@transferwise/components 46.12.0 → 46.13.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/index.esm.js +18 -6
- package/build/index.esm.js.map +1 -1
- package/build/index.js +18 -6
- package/build/index.js.map +1 -1
- package/build/types/drawer/Drawer.d.ts.map +1 -1
- package/build/types/modal/Modal.d.ts.map +1 -1
- package/build/types/popover/Popover.d.ts +1 -0
- package/build/types/popover/Popover.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/drawer/Drawer.js +13 -2
- package/src/drawer/__snapshots__/Drawer.rtl.spec.js.snap +1 -0
- package/src/modal/Modal.tsx +6 -3
- package/src/popover/Popover.js +7 -3
- package/src/popover/Popover.spec.js +16 -8
- package/src/popover/__snapshots__/Popover.spec.js.snap +0 -56
package/build/index.esm.js
CHANGED
|
@@ -1867,6 +1867,7 @@ const Drawer = ({
|
|
|
1867
1867
|
const {
|
|
1868
1868
|
isMobile
|
|
1869
1869
|
} = useLayout();
|
|
1870
|
+
const titleId = useId();
|
|
1870
1871
|
return /*#__PURE__*/jsx(Dimmer$1, {
|
|
1871
1872
|
open: open,
|
|
1872
1873
|
onClose: onClose,
|
|
@@ -1874,13 +1875,16 @@ const Drawer = ({
|
|
|
1874
1875
|
open: open,
|
|
1875
1876
|
position: isMobile ? Position.BOTTOM : position,
|
|
1876
1877
|
children: /*#__PURE__*/jsxs("div", {
|
|
1877
|
-
className: classNames('np-drawer', className),
|
|
1878
1878
|
role: "dialog",
|
|
1879
|
+
"aria-modal": true,
|
|
1880
|
+
"aria-labelledby": headerTitle ? titleId : undefined,
|
|
1881
|
+
className: classNames('np-drawer', className),
|
|
1879
1882
|
children: [/*#__PURE__*/jsxs("div", {
|
|
1880
1883
|
className: classNames('np-drawer-header', {
|
|
1881
1884
|
'np-drawer-header--withborder': headerTitle
|
|
1882
1885
|
}),
|
|
1883
1886
|
children: [headerTitle && /*#__PURE__*/jsx(Title, {
|
|
1887
|
+
id: titleId,
|
|
1884
1888
|
type: Typography.TITLE_BODY,
|
|
1885
1889
|
children: headerTitle
|
|
1886
1890
|
}), /*#__PURE__*/jsx(CloseButton, {
|
|
@@ -5922,6 +5926,7 @@ const Modal = ({
|
|
|
5922
5926
|
const isCompact = checkSpecialClasses('compact');
|
|
5923
5927
|
const noDivider = checkSpecialClasses('no-divider');
|
|
5924
5928
|
const contentReference = useRef(null);
|
|
5929
|
+
const titleId = useId();
|
|
5925
5930
|
return !isMedium ? /*#__PURE__*/jsx(Drawer$1, {
|
|
5926
5931
|
open: open,
|
|
5927
5932
|
headerTitle: title,
|
|
@@ -5949,11 +5954,12 @@ const Modal = ({
|
|
|
5949
5954
|
className: classNames('tw-modal', 'd-flex', 'fade', 'outline-none', scroll === Scroll.CONTENT && 'tw-modal--scrollable', className),
|
|
5950
5955
|
...otherProps,
|
|
5951
5956
|
children: /*#__PURE__*/jsx("div", {
|
|
5957
|
+
role: "dialog",
|
|
5958
|
+
"aria-modal": true,
|
|
5959
|
+
"aria-labelledby": titleId,
|
|
5952
5960
|
className: classNames('tw-modal-dialog', 'd-flex', {
|
|
5953
5961
|
[`tw-modal-${size}`]: size
|
|
5954
5962
|
}),
|
|
5955
|
-
"aria-modal": true,
|
|
5956
|
-
role: "dialog",
|
|
5957
5963
|
children: /*#__PURE__*/jsxs("div", {
|
|
5958
5964
|
className: classNames('tw-modal-content', 'd-flex', 'flex-column', 'justify-content-between', {
|
|
5959
5965
|
'tw-modal-compact': isCompact,
|
|
@@ -5964,6 +5970,7 @@ const Modal = ({
|
|
|
5964
5970
|
'modal--withoutborder': !title || noDivider
|
|
5965
5971
|
}),
|
|
5966
5972
|
children: [/*#__PURE__*/jsx(Title, {
|
|
5973
|
+
id: titleId,
|
|
5967
5974
|
type: Typography.TITLE_BODY,
|
|
5968
5975
|
className: "tw-modal-title",
|
|
5969
5976
|
children: title
|
|
@@ -5993,7 +6000,8 @@ const Popover$1 = ({
|
|
|
5993
6000
|
className,
|
|
5994
6001
|
content,
|
|
5995
6002
|
preferredPlacement,
|
|
5996
|
-
title
|
|
6003
|
+
title,
|
|
6004
|
+
onClose
|
|
5997
6005
|
}) => {
|
|
5998
6006
|
logActionRequired({
|
|
5999
6007
|
preferredPlacement
|
|
@@ -6003,7 +6011,10 @@ const Popover$1 = ({
|
|
|
6003
6011
|
const {
|
|
6004
6012
|
isModern
|
|
6005
6013
|
} = useTheme();
|
|
6006
|
-
const
|
|
6014
|
+
const handleOnClose = () => {
|
|
6015
|
+
setOpen(false);
|
|
6016
|
+
onClose?.();
|
|
6017
|
+
};
|
|
6007
6018
|
return /*#__PURE__*/jsxs("span", {
|
|
6008
6019
|
className: classNames('np-popover', className),
|
|
6009
6020
|
children: [/*#__PURE__*/jsx("span", {
|
|
@@ -6023,7 +6034,7 @@ const Popover$1 = ({
|
|
|
6023
6034
|
position: deprecatedPlacements[preferredPlacement] || preferredPlacement,
|
|
6024
6035
|
arrow: true,
|
|
6025
6036
|
className: "np-popover__container",
|
|
6026
|
-
onClose:
|
|
6037
|
+
onClose: handleOnClose,
|
|
6027
6038
|
children: /*#__PURE__*/jsxs("div", {
|
|
6028
6039
|
className: isModern ? 'np-popover__content np-text-default-body' : 'np-popover__content',
|
|
6029
6040
|
"aria-hidden": !open,
|
|
@@ -6056,6 +6067,7 @@ Popover$1.propTypes = {
|
|
|
6056
6067
|
* `'bottom-right'` / `'bottom-left'` are deprecated use `Position.BOTTOM` / `'bottom'` instead
|
|
6057
6068
|
*/
|
|
6058
6069
|
preferredPlacement: PropTypes.oneOf(['top', 'right', 'bottom', 'left', 'left-top', 'right-top', 'bottom-right', 'bottom-left']),
|
|
6070
|
+
onClose: PropTypes.func,
|
|
6059
6071
|
title: PropTypes.node
|
|
6060
6072
|
};
|
|
6061
6073
|
const deprecatedPlacements = {
|