@transferwise/components 45.21.0 → 45.21.2

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.
@@ -5503,6 +5503,11 @@ const Logo = ({
5503
5503
  });
5504
5504
  const isSmall = clientWidth < Breakpoint.SMALL;
5505
5505
  const LogoSvg = isSmall ? svgPaths[`WISE_FLAG${inverse ? '_INVERSE' : ''}`] : svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
5506
+
5507
+ // If clientWidth is not defined, don't render anything
5508
+ if (clientWidth === null) {
5509
+ return null;
5510
+ }
5506
5511
  return /*#__PURE__*/jsx(LogoSvg, {
5507
5512
  className: classNames('np-logo-svg', className),
5508
5513
  alt: type === LogoType.WISE ? 'Wise' : 'Wise business'
@@ -6632,13 +6637,6 @@ function inferSearchableStrings(value) {
6632
6637
  }
6633
6638
  return [];
6634
6639
  }
6635
- const SelectInputItemCheckPaddingContext = /*#__PURE__*/createContext(false);
6636
- function useSelectInputItemCheckPadding() {
6637
- const checkPadding = useContext(SelectInputItemCheckPaddingContext);
6638
- // Avoid layout shifts during transitions via caching
6639
- const [initialCheckPadding] = useState(checkPadding);
6640
- return initialCheckPadding;
6641
- }
6642
6640
  const SelectInputTriggerButtonPropsContext = /*#__PURE__*/createContext({});
6643
6641
  const SelectInputOptionContentWithinTriggerContext = /*#__PURE__*/createContext(false);
6644
6642
  function dedupeSelectInputOptionItem(item, existingValues) {
@@ -6783,54 +6781,51 @@ function SelectInput({
6783
6781
  children: ({
6784
6782
  disabled: uiDisabled,
6785
6783
  value
6786
- }) => /*#__PURE__*/jsx(SelectInputItemCheckPaddingContext.Provider, {
6787
- value: Boolean(filterable) || value != null,
6788
- children: /*#__PURE__*/jsx(OptionsOverlay, {
6789
- placement: "bottom-start",
6790
- open: open,
6791
- renderTrigger: ({
6792
- ref,
6793
- getInteractionProps
6794
- }) => /*#__PURE__*/jsx(SelectInputTriggerButtonPropsContext.Provider, {
6795
- // eslint-disable-next-line react/jsx-no-constructed-context-values
6796
- value: {
6797
- ref: mergeRefs([ref, triggerRef]),
6798
- ...mergeProps({
6799
- onClick: () => {
6800
- setOpen(prev => !prev);
6801
- }
6802
- }, getInteractionProps())
6803
- },
6804
- children: renderTrigger({
6805
- content: value != null ? /*#__PURE__*/jsx(SelectInputOptionContentWithinTriggerContext.Provider, {
6806
- value: true,
6807
- children: renderValue(value, true)
6808
- }) : placeholder,
6809
- placeholderShown: value == null,
6810
- clear: onClear != null ? () => {
6811
- onClear();
6812
- triggerRef.current?.focus({
6813
- preventScroll: true
6814
- });
6815
- } : undefined,
6816
- disabled: uiDisabled,
6817
- size,
6818
- className
6819
- })
6820
- }),
6821
- initialFocusRef: controllerRef,
6822
- padding: "none",
6823
- onClose: () => {
6824
- setOpen(false);
6784
+ }) => /*#__PURE__*/jsx(OptionsOverlay, {
6785
+ placement: "bottom-start",
6786
+ open: open,
6787
+ renderTrigger: ({
6788
+ ref,
6789
+ getInteractionProps
6790
+ }) => /*#__PURE__*/jsx(SelectInputTriggerButtonPropsContext.Provider, {
6791
+ // eslint-disable-next-line react/jsx-no-constructed-context-values
6792
+ value: {
6793
+ ref: mergeRefs([ref, triggerRef]),
6794
+ ...mergeProps({
6795
+ onClick: () => {
6796
+ setOpen(prev => !prev);
6797
+ }
6798
+ }, getInteractionProps())
6825
6799
  },
6826
- children: /*#__PURE__*/jsx(SelectInputOptions, {
6827
- items: items,
6828
- renderValue: renderValue,
6829
- filterable: filterable,
6830
- filterPlaceholder: filterPlaceholder,
6831
- searchInputRef: searchInputRef,
6832
- listboxRef: listboxRef
6800
+ children: renderTrigger({
6801
+ content: value != null ? /*#__PURE__*/jsx(SelectInputOptionContentWithinTriggerContext.Provider, {
6802
+ value: true,
6803
+ children: renderValue(value, true)
6804
+ }) : placeholder,
6805
+ placeholderShown: value == null,
6806
+ clear: onClear != null ? () => {
6807
+ onClear();
6808
+ triggerRef.current?.focus({
6809
+ preventScroll: true
6810
+ });
6811
+ } : undefined,
6812
+ disabled: uiDisabled,
6813
+ size,
6814
+ className
6833
6815
  })
6816
+ }),
6817
+ initialFocusRef: controllerRef,
6818
+ padding: "none",
6819
+ onClose: () => {
6820
+ setOpen(false);
6821
+ },
6822
+ children: /*#__PURE__*/jsx(SelectInputOptions, {
6823
+ items: items,
6824
+ renderValue: renderValue,
6825
+ filterable: filterable,
6826
+ filterPlaceholder: filterPlaceholder,
6827
+ searchInputRef: searchInputRef,
6828
+ listboxRef: listboxRef
6834
6829
  })
6835
6830
  })
6836
6831
  });
@@ -7020,7 +7015,6 @@ function SelectInputGroupItemView({
7020
7015
  needle
7021
7016
  }) {
7022
7017
  const headerId = useId();
7023
- const checkPadding = useSelectInputItemCheckPadding();
7024
7018
  return (
7025
7019
  /*#__PURE__*/
7026
7020
  // An empty container may be rendered when no options match `needle`
@@ -7029,13 +7023,11 @@ function SelectInputGroupItemView({
7029
7023
  role: "group",
7030
7024
  "aria-labelledby": headerId,
7031
7025
  className: classNames(needle === null && 'np-select-input-group-item--without-needle'),
7032
- children: [needle == null ? /*#__PURE__*/jsxs("header", {
7026
+ children: [needle == null ? /*#__PURE__*/jsx("header", {
7033
7027
  id: headerId,
7034
7028
  role: "presentation",
7035
7029
  className: "np-select-input-group-item-header np-text-title-group",
7036
- children: [checkPadding ? /*#__PURE__*/jsx("span", {
7037
- className: "np-select-input-option-check-placeholder"
7038
- }) : null, item.label]
7030
+ children: item.label
7039
7031
  }) : null, item.options.map((option, index) => /*#__PURE__*/jsx(SelectInputItemView
7040
7032
  // eslint-disable-next-line react/no-array-index-key
7041
7033
  , {
@@ -7051,7 +7043,6 @@ function SelectInputOption({
7051
7043
  disabled,
7052
7044
  children
7053
7045
  }) {
7054
- const checkPadding = useSelectInputItemCheckPadding();
7055
7046
  return /*#__PURE__*/jsx(Listbox.Option, {
7056
7047
  as: "div",
7057
7048
  value: value,
@@ -7063,12 +7054,12 @@ function SelectInputOption({
7063
7054
  children: ({
7064
7055
  selected
7065
7056
  }) => /*#__PURE__*/jsxs(Fragment, {
7066
- children: [checkPadding ? /*#__PURE__*/jsx(Check, {
7067
- size: 16,
7068
- className: classNames('np-select-input-option-check', !selected && 'np-select-input-option-check--not-selected')
7069
- }) : null, /*#__PURE__*/jsx("div", {
7057
+ children: [/*#__PURE__*/jsx("div", {
7070
7058
  className: "np-select-input-option",
7071
7059
  children: children
7060
+ }), /*#__PURE__*/jsx(Check, {
7061
+ size: 16,
7062
+ className: classNames('np-select-input-option-check', !selected && 'np-select-input-option-check--not-selected')
7072
7063
  })]
7073
7064
  })
7074
7065
  });