@transferwise/components 46.83.3 → 46.84.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/common/closeButton/CloseButton.js.map +1 -1
- package/build/common/closeButton/CloseButton.mjs.map +1 -1
- package/build/flowNavigation/FlowNavigation.js +8 -3
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +8 -3
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/i18n/de.json +5 -0
- package/build/i18n/de.json.js +5 -0
- package/build/i18n/de.json.js.map +1 -1
- package/build/i18n/de.json.mjs +5 -0
- package/build/i18n/de.json.mjs.map +1 -1
- package/build/iconButton/IconButton.js +41 -0
- package/build/iconButton/IconButton.js.map +1 -0
- package/build/iconButton/IconButton.mjs +39 -0
- package/build/iconButton/IconButton.mjs.map +1 -0
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -0
- package/build/index.mjs.map +1 -1
- package/build/main.css +86 -32
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js +83 -0
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js.map +1 -0
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs +81 -0
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs.map +1 -0
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js +90 -0
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js.map +1 -0
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs +88 -0
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs.map +1 -0
- package/build/styles/iconButton/IconButton.css +82 -0
- package/build/styles/main.css +86 -32
- package/build/styles/summary/Summary.css +4 -0
- package/build/summary/Summary.js +3 -3
- package/build/summary/Summary.js.map +1 -1
- package/build/summary/Summary.mjs +3 -3
- package/build/summary/Summary.mjs.map +1 -1
- package/build/types/common/closeButton/CloseButton.d.ts +3 -0
- package/build/types/common/closeButton/CloseButton.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/iconButton/IconButton.d.ts +15 -0
- package/build/types/iconButton/IconButton.d.ts.map +1 -0
- package/build/types/iconButton/index.d.ts +3 -0
- package/build/types/iconButton/index.d.ts.map +1 -0
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/summary/Summary.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/common/closeButton/CloseButton.tsx +3 -0
- package/src/flowNavigation/FlowNavigation.spec.js +7 -8
- package/src/flowNavigation/FlowNavigation.tsx +11 -2
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +27 -3
- package/src/i18n/de.json +5 -0
- package/src/iconButton/IconButton.css +82 -0
- package/src/iconButton/IconButton.less +55 -0
- package/src/iconButton/IconButton.story.tsx +107 -0
- package/src/iconButton/IconButton.tsx +51 -0
- package/src/iconButton/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/inputs/SelectInput.story.tsx +68 -24
- package/src/main.css +86 -32
- package/src/main.less +1 -1
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.tests.story.tsx +81 -32
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.tests.story.tsx +124 -42
- package/src/summary/Summary.css +4 -0
- package/src/summary/Summary.less +3 -0
- package/src/summary/Summary.story.tsx +13 -3
- package/src/summary/Summary.tsx +13 -11
- package/build/flowNavigation/backButton/BackButton.js +0 -30
- package/build/flowNavigation/backButton/BackButton.js.map +0 -1
- package/build/flowNavigation/backButton/BackButton.mjs +0 -28
- package/build/flowNavigation/backButton/BackButton.mjs.map +0 -1
- package/build/styles/flowNavigation/backButton/BackButton.css +0 -32
- package/build/types/flowNavigation/backButton/BackButton.d.ts +0 -7
- package/build/types/flowNavigation/backButton/BackButton.d.ts.map +0 -1
- package/build/types/flowNavigation/backButton/index.d.ts +0 -3
- package/build/types/flowNavigation/backButton/index.d.ts.map +0 -1
- package/src/flowNavigation/backButton/BackButton.css +0 -32
- package/src/flowNavigation/backButton/BackButton.less +0 -36
- package/src/flowNavigation/backButton/BackButton.tsx +0 -29
- package/src/flowNavigation/backButton/index.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloseButton.js","sources":["../../../src/common/closeButton/CloseButton.tsx"],"sourcesContent":["import { Cross, CrossCircleFill } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { forwardRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Size, SizeLarge, SizeMedium, SizeSmall } from '../propsValues/size';\n\nimport messages from './CloseButton.messages';\n\nexport type CloseButtonProps = Pick<\n React.ComponentPropsWithoutRef<'button'>,\n 'aria-label' | 'className' | 'onClick'\n> & {\n size?: SizeSmall | SizeMedium | SizeLarge;\n filled?: boolean;\n isDisabled?: boolean;\n testId?: string;\n};\n\nexport const CloseButton = forwardRef(function CloseButton(\n {\n 'aria-label': ariaLabel,\n size = Size.MEDIUM,\n filled = false,\n className,\n onClick,\n isDisabled,\n testId,\n }: CloseButtonProps,\n reference: React.ForwardedRef<HTMLButtonElement | null>,\n) {\n const intl = useIntl();\n ariaLabel ??= intl.formatMessage(messages.ariaLabel);\n const Icon = filled ? CrossCircleFill : Cross;\n\n return (\n <button\n ref={reference}\n type=\"button\"\n className={clsx(\n 'np-close-button',\n 'close btn-link',\n 'text-no-decoration',\n {\n 'np-close-button--large': size === Size.MEDIUM,\n 'np-close-button--x-large': size === Size.LARGE,\n },\n className,\n )}\n aria-label={ariaLabel}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n data-testid={testId}\n onClick={onClick}\n >\n <Icon size={size === Size.SMALL ? 16 : 24} />\n </button>\n );\n});\n"],"names":["CloseButton","forwardRef","ariaLabel","size","Size","MEDIUM","filled","className","onClick","isDisabled","testId","reference","intl","useIntl","formatMessage","messages","Icon","CrossCircleFill","Cross","_jsx","ref","type","clsx","LARGE","disabled","children","SMALL"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"CloseButton.js","sources":["../../../src/common/closeButton/CloseButton.tsx"],"sourcesContent":["import { Cross, CrossCircleFill } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { forwardRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Size, SizeLarge, SizeMedium, SizeSmall } from '../propsValues/size';\n\nimport messages from './CloseButton.messages';\n\nexport type CloseButtonProps = Pick<\n React.ComponentPropsWithoutRef<'button'>,\n 'aria-label' | 'className' | 'onClick'\n> & {\n size?: SizeSmall | SizeMedium | SizeLarge;\n filled?: boolean;\n isDisabled?: boolean;\n testId?: string;\n};\n\n/**\n * @deprecated Use `<IconButton />` component instead\n */\nexport const CloseButton = forwardRef(function CloseButton(\n {\n 'aria-label': ariaLabel,\n size = Size.MEDIUM,\n filled = false,\n className,\n onClick,\n isDisabled,\n testId,\n }: CloseButtonProps,\n reference: React.ForwardedRef<HTMLButtonElement | null>,\n) {\n const intl = useIntl();\n ariaLabel ??= intl.formatMessage(messages.ariaLabel);\n const Icon = filled ? CrossCircleFill : Cross;\n\n return (\n <button\n ref={reference}\n type=\"button\"\n className={clsx(\n 'np-close-button',\n 'close btn-link',\n 'text-no-decoration',\n {\n 'np-close-button--large': size === Size.MEDIUM,\n 'np-close-button--x-large': size === Size.LARGE,\n },\n className,\n )}\n aria-label={ariaLabel}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n data-testid={testId}\n onClick={onClick}\n >\n <Icon size={size === Size.SMALL ? 16 : 24} />\n </button>\n );\n});\n"],"names":["CloseButton","forwardRef","ariaLabel","size","Size","MEDIUM","filled","className","onClick","isDisabled","testId","reference","intl","useIntl","formatMessage","messages","Icon","CrossCircleFill","Cross","_jsx","ref","type","clsx","LARGE","disabled","children","SMALL"],"mappings":";;;;;;;;;;MAsBaA,WAAW,gBAAGC,gBAAU,CAAC,SAASD,WAAWA,CACxD;AACE,EAAA,YAAY,EAAEE,SAAS;QACvBC,MAAI,GAAGC,SAAI,CAACC,MAAM;AAClBC,EAAAA,MAAM,GAAG,KAAK;EACdC,SAAS;EACTC,OAAO;EACPC,UAAU;AACVC,EAAAA,MAAAA;AAAM,CACW,EACnBC,SAAuD,EAAA;AAEvD,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE,CAAA;EACtBX,SAAS,KAAKU,IAAI,CAACE,aAAa,CAACC,oBAAQ,CAACb,SAAS,CAAC,CAAA;AACpD,EAAA,MAAMc,IAAI,GAAGV,MAAM,GAAGW,qBAAe,GAAGC,WAAK,CAAA;AAE7C,EAAA,oBACEC,cAAA,CAAA,QAAA,EAAA;AACEC,IAAAA,GAAG,EAAET,SAAU;AACfU,IAAAA,IAAI,EAAC,QAAQ;IACbd,SAAS,EAAEe,SAAI,CACb,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB;AACE,MAAA,wBAAwB,EAAEnB,MAAI,KAAKC,SAAI,CAACC,MAAM;AAC9C,MAAA,0BAA0B,EAAEF,MAAI,KAAKC,SAAI,CAACmB,KAAAA;KAC3C,EACDhB,SAAS,CACT;AACF,IAAA,YAAA,EAAYL,SAAU;AACtB,IAAA,eAAA,EAAeO,UAAW;AAC1Be,IAAAA,QAAQ,EAAEf,UAAW;AACrB,IAAA,aAAA,EAAaC,MAAO;AACpBF,IAAAA,OAAO,EAAEA,OAAQ;IAAAiB,QAAA,eAEjBN,cAAA,CAACH,IAAI,EAAA;MAACb,IAAI,EAAEA,MAAI,KAAKC,SAAI,CAACsB,KAAK,GAAG,EAAE,GAAG,EAAA;KACzC,CAAA;AAAA,GAAQ,CAAC,CAAA;AAEb,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloseButton.mjs","sources":["../../../src/common/closeButton/CloseButton.tsx"],"sourcesContent":["import { Cross, CrossCircleFill } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { forwardRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Size, SizeLarge, SizeMedium, SizeSmall } from '../propsValues/size';\n\nimport messages from './CloseButton.messages';\n\nexport type CloseButtonProps = Pick<\n React.ComponentPropsWithoutRef<'button'>,\n 'aria-label' | 'className' | 'onClick'\n> & {\n size?: SizeSmall | SizeMedium | SizeLarge;\n filled?: boolean;\n isDisabled?: boolean;\n testId?: string;\n};\n\nexport const CloseButton = forwardRef(function CloseButton(\n {\n 'aria-label': ariaLabel,\n size = Size.MEDIUM,\n filled = false,\n className,\n onClick,\n isDisabled,\n testId,\n }: CloseButtonProps,\n reference: React.ForwardedRef<HTMLButtonElement | null>,\n) {\n const intl = useIntl();\n ariaLabel ??= intl.formatMessage(messages.ariaLabel);\n const Icon = filled ? CrossCircleFill : Cross;\n\n return (\n <button\n ref={reference}\n type=\"button\"\n className={clsx(\n 'np-close-button',\n 'close btn-link',\n 'text-no-decoration',\n {\n 'np-close-button--large': size === Size.MEDIUM,\n 'np-close-button--x-large': size === Size.LARGE,\n },\n className,\n )}\n aria-label={ariaLabel}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n data-testid={testId}\n onClick={onClick}\n >\n <Icon size={size === Size.SMALL ? 16 : 24} />\n </button>\n );\n});\n"],"names":["CloseButton","forwardRef","ariaLabel","size","Size","MEDIUM","filled","className","onClick","isDisabled","testId","reference","intl","useIntl","formatMessage","messages","Icon","CrossCircleFill","Cross","_jsx","ref","type","clsx","LARGE","disabled","children","SMALL"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"CloseButton.mjs","sources":["../../../src/common/closeButton/CloseButton.tsx"],"sourcesContent":["import { Cross, CrossCircleFill } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { forwardRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Size, SizeLarge, SizeMedium, SizeSmall } from '../propsValues/size';\n\nimport messages from './CloseButton.messages';\n\nexport type CloseButtonProps = Pick<\n React.ComponentPropsWithoutRef<'button'>,\n 'aria-label' | 'className' | 'onClick'\n> & {\n size?: SizeSmall | SizeMedium | SizeLarge;\n filled?: boolean;\n isDisabled?: boolean;\n testId?: string;\n};\n\n/**\n * @deprecated Use `<IconButton />` component instead\n */\nexport const CloseButton = forwardRef(function CloseButton(\n {\n 'aria-label': ariaLabel,\n size = Size.MEDIUM,\n filled = false,\n className,\n onClick,\n isDisabled,\n testId,\n }: CloseButtonProps,\n reference: React.ForwardedRef<HTMLButtonElement | null>,\n) {\n const intl = useIntl();\n ariaLabel ??= intl.formatMessage(messages.ariaLabel);\n const Icon = filled ? CrossCircleFill : Cross;\n\n return (\n <button\n ref={reference}\n type=\"button\"\n className={clsx(\n 'np-close-button',\n 'close btn-link',\n 'text-no-decoration',\n {\n 'np-close-button--large': size === Size.MEDIUM,\n 'np-close-button--x-large': size === Size.LARGE,\n },\n className,\n )}\n aria-label={ariaLabel}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n data-testid={testId}\n onClick={onClick}\n >\n <Icon size={size === Size.SMALL ? 16 : 24} />\n </button>\n );\n});\n"],"names":["CloseButton","forwardRef","ariaLabel","size","Size","MEDIUM","filled","className","onClick","isDisabled","testId","reference","intl","useIntl","formatMessage","messages","Icon","CrossCircleFill","Cross","_jsx","ref","type","clsx","LARGE","disabled","children","SMALL"],"mappings":";;;;;;;;MAsBaA,WAAW,gBAAGC,UAAU,CAAC,SAASD,WAAWA,CACxD;AACE,EAAA,YAAY,EAAEE,SAAS;EACvBC,IAAI,GAAGC,IAAI,CAACC,MAAM;AAClBC,EAAAA,MAAM,GAAG,KAAK;EACdC,SAAS;EACTC,OAAO;EACPC,UAAU;AACVC,EAAAA,MAAAA;AAAM,CACW,EACnBC,SAAuD,EAAA;AAEvD,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE,CAAA;EACtBX,SAAS,KAAKU,IAAI,CAACE,aAAa,CAACC,QAAQ,CAACb,SAAS,CAAC,CAAA;AACpD,EAAA,MAAMc,IAAI,GAAGV,MAAM,GAAGW,eAAe,GAAGC,KAAK,CAAA;AAE7C,EAAA,oBACEC,GAAA,CAAA,QAAA,EAAA;AACEC,IAAAA,GAAG,EAAET,SAAU;AACfU,IAAAA,IAAI,EAAC,QAAQ;IACbd,SAAS,EAAEe,IAAI,CACb,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB;AACE,MAAA,wBAAwB,EAAEnB,IAAI,KAAKC,IAAI,CAACC,MAAM;AAC9C,MAAA,0BAA0B,EAAEF,IAAI,KAAKC,IAAI,CAACmB,KAAAA;KAC3C,EACDhB,SAAS,CACT;AACF,IAAA,YAAA,EAAYL,SAAU;AACtB,IAAA,eAAA,EAAeO,UAAW;AAC1Be,IAAAA,QAAQ,EAAEf,UAAW;AACrB,IAAA,aAAA,EAAaC,MAAO;AACpBF,IAAAA,OAAO,EAAEA,OAAQ;IAAAiB,QAAA,eAEjBN,GAAA,CAACH,IAAI,EAAA;MAACb,IAAI,EAAEA,IAAI,KAAKC,IAAI,CAACsB,KAAK,GAAG,EAAE,GAAG,EAAA;KACzC,CAAA;AAAA,GAAQ,CAAC,CAAA;AAEb,CAAC;;;;"}
|
|
@@ -28,7 +28,8 @@ var Stepper = require('../stepper/Stepper.js');
|
|
|
28
28
|
var useScreenSize = require('../common/hooks/useScreenSize.js');
|
|
29
29
|
var FlowNavigation_messages = require('./FlowNavigation.messages.js');
|
|
30
30
|
var AnimatedLabel = require('./animatedLabel/AnimatedLabel.js');
|
|
31
|
-
var
|
|
31
|
+
var IconButton = require('../iconButton/IconButton.js');
|
|
32
|
+
var icons = require('@transferwise/icons');
|
|
32
33
|
var jsxRuntime = require('react/jsx-runtime');
|
|
33
34
|
|
|
34
35
|
const FlowNavigation = ({
|
|
@@ -61,9 +62,13 @@ const FlowNavigation = ({
|
|
|
61
62
|
'np-flow-navigation--lg': screenLg
|
|
62
63
|
}),
|
|
63
64
|
leftContent: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
64
|
-
children: [!screenSm && displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(
|
|
65
|
+
children: [!screenSm && displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(IconButton, {
|
|
66
|
+
size: 40,
|
|
67
|
+
priority: "tertiary",
|
|
68
|
+
type: "default",
|
|
65
69
|
"aria-label": intl.formatMessage(FlowNavigation_messages.back),
|
|
66
|
-
onClick: onGoBack
|
|
70
|
+
onClick: onGoBack,
|
|
71
|
+
children: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowLeft, {})
|
|
67
72
|
}) : /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
68
73
|
className: "np-flow-header__left",
|
|
69
74
|
children: logo
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowNavigation.js","sources":["../../src/flowNavigation/FlowNavigation.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { Breakpoint, Layout } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport FlowHeader from '../common/flowHeader/FlowHeader';\nimport Logo from '../logo';\nimport Stepper, { type Step } from '../stepper/Stepper';\n\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport messages from './FlowNavigation.messages';\nimport AnimatedLabel from './animatedLabel';\nimport
|
|
1
|
+
{"version":3,"file":"FlowNavigation.js","sources":["../../src/flowNavigation/FlowNavigation.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { Breakpoint, Layout } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport FlowHeader from '../common/flowHeader/FlowHeader';\nimport Logo from '../logo';\nimport Stepper, { type Step } from '../stepper/Stepper';\n\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport messages from './FlowNavigation.messages';\nimport AnimatedLabel from './animatedLabel';\nimport IconButton from '../iconButton';\nimport { ArrowLeft } from '@transferwise/icons';\n\nexport interface FlowNavigationProps {\n activeStep?: number;\n avatar?: React.ReactNode;\n logo?: React.ReactNode;\n done?: boolean;\n /** Called when the close button is clicked. If not provided the close button won't show */\n onClose?: () => void;\n /** Called when the back button is clicked. If not provided the back button won't show. The back button only shows on small screens */\n onGoBack?: () => void;\n /** Steps to be displayed in stepper. If you don't need the stepper, please use OverlayHeader instead */\n steps: readonly Step[];\n}\n\nconst FlowNavigation = ({\n activeStep = 0,\n avatar,\n logo = <Logo />,\n done = false,\n onClose,\n onGoBack,\n steps,\n}: FlowNavigationProps) => {\n const intl = useIntl();\n\n const closeButton = onClose != null && <CloseButton size=\"lg\" onClick={onClose} />;\n\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const screenLg = useScreenSize(Breakpoint.LARGE);\n\n const newAvatar = done ? null : avatar;\n\n const displayGoBack = onGoBack != null && activeStep > 0;\n\n return (\n <div\n className={clsx('np-flow-navigation d-flex align-items-center justify-content-center p-y-3', {\n 'np-flow-navigation--border-bottom': !done,\n })}\n >\n <FlowHeader\n className={clsx(\n 'np-flow-navigation__content p-x-3',\n screenSm == null\n ? 'np-flow-navigation--hidden'\n : {\n 'np-flow-navigation--xs-max': !screenSm,\n // Size switches on parent container which may or may not have the same size as the window.\n 'np-flow-navigation--sm': screenSm,\n 'np-flow-navigation--lg': screenLg,\n },\n )}\n leftContent={\n <>\n {!screenSm && displayGoBack ? (\n <IconButton\n size={40}\n priority=\"tertiary\"\n type=\"default\"\n aria-label={intl.formatMessage(messages.back)}\n onClick={onGoBack}\n >\n <ArrowLeft />\n </IconButton>\n ) : (\n <div className=\"np-flow-header__left\">{logo}</div>\n )}\n {!screenSm && !done && (\n <AnimatedLabel className=\"m-x-1\" steps={steps} activeLabel={activeStep} />\n )}\n </>\n }\n rightContent={\n <div className=\"np-flow-header__right d-flex align-items-center justify-content-end order-2--lg\">\n {newAvatar}\n {newAvatar && closeButton && <span className=\"m-x-1\" />}\n {closeButton}\n </div>\n }\n bottomContent={\n !done && (\n <Stepper\n activeStep={activeStep}\n steps={steps}\n className={clsx('np-flow-navigation__stepper')}\n />\n )\n }\n layout={!screenLg ? Layout.VERTICAL : Layout.HORIZONTAL}\n />\n </div>\n );\n};\n\nexport default FlowNavigation;\n"],"names":["FlowNavigation","activeStep","avatar","logo","_jsx","Logo","done","onClose","onGoBack","steps","intl","useIntl","closeButton","CloseButton","size","onClick","screenSm","useScreenSize","Breakpoint","SMALL","screenLg","LARGE","newAvatar","displayGoBack","className","clsx","children","FlowHeader","leftContent","_jsxs","_Fragment","IconButton","priority","type","formatMessage","messages","back","ArrowLeft","AnimatedLabel","activeLabel","rightContent","bottomContent","Stepper","layout","Layout","VERTICAL","HORIZONTAL"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BMA,MAAAA,cAAc,GAAGA,CAAC;AACtBC,EAAAA,UAAU,GAAG,CAAC;EACdC,MAAM;AACNC,EAAAA,IAAI,gBAAGC,cAAA,CAACC,YAAI,IAAG,CAAA;AACfC,EAAAA,IAAI,GAAG,KAAK;EACZC,OAAO;EACPC,QAAQ;AACRC,EAAAA,KAAAA;AAAK,CACe,KAAI;AACxB,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE,CAAA;EAEtB,MAAMC,WAAW,GAAGL,OAAO,IAAI,IAAI,iBAAIH,cAAA,CAACS,uBAAW,EAAA;AAACC,IAAAA,IAAI,EAAC,IAAI;AAACC,IAAAA,OAAO,EAAER,OAAAA;AAAQ,IAAG,CAAA;AAElF,EAAA,MAAMS,QAAQ,GAAGC,2BAAa,CAACC,qBAAU,CAACC,KAAK,CAAC,CAAA;AAChD,EAAA,MAAMC,QAAQ,GAAGH,2BAAa,CAACC,qBAAU,CAACG,KAAK,CAAC,CAAA;AAEhD,EAAA,MAAMC,SAAS,GAAGhB,IAAI,GAAG,IAAI,GAAGJ,MAAM,CAAA;EAEtC,MAAMqB,aAAa,GAAGf,QAAQ,IAAI,IAAI,IAAIP,UAAU,GAAG,CAAC,CAAA;AAExD,EAAA,oBACEG,cAAA,CAAA,KAAA,EAAA;AACEoB,IAAAA,SAAS,EAAEC,SAAI,CAAC,2EAA2E,EAAE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,cAAA,CAAA,MAAA,EAAA;AAAMoB,UAAAA,SAAS,EAAC,OAAA;SAAO,CAAG,EACtDZ,WAAW,CAAA;AAAA,OACT,CACN;AACD6B,MAAAA,aAAa,EACX,CAACnC,IAAI,iBACHF,cAAA,CAACsC,OAAO,EAAA;AACNzC,QAAAA,UAAU,EAAEA,UAAW;AACvBQ,QAAAA,KAAK,EAAEA,KAAM;QACbe,SAAS,EAAEC,SAAI,CAAC,6BAA6B,CAAA;AAAE,OAAA,CAGpD;MACDkB,MAAM,EAAE,CAACvB,QAAQ,GAAGwB,cAAM,CAACC,QAAQ,GAAGD,cAAM,CAACE,UAAAA;KAEjD,CAAA;AAAA,GAAK,CAAC,CAAA;AAEV;;;;"}
|
|
@@ -26,7 +26,8 @@ import Stepper from '../stepper/Stepper.mjs';
|
|
|
26
26
|
import { useScreenSize } from '../common/hooks/useScreenSize.mjs';
|
|
27
27
|
import messages from './FlowNavigation.messages.mjs';
|
|
28
28
|
import AnimatedLabel from './animatedLabel/AnimatedLabel.mjs';
|
|
29
|
-
import
|
|
29
|
+
import IconButton from '../iconButton/IconButton.mjs';
|
|
30
|
+
import { ArrowLeft } from '@transferwise/icons';
|
|
30
31
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
31
32
|
|
|
32
33
|
const FlowNavigation = ({
|
|
@@ -59,9 +60,13 @@ const FlowNavigation = ({
|
|
|
59
60
|
'np-flow-navigation--lg': screenLg
|
|
60
61
|
}),
|
|
61
62
|
leftContent: /*#__PURE__*/jsxs(Fragment, {
|
|
62
|
-
children: [!screenSm && displayGoBack ? /*#__PURE__*/jsx(
|
|
63
|
+
children: [!screenSm && displayGoBack ? /*#__PURE__*/jsx(IconButton, {
|
|
64
|
+
size: 40,
|
|
65
|
+
priority: "tertiary",
|
|
66
|
+
type: "default",
|
|
63
67
|
"aria-label": intl.formatMessage(messages.back),
|
|
64
|
-
onClick: onGoBack
|
|
68
|
+
onClick: onGoBack,
|
|
69
|
+
children: /*#__PURE__*/jsx(ArrowLeft, {})
|
|
65
70
|
}) : /*#__PURE__*/jsx("div", {
|
|
66
71
|
className: "np-flow-header__left",
|
|
67
72
|
children: logo
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowNavigation.mjs","sources":["../../src/flowNavigation/FlowNavigation.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { Breakpoint, Layout } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport FlowHeader from '../common/flowHeader/FlowHeader';\nimport Logo from '../logo';\nimport Stepper, { type Step } from '../stepper/Stepper';\n\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport messages from './FlowNavigation.messages';\nimport AnimatedLabel from './animatedLabel';\nimport
|
|
1
|
+
{"version":3,"file":"FlowNavigation.mjs","sources":["../../src/flowNavigation/FlowNavigation.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { Breakpoint, Layout } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport FlowHeader from '../common/flowHeader/FlowHeader';\nimport Logo from '../logo';\nimport Stepper, { type Step } from '../stepper/Stepper';\n\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport messages from './FlowNavigation.messages';\nimport AnimatedLabel from './animatedLabel';\nimport IconButton from '../iconButton';\nimport { ArrowLeft } from '@transferwise/icons';\n\nexport interface FlowNavigationProps {\n activeStep?: number;\n avatar?: React.ReactNode;\n logo?: React.ReactNode;\n done?: boolean;\n /** Called when the close button is clicked. If not provided the close button won't show */\n onClose?: () => void;\n /** Called when the back button is clicked. If not provided the back button won't show. The back button only shows on small screens */\n onGoBack?: () => void;\n /** Steps to be displayed in stepper. If you don't need the stepper, please use OverlayHeader instead */\n steps: readonly Step[];\n}\n\nconst FlowNavigation = ({\n activeStep = 0,\n avatar,\n logo = <Logo />,\n done = false,\n onClose,\n onGoBack,\n steps,\n}: FlowNavigationProps) => {\n const intl = useIntl();\n\n const closeButton = onClose != null && <CloseButton size=\"lg\" onClick={onClose} />;\n\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const screenLg = useScreenSize(Breakpoint.LARGE);\n\n const newAvatar = done ? null : avatar;\n\n const displayGoBack = onGoBack != null && activeStep > 0;\n\n return (\n <div\n className={clsx('np-flow-navigation d-flex align-items-center justify-content-center p-y-3', {\n 'np-flow-navigation--border-bottom': !done,\n })}\n >\n <FlowHeader\n className={clsx(\n 'np-flow-navigation__content p-x-3',\n screenSm == null\n ? 'np-flow-navigation--hidden'\n : {\n 'np-flow-navigation--xs-max': !screenSm,\n // Size switches on parent container which may or may not have the same size as the window.\n 'np-flow-navigation--sm': screenSm,\n 'np-flow-navigation--lg': screenLg,\n },\n )}\n leftContent={\n <>\n {!screenSm && displayGoBack ? (\n <IconButton\n size={40}\n priority=\"tertiary\"\n type=\"default\"\n aria-label={intl.formatMessage(messages.back)}\n onClick={onGoBack}\n >\n <ArrowLeft />\n </IconButton>\n ) : (\n <div className=\"np-flow-header__left\">{logo}</div>\n )}\n {!screenSm && !done && (\n <AnimatedLabel className=\"m-x-1\" steps={steps} activeLabel={activeStep} />\n )}\n </>\n }\n rightContent={\n <div className=\"np-flow-header__right d-flex align-items-center justify-content-end order-2--lg\">\n {newAvatar}\n {newAvatar && closeButton && <span className=\"m-x-1\" />}\n {closeButton}\n </div>\n }\n bottomContent={\n !done && (\n <Stepper\n activeStep={activeStep}\n steps={steps}\n className={clsx('np-flow-navigation__stepper')}\n />\n )\n }\n layout={!screenLg ? Layout.VERTICAL : Layout.HORIZONTAL}\n />\n </div>\n );\n};\n\nexport default FlowNavigation;\n"],"names":["FlowNavigation","activeStep","avatar","logo","_jsx","Logo","done","onClose","onGoBack","steps","intl","useIntl","closeButton","CloseButton","size","onClick","screenSm","useScreenSize","Breakpoint","SMALL","screenLg","LARGE","newAvatar","displayGoBack","className","clsx","children","FlowHeader","leftContent","_jsxs","_Fragment","IconButton","priority","type","formatMessage","messages","back","ArrowLeft","AnimatedL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AAA;AAAE,OAAA,CAGpD;MACDkB,MAAM,EAAE,CAACvB,QAAQ,GAAGwB,MAAM,CAACC,QAAQ,GAAGD,MAAM,CAACE,UAAAA;KAEjD,CAAA;AAAA,GAAK,CAAC,CAAA;AAEV;;;;"}
|
package/build/i18n/de.json
CHANGED
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
"neptune.Summary.statusDone": "Schritt erledigt",
|
|
36
36
|
"neptune.Summary.statusNotDone": "Schritt noch zu erledigen",
|
|
37
37
|
"neptune.Summary.statusPending": "Schritt ausstehend",
|
|
38
|
+
"neptune.Table.actionHeader": "Aktion",
|
|
39
|
+
"neptune.Table.emptyData": "Keine Ergebnisse gefunden",
|
|
40
|
+
"neptune.Table.loaded": "Tabellendaten wurden geladen",
|
|
41
|
+
"neptune.Table.loading": "Tabellendaten werden geladen",
|
|
42
|
+
"neptune.Table.refreshPage": "Seite aktualisieren",
|
|
38
43
|
"neptune.Upload.csButtonText": "Eine andere Datei hochladen?",
|
|
39
44
|
"neptune.Upload.csFailureText": "Hochladen fehlgeschlagen. Bitte versuche es erneut",
|
|
40
45
|
"neptune.Upload.csSuccessText": "Fertig hochgeladen!",
|
package/build/i18n/de.json.js
CHANGED
|
@@ -37,6 +37,11 @@ var de = {
|
|
|
37
37
|
"neptune.Summary.statusDone": "Schritt erledigt",
|
|
38
38
|
"neptune.Summary.statusNotDone": "Schritt noch zu erledigen",
|
|
39
39
|
"neptune.Summary.statusPending": "Schritt ausstehend",
|
|
40
|
+
"neptune.Table.actionHeader": "Aktion",
|
|
41
|
+
"neptune.Table.emptyData": "Keine Ergebnisse gefunden",
|
|
42
|
+
"neptune.Table.loaded": "Tabellendaten wurden geladen",
|
|
43
|
+
"neptune.Table.loading": "Tabellendaten werden geladen",
|
|
44
|
+
"neptune.Table.refreshPage": "Seite aktualisieren",
|
|
40
45
|
"neptune.Upload.csButtonText": "Eine andere Datei hochladen?",
|
|
41
46
|
"neptune.Upload.csFailureText": "Hochladen fehlgeschlagen. Bitte versuche es erneut",
|
|
42
47
|
"neptune.Upload.csSuccessText": "Fertig hochgeladen!",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"de.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"de.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/i18n/de.json.mjs
CHANGED
|
@@ -35,6 +35,11 @@ var de = {
|
|
|
35
35
|
"neptune.Summary.statusDone": "Schritt erledigt",
|
|
36
36
|
"neptune.Summary.statusNotDone": "Schritt noch zu erledigen",
|
|
37
37
|
"neptune.Summary.statusPending": "Schritt ausstehend",
|
|
38
|
+
"neptune.Table.actionHeader": "Aktion",
|
|
39
|
+
"neptune.Table.emptyData": "Keine Ergebnisse gefunden",
|
|
40
|
+
"neptune.Table.loaded": "Tabellendaten wurden geladen",
|
|
41
|
+
"neptune.Table.loading": "Tabellendaten werden geladen",
|
|
42
|
+
"neptune.Table.refreshPage": "Seite aktualisieren",
|
|
38
43
|
"neptune.Upload.csButtonText": "Eine andere Datei hochladen?",
|
|
39
44
|
"neptune.Upload.csFailureText": "Hochladen fehlgeschlagen. Bitte versuche es erneut",
|
|
40
45
|
"neptune.Upload.csSuccessText": "Fertig hochgeladen!",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"de.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"de.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var PrimitiveButton = require('../primitives/PrimitiveButton/src/PrimitiveButton.js');
|
|
5
|
+
var PrimitiveAnchor = require('../primitives/PrimitiveAnchor/src/PrimitiveAnchor.js');
|
|
6
|
+
var Circle = require('../common/circle/Circle.js');
|
|
7
|
+
var clsx = require('clsx');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
const IconButton = /*#__PURE__*/React.forwardRef(function IconButton({
|
|
11
|
+
size = 48,
|
|
12
|
+
href = '#',
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
priority = 'primary',
|
|
16
|
+
type = 'default',
|
|
17
|
+
...props
|
|
18
|
+
}, ref) {
|
|
19
|
+
const isLink = href !== '#';
|
|
20
|
+
return (
|
|
21
|
+
/*#__PURE__*/
|
|
22
|
+
// @ts-expect-error it's either link or `button` element so it has `onClick` / `href`
|
|
23
|
+
jsxRuntime.jsx(Circle, {
|
|
24
|
+
ref: ref,
|
|
25
|
+
as: isLink ? PrimitiveAnchor : PrimitiveButton,
|
|
26
|
+
size: size,
|
|
27
|
+
fixedSize: true,
|
|
28
|
+
className: clsx.clsx('np-icon-button', `np-icon-button-${priority}-${type}`, {
|
|
29
|
+
disabled: props.disabled
|
|
30
|
+
}, className),
|
|
31
|
+
...(isLink ? {
|
|
32
|
+
href
|
|
33
|
+
} : {}),
|
|
34
|
+
...props,
|
|
35
|
+
children: children
|
|
36
|
+
})
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
module.exports = IconButton;
|
|
41
|
+
//# sourceMappingURL=IconButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.js","sources":["../../src/iconButton/IconButton.tsx"],"sourcesContent":["import { AnchorHTMLAttributes, ButtonHTMLAttributes, forwardRef, HTMLAttributes } from 'react';\nimport { PrimitiveAnchor, PrimitiveButton } from '../primitives';\nimport Circle from '../common/circle';\nimport { clsx } from 'clsx';\n\nexport type Props = {\n size?: 16 | 24 | 32 | 40 | 48 | 56 | 72;\n priority?: 'primary' | 'secondary' | 'tertiary' | 'minimal';\n type?: 'default' | 'negative';\n 'data-testid'?: string;\n} & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'target' | 'onClick'> &\n Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'disabled'> &\n Pick<HTMLAttributes<HTMLDivElement>, 'className' | 'role' | 'children' | 'aria-label'>;\n\nconst IconButton = forwardRef(function IconButton(\n {\n size = 48,\n href = '#',\n children,\n className,\n priority = 'primary',\n type = 'default',\n ...props\n }: Props,\n ref,\n) {\n const isLink = href !== '#';\n return (\n // @ts-expect-error it's either link or `button` element so it has `onClick` / `href`\n <Circle\n ref={ref}\n as={isLink ? PrimitiveAnchor : PrimitiveButton}\n size={size}\n fixedSize\n className={clsx(\n 'np-icon-button',\n `np-icon-button-${priority}-${type}`,\n {\n disabled: props.disabled,\n },\n className,\n )}\n {...(isLink ? { href } : {})}\n {...props}\n >\n {children}\n </Circle>\n );\n});\n\nexport default IconButton;\n"],"names":["IconButton","forwardRef","size","href","children","className","priority","type","props","ref","isLink","_jsx","Circle","as","PrimitiveAnchor","PrimitiveButton","fixedSize","clsx","disabled"],"mappings":";;;;;;;;;AAcA,MAAMA,UAAU,gBAAGC,gBAAU,CAAC,SAASD,UAAUA,CAC/C;AACEE,EAAAA,IAAI,GAAG,EAAE;AACTC,EAAAA,IAAI,GAAG,GAAG;EACVC,QAAQ;EACRC,SAAS;AACTC,EAAAA,QAAQ,GAAG,SAAS;AACpBC,EAAAA,IAAI,GAAG,SAAS;EAChB,GAAGC,KAAAA;AAAK,CACF,EACRC,GAAG,EAAA;AAEH,EAAA,MAAMC,MAAM,GAAGP,IAAI,KAAK,GAAG,CAAA;AAC3B,EAAA;AAAA;AACE;AACAQ,IAAAA,cAAA,CAACC,MAAM,EAAA;AACLH,MAAAA,GAAG,EAAEA,GAAI;AACTI,MAAAA,EAAE,EAAEH,MAAM,GAAGI,eAAe,GAAGC,eAAgB;AAC/Cb,MAAAA,IAAI,EAAEA,IAAK;MACXc,SAAS,EAAA,IAAA;MACTX,SAAS,EAAEY,SAAI,CACb,gBAAgB,EAChB,kBAAkBX,QAAQ,CAAA,CAAA,EAAIC,IAAI,CAAA,CAAE,EACpC;QACEW,QAAQ,EAAEV,KAAK,CAACU,QAAAA;OACjB,EACDb,SAAS,CACT;AAAA,MAAA,IACGK,MAAM,GAAG;AAAEP,QAAAA,IAAAA;OAAM,GAAG,EAAE,CAAA;AAAA,MAAA,GACvBK,KAAK;AAAAJ,MAAAA,QAAA,EAERA,QAAAA;KACK,CAAA;AAAC,IAAA;AAEb,CAAC;;;;"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import PrimitiveButton from '../primitives/PrimitiveButton/src/PrimitiveButton.mjs';
|
|
3
|
+
import PrimitiveAnchor from '../primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs';
|
|
4
|
+
import Circle from '../common/circle/Circle.mjs';
|
|
5
|
+
import { clsx } from 'clsx';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
const IconButton = /*#__PURE__*/forwardRef(function IconButton({
|
|
9
|
+
size = 48,
|
|
10
|
+
href = '#',
|
|
11
|
+
children,
|
|
12
|
+
className,
|
|
13
|
+
priority = 'primary',
|
|
14
|
+
type = 'default',
|
|
15
|
+
...props
|
|
16
|
+
}, ref) {
|
|
17
|
+
const isLink = href !== '#';
|
|
18
|
+
return (
|
|
19
|
+
/*#__PURE__*/
|
|
20
|
+
// @ts-expect-error it's either link or `button` element so it has `onClick` / `href`
|
|
21
|
+
jsx(Circle, {
|
|
22
|
+
ref: ref,
|
|
23
|
+
as: isLink ? PrimitiveAnchor : PrimitiveButton,
|
|
24
|
+
size: size,
|
|
25
|
+
fixedSize: true,
|
|
26
|
+
className: clsx('np-icon-button', `np-icon-button-${priority}-${type}`, {
|
|
27
|
+
disabled: props.disabled
|
|
28
|
+
}, className),
|
|
29
|
+
...(isLink ? {
|
|
30
|
+
href
|
|
31
|
+
} : {}),
|
|
32
|
+
...props,
|
|
33
|
+
children: children
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export { IconButton as default };
|
|
39
|
+
//# sourceMappingURL=IconButton.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.mjs","sources":["../../src/iconButton/IconButton.tsx"],"sourcesContent":["import { AnchorHTMLAttributes, ButtonHTMLAttributes, forwardRef, HTMLAttributes } from 'react';\nimport { PrimitiveAnchor, PrimitiveButton } from '../primitives';\nimport Circle from '../common/circle';\nimport { clsx } from 'clsx';\n\nexport type Props = {\n size?: 16 | 24 | 32 | 40 | 48 | 56 | 72;\n priority?: 'primary' | 'secondary' | 'tertiary' | 'minimal';\n type?: 'default' | 'negative';\n 'data-testid'?: string;\n} & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'target' | 'onClick'> &\n Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'disabled'> &\n Pick<HTMLAttributes<HTMLDivElement>, 'className' | 'role' | 'children' | 'aria-label'>;\n\nconst IconButton = forwardRef(function IconButton(\n {\n size = 48,\n href = '#',\n children,\n className,\n priority = 'primary',\n type = 'default',\n ...props\n }: Props,\n ref,\n) {\n const isLink = href !== '#';\n return (\n // @ts-expect-error it's either link or `button` element so it has `onClick` / `href`\n <Circle\n ref={ref}\n as={isLink ? PrimitiveAnchor : PrimitiveButton}\n size={size}\n fixedSize\n className={clsx(\n 'np-icon-button',\n `np-icon-button-${priority}-${type}`,\n {\n disabled: props.disabled,\n },\n className,\n )}\n {...(isLink ? { href } : {})}\n {...props}\n >\n {children}\n </Circle>\n );\n});\n\nexport default IconButton;\n"],"names":["IconButton","forwardRef","size","href","children","className","priority","type","props","ref","isLink","_jsx","Circle","as","PrimitiveAnchor","PrimitiveButton","fixedSize","clsx","disabled"],"mappings":";;;;;;;AAcA,MAAMA,UAAU,gBAAGC,UAAU,CAAC,SAASD,UAAUA,CAC/C;AACEE,EAAAA,IAAI,GAAG,EAAE;AACTC,EAAAA,IAAI,GAAG,GAAG;EACVC,QAAQ;EACRC,SAAS;AACTC,EAAAA,QAAQ,GAAG,SAAS;AACpBC,EAAAA,IAAI,GAAG,SAAS;EAChB,GAAGC,KAAAA;AAAK,CACF,EACRC,GAAG,EAAA;AAEH,EAAA,MAAMC,MAAM,GAAGP,IAAI,KAAK,GAAG,CAAA;AAC3B,EAAA;AAAA;AACE;AACAQ,IAAAA,GAAA,CAACC,MAAM,EAAA;AACLH,MAAAA,GAAG,EAAEA,GAAI;AACTI,MAAAA,EAAE,EAAEH,MAAM,GAAGI,eAAe,GAAGC,eAAgB;AAC/Cb,MAAAA,IAAI,EAAEA,IAAK;MACXc,SAAS,EAAA,IAAA;MACTX,SAAS,EAAEY,IAAI,CACb,gBAAgB,EAChB,kBAAkBX,QAAQ,CAAA,CAAA,EAAIC,IAAI,CAAA,CAAE,EACpC;QACEW,QAAQ,EAAEV,KAAK,CAACU,QAAAA;OACjB,EACDb,SAAS,CACT;AAAA,MAAA,IACGK,MAAM,GAAG;AAAEP,QAAAA,IAAAA;OAAM,GAAG,EAAE,CAAA;AAAA,MAAA,GACvBK,KAAK;AAAAJ,MAAAA,QAAA,EAERA,QAAAA;KACK,CAAA;AAAC,IAAA;AAEb,CAAC;;;;"}
|
package/build/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var Image = require('./image/Image.js');
|
|
|
22
22
|
require('@transferwise/icons');
|
|
23
23
|
var Body = require('./body/Body.js');
|
|
24
24
|
var Button = require('./button/Button.js');
|
|
25
|
+
var IconButton = require('./iconButton/IconButton.js');
|
|
25
26
|
var Carousel = require('./carousel/Carousel.js');
|
|
26
27
|
var Card = require('./card/Card.js');
|
|
27
28
|
var Checkbox = require('./checkbox/Checkbox.js');
|
|
@@ -164,6 +165,7 @@ Object.defineProperty(exports, "Breakpoint", {
|
|
|
164
165
|
exports.Image = Image.default;
|
|
165
166
|
exports.Body = Body;
|
|
166
167
|
exports.Button = Button;
|
|
168
|
+
exports.IconButton = IconButton;
|
|
167
169
|
exports.Carousel = Carousel;
|
|
168
170
|
exports.Card = Card;
|
|
169
171
|
exports.Checkbox = Checkbox;
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/index.mjs
CHANGED
|
@@ -20,6 +20,7 @@ export { default as Image } from './image/Image.mjs';
|
|
|
20
20
|
import '@transferwise/icons';
|
|
21
21
|
export { default as Body } from './body/Body.mjs';
|
|
22
22
|
export { default as Button } from './button/Button.mjs';
|
|
23
|
+
export { default as IconButton } from './iconButton/IconButton.mjs';
|
|
23
24
|
export { default as Carousel } from './carousel/Carousel.mjs';
|
|
24
25
|
export { default as Card } from './card/Card.mjs';
|
|
25
26
|
export { default as Checkbox } from './checkbox/Checkbox.mjs';
|
package/build/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/main.css
CHANGED
|
@@ -535,6 +535,88 @@ div.critical-comms .critical-comms-body {
|
|
|
535
535
|
.np-avatar-layout-horizontal-child {
|
|
536
536
|
margin-left: calc(var(--np-avatar-offset) * -1);
|
|
537
537
|
}
|
|
538
|
+
.np-icon-button {
|
|
539
|
+
border: none;
|
|
540
|
+
}
|
|
541
|
+
.np-icon-button-tertiary-default {
|
|
542
|
+
color: var(--color-interactive-primary);
|
|
543
|
+
background-color: rgba(134,167,189,0.10196);
|
|
544
|
+
background-color: var(--color-background-neutral);
|
|
545
|
+
}
|
|
546
|
+
.np-icon-button-tertiary-default:not(.disabled):not(:disabled):hover {
|
|
547
|
+
background-color: var(--color-background-neutral-hover);
|
|
548
|
+
}
|
|
549
|
+
.np-icon-button-tertiary-default:not(.disabled):not(:disabled):active {
|
|
550
|
+
background-color: var(--color-background-neutral-active);
|
|
551
|
+
}
|
|
552
|
+
.np-icon-button-primary-default {
|
|
553
|
+
color: var(--color-interactive-control);
|
|
554
|
+
background-color: #00a2dd;
|
|
555
|
+
background-color: var(--color-interactive-accent);
|
|
556
|
+
}
|
|
557
|
+
.np-icon-button-primary-default:not(.disabled):not(:disabled):hover {
|
|
558
|
+
background-color: #008fc9;
|
|
559
|
+
background-color: var(--color-interactive-accent-hover);
|
|
560
|
+
}
|
|
561
|
+
.np-icon-button-primary-default:not(.disabled):not(:disabled):active {
|
|
562
|
+
background-color: #0081ba;
|
|
563
|
+
background-color: var(--color-interactive-accent-active);
|
|
564
|
+
}
|
|
565
|
+
.np-icon-button-primary-negative {
|
|
566
|
+
color: var(--color-contrast-overlay);
|
|
567
|
+
background-color: var(--color-sentiment-negative-primary);
|
|
568
|
+
}
|
|
569
|
+
.np-icon-button-primary-negative:not(.disabled):not(:disabled):hover {
|
|
570
|
+
background-color: var(--color-sentiment-negative-primary-hover);
|
|
571
|
+
}
|
|
572
|
+
.np-icon-button-primary-negative:not(.disabled):not(:disabled):active {
|
|
573
|
+
background-color: var(--color-sentiment-negative-primary-active);
|
|
574
|
+
}
|
|
575
|
+
.np-theme-personal--bright-green .np-icon-button-primary-negative {
|
|
576
|
+
color: var(--color-white);
|
|
577
|
+
}
|
|
578
|
+
.np-icon-button-minimal-default {
|
|
579
|
+
color: var(--color-interactive-primary);
|
|
580
|
+
background-color: #ffffff;
|
|
581
|
+
background-color: var(--color-background-screen);
|
|
582
|
+
background-color: transparent;
|
|
583
|
+
}
|
|
584
|
+
.np-icon-button-minimal-default:not(.disabled):not(:disabled):hover {
|
|
585
|
+
background-color: var(--color-background-screen-hover);
|
|
586
|
+
}
|
|
587
|
+
.np-icon-button-minimal-default:not(.disabled):not(:disabled):active {
|
|
588
|
+
background-color: var(--color-background-screen-active);
|
|
589
|
+
}
|
|
590
|
+
.np-icon-button-secondary-default {
|
|
591
|
+
color: var(--color-interactive-primary);
|
|
592
|
+
background-color: var(--color-interactive-neutral);
|
|
593
|
+
}
|
|
594
|
+
.np-icon-button-secondary-default:not(.disabled):not(:disabled):hover {
|
|
595
|
+
background-color: var(--color-interactive-neutral-hover);
|
|
596
|
+
}
|
|
597
|
+
.np-icon-button-secondary-default:not(.disabled):not(:disabled):active {
|
|
598
|
+
background-color: var(--color-interactive-neutral-active);
|
|
599
|
+
}
|
|
600
|
+
.np-theme-personal--bright-green .np-icon-button-secondary-default,
|
|
601
|
+
.np-theme-personal--forest-green .np-icon-button-secondary-default {
|
|
602
|
+
color: var(--color-interactive-control);
|
|
603
|
+
}
|
|
604
|
+
.np-icon-button-secondary-negative {
|
|
605
|
+
color: var(--color-sentiment-negative-primary);
|
|
606
|
+
background-color: var(--color-sentiment-negative-secondary);
|
|
607
|
+
}
|
|
608
|
+
.np-icon-button-secondary-negative:not(.disabled):not(:disabled):hover {
|
|
609
|
+
background-color: var(--color-sentiment-negative-secondary-hover);
|
|
610
|
+
}
|
|
611
|
+
.np-icon-button-secondary-negative:not(.disabled):not(:disabled):active {
|
|
612
|
+
background-color: var(--color-sentiment-negative-secondary-active);
|
|
613
|
+
}
|
|
614
|
+
.np-theme-personal--bright-green .np-icon-button-secondary-negative {
|
|
615
|
+
color: var(--color-white);
|
|
616
|
+
}
|
|
617
|
+
.np-theme-personal--forest-green .np-icon-button-secondary-negative {
|
|
618
|
+
color: var(--color-contrast-overlay);
|
|
619
|
+
}
|
|
538
620
|
.tw-badge {
|
|
539
621
|
position: relative;
|
|
540
622
|
display: inline-block;
|
|
@@ -2201,38 +2283,6 @@ button.np-option {
|
|
|
2201
2283
|
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
2202
2284
|
outline-offset: var(--ring-outline-offset);
|
|
2203
2285
|
}
|
|
2204
|
-
.np-back-button {
|
|
2205
|
-
color: #00a2dd;
|
|
2206
|
-
color: var(--color-interactive-accent);
|
|
2207
|
-
display: flex !important;
|
|
2208
|
-
}
|
|
2209
|
-
.np-back-button:hover {
|
|
2210
|
-
color: #008fc9;
|
|
2211
|
-
color: var(--color-interactive-accent-hover);
|
|
2212
|
-
}
|
|
2213
|
-
.np-back-button:active {
|
|
2214
|
-
color: #0081ba;
|
|
2215
|
-
color: var(--color-interactive-accent-active);
|
|
2216
|
-
}
|
|
2217
|
-
.np-theme-personal .np-back-button {
|
|
2218
|
-
color: #37517e;
|
|
2219
|
-
color: var(--color-content-primary);
|
|
2220
|
-
}
|
|
2221
|
-
.np-theme-personal .np-back-button:hover {
|
|
2222
|
-
color: var(--color-content-primary-hover);
|
|
2223
|
-
}
|
|
2224
|
-
.np-theme-personal .np-back-button:active {
|
|
2225
|
-
color: var(--color-content-primary-active);
|
|
2226
|
-
}
|
|
2227
|
-
.np-theme-personal .np-back-button .tw-icon {
|
|
2228
|
-
color: var(--color-interactive-primary);
|
|
2229
|
-
}
|
|
2230
|
-
.np-theme-personal .np-back-button .tw-icon:hover {
|
|
2231
|
-
color: var(--color-interactive-primary-hover);
|
|
2232
|
-
}
|
|
2233
|
-
.np-theme-personal .np-back-button .tw-icon:active {
|
|
2234
|
-
color: var(--color-interactive-primary-active);
|
|
2235
|
-
}
|
|
2236
2286
|
.np-flow-navigation {
|
|
2237
2287
|
width: 100%;
|
|
2238
2288
|
min-height: 97px;
|
|
@@ -4950,6 +5000,10 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4950
5000
|
padding-left: calc(var(--size-24) + var(--size-8));
|
|
4951
5001
|
padding-right: 0;
|
|
4952
5002
|
}
|
|
5003
|
+
.np-summary__description-icon {
|
|
5004
|
+
margin-top: 4px;
|
|
5005
|
+
margin-top: var(--size-4);
|
|
5006
|
+
}
|
|
4953
5007
|
.np-summary__action {
|
|
4954
5008
|
margin-top: 4px;
|
|
4955
5009
|
margin-top: var(--size-4);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var clsx = require('clsx');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
const PrimitiveAnchor = /*#__PURE__*/React.forwardRef(({
|
|
8
|
+
children,
|
|
9
|
+
className,
|
|
10
|
+
href,
|
|
11
|
+
id,
|
|
12
|
+
disabled = false,
|
|
13
|
+
testId,
|
|
14
|
+
onClick,
|
|
15
|
+
onFocus,
|
|
16
|
+
onBlur,
|
|
17
|
+
onMouseEnter,
|
|
18
|
+
onMouseLeave,
|
|
19
|
+
onKeyDown,
|
|
20
|
+
...props
|
|
21
|
+
}, ref) => {
|
|
22
|
+
const anchorClasses = clsx.clsx('wds-Anchor', {
|
|
23
|
+
'wds-Anchor--disabled': disabled
|
|
24
|
+
}, className);
|
|
25
|
+
const handleClick = React.useCallback(event => {
|
|
26
|
+
if (disabled) {
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
} else {
|
|
29
|
+
onClick?.(event);
|
|
30
|
+
}
|
|
31
|
+
}, [disabled, onClick]);
|
|
32
|
+
const handleFocus = React.useCallback(event => {
|
|
33
|
+
onFocus?.(event);
|
|
34
|
+
}, [onFocus]);
|
|
35
|
+
const handleBlur = React.useCallback(event => {
|
|
36
|
+
onBlur?.(event);
|
|
37
|
+
}, [onBlur]);
|
|
38
|
+
const handleMouseEnter = React.useCallback(event => {
|
|
39
|
+
onMouseEnter?.(event);
|
|
40
|
+
}, [onMouseEnter]);
|
|
41
|
+
const handleMouseLeave = React.useCallback(event => {
|
|
42
|
+
onMouseLeave?.(event);
|
|
43
|
+
}, [onMouseLeave]);
|
|
44
|
+
const handleKeyDown = React.useCallback(event => {
|
|
45
|
+
onKeyDown?.(event);
|
|
46
|
+
}, [onKeyDown]);
|
|
47
|
+
/**
|
|
48
|
+
* The following props are set to handle the `disabled` state for the link:
|
|
49
|
+
*
|
|
50
|
+
* - `aria-disabled`: Exposes the link as disabled to assistive technologies.
|
|
51
|
+
* - `href`: Removed when `disabled` is true to prevent navigation.
|
|
52
|
+
* - `role`: Set to 'link' when `disabled` is true to ensure the element
|
|
53
|
+
* is still exposed as a link.
|
|
54
|
+
*
|
|
55
|
+
* For more details, refer to Scott O'Hara's article on disabling links:
|
|
56
|
+
* https://www.scottohara.me/blog/2021/05/28/disabled-links.html
|
|
57
|
+
*/
|
|
58
|
+
const anchorProps = {
|
|
59
|
+
'aria-disabled': disabled,
|
|
60
|
+
className: anchorClasses,
|
|
61
|
+
'data-testid': testId,
|
|
62
|
+
href: disabled ? undefined : href,
|
|
63
|
+
id,
|
|
64
|
+
ref,
|
|
65
|
+
role: disabled ? 'link' : undefined,
|
|
66
|
+
rel: props.target === '_blank' ? 'noopener noreferrer' : undefined,
|
|
67
|
+
onClick: handleClick,
|
|
68
|
+
onFocus: handleFocus,
|
|
69
|
+
onBlur: handleBlur,
|
|
70
|
+
onMouseEnter: handleMouseEnter,
|
|
71
|
+
onMouseLeave: handleMouseLeave,
|
|
72
|
+
onKeyDown: handleKeyDown,
|
|
73
|
+
...props
|
|
74
|
+
};
|
|
75
|
+
return /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
76
|
+
...anchorProps,
|
|
77
|
+
children: children
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
PrimitiveAnchor.displayName = 'PrimitiveAnchor';
|
|
81
|
+
|
|
82
|
+
module.exports = PrimitiveAnchor;
|
|
83
|
+
//# sourceMappingURL=PrimitiveAnchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrimitiveAnchor.js","sources":["../../../../src/primitives/PrimitiveAnchor/src/PrimitiveAnchor.tsx"],"sourcesContent":["import React, { forwardRef, useCallback } from 'react';\nimport { clsx } from 'clsx';\nimport type { PrimitiveAnchorProps } from '..';\n\n/**\n * The Primitive `PrimitiveAnchor` component is customisable link element that can be\n * used in various parts of the Wise Design System internally. It supports\n * different states such as disabled and provides event handlers for common\n * interactions like click, focus, blur, mouse enter, mouse leave, and key down.\n *\n * @see {@link PrimitiveAnchor} for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/primitive-anchor--docs|Storybook Wise Design}\n */\nconst PrimitiveAnchor = forwardRef<HTMLAnchorElement, PrimitiveAnchorProps>(\n (\n {\n children,\n className,\n href,\n id,\n disabled = false,\n testId,\n onClick,\n onFocus,\n onBlur,\n onMouseEnter,\n onMouseLeave,\n onKeyDown,\n ...props\n },\n ref,\n ) => {\n const anchorClasses = clsx(\n 'wds-Anchor',\n {\n 'wds-Anchor--disabled': disabled,\n },\n className,\n );\n\n const handleClick = useCallback(\n (event: React.MouseEvent<HTMLAnchorElement>) => {\n if (disabled) {\n event.preventDefault();\n } else {\n onClick?.(event);\n }\n },\n [disabled, onClick],\n );\n\n const handleFocus = useCallback(\n (event: React.FocusEvent<HTMLAnchorElement>) => {\n onFocus?.(event);\n },\n [onFocus],\n );\n\n const handleBlur = useCallback(\n (event: React.FocusEvent<HTMLAnchorElement>) => {\n onBlur?.(event);\n },\n [onBlur],\n );\n\n const handleMouseEnter = useCallback(\n (event: React.MouseEvent<HTMLAnchorElement>) => {\n onMouseEnter?.(event);\n },\n [onMouseEnter],\n );\n\n const handleMouseLeave = useCallback(\n (event: React.MouseEvent<HTMLAnchorElement>) => {\n onMouseLeave?.(event);\n },\n [onMouseLeave],\n );\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLAnchorElement>) => {\n onKeyDown?.(event);\n },\n [onKeyDown],\n );\n\n /**\n * The following props are set to handle the `disabled` state for the link:\n *\n * - `aria-disabled`: Exposes the link as disabled to assistive technologies.\n * - `href`: Removed when `disabled` is true to prevent navigation.\n * - `role`: Set to 'link' when `disabled` is true to ensure the element\n * is still exposed as a link.\n *\n * For more details, refer to Scott O'Hara's article on disabling links:\n * https://www.scottohara.me/blog/2021/05/28/disabled-links.html\n */\n const anchorProps = {\n 'aria-disabled': disabled,\n className: anchorClasses,\n 'data-testid': testId,\n href: disabled ? undefined : href,\n id,\n ref,\n role: disabled ? 'link' : undefined,\n rel: props.target === '_blank' ? 'noopener noreferrer' : undefined,\n onClick: handleClick,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n onKeyDown: handleKeyDown,\n ...props,\n };\n\n return <a {...anchorProps}>{children}</a>;\n },\n);\n\nPrimitiveAnchor.displayName = 'PrimitiveAnchor';\n\nexport default PrimitiveAnchor;\n"],"names":["PrimitiveAnchor","forwardRef","children","className","href","id","disabled","testId","onClick","onFocus","onBlur","onMouseEnter","onMouseLeave","onKeyDown","props","ref","anchorClasses","clsx","handleClick","useCallback","event","preventDefault","handleFocus","handleBlur","handleMouseEnter","handleMouseLeave","handleKeyDown","anchorProps","undefined","role","rel","target","_jsx","displayName"],"mappings":";;;;;;AAaA,MAAMA,eAAe,gBAA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