Custom content-type for multipart items

This commit is contained in:
Gregory Schier
2024-03-16 12:49:17 -07:00
parent 4b33a696ac
commit 901cf53cd2
8 changed files with 120 additions and 48 deletions

View File

@@ -12,6 +12,7 @@ export interface PromptProps {
name: InputProps['name'];
defaultValue: InputProps['defaultValue'];
placeholder: InputProps['placeholder'];
require?: InputProps['require'];
confirmLabel?: string;
}
@@ -22,6 +23,7 @@ export function Prompt({
defaultValue,
placeholder,
onResult,
require = true,
confirmLabel = 'Save',
}: PromptProps) {
const [value, setValue] = useState<string>(defaultValue ?? '');
@@ -41,7 +43,7 @@ export function Prompt({
>
<Input
hideLabel
require
require={require}
autoSelect
placeholder={placeholder}
label={label}

View File

@@ -14,6 +14,7 @@ export function usePrompt() {
defaultValue,
placeholder,
confirmLabel,
require,
}: Pick<DialogProps, 'title' | 'description'> &
Omit<PromptProps, 'onResult' | 'onHide'> & { id: string }) =>
new Promise((onResult: PromptProps['onResult']) => {
@@ -24,7 +25,16 @@ export function usePrompt() {
hideX: true,
size: 'sm',
render: ({ hide }) =>
Prompt({ onHide: hide, onResult, name, label, defaultValue, placeholder, confirmLabel }),
Prompt({
onHide: hide,
onResult,
name,
label,
defaultValue,
placeholder,
confirmLabel,
require,
}),
});
});
}