/* * (c) Copyright 2026 Palantir Technologies Inc. All rights reserved. */ import type { Meta, StoryObj } from "@storybook/react-vite"; import { storybookLayoutDecorator, StoryLabel } from "@storybook-common"; import { type ComponentProps } from "react"; import { Flex } from "@blueprintjs/labs"; import { HTMLSelect, type HTMLSelectIconName } from "./htmlSelect"; const SAMPLE_OPTIONS = [ { label: "Option 1", value: "1" }, { label: "Option 2", value: "2" }, { label: "Option 3", value: "3" }, { label: "Option 4", value: "4" }, { label: "Option 5", value: "5" }, ]; const disabledArgs = ["children", "multiple"] as const satisfies ReadonlyArray>; const meta: Meta = { title: "Core/Form/HTMLSelect", component: HTMLSelect, decorators: [storybookLayoutDecorator], tags: ["autodocs"], args: { options: SAMPLE_OPTIONS, fill: false, large: false, minimal: false, disabled: false, iconName: "double-caret-vertical", }, argTypes: { fill: { control: "boolean", }, large: { control: "boolean", }, minimal: { control: "boolean", }, disabled: { control: "boolean", }, iconName: { control: "select", options: ["double-caret-vertical", "caret-down"] satisfies HTMLSelectIconName[], }, onChange: { action: "changed" }, ...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 HTML select with default styling. */ export const Default: Story = {}; /** * Use the `minimal` prop to apply minimal styling. */ export const VariantExample: Story = { name: "Variant", argTypes: { minimal: { table: { disable: true } }, }, render: args => ( ), }; /** * Use the `large` prop to render a larger select element. */ export const SizeExample: Story = { name: "Size", argTypes: { large: { table: { disable: true } }, }, render: args => ( ), }; /** * Use the `disabled` prop to make the select non-interactive. */ export const StateExample: Story = { name: "State", argTypes: { disabled: { table: { disable: true } }, }, render: args => ( ), }; /** * Use the `iconName` prop to choose between the supported dropdown icons. */ export const IconsExample: Story = { name: "Icons", argTypes: { iconName: { table: { disable: true } }, }, render: args => ( ), }; /** * Use the `fill` prop to make the select expand to the full width of its container. */ export const FillExample: Story = { name: "Fill", argTypes: { fill: { table: { disable: true } }, }, decorators: [ Story => (
), ], render: args => ( ), }; /** * Interactive playground with all props togglable via Storybook controls. */ export const Playground: Story = {};