Cleaning up storybook files (#5290)
* storybook v2 init * Merge config into storybook vite build * Remove path * Storybook config tweaks * Added styles and settings for storybook v2, and started working on button documentation and examples. * Badges + flex wrap on mobile * Breadcrumbs+button+avatar * Checkbox * Input + moving files around * WIP table * WIP table grid * Replaced imports for new components. * Added first steps for varianttable. * Small alignment fix. * Custom Args Table - With scrollbar * Adding table to components that need it + darkmode * Add intro * Fix types * Remove V1 storybook and replace with V2 * Fix badge type error * Fixed storybook dependencies * Added cover image to storybook * Remove vita from ts config, we dont use vite. * Fixed button import. * Explained postcss pseudo plugin. * Fixed badge import. * Add Avatar Stories * ButtonGroup Stories * Fixed imports * Add checkbox stories * Add exports for differnt types of inputs * Fix form and text area input * Fix mass import errors Co-authored-by: Jeroen Reumkens <[email protected]> Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
234 files changed
+2709
-2692
No files matched your search
@@ -1,27 +0,0 @@
|
||||
import React from "react";
|
||||
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
|
||||
export type BadgeProps = {
|
||||
variant: "default" | "success" | "gray";
|
||||
} & JSX.IntrinsicElements["span"];
|
||||
|
||||
export const Badge = function Badge(props: BadgeProps) {
|
||||
const { variant, className, ...passThroughProps } = props;
|
||||
|
||||
return (
|
||||
<span
|
||||
{...passThroughProps}
|
||||
className={classNames(
|
||||
"inline-block rounded-sm px-2 py-0.5 text-xs font-bold",
|
||||
variant === "default" && "bg-yellow-100 text-yellow-800",
|
||||
variant === "success" && "bg-green-100 text-green-800",
|
||||
variant === "gray" && "bg-gray-200 text-gray-800",
|
||||
className
|
||||
)}>
|
||||
{props.children}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
export default Badge;
|
||||
@@ -0,0 +1,27 @@
|
||||
# Whatsup with all these version?
|
||||
|
||||
We're currently in the progress of merging multiple versions of our UI library into one new version.
|
||||
|
||||
## Version 1
|
||||
Anything version 1 is in the root, or in the root folders skeleton, form, booker and apps.
|
||||
|
||||
## Version 2
|
||||
Anything version 2 is in the v2 folder
|
||||
|
||||
## New version
|
||||
We're currently creating all new components following new standards in the components directory. The /styles directory contains the shared tailwind styles.
|
||||
|
||||
### Adding new components
|
||||
For adding new components it is important to take a few patterns into account:
|
||||
* All components should be added in /components
|
||||
* All components should be in a folder, no tsx files directly in the root
|
||||
* All components should contain stories and MDX documentation (which is why they can't live in the root, since that would result in a lot of duplication)
|
||||
|
||||
### Migration process
|
||||
We're currently migrating existing components step by step, this process looks as following:
|
||||
* New components only should get added in /components
|
||||
* Any existing components in v2 are reviewed, updated if needed and then moved to the /components directory
|
||||
* After v2 is moved, the old v2 component should be deleted, as well as any v1 version of that component. All places in the monorepo where we use this component, should use the newest version by then.
|
||||
|
||||
### End state
|
||||
The envisioned end state is a state where only the /components directory exists. In this directory all components should have documentation and stories.
|
||||
@@ -24,7 +24,7 @@ const sizesPropsBySize = {
|
||||
lg: "w-16", // 64px
|
||||
} as const;
|
||||
|
||||
export default function Avatar(props: AvatarProps) {
|
||||
export function Avatar(props: AvatarProps) {
|
||||
const { imageSrc, gravatarFallbackMd5, size, alt, title } = props;
|
||||
const sizeClassname = sizesPropsBySize[size];
|
||||
const rootClass = classNames("rounded-full aspect-square", sizeClassname, "h-auto");
|
||||
@@ -1,6 +1,6 @@
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
|
||||
import Avatar from "./Avatar";
|
||||
import { Avatar } from "./Avatar";
|
||||
|
||||
export type AvatarGroupProps = {
|
||||
size: "sm" | "lg";
|
||||
@@ -57,5 +57,3 @@ export const AvatarGroup = function AvatarGroup(props: AvatarGroupProps) {
|
||||
</ul>
|
||||
);
|
||||
};
|
||||
|
||||
export default AvatarGroup;
|
||||
@@ -0,0 +1,139 @@
|
||||
import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
||||
import { Examples, Example, Note, Title,CustomArgsTable,VariantsTable,VariantRow } from '@calcom/storybook/components'
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
import {Avatar} from './Avatar';
|
||||
import {AvatarGroup} from './AvatarGroup';
|
||||
|
||||
<Meta title="UI/Avatar" component={Avatar} />
|
||||
|
||||
<Title title="Avatar" suffix="Brief" subtitle="Version 2.0 — Last Update: 22 Aug 2022"/>
|
||||
|
||||
|
||||
|
||||
## Definition
|
||||
An avatar group signals that there is more than 1 person associated with an item
|
||||
|
||||
## Structure
|
||||
Avatar group can be composed differently based on the number of user profile.
|
||||
|
||||
<CustomArgsTable of={Avatar} />
|
||||
|
||||
<Examples title="Avatar style">
|
||||
<Example title="Small">
|
||||
<Avatar size="sm" alt="Avatar Story" gravatarFallbackMd5="[email protected]" />
|
||||
</Example>
|
||||
<Example title="Large">
|
||||
<Avatar size="lg" alt="Avatar Story" gravatarFallbackMd5="[email protected]" />
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
<ArgsTable of={Avatar} />
|
||||
|
||||
### Avatar Group
|
||||
<ArgsTable of={AvatarGroup} />
|
||||
<Examples title="Avatar Group ">
|
||||
<Example title="Small">
|
||||
<AvatarGroup size="sm" items={[
|
||||
{
|
||||
image: "https://cal.com/stakeholder/peer.jpg",
|
||||
alt: "Peer",
|
||||
title: "Peer Richelsen",
|
||||
},
|
||||
{
|
||||
image: "https://cal.com/stakeholder/bailey.jpg",
|
||||
alt: "Bailey",
|
||||
title: "Bailey Pumfleet",
|
||||
},
|
||||
{
|
||||
image: "https://cal.com/stakeholder/alex-van-andel.jpg",
|
||||
alt: "Alex",
|
||||
title: "Alex Van Andel",
|
||||
},
|
||||
{
|
||||
image: "https://cal.com/stakeholder/ciaran.jpg",
|
||||
alt: "Ciarán",
|
||||
title: "Ciarán Hanrahan",
|
||||
},
|
||||
{
|
||||
image: "https://cal.com/stakeholder/peer.jpg",
|
||||
alt: "Peer",
|
||||
title: "Peer Richelsen",
|
||||
},
|
||||
{
|
||||
image: "https://cal.com/stakeholder/bailey.jpg",
|
||||
alt: "Bailey",
|
||||
title: "Bailey Pumfleet",
|
||||
},
|
||||
{
|
||||
image: "https://cal.com/stakeholder/alex-van-andel.jpg",
|
||||
alt: "Alex",
|
||||
title: "Alex Van Andel",
|
||||
},
|
||||
{
|
||||
image: "https://cal.com/stakeholder/ciaran.jpg",
|
||||
alt: "Ciarán",
|
||||
title: "Ciarán Hanrahan",
|
||||
},
|
||||
]}/>
|
||||
</Example>
|
||||
<Example title="large">
|
||||
<AvatarGroup size="lg" items={[
|
||||
{
|
||||
image: "https://cal.com/stakeholder/peer.jpg",
|
||||
alt: "Peer",
|
||||
title: "Peer Richelsen",
|
||||
},
|
||||
{
|
||||
image: "https://cal.com/stakeholder/bailey.jpg",
|
||||
alt: "Bailey",
|
||||
title: "Bailey Pumfleet",
|
||||
},
|
||||
{
|
||||
image: "https://cal.com/stakeholder/alex-van-andel.jpg",
|
||||
alt: "Alex",
|
||||
title: "Alex Van Andel",
|
||||
},
|
||||
{
|
||||
image: "https://cal.com/stakeholder/ciaran.jpg",
|
||||
alt: "Ciarán",
|
||||
title: "Ciarán Hanrahan",
|
||||
},
|
||||
{
|
||||
image: "https://cal.com/stakeholder/peer.jpg",
|
||||
alt: "Peer",
|
||||
title: "Peer Richelsen",
|
||||
},
|
||||
{
|
||||
image: "https://cal.com/stakeholder/bailey.jpg",
|
||||
alt: "Bailey",
|
||||
title: "Bailey Pumfleet",
|
||||
},
|
||||
{
|
||||
image: "https://cal.com/stakeholder/alex-van-andel.jpg",
|
||||
alt: "Alex",
|
||||
title: "Alex Van Andel",
|
||||
},
|
||||
{
|
||||
image: "https://cal.com/stakeholder/ciaran.jpg",
|
||||
alt: "Ciarán",
|
||||
title: "Ciarán Hanrahan",
|
||||
},
|
||||
]}/>
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
<Title offset title="Avatar" suffix="Variants" />
|
||||
|
||||
<Canvas>
|
||||
<Story
|
||||
name="Avatar">
|
||||
<VariantsTable titles={['Default']} columnMinWidth={150}>
|
||||
<VariantRow variant="Sm">
|
||||
<Avatar size="sm" alt="Avatar Story" gravatarFallbackMd5="[email protected]" />
|
||||
</VariantRow>
|
||||
<VariantRow variant="Lg">
|
||||
<Avatar size="lg" alt="Avatar Story" gravatarFallbackMd5="[email protected]" />
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
</Story>
|
||||
</Canvas>
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./Avatar";
|
||||
export * from "./AvatarGroup";
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Icon } from "react-feather";
|
||||
import { GoPrimitiveDot } from "react-icons/go";
|
||||
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
|
||||
@@ -24,12 +25,22 @@ export type BadgeProps = {
|
||||
size?: keyof typeof classNameBySize;
|
||||
StartIcon?: Icon;
|
||||
bold?: boolean;
|
||||
withDot?: boolean;
|
||||
rounded?: boolean;
|
||||
} & JSX.IntrinsicElements["div"];
|
||||
|
||||
export const Badge = function Badge(props: BadgeProps) {
|
||||
const { variant, className, size = "default", rounded, StartIcon, bold, ...passThroughProps } = props;
|
||||
|
||||
const {
|
||||
variant = "default",
|
||||
className,
|
||||
size = "default",
|
||||
rounded,
|
||||
StartIcon,
|
||||
withDot,
|
||||
bold,
|
||||
...passThroughProps
|
||||
} = props;
|
||||
const hasIconOrDot = StartIcon || withDot;
|
||||
return (
|
||||
<div
|
||||
{...passThroughProps}
|
||||
@@ -37,16 +48,15 @@ export const Badge = function Badge(props: BadgeProps) {
|
||||
"inline-flex items-center justify-center py-0.5 px-[6px] text-xs",
|
||||
bold ? "font-semibold" : "font-normal",
|
||||
rounded ? "min-w-5 min-h-5 rounded-full pt-1" : "rounded-md",
|
||||
!StartIcon ? classNameBySize[size] : "",
|
||||
!hasIconOrDot ? classNameBySize[size] : "",
|
||||
badgeClassNameByVariant[variant],
|
||||
className
|
||||
)}>
|
||||
<>
|
||||
{StartIcon && <StartIcon className="mr-1 h-3 w-3 stroke-[3px]" />}
|
||||
{withDot && <GoPrimitiveDot className="mr-1 h-3 w-3 stroke-[3px]" />}
|
||||
{props.children}
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Badge;
|
||||
@@ -0,0 +1,83 @@
|
||||
import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
||||
import { Examples, Example, Note, Title,CustomArgsTable,VariantsTable, VariantRow } from '@calcom/storybook/components'
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
import { Badge } from './Badge';
|
||||
|
||||
<Meta title="UI/Badge" component={Badge} />
|
||||
|
||||
<Title title="Bages" suffix="Brief" subtitle="Version 2.0 — Last Update: 22 Aug 2022"/>
|
||||
|
||||
|
||||
## Definition
|
||||
Badges are small status descriptors for UI elements. A badge consists of a small circle, typically containing a number or other short set of characters, that appears in proximity to another object. We provide three different type of badge such as status, alert, and brand badge.
|
||||
|
||||
Status badge communicate status information. It is generally used within a container such as accordion and tables to label status for easy scanning.
|
||||
## Structure
|
||||
|
||||
<CustomArgsTable of={Badge} />
|
||||
|
||||
|
||||
<Examples title="Badge style">
|
||||
<Example title="Gray">
|
||||
<Badge variant="gray" >Badge text</Badge>
|
||||
</Example>
|
||||
<Example title="Green/Success">
|
||||
<Badge variant="success">Badge text</Badge>
|
||||
</Example>
|
||||
<Example title="Orange/Default">
|
||||
<Badge variant="default">Badge text</Badge>
|
||||
</Example>
|
||||
<Example title="Red/Error">
|
||||
<Badge variant="red">Badge text</Badge>
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
<Examples title="Variants">
|
||||
<Example title="Default">
|
||||
<Badge>Button text</Badge>
|
||||
</Example>
|
||||
<Example title="With Dot">
|
||||
<Badge withDot>Button Text</Badge>
|
||||
</Example>
|
||||
<Example title="With Icon">
|
||||
<Badge StartIcon={Icon.FiPlus}>Button Text</Badge>
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
|
||||
## Alert Badges
|
||||
|
||||
|
||||
## Usage
|
||||
Alet badge is used in conjunction with an item, profile or label to indicate numeric value and messages assocciated with them.
|
||||
|
||||
|
||||
|
||||
<Title offset title="Badge" suffix="Variants" />
|
||||
|
||||
<Canvas>
|
||||
<Story name="All Variants">
|
||||
<VariantsTable titles={['Default','With Dot', 'With Icon']} columnMinWidth={150}>
|
||||
<VariantRow variant="Default">
|
||||
<Badge variant="default" >Badge text</Badge>
|
||||
<Badge variant="default" withDot>Badge text</Badge>
|
||||
<Badge variant="default" StartIcon={Icon.FiPlus}>Badge text</Badge>
|
||||
</VariantRow>
|
||||
<VariantRow variant="Success">
|
||||
<Badge variant="success" >Badge text</Badge>
|
||||
<Badge variant="success" withDot>Badge text</Badge>
|
||||
<Badge variant="success" StartIcon={Icon.FiPlus}>Badge text</Badge>
|
||||
</VariantRow>
|
||||
<VariantRow variant="gray">
|
||||
<Badge variant="gray" >Badge text</Badge>
|
||||
<Badge variant="gray" withDot>Badge text</Badge>
|
||||
<Badge variant="gray" StartIcon={Icon.FiPlus}>Badge text</Badge>
|
||||
</VariantRow>
|
||||
<VariantRow variant="error">
|
||||
<Badge variant="error" >Badge text</Badge>
|
||||
<Badge variant="error" withDot>Badge text</Badge>
|
||||
<Badge variant="error" StartIcon={Icon.FiPlus}>Badge text</Badge>
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
</Story>
|
||||
</Canvas>
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./Badge";
|
||||
File renamed without changes.
@@ -0,0 +1,28 @@
|
||||
import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
||||
import { Examples, Example, Note, Title,CustomArgsTable } from '@calcom/storybook/components'
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
|
||||
import { Breadcrumb } from './Breadcrumb';
|
||||
|
||||
<Meta title="UI/Breadcrumbs" component={Breadcrumb} />
|
||||
|
||||
<Title title="Breadcrumbs" suffix="Brief" subtitle="Version 2.0 — Last Update: 22 Aug 2022"/>
|
||||
|
||||
|
||||
## Structure
|
||||
|
||||
<CustomArgsTable of={Breadcrumb} />
|
||||
|
||||
|
||||
<Examples title="Breadcrumb style"
|
||||
>
|
||||
<Example title="Primary">
|
||||
<Breadcrumb>
|
||||
<BreadcrumbItem href="/">Home</BreadcrumbItem>
|
||||
<BreadcrumbItem href="/">Test</BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
## Usage
|
||||
When hovering over the button, there should be a tooltip to explain the context of the button, so the user can understand the result of action.
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./Breadcrumb";
|
||||
@@ -4,7 +4,7 @@ import { Icon } from "react-feather";
|
||||
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
|
||||
import { Tooltip } from "./Tooltip";
|
||||
import Tooltip from "../../v2/core/Tooltip";
|
||||
|
||||
export type ButtonBaseProps = {
|
||||
/* Primary: Signals most important actions at any given point in the application.
|
||||
@@ -152,5 +152,3 @@ const Wrapper = ({ children, tooltip }: { tooltip?: string; children: React.Reac
|
||||
|
||||
return <Tooltip content={tooltip}>{children}</Tooltip>;
|
||||
};
|
||||
|
||||
export default Button;
|
||||
@@ -0,0 +1,111 @@
|
||||
import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
||||
import { Examples, Example, Note, Title, VariantsTable, VariantColumn, RowTitles, CustomArgsTable} from '@calcom/storybook/components'
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
|
||||
import { Button } from './Button';
|
||||
|
||||
<Meta title="UI/Button" component={Button} />
|
||||
|
||||
<Title title="Buttons" suffix="Brief" subtitle="Version 2.0 — Last Update: 22 Aug 2022"/>
|
||||
|
||||
|
||||
## Definition
|
||||
Button are clickable elements that initiates user actions. Labels in the button guide users to what action will occur when the user interacts with it.
|
||||
|
||||
## Structure
|
||||
|
||||
<CustomArgsTable of={Button} />
|
||||
|
||||
|
||||
<Examples title="Button style" footnote={
|
||||
<ul>
|
||||
<li>Primary: Signals most important actions at any given point in the application.</li>
|
||||
<li>Secondary: Gives visual weight to actions that are important</li>
|
||||
<li>Minimal: Used for actions that we want to give very little significane to</li>
|
||||
</ul>
|
||||
}>
|
||||
<Example title="Primary">
|
||||
<Button className="sb-fake-pseudo--focus">Button text</Button>
|
||||
</Example>
|
||||
<Example title="Secondary">
|
||||
<Button color="secondary">Button text</Button>
|
||||
</Example>
|
||||
<Example title="Minimal">
|
||||
<Button color="minimal">Button text</Button>
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
<Examples title="State">
|
||||
<Example title="Default">
|
||||
<Button>Button text</Button>
|
||||
</Example>
|
||||
<Example title="Hover">
|
||||
<Button className="sb-pseudo--hover">Button text</Button>
|
||||
</Example>
|
||||
<Example title="Focus">
|
||||
<Button className="sb-pseudo--focus">Button text</Button>
|
||||
</Example>
|
||||
<Example title="Disabled">
|
||||
<Button disabled>Button text</Button>
|
||||
</Example>
|
||||
<Example title="Loading">
|
||||
<Button loading>Button text</Button>
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
<Examples title="Icons">
|
||||
<Example title="Default">
|
||||
<Button>Button text</Button>
|
||||
</Example>
|
||||
<Example title="Icon left">
|
||||
<Button StartIcon={Icon.FiPlus}>Button text</Button>
|
||||
</Example>
|
||||
<Example title="Icon right">
|
||||
<Button EndIcon={Icon.FiPlus}>Button text</Button>
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
|
||||
## Anatomy
|
||||
Button are clickable elements that initiates user actions. Labels in the button guide users to what action will occur when the user interacts with it.
|
||||
|
||||
## Usage
|
||||
|
||||
<Note>In general, there should be only one Primary button in any application context</Note>
|
||||
<Note>Aim to use maximum 2 words for the button label. Button size can be flexible based on the visual hierarchy and devices. </Note>
|
||||
<Note>Hover state variant for Mobile button is an option for assistive device.</Note>
|
||||
|
||||
<Title offset title="Buttons" suffix="Variants" />
|
||||
|
||||
|
||||
<Canvas>
|
||||
<Story name="All variants">
|
||||
<VariantsTable titles={['Primary', 'Secondary', 'Minimal']} columnMinWidth={150}>
|
||||
<VariantRow variant="Default">
|
||||
<Button>Button text</Button>
|
||||
<Button color="secondary">Button text</Button>
|
||||
<Button color="minimal">Button text</Button>
|
||||
</VariantRow>
|
||||
<VariantRow variant="Hover">
|
||||
<Button className="sb-pseudo--hover">Button text</Button>
|
||||
<Button className="sb-pseudo--hover" color="secondary">Button text</Button>
|
||||
<Button className="sb-pseudo--hover" color="minimal">Button text</Button>
|
||||
</VariantRow>
|
||||
<VariantRow variant="Focus">
|
||||
<Button className="sb-pseudo--focus">Button text</Button>
|
||||
<Button className="sb-pseudo--focus" color="secondary">Button text</Button>
|
||||
<Button className="sb-pseudo--focus" color="minimal">Button text</Button>
|
||||
</VariantRow>
|
||||
<VariantRow variant="Loading">
|
||||
<Button loading>Button text</Button>
|
||||
<Button loading color="secondary">Button text</Button>
|
||||
<Button loading color="minimal">Button text</Button>
|
||||
</VariantRow>
|
||||
<VariantRow variant="Disabled">
|
||||
<Button disabled>Button text</Button>
|
||||
<Button disabled color="secondary">Button text</Button>
|
||||
<Button disabled color="minimal">Button text</Button>
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
</Story>
|
||||
</Canvas>
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./Button";
|
||||
+1
-1
@@ -13,7 +13,7 @@ type Props = { children: React.ReactNode; combined?: boolean; containerProps?: J
|
||||
* We dont need to add border to the right as we never remove it
|
||||
*/
|
||||
|
||||
export default function ButtonGroup({ children, combined = false, containerProps }: Props) {
|
||||
export function ButtonGroup({ children, combined = false, containerProps }: Props) {
|
||||
return (
|
||||
<div
|
||||
{...containerProps}
|
||||
@@ -0,0 +1,84 @@
|
||||
import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
||||
import { Examples, Example, Note, Title,CustomArgsTable,VariantsTable,VariantsRow } from '@calcom/storybook/components'
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
|
||||
import { ButtonGroup} from './ButtonGroup';
|
||||
import { Button} from '../button/Button';
|
||||
|
||||
<Meta title="UI/Button Group" component={ButtonGroup} />
|
||||
|
||||
<Title title="Button Group" suffix="Brief" subtitle="Version 2.0 — Last Update: 22 Aug 2022"/>
|
||||
|
||||
## Definition
|
||||
Button group enables multiple buttons to be combined into a single unit. It offers users access to frequently performed, related actions.
|
||||
|
||||
## Structure
|
||||
|
||||
<CustomArgsTable of={ButtonGroup} />
|
||||
|
||||
|
||||
<Examples title="Breadcrumb style"
|
||||
footNote ={
|
||||
<ul>
|
||||
<li>
|
||||
Seperated: In general, seperated button group style can be included in container such as card, modal, and page.
|
||||
</li>
|
||||
<li>
|
||||
Combined: Combined button group can be used standalone e.g. mini toggles for calendars
|
||||
</li>
|
||||
</ul>
|
||||
}
|
||||
>
|
||||
<Example title="Default" >
|
||||
<ButtonGroup>
|
||||
<Button StartIcon={Icon.FiTrash} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiNavigation} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiClipboard} size="icon" color="secondary" />
|
||||
</ButtonGroup>
|
||||
</Example>
|
||||
<Example title="Combined">
|
||||
<ButtonGroup combined>
|
||||
<Button StartIcon={Icon.FiTrash} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiNavigation} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiClipboard} size="icon" color="secondary" />
|
||||
</ButtonGroup>
|
||||
</Example>
|
||||
</Examples>
|
||||
|
||||
|
||||
<Canvas>
|
||||
<Story
|
||||
name="All Variatns">
|
||||
<VariantsTable titles={["Default",'Secondary',"Minimal"]} columnMinWidth={150}>
|
||||
<VariantRow variant="Default">
|
||||
<ButtonGroup>
|
||||
<Button StartIcon={Icon.FiTrash} size="icon" />
|
||||
<Button StartIcon={Icon.FiNavigation} size="icon"/>
|
||||
<Button StartIcon={Icon.FiClipboard} size="icon" />
|
||||
</ButtonGroup>
|
||||
<ButtonGroup>
|
||||
<Button StartIcon={Icon.FiTrash} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiNavigation} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiClipboard} size="icon" color="secondary" />
|
||||
</ButtonGroup>
|
||||
<ButtonGroup>
|
||||
<Button StartIcon={Icon.FiTrash} size="icon" color="minimal" />
|
||||
<Button StartIcon={Icon.FiNavigation} size="icon" color="minimal" />
|
||||
<Button StartIcon={Icon.FiClipboard} size="icon" color="minimal" />
|
||||
</ButtonGroup>
|
||||
</VariantRow>
|
||||
<VariantRow variant="Combined">
|
||||
<ButtonGroup combined>
|
||||
<Button StartIcon={Icon.FiTrash} size="icon" />
|
||||
<Button StartIcon={Icon.FiNavigation} size="icon" />
|
||||
<Button StartIcon={Icon.FiClipboard} size="icon" />
|
||||
</ButtonGroup>
|
||||
<ButtonGroup combined>
|
||||
<Button StartIcon={Icon.FiTrash} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiNavigation} size="icon" color="secondary" />
|
||||
<Button StartIcon={Icon.FiClipboard} size="icon" color="secondary" />
|
||||
</ButtonGroup>
|
||||
</VariantRow>
|
||||
</VariantsTable>
|
||||
</Story>
|
||||
</Canvas>
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./ButtonGroup";
|
||||
File renamed without changes.
@@ -0,0 +1,66 @@
|
||||
import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
||||
import { Examples, Example, Note, Title,CustomArgsTable,VariantsTable,VariantsRow } from '@calcom/storybook/components'
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
|
||||
import 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">
|
||||
<VariantsTable titles={[""]} columnMinWidth={150}>
|
||||
<VariantsRow variant="Default">
|
||||
<Checkbox label="Default" />
|
||||
<Checkbox label="Error" error/>
|
||||
<Checkbox label="Disabled" disabled/>
|
||||
<Checkbox label="Disabled Checked" checked disabled />
|
||||
</VariantsRow>
|
||||
<VariantsRow variant="Description As Label">
|
||||
<Checkbox description="Default" descriptionAsLabel />
|
||||
<Checkbox description="Error" error descriptionAsLabel/>
|
||||
<Checkbox description="Disabled" disabled descriptionAsLabel/>
|
||||
<Checkbox description="Disabled Checked" checked disabled descriptionAsLabel/>
|
||||
</VariantsRow>
|
||||
</VariantsTable>
|
||||
</Story>
|
||||
</Canvas>
|
||||
@@ -0,0 +1 @@
|
||||
export { default as Checkbox } from "./Checkbox";
|
||||
@@ -0,0 +1,4 @@
|
||||
export * from "./checkbox";
|
||||
export * from "./inputs/HintOrErrors";
|
||||
export * from "./inputs/Input";
|
||||
export * from "./inputs/Label";
|
||||
@@ -0,0 +1,102 @@
|
||||
import { X, Circle, Check } from "react-feather";
|
||||
import { FieldValues, useFormContext } from "react-hook-form";
|
||||
|
||||
// TODO: Refactor import once V1 migration has happened
|
||||
import { Icon } from "../../../Icon";
|
||||
|
||||
export function HintsOrErrors<T extends FieldValues = FieldValues>(props: {
|
||||
hintErrors?: string[];
|
||||
fieldName: string;
|
||||
t: (key: string) => string;
|
||||
}) {
|
||||
const methods = useFormContext() as ReturnType<typeof useFormContext> | null;
|
||||
/* If there's no methods it means we're using these components outside a React Hook Form context */
|
||||
if (!methods) return null;
|
||||
const { formState } = methods;
|
||||
const { hintErrors, fieldName, t } = props;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const fieldErrors: FieldErrors<T> | undefined = formState.errors[fieldName];
|
||||
|
||||
if (!hintErrors && fieldErrors && !fieldErrors.message) {
|
||||
// no hints passed, field errors exist and they are custom ones
|
||||
return (
|
||||
<div className="text-gray mt-2 flex items-center text-sm text-gray-700">
|
||||
<ul className="ml-2">
|
||||
{Object.keys(fieldErrors).map((key: string) => {
|
||||
return (
|
||||
<li key={key} className="text-blue-700">
|
||||
{t(`${fieldName}_hint_${key}`)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (hintErrors && fieldErrors) {
|
||||
// hints passed, field errors exist
|
||||
return (
|
||||
<div className="text-gray mt-2 flex items-center text-sm text-gray-700">
|
||||
<ul className="ml-2">
|
||||
{hintErrors.map((key: string) => {
|
||||
const submitted = formState.isSubmitted;
|
||||
const error = fieldErrors[key] || fieldErrors.message;
|
||||
return (
|
||||
<li
|
||||
key={key}
|
||||
className={error !== undefined ? (submitted ? "text-red-700" : "") : "text-green-600"}>
|
||||
{error !== undefined ? (
|
||||
submitted ? (
|
||||
<X size="12" strokeWidth="3" className="mr-2 -ml-1 inline-block" />
|
||||
) : (
|
||||
<Circle fill="currentColor" size="5" className="mr-2 inline-block" />
|
||||
)
|
||||
) : (
|
||||
<Check size="12" strokeWidth="3" className="mr-2 -ml-1 inline-block" />
|
||||
)}
|
||||
{t(`${fieldName}_hint_${key}`)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// errors exist, not custom ones, just show them as is
|
||||
if (fieldErrors) {
|
||||
return (
|
||||
<div className="text-gray mt-2 flex items-center text-sm text-red-700">
|
||||
<Icon.FiInfo className="mr-1 h-3 w-3" />
|
||||
<>{fieldErrors.message}</>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!hintErrors) return null;
|
||||
|
||||
// hints passed, no errors exist, proceed to just show hints
|
||||
return (
|
||||
<div className="text-gray mt-2 flex items-center text-sm text-gray-700">
|
||||
<ul className="ml-2">
|
||||
{hintErrors.map((key: string) => {
|
||||
// if field was changed, as no error exist, show checked status and color
|
||||
const dirty = formState.dirtyFields[fieldName];
|
||||
return (
|
||||
<li key={key} className={!!dirty ? "text-green-600" : ""}>
|
||||
{!!dirty ? (
|
||||
<Icon.FiCheck size="12" strokeWidth="3" className="mr-2 -ml-1 inline-block" />
|
||||
) : (
|
||||
<Icon.FiCircle fill="currentColor" size="5" className="mr-2 inline-block" />
|
||||
)}
|
||||
{t(`${fieldName}_hint_${key}`)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+9
-123
@@ -1,22 +1,15 @@
|
||||
import { useId } from "@radix-ui/react-id";
|
||||
import React, { forwardRef, ReactElement, ReactNode, Ref, useCallback, useState } from "react";
|
||||
import { Check, Circle, Info, X, Eye, EyeOff } from "react-feather";
|
||||
import {
|
||||
FieldErrors,
|
||||
FieldValues,
|
||||
FormProvider,
|
||||
SubmitHandler,
|
||||
useFormContext,
|
||||
UseFormReturn,
|
||||
} from "react-hook-form";
|
||||
import { forwardRef, ReactElement, ReactNode, Ref, useCallback, useId, useState } from "react";
|
||||
import React from "react";
|
||||
import { Eye, EyeOff } from "react-feather";
|
||||
import { FieldValues, FormProvider, SubmitHandler, useFormContext, UseFormReturn } from "react-hook-form";
|
||||
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
import { getErrorFromUnknown } from "@calcom/lib/errors";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Skeleton, Tooltip } from "@calcom/ui/v2";
|
||||
import showToast from "@calcom/ui/v2/core/notifications";
|
||||
import { Skeleton, Tooltip, Alert, showToast } from "@calcom/ui/v2";
|
||||
|
||||
import { Alert } from "../../../Alert";
|
||||
import { HintsOrErrors } from "./HintOrErrors";
|
||||
import { Label } from "./Label";
|
||||
|
||||
type InputProps = JSX.IntrinsicElements["input"];
|
||||
|
||||
@@ -33,113 +26,6 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(pro
|
||||
);
|
||||
});
|
||||
|
||||
export function Label(props: JSX.IntrinsicElements["label"]) {
|
||||
return (
|
||||
<label
|
||||
{...props}
|
||||
className={classNames("mb-2 block text-sm font-medium leading-none text-gray-700", props.className)}>
|
||||
{props.children}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
function HintsOrErrors<T extends FieldValues = FieldValues>(props: {
|
||||
hintErrors?: string[];
|
||||
fieldName: string;
|
||||
t: (key: string) => string;
|
||||
}) {
|
||||
const methods = useFormContext() as ReturnType<typeof useFormContext> | null;
|
||||
/* If there's no methods it means we're using these components outside a React Hook Form context */
|
||||
if (!methods) return null;
|
||||
const { formState } = methods;
|
||||
const { hintErrors, fieldName, t } = props;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const fieldErrors: FieldErrors<T> | undefined = formState.errors[fieldName];
|
||||
|
||||
if (!hintErrors && fieldErrors && !fieldErrors.message) {
|
||||
// no hints passed, field errors exist and they are custom ones
|
||||
return (
|
||||
<div className="text-gray mt-2 flex items-center text-sm text-gray-700">
|
||||
<ul className="ml-2">
|
||||
{Object.keys(fieldErrors).map((key: string) => {
|
||||
return (
|
||||
<li key={key} className="text-blue-700">
|
||||
{t(`${fieldName}_hint_${key}`)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (hintErrors && fieldErrors) {
|
||||
// hints passed, field errors exist
|
||||
return (
|
||||
<div className="text-gray mt-2 flex items-center text-sm text-gray-700">
|
||||
<ul className="ml-2">
|
||||
{hintErrors.map((key: string) => {
|
||||
const submitted = formState.isSubmitted;
|
||||
const error = fieldErrors[key] || fieldErrors.message;
|
||||
return (
|
||||
<li
|
||||
key={key}
|
||||
className={error !== undefined ? (submitted ? "text-red-700" : "") : "text-green-600"}>
|
||||
{error !== undefined ? (
|
||||
submitted ? (
|
||||
<X size="12" strokeWidth="3" className="mr-2 -ml-1 inline-block" />
|
||||
) : (
|
||||
<Circle fill="currentColor" size="5" className="mr-2 inline-block" />
|
||||
)
|
||||
) : (
|
||||
<Check size="12" strokeWidth="3" className="mr-2 -ml-1 inline-block" />
|
||||
)}
|
||||
{t(`${fieldName}_hint_${key}`)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// errors exist, not custom ones, just show them as is
|
||||
if (fieldErrors) {
|
||||
return (
|
||||
<div className="text-gray mt-2 flex items-center text-sm text-red-700">
|
||||
<Info className="mr-1 h-3 w-3" />
|
||||
<>{fieldErrors.message}</>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!hintErrors) return null;
|
||||
|
||||
// hints passed, no errors exist, proceed to just show hints
|
||||
return (
|
||||
<div className="text-gray mt-2 flex items-center text-sm text-gray-700">
|
||||
<ul className="ml-2">
|
||||
{hintErrors.map((key: string) => {
|
||||
// if field was changed, as no error exist, show checked status and color
|
||||
const dirty = formState.dirtyFields[fieldName];
|
||||
return (
|
||||
<li key={key} className={!!dirty ? "text-green-600" : ""}>
|
||||
{!!dirty ? (
|
||||
<Check size="12" strokeWidth="3" className="mr-2 -ml-1 inline-block" />
|
||||
) : (
|
||||
<Circle fill="currentColor" size="5" className="mr-2 inline-block" />
|
||||
)}
|
||||
{t(`${fieldName}_hint_${key}`)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function InputLeading(props: JSX.IntrinsicElements["div"]) {
|
||||
return (
|
||||
<span className="inline-flex flex-shrink-0 items-center rounded-l-sm border border-r-0 border-gray-300 bg-gray-50 px-3 text-gray-500 sm:text-sm">
|
||||
@@ -184,7 +70,7 @@ const Addon = ({ isFilled, children, className, error }: AddonProps) => (
|
||||
</div>
|
||||
);
|
||||
|
||||
const InputField = forwardRef<HTMLInputElement, InputFieldProps>(function InputField(props, ref) {
|
||||
export const InputField = forwardRef<HTMLInputElement, InputFieldProps>(function InputField(props, ref) {
|
||||
const id = useId();
|
||||
const { t: _t, isLocaleReady, i18n } = useLocale();
|
||||
const t = props.t || _t;
|
||||
@@ -378,7 +264,7 @@ export const TextAreaField = forwardRef<HTMLTextAreaElement, TextAreaFieldProps>
|
||||
<Alert
|
||||
className="mt-1"
|
||||
severity="error"
|
||||
message={<>{methods.formState.errors[props.name]!.message}</>}
|
||||
message={<>{methods.formState.errors[props.name]?.message}</>}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
import { classNames } from "@calcom/lib";
|
||||
|
||||
export function Label(props: JSX.IntrinsicElements["label"]) {
|
||||
return (
|
||||
<label
|
||||
{...props}
|
||||
className={classNames("mb-2 block text-sm font-medium leading-none text-gray-700", props.className)}>
|
||||
{props.children}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
||||
import { Examples, Example, Note, Title,CustomArgsTable, VariantRow,VariantsTable} from '@calcom/storybook/components'
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
|
||||
import {InputField} from "./Input"
|
||||
|
||||
<Meta title="UI/Form/Input Field" component={InputField} />
|
||||
|
||||
<Title title="Inputs" suffix="Brief" subtitle="Version 2.0 — Last Update: 22 Aug 2022"/>
|
||||
|
||||
## 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="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>
|
||||
@@ -0,0 +1,6 @@
|
||||
export * from "./avatar";
|
||||
export * from "./button";
|
||||
export * from "./buttonGroup";
|
||||
export * from "./badge";
|
||||
export * from "./breadcrumb";
|
||||
export * from "./form";
|
||||
@@ -0,0 +1,13 @@
|
||||
@font-face {
|
||||
font-family: "Cal Sans";
|
||||
src: url("/fonts/cal.ttf");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Inter var";
|
||||
font-weight: 100 900;
|
||||
font-display: swap;
|
||||
font-style: normal;
|
||||
font-named-instance: "Regular";
|
||||
src: url("/fonts/Inter-roman.var.woff2") format("woff2");
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import React from "react";
|
||||
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
|
||||
import Button from "./Button";
|
||||
import { Button } from "../../components/button";
|
||||
|
||||
export type BaseCardProps = {
|
||||
image?: string;
|
||||
|
||||
@@ -3,7 +3,8 @@ import React, { PropsWithChildren, ReactNode } from "react";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
import { Button, DialogClose, DialogContent } from "@calcom/ui/v2";
|
||||
import { Button } from "@calcom/ui/components";
|
||||
import { DialogClose, DialogContent } from "@calcom/ui/v2";
|
||||
|
||||
export type ConfirmationDialogContentProps = {
|
||||
confirmBtn?: ReactNode;
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Icon } from "react-feather";
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
|
||||
import Button from "./Button";
|
||||
import { Button } from "../../components/button";
|
||||
|
||||
export type DialogProps = React.ComponentProps<typeof DialogPrimitive["Root"]> & {
|
||||
name?: string;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { IconType } from "react-icons";
|
||||
|
||||
import { SVGComponent } from "@calcom/types/SVGComponent";
|
||||
|
||||
import Button from "./Button";
|
||||
import { Button } from "../../components/button";
|
||||
|
||||
export default function EmptyScreen({
|
||||
Icon,
|
||||
|
||||
@@ -4,7 +4,7 @@ import Cropper from "react-easy-crop";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Dialog, DialogClose, DialogContent, DialogTrigger } from "@calcom/ui/Dialog";
|
||||
import Button from "@calcom/ui/v2/core/Button";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
|
||||
type ReadAsMethod = "readAsText" | "readAsDataURL" | "readAsArrayBuffer" | "readAsBinaryString";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ReactNode } from "react";
|
||||
|
||||
import Badge, { badgeClassNameByVariant } from "./Badge";
|
||||
import { Badge, badgeClassNameByVariant } from "../../components/badge";
|
||||
|
||||
type Props = {
|
||||
title: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as RadioGroup from "@radix-ui/react-radio-group";
|
||||
import React from "react";
|
||||
|
||||
import { Label } from "./form";
|
||||
import { Label } from "../../components/form";
|
||||
|
||||
type SegmentProps = {
|
||||
label: string;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useAutoAnimate } from "@formkit/auto-animate/react";
|
||||
import React, { ReactNode } from "react";
|
||||
import { ReactNode } from "react";
|
||||
|
||||
import { Label } from "../../components/form";
|
||||
import Switch from "./Switch";
|
||||
import { Label } from "./form";
|
||||
|
||||
type Props = {
|
||||
children?: ReactNode;
|
||||
|
||||
@@ -29,7 +29,7 @@ import Dropdown, {
|
||||
} from "@calcom/ui/Dropdown";
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
import TimezoneChangeDialog from "@calcom/ui/TimezoneChangeDialog";
|
||||
import Button from "@calcom/ui/v2/core/Button";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import showToast from "@calcom/ui/v2/core/notifications";
|
||||
import Tips from "@calcom/ui/v2/modules/tips/Tips";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { FC } from "react";
|
||||
|
||||
import { SVGComponent } from "@calcom/types/SVGComponent";
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
import Button from "@calcom/ui/v2/core/Button";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import {
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
import Button from "@calcom/ui/v2/core/Button";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import Stepper from "@calcom/ui/v2/core/Stepper";
|
||||
|
||||
type DefaultStep = {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { App } from "@calcom/types/App";
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
import { showToast } from "@calcom/ui/v2";
|
||||
import Button from "@calcom/ui/v2/core/Button";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
|
||||
interface AppCardProps {
|
||||
app: App;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Icon } from "react-feather";
|
||||
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
|
||||
import Button from "./Button";
|
||||
import { Button } from "../../components/button";
|
||||
|
||||
const stylesByVariant = {
|
||||
neutral: { background: "bg-gray-100 ", text: "!text-gray-800", hover: "hover:!bg-gray-200" },
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useState } from "react";
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
|
||||
import { Label } from "./fields";
|
||||
import { Label } from "../../../components/form/inputs/Label";
|
||||
|
||||
const boolean = (yesNo: "yes" | "no") => (yesNo === "yes" ? true : yesNo === "no" ? false : undefined);
|
||||
const yesNo = (boolean?: boolean) => (boolean === true ? "yes" : boolean === false ? "no" : undefined);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
export * from "./radio-area";
|
||||
export * from "./fields";
|
||||
export { default as Checkbox } from "./Checkbox";
|
||||
export { default as Checkbox } from "../../../components/form/checkbox/Checkbox";
|
||||
export { default as DatePicker } from "./DatePicker";
|
||||
export { default as Select, SelectWithValidation, SelectField, getReactSelectProps } from "./select";
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import ReactSelect, {
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
|
||||
import { Label } from "../fields";
|
||||
import { Label } from "../../../../components/form/inputs/Label";
|
||||
import {
|
||||
ControlComponent,
|
||||
InputComponent,
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
export * from "./Alert";
|
||||
export { default as Avatar } from "./Avatar";
|
||||
export { default as AvatarGroup } from "./AvatarGroup";
|
||||
export { default as Badge } from "./Badge";
|
||||
export * from "./Breadcrumb";
|
||||
export * from "./Button";
|
||||
export { default as ButtonGroup } from "./ButtonGroup";
|
||||
export * from "./Card";
|
||||
export * from "./Dialog";
|
||||
export { default as Dropdown } from "./Dropdown";
|
||||
@@ -33,4 +27,3 @@ export type { HorizontalTabItemProps } from "./navigation/tabs/HorizontalTabItem
|
||||
export * from "./Portal";
|
||||
export * from "./Segment";
|
||||
export { default as SettingsToggle } from "./SettingsToggle";
|
||||
|
||||
@@ -10,11 +10,11 @@ import { HOSTED_CAL_FEATURES } from "@calcom/lib/constants";
|
||||
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import Button from "@calcom/ui/v2/core/Button";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
|
||||
import ErrorBoundary from "../../../ErrorBoundary";
|
||||
import { Icon } from "../../../Icon";
|
||||
import { Badge } from "../Badge";
|
||||
import { Badge } from "../../../components/badge";
|
||||
import { useMeta } from "../Meta";
|
||||
import Shell from "../Shell";
|
||||
import { VerticalTabItemProps } from "../navigation/tabs/VerticalTabItem";
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Icon } from "@calcom/ui";
|
||||
import Button from "@calcom/ui/v2/core/Button";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
|
||||
interface Props {
|
||||
samlTenantID: string;
|
||||
|
||||
@@ -5,7 +5,8 @@ import { classNames } from "@calcom/lib";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
|
||||
import { Avatar, Select } from "../..";
|
||||
import { Avatar } from "../../../components";
|
||||
import { Select } from "../../core/form";
|
||||
|
||||
type CheckedSelectOption = {
|
||||
avatar: string;
|
||||
|
||||
@@ -15,8 +15,9 @@ import { createEventTypeInput } from "@calcom/prisma/zod/custom/eventtype";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Alert } from "@calcom/ui/Alert";
|
||||
import { Icon } from "@calcom/ui/Icon";
|
||||
import Avatar from "@calcom/ui/v2/core/Avatar";
|
||||
import Button from "@calcom/ui/v2/core/Button";
|
||||
import { Avatar } from "@calcom/ui/components/avatar";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import { Form, TextAreaField, TextField } from "@calcom/ui/components/form";
|
||||
import { Dialog, DialogClose, DialogContent } from "@calcom/ui/v2/core/Dialog";
|
||||
import Dropdown, {
|
||||
DropdownMenuContent,
|
||||
@@ -25,7 +26,6 @@ import Dropdown, {
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from "@calcom/ui/v2/core/Dropdown";
|
||||
import { Form, TextAreaField, TextField } from "@calcom/ui/v2/core/form/fields";
|
||||
import * as RadioArea from "@calcom/ui/v2/core/form/radio-area/RadioAreaGroup";
|
||||
import showToast from "@calcom/ui/v2/core/notifications";
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Icon } from "@calcom/ui";
|
||||
import Badge from "@calcom/ui/v2/core/Badge";
|
||||
import Button from "@calcom/ui/v2/core/Button";
|
||||
import ButtonGroup from "@calcom/ui/v2/core/ButtonGroup";
|
||||
import { Badge } from "@calcom/ui/components/badge";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import { ButtonGroup } from "@calcom/ui/components/buttonGroup";
|
||||
|
||||
type Props = {
|
||||
required?: boolean;
|
||||
@@ -19,7 +19,7 @@ function CustomInputItem({ required, deleteOnClick, editOnClick, type, question
|
||||
<div className="flex flex-col">
|
||||
<div className="flex items-center">
|
||||
<span className="pr-2 text-sm font-semibold leading-none text-black">{question}</span>
|
||||
<Badge variant="default" color="gray">
|
||||
<Badge variant="default" color="gray" withDot={false}>
|
||||
{required ? t("required") : t("optional")}
|
||||
</Badge>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { baseEventTypeSelect } from "@calcom/prisma";
|
||||
import { EventTypeModel } from "@calcom/prisma/zod";
|
||||
import { Icon } from "@calcom/ui";
|
||||
import Badge from "@calcom/ui/v2/core/Badge";
|
||||
import { Badge } from "@calcom/ui/components/badge";
|
||||
|
||||
export type EventTypeDescriptionProps = {
|
||||
eventType: Pick<
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useState } from "react";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Icon } from "@calcom/ui";
|
||||
import { Button, ButtonProps } from "@calcom/ui/v2/core/Button";
|
||||
import { Button, ButtonProps } from "@calcom/ui/components/button";
|
||||
import { Dialog, DialogTrigger, DialogContent } from "@calcom/ui/v2/core/Dialog";
|
||||
import showToast from "@calcom/ui/v2/core/notifications";
|
||||
|
||||
|
||||
Reference in new issue
Block a user