@coze-arch/cli 0.0.1-alpha.f74941 → 0.0.1-beta.6

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 (112) hide show
  1. package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +1 -1
  2. package/lib/__templates__/expo/app.json +1 -1
  3. package/lib/__templates__/expo/client/index.js +2 -1
  4. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +36 -12
  5. package/lib/__templates__/expo/metro.config.js +15 -15
  6. package/lib/__templates__/expo/package.json +14 -5
  7. package/lib/__templates__/expo/pnpm-lock.yaml +335 -4
  8. package/lib/__templates__/nextjs/.babelrc +15 -0
  9. package/lib/__templates__/nextjs/README.md +341 -19
  10. package/lib/__templates__/nextjs/components.json +21 -0
  11. package/lib/__templates__/nextjs/package.json +48 -1
  12. package/lib/__templates__/nextjs/pnpm-lock.yaml +6399 -1356
  13. package/lib/__templates__/nextjs/scripts/dev.sh +2 -1
  14. package/lib/__templates__/nextjs/server.mjs +50 -0
  15. package/lib/__templates__/nextjs/src/app/globals.css +99 -8
  16. package/lib/__templates__/nextjs/src/app/layout.tsx +4 -0
  17. package/lib/__templates__/nextjs/src/components/ui/accordion.tsx +66 -0
  18. package/lib/__templates__/nextjs/src/components/ui/alert-dialog.tsx +157 -0
  19. package/lib/__templates__/nextjs/src/components/ui/alert.tsx +66 -0
  20. package/lib/__templates__/nextjs/src/components/ui/aspect-ratio.tsx +11 -0
  21. package/lib/__templates__/nextjs/src/components/ui/avatar.tsx +53 -0
  22. package/lib/__templates__/nextjs/src/components/ui/badge.tsx +46 -0
  23. package/lib/__templates__/nextjs/src/components/ui/breadcrumb.tsx +109 -0
  24. package/lib/__templates__/nextjs/src/components/ui/button-group.tsx +83 -0
  25. package/lib/__templates__/nextjs/src/components/ui/button.tsx +62 -0
  26. package/lib/__templates__/nextjs/src/components/ui/calendar.tsx +220 -0
  27. package/lib/__templates__/nextjs/src/components/ui/card.tsx +92 -0
  28. package/lib/__templates__/nextjs/src/components/ui/carousel.tsx +241 -0
  29. package/lib/__templates__/nextjs/src/components/ui/chart.tsx +357 -0
  30. package/lib/__templates__/nextjs/src/components/ui/checkbox.tsx +32 -0
  31. package/lib/__templates__/nextjs/src/components/ui/collapsible.tsx +33 -0
  32. package/lib/__templates__/nextjs/src/components/ui/command.tsx +184 -0
  33. package/lib/__templates__/nextjs/src/components/ui/context-menu.tsx +252 -0
  34. package/lib/__templates__/nextjs/src/components/ui/dialog.tsx +143 -0
  35. package/lib/__templates__/nextjs/src/components/ui/drawer.tsx +135 -0
  36. package/lib/__templates__/nextjs/src/components/ui/dropdown-menu.tsx +257 -0
  37. package/lib/__templates__/nextjs/src/components/ui/empty.tsx +104 -0
  38. package/lib/__templates__/nextjs/src/components/ui/field.tsx +248 -0
  39. package/lib/__templates__/nextjs/src/components/ui/form.tsx +167 -0
  40. package/lib/__templates__/nextjs/src/components/ui/hover-card.tsx +44 -0
  41. package/lib/__templates__/nextjs/src/components/ui/input-group.tsx +170 -0
  42. package/lib/__templates__/nextjs/src/components/ui/input-otp.tsx +77 -0
  43. package/lib/__templates__/nextjs/src/components/ui/input.tsx +21 -0
  44. package/lib/__templates__/nextjs/src/components/ui/item.tsx +193 -0
  45. package/lib/__templates__/nextjs/src/components/ui/kbd.tsx +28 -0
  46. package/lib/__templates__/nextjs/src/components/ui/label.tsx +24 -0
  47. package/lib/__templates__/nextjs/src/components/ui/menubar.tsx +276 -0
  48. package/lib/__templates__/nextjs/src/components/ui/navigation-menu.tsx +168 -0
  49. package/lib/__templates__/nextjs/src/components/ui/pagination.tsx +127 -0
  50. package/lib/__templates__/nextjs/src/components/ui/popover.tsx +48 -0
  51. package/lib/__templates__/nextjs/src/components/ui/progress.tsx +31 -0
  52. package/lib/__templates__/nextjs/src/components/ui/radio-group.tsx +45 -0
  53. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +56 -0
  54. package/lib/__templates__/nextjs/src/components/ui/scroll-area.tsx +58 -0
  55. package/lib/__templates__/nextjs/src/components/ui/select.tsx +190 -0
  56. package/lib/__templates__/nextjs/src/components/ui/separator.tsx +28 -0
  57. package/lib/__templates__/nextjs/src/components/ui/sheet.tsx +139 -0
  58. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +726 -0
  59. package/lib/__templates__/nextjs/src/components/ui/skeleton.tsx +13 -0
  60. package/lib/__templates__/nextjs/src/components/ui/slider.tsx +63 -0
  61. package/lib/__templates__/nextjs/src/components/ui/sonner.tsx +40 -0
  62. package/lib/__templates__/nextjs/src/components/ui/spinner.tsx +16 -0
  63. package/lib/__templates__/nextjs/src/components/ui/switch.tsx +31 -0
  64. package/lib/__templates__/nextjs/src/components/ui/table.tsx +116 -0
  65. package/lib/__templates__/nextjs/src/components/ui/tabs.tsx +66 -0
  66. package/lib/__templates__/nextjs/src/components/ui/textarea.tsx +18 -0
  67. package/lib/__templates__/nextjs/src/components/ui/toggle-group.tsx +83 -0
  68. package/lib/__templates__/nextjs/src/components/ui/toggle.tsx +47 -0
  69. package/lib/__templates__/nextjs/src/components/ui/tooltip.tsx +61 -0
  70. package/lib/__templates__/nextjs/src/hooks/use-mobile.ts +19 -0
  71. package/lib/__templates__/nextjs/src/lib/utils.ts +6 -0
  72. package/lib/__templates__/nextjs/template.config.js +1 -1
  73. package/lib/__templates__/templates.json +0 -38
  74. package/lib/__templates__/vite/template.config.js +1 -1
  75. package/lib/cli.js +19 -2
  76. package/package.json +2 -2
  77. package/lib/__templates__/react-rsbuild/.coze +0 -11
  78. package/lib/__templates__/react-rsbuild/.vscode/settings.json +0 -121
  79. package/lib/__templates__/react-rsbuild/README.md +0 -61
  80. package/lib/__templates__/react-rsbuild/_gitignore +0 -97
  81. package/lib/__templates__/react-rsbuild/_npmrc +0 -22
  82. package/lib/__templates__/react-rsbuild/package.json +0 -31
  83. package/lib/__templates__/react-rsbuild/pnpm-lock.yaml +0 -997
  84. package/lib/__templates__/react-rsbuild/rsbuild.config.ts +0 -13
  85. package/lib/__templates__/react-rsbuild/scripts/build.sh +0 -14
  86. package/lib/__templates__/react-rsbuild/scripts/dev.sh +0 -51
  87. package/lib/__templates__/react-rsbuild/scripts/start.sh +0 -15
  88. package/lib/__templates__/react-rsbuild/src/App.tsx +0 -60
  89. package/lib/__templates__/react-rsbuild/src/index.css +0 -21
  90. package/lib/__templates__/react-rsbuild/src/index.html +0 -12
  91. package/lib/__templates__/react-rsbuild/src/index.tsx +0 -16
  92. package/lib/__templates__/react-rsbuild/tailwind.config.js +0 -9
  93. package/lib/__templates__/react-rsbuild/template.config.js +0 -54
  94. package/lib/__templates__/react-rsbuild/tsconfig.json +0 -17
  95. package/lib/__templates__/rsbuild/.coze +0 -11
  96. package/lib/__templates__/rsbuild/.vscode/settings.json +0 -7
  97. package/lib/__templates__/rsbuild/README.md +0 -61
  98. package/lib/__templates__/rsbuild/_gitignore +0 -97
  99. package/lib/__templates__/rsbuild/_npmrc +0 -22
  100. package/lib/__templates__/rsbuild/package.json +0 -24
  101. package/lib/__templates__/rsbuild/pnpm-lock.yaml +0 -888
  102. package/lib/__templates__/rsbuild/rsbuild.config.ts +0 -12
  103. package/lib/__templates__/rsbuild/scripts/build.sh +0 -14
  104. package/lib/__templates__/rsbuild/scripts/dev.sh +0 -51
  105. package/lib/__templates__/rsbuild/scripts/start.sh +0 -15
  106. package/lib/__templates__/rsbuild/src/index.css +0 -21
  107. package/lib/__templates__/rsbuild/src/index.html +0 -12
  108. package/lib/__templates__/rsbuild/src/index.ts +0 -5
  109. package/lib/__templates__/rsbuild/src/main.ts +0 -65
  110. package/lib/__templates__/rsbuild/tailwind.config.js +0 -9
  111. package/lib/__templates__/rsbuild/template.config.js +0 -56
  112. package/lib/__templates__/rsbuild/tsconfig.json +0 -16
@@ -0,0 +1,167 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import type * as LabelPrimitive from "@radix-ui/react-label"
5
+ import { Slot } from "@radix-ui/react-slot"
6
+ import {
7
+ Controller,
8
+ FormProvider,
9
+ useFormContext,
10
+ useFormState,
11
+ type ControllerProps,
12
+ type FieldPath,
13
+ type FieldValues,
14
+ } from "react-hook-form"
15
+
16
+ import { cn } from "@/lib/utils"
17
+ import { Label } from "@/components/ui/label"
18
+
19
+ const Form = FormProvider
20
+
21
+ type FormFieldContextValue<
22
+ TFieldValues extends FieldValues = FieldValues,
23
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
24
+ > = {
25
+ name: TName
26
+ }
27
+
28
+ const FormFieldContext = React.createContext<FormFieldContextValue>(
29
+ {} as FormFieldContextValue
30
+ )
31
+
32
+ const FormField = <
33
+ TFieldValues extends FieldValues = FieldValues,
34
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
35
+ >({
36
+ ...props
37
+ }: ControllerProps<TFieldValues, TName>) => {
38
+ return (
39
+ <FormFieldContext.Provider value={{ name: props.name }}>
40
+ <Controller {...props} />
41
+ </FormFieldContext.Provider>
42
+ )
43
+ }
44
+
45
+ const useFormField = () => {
46
+ const fieldContext = React.useContext(FormFieldContext)
47
+ const itemContext = React.useContext(FormItemContext)
48
+ const { getFieldState } = useFormContext()
49
+ const formState = useFormState({ name: fieldContext.name })
50
+ const fieldState = getFieldState(fieldContext.name, formState)
51
+
52
+ if (!fieldContext) {
53
+ throw new Error("useFormField should be used within <FormField>")
54
+ }
55
+
56
+ const { id } = itemContext
57
+
58
+ return {
59
+ id,
60
+ name: fieldContext.name,
61
+ formItemId: `${id}-form-item`,
62
+ formDescriptionId: `${id}-form-item-description`,
63
+ formMessageId: `${id}-form-item-message`,
64
+ ...fieldState,
65
+ }
66
+ }
67
+
68
+ type FormItemContextValue = {
69
+ id: string
70
+ }
71
+
72
+ const FormItemContext = React.createContext<FormItemContextValue>(
73
+ {} as FormItemContextValue
74
+ )
75
+
76
+ function FormItem({ className, ...props }: React.ComponentProps<"div">) {
77
+ const id = React.useId()
78
+
79
+ return (
80
+ <FormItemContext.Provider value={{ id }}>
81
+ <div
82
+ data-slot="form-item"
83
+ className={cn("grid gap-2", className)}
84
+ {...props}
85
+ />
86
+ </FormItemContext.Provider>
87
+ )
88
+ }
89
+
90
+ function FormLabel({
91
+ className,
92
+ ...props
93
+ }: React.ComponentProps<typeof LabelPrimitive.Root>) {
94
+ const { error, formItemId } = useFormField()
95
+
96
+ return (
97
+ <Label
98
+ data-slot="form-label"
99
+ data-error={!!error}
100
+ className={cn("data-[error=true]:text-destructive", className)}
101
+ htmlFor={formItemId}
102
+ {...props}
103
+ />
104
+ )
105
+ }
106
+
107
+ function FormControl({ ...props }: React.ComponentProps<typeof Slot>) {
108
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
109
+
110
+ return (
111
+ <Slot
112
+ data-slot="form-control"
113
+ id={formItemId}
114
+ aria-describedby={
115
+ !error
116
+ ? `${formDescriptionId}`
117
+ : `${formDescriptionId} ${formMessageId}`
118
+ }
119
+ aria-invalid={!!error}
120
+ {...props}
121
+ />
122
+ )
123
+ }
124
+
125
+ function FormDescription({ className, ...props }: React.ComponentProps<"p">) {
126
+ const { formDescriptionId } = useFormField()
127
+
128
+ return (
129
+ <p
130
+ data-slot="form-description"
131
+ id={formDescriptionId}
132
+ className={cn("text-muted-foreground text-sm", className)}
133
+ {...props}
134
+ />
135
+ )
136
+ }
137
+
138
+ function FormMessage({ className, ...props }: React.ComponentProps<"p">) {
139
+ const { error, formMessageId } = useFormField()
140
+ const body = error ? String(error?.message ?? "") : props.children
141
+
142
+ if (!body) {
143
+ return null
144
+ }
145
+
146
+ return (
147
+ <p
148
+ data-slot="form-message"
149
+ id={formMessageId}
150
+ className={cn("text-destructive text-sm", className)}
151
+ {...props}
152
+ >
153
+ {body}
154
+ </p>
155
+ )
156
+ }
157
+
158
+ export {
159
+ useFormField,
160
+ Form,
161
+ FormItem,
162
+ FormLabel,
163
+ FormControl,
164
+ FormDescription,
165
+ FormMessage,
166
+ FormField,
167
+ }
@@ -0,0 +1,44 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as HoverCardPrimitive from "@radix-ui/react-hover-card"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ function HoverCard({
9
+ ...props
10
+ }: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
11
+ return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />
12
+ }
13
+
14
+ function HoverCardTrigger({
15
+ ...props
16
+ }: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
17
+ return (
18
+ <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
19
+ )
20
+ }
21
+
22
+ function HoverCardContent({
23
+ className,
24
+ align = "center",
25
+ sideOffset = 4,
26
+ ...props
27
+ }: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
28
+ return (
29
+ <HoverCardPrimitive.Portal data-slot="hover-card-portal">
30
+ <HoverCardPrimitive.Content
31
+ data-slot="hover-card-content"
32
+ align={align}
33
+ sideOffset={sideOffset}
34
+ className={cn(
35
+ "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 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
36
+ className
37
+ )}
38
+ {...props}
39
+ />
40
+ </HoverCardPrimitive.Portal>
41
+ )
42
+ }
43
+
44
+ export { HoverCard, HoverCardTrigger, HoverCardContent }
@@ -0,0 +1,170 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cva, type VariantProps } from "class-variance-authority"
5
+
6
+ import { cn } from "@/lib/utils"
7
+ import { Button } from "@/components/ui/button"
8
+ import { Input } from "@/components/ui/input"
9
+ import { Textarea } from "@/components/ui/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 border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none",
18
+ "h-9 min-w-0 has-[>textarea]:h-auto",
19
+
20
+ // Variants based on alignment.
21
+ "has-[>[data-align=inline-start]]:[&>input]:pl-2",
22
+ "has-[>[data-align=inline-end]]:[&>input]:pr-2",
23
+ "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
24
+ "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
25
+
26
+ // Focus state.
27
+ "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]",
28
+
29
+ // Error state.
30
+ "has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
31
+
32
+ className
33
+ )}
34
+ {...props}
35
+ />
36
+ )
37
+ }
38
+
39
+ const inputGroupAddonVariants = cva(
40
+ "text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",
41
+ {
42
+ variants: {
43
+ align: {
44
+ "inline-start":
45
+ "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
46
+ "inline-end":
47
+ "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
48
+ "block-start":
49
+ "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
50
+ "block-end":
51
+ "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5",
52
+ },
53
+ },
54
+ defaultVariants: {
55
+ align: "inline-start",
56
+ },
57
+ }
58
+ )
59
+
60
+ function InputGroupAddon({
61
+ className,
62
+ align = "inline-start",
63
+ ...props
64
+ }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
65
+ return (
66
+ <div
67
+ role="group"
68
+ data-slot="input-group-addon"
69
+ data-align={align}
70
+ className={cn(inputGroupAddonVariants({ align }), className)}
71
+ onClick={(e) => {
72
+ if ((e.target as HTMLElement).closest("button")) {
73
+ return
74
+ }
75
+ e.currentTarget.parentElement?.querySelector("input")?.focus()
76
+ }}
77
+ {...props}
78
+ />
79
+ )
80
+ }
81
+
82
+ const inputGroupButtonVariants = cva(
83
+ "text-sm shadow-none flex gap-2 items-center",
84
+ {
85
+ variants: {
86
+ size: {
87
+ xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
88
+ sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
89
+ "icon-xs":
90
+ "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
91
+ "icon-sm": "size-8 p-0 has-[>svg]:p-0",
92
+ },
93
+ },
94
+ defaultVariants: {
95
+ size: "xs",
96
+ },
97
+ }
98
+ )
99
+
100
+ function InputGroupButton({
101
+ className,
102
+ type = "button",
103
+ variant = "ghost",
104
+ size = "xs",
105
+ ...props
106
+ }: Omit<React.ComponentProps<typeof Button>, "size"> &
107
+ VariantProps<typeof inputGroupButtonVariants>) {
108
+ return (
109
+ <Button
110
+ type={type}
111
+ data-size={size}
112
+ variant={variant}
113
+ className={cn(inputGroupButtonVariants({ size }), className)}
114
+ {...props}
115
+ />
116
+ )
117
+ }
118
+
119
+ function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
120
+ return (
121
+ <span
122
+ className={cn(
123
+ "text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
124
+ className
125
+ )}
126
+ {...props}
127
+ />
128
+ )
129
+ }
130
+
131
+ function InputGroupInput({
132
+ className,
133
+ ...props
134
+ }: React.ComponentProps<"input">) {
135
+ return (
136
+ <Input
137
+ data-slot="input-group-control"
138
+ className={cn(
139
+ "flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
140
+ className
141
+ )}
142
+ {...props}
143
+ />
144
+ )
145
+ }
146
+
147
+ function InputGroupTextarea({
148
+ className,
149
+ ...props
150
+ }: React.ComponentProps<"textarea">) {
151
+ return (
152
+ <Textarea
153
+ data-slot="input-group-control"
154
+ className={cn(
155
+ "flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
156
+ className
157
+ )}
158
+ {...props}
159
+ />
160
+ )
161
+ }
162
+
163
+ export {
164
+ InputGroup,
165
+ InputGroupAddon,
166
+ InputGroupButton,
167
+ InputGroupText,
168
+ InputGroupInput,
169
+ InputGroupTextarea,
170
+ }
@@ -0,0 +1,77 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { OTPInput, OTPInputContext } from "input-otp"
5
+ import { MinusIcon } from "lucide-react"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ function InputOTP({
10
+ className,
11
+ containerClassName,
12
+ ...props
13
+ }: React.ComponentProps<typeof OTPInput> & {
14
+ containerClassName?: string
15
+ }) {
16
+ return (
17
+ <OTPInput
18
+ data-slot="input-otp"
19
+ containerClassName={cn(
20
+ "flex items-center gap-2 has-disabled:opacity-50",
21
+ containerClassName
22
+ )}
23
+ className={cn("disabled:cursor-not-allowed", className)}
24
+ {...props}
25
+ />
26
+ )
27
+ }
28
+
29
+ function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) {
30
+ return (
31
+ <div
32
+ data-slot="input-otp-group"
33
+ className={cn("flex items-center", className)}
34
+ {...props}
35
+ />
36
+ )
37
+ }
38
+
39
+ function InputOTPSlot({
40
+ index,
41
+ className,
42
+ ...props
43
+ }: React.ComponentProps<"div"> & {
44
+ index: number
45
+ }) {
46
+ const inputOTPContext = React.useContext(OTPInputContext)
47
+ const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}
48
+
49
+ return (
50
+ <div
51
+ data-slot="input-otp-slot"
52
+ data-active={isActive}
53
+ className={cn(
54
+ "data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",
55
+ className
56
+ )}
57
+ {...props}
58
+ >
59
+ {char}
60
+ {hasFakeCaret && (
61
+ <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
62
+ <div className="animate-caret-blink bg-foreground h-4 w-px duration-1000" />
63
+ </div>
64
+ )}
65
+ </div>
66
+ )
67
+ }
68
+
69
+ function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
70
+ return (
71
+ <div data-slot="input-otp-separator" role="separator" {...props}>
72
+ <MinusIcon />
73
+ </div>
74
+ )
75
+ }
76
+
77
+ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
@@ -0,0 +1,21 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@/lib/utils"
4
+
5
+ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
6
+ return (
7
+ <input
8
+ type={type}
9
+ data-slot="input"
10
+ className={cn(
11
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
12
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
13
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
14
+ className
15
+ )}
16
+ {...props}
17
+ />
18
+ )
19
+ }
20
+
21
+ export { Input }
@@ -0,0 +1,193 @@
1
+ import * as React from "react"
2
+ import { Slot } from "@radix-ui/react-slot"
3
+ import { cva, type VariantProps } from "class-variance-authority"
4
+
5
+ import { cn } from "@/lib/utils"
6
+ import { Separator } from "@/components/ui/separator"
7
+
8
+ function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
9
+ return (
10
+ <div
11
+ role="list"
12
+ data-slot="item-group"
13
+ className={cn("group/item-group flex flex-col", className)}
14
+ {...props}
15
+ />
16
+ )
17
+ }
18
+
19
+ function ItemSeparator({
20
+ className,
21
+ ...props
22
+ }: React.ComponentProps<typeof Separator>) {
23
+ return (
24
+ <Separator
25
+ data-slot="item-separator"
26
+ orientation="horizontal"
27
+ className={cn("my-0", className)}
28
+ {...props}
29
+ />
30
+ )
31
+ }
32
+
33
+ const itemVariants = cva(
34
+ "group/item flex items-center border border-transparent text-sm rounded-md transition-colors [a]:hover:bg-accent/50 [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
35
+ {
36
+ variants: {
37
+ variant: {
38
+ default: "bg-transparent",
39
+ outline: "border-border",
40
+ muted: "bg-muted/50",
41
+ },
42
+ size: {
43
+ default: "p-4 gap-4 ",
44
+ sm: "py-3 px-4 gap-2.5",
45
+ },
46
+ },
47
+ defaultVariants: {
48
+ variant: "default",
49
+ size: "default",
50
+ },
51
+ }
52
+ )
53
+
54
+ function Item({
55
+ className,
56
+ variant = "default",
57
+ size = "default",
58
+ asChild = false,
59
+ ...props
60
+ }: React.ComponentProps<"div"> &
61
+ VariantProps<typeof itemVariants> & { asChild?: boolean }) {
62
+ const Comp = asChild ? Slot : "div"
63
+ return (
64
+ <Comp
65
+ data-slot="item"
66
+ data-variant={variant}
67
+ data-size={size}
68
+ className={cn(itemVariants({ variant, size, className }))}
69
+ {...props}
70
+ />
71
+ )
72
+ }
73
+
74
+ const itemMediaVariants = cva(
75
+ "flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5",
76
+ {
77
+ variants: {
78
+ variant: {
79
+ default: "bg-transparent",
80
+ icon: "size-8 border rounded-sm bg-muted [&_svg:not([class*='size-'])]:size-4",
81
+ image:
82
+ "size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover",
83
+ },
84
+ },
85
+ defaultVariants: {
86
+ variant: "default",
87
+ },
88
+ }
89
+ )
90
+
91
+ function ItemMedia({
92
+ className,
93
+ variant = "default",
94
+ ...props
95
+ }: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>) {
96
+ return (
97
+ <div
98
+ data-slot="item-media"
99
+ data-variant={variant}
100
+ className={cn(itemMediaVariants({ variant, className }))}
101
+ {...props}
102
+ />
103
+ )
104
+ }
105
+
106
+ function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
107
+ return (
108
+ <div
109
+ data-slot="item-content"
110
+ className={cn(
111
+ "flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none",
112
+ className
113
+ )}
114
+ {...props}
115
+ />
116
+ )
117
+ }
118
+
119
+ function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
120
+ return (
121
+ <div
122
+ data-slot="item-title"
123
+ className={cn(
124
+ "flex w-fit items-center gap-2 text-sm leading-snug font-medium",
125
+ className
126
+ )}
127
+ {...props}
128
+ />
129
+ )
130
+ }
131
+
132
+ function ItemDescription({ className, ...props }: React.ComponentProps<"p">) {
133
+ return (
134
+ <p
135
+ data-slot="item-description"
136
+ className={cn(
137
+ "text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance",
138
+ "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
139
+ className
140
+ )}
141
+ {...props}
142
+ />
143
+ )
144
+ }
145
+
146
+ function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
147
+ return (
148
+ <div
149
+ data-slot="item-actions"
150
+ className={cn("flex items-center gap-2", className)}
151
+ {...props}
152
+ />
153
+ )
154
+ }
155
+
156
+ function ItemHeader({ className, ...props }: React.ComponentProps<"div">) {
157
+ return (
158
+ <div
159
+ data-slot="item-header"
160
+ className={cn(
161
+ "flex basis-full items-center justify-between gap-2",
162
+ className
163
+ )}
164
+ {...props}
165
+ />
166
+ )
167
+ }
168
+
169
+ function ItemFooter({ className, ...props }: React.ComponentProps<"div">) {
170
+ return (
171
+ <div
172
+ data-slot="item-footer"
173
+ className={cn(
174
+ "flex basis-full items-center justify-between gap-2",
175
+ className
176
+ )}
177
+ {...props}
178
+ />
179
+ )
180
+ }
181
+
182
+ export {
183
+ Item,
184
+ ItemMedia,
185
+ ItemContent,
186
+ ItemActions,
187
+ ItemGroup,
188
+ ItemSeparator,
189
+ ItemTitle,
190
+ ItemDescription,
191
+ ItemHeader,
192
+ ItemFooter,
193
+ }
@@ -0,0 +1,28 @@
1
+ import { cn } from "@/lib/utils"
2
+
3
+ function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
4
+ return (
5
+ <kbd
6
+ data-slot="kbd"
7
+ className={cn(
8
+ "bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none",
9
+ "[&_svg:not([class*='size-'])]:size-3",
10
+ "[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",
11
+ className
12
+ )}
13
+ {...props}
14
+ />
15
+ )
16
+ }
17
+
18
+ function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
19
+ return (
20
+ <kbd
21
+ data-slot="kbd-group"
22
+ className={cn("inline-flex items-center gap-1", className)}
23
+ {...props}
24
+ />
25
+ )
26
+ }
27
+
28
+ export { Kbd, KbdGroup }