-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Wire fieldset up to edit UI * Update fieldset error story to trigger an actual error
- Loading branch information
1 parent
18f1701
commit 6616eb5
Showing
13 changed files
with
10,188 additions
and
12,922 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { z } from 'zod'; | ||
|
||
import { safeZodParseFormErrors } from '../../util/zod'; | ||
import { ParsePatternConfigData } from '../../pattern'; | ||
|
||
const configSchema = z.object({ | ||
legend: z.string().min(1), | ||
patterns: z.array(z.string()).default([]), | ||
}); | ||
export type FieldsetConfigSchema = z.infer<typeof configSchema>; | ||
|
||
export const parseConfigData: ParsePatternConfigData< | ||
FieldsetConfigSchema | ||
> = obj => { | ||
return safeZodParseFormErrors(configSchema, obj); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { type FieldsetPattern } from '.'; | ||
import { | ||
type CreatePrompt, | ||
type FieldsetProps, | ||
createPromptForPattern, | ||
getPattern, | ||
} from '../..'; | ||
|
||
export const createPrompt: CreatePrompt<FieldsetPattern> = ( | ||
config, | ||
session, | ||
pattern, | ||
options | ||
) => { | ||
const children = pattern.data.patterns.map((patternId: string) => { | ||
const childPattern = getPattern(session.form, patternId); | ||
return createPromptForPattern(config, session, childPattern, options); | ||
}); | ||
return { | ||
props: { | ||
_patternId: pattern.id, | ||
type: 'fieldset', | ||
legend: pattern.data.legend, | ||
} satisfies FieldsetProps, | ||
children, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.