@transferwise/components 0.0.0-experimental-a90d366 → 0.0.0-experimental-8419611
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/drawer/Drawer.js +1 -1
- package/build/drawer/Drawer.js.map +1 -1
- package/build/drawer/Drawer.mjs +1 -1
- package/build/drawer/Drawer.mjs.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs.map +1 -1
- package/package.json +3 -3
- package/src/drawer/Drawer.tsx +1 -1
- package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +1 -1
package/build/drawer/Drawer.js
CHANGED
|
@@ -40,7 +40,7 @@ function Drawer({
|
|
|
40
40
|
id: overlayId,
|
|
41
41
|
role: role,
|
|
42
42
|
"aria-modal": true,
|
|
43
|
-
"aria-labelledby": ariaLabelledBy
|
|
43
|
+
"aria-labelledby": ariaLabelledBy || (headerTitle ? titleId : undefined),
|
|
44
44
|
className: clsx.clsx('np-drawer', className),
|
|
45
45
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
46
46
|
className: clsx.clsx('np-drawer-header', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sources":["../../src/drawer/Drawer.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { HTMLAttributes, useContext, useId } from 'react';\n\nimport { Position, Typography } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport { useLayout } from '../common/hooks';\nimport Dimmer from '../dimmer';\nimport { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../slidingPanel';\nimport Title from '../title';\nimport { logActionRequiredIf } from '../utilities';\n\nexport type DrawerProps = {\n /** The content to appear in the drawer body. */\n children?: React.ReactNode;\n className?: string;\n /** The content to appear in the drawer footer. */\n footerContent?: React.ReactNode;\n /** The content to appear in the drawer header. */\n headerTitle?: React.ReactNode;\n /** The status of Drawer either open or not. */\n open?: boolean;\n /** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */\n position?: `${Position.LEFT | Position.RIGHT | Position.BOTTOM}`;\n /** The action to perform on close click. */\n onClose?: (event: KeyboardEvent | React.MouseEvent) => void;\n} & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>;\n\nexport default function Drawer({\n children,\n className,\n footerContent,\n headerTitle,\n onClose,\n open = false,\n position = 'right',\n role = 'dialog',\n 'aria-labelledby': ariaLabelledBy,\n}: DrawerProps) {\n logActionRequiredIf(\n 'Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.',\n !onClose,\n );\n\n const { isMobile } = useLayout();\n const titleId = useId();\n\n const overlayId = useContext(OverlayIdContext);\n\n return (\n <Dimmer open={open} onClose={onClose}>\n <SlidingPanel open={open} position={isMobile ? Position.BOTTOM : position}>\n <div\n id={overlayId}\n role={role}\n aria-modal\n aria-labelledby={
|
|
1
|
+
{"version":3,"file":"Drawer.js","sources":["../../src/drawer/Drawer.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { HTMLAttributes, useContext, useId } from 'react';\n\nimport { Position, Typography } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport { useLayout } from '../common/hooks';\nimport Dimmer from '../dimmer';\nimport { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../slidingPanel';\nimport Title from '../title';\nimport { logActionRequiredIf } from '../utilities';\n\nexport type DrawerProps = {\n /** The content to appear in the drawer body. */\n children?: React.ReactNode;\n className?: string;\n /** The content to appear in the drawer footer. */\n footerContent?: React.ReactNode;\n /** The content to appear in the drawer header. */\n headerTitle?: React.ReactNode;\n /** The status of Drawer either open or not. */\n open?: boolean;\n /** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */\n position?: `${Position.LEFT | Position.RIGHT | Position.BOTTOM}`;\n /** The action to perform on close click. */\n onClose?: (event: KeyboardEvent | React.MouseEvent) => void;\n} & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>;\n\nexport default function Drawer({\n children,\n className,\n footerContent,\n headerTitle,\n onClose,\n open = false,\n position = 'right',\n role = 'dialog',\n 'aria-labelledby': ariaLabelledBy,\n}: DrawerProps) {\n logActionRequiredIf(\n 'Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.',\n !onClose,\n );\n\n const { isMobile } = useLayout();\n const titleId = useId();\n\n const overlayId = useContext(OverlayIdContext);\n\n return (\n <Dimmer open={open} onClose={onClose}>\n <SlidingPanel open={open} position={isMobile ? Position.BOTTOM : position}>\n <div\n id={overlayId}\n role={role}\n aria-modal\n aria-labelledby={ariaLabelledBy || (headerTitle ? titleId : undefined)}\n className={clsx('np-drawer', className)}\n >\n <div\n className={clsx('np-drawer-header', {\n 'np-drawer-header--withborder': headerTitle,\n })}\n >\n {headerTitle && (\n <Title id={titleId} type={Typography.TITLE_BODY}>\n {headerTitle}\n </Title>\n )}\n <CloseButton onClick={onClose} />\n </div>\n {children && <div className={clsx('np-drawer-content')}>{children}</div>}\n {footerContent && <div className={clsx('np-drawer-footer')}>{footerContent}</div>}\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n}\n"],"names":["Drawer","children","className","footerContent","headerTitle","onClose","open","position","role","ariaLabelledBy","logActionRequiredIf","isMobile","useLayout","titleId","useId","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","SlidingPanel","Position","BOTTOM","_jsxs","id","undefined","clsx","Title","type","Typography","TITLE_BODY","CloseButton","onClick"],"mappings":";;;;;;;;;;;;;;;AA4BwB,SAAAA,MAAMA,CAAC;EAC7BC,QAAQ;EACRC,SAAS;EACTC,aAAa;EACbC,WAAW;EACXC,OAAO;AACPC,EAAAA,IAAI,GAAG,KAAK;AACZC,YAAAA,UAAQ,GAAG,OAAO;AAClBC,EAAAA,IAAI,G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ACa,uBAAW,EAAA;AAACC,YAAAA,OAAO,EAAE3B,OAAAA;AAAQ,WAChC,CAAA,CAAA;AAAA,SAAK,CACL,EAACJ,QAAQ,iBAAIiB,cAAA,CAAA,KAAA,EAAA;AAAKhB,UAAAA,SAAS,EAAEwB,SAAI,CAAC,mBAAmB,CAAE;AAAAzB,UAAAA,QAAA,EAAEA,QAAAA;AAAQ,SAAM,CAAC,EACvEE,aAAa,iBAAIe,cAAA,CAAA,KAAA,EAAA;AAAKhB,UAAAA,SAAS,EAAEwB,SAAI,CAAC,kBAAkB,CAAE;AAAAzB,UAAAA,QAAA,EAAEE,aAAAA;AAAa,SAAM,CAAC,CAAA;OAC9E,CAAA;KACO,CAAA;AAChB,GAAQ,CAAC,CAAA;AAEb;;;;"}
|
package/build/drawer/Drawer.mjs
CHANGED
|
@@ -38,7 +38,7 @@ function Drawer({
|
|
|
38
38
|
id: overlayId,
|
|
39
39
|
role: role,
|
|
40
40
|
"aria-modal": true,
|
|
41
|
-
"aria-labelledby": ariaLabelledBy
|
|
41
|
+
"aria-labelledby": ariaLabelledBy || (headerTitle ? titleId : undefined),
|
|
42
42
|
className: clsx('np-drawer', className),
|
|
43
43
|
children: [/*#__PURE__*/jsxs("div", {
|
|
44
44
|
className: clsx('np-drawer-header', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.mjs","sources":["../../src/drawer/Drawer.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { HTMLAttributes, useContext, useId } from 'react';\n\nimport { Position, Typography } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport { useLayout } from '../common/hooks';\nimport Dimmer from '../dimmer';\nimport { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../slidingPanel';\nimport Title from '../title';\nimport { logActionRequiredIf } from '../utilities';\n\nexport type DrawerProps = {\n /** The content to appear in the drawer body. */\n children?: React.ReactNode;\n className?: string;\n /** The content to appear in the drawer footer. */\n footerContent?: React.ReactNode;\n /** The content to appear in the drawer header. */\n headerTitle?: React.ReactNode;\n /** The status of Drawer either open or not. */\n open?: boolean;\n /** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */\n position?: `${Position.LEFT | Position.RIGHT | Position.BOTTOM}`;\n /** The action to perform on close click. */\n onClose?: (event: KeyboardEvent | React.MouseEvent) => void;\n} & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>;\n\nexport default function Drawer({\n children,\n className,\n footerContent,\n headerTitle,\n onClose,\n open = false,\n position = 'right',\n role = 'dialog',\n 'aria-labelledby': ariaLabelledBy,\n}: DrawerProps) {\n logActionRequiredIf(\n 'Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.',\n !onClose,\n );\n\n const { isMobile } = useLayout();\n const titleId = useId();\n\n const overlayId = useContext(OverlayIdContext);\n\n return (\n <Dimmer open={open} onClose={onClose}>\n <SlidingPanel open={open} position={isMobile ? Position.BOTTOM : position}>\n <div\n id={overlayId}\n role={role}\n aria-modal\n aria-labelledby={
|
|
1
|
+
{"version":3,"file":"Drawer.mjs","sources":["../../src/drawer/Drawer.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { HTMLAttributes, useContext, useId } from 'react';\n\nimport { Position, Typography } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport { useLayout } from '../common/hooks';\nimport Dimmer from '../dimmer';\nimport { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../slidingPanel';\nimport Title from '../title';\nimport { logActionRequiredIf } from '../utilities';\n\nexport type DrawerProps = {\n /** The content to appear in the drawer body. */\n children?: React.ReactNode;\n className?: string;\n /** The content to appear in the drawer footer. */\n footerContent?: React.ReactNode;\n /** The content to appear in the drawer header. */\n headerTitle?: React.ReactNode;\n /** The status of Drawer either open or not. */\n open?: boolean;\n /** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */\n position?: `${Position.LEFT | Position.RIGHT | Position.BOTTOM}`;\n /** The action to perform on close click. */\n onClose?: (event: KeyboardEvent | React.MouseEvent) => void;\n} & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>;\n\nexport default function Drawer({\n children,\n className,\n footerContent,\n headerTitle,\n onClose,\n open = false,\n position = 'right',\n role = 'dialog',\n 'aria-labelledby': ariaLabelledBy,\n}: DrawerProps) {\n logActionRequiredIf(\n 'Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.',\n !onClose,\n );\n\n const { isMobile } = useLayout();\n const titleId = useId();\n\n const overlayId = useContext(OverlayIdContext);\n\n return (\n <Dimmer open={open} onClose={onClose}>\n <SlidingPanel open={open} position={isMobile ? Position.BOTTOM : position}>\n <div\n id={overlayId}\n role={role}\n aria-modal\n aria-labelledby={ariaLabelledBy || (headerTitle ? titleId : undefined)}\n className={clsx('np-drawer', className)}\n >\n <div\n className={clsx('np-drawer-header', {\n 'np-drawer-header--withborder': headerTitle,\n })}\n >\n {headerTitle && (\n <Title id={titleId} type={Typography.TITLE_BODY}>\n {headerTitle}\n </Title>\n )}\n <CloseButton onClick={onClose} />\n </div>\n {children && <div className={clsx('np-drawer-content')}>{children}</div>}\n {footerContent && <div className={clsx('np-drawer-footer')}>{footerContent}</div>}\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n}\n"],"names":["Drawer","children","className","footerContent","headerTitle","onClose","open","position","role","ariaLabelledBy","logActionRequiredIf","isMobile","useLayout","titleId","useId","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","SlidingPanel","Position","BOTTOM","_jsxs","id","undefined","clsx","Title","type","Typography","TITLE_BODY","CloseButton","onClick"],"mappings":";;;;;;;;;;;;;AA4BwB,SAAAA,MAAMA,CAAC;EAC7BC,QAAQ;EACRC,SAAS;EACTC,aAAa;EACbC,WAAW;EACXC,OAAO;AACPC,EAAAA,IAAI,GAAG,KAAK;AACZC,EAAAA,QAAQ,GAAG,OAAO;AAClBC,EAAAA,IAAI,GAAG,QAAQ;AACf,EAAA,iBAAiB,EAAEC,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AAAA;AAAQ,WAChC,CAAA,CAAA;AAAA,SAAK,CACL,EAACJ,QAAQ,iBAAIiB,GAAA,CAAA,KAAA,EAAA;AAAKhB,UAAAA,SAAS,EAAEwB,IAAI,CAAC,mBAAmB,CAAE;AAAAzB,UAAAA,QAAA,EAAEA,QAAAA;AAAQ,SAAM,CAAC,EACvEE,aAAa,iBAAIe,GAAA,CAAA,KAAA,EAAA;AAAKhB,UAAAA,SAAS,EAAEwB,IAAI,CAAC,kBAAkB,CAAE;AAAAzB,UAAAA,QAAA,EAAEE,aAAAA;AAAa,SAAM,CAAC,CAAA;OAC9E,CAAA;KACO,CAAA;AAChB,GAAQ,CAAC,CAAA;AAEb;;;;"}
|
|
@@ -58,7 +58,7 @@ const AnimatedLabel = ({
|
|
|
58
58
|
open: showSteps,
|
|
59
59
|
onClose: () => setShowSteps(false),
|
|
60
60
|
children: /*#__PURE__*/jsxRuntime.jsx(List.List, {
|
|
61
|
-
className: "p-a-1",
|
|
61
|
+
className: "m-b-0 p-a-1",
|
|
62
62
|
children: steps.map((step, index) => {
|
|
63
63
|
const isCurrentStep = activeLabel === index;
|
|
64
64
|
const isDisabled = activeLabel < index;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedLabel.js","sources":["../../../src/flowNavigation/animatedLabel/AnimatedLabel.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useState } from 'react';\n\nimport type { Step } from '../../stepper/Stepper';\nimport BottomSheet from '../../common/bottomSheet';\nimport Option from '../../common/Option';\nimport { Check, ChevronDown } from '@transferwise/icons';\nimport { OverlayIdContext, OverlayIdProvider } from '../../provider/overlay/OverlayIdProvider';\nimport { List } from '../../listItem';\n\nexport interface AnimatedLabelProps {\n activeLabel: number;\n className?: string;\n steps: readonly Step[];\n}\n\nconst AnimatedLabel = ({ activeLabel, className, steps }: AnimatedLabelProps) => {\n const labelId = useId();\n const [showSteps, setShowSteps] = useState(false);\n\n function handleStepAction(onClick: Step['onClick']) {\n return () => {\n setShowSteps(false);\n onClick?.();\n };\n }\n\n return (\n <OverlayIdProvider open={showSteps}>\n <OverlayIdContext.Consumer>\n {(overlayId) => {\n return (\n <>\n <button\n type=\"button\"\n id={labelId}\n aria-haspopup=\"menu\"\n aria-controls={overlayId}\n aria-expanded={showSteps}\n className={clsx(\n 'np-animated-label',\n 'btn-unstyled',\n 'np-text-body-large-bold',\n className,\n )}\n onClick={() => setShowSteps(true)}\n >\n {steps.map(({ label }, index) => {\n const isCurrentStep = activeLabel === index;\n const nextLabel = index - 1;\n return (\n <div\n key={nextLabel}\n aria-hidden={!isCurrentStep}\n className={clsx('text-xs-center', 'd-inline-flex', {\n 'np-animated-label--in text-ellipsis': isCurrentStep,\n })}\n >\n {label} <ChevronDown className=\"m-l-1\" size={24} />\n </div>\n );\n })}\n </button>\n <BottomSheet\n role=\"menu\"\n aria-labelledby={labelId}\n open={showSteps}\n onClose={() => setShowSteps(false)}\n >\n <List className=\"p-a-1\">\n {steps.map((step, index) => {\n const isCurrentStep = activeLabel === index;\n const isDisabled = activeLabel < index;\n const itemId = `step-${index}`;\n return (\n <Option\n key={itemId}\n id={itemId}\n as=\"li\"\n role=\"menuitem\"\n decision={false}\n className={clsx('np-animated-label-option', 'p-x-3', 'p-y-1', 'm-y-1', {\n clickable: !isDisabled,\n })}\n title={step.label}\n content={step.hoverLabel}\n button={isCurrentStep ? <Check size={24} /> : null}\n aria-current={isCurrentStep ? 'step' : false}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n isContainerAligned\n {...(!isDisabled && {\n tabIndex: 0,\n onClick: handleStepAction(step.onClick),\n onKeyDown: (event) => {\n event.preventDefault();\n if (event.code === 'Enter' || event.code === 'Space') {\n handleStepAction(step.onClick)();\n }\n },\n })}\n />\n );\n })}\n </List>\n </BottomSheet>\n </>\n );\n }}\n </OverlayIdContext.Consumer>\n </OverlayIdProvider>\n );\n};\n\nexport default AnimatedLabel;\n"],"names":["AnimatedLabel","activeLabel","className","steps","labelId","useId","showSteps","setShowSteps","useState","handleStepAction","onClick","_jsx","OverlayIdProvider","open","children","OverlayIdContext","Consumer","overlayId","_jsxs","_Fragment","type","id","clsx","map","label","index","isCurrentStep","nextLabel","ChevronDown","size","BottomSheet","role","onClose","List","step","isDisabled","itemId","Option","as","decision","clickable","title","content","hoverLabel","button","Check","disabled","isContainerAligned","tabIndex","onKeyDown","event","preventDefault","code"],"mappings":";;;;;;;;;;;;AAgBMA,MAAAA,aAAa,GAAGA,CAAC;EAAEC,WAAW;EAAEC,SAAS;AAAEC,EAAAA,KAAAA;AAA2B,CAAA,KAAI;AAC9E,EAAA,MAAMC,OAAO,GAAGC,WAAK,EAAE,CAAA;EACvB,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC,CAAA;EAEjD,SAASC,gBAAgBA,CAACC,OAAwB,EAAA;AAChD,IAAA,OAAO,MAAK;MACVH,YAAY,CAAC,KAAK,CAAC,CAAA;AACnBG,MAAAA,OAAO,IAAI,CAAA;KACZ,CAAA;AACH,GAAA;EAEA,oBACEC,cAAA,CAACC,mCAAiB,EAAA;AAACC,IAAAA,IAAI,EAAEP,SAAU;AAAAQ,IAAAA,QAAA,eACjCH,cAAA,CAACI,kCAAgB,CAACC,QAAQ,EAAA;MAAAF,QAAA,EACtBG,SAAS,IAAI;QACb,oBACEC,eAAA,CAAAC,mBAAA,EAAA;AAAAL,UAAAA,QAAA,gBACEH,cAAA,CAAA,QAAA,EAAA;AACES,YAAAA,IAAI,EAAC,QAAQ;AACbC,YAAAA,EAAE,EAAEjB,OAAQ;AACZ,YAAA,eAAA,EAAc,MAAM;AACpB,YAAA,eAAA,EAAea,SAAU;AACzB,YAAA,eAAA,EAAeX,SAAU;YACzBJ,SAAS,EAAEoB,SAAI,CACb,mBAAmB,EACnB,cAAc,EACd,yBAAyB,EACzBpB,SAAS,CACT;AACFQ,YAAAA,OAAO,EAAEA,MAAMH,YAAY,CAAC,IAAI,CAAE;AAAAO,YAAAA,QAAA,EAEjCX,KAAK,CAACoB,GAAG,CAAC,CAAC;AAAEC,cAAAA,KAAAA;aAAO,EAAEC,KAAK,KAAI;AAC9B,cAAA,MAAMC,aAAa,GAAGzB,WAAW,KAAKwB,KAAK,CAAA;AAC3C,cAAA,MAAME,SAAS,GAAGF,KAAK,GAAG,CAAC,CAAA;AAC3B,cAAA,oBACEP,eAAA,CAAA,KAAA,EAAA;AAEE,gBAAA,aAAA,EAAa,CAACQ,aAAc;AAC5BxB,gBAAAA,SAAS,EAAEoB,SAAI,CAAC,gBAAgB,EAAE,eAAe,EAAE;AACjD,kBAAA,qCAAqC,EAAEI,aAAAA;AACxC,iBAAA,CAAE;AAAAZ,gBAAAA,QAAA,GAEFU,KAAK,EAAE,GAAA,eAAAb,cAAA,CAACiB,iBAAW,EAAA;AAAC1B,kBAAAA,SAAS,EAAC,OAAO;AAAC2B,kBAAAA,IAAI,EAAE,EAAA;AAAG,iBAClD,CAAA,CAAA;AAAA,eAAA,EAPOF,SAOF,CAAC,CAAA;aAET,CAAA;AAAC,WACI,CACR,eAAAhB,cAAA,CAACmB,WAAW,EAAA;AACVC,YAAAA,IAAI,EAAC,MAAM;AACX,YAAA,iBAAA,EAAiB3B,OAAQ;AACzBS,YAAAA,IAAI,EAAEP,SAAU;AAChB0B,YAAAA,OAAO,EAAEA,MAAMzB,YAAY,CAAC,KAAK,CAAE;YAAAO,QAAA,eAEnCH,cAAA,CAACsB,SAAI,EAAA;AAAC/B,cAAAA,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"AnimatedLabel.js","sources":["../../../src/flowNavigation/animatedLabel/AnimatedLabel.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useState } from 'react';\n\nimport type { Step } from '../../stepper/Stepper';\nimport BottomSheet from '../../common/bottomSheet';\nimport Option from '../../common/Option';\nimport { Check, ChevronDown } from '@transferwise/icons';\nimport { OverlayIdContext, OverlayIdProvider } from '../../provider/overlay/OverlayIdProvider';\nimport { List } from '../../listItem';\n\nexport interface AnimatedLabelProps {\n activeLabel: number;\n className?: string;\n steps: readonly Step[];\n}\n\nconst AnimatedLabel = ({ activeLabel, className, steps }: AnimatedLabelProps) => {\n const labelId = useId();\n const [showSteps, setShowSteps] = useState(false);\n\n function handleStepAction(onClick: Step['onClick']) {\n return () => {\n setShowSteps(false);\n onClick?.();\n };\n }\n\n return (\n <OverlayIdProvider open={showSteps}>\n <OverlayIdContext.Consumer>\n {(overlayId) => {\n return (\n <>\n <button\n type=\"button\"\n id={labelId}\n aria-haspopup=\"menu\"\n aria-controls={overlayId}\n aria-expanded={showSteps}\n className={clsx(\n 'np-animated-label',\n 'btn-unstyled',\n 'np-text-body-large-bold',\n className,\n )}\n onClick={() => setShowSteps(true)}\n >\n {steps.map(({ label }, index) => {\n const isCurrentStep = activeLabel === index;\n const nextLabel = index - 1;\n return (\n <div\n key={nextLabel}\n aria-hidden={!isCurrentStep}\n className={clsx('text-xs-center', 'd-inline-flex', {\n 'np-animated-label--in text-ellipsis': isCurrentStep,\n })}\n >\n {label} <ChevronDown className=\"m-l-1\" size={24} />\n </div>\n );\n })}\n </button>\n <BottomSheet\n role=\"menu\"\n aria-labelledby={labelId}\n open={showSteps}\n onClose={() => setShowSteps(false)}\n >\n <List className=\"m-b-0 p-a-1\">\n {steps.map((step, index) => {\n const isCurrentStep = activeLabel === index;\n const isDisabled = activeLabel < index;\n const itemId = `step-${index}`;\n return (\n <Option\n key={itemId}\n id={itemId}\n as=\"li\"\n role=\"menuitem\"\n decision={false}\n className={clsx('np-animated-label-option', 'p-x-3', 'p-y-1', 'm-y-1', {\n clickable: !isDisabled,\n })}\n title={step.label}\n content={step.hoverLabel}\n button={isCurrentStep ? <Check size={24} /> : null}\n aria-current={isCurrentStep ? 'step' : false}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n isContainerAligned\n {...(!isDisabled && {\n tabIndex: 0,\n onClick: handleStepAction(step.onClick),\n onKeyDown: (event) => {\n event.preventDefault();\n if (event.code === 'Enter' || event.code === 'Space') {\n handleStepAction(step.onClick)();\n }\n },\n })}\n />\n );\n })}\n </List>\n </BottomSheet>\n </>\n );\n }}\n </OverlayIdContext.Consumer>\n </OverlayIdProvider>\n );\n};\n\nexport default AnimatedLabel;\n"],"names":["AnimatedLabel","activeLabel","className","steps","labelId","useId","showSteps","setShowSteps","useState","handleStepAction","onClick","_jsx","OverlayIdProvider","open","children","OverlayIdContext","Consumer","overlayId","_jsxs","_Fragment","type","id","clsx","map","label","index","isCurrentStep","nextLabel","ChevronDown","size","BottomSheet","role","onClose","List","step","isDisabled","itemId","Option","as","decision","clickable","title","content","hoverLabel","button","Check","disabled","isContainerAligned","tabIndex","onKeyDown","event","preventDefault","code"],"mappings":";;;;;;;;;;;;AAgBMA,MAAAA,aAAa,GAAGA,CAAC;EAAEC,WAAW;EAAEC,SAAS;AAAEC,EAAAA,KAAAA;AAA2B,CAAA,KAAI;AAC9E,EAAA,MAAMC,OAAO,GAAGC,WAAK,EAAE,CAAA;EACvB,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC,CAAA;EAEjD,SAASC,gBAAgBA,CAACC,OAAwB,EAAA;AAChD,IAAA,OAAO,MAAK;MACVH,YAAY,CAAC,KAAK,CAAC,CAAA;AACnBG,MAAAA,OAAO,IAAI,CAAA;KACZ,CAAA;AACH,GAAA;EAEA,oBACEC,cAAA,CAACC,mCAAiB,EAAA;AAACC,IAAAA,IAAI,EAAEP,SAAU;AAAAQ,IAAAA,QAAA,eACjCH,cAAA,CAACI,kCAAgB,CAACC,QAAQ,EAAA;MAAAF,QAAA,EACtBG,SAAS,IAAI;QACb,oBACEC,eAAA,CAAAC,mBAAA,EAAA;AAAAL,UAAAA,QAAA,gBACEH,cAAA,CAAA,QAAA,EAAA;AACES,YAAAA,IAAI,EAAC,QAAQ;AACbC,YAAAA,EAAE,EAAEjB,OAAQ;AACZ,YAAA,eAAA,EAAc,MAAM;AACpB,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AAE,CAAA;AAClC,uBAAA;AACF,qBAAA;mBACD,CAAA;AAAA,iBAAA,EAxBI0B,MAyBL,CAAA,CAAA;eAEL,CAAA;aACG,CAAA;AACR,WAAa,CACf,CAAA;AAAA,SAAA,CAAG,CAAA;AAEP,OAAA;KACyB,CAAA;AAC7B,GAAmB,CAAC,CAAA;AAExB;;;;"}
|
|
@@ -56,7 +56,7 @@ const AnimatedLabel = ({
|
|
|
56
56
|
open: showSteps,
|
|
57
57
|
onClose: () => setShowSteps(false),
|
|
58
58
|
children: /*#__PURE__*/jsx(List, {
|
|
59
|
-
className: "p-a-1",
|
|
59
|
+
className: "m-b-0 p-a-1",
|
|
60
60
|
children: steps.map((step, index) => {
|
|
61
61
|
const isCurrentStep = activeLabel === index;
|
|
62
62
|
const isDisabled = activeLabel < index;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedLabel.mjs","sources":["../../../src/flowNavigation/animatedLabel/AnimatedLabel.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useState } from 'react';\n\nimport type { Step } from '../../stepper/Stepper';\nimport BottomSheet from '../../common/bottomSheet';\nimport Option from '../../common/Option';\nimport { Check, ChevronDown } from '@transferwise/icons';\nimport { OverlayIdContext, OverlayIdProvider } from '../../provider/overlay/OverlayIdProvider';\nimport { List } from '../../listItem';\n\nexport interface AnimatedLabelProps {\n activeLabel: number;\n className?: string;\n steps: readonly Step[];\n}\n\nconst AnimatedLabel = ({ activeLabel, className, steps }: AnimatedLabelProps) => {\n const labelId = useId();\n const [showSteps, setShowSteps] = useState(false);\n\n function handleStepAction(onClick: Step['onClick']) {\n return () => {\n setShowSteps(false);\n onClick?.();\n };\n }\n\n return (\n <OverlayIdProvider open={showSteps}>\n <OverlayIdContext.Consumer>\n {(overlayId) => {\n return (\n <>\n <button\n type=\"button\"\n id={labelId}\n aria-haspopup=\"menu\"\n aria-controls={overlayId}\n aria-expanded={showSteps}\n className={clsx(\n 'np-animated-label',\n 'btn-unstyled',\n 'np-text-body-large-bold',\n className,\n )}\n onClick={() => setShowSteps(true)}\n >\n {steps.map(({ label }, index) => {\n const isCurrentStep = activeLabel === index;\n const nextLabel = index - 1;\n return (\n <div\n key={nextLabel}\n aria-hidden={!isCurrentStep}\n className={clsx('text-xs-center', 'd-inline-flex', {\n 'np-animated-label--in text-ellipsis': isCurrentStep,\n })}\n >\n {label} <ChevronDown className=\"m-l-1\" size={24} />\n </div>\n );\n })}\n </button>\n <BottomSheet\n role=\"menu\"\n aria-labelledby={labelId}\n open={showSteps}\n onClose={() => setShowSteps(false)}\n >\n <List className=\"p-a-1\">\n {steps.map((step, index) => {\n const isCurrentStep = activeLabel === index;\n const isDisabled = activeLabel < index;\n const itemId = `step-${index}`;\n return (\n <Option\n key={itemId}\n id={itemId}\n as=\"li\"\n role=\"menuitem\"\n decision={false}\n className={clsx('np-animated-label-option', 'p-x-3', 'p-y-1', 'm-y-1', {\n clickable: !isDisabled,\n })}\n title={step.label}\n content={step.hoverLabel}\n button={isCurrentStep ? <Check size={24} /> : null}\n aria-current={isCurrentStep ? 'step' : false}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n isContainerAligned\n {...(!isDisabled && {\n tabIndex: 0,\n onClick: handleStepAction(step.onClick),\n onKeyDown: (event) => {\n event.preventDefault();\n if (event.code === 'Enter' || event.code === 'Space') {\n handleStepAction(step.onClick)();\n }\n },\n })}\n />\n );\n })}\n </List>\n </BottomSheet>\n </>\n );\n }}\n </OverlayIdContext.Consumer>\n </OverlayIdProvider>\n );\n};\n\nexport default AnimatedLabel;\n"],"names":["AnimatedLabel","activeLabel","className","steps","labelId","useId","showSteps","setShowSteps","useState","handleStepAction","onClick","_jsx","OverlayIdProvider","open","children","OverlayIdContext","Consumer","overlayId","_jsxs","_Fragment","type","id","clsx","map","label","index","isCurrentStep","nextLabel","ChevronDown","size","BottomSheet","role","onClose","List","step","isDisabled","itemId","Option","as","decision","clickable","title","content","hoverLabel","button","Check","disabled","isContainerAligned","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AC3B,cAAA,oBACEP,IAAA,CAAA,KAAA,EAAA;AAEE,gBAAA,aAAA,EAAa,CAACQ,aAAc;AAC5BxB,gBAAAA,SAAS,EAAEoB,IAAI,CAAC,gBAAgB,EAAE,eAAe,EAAE;AACjD,kBAAA,qCAAqC,EAAEI,aAAAA;AACxC,iBAAA,CAAE;AAAAZ,gBAAAA,QAAA,GAEFU,KAAK,EAAE,GAAA,eAAAb,GAAA,CAACiB,WAAW,EAAA;AAAC1B,kBAAAA,SAAS,EAAC,OAAO;AAAC2B,kBAAAA,IAAI,EAAE,EAAA;AAAG,iBAClD,CAAA,CAAA;AAAA,eAAA,EAPOF,SAOF,CAAC,CAAA;aAET,CAAA;AAAC,WACI,CACR,eAAAhB,GAAA,CAACmB,WAAW,EAAA;AACVC,YAAAA,IAAI,EAAC,MAAM;AACX,YAAA,iBAAA,EAAiB3B,OAAQ;AACzBS,YAAAA,IAAI,EAAEP,SAAU;AAChB0B,YAAAA,OAAO,EAAEA,MAAMzB,YAAY,CAAC,KAAK,CAAE;YAAAO,QAAA,eAEnCH,GAAA,CAACsB,IAAI,EAAA;AAAC/B,cAAAA,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"AnimatedLabel.mjs","sources":["../../../src/flowNavigation/animatedLabel/AnimatedLabel.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useState } from 'react';\n\nimport type { Step } from '../../stepper/Stepper';\nimport BottomSheet from '../../common/bottomSheet';\nimport Option from '../../common/Option';\nimport { Check, ChevronDown } from '@transferwise/icons';\nimport { OverlayIdContext, OverlayIdProvider } from '../../provider/overlay/OverlayIdProvider';\nimport { List } from '../../listItem';\n\nexport interface AnimatedLabelProps {\n activeLabel: number;\n className?: string;\n steps: readonly Step[];\n}\n\nconst AnimatedLabel = ({ activeLabel, className, steps }: AnimatedLabelProps) => {\n const labelId = useId();\n const [showSteps, setShowSteps] = useState(false);\n\n function handleStepAction(onClick: Step['onClick']) {\n return () => {\n setShowSteps(false);\n onClick?.();\n };\n }\n\n return (\n <OverlayIdProvider open={showSteps}>\n <OverlayIdContext.Consumer>\n {(overlayId) => {\n return (\n <>\n <button\n type=\"button\"\n id={labelId}\n aria-haspopup=\"menu\"\n aria-controls={overlayId}\n aria-expanded={showSteps}\n className={clsx(\n 'np-animated-label',\n 'btn-unstyled',\n 'np-text-body-large-bold',\n className,\n )}\n onClick={() => setShowSteps(true)}\n >\n {steps.map(({ label }, index) => {\n const isCurrentStep = activeLabel === index;\n const nextLabel = index - 1;\n return (\n <div\n key={nextLabel}\n aria-hidden={!isCurrentStep}\n className={clsx('text-xs-center', 'd-inline-flex', {\n 'np-animated-label--in text-ellipsis': isCurrentStep,\n })}\n >\n {label} <ChevronDown className=\"m-l-1\" size={24} />\n </div>\n );\n })}\n </button>\n <BottomSheet\n role=\"menu\"\n aria-labelledby={labelId}\n open={showSteps}\n onClose={() => setShowSteps(false)}\n >\n <List className=\"m-b-0 p-a-1\">\n {steps.map((step, index) => {\n const isCurrentStep = activeLabel === index;\n const isDisabled = activeLabel < index;\n const itemId = `step-${index}`;\n return (\n <Option\n key={itemId}\n id={itemId}\n as=\"li\"\n role=\"menuitem\"\n decision={false}\n className={clsx('np-animated-label-option', 'p-x-3', 'p-y-1', 'm-y-1', {\n clickable: !isDisabled,\n })}\n title={step.label}\n content={step.hoverLabel}\n button={isCurrentStep ? <Check size={24} /> : null}\n aria-current={isCurrentStep ? 'step' : false}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n isContainerAligned\n {...(!isDisabled && {\n tabIndex: 0,\n onClick: handleStepAction(step.onClick),\n onKeyDown: (event) => {\n event.preventDefault();\n if (event.code === 'Enter' || event.code === 'Space') {\n handleStepAction(step.onClick)();\n }\n },\n })}\n />\n );\n })}\n </List>\n </BottomSheet>\n </>\n );\n }}\n </OverlayIdContext.Consumer>\n </OverlayIdProvider>\n );\n};\n\nexport default AnimatedLabel;\n"],"names":["AnimatedLabel","activeLabel","className","steps","labelId","useId","showSteps","setShowSteps","useState","handleStepAction","onClick","_jsx","OverlayIdProvider","open","children","OverlayIdContext","Consumer","overlayId","_jsxs","_Fragment","type","id","clsx","map","label","index","isCurrentStep","nextLabel","ChevronDown","size","BottomSheet","role","onClose","List","step","isDisabled","itemId","Option","as","decision","clickable","title","content","hoverLabel","button","Check","disabled","isContainerAligned","tabIndex","onKeyDown","event","preventDefault","code"],"mappings":";;;;;;;;;;AAgBMA,MAAAA,aAAa,GAAGA,CAAC;EAAEC,WAAW;EAAEC,SAAS;AAAEC,EAAAA,KAAAA;AAA2B,CAAA,KAAI;AAC9E,EAAA,MAAMC,OAAO,GAAGC,KAAK,EAAE,CAAA;EACvB,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGC,QAAQ,CAAC,KAAK,CAAC,CAAA;EAEjD,SAASC,gBAAgBA,CAACC,OAAwB,EAAA;AAChD,IAAA,OAAO,MAAK;MACVH,YAAY,CAAC,KAAK,CAAC,CAAA;AACnBG,MAAAA,OAAO,IAAI,CAAA;KACZ,CAAA;AACH,GAAA;EAEA,oBACEC,GAAA,CAACC,iBAAiB,EAAA;AAACC,IAAAA,IAAI,EAAEP,SAAU;AAAAQ,IAAAA,QAAA,eACjCH,GAAA,CAACI,gBAAgB,CAACC,QAAQ,EAAA;MAAAF,QAAA,EACtBG,SAAS,IAAI;QACb,oBACEC,IAAA,CAAAC,QAAA,EAAA;AAAAL,UAAAA,QAAA,gBACEH,GAAA,CAAA,QAAA,EAAA;AACES,YAAAA,IAAI,EAAC,QAAQ;AACbC,YAAAA,EAAE,EAAEjB,OAAQ;AACZ,YAAA,eAAA,EAAc,MAAM;AACpB,YAAA,eAAA,EAAea,SAAU;AACzB,YAAA,eAAA,EAAeX,SAAU;YACzBJ,SAAS,EAAEoB,IAAI,CACb,mBAAmB,EACnB,cAAc,EACd,yBAAyB,EACzBpB,SAAS,CACT;AACFQ,YAAAA,OAAO,EAAEA,MAAMH,YAAY,CAAC,IAAI,CAAE;AAAAO,YAAAA,QAAA,EAEj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package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-8419611",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
"rollup-preserve-directives": "^1.1.1",
|
|
94
94
|
"storybook": "^8.2.2",
|
|
95
95
|
"@transferwise/less-config": "3.1.0",
|
|
96
|
-
"@
|
|
97
|
-
"@
|
|
96
|
+
"@transferwise/neptune-css": "14.15.0",
|
|
97
|
+
"@wise/components-theming": "1.6.0"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"@transferwise/icons": "^3.7.0",
|
package/src/drawer/Drawer.tsx
CHANGED
|
@@ -54,7 +54,7 @@ export default function Drawer({
|
|
|
54
54
|
id={overlayId}
|
|
55
55
|
role={role}
|
|
56
56
|
aria-modal
|
|
57
|
-
aria-labelledby={
|
|
57
|
+
aria-labelledby={ariaLabelledBy || (headerTitle ? titleId : undefined)}
|
|
58
58
|
className={clsx('np-drawer', className)}
|
|
59
59
|
>
|
|
60
60
|
<div
|
|
@@ -67,7 +67,7 @@ const AnimatedLabel = ({ activeLabel, className, steps }: AnimatedLabelProps) =>
|
|
|
67
67
|
open={showSteps}
|
|
68
68
|
onClose={() => setShowSteps(false)}
|
|
69
69
|
>
|
|
70
|
-
<List className="p-a-1">
|
|
70
|
+
<List className="m-b-0 p-a-1">
|
|
71
71
|
{steps.map((step, index) => {
|
|
72
72
|
const isCurrentStep = activeLabel === index;
|
|
73
73
|
const isDisabled = activeLabel < index;
|