pass regex through TextEntryDialog

This commit is contained in:
Josh Hawkins 2025-05-17 11:21:30 -05:00
parent 0af58caf1c
commit f8ef5777b0

View File

@ -20,6 +20,8 @@ type TextEntryDialogProps = {
onSave: (text: string) => void; onSave: (text: string) => void;
defaultValue?: string; defaultValue?: string;
allowEmpty?: boolean; allowEmpty?: boolean;
regexPattern?: RegExp;
regexErrorMessage?: string;
}; };
export default function TextEntryDialog({ export default function TextEntryDialog({
@ -30,6 +32,8 @@ export default function TextEntryDialog({
onSave, onSave,
defaultValue = "", defaultValue = "",
allowEmpty = false, allowEmpty = false,
regexPattern,
regexErrorMessage,
}: TextEntryDialogProps) { }: TextEntryDialogProps) {
const { t } = useTranslation("common"); const { t } = useTranslation("common");
@ -44,6 +48,8 @@ export default function TextEntryDialog({
defaultValue={defaultValue} defaultValue={defaultValue}
allowEmpty={allowEmpty} allowEmpty={allowEmpty}
onSave={onSave} onSave={onSave}
regexPattern={regexPattern}
regexErrorMessage={regexErrorMessage}
> >
<DialogFooter className={cn("pt-4", isMobile && "gap-2")}> <DialogFooter className={cn("pt-4", isMobile && "gap-2")}>
<Button type="button" onClick={() => setOpen(false)}> <Button type="button" onClick={() => setOpen(false)}>