@kumix/ui 0.3.7 → 0.3.8
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 +25 -24
- package/dist/cascader-types-BnH6wYD-.d.ts +183 -0
- package/dist/cascader-types-BnH6wYD-.d.ts.map +1 -0
- package/dist/components/motion/animated-sidebar.d.ts.map +1 -1
- package/dist/components/motion/animated-sidebar.js +12 -3
- package/dist/components/motion/animated-sidebar.js.map +1 -1
- package/dist/components/motion/attachment-upload.d.ts.map +1 -1
- package/dist/components/motion/attachment-upload.js +9 -5
- package/dist/components/motion/attachment-upload.js.map +1 -1
- package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
- package/dist/components/motion/bottom-sheet.js +77 -74
- package/dist/components/motion/bottom-sheet.js.map +1 -1
- package/dist/components/motion/center-morph-modal.d.ts.map +1 -1
- package/dist/components/motion/center-morph-modal.js +82 -88
- package/dist/components/motion/center-morph-modal.js.map +1 -1
- package/dist/components/motion/command-palette.d.ts.map +1 -1
- package/dist/components/motion/command-palette.js +48 -26
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/drawer.d.ts.map +1 -1
- package/dist/components/motion/drawer.js +30 -30
- package/dist/components/motion/drawer.js.map +1 -1
- package/dist/components/motion/loader.js +20 -22
- package/dist/components/motion/loader.js.map +1 -1
- package/dist/components/motion/morphing-modal.d.ts.map +1 -1
- package/dist/components/motion/morphing-modal.js +83 -83
- package/dist/components/motion/morphing-modal.js.map +1 -1
- package/dist/components/motion/morphing-search.d.ts +28 -0
- package/dist/components/motion/morphing-search.d.ts.map +1 -0
- package/dist/components/motion/morphing-search.js +418 -0
- package/dist/components/motion/morphing-search.js.map +1 -0
- package/dist/components/motion/project-folder.js +20 -20
- package/dist/components/motion/project-folder.js.map +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-async.d.ts +90 -0
- package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-async.js +549 -0
- package/dist/components/reui/cascader/cascader-async.js.map +1 -0
- package/dist/components/reui/cascader/cascader-columns.d.ts +29 -0
- package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-columns.js +135 -0
- package/dist/components/reui/cascader/cascader-columns.js.map +1 -0
- package/dist/components/reui/cascader/cascader-context.d.ts +193 -0
- package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-context.js +59 -0
- package/dist/components/reui/cascader/cascader-context.js.map +1 -0
- package/dist/components/reui/cascader/cascader-footer.d.ts +85 -0
- package/dist/components/reui/cascader/cascader-footer.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-footer.js +456 -0
- package/dist/components/reui/cascader/cascader-footer.js.map +1 -0
- package/dist/components/reui/cascader/cascader-i18n.d.ts +17 -0
- package/dist/components/reui/cascader/cascader-i18n.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-i18n.js +68 -0
- package/dist/components/reui/cascader/cascader-i18n.js.map +1 -0
- package/dist/components/reui/cascader/cascader-item.d.ts +115 -0
- package/dist/components/reui/cascader/cascader-item.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-item.js +530 -0
- package/dist/components/reui/cascader/cascader-item.js.map +1 -0
- package/dist/components/reui/cascader/cascader-lib.d.ts +141 -0
- package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-lib.js +576 -0
- package/dist/components/reui/cascader/cascader-lib.js.map +1 -0
- package/dist/components/reui/cascader/cascader-nav.d.ts +59 -0
- package/dist/components/reui/cascader/cascader-nav.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-nav.js +312 -0
- package/dist/components/reui/cascader/cascader-nav.js.map +1 -0
- package/dist/components/reui/cascader/cascader-types.d.ts +2 -0
- package/dist/components/reui/cascader/cascader-types.js +2 -0
- package/dist/components/reui/cascader/cascader-virtual.d.ts +65 -0
- package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-virtual.js +240 -0
- package/dist/components/reui/cascader/cascader-virtual.js.map +1 -0
- package/dist/components/reui/cascader/cascader.d.ts +322 -0
- package/dist/components/reui/cascader/cascader.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader.js +1459 -0
- package/dist/components/reui/cascader/cascader.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts +28 -47
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +26 -44
- package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts +19 -57
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts.map +1 -1
- package/dist/components/reui/filters/filters-advanced.d.ts +52 -0
- package/dist/components/reui/filters/filters-advanced.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-advanced.js +1191 -0
- package/dist/components/reui/filters/filters-advanced.js.map +1 -0
- package/dist/components/reui/filters/filters-builder.d.ts +43 -0
- package/dist/components/reui/filters/filters-builder.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-builder.js +152 -0
- package/dist/components/reui/filters/filters-builder.js.map +1 -0
- package/dist/components/reui/filters/filters-chip.d.ts +79 -0
- package/dist/components/reui/filters/filters-chip.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-chip.js +553 -0
- package/dist/components/reui/filters/filters-chip.js.map +1 -0
- package/dist/components/reui/filters/filters-context.d.ts +290 -0
- package/dist/components/reui/filters/filters-context.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-context.js +277 -0
- package/dist/components/reui/filters/filters-context.js.map +1 -0
- package/dist/components/reui/filters/filters-date.d.ts +43 -0
- package/dist/components/reui/filters/filters-date.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-date.js +143 -0
- package/dist/components/reui/filters/filters-date.js.map +1 -0
- package/dist/components/reui/filters/filters-dnd.d.ts +101 -0
- package/dist/components/reui/filters/filters-dnd.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-dnd.js +454 -0
- package/dist/components/reui/filters/filters-dnd.js.map +1 -0
- package/dist/components/reui/filters/filters-draft.d.ts +2 -0
- package/dist/components/reui/filters/filters-draft.js +128 -0
- package/dist/components/reui/filters/filters-draft.js.map +1 -0
- package/dist/components/reui/filters/filters-editors.d.ts +91 -0
- package/dist/components/reui/filters/filters-editors.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-editors.js +773 -0
- package/dist/components/reui/filters/filters-editors.js.map +1 -0
- package/dist/components/reui/filters/filters-i18n.d.ts +24 -0
- package/dist/components/reui/filters/filters-i18n.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-i18n.js +127 -0
- package/dist/components/reui/filters/filters-i18n.js.map +1 -0
- package/dist/components/reui/filters/filters-lib.d.ts +171 -0
- package/dist/components/reui/filters/filters-lib.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-lib.js +336 -0
- package/dist/components/reui/filters/filters-lib.js.map +1 -0
- package/dist/components/reui/filters/filters-operators.d.ts +49 -0
- package/dist/components/reui/filters/filters-operators.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-operators.js +300 -0
- package/dist/components/reui/filters/filters-operators.js.map +1 -0
- package/dist/components/reui/filters/filters-query.d.ts +132 -0
- package/dist/components/reui/filters/filters-query.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-query.js +476 -0
- package/dist/components/reui/filters/filters-query.js.map +1 -0
- package/dist/components/reui/filters/filters-types.d.ts +452 -0
- package/dist/components/reui/filters/filters-types.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-types.js +2 -0
- package/dist/components/reui/filters/filters.d.ts +114 -0
- package/dist/components/reui/filters/filters.d.ts.map +1 -0
- package/dist/components/reui/filters/filters.js +638 -0
- package/dist/components/reui/filters/filters.js.map +1 -0
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +1 -1
- package/dist/components/reui/gantt/gantt-types.d.ts +25 -71
- package/dist/components/reui/gantt/gantt-types.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-view.js +1 -1
- package/dist/components/ui/attachment.d.ts +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/field.js +2 -2
- package/dist/components/ui/field.js.map +1 -1
- package/dist/components/ui/item.d.ts +1 -1
- package/dist/components/ui/radio-group.js +1 -1
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/filters-draft-DEAl3TO-.d.ts +70 -0
- package/dist/filters-draft-DEAl3TO-.d.ts.map +1 -0
- package/dist/lib/text-shimmer.d.ts +2 -2
- package/dist/lib/text-shimmer.d.ts.map +1 -1
- package/dist/lib/text-shimmer.js +2 -2
- package/dist/lib/text-shimmer.js.map +1 -1
- package/dist/presence-gate-BekdC4Bo.js +24 -0
- package/dist/presence-gate-BekdC4Bo.js.map +1 -0
- package/package.json +9 -9
- package/dist/components/reui/filters.d.ts +0 -176
- package/dist/components/reui/filters.d.ts.map +0 -1
- package/dist/components/reui/filters.js +0 -1223
- package/dist/components/reui/filters.js.map +0 -1
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { EASE_OUT, SPRING_LAYOUT } from "../../lib/ease.js";
|
|
3
|
+
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { cn } from "@kumix/utils";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { AnimatePresence, LayoutGroup, motion, useReducedMotion } from "motion/react";
|
|
7
|
+
import { Search } from "lucide-react";
|
|
8
|
+
import { createPortal } from "react-dom";
|
|
9
|
+
//#region src/components/motion/morphing-search.tsx
|
|
10
|
+
const SEARCH_MORPH = {
|
|
11
|
+
type: "spring",
|
|
12
|
+
duration: .58,
|
|
13
|
+
bounce: .22
|
|
14
|
+
};
|
|
15
|
+
const SEARCH_CLIP_TRANSITION = {
|
|
16
|
+
duration: .32,
|
|
17
|
+
ease: EASE_OUT
|
|
18
|
+
};
|
|
19
|
+
function isEditableTarget(target) {
|
|
20
|
+
if (!(target instanceof HTMLElement)) return false;
|
|
21
|
+
return target.isContentEditable || target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement;
|
|
22
|
+
}
|
|
23
|
+
function MorphingSearch({ items, placeholder = "Search", shortcut = "f", iconOnly = false, emptyMessage = "No results found.", open: controlledOpen, defaultOpen = false, onOpenChange, onQueryChange, onSelect, className }) {
|
|
24
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
25
|
+
const [query, setQuery] = useState("");
|
|
26
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
27
|
+
const [mounted, setMounted] = useState(false);
|
|
28
|
+
const [backgroundScrollLocked, setBackgroundScrollLocked] = useState(defaultOpen);
|
|
29
|
+
const [anchorRect, setAnchorRect] = useState({
|
|
30
|
+
top: 16,
|
|
31
|
+
left: 16,
|
|
32
|
+
width: 288
|
|
33
|
+
});
|
|
34
|
+
const open = controlledOpen ?? internalOpen;
|
|
35
|
+
const controlled = controlledOpen !== void 0;
|
|
36
|
+
const reduce = useReducedMotion();
|
|
37
|
+
const uid = useId();
|
|
38
|
+
const anchorRef = useRef(null);
|
|
39
|
+
const triggerRef = useRef(null);
|
|
40
|
+
const inputRef = useRef(null);
|
|
41
|
+
const dialogRef = useRef(null);
|
|
42
|
+
const listRef = useRef(null);
|
|
43
|
+
const previousFocusRef = useRef(null);
|
|
44
|
+
const wasOpenRef = useRef(open);
|
|
45
|
+
const transition = reduce ? { duration: 0 } : SPRING_LAYOUT;
|
|
46
|
+
const morphTransition = reduce ? { duration: 0 } : SEARCH_MORPH;
|
|
47
|
+
const setOpen = useCallback((next) => {
|
|
48
|
+
if (!controlled) setInternalOpen(next);
|
|
49
|
+
onOpenChange?.(next);
|
|
50
|
+
}, [controlled, onOpenChange]);
|
|
51
|
+
const measureAnchor = useCallback(() => {
|
|
52
|
+
const rect = anchorRef.current?.getBoundingClientRect();
|
|
53
|
+
if (!rect || rect.width === 0) return;
|
|
54
|
+
setAnchorRect({
|
|
55
|
+
top: rect.top,
|
|
56
|
+
left: rect.left,
|
|
57
|
+
width: rect.width
|
|
58
|
+
});
|
|
59
|
+
}, []);
|
|
60
|
+
const openSearch = useCallback(() => {
|
|
61
|
+
measureAnchor();
|
|
62
|
+
setBackgroundScrollLocked(true);
|
|
63
|
+
previousFocusRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
64
|
+
setOpen(true);
|
|
65
|
+
}, [measureAnchor, setOpen]);
|
|
66
|
+
const updateQuery = useCallback((next) => {
|
|
67
|
+
setQuery(next);
|
|
68
|
+
setActiveIndex(0);
|
|
69
|
+
onQueryChange?.(next);
|
|
70
|
+
}, [onQueryChange]);
|
|
71
|
+
const closeSearch = useCallback(() => {
|
|
72
|
+
updateQuery("");
|
|
73
|
+
setOpen(false);
|
|
74
|
+
}, [setOpen, updateQuery]);
|
|
75
|
+
useEffect(() => setMounted(true), []);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (open) setBackgroundScrollLocked(true);
|
|
78
|
+
}, [open]);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
measureAnchor();
|
|
81
|
+
const anchor = anchorRef.current;
|
|
82
|
+
const observer = anchor && typeof ResizeObserver !== "undefined" ? new ResizeObserver(measureAnchor) : null;
|
|
83
|
+
if (anchor) observer?.observe(anchor);
|
|
84
|
+
window.addEventListener("resize", measureAnchor);
|
|
85
|
+
document.addEventListener("scroll", measureAnchor, true);
|
|
86
|
+
window.visualViewport?.addEventListener("resize", measureAnchor);
|
|
87
|
+
window.visualViewport?.addEventListener("scroll", measureAnchor);
|
|
88
|
+
return () => {
|
|
89
|
+
observer?.disconnect();
|
|
90
|
+
window.removeEventListener("resize", measureAnchor);
|
|
91
|
+
document.removeEventListener("scroll", measureAnchor, true);
|
|
92
|
+
window.visualViewport?.removeEventListener("resize", measureAnchor);
|
|
93
|
+
window.visualViewport?.removeEventListener("scroll", measureAnchor);
|
|
94
|
+
};
|
|
95
|
+
}, [measureAnchor]);
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (!backgroundScrollLocked) return;
|
|
98
|
+
const preventBackgroundWheel = (event) => {
|
|
99
|
+
const target = event.target;
|
|
100
|
+
if (target instanceof Node && listRef.current?.contains(target)) return;
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
};
|
|
103
|
+
const preventBackgroundTouch = (event) => {
|
|
104
|
+
const target = event.target;
|
|
105
|
+
if (target instanceof Node && listRef.current?.contains(target)) return;
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
};
|
|
108
|
+
document.addEventListener("wheel", preventBackgroundWheel, { passive: false });
|
|
109
|
+
document.addEventListener("touchmove", preventBackgroundTouch, { passive: false });
|
|
110
|
+
return () => {
|
|
111
|
+
document.removeEventListener("wheel", preventBackgroundWheel);
|
|
112
|
+
document.removeEventListener("touchmove", preventBackgroundTouch);
|
|
113
|
+
};
|
|
114
|
+
}, [backgroundScrollLocked]);
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
const handleShortcut = (event) => {
|
|
117
|
+
if (event.key === "Escape" && open) {
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
closeSearch();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (!open && shortcut && event.key.toLowerCase() === shortcut.toLowerCase() && !event.repeat && !event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey && !isEditableTarget(event.target)) {
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
openSearch();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
window.addEventListener("keydown", handleShortcut);
|
|
128
|
+
return () => window.removeEventListener("keydown", handleShortcut);
|
|
129
|
+
}, [
|
|
130
|
+
closeSearch,
|
|
131
|
+
open,
|
|
132
|
+
openSearch,
|
|
133
|
+
shortcut
|
|
134
|
+
]);
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
if (open) {
|
|
137
|
+
updateQuery("");
|
|
138
|
+
const frame = requestAnimationFrame(() => inputRef.current?.focus());
|
|
139
|
+
return () => cancelAnimationFrame(frame);
|
|
140
|
+
}
|
|
141
|
+
if (wasOpenRef.current) {
|
|
142
|
+
const frame = requestAnimationFrame(() => {
|
|
143
|
+
const previousFocus = previousFocusRef.current;
|
|
144
|
+
(previousFocus?.isConnected ? previousFocus : triggerRef.current)?.focus();
|
|
145
|
+
});
|
|
146
|
+
return () => cancelAnimationFrame(frame);
|
|
147
|
+
}
|
|
148
|
+
}, [open, updateQuery]);
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
wasOpenRef.current = open;
|
|
151
|
+
}, [open]);
|
|
152
|
+
const filteredItems = useMemo(() => {
|
|
153
|
+
const needle = query.trim().toLowerCase();
|
|
154
|
+
if (!needle) return items;
|
|
155
|
+
return items.filter((item) => [
|
|
156
|
+
item.title,
|
|
157
|
+
item.description ?? "",
|
|
158
|
+
...item.keywords ?? []
|
|
159
|
+
].join(" ").toLowerCase().includes(needle));
|
|
160
|
+
}, [items, query]);
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
if (activeIndex < filteredItems.length) return;
|
|
163
|
+
setActiveIndex(Math.max(0, filteredItems.length - 1));
|
|
164
|
+
}, [activeIndex, filteredItems.length]);
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
if (!open) return;
|
|
167
|
+
listRef.current?.querySelector(`[data-index="${activeIndex}"]`)?.scrollIntoView({ block: "nearest" });
|
|
168
|
+
}, [activeIndex, open]);
|
|
169
|
+
const selectItem = useCallback((item) => {
|
|
170
|
+
item.onSelect?.();
|
|
171
|
+
onSelect?.(item);
|
|
172
|
+
closeSearch();
|
|
173
|
+
}, [closeSearch, onSelect]);
|
|
174
|
+
const handleDialogKeyDown = (event) => {
|
|
175
|
+
if (event.key === "ArrowDown") {
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
if (filteredItems.length === 0) return;
|
|
178
|
+
setActiveIndex((current) => Math.min(current + 1, filteredItems.length - 1));
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (event.key === "ArrowUp") {
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
setActiveIndex((current) => Math.max(current - 1, 0));
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (event.key === "Enter") {
|
|
187
|
+
event.preventDefault();
|
|
188
|
+
const item = filteredItems[activeIndex];
|
|
189
|
+
if (item) selectItem(item);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (event.key !== "Tab" || !dialogRef.current) return;
|
|
193
|
+
const focusable = Array.from(dialogRef.current.querySelectorAll("input, button:not([disabled]), [tabindex]:not([tabindex=\"-1\"])"));
|
|
194
|
+
const first = focusable[0];
|
|
195
|
+
const last = focusable.at(-1);
|
|
196
|
+
if (!first || !last) return;
|
|
197
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
198
|
+
event.preventDefault();
|
|
199
|
+
last.focus();
|
|
200
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
201
|
+
event.preventDefault();
|
|
202
|
+
first.focus();
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
const shellLayoutId = `${uid}-shell`;
|
|
206
|
+
const listboxId = `${uid}-results`;
|
|
207
|
+
const panelWidth = mounted ? Math.max(anchorRect.width, Math.min(448, window.innerWidth - anchorRect.left - 16)) : anchorRect.width;
|
|
208
|
+
const resultsHeight = mounted ? Math.max(96, Math.min(288, window.innerHeight - anchorRect.top - 80)) : 288;
|
|
209
|
+
const collapsedContentClip = `inset(0px ${Math.max(0, panelWidth - anchorRect.width)}px ${resultsHeight}px 0px round 12px)`;
|
|
210
|
+
const overlay = mounted ? createPortal(/* @__PURE__ */ jsx("div", {
|
|
211
|
+
"aria-hidden": !open,
|
|
212
|
+
inert: !open,
|
|
213
|
+
className: "pointer-events-none fixed top-0 left-0 z-50 size-0",
|
|
214
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
215
|
+
initial: false,
|
|
216
|
+
mode: "popLayout",
|
|
217
|
+
onExitComplete: () => setBackgroundScrollLocked(false),
|
|
218
|
+
children: open ? /* @__PURE__ */ jsxs(motion.div, {
|
|
219
|
+
className: "fixed top-0 left-0 size-0",
|
|
220
|
+
children: [
|
|
221
|
+
/* @__PURE__ */ jsx("button", {
|
|
222
|
+
type: "button",
|
|
223
|
+
"aria-label": "Close search",
|
|
224
|
+
className: "pointer-events-auto fixed inset-0 cursor-default bg-transparent",
|
|
225
|
+
onClick: closeSearch
|
|
226
|
+
}),
|
|
227
|
+
/* @__PURE__ */ jsx(motion.div, {
|
|
228
|
+
layoutId: shellLayoutId,
|
|
229
|
+
"aria-hidden": "true",
|
|
230
|
+
className: "fixed z-10 rounded-xl bg-background/90 backdrop-blur-xl",
|
|
231
|
+
style: {
|
|
232
|
+
top: anchorRect.top,
|
|
233
|
+
left: anchorRect.left,
|
|
234
|
+
width: panelWidth,
|
|
235
|
+
height: 48 + resultsHeight,
|
|
236
|
+
boxShadow: "inset 0 0 0 1px var(--color-border)"
|
|
237
|
+
},
|
|
238
|
+
transition: morphTransition
|
|
239
|
+
}),
|
|
240
|
+
/* @__PURE__ */ jsxs(motion.div, {
|
|
241
|
+
ref: dialogRef,
|
|
242
|
+
role: "dialog",
|
|
243
|
+
"aria-modal": "true",
|
|
244
|
+
"aria-label": "Search",
|
|
245
|
+
onKeyDown: handleDialogKeyDown,
|
|
246
|
+
initial: reduce ? false : {
|
|
247
|
+
opacity: 0,
|
|
248
|
+
clipPath: collapsedContentClip
|
|
249
|
+
},
|
|
250
|
+
animate: {
|
|
251
|
+
opacity: 1,
|
|
252
|
+
clipPath: "inset(0px 0px 0px 0px round 12px)"
|
|
253
|
+
},
|
|
254
|
+
exit: {
|
|
255
|
+
opacity: 0,
|
|
256
|
+
clipPath: collapsedContentClip,
|
|
257
|
+
transition: reduce ? { duration: 0 } : {
|
|
258
|
+
clipPath: SEARCH_CLIP_TRANSITION,
|
|
259
|
+
opacity: SEARCH_MORPH
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
transition: reduce ? { duration: 0 } : {
|
|
263
|
+
clipPath: SEARCH_CLIP_TRANSITION,
|
|
264
|
+
opacity: SEARCH_MORPH
|
|
265
|
+
},
|
|
266
|
+
className: "pointer-events-auto fixed z-20 overflow-hidden rounded-xl",
|
|
267
|
+
style: {
|
|
268
|
+
top: anchorRect.top,
|
|
269
|
+
left: anchorRect.left,
|
|
270
|
+
width: panelWidth
|
|
271
|
+
},
|
|
272
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
273
|
+
className: cn("flex h-12 items-center gap-2.5 border-border border-b", iconOnly ? "px-4" : "px-3.5"),
|
|
274
|
+
children: [
|
|
275
|
+
/* @__PURE__ */ jsx("span", {
|
|
276
|
+
className: "shrink-0",
|
|
277
|
+
children: /* @__PURE__ */ jsx(Search, { className: "size-4 text-muted-foreground" })
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ jsx("div", {
|
|
280
|
+
className: "flex h-10 min-w-0 flex-1 items-center",
|
|
281
|
+
children: /* @__PURE__ */ jsx("input", {
|
|
282
|
+
ref: inputRef,
|
|
283
|
+
value: query,
|
|
284
|
+
onChange: (event) => updateQuery(event.target.value),
|
|
285
|
+
role: "combobox",
|
|
286
|
+
"aria-label": placeholder,
|
|
287
|
+
"aria-expanded": "true",
|
|
288
|
+
"aria-controls": listboxId,
|
|
289
|
+
"aria-autocomplete": "list",
|
|
290
|
+
"aria-activedescendant": filteredItems.length > 0 ? `${uid}-option-${activeIndex}` : void 0,
|
|
291
|
+
placeholder,
|
|
292
|
+
className: "size-full bg-transparent text-foreground text-sm outline-none placeholder:text-muted-foreground"
|
|
293
|
+
})
|
|
294
|
+
}),
|
|
295
|
+
/* @__PURE__ */ jsx("kbd", {
|
|
296
|
+
className: "flex h-7 shrink-0 items-center rounded-md border border-border px-2 text-muted-foreground text-xs",
|
|
297
|
+
children: "Esc"
|
|
298
|
+
})
|
|
299
|
+
]
|
|
300
|
+
}), /* @__PURE__ */ jsx(motion.div, {
|
|
301
|
+
ref: listRef,
|
|
302
|
+
id: listboxId,
|
|
303
|
+
role: "listbox",
|
|
304
|
+
"aria-label": "Search results",
|
|
305
|
+
transition: reduce ? { duration: 0 } : void 0,
|
|
306
|
+
variants: reduce ? void 0 : {
|
|
307
|
+
closed: {
|
|
308
|
+
opacity: 0,
|
|
309
|
+
transform: "translateY(6px)",
|
|
310
|
+
transition: {
|
|
311
|
+
duration: .16,
|
|
312
|
+
delay: .18,
|
|
313
|
+
ease: EASE_OUT
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
open: {
|
|
317
|
+
opacity: 1,
|
|
318
|
+
transform: "translateY(0px)",
|
|
319
|
+
transition: {
|
|
320
|
+
duration: .16,
|
|
321
|
+
ease: EASE_OUT
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
initial: reduce ? {
|
|
326
|
+
opacity: 1,
|
|
327
|
+
transform: "translateY(0px)"
|
|
328
|
+
} : "closed",
|
|
329
|
+
animate: reduce ? {
|
|
330
|
+
opacity: 1,
|
|
331
|
+
transform: "translateY(0px)"
|
|
332
|
+
} : "open",
|
|
333
|
+
exit: reduce ? void 0 : "closed",
|
|
334
|
+
className: "overflow-y-auto overscroll-contain p-2",
|
|
335
|
+
style: { maxHeight: resultsHeight },
|
|
336
|
+
children: filteredItems.length > 0 ? filteredItems.map((item, index) => {
|
|
337
|
+
const Icon = item.icon;
|
|
338
|
+
const active = index === activeIndex;
|
|
339
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
340
|
+
id: `${uid}-option-${index}`,
|
|
341
|
+
type: "button",
|
|
342
|
+
role: "option",
|
|
343
|
+
"aria-selected": active,
|
|
344
|
+
"data-index": index,
|
|
345
|
+
onMouseMove: () => setActiveIndex(index),
|
|
346
|
+
onFocus: () => setActiveIndex(index),
|
|
347
|
+
onClick: () => selectItem(item),
|
|
348
|
+
className: "relative flex w-full items-center gap-2.5 rounded-lg px-3 py-2.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
|
|
349
|
+
children: [
|
|
350
|
+
active ? /* @__PURE__ */ jsx(motion.span, {
|
|
351
|
+
layoutId: `${uid}-active-result`,
|
|
352
|
+
className: "absolute inset-0 rounded-lg bg-foreground/5",
|
|
353
|
+
transition
|
|
354
|
+
}) : null,
|
|
355
|
+
Icon ? /* @__PURE__ */ jsx(Icon, { className: "relative size-4 shrink-0 text-muted-foreground" }) : null,
|
|
356
|
+
/* @__PURE__ */ jsxs("span", {
|
|
357
|
+
className: "relative min-w-0",
|
|
358
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
359
|
+
className: "block truncate font-medium text-foreground text-sm",
|
|
360
|
+
children: item.title
|
|
361
|
+
}), item.description ? /* @__PURE__ */ jsx("span", {
|
|
362
|
+
className: "block truncate text-muted-foreground text-xs",
|
|
363
|
+
children: item.description
|
|
364
|
+
}) : null]
|
|
365
|
+
})
|
|
366
|
+
]
|
|
367
|
+
}, item.id);
|
|
368
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
369
|
+
className: "px-3 py-8 text-center text-muted-foreground text-sm",
|
|
370
|
+
children: emptyMessage
|
|
371
|
+
})
|
|
372
|
+
})]
|
|
373
|
+
})
|
|
374
|
+
]
|
|
375
|
+
}, "morphing-search-overlay") : null
|
|
376
|
+
})
|
|
377
|
+
}), document.body) : null;
|
|
378
|
+
return /* @__PURE__ */ jsxs(LayoutGroup, {
|
|
379
|
+
id: uid,
|
|
380
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
381
|
+
ref: anchorRef,
|
|
382
|
+
className: cn("relative", iconOnly ? "size-12" : "h-12 w-72 max-w-full", className),
|
|
383
|
+
children: [!open ? /* @__PURE__ */ jsx(motion.button, {
|
|
384
|
+
ref: triggerRef,
|
|
385
|
+
layoutId: shellLayoutId,
|
|
386
|
+
type: "button",
|
|
387
|
+
"aria-haspopup": "dialog",
|
|
388
|
+
"aria-expanded": "false",
|
|
389
|
+
"aria-label": placeholder,
|
|
390
|
+
onClick: openSearch,
|
|
391
|
+
transition: morphTransition,
|
|
392
|
+
style: { boxShadow: "inset 0 0 0 1px var(--search-trigger-stroke)" },
|
|
393
|
+
className: cn("flex size-full items-center rounded-xl bg-background/60 text-left outline-none backdrop-blur-md [--search-trigger-stroke:var(--color-border)] focus-visible:ring-2 focus-visible:ring-ring hover:[--search-trigger-stroke:var(--color-border-strong)]", iconOnly ? "cursor-pointer justify-center" : "cursor-text px-3.5")
|
|
394
|
+
}, "morphing-search-trigger") : null, /* @__PURE__ */ jsxs(motion.div, {
|
|
395
|
+
"aria-hidden": "true",
|
|
396
|
+
initial: false,
|
|
397
|
+
animate: { opacity: open ? 0 : 1 },
|
|
398
|
+
transition: reduce ? { duration: 0 } : {
|
|
399
|
+
duration: .1,
|
|
400
|
+
delay: open ? .1 : .12,
|
|
401
|
+
ease: EASE_OUT
|
|
402
|
+
},
|
|
403
|
+
className: cn("pointer-events-none absolute inset-0 flex items-center", backgroundScrollLocked && "z-60", iconOnly ? "justify-center" : "gap-2.5 px-3.5"),
|
|
404
|
+
children: [/* @__PURE__ */ jsx(Search, { className: "size-4 shrink-0 text-muted-foreground" }), iconOnly ? null : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
405
|
+
className: "min-w-0 flex-1 truncate text-muted-foreground text-sm",
|
|
406
|
+
children: placeholder
|
|
407
|
+
}), shortcut ? /* @__PURE__ */ jsx("kbd", {
|
|
408
|
+
className: "flex h-7 min-w-7 shrink-0 items-center justify-center rounded-md border border-border px-2 text-muted-foreground text-xs",
|
|
409
|
+
children: shortcut.toUpperCase()
|
|
410
|
+
}) : null] })]
|
|
411
|
+
})]
|
|
412
|
+
}), overlay]
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
//#endregion
|
|
416
|
+
export { MorphingSearch };
|
|
417
|
+
|
|
418
|
+
//# sourceMappingURL=morphing-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"morphing-search.js","names":[],"sources":["../../../src/components/motion/morphing-search.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type KeyboardEvent as ReactKeyboardEvent,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { type LucideIcon, Search } from \"lucide-react\";\nimport {\n AnimatePresence,\n LayoutGroup,\n motion,\n type Transition,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_LAYOUT } from \"../../lib/ease\";\n\n// Keeps the Wallet Card feel with a little more time to read the morph.\nconst SEARCH_MORPH: Transition = {\n type: \"spring\",\n duration: 0.58,\n bounce: 0.22,\n};\n\n// Keep the spring on the shell, but unfold complex clip-path values with the\n// same progressive tween as Morph Popover so the content never snaps ahead.\nconst SEARCH_CLIP_TRANSITION: Transition = {\n duration: 0.32,\n ease: EASE_OUT,\n};\n\nexport type MorphingSearchItem = {\n id: string;\n title: string;\n description?: string;\n keywords?: string[];\n icon?: LucideIcon;\n onSelect?: () => void;\n};\n\nexport interface MorphingSearchProps {\n items: MorphingSearchItem[];\n placeholder?: string;\n shortcut?: string;\n /** Render the closed trigger as a compact search icon. */\n iconOnly?: boolean;\n emptyMessage?: string;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n onQueryChange?: (query: string) => void;\n onSelect?: (item: MorphingSearchItem) => void;\n className?: string;\n}\n\ntype AnchorRect = {\n top: number;\n left: number;\n width: number;\n};\n\nfunction isEditableTarget(target: EventTarget | null) {\n if (!(target instanceof HTMLElement)) return false;\n return (\n target.isContentEditable ||\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement\n );\n}\n\nexport function MorphingSearch({\n items,\n placeholder = \"Search\",\n shortcut = \"f\",\n iconOnly = false,\n emptyMessage = \"No results found.\",\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n onQueryChange,\n onSelect,\n className,\n}: MorphingSearchProps) {\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const [query, setQuery] = useState(\"\");\n const [activeIndex, setActiveIndex] = useState(0);\n const [mounted, setMounted] = useState(false);\n const [backgroundScrollLocked, setBackgroundScrollLocked] = useState(defaultOpen);\n const [anchorRect, setAnchorRect] = useState<AnchorRect>({\n top: 16,\n left: 16,\n width: 288,\n });\n const open = controlledOpen ?? internalOpen;\n const controlled = controlledOpen !== undefined;\n const reduce = useReducedMotion();\n const uid = useId();\n const anchorRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const dialogRef = useRef<HTMLDivElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n const previousFocusRef = useRef<HTMLElement | null>(null);\n const wasOpenRef = useRef(open);\n const transition: Transition = reduce ? { duration: 0 } : SPRING_LAYOUT;\n const morphTransition: Transition = reduce ? { duration: 0 } : SEARCH_MORPH;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!controlled) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [controlled, onOpenChange],\n );\n\n const measureAnchor = useCallback(() => {\n const rect = anchorRef.current?.getBoundingClientRect();\n if (!rect || rect.width === 0) return;\n setAnchorRect({ top: rect.top, left: rect.left, width: rect.width });\n }, []);\n\n const openSearch = useCallback(() => {\n measureAnchor();\n setBackgroundScrollLocked(true);\n previousFocusRef.current =\n document.activeElement instanceof HTMLElement ? document.activeElement : null;\n setOpen(true);\n }, [measureAnchor, setOpen]);\n\n const updateQuery = useCallback(\n (next: string) => {\n setQuery(next);\n setActiveIndex(0);\n onQueryChange?.(next);\n },\n [onQueryChange],\n );\n\n const closeSearch = useCallback(() => {\n updateQuery(\"\");\n setOpen(false);\n }, [setOpen, updateQuery]);\n\n useEffect(() => setMounted(true), []);\n\n useEffect(() => {\n if (open) setBackgroundScrollLocked(true);\n }, [open]);\n\n useEffect(() => {\n measureAnchor();\n const anchor = anchorRef.current;\n const observer =\n anchor && typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(measureAnchor) : null;\n if (anchor) observer?.observe(anchor);\n window.addEventListener(\"resize\", measureAnchor);\n document.addEventListener(\"scroll\", measureAnchor, true);\n window.visualViewport?.addEventListener(\"resize\", measureAnchor);\n window.visualViewport?.addEventListener(\"scroll\", measureAnchor);\n return () => {\n observer?.disconnect();\n window.removeEventListener(\"resize\", measureAnchor);\n document.removeEventListener(\"scroll\", measureAnchor, true);\n window.visualViewport?.removeEventListener(\"resize\", measureAnchor);\n window.visualViewport?.removeEventListener(\"scroll\", measureAnchor);\n };\n }, [measureAnchor]);\n\n useEffect(() => {\n if (!backgroundScrollLocked) return;\n\n const preventBackgroundWheel = (event: WheelEvent) => {\n const target = event.target;\n if (target instanceof Node && listRef.current?.contains(target)) return;\n event.preventDefault();\n };\n const preventBackgroundTouch = (event: TouchEvent) => {\n const target = event.target;\n if (target instanceof Node && listRef.current?.contains(target)) return;\n event.preventDefault();\n };\n\n document.addEventListener(\"wheel\", preventBackgroundWheel, {\n passive: false,\n });\n document.addEventListener(\"touchmove\", preventBackgroundTouch, {\n passive: false,\n });\n return () => {\n document.removeEventListener(\"wheel\", preventBackgroundWheel);\n document.removeEventListener(\"touchmove\", preventBackgroundTouch);\n };\n }, [backgroundScrollLocked]);\n\n useEffect(() => {\n const handleShortcut = (event: KeyboardEvent) => {\n if (event.key === \"Escape\" && open) {\n event.preventDefault();\n closeSearch();\n return;\n }\n\n if (\n !open &&\n shortcut &&\n event.key.toLowerCase() === shortcut.toLowerCase() &&\n !event.repeat &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.altKey &&\n !event.shiftKey &&\n !isEditableTarget(event.target)\n ) {\n event.preventDefault();\n openSearch();\n }\n };\n\n window.addEventListener(\"keydown\", handleShortcut);\n return () => window.removeEventListener(\"keydown\", handleShortcut);\n }, [closeSearch, open, openSearch, shortcut]);\n\n useEffect(() => {\n if (open) {\n updateQuery(\"\");\n const frame = requestAnimationFrame(() => inputRef.current?.focus());\n return () => cancelAnimationFrame(frame);\n }\n\n if (wasOpenRef.current) {\n const frame = requestAnimationFrame(() => {\n const previousFocus = previousFocusRef.current;\n const focusTarget = previousFocus?.isConnected ? previousFocus : triggerRef.current;\n focusTarget?.focus();\n });\n return () => cancelAnimationFrame(frame);\n }\n }, [open, updateQuery]);\n\n useEffect(() => {\n wasOpenRef.current = open;\n }, [open]);\n\n const filteredItems = useMemo(() => {\n const needle = query.trim().toLowerCase();\n if (!needle) return items;\n\n return items.filter((item) =>\n [item.title, item.description ?? \"\", ...(item.keywords ?? [])]\n .join(\" \")\n .toLowerCase()\n .includes(needle),\n );\n }, [items, query]);\n\n useEffect(() => {\n if (activeIndex < filteredItems.length) return;\n setActiveIndex(Math.max(0, filteredItems.length - 1));\n }, [activeIndex, filteredItems.length]);\n\n useEffect(() => {\n if (!open) return;\n listRef.current\n ?.querySelector<HTMLElement>(`[data-index=\"${activeIndex}\"]`)\n ?.scrollIntoView({ block: \"nearest\" });\n }, [activeIndex, open]);\n\n const selectItem = useCallback(\n (item: MorphingSearchItem) => {\n item.onSelect?.();\n onSelect?.(item);\n closeSearch();\n },\n [closeSearch, onSelect],\n );\n\n const handleDialogKeyDown = (event: ReactKeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n if (filteredItems.length === 0) return;\n setActiveIndex((current) => Math.min(current + 1, filteredItems.length - 1));\n return;\n }\n\n if (event.key === \"ArrowUp\") {\n event.preventDefault();\n setActiveIndex((current) => Math.max(current - 1, 0));\n return;\n }\n\n if (event.key === \"Enter\") {\n event.preventDefault();\n const item = filteredItems[activeIndex];\n if (item) selectItem(item);\n return;\n }\n\n if (event.key !== \"Tab\" || !dialogRef.current) return;\n const focusable = Array.from(\n dialogRef.current.querySelectorAll<HTMLElement>(\n 'input, button:not([disabled]), [tabindex]:not([tabindex=\"-1\"])',\n ),\n );\n const first = focusable[0];\n const last = focusable.at(-1);\n if (!first || !last) return;\n\n if (event.shiftKey && document.activeElement === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && document.activeElement === last) {\n event.preventDefault();\n first.focus();\n }\n };\n\n const shellLayoutId = `${uid}-shell`;\n const listboxId = `${uid}-results`;\n const panelWidth = mounted\n ? Math.max(anchorRect.width, Math.min(448, window.innerWidth - anchorRect.left - 16))\n : anchorRect.width;\n const resultsHeight = mounted\n ? Math.max(96, Math.min(288, window.innerHeight - anchorRect.top - 80))\n : 288;\n const collapsedContentClip = `inset(0px ${Math.max(\n 0,\n panelWidth - anchorRect.width,\n )}px ${resultsHeight}px 0px round 12px)`;\n const expandedContentClip = \"inset(0px 0px 0px 0px round 12px)\";\n\n // Neither grouping layer carries a box: they only hold `inert`/`aria-hidden`,\n // the z-index and the presence key, and every child below is `fixed` and\n // resolves against the viewport itself. The click catcher spans the viewport\n // edges but has no children and filters nothing, so it is not a sampling\n const overlay = mounted\n ? createPortal(\n <div\n aria-hidden={!open}\n inert={!open}\n className=\"pointer-events-none fixed top-0 left-0 z-50 size-0\"\n >\n <AnimatePresence\n initial={false}\n mode=\"popLayout\"\n onExitComplete={() => setBackgroundScrollLocked(false)}\n >\n {open ? (\n <motion.div key=\"morphing-search-overlay\" className=\"fixed top-0 left-0 size-0\">\n <button\n type=\"button\"\n aria-label=\"Close search\"\n className=\"pointer-events-auto fixed inset-0 cursor-default bg-transparent\"\n onClick={closeSearch}\n />\n\n <motion.div\n layoutId={shellLayoutId}\n aria-hidden=\"true\"\n className=\"fixed z-10 rounded-xl bg-background/90 backdrop-blur-xl\"\n style={{\n top: anchorRect.top,\n left: anchorRect.left,\n width: panelWidth,\n height: 48 + resultsHeight,\n boxShadow: \"inset 0 0 0 1px var(--color-border)\",\n }}\n transition={morphTransition}\n />\n\n <motion.div\n ref={dialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Search\"\n onKeyDown={handleDialogKeyDown}\n initial={reduce ? false : { opacity: 0, clipPath: collapsedContentClip }}\n animate={{ opacity: 1, clipPath: expandedContentClip }}\n exit={{\n opacity: 0,\n clipPath: collapsedContentClip,\n transition: reduce\n ? { duration: 0 }\n : {\n clipPath: SEARCH_CLIP_TRANSITION,\n opacity: SEARCH_MORPH,\n },\n }}\n transition={\n reduce\n ? { duration: 0 }\n : {\n clipPath: SEARCH_CLIP_TRANSITION,\n opacity: SEARCH_MORPH,\n }\n }\n className=\"pointer-events-auto fixed z-20 overflow-hidden rounded-xl\"\n style={{\n top: anchorRect.top,\n left: anchorRect.left,\n width: panelWidth,\n }}\n >\n <div\n className={cn(\n \"flex h-12 items-center gap-2.5 border-border border-b\",\n iconOnly ? \"px-4\" : \"px-3.5\",\n )}\n >\n <span className=\"shrink-0\">\n <Search className=\"size-4 text-muted-foreground\" />\n </span>\n <div className=\"flex h-10 min-w-0 flex-1 items-center\">\n <input\n ref={inputRef}\n value={query}\n onChange={(event) => updateQuery(event.target.value)}\n role=\"combobox\"\n aria-label={placeholder}\n aria-expanded=\"true\"\n aria-controls={listboxId}\n aria-autocomplete=\"list\"\n aria-activedescendant={\n filteredItems.length > 0 ? `${uid}-option-${activeIndex}` : undefined\n }\n placeholder={placeholder}\n className=\"size-full bg-transparent text-foreground text-sm outline-none placeholder:text-muted-foreground\"\n />\n </div>\n <kbd className=\"flex h-7 shrink-0 items-center rounded-md border border-border px-2 text-muted-foreground text-xs\">\n Esc\n </kbd>\n </div>\n\n <motion.div\n ref={listRef}\n id={listboxId}\n role=\"listbox\"\n aria-label=\"Search results\"\n transition={reduce ? { duration: 0 } : undefined}\n variants={\n reduce\n ? undefined\n : {\n closed: {\n opacity: 0,\n transform: \"translateY(6px)\",\n transition: {\n duration: 0.16,\n delay: 0.18,\n ease: EASE_OUT,\n },\n },\n open: {\n opacity: 1,\n transform: \"translateY(0px)\",\n transition: {\n duration: 0.16,\n ease: EASE_OUT,\n },\n },\n }\n }\n initial={reduce ? { opacity: 1, transform: \"translateY(0px)\" } : \"closed\"}\n animate={reduce ? { opacity: 1, transform: \"translateY(0px)\" } : \"open\"}\n exit={reduce ? undefined : \"closed\"}\n className=\"overflow-y-auto overscroll-contain p-2\"\n style={{\n maxHeight: resultsHeight,\n }}\n >\n {filteredItems.length > 0 ? (\n filteredItems.map((item, index) => {\n const Icon = item.icon;\n const active = index === activeIndex;\n return (\n <button\n key={item.id}\n id={`${uid}-option-${index}`}\n type=\"button\"\n role=\"option\"\n aria-selected={active}\n data-index={index}\n onMouseMove={() => setActiveIndex(index)}\n onFocus={() => setActiveIndex(index)}\n onClick={() => selectItem(item)}\n className=\"relative flex w-full items-center gap-2.5 rounded-lg px-3 py-2.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\"\n >\n {active ? (\n <motion.span\n layoutId={`${uid}-active-result`}\n className=\"absolute inset-0 rounded-lg bg-foreground/5\"\n transition={transition}\n />\n ) : null}\n {Icon ? (\n <Icon className=\"relative size-4 shrink-0 text-muted-foreground\" />\n ) : null}\n <span className=\"relative min-w-0\">\n <span className=\"block truncate font-medium text-foreground text-sm\">\n {item.title}\n </span>\n {item.description ? (\n <span className=\"block truncate text-muted-foreground text-xs\">\n {item.description}\n </span>\n ) : null}\n </span>\n </button>\n );\n })\n ) : (\n <p className=\"px-3 py-8 text-center text-muted-foreground text-sm\">\n {emptyMessage}\n </p>\n )}\n </motion.div>\n </motion.div>\n </motion.div>\n ) : null}\n </AnimatePresence>\n </div>,\n document.body,\n )\n : null;\n\n return (\n <LayoutGroup id={uid}>\n <div\n ref={anchorRef}\n className={cn(\"relative\", iconOnly ? \"size-12\" : \"h-12 w-72 max-w-full\", className)}\n >\n {!open ? (\n <motion.button\n ref={triggerRef}\n key=\"morphing-search-trigger\"\n layoutId={shellLayoutId}\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded=\"false\"\n aria-label={placeholder}\n onClick={openSearch}\n transition={morphTransition}\n style={{\n boxShadow: \"inset 0 0 0 1px var(--search-trigger-stroke)\",\n }}\n className={cn(\n \"flex size-full items-center rounded-xl bg-background/60 text-left outline-none backdrop-blur-md [--search-trigger-stroke:var(--color-border)] focus-visible:ring-2 focus-visible:ring-ring hover:[--search-trigger-stroke:var(--color-border-strong)]\",\n iconOnly ? \"cursor-pointer justify-center\" : \"cursor-text px-3.5\",\n )}\n />\n ) : null}\n <motion.div\n aria-hidden=\"true\"\n initial={false}\n animate={{ opacity: open ? 0 : 1 }}\n transition={\n reduce\n ? { duration: 0 }\n : {\n duration: 0.1,\n delay: open ? 0.1 : 0.12,\n ease: EASE_OUT,\n }\n }\n className={cn(\n \"pointer-events-none absolute inset-0 flex items-center\",\n backgroundScrollLocked && \"z-60\",\n iconOnly ? \"justify-center\" : \"gap-2.5 px-3.5\",\n )}\n >\n <Search className=\"size-4 shrink-0 text-muted-foreground\" />\n {iconOnly ? null : (\n <>\n <span className=\"min-w-0 flex-1 truncate text-muted-foreground text-sm\">\n {placeholder}\n </span>\n {shortcut ? (\n <kbd className=\"flex h-7 min-w-7 shrink-0 items-center justify-center rounded-md border border-border px-2 text-muted-foreground text-xs\">\n {shortcut.toUpperCase()}\n </kbd>\n ) : null}\n </>\n )}\n </motion.div>\n </div>\n {overlay}\n </LayoutGroup>\n );\n}\n"],"mappings":";;;;;;;;;AAyBA,MAAM,e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G,YAAY,WAAW,YAAY,wBAAwB,SAAS;GAFpF,UAAA,CAIG,CAAC,OACA,oBAAC,OAAO,QAAR;IACE,KAAK;IAEL,UAAU;IACV,MAAK;IACL,iBAAc;IACd,iBAAc;IACd,cAAY;IACZ,SAAS;IACT,YAAY;IACZ,OAAO,EACL,WAAW,+CACb;IACA,WAAW,GACT,yPACA,WAAW,kCAAkC,oBAC/C;GACD,GAfK,yBAeL,IACC,MACJ,qBAAC,OAAO,KAAR;IACE,eAAY;IACZ,SAAS;IACT,SAAS,EAAE,SAAS,OAAO,IAAI,EAAE;IACjC,YACE,SACI,EAAE,UAAU,EAAE,IACd;KACE,UAAU;KACV,OAAO,OAAO,KAAM;KACpB,MAAM;IACR;IAEN,WAAW,GACT,0DACA,0BAA0B,QAC1B,WAAW,mBAAmB,gBAChC;IAjBF,UAAA,CAmBE,oBAAC,QAAD,EAAQ,WAAU,wCAAyC,CAAA,GAC1D,WAAW,OACV,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,QAAD;KAAM,WAAU;KACb,UAAA;IACG,CAAA,GACL,WACC,oBAAC,OAAD;KAAK,WAAU;KACZ,UAAA,SAAS,YAAY;IACnB,CAAA,IACH,IACJ,EAAA,CAAA,CAEM;GACT,CAAA,CAAA;EACJ,CAAA,GAAA,OACU;;AAEjB"}
|
|
@@ -3,7 +3,7 @@ import { useHoverCapable } from "../../hooks/use-hover-capable.js";
|
|
|
3
3
|
import { SPRING_LAYOUT, SPRING_PRESS } from "../../lib/ease.js";
|
|
4
4
|
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
5
5
|
import { cn } from "@kumix/utils";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { AnimatePresence, LayoutGroup, motion, useReducedMotion } from "motion/react";
|
|
8
8
|
import { X } from "lucide-react";
|
|
9
9
|
import { createPortal } from "react-dom";
|
|
@@ -126,28 +126,28 @@ function ProjectFolder({ title, description = "Updated recently", previews = [],
|
|
|
126
126
|
setOpen(true);
|
|
127
127
|
onClick?.();
|
|
128
128
|
};
|
|
129
|
-
const overlay = isExpanded || isClosing ? /* @__PURE__ */ jsxs(
|
|
129
|
+
const overlay = isExpanded || isClosing ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(AnimatePresence, {
|
|
130
|
+
initial: false,
|
|
131
|
+
children: isExpanded ? /* @__PURE__ */ jsx(motion.button, {
|
|
132
|
+
type: "button",
|
|
133
|
+
tabIndex: -1,
|
|
134
|
+
"aria-label": "Close file overlay",
|
|
135
|
+
onClick: closeOverlay,
|
|
136
|
+
initial: { opacity: 0 },
|
|
137
|
+
animate: { opacity: 1 },
|
|
138
|
+
exit: { opacity: 0 },
|
|
139
|
+
transition: reduce ? { duration: 0 } : { duration: .18 },
|
|
140
|
+
className: cn("fixed inset-0 z-50 cursor-default bg-background/80 backdrop-blur-xl", isClosing && "pointer-events-none")
|
|
141
|
+
}, "project-files-backdrop") : null
|
|
142
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
130
143
|
ref: dialogRef,
|
|
131
144
|
role: "dialog",
|
|
132
145
|
"aria-modal": "true",
|
|
133
146
|
"aria-labelledby": dialogTitleId,
|
|
134
147
|
"aria-hidden": isExpanded ? void 0 : "true",
|
|
135
|
-
className:
|
|
136
|
-
children:
|
|
137
|
-
|
|
138
|
-
children: isExpanded ? /* @__PURE__ */ jsx(motion.button, {
|
|
139
|
-
type: "button",
|
|
140
|
-
tabIndex: -1,
|
|
141
|
-
"aria-label": "Close file overlay",
|
|
142
|
-
onClick: closeOverlay,
|
|
143
|
-
initial: { opacity: 0 },
|
|
144
|
-
animate: { opacity: 1 },
|
|
145
|
-
exit: { opacity: 0 },
|
|
146
|
-
transition: reduce ? { duration: 0 } : { duration: .18 },
|
|
147
|
-
className: "absolute inset-0 cursor-default bg-background/80 backdrop-blur-xl"
|
|
148
|
-
}, "project-files-backdrop") : null
|
|
149
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
150
|
-
className: "relative z-10 w-full max-w-5xl px-6 py-8",
|
|
148
|
+
className: "pointer-events-none fixed inset-x-6 inset-y-8 z-50 flex items-start justify-center overflow-y-auto sm:items-center",
|
|
149
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
150
|
+
className: cn("pointer-events-auto relative z-10 w-full max-w-[61rem]", isClosing && "pointer-events-none"),
|
|
151
151
|
children: [/* @__PURE__ */ jsx(AnimatePresence, {
|
|
152
152
|
initial: false,
|
|
153
153
|
children: isExpanded ? /* @__PURE__ */ jsxs(motion.div, {
|
|
@@ -193,8 +193,8 @@ function ProjectFolder({ title, description = "Updated recently", previews = [],
|
|
|
193
193
|
children: preview.content
|
|
194
194
|
}, preview.id)) : null
|
|
195
195
|
})]
|
|
196
|
-
})
|
|
197
|
-
}) : null;
|
|
196
|
+
})
|
|
197
|
+
})] }) : null;
|
|
198
198
|
return /* @__PURE__ */ jsxs(LayoutGroup, {
|
|
199
199
|
id: layoutGroupId,
|
|
200
200
|
children: [/* @__PURE__ */ jsxs(motion.button, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-folder.js","names":[],"sources":["../../../src/components/motion/project-folder.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useEffect, useId, useRef, useState } from \"react\";\nimport { X } from \"lucide-react\";\nimport {\n AnimatePresence,\n LayoutGroup,\n motion,\n type Transition,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../hooks/use-hover-capable\";\nimport { SPRING_LAYOUT, SPRING_PRESS } from \"../../lib/ease\";\n\nexport type ProjectFolderPreview = {\n id: string;\n content: ReactNode;\n};\n\nexport interface ProjectFolderProps {\n title: string;\n description?: string;\n previews?: ProjectFolderPreview[];\n count?: number;\n itemLabel?: string;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n onClick?: () => void;\n disabled?: boolean;\n ariaLabel?: string;\n className?: string;\n}\n\nconst MAX_PREVIEWS = 5;\nconst FOCUSABLE_SELECTOR = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(\",\");\n\nfunction getPreviewTransform(index: number, count: number) {\n const offset = index - (count - 1) / 2;\n const distance = Math.abs(offset);\n const centerLift = Math.max(0, 2 - distance) * 8;\n\n return {\n x: offset * 44,\n y: 8 - centerLift,\n rotate: offset * 6,\n scale: distance === 0 ? 1.04 : distance === 1 ? 0.95 : 0.88,\n opacity: distance === 0 ? 1 : distance === 1 ? 0.78 : 0.58,\n zIndex: 10 - distance,\n };\n}\n\nexport function ProjectFolder({\n title,\n description = \"Updated recently\",\n previews = [],\n count = previews.length,\n itemLabel = \"file\",\n open,\n defaultOpen = false,\n onOpenChange,\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n onClick,\n disabled = false,\n ariaLabel,\n className,\n}: ProjectFolderProps) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const layoutGroupId = useId();\n const dialogTitleId = `${layoutGroupId}-title`;\n const hoveredRef = useRef(false);\n const focusedRef = useRef(false);\n const restoringFocusRef = useRef(false);\n const folderButtonRef = useRef<HTMLButtonElement>(null);\n const closeButtonRef = useRef<HTMLButtonElement>(null);\n const dialogRef = useRef<HTMLDivElement>(null);\n const [mounted, setMounted] = useState(false);\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n const [isClosing, setIsClosing] = useState(false);\n const openControlled = open !== undefined;\n const expandedControlled = expanded !== undefined;\n const isExpanded = expanded ?? internalExpanded;\n const isOpen = (open ?? internalOpen) || isExpanded;\n const previewItems = previews.slice(0, MAX_PREVIEWS);\n const transition: Transition = reduce ? { duration: 0 } : SPRING_LAYOUT;\n const countText = `${count} ${itemLabel}${count === 1 ? \"\" : \"s\"}`;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (disabled) return;\n if (!openControlled) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [disabled, onOpenChange, openControlled],\n );\n\n const setExpanded = useCallback(\n (next: boolean) => {\n if (disabled || previewItems.length === 0) return;\n if (!expandedControlled) setInternalExpanded(next);\n onExpandedChange?.(next);\n },\n [disabled, expandedControlled, onExpandedChange, previewItems.length],\n );\n\n const finishClose = useCallback(() => {\n setIsClosing(false);\n restoringFocusRef.current = true;\n requestAnimationFrame(() => folderButtonRef.current?.focus());\n }, []);\n\n const closeOverlay = useCallback(() => {\n setIsClosing(true);\n setOpen(false);\n setExpanded(false);\n }, [setExpanded, setOpen]);\n\n useEffect(() => setMounted(true), []);\n\n useEffect(() => {\n if (reduce && isClosing) finishClose();\n }, [finishClose, isClosing, reduce]);\n\n useEffect(() => {\n if (!isExpanded) return;\n\n const previousOverflow = document.body.style.overflow;\n const focusFrame = requestAnimationFrame(() => closeButtonRef.current?.focus());\n\n document.body.style.overflow = \"hidden\";\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n closeOverlay();\n return;\n }\n if (event.key !== \"Tab\" || !dialogRef.current) return;\n\n const focusable = Array.from(\n dialogRef.current.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR),\n ).filter((element) => element.tabIndex >= 0);\n const first = focusable[0];\n const last = focusable.at(-1);\n if (!first || !last) return;\n\n if (event.shiftKey && document.activeElement === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && document.activeElement === last) {\n event.preventDefault();\n first.focus();\n }\n };\n\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n cancelAnimationFrame(focusFrame);\n document.body.style.overflow = previousOverflow;\n document.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [closeOverlay, isExpanded]);\n\n const handleFolderClick = () => {\n setIsClosing(false);\n setExpanded(true);\n setOpen(true);\n onClick?.();\n };\n\n const overlay =\n isExpanded || isClosing ? (\n <div\n ref={dialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={dialogTitleId}\n aria-hidden={isExpanded ? undefined : \"true\"}\n className={cn(\n \"fixed inset-0 z-50 flex items-start justify-center overflow-y-auto sm:items-center\",\n isClosing && \"pointer-events-none\",\n )}\n >\n <AnimatePresence initial={false}>\n {isExpanded ? (\n <motion.button\n key=\"project-files-backdrop\"\n type=\"button\"\n tabIndex={-1}\n aria-label=\"Close file overlay\"\n onClick={closeOverlay}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={reduce ? { duration: 0 } : { duration: 0.18 }}\n className=\"absolute inset-0 cursor-default bg-background/80 backdrop-blur-xl\"\n />\n ) : null}\n </AnimatePresence>\n\n <div className=\"relative z-10 w-full max-w-5xl px-6 py-8\">\n <AnimatePresence initial={false}>\n {isExpanded ? (\n <motion.div\n key=\"project-files-header\"\n initial={{ opacity: 0, y: reduce ? 0 : 8 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: reduce ? 0 : -8 }}\n transition={reduce ? { duration: 0 } : { duration: 0.18 }}\n className=\"mb-6 flex items-center justify-between gap-4\"\n >\n <div>\n <h2 id={dialogTitleId} className=\"font-medium text-foreground text-xl\">\n {title}\n </h2>\n <p className=\"mt-1 text-muted-foreground text-sm\">{countText}</p>\n </div>\n <button\n ref={closeButtonRef}\n type=\"button\"\n onClick={closeOverlay}\n aria-label={`Close ${title}`}\n className=\"flex size-10 items-center justify-center rounded-full border border-foreground/10 bg-background/50 text-muted-foreground backdrop-blur-xl transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <X className=\"size-4\" aria-hidden=\"true\" />\n </button>\n </motion.div>\n ) : null}\n </AnimatePresence>\n\n <div className=\"grid grid-cols-2 place-items-center gap-3 sm:grid-cols-3 lg:grid-cols-5\">\n {isExpanded\n ? previewItems.map((preview) => (\n <motion.div\n key={preview.id}\n layoutId={`file-${preview.id}`}\n transition={transition}\n className=\"aspect-3/4 w-full max-w-40 overflow-hidden rounded-xl border border-foreground/10 bg-background/50 backdrop-blur-xl\"\n >\n {preview.content}\n </motion.div>\n ))\n : null}\n </div>\n </div>\n </div>\n ) : null;\n\n return (\n <LayoutGroup id={layoutGroupId}>\n <motion.button\n ref={folderButtonRef}\n type=\"button\"\n disabled={disabled}\n aria-label={ariaLabel}\n aria-haspopup=\"dialog\"\n aria-expanded={isExpanded}\n data-open={isOpen ? \"true\" : \"false\"}\n data-expanded={isExpanded ? \"true\" : \"false\"}\n tabIndex={isExpanded ? -1 : undefined}\n onPointerEnter={() => {\n if (!canHover) return;\n hoveredRef.current = true;\n setOpen(true);\n }}\n onPointerLeave={() => {\n if (!canHover) return;\n hoveredRef.current = false;\n if (!isExpanded && !isClosing) setOpen(focusedRef.current);\n }}\n onFocus={() => {\n if (restoringFocusRef.current) {\n restoringFocusRef.current = false;\n focusedRef.current = false;\n return;\n }\n focusedRef.current = true;\n setOpen(true);\n }}\n onBlur={() => {\n focusedRef.current = false;\n if (!isExpanded && !isClosing) setOpen(hoveredRef.current);\n }}\n onClick={handleFolderClick}\n whileTap={reduce || disabled ? undefined : { scale: 0.98 }}\n transition={reduce ? { duration: 0 } : SPRING_PRESS}\n className={cn(\n \"perspective-[1200px] relative block h-56 w-72 select-none rounded-2xl text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-4 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n >\n <motion.span\n aria-hidden=\"true\"\n animate={{ rotateX: isOpen && !reduce ? 15 : 0 }}\n transition={transition}\n className=\"absolute inset-0 origin-[center_bottom] rounded-2xl border border-foreground/10 bg-background/25 backdrop-blur-xl\"\n />\n\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute inset-0\">\n <span className=\"absolute top-0 left-1/2 block h-0 w-0\">\n <AnimatePresence initial={false}>\n {!isExpanded\n ? previewItems.map((preview, index) => {\n const opened = getPreviewTransform(index, previewItems.length);\n return (\n <motion.span\n key={preview.id}\n layoutId={`file-${preview.id}`}\n initial={false}\n animate={\n isOpen && !reduce\n ? {\n x: opened.x * 1.4,\n y: opened.y - 8,\n rotate: opened.rotate * 1.3,\n scale: opened.scale * 1.02,\n opacity: Math.min(1, opened.opacity + 0.18),\n }\n : {\n x: opened.x,\n y: opened.y,\n rotate: opened.rotate,\n scale: opened.scale,\n opacity: opened.opacity,\n }\n }\n transition={transition}\n onLayoutAnimationComplete={() => {\n if (isClosing && index === 0) finishClose();\n }}\n className=\"absolute top-0 left-0 -ml-12 block h-40 w-24 overflow-hidden rounded-lg border border-foreground/10 bg-background/45 backdrop-blur-lg\"\n style={{ zIndex: opened.zIndex }}\n >\n {preview.content}\n </motion.span>\n );\n })\n : null}\n </AnimatePresence>\n </span>\n </span>\n\n <motion.span\n initial={false}\n animate={{ rotateX: isOpen && !reduce ? -25 : 0 }}\n transition={transition}\n className=\"backface-hidden absolute inset-x-0 bottom-0 z-20 origin-[center_bottom] overflow-hidden rounded-2xl border border-foreground/10 bg-background/60 backdrop-blur-2xl\"\n >\n <span className=\"flex h-16 items-center px-4\">\n <span className=\"line-clamp-2 font-medium text-foreground text-xl leading-tight\">\n {title}\n </span>\n </span>\n <span className=\"flex h-12 items-center justify-between gap-3 border-foreground/10 border-t px-4\">\n <span className=\"shrink-0 font-medium text-foreground/70 text-sm\">{countText}</span>\n <span className=\"truncate text-muted-foreground text-sm\">{description}</span>\n </span>\n </motion.span>\n </motion.button>\n\n {mounted ? createPortal(overlay, document.body) : null}\n </LayoutGroup>\n );\n}\n"],"mappings":";;;;;;;;;;AAwCA,MAAM,eAAe;AACrB,MAAM,qBAAqB;CACzB;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,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;KACZ,WAAU;KAJZ,UAAA,CAME,oBAAC,QAAD;MAAM,WAAU;MACd,UAAA,oBAAC,QAAD;OAAM,WAAU;OACb,UAAA;MACG,CAAA;KACF,CAAA,GACN,qBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACE,oBAAC,QAAD;OAAM,WAAU;OAAmD,UAAA;MAAgB,CAAA,GACnF,oBAAC,QAAD;OAAM,WAAU;OAA0C,UAAA;MAAkB,CAAA,CACxE;KACK,CAAA,CAAA;;GACA;EAEd,CAAA,GAAA,UAAU,aAAa,SAAS,SAAS,IAAI,IAAI,IACvC;;AAEjB"}
|
|
1
|
+
{"version":3,"file":"project-folder.js","names":[],"sources":["../../../src/components/motion/project-folder.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useEffect, useId, useRef, useState } from \"react\";\nimport { X } from \"lucide-react\";\nimport {\n AnimatePresence,\n LayoutGroup,\n motion,\n type Transition,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../hooks/use-hover-capable\";\nimport { SPRING_LAYOUT, SPRING_PRESS } from \"../../lib/ease\";\n\nexport type ProjectFolderPreview = {\n id: string;\n content: ReactNode;\n};\n\nexport interface ProjectFolderProps {\n title: string;\n description?: string;\n previews?: ProjectFolderPreview[];\n count?: number;\n itemLabel?: string;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n onClick?: () => void;\n disabled?: boolean;\n ariaLabel?: string;\n className?: string;\n}\n\nconst MAX_PREVIEWS = 5;\nconst FOCUSABLE_SELECTOR = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(\",\");\n\nfunction getPreviewTransform(index: number, count: number) {\n const offset = index - (count - 1) / 2;\n const distance = Math.abs(offset);\n const centerLift = Math.max(0, 2 - distance) * 8;\n\n return {\n x: offset * 44,\n y: 8 - centerLift,\n rotate: offset * 6,\n scale: distance === 0 ? 1.04 : distance === 1 ? 0.95 : 0.88,\n opacity: distance === 0 ? 1 : distance === 1 ? 0.78 : 0.58,\n zIndex: 10 - distance,\n };\n}\n\nexport function ProjectFolder({\n title,\n description = \"Updated recently\",\n previews = [],\n count = previews.length,\n itemLabel = \"file\",\n open,\n defaultOpen = false,\n onOpenChange,\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n onClick,\n disabled = false,\n ariaLabel,\n className,\n}: ProjectFolderProps) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const layoutGroupId = useId();\n const dialogTitleId = `${layoutGroupId}-title`;\n const hoveredRef = useRef(false);\n const focusedRef = useRef(false);\n const restoringFocusRef = useRef(false);\n const folderButtonRef = useRef<HTMLButtonElement>(null);\n const closeButtonRef = useRef<HTMLButtonElement>(null);\n const dialogRef = useRef<HTMLDivElement>(null);\n const [mounted, setMounted] = useState(false);\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n const [isClosing, setIsClosing] = useState(false);\n const openControlled = open !== undefined;\n const expandedControlled = expanded !== undefined;\n const isExpanded = expanded ?? internalExpanded;\n const isOpen = (open ?? internalOpen) || isExpanded;\n const previewItems = previews.slice(0, MAX_PREVIEWS);\n const transition: Transition = reduce ? { duration: 0 } : SPRING_LAYOUT;\n const countText = `${count} ${itemLabel}${count === 1 ? \"\" : \"s\"}`;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (disabled) return;\n if (!openControlled) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [disabled, onOpenChange, openControlled],\n );\n\n const setExpanded = useCallback(\n (next: boolean) => {\n if (disabled || previewItems.length === 0) return;\n if (!expandedControlled) setInternalExpanded(next);\n onExpandedChange?.(next);\n },\n [disabled, expandedControlled, onExpandedChange, previewItems.length],\n );\n\n const finishClose = useCallback(() => {\n setIsClosing(false);\n restoringFocusRef.current = true;\n requestAnimationFrame(() => folderButtonRef.current?.focus());\n }, []);\n\n const closeOverlay = useCallback(() => {\n setIsClosing(true);\n setOpen(false);\n setExpanded(false);\n }, [setExpanded, setOpen]);\n\n useEffect(() => setMounted(true), []);\n\n useEffect(() => {\n if (reduce && isClosing) finishClose();\n }, [finishClose, isClosing, reduce]);\n\n useEffect(() => {\n if (!isExpanded) return;\n\n const previousOverflow = document.body.style.overflow;\n const focusFrame = requestAnimationFrame(() => closeButtonRef.current?.focus());\n\n document.body.style.overflow = \"hidden\";\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n closeOverlay();\n return;\n }\n if (event.key !== \"Tab\" || !dialogRef.current) return;\n\n const focusable = Array.from(\n dialogRef.current.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR),\n ).filter((element) => element.tabIndex >= 0);\n const first = focusable[0];\n const last = focusable.at(-1);\n if (!first || !last) return;\n\n if (event.shiftKey && document.activeElement === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && document.activeElement === last) {\n event.preventDefault();\n first.focus();\n }\n };\n\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n cancelAnimationFrame(focusFrame);\n document.body.style.overflow = previousOverflow;\n document.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [closeOverlay, isExpanded]);\n\n const handleFolderClick = () => {\n setIsClosing(false);\n setExpanded(true);\n setOpen(true);\n onClick?.();\n };\n\n // The chrome is two siblings: a backdrop spanning the viewport edges that\n // paints the scrim, and a transparent dialog inset off every edge that lays\n // out and scrolls the panel. The backdrop cannot nest inside that scroll box —\n // WebKit resolves a `position: fixed` descendant of an accelerated overflow\n // scroller against the scroller, not the viewport, so the insets would go\n // unscrimmed on a phone. The scroll box takes no pointer events and the panel\n // takes them back, so gutter presses still close the overlay. Accepted: the\n // 2rem inset sits outside the scroll box, so it stays put rather than\n // scrolling away with the content.\n const overlay =\n isExpanded || isClosing ? (\n <>\n <AnimatePresence initial={false}>\n {isExpanded ? (\n <motion.button\n key=\"project-files-backdrop\"\n type=\"button\"\n tabIndex={-1}\n aria-label=\"Close file overlay\"\n onClick={closeOverlay}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={reduce ? { duration: 0 } : { duration: 0.18 }}\n className={cn(\n \"fixed inset-0 z-50 cursor-default bg-background/80 backdrop-blur-xl\",\n isClosing && \"pointer-events-none\",\n )}\n />\n ) : null}\n </AnimatePresence>\n\n <div\n ref={dialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={dialogTitleId}\n aria-hidden={isExpanded ? undefined : \"true\"}\n className=\"pointer-events-none fixed inset-x-6 inset-y-8 z-50 flex items-start justify-center overflow-y-auto sm:items-center\"\n >\n {/* 61rem, not `max-w-5xl`: the cap is on a padding-free box, so it has to\n be the 64rem border box less the 3rem the gutters take. */}\n <div\n className={cn(\n \"pointer-events-auto relative z-10 w-full max-w-[61rem]\",\n isClosing && \"pointer-events-none\",\n )}\n >\n <AnimatePresence initial={false}>\n {isExpanded ? (\n <motion.div\n key=\"project-files-header\"\n initial={{ opacity: 0, y: reduce ? 0 : 8 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: reduce ? 0 : -8 }}\n transition={reduce ? { duration: 0 } : { duration: 0.18 }}\n className=\"mb-6 flex items-center justify-between gap-4\"\n >\n <div>\n <h2 id={dialogTitleId} className=\"font-medium text-foreground text-xl\">\n {title}\n </h2>\n <p className=\"mt-1 text-muted-foreground text-sm\">{countText}</p>\n </div>\n <button\n ref={closeButtonRef}\n type=\"button\"\n onClick={closeOverlay}\n aria-label={`Close ${title}`}\n className=\"flex size-10 items-center justify-center rounded-full border border-foreground/10 bg-background/50 text-muted-foreground backdrop-blur-xl transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <X className=\"size-4\" aria-hidden=\"true\" />\n </button>\n </motion.div>\n ) : null}\n </AnimatePresence>\n\n <div className=\"grid grid-cols-2 place-items-center gap-3 sm:grid-cols-3 lg:grid-cols-5\">\n {isExpanded\n ? previewItems.map((preview) => (\n <motion.div\n key={preview.id}\n layoutId={`file-${preview.id}`}\n transition={transition}\n className=\"aspect-3/4 w-full max-w-40 overflow-hidden rounded-xl border border-foreground/10 bg-background/50 backdrop-blur-xl\"\n >\n {preview.content}\n </motion.div>\n ))\n : null}\n </div>\n </div>\n </div>\n </>\n ) : null;\n\n return (\n <LayoutGroup id={layoutGroupId}>\n <motion.button\n ref={folderButtonRef}\n type=\"button\"\n disabled={disabled}\n aria-label={ariaLabel}\n aria-haspopup=\"dialog\"\n aria-expanded={isExpanded}\n data-open={isOpen ? \"true\" : \"false\"}\n data-expanded={isExpanded ? \"true\" : \"false\"}\n tabIndex={isExpanded ? -1 : undefined}\n onPointerEnter={() => {\n if (!canHover) return;\n hoveredRef.current = true;\n setOpen(true);\n }}\n onPointerLeave={() => {\n if (!canHover) return;\n hoveredRef.current = false;\n if (!isExpanded && !isClosing) setOpen(focusedRef.current);\n }}\n onFocus={() => {\n if (restoringFocusRef.current) {\n restoringFocusRef.current = false;\n focusedRef.current = false;\n return;\n }\n focusedRef.current = true;\n setOpen(true);\n }}\n onBlur={() => {\n focusedRef.current = false;\n if (!isExpanded && !isClosing) setOpen(hoveredRef.current);\n }}\n onClick={handleFolderClick}\n whileTap={reduce || disabled ? undefined : { scale: 0.98 }}\n transition={reduce ? { duration: 0 } : SPRING_PRESS}\n className={cn(\n \"perspective-[1200px] relative block h-56 w-72 select-none rounded-2xl text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-4 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n >\n <motion.span\n aria-hidden=\"true\"\n animate={{ rotateX: isOpen && !reduce ? 15 : 0 }}\n transition={transition}\n className=\"absolute inset-0 origin-[center_bottom] rounded-2xl border border-foreground/10 bg-background/25 backdrop-blur-xl\"\n />\n\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute inset-0\">\n <span className=\"absolute top-0 left-1/2 block h-0 w-0\">\n <AnimatePresence initial={false}>\n {!isExpanded\n ? previewItems.map((preview, index) => {\n const opened = getPreviewTransform(index, previewItems.length);\n return (\n <motion.span\n key={preview.id}\n layoutId={`file-${preview.id}`}\n initial={false}\n animate={\n isOpen && !reduce\n ? {\n x: opened.x * 1.4,\n y: opened.y - 8,\n rotate: opened.rotate * 1.3,\n scale: opened.scale * 1.02,\n opacity: Math.min(1, opened.opacity + 0.18),\n }\n : {\n x: opened.x,\n y: opened.y,\n rotate: opened.rotate,\n scale: opened.scale,\n opacity: opened.opacity,\n }\n }\n transition={transition}\n onLayoutAnimationComplete={() => {\n if (isClosing && index === 0) finishClose();\n }}\n className=\"absolute top-0 left-0 -ml-12 block h-40 w-24 overflow-hidden rounded-lg border border-foreground/10 bg-background/45 backdrop-blur-lg\"\n style={{ zIndex: opened.zIndex }}\n >\n {preview.content}\n </motion.span>\n );\n })\n : null}\n </AnimatePresence>\n </span>\n </span>\n\n <motion.span\n initial={false}\n animate={{ rotateX: isOpen && !reduce ? -25 : 0 }}\n transition={transition}\n className=\"backface-hidden absolute inset-x-0 bottom-0 z-20 origin-[center_bottom] overflow-hidden rounded-2xl border border-foreground/10 bg-background/60 backdrop-blur-2xl\"\n >\n <span className=\"flex h-16 items-center px-4\">\n <span className=\"line-clamp-2 font-medium text-foreground text-xl leading-tight\">\n {title}\n </span>\n </span>\n <span className=\"flex h-12 items-center justify-between gap-3 border-foreground/10 border-t px-4\">\n <span className=\"shrink-0 font-medium text-foreground/70 text-sm\">{countText}</span>\n <span className=\"truncate text-muted-foreground text-sm\">{description}</span>\n </span>\n </motion.span>\n </motion.button>\n\n {mounted ? createPortal(overlay, document.body) : null}\n </LayoutGroup>\n );\n}\n"],"mappings":";;;;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