@transferwise/components 46.146.0 → 46.148.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main.css +66 -0
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/prompt/CriticalBanner/CriticalBanner.js +78 -68
- package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -1
- package/build/prompt/CriticalBanner/CriticalBanner.mjs +79 -69
- package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -1
- package/build/styles/main.css +66 -0
- package/build/styles/nudge/Nudge.css +11 -0
- package/build/styles/prompt/CriticalBanner/CriticalBanner.css +48 -0
- package/build/types/nudge/Nudge.d.ts +1 -1
- package/build/types/nudge/Nudge.d.ts.map +1 -1
- package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -1
- package/package.json +23 -19
- package/src/accordion/Accordion.story.tsx +25 -0
- package/src/avatarLayout/AvatarLayout.story.tsx +10 -0
- package/src/avatarView/AvatarView.story.tsx +8 -0
- package/src/body/Body.story.tsx +12 -0
- package/src/button/_stories/Button.story.tsx +7 -1
- package/src/calendar/Calendar.story.tsx +19 -7
- package/src/carousel/Carousel.story.tsx +35 -0
- package/src/checkbox/Checkbox.story.tsx +20 -0
- package/src/checkboxButton/CheckboxButton.story.tsx +16 -0
- package/src/chevron/Chevron.story.tsx +6 -0
- package/src/chips/Chips.story.tsx +23 -0
- package/src/circularButton/CircularButton.story.tsx +13 -0
- package/src/common/baseCard/BaseCard.story.tsx +12 -0
- package/src/common/bottomSheet/BottomSheet.story.tsx +21 -0
- package/src/common/circle/Circle.story.tsx +11 -0
- package/src/container/Container.story.tsx +12 -0
- package/src/dateInput/DateInput.story.tsx +20 -0
- package/src/dateLookup/DateLookup.story.tsx +23 -0
- package/src/decision/Decision.story.tsx +36 -0
- package/src/definitionList/DefinitionList.story.tsx +16 -0
- package/src/dimmer/Dimmer.story.tsx +24 -0
- package/src/display/Display.story.tsx +11 -0
- package/src/divider/Divider.story.tsx +6 -0
- package/src/drawer/Drawer.story.tsx +25 -0
- package/src/dropFade/DropFade.story.tsx +27 -0
- package/src/emphasis/Emphasis.story.tsx +10 -0
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +37 -0
- package/src/field/Field.story.tsx +16 -0
- package/src/flowNavigation/FlowNavigation.story.tsx +25 -0
- package/src/header/Header.story.tsx +17 -0
- package/src/iconButton/IconButton.story.tsx +14 -0
- package/src/image/Image.story.tsx +11 -0
- package/src/info/Info.story.tsx +10 -0
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +23 -0
- package/src/inputs/InputGroup.story.tsx +37 -0
- package/src/inputs/SearchInput.story.tsx +22 -0
- package/src/inputs/SelectInput/_stories/SelectInput.story.tsx +42 -0
- package/src/inputs/TextArea.story.tsx +22 -0
- package/src/instructionsList/InstructionsList.story.tsx +19 -0
- package/src/label/Label.story.tsx +17 -0
- package/src/link/Link.story.tsx +11 -0
- package/src/list/List.story.tsx +19 -0
- package/src/listItem/_stories/ListItem.story.tsx +20 -0
- package/src/loader/Loader.story.tsx +6 -0
- package/src/logo/Logo.story.tsx +6 -0
- package/src/main.css +66 -0
- package/src/markdown/Markdown.story.tsx +17 -0
- package/src/modal/Modal.story.tsx +23 -0
- package/src/money/Money.story.tsx +7 -0
- package/src/moneyInput/MoneyInput.story.tsx +34 -0
- package/src/nudge/Nudge.css +11 -0
- package/src/nudge/Nudge.less +4 -0
- package/src/nudge/Nudge.story.tsx +26 -0
- package/src/nudge/Nudge.tsx +2 -1
- package/src/overlayHeader/OverlayHeader.story.tsx +10 -0
- package/src/phoneNumberInput/PhoneNumberInput.story.tsx +23 -0
- package/src/popover/Popover.story.tsx +12 -0
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +11 -0
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +11 -0
- package/src/processIndicator/ProcessIndicator.story.tsx +10 -0
- package/src/progress/Progress.story.tsx +6 -0
- package/src/progressBar/ProgressBar.story.tsx +12 -0
- package/src/promoCard/PromoCard.story.tsx +15 -0
- package/src/promoCard/PromoCardGroup.story.tsx +28 -0
- package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +31 -0
- package/src/prompt/CriticalBanner/CriticalBanner.accessibility.docs.mdx +9 -0
- package/src/prompt/CriticalBanner/CriticalBanner.css +48 -0
- package/src/prompt/CriticalBanner/CriticalBanner.less +72 -0
- package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +180 -169
- package/src/prompt/CriticalBanner/CriticalBanner.test.story.tsx +25 -6
- package/src/prompt/CriticalBanner/CriticalBanner.test.tsx +37 -0
- package/src/prompt/CriticalBanner/CriticalBanner.tsx +92 -83
- package/src/prompt/CriticalBanner/CriticalBanner.vars.less +1 -0
- package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +30 -0
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +14 -0
- package/src/radio/Radio.story.tsx +34 -0
- package/src/radioGroup/RadioGroup.story.tsx +26 -0
- package/src/section/Section.story.tsx +15 -0
- package/src/segmentedControl/SegmentedControl.story.tsx +27 -0
- package/src/sentimentSurface/SentimentSurface.story.tsx +11 -0
- package/src/slidingPanel/SlidingPanel.story.tsx +19 -0
- package/src/snackbar/Snackbar.story.tsx +24 -0
- package/src/statusIcon/StatusIcon.story.tsx +6 -0
- package/src/stepper/Stepper.story.tsx +30 -0
- package/src/sticky/Sticky.story.tsx +22 -1
- package/src/switch/Switch.story.tsx +17 -0
- package/src/table/Table.story.tsx +32 -0
- package/src/tabs/Tabs.story.tsx +31 -0
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +23 -0
- package/src/tile/Tile.story.tsx +13 -0
- package/src/title/Title.story.tsx +12 -0
- package/src/tooltip/Tooltip.story.tsx +8 -0
- package/src/typeahead/Typeahead.story.tsx +33 -0
- package/src/upload/Upload.story.tsx +24 -0
- package/src/uploadInput/UploadInput.story.tsx +31 -0
|
@@ -1 +1 @@
|
|
|
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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EAAiB7B,iBAAiB,IAAIZ,SAAU;AAChD,MAAA,kBAAA,EAAkBhB,WAAW,GAAG2B,MAAM,GAAGX,SAAU;AAAAuB,MAAAA,QAAA,gBAEnDC,IAAA,CAAA,KAAA,EAAA;AAAKhC,QAAAA,SAAS,EAAC,mCAAmC;AAAA+B,QAAAA,QAAA,EAAA,CAC/CxC,KAAK,iBACJiC,GAAA,CAAC0B,IAAI,EAAA;AACHnD,UAAAA,EAAE,EAAEmB,OAAQ;UACZiC,IAAI,EAAEC,UAAU,CAACC,eAAgB;AACjCrD,UAAAA,SAAS,EAAC,yDAAyD;AAAA+B,UAAAA,QAAA,EAElExC;AAAK,SACF,CACP,EACAC,WAAW,iBACVgC,GAAA,CAAC0B,IAAI,EAAA;AACHnD,UAAAA,EAAE,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
|
+
{"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 const bannerSurface = (\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 '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 </PrimitivePrompt>\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 className=\"wds-critical-banner__entry-mask\">\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","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","PrimitivePrompt","ref","emphasis","clsx","renderPromptMedia","imgClassName","actions","style","display","children","_jsx","Button","v2","size","priority","href","tabIndex","onClick","label","role","Body","type","Typography","BODY_LARGE_BOLD","ExpanderToggle","LiveRegion","announceOnChange","buildAnnouncementString","actionLabel","actionSecondaryLabel"],"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;AAC1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BACV4C,GAAA,CAACU,IAAI,EAAA;AACH/C,QAAAA,EAAE,EAAEoB,MAAO;AACXnB,QAAAA,SAAS,EAAE6B,IAAI,CAAC,8BAA8B,EAAE,kCAAkC,EAAE;UAClF,8CAA8C,EAAE,CAAC,CAACtC;AACnD,SAAA,CAAE;AAAA4C,QAAAA,QAAA,EAEF3C;AAAW,OACR,CACP;AAAA,KACE,CACL,eAAA4C,GAAA,CAACc,cAAc,EAAA;AACbtD,MAAAA,QAAQ,EAAEgB,gBAAiB;AAC3B2B,MAAAA,IAAI,EAAE,EAAG;AACTvC,MAAAA,SAAS,EAAC,6BAA6B;AACvCF,MAAAA,QAAQ,EAAEe;AAAa,KAAA,CAE3B;AAAA,GAAiB,CAClB;EAED,oBACEuB,GAAA,CAACe,UAAU,EAAA;AACT,IAAA,WAAA,EAAU,WAAW;IACrBC,gBAAgB,EAAEC,uBAAuB,CAAC;MACxC9D,KAAK;MACLC,WAAW;AACXI,MAAAA,QAAQ,EAAEgB,gBAAgB;MAC1B0C,WAAW,EAAE5D,MAAM,EAAEkD,KAAK;MAC1BW,oBAAoB,EAAE5D,eAAe,EAAEiD;AACxC,KAAA,CAAE;AAAAT,IAAAA,QAAA,eAEHC,GAAA,CAAA,KAAA,EAAA;AAAKpC,MAAAA,SAAS,EAAC,oCAAoC;AAAAmC,MAAAA,QAAA,eACjDC,GAAA,CAAA,KAAA,EAAA;AAAKpC,QAAAA,SAAS,EAAC,iCAAiC;AAAAmC,QAAAA,QAAA,eAC9CC,GAAA,CAAA,KAAA,EAAA;AAAKpC,UAAAA,SAAS,EAAC,kCAAkC;AAAAmC,UAAAA,QAAA,EAAEX;SAAmB;OACnE;KACF;AACP,GAAY,CAAC;AAEjB;;;;"}
|
package/build/styles/main.css
CHANGED
|
@@ -31290,6 +31290,19 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
31290
31290
|
margin-right: -22px;
|
|
31291
31291
|
}
|
|
31292
31292
|
|
|
31293
|
+
.wds-nudge-media-documents {
|
|
31294
|
+
margin-left: -8px;
|
|
31295
|
+
margin-top: 22px;
|
|
31296
|
+
position: absolute;
|
|
31297
|
+
width: 120px;
|
|
31298
|
+
}
|
|
31299
|
+
|
|
31300
|
+
[dir="rtl"] .wds-nudge-media-documents {
|
|
31301
|
+
transform: scaleX(-1);
|
|
31302
|
+
margin-left: 0;
|
|
31303
|
+
margin-right: -8px;
|
|
31304
|
+
}
|
|
31305
|
+
|
|
31293
31306
|
.wds-nudge-container {
|
|
31294
31307
|
align-items: stretch;
|
|
31295
31308
|
display: flex;
|
|
@@ -31922,6 +31935,7 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
31922
31935
|
--Prompt-gap: var(--size-10) var(--size-16);
|
|
31923
31936
|
--Prompt-border-radius: 0;
|
|
31924
31937
|
container-type: inline-size;
|
|
31938
|
+
position: relative;
|
|
31925
31939
|
--critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
|
|
31926
31940
|
--critical-banner-duration: 150ms;
|
|
31927
31941
|
/* Override PrimitivePrompt's --screen-sm-max actions behaviour:
|
|
@@ -32062,6 +32076,53 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
32062
32076
|
}
|
|
32063
32077
|
}
|
|
32064
32078
|
|
|
32079
|
+
.wds-critical-banner-overhang-query {
|
|
32080
|
+
container-name: critical-banner-overhang;
|
|
32081
|
+
container-type: inline-size;
|
|
32082
|
+
inline-size: 100%;
|
|
32083
|
+
}
|
|
32084
|
+
|
|
32085
|
+
.wds-critical-banner__entry-mask {
|
|
32086
|
+
display: grid;
|
|
32087
|
+
grid-template-rows: 0fr;
|
|
32088
|
+
overflow: hidden;
|
|
32089
|
+
animation: wds-critical-banner-reveal-height 400ms cubic-bezier(0.3, 0, 0.1, 1) 500ms both;
|
|
32090
|
+
}
|
|
32091
|
+
|
|
32092
|
+
@container critical-banner-overhang (max-width: 600px) {
|
|
32093
|
+
.wds-critical-banner__entry-mask {
|
|
32094
|
+
--critical-banner-mobile-overhang-size: 32px;
|
|
32095
|
+
}
|
|
32096
|
+
.wds-critical-banner__entry-mask .wds-critical-banner-overhang {
|
|
32097
|
+
margin-bottom: var(--critical-banner-mobile-overhang-size);
|
|
32098
|
+
}
|
|
32099
|
+
.wds-critical-banner__entry-mask .wds-critical-banner-overhang::after {
|
|
32100
|
+
content: "";
|
|
32101
|
+
position: absolute;
|
|
32102
|
+
right: 0;
|
|
32103
|
+
bottom: calc(-1 * var(--critical-banner-mobile-overhang-size));
|
|
32104
|
+
left: 0;
|
|
32105
|
+
height: var(--critical-banner-mobile-overhang-size);
|
|
32106
|
+
pointer-events: none;
|
|
32107
|
+
background: radial-gradient(circle at 100% 100%, transparent var(--critical-banner-mobile-overhang-size), var(--color-sentiment-background-surface) var(--critical-banner-mobile-overhang-size)) 0 0 / var(--critical-banner-mobile-overhang-size) var(--critical-banner-mobile-overhang-size) no-repeat, radial-gradient(circle at 0% 100%, transparent var(--critical-banner-mobile-overhang-size), var(--color-sentiment-background-surface) var(--critical-banner-mobile-overhang-size)) 100% 0 / var(--critical-banner-mobile-overhang-size) var(--critical-banner-mobile-overhang-size) no-repeat;
|
|
32108
|
+
}
|
|
32109
|
+
}
|
|
32110
|
+
|
|
32111
|
+
.wds-critical-banner__entry-track {
|
|
32112
|
+
min-height: 0;
|
|
32113
|
+
}
|
|
32114
|
+
|
|
32115
|
+
@keyframes wds-critical-banner-reveal-height {
|
|
32116
|
+
from {
|
|
32117
|
+
grid-template-rows: 0fr;
|
|
32118
|
+
overflow: hidden;
|
|
32119
|
+
}
|
|
32120
|
+
to {
|
|
32121
|
+
grid-template-rows: 1fr;
|
|
32122
|
+
overflow: visible;
|
|
32123
|
+
}
|
|
32124
|
+
}
|
|
32125
|
+
|
|
32065
32126
|
@media (prefers-reduced-motion: reduce) {
|
|
32066
32127
|
.wds-critical-banner__description,
|
|
32067
32128
|
.wds-critical-banner__title,
|
|
@@ -32069,6 +32130,11 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
32069
32130
|
.wds-critical-banner__toggle {
|
|
32070
32131
|
transition: none !important;
|
|
32071
32132
|
}
|
|
32133
|
+
.wds-critical-banner__entry-mask {
|
|
32134
|
+
animation: none;
|
|
32135
|
+
grid-template-rows: 1fr;
|
|
32136
|
+
overflow: visible;
|
|
32137
|
+
}
|
|
32072
32138
|
}
|
|
32073
32139
|
|
|
32074
32140
|
.wds-expander-toggle {
|
|
@@ -169,6 +169,17 @@
|
|
|
169
169
|
margin-left: 0;
|
|
170
170
|
margin-right: -22px;
|
|
171
171
|
}
|
|
172
|
+
.wds-nudge-media-documents {
|
|
173
|
+
margin-left: -8px;
|
|
174
|
+
margin-top: 22px;
|
|
175
|
+
position: absolute;
|
|
176
|
+
width: 120px;
|
|
177
|
+
}
|
|
178
|
+
[dir="rtl"] .wds-nudge-media-documents {
|
|
179
|
+
transform: scaleX(-1);
|
|
180
|
+
margin-left: 0;
|
|
181
|
+
margin-right: -8px;
|
|
182
|
+
}
|
|
172
183
|
.wds-nudge-container {
|
|
173
184
|
align-items: stretch;
|
|
174
185
|
display: flex;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
--Prompt-gap: var(--size-10) var(--size-16);
|
|
5
5
|
--Prompt-border-radius: 0;
|
|
6
6
|
container-type: inline-size;
|
|
7
|
+
position: relative;
|
|
7
8
|
--critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
|
|
8
9
|
--critical-banner-duration: 150ms;
|
|
9
10
|
/* Override PrimitivePrompt's --screen-sm-max actions behaviour:
|
|
@@ -124,6 +125,48 @@
|
|
|
124
125
|
min-width: fit-content;
|
|
125
126
|
}
|
|
126
127
|
}
|
|
128
|
+
.wds-critical-banner-overhang-query {
|
|
129
|
+
container-name: critical-banner-overhang;
|
|
130
|
+
container-type: inline-size;
|
|
131
|
+
inline-size: 100%;
|
|
132
|
+
}
|
|
133
|
+
.wds-critical-banner__entry-mask {
|
|
134
|
+
display: grid;
|
|
135
|
+
grid-template-rows: 0fr;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
animation: wds-critical-banner-reveal-height 400ms cubic-bezier(0.3, 0, 0.1, 1) 500ms both;
|
|
138
|
+
}
|
|
139
|
+
@container critical-banner-overhang (max-width: 600px) {
|
|
140
|
+
.wds-critical-banner__entry-mask {
|
|
141
|
+
--critical-banner-mobile-overhang-size: 32px;
|
|
142
|
+
}
|
|
143
|
+
.wds-critical-banner__entry-mask .wds-critical-banner-overhang {
|
|
144
|
+
margin-bottom: var(--critical-banner-mobile-overhang-size);
|
|
145
|
+
}
|
|
146
|
+
.wds-critical-banner__entry-mask .wds-critical-banner-overhang::after {
|
|
147
|
+
content: "";
|
|
148
|
+
position: absolute;
|
|
149
|
+
right: 0;
|
|
150
|
+
bottom: calc(-1 * var(--critical-banner-mobile-overhang-size));
|
|
151
|
+
left: 0;
|
|
152
|
+
height: var(--critical-banner-mobile-overhang-size);
|
|
153
|
+
pointer-events: none;
|
|
154
|
+
background: radial-gradient(circle at 100% 100%, transparent var(--critical-banner-mobile-overhang-size), var(--color-sentiment-background-surface) var(--critical-banner-mobile-overhang-size)) 0 0 / var(--critical-banner-mobile-overhang-size) var(--critical-banner-mobile-overhang-size) no-repeat, radial-gradient(circle at 0% 100%, transparent var(--critical-banner-mobile-overhang-size), var(--color-sentiment-background-surface) var(--critical-banner-mobile-overhang-size)) 100% 0 / var(--critical-banner-mobile-overhang-size) var(--critical-banner-mobile-overhang-size) no-repeat;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
.wds-critical-banner__entry-track {
|
|
158
|
+
min-height: 0;
|
|
159
|
+
}
|
|
160
|
+
@keyframes wds-critical-banner-reveal-height {
|
|
161
|
+
from {
|
|
162
|
+
grid-template-rows: 0fr;
|
|
163
|
+
overflow: hidden;
|
|
164
|
+
}
|
|
165
|
+
to {
|
|
166
|
+
grid-template-rows: 1fr;
|
|
167
|
+
overflow: visible;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
127
170
|
@media (prefers-reduced-motion: reduce) {
|
|
128
171
|
.wds-critical-banner__description,
|
|
129
172
|
.wds-critical-banner__title,
|
|
@@ -131,4 +174,9 @@
|
|
|
131
174
|
.wds-critical-banner__toggle {
|
|
132
175
|
transition: none !important;
|
|
133
176
|
}
|
|
177
|
+
.wds-critical-banner__entry-mask {
|
|
178
|
+
animation: none;
|
|
179
|
+
grid-template-rows: 1fr;
|
|
180
|
+
overflow: visible;
|
|
181
|
+
}
|
|
134
182
|
}
|
|
@@ -2,7 +2,7 @@ import { Assets } from '@wise/art';
|
|
|
2
2
|
import { ReactNode, MouseEvent } from 'react';
|
|
3
3
|
import type { AlertAction } from '../alert';
|
|
4
4
|
export declare const STORAGE_NAME = "dismissedNudges";
|
|
5
|
-
type MediaNameType = `${Assets.GLOBE}` | `${Assets.LOCK}` | `${Assets.WALLET}` | `${Assets.GEAR}` | `${Assets.INVITE_LETTER}` | `${Assets.PERSONAL_CARD}` | `${Assets.BUSINESS_CARD}` | `${Assets.HEART}` | `${Assets.MULTI_CURRENCY}` | `${Assets.SHOPPING_BAG}` | `${Assets.FLOWER}` | `${Assets.GIFT_BOX}` | `${Assets.BACKPACK}`;
|
|
5
|
+
type MediaNameType = `${Assets.GLOBE}` | `${Assets.LOCK}` | `${Assets.WALLET}` | `${Assets.GEAR}` | `${Assets.INVITE_LETTER}` | `${Assets.PERSONAL_CARD}` | `${Assets.BUSINESS_CARD}` | `${Assets.HEART}` | `${Assets.MULTI_CURRENCY}` | `${Assets.SHOPPING_BAG}` | `${Assets.FLOWER}` | `${Assets.GIFT_BOX}` | `${Assets.BACKPACK}` | `${Assets.DOCUMENTS}`;
|
|
6
6
|
type BaseProps = {
|
|
7
7
|
/** @deprecated Use `mediaName` property instead. */
|
|
8
8
|
media?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Nudge.d.ts","sourceRoot":"","sources":["../../../src/nudge/Nudge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAA0B,MAAM,WAAW,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eAAe,KAAK,CAAC"}
|
|
@@ -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;AAMnD,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,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,
|
|
1
|
+
{"version":3,"file":"CriticalBanner.d.ts","sourceRoot":"","sources":["../../../../src/prompt/CriticalBanner/CriticalBanner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,OAAO,CAAC;AAMnD,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,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,gCA8HrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "46.
|
|
3
|
+
"version": "46.148.0",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -39,22 +39,22 @@
|
|
|
39
39
|
"!**/*.tsbuildinfo"
|
|
40
40
|
],
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@babel/core": "^7.29.
|
|
43
|
-
"@babel/plugin-transform-runtime": "^7.29.
|
|
44
|
-
"@babel/preset-env": "^7.29.
|
|
45
|
-
"@babel/preset-react": "^7.
|
|
46
|
-
"@babel/preset-typescript": "^7.
|
|
47
|
-
"@formatjs/cli": "^6.16.
|
|
48
|
-
"@rollup/plugin-babel": "^7.
|
|
42
|
+
"@babel/core": "^7.29.7",
|
|
43
|
+
"@babel/plugin-transform-runtime": "^7.29.7",
|
|
44
|
+
"@babel/preset-env": "^7.29.7",
|
|
45
|
+
"@babel/preset-react": "^7.29.7",
|
|
46
|
+
"@babel/preset-typescript": "^7.29.7",
|
|
47
|
+
"@formatjs/cli": "^6.16.6",
|
|
48
|
+
"@rollup/plugin-babel": "^7.1.0",
|
|
49
49
|
"@rollup/plugin-json": "^6.1.0",
|
|
50
50
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
51
51
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
52
52
|
"@rollup/plugin-url": "^8.0.2",
|
|
53
|
-
"@storybook/addon-a11y": "^10.4.
|
|
54
|
-
"@storybook/addon-docs": "^10.4.
|
|
53
|
+
"@storybook/addon-a11y": "^10.4.1",
|
|
54
|
+
"@storybook/addon-docs": "^10.4.1",
|
|
55
55
|
"@storybook/addon-mcp": "^0.6.0",
|
|
56
56
|
"@storybook/addon-webpack5-compiler-babel": "^4.0.1",
|
|
57
|
-
"@storybook/react-webpack5": "^10.4.
|
|
57
|
+
"@storybook/react-webpack5": "^10.4.1",
|
|
58
58
|
"@testing-library/dom": "^10.4.1",
|
|
59
59
|
"@testing-library/jest-dom": "^6.9.1",
|
|
60
60
|
"@testing-library/react": "^16.3.2",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@types/lodash": "4.17.24",
|
|
68
68
|
"@types/lodash.clamp": "^4.0.9",
|
|
69
69
|
"@types/lodash.debounce": "^4.0.9",
|
|
70
|
-
"@types/react": "^18.3.
|
|
70
|
+
"@types/react": "^18.3.29",
|
|
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",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@wise/eslint-config": "^14.2.1",
|
|
78
78
|
"babel-plugin-formatjs": "^10.5.41",
|
|
79
79
|
"eslint": "^9.39.4",
|
|
80
|
-
"eslint-plugin-storybook": "^10.4.
|
|
80
|
+
"eslint-plugin-storybook": "^10.4.1",
|
|
81
81
|
"gulp": "^5.0.1",
|
|
82
82
|
"jest": "^29.7.0",
|
|
83
83
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -88,11 +88,11 @@
|
|
|
88
88
|
"react-live": "^4.1.8",
|
|
89
89
|
"rollup": "^4.60.4",
|
|
90
90
|
"rollup-preserve-directives": "^1.1.3",
|
|
91
|
-
"storybook": "^10.4.
|
|
91
|
+
"storybook": "^10.4.1",
|
|
92
92
|
"storybook-addon-tag-badges": "^3.1.0",
|
|
93
93
|
"storybook-addon-test-codegen": "^3.0.1",
|
|
94
|
-
"@wise/components-theming": "1.10.2",
|
|
95
94
|
"@transferwise/less-config": "3.1.2",
|
|
95
|
+
"@wise/components-theming": "1.10.2",
|
|
96
96
|
"@wise/wds-configs": "0.0.0"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
@@ -105,18 +105,18 @@
|
|
|
105
105
|
"react-intl": "^5.10.0 || ^6 || ^7"
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
|
-
"@babel/runtime": "^7.29.
|
|
108
|
+
"@babel/runtime": "^7.29.7",
|
|
109
109
|
"@floating-ui/react": "^0.27.19",
|
|
110
110
|
"@headlessui/react": "^2.2.10",
|
|
111
|
-
"@react-aria/focus": "^3.22.
|
|
112
|
-
"@react-aria/overlays": "^3.32.
|
|
111
|
+
"@react-aria/focus": "^3.22.1",
|
|
112
|
+
"@react-aria/overlays": "^3.32.1",
|
|
113
113
|
"@transferwise/formatting": "^2.14.1",
|
|
114
114
|
"@transferwise/neptune-tokens": "^8.24.0",
|
|
115
115
|
"@transferwise/neptune-validation": "^3.3.4",
|
|
116
116
|
"clsx": "^2.1.1",
|
|
117
117
|
"commonmark": "^0.31.2",
|
|
118
118
|
"core-js": "^3.49.0",
|
|
119
|
-
"framer-motion": "^12.
|
|
119
|
+
"framer-motion": "^12.40.0",
|
|
120
120
|
"lodash.clamp": "^4.0.3",
|
|
121
121
|
"lodash.debounce": "^4.0.8",
|
|
122
122
|
"merge-props": "^6.0.0",
|
|
@@ -127,6 +127,10 @@
|
|
|
127
127
|
"access": "public",
|
|
128
128
|
"registry": "https://registry.npmjs.org/"
|
|
129
129
|
},
|
|
130
|
+
"wise": {
|
|
131
|
+
"platform": "wise-library",
|
|
132
|
+
"strict": true
|
|
133
|
+
},
|
|
130
134
|
"scripts": {
|
|
131
135
|
"dev": "npm-run-all --parallel dev:* dev:*:* storybook:dev",
|
|
132
136
|
"dev:less:watch": "gulp watchLess --dest=src",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { FastFlag as FastFlagIcon, CardWise as CardWiseIcon } from '@transferwise/icons';
|
|
4
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
5
|
|
|
5
6
|
import { Scroll, Size } from '../common';
|
|
6
7
|
import Modal from '../modal';
|
|
@@ -89,6 +90,30 @@ const meta: Meta<typeof Accordion> = {
|
|
|
89
90
|
export default meta;
|
|
90
91
|
type Story = StoryObj<typeof Accordion>;
|
|
91
92
|
|
|
93
|
+
export const Sandbox = createSandboxStory({
|
|
94
|
+
code: `<Accordion
|
|
95
|
+
indexOpen={1}
|
|
96
|
+
items={[
|
|
97
|
+
{
|
|
98
|
+
title: 'Item 1',
|
|
99
|
+
content: 'I can be text',
|
|
100
|
+
icon: <Freeze size={24} />,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
title: 'Item 2 with icon',
|
|
104
|
+
content: <span>I can be a node</span>,
|
|
105
|
+
icon: <HappyEmoji size={24} />,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
title: 'Item 3',
|
|
109
|
+
content: 'I can be text',
|
|
110
|
+
icon: <New size={24} />,
|
|
111
|
+
},
|
|
112
|
+
]}
|
|
113
|
+
/>`,
|
|
114
|
+
scope: globalScope,
|
|
115
|
+
});
|
|
116
|
+
|
|
92
117
|
export const Default: Story = {
|
|
93
118
|
args: {
|
|
94
119
|
indexOpen: 0,
|
|
@@ -3,6 +3,7 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
3
3
|
import AvatarLayout, { AvatarLayoutProps } from '.';
|
|
4
4
|
import { Freeze } from '@transferwise/icons';
|
|
5
5
|
import { Flag } from '@wise/art';
|
|
6
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
6
7
|
import Body from '../body';
|
|
7
8
|
import SentimentSurface from '../sentimentSurface';
|
|
8
9
|
|
|
@@ -13,6 +14,15 @@ export default {
|
|
|
13
14
|
|
|
14
15
|
type Story = StoryObj<typeof AvatarLayout>;
|
|
15
16
|
|
|
17
|
+
export const Sandbox = createSandboxStory({
|
|
18
|
+
code: `<AvatarLayout
|
|
19
|
+
size={48}
|
|
20
|
+
orientation="diagonal"
|
|
21
|
+
avatars={[{ asset: <Flag code="br" /> }, { asset: <Flag code="jp" /> }]}
|
|
22
|
+
/>`,
|
|
23
|
+
scope: globalScope,
|
|
24
|
+
});
|
|
25
|
+
|
|
16
26
|
const sizes: AvatarLayoutProps['size'][] = [16, 24, 32, 40, 48, 56, 72, 88, 96];
|
|
17
27
|
|
|
18
28
|
export const Diagonal: Story = {
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from '@transferwise/icons';
|
|
18
18
|
import AvatarView, { AvatarViewProps } from '.';
|
|
19
19
|
import { Flag } from '@wise/art';
|
|
20
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
20
21
|
import { ProfileType } from '../common';
|
|
21
22
|
import Body from '../body';
|
|
22
23
|
import SentimentSurface from '../sentimentSurface';
|
|
@@ -28,6 +29,13 @@ export default {
|
|
|
28
29
|
|
|
29
30
|
type Story = StoryObj<typeof AvatarView>;
|
|
30
31
|
|
|
32
|
+
export const Sandbox = createSandboxStory({
|
|
33
|
+
code: `<AvatarView size={48} badge={{ flagCode: 'GBP' }}>
|
|
34
|
+
<Freeze />
|
|
35
|
+
</AvatarView>`,
|
|
36
|
+
scope: globalScope,
|
|
37
|
+
});
|
|
38
|
+
|
|
31
39
|
const profileName1 = 'Wolter White';
|
|
32
40
|
const profileName2 = 'Tyler Durden';
|
|
33
41
|
const sizes: AvatarViewProps['size'][] = [16, 24, 32, 40, 48, 56, 72, 88, 96];
|
package/src/body/Body.story.tsx
CHANGED
|
@@ -2,12 +2,23 @@ import { Typography } from '../common/propsValues/typography';
|
|
|
2
2
|
import Title from '../title';
|
|
3
3
|
|
|
4
4
|
import Body from './Body';
|
|
5
|
+
import {
|
|
6
|
+
createSandboxStory,
|
|
7
|
+
globalScope,
|
|
8
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
5
9
|
|
|
6
10
|
export default {
|
|
7
11
|
title: 'Typography/Body',
|
|
8
12
|
component: Body,
|
|
9
13
|
};
|
|
10
14
|
|
|
15
|
+
export const Sandbox = createSandboxStory({
|
|
16
|
+
code: `<Body type="body-default">
|
|
17
|
+
We're building the world's most international account.
|
|
18
|
+
</Body>`,
|
|
19
|
+
scope: globalScope,
|
|
20
|
+
});
|
|
21
|
+
|
|
11
22
|
export const Basic = () => {
|
|
12
23
|
return (
|
|
13
24
|
<>
|
|
@@ -126,3 +137,4 @@ export const Basic = () => {
|
|
|
126
137
|
</>
|
|
127
138
|
);
|
|
128
139
|
};
|
|
140
|
+
|
|
@@ -322,7 +322,13 @@ export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
|
322
322
|
};
|
|
323
323
|
|
|
324
324
|
export const Sandbox = createSandboxStory({
|
|
325
|
-
code: `<Button
|
|
325
|
+
code: `<Button
|
|
326
|
+
v2
|
|
327
|
+
priority="primary"
|
|
328
|
+
sentiment="default"
|
|
329
|
+
size="md"
|
|
330
|
+
addonEnd={{ type: 'icon', value: <ArrowRight /> }}
|
|
331
|
+
>
|
|
326
332
|
Click me
|
|
327
333
|
</Button>`,
|
|
328
334
|
scope: globalScope,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { userEvent, within } from 'storybook/test';
|
|
4
|
+
import {
|
|
5
|
+
createSandboxStory,
|
|
6
|
+
globalScope,
|
|
7
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
8
|
import Calendar, { type CalendarProps } from './Calendar';
|
|
5
9
|
import Modal from '../modal';
|
|
6
10
|
import Button from '../button';
|
|
@@ -9,13 +13,6 @@ import Button from '../button';
|
|
|
9
13
|
export default {
|
|
10
14
|
component: Calendar,
|
|
11
15
|
title: 'Forms/Calendar',
|
|
12
|
-
decorators: [
|
|
13
|
-
(Story: React.ComponentType) => (
|
|
14
|
-
<div style={{ maxWidth: 500, margin: '0 auto' }}>
|
|
15
|
-
<Story />
|
|
16
|
-
</div>
|
|
17
|
-
),
|
|
18
|
-
],
|
|
19
16
|
argTypes: {
|
|
20
17
|
monthFormat: { control: 'select', options: ['long', 'short'] },
|
|
21
18
|
min: { control: 'date' },
|
|
@@ -31,6 +28,21 @@ theFuture.setUTCDate(epoch.getUTCDate() + 10);
|
|
|
31
28
|
const thePast = new Date(epoch);
|
|
32
29
|
thePast.setUTCDate(epoch.getUTCDate() - 10);
|
|
33
30
|
|
|
31
|
+
export const Sandbox = createSandboxStory({
|
|
32
|
+
code: `const App = () => {
|
|
33
|
+
const [value, setValue] = React.useState(new Date('2024-06-15'));
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Calendar
|
|
37
|
+
monthFormat="long"
|
|
38
|
+
value={value}
|
|
39
|
+
onChange={(date) => setValue(date)}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
};`,
|
|
43
|
+
scope: { ...globalScope, Calendar },
|
|
44
|
+
});
|
|
45
|
+
|
|
34
46
|
export const Basic: Story = {
|
|
35
47
|
render: (args: CalendarProps) => {
|
|
36
48
|
const [value, setValue] = useState<Date | null>(epoch);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Args } from '@storybook/react-webpack5';
|
|
2
2
|
import { Illustration } from '@wise/art';
|
|
3
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
3
4
|
|
|
4
5
|
import Display from '../display';
|
|
5
6
|
|
|
@@ -53,6 +54,40 @@ const carouselCards: CarouselCard[] = [
|
|
|
53
54
|
},
|
|
54
55
|
];
|
|
55
56
|
|
|
57
|
+
export const Sandbox = createSandboxStory({
|
|
58
|
+
code: `const App = () => {
|
|
59
|
+
const cards = [
|
|
60
|
+
{
|
|
61
|
+
id: 'card-1',
|
|
62
|
+
type: 'button',
|
|
63
|
+
onClick: console.log,
|
|
64
|
+
content: (
|
|
65
|
+
<div className="d-flex p-a-1 flex-column align-items-center">
|
|
66
|
+
<Illustration disablePadding name="globe" size="small" alt="" />
|
|
67
|
+
</div>
|
|
68
|
+
),
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'card-2',
|
|
72
|
+
type: 'promo',
|
|
73
|
+
href: '#',
|
|
74
|
+
title: 'Wise',
|
|
75
|
+
description: 'The best way to move money internationally',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: 'card-3',
|
|
79
|
+
type: 'anchor',
|
|
80
|
+
href: '#',
|
|
81
|
+
hrefTarget: '_blank',
|
|
82
|
+
content: <Display type="display-small">Get Quick Pay</Display>,
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
return <Carousel header="Carousel heading" cards={cards} />;
|
|
87
|
+
};`,
|
|
88
|
+
scope: globalScope,
|
|
89
|
+
});
|
|
90
|
+
|
|
56
91
|
export const CarouselDefault = {
|
|
57
92
|
render: (args: Args) => {
|
|
58
93
|
return <Carousel header="Pretty nifty stuff" cards={carouselCards} {...args} />;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { fn } from 'storybook/test';
|
|
3
3
|
|
|
4
|
+
import {
|
|
5
|
+
createSandboxStory,
|
|
6
|
+
globalScope,
|
|
7
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
8
|
import { Field } from '../field/Field';
|
|
5
9
|
|
|
6
10
|
import Checkbox from './Checkbox';
|
|
@@ -19,6 +23,22 @@ export default meta;
|
|
|
19
23
|
|
|
20
24
|
type Story = StoryObj<typeof Checkbox>;
|
|
21
25
|
|
|
26
|
+
export const Sandbox = createSandboxStory({
|
|
27
|
+
code: `const App = () => {
|
|
28
|
+
const [checked, setChecked] = React.useState(false);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Checkbox
|
|
32
|
+
label="I agree to the terms and conditions"
|
|
33
|
+
secondary="Please read before accepting"
|
|
34
|
+
checked={checked}
|
|
35
|
+
onChange={() => setChecked((prev) => !prev)}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
};`,
|
|
39
|
+
scope: globalScope,
|
|
40
|
+
});
|
|
41
|
+
|
|
22
42
|
export const Basic: Story = {};
|
|
23
43
|
|
|
24
44
|
export const Multiple: Story = {
|
|
@@ -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={(event) => setChecked(event.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],
|