/* ! * (c) Copyright 2026 Palantir Technologies Inc. All rights reserved. */ import type { Meta, StoryObj } from "@storybook/react-vite"; import { storybookLayoutDecorator, StoryLabel } from "@storybook-common"; import { Flex } from "@blueprintjs/labs"; import { Alignment, ButtonVariant, Intent, Size } from "../../common"; import { Button } from "./buttons"; // These props are deprecated on Button — hide them from the Storybook controls panel. const disabledArgs = [ "large", "minimal", "outlined", "rightIcon", "small", "type", "children", ] as const satisfies ReadonlyArray>; const meta: Meta = { title: "Core/Button/Button", component: Button, decorators: [storybookLayoutDecorator], tags: ["autodocs"], args: { text: "Button", intent: "none", variant: "solid", size: "medium", alignText: "center", icon: undefined, endIcon: undefined, fill: false, active: false, loading: false, disabled: false, ellipsizeText: false, }, argTypes: { text: { control: "text", }, intent: { control: "select", options: Object.values(Intent), }, size: { control: "select", options: Object.values(Size), }, variant: { control: "select", options: Object.values(ButtonVariant), }, alignText: { control: "select", options: Object.values(Alignment), }, icon: { control: "text", }, endIcon: { control: "text", }, active: { control: "boolean", }, disabled: { control: "boolean", }, ellipsizeText: { control: "boolean", }, fill: { control: "boolean", }, loading: { control: "boolean", }, onClick: { action: "clicked" }, ...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; /** * A basic button with default styling. */ export const Default: Story = { args: { text: "Button", }, }; /** * Use the `intent` prop to apply a semantic color that conveys the purpose or status of the button. */ export const IntentExample: Story = { name: "Intent", argTypes: { intent: { table: { disable: true } }, }, render: args => ( {Object.values(Intent) .filter(i => i !== "none") .map(intent => (