Merge branch 'master' into feat/add-error-boundary

This commit is contained in:
Dan Ditomaso
2025-03-01 09:09:57 -05:00
committed by GitHub
75 changed files with 401 additions and 343 deletions
+21 -18
View File
@@ -100,24 +100,27 @@ export function DynamicForm<T extends FieldValues>({
<Subtle>{fieldGroup.description}</Subtle>
</div>
{fieldGroup.fields.map((field) => (
<FieldWrapper
key={field.label}
label={field.label}
description={field.description}
valid={
field.validationText === undefined ||
field.validationText === ""
}
validationText={field.validationText}
>
<DynamicFormField
field={field}
control={control}
disabled={isDisabled(field.disabledBy, field.disabled)}
/>
</FieldWrapper>
))}
{fieldGroup.fields.map((field) => {
return (
<FieldWrapper
key={field.label}
label={field.label}
fieldName={field.name}
description={field.description}
valid={
field.validationText === undefined ||
field.validationText === ""
}
validationText={field.validationText}
>
<DynamicFormField
field={field}
control={control}
disabled={isDisabled(field.disabledBy, field.disabled)}
/>
</FieldWrapper>
);
})}
</div>
))}
{hasSubmitButton && <Button type="submit">Submit</Button>}
+1
View File
@@ -53,6 +53,7 @@ export function GenericInput<T extends FieldValues>({
}
step={field.properties?.step}
value={field.type === "number" ? Number.parseFloat(value) : value}
id={field.name}
onChange={(e) => {
if (field.inputChange) field.inputChange(e);
onChange(
@@ -11,6 +11,7 @@ import { Controller, type FieldValues } from "react-hook-form";
export interface PasswordGeneratorProps<T> extends BaseFormBuilderProps<T> {
type: "passwordGenerator";
id: string;
hide?: boolean;
bits?: { text: string; value: string; key: string }[];
devicePSKBitCount: number;
@@ -41,6 +42,7 @@ export function PasswordGenerator<T extends FieldValues>({
render={({ field: { value, ...rest } }) => (
<Generator
type={field.hide && !passwordShown ? "password" : "text"}
id={field.id}
action={
field.hide
? {
+1 -1
View File
@@ -50,7 +50,7 @@ export function SelectInput<T extends FieldValues>({
{...remainingProperties}
{...rest}
>
<SelectTrigger>
<SelectTrigger id={field.name}>
<SelectValue />
</SelectTrigger>
<SelectContent>
+1
View File
@@ -33,6 +33,7 @@ export function ToggleInput<T extends FieldValues>({
<Switch
checked={value}
onCheckedChange={onChangeHandler(onChange)}
id={field.name}
disabled={disabled}
{...field.properties}
{...rest}
+3 -1
View File
@@ -2,6 +2,7 @@ import { Label } from "@components/UI/Label.tsx";
export interface FieldWrapperProps {
label: string;
fieldName: string;
description?: string;
disabled?: boolean;
children?: React.ReactNode;
@@ -11,6 +12,7 @@ export interface FieldWrapperProps {
export const FieldWrapper = ({
label,
fieldName,
description,
children,
valid,
@@ -19,7 +21,7 @@ export const FieldWrapper = ({
<div className="pt-6 sm:pt-5">
<fieldset aria-labelledby="label-notifications">
<div className="sm:grid sm:grid-cols-3 sm:items-baseline sm:gap-4">
<Label>{label}</Label>
<Label htmlFor={fieldName}>{label}</Label>
<div className="sm:col-span-2">
<div className="max-w-lg">
<p className="text-sm text-slate-500">{description}</p>