@transferwise/components 46.138.0 → 46.140.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/flowNavigation/FlowNavigation.js +2 -4
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +2 -4
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/loader/Loader.js +16 -6
- package/build/loader/Loader.js.map +1 -1
- package/build/loader/Loader.mjs +17 -7
- package/build/loader/Loader.mjs.map +1 -1
- package/build/main.css +33 -285
- package/build/moneyInput/MoneyInput.js +2 -1
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +2 -1
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/popover/Popover.js +2 -2
- package/build/popover/Popover.js.map +1 -1
- package/build/popover/Popover.mjs +2 -2
- package/build/popover/Popover.mjs.map +1 -1
- package/build/select/Select.js +0 -3
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +0 -3
- package/build/select/Select.mjs.map +1 -1
- package/build/styles/css/neptune.css +11 -275
- package/build/styles/less/neptune-tokens.less +2 -2
- package/build/styles/listItem/ListItem.css +1 -0
- package/build/styles/loader/Loader.css +14 -4
- package/build/styles/main.css +33 -285
- package/build/styles/props/neptune-tokens.css +1 -1
- package/build/styles/styles/less/neptune.css +11 -275
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/loader/Loader.d.ts +4 -1
- package/build/types/loader/Loader.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts +1 -0
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/select/Select.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/flowNavigation/FlowNavigation.story.tsx +14 -9
- package/src/flowNavigation/FlowNavigation.test.js +2 -2
- package/src/flowNavigation/FlowNavigation.test.story.tsx +77 -0
- package/src/flowNavigation/FlowNavigation.tsx +2 -5
- package/src/inputs/SelectInput/_stories/SelectInput.test.story.tsx +82 -0
- package/src/listItem/ListItem.css +1 -0
- package/src/listItem/ListItem.less +1 -0
- package/src/loader/Loader.css +14 -4
- package/src/loader/Loader.less +54 -88
- package/src/loader/Loader.story.tsx +4 -0
- package/src/loader/Loader.test.tsx +20 -5
- package/src/loader/Loader.tsx +18 -7
- package/src/main.css +33 -285
- package/src/modal/Modal.test.story.tsx +61 -0
- package/src/moneyInput/MoneyInput.story.tsx +20 -0
- package/src/moneyInput/MoneyInput.test.tsx +49 -0
- package/src/moneyInput/MoneyInput.tsx +2 -0
- package/src/popover/Popover.story.tsx +45 -0
- package/src/popover/Popover.test.story.tsx +124 -0
- package/src/popover/Popover.test.tsx +55 -0
- package/src/popover/Popover.tsx +2 -2
- package/src/select/Select.test.story.tsx +74 -1
- package/src/select/Select.tsx +0 -3
- package/src/styles/less/neptune.css +11 -275
|
@@ -88,13 +88,11 @@ const FlowNavigation = ({
|
|
|
88
88
|
className: "m-x-1"
|
|
89
89
|
}), closeButton]
|
|
90
90
|
}),
|
|
91
|
-
bottomContent: !done &&
|
|
91
|
+
bottomContent: !done && steps.length > 0 ? /*#__PURE__*/jsxRuntime.jsx(Stepper.default, {
|
|
92
92
|
activeStep: activeStep,
|
|
93
93
|
steps: steps,
|
|
94
94
|
className: clsx.clsx('np-flow-navigation__stepper')
|
|
95
|
-
}) :
|
|
96
|
-
className: "np-flow-navigation__stepper"
|
|
97
|
-
})),
|
|
95
|
+
}) : null,
|
|
98
96
|
layout: !screenLg ? layouts.Layout.VERTICAL : layouts.Layout.HORIZONTAL
|
|
99
97
|
})
|
|
100
98
|
});
|
|
@@ -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 IconButton from '../iconButton';\nimport { ArrowLeft } from '@transferwise/icons';\n\nexport interface FlowNavigationProps {\n /** @default 0 */\n activeStep?: number;\n avatar?: React.ReactNode;\n /** @default <Logo /> */\n logo?: React.ReactNode;\n /** @default false */\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
|
|
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 /** @default 0 */\n activeStep?: number;\n avatar?: React.ReactNode;\n /** @default <Logo /> */\n logo?: React.ReactNode;\n /** @default false */\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 && steps.length > 0 ? (\n <Stepper\n activeStep={activeStep}\n steps={steps}\n className={clsx('np-flow-navigation__stepper')}\n />\n ) : null\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","length","Stepper","layout","Layout","VERTICAL","HORIZONTAL"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAMA,cAAc,GAAGA,CAAC;AACtBC,EAAAA,UAAU,GAAG,CAAC;EACdC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|
86
86
|
}),
|
|
87
|
-
bottomContent: !done &&
|
|
87
|
+
bottomContent: !done && steps.length > 0 ? /*#__PURE__*/jsx(Stepper, {
|
|
88
88
|
activeStep: activeStep,
|
|
89
89
|
steps: steps,
|
|
90
90
|
className: clsx('np-flow-navigation__stepper')
|
|
91
|
-
}) :
|
|
92
|
-
className: "np-flow-navigation__stepper"
|
|
93
|
-
})),
|
|
91
|
+
}) : null,
|
|
94
92
|
layout: !screenLg ? Layout.VERTICAL : Layout.HORIZONTAL
|
|
95
93
|
})
|
|
96
94
|
});
|
|
@@ -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 IconButton from '../iconButton';\nimport { ArrowLeft } from '@transferwise/icons';\n\nexport interface FlowNavigationProps {\n /** @default 0 */\n activeStep?: number;\n avatar?: React.ReactNode;\n /** @default <Logo /> */\n logo?: React.ReactNode;\n /** @default false */\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
|
|
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 /** @default 0 */\n activeStep?: number;\n avatar?: React.ReactNode;\n /** @default <Logo /> */\n logo?: React.ReactNode;\n /** @default false */\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 && steps.length > 0 ? (\n <Stepper\n activeStep={activeStep}\n steps={steps}\n className={clsx('np-flow-navigation__stepper')}\n />\n ) : null\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","length","Stepper","layout","Layout","VERTICAL","HORIZONTAL"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAMA,cAAc,GAAGA,CAAC;AACtBC,EAAAA,UAAU,GAAG,CAAC;EACdC,MAAM;AACNC,EAAAA,IAAI,gBAAGC,GAAA,CAACC,IAAI,IAAA,CAAG;AACfC,EAAAA,IAAI,GAAG,KAAK;EACZC,OAAO;EACPC,QAAQ;AACRC,EAAAA;AAAK,CACe,KAAI;AACxB,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;EAEtB,MAAMC,WAAW,GAAGL,OAAO,IAAI,IAAI,iBAAIH,GAAA,CAACS,WAAW,EAAA;AAACC,IAAAA,IAAI,EAAC,IAAI;AAACC,IAAAA,OAAO,EAAER;AAAQ,IAAG;AAElF,EAAA,MAAMS,QAAQ,GAAGC,aAAa,CAACC,UAAU,CAACC,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ,GAAGH,aAAa,CAACC,UAAU,CAACG,KAAK,CAAC;AAEhD,EAAA,MAAMC,SAAS,GAAGhB,IAAI,GAAG,IAAI,GAAGJ,MAAM;EAEtC,MAAMqB,aAAa,GAAGf,QAAQ,IAAI,IAAI,IAAIP,UAAU,GAAG,CAAC;AAExD,EAAA,oBACEG,GAAA,CAAA,KAAA,EAAA;AACEoB,IAAAA,SA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,MAAA,EAAA;AAAMoB,UAAAA,SAAS,EAAC;SAAO,CAAG,EACtDZ,WAAW;AAAA,OACT,CACN;AACD6B,MAAAA,aAAa,EACX,CAACnC,IAAI,IAAIG,KAAK,CAACiC,MAAM,GAAG,CAAC,gBACvBtC,GAAA,CAACuC,OAAO,EAAA;AACN1C,QAAAA,UAAU,EAAEA,UAAW;AACvBQ,QAAAA,KAAK,EAAEA,KAAM;QACbe,SAAS,EAAEC,IAAI,CAAC,6BAA6B;OAAE,CAC/C,GACA,IACL;MACDmB,MAAM,EAAE,CAACxB,QAAQ,GAAGyB,MAAM,CAACC,QAAQ,GAAGD,MAAM,CAACE;KAAW;AAE5D,GAAK,CAAC;AAEV;;;;"}
|
package/build/loader/Loader.js
CHANGED
|
@@ -5,12 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var componentsTheming = require('@wise/components-theming');
|
|
6
6
|
var clsx = require('clsx');
|
|
7
7
|
var React = require('react');
|
|
8
|
+
var Body = require('../body/Body.js');
|
|
8
9
|
require('../common/theme.js');
|
|
9
10
|
require('../common/direction.js');
|
|
10
11
|
require('../common/propsValues/control.js');
|
|
11
12
|
require('../common/propsValues/breakpoint.js');
|
|
12
13
|
var size = require('../common/propsValues/size.js');
|
|
13
|
-
require('../common/propsValues/typography.js');
|
|
14
|
+
var typography = require('../common/propsValues/typography.js');
|
|
14
15
|
require('../common/propsValues/width.js');
|
|
15
16
|
require('../common/propsValues/type.js');
|
|
16
17
|
require('../common/propsValues/dateMode.js');
|
|
@@ -34,6 +35,7 @@ const Loader = ({
|
|
|
34
35
|
small = false,
|
|
35
36
|
size: size$1 = size.Size.MEDIUM,
|
|
36
37
|
displayInstantly = false,
|
|
38
|
+
label,
|
|
37
39
|
classNames = {},
|
|
38
40
|
...restProps
|
|
39
41
|
}) => {
|
|
@@ -64,11 +66,19 @@ const Loader = ({
|
|
|
64
66
|
console.warn('Loader is forbidden to use with Forest Green theme. Check the https://wise.design/components/screen-loader for more info.');
|
|
65
67
|
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
66
68
|
}
|
|
67
|
-
return /*#__PURE__*/jsxRuntime.
|
|
68
|
-
className:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
70
|
+
className: style('tw-loader'),
|
|
71
|
+
"data-testid": restProps['data-testid'],
|
|
72
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
73
|
+
className: clsx.clsx(style('tw-loader-asset'), style(`tw-loader-asset--${supportedSize}`), {
|
|
74
|
+
'tw-loader-asset--visible': hasDebounced
|
|
75
|
+
})
|
|
76
|
+
}), label && hasDebounced && /*#__PURE__*/jsxRuntime.jsx(Body.default, {
|
|
77
|
+
type: typography.Typography.BODY_LARGE_BOLD,
|
|
78
|
+
as: "span",
|
|
79
|
+
className: style('text-secondary'),
|
|
80
|
+
children: label
|
|
81
|
+
})]
|
|
72
82
|
});
|
|
73
83
|
};
|
|
74
84
|
const getSupportedSize = size$1 => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loader.js","sources":["../../src/loader/Loader.tsx"],"sourcesContent":["import { useTheme } from '@wise/components-theming';\nimport { clsx } from 'clsx';\nimport { useEffect, useState } from 'react';\n\nimport { Size, SizeExtraSmall, SizeSmall, SizeMedium, SizeLarge, SizeExtraLarge } from '../common';\n\n// TODO: We gracefully deprecated xs, lg and xl -- remove these as part of a future breaking change to this component\ntype DeprecatedSize = SizeExtraSmall | SizeLarge | SizeExtraLarge;\n\ntype SizeType = SizeSmall | SizeMedium;\n\nexport type LoaderProps = {\n /**\n * @deprecated Use `size` instead.\n * @default false\n */\n small?: boolean;\n /** @default 'md' */\n size?: SizeType | DeprecatedSize;\n /** @default false */\n displayInstantly?: boolean;\n // TODO: refactor in favor of prop from `CommonProps` type\n /** @default {} */\n classNames?: Record<string, string>;\n 'data-testid'?: string;\n};\n\n/**\n * Loader component\n *\n * Docs link: https://transferwise.github.io/neptune-web/components/progress/Loader\n *\n * @param root0\n * @param root0.small\n * @param root0.size\n * @param root0.classNames\n */\nconst Loader = ({\n small = false,\n size = Size.MEDIUM,\n displayInstantly = false,\n classNames = {},\n ...restProps\n}: LoaderProps) => {\n const { theme } = useTheme();\n const [hasDebounced, setHasDebounced] = useState(displayInstantly);\n\n useEffect(() => {\n let cancelled: boolean;\n let timeout: ReturnType<typeof setTimeout> | undefined;\n\n if (!displayInstantly) {\n timeout = setTimeout(() => {\n if (!cancelled) {\n setHasDebounced(true);\n }\n }, 1000);\n }\n\n return () => {\n cancelled = true;\n\n clearTimeout(timeout);\n };\n }, []);\n\n const style = (className: string): string => classNames[className] || className;\n const legacySize: SizeType | DeprecatedSize = small ? Size.SMALL : size;\n const supportedSize = getSupportedSize(legacySize);\n\n if (theme === 'forest-green') {\n // eslint-disable-next-line no-console\n console.warn(\n 'Loader is forbidden to use with Forest Green theme. Check the https://wise.design/components/screen-loader for more info.',\n );\n return <></>;\n }\n\n return (\n <div\n
|
|
1
|
+
{"version":3,"file":"Loader.js","sources":["../../src/loader/Loader.tsx"],"sourcesContent":["import { useTheme } from '@wise/components-theming';\nimport { clsx } from 'clsx';\nimport { ReactNode, useEffect, useState } from 'react';\n\nimport Body from '../body';\nimport { Size, SizeExtraSmall, SizeSmall, SizeMedium, SizeLarge, SizeExtraLarge } from '../common';\nimport { Typography } from '../common/propsValues/typography';\n\n// TODO: We gracefully deprecated xs, lg and xl -- remove these as part of a future breaking change to this component\ntype DeprecatedSize = SizeExtraSmall | SizeLarge | SizeExtraLarge;\n\ntype SizeType = SizeSmall | SizeMedium;\n\nexport type LoaderProps = {\n /**\n * @deprecated Use `size` instead.\n * @default false\n */\n small?: boolean;\n /** @default 'md' */\n size?: SizeType | DeprecatedSize;\n /** @default false */\n displayInstantly?: boolean;\n /** Optional label displayed below the loader */\n label?: ReactNode;\n // TODO: refactor in favor of prop from `CommonProps` type\n /** @default {} */\n classNames?: Record<string, string>;\n 'data-testid'?: string;\n};\n\n/**\n * Loader component\n *\n * Docs link: https://transferwise.github.io/neptune-web/components/progress/Loader\n *\n * @param root0\n * @param root0.small\n * @param root0.size\n * @param root0.classNames\n */\nconst Loader = ({\n small = false,\n size = Size.MEDIUM,\n displayInstantly = false,\n label,\n classNames = {},\n ...restProps\n}: LoaderProps) => {\n const { theme } = useTheme();\n const [hasDebounced, setHasDebounced] = useState(displayInstantly);\n\n useEffect(() => {\n let cancelled: boolean;\n let timeout: ReturnType<typeof setTimeout> | undefined;\n\n if (!displayInstantly) {\n timeout = setTimeout(() => {\n if (!cancelled) {\n setHasDebounced(true);\n }\n }, 1000);\n }\n\n return () => {\n cancelled = true;\n\n clearTimeout(timeout);\n };\n }, []);\n\n const style = (className: string): string => classNames[className] || className;\n const legacySize: SizeType | DeprecatedSize = small ? Size.SMALL : size;\n const supportedSize = getSupportedSize(legacySize);\n\n if (theme === 'forest-green') {\n // eslint-disable-next-line no-console\n console.warn(\n 'Loader is forbidden to use with Forest Green theme. Check the https://wise.design/components/screen-loader for more info.',\n );\n return <></>;\n }\n\n return (\n <div className={style('tw-loader')} data-testid={restProps['data-testid']}>\n <div\n className={clsx(style('tw-loader-asset'), style(`tw-loader-asset--${supportedSize}`), {\n 'tw-loader-asset--visible': hasDebounced,\n })}\n />\n {label && hasDebounced && (\n <Body type={Typography.BODY_LARGE_BOLD} as=\"span\" className={style('text-secondary')}>\n {label}\n </Body>\n )}\n </div>\n );\n};\n\nconst getSupportedSize = (size: SizeType | DeprecatedSize): SizeType => {\n switch (size) {\n case Size.SMALL:\n case Size.EXTRA_SMALL:\n return Size.SMALL;\n\n case Size.EXTRA_LARGE:\n case Size.LARGE:\n case Size.MEDIUM:\n default:\n return Size.MEDIUM;\n }\n};\n\nexport default Loader;\n"],"names":["Loader","small","size","Size","MEDIUM","displayInstantly","label","classNames","restProps","theme","useTheme","hasDebounced","setHasDebounced","useState","useEffect","cancelled","timeout","setTimeout","clearTimeout","style","className","legacySize","SMALL","supportedSize","getSupportedSize","console","warn","_jsx","_Fragment","_jsxs","children","clsx","Body","type","Typography","BODY_LARGE_BOLD","as","EXTRA_SMALL","EXTRA_LARGE","LARGE"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAMA,MAAM,GAAGA,CAAC;AACdC,EAAAA,KAAK,GAAG,KAAK;QACbC,MAAI,GAAGC,SAAI,CAACC,MAAM;AAClBC,EAAAA,gBAAgB,GAAG,KAAK;EACxBC,KAAK;EACLC,UAAU,GAAG,EAAE;EACf,GAAGC;AAAS,CACA,KAAI;EAChB,MAAM;AAAEC,IAAAA;GAAO,GAAGC,0BAAQ,EAAE;EAC5B,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGC,cAAQ,CAACR,gBAAgB,CAAC;AAElES,EAAAA,eAAS,CAAC,MAAK;AACb,IAAA,IAAIC,SAAkB;AACtB,IAAA,IAAIC,OAAkD;IAEtD,IAAI,CAACX,gBAAgB,EAAE;MACrBW,OAAO,GAAGC,UAAU,CAAC,MAAK;QACxB,IAAI,CAACF,SAAS,EAAE;UACdH,eAAe,CAAC,IAAI,CAAC;AACvB,QAAA;MACF,CAAC,EAAE,IAAI,CAAC;AACV,IAAA;AAEA,IAAA,OAAO,MAAK;AACVG,MAAAA,SAAS,GAAG,IAAI;MAEhBG,YAAY,CAACF,OAAO,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMG,KAAK,GAAIC,SAAiB,IAAab,UAAU,CAACa,SAAS,CAAC,IAAIA,SAAS;EAC/E,MAAMC,UAAU,GAA8BpB,KAAK,GAAGE,SAAI,CAACmB,KAAK,GAAGpB,MAAI;AACvE,EAAA,MAAMqB,aAAa,GAAGC,gBAAgB,CAACH,UAAU,CAAC;EAElD,IAAIZ,KAAK,KAAK,cAAc,EAAE;AAC5B;AACAgB,IAAAA,OAAO,CAACC,IAAI,CACV,2HAA2H,CAC5H;AACD,IAAA,oBAAOC,cAAA,CAAAC,mBAAA,EAAA,GAAK;AACd,EAAA;AAEA,EAAA,oBACEC,eAAA,CAAA,KAAA,EAAA;AAAKT,IAAAA,SAAS,EAAED,KAAK,CAAC,WAAW,CAAE;IAAC,aAAA,EAAaX,SAAS,CAAC,aAAa,CAAE;AAAAsB,IAAAA,QAAA,gBACxEH,cAAA,CAAA,KAAA,EAAA;AACEP,MAAAA,SAAS,EAAEW,SAAI,CAACZ,KAAK,CAAC,iBAAiB,CAAC,EAAEA,KAAK,CAAC,CAAA,iBAAA,EAAoBI,aAAa,CAAA,CAAE,CAAC,EAAE;AACpF,QAAA,0BAA0B,EAAEZ;OAC7B;KAAE,CAEL,EAACL,KAAK,IAAIK,YAAY,iBACpBgB,cAAA,CAACK,YAAI,EAAA;MAACC,IAAI,EAAEC,qBAAU,CAACC,eAAgB;AAACC,MAAAA,EAAE,EAAC,MAAM;AAAChB,MAAAA,SAAS,EAAED,KAAK,CAAC,gBAAgB,CAAE;AAAAW,MAAAA,QAAA,EAClFxB;AAAK,KACF,CACP;AAAA,GACE,CAAC;AAEV;AAEA,MAAMkB,gBAAgB,GAAItB,MAA+B,IAAc;AACrE,EAAA,QAAQA,MAAI;IACV,KAAKC,SAAI,CAACmB,KAAK;IACf,KAAKnB,SAAI,CAACkC,WAAW;MACnB,OAAOlC,SAAI,CAACmB,KAAK;IAEnB,KAAKnB,SAAI,CAACmC,WAAW;IACrB,KAAKnC,SAAI,CAACoC,KAAK;IACf,KAAKpC,SAAI,CAACC,MAAM;AAChB,IAAA;MACE,OAAOD,SAAI,CAACC,MAAM;AACtB;AACF,CAAC;;;;"}
|
package/build/loader/Loader.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useTheme } from '@wise/components-theming';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
|
+
import Body from '../body/Body.mjs';
|
|
4
5
|
import '../common/theme.mjs';
|
|
5
6
|
import '../common/direction.mjs';
|
|
6
7
|
import '../common/propsValues/control.mjs';
|
|
7
8
|
import '../common/propsValues/breakpoint.mjs';
|
|
8
9
|
import { Size } from '../common/propsValues/size.mjs';
|
|
9
|
-
import '../common/propsValues/typography.mjs';
|
|
10
|
+
import { Typography } from '../common/propsValues/typography.mjs';
|
|
10
11
|
import '../common/propsValues/width.mjs';
|
|
11
12
|
import '../common/propsValues/type.mjs';
|
|
12
13
|
import '../common/propsValues/dateMode.mjs';
|
|
@@ -24,12 +25,13 @@ import '@transferwise/formatting';
|
|
|
24
25
|
import '@transferwise/icons';
|
|
25
26
|
import 'react-intl';
|
|
26
27
|
import '../common/closeButton/CloseButton.messages.mjs';
|
|
27
|
-
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
28
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
28
29
|
|
|
29
30
|
const Loader = ({
|
|
30
31
|
small = false,
|
|
31
32
|
size = Size.MEDIUM,
|
|
32
33
|
displayInstantly = false,
|
|
34
|
+
label,
|
|
33
35
|
classNames = {},
|
|
34
36
|
...restProps
|
|
35
37
|
}) => {
|
|
@@ -60,11 +62,19 @@ const Loader = ({
|
|
|
60
62
|
console.warn('Loader is forbidden to use with Forest Green theme. Check the https://wise.design/components/screen-loader for more info.');
|
|
61
63
|
return /*#__PURE__*/jsx(Fragment, {});
|
|
62
64
|
}
|
|
63
|
-
return /*#__PURE__*/
|
|
64
|
-
className:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
return /*#__PURE__*/jsxs("div", {
|
|
66
|
+
className: style('tw-loader'),
|
|
67
|
+
"data-testid": restProps['data-testid'],
|
|
68
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
69
|
+
className: clsx(style('tw-loader-asset'), style(`tw-loader-asset--${supportedSize}`), {
|
|
70
|
+
'tw-loader-asset--visible': hasDebounced
|
|
71
|
+
})
|
|
72
|
+
}), label && hasDebounced && /*#__PURE__*/jsx(Body, {
|
|
73
|
+
type: Typography.BODY_LARGE_BOLD,
|
|
74
|
+
as: "span",
|
|
75
|
+
className: style('text-secondary'),
|
|
76
|
+
children: label
|
|
77
|
+
})]
|
|
68
78
|
});
|
|
69
79
|
};
|
|
70
80
|
const getSupportedSize = size => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loader.mjs","sources":["../../src/loader/Loader.tsx"],"sourcesContent":["import { useTheme } from '@wise/components-theming';\nimport { clsx } from 'clsx';\nimport { useEffect, useState } from 'react';\n\nimport { Size, SizeExtraSmall, SizeSmall, SizeMedium, SizeLarge, SizeExtraLarge } from '../common';\n\n// TODO: We gracefully deprecated xs, lg and xl -- remove these as part of a future breaking change to this component\ntype DeprecatedSize = SizeExtraSmall | SizeLarge | SizeExtraLarge;\n\ntype SizeType = SizeSmall | SizeMedium;\n\nexport type LoaderProps = {\n /**\n * @deprecated Use `size` instead.\n * @default false\n */\n small?: boolean;\n /** @default 'md' */\n size?: SizeType | DeprecatedSize;\n /** @default false */\n displayInstantly?: boolean;\n // TODO: refactor in favor of prop from `CommonProps` type\n /** @default {} */\n classNames?: Record<string, string>;\n 'data-testid'?: string;\n};\n\n/**\n * Loader component\n *\n * Docs link: https://transferwise.github.io/neptune-web/components/progress/Loader\n *\n * @param root0\n * @param root0.small\n * @param root0.size\n * @param root0.classNames\n */\nconst Loader = ({\n small = false,\n size = Size.MEDIUM,\n displayInstantly = false,\n classNames = {},\n ...restProps\n}: LoaderProps) => {\n const { theme } = useTheme();\n const [hasDebounced, setHasDebounced] = useState(displayInstantly);\n\n useEffect(() => {\n let cancelled: boolean;\n let timeout: ReturnType<typeof setTimeout> | undefined;\n\n if (!displayInstantly) {\n timeout = setTimeout(() => {\n if (!cancelled) {\n setHasDebounced(true);\n }\n }, 1000);\n }\n\n return () => {\n cancelled = true;\n\n clearTimeout(timeout);\n };\n }, []);\n\n const style = (className: string): string => classNames[className] || className;\n const legacySize: SizeType | DeprecatedSize = small ? Size.SMALL : size;\n const supportedSize = getSupportedSize(legacySize);\n\n if (theme === 'forest-green') {\n // eslint-disable-next-line no-console\n console.warn(\n 'Loader is forbidden to use with Forest Green theme. Check the https://wise.design/components/screen-loader for more info.',\n );\n return <></>;\n }\n\n return (\n <div\n
|
|
1
|
+
{"version":3,"file":"Loader.mjs","sources":["../../src/loader/Loader.tsx"],"sourcesContent":["import { useTheme } from '@wise/components-theming';\nimport { clsx } from 'clsx';\nimport { ReactNode, useEffect, useState } from 'react';\n\nimport Body from '../body';\nimport { Size, SizeExtraSmall, SizeSmall, SizeMedium, SizeLarge, SizeExtraLarge } from '../common';\nimport { Typography } from '../common/propsValues/typography';\n\n// TODO: We gracefully deprecated xs, lg and xl -- remove these as part of a future breaking change to this component\ntype DeprecatedSize = SizeExtraSmall | SizeLarge | SizeExtraLarge;\n\ntype SizeType = SizeSmall | SizeMedium;\n\nexport type LoaderProps = {\n /**\n * @deprecated Use `size` instead.\n * @default false\n */\n small?: boolean;\n /** @default 'md' */\n size?: SizeType | DeprecatedSize;\n /** @default false */\n displayInstantly?: boolean;\n /** Optional label displayed below the loader */\n label?: ReactNode;\n // TODO: refactor in favor of prop from `CommonProps` type\n /** @default {} */\n classNames?: Record<string, string>;\n 'data-testid'?: string;\n};\n\n/**\n * Loader component\n *\n * Docs link: https://transferwise.github.io/neptune-web/components/progress/Loader\n *\n * @param root0\n * @param root0.small\n * @param root0.size\n * @param root0.classNames\n */\nconst Loader = ({\n small = false,\n size = Size.MEDIUM,\n displayInstantly = false,\n label,\n classNames = {},\n ...restProps\n}: LoaderProps) => {\n const { theme } = useTheme();\n const [hasDebounced, setHasDebounced] = useState(displayInstantly);\n\n useEffect(() => {\n let cancelled: boolean;\n let timeout: ReturnType<typeof setTimeout> | undefined;\n\n if (!displayInstantly) {\n timeout = setTimeout(() => {\n if (!cancelled) {\n setHasDebounced(true);\n }\n }, 1000);\n }\n\n return () => {\n cancelled = true;\n\n clearTimeout(timeout);\n };\n }, []);\n\n const style = (className: string): string => classNames[className] || className;\n const legacySize: SizeType | DeprecatedSize = small ? Size.SMALL : size;\n const supportedSize = getSupportedSize(legacySize);\n\n if (theme === 'forest-green') {\n // eslint-disable-next-line no-console\n console.warn(\n 'Loader is forbidden to use with Forest Green theme. Check the https://wise.design/components/screen-loader for more info.',\n );\n return <></>;\n }\n\n return (\n <div className={style('tw-loader')} data-testid={restProps['data-testid']}>\n <div\n className={clsx(style('tw-loader-asset'), style(`tw-loader-asset--${supportedSize}`), {\n 'tw-loader-asset--visible': hasDebounced,\n })}\n />\n {label && hasDebounced && (\n <Body type={Typography.BODY_LARGE_BOLD} as=\"span\" className={style('text-secondary')}>\n {label}\n </Body>\n )}\n </div>\n );\n};\n\nconst getSupportedSize = (size: SizeType | DeprecatedSize): SizeType => {\n switch (size) {\n case Size.SMALL:\n case Size.EXTRA_SMALL:\n return Size.SMALL;\n\n case Size.EXTRA_LARGE:\n case Size.LARGE:\n case Size.MEDIUM:\n default:\n return Size.MEDIUM;\n }\n};\n\nexport default Loader;\n"],"names":["Loader","small","size","Size","MEDIUM","displayInstantly","label","classNames","restProps","theme","useTheme","hasDebounced","setHasDebounced","useState","useEffect","cancelled","timeout","setTimeout","clearTimeout","style","className","legacySize","SMALL","supportedSize","getSupportedSize","console","warn","_jsx","_Fragment","_jsxs","children","clsx","Body","type","Typography","BODY_LARGE_BOLD","as","EXTRA_SMALL","EXTRA_LARGE","LARGE"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAMA,MAAM,GAAGA,CAAC;AACdC,EAAAA,KAAK,GAAG,KAAK;EACbC,IAAI,GAAGC,IAAI,CAACC,MAAM;AAClBC,EAAAA,gBAAgB,GAAG,KAAK;EACxBC,KAAK;EACLC,UAAU,GAAG,EAAE;EACf,GAAGC;AAAS,CACA,KAAI;EAChB,MAAM;AAAEC,IAAAA;GAAO,GAAGC,QAAQ,EAAE;EAC5B,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGC,QAAQ,CAACR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