@producteca/producteca-ui-kit 1.77.4 → 1.77.6

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.
@@ -20808,11 +20808,16 @@ const SelectFieldBase = (props) => {
20808
20808
  tooltipProps
20809
20809
  } = props;
20810
20810
  const value = input?.value ?? props.value;
20811
- const defaultOption = filter$1(
20812
- options,
20813
- (option) => includes$1(value, _valueGetter(option, getOptionValue4))
20811
+ const isControlled = input !== void 0 || props.value !== void 0;
20812
+ const resolveSelected = (raw) => {
20813
+ if (raw === null || raw === void 0) return isMultiple ? [] : null;
20814
+ const val = isArray$h(raw) ? raw : [raw];
20815
+ const matchingOptions = filter$1(options, (option) => includes$1(val, _valueGetter(option, getOptionValue4)));
20816
+ return isMultiple ? matchingOptions : matchingOptions[0] || null;
20817
+ };
20818
+ const [optionSelected, setOptionSelected] = useState(
20819
+ () => resolveSelected(isControlled ? value : defaultValue2)
20814
20820
  );
20815
- const [optionSelected, setOptionSelected] = useState(defaultOption || null);
20816
20821
  const [isFocused, setIsFocused] = useState(false);
20817
20822
  const validationProps = { meta, value, isValid: isValid2, required };
20818
20823
  const validated = formValidation(validationProps);
@@ -20841,12 +20846,15 @@ const SelectFieldBase = (props) => {
20841
20846
  setOptionSelected(selected2);
20842
20847
  };
20843
20848
  useEffect(() => {
20844
- if (defaultValue2 && options.length > 0) {
20845
- const val = isArray$h(defaultValue2) ? defaultValue2 : [defaultValue2];
20846
- const matchingOptions = filter$1(options, (option) => includes$1(val, _valueGetter(option, getOptionValue4)));
20847
- setOptionSelected(isMultiple ? matchingOptions : matchingOptions[0] || null);
20849
+ if (isControlled) {
20850
+ setOptionSelected(resolveSelected(value));
20851
+ }
20852
+ }, [value, options]);
20853
+ useEffect(() => {
20854
+ if (defaultValue2 != null && options.length > 0) {
20855
+ setOptionSelected(resolveSelected(defaultValue2));
20848
20856
  }
20849
- }, [defaultValue2, options]);
20857
+ }, [options]);
20850
20858
  const OptionWithFormat = (optionProps) => /* @__PURE__ */ jsx$1(Option$1, { ...optionProps, formatOption, tooltipProps });
20851
20859
  const SingleValueWithFormat = (singleValueProps) => /* @__PURE__ */ jsx$1(SingleValue2, { ...singleValueProps, getOptionLabel: getOptionLabel4 });
20852
20860
  const MultiValueWithFormat = (multiValueProps) => /* @__PURE__ */ jsx$1(MultiValue2, { ...multiValueProps, formatOption });
@@ -57615,6 +57623,9 @@ const datePickerDayStyles = {
57615
57623
  color: "var(--grey-900)",
57616
57624
  border: "1px solid var(--grey-900)"
57617
57625
  },
57626
+ "&.Mui-disabled": {
57627
+ opacity: "0.5"
57628
+ },
57618
57629
  "&.Mui-selected": {
57619
57630
  backgroundColor: "var(--primary-500)",
57620
57631
  color: "white",