@transferwise/components 46.42.0 → 46.42.1

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { forwardRef, useId, cloneElement, useState, useEffect, useRef, useMemo, Component, createContext, useContext, useSyncExternalStore, useCallback, useImperativeHandle, createElement, PureComponent, createRef, isValidElement, Children, Fragment as Fragment$1 } from 'react';
2
+ import React__default, { forwardRef, useId, cloneElement, useState, useEffect, useRef, useMemo, Component, createContext, useContext, useSyncExternalStore, useCallback, useImperativeHandle, createElement, PureComponent, createRef, isValidElement, Fragment as Fragment$1, Children } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { ChevronUp, CrossCircleFill, Cross, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, NavigateAway, Briefcase, Person, ArrowRight, Download, ChevronLeft, ChevronRight, AlertCircleFill, ArrowLeft, QuestionMarkCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle, Bin } from '@transferwise/icons';
@@ -6233,6 +6233,26 @@ const PolymorphicWithOverrides = /*#__PURE__*/forwardRef(function PolymorphicWit
6233
6233
  });
6234
6234
  });
6235
6235
 
6236
+ /**
6237
+ * This progressive enhancement uses an experimental API, it might change,
6238
+ * and at the time of authoring is not supported on iOS or mobile Firefox.
6239
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/VirtualKeyboard
6240
+ */
6241
+ function useVirtualKeyboard() {
6242
+ useEffect(() => {
6243
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */
6244
+ if ('virtualKeyboard' in navigator) {
6245
+ const virtualKeyboard = navigator.virtualKeyboard;
6246
+ const initialOverlaysContent = virtualKeyboard.overlaysContent;
6247
+ virtualKeyboard.overlaysContent = true;
6248
+ return () => {
6249
+ virtualKeyboard.overlaysContent = initialOverlaysContent;
6250
+ };
6251
+ }
6252
+ /* eslint-enable @typescript-eslint/no-unsafe-member-access, functional/immutable-data */
6253
+ }, []);
6254
+ }
6255
+
6236
6256
  function PreventScroll() {
6237
6257
  usePreventScroll();
6238
6258
  return null;
@@ -6248,6 +6268,7 @@ function BottomSheet({
6248
6268
  onClose,
6249
6269
  onCloseEnd
6250
6270
  }) {
6271
+ useVirtualKeyboard();
6251
6272
  const {
6252
6273
  refs,
6253
6274
  context
@@ -6287,29 +6308,21 @@ function BottomSheet({
6287
6308
  },
6288
6309
  afterLeave: onCloseEnd,
6289
6310
  children: [/*#__PURE__*/jsx(Transition.Child, {
6290
- enter: "np-bottom-sheet-v2-backdrop-container--enter",
6291
- enterFrom: "np-bottom-sheet-v2-backdrop-container--enter-from",
6292
- leave: "np-bottom-sheet-v2-backdrop-container--leave",
6293
- leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
6294
- children: /*#__PURE__*/jsx("div", {
6295
- className: "np-bottom-sheet-v2-backdrop"
6296
- })
6311
+ className: "np-bottom-sheet-v2-backdrop",
6312
+ enterFrom: "np-bottom-sheet-v2-backdrop--closed",
6313
+ leaveTo: "np-bottom-sheet-v2-backdrop--closed"
6297
6314
  }), /*#__PURE__*/jsx("div", {
6298
6315
  className: "np-bottom-sheet-v2",
6299
- children: /*#__PURE__*/jsx(Transition.Child, {
6300
- className: "np-bottom-sheet-v2-content",
6301
- enter: "np-bottom-sheet-v2-content--enter",
6302
- enterFrom: "np-bottom-sheet-v2-content--enter-from",
6303
- leave: "np-bottom-sheet-v2-content--leave",
6304
- leaveTo: "np-bottom-sheet-v2-content--leave-to",
6305
- children: /*#__PURE__*/jsx(FocusScope, {
6306
- children: /*#__PURE__*/jsx(FloatingFocusManager, {
6307
- context: context,
6308
- initialFocus: initialFocusRef,
6309
- children: /*#__PURE__*/jsxs("div", {
6310
- // Force inner state invalidation on open
6316
+ children: /*#__PURE__*/jsx(FocusScope, {
6317
+ children: /*#__PURE__*/jsx(FloatingFocusManager, {
6318
+ context: context,
6319
+ initialFocus: initialFocusRef,
6320
+ children: /*#__PURE__*/jsx(Fragment$1, {
6321
+ children: /*#__PURE__*/jsxs(Transition.Child, {
6311
6322
  ref: refs.setFloating,
6312
- className: "np-bottom-sheet-v2-content-inner-container",
6323
+ className: "np-bottom-sheet-v2-content",
6324
+ enterFrom: "np-bottom-sheet-v2-content--closed",
6325
+ leaveTo: "np-bottom-sheet-v2-content--closed",
6313
6326
  ...getFloatingProps(),
6314
6327
  children: [/*#__PURE__*/jsx("div", {
6315
6328
  className: "np-bottom-sheet-v2-header",
@@ -6320,9 +6333,7 @@ function BottomSheet({
6320
6333
  }
6321
6334
  })
6322
6335
  }), /*#__PURE__*/jsxs("div", {
6323
- className: classNames('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
6324
- 'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
6325
- }),
6336
+ className: classNames('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md'),
6326
6337
  children: [title ? /*#__PURE__*/jsx("h2", {
6327
6338
  className: "np-bottom-sheet-v2-title np-text-title-body",
6328
6339
  children: title
@@ -6331,8 +6342,8 @@ function BottomSheet({
6331
6342
  children: children
6332
6343
  })]
6333
6344
  })]
6334
- }, floatingKey)
6335
- })
6345
+ })
6346
+ }, floatingKey)
6336
6347
  })
6337
6348
  })
6338
6349
  })]