@transferwise/components 45.19.6 → 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.
@@ -6597,7 +6597,13 @@ function inferSearchableStrings(value) {
6597
6597
  }
6598
6598
  return [];
6599
6599
  }
6600
- 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
+ }
6601
6607
  const SelectInputTriggerButtonPropsContext = /*#__PURE__*/createContext({});
6602
6608
  const SelectInputOptionContentWithinTriggerContext = /*#__PURE__*/createContext(false);
6603
6609
  function dedupeSelectInputOptionItem(item, existingValues) {
@@ -6724,9 +6730,10 @@ function SelectInput({
6724
6730
  children: ({
6725
6731
  disabled: uiDisabled,
6726
6732
  value
6727
- }) => /*#__PURE__*/jsx(SelectInputHasValueContext.Provider, {
6728
- value: value != null,
6733
+ }) => /*#__PURE__*/jsx(SelectInputItemCheckPaddingContext.Provider, {
6734
+ value: Boolean(filterable) || value != null,
6729
6735
  children: /*#__PURE__*/jsx(OptionsOverlay, {
6736
+ placement: "bottom-start",
6730
6737
  open: open,
6731
6738
  renderTrigger: ({
6732
6739
  ref,
@@ -6827,7 +6834,7 @@ const SelectInputOptionsContainer = /*#__PURE__*/forwardRef(function SelectInput
6827
6834
  function SelectInputOptions({
6828
6835
  items,
6829
6836
  renderValue = wrapInFragment,
6830
- filterable,
6837
+ filterable = false,
6831
6838
  filterPlaceholder,
6832
6839
  searchInputRef,
6833
6840
  listboxRef
@@ -6943,6 +6950,7 @@ function SelectInputGroupItemView({
6943
6950
  needle
6944
6951
  }) {
6945
6952
  const headerId = useId();
6953
+ const checkPadding = useSelectInputItemCheckPadding();
6946
6954
  return (
6947
6955
  /*#__PURE__*/
6948
6956
  // An empty container may be rendered when no options match `needle`
@@ -6951,11 +6959,13 @@ function SelectInputGroupItemView({
6951
6959
  role: "group",
6952
6960
  "aria-labelledby": headerId,
6953
6961
  className: classNames(needle === null && 'np-select-input-group-item--without-needle'),
6954
- children: [needle == null ? /*#__PURE__*/jsx("header", {
6962
+ children: [needle == null ? /*#__PURE__*/jsxs("header", {
6955
6963
  id: headerId,
6956
6964
  role: "presentation",
6957
6965
  className: "np-select-input-group-item-header np-text-title-group",
6958
- children: item.label
6966
+ children: [checkPadding ? /*#__PURE__*/jsx("span", {
6967
+ className: "np-select-input-option-check-placeholder"
6968
+ }) : null, item.label]
6959
6969
  }) : null, item.options.map((option, index) => /*#__PURE__*/jsx(SelectInputItemView
6960
6970
  // eslint-disable-next-line react/no-array-index-key
6961
6971
  , {
@@ -6971,24 +6981,24 @@ function SelectInputOption({
6971
6981
  disabled,
6972
6982
  children
6973
6983
  }) {
6984
+ const checkPadding = useSelectInputItemCheckPadding();
6974
6985
  return /*#__PURE__*/jsx(Listbox.Option, {
6975
6986
  as: "div",
6976
6987
  value: value,
6977
6988
  disabled: disabled,
6978
6989
  className: ({
6979
6990
  active,
6980
- selected,
6981
6991
  disabled: uiDisabled
6982
- }) => 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'),
6983
6993
  children: ({
6984
6994
  selected
6985
6995
  }) => /*#__PURE__*/jsxs(Fragment, {
6986
- 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", {
6987
7000
  className: "np-select-input-option",
6988
7001
  children: children
6989
- }), selected && /*#__PURE__*/jsx(Check, {
6990
- size: 24,
6991
- className: classNames('np-select-input-option-check')
6992
7002
  })]
6993
7003
  })
6994
7004
  });