@transferwise/components 0.0.0-experimental-48ee369 → 0.0.0-experimental-20865d1

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.
@@ -10027,9 +10027,7 @@ function RadioGroup({
10027
10027
  selectedValue: controlledValue,
10028
10028
  onChange
10029
10029
  }) {
10030
- const [controlled] = useState(false /* TODO: `controlledValue !== undefined` (BREAKING) */);
10031
10030
  const [uncontrolledValue, setUncontrolledValue] = useState(controlledValue);
10032
- const selectedValue = controlled ? controlledValue : uncontrolledValue;
10033
10031
  return radios.length > 0 ? /*#__PURE__*/jsx("div", {
10034
10032
  role: "radiogroup",
10035
10033
  children: radios.map(({
@@ -10041,11 +10039,9 @@ function RadioGroup({
10041
10039
  ...restProps,
10042
10040
  name: name,
10043
10041
  value: value,
10044
- checked: value === selectedValue,
10042
+ checked: value === uncontrolledValue,
10045
10043
  onChange: nextValue => {
10046
- if (!controlled) {
10047
- setUncontrolledValue(nextValue);
10048
- }
10044
+ setUncontrolledValue(nextValue);
10049
10045
  onChange(nextValue);
10050
10046
  }
10051
10047
  }, index))
@@ -12296,7 +12292,12 @@ class Typeahead extends Component {
12296
12292
  query = item.label;
12297
12293
  }
12298
12294
  this.updateSelectedValue(selected);
12299
- this.hideMenu();
12295
+ if (!item.keepFocusOnSelect) {
12296
+ this.hideMenu();
12297
+ }
12298
+ if (item.clearQueryOnSelect) {
12299
+ query = '';
12300
+ }
12300
12301
  this.setState({
12301
12302
  query
12302
12303
  });
@@ -12420,14 +12421,14 @@ class Typeahead extends Component {
12420
12421
  className: "dropdown-menu",
12421
12422
  role: "menu",
12422
12423
  "aria-labelledby": "dropdownMenu1",
12423
- children: [optionsToRender.map((option, idx) => /*#__PURE__*/jsx(Option, {
12424
+ children: [optionsToRender.length > 0 ? optionsToRender.map((option, idx) => /*#__PURE__*/jsx(Option, {
12424
12425
  query: query,
12425
12426
  option: option,
12426
12427
  selected: keyboardFocusedOptionIndex === idx,
12427
12428
  onClick: event => {
12428
12429
  this.onOptionSelected(event, option);
12429
12430
  }
12430
- }, `${option.label}${idx.toString()}`)), footer]
12431
+ }, `${option.label}${idx.toString()}`)) : null, footer]
12431
12432
  })
12432
12433
  });
12433
12434
  };
@@ -12523,10 +12524,10 @@ class Typeahead extends Component {
12523
12524
  children: /*#__PURE__*/jsx(Cross, {})
12524
12525
  })
12525
12526
  })]
12526
- }), displayAlert && /*#__PURE__*/jsx(InlineAlert, {
12527
+ }), displayAlert ? /*#__PURE__*/jsx(InlineAlert, {
12527
12528
  type: alert.type,
12528
12529
  children: alert.message
12529
- }), menu]
12530
+ }) : menu]
12530
12531
  })
12531
12532
  });
12532
12533
  }