@transferwise/components 46.116.1 → 46.117.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main.css +60 -131
- package/build/prompt/InlinePrompt/InlinePrompt.js +14 -8
- package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs +15 -9
- package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
- package/build/sentimentSurface/SentimentSurface.js +6 -5
- package/build/sentimentSurface/SentimentSurface.js.map +1 -1
- package/build/sentimentSurface/SentimentSurface.mjs +6 -5
- package/build/sentimentSurface/SentimentSurface.mjs.map +1 -1
- package/build/styles/button/Button.css +17 -17
- package/build/styles/button/Button.vars.css +16 -16
- package/build/styles/iconButton/IconButton.css +8 -8
- package/build/styles/link/Link.css +1 -0
- package/build/styles/main.css +60 -131
- package/build/styles/prompt/InlinePrompt/InlinePrompt.css +26 -105
- package/build/styles/sentimentSurface/SentimentSurface.css +8 -1
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts +19 -3
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
- package/build/types/sentimentSurface/SentimentSurface.d.ts +5 -4
- package/build/types/sentimentSurface/SentimentSurface.d.ts.map +1 -1
- package/build/types/sentimentSurface/SentimentSurface.types.d.ts +4 -16
- package/build/types/sentimentSurface/SentimentSurface.types.d.ts.map +1 -1
- package/build/types/test-utils/story-config.d.ts +24 -0
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/package.json +12 -11
- package/src/button/Button.css +17 -17
- package/src/button/Button.less +1 -1
- package/src/button/Button.story.tsx +75 -110
- package/src/button/Button.tests.story.tsx +189 -0
- package/src/button/Button.vars.css +16 -16
- package/src/button/Button.vars.less +58 -18
- package/src/iconButton/IconButton.css +8 -8
- package/src/iconButton/IconButton.less +35 -4
- package/src/iconButton/IconButton.story.tsx +72 -3
- package/src/link/Link.css +1 -0
- package/src/link/Link.less +1 -0
- package/src/link/Link.story.tsx +28 -0
- package/src/main.css +60 -131
- package/src/prompt/InlinePrompt/InlinePrompt.css +26 -105
- package/src/prompt/InlinePrompt/InlinePrompt.less +31 -119
- package/src/prompt/InlinePrompt/InlinePrompt.spec.tsx +87 -29
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +223 -31
- package/src/prompt/InlinePrompt/InlinePrompt.tsx +42 -11
- package/src/sentimentSurface/SentimentSurface.css +8 -1
- package/src/sentimentSurface/SentimentSurface.docs.mdx +32 -495
- package/src/sentimentSurface/SentimentSurface.less +121 -114
- package/src/sentimentSurface/SentimentSurface.spec.tsx +31 -11
- package/src/sentimentSurface/SentimentSurface.story.tsx +323 -108
- package/src/sentimentSurface/SentimentSurface.tests.story.tsx +90 -40
- package/src/sentimentSurface/SentimentSurface.tsx +16 -9
- package/src/sentimentSurface/SentimentSurface.types.ts +5 -20
- package/src/test-utils/story-config.ts +0 -1
- package/build/sentimentSurface/classMap.js +0 -17
- package/build/sentimentSurface/classMap.js.map +0 -1
- package/build/sentimentSurface/classMap.mjs +0 -14
- package/build/sentimentSurface/classMap.mjs.map +0 -1
- package/build/types/sentimentSurface/classMap.d.ts +0 -4
- package/build/types/sentimentSurface/classMap.d.ts.map +0 -1
- package/src/sentimentSurface/classMap.ts +0 -15
|
@@ -5,21 +5,21 @@ import {
|
|
|
5
5
|
SentimentSurfaceComponentProps,
|
|
6
6
|
SentimentSurfaceComponent,
|
|
7
7
|
} from './SentimentSurface.types';
|
|
8
|
-
import { getSentimentSurfaceClassName } from './classMap';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
|
-
* SentimentSurface is a polymorphic container component that
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* SentimentSurface is a polymorphic container component that exposes and, optionally, applies
|
|
11
|
+
* contextual colour tokens as CSS custom properties, based on sentiment types (`negative`,
|
|
12
|
+
* `warning`, `neutral`, `success`, `proposition`).
|
|
14
13
|
*
|
|
15
14
|
* @param {ElementType} [as='div'] - Optional prop to override the HTML element rendered.
|
|
16
15
|
* @param {Sentiment} sentiment - Required prop to set the sentiment type (negative, warning, neutral, success, proposition).
|
|
17
16
|
* @param {Emphasis} [emphasis='base'] - Optional prop to specify the emphasis level (base or elevated).
|
|
17
|
+
* @param {boolean} [hasBaseStyles=true] - If true, sets the `background-color` and `color` on the container. Otherwise, only exposes the tokens as CSS custom properties without rendering.
|
|
18
18
|
* @param {ReactNode} [children] - Content to render inside the surface.
|
|
19
19
|
* @param {string} [className] - Additional CSS classes to apply.
|
|
20
20
|
* @param {CSSProperties} [style] - Inline styles to apply.
|
|
21
21
|
* @param {string} [id] - Unique identifier for the component.
|
|
22
|
-
* @param {string} [
|
|
22
|
+
* @param {string} [data-testid] - A unique string that appears as data attribute `data-testid` in the rendered code.
|
|
23
23
|
*
|
|
24
24
|
* @component
|
|
25
25
|
* @example
|
|
@@ -41,21 +41,28 @@ const SentimentSurface: SentimentSurfaceComponent = forwardRef(function Sentimen
|
|
|
41
41
|
as,
|
|
42
42
|
sentiment,
|
|
43
43
|
emphasis = 'base',
|
|
44
|
-
|
|
44
|
+
hasBaseStyles = true,
|
|
45
45
|
style,
|
|
46
|
+
className,
|
|
46
47
|
children,
|
|
47
48
|
id,
|
|
48
|
-
|
|
49
|
+
'data-testid': dataTestId,
|
|
49
50
|
...props
|
|
50
51
|
}: SentimentSurfaceComponentProps<T>,
|
|
51
52
|
ref: ForwardedRef<HTMLElement>,
|
|
52
53
|
) {
|
|
53
54
|
const Element = as ?? 'div';
|
|
54
|
-
const
|
|
55
|
+
const BASE_CLASS = 'wds-sentiment-surface';
|
|
56
|
+
const classNames = clsx(
|
|
57
|
+
BASE_CLASS,
|
|
58
|
+
`${BASE_CLASS}-${sentiment}-${emphasis}`,
|
|
59
|
+
hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`,
|
|
60
|
+
className,
|
|
61
|
+
);
|
|
55
62
|
const sentimentProps = {
|
|
56
63
|
ref,
|
|
57
64
|
id,
|
|
58
|
-
'data-testid':
|
|
65
|
+
'data-testid': dataTestId,
|
|
59
66
|
className: classNames,
|
|
60
67
|
style,
|
|
61
68
|
...props,
|
|
@@ -32,35 +32,20 @@ export interface CommonProps {
|
|
|
32
32
|
emphasis?: Emphasis;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* If true, sets the `background-color` and `color` on the container. Otherwise, only exposes the tokens as CSS custom properties without rendering.
|
|
36
|
+
* @default true
|
|
36
37
|
*/
|
|
37
|
-
|
|
38
|
+
hasBaseStyles?: boolean;
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
* Additional CSS classes
|
|
41
|
-
*/
|
|
40
|
+
children?: ReactNode;
|
|
42
41
|
className?: string;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Inline styles
|
|
46
|
-
*/
|
|
47
42
|
style?: CSSProperties;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Unique identifier for the component
|
|
51
|
-
*/
|
|
52
43
|
id?: string;
|
|
53
44
|
|
|
54
45
|
/**
|
|
55
46
|
* A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
56
47
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* `data-testid` is strictly controlled through the `testId` prop.
|
|
61
|
-
* This lets consumers know that this data attribute will not be applied.
|
|
62
|
-
*/
|
|
63
|
-
'data-testid'?: never;
|
|
48
|
+
'data-testid'?: string;
|
|
64
49
|
}
|
|
65
50
|
|
|
66
51
|
/**
|
|
@@ -53,7 +53,6 @@ const getViewportWidth = (viewport: (typeof viewports)[keyof typeof viewports])
|
|
|
53
53
|
* The key to 'Large mobile' viewport {@link viewports.mobile2}
|
|
54
54
|
*/
|
|
55
55
|
const mobileViewportKey = 'mobile2';
|
|
56
|
-
// @ts-expect-error viewports has mobile2 property (comes from ...MINIMAL_VIEWPORTS)
|
|
57
56
|
const mobileViewportWidth = getViewportWidth(viewports.mobile2);
|
|
58
57
|
|
|
59
58
|
const zoom400perViewportKey = 'mobile3';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const BASE_CLASS = 'wds-sentiment-surface';
|
|
4
|
-
const sentimentClassMap = {
|
|
5
|
-
negative: `${BASE_CLASS}-negative`,
|
|
6
|
-
warning: `${BASE_CLASS}-warning`,
|
|
7
|
-
neutral: `${BASE_CLASS}-neutral`,
|
|
8
|
-
success: `${BASE_CLASS}-success`,
|
|
9
|
-
proposition: `${BASE_CLASS}-proposition`
|
|
10
|
-
};
|
|
11
|
-
const getSentimentSurfaceClassName = (sentiment, emphasis) => {
|
|
12
|
-
return `${BASE_CLASS} ${sentimentClassMap[sentiment]}-${emphasis}`;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
exports.getSentimentSurfaceClassName = getSentimentSurfaceClassName;
|
|
16
|
-
exports.sentimentClassMap = sentimentClassMap;
|
|
17
|
-
//# sourceMappingURL=classMap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classMap.js","sources":["../../src/sentimentSurface/classMap.ts"],"sourcesContent":["import type { Sentiment, Emphasis } from './SentimentSurface.types';\n\nconst BASE_CLASS = 'wds-sentiment-surface';\n\nexport const sentimentClassMap: Record<Sentiment, string> = {\n negative: `${BASE_CLASS}-negative`,\n warning: `${BASE_CLASS}-warning`,\n neutral: `${BASE_CLASS}-neutral`,\n success: `${BASE_CLASS}-success`,\n proposition: `${BASE_CLASS}-proposition`,\n};\n\nexport const getSentimentSurfaceClassName = (sentiment: Sentiment, emphasis: Emphasis): string => {\n return `${BASE_CLASS} ${sentimentClassMap[sentiment]}-${emphasis}`;\n};\n"],"names":["BASE_CLASS","sentimentClassMap","negative","warning","neutral","success","proposition","getSentimentSurfaceClassName","sentiment","emphasis"],"mappings":";;AAEA,MAAMA,UAAU,GAAG,uBAAuB;AAEnC,MAAMC,iBAAiB,GAA8B;EAC1DC,QAAQ,EAAE,CAAA,EAAGF,UAAU,CAAA,SAAA,CAAW;EAClCG,OAAO,EAAE,CAAA,EAAGH,UAAU,CAAA,QAAA,CAAU;EAChCI,OAAO,EAAE,CAAA,EAAGJ,UAAU,CAAA,QAAA,CAAU;EAChCK,OAAO,EAAE,CAAA,EAAGL,UAAU,CAAA,QAAA,CAAU;EAChCM,WAAW,EAAE,GAAGN,UAAU,CAAA,YAAA;;MAGfO,4BAA4B,GAAGA,CAACC,SAAoB,EAAEC,QAAkB,KAAY;EAC/F,OAAO,CAAA,EAAGT,UAAU,CAAA,CAAA,EAAIC,iBAAiB,CAACO,SAAS,CAAC,CAAA,CAAA,EAAIC,QAAQ,CAAA,CAAE;AACpE;;;;;"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const BASE_CLASS = 'wds-sentiment-surface';
|
|
2
|
-
const sentimentClassMap = {
|
|
3
|
-
negative: `${BASE_CLASS}-negative`,
|
|
4
|
-
warning: `${BASE_CLASS}-warning`,
|
|
5
|
-
neutral: `${BASE_CLASS}-neutral`,
|
|
6
|
-
success: `${BASE_CLASS}-success`,
|
|
7
|
-
proposition: `${BASE_CLASS}-proposition`
|
|
8
|
-
};
|
|
9
|
-
const getSentimentSurfaceClassName = (sentiment, emphasis) => {
|
|
10
|
-
return `${BASE_CLASS} ${sentimentClassMap[sentiment]}-${emphasis}`;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export { getSentimentSurfaceClassName, sentimentClassMap };
|
|
14
|
-
//# sourceMappingURL=classMap.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classMap.mjs","sources":["../../src/sentimentSurface/classMap.ts"],"sourcesContent":["import type { Sentiment, Emphasis } from './SentimentSurface.types';\n\nconst BASE_CLASS = 'wds-sentiment-surface';\n\nexport const sentimentClassMap: Record<Sentiment, string> = {\n negative: `${BASE_CLASS}-negative`,\n warning: `${BASE_CLASS}-warning`,\n neutral: `${BASE_CLASS}-neutral`,\n success: `${BASE_CLASS}-success`,\n proposition: `${BASE_CLASS}-proposition`,\n};\n\nexport const getSentimentSurfaceClassName = (sentiment: Sentiment, emphasis: Emphasis): string => {\n return `${BASE_CLASS} ${sentimentClassMap[sentiment]}-${emphasis}`;\n};\n"],"names":["BASE_CLASS","sentimentClassMap","negative","warning","neutral","success","proposition","getSentimentSurfaceClassName","sentiment","emphasis"],"mappings":"AAEA,MAAMA,UAAU,GAAG,uBAAuB;AAEnC,MAAMC,iBAAiB,GAA8B;EAC1DC,QAAQ,EAAE,CAAA,EAAGF,UAAU,CAAA,SAAA,CAAW;EAClCG,OAAO,EAAE,CAAA,EAAGH,UAAU,CAAA,QAAA,CAAU;EAChCI,OAAO,EAAE,CAAA,EAAGJ,UAAU,CAAA,QAAA,CAAU;EAChCK,OAAO,EAAE,CAAA,EAAGL,UAAU,CAAA,QAAA,CAAU;EAChCM,WAAW,EAAE,GAAGN,UAAU,CAAA,YAAA;;MAGfO,4BAA4B,GAAGA,CAACC,SAAoB,EAAEC,QAAkB,KAAY;EAC/F,OAAO,CAAA,EAAGT,UAAU,CAAA,CAAA,EAAIC,iBAAiB,CAACO,SAAS,CAAC,CAAA,CAAA,EAAIC,QAAQ,CAAA,CAAE;AACpE;;;;"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Sentiment, Emphasis } from './SentimentSurface.types';
|
|
2
|
-
export declare const sentimentClassMap: Record<Sentiment, string>;
|
|
3
|
-
export declare const getSentimentSurfaceClassName: (sentiment: Sentiment, emphasis: Emphasis) => string;
|
|
4
|
-
//# sourceMappingURL=classMap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classMap.d.ts","sourceRoot":"","sources":["../../../src/sentimentSurface/classMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIpE,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAMvD,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,WAAW,SAAS,EAAE,UAAU,QAAQ,KAAG,MAEvF,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Sentiment, Emphasis } from './SentimentSurface.types';
|
|
2
|
-
|
|
3
|
-
const BASE_CLASS = 'wds-sentiment-surface';
|
|
4
|
-
|
|
5
|
-
export const sentimentClassMap: Record<Sentiment, string> = {
|
|
6
|
-
negative: `${BASE_CLASS}-negative`,
|
|
7
|
-
warning: `${BASE_CLASS}-warning`,
|
|
8
|
-
neutral: `${BASE_CLASS}-neutral`,
|
|
9
|
-
success: `${BASE_CLASS}-success`,
|
|
10
|
-
proposition: `${BASE_CLASS}-proposition`,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const getSentimentSurfaceClassName = (sentiment: Sentiment, emphasis: Emphasis): string => {
|
|
14
|
-
return `${BASE_CLASS} ${sentimentClassMap[sentiment]}-${emphasis}`;
|
|
15
|
-
};
|