@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.
Files changed (108) hide show
  1. package/keycloak-theme/components/langauges.tsx +1 -1
  2. package/keycloak-theme/components/theme-toggle.tsx +0 -1
  3. package/keycloak-theme/components/ui/alert.tsx +69 -62
  4. package/keycloak-theme/components/ui/button.tsx +44 -39
  5. package/keycloak-theme/components/ui/card.tsx +59 -45
  6. package/keycloak-theme/components/ui/checkbox.tsx +24 -23
  7. package/keycloak-theme/components/ui/dropdown-menu.tsx +233 -168
  8. package/keycloak-theme/components/ui/field.tsx +50 -48
  9. package/keycloak-theme/components/ui/input-otp.tsx +55 -49
  10. package/keycloak-theme/components/ui/input.tsx +18 -22
  11. package/keycloak-theme/components/ui/label.tsx +19 -21
  12. package/keycloak-theme/components/ui/radio-group.tsx +27 -26
  13. package/keycloak-theme/components/ui/select.tsx +169 -122
  14. package/keycloak-theme/components/ui/separator.tsx +23 -24
  15. package/keycloak-theme/components/ui/tooltip.tsx +53 -24
  16. package/keycloak-theme/login/KcPage.tsx +2 -5
  17. package/keycloak-theme/login/components/LogoutOtherSessions.tsx +3 -5
  18. package/keycloak-theme/login/components/PasswordWrapper.tsx +4 -4
  19. package/keycloak-theme/login/components/Template/Template.tsx +110 -58
  20. package/keycloak-theme/login/components/UserProfileFormFields/AddRemoveButtonsMultiValuedAttribute.tsx +7 -3
  21. package/keycloak-theme/login/components/UserProfileFormFields/FieldErrors.tsx +8 -4
  22. package/keycloak-theme/login/components/UserProfileFormFields/GroupLabel.tsx +33 -14
  23. package/keycloak-theme/login/components/UserProfileFormFields/InputFieldByType.tsx +9 -2
  24. package/keycloak-theme/login/components/UserProfileFormFields/InputLabel.tsx +0 -1
  25. package/keycloak-theme/login/components/UserProfileFormFields/InputTag.tsx +25 -8
  26. package/keycloak-theme/login/components/UserProfileFormFields/InputTagSelects.tsx +30 -16
  27. package/keycloak-theme/login/components/UserProfileFormFields/SelectTag.tsx +32 -11
  28. package/keycloak-theme/login/components/UserProfileFormFields/TextareaTag.tsx +19 -7
  29. package/keycloak-theme/login/components/UserProfileFormFields/UserProfileFormFields.tsx +11 -5
  30. package/keycloak-theme/login/index.css +3 -20
  31. package/keycloak-theme/login/mocks/KcPageStory.tsx +6 -2
  32. package/keycloak-theme/login/pages/PageIndex.tsx +0 -4
  33. package/keycloak-theme/login/pages/code/Page.stories.tsx +4 -5
  34. package/keycloak-theme/login/pages/code/Page.tsx +6 -6
  35. package/keycloak-theme/login/pages/delete-account-confirm/Page.stories.tsx +0 -2
  36. package/keycloak-theme/login/pages/delete-account-confirm/Page.tsx +3 -6
  37. package/keycloak-theme/login/pages/delete-credential/Page.stories.tsx +0 -1
  38. package/keycloak-theme/login/pages/delete-credential/Page.tsx +11 -6
  39. package/keycloak-theme/login/pages/error/Page.stories.tsx +0 -1
  40. package/keycloak-theme/login/pages/error/Page.tsx +13 -12
  41. package/keycloak-theme/login/pages/frontchannel-logout/Page.tsx +2 -4
  42. package/keycloak-theme/login/pages/idp-review-user-profile/Page.stories.tsx +0 -1
  43. package/keycloak-theme/login/pages/idp-review-user-profile/Page.tsx +2 -5
  44. package/keycloak-theme/login/pages/info/Page.tsx +8 -6
  45. package/keycloak-theme/login/pages/link-idp-action/Page.tsx +5 -3
  46. package/keycloak-theme/login/pages/login/Form.tsx +36 -38
  47. package/keycloak-theme/login/pages/login/Page.stories.tsx +4 -3
  48. package/keycloak-theme/login/pages/login/Page.tsx +0 -1
  49. package/keycloak-theme/login/pages/login/SocialProviders.tsx +14 -23
  50. package/keycloak-theme/login/pages/login/providers/github.svg +4 -3
  51. package/keycloak-theme/login/pages/login/providers/x.svg +4 -3
  52. package/keycloak-theme/login/pages/login/useProviderLogos.tsx +2 -3
  53. package/keycloak-theme/login/pages/login-config-totp/Page.stories.tsx +0 -1
  54. package/keycloak-theme/login/pages/login-config-totp/Page.tsx +25 -12
  55. package/keycloak-theme/login/pages/login-idp-link-confirm/Page.stories.tsx +0 -1
  56. package/keycloak-theme/login/pages/login-idp-link-confirm/Page.tsx +4 -7
  57. package/keycloak-theme/login/pages/login-idp-link-confirm-override/Page.stories.tsx +0 -1
  58. package/keycloak-theme/login/pages/login-idp-link-confirm-override/Page.tsx +4 -7
  59. package/keycloak-theme/login/pages/login-idp-link-email/Page.stories.tsx +0 -1
  60. package/keycloak-theme/login/pages/login-idp-link-email/Page.tsx +4 -7
  61. package/keycloak-theme/login/pages/login-oauth-grant/Page.tsx +21 -11
  62. package/keycloak-theme/login/pages/login-oauth2-device-verify-user-code/Page.tsx +5 -7
  63. package/keycloak-theme/login/pages/login-otp/Page.stories.tsx +0 -1
  64. package/keycloak-theme/login/pages/login-otp/Page.tsx +35 -26
  65. package/keycloak-theme/login/pages/login-page-expired/Page.stories.tsx +0 -1
  66. package/keycloak-theme/login/pages/login-page-expired/Page.tsx +4 -6
  67. package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/Page.tsx +153 -96
  68. package/keycloak-theme/login/pages/login-password/Page.tsx +14 -15
  69. package/keycloak-theme/login/pages/login-password/useScript.tsx +0 -1
  70. package/keycloak-theme/login/pages/login-recovery-authn-code-config/Page.tsx +5 -8
  71. package/keycloak-theme/login/pages/login-recovery-authn-code-input/Page.tsx +2 -3
  72. package/keycloak-theme/login/pages/login-reset-otp/Page.stories.tsx +0 -1
  73. package/keycloak-theme/login/pages/login-reset-otp/Page.tsx +3 -4
  74. package/keycloak-theme/login/pages/login-reset-password/Form.tsx +5 -6
  75. package/keycloak-theme/login/pages/login-reset-password/Page.stories.tsx +0 -1
  76. package/keycloak-theme/login/pages/login-reset-password/Page.tsx +3 -3
  77. package/keycloak-theme/login/pages/login-update-password/Page.stories.tsx +0 -1
  78. package/keycloak-theme/login/pages/login-update-password/Page.tsx +5 -7
  79. package/keycloak-theme/login/pages/login-update-profile/Page.stories.tsx +0 -1
  80. package/keycloak-theme/login/pages/login-update-profile/Page.tsx +6 -7
  81. package/keycloak-theme/login/pages/login-username/Page.stories.tsx +0 -1
  82. package/keycloak-theme/login/pages/login-username/Page.tsx +6 -6
  83. package/keycloak-theme/login/pages/login-verify-email/Page.stories.tsx +0 -1
  84. package/keycloak-theme/login/pages/login-verify-email/Page.tsx +3 -4
  85. package/keycloak-theme/login/pages/login-x509-info/Page.stories.tsx +0 -1
  86. package/keycloak-theme/login/pages/login-x509-info/Page.tsx +3 -6
  87. package/keycloak-theme/login/pages/logout-confirm/Page.stories.tsx +0 -1
  88. package/keycloak-theme/login/pages/logout-confirm/Page.tsx +3 -6
  89. package/keycloak-theme/login/pages/register/Form.tsx +8 -7
  90. package/keycloak-theme/login/pages/register/Page.stories.tsx +17 -8
  91. package/keycloak-theme/login/pages/register/TermsAcceptance.tsx +6 -7
  92. package/keycloak-theme/login/pages/saml-post-form/Page.stories.tsx +0 -1
  93. package/keycloak-theme/login/pages/saml-post-form/Page.tsx +4 -6
  94. package/keycloak-theme/login/pages/select-authenticator/Page.stories.tsx +0 -1
  95. package/keycloak-theme/login/pages/select-authenticator/Page.tsx +3 -6
  96. package/keycloak-theme/login/pages/select-organization/Page.tsx +5 -8
  97. package/keycloak-theme/login/pages/terms/Page.tsx +1 -3
  98. package/keycloak-theme/login/pages/update-email/Page.stories.tsx +0 -1
  99. package/keycloak-theme/login/pages/update-email/Page.tsx +6 -7
  100. package/keycloak-theme/login/pages/webauthn-authenticate/Page.stories.tsx +0 -1
  101. package/keycloak-theme/login/pages/webauthn-authenticate/Page.tsx +50 -46
  102. package/keycloak-theme/login/pages/webauthn-error/Page.stories.tsx +2 -5
  103. package/keycloak-theme/login/pages/webauthn-error/Page.tsx +3 -6
  104. package/keycloak-theme/login/pages/webauthn-register/Page.stories.tsx +0 -1
  105. package/keycloak-theme/login/pages/webauthn-register/Page.tsx +4 -4
  106. package/keycloak-theme/login/styleLevelCustomization.tsx +5 -6
  107. package/keycloak-theme/public/site.webmanifest +11 -1
  108. package/package.json +2 -2
@@ -1,46 +1,55 @@
1
- import { OTPInput, OTPInputContext } from "input-otp";
2
- import { Minus } from "lucide-react";
3
- import * as React from "react";
1
+ import { OTPInput, OTPInputContext } from "input-otp"
2
+ import { MinusIcon } 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 InputOTP = React.forwardRef<
8
- React.ElementRef<typeof OTPInput>,
9
- React.ComponentPropsWithoutRef<typeof OTPInput>
10
- >(({ className, containerClassName, ...props }, ref) => (
11
- <OTPInput
12
- ref={ref}
13
- containerClassName={cn(
14
- "flex items-center gap-2 has-[:disabled]:opacity-50",
15
- containerClassName
16
- )}
17
- className={cn("disabled:cursor-not-allowed", className)}
18
- {...props}
19
- />
20
- ));
21
- InputOTP.displayName = "InputOTP";
7
+ function InputOTP({
8
+ className,
9
+ containerClassName,
10
+ ...props
11
+ }: React.ComponentProps<typeof OTPInput> & {
12
+ containerClassName?: string
13
+ }) {
14
+ return (
15
+ <OTPInput
16
+ data-slot="input-otp"
17
+ containerClassName={cn(
18
+ "flex items-center gap-2 has-disabled:opacity-50",
19
+ containerClassName
20
+ )}
21
+ className={cn("disabled:cursor-not-allowed", className)}
22
+ {...props}
23
+ />
24
+ )
25
+ }
22
26
 
23
- const InputOTPGroup = React.forwardRef<
24
- React.ElementRef<"div">,
25
- React.ComponentPropsWithoutRef<"div">
26
- >(({ className, ...props }, ref) => (
27
- <div ref={ref} className={cn("flex items-center", className)} {...props} />
28
- ));
29
- InputOTPGroup.displayName = "InputOTPGroup";
27
+ function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) {
28
+ return (
29
+ <div
30
+ data-slot="input-otp-group"
31
+ className={cn("flex items-center", className)}
32
+ {...props}
33
+ />
34
+ )
35
+ }
30
36
 
31
- const InputOTPSlot = React.forwardRef<
32
- React.ElementRef<"div">,
33
- React.ComponentPropsWithoutRef<"div"> & { index: number }
34
- >(({ index, className, ...props }, ref) => {
35
- const inputOTPContext = React.useContext(OTPInputContext);
36
- const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
37
+ function InputOTPSlot({
38
+ index,
39
+ className,
40
+ ...props
41
+ }: React.ComponentProps<"div"> & {
42
+ index: number
43
+ }) {
44
+ const inputOTPContext = React.useContext(OTPInputContext)
45
+ const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}
37
46
 
38
47
  return (
39
48
  <div
40
- ref={ref}
49
+ data-slot="input-otp-slot"
50
+ data-active={isActive}
41
51
  className={cn(
42
- "relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm shadow-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",
43
- isActive && "z-10 ring-1 ring-ring",
52
+ "data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",
44
53
  className
45
54
  )}
46
55
  {...props}
@@ -48,23 +57,20 @@ const InputOTPSlot = React.forwardRef<
48
57
  {char}
49
58
  {hasFakeCaret && (
50
59
  <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
51
- <div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
60
+ <div className="animate-caret-blink bg-foreground h-4 w-px duration-1000" />
52
61
  </div>
53
62
  )}
54
63
  </div>
55
- );
56
- });
57
- InputOTPSlot.displayName = "InputOTPSlot";
64
+ )
65
+ }
58
66
 
59
- const InputOTPSeparator = React.forwardRef<
60
- React.ElementRef<"div">,
61
- React.ComponentPropsWithoutRef<"div">
62
- >(({ ...props }, ref) => (
63
- <div ref={ref} role="separator" {...props}>
64
- <Minus />
65
- </div>
66
- ));
67
- InputOTPSeparator.displayName = "InputOTPSeparator";
67
+ function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
68
+ return (
69
+ <div data-slot="input-otp-separator" role="separator" {...props}>
70
+ <MinusIcon />
71
+ </div>
72
+ )
73
+ }
68
74
 
69
- export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
75
+ export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot }
70
76
 
@@ -1,25 +1,21 @@
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 Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
6
- ({ className, type, ...props }, ref) => {
7
- return (
8
- <input
9
- type={type}
10
- className={cn(
11
- "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
12
- "group-data-[invalid=true]/field:border-destructive group-data-[invalid=true]/field:focus-visible:ring-destructive",
13
- "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
14
- className
15
- )}
16
- ref={ref}
17
- {...props}
18
- />
19
- );
20
- }
21
- );
22
- Input.displayName = "Input";
23
-
24
- export { Input };
5
+ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
6
+ return (
7
+ <input
8
+ type={type}
9
+ data-slot="input"
10
+ className={cn(
11
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
12
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
13
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
14
+ className
15
+ )}
16
+ {...props}
17
+ />
18
+ )
19
+ }
25
20
 
21
+ export { Input }
@@ -1,25 +1,23 @@
1
- import * as LabelPrimitive from "@radix-ui/react-label";
2
- import { cva, type VariantProps } from "class-variance-authority";
3
- import * as React from "react";
1
+ import * as LabelPrimitive from "@radix-ui/react-label"
2
+ import * as React from "react"
4
3
 
5
- import { cn } from "@/components/lib/utils";
4
+ import { cn } from '../lib/utils'
6
5
 
7
- const labelVariants = cva(
8
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
9
- );
10
6
 
11
- const Label = React.forwardRef<
12
- React.ElementRef<typeof LabelPrimitive.Root>,
13
- React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
14
- VariantProps<typeof labelVariants>
15
- >(({ className, ...props }, ref) => (
16
- <LabelPrimitive.Root
17
- ref={ref}
18
- className={cn(labelVariants(), className)}
19
- {...props}
20
- />
21
- ));
22
- Label.displayName = LabelPrimitive.Root.displayName;
23
-
24
- export { Label };
7
+ function Label({
8
+ className,
9
+ ...props
10
+ }: React.ComponentProps<typeof LabelPrimitive.Root>) {
11
+ return (
12
+ <LabelPrimitive.Root
13
+ data-slot="label"
14
+ className={cn(
15
+ "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",
16
+ className
17
+ )}
18
+ {...props}
19
+ />
20
+ )
21
+ }
25
22
 
23
+ export { Label }
@@ -1,43 +1,44 @@
1
- import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
2
- import { Circle } from "lucide-react";
3
- import * as React from "react";
1
+ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
2
+ import { CircleIcon } 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 RadioGroup = React.forwardRef<
8
- React.ElementRef<typeof RadioGroupPrimitive.Root>,
9
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
10
- >(({ className, ...props }, ref) => {
7
+
8
+ function RadioGroup({
9
+ className,
10
+ ...props
11
+ }: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
11
12
  return (
12
13
  <RadioGroupPrimitive.Root
13
- className={cn("grid gap-2", className)}
14
+ data-slot="radio-group"
15
+ className={cn("grid gap-3", className)}
14
16
  {...props}
15
- ref={ref}
16
17
  />
17
- );
18
- });
19
- RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
18
+ )
19
+ }
20
20
 
21
- const RadioGroupItem = React.forwardRef<
22
- React.ElementRef<typeof RadioGroupPrimitive.Item>,
23
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
24
- >(({ className, ...props }, ref) => {
21
+ function RadioGroupItem({
22
+ className,
23
+ ...props
24
+ }: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
25
25
  return (
26
26
  <RadioGroupPrimitive.Item
27
- ref={ref}
27
+ data-slot="radio-group-item"
28
28
  className={cn(
29
- "aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
29
+ "border-input text-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 dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
30
30
  className
31
31
  )}
32
32
  {...props}
33
33
  >
34
- <RadioGroupPrimitive.Indicator className="flex items-center justify-center">
35
- <Circle className="h-3.5 w-3.5 fill-primary" />
34
+ <RadioGroupPrimitive.Indicator
35
+ data-slot="radio-group-indicator"
36
+ className="relative flex items-center justify-center"
37
+ >
38
+ <CircleIcon className="fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" />
36
39
  </RadioGroupPrimitive.Indicator>
37
40
  </RadioGroupPrimitive.Item>
38
- );
39
- });
40
- RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
41
-
42
- export { RadioGroup, RadioGroupItem };
41
+ )
42
+ }
43
43
 
44
+ export { RadioGroup, RadioGroupItem }
@@ -1,142 +1,189 @@
1
- import * as SelectPrimitive from "@radix-ui/react-select";
2
- import { Check, ChevronDown, ChevronUp } from "lucide-react";
3
- import * as React from "react";
1
+ import * as SelectPrimitive from "@radix-ui/react-select"
2
+ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } 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 Select = SelectPrimitive.Root;
7
+ function Select({
8
+ ...props
9
+ }: React.ComponentProps<typeof SelectPrimitive.Root>) {
10
+ return <SelectPrimitive.Root data-slot="select" {...props} />
11
+ }
8
12
 
9
- const SelectGroup = SelectPrimitive.Group;
13
+ function SelectGroup({
14
+ ...props
15
+ }: React.ComponentProps<typeof SelectPrimitive.Group>) {
16
+ return <SelectPrimitive.Group data-slot="select-group" {...props} />
17
+ }
10
18
 
11
- const SelectValue = SelectPrimitive.Value;
19
+ function SelectValue({
20
+ ...props
21
+ }: React.ComponentProps<typeof SelectPrimitive.Value>) {
22
+ return <SelectPrimitive.Value data-slot="select-value" {...props} />
23
+ }
12
24
 
13
- const SelectTrigger = React.forwardRef<
14
- React.ElementRef<typeof SelectPrimitive.Trigger>,
15
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
16
- >(({ className, children, ...props }, ref) => (
17
- <SelectPrimitive.Trigger
18
- ref={ref}
19
- className={cn(
20
- "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
21
- className
22
- )}
23
- {...props}
24
- >
25
- {children}
26
- <SelectPrimitive.Icon asChild>
27
- <ChevronDown className="h-4 w-4 opacity-50" />
28
- </SelectPrimitive.Icon>
29
- </SelectPrimitive.Trigger>
30
- ));
31
- SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
32
-
33
- const SelectScrollUpButton = React.forwardRef<
34
- React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
35
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
36
- >(({ className, ...props }, ref) => (
37
- <SelectPrimitive.ScrollUpButton
38
- ref={ref}
39
- className={cn("flex cursor-default items-center justify-center py-1", className)}
40
- {...props}
41
- >
42
- <ChevronUp className="h-4 w-4" />
43
- </SelectPrimitive.ScrollUpButton>
44
- ));
45
- SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
46
-
47
- const SelectScrollDownButton = React.forwardRef<
48
- React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
49
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
50
- >(({ className, ...props }, ref) => (
51
- <SelectPrimitive.ScrollDownButton
52
- ref={ref}
53
- className={cn("flex cursor-default items-center justify-center py-1", className)}
54
- {...props}
55
- >
56
- <ChevronDown className="h-4 w-4" />
57
- </SelectPrimitive.ScrollDownButton>
58
- ));
59
- SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
60
-
61
- const SelectContent = React.forwardRef<
62
- React.ElementRef<typeof SelectPrimitive.Content>,
63
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
64
- >(({ className, children, position = "popper", ...props }, ref) => (
65
- <SelectPrimitive.Portal>
66
- <SelectPrimitive.Content
67
- ref={ref}
25
+ function SelectTrigger({
26
+ className,
27
+ size = "default",
28
+ children,
29
+ ...props
30
+ }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
31
+ size?: "sm" | "default"
32
+ }) {
33
+ return (
34
+ <SelectPrimitive.Trigger
35
+ data-slot="select-trigger"
36
+ data-size={size}
68
37
  className={cn(
69
- "relative z-50 max-h-[--radix-select-content-available-height] min-w-32 overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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-select-content-transform-origin]",
70
- position === "popper" &&
71
- "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
38
+ "border-input data-placeholder:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
72
39
  className
73
40
  )}
74
- position={position}
75
41
  {...props}
76
42
  >
77
- <SelectScrollUpButton />
78
- <SelectPrimitive.Viewport
43
+ {children}
44
+ <SelectPrimitive.Icon asChild>
45
+ <ChevronDownIcon className="size-4 opacity-50" />
46
+ </SelectPrimitive.Icon>
47
+ </SelectPrimitive.Trigger>
48
+ )
49
+ }
50
+
51
+ function SelectContent({
52
+ className,
53
+ children,
54
+ position = "popper",
55
+ align = "center",
56
+ ...props
57
+ }: React.ComponentProps<typeof SelectPrimitive.Content>) {
58
+ return (
59
+ <SelectPrimitive.Portal>
60
+ <SelectPrimitive.Content
61
+ data-slot="select-content"
79
62
  className={cn(
80
- "p-1",
63
+ "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 relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
81
64
  position === "popper" &&
82
- "h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)"
65
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
66
+ className
83
67
  )}
68
+ position={position}
69
+ align={align}
70
+ {...props}
71
+ >
72
+ <SelectScrollUpButton />
73
+ <SelectPrimitive.Viewport
74
+ className={cn(
75
+ "p-1",
76
+ position === "popper" &&
77
+ "h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"
78
+ )}
79
+ >
80
+ {children}
81
+ </SelectPrimitive.Viewport>
82
+ <SelectScrollDownButton />
83
+ </SelectPrimitive.Content>
84
+ </SelectPrimitive.Portal>
85
+ )
86
+ }
87
+
88
+ function SelectLabel({
89
+ className,
90
+ ...props
91
+ }: React.ComponentProps<typeof SelectPrimitive.Label>) {
92
+ return (
93
+ <SelectPrimitive.Label
94
+ data-slot="select-label"
95
+ className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
96
+ {...props}
97
+ />
98
+ )
99
+ }
100
+
101
+ function SelectItem({
102
+ className,
103
+ children,
104
+ ...props
105
+ }: React.ComponentProps<typeof SelectPrimitive.Item>) {
106
+ return (
107
+ <SelectPrimitive.Item
108
+ data-slot="select-item"
109
+ className={cn(
110
+ "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 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 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
111
+ className
112
+ )}
113
+ {...props}
114
+ >
115
+ <span
116
+ data-slot="select-item-indicator"
117
+ className="absolute right-2 flex size-3.5 items-center justify-center"
84
118
  >
85
- {children}
86
- </SelectPrimitive.Viewport>
87
- <SelectScrollDownButton />
88
- </SelectPrimitive.Content>
89
- </SelectPrimitive.Portal>
90
- ));
91
- SelectContent.displayName = SelectPrimitive.Content.displayName;
119
+ <SelectPrimitive.ItemIndicator>
120
+ <CheckIcon className="size-4" />
121
+ </SelectPrimitive.ItemIndicator>
122
+ </span>
123
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
124
+ </SelectPrimitive.Item>
125
+ )
126
+ }
92
127
 
93
- const SelectLabel = React.forwardRef<
94
- React.ElementRef<typeof SelectPrimitive.Label>,
95
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
96
- >(({ className, ...props }, ref) => (
97
- <SelectPrimitive.Label
98
- ref={ref}
99
- className={cn("px-2 py-1.5 text-sm font-semibold", className)}
100
- {...props}
101
- />
102
- ));
103
- SelectLabel.displayName = SelectPrimitive.Label.displayName;
128
+ function SelectSeparator({
129
+ className,
130
+ ...props
131
+ }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
132
+ return (
133
+ <SelectPrimitive.Separator
134
+ data-slot="select-separator"
135
+ className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
136
+ {...props}
137
+ />
138
+ )
139
+ }
104
140
 
105
- const SelectItem = React.forwardRef<
106
- React.ElementRef<typeof SelectPrimitive.Item>,
107
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
108
- >(({ className, children, ...props }, ref) => (
109
- <SelectPrimitive.Item
110
- ref={ref}
111
- className={cn(
112
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",
113
- className
114
- )}
115
- {...props}
116
- >
117
- <span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
118
- <SelectPrimitive.ItemIndicator>
119
- <Check className="h-4 w-4" />
120
- </SelectPrimitive.ItemIndicator>
121
- </span>
122
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
123
- </SelectPrimitive.Item>
124
- ));
125
- SelectItem.displayName = SelectPrimitive.Item.displayName;
141
+ function SelectScrollUpButton({
142
+ className,
143
+ ...props
144
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
145
+ return (
146
+ <SelectPrimitive.ScrollUpButton
147
+ data-slot="select-scroll-up-button"
148
+ className={cn(
149
+ "flex cursor-default items-center justify-center py-1",
150
+ className
151
+ )}
152
+ {...props}
153
+ >
154
+ <ChevronUpIcon className="size-4" />
155
+ </SelectPrimitive.ScrollUpButton>
156
+ )
157
+ }
126
158
 
127
- const SelectSeparator = React.forwardRef<
128
- React.ElementRef<typeof SelectPrimitive.Separator>,
129
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
130
- >(({ className, ...props }, ref) => (
131
- <SelectPrimitive.Separator
132
- ref={ref}
133
- className={cn("-mx-1 my-1 h-px bg-muted", className)}
134
- {...props}
135
- />
136
- ));
137
- SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
159
+ function SelectScrollDownButton({
160
+ className,
161
+ ...props
162
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
163
+ return (
164
+ <SelectPrimitive.ScrollDownButton
165
+ data-slot="select-scroll-down-button"
166
+ className={cn(
167
+ "flex cursor-default items-center justify-center py-1",
168
+ className
169
+ )}
170
+ {...props}
171
+ >
172
+ <ChevronDownIcon className="size-4" />
173
+ </SelectPrimitive.ScrollDownButton>
174
+ )
175
+ }
138
176
 
139
177
  export {
140
- Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue
141
- };
178
+ Select,
179
+ SelectContent,
180
+ SelectGroup,
181
+ SelectItem,
182
+ SelectLabel,
183
+ SelectScrollDownButton,
184
+ SelectScrollUpButton,
185
+ SelectSeparator,
186
+ SelectTrigger,
187
+ SelectValue
188
+ }
142
189