@transferwise/components 45.19.5 → 45.20.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
@@ -6413,9 +6413,7 @@ function BottomSheet({
6413
6413
  }
6414
6414
  }
6415
6415
  });
6416
- const dismiss = react.useDismiss(context, {
6417
- outsidePressEvent: 'mousedown'
6418
- });
6416
+ const dismiss = react.useDismiss(context);
6419
6417
  const role = react.useRole(context);
6420
6418
  const {
6421
6419
  getReferenceProps,
@@ -6449,20 +6447,20 @@ function BottomSheet({
6449
6447
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
6450
6448
  className: "np-bottom-sheet-v2-backdrop"
6451
6449
  })
6452
- }), /*#__PURE__*/jsxRuntime.jsx(FocusBoundary, {
6453
- children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
6454
- context: context,
6455
- initialFocus: initialFocusRef,
6456
- guards: false,
6457
- modal: false,
6458
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
6459
- className: "np-bottom-sheet-v2",
6460
- children: /*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
6461
- className: "np-bottom-sheet-v2-content",
6462
- enter: "np-bottom-sheet-v2-content--enter",
6463
- enterFrom: "np-bottom-sheet-v2-content--enter-from",
6464
- leave: "np-bottom-sheet-v2-content--leave",
6465
- leaveTo: "np-bottom-sheet-v2-content--leave-to",
6450
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
6451
+ className: "np-bottom-sheet-v2",
6452
+ children: /*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
6453
+ className: "np-bottom-sheet-v2-content",
6454
+ enter: "np-bottom-sheet-v2-content--enter",
6455
+ enterFrom: "np-bottom-sheet-v2-content--enter-from",
6456
+ leave: "np-bottom-sheet-v2-content--leave",
6457
+ leaveTo: "np-bottom-sheet-v2-content--leave-to",
6458
+ children: /*#__PURE__*/jsxRuntime.jsx(FocusBoundary, {
6459
+ children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
6460
+ context: context,
6461
+ initialFocus: initialFocusRef,
6462
+ guards: false,
6463
+ modal: false,
6466
6464
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
6467
6465
  // Force inner state invalidation on open
6468
6466
  ref: refs.setFloating,
@@ -6560,9 +6558,7 @@ function Popover({
6560
6558
  }
6561
6559
  }
6562
6560
  });
6563
- const dismiss = react.useDismiss(context, {
6564
- outsidePressEvent: 'mousedown'
6565
- });
6561
+ const dismiss = react.useDismiss(context);
6566
6562
  const role = react.useRole(context);
6567
6563
  const {
6568
6564
  getReferenceProps,
@@ -6635,7 +6631,13 @@ function inferSearchableStrings(value) {
6635
6631
  }
6636
6632
  return [];
6637
6633
  }
6638
- const SelectInputHasValueContext = /*#__PURE__*/React.createContext(false);
6634
+ const SelectInputItemCheckPaddingContext = /*#__PURE__*/React.createContext(false);
6635
+ function useSelectInputItemCheckPadding() {
6636
+ const checkPadding = React.useContext(SelectInputItemCheckPaddingContext);
6637
+ // Avoid layout shifts during transitions via caching
6638
+ const [initialCheckPadding] = React.useState(checkPadding);
6639
+ return initialCheckPadding;
6640
+ }
6639
6641
  const SelectInputTriggerButtonPropsContext = /*#__PURE__*/React.createContext({});
6640
6642
  const SelectInputOptionContentWithinTriggerContext = /*#__PURE__*/React.createContext(false);
6641
6643
  function dedupeSelectInputOptionItem(item, existingValues) {
@@ -6762,9 +6764,10 @@ function SelectInput({
6762
6764
  children: ({
6763
6765
  disabled: uiDisabled,
6764
6766
  value
6765
- }) => /*#__PURE__*/jsxRuntime.jsx(SelectInputHasValueContext.Provider, {
6766
- value: value != null,
6767
+ }) => /*#__PURE__*/jsxRuntime.jsx(SelectInputItemCheckPaddingContext.Provider, {
6768
+ value: Boolean(filterable) || value != null,
6767
6769
  children: /*#__PURE__*/jsxRuntime.jsx(OptionsOverlay, {
6770
+ placement: "bottom-start",
6768
6771
  open: open,
6769
6772
  renderTrigger: ({
6770
6773
  ref,
@@ -6865,7 +6868,7 @@ const SelectInputOptionsContainer = /*#__PURE__*/React.forwardRef(function Selec
6865
6868
  function SelectInputOptions({
6866
6869
  items,
6867
6870
  renderValue = wrapInFragment,
6868
- filterable,
6871
+ filterable = false,
6869
6872
  filterPlaceholder,
6870
6873
  searchInputRef,
6871
6874
  listboxRef
@@ -6981,6 +6984,7 @@ function SelectInputGroupItemView({
6981
6984
  needle
6982
6985
  }) {
6983
6986
  const headerId = reactId.useId();
6987
+ const checkPadding = useSelectInputItemCheckPadding();
6984
6988
  return (
6985
6989
  /*#__PURE__*/
6986
6990
  // An empty container may be rendered when no options match `needle`
@@ -6989,11 +6993,13 @@ function SelectInputGroupItemView({
6989
6993
  role: "group",
6990
6994
  "aria-labelledby": headerId,
6991
6995
  className: classNames__default.default(needle === null && 'np-select-input-group-item--without-needle'),
6992
- children: [needle == null ? /*#__PURE__*/jsxRuntime.jsx("header", {
6996
+ children: [needle == null ? /*#__PURE__*/jsxRuntime.jsxs("header", {
6993
6997
  id: headerId,
6994
6998
  role: "presentation",
6995
6999
  className: "np-select-input-group-item-header np-text-title-group",
6996
- children: item.label
7000
+ children: [checkPadding ? /*#__PURE__*/jsxRuntime.jsx("span", {
7001
+ className: "np-select-input-option-check-placeholder"
7002
+ }) : null, item.label]
6997
7003
  }) : null, item.options.map((option, index) => /*#__PURE__*/jsxRuntime.jsx(SelectInputItemView
6998
7004
  // eslint-disable-next-line react/no-array-index-key
6999
7005
  , {
@@ -7009,24 +7015,24 @@ function SelectInputOption({
7009
7015
  disabled,
7010
7016
  children
7011
7017
  }) {
7018
+ const checkPadding = useSelectInputItemCheckPadding();
7012
7019
  return /*#__PURE__*/jsxRuntime.jsx(react$1.Listbox.Option, {
7013
7020
  as: "div",
7014
7021
  value: value,
7015
7022
  disabled: disabled,
7016
7023
  className: ({
7017
7024
  active,
7018
- selected,
7019
7025
  disabled: uiDisabled
7020
- }) => classNames__default.default('np-select-input-option-container np-text-body-large', active && 'np-select-input-option-container--active', selected && 'np-select-input-option-container--selected', uiDisabled && 'np-select-input-option-container--disabled'),
7026
+ }) => classNames__default.default('np-select-input-option-container np-text-body-large', active && 'np-select-input-option-container--active', uiDisabled && 'np-select-input-option-container--disabled'),
7021
7027
  children: ({
7022
7028
  selected
7023
7029
  }) => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7024
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
7030
+ children: [checkPadding ? /*#__PURE__*/jsxRuntime.jsx(icons.Check, {
7031
+ size: 16,
7032
+ className: classNames__default.default('np-select-input-option-check', !selected && 'np-select-input-option-check--not-selected')
7033
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
7025
7034
  className: "np-select-input-option",
7026
7035
  children: children
7027
- }), selected && /*#__PURE__*/jsxRuntime.jsx(icons.Check, {
7028
- size: 24,
7029
- className: classNames__default.default('np-select-input-option-check')
7030
7036
  })]
7031
7037
  })
7032
7038
  });