import React, { useState } from "react"; import { Select } from "./"; import { Button, Icon, Tooltip, theme } from "../index"; import { Info } from "@washingtonpost/wpds-assets"; import type { StoryFn } from "@storybook/react"; export default { title: "Select", component: Select.Root, subcomponents: { Trigger: Select.Trigger, Value: Select.Value, Item: Select.Item, Group: Select.Group, Label: Select.Label, Content: Select.Content, }, }; const Template: StoryFn = (args) => { return ( <> Countries France United Kingdom - Scotland, Ireland, Wales, Great Britain, and the commonwealth states of Canada, Australia, Turks and Caicos Spain Peru Chile Ecuador ); }; export const Play = { render: Template, args: { success: false, required: false, disabled: false, error: false, errorMessage: "", helperText: "", }, name: "Select", parameters: { chromatic: { disableSnapshot: true }, }, }; const UnselectedTemplate: StoryFn = (args) => { return ( <> Countries France United Kingdom - Scotland, Ireland, Wales, Great Britain, and the commonwealth states of Canada, Australia, Turks and Caicos Spain Peru Chile Ecuador Republic of Congo Ethiopia South Africa Kenya Nigeria People Republic of China Japan Vietnam South Korea North Korea ); }; export const Unselected = { render: UnselectedTemplate, parameters: { chromatic: { disableSnapshot: false }, }, }; const ControlledTemplate: StoryFn = (args) => { const [country, setCountry] = useState("spain"); const handleValueChange = (value: string) => { setCountry(value); }; return ( Countries France United Kingdom - Scotland, Ireland, Wales, Great Britain, and the commonwealth states of Canada, Australia, Turks and Caicos Spain Peru Chile Ecuador Republic of Congo Ethiopia South Africa Kenya Nigeria People Republic of China Japan Vietnam South Korea North Korea ); }; export const Controlled = { render: ControlledTemplate, parameters: { chromatic: { disableSnapshot: true }, }, }; export const SelectsInARow = () => { return (
Label/Placeholder Option 1 value Option 2 value Option 3 value Option 4 value Option 5 value Option 6 value
Label/Placeholder Option 1 value Option 2 value Option 3 value Option 4 value Option 5 value Option 6 value
Label/Placeholder Option 1 value Option 2 value Option 3 value Option 4 value Option 5 value Option 6 value
Detail about select } > Label/Placeholder Option 1 value Option 2 value Option 3 value Option 4 value Option 5 value Option 6 value
); }; const LabelOverflowTemplate: StoryFn = (args) => { return (
This is a long label for the select causing text overflow Item One Item Two Item Three
); }; export const LabelOverflow = { render: LabelOverflowTemplate, };