kineto 0.1.0
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/LICENSE +21 -0
- package/README.md +279 -0
- package/base.css +46 -0
- package/dist/accordion.d.ts +13 -0
- package/dist/accordion.js +161 -0
- package/dist/accordion.js.map +1 -0
- package/dist/alert.d.ts +20 -0
- package/dist/alert.js +137 -0
- package/dist/alert.js.map +1 -0
- package/dist/animated-number.d.ts +16 -0
- package/dist/animated-number.js +40 -0
- package/dist/animated-number.js.map +1 -0
- package/dist/area-chart.d.ts +16 -0
- package/dist/area-chart.js +138 -0
- package/dist/area-chart.js.map +1 -0
- package/dist/aspect-ratio.d.ts +6 -0
- package/dist/aspect-ratio.js +9 -0
- package/dist/aspect-ratio.js.map +1 -0
- package/dist/avatar.d.ts +18 -0
- package/dist/avatar.js +202 -0
- package/dist/avatar.js.map +1 -0
- package/dist/badge.d.ts +14 -0
- package/dist/badge.js +54 -0
- package/dist/badge.js.map +1 -0
- package/dist/bar-chart.d.ts +19 -0
- package/dist/bar-chart.js +139 -0
- package/dist/bar-chart.js.map +1 -0
- package/dist/bento-grid.d.ts +24 -0
- package/dist/bento-grid.js +129 -0
- package/dist/bento-grid.js.map +1 -0
- package/dist/breadcrumbs.d.ts +13 -0
- package/dist/breadcrumbs.js +50 -0
- package/dist/breadcrumbs.js.map +1 -0
- package/dist/button-group.d.ts +9 -0
- package/dist/button-group.js +29 -0
- package/dist/button-group.js.map +1 -0
- package/dist/button.d.ts +16 -0
- package/dist/button.js +131 -0
- package/dist/button.js.map +1 -0
- package/dist/calendar.d.ts +11 -0
- package/dist/calendar.js +185 -0
- package/dist/calendar.js.map +1 -0
- package/dist/card.d.ts +15 -0
- package/dist/card.js +131 -0
- package/dist/card.js.map +1 -0
- package/dist/carousel.d.ts +14 -0
- package/dist/carousel.js +143 -0
- package/dist/carousel.js.map +1 -0
- package/dist/chart-tooltip.d.ts +18 -0
- package/dist/chart-tooltip.js +30 -0
- package/dist/chart-tooltip.js.map +1 -0
- package/dist/checkbox.d.ts +6 -0
- package/dist/checkbox.js +88 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/cn.d.ts +10 -0
- package/dist/cn.js +10 -0
- package/dist/cn.js.map +1 -0
- package/dist/code-block.d.ts +25 -0
- package/dist/code-block.js +155 -0
- package/dist/code-block.js.map +1 -0
- package/dist/collapsible.d.ts +12 -0
- package/dist/collapsible.js +125 -0
- package/dist/collapsible.js.map +1 -0
- package/dist/color-picker.d.ts +12 -0
- package/dist/color-picker.js +180 -0
- package/dist/color-picker.js.map +1 -0
- package/dist/command.d.ts +88 -0
- package/dist/command.js +277 -0
- package/dist/command.js.map +1 -0
- package/dist/confetti.d.ts +25 -0
- package/dist/confetti.js +109 -0
- package/dist/confetti.js.map +1 -0
- package/dist/container.d.ts +19 -0
- package/dist/container.js +41 -0
- package/dist/container.js.map +1 -0
- package/dist/content-divider.d.ts +7 -0
- package/dist/content-divider.js +35 -0
- package/dist/content-divider.js.map +1 -0
- package/dist/context-menu.d.ts +30 -0
- package/dist/context-menu.js +213 -0
- package/dist/context-menu.js.map +1 -0
- package/dist/copy-button.d.ts +17 -0
- package/dist/copy-button.js +107 -0
- package/dist/copy-button.js.map +1 -0
- package/dist/dashboard-showcase.d.ts +7 -0
- package/dist/dashboard-showcase.js +2560 -0
- package/dist/dashboard-showcase.js.map +1 -0
- package/dist/data-table.d.ts +130 -0
- package/dist/data-table.js +1620 -0
- package/dist/data-table.js.map +1 -0
- package/dist/date-picker.d.ts +12 -0
- package/dist/date-picker.js +261 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/dialog.d.ts +23 -0
- package/dist/dialog.js +188 -0
- package/dist/dialog.js.map +1 -0
- package/dist/dock.d.ts +17 -0
- package/dist/dock.js +77 -0
- package/dist/dock.js.map +1 -0
- package/dist/donut-chart.d.ts +18 -0
- package/dist/donut-chart.js +92 -0
- package/dist/donut-chart.js.map +1 -0
- package/dist/drawer.d.ts +26 -0
- package/dist/drawer.js +166 -0
- package/dist/drawer.js.map +1 -0
- package/dist/dropdown-menu.d.ts +22 -0
- package/dist/dropdown-menu.js +163 -0
- package/dist/dropdown-menu.js.map +1 -0
- package/dist/empty-state.d.ts +13 -0
- package/dist/empty-state.js +149 -0
- package/dist/empty-state.js.map +1 -0
- package/dist/featured-icon.d.ts +16 -0
- package/dist/featured-icon.js +56 -0
- package/dist/featured-icon.js.map +1 -0
- package/dist/file-uploader.d.ts +11 -0
- package/dist/file-uploader.js +212 -0
- package/dist/file-uploader.js.map +1 -0
- package/dist/flex.d.ts +30 -0
- package/dist/flex.js +89 -0
- package/dist/flex.js.map +1 -0
- package/dist/form.d.ts +28 -0
- package/dist/form.js +139 -0
- package/dist/form.js.map +1 -0
- package/dist/format-time.d.ts +18 -0
- package/dist/format-time.js +54 -0
- package/dist/format-time.js.map +1 -0
- package/dist/gap.d.ts +9 -0
- package/dist/gap.js +34 -0
- package/dist/gap.js.map +1 -0
- package/dist/gradient-border.d.ts +15 -0
- package/dist/gradient-border.js +79 -0
- package/dist/gradient-border.js.map +1 -0
- package/dist/gradient-text.d.ts +12 -0
- package/dist/gradient-text.js +43 -0
- package/dist/gradient-text.js.map +1 -0
- package/dist/grid.d.ts +25 -0
- package/dist/grid.js +77 -0
- package/dist/grid.js.map +1 -0
- package/dist/hover-card.d.ts +8 -0
- package/dist/hover-card.js +93 -0
- package/dist/hover-card.js.map +1 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +93 -0
- package/dist/inline-edit.d.ts +20 -0
- package/dist/inline-edit.js +107 -0
- package/dist/inline-edit.js.map +1 -0
- package/dist/input.d.ts +6 -0
- package/dist/input.js +31 -0
- package/dist/input.js.map +1 -0
- package/dist/kbd.d.ts +16 -0
- package/dist/kbd.js +35 -0
- package/dist/kbd.js.map +1 -0
- package/dist/label.d.ts +6 -0
- package/dist/label.js +31 -0
- package/dist/label.js.map +1 -0
- package/dist/line-chart.d.ts +17 -0
- package/dist/line-chart.js +120 -0
- package/dist/line-chart.js.map +1 -0
- package/dist/logo-cloud.d.ts +14 -0
- package/dist/logo-cloud.js +106 -0
- package/dist/logo-cloud.js.map +1 -0
- package/dist/masonry.d.ts +15 -0
- package/dist/masonry.js +63 -0
- package/dist/masonry.js.map +1 -0
- package/dist/menubar.d.ts +31 -0
- package/dist/menubar.js +250 -0
- package/dist/menubar.js.map +1 -0
- package/dist/motion-presets.d.ts +70 -0
- package/dist/motion-presets.js +71 -0
- package/dist/motion-presets.js.map +1 -0
- package/dist/navigation-menu.d.ts +15 -0
- package/dist/navigation-menu.js +181 -0
- package/dist/navigation-menu.js.map +1 -0
- package/dist/notification-center.d.ts +35 -0
- package/dist/notification-center.js +384 -0
- package/dist/notification-center.js.map +1 -0
- package/dist/page-header.d.ts +13 -0
- package/dist/page-header.js +37 -0
- package/dist/page-header.js.map +1 -0
- package/dist/pagination.d.ts +13 -0
- package/dist/pagination.js +103 -0
- package/dist/pagination.js.map +1 -0
- package/dist/popover.d.ts +9 -0
- package/dist/popover.js +93 -0
- package/dist/popover.js.map +1 -0
- package/dist/progress-steps.d.ts +17 -0
- package/dist/progress-steps.js +158 -0
- package/dist/progress-steps.js.map +1 -0
- package/dist/progress.d.ts +13 -0
- package/dist/progress.js +98 -0
- package/dist/progress.js.map +1 -0
- package/dist/radio-group.d.ts +7 -0
- package/dist/radio-group.js +94 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/rating.d.ts +18 -0
- package/dist/rating.js +122 -0
- package/dist/rating.js.map +1 -0
- package/dist/relative-time.d.ts +19 -0
- package/dist/relative-time.js +187 -0
- package/dist/relative-time.js.map +1 -0
- package/dist/resizable.d.ts +27 -0
- package/dist/resizable.js +50 -0
- package/dist/resizable.js.map +1 -0
- package/dist/scroll-area.d.ts +20 -0
- package/dist/scroll-area.js +94 -0
- package/dist/scroll-area.js.map +1 -0
- package/dist/segmented-control.d.ts +16 -0
- package/dist/segmented-control.js +139 -0
- package/dist/segmented-control.js.map +1 -0
- package/dist/select.d.ts +13 -0
- package/dist/select.js +153 -0
- package/dist/select.js.map +1 -0
- package/dist/separator.d.ts +6 -0
- package/dist/separator.js +36 -0
- package/dist/separator.js.map +1 -0
- package/dist/sidebar.d.ts +24 -0
- package/dist/sidebar.js +150 -0
- package/dist/sidebar.js.map +1 -0
- package/dist/skeleton.d.ts +6 -0
- package/dist/skeleton.js +42 -0
- package/dist/skeleton.js.map +1 -0
- package/dist/slider.d.ts +6 -0
- package/dist/slider.js +44 -0
- package/dist/slider.js.map +1 -0
- package/dist/social-button.d.ts +14 -0
- package/dist/social-button.js +203 -0
- package/dist/social-button.js.map +1 -0
- package/dist/spacer.d.ts +19 -0
- package/dist/spacer.js +52 -0
- package/dist/spacer.js.map +1 -0
- package/dist/spinner.d.ts +15 -0
- package/dist/spinner.js +48 -0
- package/dist/spinner.js.map +1 -0
- package/dist/stack.d.ts +27 -0
- package/dist/stack.js +77 -0
- package/dist/stack.js.map +1 -0
- package/dist/stat-card.d.ts +26 -0
- package/dist/stat-card.js +198 -0
- package/dist/stat-card.js.map +1 -0
- package/dist/status-dot.d.ts +26 -0
- package/dist/status-dot.js +68 -0
- package/dist/status-dot.js.map +1 -0
- package/dist/switch.d.ts +6 -0
- package/dist/switch.js +108 -0
- package/dist/switch.js.map +1 -0
- package/dist/tabs.d.ts +13 -0
- package/dist/tabs.js +167 -0
- package/dist/tabs.js.map +1 -0
- package/dist/tag.d.ts +16 -0
- package/dist/tag.js +53 -0
- package/dist/tag.js.map +1 -0
- package/dist/textarea.d.ts +6 -0
- package/dist/textarea.js +30 -0
- package/dist/textarea.js.map +1 -0
- package/dist/theme-switcher.d.ts +16 -0
- package/dist/theme-switcher.js +170 -0
- package/dist/theme-switcher.js.map +1 -0
- package/dist/toast.d.ts +20 -0
- package/dist/toast.js +162 -0
- package/dist/toast.js.map +1 -0
- package/dist/tooltip.d.ts +14 -0
- package/dist/tooltip.js +98 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/tree-view.d.ts +16 -0
- package/dist/tree-view.js +123 -0
- package/dist/tree-view.js.map +1 -0
- package/dist/truncate.d.ts +16 -0
- package/dist/truncate.js +151 -0
- package/dist/truncate.js.map +1 -0
- package/dist/use-reduced-motion.d.ts +15 -0
- package/dist/use-reduced-motion.js +11 -0
- package/dist/use-reduced-motion.js.map +1 -0
- package/dist/verification-code-input.d.ts +12 -0
- package/dist/verification-code-input.js +90 -0
- package/dist/verification-code-input.js.map +1 -0
- package/package.json +131 -0
- package/theme.css +343 -0
package/dist/toast.js
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/ui/toast.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
6
|
+
import {
|
|
7
|
+
CircleAlert,
|
|
8
|
+
CircleCheck,
|
|
9
|
+
Info,
|
|
10
|
+
TriangleAlert,
|
|
11
|
+
X
|
|
12
|
+
} from "lucide-react";
|
|
13
|
+
|
|
14
|
+
// src/lib/cn.ts
|
|
15
|
+
import { clsx } from "clsx";
|
|
16
|
+
import { twMerge } from "tailwind-merge";
|
|
17
|
+
function cn(...inputs) {
|
|
18
|
+
return twMerge(clsx(inputs));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// src/lib/motion-presets.ts
|
|
22
|
+
var spring = {
|
|
23
|
+
/** Quick, decisive — buttons, indicators, dropdowns. */
|
|
24
|
+
snappy: { type: "spring", stiffness: 420, damping: 32, mass: 0.8 },
|
|
25
|
+
/** Calm and weighty — dialogs, cards, larger surfaces. */
|
|
26
|
+
soft: { type: "spring", stiffness: 180, damping: 26 },
|
|
27
|
+
/** Playful overshoot — badges, toggles, delight moments. Use sparingly. */
|
|
28
|
+
bouncy: { type: "spring", stiffness: 480, damping: 18, mass: 0.9 }
|
|
29
|
+
};
|
|
30
|
+
var tween = {
|
|
31
|
+
/** The signature easing — an expressive ease-out for orchestrated reveals. */
|
|
32
|
+
smooth: { type: "tween", duration: 0.45, ease: [0.22, 1, 0.36, 1] },
|
|
33
|
+
/** Faster variant for small elements. */
|
|
34
|
+
quick: { type: "tween", duration: 0.28, ease: [0.22, 1, 0.36, 1] },
|
|
35
|
+
/** Longer, settled curve for drawing charts, count-ups, and progress fills. */
|
|
36
|
+
draw: { type: "tween", duration: 1.1, ease: [0.16, 1, 0.3, 1] }
|
|
37
|
+
};
|
|
38
|
+
var fadeUp = {
|
|
39
|
+
hidden: { opacity: 0, y: 18 },
|
|
40
|
+
visible: { opacity: 1, y: 0, transition: tween.smooth }
|
|
41
|
+
};
|
|
42
|
+
var fadeIn = {
|
|
43
|
+
hidden: { opacity: 0 },
|
|
44
|
+
visible: { opacity: 1, transition: tween.smooth }
|
|
45
|
+
};
|
|
46
|
+
var scaleIn = {
|
|
47
|
+
hidden: { opacity: 0, scale: 0.96 },
|
|
48
|
+
visible: { opacity: 1, scale: 1, transition: spring.soft }
|
|
49
|
+
};
|
|
50
|
+
var slideInLeft = {
|
|
51
|
+
hidden: { opacity: 0, x: -28 },
|
|
52
|
+
visible: { opacity: 1, x: 0, transition: tween.smooth }
|
|
53
|
+
};
|
|
54
|
+
var slideInRight = {
|
|
55
|
+
hidden: { opacity: 0, x: 28 },
|
|
56
|
+
visible: { opacity: 1, x: 0, transition: tween.smooth }
|
|
57
|
+
};
|
|
58
|
+
var blurIn = {
|
|
59
|
+
hidden: { opacity: 0, filter: "blur(12px)" },
|
|
60
|
+
visible: { opacity: 1, filter: "blur(0px)", transition: tween.smooth }
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// src/components/ui/toast.tsx
|
|
64
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
65
|
+
var items = [];
|
|
66
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
67
|
+
function emit() {
|
|
68
|
+
for (const listener of listeners) listener(items);
|
|
69
|
+
}
|
|
70
|
+
function toast(options) {
|
|
71
|
+
const id = options.id ?? Math.random().toString(36).slice(2);
|
|
72
|
+
const item = { duration: 4e3, variant: "default", ...options, id };
|
|
73
|
+
items = [...items.filter((t) => t.id !== id), item];
|
|
74
|
+
emit();
|
|
75
|
+
if (item.duration && item.duration > 0) {
|
|
76
|
+
setTimeout(() => dismissToast(id), item.duration);
|
|
77
|
+
}
|
|
78
|
+
return id;
|
|
79
|
+
}
|
|
80
|
+
function dismissToast(id) {
|
|
81
|
+
items = items.filter((t) => t.id !== id);
|
|
82
|
+
emit();
|
|
83
|
+
}
|
|
84
|
+
function useToasts() {
|
|
85
|
+
const [state, setState] = React.useState(items);
|
|
86
|
+
React.useEffect(() => {
|
|
87
|
+
listeners.add(setState);
|
|
88
|
+
setState(items);
|
|
89
|
+
return () => {
|
|
90
|
+
listeners.delete(setState);
|
|
91
|
+
};
|
|
92
|
+
}, []);
|
|
93
|
+
return state;
|
|
94
|
+
}
|
|
95
|
+
var icons = {
|
|
96
|
+
default: Info,
|
|
97
|
+
brand: Info,
|
|
98
|
+
success: CircleCheck,
|
|
99
|
+
warning: TriangleAlert,
|
|
100
|
+
destructive: CircleAlert
|
|
101
|
+
};
|
|
102
|
+
var iconColor = {
|
|
103
|
+
default: "text-muted-foreground",
|
|
104
|
+
brand: "text-brand",
|
|
105
|
+
success: "text-success",
|
|
106
|
+
warning: "text-warning",
|
|
107
|
+
destructive: "text-destructive"
|
|
108
|
+
};
|
|
109
|
+
function Toaster({ position = "bottom-right" }) {
|
|
110
|
+
const toasts = useToasts();
|
|
111
|
+
return /* @__PURE__ */ jsx(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
"aria-live": "polite",
|
|
115
|
+
className: cn(
|
|
116
|
+
"pointer-events-none fixed z-[100] flex w-full max-w-sm flex-col gap-2 p-4",
|
|
117
|
+
position === "top-right" && "right-0 top-0",
|
|
118
|
+
position === "bottom-right" && "bottom-0 right-0",
|
|
119
|
+
position === "bottom-center" && "bottom-0 left-1/2 -translate-x-1/2"
|
|
120
|
+
),
|
|
121
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: toasts.map((t) => {
|
|
122
|
+
const variant = t.variant ?? "default";
|
|
123
|
+
const Icon = icons[variant];
|
|
124
|
+
return /* @__PURE__ */ jsxs(
|
|
125
|
+
motion.div,
|
|
126
|
+
{
|
|
127
|
+
layout: true,
|
|
128
|
+
initial: { opacity: 0, x: 48, scale: 0.96 },
|
|
129
|
+
animate: { opacity: 1, x: 0, scale: 1 },
|
|
130
|
+
exit: { opacity: 0, x: 48, scale: 0.96 },
|
|
131
|
+
transition: spring.snappy,
|
|
132
|
+
className: "pointer-events-auto flex items-start gap-3 rounded-xl border border-border bg-popover p-4 shadow-lift",
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ jsx(Icon, { className: cn("mt-0.5 size-5 shrink-0", iconColor[variant]) }),
|
|
135
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
136
|
+
t.title ? /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: t.title }) : null,
|
|
137
|
+
t.description ? /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-sm text-muted-foreground", children: t.description }) : null
|
|
138
|
+
] }),
|
|
139
|
+
/* @__PURE__ */ jsx(
|
|
140
|
+
"button",
|
|
141
|
+
{
|
|
142
|
+
type: "button",
|
|
143
|
+
"aria-label": "Dismiss",
|
|
144
|
+
onClick: () => dismissToast(t.id),
|
|
145
|
+
className: "-mr-1 -mt-1 inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
146
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-4" })
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
t.id
|
|
152
|
+
);
|
|
153
|
+
}) })
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
export {
|
|
158
|
+
Toaster,
|
|
159
|
+
dismissToast,
|
|
160
|
+
toast
|
|
161
|
+
};
|
|
162
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/toast.tsx","../src/lib/cn.ts","../src/lib/motion-presets.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport {\n CircleAlert,\n CircleCheck,\n Info,\n TriangleAlert,\n X,\n type LucideIcon,\n} from \"lucide-react\";\n\nimport { cn } from \"@/lib/cn\";\nimport { spring } from \"@/lib/motion-presets\";\n\nexport type ToastVariant = \"default\" | \"brand\" | \"success\" | \"warning\" | \"destructive\";\n\nexport interface ToastOptions {\n id?: string;\n title?: React.ReactNode;\n description?: React.ReactNode;\n variant?: ToastVariant;\n /** Auto-dismiss after ms. 0 keeps it open. */\n duration?: number;\n}\n\ninterface ToastItem extends ToastOptions {\n id: string;\n}\n\n/* Minimal motion-powered toast store — no provider required, just render <Toaster />. */\nlet items: ToastItem[] = [];\nconst listeners = new Set<(items: ToastItem[]) => void>();\n\nfunction emit() {\n for (const listener of listeners) listener(items);\n}\n\nexport function toast(options: ToastOptions): string {\n const id = options.id ?? Math.random().toString(36).slice(2);\n const item: ToastItem = { duration: 4000, variant: \"default\", ...options, id };\n items = [...items.filter((t) => t.id !== id), item];\n emit();\n if (item.duration && item.duration > 0) {\n setTimeout(() => dismissToast(id), item.duration);\n }\n return id;\n}\n\nexport function dismissToast(id: string) {\n items = items.filter((t) => t.id !== id);\n emit();\n}\n\nfunction useToasts(): ToastItem[] {\n const [state, setState] = React.useState<ToastItem[]>(items);\n React.useEffect(() => {\n listeners.add(setState);\n setState(items);\n return () => {\n listeners.delete(setState);\n };\n }, []);\n return state;\n}\n\nconst icons: Record<ToastVariant, LucideIcon> = {\n default: Info,\n brand: Info,\n success: CircleCheck,\n warning: TriangleAlert,\n destructive: CircleAlert,\n};\n\nconst iconColor: Record<ToastVariant, string> = {\n default: \"text-muted-foreground\",\n brand: \"text-brand\",\n success: \"text-success\",\n warning: \"text-warning\",\n destructive: \"text-destructive\",\n};\n\nexport interface ToasterProps {\n position?: \"bottom-right\" | \"top-right\" | \"bottom-center\";\n}\n\nexport function Toaster({ position = \"bottom-right\" }: ToasterProps) {\n const toasts = useToasts();\n\n return (\n <div\n aria-live=\"polite\"\n className={cn(\n \"pointer-events-none fixed z-[100] flex w-full max-w-sm flex-col gap-2 p-4\",\n position === \"top-right\" && \"right-0 top-0\",\n position === \"bottom-right\" && \"bottom-0 right-0\",\n position === \"bottom-center\" && \"bottom-0 left-1/2 -translate-x-1/2\"\n )}\n >\n <AnimatePresence initial={false}>\n {toasts.map((t) => {\n const variant = t.variant ?? \"default\";\n const Icon = icons[variant];\n return (\n <motion.div\n key={t.id}\n layout\n initial={{ opacity: 0, x: 48, scale: 0.96 }}\n animate={{ opacity: 1, x: 0, scale: 1 }}\n exit={{ opacity: 0, x: 48, scale: 0.96 }}\n transition={spring.snappy}\n className=\"pointer-events-auto flex items-start gap-3 rounded-xl border border-border bg-popover p-4 shadow-lift\"\n >\n <Icon className={cn(\"mt-0.5 size-5 shrink-0\", iconColor[variant])} />\n <div className=\"flex-1\">\n {t.title ? (\n <p className=\"text-sm font-medium text-foreground\">{t.title}</p>\n ) : null}\n {t.description ? (\n <p className=\"mt-0.5 text-sm text-muted-foreground\">\n {t.description}\n </p>\n ) : null}\n </div>\n <button\n type=\"button\"\n aria-label=\"Dismiss\"\n onClick={() => dismissToast(t.id)}\n className=\"-mr-1 -mt-1 inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n <X className=\"size-4\" />\n </button>\n </motion.div>\n );\n })}\n </AnimatePresence>\n </div>\n );\n}\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind-aware conflict resolution.\n * Every Kineto component accepts `className` and merges it through `cn()`,\n * so consumer overrides always win over the component's defaults.\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import type { Transition, Variants, Target } from \"motion/react\";\n\n/* -------------------------------------------------------------------------------------------------\n * Transition tokens\n * The named physics every component references. Tune these in one place and the whole\n * library re-tunes. Prefer springs for anything interactive; reserve tweens for orchestrated\n * entrances where you want a precise, repeatable curve.\n * ----------------------------------------------------------------------------------------------- */\n\nexport const spring = {\n /** Quick, decisive — buttons, indicators, dropdowns. */\n snappy: { type: \"spring\", stiffness: 420, damping: 32, mass: 0.8 },\n /** Calm and weighty — dialogs, cards, larger surfaces. */\n soft: { type: \"spring\", stiffness: 180, damping: 26 },\n /** Playful overshoot — badges, toggles, delight moments. Use sparingly. */\n bouncy: { type: \"spring\", stiffness: 480, damping: 18, mass: 0.9 },\n} satisfies Record<string, Transition>;\n\nexport const tween = {\n /** The signature easing — an expressive ease-out for orchestrated reveals. */\n smooth: { type: \"tween\", duration: 0.45, ease: [0.22, 1, 0.36, 1] },\n /** Faster variant for small elements. */\n quick: { type: \"tween\", duration: 0.28, ease: [0.22, 1, 0.36, 1] },\n /** Longer, settled curve for drawing charts, count-ups, and progress fills. */\n draw: { type: \"tween\", duration: 1.1, ease: [0.16, 1, 0.3, 1] },\n} satisfies Record<string, Transition>;\n\n/* -------------------------------------------------------------------------------------------------\n * Reveal variants\n * Named hidden→visible pairs. Pair with `initial=\"hidden\"` + `animate=\"visible\"`, or with\n * `whileInView=\"visible\"` for scroll-triggered sections (see `viewportOnce`).\n * ----------------------------------------------------------------------------------------------- */\n\nexport const fadeUp: Variants = {\n hidden: { opacity: 0, y: 18 },\n visible: { opacity: 1, y: 0, transition: tween.smooth },\n};\n\nexport const fadeIn: Variants = {\n hidden: { opacity: 0 },\n visible: { opacity: 1, transition: tween.smooth },\n};\n\nexport const scaleIn: Variants = {\n hidden: { opacity: 0, scale: 0.96 },\n visible: { opacity: 1, scale: 1, transition: spring.soft },\n};\n\nexport const slideInLeft: Variants = {\n hidden: { opacity: 0, x: -28 },\n visible: { opacity: 1, x: 0, transition: tween.smooth },\n};\n\nexport const slideInRight: Variants = {\n hidden: { opacity: 0, x: 28 },\n visible: { opacity: 1, x: 0, transition: tween.smooth },\n};\n\nexport const blurIn: Variants = {\n hidden: { opacity: 0, filter: \"blur(12px)\" },\n visible: { opacity: 1, filter: \"blur(0px)\", transition: tween.smooth },\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Stagger helpers\n * Wrap a list/grid in a container using `staggerContainer()` and give each child `staggerItem`\n * (or any reveal variant). One wrapper orchestrates the whole sequence.\n * ----------------------------------------------------------------------------------------------- */\n\nexport const staggerContainer = (stagger = 0.08, delay = 0): Variants => ({\n hidden: {},\n visible: {\n transition: { staggerChildren: stagger, delayChildren: delay },\n },\n});\n\n/** The default child for a stagger container. Aliased to `fadeUp` so sequences feel cohesive. */\nexport const staggerItem: Variants = fadeUp;\n\n/* -------------------------------------------------------------------------------------------------\n * Interaction presets\n * Standardized tap/hover targets. Note: controls (buttons, selects, anything that can act as a\n * trigger/anchor) should NOT shift on hover — moving a trigger while its popover/tooltip animates\n * in reads as two competing motions. Use color + press feedback there instead. A very subtle\n * scale-up is reserved for non-anchored content surfaces (cards/tiles) via `cardHover`.\n * Spread into `whileHover` / `whileTap`.\n * ----------------------------------------------------------------------------------------------- */\n\nexport const interaction = {\n /** Press feedback for buttons and clickable chips. */\n tap: { scale: 0.97 } satisfies Target,\n /** Very subtle scale-up for non-anchored content surfaces (cards/tiles) — never for triggers.\n * A gentle swell reads calmer than a positional lift and doesn't nudge neighbouring content. */\n cardHover: { scale: 1.02 } satisfies Target,\n} as const;\n\n/* -------------------------------------------------------------------------------------------------\n * Viewport config\n * The shared `whileInView` viewport so every scroll reveal triggers at the same threshold,\n * exactly once.\n * ----------------------------------------------------------------------------------------------- */\n\nexport const viewportOnce = { once: true, margin: \"-15%\" } as const;\n"],"mappings":";;;AAEA,YAAY,WAAW;AACvB,SAAS,iBAAiB,cAAc;AACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA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AAAA;AAAA;AAAA,UA1BK,EAAE;AAAA,QA2BT;AAAA,MAEJ,CAAC,GACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
4
|
+
|
|
5
|
+
declare const Tooltip: {
|
|
6
|
+
({ delayDuration, children, ...props }: TooltipPrimitive.TooltipProps & {
|
|
7
|
+
delayDuration?: number;
|
|
8
|
+
}): react_jsx_runtime.JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
|
|
14
|
+
export { Tooltip, TooltipContent, TooltipTrigger };
|
package/dist/tooltip.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/ui/tooltip.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
6
|
+
import { motion } from "motion/react";
|
|
7
|
+
|
|
8
|
+
// src/lib/cn.ts
|
|
9
|
+
import { clsx } from "clsx";
|
|
10
|
+
import { twMerge } from "tailwind-merge";
|
|
11
|
+
function cn(...inputs) {
|
|
12
|
+
return twMerge(clsx(inputs));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// src/lib/motion-presets.ts
|
|
16
|
+
var spring = {
|
|
17
|
+
/** Quick, decisive — buttons, indicators, dropdowns. */
|
|
18
|
+
snappy: { type: "spring", stiffness: 420, damping: 32, mass: 0.8 },
|
|
19
|
+
/** Calm and weighty — dialogs, cards, larger surfaces. */
|
|
20
|
+
soft: { type: "spring", stiffness: 180, damping: 26 },
|
|
21
|
+
/** Playful overshoot — badges, toggles, delight moments. Use sparingly. */
|
|
22
|
+
bouncy: { type: "spring", stiffness: 480, damping: 18, mass: 0.9 }
|
|
23
|
+
};
|
|
24
|
+
var tween = {
|
|
25
|
+
/** The signature easing — an expressive ease-out for orchestrated reveals. */
|
|
26
|
+
smooth: { type: "tween", duration: 0.45, ease: [0.22, 1, 0.36, 1] },
|
|
27
|
+
/** Faster variant for small elements. */
|
|
28
|
+
quick: { type: "tween", duration: 0.28, ease: [0.22, 1, 0.36, 1] },
|
|
29
|
+
/** Longer, settled curve for drawing charts, count-ups, and progress fills. */
|
|
30
|
+
draw: { type: "tween", duration: 1.1, ease: [0.16, 1, 0.3, 1] }
|
|
31
|
+
};
|
|
32
|
+
var fadeUp = {
|
|
33
|
+
hidden: { opacity: 0, y: 18 },
|
|
34
|
+
visible: { opacity: 1, y: 0, transition: tween.smooth }
|
|
35
|
+
};
|
|
36
|
+
var fadeIn = {
|
|
37
|
+
hidden: { opacity: 0 },
|
|
38
|
+
visible: { opacity: 1, transition: tween.smooth }
|
|
39
|
+
};
|
|
40
|
+
var scaleIn = {
|
|
41
|
+
hidden: { opacity: 0, scale: 0.96 },
|
|
42
|
+
visible: { opacity: 1, scale: 1, transition: spring.soft }
|
|
43
|
+
};
|
|
44
|
+
var slideInLeft = {
|
|
45
|
+
hidden: { opacity: 0, x: -28 },
|
|
46
|
+
visible: { opacity: 1, x: 0, transition: tween.smooth }
|
|
47
|
+
};
|
|
48
|
+
var slideInRight = {
|
|
49
|
+
hidden: { opacity: 0, x: 28 },
|
|
50
|
+
visible: { opacity: 1, x: 0, transition: tween.smooth }
|
|
51
|
+
};
|
|
52
|
+
var blurIn = {
|
|
53
|
+
hidden: { opacity: 0, filter: "blur(12px)" },
|
|
54
|
+
visible: { opacity: 1, filter: "blur(0px)", transition: tween.smooth }
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// src/components/ui/tooltip.tsx
|
|
58
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
59
|
+
var Tooltip = ({
|
|
60
|
+
delayDuration = 200,
|
|
61
|
+
children,
|
|
62
|
+
...props
|
|
63
|
+
}) => /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { delayDuration, children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { ...props, children }) });
|
|
64
|
+
Tooltip.displayName = "Tooltip";
|
|
65
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
66
|
+
var TooltipContent = React.forwardRef(({ className, sideOffset = 6, children, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
67
|
+
TooltipPrimitive.Content,
|
|
68
|
+
{
|
|
69
|
+
ref,
|
|
70
|
+
sideOffset,
|
|
71
|
+
className: "z-50",
|
|
72
|
+
...props,
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
motion.div,
|
|
76
|
+
{
|
|
77
|
+
initial: { opacity: 0, scale: 0.96 },
|
|
78
|
+
animate: { opacity: 1, scale: 1 },
|
|
79
|
+
transition: spring.snappy,
|
|
80
|
+
style: { transformOrigin: "var(--radix-tooltip-content-transform-origin)" },
|
|
81
|
+
className: cn(
|
|
82
|
+
"max-w-xs rounded-md bg-foreground px-2.5 py-1.5 text-xs font-medium text-background shadow-lift",
|
|
83
|
+
className
|
|
84
|
+
),
|
|
85
|
+
children
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ jsx(TooltipPrimitive.Arrow, { className: "fill-foreground" })
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
) }));
|
|
92
|
+
TooltipContent.displayName = "TooltipContent";
|
|
93
|
+
export {
|
|
94
|
+
Tooltip,
|
|
95
|
+
TooltipContent,
|
|
96
|
+
TooltipTrigger
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/tooltip.tsx","../src/lib/cn.ts","../src/lib/motion-presets.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { motion } from \"motion/react\";\n\nimport { cn } from \"@/lib/cn\";\nimport { spring } from \"@/lib/motion-presets\";\n\n/* Provider is embedded so a Tooltip is drop-in with no app-level wiring required. */\nconst Tooltip = ({\n delayDuration = 200,\n children,\n ...props\n}: TooltipPrimitive.TooltipProps & { delayDuration?: number }) => (\n <TooltipPrimitive.Provider delayDuration={delayDuration}>\n <TooltipPrimitive.Root {...props}>{children}</TooltipPrimitive.Root>\n </TooltipPrimitive.Provider>\n);\nTooltip.displayName = \"Tooltip\";\n\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 6, children, ...props }, ref) => (\n <TooltipPrimitive.Portal>\n {/* Content handles popper positioning; the inner motion.div animates from the\n Radix-provided transform origin so it grows out of the trigger. */}\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className=\"z-50\"\n {...props}\n >\n <motion.div\n initial={{ opacity: 0, scale: 0.96 }}\n animate={{ opacity: 1, scale: 1 }}\n transition={spring.snappy}\n style={{ transformOrigin: \"var(--radix-tooltip-content-transform-origin)\" }}\n className={cn(\n \"max-w-xs rounded-md bg-foreground px-2.5 py-1.5 text-xs font-medium text-background shadow-lift\",\n className\n )}\n >\n {children}\n </motion.div>\n <TooltipPrimitive.Arrow className=\"fill-foreground\" />\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n));\nTooltipContent.displayName = \"TooltipContent\";\n\nexport { Tooltip, TooltipTrigger, TooltipContent };\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind-aware conflict resolution.\n * Every Kineto component accepts `className` and merges it through `cn()`,\n * so consumer overrides always win over the component's defaults.\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import type { Transition, Variants, Target } from \"motion/react\";\n\n/* -------------------------------------------------------------------------------------------------\n * Transition tokens\n * The named physics every component references. Tune these in one place and the whole\n * library re-tunes. Prefer springs for anything interactive; reserve tweens for orchestrated\n * entrances where you want a precise, repeatable curve.\n * ----------------------------------------------------------------------------------------------- */\n\nexport const spring = {\n /** Quick, decisive — buttons, indicators, dropdowns. */\n snappy: { type: \"spring\", stiffness: 420, damping: 32, mass: 0.8 },\n /** Calm and weighty — dialogs, cards, larger surfaces. */\n soft: { type: \"spring\", stiffness: 180, damping: 26 },\n /** Playful overshoot — badges, toggles, delight moments. Use sparingly. */\n bouncy: { type: \"spring\", stiffness: 480, damping: 18, mass: 0.9 },\n} satisfies Record<string, Transition>;\n\nexport const tween = {\n /** The signature easing — an expressive ease-out for orchestrated reveals. */\n smooth: { type: \"tween\", duration: 0.45, ease: [0.22, 1, 0.36, 1] },\n /** Faster variant for small elements. */\n quick: { type: \"tween\", duration: 0.28, ease: [0.22, 1, 0.36, 1] },\n /** Longer, settled curve for drawing charts, count-ups, and progress fills. */\n draw: { type: \"tween\", duration: 1.1, ease: [0.16, 1, 0.3, 1] },\n} satisfies Record<string, Transition>;\n\n/* -------------------------------------------------------------------------------------------------\n * Reveal variants\n * Named hidden→visible pairs. Pair with `initial=\"hidden\"` + `animate=\"visible\"`, or with\n * `whileInView=\"visible\"` for scroll-triggered sections (see `viewportOnce`).\n * ----------------------------------------------------------------------------------------------- */\n\nexport const fadeUp: Variants = {\n hidden: { opacity: 0, y: 18 },\n visible: { opacity: 1, y: 0, transition: tween.smooth },\n};\n\nexport const fadeIn: Variants = {\n hidden: { opacity: 0 },\n visible: { opacity: 1, transition: tween.smooth },\n};\n\nexport const scaleIn: Variants = {\n hidden: { opacity: 0, scale: 0.96 },\n visible: { opacity: 1, scale: 1, transition: spring.soft },\n};\n\nexport const slideInLeft: Variants = {\n hidden: { opacity: 0, x: -28 },\n visible: { opacity: 1, x: 0, transition: tween.smooth },\n};\n\nexport const slideInRight: Variants = {\n hidden: { opacity: 0, x: 28 },\n visible: { opacity: 1, x: 0, transition: tween.smooth },\n};\n\nexport const blurIn: Variants = {\n hidden: { opacity: 0, filter: \"blur(12px)\" },\n visible: { opacity: 1, filter: \"blur(0px)\", transition: tween.smooth },\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Stagger helpers\n * Wrap a list/grid in a container using `staggerContainer()` and give each child `staggerItem`\n * (or any reveal variant). One wrapper orchestrates the whole sequence.\n * ----------------------------------------------------------------------------------------------- */\n\nexport const staggerContainer = (stagger = 0.08, delay = 0): Variants => ({\n hidden: {},\n visible: {\n transition: { staggerChildren: stagger, delayChildren: delay },\n },\n});\n\n/** The default child for a stagger container. Aliased to `fadeUp` so sequences feel cohesive. */\nexport const staggerItem: Variants = fadeUp;\n\n/* -------------------------------------------------------------------------------------------------\n * Interaction presets\n * Standardized tap/hover targets. Note: controls (buttons, selects, anything that can act as a\n * trigger/anchor) should NOT shift on hover — moving a trigger while its popover/tooltip animates\n * in reads as two competing motions. Use color + press feedback there instead. A very subtle\n * scale-up is reserved for non-anchored content surfaces (cards/tiles) via `cardHover`.\n * Spread into `whileHover` / `whileTap`.\n * ----------------------------------------------------------------------------------------------- */\n\nexport const interaction = {\n /** Press feedback for buttons and clickable chips. */\n tap: { scale: 0.97 } satisfies Target,\n /** Very subtle scale-up for non-anchored content surfaces (cards/tiles) — never for triggers.\n * A gentle swell reads calmer than a positional lift and doesn't nudge neighbouring content. */\n cardHover: { scale: 1.02 } satisfies Target,\n} as const;\n\n/* -------------------------------------------------------------------------------------------------\n * Viewport config\n * The shared `whileInView` viewport so every scroll reveal triggers at the same threshold,\n * exactly once.\n * ----------------------------------------------------------------------------------------------- */\n\nexport const viewportOnce = { once: true, margin: \"-15%\" } as const;\n"],"mappings":";;;AAEA,YAAY,WAAW;AACvB,YAAY,sBAAsB;AAClC,SAAS,cAAc;;;ACJvB,SAAS,YAA6B;AACtC,SAAS,eAAe;AAOjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACDO,IAAM,SAAS;AAAA;AAAA,EAEpB,QAAQ,EAAE,MAAM,UAAU,WAAW,KAAK,SAAS,IAAI,MAAM,IAAI;AAAA;AAAA,EAEjE,MAAM,EAAE,MAAM,UAAU,WAAW,KAAK,SAAS,GAAG;AAAA;AAAA,EAEpD,QAAQ,EAAE,MAAM,UAAU,WAAW,KAAK,SAAS,IAAI,MAAM,IAAI;AACnE;AAEO,IAAM,QAAQ;AAAA;AAAA,EAEnB,QAAQ,EAAE,MAAM,SAAS,UAAU,MAAM,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE;AAAA;AAAA,EAElE,OAAO,EAAE,MAAM,SAAS,UAAU,MAAM,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE;AAAA;AAAA,EAEjE,MAAM,EAAE,MAAM,SAAS,UAAU,KAAK,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE;AAChE;AAQO,IAAM,SAAmB;AAAA,EAC9B,QAAQ,EAAE,SAAS,GAAG,GAAG,GAAG;AAAA,EAC5B,SAAS,EAAE,SAAS,GAAG,GAAG,GAAG,YAAY,MAAM,OAAO;AACxD;AAEO,IAAM,SAAmB;AAAA,EAC9B,QAAQ,EAAE,SAAS,EAAE;AAAA,EACrB,SAAS,EAAE,SAAS,GAAG,YAAY,MAAM,OAAO;AAClD;AAEO,IAAM,UAAoB;AAAA,EAC/B,QAAQ,EAAE,SAAS,GAAG,OAAO,KAAK;AAAA,EAClC,SAAS,EAAE,SAAS,GAAG,OAAO,GAAG,YAAY,OAAO,KAAK;AAC3D;AAE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[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { LucideIcon } from 'lucide-react';
|
|
3
|
+
|
|
4
|
+
interface TreeNode {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
icon?: LucideIcon;
|
|
8
|
+
children?: TreeNode[];
|
|
9
|
+
}
|
|
10
|
+
interface TreeViewProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
data: TreeNode[];
|
|
12
|
+
defaultExpanded?: string[];
|
|
13
|
+
}
|
|
14
|
+
declare const TreeView: React.ForwardRefExoticComponent<TreeViewProps & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
|
|
16
|
+
export { type TreeNode, TreeView, type TreeViewProps };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/ui/tree-view.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { ChevronRight } from "lucide-react";
|
|
6
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
7
|
+
|
|
8
|
+
// src/lib/cn.ts
|
|
9
|
+
import { clsx } from "clsx";
|
|
10
|
+
import { twMerge } from "tailwind-merge";
|
|
11
|
+
function cn(...inputs) {
|
|
12
|
+
return twMerge(clsx(inputs));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// src/lib/motion-presets.ts
|
|
16
|
+
var spring = {
|
|
17
|
+
/** Quick, decisive — buttons, indicators, dropdowns. */
|
|
18
|
+
snappy: { type: "spring", stiffness: 420, damping: 32, mass: 0.8 },
|
|
19
|
+
/** Calm and weighty — dialogs, cards, larger surfaces. */
|
|
20
|
+
soft: { type: "spring", stiffness: 180, damping: 26 },
|
|
21
|
+
/** Playful overshoot — badges, toggles, delight moments. Use sparingly. */
|
|
22
|
+
bouncy: { type: "spring", stiffness: 480, damping: 18, mass: 0.9 }
|
|
23
|
+
};
|
|
24
|
+
var tween = {
|
|
25
|
+
/** The signature easing — an expressive ease-out for orchestrated reveals. */
|
|
26
|
+
smooth: { type: "tween", duration: 0.45, ease: [0.22, 1, 0.36, 1] },
|
|
27
|
+
/** Faster variant for small elements. */
|
|
28
|
+
quick: { type: "tween", duration: 0.28, ease: [0.22, 1, 0.36, 1] },
|
|
29
|
+
/** Longer, settled curve for drawing charts, count-ups, and progress fills. */
|
|
30
|
+
draw: { type: "tween", duration: 1.1, ease: [0.16, 1, 0.3, 1] }
|
|
31
|
+
};
|
|
32
|
+
var fadeUp = {
|
|
33
|
+
hidden: { opacity: 0, y: 18 },
|
|
34
|
+
visible: { opacity: 1, y: 0, transition: tween.smooth }
|
|
35
|
+
};
|
|
36
|
+
var fadeIn = {
|
|
37
|
+
hidden: { opacity: 0 },
|
|
38
|
+
visible: { opacity: 1, transition: tween.smooth }
|
|
39
|
+
};
|
|
40
|
+
var scaleIn = {
|
|
41
|
+
hidden: { opacity: 0, scale: 0.96 },
|
|
42
|
+
visible: { opacity: 1, scale: 1, transition: spring.soft }
|
|
43
|
+
};
|
|
44
|
+
var slideInLeft = {
|
|
45
|
+
hidden: { opacity: 0, x: -28 },
|
|
46
|
+
visible: { opacity: 1, x: 0, transition: tween.smooth }
|
|
47
|
+
};
|
|
48
|
+
var slideInRight = {
|
|
49
|
+
hidden: { opacity: 0, x: 28 },
|
|
50
|
+
visible: { opacity: 1, x: 0, transition: tween.smooth }
|
|
51
|
+
};
|
|
52
|
+
var blurIn = {
|
|
53
|
+
hidden: { opacity: 0, filter: "blur(12px)" },
|
|
54
|
+
visible: { opacity: 1, filter: "blur(0px)", transition: tween.smooth }
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// src/components/ui/tree-view.tsx
|
|
58
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
59
|
+
var ExpandedContext = React.createContext({ expanded: /* @__PURE__ */ new Set(), toggle: () => {
|
|
60
|
+
}, reduced: false });
|
|
61
|
+
function TreeItem({ node, depth }) {
|
|
62
|
+
const { expanded, toggle, reduced } = React.useContext(ExpandedContext);
|
|
63
|
+
const open = expanded.has(node.id);
|
|
64
|
+
const hasChildren = !!node.children?.length;
|
|
65
|
+
const Icon = node.icon;
|
|
66
|
+
return /* @__PURE__ */ jsxs("li", { children: [
|
|
67
|
+
/* @__PURE__ */ jsxs(
|
|
68
|
+
"button",
|
|
69
|
+
{
|
|
70
|
+
type: "button",
|
|
71
|
+
onClick: () => hasChildren && toggle(node.id),
|
|
72
|
+
style: { paddingLeft: `${depth * 1.25 + 0.5}rem` },
|
|
73
|
+
className: "flex w-full items-center gap-2 rounded-md py-1.5 pr-2 text-left text-sm text-foreground transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
74
|
+
children: [
|
|
75
|
+
hasChildren ? /* @__PURE__ */ jsx(
|
|
76
|
+
motion.span,
|
|
77
|
+
{
|
|
78
|
+
animate: { rotate: open ? 90 : 0 },
|
|
79
|
+
transition: reduced ? { duration: 0 } : spring.snappy,
|
|
80
|
+
className: "text-muted-foreground",
|
|
81
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-4" })
|
|
82
|
+
}
|
|
83
|
+
) : /* @__PURE__ */ jsx("span", { className: "size-4" }),
|
|
84
|
+
Icon ? /* @__PURE__ */ jsx(Icon, { className: "size-4 text-muted-foreground" }) : null,
|
|
85
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: node.label })
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
hasChildren ? /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: open ? /* @__PURE__ */ jsx(
|
|
90
|
+
motion.ul,
|
|
91
|
+
{
|
|
92
|
+
initial: reduced ? { opacity: 0 } : { height: 0, opacity: 0 },
|
|
93
|
+
animate: reduced ? { opacity: 1 } : { height: "auto", opacity: 1 },
|
|
94
|
+
exit: reduced ? { opacity: 0 } : { height: 0, opacity: 0 },
|
|
95
|
+
transition: reduced ? { duration: 0 } : tween.quick,
|
|
96
|
+
className: "overflow-hidden",
|
|
97
|
+
children: node.children.map((child) => /* @__PURE__ */ jsx(TreeItem, { node: child, depth: depth + 1 }, child.id))
|
|
98
|
+
}
|
|
99
|
+
) : null }) : null
|
|
100
|
+
] });
|
|
101
|
+
}
|
|
102
|
+
var TreeView = React.forwardRef(
|
|
103
|
+
({ className, data, defaultExpanded = [], ...props }, ref) => {
|
|
104
|
+
const [expanded, setExpanded] = React.useState(
|
|
105
|
+
() => new Set(defaultExpanded)
|
|
106
|
+
);
|
|
107
|
+
const reduced = useReducedMotion() ?? false;
|
|
108
|
+
const toggle = React.useCallback((id) => {
|
|
109
|
+
setExpanded((prev) => {
|
|
110
|
+
const next = new Set(prev);
|
|
111
|
+
if (next.has(id)) next.delete(id);
|
|
112
|
+
else next.add(id);
|
|
113
|
+
return next;
|
|
114
|
+
});
|
|
115
|
+
}, []);
|
|
116
|
+
return /* @__PURE__ */ jsx(ExpandedContext.Provider, { value: { expanded, toggle, reduced }, children: /* @__PURE__ */ jsx("div", { ref, className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsx("ul", { children: data.map((node) => /* @__PURE__ */ jsx(TreeItem, { node, depth: 0 }, node.id)) }) }) });
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
TreeView.displayName = "TreeView";
|
|
120
|
+
export {
|
|
121
|
+
TreeView
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=tree-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/tree-view.tsx","../src/lib/cn.ts","../src/lib/motion-presets.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { ChevronRight, type LucideIcon } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@/lib/cn\";\nimport { spring, tween } from \"@/lib/motion-presets\";\n\nexport interface TreeNode {\n id: string;\n label: string;\n icon?: LucideIcon;\n children?: TreeNode[];\n}\n\nexport interface TreeViewProps extends React.HTMLAttributes<HTMLDivElement> {\n data: TreeNode[];\n defaultExpanded?: string[];\n}\n\nconst ExpandedContext = React.createContext<{\n expanded: Set<string>;\n toggle: (id: string) => void;\n reduced: boolean;\n}>({ expanded: new Set(), toggle: () => {}, reduced: false });\n\nfunction TreeItem({ node, depth }: { node: TreeNode; depth: number }) {\n const { expanded, toggle, reduced } = React.useContext(ExpandedContext);\n const open = expanded.has(node.id);\n const hasChildren = !!node.children?.length;\n const Icon = node.icon;\n\n return (\n <li>\n <button\n type=\"button\"\n onClick={() => hasChildren && toggle(node.id)}\n style={{ paddingLeft: `${depth * 1.25 + 0.5}rem` }}\n className=\"flex w-full items-center gap-2 rounded-md py-1.5 pr-2 text-left text-sm text-foreground transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {hasChildren ? (\n <motion.span\n animate={{ rotate: open ? 90 : 0 }}\n transition={reduced ? { duration: 0 } : spring.snappy}\n className=\"text-muted-foreground\"\n >\n <ChevronRight className=\"size-4\" />\n </motion.span>\n ) : (\n <span className=\"size-4\" />\n )}\n {Icon ? <Icon className=\"size-4 text-muted-foreground\" /> : null}\n <span className=\"truncate\">{node.label}</span>\n </button>\n\n {hasChildren ? (\n <AnimatePresence initial={false}>\n {open ? (\n <motion.ul\n initial={reduced ? { opacity: 0 } : { height: 0, opacity: 0 }}\n animate={reduced ? { opacity: 1 } : { height: \"auto\", opacity: 1 }}\n exit={reduced ? { opacity: 0 } : { height: 0, opacity: 0 }}\n transition={reduced ? { duration: 0 } : tween.quick}\n className=\"overflow-hidden\"\n >\n {node.children!.map((child) => (\n <TreeItem key={child.id} node={child} depth={depth + 1} />\n ))}\n </motion.ul>\n ) : null}\n </AnimatePresence>\n ) : null}\n </li>\n );\n}\n\nconst TreeView = React.forwardRef<HTMLDivElement, TreeViewProps>(\n ({ className, data, defaultExpanded = [], ...props }, ref) => {\n const [expanded, setExpanded] = React.useState<Set<string>>(\n () => new Set(defaultExpanded)\n );\n const reduced = useReducedMotion() ?? false;\n\n const toggle = React.useCallback((id: string) => {\n setExpanded((prev) => {\n const next = new Set(prev);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n return next;\n });\n }, []);\n\n return (\n <ExpandedContext.Provider value={{ expanded, toggle, reduced }}>\n <div ref={ref} className={cn(\"w-full\", className)} {...props}>\n <ul>\n {data.map((node) => (\n <TreeItem key={node.id} node={node} depth={0} />\n ))}\n </ul>\n </div>\n </ExpandedContext.Provider>\n );\n }\n);\nTreeView.displayName = \"TreeView\";\n\nexport { TreeView };\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind-aware conflict resolution.\n * Every Kineto component accepts `className` and merges it through `cn()`,\n * so consumer overrides always win over the component's defaults.\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import type { Transition, Variants, Target } from \"motion/react\";\n\n/* -------------------------------------------------------------------------------------------------\n * Transition tokens\n * The named physics every component references. Tune these in one place and the whole\n * library re-tunes. Prefer springs for anything interactive; reserve tweens for orchestrated\n * entrances where you want a precise, repeatable curve.\n * ----------------------------------------------------------------------------------------------- */\n\nexport const spring = {\n /** Quick, decisive — buttons, indicators, dropdowns. */\n snappy: { type: \"spring\", stiffness: 420, damping: 32, mass: 0.8 },\n /** Calm and weighty — dialogs, cards, larger surfaces. */\n soft: { type: \"spring\", stiffness: 180, damping: 26 },\n /** Playful overshoot — badges, toggles, delight moments. Use sparingly. */\n bouncy: { type: \"spring\", stiffness: 480, damping: 18, mass: 0.9 },\n} satisfies Record<string, Transition>;\n\nexport const tween = {\n /** The signature easing — an expressive ease-out for orchestrated reveals. */\n smooth: { type: \"tween\", duration: 0.45, ease: [0.22, 1, 0.36, 1] },\n /** Faster variant for small elements. */\n quick: { type: \"tween\", duration: 0.28, ease: [0.22, 1, 0.36, 1] },\n /** Longer, settled curve for drawing charts, count-ups, and progress fills. */\n draw: { type: \"tween\", duration: 1.1, ease: [0.16, 1, 0.3, 1] },\n} satisfies Record<string, Transition>;\n\n/* -------------------------------------------------------------------------------------------------\n * Reveal variants\n * Named hidden→visible pairs. Pair with `initial=\"hidden\"` + `animate=\"visible\"`, or with\n * `whileInView=\"visible\"` for scroll-triggered sections (see `viewportOnce`).\n * ----------------------------------------------------------------------------------------------- */\n\nexport const fadeUp: Variants = {\n hidden: { opacity: 0, y: 18 },\n visible: { opacity: 1, y: 0, transition: tween.smooth },\n};\n\nexport const fadeIn: Variants = {\n hidden: { opacity: 0 },\n visible: { opacity: 1, transition: tween.smooth },\n};\n\nexport const scaleIn: Variants = {\n hidden: { opacity: 0, scale: 0.96 },\n visible: { opacity: 1, scale: 1, transition: spring.soft },\n};\n\nexport const slideInLeft: Variants = {\n hidden: { opacity: 0, x: -28 },\n visible: { opacity: 1, x: 0, transition: tween.smooth },\n};\n\nexport const slideInRight: Variants = {\n hidden: { opacity: 0, x: 28 },\n visible: { opacity: 1, x: 0, transition: tween.smooth },\n};\n\nexport const blurIn: Variants = {\n hidden: { opacity: 0, filter: \"blur(12px)\" },\n visible: { opacity: 1, filter: \"blur(0px)\", transition: tween.smooth },\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Stagger helpers\n * Wrap a list/grid in a container using `staggerContainer()` and give each child `staggerItem`\n * (or any reveal variant). One wrapper orchestrates the whole sequence.\n * ----------------------------------------------------------------------------------------------- */\n\nexport const staggerContainer = (stagger = 0.08, delay = 0): Variants => ({\n hidden: {},\n visible: {\n transition: { staggerChildren: stagger, delayChildren: delay },\n },\n});\n\n/** The default child for a stagger container. Aliased to `fadeUp` so sequences feel cohesive. */\nexport const staggerItem: Variants = fadeUp;\n\n/* -------------------------------------------------------------------------------------------------\n * Interaction presets\n * Standardized tap/hover targets. Note: controls (buttons, selects, anything that can act as a\n * trigger/anchor) should NOT shift on hover — moving a trigger while its popover/tooltip animates\n * in reads as two competing motions. Use color + press feedback there instead. A very subtle\n * scale-up is reserved for non-anchored content surfaces (cards/tiles) via `cardHover`.\n * Spread into `whileHover` / `whileTap`.\n * ----------------------------------------------------------------------------------------------- */\n\nexport const interaction = {\n /** Press feedback for buttons and clickable chips. */\n tap: { scale: 0.97 } satisfies Target,\n /** Very subtle scale-up for non-anchored content surfaces (cards/tiles) — never for triggers.\n * A gentle swell reads calmer than a positional lift and doesn't nudge neighbouring content. */\n cardHover: { scale: 1.02 } satisfies Target,\n} as const;\n\n/* -------------------------------------------------------------------------------------------------\n * Viewport config\n * The shared `whileInView` viewport so every scroll reveal triggers at the same threshold,\n * exactly once.\n * ----------------------------------------------------------------------------------------------- */\n\nexport const viewportOnce = { once: true, margin: \"-15%\" } as const;\n"],"mappings":";;;AAEA,YAAY,WAAW;AACvB,SAAS,oBAAqC;AAC9C,SAAS,iBAAiB,QAAQ,wBAAwB;;;ACJ1D,SAAS,YAA6B;AACtC,SAAS,eAAe;AAOjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACDO,IAAM,SAAS;AAAA;AAAA,EAEpB,QAAQ,EAAE,MAAM,UAAU,WAAW,KAAK,SAAS,IAAI,MAAM,IAAI;AAAA;AAAA,EAEjE,MAAM,EAAE,MAAM,UAAU,WAAW,KAAK,SAAS,GAAG;AAAA;AAAA,EAEpD,QAAQ,EAAE,MAAM,UAAU,WAAW,KAAK,SAAS,IAAI,MAAM,IAAI;AACnE;AAEO,IAAM,QAAQ;AAAA;AAAA,EAEnB,QAAQ,EAAE,MAAM,SAAS,UAAU,MAAM,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE;AAAA;AAAA,EAElE,OAAO,EAAE,MAAM,SAAS,UAAU,MAAM,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE;AAAA;AAAA,EAEjE,MAAM,EAAE,MAAM,SAAS,UAAU,KAAK,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE;AAChE;AAQO,IAAM,SAAmB;AAAA,E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A,UAAM,UAAU,iBAAiB,KAAK;AAEtC,UAAM,SAAe,kBAAY,CAAC,OAAe;AAC/C,kBAAY,CAAC,SAAS;AACpB,cAAM,OAAO,IAAI,IAAI,IAAI;AACzB,YAAI,KAAK,IAAI,EAAE,EAAG,MAAK,OAAO,EAAE;AAAA,YAC3B,MAAK,IAAI,EAAE;AAChB,eAAO;AAAA,MACT,CAAC;AAAA,IACH,GAAG,CAAC,CAAC;AAEL,WACE,oBAAC,gBAAgB,UAAhB,EAAyB,OAAO,EAAE,UAAU,QAAQ,QAAQ,GAC3D,8BAAC,SAAI,KAAU,WAAW,GAAG,UAAU,SAAS,GAAI,GAAG,OACrD,8BAAC,QACE,eAAK,IAAI,CAAC,SACT,oBAAC,YAAuB,MAAY,OAAO,KAA5B,KAAK,EAA0B,CAC/C,GACH,GACF,GACF;AAAA,EAEJ;AACF;AACA,SAAS,cAAc;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface TruncateProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
/** Number of lines before clamping. 1 = single-line ellipsis. */
|
|
5
|
+
lines?: number;
|
|
6
|
+
/** Tooltip content shown only when the text is actually clipped. Defaults to `children`. */
|
|
7
|
+
tooltip?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Clamp text to `lines` and reveal the full value in a tooltip — but ONLY when it's genuinely
|
|
11
|
+
* truncated. It measures overflow (and re-measures on resize), so a label that happens to fit never
|
|
12
|
+
* gets a pointless tooltip. The common "title attribute on everything" anti-pattern, done right.
|
|
13
|
+
*/
|
|
14
|
+
declare const Truncate: React.ForwardRefExoticComponent<TruncateProps & React.RefAttributes<HTMLSpanElement>>;
|
|
15
|
+
|
|
16
|
+
export { Truncate, type TruncateProps };
|