@transferwise/components 46.116.0 → 46.116.1

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.
@@ -98,9 +98,10 @@ function Alert({
98
98
  const [shouldFire, setShouldFire] = React.useState();
99
99
  const [shouldAnnounce, setShouldAnnounce] = React.useState(false);
100
100
  React.useEffect(() => {
101
- setTimeout(() => {
101
+ const timeoutId = setTimeout(() => {
102
102
  setShouldAnnounce(true);
103
103
  }, constants.WDS_LIVE_REGION_DELAY_MS);
104
+ return () => clearTimeout(timeoutId);
104
105
  }, []);
105
106
  const closeButtonReference = React.useRef(null);
106
107
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport {\n CloseButton,\n Sentiment,\n Size,\n Status,\n Typography,\n WDS_LIVE_REGION_DELAY_MS,\n} from '../common';\n\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport Button from '../button';\nimport Link from '../link';\n\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.NEGATIVE\n // remove when all instances of Sentiment.PENDING have been updated to Status.PENDING\n | Sentiment.PENDING\n | Status.PENDING}`;\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /**\n * Override for [StatusIcon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n statusIconLabel?: string;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /** The type dictates which icon and colour will be used */\n type?: AlertType;\n /** @deprecated Use `InlineAlert` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\nexport default function Alert({\n action,\n className,\n icon,\n statusIconLabel,\n onDismiss,\n message,\n title,\n type = 'neutral',\n arrow,\n children,\n size,\n dismissible,\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState<boolean>();\n\n const [shouldAnnounce, setShouldAnnounce] = useState<boolean>(false);\n useEffect(() => {\n setTimeout(() => {\n setShouldAnnounce(true);\n }, WDS_LIVE_REGION_DELAY_MS);\n }, []);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n /**\n * All focusable elements must be disabled until we announce the alert.\n * @see https://dequeuniversity.com/rules/axe/4.10/aria-hidden-focus?application=axeAPI\n */\n const accessibleTabIndex = shouldAnnounce ? undefined : -1;\n\n return (\n <div\n role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}\n className=\"wds-alert__liveRegion\"\n >\n <div\n aria-hidden={shouldAnnounce ? undefined : 'true'}\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div className=\"alert__icon\">\n {icon || <StatusIcon size={32} sentiment={resolvedType} iconLabel={statusIconLabel} />}\n </div>\n <div className={clsx('alert__content', 'd-flex', 'flex-grow-1')}>\n <div className=\"alert__message\">\n <div>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action &&\n ('href' in action ? (\n <Link\n href={action.href}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n ) : (\n <Button\n v2\n size=\"sm\"\n sentiment=\"default\"\n aria-label={action['aria-label']}\n priority=\"secondary-neutral\"\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Button>\n ))}\n </div>\n </div>\n {onDismiss && (\n <div className=\"alert__close\">\n <CloseButton\n ref={closeButtonReference}\n size=\"xs\"\n tabIndex={accessibleTabIndex}\n onClick={onDismiss}\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","action","className","icon","statusIconLabel","onDismiss","message","title","arrow","children","size","dismissible","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","shouldAnnounce","setShouldAnnounce","setTimeout","WDS_LIVE_REGION_DELAY_MS","closeButtonReference","useRef","accessibleTabIndex","_jsx","role","Sentiment","NEGATIVE","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","StatusIcon","sentiment","iconLabel","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Link","LINK_LARGE","tabIndex","onClick","text","Button","v2","priority","CloseButton","ref"],"mappings":";;;;;;;;;;;;;;;;;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AAA;AACFrD,YAAAA,IAAI,EAAC,IAAI;AACTsC,YAAAA,SAAS,EAAC,SAAS;YACnB,YAAA,EAAY/C,MAAM,CAAC,YAAY,CAAE;AACjC+D,YAAAA,QAAQ,EAAC,mBAAmB;AAC5B9D,YAAAA,SAAS,EAAC,eAAe;AACzByD,YAAAA,QAAQ,EAAElC,kBAAmB;YAC7BmC,OAAO,EAAE3D,MAAM,CAAC2D,OAAQ;YAAAnD,QAAA,EAEvBR,MAAM,CAAC4D;AAAI,WACN,CACT,CAAC;SACD;AACP,OAAK,CACL,EAACxD,SAAS,iBACRqB,cAAA,CAAA,KAAA,EAAA;AAAKxB,QAAAA,SAAS,EAAC,cAAc;QAAAO,QAAA,eAC3BiB,cAAA,CAACuC,uBAAW,EAAA;AACVC,UAAAA,GAAG,EAAE3C,oBAAqB;AAC1Bb,UAAAA,IAAI,EAAC,IAAI;AACTiD,UAAAA,QAAQ,EAAElC,kBAAmB;AAC7BmC,UAAAA,OAAO,EAAEvD;SAAU;AAEvB,OAAK,CACN;KACE;AACP,GAAK,CAAC;AAEV;AAEA,SAAS2B,oBAAoBA,CAACxB,KAA8B,EAAA;AAC1D,EAAA,QAAQA,KAAK;AACX,IAAA,KAAK,aAAa;AAChB,MAAA,OAAO,iCAAiC;AAC1C,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,+BAA+B;AACxC,IAAA,KAAK,YAAY;AACf,MAAA,OAAO,gCAAgC;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,oBAAoB;AAC7B,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,mBAAmB;AAC5B,IAAA,KAAK,SAAS;AACd,IAAA;AACE,MAAA,OAAO,OAAO;AAClB;AACF;;;;"}
1
+ {"version":3,"file":"Alert.js","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport {\n CloseButton,\n Sentiment,\n Size,\n Status,\n Typography,\n WDS_LIVE_REGION_DELAY_MS,\n} from '../common';\n\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport Button from '../button';\nimport Link from '../link';\n\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.NEGATIVE\n // remove when all instances of Sentiment.PENDING have been updated to Status.PENDING\n | Sentiment.PENDING\n | Status.PENDING}`;\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /**\n * Override for [StatusIcon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n statusIconLabel?: string;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /** The type dictates which icon and colour will be used */\n type?: AlertType;\n /** @deprecated Use `InlineAlert` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\nexport default function Alert({\n action,\n className,\n icon,\n statusIconLabel,\n onDismiss,\n message,\n title,\n type = 'neutral',\n arrow,\n children,\n size,\n dismissible,\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState<boolean>();\n\n const [shouldAnnounce, setShouldAnnounce] = useState<boolean>(false);\n useEffect(() => {\n const timeoutId = setTimeout(() => {\n setShouldAnnounce(true);\n }, WDS_LIVE_REGION_DELAY_MS);\n\n return () => clearTimeout(timeoutId);\n }, []);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n /**\n * All focusable elements must be disabled until we announce the alert.\n * @see https://dequeuniversity.com/rules/axe/4.10/aria-hidden-focus?application=axeAPI\n */\n const accessibleTabIndex = shouldAnnounce ? undefined : -1;\n\n return (\n <div\n role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}\n className=\"wds-alert__liveRegion\"\n >\n <div\n aria-hidden={shouldAnnounce ? undefined : 'true'}\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div className=\"alert__icon\">\n {icon || <StatusIcon size={32} sentiment={resolvedType} iconLabel={statusIconLabel} />}\n </div>\n <div className={clsx('alert__content', 'd-flex', 'flex-grow-1')}>\n <div className=\"alert__message\">\n <div>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action &&\n ('href' in action ? (\n <Link\n href={action.href}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n ) : (\n <Button\n v2\n size=\"sm\"\n sentiment=\"default\"\n aria-label={action['aria-label']}\n priority=\"secondary-neutral\"\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Button>\n ))}\n </div>\n </div>\n {onDismiss && (\n <div className=\"alert__close\">\n <CloseButton\n ref={closeButtonReference}\n size=\"xs\"\n tabIndex={accessibleTabIndex}\n onClick={onDismiss}\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","action","className","icon","statusIconLabel","onDismiss","message","title","arrow","children","size","dismissible","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","shouldAnnounce","setShouldAnnounce","timeoutId","setTimeout","WDS_LIVE_REGION_DELAY_MS","clearTimeout","closeButtonReference","useRef","accessibleTabIndex","_jsx","role","Sentiment","NEGATIVE","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","StatusIcon","sentiment","iconLabel","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Link","LINK_LARGE","tabIndex","onClick","text","Button","v2","priority","CloseButton","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCYA;AAAZ,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAAA,kBAAA,CAAA,UAAA,CAAA,GAAA,SAAoB;AACpBA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,WAAiB;AACjBA,EAAAA,kBAAA,CAAA,WAAA,CAAA,GAAA,UAAsB;AACtBA,EAAAA,kBAAA,CAAA,aAAA,CAAA,GAAA,WAAyB;AACzBA,EAAAA,kBAAA,CAAA,QAAA,CAAA,GAAA,aAAsB;AACtBA,EAAAA,kBAAA,CAAA,cAAA,CAAA,GAAA,YAA2B;AAC7B,CAAC,EAPWA,0BAAkB,KAAlBA,0BAAkB,GAAA,EAAA,CAAA,CAAA;AAsC9B,SAASC,WAAWA,CAACC,IAAe,EAAA;AAClC,EAAA,QAAQA,IAAI;AACV,IAAA,KAAK,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AAA;AACVC,UAAAA,GAAG,EAAE3C,oBAAqB;AAC1Bf,UAAAA,IAAI,EAAC,IAAI;AACTmD,UAAAA,QAAQ,EAAElC,kBAAmB;AAC7BmC,UAAAA,OAAO,EAAEzD;SAAU;AAEvB,OAAK,CACN;KACE;AACP,GAAK,CAAC;AAEV;AAEA,SAAS6B,oBAAoBA,CAAC1B,KAA8B,EAAA;AAC1D,EAAA,QAAQA,KAAK;AACX,IAAA,KAAK,aAAa;AAChB,MAAA,OAAO,iCAAiC;AAC1C,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,+BAA+B;AACxC,IAAA,KAAK,YAAY;AACf,MAAA,OAAO,gCAAgC;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,oBAAoB;AAC7B,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,mBAAmB;AAC5B,IAAA,KAAK,SAAS;AACd,IAAA;AACE,MAAA,OAAO,OAAO;AAClB;AACF;;;;"}
@@ -94,9 +94,10 @@ function Alert({
94
94
  const [shouldFire, setShouldFire] = useState();
95
95
  const [shouldAnnounce, setShouldAnnounce] = useState(false);
96
96
  useEffect(() => {
97
- setTimeout(() => {
97
+ const timeoutId = setTimeout(() => {
98
98
  setShouldAnnounce(true);
99
99
  }, WDS_LIVE_REGION_DELAY_MS);
100
+ return () => clearTimeout(timeoutId);
100
101
  }, []);
101
102
  const closeButtonReference = useRef(null);
102
103
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.mjs","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport {\n CloseButton,\n Sentiment,\n Size,\n Status,\n Typography,\n WDS_LIVE_REGION_DELAY_MS,\n} from '../common';\n\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport Button from '../button';\nimport Link from '../link';\n\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.NEGATIVE\n // remove when all instances of Sentiment.PENDING have been updated to Status.PENDING\n | Sentiment.PENDING\n | Status.PENDING}`;\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /**\n * Override for [StatusIcon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n statusIconLabel?: string;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /** The type dictates which icon and colour will be used */\n type?: AlertType;\n /** @deprecated Use `InlineAlert` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\nexport default function Alert({\n action,\n className,\n icon,\n statusIconLabel,\n onDismiss,\n message,\n title,\n type = 'neutral',\n arrow,\n children,\n size,\n dismissible,\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState<boolean>();\n\n const [shouldAnnounce, setShouldAnnounce] = useState<boolean>(false);\n useEffect(() => {\n setTimeout(() => {\n setShouldAnnounce(true);\n }, WDS_LIVE_REGION_DELAY_MS);\n }, []);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n /**\n * All focusable elements must be disabled until we announce the alert.\n * @see https://dequeuniversity.com/rules/axe/4.10/aria-hidden-focus?application=axeAPI\n */\n const accessibleTabIndex = shouldAnnounce ? undefined : -1;\n\n return (\n <div\n role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}\n className=\"wds-alert__liveRegion\"\n >\n <div\n aria-hidden={shouldAnnounce ? undefined : 'true'}\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div className=\"alert__icon\">\n {icon || <StatusIcon size={32} sentiment={resolvedType} iconLabel={statusIconLabel} />}\n </div>\n <div className={clsx('alert__content', 'd-flex', 'flex-grow-1')}>\n <div className=\"alert__message\">\n <div>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action &&\n ('href' in action ? (\n <Link\n href={action.href}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n ) : (\n <Button\n v2\n size=\"sm\"\n sentiment=\"default\"\n aria-label={action['aria-label']}\n priority=\"secondary-neutral\"\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Button>\n ))}\n </div>\n </div>\n {onDismiss && (\n <div className=\"alert__close\">\n <CloseButton\n ref={closeButtonReference}\n size=\"xs\"\n tabIndex={accessibleTabIndex}\n onClick={onDismiss}\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","action","className","icon","statusIconLabel","onDismiss","message","title","arrow","children","size","dismissible","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","shouldAnnounce","setShouldAnnounce","setTimeout","WDS_LIVE_REGION_DELAY_MS","closeButtonReference","useRef","accessibleTabIndex","_jsx","role","Sentiment","NEGATIVE","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","StatusIcon","sentiment","iconLabel","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Link","LINK_LARGE","tabIndex","onClick","text","Button","v2","priority","CloseButton","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyCYA;AAAZ,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAAA,kBAAA,CAAA,UAAA,CAAA,GAAA,SAAoB;AACpBA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,WAAiB;AACjBA,EAAAA,kBAAA,CAAA,WAAA,CAAA,GAAA,UAAsB;AACtBA,EAAAA,kBAAA,CAAA,aAAA,CAAA,GAAA,WAAyB;AACzBA,EAAAA,kBAAA,CAAA,QAAA,CAAA,GAAA,aAAsB;AACtBA,EAAAA,kBAAA,CAAA,cAAA,CAAA,GAAA,YAA2B;AAC7B,CAAC,EAPWA,kBAAkB,KAAlBA,kBAAkB,GAAA,EAAA,CAAA,CAAA;AAsC9B,SAASC,WAAWA,CAACC,IAAe,EAAA;AAClC,EAAA,QAAQA,IAAI;AACV,IAAA,KAAK,SAAS;AACZ,MAAA,OAAO,UAAU;AACnB,IAAA,KAAK,MAAM;AACT,MAAA,OAAO,SAAS;AAClB,IAAA,KAAK,OAAO;AACV,MAAA,OAAO,UAAU;AACnB,IAAA;AACE,MAAA,OAAOA,IAAI;AACf;AACF;AAEc,SAAUC,KAAKA,CAAC;EAC5BC,MAAM;EACNC,SAAS;EACT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A,OAAO,iCAAiC;AAC1C,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,+BAA+B;AACxC,IAAA,KAAK,YAAY;AACf,MAAA,OAAO,gCAAgC;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,oBAAoB;AAC7B,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,mBAAmB;AAC5B,IAAA,KAAK,SAAS;AACd,IAAA;AACE,MAAA,OAAO,OAAO;AAClB;AACF;;;;"}
1
+ {"version":3,"file":"Alert.mjs","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport {\n CloseButton,\n Sentiment,\n Size,\n Status,\n Typography,\n WDS_LIVE_REGION_DELAY_MS,\n} from '../common';\n\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport Button from '../button';\nimport Link from '../link';\n\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.NEGATIVE\n // remove when all instances of Sentiment.PENDING have been updated to Status.PENDING\n | Sentiment.PENDING\n | Status.PENDING}`;\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /**\n * Override for [StatusIcon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n statusIconLabel?: string;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /** The type dictates which icon and colour will be used */\n type?: AlertType;\n /** @deprecated Use `InlineAlert` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\nexport default function Alert({\n action,\n className,\n icon,\n statusIconLabel,\n onDismiss,\n message,\n title,\n type = 'neutral',\n arrow,\n children,\n size,\n dismissible,\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState<boolean>();\n\n const [shouldAnnounce, setShouldAnnounce] = useState<boolean>(false);\n useEffect(() => {\n const timeoutId = setTimeout(() => {\n setShouldAnnounce(true);\n }, WDS_LIVE_REGION_DELAY_MS);\n\n return () => clearTimeout(timeoutId);\n }, []);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n /**\n * All focusable elements must be disabled until we announce the alert.\n * @see https://dequeuniversity.com/rules/axe/4.10/aria-hidden-focus?application=axeAPI\n */\n const accessibleTabIndex = shouldAnnounce ? undefined : -1;\n\n return (\n <div\n role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}\n className=\"wds-alert__liveRegion\"\n >\n <div\n aria-hidden={shouldAnnounce ? undefined : 'true'}\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div className=\"alert__icon\">\n {icon || <StatusIcon size={32} sentiment={resolvedType} iconLabel={statusIconLabel} />}\n </div>\n <div className={clsx('alert__content', 'd-flex', 'flex-grow-1')}>\n <div className=\"alert__message\">\n <div>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action &&\n ('href' in action ? (\n <Link\n href={action.href}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n ) : (\n <Button\n v2\n size=\"sm\"\n sentiment=\"default\"\n aria-label={action['aria-label']}\n priority=\"secondary-neutral\"\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Button>\n ))}\n </div>\n </div>\n {onDismiss && (\n <div className=\"alert__close\">\n <CloseButton\n ref={closeButtonReference}\n size=\"xs\"\n tabIndex={accessibleTabIndex}\n onClick={onDismiss}\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","action","className","icon","statusIconLabel","onDismiss","message","title","arrow","children","size","dismissible","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","shouldAnnounce","setShouldAnnounce","timeoutId","setTimeout","WDS_LIVE_REGION_DELAY_MS","clearTimeout","closeButtonReference","useRef","accessibleTabIndex","_jsx","role","Sentiment","NEGATIVE","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","StatusIcon","sentiment","iconLabel","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Link","LINK_LARGE","tabIndex","onClick","text","Button","v2","priority","CloseButton","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyCYA;AAAZ,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAA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EAAC,IAAI;AACTwC,YAAAA,SAAS,EAAC,SAAS;YACnB,YAAA,EAAYjD,MAAM,CAAC,YAAY,CAAE;AACjCiE,YAAAA,QAAQ,EAAC,mBAAmB;AAC5BhE,YAAAA,SAAS,EAAC,eAAe;AACzB2D,YAAAA,QAAQ,EAAElC,kBAAmB;YAC7BmC,OAAO,EAAE7D,MAAM,CAAC6D,OAAQ;YAAArD,QAAA,EAEvBR,MAAM,CAAC8D;AAAI,WACN,CACT,CAAC;SACD;AACP,OAAK,CACL,EAAC1D,SAAS,iBACRuB,GAAA,CAAA,KAAA,EAAA;AAAK1B,QAAAA,SAAS,EAAC,cAAc;QAAAO,QAAA,eAC3BmB,GAAA,CAACuC,WAAW,EAAA;AACVC,UAAAA,GAAG,EAAE3C,oBAAqB;AAC1Bf,UAAAA,IAAI,EAAC,IAAI;AACTmD,UAAAA,QAAQ,EAAElC,kBAAmB;AAC7BmC,UAAAA,OAAO,EAAEzD;SAAU;AAEvB,OAAK,CACN;KACE;AACP,GAAK,CAAC;AAEV;AAEA,SAAS6B,oBAAoBA,CAAC1B,KAA8B,EAAA;AAC1D,EAAA,QAAQA,KAAK;AACX,IAAA,KAAK,aAAa;AAChB,MAAA,OAAO,iCAAiC;AAC1C,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,+BAA+B;AACxC,IAAA,KAAK,YAAY;AACf,MAAA,OAAO,gCAAgC;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,oBAAoB;AAC7B,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,mBAAmB;AAC5B,IAAA,KAAK,SAAS;AACd,IAAA;AACE,MAAA,OAAO,OAAO;AAClB;AACF;;;;"}
package/build/main.css CHANGED
@@ -1,7 +1,3 @@
1
- .wds-sentiment-surface {
2
- background-color: var(--color-sentiment-background-surface);
3
- color: var(--color-sentiment-content-primary);
4
- }
5
1
  .np-theme-personal .wds-sentiment-surface-negative-base,
6
2
  .np-theme-personal--bright-green .wds-sentiment-surface-negative-base {
7
3
  --color-sentiment-content-primary: #CB272F;
@@ -3133,8 +3129,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
3133
3129
  }
3134
3130
  @supports (hyphenate-limit-chars: 1) {
3135
3131
  .np-form-control--size-lg {
3136
- -webkit-hyphens: auto;
3137
- hyphens: auto;
3132
+ hyphens: auto;
3138
3133
  hyphenate-limit-chars: 7 3;
3139
3134
  }
3140
3135
  @media (min-width: 768px) {
@@ -3150,8 +3145,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
3150
3145
  }
3151
3146
  @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
3152
3147
  .np-form-control--size-lg {
3153
- -webkit-hyphens: auto;
3154
- hyphens: auto;
3148
+ hyphens: auto;
3155
3149
  -webkit-hyphenate-limit-before: 3;
3156
3150
  -webkit-hyphenate-limit-after: 3;
3157
3151
  }
@@ -5189,8 +5183,7 @@ html:not([dir="rtl"]) .np-navigation-option {
5189
5183
  }
5190
5184
  @supports (hyphenate-limit-chars: 1) {
5191
5185
  .np-popover__container.np-bottom-sheet .np-popover__title {
5192
- -webkit-hyphens: auto;
5193
- hyphens: auto;
5186
+ hyphens: auto;
5194
5187
  hyphenate-limit-chars: 7 3;
5195
5188
  }
5196
5189
  @media (min-width: 768px) {
@@ -5206,8 +5199,7 @@ html:not([dir="rtl"]) .np-navigation-option {
5206
5199
  }
5207
5200
  @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
5208
5201
  .np-popover__container.np-bottom-sheet .np-popover__title {
5209
- -webkit-hyphens: auto;
5210
- hyphens: auto;
5202
+ hyphens: auto;
5211
5203
  -webkit-hyphenate-limit-before: 3;
5212
5204
  -webkit-hyphenate-limit-after: 3;
5213
5205
  }
@@ -108,8 +108,7 @@
108
108
  }
109
109
  @supports (hyphenate-limit-chars: 1) {
110
110
  .np-form-control--size-lg {
111
- -webkit-hyphens: auto;
112
- hyphens: auto;
111
+ hyphens: auto;
113
112
  hyphenate-limit-chars: 7 3;
114
113
  }
115
114
  @media (min-width: 768px) {
@@ -125,8 +124,7 @@
125
124
  }
126
125
  @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
127
126
  .np-form-control--size-lg {
128
- -webkit-hyphens: auto;
129
- hyphens: auto;
127
+ hyphens: auto;
130
128
  -webkit-hyphenate-limit-before: 3;
131
129
  -webkit-hyphenate-limit-after: 3;
132
130
  }
@@ -108,8 +108,7 @@
108
108
  }
109
109
  @supports (hyphenate-limit-chars: 1) {
110
110
  .np-form-control--size-lg {
111
- -webkit-hyphens: auto;
112
- hyphens: auto;
111
+ hyphens: auto;
113
112
  hyphenate-limit-chars: 7 3;
114
113
  }
115
114
  @media (min-width: 768px) {
@@ -125,8 +124,7 @@
125
124
  }
126
125
  @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
127
126
  .np-form-control--size-lg {
128
- -webkit-hyphens: auto;
129
- hyphens: auto;
127
+ hyphens: auto;
130
128
  -webkit-hyphenate-limit-before: 3;
131
129
  -webkit-hyphenate-limit-after: 3;
132
130
  }
@@ -1,7 +1,3 @@
1
- .wds-sentiment-surface {
2
- background-color: var(--color-sentiment-background-surface);
3
- color: var(--color-sentiment-content-primary);
4
- }
5
1
  .np-theme-personal .wds-sentiment-surface-negative-base,
6
2
  .np-theme-personal--bright-green .wds-sentiment-surface-negative-base {
7
3
  --color-sentiment-content-primary: #CB272F;
@@ -3133,8 +3129,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
3133
3129
  }
3134
3130
  @supports (hyphenate-limit-chars: 1) {
3135
3131
  .np-form-control--size-lg {
3136
- -webkit-hyphens: auto;
3137
- hyphens: auto;
3132
+ hyphens: auto;
3138
3133
  hyphenate-limit-chars: 7 3;
3139
3134
  }
3140
3135
  @media (min-width: 768px) {
@@ -3150,8 +3145,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
3150
3145
  }
3151
3146
  @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
3152
3147
  .np-form-control--size-lg {
3153
- -webkit-hyphens: auto;
3154
- hyphens: auto;
3148
+ hyphens: auto;
3155
3149
  -webkit-hyphenate-limit-before: 3;
3156
3150
  -webkit-hyphenate-limit-after: 3;
3157
3151
  }
@@ -5189,8 +5183,7 @@ html:not([dir="rtl"]) .np-navigation-option {
5189
5183
  }
5190
5184
  @supports (hyphenate-limit-chars: 1) {
5191
5185
  .np-popover__container.np-bottom-sheet .np-popover__title {
5192
- -webkit-hyphens: auto;
5193
- hyphens: auto;
5186
+ hyphens: auto;
5194
5187
  hyphenate-limit-chars: 7 3;
5195
5188
  }
5196
5189
  @media (min-width: 768px) {
@@ -5206,8 +5199,7 @@ html:not([dir="rtl"]) .np-navigation-option {
5206
5199
  }
5207
5200
  @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
5208
5201
  .np-popover__container.np-bottom-sheet .np-popover__title {
5209
- -webkit-hyphens: auto;
5210
- hyphens: auto;
5202
+ hyphens: auto;
5211
5203
  -webkit-hyphenate-limit-before: 3;
5212
5204
  -webkit-hyphenate-limit-after: 3;
5213
5205
  }
@@ -38,8 +38,7 @@
38
38
  }
39
39
  @supports (hyphenate-limit-chars: 1) {
40
40
  .np-popover__container.np-bottom-sheet .np-popover__title {
41
- -webkit-hyphens: auto;
42
- hyphens: auto;
41
+ hyphens: auto;
43
42
  hyphenate-limit-chars: 7 3;
44
43
  }
45
44
  @media (min-width: 768px) {
@@ -55,8 +54,7 @@
55
54
  }
56
55
  @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
57
56
  .np-popover__container.np-bottom-sheet .np-popover__title {
58
- -webkit-hyphens: auto;
59
- hyphens: auto;
57
+ hyphens: auto;
60
58
  -webkit-hyphenate-limit-before: 3;
61
59
  -webkit-hyphenate-limit-after: 3;
62
60
  }
@@ -1,7 +1,3 @@
1
- .wds-sentiment-surface {
2
- background-color: var(--color-sentiment-background-surface);
3
- color: var(--color-sentiment-content-primary);
4
- }
5
1
  .np-theme-personal .wds-sentiment-surface-negative-base,
6
2
  .np-theme-personal--bright-green .wds-sentiment-surface-negative-base {
7
3
  --color-sentiment-content-primary: #CB272F;
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../src/alert/Alert.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,SAAS,EACT,IAAI,EACJ,MAAM,EAGP,MAAM,WAAW,CAAC;AAUnB,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,kDAAkD;AAClD,KAAK,mBAAmB,GAAG,GAAG,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC;AACrF,KAAK,iBAAiB,GAAG,GACrB,SAAS,CAAC,QAAQ,GAClB,SAAS,CAAC,OAAO,GACjB,SAAS,CAAC,OAAO,GACjB,SAAS,CAAC,QAAQ,GAElB,SAAS,CAAC,OAAO,GACjB,MAAM,CAAC,OAAO,EAAE,CAAC;AACrB,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAEhE,oBAAY,kBAAkB;IAC5B,QAAQ,YAAY;IACpB,GAAG,cAAc;IACjB,SAAS,aAAa;IACtB,WAAW,cAAc;IACzB,MAAM,gBAAgB;IACtB,YAAY,eAAe;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,yIAAyI;IACzI,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,C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AO,UAAU,KAAK,CAAC,EAC5B,MAAM,EACN,SAAS,EACT,IAAI,EACJ,eAAe,EACf,SAAS,EACT,OAAO,EACP,KAAK,EACL,IAAgB,EAChB,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,WAAW,GACZ,EAAE,UAAU,+BAsJZ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.116.0",
3
+ "version": "46.116.1",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -85,7 +85,7 @@
85
85
  "storybook-addon-test-codegen": "^2.0.1",
86
86
  "@transferwise/less-config": "3.1.2",
87
87
  "@transferwise/neptune-css": "14.25.2",
88
- "@wise/components-theming": "1.9.0",
88
+ "@wise/components-theming": "1.9.1",
89
89
  "@wise/wds-configs": "0.0.0"
90
90
  },
91
91
  "peerDependencies": {
@@ -147,9 +147,11 @@ export default function Alert({
147
147
 
148
148
  const [shouldAnnounce, setShouldAnnounce] = useState<boolean>(false);
149
149
  useEffect(() => {
150
- setTimeout(() => {
150
+ const timeoutId = setTimeout(() => {
151
151
  setShouldAnnounce(true);
152
152
  }, WDS_LIVE_REGION_DELAY_MS);
153
+
154
+ return () => clearTimeout(timeoutId);
153
155
  }, []);
154
156
 
155
157
  const closeButtonReference = useRef<HTMLButtonElement>(null);
@@ -108,8 +108,7 @@
108
108
  }
109
109
  @supports (hyphenate-limit-chars: 1) {
110
110
  .np-form-control--size-lg {
111
- -webkit-hyphens: auto;
112
- hyphens: auto;
111
+ hyphens: auto;
113
112
  hyphenate-limit-chars: 7 3;
114
113
  }
115
114
  @media (min-width: 768px) {
@@ -125,8 +124,7 @@
125
124
  }
126
125
  @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
127
126
  .np-form-control--size-lg {
128
- -webkit-hyphens: auto;
129
- hyphens: auto;
127
+ hyphens: auto;
130
128
  -webkit-hyphenate-limit-before: 3;
131
129
  -webkit-hyphenate-limit-after: 3;
132
130
  }
@@ -108,8 +108,7 @@
108
108
  }
109
109
  @supports (hyphenate-limit-chars: 1) {
110
110
  .np-form-control--size-lg {
111
- -webkit-hyphens: auto;
112
- hyphens: auto;
111
+ hyphens: auto;
113
112
  hyphenate-limit-chars: 7 3;
114
113
  }
115
114
  @media (min-width: 768px) {
@@ -125,8 +124,7 @@
125
124
  }
126
125
  @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
127
126
  .np-form-control--size-lg {
128
- -webkit-hyphens: auto;
129
- hyphens: auto;
127
+ hyphens: auto;
130
128
  -webkit-hyphenate-limit-before: 3;
131
129
  -webkit-hyphenate-limit-after: 3;
132
130
  }
package/src/main.css CHANGED
@@ -1,7 +1,3 @@
1
- .wds-sentiment-surface {
2
- background-color: var(--color-sentiment-background-surface);
3
- color: var(--color-sentiment-content-primary);
4
- }
5
1
  .np-theme-personal .wds-sentiment-surface-negative-base,
6
2
  .np-theme-personal--bright-green .wds-sentiment-surface-negative-base {
7
3
  --color-sentiment-content-primary: #CB272F;
@@ -3133,8 +3129,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
3133
3129
  }
3134
3130
  @supports (hyphenate-limit-chars: 1) {
3135
3131
  .np-form-control--size-lg {
3136
- -webkit-hyphens: auto;
3137
- hyphens: auto;
3132
+ hyphens: auto;
3138
3133
  hyphenate-limit-chars: 7 3;
3139
3134
  }
3140
3135
  @media (min-width: 768px) {
@@ -3150,8 +3145,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
3150
3145
  }
3151
3146
  @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
3152
3147
  .np-form-control--size-lg {
3153
- -webkit-hyphens: auto;
3154
- hyphens: auto;
3148
+ hyphens: auto;
3155
3149
  -webkit-hyphenate-limit-before: 3;
3156
3150
  -webkit-hyphenate-limit-after: 3;
3157
3151
  }
@@ -5189,8 +5183,7 @@ html:not([dir="rtl"]) .np-navigation-option {
5189
5183
  }
5190
5184
  @supports (hyphenate-limit-chars: 1) {
5191
5185
  .np-popover__container.np-bottom-sheet .np-popover__title {
5192
- -webkit-hyphens: auto;
5193
- hyphens: auto;
5186
+ hyphens: auto;
5194
5187
  hyphenate-limit-chars: 7 3;
5195
5188
  }
5196
5189
  @media (min-width: 768px) {
@@ -5206,8 +5199,7 @@ html:not([dir="rtl"]) .np-navigation-option {
5206
5199
  }
5207
5200
  @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
5208
5201
  .np-popover__container.np-bottom-sheet .np-popover__title {
5209
- -webkit-hyphens: auto;
5210
- hyphens: auto;
5202
+ hyphens: auto;
5211
5203
  -webkit-hyphenate-limit-before: 3;
5212
5204
  -webkit-hyphenate-limit-after: 3;
5213
5205
  }
@@ -38,8 +38,7 @@
38
38
  }
39
39
  @supports (hyphenate-limit-chars: 1) {
40
40
  .np-popover__container.np-bottom-sheet .np-popover__title {
41
- -webkit-hyphens: auto;
42
- hyphens: auto;
41
+ hyphens: auto;
43
42
  hyphenate-limit-chars: 7 3;
44
43
  }
45
44
  @media (min-width: 768px) {
@@ -55,8 +54,7 @@
55
54
  }
56
55
  @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
57
56
  .np-popover__container.np-bottom-sheet .np-popover__title {
58
- -webkit-hyphens: auto;
59
- hyphens: auto;
57
+ hyphens: auto;
60
58
  -webkit-hyphenate-limit-before: 3;
61
59
  -webkit-hyphenate-limit-after: 3;
62
60
  }
@@ -1,7 +1,3 @@
1
- .wds-sentiment-surface {
2
- background-color: var(--color-sentiment-background-surface);
3
- color: var(--color-sentiment-content-primary);
4
- }
5
1
  .np-theme-personal .wds-sentiment-surface-negative-base,
6
2
  .np-theme-personal--bright-green .wds-sentiment-surface-negative-base {
7
3
  --color-sentiment-content-primary: #CB272F;
@@ -5,7 +5,7 @@ import * as SentimentSurfaceStories from './SentimentSurface.story';
5
5
 
6
6
  # SentimentSurface Developer Guide
7
7
 
8
- `SentimentSurface` is a polymorphic container component that applies contextual background colours and text styling based on sentiment types. It's designed to visually communicate the nature or importance of content through colour and establish a semantic colour context for nested interactive components.
8
+ `SentimentSurface` is a polymorphic container component that establishes a semantic colour context by setting CSS custom properties (tokens) based on sentiment types. It does not apply any default background or text styling - instead, it provides access to sentiment-aware tokens that child components can use to style themselves appropriately.
9
9
 
10
10
  ## Basic Usage
11
11
 
@@ -51,15 +51,15 @@ The component supports five sentiment types (`negative`, `warning`, `neutral`, `
51
51
 
52
52
  ## Emphasis Levels
53
53
 
54
- Each sentiment type supports two emphasis levels to provide different levels of visual prominence (`base`, `elevated`):
54
+ Each sentiment type supports two emphasis levels that provide different sets of token values (`base`, `elevated`):
55
55
 
56
56
  ```tsx
57
57
  <SentimentSurface sentiment="success" emphasis="base">
58
- Base emphasis - subtle background
58
+ Base emphasis - provides tokens suited for subtle contexts
59
59
  </SentimentSurface>
60
60
 
61
61
  <SentimentSurface sentiment="success" emphasis="elevated">
62
- Elevated emphasis - strong background
62
+ Elevated emphasis - provides tokens suited for prominent contexts
63
63
  </SentimentSurface>
64
64
  ```
65
65
 
@@ -68,6 +68,8 @@ Each sentiment type supports two emphasis levels to provide different levels of
68
68
  - **Base**: For inline notifications, subtle callouts, or when sentiment needs to be communicated without drawing too much attention
69
69
  - **Elevated**: For prominent banners, critical alerts, or when the sentiment should be immediately noticeable
70
70
 
71
+ Note: The component does not apply background or text colours by default. Use the provided tokens in your styles to achieve the desired visual effect.
72
+
71
73
  ---
72
74
 
73
75
  ## Polymorphic Rendering
@@ -191,7 +193,7 @@ Sentiment surfaces can be nested to create layered contexts. Each nested surface
191
193
 
192
194
  ## CSS Custom Properties (Tokens)
193
195
 
194
- The component sets CSS custom properties (CSS variables) that child components can use to adapt their styling to the sentiment context. This enables a powerful theming system where nested components automatically adjust their appearance.
196
+ The component sets CSS custom properties (CSS variables) that child components can use to style themselves according to the sentiment context. The component itself does not apply any visual styling - it simply makes these tokens available for use in your own styles or by sentiment-aware child components.
195
197
 
196
198
  ### Available Tokens
197
199
 
@@ -310,6 +312,26 @@ import { Button, Body } from '@transferwise/components';
310
312
 
311
313
  The buttons will automatically use appropriate colours based on the sentiment context.
312
314
 
315
+ ### Applying Sentiment Tokens
316
+
317
+ To visually style content within a SentimentSurface, use the provided tokens in your styles:
318
+
319
+ ```tsx
320
+ // Apply tokens via inline styles
321
+ <SentimentSurface sentiment="warning">
322
+ <div
323
+ style={{
324
+ padding: '24px',
325
+ borderRadius: '16px',
326
+ backgroundColor: 'var(--color-sentiment-background-surface)',
327
+ color: 'var(--color-sentiment-content-primary)',
328
+ }}
329
+ >
330
+ This content uses the sentiment tokens for styling
331
+ </div>
332
+ </SentimentSurface>
333
+ ```
334
+
313
335
  ### Creating Custom Components with Sentiment Tokens
314
336
 
315
337
  You can create your own components that respect sentiment context:
@@ -436,14 +458,14 @@ Add appropriate ARIA attributes for screen readers:
436
458
 
437
459
  ### Color Contrast
438
460
 
439
- The component is designed with WCAG AA contrast ratios in mind:
461
+ The tokens provided by the component are designed with WCAG AA contrast ratios in mind:
440
462
 
441
- - **Base emphasis**: Provides sufficient contrast for body text
442
- - **Elevated emphasis**: Provides higher contrast, often with inverted colours
463
+ - **Base emphasis**: Tokens provide sufficient contrast for body text
464
+ - **Elevated emphasis**: Tokens provide higher contrast, often with inverted colours
443
465
 
444
466
  Always test your content for contrast compliance, especially when:
445
467
 
446
- - Adding custom text colours via `style` or `className`
468
+ - Applying tokens via `style` or `className`
447
469
  - Using small text sizes
448
470
  - Displaying important information
449
471
 
@@ -1,7 +1,4 @@
1
1
  .wds-sentiment-surface {
2
- background-color: var(--color-sentiment-background-surface);
3
- color: var(--color-sentiment-content-primary);
4
-
5
2
  &-negative {
6
3
  .np-theme-personal &,
7
4
  .np-theme-personal--bright-green & {
@@ -72,7 +72,6 @@ const meta: Meta<typeof SentimentSurface> = {
72
72
  sentiment: 'neutral',
73
73
  emphasis: 'base',
74
74
  children: 'This is a sentiment surface',
75
- style: { padding: '24px', borderRadius: '16px' },
76
75
  },
77
76
  decorators: [withContainer],
78
77
  parameters: {
@@ -94,37 +93,18 @@ export const Playground: Story = {
94
93
  args: {
95
94
  sentiment: 'negative',
96
95
  emphasis: 'base',
97
- children: 'Customise the sentiment and emphasis using the controls below',
98
- },
99
- };
100
-
101
- /**
102
- * There are five different sentiment types that communicate different types of information or states.
103
- */
104
- export const Sentiments: Story = {
105
- render: (args) => (
106
- <>
107
- <SentimentSurface {...args} sentiment="negative">
108
- Negative: Your payment has failed
109
- </SentimentSurface>
110
- <SentimentSurface {...args} sentiment="warning">
111
- Warning: Action required on your account
112
- </SentimentSurface>
113
- <SentimentSurface {...args} sentiment="neutral">
114
- Neutral: Your account is up to date
115
- </SentimentSurface>
116
- <SentimentSurface {...args} sentiment="success">
117
- Success: Your payment was successful
118
- </SentimentSurface>
119
- <SentimentSurface {...args} sentiment="proposition">
120
- Proposition: Try our new feature
121
- </SentimentSurface>
122
- </>
123
- ),
124
- parameters: {
125
- controls: { disable: true },
96
+ children: (
97
+ <div
98
+ style={{
99
+ padding: '24px',
100
+ backgroundColor: 'var(--color-sentiment-background-surface)',
101
+ color: 'var(--color-sentiment-content-primary)',
102
+ }}
103
+ >
104
+ This is a custom div demostrating a sentiment surface.
105
+ </div>
106
+ ),
126
107
  },
127
- decorators: [withComponentGrid],
128
108
  };
129
109
 
130
110
  /**
@@ -134,39 +114,48 @@ export const EmphasisLevels: Story = {
134
114
  render: (args) => (
135
115
  <>
136
116
  <SentimentSurface {...args} sentiment="negative" emphasis="base">
137
- Negative - Base emphasis
117
+ <div
118
+ style={{
119
+ padding: '24px',
120
+ backgroundColor: 'var(--color-sentiment-background-surface)',
121
+ color: 'var(--color-sentiment-content-primary)',
122
+ }}
123
+ >
124
+ Negative - Base emphasis
125
+ </div>
138
126
  </SentimentSurface>
139
127
  <SentimentSurface {...args} sentiment="negative" emphasis="elevated">
140
- Negative - Elevated emphasis
128
+ <div
129
+ style={{
130
+ padding: '24px',
131
+ backgroundColor: 'var(--color-sentiment-background-surface)',
132
+ color: 'var(--color-sentiment-content-primary)',
133
+ }}
134
+ >
135
+ Negative - Elevated emphasis
136
+ </div>
141
137
  </SentimentSurface>
142
138
  <SentimentSurface {...args} sentiment="success" emphasis="base">
143
- Success - Base emphasis
139
+ <div
140
+ style={{
141
+ padding: '24px',
142
+ backgroundColor: 'var(--color-sentiment-background-surface)',
143
+ color: 'var(--color-sentiment-content-primary)',
144
+ }}
145
+ >
146
+ Success - Base emphasis
147
+ </div>
144
148
  </SentimentSurface>
145
149
  <SentimentSurface {...args} sentiment="success" emphasis="elevated">
146
- Success - Elevated emphasis
147
- </SentimentSurface>
148
- </>
149
- ),
150
- parameters: {
151
- controls: { disable: true },
152
- },
153
- decorators: [withComponentGrid],
154
- };
155
-
156
- /**
157
- * The component can be rendered as any HTML element using the `as` prop.
158
- */
159
- export const PolymorphicRendering: Story = {
160
- render: (args) => (
161
- <>
162
- <SentimentSurface {...args} sentiment="negative">
163
- Rendered as div (default)
164
- </SentimentSurface>
165
- <SentimentSurface {...args} sentiment="negative" as="section">
166
- Rendered as section
167
- </SentimentSurface>
168
- <SentimentSurface {...args} sentiment="negative" as="article">
169
- Rendered as article
150
+ <div
151
+ style={{
152
+ padding: '24px',
153
+ backgroundColor: 'var(--color-sentiment-background-surface)',
154
+ color: 'var(--color-sentiment-content-primary)',
155
+ }}
156
+ >
157
+ Success - Elevated emphasis
158
+ </div>
170
159
  </SentimentSurface>
171
160
  </>
172
161
  ),
@@ -252,14 +241,18 @@ export const Tokens: Story = {
252
241
  key={`${sentiment}-${emphasis}`}
253
242
  sentiment={sentiment}
254
243
  emphasis={emphasis}
255
- style={{ padding: '24px', borderRadius: '16px' }}
244
+ style={{
245
+ padding: '24px',
246
+ borderRadius: '16px',
247
+ backgroundColor: 'var(--color-sentiment-background-surface)',
248
+ color: 'var(--color-sentiment-content-primary)',
249
+ }}
256
250
  >
257
251
  <div style={{ marginBottom: '16px' }}>
258
252
  <strong
259
253
  style={{
260
254
  fontSize: '16px',
261
255
  textTransform: 'capitalize',
262
- color: 'var(--color-sentiment-content-primary)',
263
256
  }}
264
257
  >
265
258
  {sentiment} - {emphasis}
@@ -308,33 +301,3 @@ export const Tokens: Story = {
308
301
  ),
309
302
  ],
310
303
  };
311
-
312
- export const AllVariants = storyConfig(
313
- {
314
- tags: ['!autodocs'],
315
- parameters: {
316
- padding: '0',
317
- controls: { disable: true },
318
- },
319
- render: () => (
320
- <div
321
- className="sentiment-surface-variants"
322
- style={{ display: 'flex', flexDirection: 'column', gap: '16px', maxWidth: '800px' }}
323
- >
324
- {sentiments.map((sentiment) =>
325
- emphasisLevels.map((emphasis) => (
326
- <SentimentSurface
327
- key={`${sentiment}-${emphasis}`}
328
- sentiment={sentiment}
329
- emphasis={emphasis}
330
- style={{ padding: '24px', borderRadius: '16px' }}
331
- >
332
- {sentiment} - {emphasis} emphasis
333
- </SentimentSurface>
334
- )),
335
- )}
336
- </div>
337
- ),
338
- },
339
- { variants: ['default', 'dark', 'bright-green', 'forest-green'] },
340
- );
@@ -1,7 +1,5 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import { expect, within } from 'storybook/test';
3
2
  import SentimentSurface from './SentimentSurface';
4
- import { storyConfig } from '../test-utils';
5
3
 
6
4
  export default {
7
5
  component: SentimentSurface,
@@ -10,110 +8,61 @@ export default {
10
8
 
11
9
  type Story = StoryObj<typeof SentimentSurface>;
12
10
 
13
- export const AllSentiments: Story = {
14
- render: () => (
15
- <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
16
- <SentimentSurface sentiment="negative">
17
- Negative sentiment - Your payment has failed
18
- </SentimentSurface>
19
- <SentimentSurface sentiment="warning">
20
- Warning sentiment - Action required on your account
21
- </SentimentSurface>
22
- <SentimentSurface sentiment="neutral">
23
- Neutral sentiment - Your account is up to date
24
- </SentimentSurface>
25
- <SentimentSurface sentiment="success">
26
- Success sentiment - Your payment was successful
27
- </SentimentSurface>
28
- <SentimentSurface sentiment="proposition">
29
- Proposition sentiment - Try our new feature
30
- </SentimentSurface>
31
- </div>
32
- ),
33
- };
34
-
35
- export const AllEmphasisLevels: Story = {
36
- render: () => (
37
- <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
38
- <SentimentSurface sentiment="neutral" emphasis="base">
39
- Base emphasis (default)
40
- </SentimentSurface>
41
- <SentimentSurface sentiment="neutral" emphasis="elevated">
42
- Elevated emphasis
43
- </SentimentSurface>
44
- </div>
45
- ),
46
- };
47
-
48
- export const PolymorphicRendering: Story = {
49
- play: async ({ canvasElement }) => {
50
- const canvas = within(canvasElement);
51
-
52
- // Test that all elements are rendered with correct tags
53
- const divElement = canvas.getByText('Rendered as div');
54
- await expect(divElement.tagName).toBe('DIV');
55
-
56
- const sectionElement = canvas.getByText('Rendered as section');
57
- await expect(sectionElement.tagName).toBe('SECTION');
58
-
59
- const articleElement = canvas.getByText('Rendered as article');
60
- await expect(articleElement.tagName).toBe('ARTICLE');
61
- },
62
- render: () => (
63
- <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
64
- <SentimentSurface sentiment="neutral">Rendered as div</SentimentSurface>
65
- <SentimentSurface sentiment="success" as="section">
66
- Rendered as section
67
- </SentimentSurface>
68
- <SentimentSurface sentiment="proposition" as="article">
69
- Rendered as article
70
- </SentimentSurface>
71
- </div>
72
- ),
73
- };
74
-
75
- export const AllVariants = storyConfig(
76
- {
77
- render: () => (
78
- <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '16px' }}>
79
- {(['negative', 'warning', 'neutral', 'success', 'proposition'] as const).map(
80
- (sentiment) => (
81
- <div key={sentiment} style={{ display: 'contents' }}>
82
- <SentimentSurface sentiment={sentiment} emphasis="base">
83
- {sentiment} - base
84
- </SentimentSurface>
85
- <SentimentSurface sentiment={sentiment} emphasis="elevated">
86
- {sentiment} - elevated
87
- </SentimentSurface>
88
- </div>
89
- ),
90
- )}
91
- </div>
92
- ),
93
- },
94
- { variants: ['default', 'dark'] },
95
- );
96
-
97
11
  export const NestedSentiments: Story = {
98
12
  render: () => (
99
13
  <div style={{ display: 'flex', flexDirection: 'column', gap: '24px' }}>
100
- <SentimentSurface sentiment="negative" emphasis="base">
14
+ <SentimentSurface
15
+ sentiment="negative"
16
+ emphasis="base"
17
+ style={{
18
+ backgroundColor: 'var(--color-sentiment-background-surface)',
19
+ color: 'var(--color-sentiment-content-primary)',
20
+ }}
21
+ >
101
22
  Outer: Negative, base
102
23
  <div style={{ margin: '16px 0 0 16px' }}>
103
- <SentimentSurface sentiment="success" emphasis="elevated">
24
+ <SentimentSurface
25
+ sentiment="success"
26
+ emphasis="elevated"
27
+ style={{
28
+ backgroundColor: 'var(--color-sentiment-background-surface)',
29
+ color: 'var(--color-sentiment-content-primary)',
30
+ }}
31
+ >
104
32
  Inner: Success, elevated
105
33
  <div style={{ margin: '12px 0 0 12px' }}>
106
- <SentimentSurface sentiment="warning" emphasis="base">
34
+ <SentimentSurface
35
+ sentiment="warning"
36
+ emphasis="base"
37
+ style={{
38
+ backgroundColor: 'var(--color-sentiment-background-surface)',
39
+ color: 'var(--color-sentiment-content-primary)',
40
+ }}
41
+ >
107
42
  Deepest: Warning, base
108
43
  </SentimentSurface>
109
44
  </div>
110
45
  </SentimentSurface>
111
46
  </div>
112
47
  </SentimentSurface>
113
- <SentimentSurface sentiment="proposition" emphasis="elevated">
48
+ <SentimentSurface
49
+ sentiment="proposition"
50
+ emphasis="elevated"
51
+ style={{
52
+ backgroundColor: 'var(--color-sentiment-background-surface)',
53
+ color: 'var(--color-sentiment-content-primary)',
54
+ }}
55
+ >
114
56
  Outer: Proposition, elevated
115
57
  <div style={{ margin: '16px 0 0 16px' }}>
116
- <SentimentSurface sentiment="neutral" emphasis="base">
58
+ <SentimentSurface
59
+ sentiment="neutral"
60
+ emphasis="base"
61
+ style={{
62
+ backgroundColor: 'var(--color-sentiment-background-surface)',
63
+ color: 'var(--color-sentiment-content-primary)',
64
+ }}
65
+ >
117
66
  Inner: Neutral, base
118
67
  </SentimentSurface>
119
68
  </div>