feat: v3 of UI components (#19136)

* ui playground

* add types to ui

* push avatar ignore ts and eslint errors

* feat: V3 UI avatar  (#18997)

* avatar playground

* add overflow-hidden back for loading indicator

* update lock

* feat: v3/badge  (#18999)

* badge intro

* fix text on small badge

* add dark mode warning

* feat: v3/button (#19014)

* TOC

* wip buttons

* shadows

* secondary

* semantic colours

* minimal buttons

* update disabled states

* checkbox

* dropdown v3

* load icons

* fix design sections

* fix icon gap

* fix

* remove client component from rsc

* use peer as avatar

* gif

* fix button gap - dropdown iocn

* support start icon in dropdowns

* add alert demo + v3 component + darken semantic text

* base inputs and text field

* wip input

* input field addon/suffix

* toast page

* wip select

* match designs for input and select rounded

* fix

* fix select isloading transform

* fix multi icons transition rotation

* fix group heading

* range slider demo + range slider

* range slider popover design

* v3 dialog

* fix slider thumb size

* wrap in suspense for useSearchParam difference in next14+

* base of tabs + horizontal tabs

* fix select sizing to match input 36px

* fix dark mode hover on button

* target domState class for light/dark so we work on portal elements

* fix default bg on popover

* lightmode toasts + eleveation token

* empty screen

* intro to split button concept

* mass colour updates

* intro to themes

* remove i18n from label with name

* bouncy buttons

* feat: small select

* nav item dumb component

* full demo

* settings demo

* fix tabs

* fix mt

* fix dropdown feedback from loom

* alert fixes mentioned in loom

* push font-cal

* move to fumadocs

* fix avatar

* colors table

* add typeography

* icon + spacing guide

* add border radius and shadow tables

* fix colours and border radius

* remove prose undline via fumas fork

* fix icon buttons sizes

* button group component

* fix horizontal tabs

* tab fixes

* switches

* pagination component

* show toasts components raw

* sync with airtable

* add use client

* 10px on input again

* 10px in select also

* fix input height

* fix files merge

* fix loading state for icon buttons

* fix button fab

* Enable addon to now overflow to next line in DS

* use cal font for dialog text

* add avatar square variant

* fix select padding and menu size

* fix type errors

* fix type errors

* add switch small size and fix type errors

* fix ref types on input

* update web styles

* remove addonFilled to fix type errors

* push dialog fixes

* fix checkbox display

* remove prose from alert examples

* remove prose from all our component examples

* badge rounded-lg on lg size

* update colors

* force w/h on icon buttons instead of inheriting

* remove border-focus

* remove border-focus from tailwind config

* update tokens to match new colours

* add new border subtle tokens and add to toasts

* fix lg button padding

* fix and drastically improve rtl rests

* multi select use badges

* use badge design for select pills

* fix avatar alignment

* fix tests and remove redudant ones

* fix tests and remove redudant ones

* update atoms globals css

* extract tokens.css

* extract app.css

* force flex for atoms

* add @calcom/ui/css

* revert ui playground styles abstraction

* fix input focus states

* fix focus states for buttons

* feat: v3/app work (#19233)

* globals.css for app + event types listing search

* few app wide NITS

* fix select foucs within styling

* fix formbuilder switch styles

* fix disabled state of nested inputs

* workflow fixes

* webhook form fixes

* i18n on tabs info

* booking filters + tab

* fix filters spacing

* make first item so we get correct border radius if not default

* round radio group in create event types + make button small

* profile page

* update editor br

* button nits in existing places in the app

* fix timezone select and multilist in guest form

* fix text area on public booking page

* size small event types create

* margin on routing filter

* filters improvments

* routing insights fixes

* fix date filter range

* ooo fixes

* fix teams/members bulk actions

* create team UI

* i18n in useTabs instead of in tab component now

* Add event type setup border to availability

* fix bulk actions on org members table

* onboarding fixes

* fix input types with ref stripe comparision

* i18n fixes for platform

* update globals of atoms

* fix form builder firstname/lastname switch + correct footer useage

* fix select

* Revert "add @calcom/ui/css"

This reverts commit 0dd8f9012907a278cfede4a98f289cb0744c9244.

* revert tokens css

* Revert "extract app.css"

This reverts commit 10b998604816ad3310c24b36a02a638dabc5be24.

* linear nits

* workflow dropdown

* fix page theme heading sizes to match cards

* fix stepper for team creation

* adjust margin to FilterSearchField

* fix ooo icon

* fix booker and dark mode due to darkgray 50

* more dark mode fixes

* add size prop

---------

Co-authored-by: Eunjae Lee <[email protected]>
Co-authored-by: Morgan Vernay <[email protected]>

* remove ui-playground

* fix grow missing from merge

* add search icon data-test-id back to search

* fix FormAction style

* fix datatestid for apps and tabs

* change selector for team invitation e2e

* fix use data-testid from item instaed of using names

* rename upper case O

* fix unit tests data-testid

* fix unit tests data-testid

* more data-testid changes

* add data-testid to apps tab

* data-testid to installed appPage

* fix embed tests

* fix filter-popover-trigger

* use text-error and use dataId for locator

* more e2e improvment

* pass in single testId as button is now duplicate

* show field-error instead

* add test to eventtype tabs

* Add css vars to embed too\

* add scrollbar and change dialog overlay colour

* fix type

* use attribute instead of class for tab detection

* await promise

* use new tokens for sprite generation

* add correct testing Ids to e2e instead of button:text

* use testIds for creation of orgs

* Webhook receiver wait for 10 seconds

---------

Co-authored-by: Eunjae Lee <[email protected]>
Co-authored-by: Morgan Vernay <[email protected]>
Co-authored-by: Hariom <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-02-14 16:31:21 -05:00
1 parent 0f67faeef3
commit 5d709cf63c
145 files changed
+17438 -10708

No files matched your search

+134 -24
View File
@@ -40,28 +40,118 @@ export type ButtonProps = ButtonBaseProps &
);
export const buttonClasses = cva(
"whitespace-nowrap inline-flex items-center text-sm font-medium relative rounded-md transition disabled:cursor-not-allowed",
"group whitespace-nowrap inline-flex items-center text-sm font-medium relative rounded-[10px] transition disabled:cursor-not-allowed gap-1",
{
variants: {
variant: {
button: "",
icon: "flex justify-center",
fab: "rounded-full justify-center md:rounded-md radix-state-open:rotate-45 md:radix-state-open:rotate-0 radix-state-open:shadown-none radix-state-open:ring-0 !shadow-none",
fab: "rounded-full justify-center md:rounded-[10px] radix-state-open:rotate-45 md:radix-state-open:rotate-0 radix-state-open:shadown-none radix-state-open:ring-0",
},
color: {
primary:
"bg-brand-default hover:bg-brand-emphasis focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset focus-visible:ring-brand-default text-brand disabled:bg-brand-subtle disabled:text-brand-subtle disabled:opacity-40 disabled:hover:bg-brand-subtle disabled:hover:text-brand-default disabled:hover:opacity-40",
secondary:
"text-emphasis border border-default bg-default hover:bg-muted hover:border-emphasis focus-visible:bg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset focus-visible:ring-empthasis disabled:border-subtle disabled:bg-opacity-30 disabled:text-muted disabled:hover:bg-opacity-30 disabled:hover:text-muted disabled:hover:border-subtle disabled:hover:bg-default",
minimal:
"text-emphasis hover:bg-subtle focus-visible:bg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset focus-visible:ring-empthasis disabled:border-subtle disabled:bg-opacity-30 disabled:text-muted disabled:hover:bg-transparent disabled:hover:text-muted disabled:hover:border-subtle",
destructive:
"border border-default text-emphasis hover:text-red-700 dark:hover:text-red-100 focus-visible:text-red-700 hover:border-red-100 focus-visible:border-red-100 hover:bg-error focus-visible:bg-error focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset focus-visible:ring-red-700 disabled:bg-red-100 disabled:border-red-200 disabled:text-red-700 disabled:hover:border-red-200 disabled:opacity-40",
primary: [
// Base colors
"bg-brand-default",
"text-brand",
// Focus state
"focus-visible:outline-none",
"focus-visible:ring-0",
"focus-visible:shadow-button-solid-brand-focused",
// Border
"border border-brand-default",
// Disabled
"disabled:opacity-30",
// Shadows and effects
"shadow-button-solid-brand-default",
"enabled:active:shadow-button-solid-brand-active",
"enabled:hover:shadow-button-solid-brand-hover",
"transition-shadow",
"transition-transform",
"duration-100",
],
secondary: [
// Base colors and border
"bg-default",
"text-default",
"border",
"border-default",
// Hover state
"enabled:hover:bg-muted",
"enabled:hover:border-emphasis",
"enabled:hover:text-emphasis",
// Disabled
"disabled:opacity-30",
// Focus state
"focus-visible:bg-subtle",
"focus-visible:outline-none",
"focus-visible:ring-0",
"focus-visible:shadow-outline-gray-focused",
// Shadows and effects
"shadow-outline-gray-rested",
"enabled:hover:shadow-outline-gray-hover",
"enabled:active:shadow-outline-gray-active",
"transition-shadow",
"duration-200",
],
minimal: [
// Base color
"text-subtle",
"border border-transparent",
// Hover
"enabled:hover:bg-subtle",
"enabled:hover:text-emphasis",
"enabled:hover:border-subtle hover:border",
// Disabled
"disabled:opacity-30",
// Focus
"focus-visible:bg-subtle",
"focus-visible:outline-none",
"focus-visible:ring-0",
"focus-visible:border-subtle",
"focus-visible:shadow-button-outline-gray-focused",
// Shadows and effects
"enabled:active:shadow-outline-gray-active",
"transition-shadow",
"duration-200",
],
destructive: [
// Base colors and border
"border",
"border-default",
"text-error",
// Hover state
"dark:hover:text-red-100",
"hover:border-semantic-danager-subtle",
"hover:bg-error",
// Focus state
"focus-visible:text-red-700",
"focus-visible:bg-error",
"focus-visible:outline-none",
"focus-visible:ring-0",
"focus-visible:shadow-button-outline-red-focused",
// Disabled state
"disabled:bg-red-100",
"disabled:border-red-200",
"disabled:text-red-700",
"disabled:hover:border-red-200",
"disabled:opacity-30",
// Shadows and effects
"shadow-outline-red-rested",
"enabled:hover:shadow-outline-red-hover",
"enabled:active:shadow-outline-red-active",
"transition-shadow",
"duration-200",
],
},
size: {
sm: "px-3 py-2 leading-4 rounded-md" /** For backwards compatibility */,
base: "h-9 px-4 py-2.5 ",
lg: "h-[36px] px-4 py-2.5 ",
xs: "h-6 p-2 leading-none text-xs rounded-md",
sm: "h-7 px-2 py-1.5 leading-none text-sm" /** For backwards compatibility */,
base: "px-2.5 py-2 text-sm leading-none",
lg: "px-3 py-2.5 ",
},
loading: {
true: "cursor-wait",
@@ -72,7 +162,7 @@ export const buttonClasses = cva(
{
loading: true,
color: "primary",
className: "bg-brand-subtle text-brand-subtle",
className: "opacity-30",
},
// Secondary variants
{
@@ -98,15 +188,25 @@ export const buttonClasses = cva(
size: "base",
className: "min-h-[36px] min-w-[36px] !p-2 hover:border-default",
},
{
variant: "icon",
size: "xs",
className: "h-5 w-5 !p-1 rounded-md",
},
{
variant: "icon",
size: "sm",
className: "h-6 w-6 !p-1",
className: "h-6 w-6 !p-1 rounded-md",
},
{
variant: "icon",
size: "lg",
className: "h-10 w-10 !p-1",
},
{
variant: "fab",
size: "base",
className: "h-14 md:h-9 md:w-auto md:px-4 md:py-2.5",
className: "min-h-14 md:min-h-9 md:min-w-auto md:px-4 md:py-2.5",
},
],
defaultVariants: {
@@ -163,24 +263,31 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
<>
{variant === "fab" ? (
<>
<Icon
name={StartIcon}
className="hidden h-4 w-4 stroke-[1.5px] ltr:-ml-1 ltr:mr-2 rtl:-mr-1 rtl:ml-2 md:inline-flex"
/>
<Icon name={StartIcon} className="hidden h-4 w-4 stroke-[1.5px] md:inline-flex" />
<Icon name="plus" data-testid="plus" className="inline h-6 w-6 md:hidden" />
</>
) : (
<Icon
data-name="start-icon"
name={StartIcon}
className={classNames(
loading ? "invisible" : "visible",
"button-icon group-active:translate-y-[0.5px]",
variant === "icon" && "h-4 w-4",
variant === "button" && "h-4 w-4 stroke-[1.5px] ltr:-ml-1 ltr:mr-2 rtl:-mr-1 rtl:ml-2"
variant === "button" && "h-4 w-4 stroke-[1.5px] "
)}
/>
)}
</>
))}
{variant === "fab" ? <span className="hidden md:inline">{props.children}</span> : props.children}
{props.children &&
(variant === "fab" ? (
<span className={`hidden md:inline ${loading ? "invisible" : "visible "}`}>{props.children}</span>
) : (
<span className={loading ? "invisible" : "visible group-active:translate-y-[0.5px]"}>
{props.children}
</span>
))}
{loading && (
<div className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform">
<svg
@@ -211,9 +318,10 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
<Icon
name={EndIcon}
className={classNames(
"inline-flex",
loading ? "invisible" : "visible",
"group-active:translate-y-[0.5px]",
variant === "icon" && "h-4 w-4",
variant === "button" && "h-4 w-4 stroke-[1.5px] ltr:-mr-1 ltr:ml-2 rtl:-ml-1 rtl:mr-2"
variant === "button" && "h-4 w-4 stroke-[1.5px] "
)}
/>
)}
@@ -266,3 +374,5 @@ const Wrapper = ({
</Tooltip>
);
};
Button.displayName = "Button";
@@ -0,0 +1,76 @@
"use client";
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
import type { ReactNode } from "react";
import { forwardRef } from "react";
import { Icon } from "../icon";
import type { ButtonBaseProps, ButtonProps } from "./Button";
import { Button, buttonClasses } from "./Button";
export interface SplitButtonProps extends ButtonBaseProps {
children?: ReactNode;
dropdown?: {
items: {
label: string;
action: () => void;
icon?: ButtonProps["StartIcon"];
color?: ButtonProps["color"];
}[];
};
}
export const SplitButton = forwardRef<HTMLButtonElement, SplitButtonProps>(function SplitButton(
{ children, dropdown, StartIcon, color = "primary", ...mainButtonProps },
forwardedRef
) {
if (!dropdown) {
return (
<Button ref={forwardedRef} StartIcon={StartIcon} color={color} {...mainButtonProps}>
{children}
</Button>
);
}
return (
<div className="inline-flex">
<Button
{...mainButtonProps}
className="rounded-r-none border-r-0"
StartIcon={StartIcon}
color={color}
ref={forwardedRef}>
{children}
</Button>
<DropdownMenuPrimitive.Root>
<DropdownMenuPrimitive.Trigger asChild>
<button
className={buttonClasses({
variant: "button",
color,
size: mainButtonProps.size,
className: "rounded-l-none px-2",
})}>
<Icon name="chevron-down" className="h-4 w-4" />
</button>
</DropdownMenuPrimitive.Trigger>
<DropdownMenuPrimitive.Portal>
<DropdownMenuPrimitive.Content
align="end"
className="bg-default border-subtle z-50 mt-1 min-w-[180px] overflow-hidden rounded-md border p-1 shadow-md">
{dropdown.items.map((item, index) => (
<DropdownMenuPrimitive.Item
key={index}
className="text-default hover:bg-subtle focus:bg-subtle flex w-full cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm outline-none"
onClick={item.action}>
{item.icon && <Icon name={item.icon} className="h-4 w-4" />}
{item.label}
</DropdownMenuPrimitive.Item>
))}
</DropdownMenuPrimitive.Content>
</DropdownMenuPrimitive.Portal>
</DropdownMenuPrimitive.Root>
</div>
);
});
+1
View File
@@ -1,3 +1,4 @@
export { Button, buttonClasses } from "./Button";
export { SplitButton } from "./SplitButton";
export type { ButtonBaseProps, ButtonProps, ButtonColor } from "./Button";
export { default as LinkIconButton } from "./LinkIconButton";