chore: remove storybook (#19659)
* remove storybook * remove storybook trpc provider * add user-event * fix lockk file --------- Co-authored-by: Bailey Pumfleet <[email protected]>
This commit is contained in:
1 parent
fff521e171
commit
d38b35b626
79 files changed
+8751
-9265
No files matched your search
@@ -1,99 +0,0 @@
|
||||
import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
|
||||
|
||||
import {
|
||||
Examples,
|
||||
Example,
|
||||
Note,
|
||||
Title,
|
||||
CustomArgsTable,
|
||||
VariantsTable,
|
||||
VariantRow,
|
||||
} from "@calcom/storybook/components";
|
||||
|
||||
import { CheckboxField as Checkbox } from "./Checkbox";
|
||||
|
||||
<Meta title="UI/Form/Checkbox" component={Checkbox} />
|
||||
|
||||
<Title title="Checkbox " suffix="Brief" subtitle="Version 2.0 — Last Update: 22 Aug 2022" />
|
||||
|
||||
## Definition
|
||||
|
||||
Checkboxes are used in forms and databases to indicate an answer to a question, apply a batch of settings or allow the user to make a multi-selection from a list. Alternatively, a single checkbox may be used for making single selections
|
||||
|
||||
## Structure
|
||||
|
||||
<CustomArgsTable of={Checkbox} />
|
||||
|
||||
<Examples title="Checkbox style">
|
||||
<Example title="Default">
|
||||
<Checkbox label="Default" />
|
||||
</Example>
|
||||
<Example title="Error">
|
||||
<Checkbox label="Error" error />
|
||||
</Example>
|
||||
<Example title="Disabled">
|
||||
<Checkbox label="Disabled" disabled />
|
||||
</Example>
|
||||
<Example title="Disabled">
|
||||
<Checkbox label="Disabled Checked" checked disabled />
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
<Examples title="Description As Label">
|
||||
<Example title="Default">
|
||||
<Checkbox descriptionAsLabel description="Default Description" />
|
||||
</Example>
|
||||
<Example title="Error">
|
||||
<Checkbox descriptionAsLabel description="Default Description" error />
|
||||
</Example>
|
||||
<Example title="Disabled">
|
||||
<Checkbox descriptionAsLabel description="Default Description" disabled />
|
||||
</Example>
|
||||
<Example title="Disabled">
|
||||
<Checkbox descriptionAsLabel description="Default Description" disabled checked />
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
<Canvas>
|
||||
<Story
|
||||
name="Checkbox"
|
||||
args={{
|
||||
label: "Default",
|
||||
description: "Default Description",
|
||||
error: false,
|
||||
disabled: false,
|
||||
}}
|
||||
argTypes={{
|
||||
label: {
|
||||
control: {
|
||||
type: "text",
|
||||
},
|
||||
},
|
||||
description: {
|
||||
control: {
|
||||
type: "text",
|
||||
},
|
||||
},
|
||||
error: {
|
||||
control: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
disabled: {
|
||||
control: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
}}>
|
||||
{({ label, description, error, disabled }) => (
|
||||
<VariantsTable titles={[""]} columnMinWidth={150}>
|
||||
<VariantRow variant="Default">
|
||||
<Checkbox label={label} error={error} disabled={disabled} />
|
||||
</VariantRow>
|
||||
<VariantRow variant="Description As Label">
|
||||
<Checkbox description={description} error={error} disabled={disabled} descriptionAsLabel />
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
)}
|
||||
</Story>
|
||||
</Canvas>
|
||||
@@ -1,82 +0,0 @@
|
||||
import { Tooltip } from "@radix-ui/react-tooltip";
|
||||
import { Canvas, Meta, Story } from "@storybook/addon-docs";
|
||||
|
||||
import {
|
||||
Example,
|
||||
Title,
|
||||
CustomArgsTable,
|
||||
VariantRow,
|
||||
VariantsTable,
|
||||
} from "@calcom/storybook/components";
|
||||
|
||||
import ColorPicker from "./colorpicker";
|
||||
|
||||
<Meta title="UI/Form/ColorPicker" component={ColorPicker} />
|
||||
|
||||
<Title title="ColorPicker" suffix="Brief" subtitle="Version 1.0 — Last Update: 16 Aug 2023" />
|
||||
|
||||
## Definitions
|
||||
|
||||
`Color Picker` is used to select custom hex colors for from a range of values.
|
||||
|
||||
## Structure
|
||||
|
||||
The `Color Picker` takes in several props
|
||||
|
||||
<CustomArgsTable of={ColorPicker} />
|
||||
|
||||
## Default:
|
||||
|
||||
<Example title="Default">
|
||||
<ColorPicker defaultValue="#000000" />
|
||||
</Example>
|
||||
|
||||
## ColorPicker Story
|
||||
|
||||
<Canvas>
|
||||
<Story
|
||||
name="Default"
|
||||
args={{
|
||||
defaultValue: "#21aef3",
|
||||
onChange: (value) => {
|
||||
console.debug(value);
|
||||
},
|
||||
resetDefaultValue: "#000000",
|
||||
className: "w-[200px]",
|
||||
popoverAlign: "start",
|
||||
}}
|
||||
argTypes={{
|
||||
defaultValue: {
|
||||
control: {
|
||||
type: "text",
|
||||
},
|
||||
},
|
||||
resetDefaultValue: {
|
||||
control: {
|
||||
type: "text",
|
||||
},
|
||||
},
|
||||
popoverAlign: {
|
||||
control: {
|
||||
type: "inline-radio",
|
||||
options: ["center", "start", "end"],
|
||||
},
|
||||
},
|
||||
}}>
|
||||
{({ defaultValue, onChange, resetDefaultValue, className, popoverAlign }) => (
|
||||
<VariantsTable titles={["Default"]} columnMinWidth={150}>
|
||||
<VariantRow>
|
||||
<Tooltip content="color picker">
|
||||
<ColorPicker
|
||||
defaultValue={defaultValue}
|
||||
onChange={onChange}
|
||||
resetDefaultValue={resetDefaultValue}
|
||||
className={className}
|
||||
popoverAlign={popoverAlign}
|
||||
/>
|
||||
</Tooltip>
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
)}
|
||||
</Story>
|
||||
</Canvas>
|
||||
@@ -1,100 +0,0 @@
|
||||
import { Canvas, Meta, Story } from "@storybook/addon-docs";
|
||||
|
||||
import {
|
||||
Examples,
|
||||
Example,
|
||||
Title,
|
||||
CustomArgsTable,
|
||||
VariantRow,
|
||||
VariantsTable,
|
||||
} from "@calcom/storybook/components";
|
||||
|
||||
import { InputFieldWithSelect } from "./InputFieldWithSelect";
|
||||
import { InputField } from "./TextField";
|
||||
|
||||
<Meta title="UI/Form/Input Field" component={InputField} />
|
||||
|
||||
<Title title="Inputs" suffix="Brief" subtitle="Version 2.0 — Last Update: 24 Aug 2023" />
|
||||
|
||||
## Definition
|
||||
|
||||
Text fields allow users to input and edit text into the product. Usually appear in forms and modals. Various options can be shown with the field to communicate the input requirements.## Structure
|
||||
|
||||
## Structure
|
||||
|
||||
<CustomArgsTable of={InputField} />
|
||||
|
||||
<Examples
|
||||
title="Inputs"
|
||||
footnote={
|
||||
<ul>
|
||||
<li>The width is flexible but the height is fixed for both desktop and mobile. </li>
|
||||
</ul>
|
||||
}>
|
||||
<Example title="Default">
|
||||
<InputField placeholder="Default" />
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
<Examples title="Input Types">
|
||||
<Example title="Default">
|
||||
<InputField placeholder="Default" />
|
||||
</Example>
|
||||
<Example title="Prefix">
|
||||
<InputField placeholder="Prefix" addOnLeading={<>Prefix</>} />
|
||||
</Example>
|
||||
<Example title="Suffix">
|
||||
<InputField placeholder="Suffic" addOnSuffix={<>Suffix</>} />
|
||||
</Example>
|
||||
<Example title="Suffix With Select">
|
||||
<InputFieldWithSelect
|
||||
placeholder="Suffix"
|
||||
selectProps={{ options: [{ value: "TEXT", label: "Text" }] }}
|
||||
/>
|
||||
</Example>
|
||||
<Example title="Focused">
|
||||
<InputField placeholder="Focused" className="sb-pseudo--focus" />
|
||||
</Example>
|
||||
<Example title="Hovered">
|
||||
<InputField placeholder="Hovered" className="sb-pseudo--hover" />
|
||||
</Example>
|
||||
<Example title="Error">
|
||||
<InputField placeholder="Error" error="Error" />
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
<Examples title="Input Text">
|
||||
<Example title="Default">
|
||||
<InputField />
|
||||
</Example>
|
||||
<Example title="Placeholder">
|
||||
<InputField placeholder="Placeholder" />
|
||||
</Example>
|
||||
<Example title="Filled">
|
||||
<InputField value="Filled" />
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
<Title offset title="Input" suffix="Variants" />
|
||||
|
||||
<Canvas>
|
||||
<Story name="All Variants">
|
||||
<VariantsTable titles={["Default", "Focused", "Hovered"]} columnMinWidth={150}>
|
||||
<VariantRow variant="Default">
|
||||
<InputField placeholder="Default" />
|
||||
<InputField placeholder="Focused" className="sb-pseudo--focus" />
|
||||
<InputField placeholder="Hovered" className="sb-pseudo--hover" />
|
||||
</VariantRow>
|
||||
<VariantRow variant="Prefixed">
|
||||
<InputField placeholder="Default" addOnLeading={<>Prefix</>} />
|
||||
<InputField placeholder="Focused" className="sb-pseudo--focus" addOnLeading={<>Prefix</>} />
|
||||
<InputField placeholder="Hovered" className="sb-pseudo--hover" addOnLeading={<>Prefix</>} />
|
||||
</VariantRow>
|
||||
<VariantRow variant="Suffix">
|
||||
<InputField placeholder="Default" addOnSuffix={<>Prefix</>} />
|
||||
<InputField placeholder="Focused" className="sb-pseudo--focus" addOnSuffix={<>Prefix</>} />
|
||||
<InputField placeholder="Hovered" className="sb-pseudo--hover" addOnSuffix={<>Prefix</>} />
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
</Story>
|
||||
</Canvas>
|
||||
@@ -1,129 +0,0 @@
|
||||
import { Canvas, Meta, Story } from "@storybook/addon-docs";
|
||||
|
||||
import {
|
||||
Examples,
|
||||
Example,
|
||||
Title,
|
||||
CustomArgsTable,
|
||||
VariantRow,
|
||||
VariantsTable,
|
||||
} from "@calcom/storybook/components";
|
||||
|
||||
import { SelectField } from "./Select";
|
||||
|
||||
<Meta title="UI/Form/Select Field" component={SelectField} />
|
||||
|
||||
<Title title="Select" suffix="Brief" subtitle="Version 2.0 — Last Update: 29 Aug 2022" />
|
||||
|
||||
## Definition
|
||||
|
||||
Dropdown fields allow users to input existing options that is preset by the designer/developer. It can be just one choice per field, or they might be multiple choices depends on the circumstances.
|
||||
|
||||
## Structure
|
||||
|
||||
<CustomArgsTable of={SelectField} />
|
||||
|
||||
export const options = [
|
||||
{ value: 0, label: "Option One" },
|
||||
{ value: 1, label: "Option Two" },
|
||||
{ value: 3, label: "Option Three" },
|
||||
{ value: 4, label: "Option Four" },
|
||||
];
|
||||
|
||||
## Examples
|
||||
|
||||
<Examples
|
||||
title=" Single Selected / Unselected"
|
||||
footnote={
|
||||
<ul>
|
||||
<li>The difference between the types are when they are filled. </li>
|
||||
</ul>
|
||||
}>
|
||||
<Example title="Single Select [Unselected]" isFullWidth>
|
||||
<SelectField label={"Single Select"} options={options} />
|
||||
</Example>
|
||||
<Example title="Single Select [Selected]" isFullWidth>
|
||||
<SelectField label={"Single Select"} options={options} defaultValue={options[0]} />
|
||||
</Example>
|
||||
<Example title="Multi Select [Unselected]" isFullWidth>
|
||||
<SelectField label={"Multi Select"} options={options} isMulti={true} />
|
||||
</Example>
|
||||
<Example title="Multi Select [Selected]" isFullWidth>
|
||||
<SelectField label={"Multi Select"} options={options} isMulti={true} defaultValue={options[0]} />
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
<Examples title="Variants">
|
||||
<Example title="Default">
|
||||
<SelectField label={"Default Select"} options={options} />
|
||||
</Example>
|
||||
<Example title="Icon Left">
|
||||
WIP
|
||||
{/* <SelectField options={options} components={{ Control }}/> */}
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
## Variant Caviats (WIP) - To be updated
|
||||
|
||||
Using Icons is a bit of a strange one cause you can't simpily pass in an icon as a prop. You have to pass in a component. To the select field.
|
||||
|
||||
```js
|
||||
// Bad: Inline declaration will cause remounting issues
|
||||
const BadSelect = (props) => (
|
||||
<Select
|
||||
{...props}
|
||||
components={{
|
||||
Control: ({ children, ...rest }) => <components.Control {...rest}>👎 {children}</components.Control>,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
// Good: Custom component declared outside of the Select scope
|
||||
const Control = <IconLeading icon="plus" />;
|
||||
|
||||
const GoodSelect = (props) => <Select {...props} components={{ Control }} />;
|
||||
```
|
||||
|
||||
<Examples title="States ">
|
||||
<Example title="Default">
|
||||
<SelectField options={options} label={"Default Select"} />
|
||||
</Example>
|
||||
{/* <Example title="Hover">
|
||||
<SelectField options={options} className="sb-pseudo--hover"/>
|
||||
</Example>
|
||||
<Example title="Focus">
|
||||
<SelectField options={options} className="sb-pseudo--focus"/>
|
||||
</Example> */}
|
||||
</Examples>
|
||||
|
||||
## Select Story
|
||||
|
||||
<Canvas>
|
||||
<Story
|
||||
name="Default"
|
||||
args={{
|
||||
required: false,
|
||||
name: "select-field",
|
||||
error: "Some error",
|
||||
variant: "default",
|
||||
label: "Select an item",
|
||||
isMulti: false,
|
||||
options,
|
||||
}}
|
||||
argTypes={{
|
||||
variant: {
|
||||
control: {
|
||||
type: "select",
|
||||
options: ["default", "checkbox"],
|
||||
},
|
||||
},
|
||||
}}>
|
||||
{(args) => (
|
||||
<VariantsTable titles={["Default"]} columnMinWidth={300}>
|
||||
<VariantRow>
|
||||
<SelectField {...args} />
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
)}
|
||||
</Story>
|
||||
</Canvas>
|
||||
@@ -1,43 +0,0 @@
|
||||
import { Canvas, Meta, Story } from "@storybook/addon-docs";
|
||||
|
||||
import { Title, VariantRow, VariantsTable, CustomArgsTable } from "@calcom/storybook/components";
|
||||
|
||||
import { Steps } from "./Steps";
|
||||
|
||||
<Meta title="UI/Form/Steps" component={Steps} />
|
||||
|
||||
<Title title="Steps" suffix="Brief" subtitle="Version 1.0 — Last Update: 15 Aug 2023" />
|
||||
|
||||
## Definition
|
||||
|
||||
Steps component is used to display the current step out of the total steps in a process.
|
||||
|
||||
## Structure
|
||||
|
||||
The `Steps` component can be used to show the steps of the total in a process.
|
||||
|
||||
<CustomArgsTable of={Steps} />
|
||||
|
||||
## Steps Story
|
||||
|
||||
<Canvas>
|
||||
<Story
|
||||
name="Steps"
|
||||
args={{ maxSteps: 4, currentStep: 2 }}
|
||||
argTypes={{ maxSteps: { control: "number" }, currentStep: { control: "number" } }}>
|
||||
{({ maxSteps, currentStep }) => (
|
||||
<VariantsTable titles={["Default"]} columnMinWidth={150}>
|
||||
<VariantRow>
|
||||
<Steps
|
||||
maxSteps={maxSteps}
|
||||
currentStep={currentStep}
|
||||
navigateToStep={(step) => {
|
||||
const newPath = `?path=/story/ui-form-steps--steps&args=currentStep:${step + 1}`;
|
||||
window.open(newPath, "_self");
|
||||
}}
|
||||
/>
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
)}
|
||||
</Story>
|
||||
</Canvas>
|
||||
@@ -1,97 +0,0 @@
|
||||
import { TooltipProvider } from "@radix-ui/react-tooltip";
|
||||
import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
|
||||
|
||||
import {
|
||||
Examples,
|
||||
Example,
|
||||
Title,
|
||||
VariantsTable,
|
||||
CustomArgsTable,
|
||||
VariantRow,
|
||||
} from "@calcom/storybook/components";
|
||||
|
||||
import Switch from "./Switch";
|
||||
|
||||
<Meta title="UI/Form/Switch" component={Switch} />
|
||||
|
||||
<Title title="Switch" suffix="Brief" subtitle="Version 1.0 — Last Update: 16 Aug 2023" />
|
||||
|
||||
## Definition
|
||||
|
||||
Switch is a customizable toggle switch component that allows users to change between two states.
|
||||
|
||||
## Structure
|
||||
|
||||
The `Switch` component can be used to create toggle switches for various purposes. It provides options for adding labels, icons, and tooltips.
|
||||
|
||||
<CustomArgsTable of={Switch} />
|
||||
|
||||
<Examples title="States">
|
||||
<Example title="Default">
|
||||
<Switch />
|
||||
</Example>
|
||||
<Example title="Disabled">
|
||||
<Switch disabled />
|
||||
</Example>
|
||||
<Example title="Checked">
|
||||
<Switch checked />
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
<Examples title="Labels">
|
||||
<Example title="With Label and labelOnLeading">
|
||||
<Switch label="Enable Feature" labelOnLeading />
|
||||
</Example>
|
||||
<Example title="With Label">
|
||||
<Switch label="Enable Feature" />
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
<Examples title="Hover">
|
||||
<Example title="With Tooltip (Hover me)">
|
||||
<TooltipProvider>
|
||||
<Switch tooltip="Toggle to enable/disable the feature" />
|
||||
</TooltipProvider>
|
||||
</Example>
|
||||
<Example title="Without Tooltip (Hover me)">
|
||||
<TooltipProvider>
|
||||
<Switch />
|
||||
</TooltipProvider>
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
<Title offset title="Switch" suffix="Variants" />
|
||||
|
||||
<Canvas>
|
||||
<Story
|
||||
name="Switch"
|
||||
args={{
|
||||
label: "Enable Feature",
|
||||
tooltip: "Toggle to enable/disable the feature",
|
||||
checked: false,
|
||||
disabled: false,
|
||||
fitToHeight: false,
|
||||
labelOnLeading: false,
|
||||
}}
|
||||
argTypes={{
|
||||
label: { control: { type: "text" } },
|
||||
tooltip: { control: { type: "text" } },
|
||||
checked: { control: { type: "boolean" } },
|
||||
disabled: { control: { type: "boolean" } },
|
||||
fitToHeight: { control: { type: "boolean" } },
|
||||
labelOnLeading: { control: { type: "boolean" } },
|
||||
}}>
|
||||
{(props) => (
|
||||
<TooltipProvider>
|
||||
<VariantsTable titles={["Default"]} columnMinWidth={150}>
|
||||
<VariantRow>
|
||||
<Switch
|
||||
{...props}
|
||||
onCheckedChange={(checkedValue) => console.log("Switch value:", checkedValue)}
|
||||
/>
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
</TooltipProvider>
|
||||
)}
|
||||
</Story>
|
||||
</Canvas>
|
||||
@@ -1,83 +0,0 @@
|
||||
import { TooltipProvider } from "@radix-ui/react-tooltip";
|
||||
import { Canvas, Meta, Story } from "@storybook/addon-docs";
|
||||
|
||||
import {
|
||||
CustomArgsTable,
|
||||
Examples,
|
||||
Example,
|
||||
Title,
|
||||
VariantsTable,
|
||||
VariantRow,
|
||||
} from "@calcom/storybook/components";
|
||||
|
||||
import { StorybookTrpcProvider } from "../../mocks/trpc";
|
||||
import { TimezoneSelect } from "./TimezoneSelect";
|
||||
|
||||
<Meta title="UI/Form/TimezoneSelect" component={TimezoneSelect} />
|
||||
|
||||
<Title title="TimezoneSelect" suffix="Brief" subtitle="Version 1.0 — Last Update: 25 Aug 2023" />
|
||||
|
||||
## Definition
|
||||
|
||||
The `TimezoneSelect` component is used to display timezone options.
|
||||
|
||||
## Structure
|
||||
|
||||
The `TimezoneSelect` component can be used to display timezone options.
|
||||
|
||||
<CustomArgsTable of={TimezoneSelect} />
|
||||
|
||||
## Examples
|
||||
|
||||
<Examples title="TimezoneSelect">
|
||||
<Example title="Default">
|
||||
<StorybookTrpcProvider>
|
||||
<TimezoneSelect value="Africa/Douala" />
|
||||
</StorybookTrpcProvider>
|
||||
</Example>
|
||||
<Example title="Disabled">
|
||||
<StorybookTrpcProvider>
|
||||
<TimezoneSelect value="Africa/Douala" isDisabled />
|
||||
</StorybookTrpcProvider>
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
## TimezoneSelect Story
|
||||
|
||||
<Canvas>
|
||||
<Story
|
||||
name="TimezoneSelect"
|
||||
args={{
|
||||
className: "mt-24",
|
||||
value: "Africa/Douala",
|
||||
variant: "default",
|
||||
isDisabled: false,
|
||||
timezones: {
|
||||
"Timezone 1": "City 1",
|
||||
"Timezone 2": "City 2",
|
||||
"Timezone 3": "City 3",
|
||||
},
|
||||
isPending: false,
|
||||
}}
|
||||
argTypes={{
|
||||
value: {
|
||||
control: { disable: true },
|
||||
},
|
||||
variant: {
|
||||
control: {
|
||||
type: "inline-radio",
|
||||
options: ["default", "minimal"],
|
||||
},
|
||||
},
|
||||
}}>
|
||||
{(args) => (
|
||||
<VariantsTable titles={["Default"]} columnMinWidth={350}>
|
||||
<VariantRow>
|
||||
<StorybookTrpcProvider>
|
||||
<TimezoneSelect {...args} />
|
||||
</StorybookTrpcProvider>
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
)}
|
||||
</Story>
|
||||
</Canvas>
|
||||
@@ -1,108 +0,0 @@
|
||||
import { TooltipProvider } from "@radix-ui/react-tooltip";
|
||||
import { Canvas, Meta, Story } from "@storybook/addon-docs";
|
||||
|
||||
import {
|
||||
CustomArgsTable,
|
||||
Examples,
|
||||
Example,
|
||||
Title,
|
||||
VariantsTable,
|
||||
VariantRow,
|
||||
} from "@calcom/storybook/components";
|
||||
import { Icon } from "@calcom/ui/icon";
|
||||
|
||||
import { ToggleGroup } from "./ToggleGroup";
|
||||
|
||||
<Meta title="UI/Form/ToggleGroup" component={ToggleGroup} />
|
||||
|
||||
<Title title="ToggleGroup" suffix="Brief" subtitle="Version 1.0 — Last Update: 17 Aug 2023" />
|
||||
|
||||
## Definition
|
||||
|
||||
The `ToggleGroup` component is used to create a group of toggle items with optional tooltips.
|
||||
|
||||
## Structure
|
||||
|
||||
<CustomArgsTable of={ToggleGroup} />
|
||||
|
||||
## Examples
|
||||
|
||||
<Examples title="Toggle Group With Icon Left">
|
||||
<Example>
|
||||
<TooltipProvider>
|
||||
<ToggleGroup
|
||||
options={[
|
||||
{ value: "option1", label: "Option 1", tooltip: "Tooltip for Option 1", iconLeft: <Icon name="arrow-right" /> },
|
||||
{ value: "option2", label: "Option 2", iconLeft: <Icon name="arrow-right" /> },
|
||||
{ value: "option3", label: "Option 3", iconLeft: <Icon name="arrow-right" /> },
|
||||
{
|
||||
value: "option4",
|
||||
label: "Option 4",
|
||||
tooltip: "Tooltip for Option 4",
|
||||
iconLeft: <Icon name="arrow-right" />,
|
||||
},
|
||||
{ value: "option5", label: "Option 5", iconLeft: <Icon name="arrow-right" />, disabled: true },
|
||||
]}
|
||||
/>
|
||||
</TooltipProvider>
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
## ToggleGroup Story
|
||||
|
||||
<Canvas>
|
||||
<Story
|
||||
name="Default"
|
||||
args={{
|
||||
options: [
|
||||
{ value: "option1", label: "Option 1", tooltip: "Tooltip for Option 1" },
|
||||
{ value: "option2", label: "Option 2" },
|
||||
{ value: "option3", label: "Option 3" },
|
||||
{
|
||||
value: "option4",
|
||||
label: "Option 4",
|
||||
tooltip: "Tooltip for Option 4",
|
||||
},
|
||||
{ value: "option5", label: "Option 5", disabled: true },
|
||||
],
|
||||
}}
|
||||
argTypes={{
|
||||
options: {
|
||||
value: {
|
||||
control: {
|
||||
type: "text",
|
||||
},
|
||||
},
|
||||
label: {
|
||||
control: {
|
||||
type: "text",
|
||||
},
|
||||
},
|
||||
tooltip: {
|
||||
control: {
|
||||
type: "text",
|
||||
},
|
||||
},
|
||||
disabled: {
|
||||
control: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
isFullWidth: {
|
||||
control: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
},
|
||||
}}>
|
||||
{({ options, isFullWidth }) => (
|
||||
<VariantsTable titles={["Default"]} columnMinWidth={150}>
|
||||
<VariantRow>
|
||||
<TooltipProvider>
|
||||
<ToggleGroup options={options} isFullWidth={isFullWidth} />
|
||||
</TooltipProvider>
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
)}
|
||||
</Story>
|
||||
</Canvas>
|
||||
@@ -1,63 +0,0 @@
|
||||
import { Canvas, Meta, Story } from "@storybook/addon-docs";
|
||||
|
||||
import { CustomArgsTable, Title, VariantsTable, VariantRow } from "@calcom/storybook/components";
|
||||
|
||||
import WizardForm from "./WizardForm";
|
||||
|
||||
<Meta title="UI/Form/WizardForm" component={WizardForm} />
|
||||
|
||||
<Title title="WizardForm" subtitle="Version 1.0 — Last Update: 5 Sep 2023" />
|
||||
|
||||
## Definition
|
||||
|
||||
The `WizardForm` component provides a structure for creating multi-step forms or wizards.
|
||||
|
||||
## Structure
|
||||
|
||||
<CustomArgsTable of={WizardForm} />
|
||||
|
||||
## Note on Navigation
|
||||
|
||||
Please be aware that the steps navigation is managed internally within the `WizardForm` component. As such, when viewing this component in Storybook, clicking the "Next" button will not showcase the transition to the subsequent step.
|
||||
|
||||
To observe the actual step navigation behavior, please refer to the Storybook stories for the individual `Steps` component.
|
||||
|
||||
## WizardForm Story
|
||||
|
||||
<Canvas>
|
||||
<Story
|
||||
parameters={{
|
||||
nextjs: {
|
||||
appDirectory: true,
|
||||
},
|
||||
}}
|
||||
name="Basic"
|
||||
args={{
|
||||
href: "/wizard",
|
||||
steps: [
|
||||
{ title: "Step 1", description: "Description for Step 1" },
|
||||
{ title: "Step 2", description: "Description for Step 2" },
|
||||
{ title: "Step 3", description: "Description for Step 3" },
|
||||
],
|
||||
}}
|
||||
argTypes={{
|
||||
href: {
|
||||
control: {
|
||||
type: "text",
|
||||
},
|
||||
},
|
||||
steps: {
|
||||
control: {
|
||||
type: "object",
|
||||
},
|
||||
},
|
||||
}}>
|
||||
{({ href, steps }) => (
|
||||
<VariantsTable titles={["Basic Wizard Form"]} columnMinWidth={150}>
|
||||
<VariantRow>
|
||||
<WizardForm href={href} steps={steps} />
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
)}
|
||||
</Story>
|
||||
</Canvas>
|
||||
Reference in new issue
Block a user