@kumix/ui 0.3.0 → 0.3.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 +14 -1
- package/dist/components/custom/confirm-dialog.d.ts +16 -0
- package/dist/components/custom/confirm-dialog.d.ts.map +1 -0
- package/dist/components/custom/confirm-dialog.js +93 -0
- package/dist/components/custom/confirm-dialog.js.map +1 -0
- package/dist/components/custom/toast.d.ts +20 -0
- package/dist/components/custom/toast.d.ts.map +1 -0
- package/dist/components/custom/toast.js +73 -0
- package/dist/components/custom/toast.js.map +1 -0
- package/dist/components/motion/action-swap.js +1 -1
- package/dist/components/motion/animated-badge.js +2 -2
- package/dist/components/motion/animated-number.js +1 -1
- package/dist/components/motion/animated-sidebar.js +2 -2
- package/dist/components/motion/animated-toast-stack.js +4 -4
- package/dist/components/motion/animated-toast-stack.js.map +1 -1
- package/dist/components/motion/attachment-upload.d.ts +47 -0
- package/dist/components/motion/attachment-upload.d.ts.map +1 -0
- package/dist/components/motion/attachment-upload.js +737 -0
- package/dist/components/motion/attachment-upload.js.map +1 -0
- package/dist/components/motion/availability-scheduler/copy-menu.d.ts +10 -0
- package/dist/components/motion/availability-scheduler/copy-menu.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/copy-menu.js +3 -0
- package/dist/components/motion/availability-scheduler/day-row.d.ts +15 -0
- package/dist/components/motion/availability-scheduler/day-row.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/day-row.js +181 -0
- package/dist/components/motion/availability-scheduler/day-row.js.map +1 -0
- package/dist/components/motion/availability-scheduler/icon-button.d.ts +15 -0
- package/dist/components/motion/availability-scheduler/icon-button.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/icon-button.js +24 -0
- package/dist/components/motion/availability-scheduler/icon-button.js.map +1 -0
- package/dist/components/motion/availability-scheduler/index.d.ts +14 -0
- package/dist/components/motion/availability-scheduler/index.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/index.js +59 -0
- package/dist/components/motion/availability-scheduler/index.js.map +1 -0
- package/dist/components/motion/availability-scheduler/time-select.d.ts +10 -0
- package/dist/components/motion/availability-scheduler/time-select.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/time-select.js +26 -0
- package/dist/components/motion/availability-scheduler/time-select.js.map +1 -0
- package/dist/components/motion/bloom-menu.d.ts +17 -0
- package/dist/components/motion/bloom-menu.d.ts.map +1 -0
- package/dist/components/motion/bloom-menu.js +170 -0
- package/dist/components/motion/bloom-menu.js.map +1 -0
- package/dist/components/motion/bottom-sheet.js +1 -1
- package/dist/components/motion/bounce-sidebar.js +1 -1
- package/dist/components/motion/bouncy-accordion.js +2 -2
- package/dist/components/motion/button/base.js +1 -1
- package/dist/components/motion/button/index.d.ts +4 -0
- package/dist/components/motion/button/index.js +5 -0
- package/dist/components/motion/button/magnetic.js +1 -1
- package/dist/components/motion/button/stateful.js +2 -2
- package/dist/components/motion/center-morph-modal.js +2 -2
- package/dist/components/motion/checkbox.js +1 -1
- package/dist/components/motion/chromatic-text-reveal.js +1 -1
- package/dist/components/motion/command-palette.d.ts +26 -0
- package/dist/components/motion/command-palette.d.ts.map +1 -0
- package/dist/components/motion/command-palette.js +246 -0
- package/dist/components/motion/command-palette.js.map +1 -0
- package/dist/components/motion/context-menu.js +2 -2
- package/dist/components/motion/cylinder-carousel.js +1 -1
- package/dist/components/motion/dock.js +1 -1
- package/dist/components/motion/drawer.js +1 -1
- package/dist/components/motion/dynamic-island.d.ts +22 -0
- package/dist/components/motion/dynamic-island.d.ts.map +1 -0
- package/dist/components/motion/dynamic-island.js +143 -0
- package/dist/components/motion/dynamic-island.js.map +1 -0
- package/dist/components/motion/expandable-action-bar.d.ts +52 -0
- package/dist/components/motion/expandable-action-bar.d.ts.map +1 -0
- package/dist/components/motion/expandable-action-bar.js +191 -0
- package/dist/components/motion/expandable-action-bar.js.map +1 -0
- package/dist/components/motion/expandable-tabs.d.ts +33 -0
- package/dist/components/motion/expandable-tabs.d.ts.map +1 -0
- package/dist/components/motion/expandable-tabs.js +291 -0
- package/dist/components/motion/expandable-tabs.js.map +1 -0
- package/dist/components/motion/feedback-widget.d.ts +18 -0
- package/dist/components/motion/feedback-widget.d.ts.map +1 -0
- package/dist/components/motion/feedback-widget.js +413 -0
- package/dist/components/motion/feedback-widget.js.map +1 -0
- package/dist/components/motion/file-upload.d.ts +48 -0
- package/dist/components/motion/file-upload.d.ts.map +1 -0
- package/dist/components/motion/file-upload.js +382 -0
- package/dist/components/motion/file-upload.js.map +1 -0
- package/dist/components/motion/hold-action-button.js +1 -1
- package/dist/components/motion/infinite-masonry.d.ts +31 -0
- package/dist/components/motion/infinite-masonry.d.ts.map +1 -0
- package/dist/components/motion/infinite-masonry.js +223 -0
- package/dist/components/motion/infinite-masonry.js.map +1 -0
- package/dist/components/motion/input.js +1 -1
- package/dist/components/motion/loader.js +1 -1
- package/dist/components/motion/magnetic.js +1 -1
- package/dist/components/motion/morphing-modal.js +1 -1
- package/dist/components/motion/not-found/glitch.d.ts +6 -0
- package/dist/components/motion/not-found/glitch.d.ts.map +1 -0
- package/dist/components/motion/not-found/glitch.js +90 -0
- package/dist/components/motion/not-found/glitch.js.map +1 -0
- package/dist/components/motion/not-found/magnetic.d.ts +6 -0
- package/dist/components/motion/not-found/magnetic.d.ts.map +1 -0
- package/dist/components/motion/not-found/magnetic.js +47 -0
- package/dist/components/motion/not-found/magnetic.js.map +1 -0
- package/dist/components/motion/not-found/shared.d.ts +32 -0
- package/dist/components/motion/not-found/shared.d.ts.map +1 -0
- package/dist/components/motion/not-found/shared.js +52 -0
- package/dist/components/motion/not-found/shared.js.map +1 -0
- package/dist/components/motion/not-found/spotlight.d.ts +6 -0
- package/dist/components/motion/not-found/spotlight.d.ts.map +1 -0
- package/dist/components/motion/not-found/spotlight.js +70 -0
- package/dist/components/motion/not-found/spotlight.js.map +1 -0
- package/dist/components/motion/not-found/stacked.d.ts +6 -0
- package/dist/components/motion/not-found/stacked.d.ts.map +1 -0
- package/dist/components/motion/not-found/stacked.js +95 -0
- package/dist/components/motion/not-found/stacked.js.map +1 -0
- package/dist/components/motion/not-found/terminal.d.ts +6 -0
- package/dist/components/motion/not-found/terminal.d.ts.map +1 -0
- package/dist/components/motion/not-found/terminal.js +90 -0
- package/dist/components/motion/not-found/terminal.js.map +1 -0
- package/dist/components/motion/notification-stack.d.ts +35 -0
- package/dist/components/motion/notification-stack.d.ts.map +1 -0
- package/dist/components/motion/notification-stack.js +187 -0
- package/dist/components/motion/notification-stack.js.map +1 -0
- package/dist/components/motion/number-ticker.js +1 -1
- package/dist/components/motion/otp-input.d.ts +32 -0
- package/dist/components/motion/otp-input.d.ts.map +1 -0
- package/dist/components/motion/otp-input.js +272 -0
- package/dist/components/motion/otp-input.js.map +1 -0
- package/dist/components/motion/overflow-actions.d.ts +39 -0
- package/dist/components/motion/overflow-actions.d.ts.map +1 -0
- package/dist/components/motion/overflow-actions.js +220 -0
- package/dist/components/motion/overflow-actions.js.map +1 -0
- package/dist/components/motion/parallax.js +1 -1
- package/dist/components/motion/popover-morph.js +2 -2
- package/dist/components/motion/popover-morph.js.map +1 -1
- package/dist/components/motion/popover.js +1 -1
- package/dist/components/motion/preview-rail.js +1 -1
- package/dist/components/motion/pull-to-refresh.js +2 -2
- package/dist/components/motion/pull-to-refresh.js.map +1 -1
- package/dist/components/motion/radio.js +1 -1
- package/dist/components/motion/range-slider-bubble.js +1 -1
- package/dist/components/motion/range-slider-fluid.js +1 -1
- package/dist/components/motion/range-slider-ruler.js +2 -2
- package/dist/components/motion/range-slider-ruler.js.map +1 -1
- package/dist/components/motion/range-slider-wave.js +1 -1
- package/dist/components/motion/range-slider.js +1 -1
- package/dist/components/motion/scroll-progress.js +1 -1
- package/dist/components/motion/scroll-reveal.js +1 -1
- package/dist/components/motion/select-morph.js +2 -2
- package/dist/components/motion/select.js +2 -2
- package/dist/components/motion/shader-background.js +1 -1
- package/dist/components/motion/shared-layout-bg.js +2 -2
- package/dist/components/motion/shared-layout-bg.js.map +1 -1
- package/dist/components/motion/slide-action-button.js +1 -1
- package/dist/components/motion/smooth-scroll.js +1 -1
- package/dist/components/motion/swipeable-list.d.ts +60 -0
- package/dist/components/motion/swipeable-list.d.ts.map +1 -0
- package/dist/components/motion/swipeable-list.js +254 -0
- package/dist/components/motion/swipeable-list.js.map +1 -0
- package/dist/components/motion/switch.js +1 -1
- package/dist/components/motion/table/index.js +1 -1
- package/dist/components/motion/table/row-handle.js +1 -1
- package/dist/components/motion/table/table-header.js +2 -2
- package/dist/components/motion/table/table-menu.js +1 -1
- package/dist/components/motion/tabs.js +1 -1
- package/dist/components/motion/text-reveal.js +1 -1
- package/dist/components/motion/text-shimmer.js +1 -1
- package/dist/components/motion/text-shimmer.js.map +1 -1
- package/dist/components/motion/theme-toggle.js +2 -2
- package/dist/components/motion/tilt-card.js +1 -1
- package/dist/components/motion/tooltip.js +1 -1
- package/dist/components/motion/wheel-picker.js +1 -1
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/alert.js +1 -1
- package/dist/components/reui/autocomplete.js +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +2 -2
- package/dist/components/reui/data-grid/data-grid-column-header.js +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +1 -1
- package/dist/components/reui/date-selector.js +2 -2
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
- package/dist/components/reui/filters.js +2 -2
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/frame.js +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-view.js +2 -2
- package/dist/components/reui/number-field.js +1 -1
- package/dist/components/reui/phone-input.js +2 -2
- package/dist/components/reui/rating.js +1 -1
- package/dist/components/reui/tree.js +1 -1
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/alert-dialog.js +1 -1
- package/dist/components/ui/alert.js +1 -1
- package/dist/components/ui/attachment.d.ts +1 -1
- package/dist/components/ui/attachment.js +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/bubble.js +1 -1
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button-group.js +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/button.js +2 -2
- package/dist/components/ui/calendar.js +1 -1
- package/dist/components/ui/carousel.js +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/combobox.js +1 -1
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/context-menu.js +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/empty.js +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/input-group.js +1 -1
- package/dist/components/ui/input-otp.js +1 -1
- package/dist/components/ui/item.d.ts +2 -2
- package/dist/components/ui/item.js +1 -1
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/marker.js +1 -1
- package/dist/components/ui/menubar.js +1 -1
- package/dist/components/ui/message-scroller.js +1 -1
- package/dist/components/ui/native-select.js +1 -1
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/pagination.js +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/sonner.js +1 -1
- package/dist/components/ui/spinner.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/toast.js +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/components/ui/toggle.js +1 -1
- package/dist/copy-menu-BJ-MXnkN.js +201 -0
- package/dist/copy-menu-BJ-MXnkN.js.map +1 -0
- package/dist/types-smkWN_7x.d.ts +20 -0
- package/dist/types-smkWN_7x.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { EASE_OUT } from "../../lib/ease.js";
|
|
3
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
4
|
+
import { cn } from "@kumix/utils";
|
|
5
|
+
import { Bell, FileText, FolderClosed, LayoutGrid, Link, Plus, Table, X } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
8
|
+
//#region src/components/motion/bloom-menu.tsx
|
|
9
|
+
const ITEMS = [
|
|
10
|
+
{
|
|
11
|
+
label: "Doc",
|
|
12
|
+
icon: FileText
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: "Board",
|
|
16
|
+
icon: LayoutGrid
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: "Table",
|
|
20
|
+
icon: Table
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: "Folder",
|
|
24
|
+
icon: FolderClosed
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: "Reminder",
|
|
28
|
+
icon: Bell
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: "Link",
|
|
32
|
+
icon: Link
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
const SPRING_FOLDER = {
|
|
36
|
+
type: "spring",
|
|
37
|
+
stiffness: 300,
|
|
38
|
+
damping: 32,
|
|
39
|
+
mass: .9
|
|
40
|
+
};
|
|
41
|
+
function BloomMenu({ items = ITEMS, onSelect, className }) {
|
|
42
|
+
const [open, setOpen] = useState(false);
|
|
43
|
+
const reduce = useReducedMotion();
|
|
44
|
+
const layoutId = useId();
|
|
45
|
+
const ref = useRef(null);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!open) return;
|
|
48
|
+
const onKey = (e) => {
|
|
49
|
+
if (e.key === "Escape") setOpen(false);
|
|
50
|
+
};
|
|
51
|
+
const onPointer = (e) => {
|
|
52
|
+
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
53
|
+
};
|
|
54
|
+
window.addEventListener("keydown", onKey);
|
|
55
|
+
window.addEventListener("pointerdown", onPointer);
|
|
56
|
+
return () => {
|
|
57
|
+
window.removeEventListener("keydown", onKey);
|
|
58
|
+
window.removeEventListener("pointerdown", onPointer);
|
|
59
|
+
};
|
|
60
|
+
}, [open]);
|
|
61
|
+
const morph = reduce ? { duration: .15 } : SPRING_FOLDER;
|
|
62
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
63
|
+
ref,
|
|
64
|
+
className: cn("relative inline-flex", className),
|
|
65
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
66
|
+
className: "h-11 w-36",
|
|
67
|
+
"aria-hidden": true
|
|
68
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
69
|
+
className: "pointer-events-none absolute top-1/2 left-1/2 z-30 grid h-[300px] w-[min(86vw,420px)] -translate-x-1/2 -translate-y-1/2 place-items-center *:pointer-events-auto",
|
|
70
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
71
|
+
initial: false,
|
|
72
|
+
mode: "popLayout",
|
|
73
|
+
children: open ? /* @__PURE__ */ jsx(motion.div, {
|
|
74
|
+
layoutId,
|
|
75
|
+
transition: morph,
|
|
76
|
+
style: { borderRadius: 16 },
|
|
77
|
+
className: "w-[min(86vw,420px)] overflow-hidden border border-border bg-card",
|
|
78
|
+
children: /* @__PURE__ */ jsxs(motion.div, {
|
|
79
|
+
layout: true,
|
|
80
|
+
initial: { opacity: 0 },
|
|
81
|
+
animate: { opacity: 1 },
|
|
82
|
+
transition: {
|
|
83
|
+
delay: reduce ? 0 : .12,
|
|
84
|
+
duration: .2
|
|
85
|
+
},
|
|
86
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
87
|
+
className: "flex items-center justify-between border-border border-b px-4 py-3",
|
|
88
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
89
|
+
className: "font-medium text-muted-foreground text-sm",
|
|
90
|
+
children: "Create"
|
|
91
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
92
|
+
type: "button",
|
|
93
|
+
onClick: () => setOpen(false),
|
|
94
|
+
"aria-label": "Close menu",
|
|
95
|
+
className: "text-muted-foreground transition-colors hover:text-foreground",
|
|
96
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
97
|
+
})]
|
|
98
|
+
}), /* @__PURE__ */ jsx(motion.div, {
|
|
99
|
+
initial: reduce ? false : { clipPath: "inset(45% 34% 45% 34%)" },
|
|
100
|
+
animate: { clipPath: "inset(0% 0% 0% 0%)" },
|
|
101
|
+
transition: {
|
|
102
|
+
delay: reduce ? 0 : .08,
|
|
103
|
+
duration: .45,
|
|
104
|
+
ease: EASE_OUT
|
|
105
|
+
},
|
|
106
|
+
className: "grid grid-cols-3",
|
|
107
|
+
children: items.map((item, i) => {
|
|
108
|
+
const cols = 3;
|
|
109
|
+
const rows = Math.ceil(items.length / cols);
|
|
110
|
+
const col = i % cols;
|
|
111
|
+
const row = Math.floor(i / cols);
|
|
112
|
+
const dist = Math.hypot(col - 2 / 2, row - (rows - 1) / 2);
|
|
113
|
+
return /* @__PURE__ */ jsx("button", {
|
|
114
|
+
type: "button",
|
|
115
|
+
onClick: () => {
|
|
116
|
+
onSelect?.(item.label);
|
|
117
|
+
setOpen(false);
|
|
118
|
+
},
|
|
119
|
+
className: cn("flex items-center justify-center px-3 py-6 text-muted-foreground transition-colors hover:text-foreground", i % 3 !== 2 && "border-border border-r", i < 3 && "border-border border-b"),
|
|
120
|
+
children: /* @__PURE__ */ jsxs(motion.span, {
|
|
121
|
+
initial: reduce ? { opacity: 0 } : {
|
|
122
|
+
opacity: 0,
|
|
123
|
+
scale: .85,
|
|
124
|
+
filter: "blur(6px)"
|
|
125
|
+
},
|
|
126
|
+
animate: {
|
|
127
|
+
opacity: 1,
|
|
128
|
+
scale: 1,
|
|
129
|
+
filter: "blur(0px)"
|
|
130
|
+
},
|
|
131
|
+
transition: {
|
|
132
|
+
delay: reduce ? 0 : .1 + dist * .07,
|
|
133
|
+
type: "spring",
|
|
134
|
+
stiffness: 440,
|
|
135
|
+
damping: 34
|
|
136
|
+
},
|
|
137
|
+
className: "flex flex-col items-center gap-2",
|
|
138
|
+
children: [/* @__PURE__ */ jsx(item.icon, { className: "h-5 w-5" }), /* @__PURE__ */ jsx("span", {
|
|
139
|
+
className: "font-medium text-sm",
|
|
140
|
+
children: item.label
|
|
141
|
+
})]
|
|
142
|
+
})
|
|
143
|
+
}, item.label);
|
|
144
|
+
})
|
|
145
|
+
})]
|
|
146
|
+
})
|
|
147
|
+
}, "panel") : /* @__PURE__ */ jsx(motion.button, {
|
|
148
|
+
type: "button",
|
|
149
|
+
layoutId,
|
|
150
|
+
transition: morph,
|
|
151
|
+
style: { borderRadius: 16 },
|
|
152
|
+
onClick: () => setOpen(true),
|
|
153
|
+
"aria-haspopup": "menu",
|
|
154
|
+
"aria-expanded": open,
|
|
155
|
+
whileTap: reduce ? void 0 : { scale: .97 },
|
|
156
|
+
className: "inline-flex h-11 w-36 items-center justify-center border border-border bg-card font-medium text-foreground text-sm",
|
|
157
|
+
children: /* @__PURE__ */ jsxs(motion.span, {
|
|
158
|
+
layout: true,
|
|
159
|
+
className: "inline-flex items-center gap-2 whitespace-nowrap",
|
|
160
|
+
children: ["Create", /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" })]
|
|
161
|
+
})
|
|
162
|
+
}, "trigger")
|
|
163
|
+
})
|
|
164
|
+
})]
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
export { BloomMenu };
|
|
169
|
+
|
|
170
|
+
//# sourceMappingURL=bloom-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bloom-menu.js","names":[],"sources":["../../../src/components/motion/bloom-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ComponentType, useEffect, useId, useRef, useState } from \"react\";\nimport { Bell, FileText, FolderClosed, LayoutGrid, Link, Plus, Table, X } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\ntype MenuItem = { label: string; icon: ComponentType<{ className?: string }> };\n\nconst ITEMS: MenuItem[] = [\n { label: \"Doc\", icon: FileText },\n { label: \"Board\", icon: LayoutGrid },\n { label: \"Table\", icon: Table },\n { label: \"Folder\", icon: FolderClosed },\n { label: \"Reminder\", icon: Bell },\n { label: \"Link\", icon: Link },\n];\n\n// Folder-open feel: a touch of overshoot as the panel expands, kept subtle.\nconst SPRING_FOLDER = {\n type: \"spring\",\n stiffness: 300,\n damping: 32,\n mass: 0.9,\n} as const;\n\nexport interface BloomMenuProps {\n items?: MenuItem[];\n onSelect?: (label: string) => void;\n className?: string;\n}\n\nexport function BloomMenu({ items = ITEMS, onSelect, className }: BloomMenuProps) {\n const [open, setOpen] = useState(false);\n const reduce = useReducedMotion();\n const layoutId = useId();\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") setOpen(false);\n };\n const onPointer = (e: PointerEvent) => {\n if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open]);\n\n const morph = reduce ? { duration: 0.15 } : SPRING_FOLDER;\n\n return (\n <div ref={ref} className={cn(\"relative inline-flex\", className)}>\n {/* spacer fixes the anchor to the trigger size */}\n <div className=\"h-11 w-36\" aria-hidden />\n\n {/* Centering box sized to the OPEN panel and centered on the trigger.\n place-items-center only centers an item that fits its cell, so the cell\n must be as wide as the panel — otherwise the overflow left-anchors and\n the panel expands rightward. The box is a fixed size per viewport (vw\n doesn't change mid-animation), so its -translate centering never drifts\n the way a content-sized wrapper would. Both states share its center, so\n the morph grows from the middle outward in every direction. */}\n <div className=\"pointer-events-none absolute top-1/2 left-1/2 z-30 grid h-[300px] w-[min(86vw,420px)] -translate-x-1/2 -translate-y-1/2 place-items-center *:pointer-events-auto\">\n {/* popLayout pulls the exiting trigger out of grid flow at once, so the\n grid never briefly holds two rows and shoves the panel off-center */}\n <AnimatePresence initial={false} mode=\"popLayout\">\n {open ? (\n <motion.div\n key=\"panel\"\n layoutId={layoutId}\n transition={morph}\n style={{ borderRadius: 16 }}\n className=\"w-[min(86vw,420px)] overflow-hidden border border-border bg-card\"\n >\n <motion.div\n // `layout` lets framer undo the box's morph scaling so this\n // content stays crisp instead of stretching with the resize.\n layout\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{ delay: reduce ? 0 : 0.12, duration: 0.2 }}\n >\n {/* header */}\n <div className=\"flex items-center justify-between border-border border-b px-4 py-3\">\n <span className=\"font-medium text-muted-foreground text-sm\">Create</span>\n <button\n type=\"button\"\n onClick={() => setOpen(false)}\n aria-label=\"Close menu\"\n className=\"text-muted-foreground transition-colors hover:text-foreground\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n\n {/* grid */}\n <motion.div\n // Iris reveal: start as a small box at the grid center and open\n // outward to all four corners, so the menu grows from the middle\n // in every direction instead of wiping top-down.\n initial={reduce ? false : { clipPath: \"inset(45% 34% 45% 34%)\" }}\n animate={{ clipPath: \"inset(0% 0% 0% 0%)\" }}\n transition={{\n delay: reduce ? 0 : 0.08,\n duration: 0.45,\n ease: EASE_OUT,\n }}\n className=\"grid grid-cols-3\"\n >\n {items.map((item, i) => {\n // Radial stagger: delay each item by its distance from the\n // grid center so the four corners animate together and the\n // open reads as center-out, not corner-by-corner.\n const cols = 3;\n const rows = Math.ceil(items.length / cols);\n const col = i % cols;\n const row = Math.floor(i / cols);\n const dist = Math.hypot(col - (cols - 1) / 2, row - (rows - 1) / 2);\n return (\n <button\n key={item.label}\n type=\"button\"\n onClick={() => {\n onSelect?.(item.label);\n setOpen(false);\n }}\n // Static cell with hairline borders (no animated fill) so\n // the grid lines never flicker as items stagger in. Only the\n // inner content animates.\n className={cn(\n \"flex items-center justify-center px-3 py-6 text-muted-foreground transition-colors hover:text-foreground\",\n i % 3 !== 2 && \"border-border border-r\",\n i < 3 && \"border-border border-b\",\n )}\n >\n <motion.span\n initial={\n reduce\n ? { opacity: 0 }\n : { opacity: 0, scale: 0.85, filter: \"blur(6px)\" }\n }\n animate={{ opacity: 1, scale: 1, filter: \"blur(0px)\" }}\n transition={{\n delay: reduce ? 0 : 0.1 + dist * 0.07,\n type: \"spring\",\n stiffness: 440,\n damping: 34,\n }}\n className=\"flex flex-col items-center gap-2\"\n >\n <item.icon className=\"h-5 w-5\" />\n <span className=\"font-medium text-sm\">{item.label}</span>\n </motion.span>\n </button>\n );\n })}\n </motion.div>\n </motion.div>\n </motion.div>\n ) : (\n <motion.button\n key=\"trigger\"\n type=\"button\"\n layoutId={layoutId}\n transition={morph}\n style={{ borderRadius: 16 }}\n onClick={() => setOpen(true)}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n whileTap={reduce ? undefined : { scale: 0.97 }}\n className=\"inline-flex h-11 w-36 items-center justify-center border border-border bg-card font-medium text-foreground text-sm\"\n >\n {/* own `layout` counter-scales the label so it stays crisp while the\n button box morphs, instead of stretching with it */}\n <motion.span layout className=\"inline-flex items-center gap-2 whitesp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AM,QAAQ;UAAY;UAErD,SAAS;WAAE,SAAS;WAAG,OAAO;WAAG,QAAQ;UAAY;UACrD,YAAY;WACV,OAAO,SAAS,IAAI,KAAM,OAAO;WACjC,MAAM;WACN,WAAW;WACX,SAAS;UACX;UACA,WAAU;UAbZ,UAAA,CAeE,oBAAC,KAAK,MAAN,EAAW,WAAU,UAAW,CAAA,GAChC,oBAAC,QAAD;WAAM,WAAU;WAAuB,UAAA,KAAK;UAAY,CAAA,CAC7C;;QACP,GAjCD,KAAK,KAiCJ;OAEZ,CAAC;MACS,CAAA,CACF;;IACF,GA1FN,OA0FM,IAEZ,oBAAC,OAAO,QAAR;KAEE,MAAK;KACK;KACV,YAAY;KACZ,OAAO,EAAE,cAAc,GAAG;KAC1B,eAAe,QAAQ,IAAI;KAC3B,iBAAc;KACd,iBAAe;KACf,UAAU,SAAS,KAAA,IAAY,EAAE,OAAO,IAAK;KAC7C,WAAU;KAIV,UAAA,qBAAC,OAAO,MAAR;MAAa,QAAA;MAAO,WAAU;MAA9B,UAAA,CAAiF,UAE/E,oBAAC,MAAD,EAAM,WAAU,UAAW,CAAA,CAChB;;IACA,GAjBT,SAiBS;GAEF,CAAA;EACd,CAAA,CACF;;AAET"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { EASE_DRAWER } from "../../lib/ease.js";
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { cn } from "@kumix/utils";
|
|
5
|
-
import { AnimatePresence, motion, useDragControls, useReducedMotion } from "motion/react";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { AnimatePresence, motion, useDragControls, useReducedMotion } from "motion/react";
|
|
7
7
|
import { createPortal } from "react-dom";
|
|
8
8
|
//#region src/components/motion/bottom-sheet.tsx
|
|
9
9
|
const DRAWER = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useCallback, useLayoutEffect, useRef, useState } from "react";
|
|
3
3
|
import { cn } from "@kumix/utils";
|
|
4
|
-
import { animate, motion, useMotionValue, useReducedMotion } from "motion/react";
|
|
5
4
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { animate, motion, useMotionValue, useReducedMotion } from "motion/react";
|
|
6
6
|
//#region src/components/motion/bounce-sidebar.tsx
|
|
7
7
|
const DOT_SIZE = 6;
|
|
8
8
|
const BOUNCE_SPRING = {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { EASE_OUT } from "../../lib/ease.js";
|
|
3
3
|
import { useCallback, useId, useLayoutEffect, useRef, useState } from "react";
|
|
4
4
|
import { cn } from "@kumix/utils";
|
|
5
|
-
import { motion, useReducedMotion } from "motion/react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
5
|
import { ChevronDown } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { motion, useReducedMotion } from "motion/react";
|
|
8
8
|
//#region src/components/motion/bouncy-accordion.tsx
|
|
9
9
|
const ROW_TRANSITION = {
|
|
10
10
|
type: "spring",
|
|
@@ -3,8 +3,8 @@ import { useHoverCapable } from "../../../hooks/use-hover-capable.js";
|
|
|
3
3
|
import { EASE_OUT, SPRING_PRESS } from "../../../lib/ease.js";
|
|
4
4
|
import { forwardRef, useCallback, useRef, useState } from "react";
|
|
5
5
|
import { cn } from "@kumix/utils";
|
|
6
|
-
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
8
8
|
//#region src/components/motion/button/base.tsx
|
|
9
9
|
const VARIANT_CLASS = {
|
|
10
10
|
primary: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Button, ButtonProps, ButtonSize, ButtonVariant } from "./base.js";
|
|
2
|
+
import { MagneticButton, MagneticButtonProps } from "./magnetic.js";
|
|
3
|
+
import { ButtonState, StatefulButton, StatefulButtonProps } from "./stateful.js";
|
|
4
|
+
export { Button, type ButtonProps, type ButtonSize, type ButtonState, type ButtonVariant, MagneticButton, type MagneticButtonProps, StatefulButton, type StatefulButtonProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Magnetic } from "../magnetic.js";
|
|
3
2
|
import { Button } from "./base.js";
|
|
3
|
+
import { Magnetic } from "../magnetic.js";
|
|
4
4
|
import { forwardRef } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/motion/button/magnetic.tsx
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { EASE_OUT, SPRING_SWAP } from "../../../lib/ease.js";
|
|
3
3
|
import { Button } from "./base.js";
|
|
4
4
|
import { forwardRef, useLayoutEffect, useRef, useState } from "react";
|
|
5
|
-
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
6
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
5
|
import { Check, Loader2, X } from "lucide-react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
8
8
|
//#region src/components/motion/button/stateful.tsx
|
|
9
9
|
const CASCADE_STAGGER = .025;
|
|
10
10
|
const ROLL_BLUR = "blur(6px)";
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { EASE_OUT } from "../../lib/ease.js";
|
|
3
3
|
import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { cn } from "@kumix/utils";
|
|
5
|
-
import { AnimatePresence, motion, useIsPresent, useReducedMotion } from "motion/react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
5
|
import { X } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { AnimatePresence, motion, useIsPresent, useReducedMotion } from "motion/react";
|
|
8
8
|
import { createPortal } from "react-dom";
|
|
9
9
|
//#region src/components/motion/center-morph-modal.tsx
|
|
10
10
|
const CenterMorphModalContext = createContext(null);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { EASE_OUT, SPRING_PRESS } from "../../lib/ease.js";
|
|
3
3
|
import { useId } from "react";
|
|
4
4
|
import { cn } from "@kumix/utils";
|
|
5
|
-
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
7
7
|
//#region src/components/motion/checkbox.tsx
|
|
8
8
|
const CHECK_PATH = "M5 13l4 4L19 7";
|
|
9
9
|
const INDETERMINATE_PATH = "M6 12h12";
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { EASE_IN_OUT, EASE_OUT } from "../../lib/ease.js";
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { cn } from "@kumix/utils";
|
|
5
|
-
import { motion, useInView, useReducedMotion } from "motion/react";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { motion, useInView, useReducedMotion } from "motion/react";
|
|
7
7
|
//#region src/components/motion/chromatic-text-reveal.tsx
|
|
8
8
|
const CHROMATIC_PALETTE = [
|
|
9
9
|
"#60a5fa",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { LucideIcon } from "lucide-react";
|
|
3
|
+
//#region src/components/motion/command-palette.d.ts
|
|
4
|
+
type CommandItem = {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
group?: string;
|
|
8
|
+
hint?: string;
|
|
9
|
+
keywords?: string[];
|
|
10
|
+
icon?: LucideIcon;
|
|
11
|
+
badge?: ReactNode;
|
|
12
|
+
onSelect: () => void;
|
|
13
|
+
};
|
|
14
|
+
interface CommandPaletteProps {
|
|
15
|
+
items: CommandItem[];
|
|
16
|
+
/** Opens with Cmd/Ctrl + this key. Default: "k" */
|
|
17
|
+
shortcut?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
emptyMessage?: string;
|
|
20
|
+
open?: boolean;
|
|
21
|
+
onOpenChange?: (open: boolean) => void;
|
|
22
|
+
}
|
|
23
|
+
declare function CommandPalette({ items, shortcut, placeholder, emptyMessage, open: controlledOpen, onOpenChange }: CommandPaletteProps): import("react").ReactPortal | null;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { CommandItem, CommandPalette, CommandPaletteProps };
|
|
26
|
+
//# sourceMappingURL=command-palette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-palette.d.ts","names":[],"sources":["../../../src/components/motion/command-palette.tsx"],"mappings":";;;KAUY;EACV;EACA;EACA;EACA;EACA;EACA,OAAO;EACP,QAAQ;EACR;;UAGe;EACf,OAAO;;EAEP;EACA;EACA;EACA;EACA,gBAAgB;;iBAwBF,iBACd,OACA,UACA,aACA,cACA,MAAM,gBACN,gBACC,sCAAmB"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { EASE_OUT } from "../../lib/ease.js";
|
|
3
|
+
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { cn } from "@kumix/utils";
|
|
5
|
+
import { Search } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { motion, useReducedMotion } from "motion/react";
|
|
8
|
+
import { createPortal } from "react-dom";
|
|
9
|
+
//#region src/components/motion/command-palette.tsx
|
|
10
|
+
function fuzzyMatch(needle, hay) {
|
|
11
|
+
if (!needle) return true;
|
|
12
|
+
needle = needle.toLowerCase();
|
|
13
|
+
hay = hay.toLowerCase();
|
|
14
|
+
let i = 0;
|
|
15
|
+
for (const ch of hay) {
|
|
16
|
+
if (ch === needle[i]) i++;
|
|
17
|
+
if (i === needle.length) return true;
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
const PANEL_SPRING = {
|
|
22
|
+
type: "spring",
|
|
23
|
+
stiffness: 560,
|
|
24
|
+
damping: 40,
|
|
25
|
+
mass: .5
|
|
26
|
+
};
|
|
27
|
+
function CommandPalette({ items, shortcut = "k", placeholder = "Type a command or search…", emptyMessage = "No results found.", open: controlledOpen, onOpenChange }) {
|
|
28
|
+
const [internalOpen, setInternalOpen] = useState(false);
|
|
29
|
+
const controlled = controlledOpen !== void 0;
|
|
30
|
+
const open = controlled ? controlledOpen : internalOpen;
|
|
31
|
+
const setOpen = useCallback((v) => {
|
|
32
|
+
if (!controlled) setInternalOpen(v);
|
|
33
|
+
onOpenChange?.(v);
|
|
34
|
+
}, [controlled, onOpenChange]);
|
|
35
|
+
const [query, setQuery] = useState("");
|
|
36
|
+
const [active, setActive] = useState(0);
|
|
37
|
+
const [mounted, setMounted] = useState(false);
|
|
38
|
+
useEffect(() => setMounted(true), []);
|
|
39
|
+
const uid = useId();
|
|
40
|
+
const reduce = useReducedMotion();
|
|
41
|
+
const updateQuery = useCallback((value) => {
|
|
42
|
+
setQuery(value);
|
|
43
|
+
setActive(0);
|
|
44
|
+
}, []);
|
|
45
|
+
const inputRef = useRef(null);
|
|
46
|
+
const listRef = useRef(null);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const onKey = (e) => {
|
|
49
|
+
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === shortcut.toLowerCase()) {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
setOpen(!open);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (e.key === "Escape" && open) {
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
setOpen(false);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
window.addEventListener("keydown", onKey);
|
|
60
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
61
|
+
}, [
|
|
62
|
+
open,
|
|
63
|
+
shortcut,
|
|
64
|
+
setOpen
|
|
65
|
+
]);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (open) {
|
|
68
|
+
updateQuery("");
|
|
69
|
+
setActive(0);
|
|
70
|
+
requestAnimationFrame(() => inputRef.current?.focus());
|
|
71
|
+
}
|
|
72
|
+
}, [open, updateQuery]);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (!open) return;
|
|
75
|
+
const prev = document.body.style.overflow;
|
|
76
|
+
document.body.style.overflow = "hidden";
|
|
77
|
+
return () => {
|
|
78
|
+
document.body.style.overflow = prev;
|
|
79
|
+
};
|
|
80
|
+
}, [open]);
|
|
81
|
+
const filtered = useMemo(() => {
|
|
82
|
+
if (!query) return items;
|
|
83
|
+
return items.filter((it) => {
|
|
84
|
+
return [
|
|
85
|
+
it.label,
|
|
86
|
+
it.group ?? "",
|
|
87
|
+
...it.keywords ?? []
|
|
88
|
+
].some((h) => fuzzyMatch(query, h));
|
|
89
|
+
});
|
|
90
|
+
}, [items, query]);
|
|
91
|
+
const hasIcons = useMemo(() => items.some((it) => it.icon), [items]);
|
|
92
|
+
const grouped = useMemo(() => {
|
|
93
|
+
const map = /* @__PURE__ */ new Map();
|
|
94
|
+
filtered.forEach((it) => {
|
|
95
|
+
const g = it.group ?? "Results";
|
|
96
|
+
const groupItems = map.get(g) ?? [];
|
|
97
|
+
groupItems.push(it);
|
|
98
|
+
map.set(g, groupItems);
|
|
99
|
+
});
|
|
100
|
+
return Array.from(map.entries());
|
|
101
|
+
}, [filtered]);
|
|
102
|
+
const onKeyDown = (e) => {
|
|
103
|
+
if (e.key === "ArrowDown") {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
setActive((a) => Math.min(filtered.length - 1, a + 1));
|
|
106
|
+
} else if (e.key === "ArrowUp") {
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
setActive((a) => Math.max(0, a - 1));
|
|
109
|
+
} else if (e.key === "Enter") {
|
|
110
|
+
e.preventDefault();
|
|
111
|
+
const it = filtered[active];
|
|
112
|
+
if (it) {
|
|
113
|
+
it.onSelect();
|
|
114
|
+
setOpen(false);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
if (!open) return;
|
|
120
|
+
(listRef.current?.querySelector(`[data-index="${active}"]`))?.scrollIntoView({ block: "nearest" });
|
|
121
|
+
}, [active, open]);
|
|
122
|
+
let cursor = 0;
|
|
123
|
+
if (!mounted) return null;
|
|
124
|
+
return createPortal(/* @__PURE__ */ jsxs("div", {
|
|
125
|
+
"aria-hidden": !open,
|
|
126
|
+
inert: !open,
|
|
127
|
+
className: cn("fixed inset-0 z-100", open ? "pointer-events-auto" : "pointer-events-none"),
|
|
128
|
+
children: [/* @__PURE__ */ jsx(motion.button, {
|
|
129
|
+
type: "button",
|
|
130
|
+
"aria-label": "Close command palette",
|
|
131
|
+
initial: false,
|
|
132
|
+
animate: { opacity: open ? 1 : 0 },
|
|
133
|
+
transition: {
|
|
134
|
+
duration: open ? .18 : .12,
|
|
135
|
+
ease: EASE_OUT
|
|
136
|
+
},
|
|
137
|
+
onClick: () => setOpen(false),
|
|
138
|
+
className: cn("absolute inset-0 bg-background/5 [-webkit-backdrop-filter:blur(12px)_saturate(140%)] [backdrop-filter:blur(12px)_saturate(140%)]", open ? "pointer-events-auto" : "pointer-events-none")
|
|
139
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
140
|
+
className: "pointer-events-none absolute inset-0 flex items-start justify-center p-4 pt-[18vh]",
|
|
141
|
+
children: /* @__PURE__ */ jsxs(motion.div, {
|
|
142
|
+
role: "dialog",
|
|
143
|
+
"aria-modal": "true",
|
|
144
|
+
"aria-label": "Command palette",
|
|
145
|
+
initial: false,
|
|
146
|
+
animate: {
|
|
147
|
+
opacity: open ? 1 : 0,
|
|
148
|
+
y: open || reduce ? 0 : -8,
|
|
149
|
+
scale: open || reduce ? 1 : .97
|
|
150
|
+
},
|
|
151
|
+
transition: reduce ? { duration: .1 } : open ? PANEL_SPRING : {
|
|
152
|
+
duration: .12,
|
|
153
|
+
ease: EASE_OUT
|
|
154
|
+
},
|
|
155
|
+
onKeyDown,
|
|
156
|
+
className: cn("w-full max-w-xl overflow-hidden rounded-2xl border border-border bg-card shadow-2xl will-change-transform", open ? "pointer-events-auto" : "pointer-events-none"),
|
|
157
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
158
|
+
className: "flex items-center gap-3 border-border border-b px-4",
|
|
159
|
+
children: [
|
|
160
|
+
/* @__PURE__ */ jsx(Search, { className: "h-4 w-4 text-muted-foreground" }),
|
|
161
|
+
/* @__PURE__ */ jsx("input", {
|
|
162
|
+
ref: inputRef,
|
|
163
|
+
value: query,
|
|
164
|
+
onChange: (e) => updateQuery(e.target.value),
|
|
165
|
+
placeholder,
|
|
166
|
+
tabIndex: open ? 0 : -1,
|
|
167
|
+
role: "combobox",
|
|
168
|
+
"aria-expanded": open,
|
|
169
|
+
"aria-controls": `${uid}-list`,
|
|
170
|
+
"aria-activedescendant": filtered.length > 0 ? `${uid}-opt-${active}` : void 0,
|
|
171
|
+
"aria-autocomplete": "list",
|
|
172
|
+
className: "h-12 flex-1 bg-transparent text-foreground text-sm outline-none placeholder:text-muted-foreground"
|
|
173
|
+
}),
|
|
174
|
+
/* @__PURE__ */ jsx("kbd", {
|
|
175
|
+
className: "hidden rounded border border-border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground sm:inline-block",
|
|
176
|
+
children: "ESC"
|
|
177
|
+
})
|
|
178
|
+
]
|
|
179
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
180
|
+
ref: listRef,
|
|
181
|
+
id: `${uid}-list`,
|
|
182
|
+
role: "listbox",
|
|
183
|
+
"aria-label": "Commands",
|
|
184
|
+
className: "max-h-[60vh] overflow-y-auto p-2",
|
|
185
|
+
children: filtered.length === 0 ? /* @__PURE__ */ jsx("div", {
|
|
186
|
+
className: "p-8 text-center text-muted-foreground text-sm",
|
|
187
|
+
children: emptyMessage
|
|
188
|
+
}) : grouped.map(([group, list]) => /* @__PURE__ */ jsxs("div", {
|
|
189
|
+
className: "mb-1 last:mb-0",
|
|
190
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
191
|
+
"aria-hidden": true,
|
|
192
|
+
className: "px-2 py-1.5 font-semibold text-[10px] text-muted-foreground uppercase tracking-wider",
|
|
193
|
+
children: group
|
|
194
|
+
}), list.map((it) => {
|
|
195
|
+
const idx = cursor++;
|
|
196
|
+
const isActive = idx === active;
|
|
197
|
+
const Icon = it.icon;
|
|
198
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
199
|
+
type: "button",
|
|
200
|
+
id: `${uid}-opt-${idx}`,
|
|
201
|
+
role: "option",
|
|
202
|
+
"aria-selected": isActive,
|
|
203
|
+
"data-index": idx,
|
|
204
|
+
onMouseEnter: () => setActive(idx),
|
|
205
|
+
onClick: () => {
|
|
206
|
+
it.onSelect();
|
|
207
|
+
setOpen(false);
|
|
208
|
+
},
|
|
209
|
+
tabIndex: open ? 0 : -1,
|
|
210
|
+
className: cn("relative isolate flex w-full items-center gap-3 rounded-md px-2 py-2 text-left text-sm transition-colors", isActive ? "text-foreground" : "text-muted-foreground"),
|
|
211
|
+
children: [
|
|
212
|
+
isActive ? /* @__PURE__ */ jsx(motion.span, {
|
|
213
|
+
layoutId: `${uid}-active`,
|
|
214
|
+
className: "absolute inset-0 z-0 rounded-md bg-primary/5",
|
|
215
|
+
transition: reduce ? { duration: 0 } : {
|
|
216
|
+
type: "spring",
|
|
217
|
+
stiffness: 480,
|
|
218
|
+
damping: 38
|
|
219
|
+
}
|
|
220
|
+
}) : null,
|
|
221
|
+
Icon ? /* @__PURE__ */ jsx(Icon, { className: "relative z-10 h-4 w-4" }) : hasIcons ? /* @__PURE__ */ jsx("span", { className: "relative z-10 h-4 w-4" }) : null,
|
|
222
|
+
/* @__PURE__ */ jsx("span", {
|
|
223
|
+
className: "relative z-10 flex-1 truncate",
|
|
224
|
+
children: it.label
|
|
225
|
+
}),
|
|
226
|
+
it.badge ? /* @__PURE__ */ jsx("span", {
|
|
227
|
+
className: "relative z-10 shrink-0",
|
|
228
|
+
children: it.badge
|
|
229
|
+
}) : null,
|
|
230
|
+
it.hint ? /* @__PURE__ */ jsx("kbd", {
|
|
231
|
+
className: "relative z-10 rounded border border-border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground",
|
|
232
|
+
children: it.hint
|
|
233
|
+
}) : null
|
|
234
|
+
]
|
|
235
|
+
}, it.id);
|
|
236
|
+
})]
|
|
237
|
+
}, group))
|
|
238
|
+
})]
|
|
239
|
+
})
|
|
240
|
+
})]
|
|
241
|
+
}), document.body);
|
|
242
|
+
}
|
|
243
|
+
//#endregion
|
|
244
|
+
export { CommandPalette };
|
|
245
|
+
|
|
246
|
+
//# sourceMappingURL=command-palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-palette.js","names":[],"sources":["../../../src/components/motion/command-palette.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { type LucideIcon, Search } from \"lucide-react\";\nimport { motion, useReducedMotion } from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type CommandItem = {\n id: string;\n label: string;\n group?: string;\n hint?: string;\n keywords?: string[];\n icon?: LucideIcon;\n badge?: ReactNode;\n onSelect: () => void;\n};\n\nexport interface CommandPaletteProps {\n items: CommandItem[];\n /** Opens with Cmd/Ctrl + this key. Default: \"k\" */\n shortcut?: string;\n placeholder?: string;\n emptyMessage?: string;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nfunction fuzzyMatch(needle: string, hay: string) {\n if (!needle) return true;\n needle = needle.toLowerCase();\n hay = hay.toLowerCase();\n let i = 0;\n for (const ch of hay) {\n if (ch === needle[i]) i++;\n if (i === needle.length) return true;\n }\n return false;\n}\n\n// Opened via a keyboard shortcut many times a day — entrance must read as\n// instant. Tight spring, even faster exit.\nconst PANEL_SPRING = {\n type: \"spring\",\n stiffness: 560,\n damping: 40,\n mass: 0.5,\n} as const;\n\nexport function CommandPalette({\n items,\n shortcut = \"k\",\n placeholder = \"Type a command or search…\",\n emptyMessage = \"No results found.\",\n open: controlledOpen,\n onOpenChange,\n}: CommandPaletteProps) {\n const [internalOpen, setInternalOpen] = useState(false);\n const controlled = controlledOpen !== undefined;\n const open = controlled ? controlledOpen : internalOpen;\n const setOpen = useCallback(\n (v: boolean) => {\n if (!controlled) setInternalOpen(v);\n onOpenChange?.(v);\n },\n [controlled, onOpenChange],\n );\n\n const [query, setQuery] = useState(\"\");\n const [active, setActive] = useState(0);\n // Portal target only exists client-side; render nothing during SSR/hydration.\n const [mounted, setMounted] = useState(false);\n useEffect(() => setMounted(true), []);\n const uid = useId();\n const reduce = useReducedMotion();\n const updateQuery = useCallback((value: string) => {\n setQuery(value);\n setActive(0);\n }, []);\n const inputRef = useRef<HTMLInputElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === shortcut.toLowerCase()) {\n e.preventDefault();\n setOpen(!open);\n return;\n }\n if (e.key === \"Escape\" && open) {\n e.preventDefault();\n setOpen(false);\n }\n };\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [open, shortcut, setOpen]);\n\n useEffect(() => {\n if (open) {\n updateQuery(\"\");\n setActive(0);\n requestAnimationFrame(() => inputRef.current?.focus());\n }\n }, [open, updateQuery]);\n\n useEffect(() => {\n if (!open) return;\n const prev = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n return () => {\n document.body.style.overflow = prev;\n };\n }, [open]);\n\n const filtered = useMemo(() => {\n if (!query) return items;\n return items.filter((it) => {\n const haystacks = [it.label, it.group ?? \"\", ...(it.keywords ?? [])];\n return haystacks.some((h) => fuzzyMatch(query, h));\n });\n }, [items, query]);\n\n // Reserve the icon column only when at least one item brings an icon, so\n // icon-less lists don't render a dead gap before every label.\n const hasIcons = useMemo(() => items.some((it) => it.icon), [items]);\n\n const grouped = useMemo(() => {\n const map = new Map<string, CommandItem[]>();\n filtered.forEach((it) => {\n const g = it.group ?? \"Results\";\n const groupItems = map.get(g) ?? [];\n groupItems.push(it);\n map.set(g, groupItems);\n });\n return Array.from(map.entries());\n }, [filtered]);\n\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setActive((a) => Math.min(filtered.length - 1, a + 1));\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n setActive((a) => Math.max(0, a - 1));\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n const it = filtered[active];\n if (it) {\n it.onSelect();\n setOpen(false);\n }\n }\n };\n\n useEffect(() => {\n if (!open) return;\n const el = listRef.current?.querySelector<HTMLButtonElement>(`[data-index=\"${active}\"]`);\n el?.scrollIntoView({ block: \"nearest\" });\n }, [active, open]);\n\n let cursor = 0;\n\n if (!mounted) return null;\n\n // Always-mounted container; pointer events fully disabled when closed so clicks\n // pass through to the page. Portaled to <body> so ancestors with transforms,\n // filters, or fixed positioning can't trap the overlay in their stacking context.\n return createPortal(\n <div\n aria-hidden={!open}\n inert={!open}\n className={cn(\"fixed inset-0 z-100\", open ? \"pointer-events-auto\" : \"pointer-events-none\")}\n >\n <motion.button\n type=\"button\"\n aria-label=\"Close command palette\"\n initial={false}\n animate={{ opacity: open ? 1 : 0 }}\n transition={{ duration: open ? 0.18 : 0.12, ease: EASE_OUT }}\n onClick={() => setOpen(false)}\n className={cn(\n \"absolute inset-0 bg-background/5 [-webkit-backdrop-filter:blur(12px)_saturate(140%)] [backdrop-filter:blur(12px)_saturate(140%)]\",\n open ? \"pointer-events-auto\" : \"pointer-events-none\",\n )}\n />\n <div className=\"pointer-events-none absolute inset-0 flex items-start justify-center p-4 pt-[18vh]\">\n <motion.div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Command palette\"\n initial={false}\n animate={{\n opacity: open ? 1 : 0,\n y: open || reduce ? 0 : -8,\n scale: open || reduce ? 1 : 0.97,\n }}\n transition={\n reduce ? { duration: 0.1 } : open ? PANEL_SPRING : { duration: 0.12, ease: EASE_OUT }\n }\n onKeyDown={onKeyDown}\n className={cn(\n \"w-full max-w-xl overflow-hidden rounded-2xl border border-border bg-card shadow-2xl will-change-transform\",\n open ? \"pointer-events-auto\" : \"pointer-events-none\",\n )}\n >\n <div className=\"flex items-center gap-3 border-border border-b px-4\">\n <Search className=\"h-4 w-4 text-muted-foreground\" />\n <input\n ref={inputRef}\n value={query}\n onChange={(e) => updateQuery(e.target.value)}\n placeholder={placeholder}\n tabIndex={open ? 0 : -1}\n role=\"combobox\"\n aria-expanded={open}\n aria-controls={`${uid}-list`}\n aria-activedescendant={filtered.length > 0 ? `${uid}-opt-${active}` : undefined}\n aria-autocomplete=\"list\"\n className=\"h-12 flex-1 bg-transparent text-foreground text-sm outline-none placeholder:text-muted-foreground\"\n />\n <kbd className=\"hidden rounded border border-border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground sm:inline-block\">\n ESC\n </kbd>\n </div>\n <div\n ref={listRef}\n id={`${uid}-list`}\n role=\"listbox\"\n aria-label=\"Commands\"\n className=\"max-h-[60vh] overflow-y-auto p-2\"\n >\n {filtered.length === 0 ? (\n <div className=\"p-8 text-center text-muted-foreground text-sm\">{emptyMessage}</div>\n ) : (\n grouped.map(([group, list]) => (\n <div key={group} className=\"mb-1 last:mb-0\">\n <div\n aria-hidden\n className=\"px-2 py-1.5 font-semibold text-[10px] text-muted-foreground uppercase tracking-wider\"\n >\n {group}\n </div>\n {list.map((it) => {\n const idx = cursor++;\n const isActive = idx === active;\n const Icon = it.icon;\n return (\n <button\n key={it.id}\n type=\"button\"\n id={`${uid}-opt-${idx}`}\n role=\"option\"\n aria-selected={isActive}\n data-index={idx}\n onMouseEnter={() => setActive(idx)}\n onClick={() => {\n it.onSelect();\n setOpen(false);\n }}\n tabIndex={open ? 0 : -1}\n className={cn(\n \"relative isolate flex w-full items-center gap-3 rounded-md px-2 py-2 text-left text-sm transition-colors\",\n isActive ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n >\n {isActive ? (\n <motion.span\n layoutId={`${uid}-active`}\n className=\"absolute inset-0 z-0 rounded-md bg-primary/5\"\n transition={\n reduce\n ? { duration: 0 }\n : // Tracks rapid arrow-key navigation — keep it tighter\n // than SPRING_LAYOUT so it never lags the active row.\n {\n type: \"spring\",\n stiffness: 480,\n damping: 38,\n }\n }\n />\n ) : null}\n {Icon ? (\n <Icon className=\"relative z-10 h-4 w-4\" />\n ) : hasIcons ? (\n <span className=\"relative z-10 h-4 w-4\" />\n ) : null}\n <span className=\"relative z-10 flex-1 truncate\">{it.label}</span>\n {it.badge ? (\n <span className=\"relative z-10 shrink-0\">{it.badge}</span>\n ) : null}\n {it.hint ? (\n <kbd className=\"relative z-10 rounded border border-border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground\">\n {it.hint}\n </kbd>\n ) : null}\n </button>\n );\n })}\n </div>\n ))\n )}\n </div>\n </motion.div>\n </div>\n </div>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;;AA+BA,SAAS,WAAW,QAAgB,KAAa;CAC/C,IAAI,CAAC,QAAQ,OAAO;CACpB,SAAS,OAAO,YAAY;CAC5B,MAAM,IAAI,YAAY;CACtB,IAAI,IAAI;CACR,KAAK,MAAM,MAAM,KAAK;EACpB,IAAI,OAAO,OAAO,IAAI;EACtB,IAAI,MAAM,OAAO,QAAQ,OAAO;CAClC;CACA,OAAO;AACT;AAIA,MAAM,eAAe;CACnB,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,SA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AA,GAAG,EAgDF;MAEZ,CAAC,CACE;KAhEK,GAAA,KAgEL,CACN;IAEA,CAAA,CACK;;EACT,CAAA,CACF;CACL,CAAA,GAAA,SAAS,IACX;AACF"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { EASE_OUT, SPRING_LAYOUT, SPRING_PANEL } from "../../lib/ease.js";
|
|
3
3
|
import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { cn } from "@kumix/utils";
|
|
5
|
-
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
5
|
import { Check } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
8
8
|
import { createPortal } from "react-dom";
|
|
9
9
|
//#region src/components/motion/context-menu.tsx
|
|
10
10
|
const VIEWPORT_PADDING = 8;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Children, useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { cn } from "@kumix/utils";
|
|
4
|
-
import { animate, motion, useMotionValue, useReducedMotion, useTransform } from "motion/react";
|
|
5
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { animate, motion, useMotionValue, useReducedMotion, useTransform } from "motion/react";
|
|
6
6
|
//#region src/components/motion/cylinder-carousel.tsx
|
|
7
7
|
const GLIDE_SPRING = {
|
|
8
8
|
stiffness: 40,
|