@oussemasahbeni/keycloakify-login-shadcn 250004.0.8 → 250004.0.10

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 (30) hide show
  1. package/README.md +317 -0
  2. package/keycloak-theme/components/ui/alert.tsx +69 -61
  3. package/keycloak-theme/components/ui/button.tsx +44 -38
  4. package/keycloak-theme/components/ui/card.tsx +60 -45
  5. package/keycloak-theme/components/ui/checkbox.tsx +24 -22
  6. package/keycloak-theme/components/ui/dropdown-menu.tsx +231 -176
  7. package/keycloak-theme/components/ui/field.tsx +51 -48
  8. package/keycloak-theme/components/ui/input-otp.tsx +56 -49
  9. package/keycloak-theme/components/ui/input.tsx +18 -21
  10. package/keycloak-theme/components/ui/label.tsx +19 -20
  11. package/keycloak-theme/components/ui/radio-group.tsx +27 -25
  12. package/keycloak-theme/components/ui/select.tsx +160 -121
  13. package/keycloak-theme/components/ui/separator.tsx +23 -23
  14. package/keycloak-theme/components/ui/tooltip.tsx +54 -24
  15. package/keycloak-theme/login/KcPage.tsx +0 -1
  16. package/keycloak-theme/login/components/Template/Template.tsx +2 -2
  17. package/keycloak-theme/login/components/Template/useInitializeTemplate.ts +3 -19
  18. package/keycloak-theme/login/index.css +3 -20
  19. package/keycloak-theme/login/pages/login/Form.tsx +49 -51
  20. package/keycloak-theme/login/pages/login/SocialProviders.tsx +9 -4
  21. package/keycloak-theme/login/pages/login/providers/github.svg +4 -3
  22. package/keycloak-theme/login/pages/login/providers/x.svg +4 -3
  23. package/keycloak-theme/login/pages/login/useProviderLogos.tsx +2 -3
  24. package/keycloak-theme/login/styleLevelCustomization.tsx +1 -0
  25. package/keycloak-theme/public/keycloak-theme/login/js/authChecker.js +95 -0
  26. package/keycloak-theme/public/keycloak-theme/login/js/passkeysConditionalAuth.js +86 -0
  27. package/keycloak-theme/public/keycloak-theme/login/js/rfc4648.js +185 -0
  28. package/keycloak-theme/public/keycloak-theme/login/js/webauthnAuthenticate.js +113 -0
  29. package/keycloak-theme/public/keycloak-theme/login/js/webauthnRegister.js +153 -0
  30. package/package.json +1 -1
@@ -1,72 +1,87 @@
1
- import * as React from "react";
1
+ import * as React from "react"
2
2
 
3
- import { cn } from "@/components/lib/utils";
3
+ import { cn } from '../lib/utils'
4
4
 
5
- const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
6
- ({ className, ...props }, ref) => (
5
+ function Card({ className, ...props }: React.ComponentProps<"div">) {
6
+ return (
7
7
  <div
8
- ref={ref}
8
+ data-slot="card"
9
9
  className={cn(
10
- "rounded-xl border bg-card text-card-foreground shadow",
10
+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
11
11
  className
12
12
  )}
13
13
  {...props}
14
14
  />
15
15
  )
16
- );
17
- Card.displayName = "Card";
16
+ }
18
17
 
19
- const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
20
- ({ className, ...props }, ref) => (
18
+ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
19
+ return (
21
20
  <div
22
- ref={ref}
23
- className={cn("flex flex-col space-y-1.5 p-6", className)}
21
+ data-slot="card-header"
22
+ className={cn(
23
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
24
+ className
25
+ )}
26
+ {...props}
27
+ />
28
+ )
29
+ }
30
+
31
+ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
32
+ return (
33
+ <div
34
+ data-slot="card-title"
35
+ className={cn("leading-none font-semibold", className)}
24
36
  {...props}
25
37
  />
26
38
  )
27
- );
28
- CardHeader.displayName = "CardHeader";
39
+ }
29
40
 
30
- const CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
31
- ({ className, ...props }, ref) => (
41
+ function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
42
+ return (
32
43
  <div
33
- ref={ref}
34
- className={cn("font-semibold leading-none tracking-tight", className)}
44
+ data-slot="card-description"
45
+ className={cn("text-muted-foreground text-sm", className)}
35
46
  {...props}
36
47
  />
37
48
  )
38
- );
39
- CardTitle.displayName = "CardTitle";
49
+ }
40
50
 
41
- const CardDescription = React.forwardRef<
42
- HTMLDivElement,
43
- React.HTMLAttributes<HTMLDivElement>
44
- >(({ className, ...props }, ref) => (
45
- <div
46
- ref={ref}
47
- className={cn("text-sm text-muted-foreground", className)}
48
- {...props}
49
- />
50
- ));
51
- CardDescription.displayName = "CardDescription";
51
+ function CardAction({ className, ...props }: React.ComponentProps<"div">) {
52
+ return (
53
+ <div
54
+ data-slot="card-action"
55
+ className={cn(
56
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
57
+ className
58
+ )}
59
+ {...props}
60
+ />
61
+ )
62
+ }
52
63
 
53
- const CardContent = React.forwardRef<
54
- HTMLDivElement,
55
- React.HTMLAttributes<HTMLDivElement>
56
- >(({ className, ...props }, ref) => (
57
- <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
58
- ));
59
- CardContent.displayName = "CardContent";
64
+ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
65
+ return (
66
+ <div
67
+ data-slot="card-content"
68
+ className={cn("px-6", className)}
69
+ {...props}
70
+ />
71
+ )
72
+ }
60
73
 
61
- const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
62
- ({ className, ...props }, ref) => (
74
+ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
75
+ return (
63
76
  <div
64
- ref={ref}
65
- className={cn("flex items-center p-6 pt-0", className)}
77
+ data-slot="card-footer"
78
+ className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
66
79
  {...props}
67
80
  />
68
81
  )
69
- );
70
- CardFooter.displayName = "CardFooter";
82
+ }
83
+
84
+ export {
85
+ Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle
86
+ }
71
87
 
72
- export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
@@ -1,28 +1,30 @@
1
- import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
2
- import { Check } from "lucide-react";
3
- import * as React from "react";
1
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
2
+ import { CheckIcon } from "lucide-react"
3
+ import * as React from "react"
4
4
 
5
- import { cn } from "@/components/lib/utils";
5
+ import { cn } from '../lib/utils'
6
6
 
7
- const Checkbox = React.forwardRef<
8
- React.ElementRef<typeof CheckboxPrimitive.Root>,
9
- React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
10
- >(({ className, ...props }, ref) => (
7
+ function Checkbox({
8
+ className,
9
+ ...props
10
+ }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
11
+ return (
11
12
  <CheckboxPrimitive.Root
12
- ref={ref}
13
- className={cn(
14
- "grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
15
- className
16
- )}
17
- {...props}
13
+ data-slot="checkbox"
14
+ className={cn(
15
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-sm border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
16
+ className
17
+ )}
18
+ {...props}
18
19
  >
19
- <CheckboxPrimitive.Indicator
20
- className={cn("grid place-content-center text-current")}
21
- >
22
- <Check className="h-4 w-4" />
23
- </CheckboxPrimitive.Indicator>
20
+ <CheckboxPrimitive.Indicator
21
+ data-slot="checkbox-indicator"
22
+ className="grid place-content-center text-current transition-none"
23
+ >
24
+ <CheckIcon className="size-3.5" />
25
+ </CheckboxPrimitive.Indicator>
24
26
  </CheckboxPrimitive.Root>
25
- ));
26
- Checkbox.displayName = CheckboxPrimitive.Root.displayName;
27
+ )
28
+ }
27
29
 
28
- export { Checkbox };
30
+ export { Checkbox }
@@ -1,192 +1,247 @@
1
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
2
- import { Check, ChevronRight, Circle } from "lucide-react";
3
- import * as React from "react";
4
-
5
- import { cn } from "@/components/lib/utils";
6
-
7
- const DropdownMenu = DropdownMenuPrimitive.Root;
8
-
9
- const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
10
-
11
- const DropdownMenuGroup = DropdownMenuPrimitive.Group;
12
-
13
- const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
14
-
15
- const DropdownMenuSub = DropdownMenuPrimitive.Sub;
16
-
17
- const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
18
-
19
- const DropdownMenuSubTrigger = React.forwardRef<
20
- React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
21
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
22
- inset?: boolean;
23
- }
24
- >(({ className, inset, children, ...props }, ref) => (
25
- <DropdownMenuPrimitive.SubTrigger
26
- ref={ref}
27
- className={cn(
28
- "flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
29
- inset && "pl-8",
30
- className
31
- )}
32
- {...props}
33
- >
34
- {children}
35
- <ChevronRight className="ml-auto" />
36
- </DropdownMenuPrimitive.SubTrigger>
37
- ));
38
- DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
39
-
40
- const DropdownMenuSubContent = React.forwardRef<
41
- React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
42
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
43
- >(({ className, ...props }, ref) => (
44
- <DropdownMenuPrimitive.SubContent
45
- ref={ref}
46
- className={cn(
47
- "z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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 origin-[--radix-dropdown-menu-content-transform-origin]",
48
- className
49
- )}
50
- {...props}
51
- />
52
- ));
53
- DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
54
-
55
- const DropdownMenuContent = React.forwardRef<
56
- React.ElementRef<typeof DropdownMenuPrimitive.Content>,
57
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
58
- >(({ className, sideOffset = 4, ...props }, ref) => (
59
- <DropdownMenuPrimitive.Portal>
60
- <DropdownMenuPrimitive.Content
61
- ref={ref}
62
- sideOffset={sideOffset}
1
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
2
+ import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
3
+ import * as React from "react"
4
+
5
+ import { cn } from '../lib/utils'
6
+
7
+ function DropdownMenu({
8
+ ...props
9
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
10
+ return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
11
+ }
12
+
13
+ function DropdownMenuPortal({
14
+ ...props
15
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
16
+ return (
17
+ <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
18
+ )
19
+ }
20
+
21
+ function DropdownMenuTrigger({
22
+ ...props
23
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
24
+ return (
25
+ <DropdownMenuPrimitive.Trigger
26
+ data-slot="dropdown-menu-trigger"
27
+ {...props}
28
+ />
29
+ )
30
+ }
31
+
32
+ function DropdownMenuContent({
33
+ className,
34
+ sideOffset = 4,
35
+ ...props
36
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
37
+ return (
38
+ <DropdownMenuPrimitive.Portal>
39
+ <DropdownMenuPrimitive.Content
40
+ data-slot="dropdown-menu-content"
41
+ sideOffset={sideOffset}
42
+ className={cn(
43
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
44
+ className
45
+ )}
46
+ {...props}
47
+ />
48
+ </DropdownMenuPrimitive.Portal>
49
+ )
50
+ }
51
+
52
+ function DropdownMenuGroup({
53
+ ...props
54
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
55
+ return (
56
+ <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
57
+ )
58
+ }
59
+
60
+ function DropdownMenuItem({
61
+ className,
62
+ inset,
63
+ variant = "default",
64
+ ...props
65
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
66
+ inset?: boolean
67
+ variant?: "default" | "destructive"
68
+ }) {
69
+ return (
70
+ <DropdownMenuPrimitive.Item
71
+ data-slot="dropdown-menu-item"
72
+ data-inset={inset}
73
+ data-variant={variant}
74
+ className={cn(
75
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive! [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
76
+ className
77
+ )}
78
+ {...props}
79
+ />
80
+ )
81
+ }
82
+
83
+ function DropdownMenuCheckboxItem({
84
+ className,
85
+ children,
86
+ checked,
87
+ ...props
88
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
89
+ return (
90
+ <DropdownMenuPrimitive.CheckboxItem
91
+ data-slot="dropdown-menu-checkbox-item"
92
+ className={cn(
93
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
94
+ className
95
+ )}
96
+ checked={checked}
97
+ {...props}
98
+ >
99
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
100
+ <DropdownMenuPrimitive.ItemIndicator>
101
+ <CheckIcon className="size-4" />
102
+ </DropdownMenuPrimitive.ItemIndicator>
103
+ </span>
104
+ {children}
105
+ </DropdownMenuPrimitive.CheckboxItem>
106
+ )
107
+ }
108
+
109
+ function DropdownMenuRadioGroup({
110
+ ...props
111
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
112
+ return (
113
+ <DropdownMenuPrimitive.RadioGroup
114
+ data-slot="dropdown-menu-radio-group"
115
+ {...props}
116
+ />
117
+ )
118
+ }
119
+
120
+ function DropdownMenuRadioItem({
121
+ className,
122
+ children,
123
+ ...props
124
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
125
+ return (
126
+ <DropdownMenuPrimitive.RadioItem
127
+ data-slot="dropdown-menu-radio-item"
128
+ className={cn(
129
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
130
+ className
131
+ )}
132
+ {...props}
133
+ >
134
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
135
+ <DropdownMenuPrimitive.ItemIndicator>
136
+ <CircleIcon className="size-2 fill-current" />
137
+ </DropdownMenuPrimitive.ItemIndicator>
138
+ </span>
139
+ {children}
140
+ </DropdownMenuPrimitive.RadioItem>
141
+ )
142
+ }
143
+
144
+ function DropdownMenuLabel({
145
+ className,
146
+ inset,
147
+ ...props
148
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
149
+ inset?: boolean
150
+ }) {
151
+ return (
152
+ <DropdownMenuPrimitive.Label
153
+ data-slot="dropdown-menu-label"
154
+ data-inset={inset}
63
155
  className={cn(
64
- "z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-32 overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
65
- "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 origin-[--radix-dropdown-menu-content-transform-origin]",
156
+ "px-2 py-1.5 text-sm font-medium data-inset:pl-8",
66
157
  className
67
158
  )}
68
159
  {...props}
69
160
  />
70
- </DropdownMenuPrimitive.Portal>
71
- ));
72
- DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
73
-
74
- const DropdownMenuItem = React.forwardRef<
75
- React.ElementRef<typeof DropdownMenuPrimitive.Item>,
76
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
77
- inset?: boolean;
78
- }
79
- >(({ className, inset, ...props }, ref) => (
80
- <DropdownMenuPrimitive.Item
81
- ref={ref}
82
- className={cn(
83
- "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",
84
- inset && "pl-8",
85
- className
86
- )}
87
- {...props}
88
- />
89
- ));
90
- DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
91
-
92
- const DropdownMenuCheckboxItem = React.forwardRef<
93
- React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
94
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
95
- >(({ className, children, checked, ...props }, ref) => (
96
- <DropdownMenuPrimitive.CheckboxItem
97
- ref={ref}
98
- className={cn(
99
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",
100
- className
101
- )}
102
- checked={checked}
103
- {...props}
104
- >
105
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
106
- <DropdownMenuPrimitive.ItemIndicator>
107
- <Check className="h-4 w-4" />
108
- </DropdownMenuPrimitive.ItemIndicator>
109
- </span>
110
- {children}
111
- </DropdownMenuPrimitive.CheckboxItem>
112
- ));
113
- DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
114
-
115
- const DropdownMenuRadioItem = React.forwardRef<
116
- React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
117
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
118
- >(({ className, children, ...props }, ref) => (
119
- <DropdownMenuPrimitive.RadioItem
120
- ref={ref}
121
- className={cn(
122
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",
123
- className
124
- )}
125
- {...props}
126
- >
127
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
128
- <DropdownMenuPrimitive.ItemIndicator>
129
- <Circle className="h-2 w-2 fill-current" />
130
- </DropdownMenuPrimitive.ItemIndicator>
131
- </span>
132
- {children}
133
- </DropdownMenuPrimitive.RadioItem>
134
- ));
135
- DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
136
-
137
- const DropdownMenuLabel = React.forwardRef<
138
- React.ElementRef<typeof DropdownMenuPrimitive.Label>,
139
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
140
- inset?: boolean;
141
- }
142
- >(({ className, inset, ...props }, ref) => (
143
- <DropdownMenuPrimitive.Label
144
- ref={ref}
145
- className={cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className)}
146
- {...props}
147
- />
148
- ));
149
- DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
150
-
151
- const DropdownMenuSeparator = React.forwardRef<
152
- React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
153
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
154
- >(({ className, ...props }, ref) => (
155
- <DropdownMenuPrimitive.Separator
156
- ref={ref}
157
- className={cn("-mx-1 my-1 h-px bg-muted", className)}
158
- {...props}
159
- />
160
- ));
161
- DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
162
-
163
- const DropdownMenuShortcut = ({
161
+ )
162
+ }
163
+
164
+ function DropdownMenuSeparator({
165
+ className,
166
+ ...props
167
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
168
+ return (
169
+ <DropdownMenuPrimitive.Separator
170
+ data-slot="dropdown-menu-separator"
171
+ className={cn("bg-border -mx-1 my-1 h-px", className)}
172
+ {...props}
173
+ />
174
+ )
175
+ }
176
+
177
+ function DropdownMenuShortcut({
164
178
  className,
165
179
  ...props
166
- }: React.HTMLAttributes<HTMLSpanElement>) => {
180
+ }: React.ComponentProps<"span">) {
167
181
  return (
168
182
  <span
169
- className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
183
+ data-slot="dropdown-menu-shortcut"
184
+ className={cn(
185
+ "text-muted-foreground ml-auto text-xs tracking-widest",
186
+ className
187
+ )}
170
188
  {...props}
171
189
  />
172
- );
173
- };
174
- DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
190
+ )
191
+ }
192
+
193
+ function DropdownMenuSub({
194
+ ...props
195
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
196
+ return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />
197
+ }
198
+
199
+ function DropdownMenuSubTrigger({
200
+ className,
201
+ inset,
202
+ children,
203
+ ...props
204
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
205
+ inset?: boolean
206
+ }) {
207
+ return (
208
+ <DropdownMenuPrimitive.SubTrigger
209
+ data-slot="dropdown-menu-sub-trigger"
210
+ data-inset={inset}
211
+ className={cn(
212
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
213
+ className
214
+ )}
215
+ {...props}
216
+ >
217
+ {children}
218
+ <ChevronRightIcon className="ml-auto size-4" />
219
+ </DropdownMenuPrimitive.SubTrigger>
220
+ )
221
+ }
222
+
223
+ function DropdownMenuSubContent({
224
+ className,
225
+ ...props
226
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
227
+ return (
228
+ <DropdownMenuPrimitive.SubContent
229
+ data-slot="dropdown-menu-sub-content"
230
+ className={cn(
231
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
232
+ className
233
+ )}
234
+ {...props}
235
+ />
236
+ )
237
+ }
175
238
 
176
239
  export {
177
- DropdownMenu,
178
- DropdownMenuCheckboxItem,
179
- DropdownMenuContent,
180
- DropdownMenuGroup,
181
- DropdownMenuItem,
182
- DropdownMenuLabel,
183
- DropdownMenuPortal,
184
- DropdownMenuRadioGroup,
240
+ DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent,
241
+ DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup,
185
242
  DropdownMenuRadioItem,
186
243
  DropdownMenuSeparator,
187
244
  DropdownMenuShortcut,
188
- DropdownMenuSub,
189
- DropdownMenuSubContent,
190
- DropdownMenuSubTrigger,
191
- DropdownMenuTrigger
192
- };
245
+ DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger
246
+ }
247
+