@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.
package/build/index.js CHANGED
@@ -5537,6 +5537,11 @@ const Logo = ({
5537
5537
  });
5538
5538
  const isSmall = clientWidth < exports.Breakpoint.SMALL;
5539
5539
  const LogoSvg = isSmall ? svgPaths[`WISE_FLAG${inverse ? '_INVERSE' : ''}`] : svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
5540
+
5541
+ // If clientWidth is not defined, don't render anything
5542
+ if (clientWidth === null) {
5543
+ return null;
5544
+ }
5540
5545
  return /*#__PURE__*/jsxRuntime.jsx(LogoSvg, {
5541
5546
  className: classNames__default.default('np-logo-svg', className),
5542
5547
  alt: type === exports.LogoType.WISE ? 'Wise' : 'Wise business'
@@ -6666,13 +6671,6 @@ function inferSearchableStrings(value) {
6666
6671
  }
6667
6672
  return [];
6668
6673
  }
6669
- const SelectInputItemCheckPaddingContext = /*#__PURE__*/React.createContext(false);
6670
- function useSelectInputItemCheckPadding() {
6671
- const checkPadding = React.useContext(SelectInputItemCheckPaddingContext);
6672
- // Avoid layout shifts during transitions via caching
6673
- const [initialCheckPadding] = React.useState(checkPadding);
6674
- return initialCheckPadding;
6675
- }
6676
6674
  const SelectInputTriggerButtonPropsContext = /*#__PURE__*/React.createContext({});
6677
6675
  const SelectInputOptionContentWithinTriggerContext = /*#__PURE__*/React.createContext(false);
6678
6676
  function dedupeSelectInputOptionItem(item, existingValues) {
@@ -6817,54 +6815,51 @@ function SelectInput({
6817
6815
  children: ({
6818
6816
  disabled: uiDisabled,
6819
6817
  value
6820
- }) => /*#__PURE__*/jsxRuntime.jsx(SelectInputItemCheckPaddingContext.Provider, {
6821
- value: Boolean(filterable) || value != null,
6822
- children: /*#__PURE__*/jsxRuntime.jsx(OptionsOverlay, {
6823
- placement: "bottom-start",
6824
- open: open,
6825
- renderTrigger: ({
6826
- ref,
6827
- getInteractionProps
6828
- }) => /*#__PURE__*/jsxRuntime.jsx(SelectInputTriggerButtonPropsContext.Provider, {
6829
- // eslint-disable-next-line react/jsx-no-constructed-context-values
6830
- value: {
6831
- ref: mergeRefs__default.default([ref, triggerRef]),
6832
- ...mergeProps__default.default({
6833
- onClick: () => {
6834
- setOpen(prev => !prev);
6835
- }
6836
- }, getInteractionProps())
6837
- },
6838
- children: renderTrigger({
6839
- content: value != null ? /*#__PURE__*/jsxRuntime.jsx(SelectInputOptionContentWithinTriggerContext.Provider, {
6840
- value: true,
6841
- children: renderValue(value, true)
6842
- }) : placeholder,
6843
- placeholderShown: value == null,
6844
- clear: onClear != null ? () => {
6845
- onClear();
6846
- triggerRef.current?.focus({
6847
- preventScroll: true
6848
- });
6849
- } : undefined,
6850
- disabled: uiDisabled,
6851
- size,
6852
- className
6853
- })
6854
- }),
6855
- initialFocusRef: controllerRef,
6856
- padding: "none",
6857
- onClose: () => {
6858
- setOpen(false);
6818
+ }) => /*#__PURE__*/jsxRuntime.jsx(OptionsOverlay, {
6819
+ placement: "bottom-start",
6820
+ open: open,
6821
+ renderTrigger: ({
6822
+ ref,
6823
+ getInteractionProps
6824
+ }) => /*#__PURE__*/jsxRuntime.jsx(SelectInputTriggerButtonPropsContext.Provider, {
6825
+ // eslint-disable-next-line react/jsx-no-constructed-context-values
6826
+ value: {
6827
+ ref: mergeRefs__default.default([ref, triggerRef]),
6828
+ ...mergeProps__default.default({
6829
+ onClick: () => {
6830
+ setOpen(prev => !prev);
6831
+ }
6832
+ }, getInteractionProps())
6859
6833
  },
6860
- children: /*#__PURE__*/jsxRuntime.jsx(SelectInputOptions, {
6861
- items: items,
6862
- renderValue: renderValue,
6863
- filterable: filterable,
6864
- filterPlaceholder: filterPlaceholder,
6865
- searchInputRef: searchInputRef,
6866
- listboxRef: listboxRef
6834
+ children: renderTrigger({
6835
+ content: value != null ? /*#__PURE__*/jsxRuntime.jsx(SelectInputOptionContentWithinTriggerContext.Provider, {
6836
+ value: true,
6837
+ children: renderValue(value, true)
6838
+ }) : placeholder,
6839
+ placeholderShown: value == null,
6840
+ clear: onClear != null ? () => {
6841
+ onClear();
6842
+ triggerRef.current?.focus({
6843
+ preventScroll: true
6844
+ });
6845
+ } : undefined,
6846
+ disabled: uiDisabled,
6847
+ size,
6848
+ className
6867
6849
  })
6850
+ }),
6851
+ initialFocusRef: controllerRef,
6852
+ padding: "none",
6853
+ onClose: () => {
6854
+ setOpen(false);
6855
+ },
6856
+ children: /*#__PURE__*/jsxRuntime.jsx(SelectInputOptions, {
6857
+ items: items,
6858
+ renderValue: renderValue,
6859
+ filterable: filterable,
6860
+ filterPlaceholder: filterPlaceholder,
6861
+ searchInputRef: searchInputRef,
6862
+ listboxRef: listboxRef
6868
6863
  })
6869
6864
  })
6870
6865
  });
@@ -7054,7 +7049,6 @@ function SelectInputGroupItemView({
7054
7049
  needle
7055
7050
  }) {
7056
7051
  const headerId = reactId.useId();
7057
- const checkPadding = useSelectInputItemCheckPadding();
7058
7052
  return (
7059
7053
  /*#__PURE__*/
7060
7054
  // An empty container may be rendered when no options match `needle`
@@ -7063,13 +7057,11 @@ function SelectInputGroupItemView({
7063
7057
  role: "group",
7064
7058
  "aria-labelledby": headerId,
7065
7059
  className: classNames__default.default(needle === null && 'np-select-input-group-item--without-needle'),
7066
- children: [needle == null ? /*#__PURE__*/jsxRuntime.jsxs("header", {
7060
+ children: [needle == null ? /*#__PURE__*/jsxRuntime.jsx("header", {
7067
7061
  id: headerId,
7068
7062
  role: "presentation",
7069
7063
  className: "np-select-input-group-item-header np-text-title-group",
7070
- children: [checkPadding ? /*#__PURE__*/jsxRuntime.jsx("span", {
7071
- className: "np-select-input-option-check-placeholder"
7072
- }) : null, item.label]
7064
+ children: item.label
7073
7065
  }) : null, item.options.map((option, index) => /*#__PURE__*/jsxRuntime.jsx(SelectInputItemView
7074
7066
  // eslint-disable-next-line react/no-array-index-key
7075
7067
  , {
@@ -7085,7 +7077,6 @@ function SelectInputOption({
7085
7077
  disabled,
7086
7078
  children
7087
7079
  }) {
7088
- const checkPadding = useSelectInputItemCheckPadding();
7089
7080
  return /*#__PURE__*/jsxRuntime.jsx(react$1.Listbox.Option, {
7090
7081
  as: "div",
7091
7082
  value: value,
@@ -7097,12 +7088,12 @@ function SelectInputOption({
7097
7088
  children: ({
7098
7089
  selected
7099
7090
  }) => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7100
- children: [checkPadding ? /*#__PURE__*/jsxRuntime.jsx(icons.Check, {
7101
- size: 16,
7102
- className: classNames__default.default('np-select-input-option-check', !selected && 'np-select-input-option-check--not-selected')
7103
- }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
7091
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
7104
7092
  className: "np-select-input-option",
7105
7093
  children: children
7094
+ }), /*#__PURE__*/jsxRuntime.jsx(icons.Check, {
7095
+ size: 16,
7096
+ className: classNames__default.default('np-select-input-option-check', !selected && 'np-select-input-option-check--not-selected')
7106
7097
  })]
7107
7098
  })
7108
7099
  });