@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.js CHANGED
@@ -1901,6 +1901,7 @@ const Drawer = ({
1901
1901
  const {
1902
1902
  isMobile
1903
1903
  } = useLayout();
1904
+ const titleId = reactId.useId();
1904
1905
  return /*#__PURE__*/jsxRuntime.jsx(Dimmer$1, {
1905
1906
  open: open,
1906
1907
  onClose: onClose,
@@ -1908,13 +1909,16 @@ const Drawer = ({
1908
1909
  open: open,
1909
1910
  position: isMobile ? exports.Position.BOTTOM : position,
1910
1911
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
1911
- className: classNames__default.default('np-drawer', className),
1912
1912
  role: "dialog",
1913
+ "aria-modal": true,
1914
+ "aria-labelledby": headerTitle ? titleId : undefined,
1915
+ className: classNames__default.default('np-drawer', className),
1913
1916
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
1914
1917
  className: classNames__default.default('np-drawer-header', {
1915
1918
  'np-drawer-header--withborder': headerTitle
1916
1919
  }),
1917
1920
  children: [headerTitle && /*#__PURE__*/jsxRuntime.jsx(Title, {
1921
+ id: titleId,
1918
1922
  type: exports.Typography.TITLE_BODY,
1919
1923
  children: headerTitle
1920
1924
  }), /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
@@ -5956,6 +5960,7 @@ const Modal = ({
5956
5960
  const isCompact = checkSpecialClasses('compact');
5957
5961
  const noDivider = checkSpecialClasses('no-divider');
5958
5962
  const contentReference = React.useRef(null);
5963
+ const titleId = reactId.useId();
5959
5964
  return !isMedium ? /*#__PURE__*/jsxRuntime.jsx(Drawer$1, {
5960
5965
  open: open,
5961
5966
  headerTitle: title,
@@ -5983,11 +5988,12 @@ const Modal = ({
5983
5988
  className: classNames__default.default('tw-modal', 'd-flex', 'fade', 'outline-none', scroll === exports.Scroll.CONTENT && 'tw-modal--scrollable', className),
5984
5989
  ...otherProps,
5985
5990
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
5991
+ role: "dialog",
5992
+ "aria-modal": true,
5993
+ "aria-labelledby": titleId,
5986
5994
  className: classNames__default.default('tw-modal-dialog', 'd-flex', {
5987
5995
  [`tw-modal-${size}`]: size
5988
5996
  }),
5989
- "aria-modal": true,
5990
- role: "dialog",
5991
5997
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
5992
5998
  className: classNames__default.default('tw-modal-content', 'd-flex', 'flex-column', 'justify-content-between', {
5993
5999
  'tw-modal-compact': isCompact,
@@ -5998,6 +6004,7 @@ const Modal = ({
5998
6004
  'modal--withoutborder': !title || noDivider
5999
6005
  }),
6000
6006
  children: [/*#__PURE__*/jsxRuntime.jsx(Title, {
6007
+ id: titleId,
6001
6008
  type: exports.Typography.TITLE_BODY,
6002
6009
  className: "tw-modal-title",
6003
6010
  children: title
@@ -6027,7 +6034,8 @@ const Popover$1 = ({
6027
6034
  className,
6028
6035
  content,
6029
6036
  preferredPlacement,
6030
- title
6037
+ title,
6038
+ onClose
6031
6039
  }) => {
6032
6040
  logActionRequired({
6033
6041
  preferredPlacement
@@ -6037,7 +6045,10 @@ const Popover$1 = ({
6037
6045
  const {
6038
6046
  isModern
6039
6047
  } = componentsTheming.useTheme();
6040
- const onClose = () => setOpen(false);
6048
+ const handleOnClose = () => {
6049
+ setOpen(false);
6050
+ onClose?.();
6051
+ };
6041
6052
  return /*#__PURE__*/jsxRuntime.jsxs("span", {
6042
6053
  className: classNames__default.default('np-popover', className),
6043
6054
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
@@ -6057,7 +6068,7 @@ const Popover$1 = ({
6057
6068
  position: deprecatedPlacements[preferredPlacement] || preferredPlacement,
6058
6069
  arrow: true,
6059
6070
  className: "np-popover__container",
6060
- onClose: onClose,
6071
+ onClose: handleOnClose,
6061
6072
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
6062
6073
  className: isModern ? 'np-popover__content np-text-default-body' : 'np-popover__content',
6063
6074
  "aria-hidden": !open,
@@ -6090,6 +6101,7 @@ Popover$1.propTypes = {
6090
6101
  * `'bottom-right'` / `'bottom-left'` are deprecated use `Position.BOTTOM` / `'bottom'` instead
6091
6102
  */
6092
6103
  preferredPlacement: PropTypes__default.default.oneOf(['top', 'right', 'bottom', 'left', 'left-top', 'right-top', 'bottom-right', 'bottom-left']),
6104
+ onClose: PropTypes__default.default.func,
6093
6105
  title: PropTypes__default.default.node
6094
6106
  };
6095
6107
  const deprecatedPlacements = {