@transferwise/components 0.0.0-experimental-9a0f034 → 0.0.0-experimental-8b4289e
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 +8 -8
- package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
- package/build/styles/iconButton/IconButton.css +8 -8
- package/build/styles/main.css +8 -8
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts +18 -2
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/iconButton/IconButton.css +8 -8
- package/src/iconButton/IconButton.less +4 -35
- package/src/iconButton/IconButton.story.tsx +3 -72
- package/src/main.css +8 -8
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +203 -42
- package/src/prompt/InlinePrompt/InlinePrompt.tsx +18 -2
package/build/main.css
CHANGED
|
@@ -1026,17 +1026,17 @@
|
|
|
1026
1026
|
background-color: var(--color-background-neutral-active);
|
|
1027
1027
|
}
|
|
1028
1028
|
.np-icon-button-primary-default {
|
|
1029
|
-
color: var(--color-
|
|
1029
|
+
color: var(--color-interactive-control);
|
|
1030
1030
|
background-color: #00a2dd;
|
|
1031
|
-
background-color: var(--color-
|
|
1031
|
+
background-color: var(--color-interactive-accent);
|
|
1032
1032
|
}
|
|
1033
1033
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):hover {
|
|
1034
1034
|
background-color: #008fc9;
|
|
1035
|
-
background-color: var(--color-
|
|
1035
|
+
background-color: var(--color-interactive-accent-hover);
|
|
1036
1036
|
}
|
|
1037
1037
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):active {
|
|
1038
1038
|
background-color: #0081ba;
|
|
1039
|
-
background-color: var(--color-
|
|
1039
|
+
background-color: var(--color-interactive-accent-active);
|
|
1040
1040
|
}
|
|
1041
1041
|
.np-icon-button-primary-negative {
|
|
1042
1042
|
color: var(--color-contrast-overlay);
|
|
@@ -1064,14 +1064,14 @@
|
|
|
1064
1064
|
background-color: var(--color-background-screen-active);
|
|
1065
1065
|
}
|
|
1066
1066
|
.np-icon-button-secondary-default {
|
|
1067
|
-
color: var(--color-
|
|
1068
|
-
background-color: var(--color-
|
|
1067
|
+
color: var(--color-interactive-primary);
|
|
1068
|
+
background-color: var(--color-interactive-neutral);
|
|
1069
1069
|
}
|
|
1070
1070
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):hover {
|
|
1071
|
-
background-color: var(--color-
|
|
1071
|
+
background-color: var(--color-interactive-neutral-hover);
|
|
1072
1072
|
}
|
|
1073
1073
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):active {
|
|
1074
|
-
background-color: var(--color-
|
|
1074
|
+
background-color: var(--color-interactive-neutral-active);
|
|
1075
1075
|
}
|
|
1076
1076
|
.np-theme-personal--bright-green .np-icon-button-secondary-default,
|
|
1077
1077
|
.np-theme-personal--forest-green .np-icon-button-secondary-default {
|
|
@@ -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 sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n loading?: boolean;\n /**\n *
|
|
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 (media && ['proposition', 'positive'].includes(sentiment)) {\n return media;\n }\n if (sentiment === 'proposition') {\n return <GiftBox />;\n }\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" />;\n }\n if (loading) {\n return <ProcessIndicator data-testid=\"InlinePrompt_ProcessIndicator\" size=\"xxs\" />;\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","includes","_jsx","GiftBox","BackslashCircle","size","ProcessIndicator","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,IAAIJ,KAAK,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAACK,QAAQ,CAACZ,WAAS,CAAC,EAAE;AAC5D,MAAA,OAAOO,KAAK;AACd,IAAA;IACA,IAAIP,WAAS,KAAK,aAAa,EAAE;AAC/B,MAAA,oBAAOa,cAAA,CAACC,aAAO,EAAA,GAAG;AACpB,IAAA;AACA,IAAA,IAAIX,KAAK,EAAE;MACT,oBAAOU,cAAA,CAACE,qBAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAA,EAAY;AAAoB,QAAG;AACvE,IAAA;AACA,IAAA,IAAIZ,OAAO,EAAE;MACX,oBAAOS,cAAA,CAACI,wBAAgB,EAAA;AAAC,QAAA,aAAA,EAAY,+BAA+B;AAACD,QAAAA,IAAI,EAAC;AAAK,OAAA,CAAG;AACpF,IAAA;IACA,oBAAOH,cAAA,CAACK,kBAAU,EAAA;AAACF,MAAAA,IAAI,EAAE,EAAG;AAAChB,MAAAA,SAAS,EAAEA;AAAU,MAAG;EACvD,CAAC;EAED,oBACEmB,eAAA,CAACC,wBAAgB,EAAA;AACfpB,IAAAA,SAAS,EAAEU,gBAAiB;AAC5B,IAAA,aAAA,EAAaF,UAAW;IACxBH,SAAS,EAAEgB,SAAI,CACb,mBAAmB,EACnB,CAAA,mBAAA,EAAsBrB,WAAS,EAAE,EACjC;AACE,MAAA,0BAA0B,EAAEG,KAAK;AACjC,MAAA,4BAA4B,EAAEC;KAC/B,EACDC,SAAS,CACT;AAAA,IAAA,GACEI,IAAI;AAAAH,IAAAA,QAAA,gBAERO,cAAA,CAAA,KAAA,EAAA;AAAKR,MAAAA,SAAS,EAAC,kCAAkC;MAAAC,QAAA,EAAEK,WAAW;AAAE,KAAM,CACtE,eAAAE,cAAA,CAACS,YAAI,EAAA;AAAAhB,MAAAA,QAAA,EAAEA;AAAQ,KAAO,CACxB;AAAA,GAAkB,CAAC;AAEvB;;;;"}
|
|
@@ -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 sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n loading?: boolean;\n /**\n *
|
|
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 (media && ['proposition', 'positive'].includes(sentiment)) {\n return media;\n }\n if (sentiment === 'proposition') {\n return <GiftBox />;\n }\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" />;\n }\n if (loading) {\n return <ProcessIndicator data-testid=\"InlinePrompt_ProcessIndicator\" size=\"xxs\" />;\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","includes","_jsx","GiftBox","BackslashCircle","size","ProcessIndicator","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,IAAIJ,KAAK,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAACK,QAAQ,CAACZ,SAAS,CAAC,EAAE;AAC5D,MAAA,OAAOO,KAAK;AACd,IAAA;IACA,IAAIP,SAAS,KAAK,aAAa,EAAE;AAC/B,MAAA,oBAAOa,GAAA,CAACC,OAAO,EAAA,GAAG;AACpB,IAAA;AACA,IAAA,IAAIX,KAAK,EAAE;MACT,oBAAOU,GAAA,CAACE,eAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAA,EAAY;AAAoB,QAAG;AACvE,IAAA;AACA,IAAA,IAAIZ,OAAO,EAAE;MACX,oBAAOS,GAAA,CAACI,gBAAgB,EAAA;AAAC,QAAA,aAAA,EAAY,+BAA+B;AAACD,QAAAA,IAAI,EAAC;AAAK,OAAA,CAAG;AACpF,IAAA;IACA,oBAAOH,GAAA,CAACK,UAAU,EAAA;AAACF,MAAAA,IAAI,EAAE,EAAG;AAAChB,MAAAA,SAAS,EAAEA;AAAU,MAAG;EACvD,CAAC;EAED,oBACEmB,IAAA,CAACC,gBAAgB,EAAA;AACfpB,IAAAA,SAAS,EAAEU,gBAAiB;AAC5B,IAAA,aAAA,EAAaF,UAAW;IACxBH,SAAS,EAAEgB,IAAI,CACb,mBAAmB,EACnB,CAAA,mBAAA,EAAsBrB,SAAS,EAAE,EACjC;AACE,MAAA,0BAA0B,EAAEG,KAAK;AACjC,MAAA,4BAA4B,EAAEC;KAC/B,EACDC,SAAS,CACT;AAAA,IAAA,GACEI,IAAI;AAAAH,IAAAA,QAAA,gBAERO,GAAA,CAAA,KAAA,EAAA;AAAKR,MAAAA,SAAS,EAAC,kCAAkC;MAAAC,QAAA,EAAEK,WAAW;AAAE,KAAM,CACtE,eAAAE,GAAA,CAACS,IAAI,EAAA;AAAAhB,MAAAA,QAAA,EAAEA;AAAQ,KAAO,CACxB;AAAA,GAAkB,CAAC;AAEvB;;;;"}
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
background-color: var(--color-background-neutral-active);
|
|
14
14
|
}
|
|
15
15
|
.np-icon-button-primary-default {
|
|
16
|
-
color: var(--color-
|
|
16
|
+
color: var(--color-interactive-control);
|
|
17
17
|
background-color: #00a2dd;
|
|
18
|
-
background-color: var(--color-
|
|
18
|
+
background-color: var(--color-interactive-accent);
|
|
19
19
|
}
|
|
20
20
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):hover {
|
|
21
21
|
background-color: #008fc9;
|
|
22
|
-
background-color: var(--color-
|
|
22
|
+
background-color: var(--color-interactive-accent-hover);
|
|
23
23
|
}
|
|
24
24
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):active {
|
|
25
25
|
background-color: #0081ba;
|
|
26
|
-
background-color: var(--color-
|
|
26
|
+
background-color: var(--color-interactive-accent-active);
|
|
27
27
|
}
|
|
28
28
|
.np-icon-button-primary-negative {
|
|
29
29
|
color: var(--color-contrast-overlay);
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
background-color: var(--color-background-screen-active);
|
|
52
52
|
}
|
|
53
53
|
.np-icon-button-secondary-default {
|
|
54
|
-
color: var(--color-
|
|
55
|
-
background-color: var(--color-
|
|
54
|
+
color: var(--color-interactive-primary);
|
|
55
|
+
background-color: var(--color-interactive-neutral);
|
|
56
56
|
}
|
|
57
57
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):hover {
|
|
58
|
-
background-color: var(--color-
|
|
58
|
+
background-color: var(--color-interactive-neutral-hover);
|
|
59
59
|
}
|
|
60
60
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):active {
|
|
61
|
-
background-color: var(--color-
|
|
61
|
+
background-color: var(--color-interactive-neutral-active);
|
|
62
62
|
}
|
|
63
63
|
.np-theme-personal--bright-green .np-icon-button-secondary-default,
|
|
64
64
|
.np-theme-personal--forest-green .np-icon-button-secondary-default {
|
package/build/styles/main.css
CHANGED
|
@@ -1026,17 +1026,17 @@
|
|
|
1026
1026
|
background-color: var(--color-background-neutral-active);
|
|
1027
1027
|
}
|
|
1028
1028
|
.np-icon-button-primary-default {
|
|
1029
|
-
color: var(--color-
|
|
1029
|
+
color: var(--color-interactive-control);
|
|
1030
1030
|
background-color: #00a2dd;
|
|
1031
|
-
background-color: var(--color-
|
|
1031
|
+
background-color: var(--color-interactive-accent);
|
|
1032
1032
|
}
|
|
1033
1033
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):hover {
|
|
1034
1034
|
background-color: #008fc9;
|
|
1035
|
-
background-color: var(--color-
|
|
1035
|
+
background-color: var(--color-interactive-accent-hover);
|
|
1036
1036
|
}
|
|
1037
1037
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):active {
|
|
1038
1038
|
background-color: #0081ba;
|
|
1039
|
-
background-color: var(--color-
|
|
1039
|
+
background-color: var(--color-interactive-accent-active);
|
|
1040
1040
|
}
|
|
1041
1041
|
.np-icon-button-primary-negative {
|
|
1042
1042
|
color: var(--color-contrast-overlay);
|
|
@@ -1064,14 +1064,14 @@
|
|
|
1064
1064
|
background-color: var(--color-background-screen-active);
|
|
1065
1065
|
}
|
|
1066
1066
|
.np-icon-button-secondary-default {
|
|
1067
|
-
color: var(--color-
|
|
1068
|
-
background-color: var(--color-
|
|
1067
|
+
color: var(--color-interactive-primary);
|
|
1068
|
+
background-color: var(--color-interactive-neutral);
|
|
1069
1069
|
}
|
|
1070
1070
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):hover {
|
|
1071
|
-
background-color: var(--color-
|
|
1071
|
+
background-color: var(--color-interactive-neutral-hover);
|
|
1072
1072
|
}
|
|
1073
1073
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):active {
|
|
1074
|
-
background-color: var(--color-
|
|
1074
|
+
background-color: var(--color-interactive-neutral-active);
|
|
1075
1075
|
}
|
|
1076
1076
|
.np-theme-personal--bright-green .np-icon-button-secondary-default,
|
|
1077
1077
|
.np-theme-personal--forest-green .np-icon-button-secondary-default {
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
import { Sentiment } from '../../common';
|
|
2
2
|
export type InlinePromptProps = {
|
|
3
|
+
/**
|
|
4
|
+
* The sentiment determines the colour scheme
|
|
5
|
+
*/
|
|
3
6
|
sentiment?: `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}` | 'proposition';
|
|
7
|
+
/**
|
|
8
|
+
* Replaces the icon with a spinner while waiting for the short-lived action to finish.
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
4
11
|
loading?: boolean;
|
|
5
12
|
/**
|
|
6
|
-
*
|
|
13
|
+
* While prompts cannot be fully (visually and functionally) disabled, this prop should be enabled
|
|
14
|
+
* they are associated with actually disabled component (e.g. a disabled list item or input).
|
|
15
|
+
* @default false
|
|
7
16
|
*/
|
|
8
17
|
muted?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Icon override for `proposition` and `positive` sentiments. Unsupported for remaining ones.
|
|
20
|
+
*/
|
|
21
|
+
media?: React.ReactNode;
|
|
9
22
|
id?: string;
|
|
10
23
|
className?: string;
|
|
11
24
|
'data-testid'?: string;
|
|
12
25
|
children: React.ReactNode;
|
|
13
|
-
media?: React.ReactNode;
|
|
14
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Inline prompts appear alongside a specific component on the screen. They help the user stay
|
|
29
|
+
* informed, fix something, or get more out of what they're doing.
|
|
30
|
+
*/
|
|
15
31
|
export declare const InlinePrompt: ({ sentiment, muted, loading, className, children, media, "data-testid": dataTestId, ...rest }: InlinePromptProps) => import("react").JSX.Element;
|
|
16
32
|
//# sourceMappingURL=InlinePrompt.d.ts.map
|
|
@@ -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,SAAS,CAAC,EACN,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,EAAE,GACpF,aAAa,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB
|
|
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,gCAsCnB,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-8b4289e",
|
|
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-8b4289e",
|
|
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-8b4289e",
|
|
94
94
|
"@wise/art": "^2.24.4",
|
|
95
95
|
"@wise/components-theming": "^1.6.2",
|
|
96
96
|
"react": ">=18",
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
background-color: var(--color-background-neutral-active);
|
|
14
14
|
}
|
|
15
15
|
.np-icon-button-primary-default {
|
|
16
|
-
color: var(--color-
|
|
16
|
+
color: var(--color-interactive-control);
|
|
17
17
|
background-color: #00a2dd;
|
|
18
|
-
background-color: var(--color-
|
|
18
|
+
background-color: var(--color-interactive-accent);
|
|
19
19
|
}
|
|
20
20
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):hover {
|
|
21
21
|
background-color: #008fc9;
|
|
22
|
-
background-color: var(--color-
|
|
22
|
+
background-color: var(--color-interactive-accent-hover);
|
|
23
23
|
}
|
|
24
24
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):active {
|
|
25
25
|
background-color: #0081ba;
|
|
26
|
-
background-color: var(--color-
|
|
26
|
+
background-color: var(--color-interactive-accent-active);
|
|
27
27
|
}
|
|
28
28
|
.np-icon-button-primary-negative {
|
|
29
29
|
color: var(--color-contrast-overlay);
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
background-color: var(--color-background-screen-active);
|
|
52
52
|
}
|
|
53
53
|
.np-icon-button-secondary-default {
|
|
54
|
-
color: var(--color-
|
|
55
|
-
background-color: var(--color-
|
|
54
|
+
color: var(--color-interactive-primary);
|
|
55
|
+
background-color: var(--color-interactive-neutral);
|
|
56
56
|
}
|
|
57
57
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):hover {
|
|
58
|
-
background-color: var(--color-
|
|
58
|
+
background-color: var(--color-interactive-neutral-hover);
|
|
59
59
|
}
|
|
60
60
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):active {
|
|
61
|
-
background-color: var(--color-
|
|
61
|
+
background-color: var(--color-interactive-neutral-active);
|
|
62
62
|
}
|
|
63
63
|
.np-theme-personal--bright-green .np-icon-button-secondary-default,
|
|
64
64
|
.np-theme-personal--forest-green .np-icon-button-secondary-default {
|
|
@@ -5,21 +5,7 @@
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
&-primary-default {
|
|
8
|
-
|
|
9
|
-
background-color: var(--color-sentiment-interactive-primary, var(--color-interactive-accent));
|
|
10
|
-
|
|
11
|
-
&:not(.disabled, :disabled):hover {
|
|
12
|
-
background-color: var(
|
|
13
|
-
--color-sentiment-interactive-primary-hover,
|
|
14
|
-
var(--color-interactive-accent-hover)
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
&:not(.disabled, :disabled):active {
|
|
18
|
-
background-color: var(
|
|
19
|
-
--color-sentiment-interactive-primary-active,
|
|
20
|
-
var(--color-interactive-accent-active)
|
|
21
|
-
);
|
|
22
|
-
}
|
|
8
|
+
.colors(--color-interactive-control, --color-interactive-accent);
|
|
23
9
|
}
|
|
24
10
|
|
|
25
11
|
&-primary-negative {
|
|
@@ -36,24 +22,7 @@
|
|
|
36
22
|
}
|
|
37
23
|
|
|
38
24
|
&-secondary-default {
|
|
39
|
-
|
|
40
|
-
background-color: var(
|
|
41
|
-
--color-sentiment-interactive-secondary-neutral,
|
|
42
|
-
var(--color-interactive-neutral)
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
&:not(.disabled, :disabled):hover {
|
|
46
|
-
background-color: var(
|
|
47
|
-
--color-sentiment-interactive-secondary-neutral-hover,
|
|
48
|
-
var(--color-interactive-neutral-hover)
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
&:not(.disabled, :disabled):active {
|
|
52
|
-
background-color: var(
|
|
53
|
-
--color-sentiment-interactive-secondary-neutral-active,
|
|
54
|
-
var(--color-interactive-neutral-active)
|
|
55
|
-
);
|
|
56
|
-
}
|
|
25
|
+
.colors(--color-interactive-primary, --color-interactive-neutral);
|
|
57
26
|
|
|
58
27
|
.np-theme-personal--bright-green &,
|
|
59
28
|
.np-theme-personal--forest-green & {
|
|
@@ -77,10 +46,10 @@
|
|
|
77
46
|
background-color: var(@bg-color);
|
|
78
47
|
|
|
79
48
|
&:not(.disabled, :disabled):hover {
|
|
80
|
-
background-color
|
|
49
|
+
background-color:~"var(@{bg-color}-hover)";
|
|
81
50
|
}
|
|
82
51
|
&:not(.disabled, :disabled):active {
|
|
83
|
-
background-color
|
|
52
|
+
background-color:~"var(@{bg-color}-active)";
|
|
84
53
|
}
|
|
85
54
|
}
|
|
86
55
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-key */
|
|
1
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
3
|
import { ArrowLeft, Cross, Defrost, Edit, Menu, Plus } from '@transferwise/icons';
|
|
3
4
|
import IconButton, { Props } from './IconButton';
|
|
4
5
|
import { action } from 'storybook/actions';
|
|
5
6
|
import Body from '../body';
|
|
6
|
-
import SentimentSurface from '../sentimentSurface';
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
title: 'Actions/IconButton',
|
|
@@ -94,83 +94,14 @@ export const Basic: Story = {
|
|
|
94
94
|
>
|
|
95
95
|
{['Primary', 'Secondary', 'Tertiary', 'Minimal', 'Neg primary', 'Neg secondary'].map(
|
|
96
96
|
(variant) => (
|
|
97
|
-
<Body
|
|
98
|
-
{variant}
|
|
99
|
-
</Body>
|
|
97
|
+
<Body type="body-default-bold">{variant}</Body>
|
|
100
98
|
),
|
|
101
99
|
)}
|
|
102
100
|
{sizes.map((size) => (
|
|
103
|
-
<Template
|
|
101
|
+
<Template size={size} />
|
|
104
102
|
))}
|
|
105
103
|
<Template size={72} disabled />
|
|
106
104
|
</div>
|
|
107
105
|
);
|
|
108
106
|
},
|
|
109
107
|
};
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* `IconButton` is sentiment-aware and will automatically adjust its
|
|
113
|
-
* colours if wrapped inside the [SentimentSurface](/?path=/docs/content-sentimentsurface--docs) component
|
|
114
|
-
*/
|
|
115
|
-
export const SentimentAwareness: Story = {
|
|
116
|
-
render: () => {
|
|
117
|
-
return (
|
|
118
|
-
<>
|
|
119
|
-
{(['success', 'warning', 'negative', 'neutral', 'proposition'] as const).map(
|
|
120
|
-
(sentiment) => (
|
|
121
|
-
<SentimentSurface
|
|
122
|
-
key={sentiment}
|
|
123
|
-
sentiment={sentiment}
|
|
124
|
-
className="p-a-1 d-flex align-items-center"
|
|
125
|
-
style={{ gap: 'var(--size-8)' }}
|
|
126
|
-
>
|
|
127
|
-
<IconButton
|
|
128
|
-
size={32}
|
|
129
|
-
aria-label="Primary action"
|
|
130
|
-
priority="primary"
|
|
131
|
-
type="default"
|
|
132
|
-
onClick={action('button click')}
|
|
133
|
-
>
|
|
134
|
-
<Plus />
|
|
135
|
-
</IconButton>
|
|
136
|
-
<IconButton
|
|
137
|
-
size={32}
|
|
138
|
-
aria-label="Secondary action"
|
|
139
|
-
priority="secondary"
|
|
140
|
-
type="default"
|
|
141
|
-
onClick={action('button click')}
|
|
142
|
-
>
|
|
143
|
-
<Defrost />
|
|
144
|
-
</IconButton>
|
|
145
|
-
<IconButton
|
|
146
|
-
size={32}
|
|
147
|
-
aria-label="Disabled action"
|
|
148
|
-
priority="primary"
|
|
149
|
-
type="default"
|
|
150
|
-
disabled
|
|
151
|
-
onClick={action('button click')}
|
|
152
|
-
>
|
|
153
|
-
<Menu />
|
|
154
|
-
</IconButton>
|
|
155
|
-
</SentimentSurface>
|
|
156
|
-
),
|
|
157
|
-
)}
|
|
158
|
-
</>
|
|
159
|
-
);
|
|
160
|
-
},
|
|
161
|
-
parameters: {
|
|
162
|
-
docs: {
|
|
163
|
-
source: { type: 'dynamic' },
|
|
164
|
-
canvas: {
|
|
165
|
-
sourceState: 'hidden',
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
decorators: [
|
|
170
|
-
(Story) => (
|
|
171
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
|
|
172
|
-
<Story />
|
|
173
|
-
</div>
|
|
174
|
-
),
|
|
175
|
-
],
|
|
176
|
-
};
|
package/src/main.css
CHANGED
|
@@ -1026,17 +1026,17 @@
|
|
|
1026
1026
|
background-color: var(--color-background-neutral-active);
|
|
1027
1027
|
}
|
|
1028
1028
|
.np-icon-button-primary-default {
|
|
1029
|
-
color: var(--color-
|
|
1029
|
+
color: var(--color-interactive-control);
|
|
1030
1030
|
background-color: #00a2dd;
|
|
1031
|
-
background-color: var(--color-
|
|
1031
|
+
background-color: var(--color-interactive-accent);
|
|
1032
1032
|
}
|
|
1033
1033
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):hover {
|
|
1034
1034
|
background-color: #008fc9;
|
|
1035
|
-
background-color: var(--color-
|
|
1035
|
+
background-color: var(--color-interactive-accent-hover);
|
|
1036
1036
|
}
|
|
1037
1037
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):active {
|
|
1038
1038
|
background-color: #0081ba;
|
|
1039
|
-
background-color: var(--color-
|
|
1039
|
+
background-color: var(--color-interactive-accent-active);
|
|
1040
1040
|
}
|
|
1041
1041
|
.np-icon-button-primary-negative {
|
|
1042
1042
|
color: var(--color-contrast-overlay);
|
|
@@ -1064,14 +1064,14 @@
|
|
|
1064
1064
|
background-color: var(--color-background-screen-active);
|
|
1065
1065
|
}
|
|
1066
1066
|
.np-icon-button-secondary-default {
|
|
1067
|
-
color: var(--color-
|
|
1068
|
-
background-color: var(--color-
|
|
1067
|
+
color: var(--color-interactive-primary);
|
|
1068
|
+
background-color: var(--color-interactive-neutral);
|
|
1069
1069
|
}
|
|
1070
1070
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):hover {
|
|
1071
|
-
background-color: var(--color-
|
|
1071
|
+
background-color: var(--color-interactive-neutral-hover);
|
|
1072
1072
|
}
|
|
1073
1073
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):active {
|
|
1074
|
-
background-color: var(--color-
|
|
1074
|
+
background-color: var(--color-interactive-neutral-active);
|
|
1075
1075
|
}
|
|
1076
1076
|
.np-theme-personal--bright-green .np-icon-button-secondary-default,
|
|
1077
1077
|
.np-theme-personal--forest-green .np-icon-button-secondary-default {
|
|
@@ -1,11 +1,34 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
1
2
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { Taxi, Travel } from '@transferwise/icons';
|
|
4
|
+
import { lorem5 } from '../../test-utils';
|
|
5
|
+
import Link from '../../link';
|
|
6
|
+
import { InlinePrompt, InlinePromptProps } from './InlinePrompt';
|
|
5
7
|
|
|
6
|
-
const
|
|
8
|
+
const withComponentGrid =
|
|
9
|
+
({ maxWidth = 'auto', gap = '1rem' } = {}) =>
|
|
10
|
+
(Story: () => ReactElement) => (
|
|
11
|
+
<div
|
|
12
|
+
style={{
|
|
13
|
+
width: '100%',
|
|
14
|
+
display: 'flex',
|
|
15
|
+
flexDirection: 'column',
|
|
16
|
+
gap,
|
|
17
|
+
maxWidth,
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
<Story />
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export default {
|
|
7
25
|
title: 'Internal/InlinePrompt',
|
|
8
26
|
component: InlinePrompt,
|
|
27
|
+
args: {
|
|
28
|
+
loading: false,
|
|
29
|
+
muted: false,
|
|
30
|
+
children: lorem5,
|
|
31
|
+
},
|
|
9
32
|
argTypes: {
|
|
10
33
|
sentiment: {
|
|
11
34
|
control: 'select',
|
|
@@ -19,52 +42,190 @@ const meta: Meta<typeof InlinePrompt> = {
|
|
|
19
42
|
},
|
|
20
43
|
children: {
|
|
21
44
|
control: 'text',
|
|
45
|
+
table: {
|
|
46
|
+
type: { summary: 'ReactNode' },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
parameters: {
|
|
51
|
+
docs: {
|
|
52
|
+
toc: true,
|
|
22
53
|
},
|
|
23
54
|
},
|
|
55
|
+
} satisfies Meta<InlinePromptProps>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Convenience controls for previewing rich markup,
|
|
59
|
+
* not otherwise possible via Storybook
|
|
60
|
+
*/
|
|
61
|
+
type PreviewStoryArgs = InlinePromptProps & {
|
|
62
|
+
previewMedia: InlinePromptProps['media'];
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const previewArgGroup = {
|
|
66
|
+
category: 'Storybook Preview options',
|
|
67
|
+
type: {
|
|
68
|
+
summary: undefined,
|
|
69
|
+
},
|
|
24
70
|
};
|
|
25
71
|
|
|
26
|
-
|
|
27
|
-
|
|
72
|
+
const previewArgTypes = {
|
|
73
|
+
previewMedia: {
|
|
74
|
+
name: 'Preview with `media`',
|
|
75
|
+
control: 'boolean',
|
|
76
|
+
mapping: {
|
|
77
|
+
false: undefined,
|
|
78
|
+
true: <Taxi />,
|
|
79
|
+
},
|
|
80
|
+
table: previewArgGroup,
|
|
81
|
+
},
|
|
82
|
+
} as const;
|
|
83
|
+
|
|
84
|
+
const getPropsForPreview = (
|
|
85
|
+
args: PreviewStoryArgs,
|
|
86
|
+
): [InlinePromptProps, Partial<InlinePromptProps>] => {
|
|
87
|
+
const { previewMedia, ...props } = args;
|
|
28
88
|
|
|
29
|
-
|
|
89
|
+
return [
|
|
90
|
+
props,
|
|
91
|
+
{
|
|
92
|
+
media: previewMedia,
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
98
|
+
tags: ['!autodocs'],
|
|
99
|
+
argTypes: previewArgTypes,
|
|
30
100
|
args: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
101
|
+
previewMedia: false,
|
|
102
|
+
},
|
|
103
|
+
render: (args: PreviewStoryArgs) => {
|
|
104
|
+
const [props, previewProps] = getPropsForPreview(args);
|
|
105
|
+
return <InlinePrompt {...props} {...previewProps} />;
|
|
35
106
|
},
|
|
36
107
|
};
|
|
37
108
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Aside from the known `neutral`, `negative`, `warning` and `positive` sentiments, `InlinePrompt` is the first of the prompts to introduce a new `proposition` sentiment, which can be used to encourage the user to take an action that might benefit them.
|
|
111
|
+
*
|
|
112
|
+
* By default, its associated icon for the prompt is `GiftBox`.
|
|
113
|
+
*/
|
|
114
|
+
export const Sentiments: StoryObj<PreviewStoryArgs> = {
|
|
115
|
+
argTypes: previewArgTypes,
|
|
116
|
+
args: {
|
|
117
|
+
previewMedia: false,
|
|
118
|
+
},
|
|
119
|
+
render: (args: PreviewStoryArgs) => {
|
|
120
|
+
const [props, previewProps] = getPropsForPreview(args);
|
|
121
|
+
return (
|
|
122
|
+
<>
|
|
123
|
+
<InlinePrompt {...props} {...previewProps} sentiment="neutral">
|
|
124
|
+
This is a neutral prompt.
|
|
125
|
+
</InlinePrompt>
|
|
126
|
+
<InlinePrompt {...props} {...previewProps} sentiment="negative">
|
|
127
|
+
This is a negative prompt.
|
|
128
|
+
</InlinePrompt>
|
|
129
|
+
<InlinePrompt {...props} {...previewProps} sentiment="warning">
|
|
130
|
+
This is a warning prompt.
|
|
131
|
+
</InlinePrompt>
|
|
132
|
+
<InlinePrompt {...props} {...previewProps} sentiment="positive">
|
|
133
|
+
This is a positive prompt.
|
|
134
|
+
</InlinePrompt>
|
|
135
|
+
<InlinePrompt {...props} {...previewProps} sentiment="proposition">
|
|
136
|
+
This is a proposition prompt.
|
|
137
|
+
</InlinePrompt>
|
|
138
|
+
</>
|
|
139
|
+
);
|
|
140
|
+
},
|
|
141
|
+
decorators: [withComponentGrid()],
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Inline prompts are also used when forms need to check something in the background, like
|
|
146
|
+
* verifying an account number is real. Turning on the loading state will replace the icon with
|
|
147
|
+
* a spinner while waiting for the check to finish.
|
|
148
|
+
*/
|
|
149
|
+
export const Loading: StoryObj<PreviewStoryArgs> = {
|
|
150
|
+
argTypes: previewArgTypes,
|
|
151
|
+
args: {
|
|
152
|
+
loading: true,
|
|
153
|
+
previewMedia: false,
|
|
154
|
+
},
|
|
155
|
+
render: (args: PreviewStoryArgs) => {
|
|
156
|
+
const [props, previewProps] = getPropsForPreview(args);
|
|
157
|
+
return <InlinePrompt {...props} {...previewProps} />;
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Inline prompt is usually associated with a different component, such as `Input` or `ListItem`.
|
|
163
|
+
* When those components are disabled, the prompt is often used to communicate to the user why they
|
|
164
|
+
* cannot interact with them. For that reason, the prompt cannot inherit the usual disabled visual
|
|
165
|
+
* style, and it must retain its interactivity. To bring these 2 components visually closer to each
|
|
166
|
+
* other, `muted` prop introduces slightly reduced opacity and luminosity as well as a special
|
|
167
|
+
* backslash circle icon.
|
|
168
|
+
*/
|
|
169
|
+
export const Muted: StoryObj<PreviewStoryArgs> = {
|
|
170
|
+
argTypes: previewArgTypes,
|
|
171
|
+
args: {
|
|
172
|
+
muted: true,
|
|
173
|
+
previewMedia: false,
|
|
174
|
+
},
|
|
175
|
+
render: (args: PreviewStoryArgs) => {
|
|
176
|
+
const [props, previewProps] = getPropsForPreview(args);
|
|
177
|
+
return <InlinePrompt {...props} {...previewProps} />;
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* While main sentiments (`warning`, `negative`, `neutral`) must retain their associated
|
|
183
|
+
* `StatusIcons`, the `positive` and `proposition` ones allow for Icon overrides to bring it
|
|
184
|
+
* closer to the prompt's content.
|
|
185
|
+
*/
|
|
186
|
+
export const IconOverrides: StoryObj<PreviewStoryArgs> = {
|
|
187
|
+
render: (args: PreviewStoryArgs) => {
|
|
188
|
+
return (
|
|
189
|
+
<>
|
|
190
|
+
<InlinePrompt {...args} media={<Travel />} sentiment="positive">
|
|
191
|
+
Your travel account is set up and ready to use.
|
|
192
|
+
</InlinePrompt>
|
|
193
|
+
<InlinePrompt {...args} media={<Taxi />} sentiment="proposition">
|
|
194
|
+
Connect Wise with your taxi app to get exclusive discounts.
|
|
195
|
+
</InlinePrompt>
|
|
196
|
+
<InlinePrompt {...args} media={<Taxi />} sentiment="negative">
|
|
197
|
+
This icon override is ignored.
|
|
198
|
+
</InlinePrompt>
|
|
199
|
+
</>
|
|
200
|
+
);
|
|
201
|
+
},
|
|
202
|
+
decorators: [withComponentGrid()],
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* When configured with any of the supported sentiments, the colour scheme of the component will propagate to all of its supported descendants, such as instances of a `Link`, `Icon`, and `StatusIcon`.
|
|
207
|
+
*/
|
|
208
|
+
export const SentimentAwareness: StoryObj<PreviewStoryArgs> = {
|
|
209
|
+
argTypes: previewArgTypes,
|
|
210
|
+
args: {
|
|
211
|
+
previewMedia: false,
|
|
212
|
+
},
|
|
213
|
+
render: (args: PreviewStoryArgs) => {
|
|
214
|
+
const [props, previewProps] = getPropsForPreview(args);
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<>
|
|
218
|
+
<InlinePrompt {...props} {...previewProps} sentiment="negative">
|
|
219
|
+
This is a negative prompt with an <Link href="#">inline link</Link>.
|
|
220
|
+
</InlinePrompt>
|
|
221
|
+
<InlinePrompt {...props} {...previewProps} sentiment="positive">
|
|
222
|
+
This is a positive prompt with an <Link href="#">inline link</Link>.
|
|
223
|
+
</InlinePrompt>
|
|
224
|
+
<InlinePrompt {...props} {...previewProps} sentiment="proposition">
|
|
225
|
+
This is a proposition prompt with an <Link href="#">inline link</Link>.
|
|
226
|
+
</InlinePrompt>
|
|
227
|
+
</>
|
|
228
|
+
);
|
|
69
229
|
},
|
|
230
|
+
decorators: [withComponentGrid()],
|
|
70
231
|
};
|
|
@@ -7,21 +7,37 @@ import Body from '../../body';
|
|
|
7
7
|
import SentimentSurface from '../../sentimentSurface';
|
|
8
8
|
|
|
9
9
|
export type InlinePromptProps = {
|
|
10
|
+
/**
|
|
11
|
+
* The sentiment determines the colour scheme
|
|
12
|
+
*/
|
|
10
13
|
sentiment?:
|
|
11
14
|
| `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`
|
|
12
15
|
| 'proposition';
|
|
16
|
+
/**
|
|
17
|
+
* Replaces the icon with a spinner while waiting for the short-lived action to finish.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
13
20
|
loading?: boolean;
|
|
14
21
|
/**
|
|
15
|
-
*
|
|
22
|
+
* While prompts cannot be fully (visually and functionally) disabled, this prop should be enabled
|
|
23
|
+
* they are associated with actually disabled component (e.g. a disabled list item or input).
|
|
24
|
+
* @default false
|
|
16
25
|
*/
|
|
17
26
|
muted?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Icon override for `proposition` and `positive` sentiments. Unsupported for remaining ones.
|
|
29
|
+
*/
|
|
30
|
+
media?: React.ReactNode;
|
|
18
31
|
id?: string;
|
|
19
32
|
className?: string;
|
|
20
33
|
'data-testid'?: string;
|
|
21
34
|
children: React.ReactNode;
|
|
22
|
-
media?: React.ReactNode;
|
|
23
35
|
};
|
|
24
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Inline prompts appear alongside a specific component on the screen. They help the user stay
|
|
39
|
+
* informed, fix something, or get more out of what they're doing.
|
|
40
|
+
*/
|
|
25
41
|
export const InlinePrompt = ({
|
|
26
42
|
sentiment = Sentiment.POSITIVE,
|
|
27
43
|
muted = false,
|