@c-rex/ui 0.0.6 → 0.0.9

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 (153) hide show
  1. package/dist/alert.cjs +2 -0
  2. package/dist/alert.cjs.map +1 -0
  3. package/dist/alert.d.cts +11 -0
  4. package/dist/{ui/src/alert.d.ts → alert.d.ts} +7 -5
  5. package/dist/alert.js +2 -0
  6. package/dist/alert.js.map +1 -0
  7. package/dist/breadcrumb.cjs +2 -0
  8. package/dist/breadcrumb.cjs.map +1 -0
  9. package/dist/breadcrumb.d.cts +22 -0
  10. package/dist/{ui/src/breadcrumb.d.ts → breadcrumb.d.ts} +7 -5
  11. package/dist/breadcrumb.js +2 -0
  12. package/dist/breadcrumb.js.map +1 -0
  13. package/dist/button.cjs +2 -0
  14. package/dist/button.cjs.map +1 -0
  15. package/dist/button.d.cts +15 -0
  16. package/dist/button.d.ts +15 -0
  17. package/dist/button.js +2 -0
  18. package/dist/button.js.map +1 -0
  19. package/dist/command.cjs +2 -0
  20. package/dist/command.cjs.map +1 -0
  21. package/dist/command.d.cts +83 -0
  22. package/dist/{ui/src/command.d.ts → command.d.ts} +21 -19
  23. package/dist/command.js +2 -0
  24. package/dist/command.js.map +1 -0
  25. package/dist/dialog.cjs +2 -0
  26. package/dist/dialog.cjs.map +1 -0
  27. package/dist/dialog.d.cts +22 -0
  28. package/dist/{ui/src/dialog.d.ts → dialog.d.ts} +8 -6
  29. package/dist/dialog.js +2 -0
  30. package/dist/dialog.js.map +1 -0
  31. package/dist/hooks/use-mobile.cjs +2 -0
  32. package/dist/hooks/use-mobile.cjs.map +1 -0
  33. package/dist/hooks/use-mobile.d.cts +3 -0
  34. package/dist/hooks/use-mobile.d.ts +3 -0
  35. package/dist/hooks/use-mobile.js +2 -0
  36. package/dist/hooks/use-mobile.js.map +1 -0
  37. package/dist/input.cjs +2 -0
  38. package/dist/input.cjs.map +1 -0
  39. package/dist/input.d.cts +5 -0
  40. package/dist/{ui/src/input.d.ts → input.d.ts} +3 -2
  41. package/dist/input.js +2 -0
  42. package/dist/input.js.map +1 -0
  43. package/dist/popover.cjs +2 -0
  44. package/dist/popover.cjs.map +1 -0
  45. package/dist/popover.d.cts +9 -0
  46. package/dist/{ui/src/popover.d.ts → popover.d.ts} +5 -4
  47. package/dist/popover.js +2 -0
  48. package/dist/popover.js.map +1 -0
  49. package/dist/select.cjs +2 -0
  50. package/dist/select.cjs.map +1 -0
  51. package/dist/select.d.cts +15 -0
  52. package/dist/{ui/src/select.d.ts → select.d.ts} +5 -4
  53. package/dist/select.js +2 -0
  54. package/dist/select.js.map +1 -0
  55. package/dist/separator.cjs +2 -0
  56. package/dist/separator.cjs.map +1 -0
  57. package/dist/separator.d.cts +6 -0
  58. package/dist/{ui/src/separator.d.ts → separator.d.ts} +4 -3
  59. package/dist/separator.js +2 -0
  60. package/dist/separator.js.map +1 -0
  61. package/dist/sheet.cjs +2 -0
  62. package/dist/sheet.cjs.map +1 -0
  63. package/dist/sheet.d.cts +29 -0
  64. package/dist/sheet.d.ts +29 -0
  65. package/dist/sheet.js +2 -0
  66. package/dist/sheet.js.map +1 -0
  67. package/dist/sidebar.cjs +2 -0
  68. package/dist/sidebar.cjs.map +1 -0
  69. package/dist/sidebar.d.cts +72 -0
  70. package/dist/{ui/src/sidebar.d.ts → sidebar.d.ts} +13 -8
  71. package/dist/sidebar.js +2 -0
  72. package/dist/sidebar.js.map +1 -0
  73. package/dist/skeleton.cjs +2 -0
  74. package/dist/skeleton.cjs.map +1 -0
  75. package/dist/skeleton.d.cts +5 -0
  76. package/dist/skeleton.d.ts +5 -0
  77. package/dist/skeleton.js +2 -0
  78. package/dist/skeleton.js.map +1 -0
  79. package/dist/table.cjs +2 -0
  80. package/dist/table.cjs.map +1 -0
  81. package/dist/table.d.cts +12 -0
  82. package/dist/{ui/src/table.d.ts → table.d.ts} +4 -3
  83. package/dist/table.js +2 -0
  84. package/dist/table.js.map +1 -0
  85. package/dist/tooltip.cjs +2 -0
  86. package/dist/tooltip.cjs.map +1 -0
  87. package/dist/tooltip.d.cts +9 -0
  88. package/dist/{ui/src/tooltip.d.ts → tooltip.d.ts} +5 -4
  89. package/dist/tooltip.js +2 -0
  90. package/dist/tooltip.js.map +1 -0
  91. package/package.json +114 -98
  92. package/dist/constants/src/index.d.ts +0 -17
  93. package/dist/constants/src/index.d.ts.map +0 -1
  94. package/dist/interfaces/src/common.d.ts +0 -36
  95. package/dist/interfaces/src/common.d.ts.map +0 -1
  96. package/dist/interfaces/src/config.d.ts +0 -26
  97. package/dist/interfaces/src/config.d.ts.map +0 -1
  98. package/dist/interfaces/src/directoryNodes.d.ts +0 -8
  99. package/dist/interfaces/src/directoryNodes.d.ts.map +0 -1
  100. package/dist/interfaces/src/documentTypes.d.ts +0 -7
  101. package/dist/interfaces/src/documentTypes.d.ts.map +0 -1
  102. package/dist/interfaces/src/index.d.ts +0 -7
  103. package/dist/interfaces/src/index.d.ts.map +0 -1
  104. package/dist/interfaces/src/informationUnits.d.ts +0 -53
  105. package/dist/interfaces/src/informationUnits.d.ts.map +0 -1
  106. package/dist/interfaces/src/treeOfContent.d.ts +0 -8
  107. package/dist/interfaces/src/treeOfContent.d.ts.map +0 -1
  108. package/dist/types/src/index.d.ts +0 -8
  109. package/dist/types/src/index.d.ts.map +0 -1
  110. package/dist/ui/src/alert.d.ts.map +0 -1
  111. package/dist/ui/src/breadcrumb.d.ts.map +0 -1
  112. package/dist/ui/src/button.d.ts +0 -13
  113. package/dist/ui/src/button.d.ts.map +0 -1
  114. package/dist/ui/src/command.d.ts.map +0 -1
  115. package/dist/ui/src/dialog.d.ts.map +0 -1
  116. package/dist/ui/src/hooks/use-mobile.d.ts +0 -2
  117. package/dist/ui/src/hooks/use-mobile.d.ts.map +0 -1
  118. package/dist/ui/src/input.d.ts.map +0 -1
  119. package/dist/ui/src/popover.d.ts.map +0 -1
  120. package/dist/ui/src/select.d.ts.map +0 -1
  121. package/dist/ui/src/separator.d.ts.map +0 -1
  122. package/dist/ui/src/sheet.d.ts +0 -26
  123. package/dist/ui/src/sheet.d.ts.map +0 -1
  124. package/dist/ui/src/sidebar.d.ts.map +0 -1
  125. package/dist/ui/src/skeleton.d.ts +0 -3
  126. package/dist/ui/src/skeleton.d.ts.map +0 -1
  127. package/dist/ui/src/table.d.ts.map +0 -1
  128. package/dist/ui/src/tooltip.d.ts.map +0 -1
  129. package/dist/utils/src/breadcrumbs.d.ts +0 -3
  130. package/dist/utils/src/breadcrumbs.d.ts.map +0 -1
  131. package/dist/utils/src/classMerge.d.ts +0 -3
  132. package/dist/utils/src/classMerge.d.ts.map +0 -1
  133. package/dist/utils/src/index.d.ts +0 -5
  134. package/dist/utils/src/index.d.ts.map +0 -1
  135. package/dist/utils/src/treeOfContent.d.ts +0 -2
  136. package/dist/utils/src/treeOfContent.d.ts.map +0 -1
  137. package/dist/utils/src/utils.d.ts +0 -8
  138. package/dist/utils/src/utils.d.ts.map +0 -1
  139. package/src/alert.tsx +0 -58
  140. package/src/breadcrumb.tsx +0 -115
  141. package/src/button.tsx +0 -66
  142. package/src/command.tsx +0 -151
  143. package/src/dialog.tsx +0 -122
  144. package/src/hooks/use-mobile.tsx +0 -19
  145. package/src/input.tsx +0 -22
  146. package/src/popover.tsx +0 -31
  147. package/src/select.tsx +0 -157
  148. package/src/separator.tsx +0 -29
  149. package/src/sheet.tsx +0 -140
  150. package/src/sidebar.tsx +0 -785
  151. package/src/skeleton.tsx +0 -15
  152. package/src/table.tsx +0 -120
  153. package/src/tooltip.tsx +0 -30
package/src/command.tsx DELETED
@@ -1,151 +0,0 @@
1
- import * as React from "react";
2
- import { type DialogProps } from "@radix-ui/react-dialog";
3
- import { Command as CommandPrimitive } from "cmdk";
4
- import { Search } from "lucide-react";
5
-
6
- import { cn } from "@c-rex/utils";
7
- import { Dialog, DialogContent } from "./dialog";
8
-
9
- const Command = React.forwardRef<
10
- React.ElementRef<typeof CommandPrimitive>,
11
- React.ComponentPropsWithoutRef<typeof CommandPrimitive>
12
- >(({ className, ...props }, ref) => (
13
- <CommandPrimitive
14
- ref={ref}
15
- className={cn(
16
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
17
- className,
18
- )}
19
- {...props}
20
- />
21
- ));
22
- Command.displayName = CommandPrimitive.displayName;
23
-
24
- const CommandDialog = ({ children, ...props }: DialogProps) => {
25
- return (
26
- <Dialog {...props}>
27
- <DialogContent className="overflow-hidden p-0">
28
- <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
29
- {children}
30
- </Command>
31
- </DialogContent>
32
- </Dialog>
33
- );
34
- };
35
-
36
- const CommandInput = React.forwardRef<
37
- React.ElementRef<typeof CommandPrimitive.Input>,
38
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
39
- >(({ className, ...props }, ref) => (
40
- <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
41
- <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
42
- <CommandPrimitive.Input
43
- ref={ref}
44
- className={cn(
45
- "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
46
- className,
47
- )}
48
- {...props}
49
- />
50
- </div>
51
- ));
52
-
53
- CommandInput.displayName = CommandPrimitive.Input.displayName;
54
-
55
- const CommandList = React.forwardRef<
56
- React.ElementRef<typeof CommandPrimitive.List>,
57
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
58
- >(({ className, ...props }, ref) => (
59
- <CommandPrimitive.List
60
- ref={ref}
61
- className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
62
- {...props}
63
- />
64
- ));
65
-
66
- CommandList.displayName = CommandPrimitive.List.displayName;
67
-
68
- const CommandEmpty = React.forwardRef<
69
- React.ElementRef<typeof CommandPrimitive.Empty>,
70
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
71
- >((props, ref) => (
72
- <CommandPrimitive.Empty
73
- ref={ref}
74
- className="py-6 text-center text-sm"
75
- {...props}
76
- />
77
- ));
78
-
79
- CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
80
-
81
- const CommandGroup = React.forwardRef<
82
- React.ElementRef<typeof CommandPrimitive.Group>,
83
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
84
- >(({ className, ...props }, ref) => (
85
- <CommandPrimitive.Group
86
- ref={ref}
87
- className={cn(
88
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
89
- className,
90
- )}
91
- {...props}
92
- />
93
- ));
94
-
95
- CommandGroup.displayName = CommandPrimitive.Group.displayName;
96
-
97
- const CommandSeparator = React.forwardRef<
98
- React.ElementRef<typeof CommandPrimitive.Separator>,
99
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
100
- >(({ className, ...props }, ref) => (
101
- <CommandPrimitive.Separator
102
- ref={ref}
103
- className={cn("-mx-1 h-px bg-border", className)}
104
- {...props}
105
- />
106
- ));
107
- CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
108
-
109
- const CommandItem = React.forwardRef<
110
- React.ElementRef<typeof CommandPrimitive.Item>,
111
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
112
- >(({ className, ...props }, ref) => (
113
- <CommandPrimitive.Item
114
- ref={ref}
115
- className={cn(
116
- "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
117
- className,
118
- )}
119
- {...props}
120
- />
121
- ));
122
-
123
- CommandItem.displayName = CommandPrimitive.Item.displayName;
124
-
125
- const CommandShortcut = ({
126
- className,
127
- ...props
128
- }: React.HTMLAttributes<HTMLSpanElement>) => {
129
- return (
130
- <span
131
- className={cn(
132
- "ml-auto text-xs tracking-widest text-muted-foreground",
133
- className,
134
- )}
135
- {...props}
136
- />
137
- );
138
- };
139
- CommandShortcut.displayName = "CommandShortcut";
140
-
141
- export {
142
- Command,
143
- CommandDialog,
144
- CommandInput,
145
- CommandList,
146
- CommandEmpty,
147
- CommandGroup,
148
- CommandItem,
149
- CommandShortcut,
150
- CommandSeparator,
151
- };
package/src/dialog.tsx DELETED
@@ -1,122 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as DialogPrimitive from "@radix-ui/react-dialog";
5
- import { X } from "lucide-react";
6
-
7
- import { cn } from "@c-rex/utils";
8
-
9
- const Dialog = DialogPrimitive.Root;
10
-
11
- const DialogTrigger = DialogPrimitive.Trigger;
12
-
13
- const DialogPortal = DialogPrimitive.Portal;
14
-
15
- const DialogClose = DialogPrimitive.Close;
16
-
17
- const DialogOverlay = React.forwardRef<
18
- React.ElementRef<typeof DialogPrimitive.Overlay>,
19
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
20
- >(({ className, ...props }, ref) => (
21
- <DialogPrimitive.Overlay
22
- ref={ref}
23
- className={cn(
24
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
25
- className,
26
- )}
27
- {...props}
28
- />
29
- ));
30
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
31
-
32
- const DialogContent = React.forwardRef<
33
- React.ElementRef<typeof DialogPrimitive.Content>,
34
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
35
- >(({ className, children, ...props }, ref) => (
36
- <DialogPortal>
37
- <DialogOverlay />
38
- <DialogPrimitive.Content
39
- ref={ref}
40
- className={cn(
41
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
42
- className,
43
- )}
44
- {...props}
45
- >
46
- {children}
47
- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
48
- <X className="h-4 w-4" />
49
- <span className="sr-only">Close</span>
50
- </DialogPrimitive.Close>
51
- </DialogPrimitive.Content>
52
- </DialogPortal>
53
- ));
54
- DialogContent.displayName = DialogPrimitive.Content.displayName;
55
-
56
- const DialogHeader = ({
57
- className,
58
- ...props
59
- }: React.HTMLAttributes<HTMLDivElement>) => (
60
- <div
61
- className={cn(
62
- "flex flex-col space-y-1.5 text-center sm:text-left",
63
- className,
64
- )}
65
- {...props}
66
- />
67
- );
68
- DialogHeader.displayName = "DialogHeader";
69
-
70
- const DialogFooter = ({
71
- className,
72
- ...props
73
- }: React.HTMLAttributes<HTMLDivElement>) => (
74
- <div
75
- className={cn(
76
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
77
- className,
78
- )}
79
- {...props}
80
- />
81
- );
82
- DialogFooter.displayName = "DialogFooter";
83
-
84
- const DialogTitle = React.forwardRef<
85
- React.ElementRef<typeof DialogPrimitive.Title>,
86
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
87
- >(({ className, ...props }, ref) => (
88
- <DialogPrimitive.Title
89
- ref={ref}
90
- className={cn(
91
- "text-lg font-semibold leading-none tracking-tight",
92
- className,
93
- )}
94
- {...props}
95
- />
96
- ));
97
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
98
-
99
- const DialogDescription = React.forwardRef<
100
- React.ElementRef<typeof DialogPrimitive.Description>,
101
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
102
- >(({ className, ...props }, ref) => (
103
- <DialogPrimitive.Description
104
- ref={ref}
105
- className={cn("text-sm text-muted-foreground", className)}
106
- {...props}
107
- />
108
- ));
109
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
110
-
111
- export {
112
- Dialog,
113
- DialogPortal,
114
- DialogOverlay,
115
- DialogTrigger,
116
- DialogClose,
117
- DialogContent,
118
- DialogHeader,
119
- DialogFooter,
120
- DialogTitle,
121
- DialogDescription,
122
- };
@@ -1,19 +0,0 @@
1
- import { useEffect, useState } from "react";
2
-
3
- const MOBILE_BREAKPOINT = 768;
4
-
5
- export function useIsMobile() {
6
- const [isMobile, setIsMobile] = useState<boolean | undefined>(undefined);
7
-
8
- useEffect(() => {
9
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
10
- const onChange = () => {
11
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
12
- };
13
- mql.addEventListener("change", onChange);
14
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
15
- return () => mql.removeEventListener("change", onChange);
16
- }, []);
17
-
18
- return !!isMobile;
19
- }
package/src/input.tsx DELETED
@@ -1,22 +0,0 @@
1
- import * as React from "react";
2
-
3
- import { cn } from "@c-rex/utils";
4
-
5
- const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
6
- ({ className, type, ...props }, ref) => {
7
- return (
8
- <input
9
- type={type}
10
- className={cn(
11
- "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
12
- className,
13
- )}
14
- ref={ref}
15
- {...props}
16
- />
17
- );
18
- },
19
- );
20
- Input.displayName = "Input";
21
-
22
- export { Input };
package/src/popover.tsx DELETED
@@ -1,31 +0,0 @@
1
- import * as React from "react";
2
- import * as PopoverPrimitive from "@radix-ui/react-popover";
3
-
4
- import { cn } from "@c-rex/utils";
5
-
6
- const Popover = PopoverPrimitive.Root;
7
-
8
- const PopoverTrigger = PopoverPrimitive.Trigger;
9
-
10
- const PopoverAnchor = PopoverPrimitive.Anchor;
11
-
12
- const PopoverContent = React.forwardRef<
13
- React.ElementRef<typeof PopoverPrimitive.Content>,
14
- React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
15
- >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
16
- <PopoverPrimitive.Portal>
17
- <PopoverPrimitive.Content
18
- ref={ref}
19
- align={align}
20
- sideOffset={sideOffset}
21
- className={cn(
22
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out 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",
23
- className,
24
- )}
25
- {...props}
26
- />
27
- </PopoverPrimitive.Portal>
28
- ));
29
- PopoverContent.displayName = PopoverPrimitive.Content.displayName;
30
-
31
- export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
package/src/select.tsx DELETED
@@ -1,157 +0,0 @@
1
- import * as React from "react";
2
- import * as SelectPrimitive from "@radix-ui/react-select";
3
- import { Check, ChevronDown, ChevronUp } from "lucide-react";
4
-
5
- import { cn } from "@c-rex/utils";
6
-
7
- const Select = SelectPrimitive.Root;
8
-
9
- const SelectGroup = SelectPrimitive.Group;
10
-
11
- const SelectValue = SelectPrimitive.Value;
12
-
13
- const SelectTrigger = React.forwardRef<
14
- React.ElementRef<typeof SelectPrimitive.Trigger>,
15
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
16
- >(({ className, children, ...props }, ref) => (
17
- <SelectPrimitive.Trigger
18
- ref={ref}
19
- className={cn(
20
- "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
21
- className,
22
- )}
23
- {...props}
24
- >
25
- {children}
26
- <SelectPrimitive.Icon asChild>
27
- <ChevronDown className="h-4 w-4 opacity-50" />
28
- </SelectPrimitive.Icon>
29
- </SelectPrimitive.Trigger>
30
- ));
31
- SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
32
-
33
- const SelectScrollUpButton = React.forwardRef<
34
- React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
35
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
36
- >(({ className, ...props }, ref) => (
37
- <SelectPrimitive.ScrollUpButton
38
- ref={ref}
39
- className={cn(
40
- "flex cursor-default items-center justify-center py-1",
41
- className,
42
- )}
43
- {...props}
44
- >
45
- <ChevronUp className="h-4 w-4" />
46
- </SelectPrimitive.ScrollUpButton>
47
- ));
48
- SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
49
-
50
- const SelectScrollDownButton = React.forwardRef<
51
- React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
52
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
53
- >(({ className, ...props }, ref) => (
54
- <SelectPrimitive.ScrollDownButton
55
- ref={ref}
56
- className={cn(
57
- "flex cursor-default items-center justify-center py-1",
58
- className,
59
- )}
60
- {...props}
61
- >
62
- <ChevronDown className="h-4 w-4" />
63
- </SelectPrimitive.ScrollDownButton>
64
- ));
65
- SelectScrollDownButton.displayName =
66
- SelectPrimitive.ScrollDownButton.displayName;
67
-
68
- const SelectContent = React.forwardRef<
69
- React.ElementRef<typeof SelectPrimitive.Content>,
70
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
71
- >(({ className, children, position = "popper", ...props }, ref) => (
72
- <SelectPrimitive.Portal>
73
- <SelectPrimitive.Content
74
- ref={ref}
75
- className={cn(
76
- "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out 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",
77
- position === "popper" &&
78
- "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
79
- className,
80
- )}
81
- position={position}
82
- {...props}
83
- >
84
- <SelectScrollUpButton />
85
- <SelectPrimitive.Viewport
86
- className={cn(
87
- "p-1",
88
- position === "popper" &&
89
- "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
90
- )}
91
- >
92
- {children}
93
- </SelectPrimitive.Viewport>
94
- <SelectScrollDownButton />
95
- </SelectPrimitive.Content>
96
- </SelectPrimitive.Portal>
97
- ));
98
- SelectContent.displayName = SelectPrimitive.Content.displayName;
99
-
100
- const SelectLabel = React.forwardRef<
101
- React.ElementRef<typeof SelectPrimitive.Label>,
102
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
103
- >(({ className, ...props }, ref) => (
104
- <SelectPrimitive.Label
105
- ref={ref}
106
- className={cn("px-2 py-1.5 text-sm font-semibold", className)}
107
- {...props}
108
- />
109
- ));
110
- SelectLabel.displayName = SelectPrimitive.Label.displayName;
111
-
112
- const SelectItem = React.forwardRef<
113
- React.ElementRef<typeof SelectPrimitive.Item>,
114
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
115
- >(({ className, children, ...props }, ref) => (
116
- <SelectPrimitive.Item
117
- ref={ref}
118
- className={cn(
119
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
120
- className,
121
- )}
122
- {...props}
123
- >
124
- <span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
125
- <SelectPrimitive.ItemIndicator>
126
- <Check className="h-4 w-4" />
127
- </SelectPrimitive.ItemIndicator>
128
- </span>
129
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
130
- </SelectPrimitive.Item>
131
- ));
132
- SelectItem.displayName = SelectPrimitive.Item.displayName;
133
-
134
- const SelectSeparator = React.forwardRef<
135
- React.ElementRef<typeof SelectPrimitive.Separator>,
136
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
137
- >(({ className, ...props }, ref) => (
138
- <SelectPrimitive.Separator
139
- ref={ref}
140
- className={cn("-mx-1 my-1 h-px bg-muted", className)}
141
- {...props}
142
- />
143
- ));
144
- SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
145
-
146
- export {
147
- Select,
148
- SelectGroup,
149
- SelectValue,
150
- SelectTrigger,
151
- SelectContent,
152
- SelectLabel,
153
- SelectItem,
154
- SelectSeparator,
155
- SelectScrollUpButton,
156
- SelectScrollDownButton,
157
- };
package/src/separator.tsx DELETED
@@ -1,29 +0,0 @@
1
- import * as React from "react";
2
- import * as SeparatorPrimitive from "@radix-ui/react-separator";
3
-
4
- import { cn } from "@c-rex/utils";
5
-
6
- const Separator = React.forwardRef<
7
- React.ElementRef<typeof SeparatorPrimitive.Root>,
8
- React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
9
- >(
10
- (
11
- { className, orientation = "horizontal", decorative = true, ...props },
12
- ref,
13
- ) => (
14
- <SeparatorPrimitive.Root
15
- ref={ref}
16
- decorative={decorative}
17
- orientation={orientation}
18
- className={cn(
19
- "shrink-0 bg-border",
20
- orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
21
- className,
22
- )}
23
- {...props}
24
- />
25
- ),
26
- );
27
- Separator.displayName = SeparatorPrimitive.Root.displayName;
28
-
29
- export { Separator };
package/src/sheet.tsx DELETED
@@ -1,140 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as SheetPrimitive from "@radix-ui/react-dialog";
5
- import { cva, type VariantProps } from "class-variance-authority";
6
- import { X } from "lucide-react";
7
-
8
- import { cn } from "@c-rex/utils";
9
-
10
- const Sheet = SheetPrimitive.Root;
11
-
12
- const SheetTrigger = SheetPrimitive.Trigger;
13
-
14
- const SheetClose = SheetPrimitive.Close;
15
-
16
- const SheetPortal = SheetPrimitive.Portal;
17
-
18
- const SheetOverlay = React.forwardRef<
19
- React.ElementRef<typeof SheetPrimitive.Overlay>,
20
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
21
- >(({ className, ...props }, ref) => (
22
- <SheetPrimitive.Overlay
23
- className={cn(
24
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
25
- className,
26
- )}
27
- {...props}
28
- ref={ref}
29
- />
30
- ));
31
- SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
32
-
33
- const sheetVariants = cva(
34
- "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
35
- {
36
- variants: {
37
- side: {
38
- top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
39
- bottom:
40
- "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
41
- left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
42
- right:
43
- "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
44
- },
45
- },
46
- defaultVariants: {
47
- side: "right",
48
- },
49
- },
50
- );
51
-
52
- interface SheetContentProps
53
- extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
54
- VariantProps<typeof sheetVariants> { }
55
-
56
- const SheetContent = React.forwardRef<
57
- React.ElementRef<typeof SheetPrimitive.Content>,
58
- SheetContentProps
59
- >(({ side = "right", className, children, ...props }, ref) => (
60
- <SheetPortal>
61
- <SheetOverlay />
62
- <SheetPrimitive.Content
63
- ref={ref}
64
- className={cn(sheetVariants({ side }), className)}
65
- {...props}
66
- >
67
- <SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
68
- <X className="h-4 w-4" />
69
- <span className="sr-only">Close</span>
70
- </SheetPrimitive.Close>
71
- {children}
72
- </SheetPrimitive.Content>
73
- </SheetPortal>
74
- ));
75
- SheetContent.displayName = SheetPrimitive.Content.displayName;
76
-
77
- const SheetHeader = ({
78
- className,
79
- ...props
80
- }: React.HTMLAttributes<HTMLDivElement>) => (
81
- <div
82
- className={cn(
83
- "flex flex-col space-y-2 text-center sm:text-left",
84
- className,
85
- )}
86
- {...props}
87
- />
88
- );
89
- SheetHeader.displayName = "SheetHeader";
90
-
91
- const SheetFooter = ({
92
- className,
93
- ...props
94
- }: React.HTMLAttributes<HTMLDivElement>) => (
95
- <div
96
- className={cn(
97
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
98
- className,
99
- )}
100
- {...props}
101
- />
102
- );
103
- SheetFooter.displayName = "SheetFooter";
104
-
105
- const SheetTitle = React.forwardRef<
106
- React.ElementRef<typeof SheetPrimitive.Title>,
107
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
108
- >(({ className, ...props }, ref) => (
109
- <SheetPrimitive.Title
110
- ref={ref}
111
- className={cn("text-lg font-semibold text-foreground", className)}
112
- {...props}
113
- />
114
- ));
115
- SheetTitle.displayName = SheetPrimitive.Title.displayName;
116
-
117
- const SheetDescription = React.forwardRef<
118
- React.ElementRef<typeof SheetPrimitive.Description>,
119
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
120
- >(({ className, ...props }, ref) => (
121
- <SheetPrimitive.Description
122
- ref={ref}
123
- className={cn("text-sm text-muted-foreground", className)}
124
- {...props}
125
- />
126
- ));
127
- SheetDescription.displayName = SheetPrimitive.Description.displayName;
128
-
129
- export {
130
- Sheet,
131
- SheetPortal,
132
- SheetOverlay,
133
- SheetTrigger,
134
- SheetClose,
135
- SheetContent,
136
- SheetHeader,
137
- SheetFooter,
138
- SheetTitle,
139
- SheetDescription,
140
- };