@catalystsoftware/ui 1.0.5 → 1.0.7

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 (155) hide show
  1. package/dist/data/data.tsx +29 -29
  2. package/dist/data/tailwind.config.js +3821 -261
  3. package/dist/data.tsx +29 -29
  4. package/package.json +4 -3
  5. package/components/catalyst-ui/buttons/burger.tsx +0 -207
  6. package/components/catalyst-ui/core/data-display/timeline.tsx +0 -210
  7. package/components/catalyst-ui/core/feedback/alert.tsx +0 -491
  8. package/components/catalyst-ui/core/feedback/spinner-1.tsx +0 -65
  9. package/components/catalyst-ui/core/feedback/toast.tsx +0 -1857
  10. package/components/catalyst-ui/core/navigation/menu.tsx +0 -164
  11. package/components/catalyst-ui/forms/toggle-class.tsx +0 -176
  12. package/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +0 -419
  13. package/components/catalyst-ui/hooks/use-counter.tsx +0 -13
  14. package/components/catalyst-ui/hooks/use-event-listener.tsx +0 -23
  15. package/components/catalyst-ui/hooks/use-export-markdown.tsx +0 -47
  16. package/components/catalyst-ui/hooks/use-focus.tsx +0 -17
  17. package/components/catalyst-ui/hooks/use-interval.tsx +0 -23
  18. package/components/catalyst-ui/hooks/use-is-client.tsx +0 -16
  19. package/components/catalyst-ui/hooks/use-media-query.tsx +0 -19
  20. package/components/catalyst-ui/hooks/use-mobile.tsx +0 -19
  21. package/components/catalyst-ui/hooks/use-resize-observer.tsx +0 -81
  22. package/components/catalyst-ui/hooks/use-timeout.tsx +0 -21
  23. package/components/catalyst-ui/hooks/use-timer.tsx +0 -209
  24. package/components/catalyst-ui/hooks/use-toggle.tsx +0 -12
  25. package/components/catalyst-ui/media/image.tsx +0 -13
  26. package/components/catalyst-ui/overlays/dual-sidebar.tsx +0 -4142
  27. package/components/catalyst-ui/overlays/sidebar-original.tsx +0 -726
  28. package/components/catalyst-ui/primitives/accordion.tsx +0 -250
  29. package/components/catalyst-ui/primitives/alert-dialog.tsx +0 -126
  30. package/components/catalyst-ui/primitives/aspect-ratio.tsx +0 -9
  31. package/components/catalyst-ui/primitives/avatar.tsx +0 -296
  32. package/components/catalyst-ui/primitives/badge.tsx +0 -57
  33. package/components/catalyst-ui/primitives/breadcrumb.tsx +0 -101
  34. package/components/catalyst-ui/primitives/button.tsx +0 -265
  35. package/components/catalyst-ui/primitives/calendar-v4.tsx +0 -208
  36. package/components/catalyst-ui/primitives/calendar.tsx +0 -295
  37. package/components/catalyst-ui/primitives/card.tsx +0 -618
  38. package/components/catalyst-ui/primitives/carousel.tsx +0 -238
  39. package/components/catalyst-ui/primitives/chart.tsx +0 -347
  40. package/components/catalyst-ui/primitives/checkbox.tsx +0 -225
  41. package/components/catalyst-ui/primitives/collapsible.tsx +0 -212
  42. package/components/catalyst-ui/primitives/command.tsx +0 -393
  43. package/components/catalyst-ui/primitives/context-menu.tsx +0 -236
  44. package/components/catalyst-ui/primitives/dialog.tsx +0 -471
  45. package/components/catalyst-ui/primitives/drawer.tsx +0 -761
  46. package/components/catalyst-ui/primitives/dropdown-menu.tsx +0 -290
  47. package/components/catalyst-ui/primitives/empty.tsx +0 -104
  48. package/components/catalyst-ui/primitives/field.tsx +0 -244
  49. package/components/catalyst-ui/primitives/hover-card.tsx +0 -124
  50. package/components/catalyst-ui/primitives/input-otp.tsx +0 -76
  51. package/components/catalyst-ui/primitives/input.tsx +0 -64
  52. package/components/catalyst-ui/primitives/item.tsx +0 -196
  53. package/components/catalyst-ui/primitives/kbd.tsx +0 -75
  54. package/components/catalyst-ui/primitives/label.tsx +0 -24
  55. package/components/catalyst-ui/primitives/navigation-menu.tsx +0 -150
  56. package/components/catalyst-ui/primitives/pagination.tsx +0 -198
  57. package/components/catalyst-ui/primitives/popover.tsx +0 -232
  58. package/components/catalyst-ui/primitives/progress.tsx +0 -34
  59. package/components/catalyst-ui/primitives/radio-group.tsx +0 -43
  60. package/components/catalyst-ui/primitives/resizable.tsx +0 -56
  61. package/components/catalyst-ui/primitives/select.tsx +0 -155
  62. package/components/catalyst-ui/primitives/separator.tsx +0 -74
  63. package/components/catalyst-ui/primitives/sheet.tsx +0 -126
  64. package/components/catalyst-ui/primitives/skeleton.tsx +0 -15
  65. package/components/catalyst-ui/primitives/slider.tsx +0 -27
  66. package/components/catalyst-ui/primitives/switch.tsx +0 -187
  67. package/components/catalyst-ui/primitives/tabs.tsx +0 -335
  68. package/components/catalyst-ui/primitives/textarea.tsx +0 -24
  69. package/components/catalyst-ui/primitives/toggle-group.tsx +0 -55
  70. package/components/catalyst-ui/primitives/toggle.tsx +0 -42
  71. package/components/catalyst-ui/primitives/tooltip.tsx +0 -116
  72. package/components/catalyst-ui/utils/basic-auth.tsx +0 -40
  73. package/components/catalyst-ui/utils/context-storage.tsx +0 -19
  74. package/components/catalyst-ui/utils/cors-middleware.tsx +0 -71
  75. package/components/catalyst-ui/utils/deferred-content.tsx +0 -595
  76. package/components/catalyst-ui/utils/honeypot-middleware.tsx +0 -38
  77. package/components/catalyst-ui/utils/incId.tsx +0 -75
  78. package/components/catalyst-ui/utils/jwk-auth.tsx +0 -36
  79. package/components/catalyst-ui/utils/request-id.tsx +0 -14
  80. package/components/catalyst-ui/utils/secure-headers.tsx +0 -37
  81. package/components/catalyst-ui/utils/server-timing.tsx +0 -23
  82. package/components/catalyst-ui/utils/utils.ts +0 -43
  83. package/components/catalyst-ui/utils/with-cookie.tsx +0 -43
  84. package/components/catalyst-ui/x/accordian-x.tsx +0 -428
  85. package/components/catalyst-ui/x/alert-x.tsx +0 -413
  86. package/components/catalyst-ui/x/animated-text-x.tsx +0 -2242
  87. package/components/catalyst-ui/x/avatar-x.tsx +0 -515
  88. package/components/catalyst-ui/x/badge-x.tsx +0 -670
  89. package/components/catalyst-ui/x/button-X.tsx +0 -2857
  90. package/components/catalyst-ui/x/button-group-x.tsx +0 -847
  91. package/components/catalyst-ui/x/calendar-x.tsx +0 -1910
  92. package/components/catalyst-ui/x/card-x.tsx +0 -2597
  93. package/components/catalyst-ui/x/checkbox-x.tsx +0 -656
  94. package/components/catalyst-ui/x/collapsible-x.tsx +0 -1360
  95. package/components/catalyst-ui/x/combobox-x.tsx +0 -911
  96. package/components/catalyst-ui/x/data-table-x.tsx +0 -1753
  97. package/components/catalyst-ui/x/date-picker-x.tsx +0 -648
  98. package/components/catalyst-ui/x/dialog-x.tsx +0 -659
  99. package/components/catalyst-ui/x/dropdown-menu-x.tsx +0 -612
  100. package/components/catalyst-ui/x/hover-card-x.tsx +0 -375
  101. package/components/catalyst-ui/x/icon-x.tsx +0 -840
  102. package/components/catalyst-ui/x/input-mask-x.tsx +0 -981
  103. package/components/catalyst-ui/x/input-otp-x.tsx +0 -659
  104. package/components/catalyst-ui/x/loader-x.tsx +0 -1757
  105. package/components/catalyst-ui/x/pagination-x.tsx +0 -622
  106. package/components/catalyst-ui/x/popover-x.tsx +0 -744
  107. package/components/catalyst-ui/x/radio-group-x.tsx +0 -499
  108. package/components/catalyst-ui/x/select-x.tsx +0 -1127
  109. package/components/catalyst-ui/x/sheet-x.tsx +0 -668
  110. package/components/catalyst-ui/x/switch-x.tsx +0 -681
  111. package/components/catalyst-ui/x/table-x.tsx +0 -574
  112. package/components/catalyst-ui/x/tabs-x.tsx +0 -839
  113. package/components/catalyst-ui/x/textarea-x.tsx +0 -1263
  114. package/components/catalyst-ui/x/tooltip-x.tsx +0 -396
  115. package/components/catalyst-ui/x/tracker-x.tsx +0 -560
  116. package/data/bg-data.tsx +0 -901
  117. package/data/buttons-data.tsx +0 -2327
  118. package/data/charts-data.tsx +0 -102
  119. package/data/chat-data.tsx +0 -83
  120. package/data/code-data.tsx +0 -1040
  121. package/data/comboboxes-data.tsx +0 -1843
  122. package/data/command-data.tsx +0 -1381
  123. package/data/core-data.tsx +0 -15953
  124. package/data/crm-data.tsx +0 -47
  125. package/data/data.tsx +0 -159
  126. package/data/date-and-time-data.tsx +0 -554
  127. package/data/dependencies.tsx +0 -7
  128. package/data/ecommerce-data.tsx +0 -1387
  129. package/data/forms-data.tsx +0 -7890
  130. package/data/hooks-data.tsx +0 -5487
  131. package/data/index.ts +0 -34
  132. package/data/inputs-data.tsx +0 -557
  133. package/data/interactive-data.tsx +0 -5394
  134. package/data/lofi-data.tsx +0 -18295
  135. package/data/marketing-data.tsx +0 -2546
  136. package/data/media-data.tsx +0 -1510
  137. package/data/motion-data.tsx +0 -5801
  138. package/data/overlay-data.tsx +0 -4136
  139. package/data/pdf-data.tsx +0 -124
  140. package/data/pos-data.tsx +0 -213
  141. package/data/postcss.config.js +0 -6
  142. package/data/primitive-data.tsx +0 -5170
  143. package/data/prompt-data.tsx +0 -1226
  144. package/data/requiredLibs.ts +0 -4
  145. package/data/sandbox-data.tsx +0 -1
  146. package/data/sidebars-data.tsx +0 -5421
  147. package/data/stacks-data.tsx +0 -32
  148. package/data/table-data.tsx +0 -706
  149. package/data/tailwind.config.js +0 -270
  150. package/data/tailwind.config.ngin.js +0 -3830
  151. package/data/tailwind.css +0 -431
  152. package/data/tools-data.tsx +0 -6910
  153. package/data/typography-data.tsx +0 -2050
  154. package/data/utils-data.tsx +0 -6500
  155. package/data/x-data.tsx +0 -1171
@@ -1,290 +0,0 @@
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
- }
@@ -1,104 +0,0 @@
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
- }
@@ -1,244 +0,0 @@
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
- }