PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.5.2
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.5.2
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / team-updraft / lib-onboarding-wizard / Wizard / Onboarding / src / components / Fields / DropdownInput.tsx

DropdownInput.tsx in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 4.5.2, at vendor/team-updraft/lib-onboarding-wizard/Wizard/Onboarding/src/components/Fields/DropdownInput.tsx

122 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 "use client"
2
3 import * as React from "react"
4 import * as SelectPrimitive from "@radix-ui/react-select"
5 import Icon from "../../utils/Icon" // Import Icon component
6
7 import { cn } from "../../utils/cn"
8
9 const Select = SelectPrimitive.Root
10
11 const SelectGroup = SelectPrimitive.Group
12
13 const SelectValue = SelectPrimitive.Value
14
15 const SelectTrigger = React.forwardRef<
16 React.ElementRef<typeof SelectPrimitive.Trigger>,
17 React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
18 >(({ className, children, ...props }, ref) => (
19 <SelectPrimitive.Trigger
20 ref={ref}
21 className={cn(
22 "flex w-full items-center rounded-md border border-gray-400 bg-white px-3 py-2 text-md ring-offset-white placeholder:text-gray-500 focus:outline-none focus:ring-2 focus:ring-blue focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 relative pr-8 group",
23 className
24 )}
25 {...props}
26 >
27 {children}
28 <SelectPrimitive.Icon
29 className="absolute right-3 top-1/2 -translate-y-1/2 opacity-50 transition-transform duration-200 group-data-[state=open]:rotate-180"
30 >
31 <Icon name="expand" size={16} />
32 </SelectPrimitive.Icon>
33 </SelectPrimitive.Trigger>
34 ))
35 SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
36
37 const SelectContent = React.forwardRef<
38 React.ElementRef<typeof SelectPrimitive.Content>,
39 React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
40 >(({ className, children, position = "popper", ...props }, ref) => (
41 <SelectPrimitive.Portal container={document.getElementById('onboarding-modal-root')}>
42 <SelectPrimitive.Content
43 ref={ref}
44 className={cn(
45 "relative z-[100003] min-w-[8rem] overflow-hidden rounded-md border border-gray-200 bg-white text-gray-900 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]:-translate-y-1",
46 position === "popper" &&
47 "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
48 className
49 )}
50 position={position}
51 {...props}
52 >
53 <SelectPrimitive.Viewport
54 className={cn(
55 "p-1",
56 position === "popper" &&
57 "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
58 )}
59 >
60 {children}
61 </SelectPrimitive.Viewport>
62 </SelectPrimitive.Content>
63 </SelectPrimitive.Portal>
64 ))
65 SelectContent.displayName = SelectPrimitive.Content.displayName
66
67 const SelectLabel = React.forwardRef<
68 React.ElementRef<typeof SelectPrimitive.Label>,
69 React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
70 >(({ className, ...props }, ref) => (
71 <SelectPrimitive.Label
72 ref={ref}
73 className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
74 {...props}
75 />
76 ))
77 SelectLabel.displayName = SelectPrimitive.Label.displayName
78
79 const SelectItem = React.forwardRef<
80 React.ElementRef<typeof SelectPrimitive.Item>,
81 React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
82 >(({ className, children, ...props }, ref) => (
83 <SelectPrimitive.Item
84 ref={ref}
85 className={cn(
86 "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-3 pr-8 text-md outline-none focus:bg-gray-100 focus:text-gray-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
87 className
88 )}
89 {...props}
90 >
91 <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
92 <span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
93 <SelectPrimitive.ItemIndicator>
94 <Icon name="CheckRoundedIcon" size={16} color="blue" />
95 </SelectPrimitive.ItemIndicator>
96 </span>
97 </SelectPrimitive.Item>
98 ))
99 SelectItem.displayName = SelectPrimitive.Item.displayName
100
101 const SelectSeparator = React.forwardRef<
102 React.ElementRef<typeof SelectPrimitive.Separator>,
103 React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
104 >(({ className, ...props }, ref) => (
105 <SelectPrimitive.Separator
106 ref={ref}
107 className={cn("-mx-1 my-1 h-px bg-gray-100", className)}
108 {...props}
109 />
110 ))
111 SelectSeparator.displayName = SelectPrimitive.Separator.displayName
112
113 export {
114 Select,
115 SelectGroup,
116 SelectValue,
117 SelectTrigger,
118 SelectContent,
119 SelectLabel,
120 SelectItem,
121 SelectSeparator,
122 }