@transferwise/components 0.0.0-experimental-4c596c1 → 0.0.0-experimental-b0617fc
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 +4 -2
- package/build/drawer/Drawer.js.map +1 -1
- package/build/drawer/Drawer.mjs +4 -2
- package/build/drawer/Drawer.mjs.map +1 -1
- package/build/main.css +9 -0
- package/build/modal/Modal.js.map +1 -1
- package/build/modal/Modal.mjs.map +1 -1
- package/build/styles/drawer/Drawer.css +9 -0
- package/build/styles/main.css +9 -0
- package/build/types/drawer/Drawer.d.ts.map +1 -1
- package/build/types/modal/Modal.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/accordion/Accordion.story.tsx +1 -1
- package/src/drawer/Drawer.css +9 -0
- package/src/drawer/Drawer.less +6 -1
- package/src/drawer/Drawer.story.tsx +39 -3
- package/src/drawer/Drawer.tsx +6 -3
- package/src/main.css +9 -0
- package/src/modal/Modal.tsx +0 -1
package/build/drawer/Drawer.js
CHANGED
|
@@ -74,7 +74,7 @@ function Drawer({
|
|
|
74
74
|
children: [headerTitle && /*#__PURE__*/jsxRuntime.jsx(Title.default, {
|
|
75
75
|
id: titleId,
|
|
76
76
|
type: typography.Typography.TITLE_SUBSECTION,
|
|
77
|
-
className: "
|
|
77
|
+
className: "np-drawer-title",
|
|
78
78
|
children: headerTitle
|
|
79
79
|
}), /*#__PURE__*/jsxRuntime.jsx(IconButton.default, {
|
|
80
80
|
size: 40,
|
|
@@ -86,9 +86,11 @@ function Drawer({
|
|
|
86
86
|
}), children && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
87
87
|
className: clsx.clsx('np-drawer-content'),
|
|
88
88
|
children: children
|
|
89
|
-
}), footerContent
|
|
89
|
+
}), footerContent ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
90
90
|
className: clsx.clsx('np-drawer-footer'),
|
|
91
91
|
children: footerContent
|
|
92
|
+
}) : /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
93
|
+
className: "m-t-3"
|
|
92
94
|
})]
|
|
93
95
|
})
|
|
94
96
|
})
|
|
@@ -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 {
|
|
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 { 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';\nimport IconButton from '../iconButton';\nimport closeBtnMessages from '../common/closeButton/CloseButton.messages';\nimport { useIntl } from 'react-intl';\nimport { Cross } from '@transferwise/icons';\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 onUnmount?: () => void;\n} & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>;\n\nexport default function Drawer({\n children,\n className,\n footerContent,\n headerTitle,\n onClose,\n onUnmount,\n open = false,\n position = 'right',\n role = 'dialog',\n 'aria-labelledby': ariaLabelledBy,\n}: DrawerProps) {\n const intl = useIntl();\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} onExited={onUnmount}>\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(\n 'np-drawer-header',\n 'd-flex',\n 'align-items-center',\n headerTitle ? 'justify-content-between' : 'justify-content-end',\n 'flex-wrap',\n )}\n >\n {headerTitle && (\n <Title id={titleId} type={Typography.TITLE_SUBSECTION} className=\"np-drawer-title\">\n {headerTitle}\n </Title>\n )}\n <IconButton\n size={40}\n priority=\"tertiary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onClose}\n >\n <Cross />\n </IconButton>\n </div>\n {children && <div className={clsx('np-drawer-content')}>{children}</div>}\n {footerContent ? (\n <div className={clsx('np-drawer-footer')}>{footerContent}</div>\n ) : (\n <div className=\"m-t-3\" />\n )}\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n}\n"],"names":["Drawer","children","className","footerContent","headerTitle","onClose","onUnmount","open","position","role","ariaLabelledBy","intl","useIntl","logActionRequiredIf","isMobile","useLayout","titleId","useId","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","onExited","SlidingPanel","Position","BOTTOM","_jsxs","id","undefined","clsx","Title","type","Typography","TITLE_SUBSECTION","IconButton","size","priority","formatMessage","closeBtnMessages","ariaLabel","onClick","Cross"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCc,SAAUA,MAAMA,CAAC;EAC7BC,QAAQ;EACRC,SAAS;EACTC,aAAa;EACbC,WAAW;EACXC,OAAO;EACPC,SAAS;AACTC,EAAAA,IAAI,GAAG,KAAK;AACZC,YAAAA,UAAQ,GAAG,OAAO;AAClBC,EAAAA,IAAI,GAAG,QAAQ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;AAAChC,YAAAA,SAAS,EAAC,iBAAiB;AAAAD,YAAAA,QAAA,EAC/EG;AAAW,WACP,CACR,eACDiB,cAAA,CAACc,kBAAU,EAAA;AACTC,YAAAA,IAAI,EAAE,EAAG;AACTC,YAAAA,QAAQ,EAAC,UAAU;AACnB,YAAA,YAAA,EAAY1B,IAAI,CAAC2B,aAAa,CAACC,4BAAgB,CAACC,SAAS,CAAE;AAC3DC,YAAAA,OAAO,EAAEpC,OAAQ;AAAAJ,YAAAA,QAAA,eAEjBoB,cAAA,CAACqB,WAAK,EAAA,EAAA;AACR,WAAY,CACd;AAAA,SAAK,CACL,EAACzC,QAAQ,iBAAIoB,cAAA,CAAA,KAAA,EAAA;AAAKnB,UAAAA,SAAS,EAAE4B,SAAI,CAAC,mBAAmB,CAAE;AAAA7B,UAAAA,QAAA,EAAEA;AAAQ,SAAM,CAAC,EACvEE,aAAa,gBACZkB,cAAA,CAAA,KAAA,EAAA;AAAKnB,UAAAA,SAAS,EAAE4B,SAAI,CAAC,kBAAkB,CAAE;AAAA7B,UAAAA,QAAA,EAAEE;SAAmB,CAAC,gBAE/DkB,cAAA,CAAA,KAAA,EAAA;AAAKnB,UAAAA,SAAS,EAAC;AAAO,SAAA,CACvB;OACE;KACO;AAChB,GAAQ,CAAC;AAEb;;;;"}
|
package/build/drawer/Drawer.mjs
CHANGED
|
@@ -70,7 +70,7 @@ function Drawer({
|
|
|
70
70
|
children: [headerTitle && /*#__PURE__*/jsx(Title, {
|
|
71
71
|
id: titleId,
|
|
72
72
|
type: Typography.TITLE_SUBSECTION,
|
|
73
|
-
className: "
|
|
73
|
+
className: "np-drawer-title",
|
|
74
74
|
children: headerTitle
|
|
75
75
|
}), /*#__PURE__*/jsx(IconButton, {
|
|
76
76
|
size: 40,
|
|
@@ -82,9 +82,11 @@ function Drawer({
|
|
|
82
82
|
}), children && /*#__PURE__*/jsx("div", {
|
|
83
83
|
className: clsx('np-drawer-content'),
|
|
84
84
|
children: children
|
|
85
|
-
}), footerContent
|
|
85
|
+
}), footerContent ? /*#__PURE__*/jsx("div", {
|
|
86
86
|
className: clsx('np-drawer-footer'),
|
|
87
87
|
children: footerContent
|
|
88
|
+
}) : /*#__PURE__*/jsx("div", {
|
|
89
|
+
className: "m-t-3"
|
|
88
90
|
})]
|
|
89
91
|
})
|
|
90
92
|
})
|
|
@@ -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 {
|
|
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 { 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';\nimport IconButton from '../iconButton';\nimport closeBtnMessages from '../common/closeButton/CloseButton.messages';\nimport { useIntl } from 'react-intl';\nimport { Cross } from '@transferwise/icons';\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 onUnmount?: () => void;\n} & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>;\n\nexport default function Drawer({\n children,\n className,\n footerContent,\n headerTitle,\n onClose,\n onUnmount,\n open = false,\n position = 'right',\n role = 'dialog',\n 'aria-labelledby': ariaLabelledBy,\n}: DrawerProps) {\n const intl = useIntl();\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} onExited={onUnmount}>\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(\n 'np-drawer-header',\n 'd-flex',\n 'align-items-center',\n headerTitle ? 'justify-content-between' : 'justify-content-end',\n 'flex-wrap',\n )}\n >\n {headerTitle && (\n <Title id={titleId} type={Typography.TITLE_SUBSECTION} className=\"np-drawer-title\">\n {headerTitle}\n </Title>\n )}\n <IconButton\n size={40}\n priority=\"tertiary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onClose}\n >\n <Cross />\n </IconButton>\n </div>\n {children && <div className={clsx('np-drawer-content')}>{children}</div>}\n {footerContent ? (\n <div className={clsx('np-drawer-footer')}>{footerContent}</div>\n ) : (\n <div className=\"m-t-3\" />\n )}\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n}\n"],"names":["Drawer","children","className","footerContent","headerTitle","onClose","onUnmount","open","position","role","ariaLabelledBy","intl","useIntl","logActionRequiredIf","isMobile","useLayout","titleId","useId","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","onExited","SlidingPanel","Position","BOTTOM","_jsxs","id","undefined","clsx","Title","type","Typography","TITLE_SUBSECTION","IconButton","size","priority","formatMessage","closeBtnMessages","ariaLabel","onClick","Cross"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCc,SAAUA,MAAMA,CAAC;EAC7BC,QAAQ;EACRC,SAAS;EACTC,aAAa;EACbC,WA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EDG,WAAW,iBACViB,GAAA,CAACU,KAAK,EAAA;AAACH,YAAAA,EAAE,EAAEZ,OAAQ;YAACgB,IAAI,EAAEC,UAAU,CAACC,gBAAiB;AAAChC,YAAAA,SAAS,EAAC,iBAAiB;AAAAD,YAAAA,QAAA,EAC/EG;AAAW,WACP,CACR,eACDiB,GAAA,CAACc,UAAU,EAAA;AACTC,YAAAA,IAAI,EAAE,EAAG;AACTC,YAAAA,QAAQ,EAAC,UAAU;AACnB,YAAA,YAAA,EAAY1B,IAAI,CAAC2B,aAAa,CAACC,gBAAgB,CAACC,SAAS,CAAE;AAC3DC,YAAAA,OAAO,EAAEpC,OAAQ;AAAAJ,YAAAA,QAAA,eAEjBoB,GAAA,CAACqB,KAAK,EAAA,EAAA;AACR,WAAY,CACd;AAAA,SAAK,CACL,EAACzC,QAAQ,iBAAIoB,GAAA,CAAA,KAAA,EAAA;AAAKnB,UAAAA,SAAS,EAAE4B,IAAI,CAAC,mBAAmB,CAAE;AAAA7B,UAAAA,QAAA,EAAEA;AAAQ,SAAM,CAAC,EACvEE,aAAa,gBACZkB,GAAA,CAAA,KAAA,EAAA;AAAKnB,UAAAA,SAAS,EAAE4B,IAAI,CAAC,kBAAkB,CAAE;AAAA7B,UAAAA,QAAA,EAAEE;SAAmB,CAAC,gBAE/DkB,GAAA,CAAA,KAAA,EAAA;AAAKnB,UAAAA,SAAS,EAAC;AAAO,SAAA,CACvB;OACE;KACO;AAChB,GAAQ,CAAC;AAEb;;;;"}
|
package/build/main.css
CHANGED
|
@@ -2319,6 +2319,12 @@ button.np-option {
|
|
|
2319
2319
|
max-height: 100vh;
|
|
2320
2320
|
max-height: 100dvh;
|
|
2321
2321
|
}
|
|
2322
|
+
@media (max-width: 770px) {
|
|
2323
|
+
.np-drawer {
|
|
2324
|
+
max-width: none;
|
|
2325
|
+
max-width: initial;
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2322
2328
|
.np-drawer .np-drawer-header {
|
|
2323
2329
|
min-height: 56px;
|
|
2324
2330
|
min-height: var(--size-56);
|
|
@@ -2331,6 +2337,9 @@ button.np-option {
|
|
|
2331
2337
|
padding: var(--size-16);
|
|
2332
2338
|
}
|
|
2333
2339
|
}
|
|
2340
|
+
.np-drawer .np-drawer-title {
|
|
2341
|
+
max-width: 85%;
|
|
2342
|
+
}
|
|
2334
2343
|
.np-drawer .np-drawer-content {
|
|
2335
2344
|
overflow-y: auto;
|
|
2336
2345
|
flex: 1;
|
package/build/modal/Modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sources":["../../src/modal/Modal.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode, useContext, useId, useRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n Position,\n PositionTop,\n PositionCenter,\n Scroll,\n CommonProps,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n SizeExtraLarge,\n ScrollContent,\n ScrollViewport,\n Typography,\n} from '../common';\nimport {
|
|
1
|
+
{"version":3,"file":"Modal.js","sources":["../../src/modal/Modal.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode, useContext, useId, useRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n Position,\n PositionTop,\n PositionCenter,\n Scroll,\n CommonProps,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n SizeExtraLarge,\n ScrollContent,\n ScrollViewport,\n Typography,\n} from '../common';\nimport { useLayout } from '../common/hooks';\nimport Dimmer from '../dimmer';\nimport Drawer from '../drawer';\nimport { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';\nimport Title from '../title/Title';\nimport { Cross } from '@transferwise/icons';\nimport IconButton from '../iconButton';\nimport closeBtnMessages from '../common/closeButton/CloseButton.messages';\n\nconst TRANSITION_DURATION_IN_MILLISECONDS = 150;\n\nexport type ModalProps = CommonProps & {\n title?: ReactNode;\n body: ReactNode;\n footer?: ReactNode;\n size?: SizeSmall | SizeMedium | SizeLarge | SizeExtraLarge;\n onClose: () => void;\n onUnmount?: () => void;\n open: boolean;\n scroll?: ScrollContent | ScrollViewport;\n position?: PositionTop | PositionCenter;\n disableDimmerClickToClose?: boolean;\n};\n\nconst Modal = ({\n title = null,\n body,\n footer = null,\n onClose,\n onUnmount,\n className,\n open,\n size = Size.MEDIUM,\n scroll = Scroll.VIEWPORT,\n position = Position.CENTER,\n disableDimmerClickToClose = false,\n ...otherProps\n}: ModalProps) => {\n const intl = useIntl();\n const { isMedium } = useLayout();\n\n const contentReference = useRef<HTMLDivElement>(null);\n const titleId = useId();\n\n const overlayId = useContext(OverlayIdContext);\n\n return !isMedium ? (\n <Drawer\n open={open}\n headerTitle={title}\n footerContent={footer}\n position={Position.BOTTOM}\n onClose={onClose}\n onUnmount={onUnmount}\n >\n {body}\n </Drawer>\n ) : (\n <Dimmer\n open={open}\n scrollable={scroll === Scroll.VIEWPORT}\n contentPosition={position}\n disableClickToClose={disableDimmerClickToClose}\n onClose={onClose}\n onExited={onUnmount}\n >\n <CSSTransition\n nodeRef={contentReference}\n appear\n in={open}\n classNames={{ enterDone: 'in' }}\n timeout={TRANSITION_DURATION_IN_MILLISECONDS}\n unmountOnExit\n >\n <div\n ref={contentReference}\n className={clsx(\n 'tw-modal',\n 'd-flex',\n 'fade',\n 'outline-none',\n scroll === Scroll.CONTENT && 'tw-modal--scrollable',\n className,\n )}\n {...otherProps}\n >\n <div\n id={overlayId}\n role=\"dialog\"\n aria-modal\n aria-labelledby={titleId}\n className={clsx('tw-modal-dialog', 'd-flex', {\n [`tw-modal-${size}`]: size,\n })}\n >\n <div\n className={clsx(\n 'tw-modal-content',\n 'd-flex',\n 'flex-column',\n 'justify-content-between',\n )}\n >\n <div\n className={clsx(\n 'tw-modal-header',\n 'd-flex',\n 'align-items-center',\n title ? 'justify-content-between' : 'justify-content-end',\n 'flex-wrap',\n )}\n >\n {title && (\n <Title id={titleId} type={Typography.TITLE_SUBSECTION} className=\"tw-modal-title\">\n {title}\n </Title>\n )}\n <IconButton\n size={40}\n priority=\"tertiary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onClose}\n >\n <Cross />\n </IconButton>\n </div>\n <div\n className={clsx('tw-modal-body', {\n 'tw-modal-body--scrollable': scroll === Scroll.CONTENT,\n })}\n >\n {body}\n </div>\n {footer ? (\n <div\n className={clsx('tw-modal-footer', 'd-flex', 'align-items-center', 'flex-wrap')}\n >\n {footer}\n </div>\n ) : (\n <div className=\"m-t-3\" />\n )}\n </div>\n </div>\n </div>\n </CSSTransition>\n </Dimmer>\n );\n};\n\nexport default Modal;\n"],"names":["TRANSITION_DURATION_IN_MILLISECONDS","Modal","title","body","footer","onClose","onUnmount","className","open","size","Size","MEDIUM","scroll","Scroll","VIEWPORT","position","Position","CENTER","disableDimmerClickToClose","otherProps","intl","useIntl","isMedium","useLayout","contentReference","useRef","titleId","useId","overlayId","useContext","OverlayIdContext","_jsx","Drawer","headerTitle","footerContent","BOTTOM","children","Dimmer","scrollable","contentPosition","disableClickToClose","onExited","CSSTransition","nodeRef","appear","in","classNames","enterDone","timeout","unmountOnExit","ref","clsx","CONTENT","id","role","_jsxs","Title","type","Typography","TITLE_SUBSECTION","IconButton","priority","formatMessage","closeBtnMessages","ariaLabel","onClick","Cross"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAMA,mCAAmC,GAAG,GAAG;AAe/C,MAAMC,KAAK,GAAGA,CAAC;AACbC,EAAAA,KAAK,GAAG,IAAI;EACZC,IAAI;AACJC,EAAAA,MAAM,GAAG,IAAI;EACbC,OAAO;EACPC,SAAS;EACTC,SAAS;EACTC,IAAI;QACJC,MAAI,GAAGC,SAAI,CAACC,MAAM;UAClBC,QAAM,GAAGC,aAAM,CAACC,QAAQ;YACxBC,UAAQ,GAAGC,iBAAQ,CAACC,MAAM;AAC1BC,EAAAA,yBAA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EAAYzC,IAAI,CAAC0C,aAAa,CAACC,4BAAgB,CAACC,SAAS,CAAE;AAC3DC,gBAAAA,OAAO,EAAE5D,OAAQ;AAAA+B,gBAAAA,QAAA,eAEjBL,cAAA,CAACmC,WAAK,EAAA,EAAA;AACR,eAAY,CACd;aAAK,CACL,eAAAnC,cAAA,CAAA,KAAA,EAAA;AACExB,cAAAA,SAAS,EAAE4C,SAAI,CAAC,eAAe,EAAE;AAC/B,gBAAA,2BAA2B,EAAEvC,QAAM,KAAKC,aAAM,CAACuC;AAChD,eAAA,CAAE;AAAAhB,cAAAA,QAAA,EAEFjC;AAAI,aACF,CACL,EAACC,MAAM,gBACL2B,cAAA,CAAA,KAAA,EAAA;cACExB,SAAS,EAAE4C,SAAI,CAAC,iBAAiB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,WAAW,CAAE;AAAAf,cAAAA,QAAA,EAE/EhC;aACE,CAAC,gBAEN2B,cAAA,CAAA,KAAA,EAAA;AAAKxB,cAAAA,SAAS,EAAC;AAAO,aAAA,CACvB;WACE;SACF;OACF;KACQ;AACjB,GAAQ,CACT;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.mjs","sources":["../../src/modal/Modal.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode, useContext, useId, useRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n Position,\n PositionTop,\n PositionCenter,\n Scroll,\n CommonProps,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n SizeExtraLarge,\n ScrollContent,\n ScrollViewport,\n Typography,\n} from '../common';\nimport {
|
|
1
|
+
{"version":3,"file":"Modal.mjs","sources":["../../src/modal/Modal.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode, useContext, useId, useRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n Position,\n PositionTop,\n PositionCenter,\n Scroll,\n CommonProps,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n SizeExtraLarge,\n ScrollContent,\n ScrollViewport,\n Typography,\n} from '../common';\nimport { useLayout } from '../common/hooks';\nimport Dimmer from '../dimmer';\nimport Drawer from '../drawer';\nimport { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';\nimport Title from '../title/Title';\nimport { Cross } from '@transferwise/icons';\nimport IconButton from '../iconButton';\nimport closeBtnMessages from '../common/closeButton/CloseButton.messages';\n\nconst TRANSITION_DURATION_IN_MILLISECONDS = 150;\n\nexport type ModalProps = CommonProps & {\n title?: ReactNode;\n body: ReactNode;\n footer?: ReactNode;\n size?: SizeSmall | SizeMedium | SizeLarge | SizeExtraLarge;\n onClose: () => void;\n onUnmount?: () => void;\n open: boolean;\n scroll?: ScrollContent | ScrollViewport;\n position?: PositionTop | PositionCenter;\n disableDimmerClickToClose?: boolean;\n};\n\nconst Modal = ({\n title = null,\n body,\n footer = null,\n onClose,\n onUnmount,\n className,\n open,\n size = Size.MEDIUM,\n scroll = Scroll.VIEWPORT,\n position = Position.CENTER,\n disableDimmerClickToClose = false,\n ...otherProps\n}: ModalProps) => {\n const intl = useIntl();\n const { isMedium } = useLayout();\n\n const contentReference = useRef<HTMLDivElement>(null);\n const titleId = useId();\n\n const overlayId = useContext(OverlayIdContext);\n\n return !isMedium ? (\n <Drawer\n open={open}\n headerTitle={title}\n footerContent={footer}\n position={Position.BOTTOM}\n onClose={onClose}\n onUnmount={onUnmount}\n >\n {body}\n </Drawer>\n ) : (\n <Dimmer\n open={open}\n scrollable={scroll === Scroll.VIEWPORT}\n contentPosition={position}\n disableClickToClose={disableDimmerClickToClose}\n onClose={onClose}\n onExited={onUnmount}\n >\n <CSSTransition\n nodeRef={contentReference}\n appear\n in={open}\n classNames={{ enterDone: 'in' }}\n timeout={TRANSITION_DURATION_IN_MILLISECONDS}\n unmountOnExit\n >\n <div\n ref={contentReference}\n className={clsx(\n 'tw-modal',\n 'd-flex',\n 'fade',\n 'outline-none',\n scroll === Scroll.CONTENT && 'tw-modal--scrollable',\n className,\n )}\n {...otherProps}\n >\n <div\n id={overlayId}\n role=\"dialog\"\n aria-modal\n aria-labelledby={titleId}\n className={clsx('tw-modal-dialog', 'd-flex', {\n [`tw-modal-${size}`]: size,\n })}\n >\n <div\n className={clsx(\n 'tw-modal-content',\n 'd-flex',\n 'flex-column',\n 'justify-content-between',\n )}\n >\n <div\n className={clsx(\n 'tw-modal-header',\n 'd-flex',\n 'align-items-center',\n title ? 'justify-content-between' : 'justify-content-end',\n 'flex-wrap',\n )}\n >\n {title && (\n <Title id={titleId} type={Typography.TITLE_SUBSECTION} className=\"tw-modal-title\">\n {title}\n </Title>\n )}\n <IconButton\n size={40}\n priority=\"tertiary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onClose}\n >\n <Cross />\n </IconButton>\n </div>\n <div\n className={clsx('tw-modal-body', {\n 'tw-modal-body--scrollable': scroll === Scroll.CONTENT,\n })}\n >\n {body}\n </div>\n {footer ? (\n <div\n className={clsx('tw-modal-footer', 'd-flex', 'align-items-center', 'flex-wrap')}\n >\n {footer}\n </div>\n ) : (\n <div className=\"m-t-3\" />\n )}\n </div>\n </div>\n </div>\n </CSSTransition>\n </Dimmer>\n );\n};\n\nexport default Modal;\n"],"names":["TRANSITION_DURATION_IN_MILLISECONDS","Modal","title","body","footer","onClose","onUnmount","className","open","size","Size","MEDIUM","scroll","Scroll","VIEWPORT","position","Position","CENTER","disableDimmerClickToClose","otherProps","intl","useIntl","isMedium","useLayout","contentReference","useRef","titleId","useId","overlayId","useContext","OverlayIdContext","_jsx","Drawer","headerTitle","footerContent","BOTTOM","children","Dimmer","scrollable","contentPosition","disableClickToClose","onExited","CSSTransition","nodeRef","appear","in","classNames","enterDone","timeout","unmountOnExit","ref","clsx","CONTENT","id","role","_jsxs","Title","type","Typography","TITLE_SUBSECTION","IconButton","priority","formatMessage","closeBtnMessages","ariaLabel","onClick","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|
|
15
|
+
max-width: initial;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
12
18
|
.np-drawer .np-drawer-header {
|
|
13
19
|
min-height: 56px;
|
|
14
20
|
min-height: var(--size-56);
|
|
@@ -21,6 +27,9 @@
|
|
|
21
27
|
padding: var(--size-16);
|
|
22
28
|
}
|
|
23
29
|
}
|
|
30
|
+
.np-drawer .np-drawer-title {
|
|
31
|
+
max-width: 85%;
|
|
32
|
+
}
|
|
24
33
|
.np-drawer .np-drawer-content {
|
|
25
34
|
overflow-y: auto;
|
|
26
35
|
flex: 1;
|
package/build/styles/main.css
CHANGED
|
@@ -2319,6 +2319,12 @@ button.np-option {
|
|
|
2319
2319
|
max-height: 100vh;
|
|
2320
2320
|
max-height: 100dvh;
|
|
2321
2321
|
}
|
|
2322
|
+
@media (max-width: 770px) {
|
|
2323
|
+
.np-drawer {
|
|
2324
|
+
max-width: none;
|
|
2325
|
+
max-width: initial;
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2322
2328
|
.np-drawer .np-drawer-header {
|
|
2323
2329
|
min-height: 56px;
|
|
2324
2330
|
min-height: var(--size-56);
|
|
@@ -2331,6 +2337,9 @@ button.np-option {
|
|
|
2331
2337
|
padding: var(--size-16);
|
|
2332
2338
|
}
|
|
2333
2339
|
}
|
|
2340
|
+
.np-drawer .np-drawer-title {
|
|
2341
|
+
max-width: 85%;
|
|
2342
|
+
}
|
|
2334
2343
|
.np-drawer .np-drawer-content {
|
|
2335
2344
|
overflow-y: auto;
|
|
2336
2345
|
flex: 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/drawer/Drawer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAqB,MAAM,OAAO,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAc,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/drawer/Drawer.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AAc,EACd,aAAa,EACb,cAAc,EAEf,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/modal/Modal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAC;AAI7D,OAAO,EAGL,WAAW,EACX,cAAc,EAEd,WAAW,EACX,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,EACd,aAAa,EACb,cAAc,EAEf,MAAM,WAAW,CAAC;AAYnB,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IACrC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,cAAc,CAAC;IAC3D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,aAAa,GAAG,cAAc,CAAC;IACxC,QAAQ,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC;IACxC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,CAAC;AAEF,QAAA,MAAM,KAAK,GAAI,gIAaZ,UAAU,gCA+GZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -145,9 +145,9 @@ export const WithinModal: Story = {
|
|
|
145
145
|
Open Modal
|
|
146
146
|
</Button>
|
|
147
147
|
<Modal
|
|
148
|
+
title="Large transfer tips"
|
|
148
149
|
body={
|
|
149
150
|
<div className="p-a-1">
|
|
150
|
-
<h3 className="m-t-2 m-b-4 text-xs-center">Large transfer tips</h3>
|
|
151
151
|
<Accordion {...args} items={[items[0]]} />
|
|
152
152
|
<Accordion {...args} items={[items[0]]} indexOpen={0} />
|
|
153
153
|
<Accordion {...args} items={items} />
|
package/src/drawer/Drawer.css
CHANGED
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
max-height: 100vh;
|
|
10
10
|
max-height: 100dvh;
|
|
11
11
|
}
|
|
12
|
+
@media (max-width: 770px) {
|
|
13
|
+
.np-drawer {
|
|
14
|
+
max-width: none;
|
|
15
|
+
max-width: initial;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
12
18
|
.np-drawer .np-drawer-header {
|
|
13
19
|
min-height: 56px;
|
|
14
20
|
min-height: var(--size-56);
|
|
@@ -21,6 +27,9 @@
|
|
|
21
27
|
padding: var(--size-16);
|
|
22
28
|
}
|
|
23
29
|
}
|
|
30
|
+
.np-drawer .np-drawer-title {
|
|
31
|
+
max-width: 85%;
|
|
32
|
+
}
|
|
24
33
|
.np-drawer .np-drawer-content {
|
|
25
34
|
overflow-y: auto;
|
|
26
35
|
flex: 1;
|
package/src/drawer/Drawer.less
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
justify-content: space-between;
|
|
5
5
|
width: 100vw;
|
|
6
6
|
max-width: 600px;
|
|
7
|
+
@media (max-width: 770px) {
|
|
8
|
+
max-width: unset;
|
|
9
|
+
}
|
|
7
10
|
height: 100vh;
|
|
8
11
|
height: 100dvh;
|
|
9
12
|
max-height: 100vh;
|
|
@@ -16,7 +19,9 @@
|
|
|
16
19
|
padding: var(--size-16);
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
|
-
|
|
22
|
+
.np-drawer-title {
|
|
23
|
+
max-width: 85%;
|
|
24
|
+
}
|
|
20
25
|
.np-drawer-content {
|
|
21
26
|
overflow-y: auto;
|
|
22
27
|
flex: 1;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Position, Priority } from '../common';
|
|
3
|
-
import { Section, Button, Input, Modal, type DrawerProps } from '..';
|
|
3
|
+
import { Section, Button, Input, Modal, type DrawerProps, Body } from '..';
|
|
4
4
|
import Drawer from './Drawer';
|
|
5
|
-
import { lorem20, lorem40, lorem5 } from '../test-utils';
|
|
5
|
+
import { lorem10, lorem20, lorem40, lorem5 } from '../test-utils';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
component: Drawer,
|
|
@@ -78,6 +78,42 @@ export const Basic = {
|
|
|
78
78
|
},
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
+
export const LongTitle = {
|
|
82
|
+
args: {
|
|
83
|
+
open: true,
|
|
84
|
+
},
|
|
85
|
+
render: (args: DrawerProps) => {
|
|
86
|
+
const [openDrawer, setOpenDrawer] = useState(args.open);
|
|
87
|
+
return (
|
|
88
|
+
<>
|
|
89
|
+
<Button v2 block={false} onClick={() => setOpenDrawer(true)}>
|
|
90
|
+
Open drawer
|
|
91
|
+
</Button>
|
|
92
|
+
<Drawer
|
|
93
|
+
open={openDrawer}
|
|
94
|
+
headerTitle={lorem10}
|
|
95
|
+
footerContent={
|
|
96
|
+
<Button v2 block onClick={() => {}}>
|
|
97
|
+
Action 1
|
|
98
|
+
</Button>
|
|
99
|
+
}
|
|
100
|
+
onClose={() => {
|
|
101
|
+
setOpenDrawer(false);
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
<p>{lorem20}</p>
|
|
105
|
+
<p>{lorem40}</p>
|
|
106
|
+
<p>{lorem40}</p>
|
|
107
|
+
<p>{lorem40}</p>
|
|
108
|
+
<p>{lorem40}</p>
|
|
109
|
+
<p>{lorem40}</p>
|
|
110
|
+
<p>{lorem40}</p>
|
|
111
|
+
</Drawer>
|
|
112
|
+
</>
|
|
113
|
+
);
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
81
117
|
export const NoTitle = {
|
|
82
118
|
args: {
|
|
83
119
|
open: true,
|
|
@@ -137,7 +173,7 @@ export const NoFooter = {
|
|
|
137
173
|
<p>{lorem40}</p>
|
|
138
174
|
<p>{lorem40}</p>
|
|
139
175
|
<p>{lorem40}</p>
|
|
140
|
-
<
|
|
176
|
+
<Body>{lorem40}</Body>
|
|
141
177
|
</Drawer>
|
|
142
178
|
</>
|
|
143
179
|
);
|
package/src/drawer/Drawer.tsx
CHANGED
|
@@ -2,7 +2,6 @@ import { clsx } from 'clsx';
|
|
|
2
2
|
import { HTMLAttributes, useContext, useId } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Position, Typography } from '../common';
|
|
5
|
-
import { CloseButton } from '../common/closeButton';
|
|
6
5
|
import { useLayout } from '../common/hooks';
|
|
7
6
|
import Dimmer from '../dimmer';
|
|
8
7
|
import { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';
|
|
@@ -74,7 +73,7 @@ export default function Drawer({
|
|
|
74
73
|
)}
|
|
75
74
|
>
|
|
76
75
|
{headerTitle && (
|
|
77
|
-
<Title id={titleId} type={Typography.TITLE_SUBSECTION} className="
|
|
76
|
+
<Title id={titleId} type={Typography.TITLE_SUBSECTION} className="np-drawer-title">
|
|
78
77
|
{headerTitle}
|
|
79
78
|
</Title>
|
|
80
79
|
)}
|
|
@@ -88,7 +87,11 @@ export default function Drawer({
|
|
|
88
87
|
</IconButton>
|
|
89
88
|
</div>
|
|
90
89
|
{children && <div className={clsx('np-drawer-content')}>{children}</div>}
|
|
91
|
-
{footerContent
|
|
90
|
+
{footerContent ? (
|
|
91
|
+
<div className={clsx('np-drawer-footer')}>{footerContent}</div>
|
|
92
|
+
) : (
|
|
93
|
+
<div className="m-t-3" />
|
|
94
|
+
)}
|
|
92
95
|
</div>
|
|
93
96
|
</SlidingPanel>
|
|
94
97
|
</Dimmer>
|
package/src/main.css
CHANGED
|
@@ -2319,6 +2319,12 @@ button.np-option {
|
|
|
2319
2319
|
max-height: 100vh;
|
|
2320
2320
|
max-height: 100dvh;
|
|
2321
2321
|
}
|
|
2322
|
+
@media (max-width: 770px) {
|
|
2323
|
+
.np-drawer {
|
|
2324
|
+
max-width: none;
|
|
2325
|
+
max-width: initial;
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2322
2328
|
.np-drawer .np-drawer-header {
|
|
2323
2329
|
min-height: 56px;
|
|
2324
2330
|
min-height: var(--size-56);
|
|
@@ -2331,6 +2337,9 @@ button.np-option {
|
|
|
2331
2337
|
padding: var(--size-16);
|
|
2332
2338
|
}
|
|
2333
2339
|
}
|
|
2340
|
+
.np-drawer .np-drawer-title {
|
|
2341
|
+
max-width: 85%;
|
|
2342
|
+
}
|
|
2334
2343
|
.np-drawer .np-drawer-content {
|
|
2335
2344
|
overflow-y: auto;
|
|
2336
2345
|
flex: 1;
|
package/src/modal/Modal.tsx
CHANGED