@trycompai/design-system 1.0.0 → 1.0.1

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 (72) hide show
  1. package/package.json +2 -2
  2. package/src/components/atoms/index.ts +19 -0
  3. package/src/components/atoms/kbd.tsx +21 -0
  4. package/src/components/{ui → atoms}/slider.tsx +4 -4
  5. package/src/components/{ui → atoms}/textarea.tsx +8 -2
  6. package/src/components/{ui → atoms}/toggle.tsx +2 -5
  7. package/src/components/{ui → molecules}/breadcrumb.tsx +1 -1
  8. package/src/components/molecules/empty.tsx +82 -0
  9. package/src/components/{ui → molecules}/field.tsx +16 -37
  10. package/src/components/{ui → molecules}/hover-card.tsx +2 -8
  11. package/src/components/molecules/index.ts +26 -0
  12. package/src/components/{ui → molecules}/input-group.tsx +1 -1
  13. package/src/components/molecules/input-otp.tsx +70 -0
  14. package/src/components/{ui → molecules}/item.tsx +18 -36
  15. package/src/components/{ui → molecules}/page-header.tsx +2 -2
  16. package/src/components/{ui → molecules}/pagination.tsx +10 -19
  17. package/src/components/{ui → molecules}/radio-group.tsx +4 -8
  18. package/src/components/{ui → molecules}/scroll-area.tsx +8 -11
  19. package/src/components/{ui → molecules}/section.tsx +2 -2
  20. package/src/components/{ui → molecules}/select.tsx +17 -5
  21. package/src/components/{ui → molecules}/table.tsx +11 -2
  22. package/src/components/{ui → molecules}/toggle-group.tsx +1 -1
  23. package/src/components/organisms/alert-dialog.tsx +135 -0
  24. package/src/components/{ui → organisms}/calendar.tsx +2 -3
  25. package/src/components/{ui → organisms}/carousel.tsx +6 -8
  26. package/src/components/{ui → organisms}/chart.tsx +9 -24
  27. package/src/components/{ui → organisms}/combobox.tsx +2 -2
  28. package/src/components/{ui → organisms}/context-menu.tsx +19 -49
  29. package/src/components/{ui → organisms}/dialog.tsx +1 -1
  30. package/src/components/organisms/index.ts +16 -0
  31. package/src/components/organisms/navigation-menu.tsx +137 -0
  32. package/src/components/{ui → organisms}/sheet.tsx +6 -6
  33. package/src/components/{ui → organisms}/sidebar.tsx +42 -83
  34. package/src/components/{ui → organisms}/sonner.tsx +7 -9
  35. package/src/components/ui/index.ts +3 -61
  36. package/src/styles/globals.css +12 -0
  37. package/src/components/ui/alert-dialog.tsx +0 -161
  38. package/src/components/ui/empty.tsx +0 -94
  39. package/src/components/ui/input-otp.tsx +0 -84
  40. package/src/components/ui/kbd.tsx +0 -26
  41. package/src/components/ui/navigation-menu.tsx +0 -147
  42. /package/src/components/{ui → atoms}/aspect-ratio.tsx +0 -0
  43. /package/src/components/{ui → atoms}/avatar.tsx +0 -0
  44. /package/src/components/{ui → atoms}/badge.tsx +0 -0
  45. /package/src/components/{ui → atoms}/button.tsx +0 -0
  46. /package/src/components/{ui → atoms}/checkbox.tsx +0 -0
  47. /package/src/components/{ui → atoms}/container.tsx +0 -0
  48. /package/src/components/{ui → atoms}/heading.tsx +0 -0
  49. /package/src/components/{ui → atoms}/input.tsx +0 -0
  50. /package/src/components/{ui → atoms}/label.tsx +0 -0
  51. /package/src/components/{ui → atoms}/progress.tsx +0 -0
  52. /package/src/components/{ui → atoms}/separator.tsx +0 -0
  53. /package/src/components/{ui → atoms}/skeleton.tsx +0 -0
  54. /package/src/components/{ui → atoms}/spinner.tsx +0 -0
  55. /package/src/components/{ui → atoms}/switch.tsx +0 -0
  56. /package/src/components/{ui → atoms}/text.tsx +0 -0
  57. /package/src/components/{ui → molecules}/accordion.tsx +0 -0
  58. /package/src/components/{ui → molecules}/alert.tsx +0 -0
  59. /package/src/components/{ui → molecules}/button-group.tsx +0 -0
  60. /package/src/components/{ui → molecules}/card.tsx +0 -0
  61. /package/src/components/{ui → molecules}/collapsible.tsx +0 -0
  62. /package/src/components/{ui → molecules}/grid.tsx +0 -0
  63. /package/src/components/{ui → molecules}/popover.tsx +0 -0
  64. /package/src/components/{ui → molecules}/resizable.tsx +0 -0
  65. /package/src/components/{ui → molecules}/stack.tsx +0 -0
  66. /package/src/components/{ui → molecules}/tabs.tsx +0 -0
  67. /package/src/components/{ui → molecules}/tooltip.tsx +0 -0
  68. /package/src/components/{ui → organisms}/command.tsx +0 -0
  69. /package/src/components/{ui → organisms}/drawer.tsx +0 -0
  70. /package/src/components/{ui → organisms}/dropdown-menu.tsx +0 -0
  71. /package/src/components/{ui → organisms}/menubar.tsx +0 -0
  72. /package/src/components/{ui → organisms}/page-layout.tsx +0 -0
@@ -1,94 +0,0 @@
1
- import { cva, type VariantProps } from 'class-variance-authority';
2
-
3
- import { cn } from '../../../lib/utils';
4
-
5
- function Empty({ className, ...props }: React.ComponentProps<'div'>) {
6
- return (
7
- <div
8
- data-slot="empty"
9
- className={cn(
10
- 'gap-4 rounded-lg border-dashed p-12 flex w-full min-w-0 flex-1 flex-col items-center justify-center text-center text-balance',
11
- className,
12
- )}
13
- {...props}
14
- />
15
- );
16
- }
17
-
18
- function EmptyHeader({ className, ...props }: React.ComponentProps<'div'>) {
19
- return (
20
- <div
21
- data-slot="empty-header"
22
- className={cn('gap-2 flex max-w-sm flex-col items-center', className)}
23
- {...props}
24
- />
25
- );
26
- }
27
-
28
- const emptyMediaVariants = cva(
29
- 'mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0',
30
- {
31
- variants: {
32
- variant: {
33
- default: 'bg-transparent',
34
- icon: "bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6",
35
- },
36
- },
37
- defaultVariants: {
38
- variant: 'default',
39
- },
40
- },
41
- );
42
-
43
- function EmptyMedia({
44
- className,
45
- variant = 'default',
46
- ...props
47
- }: React.ComponentProps<'div'> & VariantProps<typeof emptyMediaVariants>) {
48
- return (
49
- <div
50
- data-slot="empty-icon"
51
- data-variant={variant}
52
- className={cn(emptyMediaVariants({ variant, className }))}
53
- {...props}
54
- />
55
- );
56
- }
57
-
58
- function EmptyTitle({ className, ...props }: React.ComponentProps<'div'>) {
59
- return (
60
- <div
61
- data-slot="empty-title"
62
- className={cn('text-lg font-medium tracking-tight', className)}
63
- {...props}
64
- />
65
- );
66
- }
67
-
68
- function EmptyDescription({ className, ...props }: React.ComponentProps<'p'>) {
69
- return (
70
- <div
71
- data-slot="empty-description"
72
- className={cn(
73
- 'text-sm/relaxed text-muted-foreground [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',
74
- className,
75
- )}
76
- {...props}
77
- />
78
- );
79
- }
80
-
81
- function EmptyContent({ className, ...props }: React.ComponentProps<'div'>) {
82
- return (
83
- <div
84
- data-slot="empty-content"
85
- className={cn(
86
- 'gap-4 text-sm flex w-full max-w-sm min-w-0 flex-col items-center text-balance',
87
- className,
88
- )}
89
- {...props}
90
- />
91
- );
92
- }
93
-
94
- export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle };
@@ -1,84 +0,0 @@
1
- import { OTPInput, OTPInputContext } from 'input-otp';
2
- import * as React from 'react';
3
-
4
- import { MinusIcon } from 'lucide-react';
5
- import { cn } from '../../../lib/utils';
6
-
7
- function InputOTP({
8
- className,
9
- containerClassName,
10
- ...props
11
- }: React.ComponentProps<typeof OTPInput> & {
12
- containerClassName?: string;
13
- }) {
14
- return (
15
- <OTPInput
16
- data-slot="input-otp"
17
- containerClassName={cn(
18
- 'cn-input-otp flex items-center has-disabled:opacity-50',
19
- containerClassName,
20
- )}
21
- spellCheck={false}
22
- className={cn('disabled:cursor-not-allowed', className)}
23
- {...props}
24
- />
25
- );
26
- }
27
-
28
- function InputOTPGroup({ className, ...props }: React.ComponentProps<'div'>) {
29
- return (
30
- <div
31
- data-slot="input-otp-group"
32
- className={cn(
33
- 'has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40 has-aria-invalid:border-destructive rounded-md has-aria-invalid:ring-[3px] flex items-center',
34
- className,
35
- )}
36
- {...props}
37
- />
38
- );
39
- }
40
-
41
- function InputOTPSlot({
42
- index,
43
- className,
44
- ...props
45
- }: React.ComponentProps<'div'> & {
46
- index: number;
47
- }) {
48
- const inputOTPContext = React.useContext(OTPInputContext);
49
- const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
50
-
51
- return (
52
- <div
53
- data-slot="input-otp-slot"
54
- data-active={isActive}
55
- className={cn(
56
- 'dark:bg-input/30 border-input data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive size-9 border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:ring-[3px] relative flex items-center justify-center data-[active=true]:z-10',
57
- className,
58
- )}
59
- {...props}
60
- >
61
- {char}
62
- {hasFakeCaret && (
63
- <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
64
- <div className="animate-caret-blink bg-foreground h-4 w-px duration-1000 bg-foreground h-4 w-px" />
65
- </div>
66
- )}
67
- </div>
68
- );
69
- }
70
-
71
- function InputOTPSeparator({ ...props }: React.ComponentProps<'div'>) {
72
- return (
73
- <div
74
- data-slot="input-otp-separator"
75
- className="[&_svg:not([class*='size-'])]:size-4 flex items-center"
76
- role="separator"
77
- {...props}
78
- >
79
- <MinusIcon />
80
- </div>
81
- );
82
- }
83
-
84
- export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
@@ -1,26 +0,0 @@
1
- import { cn } from '../../../lib/utils';
2
-
3
- function Kbd({ className, ...props }: React.ComponentProps<'kbd'>) {
4
- return (
5
- <kbd
6
- data-slot="kbd"
7
- className={cn(
8
- "bg-muted text-muted-foreground [[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10 h-5 w-fit min-w-5 gap-1 rounded-sm px-1 font-sans text-xs font-medium [&_svg:not([class*='size-'])]:size-3 pointer-events-none inline-flex items-center justify-center select-none",
9
- className,
10
- )}
11
- {...props}
12
- />
13
- );
14
- }
15
-
16
- function KbdGroup({ className, ...props }: React.ComponentProps<'div'>) {
17
- return (
18
- <kbd
19
- data-slot="kbd-group"
20
- className={cn('gap-1 inline-flex items-center', className)}
21
- {...props}
22
- />
23
- );
24
- }
25
-
26
- export { Kbd, KbdGroup };
@@ -1,147 +0,0 @@
1
- import { NavigationMenu as NavigationMenuPrimitive } from '@base-ui/react/navigation-menu';
2
- import { cva } from 'class-variance-authority';
3
-
4
- import { ChevronDownIcon } from 'lucide-react';
5
- import { cn } from '../../../lib/utils';
6
-
7
- function NavigationMenu({ className, children, ...props }: NavigationMenuPrimitive.Root.Props) {
8
- return (
9
- <NavigationMenuPrimitive.Root
10
- data-slot="navigation-menu"
11
- className={cn(
12
- 'max-w-max group/navigation-menu relative flex max-w-max flex-1 items-center justify-center',
13
- className,
14
- )}
15
- {...props}
16
- >
17
- {children}
18
- <NavigationMenuPositioner />
19
- </NavigationMenuPrimitive.Root>
20
- );
21
- }
22
-
23
- function NavigationMenuList({ className, ...props }: NavigationMenuPrimitive.List.Props) {
24
- return (
25
- <NavigationMenuPrimitive.List
26
- data-slot="navigation-menu-list"
27
- className={cn('gap-0 group flex flex-1 list-none items-center justify-center', className)}
28
- {...props}
29
- />
30
- );
31
- }
32
-
33
- function NavigationMenuItem({ className, ...props }: NavigationMenuPrimitive.Item.Props) {
34
- return (
35
- <NavigationMenuPrimitive.Item
36
- data-slot="navigation-menu-item"
37
- className={cn('relative', className)}
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
- className,
49
- children,
50
- ...props
51
- }: NavigationMenuPrimitive.Trigger.Props) {
52
- return (
53
- <NavigationMenuPrimitive.Trigger
54
- data-slot="navigation-menu-trigger"
55
- className={cn(navigationMenuTriggerStyle(), 'group', className)}
56
- {...props}
57
- >
58
- {children}{' '}
59
- <ChevronDownIcon
60
- 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"
61
- aria-hidden="true"
62
- />
63
- </NavigationMenuPrimitive.Trigger>
64
- );
65
- }
66
-
67
- function NavigationMenuContent({ className, ...props }: NavigationMenuPrimitive.Content.Props) {
68
- return (
69
- <NavigationMenuPrimitive.Content
70
- data-slot="navigation-menu-content"
71
- className={cn(
72
- '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
- className,
74
- )}
75
- {...props}
76
- />
77
- );
78
- }
79
-
80
- function NavigationMenuPositioner({
81
- className,
82
- side = 'bottom',
83
- sideOffset = 8,
84
- align = 'start',
85
- alignOffset = 0,
86
- ...props
87
- }: NavigationMenuPrimitive.Positioner.Props) {
88
- return (
89
- <NavigationMenuPrimitive.Portal>
90
- <NavigationMenuPrimitive.Positioner
91
- side={side}
92
- sideOffset={sideOffset}
93
- align={align}
94
- alignOffset={alignOffset}
95
- className={cn(
96
- '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',
97
- className,
98
- )}
99
- {...props}
100
- >
101
- <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)">
102
- <NavigationMenuPrimitive.Viewport className="relative size-full overflow-hidden" />
103
- </NavigationMenuPrimitive.Popup>
104
- </NavigationMenuPrimitive.Positioner>
105
- </NavigationMenuPrimitive.Portal>
106
- );
107
- }
108
-
109
- function NavigationMenuLink({ className, ...props }: NavigationMenuPrimitive.Link.Props) {
110
- return (
111
- <NavigationMenuPrimitive.Link
112
- data-slot="navigation-menu-link"
113
- className={cn(
114
- "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",
115
- className,
116
- )}
117
- {...props}
118
- />
119
- );
120
- }
121
-
122
- function NavigationMenuIndicator({ className, ...props }: NavigationMenuPrimitive.Icon.Props) {
123
- return (
124
- <NavigationMenuPrimitive.Icon
125
- data-slot="navigation-menu-indicator"
126
- className={cn(
127
- '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',
128
- className,
129
- )}
130
- {...props}
131
- >
132
- <div className="bg-border rounded-tl-sm shadow-md relative top-[60%] h-2 w-2 rotate-45" />
133
- </NavigationMenuPrimitive.Icon>
134
- );
135
- }
136
-
137
- export {
138
- NavigationMenu,
139
- NavigationMenuContent,
140
- NavigationMenuIndicator,
141
- NavigationMenuItem,
142
- NavigationMenuLink,
143
- NavigationMenuList,
144
- NavigationMenuPositioner,
145
- NavigationMenuTrigger,
146
- navigationMenuTriggerStyle,
147
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes