@snapdragonsnursery/react-components 1.16.1 → 1.17.1
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/README.md +41 -0
- package/package.json +2 -1
- package/src/components/EmployeeSelect.jsx +259 -0
- package/src/components/ui/select.jsx +144 -23
- package/src/index.js +1 -0
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@ A collection of reusable React components for Snapdragons Nursery applications.
|
|
|
6
6
|
|
|
7
7
|
- **ChildSearchModal**: Advanced child search and selection component with filtering, pagination, and multi-select capabilities
|
|
8
8
|
- **ChildSearchFilters**: Advanced filtering component with date range picker, status, site, and age filters (includes Apply button for better UX)
|
|
9
|
+
- **EmployeeSelect**: Lightweight, searchable employee selector with grouping and optional avatars
|
|
10
|
+
- **EmployeeSearchModal**: Advanced employee search with server-side filtering, pagination, and complex filters
|
|
9
11
|
- **DateRangePicker**: Shadcn-style date range picker component (supports optional presets)
|
|
10
12
|
- **DatePicker**: Shadcn-style single date picker component
|
|
11
13
|
- **Calendar**: Official shadcn calendar component
|
|
@@ -40,6 +42,44 @@ function MyComponent() {
|
|
|
40
42
|
}
|
|
41
43
|
```
|
|
42
44
|
|
|
45
|
+
### EmployeeSelect Example
|
|
46
|
+
|
|
47
|
+
```jsx
|
|
48
|
+
import { EmployeeSelect } from '@snapdragonsnursery/react-components';
|
|
49
|
+
|
|
50
|
+
function MyComponent() {
|
|
51
|
+
const [selectedEntraId, setSelectedEntraId] = useState();
|
|
52
|
+
const employees = [
|
|
53
|
+
{
|
|
54
|
+
entra_id: '123-456',
|
|
55
|
+
full_name: 'Jane Smith',
|
|
56
|
+
site_name: 'Main Office',
|
|
57
|
+
role_name: 'Teacher',
|
|
58
|
+
employee_id: 'EMP001',
|
|
59
|
+
email: 'jane@example.com',
|
|
60
|
+
employee_status: 'Active'
|
|
61
|
+
},
|
|
62
|
+
// ... more employees
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<EmployeeSelect
|
|
67
|
+
value={selectedEntraId}
|
|
68
|
+
onChange={setSelectedEntraId}
|
|
69
|
+
items={employees}
|
|
70
|
+
groupBy="site"
|
|
71
|
+
showAvatar
|
|
72
|
+
showSiteName
|
|
73
|
+
placeholder="Select an employee..."
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**EmployeeSelect vs EmployeeSearchModal**:
|
|
80
|
+
- **EmployeeSelect**: Use for simple dropdown selection with pre-loaded employee data. Supports grouping by site/role, optional avatars, and built-in client-side search. Perfect for forms with limited employee lists.
|
|
81
|
+
- **EmployeeSearchModal**: Use for advanced search scenarios requiring server-side filtering, pagination, complex multi-criteria filters, and multi-select. Ideal for large employee databases.
|
|
82
|
+
|
|
43
83
|
### SoftWarningAlert Example
|
|
44
84
|
|
|
45
85
|
```jsx
|
|
@@ -198,6 +238,7 @@ VITE_APIM_SCOPE=api://your-apim-app-id/.default
|
|
|
198
238
|
|
|
199
239
|
- [ChildSearchModal Documentation](docs/CHILD_SEARCH_MODAL_DOCUMENTATION.md)
|
|
200
240
|
- [ChildSearchModal README](docs/CHILD_SEARCH_README.md)
|
|
241
|
+
- [EmployeeSelect Documentation](docs/EMPLOYEE_SELECT_DOCUMENTATION.md)
|
|
201
242
|
- [Release Guide](./RELEASE.md)
|
|
202
243
|
- [SoftWarningAlert](./SOFT_WARNING_ALERT.md)
|
|
203
244
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snapdragonsnursery/react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
46
46
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
47
47
|
"@radix-ui/react-popover": "^1.1.14",
|
|
48
|
+
"@radix-ui/react-select": "^2.2.5",
|
|
48
49
|
"@radix-ui/react-separator": "^1.1.7",
|
|
49
50
|
"@radix-ui/react-slot": "^1.2.3",
|
|
50
51
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
// EmployeeSelect Component
|
|
2
|
+
// A lightweight, searchable employee selector built with shadcn/ui primitives.
|
|
3
|
+
// Use this for simple employee selection with pre-loaded data. For advanced search
|
|
4
|
+
// with server-side filtering, pagination, and complex filters, use EmployeeSearchModal instead.
|
|
5
|
+
//
|
|
6
|
+
// Example:
|
|
7
|
+
// import { EmployeeSelect } from '@snapdragonsnursery/react-components'
|
|
8
|
+
// const [entraId, setEntraId] = useState()
|
|
9
|
+
// const { employees } = useAuth()
|
|
10
|
+
// <EmployeeSelect
|
|
11
|
+
// value={entraId}
|
|
12
|
+
// onChange={setEntraId}
|
|
13
|
+
// items={employees}
|
|
14
|
+
// groupBy="site"
|
|
15
|
+
// showAvatar
|
|
16
|
+
// showSiteName
|
|
17
|
+
// />
|
|
18
|
+
//
|
|
19
|
+
// Props:
|
|
20
|
+
// - value?: string // selected entra_id
|
|
21
|
+
// - onChange?: (entraId?: string) => void
|
|
22
|
+
// - items: Array<employee> // required employee list
|
|
23
|
+
// - filter?: 'active' | 'all' // filter by status (default: 'active')
|
|
24
|
+
// - groupBy?: 'site' | 'role' | 'none' // grouping (default: 'none')
|
|
25
|
+
// - showAvatar?: boolean // show colored initials (default: false)
|
|
26
|
+
// - showSiteName?: boolean // show site below name (default: true)
|
|
27
|
+
// - showEmployeeId?: boolean // show employee ID below name (default: false)
|
|
28
|
+
// - showEmail?: boolean // show email below name (default: false)
|
|
29
|
+
// - placeholder?: string
|
|
30
|
+
// - disabled?: boolean
|
|
31
|
+
// - className?: string
|
|
32
|
+
// - allowAll?: boolean // include "All employees" option
|
|
33
|
+
// - allLabel?: string // custom label for all option
|
|
34
|
+
// - maxHeight?: string // max height for dropdown (default: '160px')
|
|
35
|
+
|
|
36
|
+
import React from "react";
|
|
37
|
+
import { Users } from "lucide-react";
|
|
38
|
+
import { cn } from "../lib/utils";
|
|
39
|
+
|
|
40
|
+
import {
|
|
41
|
+
Select,
|
|
42
|
+
SelectContent,
|
|
43
|
+
SelectItem,
|
|
44
|
+
SelectTrigger,
|
|
45
|
+
SelectValue,
|
|
46
|
+
} from "./ui/select";
|
|
47
|
+
|
|
48
|
+
export const EmployeeSelect = ({
|
|
49
|
+
value,
|
|
50
|
+
onChange,
|
|
51
|
+
items = [],
|
|
52
|
+
filter = "active",
|
|
53
|
+
groupBy = "none",
|
|
54
|
+
showAvatar = false,
|
|
55
|
+
showSiteName = true,
|
|
56
|
+
showEmployeeId = false,
|
|
57
|
+
showEmail = false,
|
|
58
|
+
placeholder = "Select employee…",
|
|
59
|
+
disabled = false,
|
|
60
|
+
className,
|
|
61
|
+
allowAll = false,
|
|
62
|
+
allLabel = "All employees",
|
|
63
|
+
maxHeight = "160px",
|
|
64
|
+
}) => {
|
|
65
|
+
// Helper function to generate initials from full name
|
|
66
|
+
const getInitials = (name) => {
|
|
67
|
+
if (!name) return "??";
|
|
68
|
+
return name
|
|
69
|
+
.split(" ")
|
|
70
|
+
.map((word) => word.charAt(0))
|
|
71
|
+
.join("")
|
|
72
|
+
.toUpperCase()
|
|
73
|
+
.slice(0, 2);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// Helper function to get avatar color based on name
|
|
77
|
+
const getAvatarColor = (name) => {
|
|
78
|
+
if (!name) return "#6b7280";
|
|
79
|
+
// Generate a consistent color based on the name
|
|
80
|
+
let hash = 0;
|
|
81
|
+
for (let i = 0; i < name.length; i++) {
|
|
82
|
+
hash = name.charCodeAt(i) + ((hash << 5) - hash);
|
|
83
|
+
}
|
|
84
|
+
const hue = hash % 360;
|
|
85
|
+
return `hsl(${hue}, 70%, 50%)`;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const processedItems = React.useMemo(() => {
|
|
89
|
+
const list = Array.isArray(items) ? [...items] : [];
|
|
90
|
+
|
|
91
|
+
// Filter by employee status
|
|
92
|
+
const filtered = list.filter((e) => {
|
|
93
|
+
if (filter === "active") {
|
|
94
|
+
return e.employee_status === "Active";
|
|
95
|
+
}
|
|
96
|
+
return true; // 'all' - no filtering
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Map to consistent structure
|
|
100
|
+
const mapped = filtered
|
|
101
|
+
.map((e) => ({
|
|
102
|
+
entraId: String(e.entra_id || ""),
|
|
103
|
+
fullName: String(e.full_name || "Unknown"),
|
|
104
|
+
siteName: String(e.site_name || ""),
|
|
105
|
+
roleName: String(e.role_name || ""),
|
|
106
|
+
employeeId: String(e.employee_id || ""),
|
|
107
|
+
email: String(e.email || ""),
|
|
108
|
+
}))
|
|
109
|
+
.filter((e) => e.entraId); // Remove items without entra_id
|
|
110
|
+
|
|
111
|
+
// Sort based on grouping
|
|
112
|
+
mapped.sort((a, b) => {
|
|
113
|
+
if (groupBy === "site") {
|
|
114
|
+
const siteCompare = a.siteName.localeCompare(b.siteName);
|
|
115
|
+
if (siteCompare !== 0) return siteCompare;
|
|
116
|
+
return a.fullName.localeCompare(b.fullName);
|
|
117
|
+
}
|
|
118
|
+
if (groupBy === "role") {
|
|
119
|
+
const roleCompare = a.roleName.localeCompare(b.roleName);
|
|
120
|
+
if (roleCompare !== 0) return roleCompare;
|
|
121
|
+
return a.fullName.localeCompare(b.fullName);
|
|
122
|
+
}
|
|
123
|
+
return a.fullName.localeCompare(b.fullName);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
return mapped;
|
|
127
|
+
}, [items, filter, groupBy]);
|
|
128
|
+
|
|
129
|
+
const selectedEmployee = processedItems.find((e) => e.entraId === value);
|
|
130
|
+
|
|
131
|
+
const renderEmployeeItem = (employee, isSelected = false) => (
|
|
132
|
+
<div className="flex items-center gap-2">
|
|
133
|
+
{showAvatar && !isSelected && (
|
|
134
|
+
<div
|
|
135
|
+
className="flex h-6 w-6 items-center justify-center rounded-full text-xs font-medium text-white"
|
|
136
|
+
style={{ backgroundColor: getAvatarColor(employee.fullName) }}
|
|
137
|
+
>
|
|
138
|
+
{getInitials(employee.fullName)}
|
|
139
|
+
</div>
|
|
140
|
+
)}
|
|
141
|
+
<div className="flex-1 min-w-0">
|
|
142
|
+
<div className="flex items-center gap-2">
|
|
143
|
+
<span className="truncate">{employee.fullName}</span>
|
|
144
|
+
</div>
|
|
145
|
+
{showSiteName && employee.siteName && (
|
|
146
|
+
<div className="text-xs text-muted-foreground truncate">
|
|
147
|
+
{employee.siteName}
|
|
148
|
+
</div>
|
|
149
|
+
)}
|
|
150
|
+
{showEmployeeId && employee.employeeId && (
|
|
151
|
+
<div className="text-xs text-muted-foreground truncate">
|
|
152
|
+
ID: {employee.employeeId}
|
|
153
|
+
</div>
|
|
154
|
+
)}
|
|
155
|
+
{showEmail && employee.email && (
|
|
156
|
+
<div className="text-xs text-muted-foreground truncate">
|
|
157
|
+
{employee.email}
|
|
158
|
+
</div>
|
|
159
|
+
)}
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<Select
|
|
166
|
+
value={value || (allowAll ? "__all__" : undefined)}
|
|
167
|
+
onValueChange={(val) => {
|
|
168
|
+
if (val === "__all__") {
|
|
169
|
+
onChange?.(undefined);
|
|
170
|
+
} else {
|
|
171
|
+
onChange?.(val);
|
|
172
|
+
}
|
|
173
|
+
}}
|
|
174
|
+
disabled={disabled}
|
|
175
|
+
>
|
|
176
|
+
<SelectTrigger className={cn("w-full", className)}>
|
|
177
|
+
<div className="flex items-center gap-2">
|
|
178
|
+
{selectedEmployee && showAvatar ? (
|
|
179
|
+
<div
|
|
180
|
+
className="flex h-6 w-6 items-center justify-center rounded-full text-xs font-medium text-white"
|
|
181
|
+
style={{ backgroundColor: getAvatarColor(selectedEmployee.fullName) }}
|
|
182
|
+
>
|
|
183
|
+
{getInitials(selectedEmployee.fullName)}
|
|
184
|
+
</div>
|
|
185
|
+
) : (
|
|
186
|
+
<Users className="h-4 w-4" />
|
|
187
|
+
)}
|
|
188
|
+
<SelectValue placeholder={placeholder} />
|
|
189
|
+
</div>
|
|
190
|
+
</SelectTrigger>
|
|
191
|
+
<SelectContent
|
|
192
|
+
className="[&_[data-radix-select-viewport]]:max-h-[var(--select-max-height)] [&_[data-radix-select-viewport]]:overflow-y-auto [&>button[data-radix-select-scroll-up-button]]:hidden [&>button[data-radix-select-scroll-down-button]]:hidden"
|
|
193
|
+
style={{ "--select-max-height": maxHeight }}
|
|
194
|
+
>
|
|
195
|
+
{allowAll && <SelectItem value="__all__">{allLabel}</SelectItem>}
|
|
196
|
+
{groupBy === "site"
|
|
197
|
+
? // Group by site
|
|
198
|
+
Object.entries(
|
|
199
|
+
processedItems.reduce((groups, employee) => {
|
|
200
|
+
const site = employee.siteName || "Other";
|
|
201
|
+
if (!groups[site]) groups[site] = [];
|
|
202
|
+
groups[site].push(employee);
|
|
203
|
+
return groups;
|
|
204
|
+
}, {})
|
|
205
|
+
).map(([siteName, employees]) => (
|
|
206
|
+
<div key={siteName}>
|
|
207
|
+
<div className="px-2 py-1.5 text-xs font-semibold text-muted-foreground">
|
|
208
|
+
{siteName}
|
|
209
|
+
</div>
|
|
210
|
+
{employees.map((employee) => {
|
|
211
|
+
const isSelected = value === employee.entraId;
|
|
212
|
+
return (
|
|
213
|
+
<SelectItem key={employee.entraId} value={employee.entraId}>
|
|
214
|
+
{renderEmployeeItem(employee, isSelected)}
|
|
215
|
+
</SelectItem>
|
|
216
|
+
);
|
|
217
|
+
})}
|
|
218
|
+
</div>
|
|
219
|
+
))
|
|
220
|
+
: groupBy === "role"
|
|
221
|
+
? // Group by role
|
|
222
|
+
Object.entries(
|
|
223
|
+
processedItems.reduce((groups, employee) => {
|
|
224
|
+
const role = employee.roleName || "Other";
|
|
225
|
+
if (!groups[role]) groups[role] = [];
|
|
226
|
+
groups[role].push(employee);
|
|
227
|
+
return groups;
|
|
228
|
+
}, {})
|
|
229
|
+
).map(([roleName, employees]) => (
|
|
230
|
+
<div key={roleName}>
|
|
231
|
+
<div className="px-2 py-1.5 text-xs font-semibold text-muted-foreground">
|
|
232
|
+
{roleName}
|
|
233
|
+
</div>
|
|
234
|
+
{employees.map((employee) => {
|
|
235
|
+
const isSelected = value === employee.entraId;
|
|
236
|
+
return (
|
|
237
|
+
<SelectItem key={employee.entraId} value={employee.entraId}>
|
|
238
|
+
{renderEmployeeItem(employee, isSelected)}
|
|
239
|
+
</SelectItem>
|
|
240
|
+
);
|
|
241
|
+
})}
|
|
242
|
+
</div>
|
|
243
|
+
))
|
|
244
|
+
: // No grouping
|
|
245
|
+
processedItems.map((employee) => {
|
|
246
|
+
const isSelected = value === employee.entraId;
|
|
247
|
+
return (
|
|
248
|
+
<SelectItem key={employee.entraId} value={employee.entraId}>
|
|
249
|
+
{renderEmployeeItem(employee, isSelected)}
|
|
250
|
+
</SelectItem>
|
|
251
|
+
);
|
|
252
|
+
})}
|
|
253
|
+
</SelectContent>
|
|
254
|
+
</Select>
|
|
255
|
+
);
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
export default EmployeeSelect;
|
|
259
|
+
|
|
@@ -1,34 +1,155 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
1
|
+
//
|
|
2
|
+
// select.jsx
|
|
3
|
+
// -----------
|
|
4
|
+
// shadcn/ui Select component wrappers using @radix-ui/react-select.
|
|
5
|
+
// Import and use in forms for consistent dropdown styling.
|
|
6
|
+
//
|
|
7
|
+
// Example:
|
|
8
|
+
// <Select value={value} onValueChange={setValue}>
|
|
9
|
+
// <SelectTrigger className="w-full"><SelectValue placeholder="Select..." /></SelectTrigger>
|
|
10
|
+
// <SelectContent>
|
|
11
|
+
// <SelectItem value="site">Nursery site</SelectItem>
|
|
12
|
+
// <SelectItem value="custom">Custom address</SelectItem>
|
|
13
|
+
// </SelectContent>
|
|
14
|
+
// </Select>
|
|
3
15
|
|
|
4
16
|
import * as React from "react";
|
|
17
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
18
|
+
import { Check, ChevronDown, ChevronUp } from "lucide-react";
|
|
5
19
|
import { cn } from "../../lib/utils";
|
|
6
20
|
|
|
7
|
-
const Select =
|
|
8
|
-
|
|
9
|
-
|
|
21
|
+
const Select = SelectPrimitive.Root;
|
|
22
|
+
|
|
23
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
24
|
+
|
|
25
|
+
const SelectValue = SelectPrimitive.Value;
|
|
26
|
+
|
|
27
|
+
const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => (
|
|
28
|
+
<SelectPrimitive.Trigger
|
|
29
|
+
ref={ref}
|
|
30
|
+
className={cn(
|
|
31
|
+
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background",
|
|
32
|
+
"placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
33
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
34
|
+
"[&>span]:line-clamp-1",
|
|
35
|
+
className
|
|
36
|
+
)}
|
|
37
|
+
{...props}
|
|
38
|
+
>
|
|
39
|
+
{children}
|
|
40
|
+
<SelectPrimitive.Icon asChild>
|
|
41
|
+
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
42
|
+
</SelectPrimitive.Icon>
|
|
43
|
+
</SelectPrimitive.Trigger>
|
|
44
|
+
));
|
|
45
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
46
|
+
|
|
47
|
+
const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => (
|
|
48
|
+
<SelectPrimitive.ScrollUpButton
|
|
49
|
+
ref={ref}
|
|
50
|
+
className={cn(
|
|
51
|
+
"flex cursor-default items-center justify-center py-1",
|
|
52
|
+
className
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
>
|
|
56
|
+
<ChevronUp className="h-4 w-4" />
|
|
57
|
+
</SelectPrimitive.ScrollUpButton>
|
|
58
|
+
));
|
|
59
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
60
|
+
|
|
61
|
+
const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => (
|
|
62
|
+
<SelectPrimitive.ScrollDownButton
|
|
63
|
+
ref={ref}
|
|
64
|
+
className={cn(
|
|
65
|
+
"flex cursor-default items-center justify-center py-1",
|
|
66
|
+
className
|
|
67
|
+
)}
|
|
68
|
+
{...props}
|
|
69
|
+
>
|
|
70
|
+
<ChevronDown className="h-4 w-4" />
|
|
71
|
+
</SelectPrimitive.ScrollDownButton>
|
|
72
|
+
));
|
|
73
|
+
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
74
|
+
|
|
75
|
+
const SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => (
|
|
76
|
+
<SelectPrimitive.Portal>
|
|
77
|
+
<SelectPrimitive.Content
|
|
78
|
+
ref={ref}
|
|
10
79
|
className={cn(
|
|
11
|
-
"
|
|
80
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
81
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
82
|
+
"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",
|
|
83
|
+
position === "popper" &&
|
|
84
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
12
85
|
className
|
|
13
86
|
)}
|
|
14
|
-
|
|
87
|
+
position={position}
|
|
15
88
|
{...props}
|
|
16
89
|
>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<option className={cn("", className)} ref={ref} {...props}>
|
|
90
|
+
<SelectScrollUpButton />
|
|
91
|
+
<SelectPrimitive.Viewport
|
|
92
|
+
className={cn(
|
|
93
|
+
"p-1",
|
|
94
|
+
position === "popper" &&
|
|
95
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
96
|
+
)}
|
|
97
|
+
>
|
|
27
98
|
{children}
|
|
28
|
-
</
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
99
|
+
</SelectPrimitive.Viewport>
|
|
100
|
+
<SelectScrollDownButton />
|
|
101
|
+
</SelectPrimitive.Content>
|
|
102
|
+
</SelectPrimitive.Portal>
|
|
103
|
+
));
|
|
104
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
105
|
+
|
|
106
|
+
const SelectLabel = React.forwardRef(({ className, ...props }, ref) => (
|
|
107
|
+
<SelectPrimitive.Label
|
|
108
|
+
ref={ref}
|
|
109
|
+
className={cn("px-2 py-1.5 text-sm font-semibold", className)}
|
|
110
|
+
{...props}
|
|
111
|
+
/>
|
|
112
|
+
));
|
|
113
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
114
|
+
|
|
115
|
+
const SelectItem = React.forwardRef(({ className, children, ...props }, ref) => (
|
|
116
|
+
<SelectPrimitive.Item
|
|
117
|
+
ref={ref}
|
|
118
|
+
className={cn(
|
|
119
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none",
|
|
120
|
+
"focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
121
|
+
className
|
|
122
|
+
)}
|
|
123
|
+
{...props}
|
|
124
|
+
>
|
|
125
|
+
<span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
126
|
+
<SelectPrimitive.ItemIndicator>
|
|
127
|
+
<Check className="h-4 w-4" />
|
|
128
|
+
</SelectPrimitive.ItemIndicator>
|
|
129
|
+
</span>
|
|
130
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
131
|
+
</SelectPrimitive.Item>
|
|
132
|
+
));
|
|
133
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
134
|
+
|
|
135
|
+
const SelectSeparator = React.forwardRef(({ className, ...props }, ref) => (
|
|
136
|
+
<SelectPrimitive.Separator
|
|
137
|
+
ref={ref}
|
|
138
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
139
|
+
{...props}
|
|
140
|
+
/>
|
|
141
|
+
));
|
|
142
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
33
143
|
|
|
34
|
-
export {
|
|
144
|
+
export {
|
|
145
|
+
Select,
|
|
146
|
+
SelectGroup,
|
|
147
|
+
SelectValue,
|
|
148
|
+
SelectTrigger,
|
|
149
|
+
SelectScrollUpButton,
|
|
150
|
+
SelectScrollDownButton,
|
|
151
|
+
SelectContent,
|
|
152
|
+
SelectLabel,
|
|
153
|
+
SelectItem,
|
|
154
|
+
SelectSeparator,
|
|
155
|
+
};
|
package/src/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { default as EmployeeSearchPage } from "./EmployeeSearchPage.jsx";
|
|
|
16
16
|
export { default as EmployeeSearchModal } from "./EmployeeSearchModal.jsx";
|
|
17
17
|
export { default as EmployeeSearchDemo } from "./EmployeeSearchDemo.jsx";
|
|
18
18
|
export { default as EmployeeSearchFilters } from "./components/EmployeeSearchFilters.jsx";
|
|
19
|
+
export { default as EmployeeSelect } from "./components/EmployeeSelect.jsx";
|
|
19
20
|
|
|
20
21
|
export { configureTelemetry } from "./telemetry.js";
|
|
21
22
|
|