import type { Meta, StoryObj } from "@storybook/react" import React from "react" import { Slider } from "./Slider" /** * A slider component for selecting values within a range. * * ## Props * - `defaultValue`: number[] - Default value(s) for the slider * - `value`: number[] - Controlled value(s) for the slider * - `onValueChange`: (value: number[]) => void - Callback when value changes * - `onValueCommit`: (value: number[]) => void - Callback when value is committed * - `min`: number - Minimum value (default: 0) * - `max`: number - Maximum value (default: 100) * - `step`: number - Step increment (default: 1) * - `minStepsBetweenThumbs`: number - Minimum steps between thumbs * - `disabled`: boolean - Whether the slider is disabled * - `orientation`: "horizontal" | "vertical" - Orientation of the slider * - `inverted`: boolean - Whether the slider is inverted * - `color`: "gray" | "gold" | "bronze" | "brown" | "yellow" | "amber" | "orange" | "tomato" | "red" | "ruby" | "crimson" | "pink" | "plum" | "purple" | "violet" | "iris" | "indigo" | "blue" | "cyan" | "teal" | "jade" | "green" | "grass" | "lime" | "mint" | "sky" * - `size`: "1" | "2" | "3" (default: "2") * - `variant`: "classic" | "surface" | "soft" (default: "surface") * - `radius`: "none" | "small" | "medium" | "large" | "full" * - `highContrast`: boolean - Whether to use high contrast colors */ const meta = { title: "base/components/Slider", component: Slider, tags: ["autodocs"], argTypes: { defaultValue: { control: "object", description: "Default value(s) for the slider", }, min: { control: "number", description: "Minimum value", }, max: { control: "number", description: "Maximum value", }, step: { control: "number", description: "Step increment", }, disabled: { control: "boolean", description: "Whether the slider is disabled", }, orientation: { control: "select", options: ["horizontal", "vertical"], description: "Orientation of the slider", }, color: { control: "select", options: [ "gray", "gold", "bronze", "brown", "yellow", "amber", "orange", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "lime", "mint", "sky", ], description: "Color theme of the slider", }, size: { control: "select", options: ["1", "2", "3"], description: "Size of the slider", }, variant: { control: "select", options: ["classic", "surface", "soft"], description: "Visual style of the slider", }, radius: { control: "select", options: ["none", "small", "medium", "large", "full"], description: "Border radius of the slider", }, highContrast: { control: "boolean", description: "Whether to use high contrast colors", }, }, parameters: { layout: "centered", }, } satisfies Meta export default meta type Story = StoryObj /** * Basic slider with default settings. */ export const Default: Story = { args: { defaultValue: [50], }, render: args => (
), } /** * Slider with different colors. */ export const Colors: Story = { render: () => (
), } /** * Slider with different sizes. */ export const Sizes: Story = { render: () => (
), } /** * Slider with different variants. */ export const Variants: Story = { render: () => (
), } /** * Slider with different radius values. */ export const Radius: Story = { render: () => (
), } /** * Slider with high contrast. */ export const HighContrast: Story = { render: () => (
), } /** * Slider with different ranges. */ export const Ranges: Story = { render: () => (
), } /** * Slider with different step values. */ export const Steps: Story = { render: () => (
), } /** * Slider with multiple thumbs. */ export const MultipleThumbs: Story = { render: () => (
), } /** * Slider with controlled state. */ export const Controlled: Story = { render: () => { const [value, setValue] = React.useState([50]) return (
) }, } /** * Slider with different orientations. */ export const Orientations: Story = { render: () => (
), } /** * Slider with disabled state. */ export const Disabled: Story = { render: () => (
), } /** * Slider with value display. */ export const WithValueDisplay: Story = { render: () => { const [value, setValue] = React.useState([50]) return (
{value[0]}%
0% 100%
) }, } /** * Slider with different contexts. */ export const Contexts: Story = { render: () => (
), } /** * Slider with inverted orientation. */ export const Inverted: Story = { render: () => (
), }