@northlight/ui 2.31.0 → 2.31.1

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.
@@ -4240,7 +4240,7 @@ interface CreatableSelectDropdownProps<T extends string = string> extends Compon
4240
4240
  declare const CreatableSelectDropdown: <T extends string = string>({ standardOptions, initialPlaceholder, addOptionPlaceholder, creationOption, onOptionChange, variant, defaultValue, value, menuPlacement, ...restProps }: CreatableSelectDropdownProps<T>) => JSX.Element;
4241
4241
 
4242
4242
  type ComboPickerValue = {
4243
- input: number;
4243
+ input?: number;
4244
4244
  option: ComboPickerOption;
4245
4245
  };
4246
4246
  type ComboPickerOption = {
@@ -4286,6 +4286,7 @@ declare const ComboPicker: ({ onChange, options, size, value, placeholder, preci
4286
4286
  * <ComboPickerField
4287
4287
  * label="Budget"
4288
4288
  * name="budget"
4289
+ * placeholder="Amount"
4289
4290
  * options={ [
4290
4291
  * { label: 'USD', value: 'usd' },
4291
4292
  * { label: 'EUR', value: 'eur' },
@@ -14291,18 +14291,18 @@ const ComboPicker = (_a) => {
14291
14291
  "isDisabled",
14292
14292
  "isReadOnly"
14293
14293
  ]);
14294
+ var _a2;
14294
14295
  const { isOpen, onToggle, onClose } = useDisclosure();
14295
- const [inputValue, setInputValue] = useState(value ? value.input : 0);
14296
- const [selectOption, setSelectOption] = useState(value ? value.option : options[0]);
14296
+ const [inputValue, setInputValue] = useState(value == null ? void 0 : value.input);
14297
+ const [selectOption, setSelectOption] = useState((_a2 = value == null ? void 0 : value.option) != null ? _a2 : options[0]);
14297
14298
  const [enableSelectInput, setEnableSelectInput] = useState(false);
14298
14299
  const buttonRef = useRef();
14299
14300
  const selectRef = useRef();
14301
+ const getNewValue = (option, input) => input ? { input: Number(input), option } : { option };
14300
14302
  const handleInputChange = (newInputvalue) => {
14301
- setInputValue(Number(newInputvalue.floatValue));
14302
- onChange == null ? void 0 : onChange({
14303
- input: Number(newInputvalue.floatValue),
14304
- option: selectOption
14305
- });
14303
+ const newValue = getNewValue(selectOption, newInputvalue.floatValue);
14304
+ setInputValue(newValue.input);
14305
+ onChange == null ? void 0 : onChange(newValue);
14306
14306
  };
14307
14307
  const handleSelectClose = () => {
14308
14308
  if (buttonRef.current) {
@@ -14314,10 +14314,7 @@ const ComboPicker = (_a) => {
14314
14314
  const handleSelectChange = (selectedOption) => {
14315
14315
  if (selectedOption) {
14316
14316
  setSelectOption(selectedOption);
14317
- onChange == null ? void 0 : onChange({
14318
- input: inputValue,
14319
- option: selectedOption
14320
- });
14317
+ onChange == null ? void 0 : onChange(getNewValue(selectedOption, inputValue));
14321
14318
  handleSelectClose();
14322
14319
  }
14323
14320
  };