/* * (c) Copyright 2026 Palantir Technologies Inc. All rights reserved. */ import type { Meta, StoryObj } from "@storybook/react-vite"; import { useArgs, useCallback } from "storybook/preview-api"; import { Flex } from "@blueprintjs/labs"; import { Button } from "../button/buttons"; import { Dialog } from "./dialog"; import { DialogBody } from "./dialogBody"; import { DialogFooter } from "./dialogFooter"; const disabledArgs = ["containerRef", "hasBackdrop", "transitionName"] as const satisfies ReadonlyArray< keyof React.ComponentProps >; const meta: Meta = { title: "Core/Overlays/Dialog", component: Dialog, decorators: [ Story => ( ), ], args: { title: "Dialog Title", isOpen: true, isCloseButtonShown: true, }, argTypes: { icon: { control: "text" }, title: { control: "text" }, isCloseButtonShown: { control: "boolean" }, isOpen: { control: "boolean" }, role: { control: "select", options: ["dialog", "alertdialog"] }, ...disabledArgs.reduce( (acc, argName) => { acc[argName] = { table: { disable: true } }; return acc; }, {} as Record<(typeof disabledArgs)[number], { table: { disable: boolean } }>, ), }, } satisfies Meta; export default meta; type Story = StoryObj; export const Default: Story = { render: renderDialog(), }; /** * A dialog without a title bar. */ export const WithoutTitle: Story = { name: "Without Title", args: { title: undefined, }, render: renderDialog(), }; /** * A dialog with a minimal footer that flows inline with the content. */ export const WithMinimalFooter: Story = { name: "With Minimal Footer", render: function Render(args) { const [, updateArgs] = useArgs(); const handleOpen = useCallback(() => updateArgs({ isOpen: true }), [updateArgs]); const handleClose = useCallback(() => updateArgs({ isOpen: false }), [updateArgs]); return ( <>