/* * (c) Copyright 2026 Palantir Technologies Inc. All rights reserved. */ import type { Meta, StoryObj } from "@storybook/react-vite"; import { useCallback } from "react"; import { useArgs } from "storybook/preview-api"; import { Flex } from "@blueprintjs/labs"; import { Button } from "../button/buttons"; import { Code, H4 } from "../html/html"; import { Collapse } from "./collapse"; const sampleContent = (

This is an example of collapsible content. It can contain any valid React elements, including paragraphs, lists, forms, or other components.

); const meta: Meta = { title: "Core/Collapse", component: Collapse, decorators: [ Story => ( ), ], tags: ["autodocs"], args: { isOpen: false, keepChildrenMounted: false, transitionDuration: 200, }, argTypes: { isOpen: { control: "boolean", }, keepChildrenMounted: { control: "boolean", }, transitionDuration: { control: "number", }, component: { control: "text", }, }, } satisfies Meta; export default meta; type Story = StoryObj; /** * A basic collapse that reveals and hides content with a smooth sliding animation. * Use the `isOpen` control to toggle visibility. */ export const Default: Story = { args: { isOpen: true, }, argTypes: { component: { table: { disable: true } }, }, render: function RenderDefault(args) { const [, updateArgs] = useArgs(); const handleToggle = useCallback(() => updateArgs({ isOpen: !args.isOpen }), [args.isOpen, updateArgs]); return (