@toteat-eng/ds-react 2026.8.27 → 2026.908.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.
@@ -4,5 +4,13 @@ export interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputEleme
4
4
  label?: string;
5
5
  ref?: Ref<HTMLInputElement>;
6
6
  "data-testid"?: string;
7
+ /**
8
+ * Convenience handler receiving the input's string value directly
9
+ * (`event.target.value`), instead of the native change event. Prefer this
10
+ * over `onChange` when you only need the value — it avoids passing a
11
+ * state setter straight to `onChange`, which stores the SyntheticEvent
12
+ * instead of the date string and silently blanks the field.
13
+ */
14
+ onValueChange?: (value: string) => void;
7
15
  }
8
- export declare function DatePicker({ error, label, className, id, ref, "data-testid": testId, ...props }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function DatePicker({ error, label, className, id, ref, "data-testid": testId, onChange, onValueChange, ...props }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
@@ -9,3 +9,4 @@ export declare const WithError: Story;
9
9
  export declare const Disabled: Story;
10
10
  export declare const WithoutLabel: Story;
11
11
  export declare const Controlled: Story;
12
+ export declare const ControlledWithOnValueChange: Story;
package/dist/index.es.js CHANGED
@@ -976,23 +976,26 @@ var or = {
976
976
  };
977
977
  //#endregion
978
978
  //#region src/components/DatePicker/DatePicker.tsx
979
- function sr({ error: e, label: t, className: n, id: r, ref: i, "data-testid": o, ...s }) {
980
- let c = a(), l = r ?? c;
979
+ function sr({ error: e, label: t, className: n, id: r, ref: i, "data-testid": o, onChange: s, onValueChange: c, ...l }) {
980
+ let u = a(), d = r ?? u;
981
981
  return /* @__PURE__ */ p("div", {
982
982
  className: R(or.wrapper, n),
983
983
  "data-testid": o,
984
984
  children: [t && /* @__PURE__ */ f("label", {
985
- htmlFor: l,
985
+ htmlFor: d,
986
986
  className: or.label,
987
987
  children: t
988
988
  }), /* @__PURE__ */ f("input", {
989
989
  ref: i,
990
990
  type: "date",
991
- id: l,
991
+ id: d,
992
992
  className: or.input,
993
993
  "data-error": e || void 0,
994
994
  "aria-invalid": e || void 0,
995
- ...s
995
+ onChange: (e) => {
996
+ s?.(e), c?.(e.target.value);
997
+ },
998
+ ...l
996
999
  })]
997
1000
  });
998
1001
  }
@@ -1068,7 +1071,7 @@ function lr(e, t = {}) {
1068
1071
  };
1069
1072
  let t = window.scrollY;
1070
1073
  return document.body.style.overflow = "hidden", document.body.style.position = "fixed", document.body.style.top = `-${t}px`, document.body.style.width = "100%", () => {
1071
- document.body.style.overflow = "", document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", window.scrollTo(0, t);
1074
+ document.body.style.overflow = "", document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", window.scrollY !== t && window.scrollTo(0, t);
1072
1075
  };
1073
1076
  }, [e, n]);
1074
1077
  }