@northlight/ui 2.23.0 → 2.24.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.
@@ -13808,9 +13808,16 @@
13808
13808
  },
13809
13809
  onOptionChange,
13810
13810
  width = "100%",
13811
- variant = "outline"
13811
+ variant = "outline",
13812
+ initialValue = ""
13812
13813
  }) => {
13813
- const [selectedOption, setSelectedOption] = React.useState(null);
13814
+ const initialSelectedOption = React.useMemo(
13815
+ () => standardOptions.find(
13816
+ (option) => option.value === initialValue
13817
+ ) || null,
13818
+ []
13819
+ );
13820
+ const [selectedOption, setSelectedOption] = React.useState(initialSelectedOption);
13814
13821
  const [newOptionText, setNewOptionText] = React.useState("");
13815
13822
  const [newOptionPlaceholder, setNewOptionPlaceholder] = React.useState(initialPlaceholder);
13816
13823
  const [createdOptions, setCreatedOptions] = React.useState([]);
@@ -13832,7 +13839,8 @@
13832
13839
  function isCreationOption(option) {
13833
13840
  return option && typeof option.isCreation === "string";
13834
13841
  }
13835
- const handleChange = (option) => {
13842
+ const handleChange = (newValue, _actionMeta) => {
13843
+ const option = newValue;
13836
13844
  if (option === null) {
13837
13845
  return;
13838
13846
  }
@@ -13861,18 +13869,19 @@
13861
13869
  return /* @__PURE__ */ React.createElement(
13862
13870
  chakraReactSelect.CreatableSelect,
13863
13871
  {
13864
- chakraStyles: {
13872
+ chakraStyles: __spreadProps(__spreadValues({}, customSelectStyles), {
13865
13873
  container: (provided) => __spreadProps(__spreadValues({}, provided), {
13866
13874
  width
13867
13875
  }),
13868
13876
  option: (provided, { isSelected }) => __spreadValues(__spreadValues({}, provided), isSelected && {
13869
13877
  color: "black"
13870
13878
  })
13871
- },
13879
+ }),
13872
13880
  components: customComponents,
13873
13881
  options: customOptions,
13874
13882
  value: selectedOption,
13875
13883
  onChange: handleChange,
13884
+ isMulti: false,
13876
13885
  onInputChange: handleInputChange,
13877
13886
  onKeyDown: handleKeyDown,
13878
13887
  onCreateOption: handleCreateOption,