@xk2800/nextjs-template 0.7.1-beta.12 → 0.7.1-beta.13
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/components/ui/calendar.tsx +220 -0
- package/components/ui/category-selector.tsx +215 -0
- package/components/ui/chart.tsx +374 -0
- package/components/ui/column-picker.tsx +140 -0
- package/components/ui/command.tsx +184 -0
- package/components/ui/data-table.tsx +31 -2
- package/components/ui/date-picker-with-presets.tsx +122 -0
- package/components/ui/disclaimer.tsx +4 -0
- package/components/ui/field.tsx +248 -0
- package/components/ui/info-tooltip.tsx +53 -0
- package/components/ui/month-selector.tsx +194 -0
- package/components/ui/navigation-menu.tsx +168 -0
- package/components/ui/pagination.tsx +127 -0
- package/components/ui/popover.tsx +89 -0
- package/components/ui/source-selector.tsx +164 -0
- package/dist/activity/queries.d.mts +1 -1
- package/dist/activity/queries.d.ts +1 -1
- package/dist/auth/index.d.mts +2 -2
- package/dist/auth/index.d.ts +2 -2
- package/dist/db/index.d.mts +1 -1
- package/dist/db/index.d.ts +1 -1
- package/dist/db/schema.d.mts +1 -1
- package/dist/db/schema.d.ts +1 -1
- package/dist/{schema-CN_Y6EXv.d.mts → schema-lgO4CzE4.d.mts} +1 -1
- package/dist/{schema-CN_Y6EXv.d.ts → schema-lgO4CzE4.d.ts} +1 -1
- package/dist/settings/queries.d.mts +1 -1
- package/dist/settings/queries.d.ts +1 -1
- package/package.json +24 -2
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cva } from "class-variance-authority"
|
|
3
|
+
import { ChevronDownIcon } from "lucide-react"
|
|
4
|
+
import { NavigationMenu as NavigationMenuPrimitive } from "radix-ui"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
|
|
8
|
+
function NavigationMenu({
|
|
9
|
+
className,
|
|
10
|
+
children,
|
|
11
|
+
viewport = true,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
|
|
14
|
+
viewport?: boolean
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<NavigationMenuPrimitive.Root
|
|
18
|
+
data-slot="navigation-menu"
|
|
19
|
+
data-viewport={viewport}
|
|
20
|
+
className={cn(
|
|
21
|
+
"group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
>
|
|
26
|
+
{children}
|
|
27
|
+
{viewport && <NavigationMenuViewport />}
|
|
28
|
+
</NavigationMenuPrimitive.Root>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function NavigationMenuList({
|
|
33
|
+
className,
|
|
34
|
+
...props
|
|
35
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {
|
|
36
|
+
return (
|
|
37
|
+
<NavigationMenuPrimitive.List
|
|
38
|
+
data-slot="navigation-menu-list"
|
|
39
|
+
className={cn(
|
|
40
|
+
"group flex flex-1 list-none items-center justify-center gap-1",
|
|
41
|
+
className
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function NavigationMenuItem({
|
|
49
|
+
className,
|
|
50
|
+
...props
|
|
51
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {
|
|
52
|
+
return (
|
|
53
|
+
<NavigationMenuPrimitive.Item
|
|
54
|
+
data-slot="navigation-menu-item"
|
|
55
|
+
className={cn("relative", className)}
|
|
56
|
+
{...props}
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const navigationMenuTriggerStyle = cva(
|
|
62
|
+
"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-[color,box-shadow] outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=open]:bg-accent/50 data-[state=open]:text-accent-foreground data-[state=open]:hover:bg-accent data-[state=open]:focus:bg-accent"
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
function NavigationMenuTrigger({
|
|
66
|
+
className,
|
|
67
|
+
children,
|
|
68
|
+
...props
|
|
69
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
|
|
70
|
+
return (
|
|
71
|
+
<NavigationMenuPrimitive.Trigger
|
|
72
|
+
data-slot="navigation-menu-trigger"
|
|
73
|
+
className={cn(navigationMenuTriggerStyle(), "group", className)}
|
|
74
|
+
{...props}
|
|
75
|
+
>
|
|
76
|
+
{children}{" "}
|
|
77
|
+
<ChevronDownIcon
|
|
78
|
+
className="relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180"
|
|
79
|
+
aria-hidden="true"
|
|
80
|
+
/>
|
|
81
|
+
</NavigationMenuPrimitive.Trigger>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function NavigationMenuContent({
|
|
86
|
+
className,
|
|
87
|
+
...props
|
|
88
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {
|
|
89
|
+
return (
|
|
90
|
+
<NavigationMenuPrimitive.Content
|
|
91
|
+
data-slot="navigation-menu-content"
|
|
92
|
+
className={cn(
|
|
93
|
+
"top-0 left-0 w-full p-2 pr-2.5 data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out md:absolute md:w-auto",
|
|
94
|
+
"group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95",
|
|
95
|
+
className
|
|
96
|
+
)}
|
|
97
|
+
{...props}
|
|
98
|
+
/>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function NavigationMenuViewport({
|
|
103
|
+
className,
|
|
104
|
+
...props
|
|
105
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) {
|
|
106
|
+
return (
|
|
107
|
+
<div
|
|
108
|
+
className={cn(
|
|
109
|
+
"absolute top-full left-0 isolate z-50 flex justify-center"
|
|
110
|
+
)}
|
|
111
|
+
>
|
|
112
|
+
<NavigationMenuPrimitive.Viewport
|
|
113
|
+
data-slot="navigation-menu-viewport"
|
|
114
|
+
className={cn(
|
|
115
|
+
"origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",
|
|
116
|
+
className
|
|
117
|
+
)}
|
|
118
|
+
{...props}
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function NavigationMenuLink({
|
|
125
|
+
className,
|
|
126
|
+
...props
|
|
127
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {
|
|
128
|
+
return (
|
|
129
|
+
<NavigationMenuPrimitive.Link
|
|
130
|
+
data-slot="navigation-menu-link"
|
|
131
|
+
className={cn(
|
|
132
|
+
"flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground data-[active=true]:hover:bg-accent data-[active=true]:focus:bg-accent [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
133
|
+
className
|
|
134
|
+
)}
|
|
135
|
+
{...props}
|
|
136
|
+
/>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function NavigationMenuIndicator({
|
|
141
|
+
className,
|
|
142
|
+
...props
|
|
143
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {
|
|
144
|
+
return (
|
|
145
|
+
<NavigationMenuPrimitive.Indicator
|
|
146
|
+
data-slot="navigation-menu-indicator"
|
|
147
|
+
className={cn(
|
|
148
|
+
"top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:animate-in data-[state=visible]:fade-in",
|
|
149
|
+
className
|
|
150
|
+
)}
|
|
151
|
+
{...props}
|
|
152
|
+
>
|
|
153
|
+
<div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
|
|
154
|
+
</NavigationMenuPrimitive.Indicator>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export {
|
|
159
|
+
NavigationMenu,
|
|
160
|
+
NavigationMenuList,
|
|
161
|
+
NavigationMenuItem,
|
|
162
|
+
NavigationMenuContent,
|
|
163
|
+
NavigationMenuTrigger,
|
|
164
|
+
NavigationMenuLink,
|
|
165
|
+
NavigationMenuIndicator,
|
|
166
|
+
NavigationMenuViewport,
|
|
167
|
+
navigationMenuTriggerStyle,
|
|
168
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import {
|
|
3
|
+
ChevronLeftIcon,
|
|
4
|
+
ChevronRightIcon,
|
|
5
|
+
MoreHorizontalIcon,
|
|
6
|
+
} from "lucide-react"
|
|
7
|
+
|
|
8
|
+
import { cn } from "../../lib/utils"
|
|
9
|
+
import { buttonVariants, type Button } from "./button"
|
|
10
|
+
|
|
11
|
+
function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
|
|
12
|
+
return (
|
|
13
|
+
<nav
|
|
14
|
+
role="navigation"
|
|
15
|
+
aria-label="pagination"
|
|
16
|
+
data-slot="pagination"
|
|
17
|
+
className={cn("mx-auto flex w-full justify-center", className)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function PaginationContent({
|
|
24
|
+
className,
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<"ul">) {
|
|
27
|
+
return (
|
|
28
|
+
<ul
|
|
29
|
+
data-slot="pagination-content"
|
|
30
|
+
className={cn("flex flex-row items-center gap-1", className)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function PaginationItem({ ...props }: React.ComponentProps<"li">) {
|
|
37
|
+
return <li data-slot="pagination-item" {...props} />
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type PaginationLinkProps = {
|
|
41
|
+
isActive?: boolean
|
|
42
|
+
} & Pick<React.ComponentProps<typeof Button>, "size"> &
|
|
43
|
+
React.ComponentProps<"a">
|
|
44
|
+
|
|
45
|
+
function PaginationLink({
|
|
46
|
+
className,
|
|
47
|
+
isActive,
|
|
48
|
+
size = "icon",
|
|
49
|
+
...props
|
|
50
|
+
}: PaginationLinkProps) {
|
|
51
|
+
return (
|
|
52
|
+
<a
|
|
53
|
+
aria-current={isActive ? "page" : undefined}
|
|
54
|
+
data-slot="pagination-link"
|
|
55
|
+
data-active={isActive}
|
|
56
|
+
className={cn(
|
|
57
|
+
buttonVariants({
|
|
58
|
+
variant: isActive ? "outline" : "ghost",
|
|
59
|
+
size,
|
|
60
|
+
}),
|
|
61
|
+
className
|
|
62
|
+
)}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function PaginationPrevious({
|
|
69
|
+
className,
|
|
70
|
+
...props
|
|
71
|
+
}: React.ComponentProps<typeof PaginationLink>) {
|
|
72
|
+
return (
|
|
73
|
+
<PaginationLink
|
|
74
|
+
aria-label="Go to previous page"
|
|
75
|
+
size="default"
|
|
76
|
+
className={cn("gap-1 px-2.5 sm:pl-2.5", className)}
|
|
77
|
+
{...props}
|
|
78
|
+
>
|
|
79
|
+
<ChevronLeftIcon />
|
|
80
|
+
<span className="hidden sm:block">Previous</span>
|
|
81
|
+
</PaginationLink>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function PaginationNext({
|
|
86
|
+
className,
|
|
87
|
+
...props
|
|
88
|
+
}: React.ComponentProps<typeof PaginationLink>) {
|
|
89
|
+
return (
|
|
90
|
+
<PaginationLink
|
|
91
|
+
aria-label="Go to next page"
|
|
92
|
+
size="default"
|
|
93
|
+
className={cn("gap-1 px-2.5 sm:pr-2.5", className)}
|
|
94
|
+
{...props}
|
|
95
|
+
>
|
|
96
|
+
<span className="hidden sm:block">Next</span>
|
|
97
|
+
<ChevronRightIcon />
|
|
98
|
+
</PaginationLink>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function PaginationEllipsis({
|
|
103
|
+
className,
|
|
104
|
+
...props
|
|
105
|
+
}: React.ComponentProps<"span">) {
|
|
106
|
+
return (
|
|
107
|
+
<span
|
|
108
|
+
aria-hidden
|
|
109
|
+
data-slot="pagination-ellipsis"
|
|
110
|
+
className={cn("flex size-9 items-center justify-center", className)}
|
|
111
|
+
{...props}
|
|
112
|
+
>
|
|
113
|
+
<MoreHorizontalIcon className="size-4" />
|
|
114
|
+
<span className="sr-only">More pages</span>
|
|
115
|
+
</span>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export {
|
|
120
|
+
Pagination,
|
|
121
|
+
PaginationContent,
|
|
122
|
+
PaginationLink,
|
|
123
|
+
PaginationItem,
|
|
124
|
+
PaginationPrevious,
|
|
125
|
+
PaginationNext,
|
|
126
|
+
PaginationEllipsis,
|
|
127
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Popover as PopoverPrimitive } from "radix-ui"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
|
|
8
|
+
function Popover({
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
11
|
+
return <PopoverPrimitive.Root data-slot="popover" {...props} />
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function PopoverTrigger({
|
|
15
|
+
...props
|
|
16
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
17
|
+
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function PopoverContent({
|
|
21
|
+
className,
|
|
22
|
+
align = "center",
|
|
23
|
+
sideOffset = 4,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
26
|
+
return (
|
|
27
|
+
<PopoverPrimitive.Portal>
|
|
28
|
+
<PopoverPrimitive.Content
|
|
29
|
+
data-slot="popover-content"
|
|
30
|
+
align={align}
|
|
31
|
+
sideOffset={sideOffset}
|
|
32
|
+
className={cn(
|
|
33
|
+
"z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden 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 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
34
|
+
className
|
|
35
|
+
)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
</PopoverPrimitive.Portal>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function PopoverAnchor({
|
|
43
|
+
...props
|
|
44
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
45
|
+
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
49
|
+
return (
|
|
50
|
+
<div
|
|
51
|
+
data-slot="popover-header"
|
|
52
|
+
className={cn("flex flex-col gap-1 text-sm", className)}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function PopoverTitle({ className, ...props }: React.ComponentProps<"h2">) {
|
|
59
|
+
return (
|
|
60
|
+
<div
|
|
61
|
+
data-slot="popover-title"
|
|
62
|
+
className={cn("font-medium", className)}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function PopoverDescription({
|
|
69
|
+
className,
|
|
70
|
+
...props
|
|
71
|
+
}: React.ComponentProps<"p">) {
|
|
72
|
+
return (
|
|
73
|
+
<p
|
|
74
|
+
data-slot="popover-description"
|
|
75
|
+
className={cn("text-muted-foreground", className)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export {
|
|
82
|
+
Popover,
|
|
83
|
+
PopoverTrigger,
|
|
84
|
+
PopoverContent,
|
|
85
|
+
PopoverAnchor,
|
|
86
|
+
PopoverHeader,
|
|
87
|
+
PopoverTitle,
|
|
88
|
+
PopoverDescription,
|
|
89
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Check, ChevronDown, Plus } from "lucide-react"
|
|
5
|
+
import { cn } from "../../lib/utils"
|
|
6
|
+
import { Button } from "./button"
|
|
7
|
+
import { Input } from "./input"
|
|
8
|
+
import {
|
|
9
|
+
Command,
|
|
10
|
+
CommandEmpty,
|
|
11
|
+
CommandGroup,
|
|
12
|
+
CommandInput,
|
|
13
|
+
CommandItem,
|
|
14
|
+
CommandList,
|
|
15
|
+
CommandSeparator,
|
|
16
|
+
} from "./command"
|
|
17
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./popover"
|
|
18
|
+
import { Disclaimer } from "./disclaimer"
|
|
19
|
+
import type { SuggestionGroup } from "./category-selector"
|
|
20
|
+
|
|
21
|
+
interface SourceSelectorProps {
|
|
22
|
+
/** The user's existing sources. The value is the source name. */
|
|
23
|
+
sources: { id: string | number; name: string }[]
|
|
24
|
+
isLoading?: boolean
|
|
25
|
+
value?: string
|
|
26
|
+
onSourceChange?: (sourceName: string) => void
|
|
27
|
+
onNewSourceChange?: (newSourceName: string) => void
|
|
28
|
+
newSourceValue?: string
|
|
29
|
+
className?: string
|
|
30
|
+
placeholder?: string
|
|
31
|
+
disabled?: boolean
|
|
32
|
+
/** Extra names offered below the user's own sources; picking one selects that name. */
|
|
33
|
+
suggestionGroups?: SuggestionGroup[]
|
|
34
|
+
/** Small print under the new-source input. */
|
|
35
|
+
newSourceNote?: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Combobox over named sources (selected by name), with optional suggestion groups and "Add new source". */
|
|
39
|
+
export function SourceSelector({
|
|
40
|
+
sources,
|
|
41
|
+
isLoading = false,
|
|
42
|
+
value,
|
|
43
|
+
onSourceChange,
|
|
44
|
+
onNewSourceChange,
|
|
45
|
+
newSourceValue = "",
|
|
46
|
+
className,
|
|
47
|
+
placeholder = "Select a source...",
|
|
48
|
+
disabled = false,
|
|
49
|
+
suggestionGroups,
|
|
50
|
+
newSourceNote,
|
|
51
|
+
}: SourceSelectorProps) {
|
|
52
|
+
const [open, setOpen] = React.useState(false)
|
|
53
|
+
const [showNewInput, setShowNewInput] = React.useState(false)
|
|
54
|
+
const groups = suggestionGroups?.filter((g) => g.items.length > 0) ?? []
|
|
55
|
+
|
|
56
|
+
const handleSourceSelect = (name: string) => {
|
|
57
|
+
onSourceChange?.(name)
|
|
58
|
+
onNewSourceChange?.("")
|
|
59
|
+
setShowNewInput(false)
|
|
60
|
+
setOpen(false)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const handleAddNew = () => {
|
|
64
|
+
onSourceChange?.("")
|
|
65
|
+
setShowNewInput(true)
|
|
66
|
+
setOpen(false)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const triggerLabel = isLoading
|
|
70
|
+
? "Loading..."
|
|
71
|
+
: value
|
|
72
|
+
? value
|
|
73
|
+
: showNewInput
|
|
74
|
+
? "Add new source"
|
|
75
|
+
: placeholder
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<div className={cn("space-y-2", className)}>
|
|
79
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
80
|
+
<PopoverTrigger asChild>
|
|
81
|
+
<Button
|
|
82
|
+
variant="outline"
|
|
83
|
+
role="combobox"
|
|
84
|
+
aria-expanded={open}
|
|
85
|
+
className="w-full justify-between"
|
|
86
|
+
disabled={disabled || isLoading}
|
|
87
|
+
>
|
|
88
|
+
{triggerLabel}
|
|
89
|
+
<ChevronDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
|
90
|
+
</Button>
|
|
91
|
+
</PopoverTrigger>
|
|
92
|
+
<PopoverContent className="w-full p-0">
|
|
93
|
+
<Command>
|
|
94
|
+
<CommandInput placeholder="Search sources..." />
|
|
95
|
+
<CommandList>
|
|
96
|
+
<CommandEmpty>No sources found.</CommandEmpty>
|
|
97
|
+
|
|
98
|
+
<CommandGroup heading={groups.length ? "My Sources" : undefined}>
|
|
99
|
+
{sources.map((source) => (
|
|
100
|
+
<CommandItem
|
|
101
|
+
key={source.id}
|
|
102
|
+
value={source.name}
|
|
103
|
+
onSelect={() => handleSourceSelect(source.name)}
|
|
104
|
+
>
|
|
105
|
+
{source.name}
|
|
106
|
+
<Check
|
|
107
|
+
className={cn(
|
|
108
|
+
"ml-auto h-4 w-4",
|
|
109
|
+
value === source.name ? "opacity-100" : "opacity-0"
|
|
110
|
+
)}
|
|
111
|
+
/>
|
|
112
|
+
</CommandItem>
|
|
113
|
+
))}
|
|
114
|
+
<CommandItem onSelect={handleAddNew}>
|
|
115
|
+
<Plus className="mr-2 h-4 w-4" />
|
|
116
|
+
Add new source
|
|
117
|
+
</CommandItem>
|
|
118
|
+
</CommandGroup>
|
|
119
|
+
|
|
120
|
+
{groups.map((group) => (
|
|
121
|
+
<React.Fragment key={group.heading}>
|
|
122
|
+
<CommandSeparator />
|
|
123
|
+
<CommandGroup heading={group.heading}>
|
|
124
|
+
{group.items.map((s) => (
|
|
125
|
+
<CommandItem
|
|
126
|
+
key={s.name}
|
|
127
|
+
value={s.name}
|
|
128
|
+
onSelect={() => handleSourceSelect(s.name)}
|
|
129
|
+
>
|
|
130
|
+
<div className="flex flex-col">
|
|
131
|
+
<span>{s.name}</span>
|
|
132
|
+
{s.note && <span className="text-xs text-muted-foreground">{s.note}</span>}
|
|
133
|
+
</div>
|
|
134
|
+
<Check
|
|
135
|
+
className={cn(
|
|
136
|
+
"ml-auto h-4 w-4 shrink-0",
|
|
137
|
+
value === s.name ? "opacity-100" : "opacity-0"
|
|
138
|
+
)}
|
|
139
|
+
/>
|
|
140
|
+
</CommandItem>
|
|
141
|
+
))}
|
|
142
|
+
</CommandGroup>
|
|
143
|
+
</React.Fragment>
|
|
144
|
+
))}
|
|
145
|
+
</CommandList>
|
|
146
|
+
</Command>
|
|
147
|
+
</PopoverContent>
|
|
148
|
+
</Popover>
|
|
149
|
+
|
|
150
|
+
{showNewInput && (
|
|
151
|
+
<>
|
|
152
|
+
<Input
|
|
153
|
+
placeholder="Enter new source name..."
|
|
154
|
+
value={newSourceValue}
|
|
155
|
+
onChange={(e) => onNewSourceChange?.(e.target.value)}
|
|
156
|
+
disabled={disabled}
|
|
157
|
+
autoFocus
|
|
158
|
+
/>
|
|
159
|
+
{newSourceNote && <Disclaimer disclaimerText={newSourceNote} />}
|
|
160
|
+
</>
|
|
161
|
+
)}
|
|
162
|
+
</div>
|
|
163
|
+
)
|
|
164
|
+
}
|
package/dist/auth/index.d.mts
CHANGED
|
@@ -891,7 +891,7 @@ declare function createAuth(overrides?: AuthOverrides): better_auth.Auth<{
|
|
|
891
891
|
$Infer: {
|
|
892
892
|
body: {
|
|
893
893
|
permissions: {
|
|
894
|
-
readonly user?: ("
|
|
894
|
+
readonly user?: ("set-role" | "delete" | "update" | "list" | "create" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
895
895
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
896
896
|
};
|
|
897
897
|
} & {
|
|
@@ -3175,7 +3175,7 @@ declare const auth: better_auth.Auth<{
|
|
|
3175
3175
|
$Infer: {
|
|
3176
3176
|
body: {
|
|
3177
3177
|
permissions: {
|
|
3178
|
-
readonly user?: ("
|
|
3178
|
+
readonly user?: ("set-role" | "delete" | "update" | "list" | "create" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
3179
3179
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
3180
3180
|
};
|
|
3181
3181
|
} & {
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -891,7 +891,7 @@ declare function createAuth(overrides?: AuthOverrides): better_auth.Auth<{
|
|
|
891
891
|
$Infer: {
|
|
892
892
|
body: {
|
|
893
893
|
permissions: {
|
|
894
|
-
readonly user?: ("
|
|
894
|
+
readonly user?: ("set-role" | "delete" | "update" | "list" | "create" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
895
895
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
896
896
|
};
|
|
897
897
|
} & {
|
|
@@ -3175,7 +3175,7 @@ declare const auth: better_auth.Auth<{
|
|
|
3175
3175
|
$Infer: {
|
|
3176
3176
|
body: {
|
|
3177
3177
|
permissions: {
|
|
3178
|
-
readonly user?: ("
|
|
3178
|
+
readonly user?: ("set-role" | "delete" | "update" | "list" | "create" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "get")[] | undefined;
|
|
3179
3179
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
3180
3180
|
};
|
|
3181
3181
|
} & {
|
package/dist/db/index.d.mts
CHANGED
package/dist/db/index.d.ts
CHANGED
package/dist/db/schema.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'drizzle-orm';
|
|
2
2
|
import 'drizzle-orm/pg-core';
|
|
3
|
-
export { A as ActivityActionEnum, R as RoleEnum, b as accounts, c as activityLogs, d as authThrottle, e as consentLog, f as deviceFingerprints, g as errorRefs, p as passkeys, h as sessions, s as systemSettings, t as twoFactors, u as users, v as verifications } from '../schema-
|
|
3
|
+
export { A as ActivityActionEnum, R as RoleEnum, b as accounts, c as activityLogs, d as authThrottle, e as consentLog, f as deviceFingerprints, g as errorRefs, p as passkeys, h as sessions, s as systemSettings, t as twoFactors, u as users, v as verifications } from '../schema-lgO4CzE4.mjs';
|
package/dist/db/schema.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'drizzle-orm';
|
|
2
2
|
import 'drizzle-orm/pg-core';
|
|
3
|
-
export { A as ActivityActionEnum, R as RoleEnum, b as accounts, c as activityLogs, d as authThrottle, e as consentLog, f as deviceFingerprints, g as errorRefs, p as passkeys, h as sessions, s as systemSettings, t as twoFactors, u as users, v as verifications } from '../schema-
|
|
3
|
+
export { A as ActivityActionEnum, R as RoleEnum, b as accounts, c as activityLogs, d as authThrottle, e as consentLog, f as deviceFingerprints, g as errorRefs, p as passkeys, h as sessions, s as systemSettings, t as twoFactors, u as users, v as verifications } from '../schema-lgO4CzE4.js';
|
|
@@ -1142,7 +1142,7 @@ declare const activityLogs: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1142
1142
|
tableName: "activity_log";
|
|
1143
1143
|
dataType: "string";
|
|
1144
1144
|
columnType: "PgEnumColumn";
|
|
1145
|
-
data: "
|
|
1145
|
+
data: "login_failed" | "login" | "logout" | "password_changed" | "email_changed" | "profile_updated" | "session_revoked" | "user_deleted" | "user_banned" | "user_unbanned" | "role_changed" | "impersonation_started" | "impersonation_stopped" | "settings_changed" | "passkey_added" | "passkey_removed";
|
|
1146
1146
|
driverParam: string;
|
|
1147
1147
|
notNull: true;
|
|
1148
1148
|
hasDefault: false;
|
|
@@ -1142,7 +1142,7 @@ declare const activityLogs: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1142
1142
|
tableName: "activity_log";
|
|
1143
1143
|
dataType: "string";
|
|
1144
1144
|
columnType: "PgEnumColumn";
|
|
1145
|
-
data: "
|
|
1145
|
+
data: "login_failed" | "login" | "logout" | "password_changed" | "email_changed" | "profile_updated" | "session_revoked" | "user_deleted" | "user_banned" | "user_unbanned" | "role_changed" | "impersonation_started" | "impersonation_stopped" | "settings_changed" | "passkey_added" | "passkey_removed";
|
|
1146
1146
|
driverParam: string;
|
|
1147
1147
|
notNull: true;
|
|
1148
1148
|
hasDefault: false;
|