@majapisoftwares/ui 6.2.2 → 6.4.0

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 (81) hide show
  1. package/AGENTS.md +27 -27
  2. package/README.md +79 -79
  3. package/THIRD_PARTY_NOTICES.md +39 -39
  4. package/components.json +25 -25
  5. package/docs/MIGRATION-0.2.md +20 -20
  6. package/docs/MIGRATION-6.0.md +33 -33
  7. package/docs/NEXT-STARTER-VALIDATION.md +14 -14
  8. package/docs/STANDARDS.md +65 -43
  9. package/docs/VALIDATION.md +11 -11
  10. package/docs/VERSIONING.md +32 -28
  11. package/docs/validation/preference-titles.md +22 -22
  12. package/package.json +91 -88
  13. package/scripts/check-standards.mjs +41 -41
  14. package/src/components/ui/accordion.tsx +82 -82
  15. package/src/components/ui/alert-dialog.tsx +187 -187
  16. package/src/components/ui/alert.tsx +77 -77
  17. package/src/components/ui/attachment.tsx +209 -0
  18. package/src/components/ui/avatar.tsx +108 -108
  19. package/src/components/ui/badge.tsx +55 -55
  20. package/src/components/ui/breadcrumb.tsx +125 -125
  21. package/src/components/ui/bubble.tsx +129 -0
  22. package/src/components/ui/button-group.tsx +89 -89
  23. package/src/components/ui/button.tsx +59 -59
  24. package/src/components/ui/card.tsx +101 -101
  25. package/src/components/ui/checkbox.tsx +27 -27
  26. package/src/components/ui/collapsible.tsx +21 -21
  27. package/src/components/ui/context-menu.tsx +271 -271
  28. package/src/components/ui/dialog.tsx +161 -161
  29. package/src/components/ui/dropdown-menu.tsx +271 -271
  30. package/src/components/ui/empty.tsx +105 -105
  31. package/src/components/ui/field.tsx +238 -238
  32. package/src/components/ui/hover-card.tsx +50 -50
  33. package/src/components/ui/input-group.tsx +155 -155
  34. package/src/components/ui/input.tsx +21 -21
  35. package/src/components/ui/item.tsx +203 -0
  36. package/src/components/ui/kbd.tsx +28 -28
  37. package/src/components/ui/label.tsx +19 -19
  38. package/src/components/ui/message-scroller.tsx +166 -0
  39. package/src/components/ui/message.tsx +93 -0
  40. package/src/components/ui/orb.css +1002 -1002
  41. package/src/components/ui/orb.tsx +752 -752
  42. package/src/components/ui/popover.tsx +89 -89
  43. package/src/components/ui/progress.tsx +82 -82
  44. package/src/components/ui/radio-group.tsx +37 -37
  45. package/src/components/ui/scroll-area.tsx +54 -54
  46. package/src/components/ui/select.tsx +204 -204
  47. package/src/components/ui/separator.tsx +24 -24
  48. package/src/components/ui/sheet.tsx +139 -139
  49. package/src/components/ui/sidebar.tsx +1048 -1044
  50. package/src/components/ui/skeleton.tsx +15 -15
  51. package/src/components/ui/slider.tsx +53 -53
  52. package/src/components/ui/sonner.tsx +44 -44
  53. package/src/components/ui/spinner.tsx +32 -32
  54. package/src/components/ui/switch.tsx +31 -31
  55. package/src/components/ui/table.tsx +121 -121
  56. package/src/components/ui/tabs.tsx +81 -81
  57. package/src/components/ui/textarea.tsx +19 -19
  58. package/src/components/ui/toggle-group.tsx +89 -89
  59. package/src/components/ui/toggle.tsx +44 -44
  60. package/src/components/ui/tooltip.tsx +65 -65
  61. package/src/components/ui/trace.tsx +163 -0
  62. package/src/hooks/use-mobile.ts +20 -20
  63. package/src/hooks/use-streamed-text.ts +64 -0
  64. package/src/lib/i18n.tsx +151 -109
  65. package/src/lib/utils.ts +1 -1
  66. package/src/patterns/app-shell.tsx +237 -177
  67. package/src/patterns/chat-markdown.tsx +72 -0
  68. package/src/patterns/chat-trace.tsx +200 -0
  69. package/src/patterns/chat.tsx +317 -0
  70. package/src/patterns/data-table.tsx +2492 -2486
  71. package/src/patterns/filter-tabs.tsx +53 -53
  72. package/src/patterns/majapi-logo.tsx +32 -32
  73. package/src/patterns/page-header.tsx +62 -62
  74. package/src/patterns/prompt-input.tsx +364 -0
  75. package/src/patterns/status-badge.tsx +24 -24
  76. package/src/patterns/user-menu.tsx +218 -218
  77. package/src/patterns/workspace-switcher.tsx +176 -176
  78. package/src/styles.css +170 -165
  79. package/src/templates/admin-dashboard.tsx +44 -44
  80. package/src/templates/auth-layout.tsx +30 -30
  81. package/src/templates/signup-form.tsx +177 -177
@@ -1,50 +1,50 @@
1
- "use client";
2
-
3
- import { PreviewCard as PreviewCardPrimitive } from "@base-ui/react/preview-card";
4
- import { cn } from "cn";
5
-
6
- function HoverCard({ ...props }: PreviewCardPrimitive.Root.Props) {
7
- return <PreviewCardPrimitive.Root data-slot="hover-card" {...props} />;
8
- }
9
-
10
- function HoverCardTrigger({ ...props }: PreviewCardPrimitive.Trigger.Props) {
11
- return (
12
- <PreviewCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
13
- );
14
- }
15
-
16
- function HoverCardContent({
17
- className,
18
- side = "bottom",
19
- sideOffset = 4,
20
- align = "center",
21
- alignOffset = 4,
22
- ...props
23
- }: PreviewCardPrimitive.Popup.Props &
24
- Pick<
25
- PreviewCardPrimitive.Positioner.Props,
26
- "align" | "alignOffset" | "side" | "sideOffset"
27
- >) {
28
- return (
29
- <PreviewCardPrimitive.Portal data-slot="hover-card-portal">
30
- <PreviewCardPrimitive.Positioner
31
- align={align}
32
- alignOffset={alignOffset}
33
- side={side}
34
- sideOffset={sideOffset}
35
- className="isolate z-50"
36
- >
37
- <PreviewCardPrimitive.Popup
38
- data-slot="hover-card-content"
39
- className={cn(
40
- "z-50 w-72 origin-(--transform-origin) rounded-3xl bg-popover p-4 text-sm text-popover-foreground shadow-lg ring-1 ring-foreground/5 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
41
- className,
42
- )}
43
- {...props}
44
- />
45
- </PreviewCardPrimitive.Positioner>
46
- </PreviewCardPrimitive.Portal>
47
- );
48
- }
49
-
50
- export { HoverCard, HoverCardTrigger, HoverCardContent };
1
+ "use client";
2
+
3
+ import { PreviewCard as PreviewCardPrimitive } from "@base-ui/react/preview-card";
4
+ import { cn } from "cn";
5
+
6
+ function HoverCard({ ...props }: PreviewCardPrimitive.Root.Props) {
7
+ return <PreviewCardPrimitive.Root data-slot="hover-card" {...props} />;
8
+ }
9
+
10
+ function HoverCardTrigger({ ...props }: PreviewCardPrimitive.Trigger.Props) {
11
+ return (
12
+ <PreviewCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
13
+ );
14
+ }
15
+
16
+ function HoverCardContent({
17
+ className,
18
+ side = "bottom",
19
+ sideOffset = 4,
20
+ align = "center",
21
+ alignOffset = 4,
22
+ ...props
23
+ }: PreviewCardPrimitive.Popup.Props &
24
+ Pick<
25
+ PreviewCardPrimitive.Positioner.Props,
26
+ "align" | "alignOffset" | "side" | "sideOffset"
27
+ >) {
28
+ return (
29
+ <PreviewCardPrimitive.Portal data-slot="hover-card-portal">
30
+ <PreviewCardPrimitive.Positioner
31
+ align={align}
32
+ alignOffset={alignOffset}
33
+ side={side}
34
+ sideOffset={sideOffset}
35
+ className="isolate z-50"
36
+ >
37
+ <PreviewCardPrimitive.Popup
38
+ data-slot="hover-card-content"
39
+ className={cn(
40
+ "z-50 w-72 origin-(--transform-origin) rounded-3xl bg-popover p-4 text-sm text-popover-foreground shadow-lg ring-1 ring-foreground/5 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
41
+ className,
42
+ )}
43
+ {...props}
44
+ />
45
+ </PreviewCardPrimitive.Positioner>
46
+ </PreviewCardPrimitive.Portal>
47
+ );
48
+ }
49
+
50
+ export { HoverCard, HoverCardTrigger, HoverCardContent };
@@ -1,155 +1,155 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { cva, type VariantProps } from "class-variance-authority";
5
- import { cn } from "cn";
6
-
7
- import { Button } from "./button";
8
- import { Input } from "./input";
9
- import { Textarea } from "./textarea";
10
-
11
- function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
12
- return (
13
- <div
14
- data-slot="input-group"
15
- role="group"
16
- className={cn(
17
- "group/input-group relative flex h-9 w-full min-w-0 items-center rounded-4xl border border-transparent bg-input/50 transition-[color,box-shadow,background-color] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-3xl has-data-[align=block-start]:rounded-3xl has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-2xl has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",
18
- className,
19
- )}
20
- {...props}
21
- />
22
- );
23
- }
24
-
25
- const inputGroupAddonVariants = cva(
26
- "flex h-auto cursor-text items-center justify-center gap-2 py-2 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-3xl **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1.5 [&>svg:not([class*='size-'])]:size-4",
27
- {
28
- variants: {
29
- align: {
30
- "inline-start": "order-first pl-3 has-[>button]:-ml-1 has-[>kbd]:-ml-1",
31
- "inline-end": "order-last pr-3 has-[>button]:-mr-1 has-[>kbd]:-mr-1",
32
- "block-start":
33
- "order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-3.5 [.border-b]:pb-3.5",
34
- "block-end":
35
- "order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-3.5 [.border-t]:pt-3.5",
36
- },
37
- },
38
- defaultVariants: {
39
- align: "inline-start",
40
- },
41
- },
42
- );
43
-
44
- function InputGroupAddon({
45
- className,
46
- align = "inline-start",
47
- ...props
48
- }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
49
- return (
50
- <div
51
- role="group"
52
- data-slot="input-group-addon"
53
- data-align={align}
54
- className={cn(inputGroupAddonVariants({ align }), className)}
55
- onClick={(e) => {
56
- if ((e.target as HTMLElement).closest("button")) {
57
- return;
58
- }
59
- e.currentTarget.parentElement?.querySelector("input")?.focus();
60
- }}
61
- {...props}
62
- />
63
- );
64
- }
65
-
66
- const inputGroupButtonVariants = cva(
67
- "flex items-center gap-2 rounded-4xl text-sm shadow-none",
68
- {
69
- variants: {
70
- size: {
71
- xs: "h-6 gap-1 rounded-xl px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
72
- sm: "",
73
- "icon-xs": "size-6 rounded-xl p-0 has-[>svg]:p-0",
74
- "icon-sm": "size-8 p-0 has-[>svg]:p-0",
75
- },
76
- },
77
- defaultVariants: {
78
- size: "xs",
79
- },
80
- },
81
- );
82
-
83
- function InputGroupButton({
84
- className,
85
- type = "button",
86
- variant = "ghost",
87
- size = "xs",
88
- ...props
89
- }: Omit<React.ComponentProps<typeof Button>, "size" | "type"> &
90
- VariantProps<typeof inputGroupButtonVariants> & {
91
- type?: "button" | "submit" | "reset";
92
- }) {
93
- return (
94
- <Button
95
- type={type}
96
- data-size={size}
97
- variant={variant}
98
- className={cn(inputGroupButtonVariants({ size }), className)}
99
- {...props}
100
- />
101
- );
102
- }
103
-
104
- function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
105
- return (
106
- <span
107
- className={cn(
108
- "flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
109
- className,
110
- )}
111
- {...props}
112
- />
113
- );
114
- }
115
-
116
- function InputGroupInput({
117
- className,
118
- ...props
119
- }: React.ComponentProps<"input">) {
120
- return (
121
- <Input
122
- data-slot="input-group-control"
123
- className={cn(
124
- "flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
125
- className,
126
- )}
127
- {...props}
128
- />
129
- );
130
- }
131
-
132
- function InputGroupTextarea({
133
- className,
134
- ...props
135
- }: React.ComponentProps<"textarea">) {
136
- return (
137
- <Textarea
138
- data-slot="input-group-control"
139
- className={cn(
140
- "flex-1 resize-none rounded-none border-0 bg-transparent py-2.5 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
141
- className,
142
- )}
143
- {...props}
144
- />
145
- );
146
- }
147
-
148
- export {
149
- InputGroup,
150
- InputGroupAddon,
151
- InputGroupButton,
152
- InputGroupText,
153
- InputGroupInput,
154
- InputGroupTextarea,
155
- };
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { cva, type VariantProps } from "class-variance-authority";
5
+ import { cn } from "cn";
6
+
7
+ import { Button } from "./button";
8
+ import { Input } from "./input";
9
+ import { Textarea } from "./textarea";
10
+
11
+ function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
12
+ return (
13
+ <div
14
+ data-slot="input-group"
15
+ role="group"
16
+ className={cn(
17
+ "group/input-group relative flex h-9 w-full min-w-0 items-center rounded-4xl border border-transparent bg-input/50 transition-[color,box-shadow,background-color] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-3xl has-data-[align=block-start]:rounded-3xl has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-2xl has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",
18
+ className,
19
+ )}
20
+ {...props}
21
+ />
22
+ );
23
+ }
24
+
25
+ const inputGroupAddonVariants = cva(
26
+ "flex h-auto cursor-text items-center justify-center gap-2 py-2 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-3xl **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1.5 [&>svg:not([class*='size-'])]:size-4",
27
+ {
28
+ variants: {
29
+ align: {
30
+ "inline-start": "order-first pl-3 has-[>button]:-ml-1 has-[>kbd]:-ml-1",
31
+ "inline-end": "order-last pr-3 has-[>button]:-mr-1 has-[>kbd]:-mr-1",
32
+ "block-start":
33
+ "order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-3.5 [.border-b]:pb-3.5",
34
+ "block-end":
35
+ "order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-3.5 [.border-t]:pt-3.5",
36
+ },
37
+ },
38
+ defaultVariants: {
39
+ align: "inline-start",
40
+ },
41
+ },
42
+ );
43
+
44
+ function InputGroupAddon({
45
+ className,
46
+ align = "inline-start",
47
+ ...props
48
+ }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
49
+ return (
50
+ <div
51
+ role="group"
52
+ data-slot="input-group-addon"
53
+ data-align={align}
54
+ className={cn(inputGroupAddonVariants({ align }), className)}
55
+ onClick={(e) => {
56
+ if ((e.target as HTMLElement).closest("button")) {
57
+ return;
58
+ }
59
+ e.currentTarget.parentElement?.querySelector("input")?.focus();
60
+ }}
61
+ {...props}
62
+ />
63
+ );
64
+ }
65
+
66
+ const inputGroupButtonVariants = cva(
67
+ "flex items-center gap-2 rounded-4xl text-sm shadow-none",
68
+ {
69
+ variants: {
70
+ size: {
71
+ xs: "h-6 gap-1 rounded-xl px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
72
+ sm: "",
73
+ "icon-xs": "size-6 rounded-xl p-0 has-[>svg]:p-0",
74
+ "icon-sm": "size-8 p-0 has-[>svg]:p-0",
75
+ },
76
+ },
77
+ defaultVariants: {
78
+ size: "xs",
79
+ },
80
+ },
81
+ );
82
+
83
+ function InputGroupButton({
84
+ className,
85
+ type = "button",
86
+ variant = "ghost",
87
+ size = "xs",
88
+ ...props
89
+ }: Omit<React.ComponentProps<typeof Button>, "size" | "type"> &
90
+ VariantProps<typeof inputGroupButtonVariants> & {
91
+ type?: "button" | "submit" | "reset";
92
+ }) {
93
+ return (
94
+ <Button
95
+ type={type}
96
+ data-size={size}
97
+ variant={variant}
98
+ className={cn(inputGroupButtonVariants({ size }), className)}
99
+ {...props}
100
+ />
101
+ );
102
+ }
103
+
104
+ function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
105
+ return (
106
+ <span
107
+ className={cn(
108
+ "flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
109
+ className,
110
+ )}
111
+ {...props}
112
+ />
113
+ );
114
+ }
115
+
116
+ function InputGroupInput({
117
+ className,
118
+ ...props
119
+ }: React.ComponentProps<"input">) {
120
+ return (
121
+ <Input
122
+ data-slot="input-group-control"
123
+ className={cn(
124
+ "flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
125
+ className,
126
+ )}
127
+ {...props}
128
+ />
129
+ );
130
+ }
131
+
132
+ function InputGroupTextarea({
133
+ className,
134
+ ...props
135
+ }: React.ComponentProps<"textarea">) {
136
+ return (
137
+ <Textarea
138
+ data-slot="input-group-control"
139
+ className={cn(
140
+ "flex-1 resize-none rounded-none border-0 bg-transparent py-2.5 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
141
+ className,
142
+ )}
143
+ {...props}
144
+ />
145
+ );
146
+ }
147
+
148
+ export {
149
+ InputGroup,
150
+ InputGroupAddon,
151
+ InputGroupButton,
152
+ InputGroupText,
153
+ InputGroupInput,
154
+ InputGroupTextarea,
155
+ };
@@ -1,21 +1,21 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { Input as InputPrimitive } from "@base-ui/react/input";
5
- import { cn } from "cn";
6
-
7
- function Input({ className, type, ...props }: React.ComponentProps<"input">) {
8
- return (
9
- <InputPrimitive
10
- type={type}
11
- data-slot="input"
12
- className={cn(
13
- "h-9 w-full min-w-0 rounded-3xl border border-transparent bg-input/50 px-3 py-1 text-base transition-[color,box-shadow,background-color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
14
- className,
15
- )}
16
- {...props}
17
- />
18
- );
19
- }
20
-
21
- export { Input };
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { Input as InputPrimitive } from "@base-ui/react/input";
5
+ import { cn } from "cn";
6
+
7
+ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
8
+ return (
9
+ <InputPrimitive
10
+ type={type}
11
+ data-slot="input"
12
+ className={cn(
13
+ "h-9 w-full min-w-0 rounded-3xl border border-transparent bg-input/50 px-3 py-1 text-base transition-[color,box-shadow,background-color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
14
+ className,
15
+ )}
16
+ {...props}
17
+ />
18
+ );
19
+ }
20
+
21
+ export { Input };
@@ -0,0 +1,203 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { mergeProps } from "@base-ui/react/merge-props";
5
+ import { useRender } from "@base-ui/react/use-render";
6
+ import { cva, type VariantProps } from "class-variance-authority";
7
+ import { cn } from "cn";
8
+
9
+ import { Separator } from "./separator";
10
+
11
+ function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
12
+ return (
13
+ <div
14
+ role="list"
15
+ data-slot="item-group"
16
+ className={cn(
17
+ "group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2",
18
+ className,
19
+ )}
20
+ {...props}
21
+ />
22
+ );
23
+ }
24
+
25
+ function ItemSeparator({
26
+ className,
27
+ ...props
28
+ }: React.ComponentProps<typeof Separator>) {
29
+ return (
30
+ <Separator
31
+ data-slot="item-separator"
32
+ orientation="horizontal"
33
+ className={cn("my-2", className)}
34
+ {...props}
35
+ />
36
+ );
37
+ }
38
+
39
+ const itemVariants = cva(
40
+ "group/item flex w-full flex-wrap items-center rounded-2xl border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted",
41
+ {
42
+ variants: {
43
+ variant: {
44
+ default: "border-transparent",
45
+ outline: "border-border",
46
+ muted: "border-transparent bg-muted/50",
47
+ },
48
+ size: {
49
+ default: "gap-3.5 px-4 py-3.5",
50
+ sm: "gap-3.5 px-3.5 py-3",
51
+ xs: "gap-2.5 px-3 py-2.5 in-data-[slot=dropdown-menu-content]:p-0",
52
+ },
53
+ },
54
+ defaultVariants: {
55
+ variant: "default",
56
+ size: "default",
57
+ },
58
+ },
59
+ );
60
+
61
+ function Item({
62
+ className,
63
+ variant = "default",
64
+ size = "default",
65
+ render,
66
+ ...props
67
+ }: useRender.ComponentProps<"div"> & VariantProps<typeof itemVariants>) {
68
+ return useRender({
69
+ defaultTagName: "div",
70
+ props: mergeProps<"div">(
71
+ {
72
+ className: cn(itemVariants({ variant, size, className })),
73
+ },
74
+ props,
75
+ ),
76
+ render,
77
+ state: {
78
+ slot: "item",
79
+ variant,
80
+ size,
81
+ },
82
+ });
83
+ }
84
+
85
+ const itemMediaVariants = cva(
86
+ "flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none",
87
+ {
88
+ variants: {
89
+ variant: {
90
+ default: "bg-transparent",
91
+ icon: "[&_svg:not([class*='size-'])]:size-4",
92
+ image:
93
+ "size-10 overflow-hidden rounded-xl group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 group-data-[size=xs]/item:rounded-lg [&_img]:size-full [&_img]:object-cover",
94
+ },
95
+ },
96
+ defaultVariants: {
97
+ variant: "default",
98
+ },
99
+ },
100
+ );
101
+
102
+ function ItemMedia({
103
+ className,
104
+ variant = "default",
105
+ ...props
106
+ }: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>) {
107
+ return (
108
+ <div
109
+ data-slot="item-media"
110
+ data-variant={variant}
111
+ className={cn(itemMediaVariants({ variant, className }))}
112
+ {...props}
113
+ />
114
+ );
115
+ }
116
+
117
+ function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
118
+ return (
119
+ <div
120
+ data-slot="item-content"
121
+ className={cn(
122
+ "flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0.5 [&+[data-slot=item-content]]:flex-none",
123
+ className,
124
+ )}
125
+ {...props}
126
+ />
127
+ );
128
+ }
129
+
130
+ function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
131
+ return (
132
+ <div
133
+ data-slot="item-title"
134
+ className={cn(
135
+ "line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4",
136
+ className,
137
+ )}
138
+ {...props}
139
+ />
140
+ );
141
+ }
142
+
143
+ function ItemDescription({ className, ...props }: React.ComponentProps<"p">) {
144
+ return (
145
+ <p
146
+ data-slot="item-description"
147
+ className={cn(
148
+ "line-clamp-2 text-left text-sm font-normal text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
149
+ className,
150
+ )}
151
+ {...props}
152
+ />
153
+ );
154
+ }
155
+
156
+ function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
157
+ return (
158
+ <div
159
+ data-slot="item-actions"
160
+ className={cn("flex items-center gap-2", className)}
161
+ {...props}
162
+ />
163
+ );
164
+ }
165
+
166
+ function ItemHeader({ className, ...props }: React.ComponentProps<"div">) {
167
+ return (
168
+ <div
169
+ data-slot="item-header"
170
+ className={cn(
171
+ "flex basis-full items-center justify-between gap-2",
172
+ className,
173
+ )}
174
+ {...props}
175
+ />
176
+ );
177
+ }
178
+
179
+ function ItemFooter({ className, ...props }: React.ComponentProps<"div">) {
180
+ return (
181
+ <div
182
+ data-slot="item-footer"
183
+ className={cn(
184
+ "flex basis-full items-center justify-between gap-2",
185
+ className,
186
+ )}
187
+ {...props}
188
+ />
189
+ );
190
+ }
191
+
192
+ export {
193
+ Item,
194
+ ItemMedia,
195
+ ItemContent,
196
+ ItemActions,
197
+ ItemGroup,
198
+ ItemSeparator,
199
+ ItemTitle,
200
+ ItemDescription,
201
+ ItemHeader,
202
+ ItemFooter,
203
+ };