@oussemasahbeni/keycloakify-login-shadcn 250004.0.7 → 250004.0.9
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/keycloak-theme/components/langauges.tsx +1 -1
- package/keycloak-theme/components/theme-toggle.tsx +0 -1
- package/keycloak-theme/components/ui/alert.tsx +69 -62
- package/keycloak-theme/components/ui/button.tsx +44 -39
- package/keycloak-theme/components/ui/card.tsx +59 -45
- package/keycloak-theme/components/ui/checkbox.tsx +24 -23
- package/keycloak-theme/components/ui/dropdown-menu.tsx +233 -168
- package/keycloak-theme/components/ui/field.tsx +50 -48
- package/keycloak-theme/components/ui/input-otp.tsx +55 -49
- package/keycloak-theme/components/ui/input.tsx +18 -22
- package/keycloak-theme/components/ui/label.tsx +19 -21
- package/keycloak-theme/components/ui/radio-group.tsx +27 -26
- package/keycloak-theme/components/ui/select.tsx +169 -122
- package/keycloak-theme/components/ui/separator.tsx +23 -24
- package/keycloak-theme/components/ui/tooltip.tsx +53 -24
- package/keycloak-theme/login/KcPage.tsx +2 -5
- package/keycloak-theme/login/components/LogoutOtherSessions.tsx +3 -5
- package/keycloak-theme/login/components/PasswordWrapper.tsx +4 -4
- package/keycloak-theme/login/components/Template/Template.tsx +110 -58
- package/keycloak-theme/login/components/UserProfileFormFields/AddRemoveButtonsMultiValuedAttribute.tsx +7 -3
- package/keycloak-theme/login/components/UserProfileFormFields/FieldErrors.tsx +8 -4
- package/keycloak-theme/login/components/UserProfileFormFields/GroupLabel.tsx +33 -14
- package/keycloak-theme/login/components/UserProfileFormFields/InputFieldByType.tsx +9 -2
- package/keycloak-theme/login/components/UserProfileFormFields/InputLabel.tsx +0 -1
- package/keycloak-theme/login/components/UserProfileFormFields/InputTag.tsx +25 -8
- package/keycloak-theme/login/components/UserProfileFormFields/InputTagSelects.tsx +30 -16
- package/keycloak-theme/login/components/UserProfileFormFields/SelectTag.tsx +32 -11
- package/keycloak-theme/login/components/UserProfileFormFields/TextareaTag.tsx +19 -7
- package/keycloak-theme/login/components/UserProfileFormFields/UserProfileFormFields.tsx +11 -5
- package/keycloak-theme/login/index.css +3 -20
- package/keycloak-theme/login/mocks/KcPageStory.tsx +6 -2
- package/keycloak-theme/login/pages/PageIndex.tsx +0 -4
- package/keycloak-theme/login/pages/code/Page.stories.tsx +4 -5
- package/keycloak-theme/login/pages/code/Page.tsx +6 -6
- package/keycloak-theme/login/pages/delete-account-confirm/Page.stories.tsx +0 -2
- package/keycloak-theme/login/pages/delete-account-confirm/Page.tsx +3 -6
- package/keycloak-theme/login/pages/delete-credential/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/delete-credential/Page.tsx +11 -6
- package/keycloak-theme/login/pages/error/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/error/Page.tsx +13 -12
- package/keycloak-theme/login/pages/frontchannel-logout/Page.tsx +2 -4
- package/keycloak-theme/login/pages/idp-review-user-profile/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/idp-review-user-profile/Page.tsx +2 -5
- package/keycloak-theme/login/pages/info/Page.tsx +8 -6
- package/keycloak-theme/login/pages/link-idp-action/Page.tsx +5 -3
- package/keycloak-theme/login/pages/login/Form.tsx +36 -38
- package/keycloak-theme/login/pages/login/Page.stories.tsx +4 -3
- package/keycloak-theme/login/pages/login/Page.tsx +0 -1
- package/keycloak-theme/login/pages/login/SocialProviders.tsx +14 -23
- package/keycloak-theme/login/pages/login/providers/github.svg +4 -3
- package/keycloak-theme/login/pages/login/providers/x.svg +4 -3
- package/keycloak-theme/login/pages/login/useProviderLogos.tsx +2 -3
- package/keycloak-theme/login/pages/login-config-totp/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/login-config-totp/Page.tsx +25 -12
- package/keycloak-theme/login/pages/login-idp-link-confirm/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/login-idp-link-confirm/Page.tsx +4 -7
- package/keycloak-theme/login/pages/login-idp-link-confirm-override/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/login-idp-link-confirm-override/Page.tsx +4 -7
- package/keycloak-theme/login/pages/login-idp-link-email/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/login-idp-link-email/Page.tsx +4 -7
- package/keycloak-theme/login/pages/login-oauth-grant/Page.tsx +21 -11
- package/keycloak-theme/login/pages/login-oauth2-device-verify-user-code/Page.tsx +5 -7
- package/keycloak-theme/login/pages/login-otp/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/login-otp/Page.tsx +35 -26
- package/keycloak-theme/login/pages/login-page-expired/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/login-page-expired/Page.tsx +4 -6
- package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/Page.tsx +153 -96
- package/keycloak-theme/login/pages/login-password/Page.tsx +14 -15
- package/keycloak-theme/login/pages/login-password/useScript.tsx +0 -1
- package/keycloak-theme/login/pages/login-recovery-authn-code-config/Page.tsx +5 -8
- package/keycloak-theme/login/pages/login-recovery-authn-code-input/Page.tsx +2 -3
- package/keycloak-theme/login/pages/login-reset-otp/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/login-reset-otp/Page.tsx +3 -4
- package/keycloak-theme/login/pages/login-reset-password/Form.tsx +5 -6
- package/keycloak-theme/login/pages/login-reset-password/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/login-reset-password/Page.tsx +3 -3
- package/keycloak-theme/login/pages/login-update-password/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/login-update-password/Page.tsx +5 -7
- package/keycloak-theme/login/pages/login-update-profile/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/login-update-profile/Page.tsx +6 -7
- package/keycloak-theme/login/pages/login-username/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/login-username/Page.tsx +6 -6
- package/keycloak-theme/login/pages/login-verify-email/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/login-verify-email/Page.tsx +3 -4
- package/keycloak-theme/login/pages/login-x509-info/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/login-x509-info/Page.tsx +3 -6
- package/keycloak-theme/login/pages/logout-confirm/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/logout-confirm/Page.tsx +3 -6
- package/keycloak-theme/login/pages/register/Form.tsx +8 -7
- package/keycloak-theme/login/pages/register/Page.stories.tsx +17 -8
- package/keycloak-theme/login/pages/register/TermsAcceptance.tsx +6 -7
- package/keycloak-theme/login/pages/saml-post-form/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/saml-post-form/Page.tsx +4 -6
- package/keycloak-theme/login/pages/select-authenticator/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/select-authenticator/Page.tsx +3 -6
- package/keycloak-theme/login/pages/select-organization/Page.tsx +5 -8
- package/keycloak-theme/login/pages/terms/Page.tsx +1 -3
- package/keycloak-theme/login/pages/update-email/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/update-email/Page.tsx +6 -7
- package/keycloak-theme/login/pages/webauthn-authenticate/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/webauthn-authenticate/Page.tsx +50 -46
- package/keycloak-theme/login/pages/webauthn-error/Page.stories.tsx +2 -5
- package/keycloak-theme/login/pages/webauthn-error/Page.tsx +3 -6
- package/keycloak-theme/login/pages/webauthn-register/Page.stories.tsx +0 -1
- package/keycloak-theme/login/pages/webauthn-register/Page.tsx +4 -4
- package/keycloak-theme/login/styleLevelCustomization.tsx +5 -6
- package/keycloak-theme/public/site.webmanifest +11 -1
- package/package.json +2 -2
|
@@ -1,182 +1,247 @@
|
|
|
1
|
-
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
|
2
|
-
import {
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
|
|
5
|
-
import { cn } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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}
|
|
63
74
|
className={cn(
|
|
64
|
-
"
|
|
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]",
|
|
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",
|
|
66
76
|
className
|
|
67
77
|
)}
|
|
68
78
|
{...props}
|
|
69
79
|
/>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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 = ({
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function DropdownMenuCheckboxItem({
|
|
164
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({
|
|
165
110
|
...props
|
|
166
|
-
}: React.
|
|
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}
|
|
155
|
+
className={cn(
|
|
156
|
+
"px-2 py-1.5 text-sm font-medium data-inset:pl-8",
|
|
157
|
+
className
|
|
158
|
+
)}
|
|
159
|
+
{...props}
|
|
160
|
+
/>
|
|
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({
|
|
178
|
+
className,
|
|
179
|
+
...props
|
|
180
|
+
}: React.ComponentProps<"span">) {
|
|
167
181
|
return (
|
|
168
182
|
<span
|
|
169
|
-
|
|
183
|
+
data-slot="dropdown-menu-shortcut"
|
|
184
|
+
className={cn(
|
|
185
|
+
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
186
|
+
className
|
|
187
|
+
)}
|
|
188
|
+
{...props}
|
|
189
|
+
/>
|
|
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
|
+
)}
|
|
170
234
|
{...props}
|
|
171
235
|
/>
|
|
172
|
-
)
|
|
173
|
-
}
|
|
174
|
-
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
236
|
+
)
|
|
237
|
+
}
|
|
175
238
|
|
|
176
239
|
export {
|
|
177
|
-
DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent,
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
240
|
+
DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent,
|
|
241
|
+
DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup,
|
|
242
|
+
DropdownMenuRadioItem,
|
|
243
|
+
DropdownMenuSeparator,
|
|
244
|
+
DropdownMenuShortcut,
|
|
245
|
+
DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger
|
|
246
|
+
}
|
|
182
247
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
2
|
-
import { useMemo } from "react"
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
2
|
+
import { useMemo } from "react"
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { Label } from "@/components/ui/label"
|
|
5
|
+
import { Separator } from "@/components/ui/separator"
|
|
6
|
+
import { cn } from '../lib/utils'
|
|
7
7
|
|
|
8
8
|
function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
|
|
9
9
|
return (
|
|
@@ -16,7 +16,7 @@ function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
|
|
|
16
16
|
)}
|
|
17
17
|
{...props}
|
|
18
18
|
/>
|
|
19
|
-
)
|
|
19
|
+
)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function FieldLegend({
|
|
@@ -36,7 +36,7 @@ function FieldLegend({
|
|
|
36
36
|
)}
|
|
37
37
|
{...props}
|
|
38
38
|
/>
|
|
39
|
-
)
|
|
39
|
+
)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
@@ -49,11 +49,11 @@ function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
49
49
|
)}
|
|
50
50
|
{...props}
|
|
51
51
|
/>
|
|
52
|
-
)
|
|
52
|
+
)
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const fieldVariants = cva(
|
|
56
|
-
"group/field
|
|
56
|
+
"group/field flex w-full gap-2 ",
|
|
57
57
|
{
|
|
58
58
|
variants: {
|
|
59
59
|
orientation: {
|
|
@@ -61,20 +61,20 @@ const fieldVariants = cva(
|
|
|
61
61
|
horizontal: [
|
|
62
62
|
"flex-row items-center",
|
|
63
63
|
"[&>[data-slot=field-label]]:flex-auto",
|
|
64
|
-
"has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px
|
|
64
|
+
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
65
65
|
],
|
|
66
66
|
responsive: [
|
|
67
|
-
"@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto
|
|
67
|
+
"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",
|
|
68
68
|
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
69
|
-
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
70
|
-
]
|
|
71
|
-
}
|
|
69
|
+
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
72
|
},
|
|
73
73
|
defaultVariants: {
|
|
74
|
-
orientation: "vertical"
|
|
75
|
-
}
|
|
74
|
+
orientation: "vertical",
|
|
75
|
+
},
|
|
76
76
|
}
|
|
77
|
-
)
|
|
77
|
+
)
|
|
78
78
|
|
|
79
79
|
function Field({
|
|
80
80
|
className,
|
|
@@ -89,7 +89,7 @@ function Field({
|
|
|
89
89
|
className={cn(fieldVariants({ orientation }), className)}
|
|
90
90
|
{...props}
|
|
91
91
|
/>
|
|
92
|
-
)
|
|
92
|
+
)
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
@@ -102,10 +102,13 @@ function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
102
102
|
)}
|
|
103
103
|
{...props}
|
|
104
104
|
/>
|
|
105
|
-
)
|
|
105
|
+
)
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
function FieldLabel({
|
|
108
|
+
function FieldLabel({
|
|
109
|
+
className,
|
|
110
|
+
...props
|
|
111
|
+
}: React.ComponentProps<typeof Label>) {
|
|
109
112
|
return (
|
|
110
113
|
<Label
|
|
111
114
|
data-slot="field-label"
|
|
@@ -117,7 +120,7 @@ function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>)
|
|
|
117
120
|
)}
|
|
118
121
|
{...props}
|
|
119
122
|
/>
|
|
120
|
-
)
|
|
123
|
+
)
|
|
121
124
|
}
|
|
122
125
|
|
|
123
126
|
function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
@@ -125,12 +128,12 @@ function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
125
128
|
<div
|
|
126
129
|
data-slot="field-label"
|
|
127
130
|
className={cn(
|
|
128
|
-
"flex w-fit items-center gap-2 text-sm font-medium
|
|
131
|
+
"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
|
|
129
132
|
className
|
|
130
133
|
)}
|
|
131
134
|
{...props}
|
|
132
135
|
/>
|
|
133
|
-
)
|
|
136
|
+
)
|
|
134
137
|
}
|
|
135
138
|
|
|
136
139
|
function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
@@ -138,14 +141,14 @@ function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
|
138
141
|
<p
|
|
139
142
|
data-slot="field-description"
|
|
140
143
|
className={cn(
|
|
141
|
-
"text-muted-foreground text-sm
|
|
142
|
-
"nth-last-2:-mt-1
|
|
144
|
+
"text-muted-foreground text-sm leading-normal font-normal group-has-data-[orientation=horizontal]/field:text-balance",
|
|
145
|
+
"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
|
|
143
146
|
"[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
|
|
144
147
|
className
|
|
145
148
|
)}
|
|
146
149
|
{...props}
|
|
147
150
|
/>
|
|
148
|
-
)
|
|
151
|
+
)
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
function FieldSeparator({
|
|
@@ -153,7 +156,7 @@ function FieldSeparator({
|
|
|
153
156
|
className,
|
|
154
157
|
...props
|
|
155
158
|
}: React.ComponentProps<"div"> & {
|
|
156
|
-
children?: React.ReactNode
|
|
159
|
+
children?: React.ReactNode
|
|
157
160
|
}) {
|
|
158
161
|
return (
|
|
159
162
|
<div
|
|
@@ -175,7 +178,7 @@ function FieldSeparator({
|
|
|
175
178
|
</span>
|
|
176
179
|
)}
|
|
177
180
|
</div>
|
|
178
|
-
)
|
|
181
|
+
)
|
|
179
182
|
}
|
|
180
183
|
|
|
181
184
|
function FieldError({
|
|
@@ -184,33 +187,37 @@ function FieldError({
|
|
|
184
187
|
errors,
|
|
185
188
|
...props
|
|
186
189
|
}: React.ComponentProps<"div"> & {
|
|
187
|
-
errors?: Array<{ message?: string } | undefined
|
|
190
|
+
errors?: Array<{ message?: string } | undefined>
|
|
188
191
|
}) {
|
|
189
192
|
const content = useMemo(() => {
|
|
190
193
|
if (children) {
|
|
191
|
-
return children
|
|
194
|
+
return children
|
|
192
195
|
}
|
|
193
196
|
|
|
194
|
-
if (!errors) {
|
|
195
|
-
return null
|
|
197
|
+
if (!errors?.length) {
|
|
198
|
+
return null
|
|
196
199
|
}
|
|
197
200
|
|
|
198
|
-
|
|
199
|
-
|
|
201
|
+
const uniqueErrors = [
|
|
202
|
+
...new Map(errors.map((error) => [error?.message, error])).values(),
|
|
203
|
+
]
|
|
204
|
+
|
|
205
|
+
if (uniqueErrors?.length == 1) {
|
|
206
|
+
return uniqueErrors[0]?.message
|
|
200
207
|
}
|
|
201
208
|
|
|
202
209
|
return (
|
|
203
210
|
<ul className="ml-4 flex list-disc flex-col gap-1">
|
|
204
|
-
{
|
|
211
|
+
{uniqueErrors.map(
|
|
205
212
|
(error, index) =>
|
|
206
213
|
error?.message && <li key={index}>{error.message}</li>
|
|
207
214
|
)}
|
|
208
215
|
</ul>
|
|
209
|
-
)
|
|
210
|
-
}, [children, errors])
|
|
216
|
+
)
|
|
217
|
+
}, [children, errors])
|
|
211
218
|
|
|
212
219
|
if (!content) {
|
|
213
|
-
return null
|
|
220
|
+
return null
|
|
214
221
|
}
|
|
215
222
|
|
|
216
223
|
return (
|
|
@@ -222,19 +229,14 @@ function FieldError({
|
|
|
222
229
|
>
|
|
223
230
|
{content}
|
|
224
231
|
</div>
|
|
225
|
-
)
|
|
232
|
+
)
|
|
226
233
|
}
|
|
227
234
|
|
|
228
235
|
export {
|
|
229
|
-
Field,
|
|
230
|
-
FieldContent,
|
|
231
|
-
FieldDescription,
|
|
236
|
+
Field, FieldContent, FieldDescription,
|
|
232
237
|
FieldError,
|
|
233
|
-
FieldGroup,
|
|
234
|
-
FieldLabel,
|
|
235
|
-
FieldLegend,
|
|
238
|
+
FieldGroup, FieldLabel, FieldLegend,
|
|
236
239
|
FieldSeparator,
|
|
237
|
-
FieldSet,
|
|
238
|
-
|
|
239
|
-
};
|
|
240
|
+
FieldSet, FieldTitle
|
|
241
|
+
}
|
|
240
242
|
|