From 64dccf9b2d8b07a115f138f99ad20438aa2480a1 Mon Sep 17 00:00:00 2001 From: Ole Kristian Losvik Date: Sat, 1 Aug 2026 17:45:20 +0100 Subject: [PATCH] =?UTF-8?q?feat(ratio-ui):=20type=20the=20Input=20family?= =?UTF-8?q?=20props=20=E2=80=94=20typed=20InputProps,=20deprecated=20index?= =?UTF-8?q?=20signature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit InputProps/InputFieldProps now extend InputHTMLAttributes, so every DOM prop (incl. onChange) is declared, autocompletes, and infers under strict. The [x: string]: any escape hatch stays for 2.x but is @deprecated for removal in the next major. TextField moves from forwardRef to a React 19 ref prop — forwardRef's PropsWithoutRef collapses named props into the index signature, degrading every prop to any. Public contract unchanged (ref?: Ref). Also fixes the WithError story's errors shape, surfaced by the new types. --- .changeset/typed-input-family-props.md | 18 ++ .../ratio-ui/src/forms/Input/InputProps.ts | 51 ++--- .../src/forms/Input/TextField.stories.tsx | 2 +- .../ratio-ui/src/forms/Input/TextField.tsx | 203 +++++++++--------- 4 files changed, 136 insertions(+), 138 deletions(-) create mode 100644 .changeset/typed-input-family-props.md diff --git a/.changeset/typed-input-family-props.md b/.changeset/typed-input-family-props.md new file mode 100644 index 00000000..1c5d11bf --- /dev/null +++ b/.changeset/typed-input-family-props.md @@ -0,0 +1,18 @@ +--- +"@eventuras/ratio-ui": minor +--- + +Type the Input family's props: `InputProps`/`InputFieldProps` now extend +`InputHTMLAttributes`, so every real DOM +prop — including `onChange` — is declared and autocompletes, and handler +parameters infer under `strict` without hand annotations. Existing handlers +annotated with the narrower element types remain assignable. + +The `[x: string]: any` index signature is kept for backwards compatibility but +is now `@deprecated`; it will be removed in the next major, at which point prop +typos stop compiling. + +`TextField` moves from `forwardRef` to React 19 ref-as-prop (required for the +declared prop types to survive; `PropsWithoutRef` collapses named props into +the index signature). The public contract is unchanged: `ref?: Ref` +receiving the underlying ``/`