@transferwise/components 0.0.0-experimental-b0bc049 → 0.0.0-experimental-12c2379

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.
Files changed (42) hide show
  1. package/build/container/Container.js.map +1 -1
  2. package/build/container/Container.mjs.map +1 -1
  3. package/build/main.css +6 -7
  4. package/build/prompt/CriticalBanner/CriticalBanner.js +1 -4
  5. package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -1
  6. package/build/prompt/CriticalBanner/CriticalBanner.mjs +1 -4
  7. package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -1
  8. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
  9. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
  10. package/build/styles/main.css +6 -7
  11. package/build/styles/prompt/ActionPrompt/ActionPrompt.css +1 -1
  12. package/build/styles/prompt/CriticalBanner/CriticalBanner.css +1 -1
  13. package/build/styles/prompt/InfoPrompt/InfoPrompt.css +1 -1
  14. package/build/styles/prompt/InlinePrompt/InlinePrompt.css +1 -1
  15. package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +2 -3
  16. package/build/types/container/Container.d.ts +2 -2
  17. package/build/types/container/Container.d.ts.map +1 -1
  18. package/build/types/iconButton/IconButton.d.ts +1 -1
  19. package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -1
  20. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +1 -1
  21. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
  22. package/package.json +1 -1
  23. package/src/checkboxButton/CheckboxButton.story.tsx +16 -0
  24. package/src/chips/Chips.story.tsx +23 -0
  25. package/src/circularButton/CircularButton.story.tsx +13 -0
  26. package/src/container/Container.tsx +2 -2
  27. package/src/iconButton/IconButton.story.tsx +8 -0
  28. package/src/main.css +6 -7
  29. package/src/prompt/ActionPrompt/ActionPrompt.css +1 -1
  30. package/src/prompt/ActionPrompt/ActionPrompt.less +1 -1
  31. package/src/prompt/CriticalBanner/CriticalBanner.css +1 -1
  32. package/src/prompt/CriticalBanner/CriticalBanner.less +1 -1
  33. package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +1 -1
  34. package/src/prompt/CriticalBanner/CriticalBanner.tsx +3 -6
  35. package/src/prompt/InfoPrompt/InfoPrompt.css +1 -1
  36. package/src/prompt/InfoPrompt/InfoPrompt.less +1 -1
  37. package/src/prompt/InlinePrompt/InlinePrompt.css +1 -1
  38. package/src/prompt/InlinePrompt/InlinePrompt.less +1 -1
  39. package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +2 -3
  40. package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +1 -2
  41. package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +1 -1
  42. package/src/switch/Switch.story.tsx +17 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Container.js","sources":["../../src/container/Container.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { ComponentPropsWithRef, ElementType, PropsWithChildren } from 'react';\n\nimport { CommonProps } from '../common';\n\ntype ContainerOwnProps<T extends ElementType> = CommonProps & {\n /** Controls the maximum width: `fluid` (100%), `standard` (1160px), `narrow` (840px), `compact` (600px). @default 'standard' */\n size?: 'fluid' | 'standard' | 'narrow' | 'compact';\n as?: T;\n};\n\nexport type ContainerProps<T extends ElementType = 'div'> = PropsWithChildren<\n ContainerOwnProps<T>\n> &\n Omit<ComponentPropsWithRef<T>, keyof ContainerOwnProps<T> | 'children'>;\n\n/**\n * Centers page content within a responsive max-width boundary, with automatic horizontal padding that adapts to the viewport size.\n *\n * **Design guidance**: <a href=\"https://docs.wise.design/foundations/grid\" target=\"_blank\">wise.design/foundations/grid</a>\n */\nconst Container = <T extends ElementType = 'div'>({\n size = 'standard',\n as,\n className,\n children,\n ...otherProps\n}: ContainerProps<T>) => {\n const Element = as ?? 'div';\n return (\n <Element {...otherProps} className={clsx('wds-container', `wds-container--${size}`, className)}>\n {children}\n </Element>\n );\n};\n\nexport default Container;\n"],"names":["Container","size","as","className","children","otherProps","Element","_jsx","clsx"],"mappings":";;;;;;;AAqBA,MAAMA,SAAS,GAAGA,CAAgC;AAChDC,EAAAA,IAAI,GAAG,UAAU;EACjBC,EAAE;EACFC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAU,CACK,KAAI;AACtB,EAAA,MAAMC,OAAO,GAAGJ,EAAE,IAAI,KAAK;EAC3B,oBACEK,cAAA,CAACD,OAAO,EAAA;AAAA,IAAA,GAAKD,UAAU;IAAEF,SAAS,EAAEK,SAAI,CAAC,eAAe,EAAE,kBAAkBP,IAAI,CAAA,CAAE,EAAEE,SAAS,CAAE;AAAAC,IAAAA,QAAA,EAC5FA;AAAQ,GACF,CAAC;AAEd;;;;"}
1
+ {"version":3,"file":"Container.js","sources":["../../src/container/Container.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { ComponentPropsWithoutRef, ElementType, PropsWithChildren } from 'react';\n\nimport { CommonProps } from '../common';\n\ntype ContainerOwnProps<T extends ElementType> = CommonProps & {\n /** Controls the maximum width: `fluid` (100%), `standard` (1160px), `narrow` (840px), `compact` (600px). @default 'standard' */\n size?: 'fluid' | 'standard' | 'narrow' | 'compact';\n as?: T;\n};\n\nexport type ContainerProps<T extends ElementType = 'div'> = PropsWithChildren<\n ContainerOwnProps<T>\n> &\n Omit<ComponentPropsWithoutRef<T>, keyof ContainerOwnProps<T> | 'children'>;\n\n/**\n * Centers page content within a responsive max-width boundary, with automatic horizontal padding that adapts to the viewport size.\n *\n * **Design guidance**: <a href=\"https://docs.wise.design/foundations/grid\" target=\"_blank\">wise.design/foundations/grid</a>\n */\nconst Container = <T extends ElementType = 'div'>({\n size = 'standard',\n as,\n className,\n children,\n ...otherProps\n}: ContainerProps<T>) => {\n const Element = as ?? 'div';\n return (\n <Element {...otherProps} className={clsx('wds-container', `wds-container--${size}`, className)}>\n {children}\n </Element>\n );\n};\n\nexport default Container;\n"],"names":["Container","size","as","className","children","otherProps","Element","_jsx","clsx"],"mappings":";;;;;;;AAqBA,MAAMA,SAAS,GAAGA,CAAgC;AAChDC,EAAAA,IAAI,GAAG,UAAU;EACjBC,EAAE;EACFC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAU,CACK,KAAI;AACtB,EAAA,MAAMC,OAAO,GAAGJ,EAAE,IAAI,KAAK;EAC3B,oBACEK,cAAA,CAACD,OAAO,EAAA;AAAA,IAAA,GAAKD,UAAU;IAAEF,SAAS,EAAEK,SAAI,CAAC,eAAe,EAAE,kBAAkBP,IAAI,CAAA,CAAE,EAAEE,SAAS,CAAE;AAAAC,IAAAA,QAAA,EAC5FA;AAAQ,GACF,CAAC;AAEd;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Container.mjs","sources":["../../src/container/Container.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { ComponentPropsWithRef, ElementType, PropsWithChildren } from 'react';\n\nimport { CommonProps } from '../common';\n\ntype ContainerOwnProps<T extends ElementType> = CommonProps & {\n /** Controls the maximum width: `fluid` (100%), `standard` (1160px), `narrow` (840px), `compact` (600px). @default 'standard' */\n size?: 'fluid' | 'standard' | 'narrow' | 'compact';\n as?: T;\n};\n\nexport type ContainerProps<T extends ElementType = 'div'> = PropsWithChildren<\n ContainerOwnProps<T>\n> &\n Omit<ComponentPropsWithRef<T>, keyof ContainerOwnProps<T> | 'children'>;\n\n/**\n * Centers page content within a responsive max-width boundary, with automatic horizontal padding that adapts to the viewport size.\n *\n * **Design guidance**: <a href=\"https://docs.wise.design/foundations/grid\" target=\"_blank\">wise.design/foundations/grid</a>\n */\nconst Container = <T extends ElementType = 'div'>({\n size = 'standard',\n as,\n className,\n children,\n ...otherProps\n}: ContainerProps<T>) => {\n const Element = as ?? 'div';\n return (\n <Element {...otherProps} className={clsx('wds-container', `wds-container--${size}`, className)}>\n {children}\n </Element>\n );\n};\n\nexport default Container;\n"],"names":["Container","size","as","className","children","otherProps","Element","_jsx","clsx"],"mappings":";;;AAqBA,MAAMA,SAAS,GAAGA,CAAgC;AAChDC,EAAAA,IAAI,GAAG,UAAU;EACjBC,EAAE;EACFC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAU,CACK,KAAI;AACtB,EAAA,MAAMC,OAAO,GAAGJ,EAAE,IAAI,KAAK;EAC3B,oBACEK,GAAA,CAACD,OAAO,EAAA;AAAA,IAAA,GAAKD,UAAU;IAAEF,SAAS,EAAEK,IAAI,CAAC,eAAe,EAAE,kBAAkBP,IAAI,CAAA,CAAE,EAAEE,SAAS,CAAE;AAAAC,IAAAA,QAAA,EAC5FA;AAAQ,GACF,CAAC;AAEd;;;;"}
1
+ {"version":3,"file":"Container.mjs","sources":["../../src/container/Container.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { ComponentPropsWithoutRef, ElementType, PropsWithChildren } from 'react';\n\nimport { CommonProps } from '../common';\n\ntype ContainerOwnProps<T extends ElementType> = CommonProps & {\n /** Controls the maximum width: `fluid` (100%), `standard` (1160px), `narrow` (840px), `compact` (600px). @default 'standard' */\n size?: 'fluid' | 'standard' | 'narrow' | 'compact';\n as?: T;\n};\n\nexport type ContainerProps<T extends ElementType = 'div'> = PropsWithChildren<\n ContainerOwnProps<T>\n> &\n Omit<ComponentPropsWithoutRef<T>, keyof ContainerOwnProps<T> | 'children'>;\n\n/**\n * Centers page content within a responsive max-width boundary, with automatic horizontal padding that adapts to the viewport size.\n *\n * **Design guidance**: <a href=\"https://docs.wise.design/foundations/grid\" target=\"_blank\">wise.design/foundations/grid</a>\n */\nconst Container = <T extends ElementType = 'div'>({\n size = 'standard',\n as,\n className,\n children,\n ...otherProps\n}: ContainerProps<T>) => {\n const Element = as ?? 'div';\n return (\n <Element {...otherProps} className={clsx('wds-container', `wds-container--${size}`, className)}>\n {children}\n </Element>\n );\n};\n\nexport default Container;\n"],"names":["Container","size","as","className","children","otherProps","Element","_jsx","clsx"],"mappings":";;;AAqBA,MAAMA,SAAS,GAAGA,CAAgC;AAChDC,EAAAA,IAAI,GAAG,UAAU;EACjBC,EAAE;EACFC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAU,CACK,KAAI;AACtB,EAAA,MAAMC,OAAO,GAAGJ,EAAE,IAAI,KAAK;EAC3B,oBACEK,GAAA,CAACD,OAAO,EAAA;AAAA,IAAA,GAAKD,UAAU;IAAEF,SAAS,EAAEK,IAAI,CAAC,eAAe,EAAE,kBAAkBP,IAAI,CAAA,CAAE,EAAEE,SAAS,CAAE;AAAAC,IAAAA,QAAA,EAC5FA;AAAQ,GACF,CAAC;AAEd;;;;"}
package/build/main.css CHANGED
@@ -31687,15 +31687,14 @@ html:not([dir="rtl"]) .np-navigation-option {
31687
31687
  }
31688
31688
 
31689
31689
  .wds-prompt {
31690
- --Prompt-padding-x: var(--padding-x-small);
31691
31690
  border-radius: 10px;
31692
31691
  border-radius: var(--Prompt-border-radius, var(--radius-small));
31693
31692
  display: flex;
31694
31693
  gap: 16px;
31695
31694
  gap: var(--Prompt-gap, var(--size-16));
31696
31695
  word-wrap: break-word;
31697
- padding: 8px var(--Prompt-padding-y);
31698
- padding: var(--Prompt-padding-x) var(--Prompt-padding-y);
31696
+ padding: 8px;
31697
+ padding: var(--Prompt-padding, var(--padding-x-small));
31699
31698
  text-align: left;
31700
31699
  word-break: break-word;
31701
31700
  width: 100%;
@@ -31747,7 +31746,7 @@ html:not([dir="rtl"]) .np-navigation-option {
31747
31746
 
31748
31747
  .wds-inline-prompt {
31749
31748
  --Prompt-gap: calc(var(--size-12) / 2);
31750
- --Prompt-padding-x: calc(var(--padding-x-small) / 2) var(--padding-x-small);
31749
+ --Prompt-padding: calc(var(--padding-x-small) / 2) var(--padding-x-small);
31751
31750
  display: inline-flex;
31752
31751
  border-radius: 10px;
31753
31752
  border-radius: var(--radius-small);
@@ -31817,7 +31816,7 @@ html:not([dir="rtl"]) .np-navigation-option {
31817
31816
  .wds-info-prompt {
31818
31817
  --Prompt-border-radius: var(--radius-medium);
31819
31818
  --Prompt-gap: var(--size-8);
31820
- --Prompt-padding-x: var(--size-12);
31819
+ --Prompt-padding: var(--size-12);
31821
31820
  }
31822
31821
 
31823
31822
  .wds-info-prompt__content {
@@ -31883,7 +31882,7 @@ html:not([dir="rtl"]) .np-navigation-option {
31883
31882
  }
31884
31883
 
31885
31884
  .wds-action-prompt {
31886
- --Prompt-padding-x: var(--size-16);
31885
+ --Prompt-padding: var(--size-16);
31887
31886
  --Prompt-actions-gap: var(--size-8);
31888
31887
  --Prompt-gap: var(--size-10) var(--size-16);
31889
31888
  --Prompt-border-radius: var(--radius-large);
@@ -31918,7 +31917,7 @@ html:not([dir="rtl"]) .np-navigation-option {
31918
31917
  }
31919
31918
 
31920
31919
  .wds-critical-banner {
31921
- --Prompt-padding-y: var(--wds-container-padding-inline);
31920
+ --Prompt-padding: var(--size-16);
31922
31921
  --Prompt-actions-gap: var(--size-8);
31923
31922
  --Prompt-gap: var(--size-10) var(--size-16);
31924
31923
  --Prompt-border-radius: 0;
@@ -4,7 +4,6 @@ var React = require('react');
4
4
  var clsx = require('clsx');
5
5
  var Body = require('../../body/Body.js');
6
6
  var Button_resolver = require('../../button/Button.resolver.js');
7
- var Container = require('../../container/Container.js');
8
7
  require('../../common/theme.js');
9
8
  require('../../common/direction.js');
10
9
  var neptuneTokens = require('@transferwise/neptune-tokens');
@@ -68,9 +67,7 @@ const CriticalBanner = ({
68
67
  actionLabel: action?.label,
69
68
  actionSecondaryLabel: actionSecondary?.label
70
69
  }),
71
- children: /*#__PURE__*/jsxRuntime.jsxs(Container.default, {
72
- size: "fluid",
73
- as: PrimitivePrompt.PrimitivePrompt,
70
+ children: /*#__PURE__*/jsxRuntime.jsxs(PrimitivePrompt.PrimitivePrompt, {
74
71
  ref: containerRef,
75
72
  id: id,
76
73
  sentiment: sentiment,
@@ -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 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 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 <Container\n size=\"fluid\"\n as={PrimitivePrompt as ElementType}\n ref={containerRef}\n id={id}\n sentiment={sentiment}\n emphasis={sentiment === 'neutral' ? 'base' : 'elevated'}\n data-testid={testId}\n className={clsx(\n 'wds-critical-banner',\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 </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","_jsx","LiveRegion","announceOnChange","buildAnnouncementString","actionLabel","label","actionSecondaryLabel","children","_jsxs","Container","size","as","PrimitivePrompt","ref","emphasis","clsx","renderPromptMedia","imgClassName","actions","style","display","Button","v2","priority","href","tabIndex","onClick","role","Body","type","Typography","BODY_LARGE_BOLD","ExpanderToggle"],"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,IAAIV,QAAQ,KAAKU,SAAS;EACzE,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGC,cAAQ,CAAC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BAAiB,IAAIZ,SAAU;AAChD,MAAA,kBAAA,EAAkBhB,WAAW,GAAG2B,MAAM,GAAGX,SAAU;AAAAuB,MAAAA,QAAA,gBAEnDC,eAAA,CAAA,KAAA,EAAA;AAAKhC,QAAAA,SAAS,EAAC,mCAAmC;AAAA+B,QAAAA,QAAA,EAAA,CAC/CxC,KAAK,iBACJiC,cAAA,CAAC4B,YAAI,EAAA;AACHrD,UAAAA,EAAE,EAAEmB,OAAQ;UACZmC,IAAI,EAAEC,qBAAU,CAACC,eAAgB;AACjCvD,UAAAA,SAAS,EAAC,yDAAyD;AAAA+B,UAAAA,QAAA,EAElExC;AAAK,SACF,CACP,EACAC,WAAW,iBACVgC,cAAA,CAAC4B,YAAI,EAAA;AACHrD,UAAAA,EAAE,EAAEoB,MAAO;AACXnB,UAAAA,SAAS,EAAEuC,SAAI,CAAC,8BAA8B,EAAE,kCAAkC,EAAE;YAClF,8CAA8C,EAAE,CAAC,CAAChD;AACnD,WAAA,CAAE;AAAAwC,UAAAA,QAAA,EAEFvC;AAAW,SACR,CACP;AAAA,OACE,CACL,eAAAgC,cAAA,CAACgC,uBAAc,EAAA;AACb5D,QAAAA,QAAQ,EAAEgB,gBAAiB;AAC3BsB,QAAAA,IAAI,EAAE,EAAG;AACTlC,QAAAA,SAAS,EAAC,6BAA6B;AACvCF,QAAAA,QAAQ,EAAEe;AAAa,OAAA,CAE3B;KAAW;AACb,GAAY,CAAC;AAEjB;;;;"}
1
+ {"version":3,"file":"CriticalBanner.js","sources":["../../../src/prompt/CriticalBanner/CriticalBanner.tsx"],"sourcesContent":["import { ReactNode, useId, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport Body from '../../body';\nimport Button from '../../button';\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 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 <PrimitivePrompt\n ref={containerRef}\n id={id}\n sentiment={sentiment}\n emphasis={sentiment === 'neutral' ? 'base' : 'elevated'}\n data-testid={testId}\n className={clsx(\n 'wds-critical-banner',\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 </PrimitivePrompt>\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","_jsx","LiveRegion","announceOnChange","buildAnnouncementString","actionLabel","label","actionSecondaryLabel","children","_jsxs","PrimitivePrompt","ref","emphasis","clsx","renderPromptMedia","imgClassName","actions","style","display","Button","v2","size","priority","href","tabIndex","onClick","role","Body","type","Typography","BODY_LARGE_BOLD","ExpanderToggle"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CO,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,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,CAAEI,gBAAgB,IAAK,CAACA,gBAAgB,CAAC;AACtE,EAAA,MAAMC,UAAU,GAAGrB,MAAM,IAAIC,eAAe;AAC5C,EAAA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AAC,yDAAyD;AAAA+B,UAAAA,QAAA,EAElExC;AAAK,SACF,CACP,EACAC,WAAW,iBACVgC,cAAA,CAAC0B,YAAI,EAAA;AACHnD,UAAAA,EAAE,EAAEoB,MAAO;AACXnB,UAAAA,SAAS,EAAEoC,SAAI,CAAC,8BAA8B,EAAE,kCAAkC,EAAE;YAClF,8CAA8C,EAAE,CAAC,CAAC7C;AACnD,WAAA,CAAE;AAAAwC,UAAAA,QAAA,EAEFvC;AAAW,SACR,CACP;AAAA,OACE,CACL,eAAAgC,cAAA,CAAC8B,uBAAc,EAAA;AACb1D,QAAAA,QAAQ,EAAEgB,gBAAiB;AAC3BgC,QAAAA,IAAI,EAAE,EAAG;AACT5C,QAAAA,SAAS,EAAC,6BAA6B;AACvCF,QAAAA,QAAQ,EAAEe;AAAa,OAAA,CAE3B;KAAiB;AACnB,GAAY,CAAC;AAEjB;;;;"}
@@ -2,7 +2,6 @@ import { useState, useId } from 'react';
2
2
  import { clsx } from 'clsx';
3
3
  import Body from '../../body/Body.mjs';
4
4
  import Button from '../../button/Button.resolver.mjs';
5
- import Container from '../../container/Container.mjs';
6
5
  import '../../common/theme.mjs';
7
6
  import '../../common/direction.mjs';
8
7
  import { Breakpoint } from '@transferwise/neptune-tokens';
@@ -66,9 +65,7 @@ const CriticalBanner = ({
66
65
  actionLabel: action?.label,
67
66
  actionSecondaryLabel: actionSecondary?.label
68
67
  }),
69
- children: /*#__PURE__*/jsxs(Container, {
70
- size: "fluid",
71
- as: PrimitivePrompt,
68
+ children: /*#__PURE__*/jsxs(PrimitivePrompt, {
72
69
  ref: containerRef,
73
70
  id: id,
74
71
  sentiment: sentiment,
@@ -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 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 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 <Container\n size=\"fluid\"\n as={PrimitivePrompt as ElementType}\n ref={containerRef}\n id={id}\n sentiment={sentiment}\n emphasis={sentiment === 'neutral' ? 'base' : 'elevated'}\n data-testid={testId}\n className={clsx(\n 'wds-critical-banner',\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 </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","_jsx","LiveRegion","announceOnChange","buildAnnouncementString","actionLabel","label","actionSecondaryLabel","children","_jsxs","Container","size","as","PrimitivePrompt","ref","emphasis","clsx","renderPromptMedia","imgClassName","actions","style","display","Button","v2","priority","href","tabIndex","onClick","role","Body","type","Typography","BODY_LARGE_BOLD","ExpanderToggle"],"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;AAC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C,IAAA,CAAA,KAAA,EAAA;AAAKhC,QAAAA,SAAS,EAAC,mCAAmC;AAAA+B,QAAAA,QAAA,EAAA,CAC/CxC,KAAK,iBACJiC,GAAA,CAAC4B,IAAI,EAAA;AACHrD,UAAAA,EAAE,EAAEmB,OAAQ;UACZmC,IAAI,EAAEC,UAAU,CAACC,eAAgB;AACjCvD,UAAAA,SAAS,EAAC,yDAAyD;AAAA+B,UAAAA,QAAA,EAElExC;AAAK,SACF,CACP,EACAC,WAAW,iBACVgC,GAAA,CAAC4B,IAAI,EAAA;AACHrD,UAAAA,EAAE,EAAEoB,MAAO;AACXnB,UAAAA,SAAS,EAAEuC,IAAI,CAAC,8BAA8B,EAAE,kCAAkC,EAAE;YAClF,8CAA8C,EAAE,CAAC,CAAChD;AACnD,WAAA,CAAE;AAAAwC,UAAAA,QAAA,EAEFvC;AAAW,SACR,CACP;AAAA,OACE,CACL,eAAAgC,GAAA,CAACgC,cAAc,EAAA;AACb5D,QAAAA,QAAQ,EAAEgB,gBAAiB;AAC3BsB,QAAAA,IAAI,EAAE,EAAG;AACTlC,QAAAA,SAAS,EAAC,6BAA6B;AACvCF,QAAAA,QAAQ,EAAEe;AAAa,OAAA,CAE3B;KAAW;AACb,GAAY,CAAC;AAEjB;;;;"}
1
+ {"version":3,"file":"CriticalBanner.mjs","sources":["../../../src/prompt/CriticalBanner/CriticalBanner.tsx"],"sourcesContent":["import { ReactNode, useId, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport Body from '../../body';\nimport Button from '../../button';\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 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 <PrimitivePrompt\n ref={containerRef}\n id={id}\n sentiment={sentiment}\n emphasis={sentiment === 'neutral' ? 'base' : 'elevated'}\n data-testid={testId}\n className={clsx(\n 'wds-critical-banner',\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 </PrimitivePrompt>\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","_jsx","LiveRegion","announceOnChange","buildAnnouncementString","actionLabel","label","actionSecondaryLabel","children","_jsxs","PrimitivePrompt","ref","emphasis","clsx","renderPromptMedia","imgClassName","actions","style","display","Button","v2","size","priority","href","tabIndex","onClick","role","Body","type","Typography","BODY_LARGE_BOLD","ExpanderToggle"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CO,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,QAAQ,GACR,MAAMY,mBAAmB,CAAEI,gBAAgB,IAAK,CAACA,gBAAgB,CAAC;AACtE,EAAA,MAAMC,UAAU,GAAGrB,MAAM,IAAIC,eAAe;AAC5C,EAAA,MAAMqB,OAAO,GAAGC,KAAK,EAAE;AACvB,EAAA,MAAMC,OAAO,GAAGD,KAAK,EAAE;AACvB,EAAA,MAAME,MAAM,GAAGF,KAAK,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E,EAAEoB,MAAO;AACXnB,UAAAA,SAAS,EAAEoC,IAAI,CAAC,8BAA8B,EAAE,kCAAkC,EAAE;YAClF,8CAA8C,EAAE,CAAC,CAAC7C;AACnD,WAAA,CAAE;AAAAwC,UAAAA,QAAA,EAEFvC;AAAW,SACR,CACP;AAAA,OACE,CACL,eAAAgC,GAAA,CAAC8B,cAAc,EAAA;AACb1D,QAAAA,QAAQ,EAAEgB,gBAAiB;AAC3BgC,QAAAA,IAAI,EAAE,EAAG;AACT5C,QAAAA,SAAS,EAAC,6BAA6B;AACvCF,QAAAA,QAAQ,EAAEe;AAAa,OAAA,CAE3B;KAAiB;AACnB,GAAY,CAAC;AAEjB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PrimitivePrompt.js","sources":["../../../src/prompt/PrimitivePrompt/PrimitivePrompt.tsx"],"sourcesContent":["import { Cross } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport SentimentSurface, { Emphasis, Sentiment } from '../../sentimentSurface';\nimport IconButton from '../../iconButton';\nimport { useIntl } from 'react-intl';\nimport closeBtnMessages from '../../common/closeButton/CloseButton.messages';\nimport { forwardRef, HTMLAttributes, ReactNode } from 'react';\n\nexport type PrimitivePromptProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * The sentiment determines the colour scheme.\n * @default success\n */\n sentiment?: Sentiment;\n /**\n * The emphasis level affecting background and text contrast.\n * @default 'base'\n */\n emphasis?: Emphasis;\n /**\n * Media to be displayed on the prompt (icon/image/etc).\n */\n media: ReactNode;\n /**\n * Any actions to be displayed on the prompt.\n */\n actions?: ReactNode;\n /**\n * Handler called when the close button is clicked. If not provided, then the close button is hidden.\n */\n onDismiss?: () => void;\n /**\n * Test ID for testing tools\n */\n 'data-testid'?: string;\n};\n\n/**\n * PrimitivePrompt is a low-level component that provides the structure, sentiment support and styling for various prompts.\n * Uses several css variables to handle styling from within the consuming component, e.g. --Prompt-padding-x. */\nexport const PrimitivePrompt = forwardRef<HTMLDivElement, PrimitivePromptProps>(\n (\n {\n sentiment = 'success',\n emphasis = 'base',\n media,\n actions,\n onDismiss,\n className,\n children,\n ...restProps\n },\n ref,\n ) => {\n const intl = useIntl();\n\n return (\n <SentimentSurface\n // @ts-expect-error - SentimentSurface forwardRef types don't expose ref in props\n ref={ref}\n sentiment={sentiment}\n emphasis={emphasis}\n className={clsx('wds-prompt', `wds-prompt--${sentiment}`, className)}\n {...restProps}\n >\n <div\n className={clsx('wds-prompt__content-wrapper', {\n 'wds-prompt__content-wrapper--with-dismiss': !!onDismiss,\n })}\n >\n <div className={clsx('wds-prompt__media-wrapper')}>{media}</div>\n {children}\n {onDismiss && (\n <IconButton\n size={24}\n priority=\"secondary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onDismiss}\n >\n <Cross />\n </IconButton>\n )}\n {actions && <div className=\"wds-prompt__actions-wrapper\">{actions}</div>}\n </div>\n </SentimentSurface>\n );\n },\n);\n\nPrimitivePrompt.displayName = 'PrimitivePrompt';\n"],"names":["PrimitivePrompt","forwardRef","sentiment","emphasis","media","actions","onDismiss","className","children","restProps","ref","intl","useIntl","_jsx","SentimentSurface","clsx","_jsxs","IconButton","size","priority","formatMessage","closeBtnMessages","ariaLabel","onClick","Cross","displayName"],"mappings":";;;;;;;;;;;AAwCO,MAAMA,eAAe,gBAAGC,gBAAU,CACvC,CACE;AACEC,EAAAA,SAAS,GAAG,SAAS;AACrBC,EAAAA,QAAQ,GAAG,MAAM;EACjBC,KAAK;EACLC,OAAO;EACPC,SAAS;EACTC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAS,CACb,EACDC,GAAG,KACD;AACF,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE;AAEtB,EAAA,oBACEC,cAAA,CAACC;AACC;AAAA,IAAA;AACAJ,IAAAA,GAAG,EAAEA,GAAI;AACTR,IAAAA,SAAS,EAAEA,SAAU;AACrBC,IAAAA,QAAQ,EAAEA,QAAS;IACnBI,SAAS,EAAEQ,SAAI,CAAC,YAAY,EAAE,eAAeb,SAAS,CAAA,CAAE,EAAEK,SAAS,CAAE;AAAA,IAAA,GACjEE,SAAS;AAAAD,IAAAA,QAAA,eAEbQ,eAAA,CAAA,KAAA,EAAA;AACET,MAAAA,SAAS,EAAEQ,SAAI,CAAC,6BAA6B,EAAE;QAC7C,2CAA2C,EAAE,CAAC,CAACT;AAChD,OAAA,CAAE;AAAAE,MAAAA,QAAA,gBAEHK,cAAA,CAAA,KAAA,EAAA;AAAKN,QAAAA,SAAS,EAAEQ,SAAI,CAAC,2BAA2B,CAAE;AAAAP,QAAAA,QAAA,EAAEJ;OAAW,CAC/D,EAACI,QAAQ,EACRF,SAAS,iBACRO,cAAA,CAACI,kBAAU,EAAA;AACTC,QAAAA,IAAI,EAAE,EAAG;AACTC,QAAAA,QAAQ,EAAC,WAAW;AACpB,QAAA,YAAA,EAAYR,IAAI,CAACS,aAAa,CAACC,4BAAgB,CAACC,SAAS,CAAE;AAC3DC,QAAAA,OAAO,EAAEjB,SAAU;AAAAE,QAAAA,QAAA,eAEnBK,cAAA,CAACW,WAAK,EAAA,EAAA;AACR,OAAY,CACb,EACAnB,OAAO,iBAAIQ,cAAA,CAAA,KAAA,EAAA;AAAKN,QAAAA,SAAS,EAAC,6BAA6B;AAAAC,QAAAA,QAAA,EAAEH;AAAO,OAAM,CAAC;KACrE;AACP,GAAkB,CAAC;AAEvB,CAAC;AAGHL,eAAe,CAACyB,WAAW,GAAG,iBAAiB;;;;"}
1
+ {"version":3,"file":"PrimitivePrompt.js","sources":["../../../src/prompt/PrimitivePrompt/PrimitivePrompt.tsx"],"sourcesContent":["import { Cross } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport SentimentSurface, { Emphasis, Sentiment } from '../../sentimentSurface';\nimport IconButton from '../../iconButton';\nimport { useIntl } from 'react-intl';\nimport closeBtnMessages from '../../common/closeButton/CloseButton.messages';\nimport { forwardRef, HTMLAttributes, ReactNode } from 'react';\n\nexport type PrimitivePromptProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * The sentiment determines the colour scheme.\n * @default success\n */\n sentiment?: Sentiment;\n /**\n * The emphasis level affecting background and text contrast.\n * @default 'base'\n */\n emphasis?: Emphasis;\n /**\n * Media to be displayed on the prompt (icon/image/etc).\n */\n media: ReactNode;\n /**\n * Any actions to be displayed on the prompt.\n */\n actions?: ReactNode;\n /**\n * Handler called when the close button is clicked. If not provided, then the close button is hidden.\n */\n onDismiss?: () => void;\n /**\n * Test ID for testing tools\n */\n 'data-testid'?: string;\n};\n\n/**\n * PrimitivePrompt is a low-level component that provides the structure, sentiment support and styling for various prompts.\n * Uses several css variables to handle styling from within the consuming component, e.g. --Prompt-padding. */\nexport const PrimitivePrompt = forwardRef<HTMLDivElement, PrimitivePromptProps>(\n (\n {\n sentiment = 'success',\n emphasis = 'base',\n media,\n actions,\n onDismiss,\n className,\n children,\n ...restProps\n },\n ref,\n ) => {\n const intl = useIntl();\n\n return (\n <SentimentSurface\n // @ts-expect-error - SentimentSurface forwardRef types don't expose ref in props\n ref={ref}\n sentiment={sentiment}\n emphasis={emphasis}\n className={clsx('wds-prompt', `wds-prompt--${sentiment}`, className)}\n {...restProps}\n >\n <div\n className={clsx('wds-prompt__content-wrapper', {\n 'wds-prompt__content-wrapper--with-dismiss': !!onDismiss,\n })}\n >\n <div className={clsx('wds-prompt__media-wrapper')}>{media}</div>\n {children}\n {onDismiss && (\n <IconButton\n size={24}\n priority=\"secondary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onDismiss}\n >\n <Cross />\n </IconButton>\n )}\n {actions && <div className=\"wds-prompt__actions-wrapper\">{actions}</div>}\n </div>\n </SentimentSurface>\n );\n },\n);\n\nPrimitivePrompt.displayName = 'PrimitivePrompt';\n"],"names":["PrimitivePrompt","forwardRef","sentiment","emphasis","media","actions","onDismiss","className","children","restProps","ref","intl","useIntl","_jsx","SentimentSurface","clsx","_jsxs","IconButton","size","priority","formatMessage","closeBtnMessages","ariaLab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QAAAA,SAAS,EAAC,6BAA6B;AAAAC,QAAAA,QAAA,EAAEH;AAAO,OAAM,CAAC;KACrE;AACP,GAAkB,CAAC;AAEvB,CAAC;AAGHL,eAAe,CAACyB,WAAW,GAAG,iBAAiB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PrimitivePrompt.mjs","sources":["../../../src/prompt/PrimitivePrompt/PrimitivePrompt.tsx"],"sourcesContent":["import { Cross } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport SentimentSurface, { Emphasis, Sentiment } from '../../sentimentSurface';\nimport IconButton from '../../iconButton';\nimport { useIntl } from 'react-intl';\nimport closeBtnMessages from '../../common/closeButton/CloseButton.messages';\nimport { forwardRef, HTMLAttributes, ReactNode } from 'react';\n\nexport type PrimitivePromptProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * The sentiment determines the colour scheme.\n * @default success\n */\n sentiment?: Sentiment;\n /**\n * The emphasis level affecting background and text contrast.\n * @default 'base'\n */\n emphasis?: Emphasis;\n /**\n * Media to be displayed on the prompt (icon/image/etc).\n */\n media: ReactNode;\n /**\n * Any actions to be displayed on the prompt.\n */\n actions?: ReactNode;\n /**\n * Handler called when the close button is clicked. If not provided, then the close button is hidden.\n */\n onDismiss?: () => void;\n /**\n * Test ID for testing tools\n */\n 'data-testid'?: string;\n};\n\n/**\n * PrimitivePrompt is a low-level component that provides the structure, sentiment support and styling for various prompts.\n * Uses several css variables to handle styling from within the consuming component, e.g. --Prompt-padding-x. */\nexport const PrimitivePrompt = forwardRef<HTMLDivElement, PrimitivePromptProps>(\n (\n {\n sentiment = 'success',\n emphasis = 'base',\n media,\n actions,\n onDismiss,\n className,\n children,\n ...restProps\n },\n ref,\n ) => {\n const intl = useIntl();\n\n return (\n <SentimentSurface\n // @ts-expect-error - SentimentSurface forwardRef types don't expose ref in props\n ref={ref}\n sentiment={sentiment}\n emphasis={emphasis}\n className={clsx('wds-prompt', `wds-prompt--${sentiment}`, className)}\n {...restProps}\n >\n <div\n className={clsx('wds-prompt__content-wrapper', {\n 'wds-prompt__content-wrapper--with-dismiss': !!onDismiss,\n })}\n >\n <div className={clsx('wds-prompt__media-wrapper')}>{media}</div>\n {children}\n {onDismiss && (\n <IconButton\n size={24}\n priority=\"secondary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onDismiss}\n >\n <Cross />\n </IconButton>\n )}\n {actions && <div className=\"wds-prompt__actions-wrapper\">{actions}</div>}\n </div>\n </SentimentSurface>\n );\n },\n);\n\nPrimitivePrompt.displayName = 'PrimitivePrompt';\n"],"names":["PrimitivePrompt","forwardRef","sentiment","emphasis","media","actions","onDismiss","className","children","restProps","ref","intl","useIntl","_jsx","SentimentSurface","clsx","_jsxs","IconButton","size","priority","formatMessage","closeBtnMessages","ariaLabel","onClick","Cross","displayName"],"mappings":";;;;;;;;;AAwCO,MAAMA,eAAe,gBAAGC,UAAU,CACvC,CACE;AACEC,EAAAA,SAAS,GAAG,SAAS;AACrBC,EAAAA,QAAQ,GAAG,MAAM;EACjBC,KAAK;EACLC,OAAO;EACPC,SAAS;EACTC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAS,CACb,EACDC,GAAG,KACD;AACF,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;AAEtB,EAAA,oBACEC,GAAA,CAACC;AACC;AAAA,IAAA;AACAJ,IAAAA,GAAG,EAAEA,GAAI;AACTR,IAAAA,SAAS,EAAEA,SAAU;AACrBC,IAAAA,QAAQ,EAAEA,QAAS;IACnBI,SAAS,EAAEQ,IAAI,CAAC,YAAY,EAAE,eAAeb,SAAS,CAAA,CAAE,EAAEK,SAAS,CAAE;AAAA,IAAA,GACjEE,SAAS;AAAAD,IAAAA,QAAA,eAEbQ,IAAA,CAAA,KAAA,EAAA;AACET,MAAAA,SAAS,EAAEQ,IAAI,CAAC,6BAA6B,EAAE;QAC7C,2CAA2C,EAAE,CAAC,CAACT;AAChD,OAAA,CAAE;AAAAE,MAAAA,QAAA,gBAEHK,GAAA,CAAA,KAAA,EAAA;AAAKN,QAAAA,SAAS,EAAEQ,IAAI,CAAC,2BAA2B,CAAE;AAAAP,QAAAA,QAAA,EAAEJ;OAAW,CAC/D,EAACI,QAAQ,EACRF,SAAS,iBACRO,GAAA,CAACI,UAAU,EAAA;AACTC,QAAAA,IAAI,EAAE,EAAG;AACTC,QAAAA,QAAQ,EAAC,WAAW;AACpB,QAAA,YAAA,EAAYR,IAAI,CAACS,aAAa,CAACC,gBAAgB,CAACC,SAAS,CAAE;AAC3DC,QAAAA,OAAO,EAAEjB,SAAU;AAAAE,QAAAA,QAAA,eAEnBK,GAAA,CAACW,KAAK,EAAA,EAAA;AACR,OAAY,CACb,EACAnB,OAAO,iBAAIQ,GAAA,CAAA,KAAA,EAAA;AAAKN,QAAAA,SAAS,EAAC,6BAA6B;AAAAC,QAAAA,QAAA,EAAEH;AAAO,OAAM,CAAC;KACrE;AACP,GAAkB,CAAC;AAEvB,CAAC;AAGHL,eAAe,CAACyB,WAAW,GAAG,iBAAiB;;;;"}
1
+ {"version":3,"file":"PrimitivePrompt.mjs","sources":["../../../src/prompt/PrimitivePrompt/PrimitivePrompt.tsx"],"sourcesContent":["import { Cross } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport SentimentSurface, { Emphasis, Sentiment } from '../../sentimentSurface';\nimport IconButton from '../../iconButton';\nimport { useIntl } from 'react-intl';\nimport closeBtnMessages from '../../common/closeButton/CloseButton.messages';\nimport { forwardRef, HTMLAttributes, ReactNode } from 'react';\n\nexport type PrimitivePromptProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * The sentiment determines the colour scheme.\n * @default success\n */\n sentiment?: Sentiment;\n /**\n * The emphasis level affecting background and text contrast.\n * @default 'base'\n */\n emphasis?: Emphasis;\n /**\n * Media to be displayed on the prompt (icon/image/etc).\n */\n media: ReactNode;\n /**\n * Any actions to be displayed on the prompt.\n */\n actions?: ReactNode;\n /**\n * Handler called when the close button is clicked. If not provided, then the close button is hidden.\n */\n onDismiss?: () => void;\n /**\n * Test ID for testing tools\n */\n 'data-testid'?: string;\n};\n\n/**\n * PrimitivePrompt is a low-level component that provides the structure, sentiment support and styling for various prompts.\n * Uses several css variables to handle styling from within the consuming component, e.g. --Prompt-padding. */\nexport const PrimitivePrompt = forwardRef<HTMLDivElement, PrimitivePromptProps>(\n (\n {\n sentiment = 'success',\n emphasis = 'base',\n media,\n actions,\n onDismiss,\n className,\n children,\n ...restProps\n },\n ref,\n ) => {\n const intl = useIntl();\n\n return (\n <SentimentSurface\n // @ts-expect-error - SentimentSurface forwardRef types don't expose ref in props\n ref={ref}\n sentiment={sentiment}\n emphasis={emphasis}\n className={clsx('wds-prompt', `wds-prompt--${sentiment}`, className)}\n {...restProps}\n >\n <div\n className={clsx('wds-prompt__content-wrapper', {\n 'wds-prompt__content-wrapper--with-dismiss': !!onDismiss,\n })}\n >\n <div className={clsx('wds-prompt__media-wrapper')}>{media}</div>\n {children}\n {onDismiss && (\n <IconButton\n size={24}\n priority=\"secondary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onDismiss}\n >\n <Cross />\n </IconButton>\n )}\n {actions && <div className=\"wds-prompt__actions-wrapper\">{actions}</div>}\n </div>\n </SentimentSurface>\n );\n },\n);\n\nPrimitivePrompt.displayName = 'PrimitivePrompt';\n"],"names":["PrimitivePrompt","forwardRef","sentiment","emphasis","media","actions","onDismiss","className","children","restProps","ref","intl","useIntl","_jsx","SentimentSurface","clsx","_jsxs","IconButton","size","priority","formatMessage","closeBtnMessages","ariaLabel","onClick","Cross","displayName"],"mappings":";;;;;;;;;AAwCO,MAAMA,eAAe,gBAAGC,UAAU,CACvC,CACE;AACEC,EAAAA,SAAS,GAAG,SAAS;AACrBC,EAAAA,QAAQ,GAAG,MAAM;EACjBC,KAAK;EACLC,OAAO;EACPC,SAAS;EACTC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAS,CACb,EACDC,GAAG,KACD;AACF,EAAA,MAAMC,IAAI,GA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691
31690
  border-radius: 10px;
31692
31691
  border-radius: var(--Prompt-border-radius, var(--radius-small));
31693
31692
  display: flex;
31694
31693
  gap: 16px;
31695
31694
  gap: var(--Prompt-gap, var(--size-16));
31696
31695
  word-wrap: break-word;
31697
- padding: 8px var(--Prompt-padding-y);
31698
- padding: var(--Prompt-padding-x) var(--Prompt-padding-y);
31696
+ padding: 8px;
31697
+ padding: var(--Prompt-padding, var(--padding-x-small));
31699
31698
  text-align: left;
31700
31699
  word-break: break-word;
31701
31700
  width: 100%;
@@ -31747,7 +31746,7 @@ html:not([dir="rtl"]) .np-navigation-option {
31747
31746
 
31748
31747
  .wds-inline-prompt {
31749
31748
  --Prompt-gap: calc(var(--size-12) / 2);
31750
- --Prompt-padding-x: calc(var(--padding-x-small) / 2) var(--padding-x-small);
31749
+ --Prompt-padding: calc(var(--padding-x-small) / 2) var(--padding-x-small);
31751
31750
  display: inline-flex;
31752
31751
  border-radius: 10px;
31753
31752
  border-radius: var(--radius-small);
@@ -31817,7 +31816,7 @@ html:not([dir="rtl"]) .np-navigation-option {
31817
31816
  .wds-info-prompt {
31818
31817
  --Prompt-border-radius: var(--radius-medium);
31819
31818
  --Prompt-gap: var(--size-8);
31820
- --Prompt-padding-x: var(--size-12);
31819
+ --Prompt-padding: var(--size-12);
31821
31820
  }
31822
31821
 
31823
31822
  .wds-info-prompt__content {
@@ -31883,7 +31882,7 @@ html:not([dir="rtl"]) .np-navigation-option {
31883
31882
  }
31884
31883
 
31885
31884
  .wds-action-prompt {
31886
- --Prompt-padding-x: var(--size-16);
31885
+ --Prompt-padding: var(--size-16);
31887
31886
  --Prompt-actions-gap: var(--size-8);
31888
31887
  --Prompt-gap: var(--size-10) var(--size-16);
31889
31888
  --Prompt-border-radius: var(--radius-large);
@@ -31918,7 +31917,7 @@ html:not([dir="rtl"]) .np-navigation-option {
31918
31917
  }
31919
31918
 
31920
31919
  .wds-critical-banner {
31921
- --Prompt-padding-y: var(--wds-container-padding-inline);
31920
+ --Prompt-padding: var(--size-16);
31922
31921
  --Prompt-actions-gap: var(--size-8);
31923
31922
  --Prompt-gap: var(--size-10) var(--size-16);
31924
31923
  --Prompt-border-radius: 0;
@@ -1,5 +1,5 @@
1
1
  .wds-action-prompt {
2
- --Prompt-padding-x: var(--size-16);
2
+ --Prompt-padding: var(--size-16);
3
3
  --Prompt-actions-gap: var(--size-8);
4
4
  --Prompt-gap: var(--size-10) var(--size-16);
5
5
  --Prompt-border-radius: var(--radius-large);
@@ -1,5 +1,5 @@
1
1
  .wds-critical-banner {
2
- --Prompt-padding-y: var(--wds-container-padding-inline);
2
+ --Prompt-padding: var(--size-16);
3
3
  --Prompt-actions-gap: var(--size-8);
4
4
  --Prompt-gap: var(--size-10) var(--size-16);
5
5
  --Prompt-border-radius: 0;
@@ -1,7 +1,7 @@
1
1
  .wds-info-prompt {
2
2
  --Prompt-border-radius: var(--radius-medium);
3
3
  --Prompt-gap: var(--size-8);
4
- --Prompt-padding-x: var(--size-12);
4
+ --Prompt-padding: var(--size-12);
5
5
  }
6
6
  .wds-info-prompt__content {
7
7
  display: flex;
@@ -1,6 +1,6 @@
1
1
  .wds-inline-prompt {
2
2
  --Prompt-gap: calc(var(--size-12) / 2);
3
- --Prompt-padding-x: calc(var(--padding-x-small) / 2) var(--padding-x-small);
3
+ --Prompt-padding: calc(var(--padding-x-small) / 2) var(--padding-x-small);
4
4
  display: inline-flex;
5
5
  border-radius: 10px;
6
6
  border-radius: var(--radius-small);
@@ -1,13 +1,12 @@
1
1
  .wds-prompt {
2
- --Prompt-padding-x: var(--padding-x-small);
3
2
  border-radius: 10px;
4
3
  border-radius: var(--Prompt-border-radius, var(--radius-small));
5
4
  display: flex;
6
5
  gap: 16px;
7
6
  gap: var(--Prompt-gap, var(--size-16));
8
7
  word-wrap: break-word;
9
- padding: 8px var(--Prompt-padding-y);
10
- padding: var(--Prompt-padding-x) var(--Prompt-padding-y);
8
+ padding: 8px;
9
+ padding: var(--Prompt-padding, var(--padding-x-small));
11
10
  text-align: left;
12
11
  word-break: break-word;
13
12
  width: 100%;
@@ -1,11 +1,11 @@
1
- import type { ComponentPropsWithRef, ElementType, PropsWithChildren } from 'react';
1
+ import type { ComponentPropsWithoutRef, ElementType, PropsWithChildren } from 'react';
2
2
  import { CommonProps } from '../common';
3
3
  type ContainerOwnProps<T extends ElementType> = CommonProps & {
4
4
  /** Controls the maximum width: `fluid` (100%), `standard` (1160px), `narrow` (840px), `compact` (600px). @default 'standard' */
5
5
  size?: 'fluid' | 'standard' | 'narrow' | 'compact';
6
6
  as?: T;
7
7
  };
8
- export type ContainerProps<T extends ElementType = 'div'> = PropsWithChildren<ContainerOwnProps<T>> & Omit<ComponentPropsWithRef<T>, keyof ContainerOwnProps<T> | 'children'>;
8
+ export type ContainerProps<T extends ElementType = 'div'> = PropsWithChildren<ContainerOwnProps<T>> & Omit<ComponentPropsWithoutRef<T>, keyof ContainerOwnProps<T> | 'children'>;
9
9
  /**
10
10
  * Centers page content within a responsive max-width boundary, with automatic horizontal padding that adapts to the viewport size.
11
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../src/container/Container.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEnF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,KAAK,iBAAiB,CAAC,CAAC,SAAS,WAAW,IAAI,WAAW,GAAG;IAC5D,gIAAgI;IAChI,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;IACnD,EAAE,CAAC,EAAE,CAAC,CAAC;CACR,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,iBAAiB,CAC3E,iBAAiB,CAAC,CAAC,CAAC,CACrB,GACC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,MAAM,iBAAiB,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC;AAE1E;;;;GAIG;AACH,QAAA,MAAM,SAAS,GAAI,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,kDAM/C,cAAc,CAAC,CAAC,CAAC,gCAOnB,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../src/container/Container.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,KAAK,iBAAiB,CAAC,CAAC,SAAS,WAAW,IAAI,WAAW,GAAG;IAC5D,gIAAgI;IAChI,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;IACnD,EAAE,CAAC,EAAE,CAAC,CAAC;CACR,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,iBAAiB,CAC3E,iBAAiB,CAAC,CAAC,CAAC,CACrB,GACC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,MAAM,iBAAiB,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC;AAE7E;;;;GAIG;AACH,QAAA,MAAM,SAAS,GAAI,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,kDAM/C,cAAc,CAAC,CAAC,CAAC,gCAOnB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -16,6 +16,6 @@ declare const IconButton: import("react").ForwardRefExoticComponent<{
16
16
  /** @default 'default' */
17
17
  type?: "default" | "negative";
18
18
  'data-testid'?: string;
19
- } & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, "onClick" | "target" | "href"> & Pick<ButtonHTMLAttributes<HTMLButtonElement>, "disabled" | "onClick"> & Pick<HTMLAttributes<HTMLDivElement>, "id" | "className" | "tabIndex" | "role" | "aria-label" | "children"> & import("react").RefAttributes<unknown>>;
19
+ } & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, "onClick" | "href" | "target"> & Pick<ButtonHTMLAttributes<HTMLButtonElement>, "disabled" | "onClick"> & Pick<HTMLAttributes<HTMLDivElement>, "id" | "className" | "tabIndex" | "role" | "aria-label" | "children"> & import("react").RefAttributes<unknown>>;
20
20
  export default IconButton;
21
21
  //# sourceMappingURL=IconButton.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;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,C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,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,4IAY5B,mBAAmB,gCAqHrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -30,7 +30,7 @@ export type PrimitivePromptProps = HTMLAttributes<HTMLDivElement> & {
30
30
  };
31
31
  /**
32
32
  * PrimitivePrompt is a low-level component that provides the structure, sentiment support and styling for various prompts.
33
- * Uses several css variables to handle styling from within the consuming component, e.g. --Prompt-padding-x. */
33
+ * Uses several css variables to handle styling from within the consuming component, e.g. --Prompt-padding. */
34
34
  export declare const PrimitivePrompt: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
35
35
  /**
36
36
  * The sentiment determines the colour scheme.
@@ -1 +1 @@
1
- {"version":3,"file":"PrimitivePrompt.d.ts","sourceRoot":"","sources":["../../../../src/prompt/PrimitivePrompt/PrimitivePrompt.tsx"],"names":[],"mappings":"AAEA,OAAyB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAI/E,OAAO,EAAc,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9D,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAClE;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;gHAEgH;AAChH,eAAO,MAAM,eAAe;IA/B1B;;;OAGG;gBACS,SAAS;IACrB;;;OAGG;eACQ,QAAQ;IACnB;;OAEG;WACI,SAAS;IAChB;;OAEG;cACO,SAAS;IACnB;;OAEG;gBACS,MAAM,IAAI;IACtB;;OAEG;oBACa,MAAM;kDAqDvB,CAAC"}
1
+ {"version":3,"file":"PrimitivePrompt.d.ts","sourceRoot":"","sources":["../../../../src/prompt/PrimitivePrompt/PrimitivePrompt.tsx"],"names":[],"mappings":"AAEA,OAAyB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAI/E,OAAO,EAAc,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9D,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAClE;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;8GAE8G;AAC9G,eAAO,MAAM,eAAe;IA/B1B;;;OAGG;gBACS,SAAS;IACrB;;;OAGG;eACQ,QAAQ;IACnB;;OAEG;WACI,SAAS;IAChB;;OAEG;cACO,SAAS;IACnB;;OAEG;gBACS,MAAM,IAAI;IACtB;;OAEG;oBACa,MAAM;kDAqDvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-b0bc049",
3
+ "version": "0.0.0-experimental-12c2379",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -3,6 +3,7 @@ import { fn } from 'storybook/test';
3
3
  import { Meta, StoryObj } from '@storybook/react-webpack5';
4
4
 
5
5
  import { storySourceWithoutNoise } from '../../.storybook/helpers';
6
+ import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
6
7
  import CheckboxButton, { type CheckboxButtonProps } from './CheckboxButton';
7
8
  import { Label } from '../label/Label';
8
9
 
@@ -89,6 +90,21 @@ export const Playground: Story = storySourceWithoutNoise({
89
90
  },
90
91
  });
91
92
 
93
+ export const Sandbox = createSandboxStory({
94
+ code: `const App = () => {
95
+ const [checked, setChecked] = React.useState(true);
96
+
97
+ return (
98
+ <CheckboxButton
99
+ aria-label="Toggle email updates"
100
+ checked={checked}
101
+ onChange={(e) => setChecked(e.currentTarget.checked)}
102
+ />
103
+ );
104
+ };`,
105
+ scope: globalScope,
106
+ });
107
+
92
108
  /** Disabled state — checked and unchecked. */
93
109
  export const Disabled: Story = {
94
110
  decorators: [withColumnLayout],
@@ -4,6 +4,7 @@ import { useState } from 'react';
4
4
 
5
5
  import Chips, { type ChipValue, type ChipsProps } from './Chips';
6
6
  import { storySourceWithoutNoise } from '../../.storybook/helpers';
7
+ import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
7
8
 
8
9
  /**
9
10
  * Can be used for making a <a href="?path=/story/actions-chips--choice">choice</a>, or as a <a href="?path=/story/actions-chips--filter">filter</a> with multiple options.
@@ -91,6 +92,28 @@ export const Playground: Story = storySourceWithoutNoise<typeof Chips>({
91
92
  },
92
93
  });
93
94
 
95
+ export const Sandbox = createSandboxStory({
96
+ code: `const App = () => {
97
+ const [selected, setSelected] = React.useState('accounting');
98
+
99
+ return (
100
+ <Chips
101
+ chips={[
102
+ { value: 'all', label: 'All' },
103
+ { value: 'accounting', label: 'Accounting' },
104
+ { value: 'payroll', label: 'Payroll' },
105
+ { value: 'reporting', label: 'Reporting' },
106
+ { value: 'payments', label: 'Payments' },
107
+ ]}
108
+ selected={selected}
109
+ onChange={({ selectedValue }) => setSelected(selectedValue)}
110
+ aria-label="Category filter"
111
+ />
112
+ );
113
+ };`,
114
+ scope: globalScope,
115
+ });
116
+
94
117
  /**
95
118
  * The user can select any number of chips with the selected prop as an array (`multiple` prop set to `true`). <br />
96
119
  * <a href="https://docs.wise.design/components/chip#filter-chips" target="_blank">Design documentation</a>
@@ -2,6 +2,7 @@ import * as Icons from '@transferwise/icons';
2
2
 
3
3
  import { Meta, StoryObj } from '@storybook/react-webpack5';
4
4
  import { fn } from 'storybook/test';
5
+ import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
5
6
  import CircularButton, { CircularButtonProps } from './CircularButton';
6
7
  import Title from '../title';
7
8
  import SentimentSurface from '../sentimentSurface';
@@ -42,6 +43,18 @@ type Story = StoryObj<typeof CircularButton>;
42
43
  /** Explore all props via the controls panel. */
43
44
  export const Playground: Story = {};
44
45
 
46
+ export const Sandbox = createSandboxStory({
47
+ code: `<CircularButton
48
+ icon={<Freeze />}
49
+ priority="primary"
50
+ type="default"
51
+ onClick={() => console.log('clicked')}
52
+ >
53
+ Freeze card
54
+ </CircularButton>`,
55
+ scope: globalScope,
56
+ });
57
+
45
58
  /**
46
59
  * Priorities set a visual hierarchy amongst the buttons displayed on the
47
60
  * screen to help more important buttons to take precedence over others. <br />
@@ -1,5 +1,5 @@
1
1
  import { clsx } from 'clsx';
2
- import type { ComponentPropsWithRef, ElementType, PropsWithChildren } from 'react';
2
+ import type { ComponentPropsWithoutRef, ElementType, PropsWithChildren } from 'react';
3
3
 
4
4
  import { CommonProps } from '../common';
5
5
 
@@ -12,7 +12,7 @@ type ContainerOwnProps<T extends ElementType> = CommonProps & {
12
12
  export type ContainerProps<T extends ElementType = 'div'> = PropsWithChildren<
13
13
  ContainerOwnProps<T>
14
14
  > &
15
- Omit<ComponentPropsWithRef<T>, keyof ContainerOwnProps<T> | 'children'>;
15
+ Omit<ComponentPropsWithoutRef<T>, keyof ContainerOwnProps<T> | 'children'>;
16
16
 
17
17
  /**
18
18
  * Centers page content within a responsive max-width boundary, with automatic horizontal padding that adapts to the viewport size.
@@ -13,6 +13,7 @@ import {
13
13
  Freeze,
14
14
  } from '@transferwise/icons';
15
15
  import { fn } from 'storybook/test';
16
+ import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
16
17
  import IconButton, { Props } from './IconButton';
17
18
  import SentimentSurface from '../sentimentSurface';
18
19
 
@@ -61,6 +62,13 @@ export const Playground: Story = {
61
62
  ),
62
63
  };
63
64
 
65
+ export const Sandbox = createSandboxStory({
66
+ code: `<IconButton size={48} priority="primary" type="default" aria-label="Add item" onClick={() => console.log('clicked')}>
67
+ <Plus />
68
+ </IconButton>`,
69
+ scope: globalScope,
70
+ });
71
+
64
72
  /**
65
73
  * Priorities set a visual hierarchy amongst the buttons displayed on the
66
74
  * screen to help more important buttons to take precedence over others. <br />
package/src/main.css CHANGED
@@ -31687,15 +31687,14 @@ html:not([dir="rtl"]) .np-navigation-option {
31687
31687
  }
31688
31688
 
31689
31689
  .wds-prompt {
31690
- --Prompt-padding-x: var(--padding-x-small);
31691
31690
  border-radius: 10px;
31692
31691
  border-radius: var(--Prompt-border-radius, var(--radius-small));
31693
31692
  display: flex;
31694
31693
  gap: 16px;
31695
31694
  gap: var(--Prompt-gap, var(--size-16));
31696
31695
  word-wrap: break-word;
31697
- padding: 8px var(--Prompt-padding-y);
31698
- padding: var(--Prompt-padding-x) var(--Prompt-padding-y);
31696
+ padding: 8px;
31697
+ padding: var(--Prompt-padding, var(--padding-x-small));
31699
31698
  text-align: left;
31700
31699
  word-break: break-word;
31701
31700
  width: 100%;
@@ -31747,7 +31746,7 @@ html:not([dir="rtl"]) .np-navigation-option {
31747
31746
 
31748
31747
  .wds-inline-prompt {
31749
31748
  --Prompt-gap: calc(var(--size-12) / 2);
31750
- --Prompt-padding-x: calc(var(--padding-x-small) / 2) var(--padding-x-small);
31749
+ --Prompt-padding: calc(var(--padding-x-small) / 2) var(--padding-x-small);
31751
31750
  display: inline-flex;
31752
31751
  border-radius: 10px;
31753
31752
  border-radius: var(--radius-small);
@@ -31817,7 +31816,7 @@ html:not([dir="rtl"]) .np-navigation-option {
31817
31816
  .wds-info-prompt {
31818
31817
  --Prompt-border-radius: var(--radius-medium);
31819
31818
  --Prompt-gap: var(--size-8);
31820
- --Prompt-padding-x: var(--size-12);
31819
+ --Prompt-padding: var(--size-12);
31821
31820
  }
31822
31821
 
31823
31822
  .wds-info-prompt__content {
@@ -31883,7 +31882,7 @@ html:not([dir="rtl"]) .np-navigation-option {
31883
31882
  }
31884
31883
 
31885
31884
  .wds-action-prompt {
31886
- --Prompt-padding-x: var(--size-16);
31885
+ --Prompt-padding: var(--size-16);
31887
31886
  --Prompt-actions-gap: var(--size-8);
31888
31887
  --Prompt-gap: var(--size-10) var(--size-16);
31889
31888
  --Prompt-border-radius: var(--radius-large);
@@ -31918,7 +31917,7 @@ html:not([dir="rtl"]) .np-navigation-option {
31918
31917
  }
31919
31918
 
31920
31919
  .wds-critical-banner {
31921
- --Prompt-padding-y: var(--wds-container-padding-inline);
31920
+ --Prompt-padding: var(--size-16);
31922
31921
  --Prompt-actions-gap: var(--size-8);
31923
31922
  --Prompt-gap: var(--size-10) var(--size-16);
31924
31923
  --Prompt-border-radius: 0;
@@ -1,5 +1,5 @@
1
1
  .wds-action-prompt {
2
- --Prompt-padding-x: var(--size-16);
2
+ --Prompt-padding: var(--size-16);
3
3
  --Prompt-actions-gap: var(--size-8);
4
4
  --Prompt-gap: var(--size-10) var(--size-16);
5
5
  --Prompt-border-radius: var(--radius-large);
@@ -1,5 +1,5 @@
1
1
  .wds-action-prompt {
2
- --Prompt-padding-x: var(--size-16);
2
+ --Prompt-padding: var(--size-16);
3
3
  --Prompt-actions-gap: var(--size-8);
4
4
  --Prompt-gap: var(--size-10) var(--size-16);
5
5
  --Prompt-border-radius: var(--radius-large);
@@ -1,5 +1,5 @@
1
1
  .wds-critical-banner {
2
- --Prompt-padding-y: var(--wds-container-padding-inline);
2
+ --Prompt-padding: var(--size-16);
3
3
  --Prompt-actions-gap: var(--size-8);
4
4
  --Prompt-gap: var(--size-10) var(--size-16);
5
5
  --Prompt-border-radius: 0;
@@ -2,7 +2,7 @@
2
2
  @import (reference) "./CriticalBanner.vars.less";
3
3
 
4
4
  .wds-critical-banner {
5
- --Prompt-padding-y: var(--wds-container-padding-inline);
5
+ --Prompt-padding: var(--size-16);
6
6
  --Prompt-actions-gap: var(--size-8);
7
7
  --Prompt-gap: var(--size-10) var(--size-16);
8
8
  --Prompt-border-radius: 0;
@@ -16,7 +16,7 @@ const meta = {
16
16
  component: CriticalBanner,
17
17
  title: 'Prompts/CriticalBanner',
18
18
  tags: ['new'],
19
- parameters: { docs: { toc: true }, padding: '0', },
19
+ parameters: { docs: { toc: true } },
20
20
  args: {
21
21
  title: 'Your account requires verification',
22
22
  description: 'Please verify your identity to continue using all features.',
@@ -1,9 +1,8 @@
1
- import { ElementType, ReactNode, useId, useState } from 'react';
1
+ import { ReactNode, useId, useState } from 'react';
2
2
  import { clsx } from 'clsx';
3
3
 
4
4
  import Body from '../../body';
5
5
  import Button from '../../button';
6
- import Container from '../../container';
7
6
  import { Breakpoint, LiveRegion, Typography } from '../../common';
8
7
  import { ButtonProps } from '../../button/Button.types';
9
8
  import { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';
@@ -89,9 +88,7 @@ export const CriticalBanner = ({
89
88
  actionSecondaryLabel: actionSecondary?.label,
90
89
  })}
91
90
  >
92
- <Container
93
- size="fluid"
94
- as={PrimitivePrompt as ElementType}
91
+ <PrimitivePrompt
95
92
  ref={containerRef}
96
93
  id={id}
97
94
  sentiment={sentiment}
@@ -174,7 +171,7 @@ export const CriticalBanner = ({
174
171
  className="wds-critical-banner__toggle"
175
172
  onToggle={handleToggle}
176
173
  />
177
- </Container>
174
+ </PrimitivePrompt>
178
175
  </LiveRegion>
179
176
  );
180
177
  };
@@ -1,7 +1,7 @@
1
1
  .wds-info-prompt {
2
2
  --Prompt-border-radius: var(--radius-medium);
3
3
  --Prompt-gap: var(--size-8);
4
- --Prompt-padding-x: var(--size-12);
4
+ --Prompt-padding: var(--size-12);
5
5
  }
6
6
  .wds-info-prompt__content {
7
7
  display: flex;
@@ -1,7 +1,7 @@
1
1
  .wds-info-prompt {
2
2
  --Prompt-border-radius: var(--radius-medium);
3
3
  --Prompt-gap: var(--size-8);
4
- --Prompt-padding-x: var(--size-12);
4
+ --Prompt-padding: var(--size-12);
5
5
 
6
6
  &__content {
7
7
  display: flex;
@@ -1,6 +1,6 @@
1
1
  .wds-inline-prompt {
2
2
  --Prompt-gap: calc(var(--size-12) / 2);
3
- --Prompt-padding-x: calc(var(--padding-x-small) / 2) var(--padding-x-small);
3
+ --Prompt-padding: calc(var(--padding-x-small) / 2) var(--padding-x-small);
4
4
  display: inline-flex;
5
5
  border-radius: 10px;
6
6
  border-radius: var(--radius-small);
@@ -1,6 +1,6 @@
1
1
  .wds-inline-prompt {
2
2
  --Prompt-gap: calc(var(--size-12) / 2);
3
- --Prompt-padding-x: calc(var(--padding-x-small) / 2) var(--padding-x-small);
3
+ --Prompt-padding: calc(var(--padding-x-small) / 2) var(--padding-x-small);
4
4
 
5
5
  display: inline-flex;
6
6
  border-radius: var(--radius-small);
@@ -1,13 +1,12 @@
1
1
  .wds-prompt {
2
- --Prompt-padding-x: var(--padding-x-small);
3
2
  border-radius: 10px;
4
3
  border-radius: var(--Prompt-border-radius, var(--radius-small));
5
4
  display: flex;
6
5
  gap: 16px;
7
6
  gap: var(--Prompt-gap, var(--size-16));
8
7
  word-wrap: break-word;
9
- padding: 8px var(--Prompt-padding-y);
10
- padding: var(--Prompt-padding-x) var(--Prompt-padding-y);
8
+ padding: 8px;
9
+ padding: var(--Prompt-padding, var(--padding-x-small));
11
10
  text-align: left;
12
11
  word-break: break-word;
13
12
  width: 100%;
@@ -1,10 +1,9 @@
1
1
  .wds-prompt {
2
- --Prompt-padding-x: var(--padding-x-small);
3
2
  border-radius: var(--Prompt-border-radius, var(--radius-small));
4
3
  display: flex;
5
4
  gap: var(--Prompt-gap, var(--size-16));
6
5
  overflow-wrap: break-word;
7
- padding: var(--Prompt-padding-x) var(--Prompt-padding-y);
6
+ padding: var(--Prompt-padding, var(--padding-x-small));
8
7
  text-align: left;
9
8
  word-break: break-word;
10
9
  width: 100%;
@@ -37,7 +37,7 @@ export type PrimitivePromptProps = HTMLAttributes<HTMLDivElement> & {
37
37
 
38
38
  /**
39
39
  * PrimitivePrompt is a low-level component that provides the structure, sentiment support and styling for various prompts.
40
- * Uses several css variables to handle styling from within the consuming component, e.g. --Prompt-padding-x. */
40
+ * Uses several css variables to handle styling from within the consuming component, e.g. --Prompt-padding. */
41
41
  export const PrimitivePrompt = forwardRef<HTMLDivElement, PrimitivePromptProps>(
42
42
  (
43
43
  {
@@ -2,6 +2,7 @@ import { useState, useEffect } from 'react';
2
2
  import { fn } from 'storybook/test';
3
3
 
4
4
  import { storySourceWithoutNoise } from '../../.storybook/helpers';
5
+ import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
5
6
  import Switch, { SwitchProps } from './Switch';
6
7
  import { Field } from '../field/Field';
7
8
  import { Meta, StoryObj } from '@storybook/react-webpack5';
@@ -55,6 +56,22 @@ export const Playground: Story = storySourceWithoutNoise({
55
56
  },
56
57
  });
57
58
 
59
+ export const Sandbox = createSandboxStory({
60
+ code: `const App = () => {
61
+ const [checked, setChecked] = React.useState(false);
62
+
63
+ return (
64
+ <Field id="sandbox-field" label="Enable notifications">
65
+ <Switch
66
+ checked={checked}
67
+ onClick={() => setChecked((v) => !v)}
68
+ />
69
+ </Field>
70
+ );
71
+ };`,
72
+ scope: globalScope,
73
+ });
74
+
58
75
  /**
59
76
  * Three labelling patterns: <a href="?path=/docs/forms-label--docs">Label</a>, `aria-labelledby`, and <a href="?path=/docs/forms-field--docs">Field</a>. <br />
60
77
  * Use Label for simple label-input pairs. Use `aria-labelledby` to reference existing text as the accessible name. Use Field for form layouts with labels, descriptions, and validation.