@meta-1/design 0.0.159

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +412 -0
  2. package/package.json +138 -0
  3. package/src/assets/icons/empty.svg +1 -0
  4. package/src/assets/icons/spin.svg +1 -0
  5. package/src/assets/locales/en-us.ts +74 -0
  6. package/src/assets/locales/zh-cn.ts +74 -0
  7. package/src/assets/locales/zh-tw.ts +74 -0
  8. package/src/assets/style/theme.css +173 -0
  9. package/src/components/icons/Empty.tsx +18 -0
  10. package/src/components/icons/Spin.tsx +16 -0
  11. package/src/components/icons/index.ts +2 -0
  12. package/src/components/ui/alert-dialog.tsx +111 -0
  13. package/src/components/ui/alert.tsx +49 -0
  14. package/src/components/ui/avatar.tsx +32 -0
  15. package/src/components/ui/badge.tsx +36 -0
  16. package/src/components/ui/breadcrumb.tsx +92 -0
  17. package/src/components/ui/button.tsx +52 -0
  18. package/src/components/ui/calendar.tsx +56 -0
  19. package/src/components/ui/card.tsx +56 -0
  20. package/src/components/ui/checkbox.tsx +28 -0
  21. package/src/components/ui/command.tsx +137 -0
  22. package/src/components/ui/dialog.tsx +127 -0
  23. package/src/components/ui/dropdown-menu.tsx +217 -0
  24. package/src/components/ui/form.tsx +138 -0
  25. package/src/components/ui/hover-card.tsx +36 -0
  26. package/src/components/ui/input-otp.tsx +66 -0
  27. package/src/components/ui/input.tsx +21 -0
  28. package/src/components/ui/label.tsx +21 -0
  29. package/src/components/ui/navigation-menu.tsx +142 -0
  30. package/src/components/ui/pagination.tsx +118 -0
  31. package/src/components/ui/popover.tsx +40 -0
  32. package/src/components/ui/progress.tsx +22 -0
  33. package/src/components/ui/radio-group.tsx +31 -0
  34. package/src/components/ui/resizable.tsx +46 -0
  35. package/src/components/ui/scroll-area.tsx +46 -0
  36. package/src/components/ui/select.tsx +158 -0
  37. package/src/components/ui/separator.tsx +26 -0
  38. package/src/components/ui/sheet.tsx +101 -0
  39. package/src/components/ui/skeleton.tsx +7 -0
  40. package/src/components/ui/sonner.tsx +23 -0
  41. package/src/components/ui/switch.tsx +26 -0
  42. package/src/components/ui/table.tsx +73 -0
  43. package/src/components/ui/tabs.tsx +40 -0
  44. package/src/components/ui/textarea.tsx +18 -0
  45. package/src/components/ui/tooltip.tsx +46 -0
  46. package/src/components/uix/action/index.tsx +37 -0
  47. package/src/components/uix/alert/index.tsx +43 -0
  48. package/src/components/uix/alert-dialog/index.tsx +109 -0
  49. package/src/components/uix/avatar/index.tsx +25 -0
  50. package/src/components/uix/breadcrumbs/index.tsx +38 -0
  51. package/src/components/uix/broadcast-channel-context/index.tsx +28 -0
  52. package/src/components/uix/button/index.tsx +29 -0
  53. package/src/components/uix/card/index.tsx +32 -0
  54. package/src/components/uix/checkbox/index.tsx +79 -0
  55. package/src/components/uix/checkbox-group/index.tsx +60 -0
  56. package/src/components/uix/combo-select/index.tsx +364 -0
  57. package/src/components/uix/config-provider/index.tsx +31 -0
  58. package/src/components/uix/data-table/index.tsx +491 -0
  59. package/src/components/uix/data-table/style.css +40 -0
  60. package/src/components/uix/date-picker/index.tsx +88 -0
  61. package/src/components/uix/date-range-picker/index.tsx +71 -0
  62. package/src/components/uix/dialog/index.tsx +70 -0
  63. package/src/components/uix/divider/index.tsx +23 -0
  64. package/src/components/uix/dropdown/index.tsx +117 -0
  65. package/src/components/uix/empty/index.tsx +29 -0
  66. package/src/components/uix/filters/index.tsx +105 -0
  67. package/src/components/uix/form/index.tsx +274 -0
  68. package/src/components/uix/image/index.tsx +13 -0
  69. package/src/components/uix/loading/index.tsx +24 -0
  70. package/src/components/uix/message/index.tsx +21 -0
  71. package/src/components/uix/pagination/index.tsx +180 -0
  72. package/src/components/uix/radio-group/index.tsx +35 -0
  73. package/src/components/uix/result/index.tsx +45 -0
  74. package/src/components/uix/select/index.tsx +93 -0
  75. package/src/components/uix/space/index.tsx +24 -0
  76. package/src/components/uix/spin/index.tsx +12 -0
  77. package/src/components/uix/steps/index.tsx +67 -0
  78. package/src/components/uix/switch/index.tsx +33 -0
  79. package/src/components/uix/tooltip/index.tsx +29 -0
  80. package/src/components/uix/tree/index.tsx +39 -0
  81. package/src/components/uix/tree/style.css +75 -0
  82. package/src/components/uix/tree-select/index.tsx +137 -0
  83. package/src/components/uix/tree-table/action.tsx +24 -0
  84. package/src/components/uix/tree-table/config.ts +2 -0
  85. package/src/components/uix/tree-table/index.tsx +86 -0
  86. package/src/components/uix/tree-table/utils.tsx +63 -0
  87. package/src/components/uix/uploader/index.tsx +237 -0
  88. package/src/components/uix/uploader/type.ts +20 -0
  89. package/src/components/uix/uploader/utils.ts +41 -0
  90. package/src/components/uix/value-formatter/index.tsx +59 -0
  91. package/src/hooks/index.ts +2 -0
  92. package/src/hooks/resize.ts +29 -0
  93. package/src/hooks/use.outside.ts +30 -0
  94. package/src/index.ts +159 -0
  95. package/src/lib/formatters.ts +13 -0
  96. package/src/lib/index.ts +4 -0
  97. package/src/lib/is.ts +6 -0
  98. package/src/lib/react-dom.ts +98 -0
  99. package/src/lib/utils.ts +39 -0
@@ -0,0 +1,46 @@
1
+ import type * as React from "react";
2
+ import { GripVerticalIcon } from "lucide-react";
3
+ import * as ResizablePrimitive from "react-resizable-panels";
4
+
5
+ import { cn } from "@meta-1/design/lib/utils";
6
+
7
+ function ResizablePanelGroup({ className, ...props }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) {
8
+ return (
9
+ <ResizablePrimitive.PanelGroup
10
+ className={cn("flex h-full w-full data-[panel-group-direction=vertical]:flex-col", className)}
11
+ data-slot="resizable-panel-group"
12
+ {...props}
13
+ />
14
+ );
15
+ }
16
+
17
+ function ResizablePanel({ ...props }: React.ComponentProps<typeof ResizablePrimitive.Panel>) {
18
+ return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />;
19
+ }
20
+
21
+ function ResizableHandle({
22
+ withHandle,
23
+ className,
24
+ ...props
25
+ }: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
26
+ withHandle?: boolean;
27
+ }) {
28
+ return (
29
+ <ResizablePrimitive.PanelResizeHandle
30
+ className={cn(
31
+ "after:-translate-x-1/2 data-[panel-group-direction=vertical]:after:-translate-y-1/2 relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",
32
+ className,
33
+ )}
34
+ data-slot="resizable-handle"
35
+ {...props}
36
+ >
37
+ {withHandle && (
38
+ <div className="z-10 flex h-4 w-3 items-center justify-center rounded-xs border bg-border">
39
+ <GripVerticalIcon className="size-2.5" />
40
+ </div>
41
+ )}
42
+ </ResizablePrimitive.PanelResizeHandle>
43
+ );
44
+ }
45
+
46
+ export { ResizablePanelGroup, ResizablePanel, ResizableHandle };
@@ -0,0 +1,46 @@
1
+ import type * as React from "react";
2
+ import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
3
+
4
+ import { cn } from "@meta-1/design/lib/utils";
5
+
6
+ function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
7
+ return (
8
+ <ScrollAreaPrimitive.Root className={cn("relative", className)} data-slot="scroll-area" {...props}>
9
+ <ScrollAreaPrimitive.Viewport
10
+ className="size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] focus-visible:ring-ring/50"
11
+ data-slot="scroll-area-viewport"
12
+ >
13
+ {children}
14
+ </ScrollAreaPrimitive.Viewport>
15
+ <ScrollBar />
16
+ <ScrollAreaPrimitive.Corner />
17
+ </ScrollAreaPrimitive.Root>
18
+ );
19
+ }
20
+
21
+ function ScrollBar({
22
+ className,
23
+ orientation = "vertical",
24
+ ...props
25
+ }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
26
+ return (
27
+ <ScrollAreaPrimitive.ScrollAreaScrollbar
28
+ className={cn(
29
+ "flex touch-none select-none p-px transition-colors",
30
+ orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent",
31
+ orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent",
32
+ className,
33
+ )}
34
+ data-slot="scroll-area-scrollbar"
35
+ orientation={orientation}
36
+ {...props}
37
+ >
38
+ <ScrollAreaPrimitive.ScrollAreaThumb
39
+ className="relative flex-1 rounded-full bg-border"
40
+ data-slot="scroll-area-thumb"
41
+ />
42
+ </ScrollAreaPrimitive.ScrollAreaScrollbar>
43
+ );
44
+ }
45
+
46
+ export { ScrollArea, ScrollBar };
@@ -0,0 +1,158 @@
1
+ import type * as React from "react";
2
+ import * as SelectPrimitive from "@radix-ui/react-select";
3
+ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
4
+
5
+ import { cn } from "@meta-1/design/lib/utils";
6
+
7
+ function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
8
+ return <SelectPrimitive.Root data-slot="select" {...props} />;
9
+ }
10
+
11
+ function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {
12
+ return <SelectPrimitive.Group data-slot="select-group" {...props} />;
13
+ }
14
+
15
+ function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {
16
+ return <SelectPrimitive.Value data-slot="select-value" {...props} />;
17
+ }
18
+
19
+ function SelectTrigger({
20
+ className,
21
+ size = "default",
22
+ children,
23
+ ...props
24
+ }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
25
+ size?: "sm" | "default";
26
+ }) {
27
+ return (
28
+ <SelectPrimitive.Trigger
29
+ className={cn(
30
+ "flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[size=default]:h-9 data-[size=sm]:h-8 data-[placeholder]:text-muted-foreground *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:hover:bg-input/50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
31
+ className,
32
+ )}
33
+ data-size={size}
34
+ data-slot="select-trigger"
35
+ {...props}
36
+ >
37
+ {children}
38
+ <SelectPrimitive.Icon asChild>
39
+ <ChevronDownIcon className="size-4 opacity-50 group-hover:invisible" />
40
+ </SelectPrimitive.Icon>
41
+ </SelectPrimitive.Trigger>
42
+ );
43
+ }
44
+
45
+ function SelectContent({
46
+ className,
47
+ children,
48
+ position = "popper",
49
+ ...props
50
+ }: React.ComponentProps<typeof SelectPrimitive.Content>) {
51
+ return (
52
+ <SelectPrimitive.Portal>
53
+ <SelectPrimitive.Content
54
+ className={cn(
55
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=closed]:animate-out data-[state=open]:animate-in",
56
+ position === "popper" &&
57
+ "data-[side=left]:-translate-x-1 data-[side=top]:-translate-y-1 data-[side=right]:translate-x-1 data-[side=bottom]:translate-y-1",
58
+ className,
59
+ )}
60
+ data-slot="select-content"
61
+ position={position}
62
+ {...props}
63
+ >
64
+ <SelectScrollUpButton />
65
+ <SelectPrimitive.Viewport
66
+ className={cn(
67
+ "p-1",
68
+ position === "popper" &&
69
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1",
70
+ )}
71
+ >
72
+ {children}
73
+ </SelectPrimitive.Viewport>
74
+ <SelectScrollDownButton />
75
+ </SelectPrimitive.Content>
76
+ </SelectPrimitive.Portal>
77
+ );
78
+ }
79
+
80
+ function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
81
+ return (
82
+ <SelectPrimitive.Label
83
+ className={cn("px-2 py-1.5 text-muted-foreground text-xs", className)}
84
+ data-slot="select-label"
85
+ {...props}
86
+ />
87
+ );
88
+ }
89
+
90
+ function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {
91
+ return (
92
+ <SelectPrimitive.Item
93
+ className={cn(
94
+ "relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
95
+ className,
96
+ )}
97
+ data-slot="select-item"
98
+ {...props}
99
+ >
100
+ <span className="absolute right-2 flex size-3.5 items-center justify-center">
101
+ <SelectPrimitive.ItemIndicator>
102
+ <CheckIcon className="size-4" />
103
+ </SelectPrimitive.ItemIndicator>
104
+ </span>
105
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
106
+ </SelectPrimitive.Item>
107
+ );
108
+ }
109
+
110
+ function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
111
+ return (
112
+ <SelectPrimitive.Separator
113
+ className={cn("-mx-1 pointer-events-none my-1 h-px bg-border", className)}
114
+ data-slot="select-separator"
115
+ {...props}
116
+ />
117
+ );
118
+ }
119
+
120
+ function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
121
+ return (
122
+ <SelectPrimitive.ScrollUpButton
123
+ className={cn("flex cursor-default items-center justify-center py-1", className)}
124
+ data-slot="select-scroll-up-button"
125
+ {...props}
126
+ >
127
+ <ChevronUpIcon className="size-4" />
128
+ </SelectPrimitive.ScrollUpButton>
129
+ );
130
+ }
131
+
132
+ function SelectScrollDownButton({
133
+ className,
134
+ ...props
135
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
136
+ return (
137
+ <SelectPrimitive.ScrollDownButton
138
+ className={cn("flex cursor-default items-center justify-center py-1", className)}
139
+ data-slot="select-scroll-down-button"
140
+ {...props}
141
+ >
142
+ <ChevronDownIcon className="size-4" />
143
+ </SelectPrimitive.ScrollDownButton>
144
+ );
145
+ }
146
+
147
+ export {
148
+ Select,
149
+ SelectContent,
150
+ SelectGroup,
151
+ SelectItem,
152
+ SelectLabel,
153
+ SelectScrollDownButton,
154
+ SelectScrollUpButton,
155
+ SelectSeparator,
156
+ SelectTrigger,
157
+ SelectValue,
158
+ };
@@ -0,0 +1,26 @@
1
+ import type * as React from "react";
2
+ import * as SeparatorPrimitive from "@radix-ui/react-separator";
3
+
4
+ import { cn } from "@meta-1/design/lib/utils";
5
+
6
+ function Separator({
7
+ className,
8
+ orientation = "horizontal",
9
+ decorative = true,
10
+ ...props
11
+ }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
12
+ return (
13
+ <SeparatorPrimitive.Root
14
+ className={cn(
15
+ "shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=vertical]:h-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px",
16
+ className,
17
+ )}
18
+ data-slot="separator-root"
19
+ decorative={decorative}
20
+ orientation={orientation}
21
+ {...props}
22
+ />
23
+ );
24
+ }
25
+
26
+ export { Separator };
@@ -0,0 +1,101 @@
1
+ import type * as React from "react";
2
+ import * as SheetPrimitive from "@radix-ui/react-dialog";
3
+ import { XIcon } from "lucide-react";
4
+
5
+ import { cn } from "@meta-1/design/lib/utils";
6
+
7
+ function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
8
+ return <SheetPrimitive.Root data-slot="sheet" {...props} />;
9
+ }
10
+
11
+ function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
12
+ return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
13
+ }
14
+
15
+ function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>) {
16
+ return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
17
+ }
18
+
19
+ function SheetPortal({ ...props }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
20
+ return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
21
+ }
22
+
23
+ function SheetOverlay({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
24
+ return (
25
+ <SheetPrimitive.Overlay
26
+ className={cn(
27
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=open]:animate-in",
28
+ className,
29
+ )}
30
+ data-slot="sheet-overlay"
31
+ {...props}
32
+ />
33
+ );
34
+ }
35
+
36
+ function SheetContent({
37
+ className,
38
+ children,
39
+ side = "right",
40
+ ...props
41
+ }: React.ComponentProps<typeof SheetPrimitive.Content> & {
42
+ side?: "top" | "right" | "bottom" | "left";
43
+ }) {
44
+ return (
45
+ <SheetPortal>
46
+ <SheetOverlay />
47
+ <SheetPrimitive.Content
48
+ className={cn(
49
+ "fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:duration-300 data-[state=open]:duration-500",
50
+ side === "right" &&
51
+ "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
52
+ side === "left" &&
53
+ "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
54
+ side === "top" &&
55
+ "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
56
+ side === "bottom" &&
57
+ "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
58
+ className,
59
+ )}
60
+ data-slot="sheet-content"
61
+ {...props}
62
+ >
63
+ {children}
64
+ <SheetPrimitive.Close className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
65
+ <XIcon className="size-4" />
66
+ <span className="sr-only">Close</span>
67
+ </SheetPrimitive.Close>
68
+ </SheetPrimitive.Content>
69
+ </SheetPortal>
70
+ );
71
+ }
72
+
73
+ function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
74
+ return <div className={cn("flex flex-col gap-1.5 p-4", className)} data-slot="sheet-header" {...props} />;
75
+ }
76
+
77
+ function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
78
+ return <div className={cn("mt-auto flex flex-col gap-2 p-4", className)} data-slot="sheet-footer" {...props} />;
79
+ }
80
+
81
+ function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>) {
82
+ return (
83
+ <SheetPrimitive.Title
84
+ className={cn("font-semibold text-foreground", className)}
85
+ data-slot="sheet-title"
86
+ {...props}
87
+ />
88
+ );
89
+ }
90
+
91
+ function SheetDescription({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Description>) {
92
+ return (
93
+ <SheetPrimitive.Description
94
+ className={cn("text-muted-foreground text-sm", className)}
95
+ data-slot="sheet-description"
96
+ {...props}
97
+ />
98
+ );
99
+ }
100
+
101
+ export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription };
@@ -0,0 +1,7 @@
1
+ import { cn } from "@meta-1/design/lib/utils";
2
+
3
+ function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
4
+ return <div className={cn("animate-pulse rounded-md bg-accent", className)} data-slot="skeleton" {...props} />;
5
+ }
6
+
7
+ export { Skeleton };
@@ -0,0 +1,23 @@
1
+ import { useTheme } from "next-themes";
2
+ import { Toaster as Sonner, type ToasterProps } from "sonner";
3
+
4
+ const Toaster = ({ ...props }: ToasterProps) => {
5
+ const { theme = "system" } = useTheme();
6
+
7
+ return (
8
+ <Sonner
9
+ className="toaster group"
10
+ style={
11
+ {
12
+ "--normal-bg": "var(--popover)",
13
+ "--normal-text": "var(--popover-foreground)",
14
+ "--normal-border": "var(--border)",
15
+ } as React.CSSProperties
16
+ }
17
+ theme={theme as ToasterProps["theme"]}
18
+ {...props}
19
+ />
20
+ );
21
+ };
22
+
23
+ export { Toaster };
@@ -0,0 +1,26 @@
1
+ import type * as React from "react";
2
+ import * as SwitchPrimitive from "@radix-ui/react-switch";
3
+
4
+ import { cn } from "@meta-1/design/lib/utils";
5
+
6
+ function Switch({ className, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root>) {
7
+ return (
8
+ <SwitchPrimitive.Root
9
+ className={cn(
10
+ "peer inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs outline-none transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",
11
+ className,
12
+ )}
13
+ data-slot="switch"
14
+ {...props}
15
+ >
16
+ <SwitchPrimitive.Thumb
17
+ className={cn(
18
+ "pointer-events-none block size-4 rounded-full bg-background ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground",
19
+ )}
20
+ data-slot="switch-thumb"
21
+ />
22
+ </SwitchPrimitive.Root>
23
+ );
24
+ }
25
+
26
+ export { Switch };
@@ -0,0 +1,73 @@
1
+ import type * as React from "react";
2
+
3
+ import { cn } from "@meta-1/design/lib/utils";
4
+
5
+ function Table({ className, ...props }: React.ComponentProps<"table">) {
6
+ return (
7
+ <div className="relative w-full overflow-x-auto" data-slot="table-container">
8
+ <table className={cn("w-full caption-bottom text-sm", className)} data-slot="table" {...props} />
9
+ </div>
10
+ );
11
+ }
12
+
13
+ function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
14
+ return <thead className={cn("[&_tr]:border-b", className)} data-slot="table-header" {...props} />;
15
+ }
16
+
17
+ function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
18
+ return <tbody className={cn("[&_tr:last-child]:border-0", className)} data-slot="table-body" {...props} />;
19
+ }
20
+
21
+ function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
22
+ return (
23
+ <tfoot
24
+ className={cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className)}
25
+ data-slot="table-footer"
26
+ {...props}
27
+ />
28
+ );
29
+ }
30
+
31
+ function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
32
+ return (
33
+ <tr
34
+ className={cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className)}
35
+ data-slot="table-row"
36
+ {...props}
37
+ />
38
+ );
39
+ }
40
+
41
+ function TableHead({ className, ...props }: React.ComponentProps<"th">) {
42
+ return (
43
+ <th
44
+ className={cn(
45
+ "h-10 whitespace-nowrap px-2 text-left align-middle font-medium text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
46
+ className,
47
+ )}
48
+ data-slot="table-head"
49
+ {...props}
50
+ />
51
+ );
52
+ }
53
+
54
+ function TableCell({ className, ...props }: React.ComponentProps<"td">) {
55
+ return (
56
+ <td
57
+ className={cn(
58
+ "whitespace-nowrap p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
59
+ className,
60
+ )}
61
+ data-slot="table-cell"
62
+ {...props}
63
+ />
64
+ );
65
+ }
66
+
67
+ function TableCaption({ className, ...props }: React.ComponentProps<"caption">) {
68
+ return (
69
+ <caption className={cn("mt-4 text-muted-foreground text-sm", className)} data-slot="table-caption" {...props} />
70
+ );
71
+ }
72
+
73
+ export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
@@ -0,0 +1,40 @@
1
+ import type * as React from "react";
2
+ import * as TabsPrimitive from "@radix-ui/react-tabs";
3
+
4
+ import { cn } from "@meta-1/design/lib/utils";
5
+
6
+ function Tabs({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>) {
7
+ return <TabsPrimitive.Root className={cn("flex flex-col gap-2", className)} data-slot="tabs" {...props} />;
8
+ }
9
+
10
+ function TabsList({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.List>) {
11
+ return (
12
+ <TabsPrimitive.List
13
+ className={cn(
14
+ "inline-flex h-9 w-fit items-center justify-center rounded-lg bg-muted p-[3px] text-muted-foreground",
15
+ className,
16
+ )}
17
+ data-slot="tabs-list"
18
+ {...props}
19
+ />
20
+ );
21
+ }
22
+
23
+ function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
24
+ return (
25
+ <TabsPrimitive.Trigger
26
+ className={cn(
27
+ "inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-2 py-1 font-medium text-foreground text-sm transition-[color,box-shadow] focus-visible:border-ring focus-visible:outline-1 focus-visible:outline-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:shadow-sm dark:text-muted-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
28
+ className,
29
+ )}
30
+ data-slot="tabs-trigger"
31
+ {...props}
32
+ />
33
+ );
34
+ }
35
+
36
+ function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>) {
37
+ return <TabsPrimitive.Content className={cn("flex-1 outline-none", className)} data-slot="tabs-content" {...props} />;
38
+ }
39
+
40
+ export { Tabs, TabsList, TabsTrigger, TabsContent };
@@ -0,0 +1,18 @@
1
+ import type * as React from "react";
2
+
3
+ import { cn } from "@meta-1/design/lib/utils";
4
+
5
+ function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
6
+ return (
7
+ <textarea
8
+ className={cn(
9
+ "field-sizing-content flex min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
10
+ className,
11
+ )}
12
+ data-slot="textarea"
13
+ {...props}
14
+ />
15
+ );
16
+ }
17
+
18
+ export { Textarea };
@@ -0,0 +1,46 @@
1
+ import type * as React from "react";
2
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
3
+
4
+ import { cn } from "@meta-1/design/lib/utils";
5
+
6
+ function TooltipProvider({ delayDuration = 0, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
7
+ return <TooltipPrimitive.Provider data-slot="tooltip-provider" delayDuration={delayDuration} {...props} />;
8
+ }
9
+
10
+ function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
11
+ return (
12
+ <TooltipProvider>
13
+ <TooltipPrimitive.Root data-slot="tooltip" {...props} />
14
+ </TooltipProvider>
15
+ );
16
+ }
17
+
18
+ function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
19
+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
20
+ }
21
+
22
+ function TooltipContent({
23
+ className,
24
+ sideOffset = 0,
25
+ children,
26
+ ...props
27
+ }: React.ComponentProps<typeof TooltipPrimitive.Content>) {
28
+ return (
29
+ <TooltipPrimitive.Portal>
30
+ <TooltipPrimitive.Content
31
+ className={cn(
32
+ "fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in text-balance rounded-md bg-primary px-3 py-1.5 text-primary-foreground text-xs data-[state=closed]:animate-out",
33
+ className,
34
+ )}
35
+ data-slot="tooltip-content"
36
+ sideOffset={sideOffset}
37
+ {...props}
38
+ >
39
+ {children}
40
+ <TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-primary fill-primary" />
41
+ </TooltipPrimitive.Content>
42
+ </TooltipPrimitive.Portal>
43
+ );
44
+ }
45
+
46
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -0,0 +1,37 @@
1
+ import type { FC, HTMLAttributes, PropsWithChildren } from "react";
2
+ import classNames from "classnames";
3
+
4
+ export type ActionProps = PropsWithChildren<HTMLAttributes<HTMLButtonElement>> & {
5
+ theme?: "dark" | "light";
6
+ active?: boolean;
7
+ disabled?: boolean;
8
+ elType?: "button" | "span";
9
+ };
10
+
11
+ export const Action: FC<ActionProps> = (props) => {
12
+ const { theme = "dark", active = false, disabled = false, elType = "button", ...rest } = props;
13
+
14
+ const elProps = {
15
+ ...rest,
16
+ disabled,
17
+ className: classNames(
18
+ "p-2 flex justify-center items-center rounded-sm border border-transparent border-solid focus-visible:outline-none",
19
+ theme === "light" && "hover:bg-white/20",
20
+ theme === "light" && "focus:bg-white/30 focus:border-white/30",
21
+ theme === "light" && "active:bg-white/30 active:border-white/30",
22
+ theme === "dark" && "action-effect action-effect-active",
23
+ active && theme === "light" && "bg-white/20",
24
+ active && theme === "dark" && "action-active",
25
+ disabled && "action-effect-disabled",
26
+ props.className,
27
+ ),
28
+ };
29
+
30
+ return elType === "button" ? (
31
+ <button {...elProps} type="button">
32
+ {props.children}
33
+ </button>
34
+ ) : (
35
+ <span {...elProps}>{props.children}</span>
36
+ );
37
+ };