@allbluecn/admin-app 0.3.3 → 0.3.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.
- package/package.json +4 -3
- package/src/components/admin/admin-user-menu.tsx +4 -4
- package/src/components/admin/developer-log.tsx +7 -7
- package/src/components/ai-memory/memory-facts-panel.tsx +9 -9
- package/src/components/ai-prompts/preview-panel.tsx +1 -1
- package/src/components/ai-prompts/prompt-editor.tsx +8 -8
- package/src/components/ai-prompts/prompt-table.tsx +6 -6
- package/src/components/ai-prompts/section-editor.tsx +3 -3
- package/src/components/ai-prompts/variable-panel.tsx +2 -2
- package/src/components/ai-prompts/version-history.tsx +5 -5
- package/src/components/ai-provider/model-list-editor.tsx +2 -2
- package/src/components/ai-provider/provider-form.tsx +7 -7
- package/src/components/ai-provider/provider-table.tsx +6 -6
- package/src/components/auth/admin-login-form.tsx +6 -6
- package/src/components/auth/icon-input.tsx +2 -2
- package/src/components/auth/password-input.tsx +2 -2
- package/src/components/component/component-form-dialog.tsx +8 -8
- package/src/components/component/component-import-dialog.tsx +6 -6
- package/src/components/component/component-table.tsx +3 -3
- package/src/components/confirm-dialog.tsx +94 -0
- package/src/components/data-table/data-table-pagination.tsx +121 -0
- package/src/components/data-table/data-table.tsx +218 -0
- package/src/components/data-table/table-detail-layout.tsx +97 -0
- package/src/components/dependency/changelog-dialog.tsx +2 -2
- package/src/components/dependency/columns.tsx +3 -3
- package/src/components/dependency/dependency-table.tsx +7 -7
- package/src/components/dependency/edit-dialog.tsx +8 -8
- package/src/components/invitations/invitations-page.tsx +13 -13
- package/src/components/knowledge-public/bookmark-form-dialog.tsx +6 -6
- package/src/components/knowledge-public/compliance-form-dialog.tsx +6 -6
- package/src/components/knowledge-public/legal-form-dialog.tsx +7 -7
- package/src/components/layout/sidebar-02/app-sidebar.tsx +1 -1
- package/src/components/layout/sidebar-02/index.tsx +1 -1
- package/src/components/layout/sidebar-02/nav-main.tsx +2 -2
- package/src/components/layout/sidebar-02/nav-notifications.tsx +3 -3
- package/src/components/market/columns.tsx +4 -4
- package/src/components/market/market-app-form.tsx +6 -6
- package/src/components/market/market-app-list.tsx +4 -4
- package/src/components/monitoring/error-list.tsx +1 -1
- package/src/components/monitoring/metrics-stats.tsx +1 -1
- package/src/components/monitoring/request-log-table.tsx +1 -1
- package/src/components/notion-avatar.tsx +126 -0
- package/src/components/oauth-providers/provider-page.tsx +9 -9
- package/src/components/permissions/assign-dialog.tsx +5 -5
- package/src/components/permissions/create-role-dialog.tsx +6 -6
- package/src/components/ui/alert-dialog.tsx +185 -0
- package/src/components/ui/alert.tsx +75 -0
- package/src/components/ui/avatar.tsx +106 -0
- package/src/components/ui/badge.tsx +51 -0
- package/src/components/ui/button.tsx +57 -0
- package/src/components/ui/card.tsx +102 -0
- package/src/components/ui/checkbox.tsx +27 -0
- package/src/components/ui/collapsible.tsx +19 -0
- package/src/components/ui/dialog.tsx +155 -0
- package/src/components/ui/dropdown-menu.tsx +265 -0
- package/src/components/ui/field.tsx +236 -0
- package/src/components/ui/input-group.tsx +157 -0
- package/src/components/ui/input.tsx +19 -0
- package/src/components/ui/label.tsx +17 -0
- package/src/components/ui/pagination.tsx +130 -0
- package/src/components/ui/select.tsx +232 -0
- package/src/components/ui/separator.tsx +23 -0
- package/src/components/ui/sheet.tsx +134 -0
- package/src/components/ui/sidebar.tsx +721 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/switch.tsx +30 -0
- package/src/components/ui/table.tsx +113 -0
- package/src/components/ui/textarea.tsx +17 -0
- package/src/components/ui/toast.tsx +308 -0
- package/src/components/ui/tooltip.tsx +64 -0
- package/src/components/user/columns.tsx +4 -4
- package/src/components/user/settings-activity-log.tsx +7 -7
- package/src/components/user/settings-profile/avatar-uploader.tsx +2 -2
- package/src/components/user/settings-profile/social-links.tsx +2 -2
- package/src/components/user/settings-profile.tsx +6 -6
- package/src/components/user/user-create-dialog.tsx +6 -6
- package/src/components/user/user-detail/error-boundary.tsx +1 -1
- package/src/components/user/user-detail/user-detail-dialogs.tsx +6 -6
- package/src/components/user/user-filters.tsx +3 -3
- package/src/components/user-avatar.tsx +82 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/lib/datetime.ts +226 -0
- package/src/lib/sanitize.ts +18 -0
- package/src/providers/index.tsx +1 -1
- package/src/routes/__root.tsx +1 -1
- package/src/routes/_nav/audit/route.lazy.tsx +1 -1
- package/src/routes/_nav/compliance/route.lazy.tsx +3 -3
- package/src/routes/_nav/components/route.lazy.tsx +4 -4
- package/src/routes/_nav/knowledge-public/bookmarks/route.lazy.tsx +6 -6
- package/src/routes/_nav/knowledge-public/compliance/route.lazy.tsx +6 -6
- package/src/routes/_nav/knowledge-public/legal/route.lazy.tsx +6 -6
- package/src/routes/_nav/licenses/$licenseId/route.lazy.tsx +3 -3
- package/src/routes/_nav/licenses/new/route.lazy.tsx +5 -5
- package/src/routes/_nav/licenses/route.lazy.tsx +1 -1
- package/src/routes/_nav/monitoring/ai-usage/route.lazy.tsx +2 -2
- package/src/routes/_nav/monitoring/errors/route.lazy.tsx +1 -1
- package/src/routes/_nav/monitoring/health/route.lazy.tsx +3 -3
- package/src/routes/_nav/monitoring/logs/route.lazy.tsx +3 -3
- package/src/routes/_nav/monitoring/metrics/route.lazy.tsx +3 -3
- package/src/routes/_nav/monitoring/route.lazy.tsx +2 -2
- package/src/routes/_nav/monitoring/sentry/route.lazy.tsx +1 -1
- package/src/routes/_nav/permissions/route.lazy.tsx +4 -4
- package/src/routes/_nav/sso/route.lazy.tsx +2 -2
- package/src/routes/_nav/users/$userId/route.lazy.tsx +8 -8
- package/src/routes/_nav/users/-components/users-table.tsx +1 -1
- package/src/routes/_nav/users/route.lazy.tsx +1 -1
- package/src/routes/setup/route.lazy.tsx +2 -2
- package/src/server/dependency/helpers.ts +0 -1
- package/src/styles/globals.css +3 -3
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { useMemo } from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
import { cn } from "cn"
|
|
4
|
+
|
|
5
|
+
import { Label } from "./label"
|
|
6
|
+
import { Separator } from "./separator"
|
|
7
|
+
|
|
8
|
+
function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
|
|
9
|
+
return (
|
|
10
|
+
<fieldset
|
|
11
|
+
data-slot="field-set"
|
|
12
|
+
className={cn(
|
|
13
|
+
"flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function FieldLegend({
|
|
22
|
+
className,
|
|
23
|
+
variant = "legend",
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) {
|
|
26
|
+
return (
|
|
27
|
+
<legend
|
|
28
|
+
data-slot="field-legend"
|
|
29
|
+
data-variant={variant}
|
|
30
|
+
className={cn(
|
|
31
|
+
"mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base",
|
|
32
|
+
className
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
40
|
+
return (
|
|
41
|
+
<div
|
|
42
|
+
data-slot="field-group"
|
|
43
|
+
className={cn(
|
|
44
|
+
"group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",
|
|
45
|
+
className
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const fieldVariants = cva(
|
|
53
|
+
"group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
|
|
54
|
+
{
|
|
55
|
+
variants: {
|
|
56
|
+
orientation: {
|
|
57
|
+
vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
|
|
58
|
+
horizontal:
|
|
59
|
+
"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
60
|
+
responsive:
|
|
61
|
+
"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
defaultVariants: {
|
|
65
|
+
orientation: "vertical",
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
function Field({
|
|
71
|
+
className,
|
|
72
|
+
orientation = "vertical",
|
|
73
|
+
...props
|
|
74
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>) {
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
role="group"
|
|
78
|
+
data-slot="field"
|
|
79
|
+
data-orientation={orientation}
|
|
80
|
+
className={cn(fieldVariants({ orientation }), className)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
87
|
+
return (
|
|
88
|
+
<div
|
|
89
|
+
data-slot="field-content"
|
|
90
|
+
className={cn(
|
|
91
|
+
"group/field-content flex flex-1 flex-col gap-1 leading-snug",
|
|
92
|
+
className
|
|
93
|
+
)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function FieldLabel({
|
|
100
|
+
className,
|
|
101
|
+
...props
|
|
102
|
+
}: React.ComponentProps<typeof Label>) {
|
|
103
|
+
return (
|
|
104
|
+
<Label
|
|
105
|
+
data-slot="field-label"
|
|
106
|
+
className={cn(
|
|
107
|
+
"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10",
|
|
108
|
+
"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",
|
|
109
|
+
className
|
|
110
|
+
)}
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
117
|
+
return (
|
|
118
|
+
<div
|
|
119
|
+
data-slot="field-label"
|
|
120
|
+
className={cn(
|
|
121
|
+
"flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",
|
|
122
|
+
className
|
|
123
|
+
)}
|
|
124
|
+
{...props}
|
|
125
|
+
/>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
130
|
+
return (
|
|
131
|
+
<p
|
|
132
|
+
data-slot="field-description"
|
|
133
|
+
className={cn(
|
|
134
|
+
"text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5",
|
|
135
|
+
"last:mt-0 nth-last-2:-mt-1",
|
|
136
|
+
"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
137
|
+
className
|
|
138
|
+
)}
|
|
139
|
+
{...props}
|
|
140
|
+
/>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function FieldSeparator({
|
|
145
|
+
children,
|
|
146
|
+
className,
|
|
147
|
+
...props
|
|
148
|
+
}: React.ComponentProps<"div"> & {
|
|
149
|
+
children?: React.ReactNode
|
|
150
|
+
}) {
|
|
151
|
+
return (
|
|
152
|
+
<div
|
|
153
|
+
data-slot="field-separator"
|
|
154
|
+
data-content={!!children}
|
|
155
|
+
className={cn(
|
|
156
|
+
"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
|
|
157
|
+
className
|
|
158
|
+
)}
|
|
159
|
+
{...props}
|
|
160
|
+
>
|
|
161
|
+
<Separator className="absolute inset-0 top-1/2" />
|
|
162
|
+
{children && (
|
|
163
|
+
<span
|
|
164
|
+
className="relative mx-auto block w-fit bg-background px-2 text-muted-foreground"
|
|
165
|
+
data-slot="field-separator-content"
|
|
166
|
+
>
|
|
167
|
+
{children}
|
|
168
|
+
</span>
|
|
169
|
+
)}
|
|
170
|
+
</div>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function FieldError({
|
|
175
|
+
className,
|
|
176
|
+
children,
|
|
177
|
+
errors,
|
|
178
|
+
...props
|
|
179
|
+
}: React.ComponentProps<"div"> & {
|
|
180
|
+
errors?: Array<{ message?: string } | undefined>
|
|
181
|
+
}) {
|
|
182
|
+
const content = useMemo(() => {
|
|
183
|
+
if (children) {
|
|
184
|
+
return children
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (!errors?.length) {
|
|
188
|
+
return null
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const uniqueErrors = [
|
|
192
|
+
...new Map(errors.map((error) => [error?.message, error])).values(),
|
|
193
|
+
]
|
|
194
|
+
|
|
195
|
+
if (uniqueErrors?.length == 1) {
|
|
196
|
+
return uniqueErrors[0]?.message
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<ul className="ml-4 flex list-disc flex-col gap-1">
|
|
201
|
+
{uniqueErrors.map(
|
|
202
|
+
(error, index) =>
|
|
203
|
+
error?.message && <li key={index}>{error.message}</li>
|
|
204
|
+
)}
|
|
205
|
+
</ul>
|
|
206
|
+
)
|
|
207
|
+
}, [children, errors])
|
|
208
|
+
|
|
209
|
+
if (!content) {
|
|
210
|
+
return null
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return (
|
|
214
|
+
<div
|
|
215
|
+
role="alert"
|
|
216
|
+
data-slot="field-error"
|
|
217
|
+
className={cn("text-sm font-normal text-destructive", className)}
|
|
218
|
+
{...props}
|
|
219
|
+
>
|
|
220
|
+
{content}
|
|
221
|
+
</div>
|
|
222
|
+
)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export {
|
|
226
|
+
Field,
|
|
227
|
+
FieldLabel,
|
|
228
|
+
FieldDescription,
|
|
229
|
+
FieldError,
|
|
230
|
+
FieldGroup,
|
|
231
|
+
FieldLegend,
|
|
232
|
+
FieldSeparator,
|
|
233
|
+
FieldSet,
|
|
234
|
+
FieldContent,
|
|
235
|
+
FieldTitle,
|
|
236
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react"
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
+
import { cn } from "cn"
|
|
5
|
+
|
|
6
|
+
import { Button } from "./button"
|
|
7
|
+
import { Input } from "./input"
|
|
8
|
+
import { Textarea } from "./textarea"
|
|
9
|
+
|
|
10
|
+
function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
data-slot="input-group"
|
|
14
|
+
role="group"
|
|
15
|
+
className={cn(
|
|
16
|
+
"group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 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/50 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-[>[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:bg-input/30 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",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const inputGroupAddonVariants = cva(
|
|
25
|
+
"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
|
|
26
|
+
{
|
|
27
|
+
variants: {
|
|
28
|
+
align: {
|
|
29
|
+
"inline-start":
|
|
30
|
+
"order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]",
|
|
31
|
+
"inline-end":
|
|
32
|
+
"order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]",
|
|
33
|
+
"block-start":
|
|
34
|
+
"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
|
|
35
|
+
"block-end":
|
|
36
|
+
"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
align: "inline-start",
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
function InputGroupAddon({
|
|
46
|
+
className,
|
|
47
|
+
align = "inline-start",
|
|
48
|
+
...props
|
|
49
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
role="group"
|
|
53
|
+
data-slot="input-group-addon"
|
|
54
|
+
data-align={align}
|
|
55
|
+
className={cn(inputGroupAddonVariants({ align }), className)}
|
|
56
|
+
onClick={(e) => {
|
|
57
|
+
if ((e.target as HTMLElement).closest("button")) {
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus()
|
|
61
|
+
}}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const inputGroupButtonVariants = cva(
|
|
68
|
+
"flex items-center gap-2 text-sm shadow-none",
|
|
69
|
+
{
|
|
70
|
+
variants: {
|
|
71
|
+
size: {
|
|
72
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
73
|
+
sm: "",
|
|
74
|
+
"icon-xs":
|
|
75
|
+
"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
76
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
defaultVariants: {
|
|
80
|
+
size: "xs",
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
function InputGroupButton({
|
|
86
|
+
className,
|
|
87
|
+
type = "button",
|
|
88
|
+
variant = "ghost",
|
|
89
|
+
size = "xs",
|
|
90
|
+
...props
|
|
91
|
+
}: Omit<React.ComponentProps<typeof Button>, "size" | "type"> &
|
|
92
|
+
VariantProps<typeof inputGroupButtonVariants> & {
|
|
93
|
+
type?: "button" | "submit" | "reset"
|
|
94
|
+
}) {
|
|
95
|
+
return (
|
|
96
|
+
<Button
|
|
97
|
+
type={type}
|
|
98
|
+
data-size={size}
|
|
99
|
+
variant={variant}
|
|
100
|
+
className={cn(inputGroupButtonVariants({ size }), className)}
|
|
101
|
+
{...props}
|
|
102
|
+
/>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
|
|
107
|
+
return (
|
|
108
|
+
<span
|
|
109
|
+
className={cn(
|
|
110
|
+
"flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
111
|
+
className
|
|
112
|
+
)}
|
|
113
|
+
{...props}
|
|
114
|
+
/>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function InputGroupInput({
|
|
119
|
+
className,
|
|
120
|
+
...props
|
|
121
|
+
}: React.ComponentProps<"input">) {
|
|
122
|
+
return (
|
|
123
|
+
<Input
|
|
124
|
+
data-slot="input-group-control"
|
|
125
|
+
className={cn(
|
|
126
|
+
"flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
|
|
127
|
+
className
|
|
128
|
+
)}
|
|
129
|
+
{...props}
|
|
130
|
+
/>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function InputGroupTextarea({
|
|
135
|
+
className,
|
|
136
|
+
...props
|
|
137
|
+
}: React.ComponentProps<"textarea">) {
|
|
138
|
+
return (
|
|
139
|
+
<Textarea
|
|
140
|
+
data-slot="input-group-control"
|
|
141
|
+
className={cn(
|
|
142
|
+
"flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
|
|
143
|
+
className
|
|
144
|
+
)}
|
|
145
|
+
{...props}
|
|
146
|
+
/>
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export {
|
|
151
|
+
InputGroup,
|
|
152
|
+
InputGroupAddon,
|
|
153
|
+
InputGroupButton,
|
|
154
|
+
InputGroupText,
|
|
155
|
+
InputGroupInput,
|
|
156
|
+
InputGroupTextarea,
|
|
157
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Input as InputPrimitive } from "@base-ui/react/input"
|
|
3
|
+
import { cn } from "cn"
|
|
4
|
+
|
|
5
|
+
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
6
|
+
return (
|
|
7
|
+
<InputPrimitive
|
|
8
|
+
type={type}
|
|
9
|
+
data-slot="input"
|
|
10
|
+
className={cn(
|
|
11
|
+
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base transition-[color,box-shadow] 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/50 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:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
12
|
+
className
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { Input }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "cn"
|
|
3
|
+
|
|
4
|
+
function Label({ className, ...props }: React.ComponentProps<"label">) {
|
|
5
|
+
return (
|
|
6
|
+
<label
|
|
7
|
+
data-slot="label"
|
|
8
|
+
className={cn(
|
|
9
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
10
|
+
className
|
|
11
|
+
)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Label }
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "cn"
|
|
3
|
+
|
|
4
|
+
import { Button } from "./button"
|
|
5
|
+
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
|
|
8
|
+
return (
|
|
9
|
+
<nav
|
|
10
|
+
role="navigation"
|
|
11
|
+
aria-label="pagination"
|
|
12
|
+
data-slot="pagination"
|
|
13
|
+
className={cn("mx-auto flex w-full justify-center", className)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function PaginationContent({
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<"ul">) {
|
|
23
|
+
return (
|
|
24
|
+
<ul
|
|
25
|
+
data-slot="pagination-content"
|
|
26
|
+
className={cn("flex items-center gap-1", className)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function PaginationItem({ ...props }: React.ComponentProps<"li">) {
|
|
33
|
+
return <li data-slot="pagination-item" {...props} />
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type PaginationLinkProps = {
|
|
37
|
+
isActive?: boolean
|
|
38
|
+
} & Pick<React.ComponentProps<typeof Button>, "size"> &
|
|
39
|
+
React.ComponentProps<"a">
|
|
40
|
+
|
|
41
|
+
function PaginationLink({
|
|
42
|
+
className,
|
|
43
|
+
isActive,
|
|
44
|
+
size = "icon",
|
|
45
|
+
...props
|
|
46
|
+
}: PaginationLinkProps) {
|
|
47
|
+
return (
|
|
48
|
+
<Button
|
|
49
|
+
variant={isActive ? "outline" : "ghost"}
|
|
50
|
+
size={size}
|
|
51
|
+
className={cn(className)}
|
|
52
|
+
nativeButton={false}
|
|
53
|
+
render={
|
|
54
|
+
<a
|
|
55
|
+
aria-current={isActive ? "page" : undefined}
|
|
56
|
+
data-slot="pagination-link"
|
|
57
|
+
data-active={isActive}
|
|
58
|
+
{...props}
|
|
59
|
+
/>
|
|
60
|
+
}
|
|
61
|
+
/>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function PaginationPrevious({
|
|
66
|
+
className,
|
|
67
|
+
text = "Previous",
|
|
68
|
+
...props
|
|
69
|
+
}: React.ComponentProps<typeof PaginationLink> & { text?: string }) {
|
|
70
|
+
return (
|
|
71
|
+
<PaginationLink
|
|
72
|
+
aria-label="Go to previous page"
|
|
73
|
+
size="default"
|
|
74
|
+
className={cn("pl-2!", className)}
|
|
75
|
+
{...props}
|
|
76
|
+
>
|
|
77
|
+
<ChevronLeftIcon data-icon="inline-start" />
|
|
78
|
+
<span className="hidden sm:block">{text}</span>
|
|
79
|
+
</PaginationLink>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function PaginationNext({
|
|
84
|
+
className,
|
|
85
|
+
text = "Next",
|
|
86
|
+
...props
|
|
87
|
+
}: React.ComponentProps<typeof PaginationLink> & { text?: string }) {
|
|
88
|
+
return (
|
|
89
|
+
<PaginationLink
|
|
90
|
+
aria-label="Go to next page"
|
|
91
|
+
size="default"
|
|
92
|
+
className={cn("pr-2!", className)}
|
|
93
|
+
{...props}
|
|
94
|
+
>
|
|
95
|
+
<span className="hidden sm:block">{text}</span>
|
|
96
|
+
<ChevronRightIcon data-icon="inline-end" />
|
|
97
|
+
</PaginationLink>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function PaginationEllipsis({
|
|
102
|
+
className,
|
|
103
|
+
...props
|
|
104
|
+
}: React.ComponentProps<"span">) {
|
|
105
|
+
return (
|
|
106
|
+
<span
|
|
107
|
+
aria-hidden
|
|
108
|
+
data-slot="pagination-ellipsis"
|
|
109
|
+
className={cn(
|
|
110
|
+
"flex size-9 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
|
|
111
|
+
className
|
|
112
|
+
)}
|
|
113
|
+
{...props}
|
|
114
|
+
>
|
|
115
|
+
<MoreHorizontalIcon
|
|
116
|
+
/>
|
|
117
|
+
<span className="sr-only">More pages</span>
|
|
118
|
+
</span>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
Pagination,
|
|
124
|
+
PaginationContent,
|
|
125
|
+
PaginationEllipsis,
|
|
126
|
+
PaginationItem,
|
|
127
|
+
PaginationLink,
|
|
128
|
+
PaginationNext,
|
|
129
|
+
PaginationPrevious,
|
|
130
|
+
}
|