@transferwise/components 46.114.0 → 46.115.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.
Files changed (51) hide show
  1. package/build/common/closeButton/CloseButton.messages.js +2 -2
  2. package/build/common/closeButton/CloseButton.messages.js.map +1 -1
  3. package/build/common/closeButton/CloseButton.messages.mjs +2 -2
  4. package/build/common/closeButton/CloseButton.messages.mjs.map +1 -1
  5. package/build/common/closeButton/CloseButton.mjs +2 -2
  6. package/build/common/closeButton/CloseButton.mjs.map +1 -1
  7. package/build/common/hooks/useVirtualKeyboard.js +4 -3
  8. package/build/common/hooks/useVirtualKeyboard.js.map +1 -1
  9. package/build/common/hooks/useVirtualKeyboard.mjs +4 -3
  10. package/build/common/hooks/useVirtualKeyboard.mjs.map +1 -1
  11. package/build/drawer/Drawer.js +18 -9
  12. package/build/drawer/Drawer.js.map +1 -1
  13. package/build/drawer/Drawer.mjs +18 -9
  14. package/build/drawer/Drawer.mjs.map +1 -1
  15. package/build/i18n/nl.json +1 -1
  16. package/build/i18n/nl.json.js +1 -1
  17. package/build/i18n/nl.json.mjs +1 -1
  18. package/build/inputs/_BottomSheet.js +1 -1
  19. package/build/inputs/_BottomSheet.js.map +1 -1
  20. package/build/inputs/_BottomSheet.mjs +1 -1
  21. package/build/inputs/_BottomSheet.mjs.map +1 -1
  22. package/build/main.css +17 -127
  23. package/build/modal/Modal.js +20 -21
  24. package/build/modal/Modal.js.map +1 -1
  25. package/build/modal/Modal.mjs +20 -21
  26. package/build/modal/Modal.mjs.map +1 -1
  27. package/build/styles/drawer/Drawer.css +11 -58
  28. package/build/styles/main.css +17 -127
  29. package/build/styles/modal/Modal.css +6 -69
  30. package/build/types/common/hooks/useVirtualKeyboard.d.ts +2 -1
  31. package/build/types/common/hooks/useVirtualKeyboard.d.ts.map +1 -1
  32. package/build/types/drawer/Drawer.d.ts.map +1 -1
  33. package/build/types/modal/Modal.d.ts.map +1 -1
  34. package/package.json +2 -2
  35. package/src/accordion/Accordion.story.tsx +1 -1
  36. package/src/avatarLayout/AvatarLayout.story.tsx +1 -0
  37. package/src/avatarView/AvatarView.story.tsx +1 -0
  38. package/src/common/hooks/useVirtualKeyboard.ts +4 -3
  39. package/src/display/Display.story.tsx +1 -0
  40. package/src/drawer/Drawer.css +11 -58
  41. package/src/drawer/Drawer.less +14 -70
  42. package/src/drawer/Drawer.story.tsx +158 -100
  43. package/src/drawer/Drawer.tsx +26 -7
  44. package/src/i18n/nl.json +1 -1
  45. package/src/iconButton/IconButton.story.tsx +1 -0
  46. package/src/inputs/_BottomSheet.tsx +1 -1
  47. package/src/main.css +17 -127
  48. package/src/modal/Modal.css +6 -69
  49. package/src/modal/Modal.less +6 -76
  50. package/src/modal/Modal.tsx +23 -23
  51. package/src/provider/theme/ThemeProvider.story.tsx +23 -0
@@ -4,11 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var reactIntl = require('react-intl');
6
6
 
7
- var messages = reactIntl.defineMessages({
7
+ var closeBtnMessages = reactIntl.defineMessages({
8
8
  ariaLabel: {
9
9
  id: "neptune.CloseButton.ariaLabel"
10
10
  }
11
11
  });
12
12
 
13
- exports.default = messages;
13
+ exports.default = closeBtnMessages;
14
14
  //# sourceMappingURL=CloseButton.messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CloseButton.messages.js","sources":["../../../src/common/closeButton/CloseButton.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n ariaLabel: {\n id: 'neptune.CloseButton.ariaLabel',\n defaultMessage: 'Close',\n description: 'Description of close button',\n },\n});\n"],"names":["defineMessages","ariaLabel","id"],"mappings":";;;;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,SAAS,EAAE;IACTC,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
1
+ {"version":3,"file":"CloseButton.messages.js","sources":["../../../src/common/closeButton/CloseButton.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n ariaLabel: {\n id: 'neptune.CloseButton.ariaLabel',\n defaultMessage: 'Close',\n description: 'Description of close button',\n },\n});\n"],"names":["defineMessages","ariaLabel","id"],"mappings":";;;;;;AAEA,uBAAeA,wBAAc,CAAC;AAC5BC,EAAAA,SAAS,EAAE;IACTC,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
@@ -1,10 +1,10 @@
1
1
  import { defineMessages } from 'react-intl';
2
2
 
3
- var messages = defineMessages({
3
+ var closeBtnMessages = defineMessages({
4
4
  ariaLabel: {
5
5
  id: "neptune.CloseButton.ariaLabel"
6
6
  }
7
7
  });
8
8
 
9
- export { messages as default };
9
+ export { closeBtnMessages as default };
10
10
  //# sourceMappingURL=CloseButton.messages.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CloseButton.messages.mjs","sources":["../../../src/common/closeButton/CloseButton.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n ariaLabel: {\n id: 'neptune.CloseButton.ariaLabel',\n defaultMessage: 'Close',\n description: 'Description of close button',\n },\n});\n"],"names":["defineMessages","ariaLabel","id"],"mappings":";;AAEA,eAAeA,cAAc,CAAC;AAC5BC,EAAAA,SAAS,EAAE;IACTC,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
1
+ {"version":3,"file":"CloseButton.messages.mjs","sources":["../../../src/common/closeButton/CloseButton.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n ariaLabel: {\n id: 'neptune.CloseButton.ariaLabel',\n defaultMessage: 'Close',\n description: 'Description of close button',\n },\n});\n"],"names":["defineMessages","ariaLabel","id"],"mappings":";;AAEA,uBAAeA,cAAc,CAAC;AAC5BC,EAAAA,SAAS,EAAE;IACTC,EAAE,EAAA;AAGH;AACF,CAAA,CAAC;;;;"}
@@ -3,7 +3,7 @@ import { clsx } from 'clsx';
3
3
  import { forwardRef } from 'react';
4
4
  import { useIntl } from 'react-intl';
5
5
  import { Size } from '../propsValues/size.mjs';
6
- import messages from './CloseButton.messages.mjs';
6
+ import closeBtnMessages from './CloseButton.messages.mjs';
7
7
  import { jsx } from 'react/jsx-runtime';
8
8
 
9
9
  const CloseButton = /*#__PURE__*/forwardRef(function CloseButton({
@@ -17,7 +17,7 @@ const CloseButton = /*#__PURE__*/forwardRef(function CloseButton({
17
17
  tabIndex
18
18
  }, reference) {
19
19
  const intl = useIntl();
20
- ariaLabel ??= intl.formatMessage(messages.ariaLabel);
20
+ ariaLabel ??= intl.formatMessage(closeBtnMessages.ariaLabel);
21
21
  const Icon = filled ? CrossCircleFill : Cross;
22
22
  return /*#__PURE__*/jsx("button", {
23
23
  ref: reference,
@@ -1 +1 @@
1
- {"version":3,"file":"CloseButton.mjs","sources":["../../../src/common/closeButton/CloseButton.tsx"],"sourcesContent":["import { Cross, CrossCircleFill } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { forwardRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Size, SizeLarge, SizeMedium, SizeSmall, SizeExtraSmall } from '../propsValues/size';\n\nimport messages from './CloseButton.messages';\n\nexport type CloseButtonProps = Pick<\n React.ComponentPropsWithoutRef<'button'>,\n 'aria-label' | 'className' | 'onClick'\n> & {\n size?: SizeExtraSmall | SizeSmall | SizeMedium | SizeLarge;\n filled?: boolean;\n isDisabled?: boolean;\n testId?: string;\n tabIndex?: number;\n};\n\n/**\n * @deprecated Use `<IconButton />` component instead\n */\nexport const CloseButton = forwardRef(function CloseButton(\n {\n 'aria-label': ariaLabel,\n size = Size.MEDIUM,\n filled = false,\n className,\n onClick,\n isDisabled,\n testId,\n tabIndex,\n }: CloseButtonProps,\n reference: React.ForwardedRef<HTMLButtonElement | null>,\n) {\n const intl = useIntl();\n ariaLabel ??= intl.formatMessage(messages.ariaLabel);\n const Icon = filled ? CrossCircleFill : Cross;\n\n return (\n <button\n ref={reference}\n type=\"button\"\n className={clsx(\n 'np-close-button',\n 'close btn-link',\n 'text-no-decoration',\n {\n 'np-close-button--x-small': size === Size.EXTRA_SMALL,\n 'np-close-button--large': size === Size.MEDIUM,\n 'np-close-button--x-large': size === Size.LARGE,\n },\n className,\n )}\n aria-label={ariaLabel}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n data-testid={testId}\n tabIndex={tabIndex}\n onClick={onClick}\n >\n <Icon size={size === Size.SMALL || size === Size.EXTRA_SMALL ? 16 : 24} />\n </button>\n );\n});\n"],"names":["CloseButton","forwardRef","ariaLabel","size","Size","MEDIUM","filled","className","onClick","isDisabled","testId","tabIndex","reference","intl","useIntl","formatMessage","messages","Icon","CrossCircleFill","Cross","_jsx","ref","type","clsx","EXTRA_SMALL","LARGE","disabled","children","SMALL"],"mappings":";;;;;;;;MAuBaA,WAAW,gBAAGC,UAAU,CAAC,SAASD,WAAWA,CACxD;AACE,EAAA,YAAY,EAAEE,SAAS;EACvBC,IAAI,GAAGC,IAAI,CAACC,MAAM;AAClBC,EAAAA,MAAM,GAAG,KAAK;EACdC,SAAS;EACTC,OAAO;EACPC,UAAU;EACVC,MAAM;AACNC,EAAAA;AAAQ,CACS,EACnBC,SAAuD,EAAA;AAEvD,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;EACtBZ,SAAS,KAAKW,IAAI,CAACE,aAAa,CAACC,QAAQ,CAACd,SAAS,CAAC;AACpD,EAAA,MAAMe,IAAI,GAAGX,MAAM,GAAGY,eAAe,GAAGC,KAAK;AAE7C,EAAA,oBACEC,GAAA,CAAA,QAAA,EAAA;AACEC,IAAAA,GAAG,EAAET,SAAU;AACfU,IAAAA,IAAI,EAAC,QAAQ;IACbf,SAAS,EAAEgB,IAAI,CACb,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB;AACE,MAAA,0BAA0B,EAAEpB,IAAI,KAAKC,IAAI,CAACoB,WAAW;AACrD,MAAA,wBAAwB,EAAErB,IAAI,KAAKC,IAAI,CAACC,MAAM;AAC9C,MAAA,0BAA0B,EAAEF,IAAI,KAAKC,IAAI,CAACqB;KAC3C,EACDlB,SAAS,CACT;AACF,IAAA,YAAA,EAAYL,SAAU;AACtB,IAAA,eAAA,EAAeO,UAAW;AAC1BiB,IAAAA,QAAQ,EAAEjB,UAAW;AACrB,IAAA,aAAA,EAAaC,MAAO;AACpBC,IAAAA,QAAQ,EAAEA,QAAS;AACnBH,IAAAA,OAAO,EAAEA,OAAQ;IAAAmB,QAAA,eAEjBP,GAAA,CAACH,IAAI,EAAA;AAACd,MAAAA,IAAI,EAAEA,IAAI,KAAKC,IAAI,CAACwB,KAAK,IAAIzB,IAAI,KAAKC,IAAI,CAACoB,WAAW,GAAG,EAAE,GAAG;KAAG;AACzE,GAAQ,CAAC;AAEb,CAAC;;;;"}
1
+ {"version":3,"file":"CloseButton.mjs","sources":["../../../src/common/closeButton/CloseButton.tsx"],"sourcesContent":["import { Cross, CrossCircleFill } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { forwardRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Size, SizeLarge, SizeMedium, SizeSmall, SizeExtraSmall } from '../propsValues/size';\n\nimport messages from './CloseButton.messages';\n\nexport type CloseButtonProps = Pick<\n React.ComponentPropsWithoutRef<'button'>,\n 'aria-label' | 'className' | 'onClick'\n> & {\n size?: SizeExtraSmall | SizeSmall | SizeMedium | SizeLarge;\n filled?: boolean;\n isDisabled?: boolean;\n testId?: string;\n tabIndex?: number;\n};\n\n/**\n * @deprecated Use `<IconButton />` component instead\n */\nexport const CloseButton = forwardRef(function CloseButton(\n {\n 'aria-label': ariaLabel,\n size = Size.MEDIUM,\n filled = false,\n className,\n onClick,\n isDisabled,\n testId,\n tabIndex,\n }: CloseButtonProps,\n reference: React.ForwardedRef<HTMLButtonElement | null>,\n) {\n const intl = useIntl();\n ariaLabel ??= intl.formatMessage(messages.ariaLabel);\n const Icon = filled ? CrossCircleFill : Cross;\n\n return (\n <button\n ref={reference}\n type=\"button\"\n className={clsx(\n 'np-close-button',\n 'close btn-link',\n 'text-no-decoration',\n {\n 'np-close-button--x-small': size === Size.EXTRA_SMALL,\n 'np-close-button--large': size === Size.MEDIUM,\n 'np-close-button--x-large': size === Size.LARGE,\n },\n className,\n )}\n aria-label={ariaLabel}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n data-testid={testId}\n tabIndex={tabIndex}\n onClick={onClick}\n >\n <Icon size={size === Size.SMALL || size === Size.EXTRA_SMALL ? 16 : 24} />\n </button>\n );\n});\n"],"names":["CloseButton","forwardRef","ariaLabel","size","Size","MEDIUM","filled","className","onClick","isDisabled","testId","tabIndex","reference","intl","useIntl","formatMessage","messages","Icon","CrossCircleFill","Cross","_jsx","ref","type","clsx","EXTRA_SMALL","LARGE","disabled","children","SMALL"],"mappings":";;;;;;;;MAuBaA,WAAW,gBAAGC,UAAU,CAAC,SAASD,WAAWA,CACxD;AACE,EAAA,YAAY,EAAEE,SAAS;EACvBC,IAAI,GAAGC,IAAI,CAACC,MAAM;AAClBC,EAAAA,MAAM,GAAG,KAAK;EACdC,SAAS;EACTC,OAAO;EACPC,UAAU;EACVC,MAAM;AACNC,EAAAA;AAAQ,CACS,EACnBC,SAAuD,EAAA;AAEvD,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;EACtBZ,SAAS,KAAKW,IAAI,CAACE,aAAa,CAACC,gBAAQ,CAACd,SAAS,CAAC;AACpD,EAAA,MAAMe,IAAI,GAAGX,MAAM,GAAGY,eAAe,GAAGC,KAAK;AAE7C,EAAA,oBACEC,GAAA,CAAA,QAAA,EAAA;AACEC,IAAAA,GAAG,EAAET,SAAU;AACfU,IAAAA,IAAI,EAAC,QAAQ;IACbf,SAAS,EAAEgB,IAAI,CACb,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB;AACE,MAAA,0BAA0B,EAAEpB,IAAI,KAAKC,IAAI,CAACoB,WAAW;AACrD,MAAA,wBAAwB,EAAErB,IAAI,KAAKC,IAAI,CAACC,MAAM;AAC9C,MAAA,0BAA0B,EAAEF,IAAI,KAAKC,IAAI,CAACqB;KAC3C,EACDlB,SAAS,CACT;AACF,IAAA,YAAA,EAAYL,SAAU;AACtB,IAAA,eAAA,EAAeO,UAAW;AAC1BiB,IAAAA,QAAQ,EAAEjB,UAAW;AACrB,IAAA,aAAA,EAAaC,MAAO;AACpBC,IAAAA,QAAQ,EAAEA,QAAS;AACnBH,IAAAA,OAAO,EAAEA,OAAQ;IAAAmB,QAAA,eAEjBP,GAAA,CAACH,IAAI,EAAA;AAACd,MAAAA,IAAI,EAAEA,IAAI,KAAKC,IAAI,CAACwB,KAAK,IAAIzB,IAAI,KAAKC,IAAI,CAACoB,WAAW,GAAG,EAAE,GAAG;KAAG;AACzE,GAAQ,CAAC;AAEb,CAAC;;;;"}
@@ -6,20 +6,21 @@ var React = require('react');
6
6
  * This progressive enhancement uses an experimental API, it might change,
7
7
  * and at the time of authoring is not supported on iOS or mobile Firefox.
8
8
  * @see https://developer.mozilla.org/en-US/docs/Web/API/VirtualKeyboard
9
+ * @param open - Controls whether the virtual keyboard should overlay content
9
10
  */
10
- function useVirtualKeyboard() {
11
+ function useVirtualKeyboard(open) {
11
12
  React.useEffect(() => {
12
13
  /* eslint-disable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */
13
14
  if ('virtualKeyboard' in navigator) {
14
15
  const virtualKeyboard = navigator.virtualKeyboard;
15
16
  const initialOverlaysContent = virtualKeyboard.overlaysContent;
16
- virtualKeyboard.overlaysContent = true;
17
+ virtualKeyboard.overlaysContent = open;
17
18
  return () => {
18
19
  virtualKeyboard.overlaysContent = initialOverlaysContent;
19
20
  };
20
21
  }
21
22
  /* eslint-enable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */
22
- }, []);
23
+ }, [open]);
23
24
  }
24
25
 
25
26
  exports.useVirtualKeyboard = useVirtualKeyboard;
@@ -1 +1 @@
1
- {"version":3,"file":"useVirtualKeyboard.js","sources":["../../../src/common/hooks/useVirtualKeyboard.ts"],"sourcesContent":["import { useEffect } from 'react';\n\n/**\n * This progressive enhancement uses an experimental API, it might change,\n * and at the time of authoring is not supported on iOS or mobile Firefox.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/VirtualKeyboard\n */\nexport function useVirtualKeyboard() {\n useEffect(() => {\n /* eslint-disable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */\n if ('virtualKeyboard' in navigator) {\n const virtualKeyboard: any = navigator.virtualKeyboard;\n const initialOverlaysContent: unknown = virtualKeyboard.overlaysContent;\n virtualKeyboard.overlaysContent = true;\n return () => {\n virtualKeyboard.overlaysContent = initialOverlaysContent;\n };\n }\n /* eslint-enable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */\n }, []);\n}\n"],"names":["useVirtualKeyboard","useEffect","navigator","virtualKeyboard","initialOverlaysContent","overlaysContent"],"mappings":";;;;AAEA;;;;AAIG;SACaA,kBAAkBA,GAAA;AAChCC,EAAAA,eAAS,CAAC,MAAK;AACb;IACA,IAAI,iBAAiB,IAAIC,SAAS,EAAE;AAClC,MAAA,MAAMC,eAAe,GAAQD,SAAS,CAACC,eAAe;AACtD,MAAA,MAAMC,sBAAsB,GAAYD,eAAe,CAACE,eAAe;MACvEF,eAAe,CAACE,eAAe,GAAG,IAAI;AACtC,MAAA,OAAO,MAAK;QACVF,eAAe,CAACE,eAAe,GAAGD,sBAAsB;MAC1D,CAAC;AACH,IAAA;AACA;EACF,CAAC,EAAE,EAAE,CAAC;AACR;;;;"}
1
+ {"version":3,"file":"useVirtualKeyboard.js","sources":["../../../src/common/hooks/useVirtualKeyboard.ts"],"sourcesContent":["import { useEffect } from 'react';\n\n/**\n * This progressive enhancement uses an experimental API, it might change,\n * and at the time of authoring is not supported on iOS or mobile Firefox.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/VirtualKeyboard\n * @param open - Controls whether the virtual keyboard should overlay content\n */\nexport function useVirtualKeyboard(open: boolean) {\n useEffect(() => {\n /* eslint-disable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */\n if ('virtualKeyboard' in navigator) {\n const virtualKeyboard: any = navigator.virtualKeyboard;\n const initialOverlaysContent: unknown = virtualKeyboard.overlaysContent;\n virtualKeyboard.overlaysContent = open;\n return () => {\n virtualKeyboard.overlaysContent = initialOverlaysContent;\n };\n }\n /* eslint-enable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */\n }, [open]);\n}\n"],"names":["useVirtualKeyboard","open","useEffect","navigator","virtualKeyboard","initialOverlaysContent","overlaysContent"],"mappings":";;;;AAEA;;;;;AAKG;AACG,SAAUA,kBAAkBA,CAACC,IAAa,EAAA;AAC9CC,EAAAA,eAAS,CAAC,MAAK;AACb;IACA,IAAI,iBAAiB,IAAIC,SAAS,EAAE;AAClC,MAAA,MAAMC,eAAe,GAAQD,SAAS,CAACC,eAAe;AACtD,MAAA,MAAMC,sBAAsB,GAAYD,eAAe,CAACE,eAAe;MACvEF,eAAe,CAACE,eAAe,GAAGL,IAAI;AACtC,MAAA,OAAO,MAAK;QACVG,eAAe,CAACE,eAAe,GAAGD,sBAAsB;MAC1D,CAAC;AACH,IAAA;AACA;AACF,EAAA,CAAC,EAAE,CAACJ,IAAI,CAAC,CAAC;AACZ;;;;"}
@@ -4,20 +4,21 @@ import { useEffect } from 'react';
4
4
  * This progressive enhancement uses an experimental API, it might change,
5
5
  * and at the time of authoring is not supported on iOS or mobile Firefox.
6
6
  * @see https://developer.mozilla.org/en-US/docs/Web/API/VirtualKeyboard
7
+ * @param open - Controls whether the virtual keyboard should overlay content
7
8
  */
8
- function useVirtualKeyboard() {
9
+ function useVirtualKeyboard(open) {
9
10
  useEffect(() => {
10
11
  /* eslint-disable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */
11
12
  if ('virtualKeyboard' in navigator) {
12
13
  const virtualKeyboard = navigator.virtualKeyboard;
13
14
  const initialOverlaysContent = virtualKeyboard.overlaysContent;
14
- virtualKeyboard.overlaysContent = true;
15
+ virtualKeyboard.overlaysContent = open;
15
16
  return () => {
16
17
  virtualKeyboard.overlaysContent = initialOverlaysContent;
17
18
  };
18
19
  }
19
20
  /* eslint-enable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */
20
- }, []);
21
+ }, [open]);
21
22
  }
22
23
 
23
24
  export { useVirtualKeyboard };
@@ -1 +1 @@
1
- {"version":3,"file":"useVirtualKeyboard.mjs","sources":["../../../src/common/hooks/useVirtualKeyboard.ts"],"sourcesContent":["import { useEffect } from 'react';\n\n/**\n * This progressive enhancement uses an experimental API, it might change,\n * and at the time of authoring is not supported on iOS or mobile Firefox.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/VirtualKeyboard\n */\nexport function useVirtualKeyboard() {\n useEffect(() => {\n /* eslint-disable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */\n if ('virtualKeyboard' in navigator) {\n const virtualKeyboard: any = navigator.virtualKeyboard;\n const initialOverlaysContent: unknown = virtualKeyboard.overlaysContent;\n virtualKeyboard.overlaysContent = true;\n return () => {\n virtualKeyboard.overlaysContent = initialOverlaysContent;\n };\n }\n /* eslint-enable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */\n }, []);\n}\n"],"names":["useVirtualKeyboard","useEffect","navigator","virtualKeyboard","initialOverlaysContent","overlaysContent"],"mappings":";;AAEA;;;;AAIG;SACaA,kBAAkBA,GAAA;AAChCC,EAAAA,SAAS,CAAC,MAAK;AACb;IACA,IAAI,iBAAiB,IAAIC,SAAS,EAAE;AAClC,MAAA,MAAMC,eAAe,GAAQD,SAAS,CAACC,eAAe;AACtD,MAAA,MAAMC,sBAAsB,GAAYD,eAAe,CAACE,eAAe;MACvEF,eAAe,CAACE,eAAe,GAAG,IAAI;AACtC,MAAA,OAAO,MAAK;QACVF,eAAe,CAACE,eAAe,GAAGD,sBAAsB;MAC1D,CAAC;AACH,IAAA;AACA;EACF,CAAC,EAAE,EAAE,CAAC;AACR;;;;"}
1
+ {"version":3,"file":"useVirtualKeyboard.mjs","sources":["../../../src/common/hooks/useVirtualKeyboard.ts"],"sourcesContent":["import { useEffect } from 'react';\n\n/**\n * This progressive enhancement uses an experimental API, it might change,\n * and at the time of authoring is not supported on iOS or mobile Firefox.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/VirtualKeyboard\n * @param open - Controls whether the virtual keyboard should overlay content\n */\nexport function useVirtualKeyboard(open: boolean) {\n useEffect(() => {\n /* eslint-disable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */\n if ('virtualKeyboard' in navigator) {\n const virtualKeyboard: any = navigator.virtualKeyboard;\n const initialOverlaysContent: unknown = virtualKeyboard.overlaysContent;\n virtualKeyboard.overlaysContent = open;\n return () => {\n virtualKeyboard.overlaysContent = initialOverlaysContent;\n };\n }\n /* eslint-enable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */\n }, [open]);\n}\n"],"names":["useVirtualKeyboard","open","useEffect","navigator","virtualKeyboard","initialOverlaysContent","overlaysContent"],"mappings":";;AAEA;;;;;AAKG;AACG,SAAUA,kBAAkBA,CAACC,IAAa,EAAA;AAC9CC,EAAAA,SAAS,CAAC,MAAK;AACb;IACA,IAAI,iBAAiB,IAAIC,SAAS,EAAE;AAClC,MAAA,MAAMC,eAAe,GAAQD,SAAS,CAACC,eAAe;AACtD,MAAA,MAAMC,sBAAsB,GAAYD,eAAe,CAACE,eAAe;MACvEF,eAAe,CAACE,eAAe,GAAGL,IAAI;AACtC,MAAA,OAAO,MAAK;QACVG,eAAe,CAACE,eAAe,GAAGD,sBAAsB;MAC1D,CAAC;AACH,IAAA;AACA;AACF,EAAA,CAAC,EAAE,CAACJ,IAAI,CAAC,CAAC;AACZ;;;;"}
@@ -23,7 +23,10 @@ require('../common/propsValues/variant.js');
23
23
  require('../common/propsValues/scroll.js');
24
24
  require('../common/propsValues/markdownNodeType.js');
25
25
  require('../common/fileType.js');
26
- var CloseButton = require('../common/closeButton/CloseButton.js');
26
+ var icons = require('@transferwise/icons');
27
+ var reactIntl = require('react-intl');
28
+ var CloseButton_messages = require('../common/closeButton/CloseButton.messages.js');
29
+ var jsxRuntime = require('react/jsx-runtime');
27
30
  require('@transferwise/neptune-validation');
28
31
  require('../provider/direction/DirectionProvider.js');
29
32
  var useLayout = require('../common/hooks/useLayout/useLayout.js');
@@ -32,7 +35,7 @@ var OverlayIdProvider = require('../provider/overlay/OverlayIdProvider.js');
32
35
  var SlidingPanel = require('../slidingPanel/SlidingPanel.js');
33
36
  var Title = require('../title/Title.js');
34
37
  var logActionRequired = require('../utilities/logActionRequired.js');
35
- var jsxRuntime = require('react/jsx-runtime');
38
+ var IconButton = require('../iconButton/IconButton.js');
36
39
 
37
40
  function Drawer({
38
41
  children,
@@ -46,6 +49,7 @@ function Drawer({
46
49
  role = 'dialog',
47
50
  'aria-labelledby': ariaLabelledBy
48
51
  }) {
52
+ const intl = reactIntl.useIntl();
49
53
  logActionRequired.logActionRequiredIf('Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.', !onClose);
50
54
  const {
51
55
  isMobile
@@ -66,22 +70,27 @@ function Drawer({
66
70
  "aria-labelledby": ariaLabelledBy || (headerTitle ? titleId : undefined),
67
71
  className: clsx.clsx('np-drawer', className),
68
72
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
69
- className: clsx.clsx('np-drawer-header', {
70
- 'np-drawer-header--withborder': headerTitle
71
- }),
73
+ className: clsx.clsx('np-drawer-header', 'd-flex', 'align-items-center', headerTitle ? 'justify-content-between' : 'justify-content-end', 'flex-wrap'),
72
74
  children: [headerTitle && /*#__PURE__*/jsxRuntime.jsx(Title.default, {
73
75
  id: titleId,
74
- type: typography.Typography.TITLE_BODY,
76
+ type: typography.Typography.TITLE_SUBSECTION,
77
+ className: "np-drawer-title",
75
78
  children: headerTitle
76
- }), /*#__PURE__*/jsxRuntime.jsx(CloseButton.CloseButton, {
77
- onClick: onClose
79
+ }), /*#__PURE__*/jsxRuntime.jsx(IconButton.default, {
80
+ size: 40,
81
+ priority: "tertiary",
82
+ "aria-label": intl.formatMessage(CloseButton_messages.default.ariaLabel),
83
+ onClick: onClose,
84
+ children: /*#__PURE__*/jsxRuntime.jsx(icons.Cross, {})
78
85
  })]
79
86
  }), children && /*#__PURE__*/jsxRuntime.jsx("div", {
80
87
  className: clsx.clsx('np-drawer-content'),
81
88
  children: children
82
- }), footerContent && /*#__PURE__*/jsxRuntime.jsx("div", {
89
+ }), footerContent ? /*#__PURE__*/jsxRuntime.jsx("div", {
83
90
  className: clsx.clsx('np-drawer-footer'),
84
91
  children: footerContent
92
+ }) : /*#__PURE__*/jsxRuntime.jsx("div", {
93
+ className: "m-t-3"
85
94
  })]
86
95
  })
87
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 { 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 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 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('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","onUnmount","open","position","role","ariaLabelledBy","logActionRequiredIf","isMobile","useLayout","titleId","useId","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","onExited","SlidingPanel","Position","BOTTOM","_jsxs","id","undefined","clsx","Title","type","Typography","TITLE_BODY","CloseButton","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6Bc,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;AACf,EAAA,iBAAiB,EAAEC;AAAc,CACrB,EAAA;AACZC,EAAAA,qCAAmB,CACjB,8GAA8G,EAC9G,CAACN,OAAO,CACT;EAED,MAAM;AAAEO,IAAAA;GAAU,GAAGC,mBAAS,EAAE;AAChC,EAAA,MAAMC,OAAO,GAAGC,WAAK,EAAE;AA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AAC,EACvEE,aAAa,iBAAIgB,cAAA,CAAA,KAAA,EAAA;AAAKjB,UAAAA,SAAS,EAAE0B,SAAI,CAAC,kBAAkB,CAAE;AAAA3B,UAAAA,QAAA,EAAEE;AAAa,SAAM,CAAC;OAC9E;KACO;AAChB,GAAQ,CAAC;AAEb;;;;"}
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;AACf,EAAA,iBAAiB,EAAEC;AAAc,CACrB,EAAA;AACZ,EAAA,MAA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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;;;;"}
@@ -19,7 +19,10 @@ import '../common/propsValues/variant.mjs';
19
19
  import '../common/propsValues/scroll.mjs';
20
20
  import '../common/propsValues/markdownNodeType.mjs';
21
21
  import '../common/fileType.mjs';
22
- import { CloseButton } from '../common/closeButton/CloseButton.mjs';
22
+ import { Cross } from '@transferwise/icons';
23
+ import { useIntl } from 'react-intl';
24
+ import closeBtnMessages from '../common/closeButton/CloseButton.messages.mjs';
25
+ import { jsx, jsxs } from 'react/jsx-runtime';
23
26
  import '@transferwise/neptune-validation';
24
27
  import '../provider/direction/DirectionProvider.mjs';
25
28
  import { useLayout } from '../common/hooks/useLayout/useLayout.mjs';
@@ -28,7 +31,7 @@ import { OverlayIdContext } from '../provider/overlay/OverlayIdProvider.mjs';
28
31
  import SlidingPanel from '../slidingPanel/SlidingPanel.mjs';
29
32
  import Title from '../title/Title.mjs';
30
33
  import { logActionRequiredIf } from '../utilities/logActionRequired.mjs';
31
- import { jsx, jsxs } from 'react/jsx-runtime';
34
+ import IconButton from '../iconButton/IconButton.mjs';
32
35
 
33
36
  function Drawer({
34
37
  children,
@@ -42,6 +45,7 @@ function Drawer({
42
45
  role = 'dialog',
43
46
  'aria-labelledby': ariaLabelledBy
44
47
  }) {
48
+ const intl = useIntl();
45
49
  logActionRequiredIf('Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.', !onClose);
46
50
  const {
47
51
  isMobile
@@ -62,22 +66,27 @@ function Drawer({
62
66
  "aria-labelledby": ariaLabelledBy || (headerTitle ? titleId : undefined),
63
67
  className: clsx('np-drawer', className),
64
68
  children: [/*#__PURE__*/jsxs("div", {
65
- className: clsx('np-drawer-header', {
66
- 'np-drawer-header--withborder': headerTitle
67
- }),
69
+ className: clsx('np-drawer-header', 'd-flex', 'align-items-center', headerTitle ? 'justify-content-between' : 'justify-content-end', 'flex-wrap'),
68
70
  children: [headerTitle && /*#__PURE__*/jsx(Title, {
69
71
  id: titleId,
70
- type: Typography.TITLE_BODY,
72
+ type: Typography.TITLE_SUBSECTION,
73
+ className: "np-drawer-title",
71
74
  children: headerTitle
72
- }), /*#__PURE__*/jsx(CloseButton, {
73
- onClick: onClose
75
+ }), /*#__PURE__*/jsx(IconButton, {
76
+ size: 40,
77
+ priority: "tertiary",
78
+ "aria-label": intl.formatMessage(closeBtnMessages.ariaLabel),
79
+ onClick: onClose,
80
+ children: /*#__PURE__*/jsx(Cross, {})
74
81
  })]
75
82
  }), children && /*#__PURE__*/jsx("div", {
76
83
  className: clsx('np-drawer-content'),
77
84
  children: children
78
- }), footerContent && /*#__PURE__*/jsx("div", {
85
+ }), footerContent ? /*#__PURE__*/jsx("div", {
79
86
  className: clsx('np-drawer-footer'),
80
87
  children: footerContent
88
+ }) : /*#__PURE__*/jsx("div", {
89
+ className: "m-t-3"
81
90
  })]
82
91
  })
83
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 { 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 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 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('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","onUnmount","open","position","role","ariaLabelledBy","logActionRequiredIf","isMobile","useLayout","titleId","useId","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","onExited","SlidingPanel","Position","BOTTOM","_jsxs","id","undefined","clsx","Title","type","Typography","TITLE_BODY","CloseButton","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6Bc,SAAUA,MAAMA,CAAC;EAC7BC,QAAQ;EACRC,SAAS;EACTC,aAAa;EACbC,WAAW;EACXC,OAAO;EACPC,SAAS;AACTC,EAAAA,IAAI,GAAG,KAAK;AACZC,EAAAA,QAAQ,GAAG,OAAO;AAClBC,EAAAA,IAAI,GAAG,QAAQ;AACf,EAAA,iBAAiB,EAAEC;AAAc,CACrB,EAAA;AACZC,EAAAA,mBAAmB,CACjB,8GAA8G,EAC9G,CAACN,OAAO,CACT;EAED,MAAM;AAAEO,IAAAA;GAAU,GAAGC,SAAS,EAAE;AAChC,EAAA,MAAMC,OAAO,GAAGC,KAAK,EAAE;AAEvB,EAAA,MAAMC,SAAS,GAAGC,UAAU,CAACC,gBAAgB,CAAC;EAE9C,oBACEC,GAAA,CAACC,MAAM,EAAA;AAACb,IAAAA,IAAI,EAAEA,IAAK;AAACF,IAAAA,OAAO,EAAEA,OAAQ;AAACgB,IAAAA,QAAQ,EAAEf,SAAU;IAAAL,QAAA,eACxDkB,GAAA,CAACG,YAAY,EAAA;AAACf,MAAAA,IAAI,EAAEA,IAAK;AAACC,MAAAA,QAAQ,EAAEI,QAAQ,GAAGW,QAAQ,CAACC,MAAM,GAAGhB,QAAS;AAAAP,MAAAA,QAAA,eACxEwB,IAAA,CAAA,KAAA,EAAA;AACEC,QAAAA,EAAE,EAAEV,SAAU;AACdP,QAAAA,IAAI,EAAEA,IAAK;QACX,YAAA,EAAA,IAAU;AACV,QAAA,iBAAA,EAAiBC,cAAc,KAAKN,WAAW,GAAGU,OAAO,GAAGa,SAAS,CAAE;AACvEzB,QAAAA,SAAS,EAAE0B,IAAI,CAAC,WAAW,EAAE1B,SAAS,CAAE;AAAAD,QAAAA,QAAA,gBAExCwB,IAAA,CAAA,KAAA,EAAA;AACEvB,UAAAA,SAAS,EAAE0B,IAAI,CAAC,kBAAkB,EAAE;AAClC,YAAA,8BAA8B,EAAExB;AACjC,WAAA,CAAE;AAAAH,UAAAA,QAAA,EAAA,CAEFG,WAAW,iBACVe,GAAA,CAACU,KAAK,EAAA;AAACH,YAAAA,EAAE,EAAEZ,OAAQ;YAACgB,IAAI,EAAEC,UAAU,CAACC,UAAW;AAAA/B,YAAAA,QAAA,EAC7CG;AAAW,WACP,CACR,eACDe,GAAA,CAACc,WAAW,EAAA;AAACC,YAAAA,OAAO,EAAE7B;AAAQ,WAAA,CAChC;AAAA,SAAK,CACL,EAACJ,QAAQ,iBAAIkB,GAAA,CAAA,KAAA,EAAA;AAAKjB,UAAAA,SAAS,EAAE0B,IAAI,CAAC,mBAAmB,CAAE;AAAA3B,UAAAA,QAAA,EAAEA;AAAQ,SAAM,CAAC,EACvEE,aAAa,iBAAIgB,GAAA,CAAA,KAAA,EAAA;AAAKjB,UAAAA,SAAS,EAAE0B,IAAI,CAAC,kBAAkB,CAAE;AAAA3B,UAAAA,QAAA,EAAEE;AAAa,SAAM,CAAC;OAC9E;KACO;AAChB,GAAQ,CAAC;AAEb;;;;"}
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,WAAW;EACXC,OAAO;EACPC,SAAS;AACTC,EAAAA,IAAI,GAAG,KAAK;AACZC,EAAAA,QAAQ,GAAG,OAAO;AAClBC,EAAAA,IAAI,GAAG,QAAQ;AACf,EAAA,iBAAiB,EAAEC;AAAc,CACrB,EAAA;AACZ,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;AACtBC,EAAAA,mBAAmB,CACjB,8GAA8G,EAC9G,CAACR,OAAO,CACT;EAED,MAAM;AAAES,IAAAA;GAAU,GAAGC,SAAS,EAAE;AAChC,EAAA,MAAMC,OAAO,GAAGC,KAAK,EAAE;AAEvB,EAAA,MAAMC,SAAS,GAAGC,UAAU,CAACC,gBAAgB,CAAC;EAE9C,oBACEC,GAAA,CAACC,MAAM,EAAA;AAACf,IAAAA,IAAI,EAAEA,IAAK;AAACF,IAAAA,OAAO,EAAEA,OAAQ;AAACkB,IAAAA,QA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;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;;;;"}
@@ -16,7 +16,7 @@
16
16
  "neptune.DateLookup.selected": "geselecteerd",
17
17
  "neptune.DateLookup.twentyYears": "20 jaar",
18
18
  "neptune.DateLookup.year": "jaar",
19
- "neptune.ExpressiveMoneyInput.currency.search.placeholder": "Typ valuta / land",
19
+ "neptune.ExpressiveMoneyInput.currency.search.placeholder": "Voer een valuta / land in",
20
20
  "neptune.ExpressiveMoneyInput.currency.select.currency": "Selecteer valuta",
21
21
  "neptune.FlowNavigation.back": "terug naar vorige stap",
22
22
  "neptune.Info.ariaLabel": "Meer informatie",
@@ -20,7 +20,7 @@ var nl = {
20
20
  "neptune.DateLookup.selected": "geselecteerd",
21
21
  "neptune.DateLookup.twentyYears": "20 jaar",
22
22
  "neptune.DateLookup.year": "jaar",
23
- "neptune.ExpressiveMoneyInput.currency.search.placeholder": "Typ valuta / land",
23
+ "neptune.ExpressiveMoneyInput.currency.search.placeholder": "Voer een valuta / land in",
24
24
  "neptune.ExpressiveMoneyInput.currency.select.currency": "Selecteer valuta",
25
25
  "neptune.FlowNavigation.back": "terug naar vorige stap",
26
26
  "neptune.Info.ariaLabel": "Meer informatie",
@@ -16,7 +16,7 @@ var nl = {
16
16
  "neptune.DateLookup.selected": "geselecteerd",
17
17
  "neptune.DateLookup.twentyYears": "20 jaar",
18
18
  "neptune.DateLookup.year": "jaar",
19
- "neptune.ExpressiveMoneyInput.currency.search.placeholder": "Typ valuta / land",
19
+ "neptune.ExpressiveMoneyInput.currency.search.placeholder": "Voer een valuta / land in",
20
20
  "neptune.ExpressiveMoneyInput.currency.select.currency": "Selecteer valuta",
21
21
  "neptune.FlowNavigation.back": "terug naar vorige stap",
22
22
  "neptune.Info.ariaLabel": "Meer informatie",
@@ -22,7 +22,7 @@ function BottomSheet({
22
22
  onClose,
23
23
  onCloseEnd
24
24
  }) {
25
- useVirtualKeyboard.useVirtualKeyboard();
25
+ useVirtualKeyboard.useVirtualKeyboard(open);
26
26
  const {
27
27
  refs,
28
28
  context
@@ -1 +1 @@
1
- {"version":3,"file":"_BottomSheet.js","sources":["../../src/inputs/_BottomSheet.tsx"],"sourcesContent":["import {\n FloatingFocusManager,\n FloatingPortal,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { Transition } from '@headlessui/react';\nimport { FocusScope } from '@react-aria/focus';\nimport { ThemeProvider, useTheme } from '@wise/components-theming';\nimport { clsx } from 'clsx';\nimport { Fragment, useState } from 'react';\n\nimport { CloseButton } from '../common/closeButton';\nimport { useVirtualKeyboard } from '../common/hooks/useVirtualKeyboard';\nimport { PreventScroll } from '../common/preventScroll/PreventScroll';\nimport { Size } from '../common/propsValues/size';\n\nexport interface BottomSheetProps {\n open: boolean;\n renderTrigger?: (args: {\n ref: React.RefCallback<Element>;\n getInteractionProps: (customEventHandlers?: React.HTMLProps<Element>) => {\n [key: string]: unknown;\n };\n }) => React.ReactNode;\n title?: string;\n initialFocusRef?: React.MutableRefObject<HTMLElement | null>;\n padding?: 'none' | 'md';\n children?: React.ReactNode;\n onClose?: () => void;\n onCloseEnd?: () => void;\n}\n\nexport function BottomSheet({\n open,\n renderTrigger,\n title,\n initialFocusRef,\n padding = 'md',\n children,\n onClose,\n onCloseEnd,\n}: BottomSheetProps) {\n useVirtualKeyboard();\n\n const { refs, context } = useFloating<Element>({\n open,\n onOpenChange: (value) => {\n if (!value) {\n onClose?.();\n }\n },\n });\n\n const dismiss = useDismiss(context);\n const role = useRole(context);\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss, role]);\n\n const [floatingKey, setFloatingKey] = useState(0);\n\n const { theme, screenMode } = useTheme();\n\n return (\n <>\n {open ? <PreventScroll /> : null}\n {renderTrigger?.({\n ref: refs.setReference,\n getInteractionProps: getReferenceProps,\n })}\n\n <FloatingPortal>\n <ThemeProvider\n theme=\"personal\"\n screenMode={theme === 'personal' ? screenMode : 'light'}\n isNotRootProvider\n >\n <Transition\n show={open}\n className=\"np-bottom-sheet-v2-container\"\n beforeEnter={() => {\n setFloatingKey((prev) => prev + 1);\n }}\n afterLeave={onCloseEnd}\n >\n <Transition.Child\n className=\"np-bottom-sheet-v2-backdrop\"\n enterFrom=\"np-bottom-sheet-v2-backdrop--closed\"\n leaveTo=\"np-bottom-sheet-v2-backdrop--closed\"\n />\n\n <div className=\"np-bottom-sheet-v2\">\n <FocusScope>\n <FloatingFocusManager context={context} initialFocus={initialFocusRef}>\n <Fragment\n key={floatingKey} // Force inner state invalidation on open\n >\n <Transition.Child\n ref={refs.setFloating}\n className=\"np-bottom-sheet-v2-content\"\n enterFrom=\"np-bottom-sheet-v2-content--closed\"\n leaveTo=\"np-bottom-sheet-v2-content--closed\"\n {...getFloatingProps()}\n >\n <div className=\"np-bottom-sheet-v2-header\">\n <CloseButton\n size={Size.SMALL}\n onClick={() => {\n onClose?.();\n }}\n />\n </div>\n <div\n className={clsx(\n 'np-bottom-sheet-v2-content-inner',\n title && 'np-bottom-sheet-v2-content-inner--has-title',\n padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md',\n )}\n >\n {title ? (\n <h2 className=\"np-bottom-sheet-v2-title np-text-title-body\">{title}</h2>\n ) : null}\n <div className=\"np-bottom-sheet-v2-body np-text-body-default\">\n {children}\n </div>\n </div>\n </Transition.Child>\n </Fragment>\n </FloatingFocusManager>\n </FocusScope>\n </div>\n </Transition>\n </ThemeProvider>\n </FloatingPortal>\n </>\n );\n}\n"],"names":["BottomSheet","open","renderTrigger","title","initialFocusRef","padding","children","onClose","onCloseEnd","useVirtualKeyboard","refs","context","useFloating","onOpenChange","value","dismiss","useDismiss","role","useRole","getReferenceProps","getFloatingProps","useInteractions","floatingKey","setFloatingKey","useState","theme","screenMode","useTheme","_jsxs","_Fragment","_jsx","PreventScroll","ref","setReference","getInteractionProps","FloatingPortal","ThemeProvider","isNotRootProvider","Transition","show","className","beforeEnter","prev","afterLeave","Child","enterFrom","leaveTo","FocusScope","FloatingFocusManager","initialFocus","Fragment","setFloating","CloseButton","size","Size","SMALL","onClick","clsx"],"mappings":";;;;;;;;;;;;;;AAmCM,SAAUA,WAAWA,CAAC;EAC1BC,IAAI;EACJC,aAAa;EACbC,KAAK;EACLC,eAAe;AACfC,EAAAA,OAAO,GAAG,IAAI;EACdC,QAAQ;EACRC,OAAO;AACPC,EAAAA;AAAU,CACO,EAAA;AACjBC,EAAAA,qCAAkB,EAAE;EAEpB,MAAM;IAAEC,IAAI;AAAEC,IAAAA;GAAS,GAAGC,iBAAW,CAAU;IAC7CX,IAAI;IACJY,YAAY,EAAGC,KAAK,IAAI;MACtB,IAAI,CAACA,KAAK,EAAE;AACVP,QAAAA,OAAO,IAAI;AACb,MAAA;AACF,IAAA;AACD,GAAA,CAAC;AAEF,EAAA,MAAMQ,OAAO,GAAGC,gBAAU,CAACL,OAAO,CAAC;AACnC,EAAA,MAAMM,IAAI,GAAGC,aAAO,CAACP,OAAO,CAAC;EAC7B,MAAM;IAAEQ,iBAAiB;AAAEC,IAAAA;GAAkB,GAAGC,qBAAe,CAAC,CAACN,OAAO,EAAEE,IAAI,CAAC,CAAC;EAEhF,MAAM,CAACK,WAAW,EAAEC,cAAc,CAAC,GAAGC,cAAQ,CAAC,CAAC,CAAC;EAEjD,MAAM;IAAEC,KAAK;AAAEC,IAAAA;GAAY,GAAGC,0BAAQ,EAAE;EAExC,oBACEC,eAAA,CAAAC,mBAAA,EAAA;AAAAvB,IAAAA,QAAA,EAAA,C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;AACtBX,oBAAAA,SAAS,EAAC,4BAA4B;AACtCK,oBAAAA,SAAS,EAAC,oCAAoC;AAC9CC,oBAAAA,OAAO,EAAC,oCAAoC;oBAAA,GACxC1B,gBAAgB,EAAE;AAAAd,oBAAAA,QAAA,gBAEtBwB,cAAA,CAAA,KAAA,EAAA;AAAKU,sBAAAA,SAAS,EAAC,2BAA2B;sBAAAlC,QAAA,eACxCwB,cAAA,CAACsB,uBAAW,EAAA;wBACVC,IAAI,EAAEC,SAAI,CAACC,KAAM;wBACjBC,OAAO,EAAEA,MAAK;AACZjD,0BAAAA,OAAO,IAAI;AACb,wBAAA;uBAAE;qBAED,CACL,eAAAqB,eAAA,CAAA,KAAA,EAAA;AACEY,sBAAAA,SAAS,EAAEiB,SAAI,CACb,kCAAkC,EAClCtD,KAAK,IAAI,6CAA6C,EACtDE,OAAO,KAAK,IAAI,IAAI,8CAA8C,CAClE;sBAAAC,QAAA,EAAA,CAEDH,KAAK,gBACJ2B,cAAA,CAAA,IAAA,EAAA;AAAIU,wBAAAA,SAAS,EAAC,6CAA6C;AAAAlC,wBAAAA,QAAA,EAAEH;AAAK,uBAAK,CAAC,GACtE,IAAI,eACR2B,cAAA,CAAA,KAAA,EAAA;AAAKU,wBAAAA,SAAS,EAAC,8CAA8C;AAAAlC,wBAAAA,QAAA,EAC1DA;AAAQ,uBACN,CACP;AAAA,qBAAK,CACP;mBAAkB;AACpB,iBAAA,EAhCOgB,WAgCG;eACU;aACZ;AACd,WAAK,CACP;SAAY;OACC;AACjB,KAAgB,CAClB;AAAA,GAAA,CAAG;AAEP;;;;"}
1
+ {"version":3,"file":"_BottomSheet.js","sources":["../../src/inputs/_BottomSheet.tsx"],"sourcesContent":["import {\n FloatingFocusManager,\n FloatingPortal,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { Transition } from '@headlessui/react';\nimport { FocusScope } from '@react-aria/focus';\nimport { ThemeProvider, useTheme } from '@wise/components-theming';\nimport { clsx } from 'clsx';\nimport { Fragment, useState } from 'react';\n\nimport { CloseButton } from '../common/closeButton';\nimport { useVirtualKeyboard } from '../common/hooks/useVirtualKeyboard';\nimport { PreventScroll } from '../common/preventScroll/PreventScroll';\nimport { Size } from '../common/propsValues/size';\n\nexport interface BottomSheetProps {\n open: boolean;\n renderTrigger?: (args: {\n ref: React.RefCallback<Element>;\n getInteractionProps: (customEventHandlers?: React.HTMLProps<Element>) => {\n [key: string]: unknown;\n };\n }) => React.ReactNode;\n title?: string;\n initialFocusRef?: React.MutableRefObject<HTMLElement | null>;\n padding?: 'none' | 'md';\n children?: React.ReactNode;\n onClose?: () => void;\n onCloseEnd?: () => void;\n}\n\nexport function BottomSheet({\n open,\n renderTrigger,\n title,\n initialFocusRef,\n padding = 'md',\n children,\n onClose,\n onCloseEnd,\n}: BottomSheetProps) {\n useVirtualKeyboard(open);\n\n const { refs, context } = useFloating<Element>({\n open,\n onOpenChange: (value) => {\n if (!value) {\n onClose?.();\n }\n },\n });\n\n const dismiss = useDismiss(context);\n const role = useRole(context);\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss, role]);\n\n const [floatingKey, setFloatingKey] = useState(0);\n\n const { theme, screenMode } = useTheme();\n\n return (\n <>\n {open ? <PreventScroll /> : null}\n {renderTrigger?.({\n ref: refs.setReference,\n getInteractionProps: getReferenceProps,\n })}\n\n <FloatingPortal>\n <ThemeProvider\n theme=\"personal\"\n screenMode={theme === 'personal' ? screenMode : 'light'}\n isNotRootProvider\n >\n <Transition\n show={open}\n className=\"np-bottom-sheet-v2-container\"\n beforeEnter={() => {\n setFloatingKey((prev) => prev + 1);\n }}\n afterLeave={onCloseEnd}\n >\n <Transition.Child\n className=\"np-bottom-sheet-v2-backdrop\"\n enterFrom=\"np-bottom-sheet-v2-backdrop--closed\"\n leaveTo=\"np-bottom-sheet-v2-backdrop--closed\"\n />\n\n <div className=\"np-bottom-sheet-v2\">\n <FocusScope>\n <FloatingFocusManager context={context} initialFocus={initialFocusRef}>\n <Fragment\n key={floatingKey} // Force inner state invalidation on open\n >\n <Transition.Child\n ref={refs.setFloating}\n className=\"np-bottom-sheet-v2-content\"\n enterFrom=\"np-bottom-sheet-v2-content--closed\"\n leaveTo=\"np-bottom-sheet-v2-content--closed\"\n {...getFloatingProps()}\n >\n <div className=\"np-bottom-sheet-v2-header\">\n <CloseButton\n size={Size.SMALL}\n onClick={() => {\n onClose?.();\n }}\n />\n </div>\n <div\n className={clsx(\n 'np-bottom-sheet-v2-content-inner',\n title && 'np-bottom-sheet-v2-content-inner--has-title',\n padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md',\n )}\n >\n {title ? (\n <h2 className=\"np-bottom-sheet-v2-title np-text-title-body\">{title}</h2>\n ) : null}\n <div className=\"np-bottom-sheet-v2-body np-text-body-default\">\n {children}\n </div>\n </div>\n </Transition.Child>\n </Fragment>\n </FloatingFocusManager>\n </FocusScope>\n </div>\n </Transition>\n </ThemeProvider>\n </FloatingPortal>\n </>\n );\n}\n"],"names":["BottomSheet","open","renderTrigger","title","initialFocusRef","padding","children","onClose","onCloseEnd","useVirtualKeyboard","refs","context","useFloating","onOpenChange","value","dismiss","useDismiss","role","useRole","getReferenceProps","getFloatingProps","useInteractions","floatingKey","setFloatingKey","useState","theme","screenMode","useTheme","_jsxs","_Fragment","_jsx","PreventScroll","ref","setReference","getInteractionProps","FloatingPortal","ThemeProvider","isNotRootProvider","Transition","show","className","beforeEnter","prev","afterLeave","Child","enterFrom","leaveTo","FocusScope","FloatingFocusManager","initialFocus","Fragment","setFloating","CloseButton","size","Size","SMALL","onClick","clsx"],"mappings":";;;;;;;;;;;;;;AAmCM,SAAUA,WAAWA,CAAC;EAC1BC,IAAI;EACJC,aAAa;EACbC,KAAK;EACLC,eAAe;AACfC,EAAAA,OAAO,GAAG,IAAI;EACdC,QAAQ;EACRC,OAAO;AACPC,EAAAA;AAAU,CACO,EAAA;EACjBC,qCAAkB,CAACR,IAAI,CAAC;EAExB,MAAM;IAAES,IAA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A,CAAA,IAAA,EAAA;AAAIU,wBAAAA,SAAS,EAAC,6CAA6C;AAAAlC,wBAAAA,QAAA,EAAEH;AAAK,uBAAK,CAAC,GACtE,IAAI,eACR2B,cAAA,CAAA,KAAA,EAAA;AAAKU,wBAAAA,SAAS,EAAC,8CAA8C;AAAAlC,wBAAAA,QAAA,EAC1DA;AAAQ,uBACN,CACP;AAAA,qBAAK,CACP;mBAAkB;AACpB,iBAAA,EAhCOgB,WAgCG;eACU;aACZ;AACd,WAAK,CACP;SAAY;OACC;AACjB,KAAgB,CAClB;AAAA,GAAA,CAAG;AAEP;;;;"}
@@ -20,7 +20,7 @@ function BottomSheet({
20
20
  onClose,
21
21
  onCloseEnd
22
22
  }) {
23
- useVirtualKeyboard();
23
+ useVirtualKeyboard(open);
24
24
  const {
25
25
  refs,
26
26
  context
@@ -1 +1 @@
1
- {"version":3,"file":"_BottomSheet.mjs","sources":["../../src/inputs/_BottomSheet.tsx"],"sourcesContent":["import {\n FloatingFocusManager,\n FloatingPortal,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { Transition } from '@headlessui/react';\nimport { FocusScope } from '@react-aria/focus';\nimport { ThemeProvider, useTheme } from '@wise/components-theming';\nimport { clsx } from 'clsx';\nimport { Fragment, useState } from 'react';\n\nimport { CloseButton } from '../common/closeButton';\nimport { useVirtualKeyboard } from '../common/hooks/useVirtualKeyboard';\nimport { PreventScroll } from '../common/preventScroll/PreventScroll';\nimport { Size } from '../common/propsValues/size';\n\nexport interface BottomSheetProps {\n open: boolean;\n renderTrigger?: (args: {\n ref: React.RefCallback<Element>;\n getInteractionProps: (customEventHandlers?: React.HTMLProps<Element>) => {\n [key: string]: unknown;\n };\n }) => React.ReactNode;\n title?: string;\n initialFocusRef?: React.MutableRefObject<HTMLElement | null>;\n padding?: 'none' | 'md';\n children?: React.ReactNode;\n onClose?: () => void;\n onCloseEnd?: () => void;\n}\n\nexport function BottomSheet({\n open,\n renderTrigger,\n title,\n initialFocusRef,\n padding = 'md',\n children,\n onClose,\n onCloseEnd,\n}: BottomSheetProps) {\n useVirtualKeyboard();\n\n const { refs, context } = useFloating<Element>({\n open,\n onOpenChange: (value) => {\n if (!value) {\n onClose?.();\n }\n },\n });\n\n const dismiss = useDismiss(context);\n const role = useRole(context);\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss, role]);\n\n const [floatingKey, setFloatingKey] = useState(0);\n\n const { theme, screenMode } = useTheme();\n\n return (\n <>\n {open ? <PreventScroll /> : null}\n {renderTrigger?.({\n ref: refs.setReference,\n getInteractionProps: getReferenceProps,\n })}\n\n <FloatingPortal>\n <ThemeProvider\n theme=\"personal\"\n screenMode={theme === 'personal' ? screenMode : 'light'}\n isNotRootProvider\n >\n <Transition\n show={open}\n className=\"np-bottom-sheet-v2-container\"\n beforeEnter={() => {\n setFloatingKey((prev) => prev + 1);\n }}\n afterLeave={onCloseEnd}\n >\n <Transition.Child\n className=\"np-bottom-sheet-v2-backdrop\"\n enterFrom=\"np-bottom-sheet-v2-backdrop--closed\"\n leaveTo=\"np-bottom-sheet-v2-backdrop--closed\"\n />\n\n <div className=\"np-bottom-sheet-v2\">\n <FocusScope>\n <FloatingFocusManager context={context} initialFocus={initialFocusRef}>\n <Fragment\n key={floatingKey} // Force inner state invalidation on open\n >\n <Transition.Child\n ref={refs.setFloating}\n className=\"np-bottom-sheet-v2-content\"\n enterFrom=\"np-bottom-sheet-v2-content--closed\"\n leaveTo=\"np-bottom-sheet-v2-content--closed\"\n {...getFloatingProps()}\n >\n <div className=\"np-bottom-sheet-v2-header\">\n <CloseButton\n size={Size.SMALL}\n onClick={() => {\n onClose?.();\n }}\n />\n </div>\n <div\n className={clsx(\n 'np-bottom-sheet-v2-content-inner',\n title && 'np-bottom-sheet-v2-content-inner--has-title',\n padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md',\n )}\n >\n {title ? (\n <h2 className=\"np-bottom-sheet-v2-title np-text-title-body\">{title}</h2>\n ) : null}\n <div className=\"np-bottom-sheet-v2-body np-text-body-default\">\n {children}\n </div>\n </div>\n </Transition.Child>\n </Fragment>\n </FloatingFocusManager>\n </FocusScope>\n </div>\n </Transition>\n </ThemeProvider>\n </FloatingPortal>\n </>\n );\n}\n"],"names":["BottomSheet","open","renderTrigger","title","initialFocusRef","padding","children","onClose","onCloseEnd","useVirtualKeyboard","refs","context","useFloating","onOpenChange","value","dismiss","useDismiss","role","useRole","getReferenceProps","getFloatingProps","useInteractions","floatingKey","setFloatingKey","useState","theme","screenMode","useTheme","_jsxs","_Fragment","_jsx","PreventScroll","ref","setReference","getInteractionProps","FloatingPortal","ThemeProvider","isNotRootProvider","Transition","show","className","beforeEnter","prev","afterLeave","Child","enterFrom","leaveTo","FocusScope","FloatingFocusManager","initialFocus","Fragment","setFloating","CloseButton","size","Size","SMALL","onClick","clsx"],"mappings":";;;;;;;;;;;;AAmCM,SAAUA,WAAWA,CAAC;EAC1BC,IAAI;EACJC,aAAa;EACbC,KAAK;EACLC,eAAe;AACfC,EAAAA,OAAO,GAAG,IAAI;EACdC,QAAQ;EACRC,OAAO;AACPC,EAAAA;AAAU,CACO,EAAA;AACjBC,EAAAA,kBAAkB,EAAE;EAEpB,MAAM;IAAEC,IAAI;AAAEC,IAAAA;GAAS,GAAGC,WAAW,CAAU;IAC7CX,IAAI;IACJY,YAAY,EAAGC,KAAK,IAAI;MACtB,IAAI,CAACA,KAAK,EAAE;AACVP,QAAAA,OAAO,IAAI;AACb,MAAA;AACF,IAAA;AACD,GAAA,CAAC;AAEF,EAAA,MAAMQ,OAAO,GAAGC,UAAU,CAACL,OAAO,CAAC;AACnC,EAAA,MAAMM,IAAI,GAAGC,OAAO,CAACP,OAAO,CAAC;EAC7B,MAAM;IAAEQ,iBAAiB;AAAEC,IAAAA;GAAkB,GAAGC,eAAe,CAAC,CAACN,OAAO,EAAEE,IAAI,CAAC,CAAC;EAEhF,MAAM,CAACK,WAAW,EAAEC,cAAc,CAAC,GAAGC,QAAQ,C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eACpEwB,GAAA,CAACoB,UAAQ,EAAA;AAAA5C,kBAAAA,QAAA,eAGPsB,IAAA,CAACU,UAAU,CAACM,KAAK,EAAA;oBACfZ,GAAG,EAAEtB,IAAI,CAACyC,WAAY;AACtBX,oBAAAA,SAAS,EAAC,4BAA4B;AACtCK,oBAAAA,SAAS,EAAC,oCAAoC;AAC9CC,oBAAAA,OAAO,EAAC,oCAAoC;oBAAA,GACxC1B,gBAAgB,EAAE;AAAAd,oBAAAA,QAAA,gBAEtBwB,GAAA,CAAA,KAAA,EAAA;AAAKU,sBAAAA,SAAS,EAAC,2BAA2B;sBAAAlC,QAAA,eACxCwB,GAAA,CAACsB,WAAW,EAAA;wBACVC,IAAI,EAAEC,IAAI,CAACC,KAAM;wBACjBC,OAAO,EAAEA,MAAK;AACZjD,0BAAAA,OAAO,IAAI;AACb,wBAAA;uBAAE;qBAED,CACL,eAAAqB,IAAA,CAAA,KAAA,EAAA;AACEY,sBAAAA,SAAS,EAAEiB,IAAI,CACb,kCAAkC,EAClCtD,KAAK,IAAI,6CAA6C,EACtDE,OAAO,KAAK,IAAI,IAAI,8CAA8C,CAClE;sBAAAC,QAAA,EAAA,CAEDH,KAAK,gBACJ2B,GAAA,CAAA,IAAA,EAAA;AAAIU,wBAAAA,SAAS,EAAC,6CAA6C;AAAAlC,wBAAAA,QAAA,EAAEH;AAAK,uBAAK,CAAC,GACtE,IAAI,eACR2B,GAAA,CAAA,KAAA,EAAA;AAAKU,wBAAAA,SAAS,EAAC,8CAA8C;AAAAlC,wBAAAA,QAAA,EAC1DA;AAAQ,uBACN,CACP;AAAA,qBAAK,CACP;mBAAkB;AACpB,iBAAA,EAhCOgB,WAgCG;eACU;aACZ;AACd,WAAK,CACP;SAAY;OACC;AACjB,KAAgB,CAClB;AAAA,GAAA,CAAG;AAEP;;;;"}
1
+ {"version":3,"file":"_BottomSheet.mjs","sources":["../../src/inputs/_BottomSheet.tsx"],"sourcesContent":["import {\n FloatingFocusManager,\n FloatingPortal,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { Transition } from '@headlessui/react';\nimport { FocusScope } from '@react-aria/focus';\nimport { ThemeProvider, useTheme } from '@wise/components-theming';\nimport { clsx } from 'clsx';\nimport { Fragment, useState } from 'react';\n\nimport { CloseButton } from '../common/closeButton';\nimport { useVirtualKeyboard } from '../common/hooks/useVirtualKeyboard';\nimport { PreventScroll } from '../common/preventScroll/PreventScroll';\nimport { Size } from '../common/propsValues/size';\n\nexport interface BottomSheetProps {\n open: boolean;\n renderTrigger?: (args: {\n ref: React.RefCallback<Element>;\n getInteractionProps: (customEventHandlers?: React.HTMLProps<Element>) => {\n [key: string]: unknown;\n };\n }) => React.ReactNode;\n title?: string;\n initialFocusRef?: React.MutableRefObject<HTMLElement | null>;\n padding?: 'none' | 'md';\n children?: React.ReactNode;\n onClose?: () => void;\n onCloseEnd?: () => void;\n}\n\nexport function BottomSheet({\n open,\n renderTrigger,\n title,\n initialFocusRef,\n padding = 'md',\n children,\n onClose,\n onCloseEnd,\n}: BottomSheetProps) {\n useVirtualKeyboard(open);\n\n const { refs, context } = useFloating<Element>({\n open,\n onOpenChange: (value) => {\n if (!value) {\n onClose?.();\n }\n },\n });\n\n const dismiss = useDismiss(context);\n const role = useRole(context);\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss, role]);\n\n const [floatingKey, setFloatingKey] = useState(0);\n\n const { theme, screenMode } = useTheme();\n\n return (\n <>\n {open ? <PreventScroll /> : null}\n {renderTrigger?.({\n ref: refs.setReference,\n getInteractionProps: getReferenceProps,\n })}\n\n <FloatingPortal>\n <ThemeProvider\n theme=\"personal\"\n screenMode={theme === 'personal' ? screenMode : 'light'}\n isNotRootProvider\n >\n <Transition\n show={open}\n className=\"np-bottom-sheet-v2-container\"\n beforeEnter={() => {\n setFloatingKey((prev) => prev + 1);\n }}\n afterLeave={onCloseEnd}\n >\n <Transition.Child\n className=\"np-bottom-sheet-v2-backdrop\"\n enterFrom=\"np-bottom-sheet-v2-backdrop--closed\"\n leaveTo=\"np-bottom-sheet-v2-backdrop--closed\"\n />\n\n <div className=\"np-bottom-sheet-v2\">\n <FocusScope>\n <FloatingFocusManager context={context} initialFocus={initialFocusRef}>\n <Fragment\n key={floatingKey} // Force inner state invalidation on open\n >\n <Transition.Child\n ref={refs.setFloating}\n className=\"np-bottom-sheet-v2-content\"\n enterFrom=\"np-bottom-sheet-v2-content--closed\"\n leaveTo=\"np-bottom-sheet-v2-content--closed\"\n {...getFloatingProps()}\n >\n <div className=\"np-bottom-sheet-v2-header\">\n <CloseButton\n size={Size.SMALL}\n onClick={() => {\n onClose?.();\n }}\n />\n </div>\n <div\n className={clsx(\n 'np-bottom-sheet-v2-content-inner',\n title && 'np-bottom-sheet-v2-content-inner--has-title',\n padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md',\n )}\n >\n {title ? (\n <h2 className=\"np-bottom-sheet-v2-title np-text-title-body\">{title}</h2>\n ) : null}\n <div className=\"np-bottom-sheet-v2-body np-text-body-default\">\n {children}\n </div>\n </div>\n </Transition.Child>\n </Fragment>\n </FloatingFocusManager>\n </FocusScope>\n </div>\n </Transition>\n </ThemeProvider>\n </FloatingPortal>\n </>\n );\n}\n"],"names":["BottomSheet","open","renderTrigger","title","initialFocusRef","padding","children","onClose","onCloseEnd","useVirtualKeyboard","refs","context","useFloating","onOpenChange","value","dismiss","useDismiss","role","useRole","getReferenceProps","getFloatingProps","useInteractions","floatingKey","setFloatingKey","useState","theme","screenMode","useTheme","_jsxs","_Fragment","_jsx","PreventScroll","ref","setReference","getInteractionProps","FloatingPortal","ThemeProvider","isNotRootProvider","Transition","show","className","beforeEnter","prev","afterLeave","Child","enterFrom","leaveTo","FocusScope","FloatingFocusManager","initialFocus","Fragment","setFloating","CloseButton","size","Size","SMALL","onClick","clsx"],"mappings":";;;;;;;;;;;;AAmCM,SAAUA,WAAWA,CAAC;EAC1BC,IAAI;EACJC,aAAa;EACbC,KAAK;EACLC,eAAe;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