feat: Org user table - bulk actions (#10504)

Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: Hariom Balhara <[email protected]>
Co-authored-by: Leo Giovanetti <[email protected]>
Co-authored-by: Alex van Andel <[email protected]>
Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: zomars <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: Keith Williams <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Syed Ali Shahbaz <[email protected]>
Co-authored-by: gitstart-calcom <[email protected]>
Co-authored-by: Shivam Kalra <[email protected]>
Co-authored-by: cherish2003 <[email protected]>
Co-authored-by: sean-brydon <[email protected]>
Co-authored-by: rkreddy99 <[email protected]>
Co-authored-by: varun thummar <Varun>
Co-authored-by: Crowdin Bot <[email protected]>
Co-authored-by: Pradumn Kumar <[email protected]>
Co-authored-by: Richard Poelderl <[email protected]>
Co-authored-by: mohammed hussam <[email protected]>
Co-authored-by: Carina Wollendorfer <[email protected]>
Co-authored-by: Anik Dhabal Babu <[email protected]>
Co-authored-by: nicktrn <[email protected]>
Co-authored-by: sydwardrae <[email protected]>
Co-authored-by: Janakiram Yellapu <[email protected]>
Co-authored-by: GitStart-Cal.com <[email protected]>
Co-authored-by: sajanlamsal <[email protected]>
Co-authored-by: Cherish <[email protected]>
Co-authored-by: Danila <[email protected]>
Co-authored-by: Neel Patel <[email protected]>
Co-authored-by: Rama Krishna Reddy <[email protected]>
Co-authored-by: Varun Thummar <[email protected]>
Co-authored-by: Bhargav <[email protected]>
Co-authored-by: Pratik Kumar <[email protected]>
Co-authored-by: Ritesh Patil <[email protected]>
This commit is contained in:
47 files changed
+1282 -336

No files matched your search

+2 -2
View File
@@ -12,7 +12,7 @@ import { Tooltip } from "../tooltip";
export type AvatarProps = {
className?: string;
size: "xxs" | "xs" | "xsm" | "sm" | "md" | "mdLg" | "lg" | "xl";
size?: "xxs" | "xs" | "xsm" | "sm" | "md" | "mdLg" | "lg" | "xl";
imageSrc?: Maybe<string>;
title?: string;
alt: string;
@@ -35,7 +35,7 @@ const sizesPropsBySize = {
} as const;
export function Avatar(props: AvatarProps) {
const { imageSrc, gravatarFallbackMd5, size, alt, title, href } = props;
const { imageSrc, gravatarFallbackMd5, size = "md", alt, title, href } = props;
const rootClass = classNames("aspect-square rounded-full", sizesPropsBySize[size]);
let avatar = (
<AvatarPrimitive.Root
+1 -1
View File
@@ -95,7 +95,7 @@ const CommandSeparator = React.forwardRef<
>(({ className, ...props }, ref) => (
<CommandPrimitive.Separator
ref={ref}
className={classNames("bg-border -mx-1 h-px", className)}
className={classNames("bg-subtle -mx-1 mb-2 h-px", className)}
{...props}
/>
));
@@ -1,16 +1,25 @@
import type { Table } from "@tanstack/react-table";
import { Fragment } from "react";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import { Button } from "../button";
export type ActionItem<TData> =
| {
type: "action";
label: string;
onClick: () => void;
icon?: SVGComponent;
}
| {
type: "render";
render: (table: Table<TData>) => React.ReactNode;
};
interface DataTableSelectionBarProps<TData> {
table: Table<TData>;
actions?: {
label: string;
onClick: () => void;
icon?: SVGComponent;
}[];
actions?: ActionItem<TData>[];
}
export function DataTableSelectionBar<TData>({ table, actions }: DataTableSelectionBarProps<TData>) {
@@ -21,10 +30,16 @@ export function DataTableSelectionBar<TData>({ table, actions }: DataTableSelect
return (
<div className="bg-brand-default text-brand item-center absolute bottom-0 left-1/2 flex -translate-x-1/2 gap-4 rounded-lg p-2">
<div className="text-brand-subtle my-auto px-2">{numberOfSelectedRows} selected</div>
{actions?.map((action) => (
<Button aria-label={action.label} onClick={action.onClick} StartIcon={action.icon} key={action.label}>
{action.label}
</Button>
{actions?.map((action, index) => (
<Fragment key={index}>
{action.type === "action" ? (
<Button aria-label={action.label} onClick={action.onClick} StartIcon={action.icon}>
{action.label}
</Button>
) : action.type === "render" ? (
action.render(table)
) : null}
</Fragment>
))}
</div>
);
+2 -7
View File
@@ -17,9 +17,8 @@ import {
import { useState } from "react";
import { useVirtual } from "react-virtual";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../table/TableNew";
import type { ActionItem } from "./DataTableSelectionBar";
import { DataTableSelectionBar } from "./DataTableSelectionBar";
import type { FilterableItems } from "./DataTableToolbar";
import { DataTableToolbar } from "./DataTableToolbar";
@@ -30,11 +29,7 @@ export interface DataTableProps<TData, TValue> {
data: TData[];
searchKey?: string;
filterableItems?: FilterableItems;
selectionOptions?: {
label: string;
onClick: () => void;
icon?: SVGComponent;
}[];
selectionOptions?: ActionItem<TData>[];
tableCTA?: React.ReactNode;
isLoading?: boolean;
onScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
+6 -6
View File
@@ -52,10 +52,10 @@ const sheetVariants = cva(
{
variants: {
position: {
top: "animate-in slide-in-from-top w-full duration-300",
bottom: "animate-in slide-in-from-bottom w-full duration-300",
left: "animate-in slide-in-from-left h-full duration-300",
right: "animate-in slide-in-from-right h-full duration-300",
top: "animate-in slide-in-from-top w-full duration-200",
bottom: "animate-in slide-in-from-bottom w-full duration-200",
left: "animate-in slide-in-from-left h-full duration-200",
right: "animate-in slide-in-from-right h-full duration-200",
},
size: {
content: "",
@@ -105,12 +105,12 @@ const sheetVariants = cva(
{
position: ["right", "left"],
size: "default",
class: "w-1/3 h-[calc(100vh-2rem)]",
class: "w-1/3 max-h-[calc(100vh-2rem)]",
},
{
position: ["right", "left"],
size: "sm",
class: "w-1/4 h-[calc(100vh-2rem)]",
class: "w-1/4 max-h-[calc(100vh-2rem)]",
},
{
position: ["right", "left"],
+23
View File
@@ -138,3 +138,26 @@ export { useCalcomTheme } from "./styles/useCalcomTheme";
export { ScrollableArea } from "./components/scrollable/ScrollableArea";
export { WizardLayout } from "./layouts/WizardLayout";
export { DataTable } from "./components/data-table";
export {
Sheet,
SheetClose,
SheetContent,
SheetDescription,
SheetFooter,
SheetHeader,
SheetTitle,
SheetTrigger,
} from "./components/sheet/sheet";
export {
Command,
CommandDialog,
CommandEmpty,
CommandGroup,
CommandItem,
CommandList,
CommandInput,
CommandSeparator,
CommandShortcut,
} from "./components/command";
export { Popover, PopoverContent, PopoverTrigger } from "./components/popover";