/* ! * (c) Copyright 2026 Palantir Technologies Inc. All rights reserved. */ import type { Meta, StoryObj } from "@storybook/react-vite"; import { DashedPaddedContainer, storybookLayoutDecorator, StoryLabel } from "@storybook-common"; import { Button } from "../button/buttons"; import { Spinner } from "../spinner/spinner"; import { NonIdealState, NonIdealStateIconSize } from "./nonIdealState"; const meta: Meta = { title: "Core/NonIdealState", component: NonIdealState, decorators: [storybookLayoutDecorator], args: { icon: "search", title: "No search results", description: "Try a different search query or check your filters.", layout: "vertical", iconMuted: true, iconSize: NonIdealStateIconSize.STANDARD, }, argTypes: { icon: { control: "text", }, iconSize: { control: "select", options: Object.values(NonIdealStateIconSize).filter(v => typeof v === "number"), }, iconMuted: { control: "boolean", }, layout: { control: "select", options: ["vertical", "horizontal"], }, }, } satisfies Meta; export default meta; type Story = StoryObj; /** * A basic NonIdealState with an icon, title, and description. */ export const Default: Story = {}; /** * Horizontal vs vertical layout. */ export const LayoutExample: Story = { name: "Layout", argTypes: { layout: { table: { disable: true } }, }, render: args => (
), }; /** * Icon size options available for the visual element. */ export const IconSizeExample: Story = { name: "Icon Size", argTypes: { iconSize: { table: { disable: true } }, }, render: args => (
{( [ { size: NonIdealStateIconSize.EXTRA_SMALL, label: "Extra Small" }, { size: NonIdealStateIconSize.SMALL, label: "Small" }, { size: NonIdealStateIconSize.STANDARD, label: "Standard" }, ] as const ).map(({ size, label }) => (
))}
), }; /** * Icon size options available for the visual element. */ export const IconMutedExample: Story = { name: "Icon Muted", argTypes: { iconSize: { table: { disable: true } }, iconMuted: { table: { disable: true } }, }, render: args => (
{( [ { iconMuted: true, label: "Icon muted (Default)" }, { iconMuted: false, label: "Icon isn't muted" }, ] as const ).map(({ iconMuted, label }) => (
))}
), }; /** * Pass a `` as the `icon` to communicate a loading state. */ export const LoadingExample: Story = { name: "Loading", args: { icon: , title: "Loading search results", description: "This may take a moment.", }, argTypes: { icon: { table: { disable: true } }, }, render: args => } />, }; /** * Interactive playground for experimenting with NonIdealState props. */ export const Playground: Story = { args: { icon: "search", title: "No search results", description: "Your search didn't match any files. Try searching for something else.", action: