/* * (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 { Intent } from "../../common"; import { Spinner, SpinnerSize } from "./spinner"; const meta: Meta = { title: "Core/Spinner", component: Spinner, decorators: [storybookLayoutDecorator], tags: ["autodocs"], args: { intent: Intent.NONE, size: SpinnerSize.STANDARD, }, argTypes: { intent: { control: "select", options: Object.values(Intent), }, size: { control: "number", }, value: { control: { type: "range", min: 0, max: 1, step: 0.05 }, }, tagName: { control: "text", }, }, } satisfies Meta; export default meta; type Story = StoryObj; /** * A basic spinner with default styling (indeterminate). */ export const Default: Story = {}; /** * Use the `intent` prop to apply a semantic color to the spinner. */ export const IntentExample: Story = { name: "Intent", argTypes: { intent: { table: { disable: true } }, }, render: args => ( {Object.values(Intent).map(intent => ( ))} ), }; /** * Use the `size` prop to control the spinner dimensions. Common sizes are available as `SpinnerSize` constants. */ export const SizeExample: Story = { name: "Size", argTypes: { size: { table: { disable: true } }, }, render: args => ( ), }; /** * Use the `value` prop to show determinate progress. Omit it for an indeterminate spinner. */ export const StateExample: Story = { name: "State", argTypes: { value: { table: { disable: true } }, }, render: args => ( ), }; /** * Interactive playground with all props toggleable via Storybook controls. */ export const Playground: Story = { args: { intent: Intent.PRIMARY, size: SpinnerSize.STANDARD, value: 0.7, }, };