@trycompai/design-system 1.0.0 → 1.0.2

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 (101) hide show
  1. package/package.json +6 -3
  2. package/src/components/atoms/badge.tsx +49 -0
  3. package/src/components/{ui → atoms}/button.tsx +6 -1
  4. package/src/components/{ui → atoms}/checkbox.tsx +3 -3
  5. package/src/components/{ui → atoms}/heading.tsx +6 -6
  6. package/src/components/atoms/index.ts +21 -0
  7. package/src/components/atoms/kbd.tsx +21 -0
  8. package/src/components/atoms/logo.tsx +52 -0
  9. package/src/components/{ui → atoms}/slider.tsx +4 -4
  10. package/src/components/{ui → atoms}/spinner.tsx +3 -3
  11. package/src/components/atoms/stack.tsx +97 -0
  12. package/src/components/{ui → atoms}/switch.tsx +1 -1
  13. package/src/components/{ui → atoms}/text.tsx +5 -1
  14. package/src/components/{ui → atoms}/textarea.tsx +8 -2
  15. package/src/components/{ui → atoms}/toggle.tsx +3 -6
  16. package/src/components/{ui → molecules}/accordion.tsx +3 -3
  17. package/src/components/molecules/ai-chat.tsx +217 -0
  18. package/src/components/{ui → molecules}/alert.tsx +5 -5
  19. package/src/components/{ui → molecules}/breadcrumb.tsx +9 -8
  20. package/src/components/{ui → molecules}/card.tsx +24 -5
  21. package/src/components/molecules/command-search.tsx +147 -0
  22. package/src/components/molecules/empty.tsx +82 -0
  23. package/src/components/{ui → molecules}/field.tsx +16 -37
  24. package/src/components/{ui → molecules}/hover-card.tsx +2 -8
  25. package/src/components/molecules/index.ts +29 -0
  26. package/src/components/{ui → molecules}/input-group.tsx +1 -1
  27. package/src/components/molecules/input-otp.tsx +70 -0
  28. package/src/components/{ui → molecules}/item.tsx +18 -36
  29. package/src/components/molecules/page-header.tsx +80 -0
  30. package/src/components/{ui → molecules}/pagination.tsx +14 -23
  31. package/src/components/{ui → molecules}/popover.tsx +4 -2
  32. package/src/components/molecules/radio-group.tsx +33 -0
  33. package/src/components/{ui → molecules}/scroll-area.tsx +8 -11
  34. package/src/components/{ui → molecules}/section.tsx +3 -3
  35. package/src/components/{ui → molecules}/select.tsx +22 -10
  36. package/src/components/molecules/settings.tsx +169 -0
  37. package/src/components/{ui → molecules}/table.tsx +16 -3
  38. package/src/components/molecules/tabs.tsx +70 -0
  39. package/src/components/molecules/theme-switcher.tsx +176 -0
  40. package/src/components/{ui → molecules}/toggle-group.tsx +1 -1
  41. package/src/components/organisms/alert-dialog.tsx +135 -0
  42. package/src/components/organisms/app-shell.tsx +822 -0
  43. package/src/components/{ui → organisms}/calendar.tsx +6 -7
  44. package/src/components/{ui → organisms}/carousel.tsx +9 -11
  45. package/src/components/{ui → organisms}/chart.tsx +9 -24
  46. package/src/components/{ui → organisms}/combobox.tsx +7 -7
  47. package/src/components/{ui → organisms}/command.tsx +3 -3
  48. package/src/components/{ui → organisms}/context-menu.tsx +23 -53
  49. package/src/components/{ui → organisms}/dialog.tsx +3 -3
  50. package/src/components/{ui → organisms}/dropdown-menu.tsx +8 -6
  51. package/src/components/organisms/index.ts +17 -0
  52. package/src/components/{ui → organisms}/menubar.tsx +3 -3
  53. package/src/components/organisms/navigation-menu.tsx +137 -0
  54. package/src/components/organisms/page-layout.tsx +95 -0
  55. package/src/components/{ui → organisms}/sheet.tsx +7 -7
  56. package/src/components/{ui → organisms}/sidebar.tsx +61 -86
  57. package/src/components/organisms/sonner.tsx +41 -0
  58. package/src/components/ui/index.ts +3 -61
  59. package/src/fonts/TWKLausanne/TWKLausanne-300-Italic.woff +0 -0
  60. package/src/fonts/TWKLausanne/TWKLausanne-300-Italic.woff2 +0 -0
  61. package/src/fonts/TWKLausanne/TWKLausanne-300.woff +0 -0
  62. package/src/fonts/TWKLausanne/TWKLausanne-300.woff2 +0 -0
  63. package/src/fonts/TWKLausanne/TWKLausanne-350-Italic.woff +0 -0
  64. package/src/fonts/TWKLausanne/TWKLausanne-350-Italic.woff2 +0 -0
  65. package/src/fonts/TWKLausanne/TWKLausanne-350.woff +0 -0
  66. package/src/fonts/TWKLausanne/TWKLausanne-350.woff2 +0 -0
  67. package/src/fonts/TWKLausanne/TWKLausanne-400-Italic.woff +0 -0
  68. package/src/fonts/TWKLausanne/TWKLausanne-400-Italic.woff2 +0 -0
  69. package/src/fonts/TWKLausanne/TWKLausanne-400.woff +0 -0
  70. package/src/fonts/TWKLausanne/TWKLausanne-400.woff2 +0 -0
  71. package/src/fonts/TWKLausanne/TWKLausanne-700-Italic.woff +0 -0
  72. package/src/fonts/TWKLausanne/TWKLausanne-700-Italic.woff2 +0 -0
  73. package/src/fonts/TWKLausanne/TWKLausanne-700.woff +0 -0
  74. package/src/fonts/TWKLausanne/TWKLausanne-700.woff2 +0 -0
  75. package/src/styles/globals.css +167 -23
  76. package/src/components/ui/alert-dialog.tsx +0 -161
  77. package/src/components/ui/badge.tsx +0 -48
  78. package/src/components/ui/empty.tsx +0 -94
  79. package/src/components/ui/input-otp.tsx +0 -84
  80. package/src/components/ui/kbd.tsx +0 -26
  81. package/src/components/ui/navigation-menu.tsx +0 -147
  82. package/src/components/ui/page-header.tsx +0 -51
  83. package/src/components/ui/page-layout.tsx +0 -65
  84. package/src/components/ui/radio-group.tsx +0 -37
  85. package/src/components/ui/sonner.tsx +0 -43
  86. package/src/components/ui/stack.tsx +0 -72
  87. package/src/components/ui/tabs.tsx +0 -69
  88. /package/src/components/{ui → atoms}/aspect-ratio.tsx +0 -0
  89. /package/src/components/{ui → atoms}/avatar.tsx +0 -0
  90. /package/src/components/{ui → atoms}/container.tsx +0 -0
  91. /package/src/components/{ui → atoms}/input.tsx +0 -0
  92. /package/src/components/{ui → atoms}/label.tsx +0 -0
  93. /package/src/components/{ui → atoms}/progress.tsx +0 -0
  94. /package/src/components/{ui → atoms}/separator.tsx +0 -0
  95. /package/src/components/{ui → atoms}/skeleton.tsx +0 -0
  96. /package/src/components/{ui → molecules}/button-group.tsx +0 -0
  97. /package/src/components/{ui → molecules}/collapsible.tsx +0 -0
  98. /package/src/components/{ui → molecules}/grid.tsx +0 -0
  99. /package/src/components/{ui → molecules}/resizable.tsx +0 -0
  100. /package/src/components/{ui → molecules}/tooltip.tsx +0 -0
  101. /package/src/components/{ui → organisms}/drawer.tsx +0 -0
@@ -0,0 +1,137 @@
1
+ import { NavigationMenu as NavigationMenuPrimitive } from '@base-ui/react/navigation-menu';
2
+ import { cva } from 'class-variance-authority';
3
+
4
+ import { ChevronDown } from '@carbon/icons-react';
5
+ import { cn } from '../../../lib/utils';
6
+
7
+ function NavigationMenu({
8
+ children,
9
+ ...props
10
+ }: Omit<NavigationMenuPrimitive.Root.Props, 'className'>) {
11
+ return (
12
+ <NavigationMenuPrimitive.Root
13
+ data-slot="navigation-menu"
14
+ className="max-w-max group/navigation-menu relative flex max-w-max flex-1 items-center justify-center"
15
+ {...props}
16
+ >
17
+ {children}
18
+ <NavigationMenuPositioner />
19
+ </NavigationMenuPrimitive.Root>
20
+ );
21
+ }
22
+
23
+ function NavigationMenuList({ ...props }: Omit<NavigationMenuPrimitive.List.Props, 'className'>) {
24
+ return (
25
+ <NavigationMenuPrimitive.List
26
+ data-slot="navigation-menu-list"
27
+ className="gap-0 group flex flex-1 list-none items-center justify-center"
28
+ {...props}
29
+ />
30
+ );
31
+ }
32
+
33
+ function NavigationMenuItem({ ...props }: Omit<NavigationMenuPrimitive.Item.Props, 'className'>) {
34
+ return (
35
+ <NavigationMenuPrimitive.Item
36
+ data-slot="navigation-menu-item"
37
+ className="relative"
38
+ {...props}
39
+ />
40
+ );
41
+ }
42
+
43
+ const navigationMenuTriggerStyle = cva(
44
+ 'bg-background hover:bg-muted focus:bg-muted data-open:hover:bg-muted data-open:focus:bg-muted data-open:bg-muted/50 focus-visible:ring-ring/50 data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted rounded-md px-4 py-2 text-sm font-medium transition-all focus-visible:ring-[3px] focus-visible:outline-1 disabled:opacity-50 group/navigation-menu-trigger inline-flex h-9 w-max items-center justify-center disabled:pointer-events-none outline-none',
45
+ );
46
+
47
+ function NavigationMenuTrigger({
48
+ children,
49
+ ...props
50
+ }: Omit<NavigationMenuPrimitive.Trigger.Props, 'className'>) {
51
+ return (
52
+ <NavigationMenuPrimitive.Trigger
53
+ data-slot="navigation-menu-trigger"
54
+ className={cn(navigationMenuTriggerStyle(), 'group')}
55
+ {...props}
56
+ >
57
+ {children}{' '}
58
+ <ChevronDown
59
+ className="relative top-[1px] ml-1 size-3 transition duration-300 group-data-open/navigation-menu-trigger:rotate-180 group-data-popup-open/navigation-menu-trigger:rotate-180"
60
+ aria-hidden="true"
61
+ />
62
+ </NavigationMenuPrimitive.Trigger>
63
+ );
64
+ }
65
+
66
+ function NavigationMenuContent({
67
+ ...props
68
+ }: Omit<NavigationMenuPrimitive.Content.Props, 'className'>) {
69
+ return (
70
+ <NavigationMenuPrimitive.Content
71
+ data-slot="navigation-menu-content"
72
+ className="data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-open:animate-in group-data-[viewport=false]/navigation-menu:data-closed:animate-out group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-open:fade-in-0 group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0 group-data-[viewport=false]/navigation-menu:ring-foreground/10 p-2 pr-2.5 ease-[cubic-bezier(0.22,1,0.36,1)] group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:ring-1 group-data-[viewport=false]/navigation-menu:duration-300 h-full w-auto **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none"
73
+ {...props}
74
+ />
75
+ );
76
+ }
77
+
78
+ function NavigationMenuPositioner({
79
+ side = 'bottom',
80
+ sideOffset = 8,
81
+ align = 'start',
82
+ alignOffset = 0,
83
+ ...props
84
+ }: Omit<NavigationMenuPrimitive.Positioner.Props, 'className'>) {
85
+ return (
86
+ <NavigationMenuPrimitive.Portal>
87
+ <NavigationMenuPrimitive.Positioner
88
+ side={side}
89
+ sideOffset={sideOffset}
90
+ align={align}
91
+ alignOffset={alignOffset}
92
+ className="transition-[top,left,right,bottom] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] data-[side=bottom]:before:top-[-10px] data-[side=bottom]:before:right-0 data-[side=bottom]:before:left-0 isolate z-50 h-[var(--positioner-height)] w-[var(--positioner-width)] max-w-[var(--available-width)] data-[instant]:transition-none"
93
+ {...props}
94
+ >
95
+ <NavigationMenuPrimitive.Popup className="bg-popover text-popover-foreground ring-foreground/10 rounded-lg shadow ring-1 transition-all ease-[cubic-bezier(0.22,1,0.36,1)] outline-none data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[ending-style]:duration-150 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 xs:w-(--popup-width) relative h-(--popup-height) w-(--popup-width) origin-(--transform-origin)">
96
+ <NavigationMenuPrimitive.Viewport className="relative size-full overflow-hidden" />
97
+ </NavigationMenuPrimitive.Popup>
98
+ </NavigationMenuPrimitive.Positioner>
99
+ </NavigationMenuPrimitive.Portal>
100
+ );
101
+ }
102
+
103
+ function NavigationMenuLink({ ...props }: Omit<NavigationMenuPrimitive.Link.Props, 'className'>) {
104
+ return (
105
+ <NavigationMenuPrimitive.Link
106
+ data-slot="navigation-menu-link"
107
+ className="data-[active=true]:focus:bg-muted data-[active=true]:hover:bg-muted data-[active=true]:bg-muted/50 focus-visible:ring-ring/50 hover:bg-muted focus:bg-muted flex items-center gap-1.5 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4"
108
+ {...props}
109
+ />
110
+ );
111
+ }
112
+
113
+ function NavigationMenuIndicator({
114
+ ...props
115
+ }: Omit<NavigationMenuPrimitive.Icon.Props, 'className'>) {
116
+ return (
117
+ <NavigationMenuPrimitive.Icon
118
+ data-slot="navigation-menu-indicator"
119
+ className="data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden"
120
+ {...props}
121
+ >
122
+ <div className="bg-border rounded-tl-sm shadow-md relative top-[60%] h-2 w-2 rotate-45" />
123
+ </NavigationMenuPrimitive.Icon>
124
+ );
125
+ }
126
+
127
+ export {
128
+ NavigationMenu,
129
+ NavigationMenuContent,
130
+ NavigationMenuIndicator,
131
+ NavigationMenuItem,
132
+ NavigationMenuLink,
133
+ NavigationMenuList,
134
+ NavigationMenuPositioner,
135
+ NavigationMenuTrigger,
136
+ navigationMenuTriggerStyle,
137
+ };
@@ -0,0 +1,95 @@
1
+ import { cva, type VariantProps } from 'class-variance-authority';
2
+ import * as React from 'react';
3
+
4
+ import { cn } from '../../../lib/utils';
5
+ import { Stack } from '../atoms/stack';
6
+
7
+ const pageLayoutVariants = cva('min-h-dvh bg-background text-foreground', {
8
+ variants: {
9
+ variant: {
10
+ default: 'flex flex-col',
11
+ center: 'flex items-center justify-center',
12
+ },
13
+ padding: {
14
+ none: '',
15
+ sm: 'px-4 py-6',
16
+ default: 'px-4 py-10 sm:px-6 lg:px-8',
17
+ lg: 'px-6 py-12 sm:px-8 lg:px-12',
18
+ },
19
+ },
20
+ defaultVariants: {
21
+ variant: 'default',
22
+ padding: 'default',
23
+ },
24
+ });
25
+
26
+ const containerVariants = cva('mx-auto w-full', {
27
+ variants: {
28
+ maxWidth: {
29
+ sm: 'max-w-screen-sm', // 640px
30
+ md: 'max-w-screen-md', // 768px
31
+ lg: 'max-w-screen-lg', // 1024px
32
+ xl: 'max-w-[1200px]',
33
+ '2xl': 'max-w-[1400px]',
34
+ },
35
+ },
36
+ defaultVariants: {
37
+ maxWidth: 'xl',
38
+ },
39
+ });
40
+
41
+ interface PageLayoutProps
42
+ extends Omit<React.ComponentProps<'div'>, 'className' | 'children'>,
43
+ VariantProps<typeof pageLayoutVariants> {
44
+ children?: React.ReactNode;
45
+ /** Whether to wrap content in a centered container. Defaults to true. */
46
+ container?: boolean;
47
+ /** Max width of the container. Only applies when container is true. */
48
+ maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl';
49
+ /** Vertical gap between children. Defaults to 'lg' (gap-6). */
50
+ gap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '0' | '1' | '2' | '3' | '4' | '6' | '8';
51
+ }
52
+
53
+ function PageLayout({
54
+ variant,
55
+ padding,
56
+ container = true,
57
+ maxWidth,
58
+ gap = 'lg',
59
+ children,
60
+ ...props
61
+ }: PageLayoutProps) {
62
+ // For center variant, default to smaller max-width (sm) for auth-style pages
63
+ const resolvedMaxWidth = maxWidth ?? (variant === 'center' ? 'sm' : 'lg');
64
+
65
+ const content = (
66
+ <Stack gap={gap}>
67
+ {children}
68
+ </Stack>
69
+ );
70
+
71
+ return (
72
+ <div
73
+ data-slot="page-layout"
74
+ data-variant={variant}
75
+ className={pageLayoutVariants({ variant, padding })}
76
+ {...props}
77
+ >
78
+ {container ? (
79
+ <div
80
+ data-slot="page-layout-container"
81
+ className={cn(
82
+ containerVariants({ maxWidth: resolvedMaxWidth }),
83
+ variant === 'center' && 'flex items-center justify-center'
84
+ )}
85
+ >
86
+ {content}
87
+ </div>
88
+ ) : (
89
+ content
90
+ )}
91
+ </div>
92
+ );
93
+ }
94
+
95
+ export { PageLayout, pageLayoutVariants };
@@ -1,8 +1,8 @@
1
1
  import { Dialog as SheetPrimitive } from '@base-ui/react/dialog';
2
2
  import * as React from 'react';
3
3
 
4
- import { XIcon } from 'lucide-react';
5
- import { Button } from './button';
4
+ import { Close } from '@carbon/icons-react';
5
+ import { Button } from '../atoms/button';
6
6
 
7
7
  function Sheet({ ...props }: SheetPrimitive.Root.Props) {
8
8
  return <SheetPrimitive.Root data-slot="sheet" {...props} />;
@@ -45,7 +45,7 @@ function SheetContent({
45
45
  <SheetPrimitive.Popup
46
46
  data-slot="sheet-content"
47
47
  data-side={side}
48
- className="bg-background data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm"
48
+ className="bg-background data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col gap-4 px-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm"
49
49
  {...props}
50
50
  >
51
51
  {children}
@@ -53,9 +53,9 @@ function SheetContent({
53
53
  <SheetPrimitive.Close
54
54
  data-slot="sheet-close"
55
55
  render={<Button variant="ghost" size="icon-sm" />}
56
- className="absolute top-3 right-3"
56
+ className="absolute top-4 right-4"
57
57
  >
58
- <XIcon />
58
+ <Close className="size-4" />
59
59
  <span className="sr-only">Close</span>
60
60
  </SheetPrimitive.Close>
61
61
  )}
@@ -65,11 +65,11 @@ function SheetContent({
65
65
  }
66
66
 
67
67
  function SheetHeader({ ...props }: Omit<React.ComponentProps<'div'>, 'className'>) {
68
- return <div data-slot="sheet-header" className="gap-0.5 p-4 flex flex-col" {...props} />;
68
+ return <div data-slot="sheet-header" className="gap-0.5 pt-4 flex flex-col" {...props} />;
69
69
  }
70
70
 
71
71
  function SheetFooter({ ...props }: Omit<React.ComponentProps<'div'>, 'className'>) {
72
- return <div data-slot="sheet-footer" className="gap-2 p-4 mt-auto flex flex-col" {...props} />;
72
+ return <div data-slot="sheet-footer" className="gap-2 pb-4 mt-auto flex flex-col" {...props} />;
73
73
  }
74
74
 
75
75
  function SheetTitle({ ...props }: Omit<SheetPrimitive.Title.Props, 'className'>) {