fix: add type safety for ExportDialog trigger props
This commit is contained in:
parent
5093699568
commit
ced7a08672
1 changed files with 16 additions and 2 deletions
|
|
@ -139,17 +139,31 @@ export async function exportConfig(
|
||||||
await exportFromApi(config.endpoint, filename, options);
|
await exportFromApi(config.endpoint, filename, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
type ExportDialogProps = {
|
type BaseExportDialogProps = {
|
||||||
entityType: ExportEntityType;
|
entityType: ExportEntityType;
|
||||||
name?: string;
|
name?: string;
|
||||||
id?: string | number;
|
id?: string | number;
|
||||||
trigger?: React.ReactNode;
|
};
|
||||||
|
|
||||||
|
type ExportDialogWithTrigger = BaseExportDialogProps & {
|
||||||
|
/** Custom trigger element. When provided, variant/size/triggerLabel/showIcon are ignored. */
|
||||||
|
trigger: React.ReactNode;
|
||||||
|
variant?: never;
|
||||||
|
size?: never;
|
||||||
|
triggerLabel?: never;
|
||||||
|
showIcon?: never;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ExportDialogWithDefaultTrigger = BaseExportDialogProps & {
|
||||||
|
trigger?: never;
|
||||||
variant?: "default" | "outline" | "ghost" | "card";
|
variant?: "default" | "outline" | "ghost" | "card";
|
||||||
size?: "default" | "sm" | "lg" | "icon";
|
size?: "default" | "sm" | "lg" | "icon";
|
||||||
triggerLabel?: string;
|
triggerLabel?: string;
|
||||||
showIcon?: boolean;
|
showIcon?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type ExportDialogProps = ExportDialogWithTrigger | ExportDialogWithDefaultTrigger;
|
||||||
|
|
||||||
export function ExportDialog({
|
export function ExportDialog({
|
||||||
entityType,
|
entityType,
|
||||||
name,
|
name,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue