@snapdragonsnursery/react-components 1.18.0 → 1.18.2
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/package.json +1 -1
- package/src/AuthButtons.jsx +35 -14
- package/src/components/EmployeeSelect.jsx +4 -0
package/package.json
CHANGED
package/src/AuthButtons.jsx
CHANGED
|
@@ -203,23 +203,44 @@ function AuthButtons({ theme, setTheme, authState, setAuthState }) {
|
|
|
203
203
|
// Setup Popper when menu is open
|
|
204
204
|
useEffect(() => {
|
|
205
205
|
if (menuOpen && buttonRef.current && menuRef.current) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
206
|
+
// Add a small delay to ensure DOM nodes are fully mounted
|
|
207
|
+
// This prevents MutationObserver errors when Popper tries to observe nodes
|
|
208
|
+
const timeoutId = setTimeout(() => {
|
|
209
|
+
// Double-check refs are still valid before creating Popper
|
|
210
|
+
if (
|
|
211
|
+
buttonRef.current &&
|
|
212
|
+
menuRef.current &&
|
|
213
|
+
buttonRef.current instanceof Node &&
|
|
214
|
+
menuRef.current instanceof Node
|
|
215
|
+
) {
|
|
216
|
+
popperInstance.current = createPopper(
|
|
217
|
+
buttonRef.current,
|
|
218
|
+
menuRef.current,
|
|
213
219
|
{
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
+
placement: "bottom-end",
|
|
221
|
+
modifiers: [
|
|
222
|
+
{ name: "preventOverflow", options: { boundary: "viewport" } },
|
|
223
|
+
{
|
|
224
|
+
name: "flip",
|
|
225
|
+
options: {
|
|
226
|
+
fallbackPlacements: ["bottom-start", "top-end", "top-start"],
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
}, 0);
|
|
234
|
+
|
|
235
|
+
return () => {
|
|
236
|
+
clearTimeout(timeoutId);
|
|
237
|
+
if (popperInstance.current) {
|
|
238
|
+
popperInstance.current.destroy();
|
|
239
|
+
popperInstance.current = null;
|
|
220
240
|
}
|
|
221
|
-
|
|
241
|
+
};
|
|
222
242
|
}
|
|
243
|
+
|
|
223
244
|
return () => {
|
|
224
245
|
if (popperInstance.current) {
|
|
225
246
|
popperInstance.current.destroy();
|
|
@@ -304,6 +304,10 @@ export const EmployeeSelect = ({
|
|
|
304
304
|
<div className="px-3 py-6 text-center text-sm text-muted-foreground">
|
|
305
305
|
Start typing to search for employees...
|
|
306
306
|
</div>
|
|
307
|
+
) : isSearching ? (
|
|
308
|
+
<div className="px-3 py-6 text-center">
|
|
309
|
+
<div className="animate-spin rounded-full h-6 w-6 border-b-2 border-primary mx-auto"></div>
|
|
310
|
+
</div>
|
|
307
311
|
) : processedItems.length === 0 ? (
|
|
308
312
|
<div className="px-3 py-6 text-center text-sm text-muted-foreground">
|
|
309
313
|
No employees found
|