From 1677e3dad7905b9fcb93bf1fcb1bf833d5a5dafe Mon Sep 17 00:00:00 2001 From: alanv Date: Tue, 8 Sep 2026 21:44:14 -0500 Subject: [PATCH 1/5] AutoForm: Add support for Date inputs --- .../src/internal/components/AutoForm.tsx | 51 +++++++++++++------ .../src/internal/components/DateInput.tsx | 2 +- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/packages/components/src/internal/components/AutoForm.tsx b/packages/components/src/internal/components/AutoForm.tsx index efb64025bc..4967ee538f 100644 --- a/packages/components/src/internal/components/AutoForm.tsx +++ b/packages/components/src/internal/components/AutoForm.tsx @@ -5,6 +5,7 @@ import React, { ChangeEvent, FC, useCallback } from 'react'; import { HelpIcon } from './HelpIcon'; +import { DateInput } from './DateInput'; const INPUT_CLASSES = { checkbox: 'form-check', @@ -34,7 +35,7 @@ export interface Field { label: string; name: string; // Options are used in Select and Radio fields. - options?: Array>; + options?: Option[]; placeholder?: string; required?: boolean; type: string; @@ -48,16 +49,16 @@ export interface FormSchema { } export interface FieldClassProps { + // className for the div that wraps each field component + fieldWrapperCls?: string; // A map of input types to classNames (see INPUT_CLASSES for the default values) inputClasses?: Record; // className for the div that wraps each input element inputWrapperCls?: string; - // className for the the label element + // className for the label element labelCls?: string; // className for the div that wraps the label element labelWrapperCls?: string; - // className for the div that wraps each field component - fieldWrapperCls?: string; } // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -85,7 +86,7 @@ const Label: FC = ({ cls, field, id, wrapperCls }) => { if (helpTextHref) { helpLink = (

- + More info

@@ -119,10 +120,10 @@ const TextInput: FC = ({ field, id, inputClasses, onChange, className={className} id={id} name={name} + onChange={_onChange} placeholder={placeholder} type="text" value={_value} - onChange={_onChange} /> ); }; @@ -139,11 +140,11 @@ const NumberInput: FC = ({ field, id, inputClasses, onChange id={id} inputMode="numeric" name={name} + onChange={_onChange} pattern="[0-9]*" placeholder={placeholder} type="text" value={_value} - onChange={_onChange} /> ); }; @@ -156,7 +157,7 @@ const TextareaInput: FC = ({ field, id, inputClasses, onChan ); const className = inputClasses.textarea ?? ''; const _value = value === null || value === undefined ? '' : value; - return