@transferwise/components 0.0.0-experimental-feef95e → 0.0.0-experimental-1bb5459
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/SentimentSurface/SentimentSurface.js +2 -1
- package/build/SentimentSurface/SentimentSurface.js.map +1 -1
- package/build/SentimentSurface/SentimentSurface.mjs +2 -1
- package/build/SentimentSurface/SentimentSurface.mjs.map +1 -1
- package/build/Tag/Tag.js +42 -0
- package/build/Tag/Tag.js.map +1 -0
- package/build/Tag/Tag.mjs +38 -0
- package/build/Tag/Tag.mjs.map +1 -0
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -0
- package/build/index.mjs.map +1 -1
- package/build/main.css +57 -809
- package/build/styles/Inputs/Input/Input.css +0 -84
- package/build/styles/Inputs/TextArea/TextArea.css +0 -84
- package/build/styles/Tag/Tag.css +35 -0
- package/build/styles/_deprecated/Select/Select.css +0 -28
- package/build/styles/css/accordion.css +0 -28
- package/build/styles/css/button-groups.css +0 -28
- package/build/styles/css/buttons.css +0 -28
- package/build/styles/css/decision.css +0 -28
- package/build/styles/css/dropdowns.css +0 -56
- package/build/styles/css/droppable.css +0 -28
- package/build/styles/css/footer.css +0 -61
- package/build/styles/css/input-groups.css +0 -183
- package/build/styles/css/navbar.css +0 -56
- package/build/styles/css/neptune-core.css +0 -179
- package/build/styles/css/neptune.css +0 -675
- package/build/styles/css/popovers.css +0 -56
- package/build/styles/css/tooltip.css +0 -28
- package/build/styles/main.css +57 -809
- package/build/styles/styles/less/accordion.css +0 -28
- package/build/styles/styles/less/button-groups.css +0 -28
- package/build/styles/styles/less/buttons.css +0 -28
- package/build/styles/styles/less/decision.css +0 -28
- package/build/styles/styles/less/dropdowns.css +0 -56
- package/build/styles/styles/less/droppable.css +0 -28
- package/build/styles/styles/less/footer.css +0 -61
- package/build/styles/styles/less/forms/bootstrap-forms.css +0 -112
- package/build/styles/styles/less/input-groups.css +0 -183
- package/build/styles/styles/less/navbar.css +0 -56
- package/build/styles/styles/less/neptune-core.css +0 -179
- package/build/styles/styles/less/neptune.css +0 -675
- package/build/styles/styles/less/popovers.css +0 -56
- package/build/styles/styles/less/tooltip.css +0 -28
- package/build/types/SentimentSurface/SentimentSurface.d.ts +1 -0
- package/build/types/SentimentSurface/SentimentSurface.d.ts.map +1 -1
- package/build/types/SentimentSurface/SentimentSurface.types.d.ts +9 -0
- package/build/types/SentimentSurface/SentimentSurface.types.d.ts.map +1 -1
- package/build/types/SentimentSurface/index.d.ts +1 -1
- package/build/types/SentimentSurface/index.d.ts.map +1 -1
- package/build/types/Tag/Tag.d.ts +24 -0
- package/build/types/Tag/Tag.d.ts.map +1 -0
- package/build/types/Tag/Tag.types.d.ts +39 -0
- package/build/types/Tag/Tag.types.d.ts.map +1 -0
- package/build/types/Tag/index.d.ts +3 -0
- package/build/types/Tag/index.d.ts.map +1 -0
- package/build/types/index.d.ts +3 -1
- package/build/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Inputs/Input/Input.css +0 -84
- package/src/Inputs/TextArea/TextArea.css +0 -84
- package/src/SentimentSurface/SentimentSurface.test.tsx +24 -0
- package/src/SentimentSurface/SentimentSurface.tsx +3 -1
- package/src/SentimentSurface/SentimentSurface.types.ts +11 -0
- package/src/SentimentSurface/_stories/SentimentSurface.story.tsx +10 -0
- package/src/SentimentSurface/index.ts +1 -0
- package/src/Tag/Tag.css +35 -0
- package/src/Tag/Tag.less +35 -0
- package/src/Tag/Tag.test.tsx +72 -0
- package/src/Tag/Tag.tsx +60 -0
- package/src/Tag/Tag.types.ts +46 -0
- package/src/Tag/_stories/Tag.story.tsx +245 -0
- package/src/Tag/_stories/Tag.test.story.tsx +120 -0
- package/src/Tag/index.ts +2 -0
- package/src/_deprecated/Select/Select.css +0 -28
- package/src/index.ts +3 -0
- package/src/main.css +57 -809
- package/src/main.less +1 -0
- package/src/styles/less/accordion.css +0 -28
- package/src/styles/less/button-groups.css +0 -28
- package/src/styles/less/buttons.css +0 -28
- package/src/styles/less/core/_typography.less +0 -12
- package/src/styles/less/decision.css +0 -28
- package/src/styles/less/dropdowns.css +0 -56
- package/src/styles/less/droppable.css +0 -28
- package/src/styles/less/footer.css +0 -61
- package/src/styles/less/forms/bootstrap-forms.css +0 -112
- package/src/styles/less/input-groups.css +0 -183
- package/src/styles/less/navbar.css +0 -56
- package/src/styles/less/neptune-core.css +0 -179
- package/src/styles/less/neptune.css +0 -675
- package/src/styles/less/popovers.css +0 -56
- package/src/styles/less/tooltip.css +0 -28
- package/src/test-utils/assets/card-payment-bakery.webp +0 -0
|
@@ -12,6 +12,7 @@ const SentimentSurface = /*#__PURE__*/React.forwardRef(function SentimentSurface
|
|
|
12
12
|
sentiment,
|
|
13
13
|
emphasis = 'base',
|
|
14
14
|
hasBaseStyles = true,
|
|
15
|
+
colourScheme,
|
|
15
16
|
style,
|
|
16
17
|
className,
|
|
17
18
|
children,
|
|
@@ -31,7 +32,7 @@ const SentimentSurface = /*#__PURE__*/React.forwardRef(function SentimentSurface
|
|
|
31
32
|
const isPlatform = theme.includes('platform');
|
|
32
33
|
return isForestGreen || isDark && !isPlatform ? 'dark' : 'light';
|
|
33
34
|
};
|
|
34
|
-
const classNames = clsx.clsx(closestBrandTheme, BASE_CLASS, `wds-sentiment-${sentiment}-${getThemeBrightness()}-${emphasis}`, hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`, className);
|
|
35
|
+
const classNames = clsx.clsx(closestBrandTheme, BASE_CLASS, `wds-sentiment-${sentiment}-${colourScheme ?? getThemeBrightness()}-${emphasis}`, hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`, className);
|
|
35
36
|
const sentimentProps = {
|
|
36
37
|
ref,
|
|
37
38
|
id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentimentSurface.js","sources":["../../src/SentimentSurface/SentimentSurface.tsx"],"sourcesContent":["import { forwardRef, ElementType, ForwardedRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport {\n SentimentSurfaceComponentProps,\n SentimentSurfaceComponent,\n} from './SentimentSurface.types';\nimport { useTheme } from '@wise/components-theming';\n\n/**\n * SentimentSurface is a polymorphic container component that exposes and, optionally, applies\n * contextual colour tokens as CSS custom properties, based on sentiment types (`negative`,\n * `warning`, `neutral`, `success`, `proposition`).\n *\n * @param {ElementType} [as='div'] - Optional prop to override the HTML element rendered.\n * @param {Sentiment} sentiment - Required prop to set the sentiment type (negative, warning, neutral, success, proposition).\n * @param {Emphasis} [emphasis='base'] - Optional prop to specify the emphasis level (base or elevated).\n * @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.\n * @param {ReactNode} [children] - Content to render inside the surface.\n * @param {string} [className] - Additional CSS classes to apply.\n * @param {CSSProperties} [style] - Inline styles to apply.\n * @param {string} [id] - Unique identifier for the component.\n * @param {string} [data-testid] - A unique string that appears as data attribute `data-testid` in the rendered code.\n *\n * @component\n * @example\n * ```tsx\n * // Basic usage with negative sentiment\n * <SentimentSurface sentiment=\"negative\">\n * Your payment has failed\n * </SentimentSurface>\n * ```\n *\n * @see {@link SentimentSurface} for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/sentiment-surface--docs|Storybook Wise Design}\n */\n// @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\nconst SentimentSurface: SentimentSurfaceComponent = forwardRef(function SentimentSurface<\n T extends ElementType = 'div',\n>(\n {\n as,\n sentiment,\n emphasis = 'base',\n hasBaseStyles = true,\n style,\n className,\n children,\n id,\n 'data-testid': dataTestId,\n ...props\n }: SentimentSurfaceComponentProps<T>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const Element = as ?? 'div';\n const BASE_CLASS = 'wds-sentiment-surface';\n const { className: closestBrandTheme, isScreenModeDark: isDark, theme } = useTheme();\n\n const getThemeBrightness = () => {\n const isForestGreen = theme.includes('forest-green');\n const isPlatform = theme.includes('platform');\n\n return isForestGreen || (isDark && !isPlatform) ? 'dark' : 'light';\n };\n\n const classNames = clsx(\n closestBrandTheme,\n BASE_CLASS,\n `wds-sentiment-${sentiment}-${getThemeBrightness()}-${emphasis}`,\n hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`,\n className,\n );\n const sentimentProps = {\n ref,\n id,\n 'data-testid': dataTestId,\n className: classNames,\n style,\n ...props,\n };\n\n return (\n // @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\n <Element {...sentimentProps}>{children}</Element>\n );\n});\n\nSentimentSurface.displayName = 'SentimentSurface';\n\nexport default SentimentSurface;\n"],"names":["SentimentSurface","forwardRef","as","sentiment","emphasis","hasBaseStyles","style","className","children","id","dataTestId","props","ref","Element","BASE_CLASS","closestBrandTheme","isScreenModeDark","isDark","theme","useTheme","getThemeBrightness","isForestGreen","includes","isPlatform","classNames","clsx","sentimentProps","_jsx","displayName"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"SentimentSurface.js","sources":["../../src/SentimentSurface/SentimentSurface.tsx"],"sourcesContent":["import { forwardRef, ElementType, ForwardedRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport {\n SentimentSurfaceComponentProps,\n SentimentSurfaceComponent,\n} from './SentimentSurface.types';\nimport { useTheme } from '@wise/components-theming';\n\n/**\n * SentimentSurface is a polymorphic container component that exposes and, optionally, applies\n * contextual colour tokens as CSS custom properties, based on sentiment types (`negative`,\n * `warning`, `neutral`, `success`, `proposition`).\n *\n * @param {ElementType} [as='div'] - Optional prop to override the HTML element rendered.\n * @param {Sentiment} sentiment - Required prop to set the sentiment type (negative, warning, neutral, success, proposition).\n * @param {Emphasis} [emphasis='base'] - Optional prop to specify the emphasis level (base or elevated).\n * @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.\n * @param {ColourScheme} [colourScheme] - Optional prop to force the colour scheme (light or dark) instead of deriving it from the closest theme.\n * @param {ReactNode} [children] - Content to render inside the surface.\n * @param {string} [className] - Additional CSS classes to apply.\n * @param {CSSProperties} [style] - Inline styles to apply.\n * @param {string} [id] - Unique identifier for the component.\n * @param {string} [data-testid] - A unique string that appears as data attribute `data-testid` in the rendered code.\n *\n * @component\n * @example\n * ```tsx\n * // Basic usage with negative sentiment\n * <SentimentSurface sentiment=\"negative\">\n * Your payment has failed\n * </SentimentSurface>\n * ```\n *\n * @see {@link SentimentSurface} for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/sentiment-surface--docs|Storybook Wise Design}\n */\n// @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\nconst SentimentSurface: SentimentSurfaceComponent = forwardRef(function SentimentSurface<\n T extends ElementType = 'div',\n>(\n {\n as,\n sentiment,\n emphasis = 'base',\n hasBaseStyles = true,\n colourScheme,\n style,\n className,\n children,\n id,\n 'data-testid': dataTestId,\n ...props\n }: SentimentSurfaceComponentProps<T>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const Element = as ?? 'div';\n const BASE_CLASS = 'wds-sentiment-surface';\n const { className: closestBrandTheme, isScreenModeDark: isDark, theme } = useTheme();\n\n const getThemeBrightness = () => {\n const isForestGreen = theme.includes('forest-green');\n const isPlatform = theme.includes('platform');\n\n return isForestGreen || (isDark && !isPlatform) ? 'dark' : 'light';\n };\n\n const classNames = clsx(\n closestBrandTheme,\n BASE_CLASS,\n `wds-sentiment-${sentiment}-${colourScheme ?? getThemeBrightness()}-${emphasis}`,\n hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`,\n className,\n );\n const sentimentProps = {\n ref,\n id,\n 'data-testid': dataTestId,\n className: classNames,\n style,\n ...props,\n };\n\n return (\n // @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\n <Element {...sentimentProps}>{children}</Element>\n );\n});\n\nSentimentSurface.displayName = 'SentimentSurface';\n\nexport default SentimentSurface;\n"],"names":["SentimentSurface","forwardRef","as","sentiment","emphasis","hasBaseStyles","colourScheme","style","className","children","id","dataTestId","props","ref","Element","BASE_CLASS","closestBrandTheme","isScreenModeDark","isDark","theme","useTheme","getThemeBrightness","isForestGreen","includes","isPlatform","classNames","clsx","sentimentProps","_jsx","displayName"],"mappings":";;;;;;;;;AAsCA,MAAMA,gBAAgB,gBAA8BC,gBAAU,CAAC,SAASD,gBAAgBA,CAGtF;EACEE,EAAE;EACFC,SAAS;AACTC,EAAAA,QAAQ,GAAG,MAAM;AACjBC,EAAAA,aAAa,GAAG,IAAI;EACpBC,YAAY;EACZC,KAAK;EACLC,SAAS;EACTC,QAAQ;EACRC,EAAE;AACF,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AAAK,CAC0B,EACpCC,GAA8B,EAAA;AAE9B,EAAA,MAAMC,OAAO,GAAGZ,EAAE,IAAI,KAAK;EAC3B,MAAMa,UAAU,GAAG,uBAAuB;EAC1C,MAAM;AAAEP,IAAAA,SAAS,EAAEQ,iBAAiB;AAAEC,IAAAA,gBAAgB,EAAEC,MAAM;AAAEC,IAAAA;GAAO,GAAGC,0BAAQ,EAAE;EAEpF,MAAMC,kBAAkB,GAAGA,MAAK;AAC9B,IAAA,MAAMC,aAAa,GAAGH,KAAK,CAACI,QAAQ,CAAC,cAAc,CAAC;AACpD,IAAA,MAAMC,UAAU,GAAGL,KAAK,CAACI,QAAQ,CAAC,UAAU,CAAC;IAE7C,OAAOD,aAAa,IAAKJ,MAAM,IAAI,CAACM,UAAW,GAAG,MAAM,GAAG,OAAO;EACpE,CAAC;EAED,MAAMC,UAAU,GAAGC,SAAI,CACrBV,iBAAiB,EACjBD,UAAU,EACV,CAAA,cAAA,EAAiBZ,SAAS,CAAA,CAAA,EAAIG,YAAY,IAAIe,kBAAkB,EAAE,CAAA,CAAA,EAAIjB,QAAQ,CAAA,CAAE,EAChFC,aAAa,IAAI,CAAA,EAAGU,UAAU,CAAA,eAAA,CAAiB,EAC/CP,SAAS,CACV;AACD,EAAA,MAAMmB,cAAc,GAAG;IACrBd,GAAG;IACHH,EAAE;AACF,IAAA,aAAa,EAAEC,UAAU;AACzBH,IAAAA,SAAS,EAAEiB,UAAU;IACrBlB,KAAK;IACL,GAAGK;GACJ;AAED,EAAA;AAAA;AACE;AACAgB,IAAAA,cAAA,CAACd,OAAO,EAAA;AAAA,MAAA,GAAKa,cAAc;AAAAlB,MAAAA,QAAA,EAAGA;KAAkB;AAAC;AAErD,CAAC;AAEDT,gBAAgB,CAAC6B,WAAW,GAAG,kBAAkB;;;;"}
|
|
@@ -8,6 +8,7 @@ const SentimentSurface = /*#__PURE__*/forwardRef(function SentimentSurface({
|
|
|
8
8
|
sentiment,
|
|
9
9
|
emphasis = 'base',
|
|
10
10
|
hasBaseStyles = true,
|
|
11
|
+
colourScheme,
|
|
11
12
|
style,
|
|
12
13
|
className,
|
|
13
14
|
children,
|
|
@@ -27,7 +28,7 @@ const SentimentSurface = /*#__PURE__*/forwardRef(function SentimentSurface({
|
|
|
27
28
|
const isPlatform = theme.includes('platform');
|
|
28
29
|
return isForestGreen || isDark && !isPlatform ? 'dark' : 'light';
|
|
29
30
|
};
|
|
30
|
-
const classNames = clsx(closestBrandTheme, BASE_CLASS, `wds-sentiment-${sentiment}-${getThemeBrightness()}-${emphasis}`, hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`, className);
|
|
31
|
+
const classNames = clsx(closestBrandTheme, BASE_CLASS, `wds-sentiment-${sentiment}-${colourScheme ?? getThemeBrightness()}-${emphasis}`, hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`, className);
|
|
31
32
|
const sentimentProps = {
|
|
32
33
|
ref,
|
|
33
34
|
id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentimentSurface.mjs","sources":["../../src/SentimentSurface/SentimentSurface.tsx"],"sourcesContent":["import { forwardRef, ElementType, ForwardedRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport {\n SentimentSurfaceComponentProps,\n SentimentSurfaceComponent,\n} from './SentimentSurface.types';\nimport { useTheme } from '@wise/components-theming';\n\n/**\n * SentimentSurface is a polymorphic container component that exposes and, optionally, applies\n * contextual colour tokens as CSS custom properties, based on sentiment types (`negative`,\n * `warning`, `neutral`, `success`, `proposition`).\n *\n * @param {ElementType} [as='div'] - Optional prop to override the HTML element rendered.\n * @param {Sentiment} sentiment - Required prop to set the sentiment type (negative, warning, neutral, success, proposition).\n * @param {Emphasis} [emphasis='base'] - Optional prop to specify the emphasis level (base or elevated).\n * @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.\n * @param {ReactNode} [children] - Content to render inside the surface.\n * @param {string} [className] - Additional CSS classes to apply.\n * @param {CSSProperties} [style] - Inline styles to apply.\n * @param {string} [id] - Unique identifier for the component.\n * @param {string} [data-testid] - A unique string that appears as data attribute `data-testid` in the rendered code.\n *\n * @component\n * @example\n * ```tsx\n * // Basic usage with negative sentiment\n * <SentimentSurface sentiment=\"negative\">\n * Your payment has failed\n * </SentimentSurface>\n * ```\n *\n * @see {@link SentimentSurface} for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/sentiment-surface--docs|Storybook Wise Design}\n */\n// @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\nconst SentimentSurface: SentimentSurfaceComponent = forwardRef(function SentimentSurface<\n T extends ElementType = 'div',\n>(\n {\n as,\n sentiment,\n emphasis = 'base',\n hasBaseStyles = true,\n style,\n className,\n children,\n id,\n 'data-testid': dataTestId,\n ...props\n }: SentimentSurfaceComponentProps<T>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const Element = as ?? 'div';\n const BASE_CLASS = 'wds-sentiment-surface';\n const { className: closestBrandTheme, isScreenModeDark: isDark, theme } = useTheme();\n\n const getThemeBrightness = () => {\n const isForestGreen = theme.includes('forest-green');\n const isPlatform = theme.includes('platform');\n\n return isForestGreen || (isDark && !isPlatform) ? 'dark' : 'light';\n };\n\n const classNames = clsx(\n closestBrandTheme,\n BASE_CLASS,\n `wds-sentiment-${sentiment}-${getThemeBrightness()}-${emphasis}`,\n hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`,\n className,\n );\n const sentimentProps = {\n ref,\n id,\n 'data-testid': dataTestId,\n className: classNames,\n style,\n ...props,\n };\n\n return (\n // @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\n <Element {...sentimentProps}>{children}</Element>\n );\n});\n\nSentimentSurface.displayName = 'SentimentSurface';\n\nexport default SentimentSurface;\n"],"names":["SentimentSurface","forwardRef","as","sentiment","emphasis","hasBaseStyles","style","className","children","id","dataTestId","props","ref","Element","BASE_CLASS","closestBrandTheme","isScreenModeDark","isDark","theme","useTheme","getThemeBrightness","isForestGreen","includes","isPlatform","classNames","clsx","sentimentProps","_jsx","displayName"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"SentimentSurface.mjs","sources":["../../src/SentimentSurface/SentimentSurface.tsx"],"sourcesContent":["import { forwardRef, ElementType, ForwardedRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport {\n SentimentSurfaceComponentProps,\n SentimentSurfaceComponent,\n} from './SentimentSurface.types';\nimport { useTheme } from '@wise/components-theming';\n\n/**\n * SentimentSurface is a polymorphic container component that exposes and, optionally, applies\n * contextual colour tokens as CSS custom properties, based on sentiment types (`negative`,\n * `warning`, `neutral`, `success`, `proposition`).\n *\n * @param {ElementType} [as='div'] - Optional prop to override the HTML element rendered.\n * @param {Sentiment} sentiment - Required prop to set the sentiment type (negative, warning, neutral, success, proposition).\n * @param {Emphasis} [emphasis='base'] - Optional prop to specify the emphasis level (base or elevated).\n * @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.\n * @param {ColourScheme} [colourScheme] - Optional prop to force the colour scheme (light or dark) instead of deriving it from the closest theme.\n * @param {ReactNode} [children] - Content to render inside the surface.\n * @param {string} [className] - Additional CSS classes to apply.\n * @param {CSSProperties} [style] - Inline styles to apply.\n * @param {string} [id] - Unique identifier for the component.\n * @param {string} [data-testid] - A unique string that appears as data attribute `data-testid` in the rendered code.\n *\n * @component\n * @example\n * ```tsx\n * // Basic usage with negative sentiment\n * <SentimentSurface sentiment=\"negative\">\n * Your payment has failed\n * </SentimentSurface>\n * ```\n *\n * @see {@link SentimentSurface} for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/sentiment-surface--docs|Storybook Wise Design}\n */\n// @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\nconst SentimentSurface: SentimentSurfaceComponent = forwardRef(function SentimentSurface<\n T extends ElementType = 'div',\n>(\n {\n as,\n sentiment,\n emphasis = 'base',\n hasBaseStyles = true,\n colourScheme,\n style,\n className,\n children,\n id,\n 'data-testid': dataTestId,\n ...props\n }: SentimentSurfaceComponentProps<T>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const Element = as ?? 'div';\n const BASE_CLASS = 'wds-sentiment-surface';\n const { className: closestBrandTheme, isScreenModeDark: isDark, theme } = useTheme();\n\n const getThemeBrightness = () => {\n const isForestGreen = theme.includes('forest-green');\n const isPlatform = theme.includes('platform');\n\n return isForestGreen || (isDark && !isPlatform) ? 'dark' : 'light';\n };\n\n const classNames = clsx(\n closestBrandTheme,\n BASE_CLASS,\n `wds-sentiment-${sentiment}-${colourScheme ?? getThemeBrightness()}-${emphasis}`,\n hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`,\n className,\n );\n const sentimentProps = {\n ref,\n id,\n 'data-testid': dataTestId,\n className: classNames,\n style,\n ...props,\n };\n\n return (\n // @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\n <Element {...sentimentProps}>{children}</Element>\n );\n});\n\nSentimentSurface.displayName = 'SentimentSurface';\n\nexport default SentimentSurface;\n"],"names":["SentimentSurface","forwardRef","as","sentiment","emphasis","hasBaseStyles","colourScheme","style","className","children","id","dataTestId","props","ref","Element","BASE_CLASS","closestBrandTheme","isScreenModeDark","isDark","theme","useTheme","getThemeBrightness","isForestGreen","includes","isPlatform","classNames","clsx","sentimentProps","_jsx","displayName"],"mappings":";;;;;AAsCA,MAAMA,gBAAgB,gBAA8BC,UAAU,CAAC,SAASD,gBAAgBA,CAGtF;EACEE,EAAE;EACFC,SAAS;AACTC,EAAAA,QAAQ,GAAG,MAAM;AACjBC,EAAAA,aAAa,GAAG,IAAI;EACpBC,YAAY;EACZC,KAAK;EACLC,SAAS;EACTC,QAAQ;EACRC,EAAE;AACF,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AAAK,CAC0B,EACpCC,GAA8B,EAAA;AAE9B,EAAA,MAAMC,OAAO,GAAGZ,EAAE,IAAI,KAAK;EAC3B,MAAMa,UAAU,GAAG,uBAAuB;EAC1C,MAAM;AAAEP,IAAAA,SAAS,EAAEQ,iBAAiB;AAAEC,IAAAA,gBAAgB,EAAEC,MAAM;AAAEC,IAAAA;GAAO,GAAGC,QAAQ,EAAE;EAEpF,MAAMC,kBAAkB,GAAGA,MAAK;AAC9B,IAAA,MAAMC,aAAa,GAAGH,KAAK,CAACI,QAAQ,CAAC,cAAc,CAAC;AACpD,IAAA,MAAMC,UAAU,GAAGL,KAAK,CAACI,QAAQ,CAAC,UAAU,CAAC;IAE7C,OAAOD,aAAa,IAAKJ,MAAM,IAAI,CAACM,UAAW,GAAG,MAAM,GAAG,OAAO;EACpE,CAAC;EAED,MAAMC,UAAU,GAAGC,IAAI,CACrBV,iBAAiB,EACjBD,UAAU,EACV,CAAA,cAAA,EAAiBZ,SAAS,CAAA,CAAA,EAAIG,YAAY,IAAIe,kBAAkB,EAAE,CAAA,CAAA,EAAIjB,QAAQ,CAAA,CAAE,EAChFC,aAAa,IAAI,CAAA,EAAGU,UAAU,CAAA,eAAA,CAAiB,EAC/CP,SAAS,CACV;AACD,EAAA,MAAMmB,cAAc,GAAG;IACrBd,GAAG;IACHH,EAAE;AACF,IAAA,aAAa,EAAEC,UAAU;AACzBH,IAAAA,SAAS,EAAEiB,UAAU;IACrBlB,KAAK;IACL,GAAGK;GACJ;AAED,EAAA;AAAA;AACE;AACAgB,IAAAA,GAAA,CAACd,OAAO,EAAA;AAAA,MAAA,GAAKa,cAAc;AAAAlB,MAAAA,QAAA,EAAGA;KAAkB;AAAC;AAErD,CAAC;AAEDT,gBAAgB,CAAC6B,WAAW,GAAG,kBAAkB;;;;"}
|
package/build/Tag/Tag.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var clsx = require('clsx');
|
|
7
|
+
var Body = require('../Body/Body.js');
|
|
8
|
+
var SentimentSurface = require('../SentimentSurface/SentimentSurface.js');
|
|
9
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
|
+
|
|
11
|
+
const Tag = /*#__PURE__*/React.forwardRef(function Tag({
|
|
12
|
+
children,
|
|
13
|
+
sentiment = 'neutral',
|
|
14
|
+
size = 'small',
|
|
15
|
+
emphasis = 'base',
|
|
16
|
+
overMedia = false,
|
|
17
|
+
className,
|
|
18
|
+
id,
|
|
19
|
+
'data-testid': dataTestId
|
|
20
|
+
}, ref) {
|
|
21
|
+
return /*#__PURE__*/jsxRuntime.jsx(SentimentSurface.default
|
|
22
|
+
// @ts-expect-error - SentimentSurface forwardRef types don't expose ref in props
|
|
23
|
+
, {
|
|
24
|
+
ref: ref,
|
|
25
|
+
as: "span",
|
|
26
|
+
sentiment: sentiment,
|
|
27
|
+
emphasis: overMedia ? 'elevated' : emphasis,
|
|
28
|
+
colourScheme: overMedia ? 'dark' : undefined,
|
|
29
|
+
id: id,
|
|
30
|
+
"data-testid": dataTestId,
|
|
31
|
+
className: clsx.clsx('wds-tag', `wds-tag--${size}`, `wds-tag--${sentiment}`, className),
|
|
32
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Body.default, {
|
|
33
|
+
as: "span",
|
|
34
|
+
type: "body-default-bold",
|
|
35
|
+
className: "wds-tag__text",
|
|
36
|
+
children: children
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
exports.default = Tag;
|
|
42
|
+
//# sourceMappingURL=Tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tag.js","sources":["../../src/Tag/Tag.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport Body from '../Body';\nimport SentimentSurface from '../SentimentSurface';\nimport { TagProps } from './Tag.types';\n\n/**\n * Tag is a small, non-interactive label that categorises or highlights a piece of content.\n *\n * @param {string} children - The text of the tag.\n * @param {Sentiment} [sentiment='neutral'] - Optional prop to set the sentiment type (negative, warning, neutral, success, proposition).\n * @param {TagSize} [size='small'] - Optional prop to set the size of the tag (small or large).\n * @param {Emphasis} [emphasis='base'] - Optional prop to specify the emphasis level (base or elevated).\n * @param {boolean} [overMedia=false] - If true, renders the tag for use over media, keeping the colours it uses in dark screen modes.\n * @param {string} [className] - Additional CSS classes to apply.\n * @param {string} [id] - Unique identifier for the component.\n * @param {string} [data-testid] - A unique string that appears as data attribute `data-testid` in the rendered code.\n *\n * @component\n * @example\n * ```tsx\n * <Tag sentiment=\"success\">Verified</Tag>\n * ```\n *\n * @see {@link https://storybook.wise.design/?path=/docs/tag--docs|Storybook Wise Design}\n */\nconst Tag = forwardRef<HTMLSpanElement, TagProps>(function Tag(\n {\n children,\n sentiment = 'neutral',\n size = 'small',\n emphasis = 'base',\n overMedia = false,\n className,\n id,\n 'data-testid': dataTestId,\n },\n ref,\n) {\n return (\n <SentimentSurface\n // @ts-expect-error - SentimentSurface forwardRef types don't expose ref in props\n ref={ref}\n as=\"span\"\n sentiment={sentiment}\n emphasis={overMedia ? 'elevated' : emphasis}\n colourScheme={overMedia ? 'dark' : undefined}\n id={id}\n data-testid={dataTestId}\n className={clsx('wds-tag', `wds-tag--${size}`, `wds-tag--${sentiment}`, className)}\n >\n <Body as=\"span\" type=\"body-default-bold\" className=\"wds-tag__text\">\n {children}\n </Body>\n </SentimentSurface>\n );\n});\n\nexport default Tag;\n"],"names":["Tag","forwardRef","children","sentiment","size","emphasis","overMedia","className","id","dataTestId","ref","_jsx","SentimentSurface","as","colourScheme","undefined","clsx","Body","type"],"mappings":";;;;;;;;;;AA2BA,MAAMA,GAAG,gBAAGC,gBAAU,CAA4B,SAASD,GAAGA,CAC5D;EACEE,QAAQ;AACRC,EAAAA,SAAS,GAAG,SAAS;AACrBC,EAAAA,IAAI,GAAG,OAAO;AACdC,EAAAA,QAAQ,GAAG,MAAM;AACjBC,EAAAA,SAAS,GAAG,KAAK;EACjBC,SAAS;EACTC,EAAE;AACF,EAAA,aAAa,EAAEC;AAAU,CAC1B,EACDC,GAAG,EAAA;AAEH,EAAA,oBACEC,cAAA,CAACC;AACC;AAAA,IAAA;AACAF,IAAAA,GAAG,EAAEA,GAAI;AACTG,IAAAA,EAAE,EAAC,MAAM;AACTV,IAAAA,SAAS,EAAEA,SAAU;AACrBE,IAAAA,QAAQ,EAAEC,SAAS,GAAG,UAAU,GAAGD,QAAS;AAC5CS,IAAAA,YAAY,EAAER,SAAS,GAAG,MAAM,GAAGS,SAAU;AAC7CP,IAAAA,EAAE,EAAEA,EAAG;AACP,IAAA,aAAA,EAAaC,UAAW;AACxBF,IAAAA,SAAS,EAAES,SAAI,CAAC,SAAS,EAAE,CAAA,SAAA,EAAYZ,IAAI,CAAA,CAAE,EAAE,CAAA,SAAA,EAAYD,SAAS,CAAA,CAAE,EAAEI,SAAS,CAAE;IAAAL,QAAA,eAEnFS,cAAA,CAACM,YAAI,EAAA;AAACJ,MAAAA,EAAE,EAAC,MAAM;AAACK,MAAAA,IAAI,EAAC,mBAAmB;AAACX,MAAAA,SAAS,EAAC,eAAe;AAAAL,MAAAA,QAAA,EAC/DA;KACG;AACR,GAAkB,CAAC;AAEvB,CAAC;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import Body from '../Body/Body.mjs';
|
|
4
|
+
import SentimentSurface from '../SentimentSurface/SentimentSurface.mjs';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
const Tag = /*#__PURE__*/forwardRef(function Tag({
|
|
8
|
+
children,
|
|
9
|
+
sentiment = 'neutral',
|
|
10
|
+
size = 'small',
|
|
11
|
+
emphasis = 'base',
|
|
12
|
+
overMedia = false,
|
|
13
|
+
className,
|
|
14
|
+
id,
|
|
15
|
+
'data-testid': dataTestId
|
|
16
|
+
}, ref) {
|
|
17
|
+
return /*#__PURE__*/jsx(SentimentSurface
|
|
18
|
+
// @ts-expect-error - SentimentSurface forwardRef types don't expose ref in props
|
|
19
|
+
, {
|
|
20
|
+
ref: ref,
|
|
21
|
+
as: "span",
|
|
22
|
+
sentiment: sentiment,
|
|
23
|
+
emphasis: overMedia ? 'elevated' : emphasis,
|
|
24
|
+
colourScheme: overMedia ? 'dark' : undefined,
|
|
25
|
+
id: id,
|
|
26
|
+
"data-testid": dataTestId,
|
|
27
|
+
className: clsx('wds-tag', `wds-tag--${size}`, `wds-tag--${sentiment}`, className),
|
|
28
|
+
children: /*#__PURE__*/jsx(Body, {
|
|
29
|
+
as: "span",
|
|
30
|
+
type: "body-default-bold",
|
|
31
|
+
className: "wds-tag__text",
|
|
32
|
+
children: children
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export { Tag as default };
|
|
38
|
+
//# sourceMappingURL=Tag.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tag.mjs","sources":["../../src/Tag/Tag.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport Body from '../Body';\nimport SentimentSurface from '../SentimentSurface';\nimport { TagProps } from './Tag.types';\n\n/**\n * Tag is a small, non-interactive label that categorises or highlights a piece of content.\n *\n * @param {string} children - The text of the tag.\n * @param {Sentiment} [sentiment='neutral'] - Optional prop to set the sentiment type (negative, warning, neutral, success, proposition).\n * @param {TagSize} [size='small'] - Optional prop to set the size of the tag (small or large).\n * @param {Emphasis} [emphasis='base'] - Optional prop to specify the emphasis level (base or elevated).\n * @param {boolean} [overMedia=false] - If true, renders the tag for use over media, keeping the colours it uses in dark screen modes.\n * @param {string} [className] - Additional CSS classes to apply.\n * @param {string} [id] - Unique identifier for the component.\n * @param {string} [data-testid] - A unique string that appears as data attribute `data-testid` in the rendered code.\n *\n * @component\n * @example\n * ```tsx\n * <Tag sentiment=\"success\">Verified</Tag>\n * ```\n *\n * @see {@link https://storybook.wise.design/?path=/docs/tag--docs|Storybook Wise Design}\n */\nconst Tag = forwardRef<HTMLSpanElement, TagProps>(function Tag(\n {\n children,\n sentiment = 'neutral',\n size = 'small',\n emphasis = 'base',\n overMedia = false,\n className,\n id,\n 'data-testid': dataTestId,\n },\n ref,\n) {\n return (\n <SentimentSurface\n // @ts-expect-error - SentimentSurface forwardRef types don't expose ref in props\n ref={ref}\n as=\"span\"\n sentiment={sentiment}\n emphasis={overMedia ? 'elevated' : emphasis}\n colourScheme={overMedia ? 'dark' : undefined}\n id={id}\n data-testid={dataTestId}\n className={clsx('wds-tag', `wds-tag--${size}`, `wds-tag--${sentiment}`, className)}\n >\n <Body as=\"span\" type=\"body-default-bold\" className=\"wds-tag__text\">\n {children}\n </Body>\n </SentimentSurface>\n );\n});\n\nexport default Tag;\n"],"names":["Tag","forwardRef","children","sentiment","size","emphasis","overMedia","className","id","dataTestId","ref","_jsx","SentimentSurface","as","colourScheme","undefined","clsx","Body","type"],"mappings":";;;;;;AA2BA,MAAMA,GAAG,gBAAGC,UAAU,CAA4B,SAASD,GAAGA,CAC5D;EACEE,QAAQ;AACRC,EAAAA,SAAS,GAAG,SAAS;AACrBC,EAAAA,IAAI,GAAG,OAAO;AACdC,EAAAA,QAAQ,GAAG,MAAM;AACjBC,EAAAA,SAAS,GAAG,KAAK;EACjBC,SAAS;EACTC,EAAE;AACF,EAAA,aAAa,EAAEC;AAAU,CAC1B,EACDC,GAAG,EAAA;AAEH,EAAA,oBACEC,GAAA,CAACC;AACC;AAAA,IAAA;AACAF,IAAAA,GAAG,EAAEA,GAAI;AACTG,IAAAA,EAAE,EAAC,MAAM;AACTV,IAAAA,SAAS,EAAEA,SAAU;AACrBE,IAAAA,QAAQ,EAAEC,SAAS,GAAG,UAAU,GAAGD,QAAS;AAC5CS,IAAAA,YAAY,EAAER,SAAS,GAAG,MAAM,GAAGS,SAAU;AAC7CP,IAAAA,EAAE,EAAEA,EAAG;AACP,IAAA,aAAA,EAAaC,UAAW;AACxBF,IAAAA,SAAS,EAAES,IAAI,CAAC,SAAS,EAAE,CAAA,SAAA,EAAYZ,IAAI,CAAA,CAAE,EAAE,CAAA,SAAA,EAAYD,SAAS,CAAA,CAAE,EAAEI,SAAS,CAAE;IAAAL,QAAA,eAEnFS,GAAA,CAACM,IAAI,EAAA;AAACJ,MAAAA,EAAE,EAAC,MAAM;AAACK,MAAAA,IAAI,EAAC,mBAAmB;AAACX,MAAAA,SAAS,EAAC,eAAe;AAAAL,MAAAA,QAAA,EAC/DA;KACG;AACR,GAAkB,CAAC;AAEvB,CAAC;;;;"}
|
package/build/index.js
CHANGED
|
@@ -114,6 +114,7 @@ var Summary = require('./_deprecated/Summary/Summary.js');
|
|
|
114
114
|
var Switch = require('./Switch/Switch.js');
|
|
115
115
|
var SwitchOption = require('./_deprecated/SwitchOption/SwitchOption.js');
|
|
116
116
|
var Tabs = require('./Tabs/Tabs.js');
|
|
117
|
+
var Tag = require('./Tag/Tag.js');
|
|
117
118
|
var TextareaWithDisplayFormat = require('./TextareaWithDisplayFormat/TextareaWithDisplayFormat.js');
|
|
118
119
|
var Title = require('./Title/Title.js');
|
|
119
120
|
var Tile = require('./Tile/Tile.js');
|
|
@@ -284,6 +285,7 @@ exports.Summary = Summary.default;
|
|
|
284
285
|
exports.Switch = Switch.default;
|
|
285
286
|
exports.SwitchOption = SwitchOption.default;
|
|
286
287
|
exports.Tabs = Tabs.default;
|
|
288
|
+
exports.Tag = Tag.default;
|
|
287
289
|
exports.TextareaWithDisplayFormat = TextareaWithDisplayFormat.default;
|
|
288
290
|
exports.Title = Title.default;
|
|
289
291
|
exports.Tile = Tile.default;
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/index.mjs
CHANGED
|
@@ -112,6 +112,7 @@ export { default as Summary } from './_deprecated/Summary/Summary.mjs';
|
|
|
112
112
|
export { default as Switch } from './Switch/Switch.mjs';
|
|
113
113
|
export { default as SwitchOption } from './_deprecated/SwitchOption/SwitchOption.mjs';
|
|
114
114
|
export { default as Tabs } from './Tabs/Tabs.mjs';
|
|
115
|
+
export { default as Tag } from './Tag/Tag.mjs';
|
|
115
116
|
export { default as TextareaWithDisplayFormat } from './TextareaWithDisplayFormat/TextareaWithDisplayFormat.mjs';
|
|
116
117
|
export { default as Title } from './Title/Title.mjs';
|
|
117
118
|
export { default as Tile } from './Tile/Tile.mjs';
|
package/build/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|