@catalystsoftware/ui 1.0.2 → 1.0.5

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 (157) hide show
  1. package/data/tailwind.config.js +261 -3821
  2. package/dist/components/catalyst-ui/buttons/burger.tsx +207 -0
  3. package/dist/components/catalyst-ui/core/data-display/timeline.tsx +210 -0
  4. package/dist/components/catalyst-ui/core/feedback/alert.tsx +491 -0
  5. package/dist/components/catalyst-ui/core/feedback/spinner-1.tsx +65 -0
  6. package/dist/components/catalyst-ui/core/feedback/toast.tsx +1857 -0
  7. package/dist/components/catalyst-ui/core/navigation/menu.tsx +164 -0
  8. package/dist/components/catalyst-ui/forms/toggle-class.tsx +176 -0
  9. package/dist/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +419 -0
  10. package/dist/components/catalyst-ui/hooks/use-counter.tsx +13 -0
  11. package/dist/components/catalyst-ui/hooks/use-event-listener.tsx +23 -0
  12. package/dist/components/catalyst-ui/hooks/use-export-markdown.tsx +47 -0
  13. package/dist/components/catalyst-ui/hooks/use-focus.tsx +17 -0
  14. package/dist/components/catalyst-ui/hooks/use-interval.tsx +23 -0
  15. package/dist/components/catalyst-ui/hooks/use-is-client.tsx +16 -0
  16. package/dist/components/catalyst-ui/hooks/use-media-query.tsx +19 -0
  17. package/dist/components/catalyst-ui/hooks/use-mobile.tsx +19 -0
  18. package/dist/components/catalyst-ui/hooks/use-resize-observer.tsx +81 -0
  19. package/dist/components/catalyst-ui/hooks/use-timeout.tsx +21 -0
  20. package/dist/components/catalyst-ui/hooks/use-timer.tsx +209 -0
  21. package/dist/components/catalyst-ui/hooks/use-toggle.tsx +12 -0
  22. package/dist/components/catalyst-ui/media/image.tsx +13 -0
  23. package/dist/components/catalyst-ui/overlays/dual-sidebar.tsx +4142 -0
  24. package/dist/components/catalyst-ui/overlays/sidebar-original.tsx +726 -0
  25. package/dist/components/catalyst-ui/primitives/accordion.tsx +250 -0
  26. package/dist/components/catalyst-ui/primitives/alert-dialog.tsx +126 -0
  27. package/dist/components/catalyst-ui/primitives/aspect-ratio.tsx +9 -0
  28. package/dist/components/catalyst-ui/primitives/avatar.tsx +296 -0
  29. package/dist/components/catalyst-ui/primitives/badge.tsx +57 -0
  30. package/dist/components/catalyst-ui/primitives/breadcrumb.tsx +101 -0
  31. package/dist/components/catalyst-ui/primitives/button.tsx +265 -0
  32. package/dist/components/catalyst-ui/primitives/calendar-v4.tsx +208 -0
  33. package/dist/components/catalyst-ui/primitives/calendar.tsx +295 -0
  34. package/dist/components/catalyst-ui/primitives/card.tsx +618 -0
  35. package/dist/components/catalyst-ui/primitives/carousel.tsx +238 -0
  36. package/dist/components/catalyst-ui/primitives/chart.tsx +347 -0
  37. package/dist/components/catalyst-ui/primitives/checkbox.tsx +225 -0
  38. package/dist/components/catalyst-ui/primitives/collapsible.tsx +212 -0
  39. package/dist/components/catalyst-ui/primitives/command.tsx +393 -0
  40. package/dist/components/catalyst-ui/primitives/context-menu.tsx +236 -0
  41. package/dist/components/catalyst-ui/primitives/dialog.tsx +471 -0
  42. package/dist/components/catalyst-ui/primitives/drawer.tsx +761 -0
  43. package/dist/components/catalyst-ui/primitives/dropdown-menu.tsx +290 -0
  44. package/dist/components/catalyst-ui/primitives/empty.tsx +104 -0
  45. package/dist/components/catalyst-ui/primitives/field.tsx +244 -0
  46. package/dist/components/catalyst-ui/primitives/hover-card.tsx +124 -0
  47. package/dist/components/catalyst-ui/primitives/input-otp.tsx +76 -0
  48. package/dist/components/catalyst-ui/primitives/input.tsx +64 -0
  49. package/dist/components/catalyst-ui/primitives/item.tsx +196 -0
  50. package/dist/components/catalyst-ui/primitives/kbd.tsx +75 -0
  51. package/dist/components/catalyst-ui/primitives/label.tsx +24 -0
  52. package/dist/components/catalyst-ui/primitives/navigation-menu.tsx +150 -0
  53. package/dist/components/catalyst-ui/primitives/pagination.tsx +198 -0
  54. package/dist/components/catalyst-ui/primitives/popover.tsx +232 -0
  55. package/dist/components/catalyst-ui/primitives/progress.tsx +34 -0
  56. package/dist/components/catalyst-ui/primitives/radio-group.tsx +43 -0
  57. package/dist/components/catalyst-ui/primitives/resizable.tsx +56 -0
  58. package/dist/components/catalyst-ui/primitives/select.tsx +155 -0
  59. package/dist/components/catalyst-ui/primitives/separator.tsx +74 -0
  60. package/dist/components/catalyst-ui/primitives/sheet.tsx +126 -0
  61. package/dist/components/catalyst-ui/primitives/skeleton.tsx +15 -0
  62. package/dist/components/catalyst-ui/primitives/slider.tsx +27 -0
  63. package/dist/components/catalyst-ui/primitives/switch.tsx +187 -0
  64. package/dist/components/catalyst-ui/primitives/tabs.tsx +335 -0
  65. package/dist/components/catalyst-ui/primitives/textarea.tsx +24 -0
  66. package/dist/components/catalyst-ui/primitives/toggle-group.tsx +55 -0
  67. package/dist/components/catalyst-ui/primitives/toggle.tsx +42 -0
  68. package/dist/components/catalyst-ui/primitives/tooltip.tsx +116 -0
  69. package/dist/components/catalyst-ui/utils/basic-auth.tsx +40 -0
  70. package/dist/components/catalyst-ui/utils/context-storage.tsx +19 -0
  71. package/dist/components/catalyst-ui/utils/cors-middleware.tsx +71 -0
  72. package/dist/components/catalyst-ui/utils/deferred-content.tsx +595 -0
  73. package/dist/components/catalyst-ui/utils/honeypot-middleware.tsx +38 -0
  74. package/dist/components/catalyst-ui/utils/incId.tsx +75 -0
  75. package/dist/components/catalyst-ui/utils/jwk-auth.tsx +36 -0
  76. package/dist/components/catalyst-ui/utils/request-id.tsx +14 -0
  77. package/dist/components/catalyst-ui/utils/secure-headers.tsx +37 -0
  78. package/dist/components/catalyst-ui/utils/server-timing.tsx +23 -0
  79. package/dist/components/catalyst-ui/utils/utils.ts +43 -0
  80. package/dist/components/catalyst-ui/utils/with-cookie.tsx +43 -0
  81. package/dist/components/catalyst-ui/x/accordian-x.tsx +428 -0
  82. package/dist/components/catalyst-ui/x/alert-x.tsx +413 -0
  83. package/dist/components/catalyst-ui/x/animated-text-x.tsx +2242 -0
  84. package/dist/components/catalyst-ui/x/avatar-x.tsx +515 -0
  85. package/dist/components/catalyst-ui/x/badge-x.tsx +670 -0
  86. package/dist/components/catalyst-ui/x/button-X.tsx +2857 -0
  87. package/dist/components/catalyst-ui/x/button-group-x.tsx +847 -0
  88. package/dist/components/catalyst-ui/x/calendar-x.tsx +1910 -0
  89. package/dist/components/catalyst-ui/x/card-x.tsx +2597 -0
  90. package/dist/components/catalyst-ui/x/checkbox-x.tsx +656 -0
  91. package/dist/components/catalyst-ui/x/collapsible-x.tsx +1360 -0
  92. package/dist/components/catalyst-ui/x/combobox-x.tsx +911 -0
  93. package/dist/components/catalyst-ui/x/data-table-x.tsx +1753 -0
  94. package/dist/components/catalyst-ui/x/date-picker-x.tsx +648 -0
  95. package/dist/components/catalyst-ui/x/dialog-x.tsx +659 -0
  96. package/dist/components/catalyst-ui/x/dropdown-menu-x.tsx +612 -0
  97. package/dist/components/catalyst-ui/x/hover-card-x.tsx +375 -0
  98. package/dist/components/catalyst-ui/x/icon-x.tsx +840 -0
  99. package/dist/components/catalyst-ui/x/input-mask-x.tsx +981 -0
  100. package/dist/components/catalyst-ui/x/input-otp-x.tsx +659 -0
  101. package/dist/components/catalyst-ui/x/loader-x.tsx +1757 -0
  102. package/dist/components/catalyst-ui/x/pagination-x.tsx +622 -0
  103. package/dist/components/catalyst-ui/x/popover-x.tsx +744 -0
  104. package/dist/components/catalyst-ui/x/radio-group-x.tsx +499 -0
  105. package/dist/components/catalyst-ui/x/select-x.tsx +1127 -0
  106. package/dist/components/catalyst-ui/x/sheet-x.tsx +668 -0
  107. package/dist/components/catalyst-ui/x/switch-x.tsx +681 -0
  108. package/dist/components/catalyst-ui/x/table-x.tsx +574 -0
  109. package/dist/components/catalyst-ui/x/tabs-x.tsx +839 -0
  110. package/dist/components/catalyst-ui/x/textarea-x.tsx +1263 -0
  111. package/dist/components/catalyst-ui/x/tooltip-x.tsx +396 -0
  112. package/dist/components/catalyst-ui/x/tracker-x.tsx +560 -0
  113. package/dist/data/bg-data.tsx +901 -0
  114. package/dist/data/buttons-data.tsx +2327 -0
  115. package/dist/data/charts-data.tsx +102 -0
  116. package/dist/data/chat-data.tsx +83 -0
  117. package/dist/data/code-data.tsx +1040 -0
  118. package/dist/data/comboboxes-data.tsx +1843 -0
  119. package/dist/data/command-data.tsx +1381 -0
  120. package/dist/data/core-data.tsx +15953 -0
  121. package/dist/data/crm-data.tsx +47 -0
  122. package/dist/data/data.tsx +159 -0
  123. package/dist/data/date-and-time-data.tsx +554 -0
  124. package/dist/data/dependencies.tsx +7 -0
  125. package/dist/data/ecommerce-data.tsx +1387 -0
  126. package/dist/data/forms-data.tsx +7890 -0
  127. package/dist/data/hooks-data.tsx +5487 -0
  128. package/dist/data/index.ts +34 -0
  129. package/dist/data/inputs-data.tsx +557 -0
  130. package/dist/data/interactive-data.tsx +5394 -0
  131. package/dist/data/lofi-data.tsx +18295 -0
  132. package/dist/data/marketing-data.tsx +2546 -0
  133. package/dist/data/media-data.tsx +1510 -0
  134. package/dist/data/motion-data.tsx +5801 -0
  135. package/dist/data/overlay-data.tsx +4136 -0
  136. package/dist/data/pdf-data.tsx +124 -0
  137. package/dist/data/pos-data.tsx +213 -0
  138. package/dist/data/postcss.config.js +6 -0
  139. package/dist/data/primitive-data.tsx +5170 -0
  140. package/dist/data/prompt-data.tsx +1226 -0
  141. package/dist/data/requiredLibs.ts +4 -0
  142. package/dist/data/sandbox-data.tsx +1 -0
  143. package/dist/data/sidebars-data.tsx +5421 -0
  144. package/dist/data/stacks-data.tsx +32 -0
  145. package/dist/data/table-data.tsx +706 -0
  146. package/dist/data/tailwind.config.js +270 -0
  147. package/dist/data/tailwind.config.ngin.js +3830 -0
  148. package/dist/data/tailwind.css +431 -0
  149. package/dist/data/tools-data.tsx +6910 -0
  150. package/dist/data/typography-data.tsx +2050 -0
  151. package/dist/data/utils-data.tsx +6500 -0
  152. package/dist/data/x-data.tsx +1171 -0
  153. package/dist/data.tsx +159 -0
  154. package/package.json +1 -1
  155. package/dist/index.d.ts +0 -3
  156. package/dist/index.d.ts.map +0 -1
  157. package/dist/index.js.map +0 -362
@@ -0,0 +1,290 @@
1
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
2
+ import { cn } from "~/components/catalyst-ui";
3
+ import React from "react"
4
+ import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
5
+
6
+ // @dev app/components/catalyst-ui/data/primitive-data.tsx:3492
7
+ function DropdownMenu({
8
+ ...props
9
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
10
+ return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
11
+ }
12
+
13
+ function DropdownMenuPortal({
14
+ ...props
15
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
16
+ return (
17
+ <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
18
+ )
19
+ }
20
+
21
+ function DropdownMenuTrigger({
22
+ ...props
23
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
24
+ return (
25
+ <DropdownMenuPrimitive.Trigger
26
+ data-slot="dropdown-menu-trigger"
27
+ {...props}
28
+ />
29
+ )
30
+ }
31
+
32
+ function DropdownMenuContent({
33
+ className,
34
+ sideOffset = 4,
35
+ ...props
36
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
37
+ return (
38
+ <DropdownMenuPrimitive.Portal>
39
+ <DropdownMenuPrimitive.Content
40
+ data-slot="dropdown-menu-content"
41
+ sideOffset={sideOffset}
42
+ className={cn(
43
+ "bg-popover text-popover-foreground 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
44
+ className
45
+ )}
46
+ {...props}
47
+ />
48
+ </DropdownMenuPrimitive.Portal>
49
+ )
50
+ }
51
+
52
+ function DropdownMenuGroup({
53
+ ...props
54
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
55
+ return (
56
+ <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
57
+ )
58
+ }
59
+
60
+ function DropdownMenuItem({
61
+ className,
62
+ inset,
63
+ variant = "default",
64
+ ...props
65
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
66
+ inset?: boolean
67
+ variant?: "default" | "destructive"
68
+ }) {
69
+ return (
70
+ <DropdownMenuPrimitive.Item
71
+ data-slot="dropdown-menu-item"
72
+ data-inset={inset}
73
+ data-variant={variant}
74
+ className={cn(
75
+ "focus:bg-accent focus:text-accent-foreground cursor-pointer data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
76
+ className
77
+ )}
78
+ {...props}
79
+ />
80
+ )
81
+ }
82
+
83
+ function DropdownMenuAnchor({
84
+ className,
85
+ children,
86
+ to,
87
+ variant = "default",
88
+ newTab = true,
89
+ ...props
90
+ }: {
91
+ className?: string
92
+ children: React.ReactNode
93
+ to: string
94
+ newTab?: boolean
95
+ }) {
96
+ const anchorProps = newTab ? {
97
+ target: "_blank",
98
+ rel: "noopener noreferrer"
99
+ } : {};
100
+ return (
101
+ <a
102
+ ref={ref}
103
+ href={to}
104
+ {...anchorProps}
105
+ className={cn(className)}
106
+ {...props}
107
+ >
108
+ <DropdownMenuItem variant={variant}>
109
+ <span className="flex-1 truncate">{children}</span>
110
+ </DropdownMenuItem>
111
+ </a>
112
+ );
113
+ }
114
+
115
+
116
+ function DropdownMenuCheckboxItem({
117
+ className,
118
+ children,
119
+ checked,
120
+ ...props
121
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
122
+ return (
123
+ <DropdownMenuPrimitive.CheckboxItem
124
+ data-slot="dropdown-menu-checkbox-item"
125
+ className={cn(
126
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
127
+ className
128
+ )}
129
+ checked={checked}
130
+ {...props}
131
+ >
132
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
133
+ <DropdownMenuPrimitive.ItemIndicator>
134
+ <CheckIcon className="size-4" />
135
+ </DropdownMenuPrimitive.ItemIndicator>
136
+ </span>
137
+ {children}
138
+ </DropdownMenuPrimitive.CheckboxItem>
139
+ )
140
+ }
141
+
142
+ function DropdownMenuRadioGroup({
143
+ ...props
144
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
145
+ return (
146
+ <DropdownMenuPrimitive.RadioGroup
147
+ data-slot="dropdown-menu-radio-group"
148
+ {...props}
149
+ />
150
+ )
151
+ }
152
+
153
+ function DropdownMenuRadioItem({
154
+ className,
155
+ children,
156
+ ...props
157
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
158
+ return (
159
+ <DropdownMenuPrimitive.RadioItem
160
+ data-slot="dropdown-menu-radio-item"
161
+ className={cn(
162
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
163
+ className
164
+ )}
165
+ {...props}
166
+ >
167
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
168
+ <DropdownMenuPrimitive.ItemIndicator>
169
+ <CircleIcon className="size-2 fill-current" />
170
+ </DropdownMenuPrimitive.ItemIndicator>
171
+ </span>
172
+ {children}
173
+ </DropdownMenuPrimitive.RadioItem>
174
+ )
175
+ }
176
+
177
+ function DropdownMenuLabel({
178
+ className,
179
+ inset,
180
+ ...props
181
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
182
+ inset?: boolean
183
+ }) {
184
+ return (
185
+ <DropdownMenuPrimitive.Label
186
+ data-slot="dropdown-menu-label"
187
+ data-inset={inset}
188
+ className={cn(
189
+ "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
190
+ className
191
+ )}
192
+ {...props}
193
+ />
194
+ )
195
+ }
196
+
197
+ function DropdownMenuSeparator({
198
+ className,
199
+ ...props
200
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
201
+ return (
202
+ <DropdownMenuPrimitive.Separator
203
+ data-slot="dropdown-menu-separator"
204
+ className={cn("bg-border -mx-1 my-1 h-px", className)}
205
+ {...props}
206
+ />
207
+ )
208
+ }
209
+
210
+ function DropdownMenuShortcut({
211
+ className,
212
+ ...props
213
+ }: React.ComponentProps<"span">) {
214
+ return (
215
+ <span
216
+ data-slot="dropdown-menu-shortcut"
217
+ className={cn(
218
+ "text-muted-foreground ml-auto text-xs tracking-widest",
219
+ className
220
+ )}
221
+ {...props}
222
+ />
223
+ )
224
+ }
225
+
226
+ function DropdownMenuSub({
227
+ ...props
228
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
229
+ return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />
230
+ }
231
+
232
+ function DropdownMenuSubTrigger({
233
+ className,
234
+ inset,
235
+ children,
236
+ ...props
237
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
238
+ inset?: boolean
239
+ }) {
240
+ return (
241
+ <DropdownMenuPrimitive.SubTrigger
242
+ data-slot="dropdown-menu-sub-trigger"
243
+ data-inset={inset}
244
+ className={cn(
245
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",
246
+ className
247
+ )}
248
+ {...props}
249
+ >
250
+ {children}
251
+ <ChevronRightIcon className="ml-auto size-4" />
252
+ </DropdownMenuPrimitive.SubTrigger>
253
+ )
254
+ }
255
+
256
+ function DropdownMenuSubContent({
257
+ className,
258
+ ...props
259
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
260
+ return (
261
+ <DropdownMenuPrimitive.SubContent
262
+ data-slot="dropdown-menu-sub-content"
263
+ className={cn(
264
+ "bg-popover text-popover-foreground 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 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
265
+ className
266
+ )}
267
+ {...props}
268
+ />
269
+ )
270
+ }
271
+
272
+
273
+ export {
274
+ DropdownMenu,
275
+ DropdownMenuPortal,
276
+ DropdownMenuTrigger,
277
+ DropdownMenuContent,
278
+ DropdownMenuGroup,
279
+ DropdownMenuLabel,
280
+ DropdownMenuItem,
281
+ DropdownMenuCheckboxItem,
282
+ DropdownMenuRadioGroup,
283
+ DropdownMenuRadioItem,
284
+ DropdownMenuSeparator,
285
+ DropdownMenuShortcut,
286
+ DropdownMenuSub,
287
+ DropdownMenuSubTrigger,
288
+ DropdownMenuSubContent,
289
+ DropdownMenuAnchor,
290
+ }
@@ -0,0 +1,104 @@
1
+ import { cva, type VariantProps } from "class-variance-authority"
2
+
3
+ import { cn } from "~/components/catalyst-ui"
4
+
5
+ function Empty({ className, ...props }: React.ComponentProps<"div">) {
6
+ return (
7
+ <div
8
+ data-slot="empty"
9
+ className={cn(
10
+ "flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12",
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(
23
+ "flex max-w-sm flex-col items-center gap-2 text-center",
24
+ className
25
+ )}
26
+ {...props}
27
+ />
28
+ )
29
+ }
30
+
31
+ const emptyMediaVariants = cva(
32
+ "flex shrink-0 items-center justify-center mb-2 [&_svg]:pointer-events-none [&_svg]:shrink-0",
33
+ {
34
+ variants: {
35
+ variant: {
36
+ default: "bg-transparent",
37
+ icon: "bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6",
38
+ },
39
+ },
40
+ defaultVariants: {
41
+ variant: "default",
42
+ },
43
+ }
44
+ )
45
+
46
+ function EmptyMedia({
47
+ className,
48
+ variant = "default",
49
+ ...props
50
+ }: React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>) {
51
+ return (
52
+ <div
53
+ data-slot="empty-icon"
54
+ data-variant={variant}
55
+ className={cn(emptyMediaVariants({ variant, className }))}
56
+ {...props}
57
+ />
58
+ )
59
+ }
60
+
61
+ function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) {
62
+ return (
63
+ <div
64
+ data-slot="empty-title"
65
+ className={cn("text-lg font-medium tracking-tight", className)}
66
+ {...props}
67
+ />
68
+ )
69
+ }
70
+
71
+ function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) {
72
+ return (
73
+ <div
74
+ data-slot="empty-description"
75
+ className={cn(
76
+ "text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4",
77
+ className
78
+ )}
79
+ {...props}
80
+ />
81
+ )
82
+ }
83
+
84
+ function EmptyContent({ className, ...props }: React.ComponentProps<"div">) {
85
+ return (
86
+ <div
87
+ data-slot="empty-content"
88
+ className={cn(
89
+ "flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",
90
+ className
91
+ )}
92
+ {...props}
93
+ />
94
+ )
95
+ }
96
+
97
+ export {
98
+ Empty,
99
+ EmptyHeader,
100
+ EmptyTitle,
101
+ EmptyDescription,
102
+ EmptyContent,
103
+ EmptyMedia,
104
+ }
@@ -0,0 +1,244 @@
1
+ import { useMemo } from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+ import { Label, cn } from "~/components/catalyst-ui"
4
+ import { Separator } from "~/components/catalyst-ui"
5
+
6
+ function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
7
+ return (
8
+ <fieldset
9
+ data-slot="field-set"
10
+ className={cn(
11
+ "flex flex-col gap-6",
12
+ "[&:has(>_[data-slot=checkbox-group])]:gap-3 [&:has(>_[data-slot=radio-group])]:gap-3",
13
+ className
14
+ )}
15
+ {...props}
16
+ />
17
+ )
18
+ }
19
+
20
+ function FieldLegend({
21
+ className,
22
+ variant = "legend",
23
+ ...props
24
+ }: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) {
25
+ return (
26
+ <legend
27
+ data-slot="field-legend"
28
+ data-variant={variant}
29
+ className={cn(
30
+ "mb-3 font-medium",
31
+ variant === "legend" && "text-base",
32
+ variant === "label" && "text-sm",
33
+ className
34
+ )}
35
+ {...props}
36
+ />
37
+ )
38
+ }
39
+
40
+ function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
41
+ return (
42
+ <div
43
+ data-slot="field-group"
44
+ className={cn(
45
+ "group/field-group flex w-full flex-col gap-7 [&>[data-slot=checkbox-group]]:gap-3 [&>[data-slot=field-group]]:gap-4",
46
+ className
47
+ )}
48
+ {...props}
49
+ />
50
+ )
51
+ }
52
+
53
+ const fieldVariants = cva(
54
+ "group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
55
+ {
56
+ variants: {
57
+ orientation: {
58
+ vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
59
+ horizontal: [
60
+ "flex-row items-center",
61
+ "[&>[data-slot=field-label]]:flex-auto",
62
+ "[&:has(>_[data-slot=field-content])]:items-start [&:has(>_[data-slot=field-content])_[role=checkbox]]:mt-px [&:has(>_[data-slot=field-content])_[role=radio]]:mt-px",
63
+ ],
64
+ responsive: [
65
+ "flex-col [&>*]:w-full [&>.sr-only]:w-auto md:flex-row md:items-center md:[&>*]:w-auto",
66
+ "md:[&>[data-slot=field-label]]:flex-auto",
67
+ "md:[&:has(>_[data-slot=field-content])]:items-start md:[&:has(>_[data-slot=field-content])_[role=checkbox]]:mt-px md:[&:has(>_[data-slot=field-content])_[role=radio]]:mt-px",
68
+ ],
69
+ },
70
+ },
71
+ defaultVariants: {
72
+ orientation: "vertical",
73
+ },
74
+ }
75
+ )
76
+
77
+ function Field({
78
+ className,
79
+ orientation = "vertical",
80
+ ...props
81
+ }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>) {
82
+ return (
83
+ <div
84
+ role="group"
85
+ data-slot="field"
86
+ data-orientation={orientation}
87
+ className={cn(fieldVariants({ orientation }), className)}
88
+ {...props}
89
+ />
90
+ )
91
+ }
92
+
93
+ function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
94
+ return (
95
+ <div
96
+ data-slot="field-content"
97
+ className={cn(
98
+ "group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
99
+ className
100
+ )}
101
+ {...props}
102
+ />
103
+ )
104
+ }
105
+
106
+ function FieldLabel({
107
+ className,
108
+ ...props
109
+ }: React.ComponentProps<typeof Label>) {
110
+ return (
111
+ <Label
112
+ data-slot="field-label"
113
+ className={cn(
114
+ "group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
115
+ "[&:has(>_[data-slot=field])]:w-full [&:has(>_[data-slot=field])]:flex-col [&:has(>_[data-slot=field])]:rounded-md [&:has(>_[data-slot=field])]:border [&>*[data-slot=field]]:p-4",
116
+ "[&:has([data-state=checked])]:bg-primary/5 [&:has([data-state=checked])]:border-primary dark:[&:has([data-state=checked])]:bg-primary/10",
117
+ className
118
+ )}
119
+ {...props}
120
+ />
121
+ )
122
+ }
123
+
124
+ function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {
125
+ return (
126
+ <div
127
+ data-slot="field-label"
128
+ className={cn(
129
+ "flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
130
+ className
131
+ )}
132
+ {...props}
133
+ />
134
+ )
135
+ }
136
+
137
+ function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
138
+ return (
139
+ <p
140
+ data-slot="field-description"
141
+ className={cn(
142
+ "text-muted-foreground text-sm leading-normal font-normal [.group:has([data-orientation=horizontal])_&]:text-balance",
143
+ "last:mt-0 [&:nth-last-child(2)]:-mt-1 [[data-variant=legend]_+_&]:-mt-1.5",
144
+ "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
145
+ className
146
+ )}
147
+ {...props}
148
+ />
149
+ )
150
+ }
151
+
152
+ function FieldSeparator({
153
+ children,
154
+ className,
155
+ ...props
156
+ }: React.ComponentProps<"div"> & {
157
+ children?: React.ReactNode
158
+ }) {
159
+ return (
160
+ <div
161
+ data-slot="field-separator"
162
+ data-content={!!children}
163
+ className={cn(
164
+ "relative -my-2 h-5 text-sm [.group-\\[data-variant\\=outline\\]\\/field-group_&]:-mb-2",
165
+ className
166
+ )}
167
+ {...props}
168
+ >
169
+ <Separator className="absolute inset-0 top-1/2" />
170
+ {children && (
171
+ <span
172
+ className="bg-background text-muted-foreground relative mx-auto block w-fit px-2"
173
+ data-slot="field-separator-content"
174
+ >
175
+ {children}
176
+ </span>
177
+ )}
178
+ </div>
179
+ )
180
+ }
181
+
182
+ function FieldError({
183
+ className,
184
+ children,
185
+ errors,
186
+ ...props
187
+ }: React.ComponentProps<"div"> & {
188
+ errors?: Array<{ message?: string } | undefined>
189
+ }) {
190
+ const content = useMemo(() => {
191
+ if (children) {
192
+ return children
193
+ }
194
+
195
+ if (!errors?.length) {
196
+ return null
197
+ }
198
+
199
+ const uniqueErrors = [
200
+ ...new Map(errors.map((error) => [error?.message, error])).values(),
201
+ ]
202
+
203
+ if (uniqueErrors?.length == 1) {
204
+ return uniqueErrors[0]?.message
205
+ }
206
+
207
+ return (
208
+ <ul className="ml-4 flex list-disc flex-col gap-1">
209
+ {uniqueErrors.map(
210
+ (error, index) =>
211
+ error?.message && <li key={index}>{error.message}</li>
212
+ )}
213
+ </ul>
214
+ )
215
+ }, [children, errors])
216
+
217
+ if (!content) {
218
+ return null
219
+ }
220
+
221
+ return (
222
+ <div
223
+ role="alert"
224
+ data-slot="field-error"
225
+ className={cn("text-destructive text-sm font-normal", className)}
226
+ {...props}
227
+ >
228
+ {content}
229
+ </div>
230
+ )
231
+ }
232
+
233
+ export {
234
+ Field,
235
+ FieldLabel,
236
+ FieldDescription,
237
+ FieldError,
238
+ FieldGroup,
239
+ FieldLegend,
240
+ FieldSeparator,
241
+ FieldSet,
242
+ FieldContent,
243
+ FieldTitle,
244
+ }