@transferwise/components 46.41.1 → 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';
@@ -4837,20 +4837,17 @@ function InlineAlert({
4837
4837
  className,
4838
4838
  children
4839
4839
  }) {
4840
- return /*#__PURE__*/jsx("div", {
4840
+ return /*#__PURE__*/jsxs("div", {
4841
4841
  role: "alert",
4842
4842
  id: id,
4843
4843
  className: classNames('alert alert-detach', `alert-${type === Sentiment.NEGATIVE || type === Sentiment.ERROR ? 'danger' : type}`, className),
4844
- children: /*#__PURE__*/jsxs("div", {
4845
- className: "d-inline-flex",
4846
- children: [type !== Sentiment.NEUTRAL && type !== Sentiment.PENDING && /*#__PURE__*/jsx(StatusIcon, {
4847
- sentiment: type,
4848
- size: Size.SMALL
4849
- }), /*#__PURE__*/jsx("div", {
4850
- className: "np-text-body-default",
4851
- children: children
4852
- })]
4853
- })
4844
+ children: [type !== Sentiment.NEUTRAL && type !== Sentiment.PENDING && /*#__PURE__*/jsx(StatusIcon, {
4845
+ sentiment: type,
4846
+ size: Size.SMALL
4847
+ }), /*#__PURE__*/jsx("div", {
4848
+ className: "np-text-body-default",
4849
+ children: children
4850
+ })]
4854
4851
  });
4855
4852
  }
4856
4853
 
@@ -6236,6 +6233,26 @@ const PolymorphicWithOverrides = /*#__PURE__*/forwardRef(function PolymorphicWit
6236
6233
  });
6237
6234
  });
6238
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
+
6239
6256
  function PreventScroll() {
6240
6257
  usePreventScroll();
6241
6258
  return null;
@@ -6251,6 +6268,7 @@ function BottomSheet({
6251
6268
  onClose,
6252
6269
  onCloseEnd
6253
6270
  }) {
6271
+ useVirtualKeyboard();
6254
6272
  const {
6255
6273
  refs,
6256
6274
  context
@@ -6290,29 +6308,21 @@ function BottomSheet({
6290
6308
  },
6291
6309
  afterLeave: onCloseEnd,
6292
6310
  children: [/*#__PURE__*/jsx(Transition.Child, {
6293
- enter: "np-bottom-sheet-v2-backdrop-container--enter",
6294
- enterFrom: "np-bottom-sheet-v2-backdrop-container--enter-from",
6295
- leave: "np-bottom-sheet-v2-backdrop-container--leave",
6296
- leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
6297
- children: /*#__PURE__*/jsx("div", {
6298
- className: "np-bottom-sheet-v2-backdrop"
6299
- })
6311
+ className: "np-bottom-sheet-v2-backdrop",
6312
+ enterFrom: "np-bottom-sheet-v2-backdrop--closed",
6313
+ leaveTo: "np-bottom-sheet-v2-backdrop--closed"
6300
6314
  }), /*#__PURE__*/jsx("div", {
6301
6315
  className: "np-bottom-sheet-v2",
6302
- children: /*#__PURE__*/jsx(Transition.Child, {
6303
- className: "np-bottom-sheet-v2-content",
6304
- enter: "np-bottom-sheet-v2-content--enter",
6305
- enterFrom: "np-bottom-sheet-v2-content--enter-from",
6306
- leave: "np-bottom-sheet-v2-content--leave",
6307
- leaveTo: "np-bottom-sheet-v2-content--leave-to",
6308
- children: /*#__PURE__*/jsx(FocusScope, {
6309
- children: /*#__PURE__*/jsx(FloatingFocusManager, {
6310
- context: context,
6311
- initialFocus: initialFocusRef,
6312
- children: /*#__PURE__*/jsxs("div", {
6313
- // 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, {
6314
6322
  ref: refs.setFloating,
6315
- 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",
6316
6326
  ...getFloatingProps(),
6317
6327
  children: [/*#__PURE__*/jsx("div", {
6318
6328
  className: "np-bottom-sheet-v2-header",
@@ -6323,9 +6333,7 @@ function BottomSheet({
6323
6333
  }
6324
6334
  })
6325
6335
  }), /*#__PURE__*/jsxs("div", {
6326
- className: classNames('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
6327
- 'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
6328
- }),
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'),
6329
6337
  children: [title ? /*#__PURE__*/jsx("h2", {
6330
6338
  className: "np-bottom-sheet-v2-title np-text-title-body",
6331
6339
  children: title
@@ -6334,8 +6342,8 @@ function BottomSheet({
6334
6342
  children: children
6335
6343
  })]
6336
6344
  })]
6337
- }, floatingKey)
6338
- })
6345
+ })
6346
+ }, floatingKey)
6339
6347
  })
6340
6348
  })
6341
6349
  })]