@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.js CHANGED
@@ -7643,40 +7643,35 @@ function PageFilter(props) {
7643
7643
  values,
7644
7644
  primaryColor
7645
7645
  } = props;
7646
- const [localValues, setLocalValues] = useState(values);
7647
7646
  const initialValuesRef = useRef(values);
7648
- const updateLocal = (updates) => {
7649
- setLocalValues((prev) => ({ ...prev, ...updates }));
7650
- };
7651
7647
  const handleInputChange = (key) => (e) => {
7652
- updateLocal({ [key]: e.target.value });
7648
+ onChange({ [key]: e.target.value });
7653
7649
  };
7654
7650
  const handleSelectChange = (key) => (value) => {
7655
- updateLocal({ [key]: value });
7651
+ onChange({ [key]: value });
7656
7652
  };
7657
7653
  const handleRadioChange = (key) => (value) => {
7658
- updateLocal({ [key]: value });
7654
+ onChange({ [key]: value });
7659
7655
  };
7660
7656
  const handleDateChange = (key) => (date) => {
7661
- updateLocal({ [key]: date });
7657
+ onChange({ [key]: date });
7662
7658
  };
7663
7659
  const handleRangeChangeCurried = (startKey, endKey) => (start, end) => {
7664
- updateLocal({ [startKey]: start, [endKey]: end });
7660
+ onChange({ [startKey]: start, [endKey]: end });
7665
7661
  };
7666
7662
  const handleCheckboxChange = (key) => (checked) => {
7667
- updateLocal({ [key]: checked ? "true" : "false" });
7663
+ onChange({ [key]: checked ? "true" : "false" });
7668
7664
  };
7669
7665
  const handleSubmit = () => {
7670
- onChange(localValues);
7671
7666
  onSubmit();
7672
7667
  };
7673
7668
  const handleReset = () => {
7674
- setLocalValues(initialValuesRef.current);
7669
+ onChange(initialValuesRef.current);
7675
7670
  onReset?.();
7676
7671
  };
7677
7672
  const renderFilterOption = (option, gap, index) => {
7678
7673
  const optionKey = option.key;
7679
- const currentValue = String(localValues[optionKey] ?? "");
7674
+ const currentValue = String(values[optionKey] ?? "");
7680
7675
  const rowGap2 = index !== 0 ? option.label ? gap : 5 : 0;
7681
7676
  switch (option.type) {
7682
7677
  case "input":
@@ -7751,10 +7746,7 @@ function PageFilter(props) {
7751
7746
  return /* @__PURE__ */ jsx(
7752
7747
  "div",
7753
7748
  {
7754
- className: cn(
7755
- "flex flex-col gap-3 bg-white py-3 px-5 border-t-main border-t-1 shadow-panel",
7756
- containerClassName
7757
- ),
7749
+ className: cn("flex flex-col gap-3 bg-white py-3 px-5 border-t-main border-t-1 shadow-panel", containerClassName),
7758
7750
  style: primaryColor ? { borderTopColor: primaryColor } : void 0,
7759
7751
  children: /* @__PURE__ */ jsx("div", { className: "relative flex flex-col", style: { gap: `${colGap}px` }, children: rows.map((row, ix) => {
7760
7752
  const isLastRow = rows.length - 1 === ix;