@farmzone/fz-react-ui 1.0.5 → 1.0.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.
package/dist/index.cjs CHANGED
@@ -7677,40 +7677,35 @@ function PageFilter(props) {
7677
7677
  values,
7678
7678
  primaryColor
7679
7679
  } = props;
7680
- const [localValues, setLocalValues] = React6.useState(values);
7681
7680
  const initialValuesRef = React6.useRef(values);
7682
- const updateLocal = (updates) => {
7683
- setLocalValues((prev) => ({ ...prev, ...updates }));
7684
- };
7685
7681
  const handleInputChange = (key) => (e) => {
7686
- updateLocal({ [key]: e.target.value });
7682
+ onChange({ [key]: e.target.value });
7687
7683
  };
7688
7684
  const handleSelectChange = (key) => (value) => {
7689
- updateLocal({ [key]: value });
7685
+ onChange({ [key]: value });
7690
7686
  };
7691
7687
  const handleRadioChange = (key) => (value) => {
7692
- updateLocal({ [key]: value });
7688
+ onChange({ [key]: value });
7693
7689
  };
7694
7690
  const handleDateChange = (key) => (date) => {
7695
- updateLocal({ [key]: date });
7691
+ onChange({ [key]: date });
7696
7692
  };
7697
7693
  const handleRangeChangeCurried = (startKey, endKey) => (start, end) => {
7698
- updateLocal({ [startKey]: start, [endKey]: end });
7694
+ onChange({ [startKey]: start, [endKey]: end });
7699
7695
  };
7700
7696
  const handleCheckboxChange = (key) => (checked) => {
7701
- updateLocal({ [key]: checked ? "true" : "false" });
7697
+ onChange({ [key]: checked ? "true" : "false" });
7702
7698
  };
7703
7699
  const handleSubmit = () => {
7704
- onChange(localValues);
7705
7700
  onSubmit();
7706
7701
  };
7707
7702
  const handleReset = () => {
7708
- setLocalValues(initialValuesRef.current);
7703
+ onChange(initialValuesRef.current);
7709
7704
  onReset?.();
7710
7705
  };
7711
7706
  const renderFilterOption = (option, gap, index) => {
7712
7707
  const optionKey = option.key;
7713
- const currentValue = String(localValues[optionKey] ?? "");
7708
+ const currentValue = String(values[optionKey] ?? "");
7714
7709
  const rowGap2 = index !== 0 ? option.label ? gap : 5 : 0;
7715
7710
  switch (option.type) {
7716
7711
  case "input":
@@ -7785,10 +7780,7 @@ function PageFilter(props) {
7785
7780
  return /* @__PURE__ */ jsxRuntime.jsx(
7786
7781
  "div",
7787
7782
  {
7788
- className: cn(
7789
- "flex flex-col gap-3 bg-white py-3 px-5 border-t-main border-t-1 shadow-panel",
7790
- containerClassName
7791
- ),
7783
+ className: cn("flex flex-col gap-3 bg-white py-3 px-5 border-t-main border-t-1 shadow-panel", containerClassName),
7792
7784
  style: primaryColor ? { borderTopColor: primaryColor } : void 0,
7793
7785
  children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative flex flex-col", style: { gap: `${colGap}px` }, children: rows.map((row, ix) => {
7794
7786
  const isLastRow = rows.length - 1 === ix;