@transferwise/components 0.0.0-experimental-abeb3fe → 0.0.0-experimental-999c033

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.
@@ -43,7 +43,6 @@ const CriticalBanner = ({
43
43
  media = {},
44
44
  action,
45
45
  actionSecondary,
46
- animateEntry = true,
47
46
  expanded: expandedProp,
48
47
  onToggle,
49
48
  id,
@@ -142,15 +141,7 @@ const CriticalBanner = ({
142
141
  }),
143
142
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
144
143
  className: "wds-critical-banner-overhang-query",
145
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
146
- className: clsx.clsx('wds-critical-banner__entry-mask', {
147
- 'wds-critical-banner__entry-mask--animated': animateEntry
148
- }),
149
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
150
- className: "wds-critical-banner__entry-track",
151
- children: bannerSurface
152
- })
153
- })
144
+ children: bannerSurface
154
145
  })
155
146
  });
156
147
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CriticalBanner.js","sources":["../../../src/Prompt/CriticalBanner/CriticalBanner.tsx"],"sourcesContent":["import { ElementType, ReactNode, useId, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport Body from '../../Body';\nimport Button from '../../Button';\nimport Container from '../../Container';\nimport { Breakpoint, LiveRegion, Typography } from '../../common';\nimport { ButtonProps } from '../../Button/Button.types';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\n\nimport { renderPromptMedia, PromptMedia } from '../helpers/promptMedia';\nimport { ExpanderToggle } from '../common/Expander/Expander';\nimport { buildAnnouncementString } from './helpers';\nimport { useContainerSize } from '../../common/hooks/useContainerSize';\n\nexport type CriticalBannerProps = {\n title?: ReactNode;\n description: ReactNode;\n media?: PromptMedia;\n action?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n actionSecondary?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n sentiment?: Exclude<PrimitivePromptProps['sentiment'], 'proposition'>;\n /**\n * Controls whether the banner plays its entry animation when mounted.\n * Expand and collapse animations are unaffected.\n */\n animateEntry?: boolean;\n /**\n * Controls whether the description and actions are visible, as a controlled component.\n * When collapsed with a title, only the title is shown.\n * When collapsed without a title, the description is trimmed to 2 lines.\n *\n * Note: On desktop (container width >= 768px), the banner is always expanded\n * regardless of this prop value.\n */\n expanded?: boolean;\n /**\n * Called when the user clicks the chevron toggle.\n * If not provided, the component will manage expanded state internally.\n */\n onToggle?: () => void;\n} & Pick<PrimitivePromptProps, 'id' | 'className' | 'data-testid'>;\n\n/**\n * A full-width, non-dismissible banner for critical messages such as account blocks or\n * time-sensitive actions that require immediate user attention.\n\n * @see {@link https://docs.wise.design/components/critical-banner Design Spec}\n */\nexport const CriticalBanner = ({\n sentiment = 'negative',\n title,\n description,\n media = {},\n action,\n actionSecondary,\n animateEntry = true,\n expanded: expandedProp,\n onToggle,\n id,\n className,\n 'data-testid': testId,\n}: CriticalBannerProps) => {\n const [containerRef, isDesktop] = useContainerSize(Breakpoint.MEDIUM);\n const isControlled = expandedProp !== undefined && onToggle !== undefined;\n const [internalExpanded, setInternalExpanded] = useState(true);\n const resolvedExpanded = isDesktop ? true : isControlled ? expandedProp : internalExpanded;\n const handleToggle = isControlled\n ? onToggle\n : () => setInternalExpanded((previousExpanded) => !previousExpanded);\n const hasActions = action ?? actionSecondary;\n const mediaId = useId();\n const titleId = useId();\n const descId = useId();\n\n const ariaLabelledByIds = [\n media['aria-hidden'] ? undefined : mediaId,\n !title ? undefined : titleId,\n ]\n .filter(Boolean)\n .join(' ');\n\n const bannerSurface = (\n <Container\n ref={containerRef}\n size=\"fluid\"\n as={PrimitivePrompt as ElementType}\n id={id}\n sentiment={sentiment}\n emphasis={sentiment === 'neutral' ? 'base' : 'elevated'}\n data-testid={testId}\n className={clsx(\n 'wds-critical-banner',\n 'wds-critical-banner-overhang',\n {\n 'wds-critical-banner--collapsed': !resolvedExpanded,\n 'wds-critical-banner--with-two-actions': !!actionSecondary,\n },\n className,\n )}\n media={renderPromptMedia({\n media,\n sentiment,\n mediaId,\n imgClassName: 'wds-critical-banner--media-image',\n })}\n actions={\n hasActions ? (\n <div aria-hidden={!resolvedExpanded ? true : undefined} style={{ display: 'contents' }}>\n {actionSecondary && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"secondary\"\n href={actionSecondary.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={actionSecondary?.onClick}\n >\n {actionSecondary.label}\n </Button>\n )}\n {action && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"primary\"\n href={action.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n )}\n </div>\n ) : undefined\n }\n role=\"region\"\n aria-labelledby={ariaLabelledByIds || undefined}\n aria-describedby={description ? descId : undefined}\n >\n <div className=\"wds-critical-banner__text-wrapper\">\n {title && (\n <Body\n id={titleId}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-critical-banner__content wds-critical-banner__title\"\n >\n {title}\n </Body>\n )}\n {description && (\n <Body\n id={descId}\n className={clsx('wds-critical-banner__content', 'wds-critical-banner__description', {\n 'wds-critical-banner__description--with-title': !!title,\n })}\n >\n {description}\n </Body>\n )}\n </div>\n <ExpanderToggle\n expanded={resolvedExpanded}\n size={24}\n className=\"wds-critical-banner__toggle\"\n onToggle={handleToggle}\n />\n </Container>\n );\n\n return (\n <LiveRegion\n aria-live=\"assertive\"\n announceOnChange={buildAnnouncementString({\n title,\n description,\n expanded: resolvedExpanded,\n actionLabel: action?.label,\n actionSecondaryLabel: actionSecondary?.label,\n })}\n >\n <div className=\"wds-critical-banner-overhang-query\">\n <div\n className={clsx('wds-critical-banner__entry-mask', {\n 'wds-critical-banner__entry-mask--animated': animateEntry,\n })}\n >\n <div className=\"wds-critical-banner__entry-track\">{bannerSurface}</div>\n </div>\n </div>\n </LiveRegion>\n );\n};\n\nexport default CriticalBanner;\n"],"names":["CriticalBanner","sentiment","title","description","media","action","actionSecondary","animateEntry","expanded","expandedProp","onToggle","id","className","testId","containerRef","isDesktop","useContainerSize","Breakpoint","MEDIUM","isControlled","undefined","internalExpanded","setInternalExpanded","useState","resolvedExpanded","handleToggle","previousExpanded","hasActions","mediaId","useId","titleId","descId","ariaLabelledByIds","filter","Boolean","join","bannerSurface","_jsxs","Container","ref","size","as","PrimitivePrompt","emphasis","clsx","renderPromptMedia","imgClassName","actions","style","display","children","_jsx","Button","v2","priority","href","tabIndex","onClick","label","role","Body","type","Typography","BODY_LARGE_BOLD","ExpanderToggle","LiveRegion","announceOnChange","buildAnnouncementString","actionLabel","actionSecondaryLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDO,MAAMA,cAAc,GAAGA,CAAC;AAC7BC,EAAAA,SAAS,GAAG,UAAU;EACtBC,KAAK;EACLC,WAAW;EACXC,KAAK,GAAG,EAAE;EACVC,MAAM;EACNC,eAAe;AACfC,EAAAA,YAAY,GAAG,IAAI;AACnBC,EAAAA,QAAQ,EAAEC,YAAY;EACtBC,QAAQ;EACRC,EAAE;EACFC,SAAS;AACT,EAAA,aAAa,EAAEC;AAAM,CACD,KAAI;EACxB,MAAM,CAACC,YAAY,EAAEC,SAAS,CAAC,GAAGC,iCAAgB,CAACC,wBAAU,CAACC,MAAM,CAAC;EACrE,MAAMC,YAAY,GAAGV,YAAY,KAAKW,SAAS,IAAIV,QAAQ,KAAKU,SAAS;EACzE,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGC,cAAQ,CAAC,IAAI,CAAC;EAC9D,MAAMC,gBAAgB,GAAGT,SAAS,GAAG,IAAI,GAAGI,YAAY,GAAGV,YAAY,GAAGY,gBAAgB;AAC1F,EAAA,MAAMI,YAAY,GAAGN,YAAY,GAC7BT,QAAQ,GACR,MAAMY,mBAAmB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W,iBACVgD,cAAA,CAACS,YAAI,EAAA;AACHjD,QAAAA,EAAE,EAAEoB,MAAO;AACXnB,QAAAA,SAAS,EAAEgC,SAAI,CAAC,8BAA8B,EAAE,kCAAkC,EAAE;UAClF,8CAA8C,EAAE,CAAC,CAAC1C;AACnD,SAAA,CAAE;AAAAgD,QAAAA,QAAA,EAEF/C;AAAW,OACR,CACP;AAAA,KACE,CACL,eAAAgD,cAAA,CAACa,uBAAc,EAAA;AACbxD,MAAAA,QAAQ,EAAEgB,gBAAiB;AAC3BgB,MAAAA,IAAI,EAAE,EAAG;AACT5B,MAAAA,SAAS,EAAC,6BAA6B;AACvCF,MAAAA,QAAQ,EAAEe;AAAa,KAAA,CAE3B;AAAA,GAAW,CACZ;EAED,oBACE0B,cAAA,CAACc,qBAAU,EAAA;AACT,IAAA,WAAA,EAAU,WAAW;IACrBC,gBAAgB,EAAEC,+BAAuB,CAAC;MACxCjE,KAAK;MACLC,WAAW;AACXK,MAAAA,QAAQ,EAAEgB,gBAAgB;MAC1B4C,WAAW,EAAE/D,MAAM,EAAEqD,KAAK;MAC1BW,oBAAoB,EAAE/D,eAAe,EAAEoD;AACxC,KAAA,CAAE;AAAAR,IAAAA,QAAA,eAEHC,cAAA,CAAA,KAAA,EAAA;AAAKvC,MAAAA,SAAS,EAAC,oCAAoC;AAAAsC,MAAAA,QAAA,eACjDC,cAAA,CAAA,KAAA,EAAA;AACEvC,QAAAA,SAAS,EAAEgC,SAAI,CAAC,iCAAiC,EAAE;AACjD,UAAA,2CAA2C,EAAErC;AAC9C,SAAA,CAAE;AAAA2C,QAAAA,QAAA,eAEHC,cAAA,CAAA,KAAA,EAAA;AAAKvC,UAAAA,SAAS,EAAC,kCAAkC;AAAAsC,UAAAA,QAAA,EAAEd;SAAmB;OACnE;KACF;AACP,GAAY,CAAC;AAEjB;;;;"}
1
+ {"version":3,"file":"CriticalBanner.js","sources":["../../../src/Prompt/CriticalBanner/CriticalBanner.tsx"],"sourcesContent":["import { ElementType, ReactNode, useId, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport Body from '../../Body';\nimport Button from '../../Button';\nimport Container from '../../Container';\nimport { Breakpoint, LiveRegion, Typography } from '../../common';\nimport { ButtonProps } from '../../Button/Button.types';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\n\nimport { renderPromptMedia, PromptMedia } from '../helpers/promptMedia';\nimport { ExpanderToggle } from '../common/Expander/Expander';\nimport { buildAnnouncementString } from './helpers';\nimport { useContainerSize } from '../../common/hooks/useContainerSize';\n\nexport type CriticalBannerProps = {\n title?: ReactNode;\n description: ReactNode;\n media?: PromptMedia;\n action?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n actionSecondary?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n sentiment?: Exclude<PrimitivePromptProps['sentiment'], 'proposition'>;\n /**\n * Controls whether the description and actions are visible, as a controlled component.\n * When collapsed with a title, only the title is shown.\n * When collapsed without a title, the description is trimmed to 2 lines.\n *\n * Note: On desktop (container width >= 768px), the banner is always expanded\n * regardless of this prop value.\n */\n expanded?: boolean;\n /**\n * Called when the user clicks the chevron toggle.\n * If not provided, the component will manage expanded state internally.\n */\n onToggle?: () => void;\n} & Pick<PrimitivePromptProps, 'id' | 'className' | 'data-testid'>;\n\n/**\n * A full-width, non-dismissible banner for critical messages such as account blocks or\n * time-sensitive actions that require immediate user attention.\n\n * @see {@link https://docs.wise.design/components/critical-banner Design Spec}\n */\nexport const CriticalBanner = ({\n sentiment = 'negative',\n title,\n description,\n media = {},\n action,\n actionSecondary,\n expanded: expandedProp,\n onToggle,\n id,\n className,\n 'data-testid': testId,\n}: CriticalBannerProps) => {\n const [containerRef, isDesktop] = useContainerSize(Breakpoint.MEDIUM);\n const isControlled = expandedProp !== undefined && onToggle !== undefined;\n const [internalExpanded, setInternalExpanded] = useState(true);\n const resolvedExpanded = isDesktop ? true : isControlled ? expandedProp : internalExpanded;\n const handleToggle = isControlled\n ? onToggle\n : () => setInternalExpanded((previousExpanded) => !previousExpanded);\n const hasActions = action ?? actionSecondary;\n const mediaId = useId();\n const titleId = useId();\n const descId = useId();\n\n const ariaLabelledByIds = [\n media['aria-hidden'] ? undefined : mediaId,\n !title ? undefined : titleId,\n ]\n .filter(Boolean)\n .join(' ');\n\n const bannerSurface = (\n <Container\n ref={containerRef}\n size=\"fluid\"\n as={PrimitivePrompt as ElementType}\n id={id}\n sentiment={sentiment}\n emphasis={sentiment === 'neutral' ? 'base' : 'elevated'}\n data-testid={testId}\n className={clsx(\n 'wds-critical-banner',\n 'wds-critical-banner-overhang',\n {\n 'wds-critical-banner--collapsed': !resolvedExpanded,\n 'wds-critical-banner--with-two-actions': !!actionSecondary,\n },\n className,\n )}\n media={renderPromptMedia({\n media,\n sentiment,\n mediaId,\n imgClassName: 'wds-critical-banner--media-image',\n })}\n actions={\n hasActions ? (\n <div aria-hidden={!resolvedExpanded ? true : undefined} style={{ display: 'contents' }}>\n {actionSecondary && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"secondary\"\n href={actionSecondary.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={actionSecondary?.onClick}\n >\n {actionSecondary.label}\n </Button>\n )}\n {action && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"primary\"\n href={action.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n )}\n </div>\n ) : undefined\n }\n role=\"region\"\n aria-labelledby={ariaLabelledByIds || undefined}\n aria-describedby={description ? descId : undefined}\n >\n <div className=\"wds-critical-banner__text-wrapper\">\n {title && (\n <Body\n id={titleId}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-critical-banner__content wds-critical-banner__title\"\n >\n {title}\n </Body>\n )}\n {description && (\n <Body\n id={descId}\n className={clsx('wds-critical-banner__content', 'wds-critical-banner__description', {\n 'wds-critical-banner__description--with-title': !!title,\n })}\n >\n {description}\n </Body>\n )}\n </div>\n <ExpanderToggle\n expanded={resolvedExpanded}\n size={24}\n className=\"wds-critical-banner__toggle\"\n onToggle={handleToggle}\n />\n </Container>\n );\n\n return (\n <LiveRegion\n aria-live=\"assertive\"\n announceOnChange={buildAnnouncementString({\n title,\n description,\n expanded: resolvedExpanded,\n actionLabel: action?.label,\n actionSecondaryLabel: actionSecondary?.label,\n })}\n >\n <div className=\"wds-critical-banner-overhang-query\">{bannerSurface}</div>\n </LiveRegion>\n );\n};\n\nexport default CriticalBanner;\n"],"names":["CriticalBanner","sentiment","title","description","media","action","actionSecondary","expanded","expandedProp","onToggle","id","className","testId","containerRef","isDesktop","useContainerSize","Breakpoint","MEDIUM","isControlled","undefined","internalExpanded","setInternalExpanded","useState","resolvedExpanded","handleToggle","previousExpanded","hasActions","mediaId","useId","titleId","descId","ariaLabelledByIds","filter","Boolean","join","bannerSurface","_jsxs","Container","ref","size","as","PrimitivePrompt","emphasis","clsx","renderPromptMedia","imgClassName","actions","style","display","children","_jsx","Button","v2","priority","href","tabIndex","onClick","label","role","Body","type","Typography","BODY_LARGE_BOLD","ExpanderToggle","LiveRegion","announceOnChange","buildAnnouncementString","actionLabel","actionSecondaryLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDO,MAAMA,cAAc,GAAGA,CAAC;AAC7BC,EAAAA,SAAS,GAAG,UAAU;EACtBC,KAAK;EACLC,WAAW;EACXC,KAAK,GAAG,EAAE;EACVC,MAAM;EACNC,eAAe;AACfC,EAAAA,QAAQ,EAAEC,YAAY;EACtBC,QAAQ;EACRC,EAAE;EACFC,SAAS;AACT,EAAA,aAAa,EAAEC;AAAM,CACD,KAAI;EACxB,MAAM,CAACC,YAAY,EAAEC,SAAS,CAAC,GAAGC,iCAAgB,CAACC,wBAAU,CAACC,MAAM,CAAC;EACrE,MAAMC,YAAY,GAAGV,YAAY,KAAKW,SAAS,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animateEntry = true,
45
44
  expanded: expandedProp,
46
45
  onToggle,
47
46
  id,
@@ -140,15 +139,7 @@ const CriticalBanner = ({
140
139
  }),
141
140
  children: /*#__PURE__*/jsx("div", {
142
141
  className: "wds-critical-banner-overhang-query",
143
- children: /*#__PURE__*/jsx("div", {
144
- className: clsx('wds-critical-banner__entry-mask', {
145
- 'wds-critical-banner__entry-mask--animated': animateEntry
146
- }),
147
- children: /*#__PURE__*/jsx("div", {
148
- className: "wds-critical-banner__entry-track",
149
- children: bannerSurface
150
- })
151
- })
142
+ children: bannerSurface
152
143
  })
153
144
  });
154
145
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CriticalBanner.mjs","sources":["../../../src/Prompt/CriticalBanner/CriticalBanner.tsx"],"sourcesContent":["import { ElementType, ReactNode, useId, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport Body from '../../Body';\nimport Button from '../../Button';\nimport Container from '../../Container';\nimport { Breakpoint, LiveRegion, Typography } from '../../common';\nimport { ButtonProps } from '../../Button/Button.types';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\n\nimport { renderPromptMedia, PromptMedia } from '../helpers/promptMedia';\nimport { ExpanderToggle } from '../common/Expander/Expander';\nimport { buildAnnouncementString } from './helpers';\nimport { useContainerSize } from '../../common/hooks/useContainerSize';\n\nexport type CriticalBannerProps = {\n title?: ReactNode;\n description: ReactNode;\n media?: PromptMedia;\n action?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n actionSecondary?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n sentiment?: Exclude<PrimitivePromptProps['sentiment'], 'proposition'>;\n /**\n * Controls whether the banner plays its entry animation when mounted.\n * Expand and collapse animations are unaffected.\n */\n animateEntry?: boolean;\n /**\n * Controls whether the description and actions are visible, as a controlled component.\n * When collapsed with a title, only the title is shown.\n * When collapsed without a title, the description is trimmed to 2 lines.\n *\n * Note: On desktop (container width >= 768px), the banner is always expanded\n * regardless of this prop value.\n */\n expanded?: boolean;\n /**\n * Called when the user clicks the chevron toggle.\n * If not provided, the component will manage expanded state internally.\n */\n onToggle?: () => void;\n} & Pick<PrimitivePromptProps, 'id' | 'className' | 'data-testid'>;\n\n/**\n * A full-width, non-dismissible banner for critical messages such as account blocks or\n * time-sensitive actions that require immediate user attention.\n\n * @see {@link https://docs.wise.design/components/critical-banner Design Spec}\n */\nexport const CriticalBanner = ({\n sentiment = 'negative',\n title,\n description,\n media = {},\n action,\n actionSecondary,\n animateEntry = true,\n expanded: expandedProp,\n onToggle,\n id,\n className,\n 'data-testid': testId,\n}: CriticalBannerProps) => {\n const [containerRef, isDesktop] = useContainerSize(Breakpoint.MEDIUM);\n const isControlled = expandedProp !== undefined && onToggle !== undefined;\n const [internalExpanded, setInternalExpanded] = useState(true);\n const resolvedExpanded = isDesktop ? true : isControlled ? expandedProp : internalExpanded;\n const handleToggle = isControlled\n ? onToggle\n : () => setInternalExpanded((previousExpanded) => !previousExpanded);\n const hasActions = action ?? actionSecondary;\n const mediaId = useId();\n const titleId = useId();\n const descId = useId();\n\n const ariaLabelledByIds = [\n media['aria-hidden'] ? undefined : mediaId,\n !title ? undefined : titleId,\n ]\n .filter(Boolean)\n .join(' ');\n\n const bannerSurface = (\n <Container\n ref={containerRef}\n size=\"fluid\"\n as={PrimitivePrompt as ElementType}\n id={id}\n sentiment={sentiment}\n emphasis={sentiment === 'neutral' ? 'base' : 'elevated'}\n data-testid={testId}\n className={clsx(\n 'wds-critical-banner',\n 'wds-critical-banner-overhang',\n {\n 'wds-critical-banner--collapsed': !resolvedExpanded,\n 'wds-critical-banner--with-two-actions': !!actionSecondary,\n },\n className,\n )}\n media={renderPromptMedia({\n media,\n sentiment,\n mediaId,\n imgClassName: 'wds-critical-banner--media-image',\n })}\n actions={\n hasActions ? (\n <div aria-hidden={!resolvedExpanded ? true : undefined} style={{ display: 'contents' }}>\n {actionSecondary && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"secondary\"\n href={actionSecondary.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={actionSecondary?.onClick}\n >\n {actionSecondary.label}\n </Button>\n )}\n {action && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"primary\"\n href={action.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n )}\n </div>\n ) : undefined\n }\n role=\"region\"\n aria-labelledby={ariaLabelledByIds || undefined}\n aria-describedby={description ? descId : undefined}\n >\n <div className=\"wds-critical-banner__text-wrapper\">\n {title && (\n <Body\n id={titleId}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-critical-banner__content wds-critical-banner__title\"\n >\n {title}\n </Body>\n )}\n {description && (\n <Body\n id={descId}\n className={clsx('wds-critical-banner__content', 'wds-critical-banner__description', {\n 'wds-critical-banner__description--with-title': !!title,\n })}\n >\n {description}\n </Body>\n )}\n </div>\n <ExpanderToggle\n expanded={resolvedExpanded}\n size={24}\n className=\"wds-critical-banner__toggle\"\n onToggle={handleToggle}\n />\n </Container>\n );\n\n return (\n <LiveRegion\n aria-live=\"assertive\"\n announceOnChange={buildAnnouncementString({\n title,\n description,\n expanded: resolvedExpanded,\n actionLabel: action?.label,\n actionSecondaryLabel: actionSecondary?.label,\n })}\n >\n <div className=\"wds-critical-banner-overhang-query\">\n <div\n className={clsx('wds-critical-banner__entry-mask', {\n 'wds-critical-banner__entry-mask--animated': animateEntry,\n })}\n >\n <div className=\"wds-critical-banner__entry-track\">{bannerSurface}</div>\n </div>\n </div>\n </LiveRegion>\n );\n};\n\nexport default CriticalBanner;\n"],"names":["CriticalBanner","sentiment","title","description","media","action","actionSecondary","animateEntry","expanded","expandedProp","onToggle","id","className","testId","containerRef","isDesktop","useContainerSize","Breakpoint","MEDIUM","isControlled","undefined","internalExpanded","setInternalExpanded","useState","resolvedExpanded","handleToggle","previousExpanded","hasActions","mediaId","useId","titleId","descId","ariaLabelledByIds","filter","Boolean","join","bannerSurface","_jsxs","Container","ref","size","as","PrimitivePrompt","emphasis","clsx","renderPromptMedia","imgClassName","actions","style","display","children","_jsx","Button","v2","priority","href","tabIndex","onClick","label","role","Body","type","Typography","BODY_LARGE_BOLD","ExpanderToggle","LiveRegion","announceOnChange","buildAnnouncementString","actionLabel","actionSecondaryLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDO,MAAMA,cAAc,GAAGA,CAAC;AAC7BC,EAAAA,SAAS,GAAG,UAAU;EACtBC,KAAK;EACLC,WAAW;EACXC,KAAK,GAAG,EAAE;EACVC,MAAM;EACNC,eAAe;AACfC,EAAAA,YAAY,GAAG,IAAI;AACnBC,EAAAA,QAAQ,EAAEC,YAAY;EACtBC,QAAQ;EACRC,EAAE;EACFC,SAAS;AACT,EAAA,aAAa,EAAEC;AAAM,CACD,KAAI;EACxB,MAAM,CAACC,YAAY,EAAEC,SAAS,CAAC,GAAGC,gBAAgB,CAACC,UAAU,CAACC,MAAM,CAAC;EACrE,MAAMC,YAAY,GAAGV,YAAY,KAAKW,SAAS,IAAIV,QAAQ,KAAKU,SAAS;EACzE,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGC,QAAQ,CAAC,IAAI,CAAC;EAC9D,MAAMC,gBAAgB,GAAGT,SAAS,GAAG,IAAI,GAAGI,YAAY,GAAGV,YAAY,GAAGY,gBAAgB;AAC1F,EAAA,MAAMI,YAAY,GAAGN,YAAY,GAC7BT,QAAQ,GACR,MAAMY,mBAAmB,CAAEI,gBAAgB,IAAK,CAACA,gBAAgB,CAAC;AACtE,EAAA,MAAMC,UAAU,GAAGtB,MAAM,IAAIC,eAAe;AAC5C,EAAA,MAAMsB,OAAO,GAAGC,KAAK,EAAE;AACvB,EAAA,MAAMC,OAAO,GAAGD,KAAK,EAAE;AACvB,EAAA,MAAME,MAAM,GAAGF,KAAK,EAAE;AAEtB,EA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E,CACL,eAAAgD,GAAA,CAACa,cAAc,EAAA;AACbxD,MAAAA,QAAQ,EAAEgB,gBAAiB;AAC3BgB,MAAAA,IAAI,EAAE,EAAG;AACT5B,MAAAA,SAAS,EAAC,6BAA6B;AACvCF,MAAAA,QAAQ,EAAEe;AAAa,KAAA,CAE3B;AAAA,GAAW,CACZ;EAED,oBACE0B,GAAA,CAACc,UAAU,EAAA;AACT,IAAA,WAAA,EAAU,WAAW;IACrBC,gBAAgB,EAAEC,uBAAuB,CAAC;MACxCjE,KAAK;MACLC,WAAW;AACXK,MAAAA,QAAQ,EAAEgB,gBAAgB;MAC1B4C,WAAW,EAAE/D,MAAM,EAAEqD,KAAK;MAC1BW,oBAAoB,EAAE/D,eAAe,EAAEoD;AACxC,KAAA,CAAE;AAAAR,IAAAA,QAAA,eAEHC,GAAA,CAAA,KAAA,EAAA;AAAKvC,MAAAA,SAAS,EAAC,oCAAoC;AAAAsC,MAAAA,QAAA,eACjDC,GAAA,CAAA,KAAA,EAAA;AACEvC,QAAAA,SAAS,EAAEgC,IAAI,CAAC,iCAAiC,EAAE;AACjD,UAAA,2CAA2C,EAAErC;AAC9C,SAAA,CAAE;AAAA2C,QAAAA,QAAA,eAEHC,GAAA,CAAA,KAAA,EAAA;AAAKvC,UAAAA,SAAS,EAAC,kCAAkC;AAAAsC,UAAAA,QAAA,EAAEd;SAAmB;OACnE;KACF;AACP,GAAY,CAAC;AAEjB;;;;"}
1
+ {"version":3,"file":"CriticalBanner.mjs","sources":["../../../src/Prompt/CriticalBanner/CriticalBanner.tsx"],"sourcesContent":["import { ElementType, ReactNode, useId, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport Body from '../../Body';\nimport Button from '../../Button';\nimport Container from '../../Container';\nimport { Breakpoint, LiveRegion, Typography } from '../../common';\nimport { ButtonProps } from '../../Button/Button.types';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\n\nimport { renderPromptMedia, PromptMedia } from '../helpers/promptMedia';\nimport { ExpanderToggle } from '../common/Expander/Expander';\nimport { buildAnnouncementString } from './helpers';\nimport { useContainerSize } from '../../common/hooks/useContainerSize';\n\nexport type CriticalBannerProps = {\n title?: ReactNode;\n description: ReactNode;\n media?: PromptMedia;\n action?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n actionSecondary?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n sentiment?: Exclude<PrimitivePromptProps['sentiment'], 'proposition'>;\n /**\n * Controls whether the description and actions are visible, as a controlled component.\n * When collapsed with a title, only the title is shown.\n * When collapsed without a title, the description is trimmed to 2 lines.\n *\n * Note: On desktop (container width >= 768px), the banner is always expanded\n * regardless of this prop value.\n */\n expanded?: boolean;\n /**\n * Called when the user clicks the chevron toggle.\n * If not provided, the component will manage expanded state internally.\n */\n onToggle?: () => void;\n} & Pick<PrimitivePromptProps, 'id' | 'className' | 'data-testid'>;\n\n/**\n * A full-width, non-dismissible banner for critical messages such as account blocks or\n * time-sensitive actions that require immediate user attention.\n\n * @see {@link https://docs.wise.design/components/critical-banner Design Spec}\n */\nexport const CriticalBanner = ({\n sentiment = 'negative',\n title,\n description,\n media = {},\n action,\n actionSecondary,\n expanded: expandedProp,\n onToggle,\n id,\n className,\n 'data-testid': testId,\n}: CriticalBannerProps) => {\n const [containerRef, isDesktop] = useContainerSize(Breakpoint.MEDIUM);\n const isControlled = expandedProp !== undefined && onToggle !== undefined;\n const [internalExpanded, setInternalExpanded] = useState(true);\n const resolvedExpanded = isDesktop ? true : isControlled ? expandedProp : internalExpanded;\n const handleToggle = isControlled\n ? onToggle\n : () => setInternalExpanded((previousExpanded) => !previousExpanded);\n const hasActions = action ?? actionSecondary;\n const mediaId = useId();\n const titleId = useId();\n const descId = useId();\n\n const ariaLabelledByIds = [\n media['aria-hidden'] ? undefined : mediaId,\n !title ? undefined : titleId,\n ]\n .filter(Boolean)\n .join(' ');\n\n const bannerSurface = (\n <Container\n ref={containerRef}\n size=\"fluid\"\n as={PrimitivePrompt as ElementType}\n id={id}\n sentiment={sentiment}\n emphasis={sentiment === 'neutral' ? 'base' : 'elevated'}\n data-testid={testId}\n className={clsx(\n 'wds-critical-banner',\n 'wds-critical-banner-overhang',\n {\n 'wds-critical-banner--collapsed': !resolvedExpanded,\n 'wds-critical-banner--with-two-actions': !!actionSecondary,\n },\n className,\n )}\n media={renderPromptMedia({\n media,\n sentiment,\n mediaId,\n imgClassName: 'wds-critical-banner--media-image',\n })}\n actions={\n hasActions ? (\n <div aria-hidden={!resolvedExpanded ? true : undefined} style={{ display: 'contents' }}>\n {actionSecondary && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"secondary\"\n href={actionSecondary.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={actionSecondary?.onClick}\n >\n {actionSecondary.label}\n </Button>\n )}\n {action && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"primary\"\n href={action.href}\n tabIndex={resolvedExpanded ? undefined : -1}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n )}\n </div>\n ) : undefined\n }\n role=\"region\"\n aria-labelledby={ariaLabelledByIds || undefined}\n aria-describedby={description ? descId : undefined}\n >\n <div className=\"wds-critical-banner__text-wrapper\">\n {title && (\n <Body\n id={titleId}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-critical-banner__content wds-critical-banner__title\"\n >\n {title}\n </Body>\n )}\n {description && (\n <Body\n id={descId}\n className={clsx('wds-critical-banner__content', 'wds-critical-banner__description', {\n 'wds-critical-banner__description--with-title': !!title,\n })}\n >\n {description}\n </Body>\n )}\n </div>\n <ExpanderToggle\n expanded={resolvedExpanded}\n size={24}\n className=\"wds-critical-banner__toggle\"\n onToggle={handleToggle}\n />\n </Container>\n );\n\n return (\n <LiveRegion\n aria-live=\"assertive\"\n announceOnChange={buildAnnouncementString({\n title,\n description,\n expanded: resolvedExpanded,\n actionLabel: action?.label,\n actionSecondaryLabel: actionSecondary?.label,\n })}\n >\n <div className=\"wds-critical-banner-overhang-query\">{bannerSurface}</div>\n </LiveRegion>\n );\n};\n\nexport default CriticalBanner;\n"],"names":["CriticalBanner","sentiment","title","description","media","action","actionSecondary","expanded","expandedProp","onToggle","id","className","testId","containerRef","isDesktop","useContainerSize","Breakpoint","MEDIUM","isControlled","undefined","internalExpanded","setInternalExpanded","useState","resolvedExpanded","handleToggle","previousExpanded","hasActions","mediaId","useId","titleId","descId","ariaLabelledByIds","filter","Boolean","join","bannerSurface","_jsxs","Container","ref","size","as","PrimitivePrompt","emphasis","clsx","renderPromptMedia","imgClassName","actions","style","display","children","_jsx","Button","v2","priority","href","tabIndex","onClick","label","role","Body","type","Typography","BODY_LARGE_BOLD","ExpanderToggle","LiveRegion","announceOnChange","buildAnnouncementString","actionLabel","actionSecondaryLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDO,MAAMA,cAAc,GAAGA,CAAC;AAC7BC,EAAAA,SAAS,GAAG,UAAU;EACtBC,KAAK;EACLC,WAAW;EACXC,KAAK,GAAG,EAAE;EACVC,MAAM;EACNC,eAAe;AACfC,EAAAA,QAAQ,EAAEC,YAAY;EACtBC,QAAQ;EACRC,EAAE;EACFC,SAAS;AACT,EAAA,aAAa,EAAEC;AAAM,CACD,KAAI;EACxB,MAAM,CAACC,YAAY,EAAEC,SAAS,CAAC,GAAGC,gBAAgB,CAACC,UAAU,CAACC,MAAM,CAAC;EACrE,MAAMC,YAAY,GAAGV,YAAY,KAAKW,SAAS,IAAIV,QAAQ,KAAKU,SAAS;EACzE,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGC,QAAQ,CAAC,IAAI,CAAC;EAC9D,MAAMC,gBAAgB,GAAGT,SAAS,GAAG,IAAI,GAAGI,YAAY,GAAGV,YAAY,GAAGY,gBAAgB;AAC1F,EAAA,MAAMI,YAAY,GAAGN,YAAY,GAC7BT,QAA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ACP,EACAC,WAAW,iBACV+C,GAAA,CAACS,IAAI,EAAA;AACHjD,QAAAA,EAAE,EAAEoB,MAAO;AACXnB,QAAAA,SAAS,EAAEgC,IAAI,CAAC,8BAA8B,EAAE,kCAAkC,EAAE;UAClF,8CAA8C,EAAE,CAAC,CAACzC;AACnD,SAAA,CAAE;AAAA+C,QAAAA,QAAA,EAEF9C;AAAW,OACR,CACP;AAAA,KACE,CACL,eAAA+C,GAAA,CAACa,cAAc,EAAA;AACbxD,MAAAA,QAAQ,EAAEgB,gBAAiB;AAC3BgB,MAAAA,IAAI,EAAE,EAAG;AACT5B,MAAAA,SAAS,EAAC,6BAA6B;AACvCF,MAAAA,QAAQ,EAAEe;AAAa,KAAA,CAE3B;AAAA,GAAW,CACZ;EAED,oBACE0B,GAAA,CAACc,UAAU,EAAA;AACT,IAAA,WAAA,EAAU,WAAW;IACrBC,gBAAgB,EAAEC,uBAAuB,CAAC;MACxChE,KAAK;MACLC,WAAW;AACXI,MAAAA,QAAQ,EAAEgB,gBAAgB;MAC1B4C,WAAW,EAAE9D,MAAM,EAAEoD,KAAK;MAC1BW,oBAAoB,EAAE9D,eAAe,EAAEmD;AACxC,KAAA,CAAE;AAAAR,IAAAA,QAAA,eAEHC,GAAA,CAAA,KAAA,EAAA;AAAKvC,MAAAA,SAAS,EAAC,oCAAoC;AAAAsC,MAAAA,QAAA,EAAEd;KAAmB;AAC1E,GAAY,CAAC;AAEjB;;;;"}
package/build/main.css CHANGED
@@ -25144,35 +25144,6 @@ button.np-link {
25144
25144
  mask: var(--critical-banner-overhang-mask);
25145
25145
  }
25146
25146
  }
25147
- .wds-critical-banner__entry-mask {
25148
- display: grid;
25149
- grid-template-rows: 1fr;
25150
- overflow: visible;
25151
- }
25152
- .wds-critical-banner__entry-mask--animated {
25153
- grid-template-rows: 0fr;
25154
- overflow: hidden;
25155
- animation: wds-critical-banner-reveal-height 400ms ease-in-out both, wds-critical-banner-release-overflow 1ms linear 399ms both;
25156
- }
25157
- .wds-critical-banner__entry-track {
25158
- min-block-size: 0;
25159
- }
25160
- @keyframes wds-critical-banner-reveal-height {
25161
- from {
25162
- grid-template-rows: 0fr;
25163
- }
25164
- to {
25165
- grid-template-rows: 1fr;
25166
- }
25167
- }
25168
- @keyframes wds-critical-banner-release-overflow {
25169
- from {
25170
- overflow: hidden;
25171
- }
25172
- to {
25173
- overflow: visible;
25174
- }
25175
- }
25176
25147
  @media (prefers-reduced-motion: reduce) {
25177
25148
  .wds-critical-banner__description,
25178
25149
  .wds-critical-banner__title,
@@ -25180,11 +25151,6 @@ button.np-link {
25180
25151
  .wds-critical-banner__toggle {
25181
25152
  transition: none !important;
25182
25153
  }
25183
- .wds-critical-banner__entry-mask--animated {
25184
- animation: none;
25185
- grid-template-rows: 1fr;
25186
- overflow: visible;
25187
- }
25188
25154
  }
25189
25155
  .wds-expander-toggle {
25190
25156
  align-self: flex-start;
@@ -155,35 +155,6 @@
155
155
  mask: var(--critical-banner-overhang-mask);
156
156
  }
157
157
  }
158
- .wds-critical-banner__entry-mask {
159
- display: grid;
160
- grid-template-rows: 1fr;
161
- overflow: visible;
162
- }
163
- .wds-critical-banner__entry-mask--animated {
164
- grid-template-rows: 0fr;
165
- overflow: hidden;
166
- animation: wds-critical-banner-reveal-height 400ms ease-in-out both, wds-critical-banner-release-overflow 1ms linear 399ms both;
167
- }
168
- .wds-critical-banner__entry-track {
169
- min-block-size: 0;
170
- }
171
- @keyframes wds-critical-banner-reveal-height {
172
- from {
173
- grid-template-rows: 0fr;
174
- }
175
- to {
176
- grid-template-rows: 1fr;
177
- }
178
- }
179
- @keyframes wds-critical-banner-release-overflow {
180
- from {
181
- overflow: hidden;
182
- }
183
- to {
184
- overflow: visible;
185
- }
186
- }
187
158
  @media (prefers-reduced-motion: reduce) {
188
159
  .wds-critical-banner__description,
189
160
  .wds-critical-banner__title,
@@ -191,9 +162,4 @@
191
162
  .wds-critical-banner__toggle {
192
163
  transition: none !important;
193
164
  }
194
- .wds-critical-banner__entry-mask--animated {
195
- animation: none;
196
- grid-template-rows: 1fr;
197
- overflow: visible;
198
- }
199
165
  }
@@ -25144,35 +25144,6 @@ button.np-link {
25144
25144
  mask: var(--critical-banner-overhang-mask);
25145
25145
  }
25146
25146
  }
25147
- .wds-critical-banner__entry-mask {
25148
- display: grid;
25149
- grid-template-rows: 1fr;
25150
- overflow: visible;
25151
- }
25152
- .wds-critical-banner__entry-mask--animated {
25153
- grid-template-rows: 0fr;
25154
- overflow: hidden;
25155
- animation: wds-critical-banner-reveal-height 400ms ease-in-out both, wds-critical-banner-release-overflow 1ms linear 399ms both;
25156
- }
25157
- .wds-critical-banner__entry-track {
25158
- min-block-size: 0;
25159
- }
25160
- @keyframes wds-critical-banner-reveal-height {
25161
- from {
25162
- grid-template-rows: 0fr;
25163
- }
25164
- to {
25165
- grid-template-rows: 1fr;
25166
- }
25167
- }
25168
- @keyframes wds-critical-banner-release-overflow {
25169
- from {
25170
- overflow: hidden;
25171
- }
25172
- to {
25173
- overflow: visible;
25174
- }
25175
- }
25176
25147
  @media (prefers-reduced-motion: reduce) {
25177
25148
  .wds-critical-banner__description,
25178
25149
  .wds-critical-banner__title,
@@ -25180,11 +25151,6 @@ button.np-link {
25180
25151
  .wds-critical-banner__toggle {
25181
25152
  transition: none !important;
25182
25153
  }
25183
- .wds-critical-banner__entry-mask--animated {
25184
- animation: none;
25185
- grid-template-rows: 1fr;
25186
- overflow: visible;
25187
- }
25188
25154
  }
25189
25155
  .wds-expander-toggle {
25190
25156
  align-self: flex-start;
@@ -13,11 +13,6 @@ export type CriticalBannerProps = {
13
13
  label: ButtonProps['children'];
14
14
  };
15
15
  sentiment?: Exclude<PrimitivePromptProps['sentiment'], 'proposition'>;
16
- /**
17
- * Controls whether the banner plays its entry animation when mounted.
18
- * Expand and collapse animations are unaffected.
19
- */
20
- animateEntry?: boolean;
21
16
  /**
22
17
  * Controls whether the description and actions are visible, as a controlled component.
23
18
  * When collapsed with a title, only the title is shown.
@@ -39,6 +34,6 @@ export type CriticalBannerProps = {
39
34
 
40
35
  * @see {@link https://docs.wise.design/components/critical-banner Design Spec}
41
36
  */
42
- export declare const CriticalBanner: ({ sentiment, title, description, media, action, actionSecondary, animateEntry, expanded: expandedProp, onToggle, id, className, "data-testid": testId, }: CriticalBannerProps) => import("react").JSX.Element;
37
+ export declare const CriticalBanner: ({ sentiment, title, description, media, action, actionSecondary, expanded: expandedProp, onToggle, id, className, "data-testid": testId, }: CriticalBannerProps) => import("react").JSX.Element;
43
38
  export default CriticalBanner;
44
39
  //# sourceMappingURL=CriticalBanner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CriticalBanner.d.ts","sourceRoot":"","sources":["../../../../src/Prompt/CriticalBanner/CriticalBanner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAmB,MAAM,OAAO,CAAC;AAOhE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAmB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAAqB,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAKxE,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,EAAE,SAAS,CAAC;IACvB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC,GAAG;QAC1D,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;KAChC,CAAC;IACF,eAAe,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC,GAAG;QACnE,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;KAChC,CAAC;IACF,SAAS,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC;IACtE;;;OAGG;IACH,YAAY,C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Q,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,GAAG,IAAI,CAAC,oBAAoB,EAAE,IAAI,GAAG,WAAW,GAAG,aAAa,CAAC,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,4IAY5B,mBAAmB,gCA4HrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-abeb3fe",
3
+ "version": "0.0.0-experimental-999c033",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -71,7 +71,7 @@
71
71
  "@types/react-dom": "^18.3.7",
72
72
  "@types/react-transition-group": "4.4.12",
73
73
  "@monaco-editor/react": "^4.7.0",
74
- "monaco-editor": "^0.55.1",
74
+ "monaco-editor": "^0.56.0",
75
75
  "monaco-editor-webpack-plugin": "^7.1.1",
76
76
  "@wise/art": "^2.32.0",
77
77
  "@wise/eslint-config": "^14.2.1",
@@ -155,35 +155,6 @@
155
155
  mask: var(--critical-banner-overhang-mask);
156
156
  }
157
157
  }
158
- .wds-critical-banner__entry-mask {
159
- display: grid;
160
- grid-template-rows: 1fr;
161
- overflow: visible;
162
- }
163
- .wds-critical-banner__entry-mask--animated {
164
- grid-template-rows: 0fr;
165
- overflow: hidden;
166
- animation: wds-critical-banner-reveal-height 400ms ease-in-out both, wds-critical-banner-release-overflow 1ms linear 399ms both;
167
- }
168
- .wds-critical-banner__entry-track {
169
- min-block-size: 0;
170
- }
171
- @keyframes wds-critical-banner-reveal-height {
172
- from {
173
- grid-template-rows: 0fr;
174
- }
175
- to {
176
- grid-template-rows: 1fr;
177
- }
178
- }
179
- @keyframes wds-critical-banner-release-overflow {
180
- from {
181
- overflow: hidden;
182
- }
183
- to {
184
- overflow: visible;
185
- }
186
- }
187
158
  @media (prefers-reduced-motion: reduce) {
188
159
  .wds-critical-banner__description,
189
160
  .wds-critical-banner__title,
@@ -191,9 +162,4 @@
191
162
  .wds-critical-banner__toggle {
192
163
  transition: none !important;
193
164
  }
194
- .wds-critical-banner__entry-mask--animated {
195
- animation: none;
196
- grid-template-rows: 1fr;
197
- overflow: visible;
198
- }
199
165
  }
@@ -193,45 +193,6 @@
193
193
  }
194
194
  }
195
195
 
196
- .wds-critical-banner__entry-mask {
197
- display: grid;
198
- grid-template-rows: 1fr;
199
- overflow: visible;
200
-
201
- // Clip only during the reveal, then release overflow so actions remain visible.
202
- &--animated {
203
- grid-template-rows: 0fr;
204
- overflow: hidden;
205
- animation:
206
- wds-critical-banner-reveal-height 400ms ease-in-out both,
207
- wds-critical-banner-release-overflow 1ms linear 399ms both;
208
- }
209
- }
210
-
211
- .wds-critical-banner__entry-track {
212
- min-height: 0;
213
- }
214
-
215
- @keyframes wds-critical-banner-reveal-height {
216
- from {
217
- grid-template-rows: 0fr;
218
- }
219
-
220
- to {
221
- grid-template-rows: 1fr;
222
- }
223
- }
224
-
225
- @keyframes wds-critical-banner-release-overflow {
226
- from {
227
- overflow: hidden;
228
- }
229
-
230
- to {
231
- overflow: visible;
232
- }
233
- }
234
-
235
196
  // Reduced motion support
236
197
  @media (prefers-reduced-motion: reduce) {
237
198
  .wds-critical-banner__description,
@@ -240,10 +201,4 @@
240
201
  .wds-critical-banner__toggle {
241
202
  transition: none !important;
242
203
  }
243
-
244
- .wds-critical-banner__entry-mask--animated {
245
- animation: none;
246
- grid-template-rows: 1fr;
247
- overflow: visible;
248
- }
249
204
  }
@@ -15,7 +15,7 @@ describe('CriticalBanner', () => {
15
15
  resetLiveRegionAnnouncementQueue();
16
16
  });
17
17
 
18
- it('applies mobile overhang classes by default', () => {
18
+ it('renders mobile overhang markup without entry animation markup', () => {
19
19
  const { container } = render(
20
20
  <CriticalBanner {...defaultProps} data-testid="critical-banner" />,
21
21
  );
@@ -23,30 +23,7 @@ describe('CriticalBanner', () => {
23
23
  expect(screen.getByTestId('critical-banner')).toBeInTheDocument();
24
24
  expect(container.querySelector('.wds-critical-banner-overhang')).toBeInTheDocument();
25
25
  expect(container.querySelector('.wds-critical-banner-overhang-query')).toBeInTheDocument();
26
- });
27
-
28
- it('applies the entry animation by default', () => {
29
- const { container } = render(
30
- <CriticalBanner {...defaultProps} data-testid="critical-banner" />,
31
- );
32
-
33
- expect(screen.getByTestId('critical-banner')).toBeInTheDocument();
34
- expect(
35
- container.querySelector('.wds-critical-banner__entry-mask--animated'),
36
- ).toBeInTheDocument();
37
- expect(container.querySelector('.wds-critical-banner__entry-track')).toBeInTheDocument();
38
- });
39
-
40
- it('can render without the entry animation', () => {
41
- const { container } = render(
42
- <CriticalBanner {...defaultProps} animateEntry={false} data-testid="critical-banner" />,
43
- );
44
-
45
- expect(screen.getByTestId('critical-banner')).toBeInTheDocument();
46
- expect(container.querySelector('.wds-critical-banner__entry-mask')).toBeInTheDocument();
47
- expect(
48
- container.querySelector('.wds-critical-banner__entry-mask--animated'),
49
- ).not.toBeInTheDocument();
50
- expect(container.querySelector('.wds-critical-banner__entry-track')).toBeInTheDocument();
26
+ expect(container.querySelector('.wds-critical-banner__entry-mask')).not.toBeInTheDocument();
27
+ expect(container.querySelector('.wds-critical-banner__entry-track')).not.toBeInTheDocument();
51
28
  });
52
29
  });
@@ -24,11 +24,6 @@ export type CriticalBannerProps = {
24
24
  label: ButtonProps['children'];
25
25
  };
26
26
  sentiment?: Exclude<PrimitivePromptProps['sentiment'], 'proposition'>;
27
- /**
28
- * Controls whether the banner plays its entry animation when mounted.
29
- * Expand and collapse animations are unaffected.
30
- */
31
- animateEntry?: boolean;
32
27
  /**
33
28
  * Controls whether the description and actions are visible, as a controlled component.
34
29
  * When collapsed with a title, only the title is shown.
@@ -58,7 +53,6 @@ export const CriticalBanner = ({
58
53
  media = {},
59
54
  action,
60
55
  actionSecondary,
61
- animateEntry = true,
62
56
  expanded: expandedProp,
63
57
  onToggle,
64
58
  id,
@@ -185,15 +179,7 @@ export const CriticalBanner = ({
185
179
  actionSecondaryLabel: actionSecondary?.label,
186
180
  })}
187
181
  >
188
- <div className="wds-critical-banner-overhang-query">
189
- <div
190
- className={clsx('wds-critical-banner__entry-mask', {
191
- 'wds-critical-banner__entry-mask--animated': animateEntry,
192
- })}
193
- >
194
- <div className="wds-critical-banner__entry-track">{bannerSurface}</div>
195
- </div>
196
- </div>
182
+ <div className="wds-critical-banner-overhang-query">{bannerSurface}</div>
197
183
  </LiveRegion>
198
184
  );
199
185
  };
@@ -66,10 +66,7 @@ Screen readers announce the banner content whenever:
66
66
 
67
67
  ## Reduced Motion
68
68
 
69
- `CriticalBanner` respects the user's reduced motion preference. When reduced motion is on, the component does not show:
70
-
71
- - the entry animation that reveals the banner from above when it first appears
72
- - the collapse and expand animation used when the user toggles the banner content
69
+ `CriticalBanner` respects the user's reduced motion preference. When reduced motion is on, the component does not show the collapse and expand animation used when the user toggles the banner content.
73
70
 
74
71
  The same content is still rendered and announced. Reduced motion only removes the visual movement.
75
72
 
@@ -28,7 +28,6 @@ const meta = {
28
28
  action: { label: 'Verify now', onClick: fn() },
29
29
  actionSecondary: undefined,
30
30
  media: undefined,
31
- animateEntry: true,
32
31
  id: undefined,
33
32
  className: undefined,
34
33
  'data-testid': undefined,
@@ -48,7 +47,6 @@ const meta = {
48
47
  table: { type: { summary: 'ReactNode' } },
49
48
  },
50
49
  expanded: { control: 'boolean' },
51
- animateEntry: { control: 'boolean' },
52
50
  media: {
53
51
  control: false,
54
52
  description: 'Replaces the default Status Icon with a custom image or AvatarView.',
@@ -133,28 +131,12 @@ const hiddenArgTypes = {
133
131
  actionSecondary: { table: { disable: true } },
134
132
  media: { table: { disable: true } },
135
133
  expanded: { table: { disable: true } },
136
- animateEntry: { table: { disable: true } },
137
134
  onToggle: { table: { disable: true } },
138
135
  id: { table: { disable: true } },
139
136
  className: { table: { disable: true } },
140
137
  'data-testid': { table: { disable: true } },
141
138
  } as const;
142
139
 
143
- const AnimatedEntryPreview = (args: CriticalBannerProps) => {
144
- const [bannerInstance, setBannerInstance] = useState(0);
145
-
146
- return (
147
- <>
148
- <CriticalBanner key={bannerInstance} {...args} />
149
- <div className="p-t-3">
150
- <Button block v2 onClick={() => setBannerInstance((current) => current + 1)}>
151
- Replay
152
- </Button>
153
- </div>
154
- </>
155
- );
156
- };
157
-
158
140
  /** Renders children inside an iframe that inherits the parent page's stylesheets. */
159
141
  function IframeContainer({ width, children }: { width: number; children: ReactNode }) {
160
142
  const iframeRef = useRef<HTMLIFrameElement>(null);
@@ -603,40 +585,6 @@ export const MobileOverhang: Story = {
603
585
  },
604
586
  };
605
587
 
606
- /** The banner reveals from above immediately when it enters the page. */
607
- export const AnimatedEntry: Story = {
608
- args: {
609
- title: 'Your account is restricted.',
610
- description: 'Review your personal details to get your account active again.',
611
- action: { label: 'Review details', onClick: fn() },
612
- },
613
- argTypes: hiddenArgTypes,
614
- render: (args) => <AnimatedEntryPreview {...args} />,
615
- parameters: {
616
- layout: 'fullscreen',
617
- docs: {
618
- canvas: { sourceState: 'hidden' },
619
- },
620
- },
621
- };
622
-
623
- /** The banner can mount immediately without replaying its entry animation. */
624
- export const WithoutEntryAnimation: Story = {
625
- args: {
626
- animateEntry: false,
627
- title: 'Your account is restricted.',
628
- description: 'Review your personal details to get your account active again.',
629
- action: { label: 'Review details', onClick: fn() },
630
- },
631
- argTypes: hiddenArgTypes,
632
- parameters: {
633
- layout: 'fullscreen',
634
- docs: {
635
- canvas: { sourceState: 'hidden' },
636
- },
637
- },
638
- };
639
-
640
588
  /**
641
589
  * The text container is capped at 480px for optimal readability, even though
642
590
  * the banner itself stretches to the full available width.
@@ -22,7 +22,6 @@ const wait = async (ms: number) =>
22
22
  });
23
23
 
24
24
  const ANIMATION_DURATION = 200; // 150ms animation + 50ms buffer
25
- const ENTRY_ANIMATION_DURATION = 450; // 400ms animation + 50ms buffer
26
25
 
27
26
  const longDescription =
28
27
  'We have detected unusual activity on your account that does not match your typical usage patterns. To protect your funds and personal information, we have temporarily restricted access. Please verify your identity to restore full access to your account.';
@@ -152,7 +151,7 @@ export const MobileVariants: Story = {
152
151
  ...withVariantConfig(['mobile']),
153
152
  };
154
153
 
155
- /** Neutral background regression test with page content scrolled under the sticky banner. */
154
+ /** Neutral background regression test with page content scrolled under the mobile overhang. */
156
155
  export const BackgroundIsNotTransparent: Story = {
157
156
  args: {
158
157
  sentiment: 'neutral',
@@ -199,7 +198,6 @@ export const BackgroundIsNotTransparent: Story = {
199
198
 
200
199
  if (scrollContainer) {
201
200
  scrollContainer.scrollTop = 250;
202
- await wait(ENTRY_ANIMATION_DURATION);
203
201
  }
204
202
  },
205
203
  ...withVariantConfig(['mobile'], {
@@ -209,25 +207,6 @@ export const BackgroundIsNotTransparent: Story = {
209
207
  }),
210
208
  };
211
209
 
212
- /** Mobile entry animation visual regression test. */
213
- export const AnimatedEntryMobile: Story = {
214
- render: function Render() {
215
- return (
216
- <CriticalBanner
217
- sentiment="negative"
218
- title="Your account is restricted."
219
- description="Review your personal details to get your account active again."
220
- action={{ label: 'Review details', onClick: fn() }}
221
- />
222
- );
223
- },
224
- ...withVariantConfig(['mobile'], {
225
- parameters: {
226
- chromatic: { pauseAnimationAtEnd: true },
227
- },
228
- }),
229
- };
230
-
231
210
  /**
232
211
  * Tests keyboard navigation and interaction:
233
212
  * - Tab focuses the first chevron toggle button
package/src/main.css CHANGED
@@ -25144,35 +25144,6 @@ button.np-link {
25144
25144
  mask: var(--critical-banner-overhang-mask);
25145
25145
  }
25146
25146
  }
25147
- .wds-critical-banner__entry-mask {
25148
- display: grid;
25149
- grid-template-rows: 1fr;
25150
- overflow: visible;
25151
- }
25152
- .wds-critical-banner__entry-mask--animated {
25153
- grid-template-rows: 0fr;
25154
- overflow: hidden;
25155
- animation: wds-critical-banner-reveal-height 400ms ease-in-out both, wds-critical-banner-release-overflow 1ms linear 399ms both;
25156
- }
25157
- .wds-critical-banner__entry-track {
25158
- min-block-size: 0;
25159
- }
25160
- @keyframes wds-critical-banner-reveal-height {
25161
- from {
25162
- grid-template-rows: 0fr;
25163
- }
25164
- to {
25165
- grid-template-rows: 1fr;
25166
- }
25167
- }
25168
- @keyframes wds-critical-banner-release-overflow {
25169
- from {
25170
- overflow: hidden;
25171
- }
25172
- to {
25173
- overflow: visible;
25174
- }
25175
- }
25176
25147
  @media (prefers-reduced-motion: reduce) {
25177
25148
  .wds-critical-banner__description,
25178
25149
  .wds-critical-banner__title,
@@ -25180,11 +25151,6 @@ button.np-link {
25180
25151
  .wds-critical-banner__toggle {
25181
25152
  transition: none !important;
25182
25153
  }
25183
- .wds-critical-banner__entry-mask--animated {
25184
- animation: none;
25185
- grid-template-rows: 1fr;
25186
- overflow: visible;
25187
- }
25188
25154
  }
25189
25155
  .wds-expander-toggle {
25190
25156
  align-self: flex-start;