@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.
@@ -6379,9 +6379,7 @@ function BottomSheet({
6379
6379
  }
6380
6380
  }
6381
6381
  });
6382
- const dismiss = useDismiss(context, {
6383
- outsidePressEvent: 'mousedown'
6384
- });
6382
+ const dismiss = useDismiss(context);
6385
6383
  const role = useRole(context);
6386
6384
  const {
6387
6385
  getReferenceProps,
@@ -6415,20 +6413,20 @@ function BottomSheet({
6415
6413
  children: /*#__PURE__*/jsx("div", {
6416
6414
  className: "np-bottom-sheet-v2-backdrop"
6417
6415
  })
6418
- }), /*#__PURE__*/jsx(FocusBoundary, {
6419
- children: /*#__PURE__*/jsx(FloatingFocusManager, {
6420
- context: context,
6421
- initialFocus: initialFocusRef,
6422
- guards: false,
6423
- modal: false,
6424
- children: /*#__PURE__*/jsx("div", {
6425
- className: "np-bottom-sheet-v2",
6426
- children: /*#__PURE__*/jsx(Transition.Child, {
6427
- className: "np-bottom-sheet-v2-content",
6428
- enter: "np-bottom-sheet-v2-content--enter",
6429
- enterFrom: "np-bottom-sheet-v2-content--enter-from",
6430
- leave: "np-bottom-sheet-v2-content--leave",
6431
- leaveTo: "np-bottom-sheet-v2-content--leave-to",
6416
+ }), /*#__PURE__*/jsx("div", {
6417
+ className: "np-bottom-sheet-v2",
6418
+ children: /*#__PURE__*/jsx(Transition.Child, {
6419
+ className: "np-bottom-sheet-v2-content",
6420
+ enter: "np-bottom-sheet-v2-content--enter",
6421
+ enterFrom: "np-bottom-sheet-v2-content--enter-from",
6422
+ leave: "np-bottom-sheet-v2-content--leave",
6423
+ leaveTo: "np-bottom-sheet-v2-content--leave-to",
6424
+ children: /*#__PURE__*/jsx(FocusBoundary, {
6425
+ children: /*#__PURE__*/jsx(FloatingFocusManager, {
6426
+ context: context,
6427
+ initialFocus: initialFocusRef,
6428
+ guards: false,
6429
+ modal: false,
6432
6430
  children: /*#__PURE__*/jsxs("div", {
6433
6431
  // Force inner state invalidation on open
6434
6432
  ref: refs.setFloating,
@@ -6526,9 +6524,7 @@ function Popover({
6526
6524
  }
6527
6525
  }
6528
6526
  });
6529
- const dismiss = useDismiss(context, {
6530
- outsidePressEvent: 'mousedown'
6531
- });
6527
+ const dismiss = useDismiss(context);
6532
6528
  const role = useRole(context);
6533
6529
  const {
6534
6530
  getReferenceProps,
@@ -6601,7 +6597,13 @@ function inferSearchableStrings(value) {
6601
6597
  }
6602
6598
  return [];
6603
6599
  }
6604
- const SelectInputHasValueContext = /*#__PURE__*/createContext(false);
6600
+ const SelectInputItemCheckPaddingContext = /*#__PURE__*/createContext(false);
6601
+ function useSelectInputItemCheckPadding() {
6602
+ const checkPadding = useContext(SelectInputItemCheckPaddingContext);
6603
+ // Avoid layout shifts during transitions via caching
6604
+ const [initialCheckPadding] = useState(checkPadding);
6605
+ return initialCheckPadding;
6606
+ }
6605
6607
  const SelectInputTriggerButtonPropsContext = /*#__PURE__*/createContext({});
6606
6608
  const SelectInputOptionContentWithinTriggerContext = /*#__PURE__*/createContext(false);
6607
6609
  function dedupeSelectInputOptionItem(item, existingValues) {
@@ -6728,9 +6730,10 @@ function SelectInput({
6728
6730
  children: ({
6729
6731
  disabled: uiDisabled,
6730
6732
  value
6731
- }) => /*#__PURE__*/jsx(SelectInputHasValueContext.Provider, {
6732
- value: value != null,
6733
+ }) => /*#__PURE__*/jsx(SelectInputItemCheckPaddingContext.Provider, {
6734
+ value: Boolean(filterable) || value != null,
6733
6735
  children: /*#__PURE__*/jsx(OptionsOverlay, {
6736
+ placement: "bottom-start",
6734
6737
  open: open,
6735
6738
  renderTrigger: ({
6736
6739
  ref,
@@ -6831,7 +6834,7 @@ const SelectInputOptionsContainer = /*#__PURE__*/forwardRef(function SelectInput
6831
6834
  function SelectInputOptions({
6832
6835
  items,
6833
6836
  renderValue = wrapInFragment,
6834
- filterable,
6837
+ filterable = false,
6835
6838
  filterPlaceholder,
6836
6839
  searchInputRef,
6837
6840
  listboxRef
@@ -6947,6 +6950,7 @@ function SelectInputGroupItemView({
6947
6950
  needle
6948
6951
  }) {
6949
6952
  const headerId = useId();
6953
+ const checkPadding = useSelectInputItemCheckPadding();
6950
6954
  return (
6951
6955
  /*#__PURE__*/
6952
6956
  // An empty container may be rendered when no options match `needle`
@@ -6955,11 +6959,13 @@ function SelectInputGroupItemView({
6955
6959
  role: "group",
6956
6960
  "aria-labelledby": headerId,
6957
6961
  className: classNames(needle === null && 'np-select-input-group-item--without-needle'),
6958
- children: [needle == null ? /*#__PURE__*/jsx("header", {
6962
+ children: [needle == null ? /*#__PURE__*/jsxs("header", {
6959
6963
  id: headerId,
6960
6964
  role: "presentation",
6961
6965
  className: "np-select-input-group-item-header np-text-title-group",
6962
- children: item.label
6966
+ children: [checkPadding ? /*#__PURE__*/jsx("span", {
6967
+ className: "np-select-input-option-check-placeholder"
6968
+ }) : null, item.label]
6963
6969
  }) : null, item.options.map((option, index) => /*#__PURE__*/jsx(SelectInputItemView
6964
6970
  // eslint-disable-next-line react/no-array-index-key
6965
6971
  , {
@@ -6975,24 +6981,24 @@ function SelectInputOption({
6975
6981
  disabled,
6976
6982
  children
6977
6983
  }) {
6984
+ const checkPadding = useSelectInputItemCheckPadding();
6978
6985
  return /*#__PURE__*/jsx(Listbox.Option, {
6979
6986
  as: "div",
6980
6987
  value: value,
6981
6988
  disabled: disabled,
6982
6989
  className: ({
6983
6990
  active,
6984
- selected,
6985
6991
  disabled: uiDisabled
6986
- }) => classNames('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'),
6992
+ }) => classNames('np-select-input-option-container np-text-body-large', active && 'np-select-input-option-container--active', uiDisabled && 'np-select-input-option-container--disabled'),
6987
6993
  children: ({
6988
6994
  selected
6989
6995
  }) => /*#__PURE__*/jsxs(Fragment, {
6990
- children: [/*#__PURE__*/jsx("div", {
6996
+ children: [checkPadding ? /*#__PURE__*/jsx(Check, {
6997
+ size: 16,
6998
+ className: classNames('np-select-input-option-check', !selected && 'np-select-input-option-check--not-selected')
6999
+ }) : null, /*#__PURE__*/jsx("div", {
6991
7000
  className: "np-select-input-option",
6992
7001
  children: children
6993
- }), selected && /*#__PURE__*/jsx(Check, {
6994
- size: 24,
6995
- className: classNames('np-select-input-option-check')
6996
7002
  })]
6997
7003
  })
6998
7004
  });