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/rating.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/ui/rating.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { Star } from "lucide-react";
|
|
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/rating.tsx
|
|
58
|
+
import { jsx } from "react/jsx-runtime";
|
|
59
|
+
var sizeClasses = { sm: "size-4", md: "size-5", lg: "size-7" };
|
|
60
|
+
var Rating = React.forwardRef(
|
|
61
|
+
({
|
|
62
|
+
className,
|
|
63
|
+
value,
|
|
64
|
+
defaultValue = 0,
|
|
65
|
+
onValueChange,
|
|
66
|
+
max = 5,
|
|
67
|
+
readOnly = false,
|
|
68
|
+
size = "md",
|
|
69
|
+
...props
|
|
70
|
+
}, ref) => {
|
|
71
|
+
const [internal, setInternal] = React.useState(defaultValue);
|
|
72
|
+
const [hover, setHover] = React.useState(null);
|
|
73
|
+
const current = value ?? internal;
|
|
74
|
+
const display = hover ?? current;
|
|
75
|
+
const set = (next) => {
|
|
76
|
+
if (readOnly) return;
|
|
77
|
+
if (value === void 0) setInternal(next);
|
|
78
|
+
onValueChange?.(next);
|
|
79
|
+
};
|
|
80
|
+
return /* @__PURE__ */ jsx(
|
|
81
|
+
"div",
|
|
82
|
+
{
|
|
83
|
+
ref,
|
|
84
|
+
role: "radiogroup",
|
|
85
|
+
className: cn("inline-flex items-center gap-1", className),
|
|
86
|
+
...props,
|
|
87
|
+
children: Array.from({ length: max }).map((_, i) => {
|
|
88
|
+
const idx = i + 1;
|
|
89
|
+
const filled = idx <= display;
|
|
90
|
+
return /* @__PURE__ */ jsx(
|
|
91
|
+
motion.button,
|
|
92
|
+
{
|
|
93
|
+
type: "button",
|
|
94
|
+
disabled: readOnly,
|
|
95
|
+
"aria-label": `${idx} star${idx > 1 ? "s" : ""}`,
|
|
96
|
+
whileTap: readOnly ? void 0 : { scale: 0.85 },
|
|
97
|
+
animate: { scale: !readOnly && hover === idx ? 1.15 : 1 },
|
|
98
|
+
transition: spring.snappy,
|
|
99
|
+
onMouseEnter: () => !readOnly && setHover(idx),
|
|
100
|
+
onMouseLeave: () => !readOnly && setHover(null),
|
|
101
|
+
onFocus: () => !readOnly && setHover(idx),
|
|
102
|
+
onBlur: () => !readOnly && setHover(null),
|
|
103
|
+
onClick: () => set(idx),
|
|
104
|
+
className: cn(
|
|
105
|
+
"rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
106
|
+
readOnly ? "cursor-default" : "cursor-pointer",
|
|
107
|
+
filled ? "text-warning" : "text-muted-foreground/35"
|
|
108
|
+
),
|
|
109
|
+
children: /* @__PURE__ */ jsx(Star, { className: cn(sizeClasses[size], filled && "fill-current") })
|
|
110
|
+
},
|
|
111
|
+
i
|
|
112
|
+
);
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
Rating.displayName = "Rating";
|
|
119
|
+
export {
|
|
120
|
+
Rating
|
|
121
|
+
};
|
|
122
|
+
//# sourceMappingURL=rating.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/rating.tsx","../src/lib/cn.ts","../src/lib/motion-presets.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Star } from \"lucide-react\";\nimport { motion } from \"motion/react\";\n\nimport { cn } from \"@/lib/cn\";\nimport { spring } from \"@/lib/motion-presets\";\n\nconst sizeClasses = { sm: \"size-4\", md: \"size-5\", lg: \"size-7\" } as const;\n\nexport interface RatingProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n value?: number;\n defaultValue?: number;\n onValueChange?: (value: number) => void;\n max?: number;\n readOnly?: boolean;\n size?: keyof typeof sizeClasses;\n}\n\nconst Rating = React.forwardRef<HTMLDivElement, RatingProps>(\n (\n {\n className,\n value,\n defaultValue = 0,\n onValueChange,\n max = 5,\n readOnly = false,\n size = \"md\",\n ...props\n },\n ref\n ) => {\n const [internal, setInternal] = React.useState(defaultValue);\n const [hover, setHover] = React.useState<number | null>(null);\n const current = value ?? internal;\n const display = hover ?? current;\n\n const set = (next: number) => {\n if (readOnly) return;\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n };\n\n return (\n <div\n ref={ref}\n role=\"radiogroup\"\n className={cn(\"inline-flex items-center gap-1\", className)}\n {...props}\n >\n {Array.from({ length: max }).map((_, i) => {\n const idx = i + 1;\n const filled = idx <= display;\n return (\n <motion.button\n key={i}\n type=\"button\"\n disabled={readOnly}\n aria-label={`${idx} star${idx > 1 ? \"s\" : \"\"}`}\n whileTap={readOnly ? undefined : { scale: 0.85 }}\n animate={{ scale: !readOnly && hover === idx ? 1.15 : 1 }}\n transition={spring.snappy}\n onMouseEnter={() => !readOnly && setHover(idx)}\n onMouseLeave={() => !readOnly && setHover(null)}\n onFocus={() => !readOnly && setHover(idx)}\n onBlur={() => !readOnly && setHover(null)}\n onClick={() => set(idx)}\n className={cn(\n \"rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n readOnly ? \"cursor-default\" : \"cursor-pointer\",\n filled ? \"text-warning\" : \"text-muted-foreground/35\"\n )}\n >\n <Star className={cn(sizeClasses[size], filled && \"fill-current\")} />\n </motion.button>\n );\n })}\n </div>\n );\n }\n);\nRating.displayName = \"Rating\";\n\nexport { Rating };\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,YAAY;AACrB,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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AAA,IACtB;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,MAAK;AAAA,QACL,WAAW,GAAG,kCAAkC,SAAS;AAAA,QACxD,GAAG;AAAA,QAEH,gBAAM,KAAK,EAAE,QAAQ,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG,MAAM;AACzC,gBAAM,MAAM,IAAI;AAChB,gBAAM,SAAS,OAAO;AACtB,iBACE;AAAA,YAAC,OAAO;AAAA,YAAP;AAAA,cAEC,MAAK;AAAA,cACL,UAAU;AAAA,cACV,cAAY,GAAG,GAAG,QAAQ,MAAM,IAAI,MAAM,EAAE;AAAA,cAC5C,UAAU,WAAW,SAAY,EAAE,OAAO,KAAK;AAAA,cAC/C,SAAS,EAAE,OAAO,CAAC,YAAY,UAAU,MAAM,OAAO,EAAE;AAAA,cACxD,YAAY,OAAO;AAAA,cACnB,cAAc,MAAM,CAAC,YAAY,SAAS,GAAG;AAAA,cAC7C,cAAc,MAAM,CAAC,YAAY,SAAS,IAAI;AAAA,cAC9C,SAAS,MAAM,CAAC,YAAY,SAAS,GAAG;AAAA,cACxC,QAAQ,MAAM,CAAC,YAAY,SAAS,IAAI;AAAA,cACxC,SAAS,MAAM,IAAI,GAAG;AAAA,cACtB,WAAW;AAAA,gBACT;AAAA,gBACA,WAAW,mBAAmB;AAAA,gBAC9B,SAAS,iBAAiB;AAAA,cAC5B;AAAA,cAEA,8BAAC,QAAK,WAAW,GAAG,YAAY,IAAI,GAAG,UAAU,cAAc,GAAG;AAAA;AAAA,YAlB7D;AAAA,UAmBP;AAAA,QAEJ,CAAC;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,OAAO,cAAc;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TimeInput } from './format-time.js';
|
|
3
|
+
|
|
4
|
+
interface RelativeTimeProps extends Omit<React.HTMLAttributes<HTMLTimeElement>, "children"> {
|
|
5
|
+
/** The moment to describe — a Date, epoch ms, or parseable date string. */
|
|
6
|
+
date: TimeInput;
|
|
7
|
+
/** Reveal the absolute timestamp in a tooltip on hover/focus. */
|
|
8
|
+
tooltip?: boolean;
|
|
9
|
+
/** Keep the label ticking as time passes. Disable for static/archival contexts. */
|
|
10
|
+
live?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* "2h ago" that updates itself as time passes and, on hover/focus, reveals the absolute timestamp.
|
|
14
|
+
* Formatting comes from the shared `format-time` system, so every relative label in the app matches.
|
|
15
|
+
* The auto-update cadence scales with age (seconds tick often, old dates barely at all).
|
|
16
|
+
*/
|
|
17
|
+
declare const RelativeTime: React.ForwardRefExoticComponent<RelativeTimeProps & React.RefAttributes<HTMLTimeElement>>;
|
|
18
|
+
|
|
19
|
+
export { RelativeTime, type RelativeTimeProps };
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/ui/relative-time.tsx
|
|
4
|
+
import * as React2 from "react";
|
|
5
|
+
|
|
6
|
+
// src/lib/cn.ts
|
|
7
|
+
import { clsx } from "clsx";
|
|
8
|
+
import { twMerge } from "tailwind-merge";
|
|
9
|
+
function cn(...inputs) {
|
|
10
|
+
return twMerge(clsx(inputs));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// src/lib/format-time.ts
|
|
14
|
+
function toMs(input) {
|
|
15
|
+
if (input instanceof Date) return input.getTime();
|
|
16
|
+
if (typeof input === "number") return input;
|
|
17
|
+
return new Date(input).getTime();
|
|
18
|
+
}
|
|
19
|
+
var SEC = 1e3;
|
|
20
|
+
var MIN = 60 * SEC;
|
|
21
|
+
var HOUR = 60 * MIN;
|
|
22
|
+
var DAY = 24 * HOUR;
|
|
23
|
+
var WEEK = 7 * DAY;
|
|
24
|
+
function formatRelativeTime(input, now = Date.now()) {
|
|
25
|
+
const then = toMs(input);
|
|
26
|
+
const nowMs = toMs(now);
|
|
27
|
+
const diff = nowMs - then;
|
|
28
|
+
const past = diff >= 0;
|
|
29
|
+
const abs = Math.abs(diff);
|
|
30
|
+
if (abs < 45 * SEC) return "just now";
|
|
31
|
+
const unit = (n, u) => past ? `${n}${u} ago` : `in ${n}${u}`;
|
|
32
|
+
if (abs < HOUR) return unit(Math.max(1, Math.round(abs / MIN)), "m");
|
|
33
|
+
if (abs < DAY) return unit(Math.round(abs / HOUR), "h");
|
|
34
|
+
if (abs < WEEK) return unit(Math.round(abs / DAY), "d");
|
|
35
|
+
if (abs < 4 * WEEK) return unit(Math.round(abs / WEEK), "w");
|
|
36
|
+
return formatAbsoluteDate(then, nowMs);
|
|
37
|
+
}
|
|
38
|
+
function formatAbsoluteDate(input, now = Date.now()) {
|
|
39
|
+
const date = new Date(toMs(input));
|
|
40
|
+
const sameYear = new Date(toMs(now)).getFullYear() === date.getFullYear();
|
|
41
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
42
|
+
month: "short",
|
|
43
|
+
day: "numeric",
|
|
44
|
+
...sameYear ? {} : { year: "numeric" }
|
|
45
|
+
}).format(date);
|
|
46
|
+
}
|
|
47
|
+
function formatAbsoluteTime(input) {
|
|
48
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
49
|
+
dateStyle: "medium",
|
|
50
|
+
timeStyle: "short"
|
|
51
|
+
}).format(new Date(toMs(input)));
|
|
52
|
+
}
|
|
53
|
+
function relativeUpdateInterval(input, now = Date.now()) {
|
|
54
|
+
const abs = Math.abs(toMs(now) - toMs(input));
|
|
55
|
+
if (abs < 45 * SEC) return 10 * SEC;
|
|
56
|
+
if (abs < HOUR) return 30 * SEC;
|
|
57
|
+
if (abs < DAY) return 5 * MIN;
|
|
58
|
+
return HOUR;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/components/ui/tooltip.tsx
|
|
62
|
+
import * as React from "react";
|
|
63
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
64
|
+
import { motion } from "motion/react";
|
|
65
|
+
|
|
66
|
+
// src/lib/motion-presets.ts
|
|
67
|
+
var spring = {
|
|
68
|
+
/** Quick, decisive — buttons, indicators, dropdowns. */
|
|
69
|
+
snappy: { type: "spring", stiffness: 420, damping: 32, mass: 0.8 },
|
|
70
|
+
/** Calm and weighty — dialogs, cards, larger surfaces. */
|
|
71
|
+
soft: { type: "spring", stiffness: 180, damping: 26 },
|
|
72
|
+
/** Playful overshoot — badges, toggles, delight moments. Use sparingly. */
|
|
73
|
+
bouncy: { type: "spring", stiffness: 480, damping: 18, mass: 0.9 }
|
|
74
|
+
};
|
|
75
|
+
var tween = {
|
|
76
|
+
/** The signature easing — an expressive ease-out for orchestrated reveals. */
|
|
77
|
+
smooth: { type: "tween", duration: 0.45, ease: [0.22, 1, 0.36, 1] },
|
|
78
|
+
/** Faster variant for small elements. */
|
|
79
|
+
quick: { type: "tween", duration: 0.28, ease: [0.22, 1, 0.36, 1] },
|
|
80
|
+
/** Longer, settled curve for drawing charts, count-ups, and progress fills. */
|
|
81
|
+
draw: { type: "tween", duration: 1.1, ease: [0.16, 1, 0.3, 1] }
|
|
82
|
+
};
|
|
83
|
+
var fadeUp = {
|
|
84
|
+
hidden: { opacity: 0, y: 18 },
|
|
85
|
+
visible: { opacity: 1, y: 0, transition: tween.smooth }
|
|
86
|
+
};
|
|
87
|
+
var fadeIn = {
|
|
88
|
+
hidden: { opacity: 0 },
|
|
89
|
+
visible: { opacity: 1, transition: tween.smooth }
|
|
90
|
+
};
|
|
91
|
+
var scaleIn = {
|
|
92
|
+
hidden: { opacity: 0, scale: 0.96 },
|
|
93
|
+
visible: { opacity: 1, scale: 1, transition: spring.soft }
|
|
94
|
+
};
|
|
95
|
+
var slideInLeft = {
|
|
96
|
+
hidden: { opacity: 0, x: -28 },
|
|
97
|
+
visible: { opacity: 1, x: 0, transition: tween.smooth }
|
|
98
|
+
};
|
|
99
|
+
var slideInRight = {
|
|
100
|
+
hidden: { opacity: 0, x: 28 },
|
|
101
|
+
visible: { opacity: 1, x: 0, transition: tween.smooth }
|
|
102
|
+
};
|
|
103
|
+
var blurIn = {
|
|
104
|
+
hidden: { opacity: 0, filter: "blur(12px)" },
|
|
105
|
+
visible: { opacity: 1, filter: "blur(0px)", transition: tween.smooth }
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// src/components/ui/tooltip.tsx
|
|
109
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
110
|
+
var Tooltip = ({
|
|
111
|
+
delayDuration = 200,
|
|
112
|
+
children,
|
|
113
|
+
...props
|
|
114
|
+
}) => /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { delayDuration, children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { ...props, children }) });
|
|
115
|
+
Tooltip.displayName = "Tooltip";
|
|
116
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
117
|
+
var TooltipContent = React.forwardRef(({ className, sideOffset = 6, children, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
118
|
+
TooltipPrimitive.Content,
|
|
119
|
+
{
|
|
120
|
+
ref,
|
|
121
|
+
sideOffset,
|
|
122
|
+
className: "z-50",
|
|
123
|
+
...props,
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ jsx(
|
|
126
|
+
motion.div,
|
|
127
|
+
{
|
|
128
|
+
initial: { opacity: 0, scale: 0.96 },
|
|
129
|
+
animate: { opacity: 1, scale: 1 },
|
|
130
|
+
transition: spring.snappy,
|
|
131
|
+
style: { transformOrigin: "var(--radix-tooltip-content-transform-origin)" },
|
|
132
|
+
className: cn(
|
|
133
|
+
"max-w-xs rounded-md bg-foreground px-2.5 py-1.5 text-xs font-medium text-background shadow-lift",
|
|
134
|
+
className
|
|
135
|
+
),
|
|
136
|
+
children
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ jsx(TooltipPrimitive.Arrow, { className: "fill-foreground" })
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
) }));
|
|
143
|
+
TooltipContent.displayName = "TooltipContent";
|
|
144
|
+
|
|
145
|
+
// src/components/ui/relative-time.tsx
|
|
146
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
147
|
+
var RelativeTime = React2.forwardRef(
|
|
148
|
+
({ date, tooltip = true, live = true, className, ...props }, ref) => {
|
|
149
|
+
const ms = React2.useMemo(() => date instanceof Date ? date.getTime() : new Date(date).getTime(), [date]);
|
|
150
|
+
const [, tick] = React2.useReducer((n) => n + 1, 0);
|
|
151
|
+
React2.useEffect(() => {
|
|
152
|
+
if (!live) return;
|
|
153
|
+
let timer;
|
|
154
|
+
const schedule = () => {
|
|
155
|
+
timer = setTimeout(() => {
|
|
156
|
+
tick();
|
|
157
|
+
schedule();
|
|
158
|
+
}, relativeUpdateInterval(ms));
|
|
159
|
+
};
|
|
160
|
+
schedule();
|
|
161
|
+
return () => clearTimeout(timer);
|
|
162
|
+
}, [ms, live]);
|
|
163
|
+
const relative = formatRelativeTime(ms);
|
|
164
|
+
const absolute = formatAbsoluteTime(ms);
|
|
165
|
+
const timeEl = /* @__PURE__ */ jsx2(
|
|
166
|
+
"time",
|
|
167
|
+
{
|
|
168
|
+
ref,
|
|
169
|
+
dateTime: new Date(ms).toISOString(),
|
|
170
|
+
className: cn(className),
|
|
171
|
+
suppressHydrationWarning: true,
|
|
172
|
+
...props,
|
|
173
|
+
children: relative
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
if (!tooltip) return timeEl;
|
|
177
|
+
return /* @__PURE__ */ jsxs2(Tooltip, { children: [
|
|
178
|
+
/* @__PURE__ */ jsx2(TooltipTrigger, { asChild: true, children: timeEl }),
|
|
179
|
+
/* @__PURE__ */ jsx2(TooltipContent, { children: absolute })
|
|
180
|
+
] });
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
RelativeTime.displayName = "RelativeTime";
|
|
184
|
+
export {
|
|
185
|
+
RelativeTime
|
|
186
|
+
};
|
|
187
|
+
//# sourceMappingURL=relative-time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/relative-time.tsx","../src/lib/cn.ts","../src/lib/format-time.ts","../src/components/ui/tooltip.tsx","../src/lib/motion-presets.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/cn\";\nimport {\n formatAbsoluteTime,\n formatRelativeTime,\n relativeUpdateInterval,\n type TimeInput,\n} from \"@/lib/format-time\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"@/components/ui/tooltip\";\n\nexport interface RelativeTimeProps\n extends Omit<React.HTMLAttributes<HTMLTimeElement>, \"children\"> {\n /** The moment to describe — a Date, epoch ms, or parseable date string. */\n date: TimeInput;\n /** Reveal the absolute timestamp in a tooltip on hover/focus. */\n tooltip?: boolean;\n /** Keep the label ticking as time passes. Disable for static/archival contexts. */\n live?: boolean;\n}\n\n/**\n * \"2h ago\" that updates itself as time passes and, on hover/focus, reveals the absolute timestamp.\n * Formatting comes from the shared `format-time` system, so every relative label in the app matches.\n * The auto-update cadence scales with age (seconds tick often, old dates barely at all).\n */\nconst RelativeTime = React.forwardRef<HTMLTimeElement, RelativeTimeProps>(\n ({ date, tooltip = true, live = true, className, ...props }, ref) => {\n const ms = React.useMemo(() => (date instanceof Date ? date.getTime() : new Date(date).getTime()), [date]);\n\n // A bare counter to re-render on each tick; the formatters read the live clock themselves.\n const [, tick] = React.useReducer((n: number) => n + 1, 0);\n React.useEffect(() => {\n if (!live) return;\n let timer: ReturnType<typeof setTimeout>;\n const schedule = () => {\n timer = setTimeout(() => {\n tick();\n schedule();\n }, relativeUpdateInterval(ms));\n };\n schedule();\n return () => clearTimeout(timer);\n }, [ms, live]);\n\n const relative = formatRelativeTime(ms);\n const absolute = formatAbsoluteTime(ms);\n\n const timeEl = (\n <time\n ref={ref}\n dateTime={new Date(ms).toISOString()}\n className={cn(className)}\n // Server and client clocks differ by the hydration delay; let the text reconcile silently.\n suppressHydrationWarning\n {...props}\n >\n {relative}\n </time>\n );\n\n if (!tooltip) return timeEl;\n\n return (\n <Tooltip>\n <TooltipTrigger asChild>{timeEl}</TooltipTrigger>\n <TooltipContent>{absolute}</TooltipContent>\n </Tooltip>\n );\n }\n);\nRelativeTime.displayName = \"RelativeTime\";\n\nexport { RelativeTime };\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","/* -------------------------------------------------------------------------------------------------\n * kineto — the one time-formatting system\n *\n * `RelativeTime` renders through these helpers so \"2h ago\" reads identically everywhere and the\n * absolute tooltip uses one locale format. Keeping the rules here (not inline in a component) is the\n * point: relative strings stay consistent across the whole app, and you tune the scale in one place.\n *\n * Runtime-only `Date.now()` is fine here (this is browser/render code, not a workflow script).\n * ----------------------------------------------------------------------------------------------- */\n\nexport type TimeInput = Date | number | string;\n\nfunction toMs(input: TimeInput): number {\n if (input instanceof Date) return input.getTime();\n if (typeof input === \"number\") return input;\n return new Date(input).getTime();\n}\n\nconst SEC = 1000;\nconst MIN = 60 * SEC;\nconst HOUR = 60 * MIN;\nconst DAY = 24 * HOUR;\nconst WEEK = 7 * DAY;\n\n/**\n * Compact relative string: \"just now\", \"5m ago\", \"2h ago\", \"3d ago\", \"2w ago\", then an absolute\n * short date for anything older. Future times read \"in 5m\". `now` is injectable for testing/SSR.\n */\nexport function formatRelativeTime(input: TimeInput, now: TimeInput = Date.now()): string {\n const then = toMs(input);\n const nowMs = toMs(now);\n const diff = nowMs - then; // > 0 ⇒ in the past\n const past = diff >= 0;\n const abs = Math.abs(diff);\n\n if (abs < 45 * SEC) return \"just now\";\n\n const unit = (n: number, u: string) => (past ? `${n}${u} ago` : `in ${n}${u}`);\n\n if (abs < HOUR) return unit(Math.max(1, Math.round(abs / MIN)), \"m\");\n if (abs < DAY) return unit(Math.round(abs / HOUR), \"h\");\n if (abs < WEEK) return unit(Math.round(abs / DAY), \"d\");\n if (abs < 4 * WEEK) return unit(Math.round(abs / WEEK), \"w\");\n return formatAbsoluteDate(then, nowMs);\n}\n\n/** Short calendar date — \"Jan 5\", or \"Jan 5, 2023\" when the year differs from `now`. */\nexport function formatAbsoluteDate(input: TimeInput, now: TimeInput = Date.now()): string {\n const date = new Date(toMs(input));\n const sameYear = new Date(toMs(now)).getFullYear() === date.getFullYear();\n return new Intl.DateTimeFormat(undefined, {\n month: \"short\",\n day: \"numeric\",\n ...(sameYear ? {} : { year: \"numeric\" }),\n }).format(date);\n}\n\n/** Full, unambiguous timestamp for the hover tooltip — e.g. \"Jan 5, 2024, 3:42 PM\". */\nexport function formatAbsoluteTime(input: TimeInput): string {\n return new Intl.DateTimeFormat(undefined, {\n dateStyle: \"medium\",\n timeStyle: \"short\",\n }).format(new Date(toMs(input)));\n}\n\n/**\n * How long (ms) until the relative string could meaningfully change — used by `RelativeTime` to\n * schedule the next tick. Tighter near \"now\", lazier for older timestamps so we don't re-render\n * a year-old date every few seconds.\n */\nexport function relativeUpdateInterval(input: TimeInput, now: TimeInput = Date.now()): number {\n const abs = Math.abs(toMs(now) - toMs(input));\n if (abs < 45 * SEC) return 10 * SEC;\n if (abs < HOUR) return 30 * SEC;\n if (abs < DAY) return 5 * MIN;\n return HOUR;\n}\n","\"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 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,YAAYA,YAAW;;;ACFvB,SAAS,YAA6B;AACtC,SAAS,eAAe;AAOjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACEA,SAAS,KAAK,OAA0B;AACtC,MAAI,iBAAiB,KAAM,QAAO,MAAM,QAAQ;AAChD,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,SAAO,IAAI,KAAK,KAAK,EAAE,QAAQ;AACjC;AAEA,IAAM,MAAM;AACZ,IAAM,MAAM,KAAK;AACjB,IAAM,OAAO,KAAK;AAClB,IAAM,MAAM,KAAK;AACjB,IAAM,OAAO,IAAI;AAMV,SAAS,mBAAmB,OAAkB,MAAiB,KAAK,IAAI,GAAW;AACxF,QAAM,OAAO,KAAK,KAAK;AACvB,QAAM,QAAQ,KAAK,GAAG;AACtB,QAAM,OAAO,QAAQ;AACrB,QAAM,OAAO,QAAQ;AACrB,QAAM,MAAM,KAAK,IAAI,IAAI;A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eAAQ,MAAO,gBAAgB,OAAO,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,QAAQ,GAAI,CAAC,IAAI,CAAC;AAGzG,UAAM,CAAC,EAAE,IAAI,IAAU,kBAAW,CAAC,MAAc,IAAI,GAAG,CAAC;AACzD,IAAM,iBAAU,MAAM;AACpB,UAAI,CAAC,KAAM;AACX,UAAI;AACJ,YAAM,WAAW,MAAM;AACrB,gBAAQ,WAAW,MAAM;AACvB,eAAK;AACL,mBAAS;AAAA,QACX,GAAG,uBAAuB,EAAE,CAAC;AAAA,MAC/B;AACA,eAAS;AACT,aAAO,MAAM,aAAa,KAAK;AAAA,IACjC,GAAG,CAAC,IAAI,IAAI,CAAC;AAEb,UAAM,WAAW,mBAAmB,EAAE;AACtC,UAAM,WAAW,mBAAmB,EAAE;AAEtC,UAAM,SACJ,gBAAAD;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,UAAU,IAAI,KAAK,EAAE,EAAE,YAAY;AAAA,QACnC,WAAW,GAAG,SAAS;AAAA,QAEvB,0BAAwB;AAAA,QACvB,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAGF,QAAI,CAAC,QAAS,QAAO;AAErB,WACE,gBAAAC,MAAC,WACC;AAAA,sBAAAD,KAAC,kBAAe,SAAO,MAAE,kBAAO;AAAA,MAChC,gBAAAA,KAAC,kBAAgB,oBAAS;AAAA,OAC5B;AAAA,EAEJ;AACF;AACA,aAAa,cAAc;","names":["React","jsx","jsxs"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
4
|
+
|
|
5
|
+
declare const ResizablePanelGroup: ({ className, ...props }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => react_jsx_runtime.JSX.Element;
|
|
6
|
+
declare const ResizablePanel: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLSpanElement | HTMLElement | HTMLObjectElement | HTMLAnchorElement | HTMLButtonElement | HTMLDivElement | HTMLFormElement | HTMLHeadingElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLIElement | HTMLOListElement | HTMLParagraphElement | HTMLSelectElement | HTMLUListElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLLegendElement | HTMLLinkElement | HTMLMapElement | HTMLMetaElement | HTMLMeterElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPreElement | HTMLProgressElement | HTMLSlotElement | HTMLScriptElement | HTMLSourceElement | HTMLStyleElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement>, "id" | "onResize"> & {
|
|
7
|
+
className?: string | undefined;
|
|
8
|
+
collapsedSize?: number | undefined;
|
|
9
|
+
collapsible?: boolean | undefined;
|
|
10
|
+
defaultSize?: number | undefined;
|
|
11
|
+
id?: string | undefined;
|
|
12
|
+
maxSize?: number | undefined;
|
|
13
|
+
minSize?: number | undefined;
|
|
14
|
+
onCollapse?: ResizablePrimitive.PanelOnCollapse | undefined;
|
|
15
|
+
onExpand?: ResizablePrimitive.PanelOnExpand | undefined;
|
|
16
|
+
onResize?: ResizablePrimitive.PanelOnResize | undefined;
|
|
17
|
+
order?: number | undefined;
|
|
18
|
+
style?: object | undefined;
|
|
19
|
+
tagName?: keyof HTMLElementTagNameMap | undefined;
|
|
20
|
+
} & {
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
} & React.RefAttributes<ResizablePrimitive.ImperativePanelHandle>>;
|
|
23
|
+
declare const ResizableHandle: ({ withHandle, className, ...props }: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
|
|
24
|
+
withHandle?: boolean;
|
|
25
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
26
|
+
|
|
27
|
+
export { ResizableHandle, ResizablePanel, ResizablePanelGroup };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/ui/resizable.tsx
|
|
4
|
+
import { GripVertical } from "lucide-react";
|
|
5
|
+
import * as ResizablePrimitive from "react-resizable-panels";
|
|
6
|
+
|
|
7
|
+
// src/lib/cn.ts
|
|
8
|
+
import { clsx } from "clsx";
|
|
9
|
+
import { twMerge } from "tailwind-merge";
|
|
10
|
+
function cn(...inputs) {
|
|
11
|
+
return twMerge(clsx(inputs));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// src/components/ui/resizable.tsx
|
|
15
|
+
import { jsx } from "react/jsx-runtime";
|
|
16
|
+
var ResizablePanelGroup = ({
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}) => /* @__PURE__ */ jsx(
|
|
20
|
+
ResizablePrimitive.PanelGroup,
|
|
21
|
+
{
|
|
22
|
+
className: cn(
|
|
23
|
+
"flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
|
|
24
|
+
className
|
|
25
|
+
),
|
|
26
|
+
...props
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
var ResizablePanel = ResizablePrimitive.Panel;
|
|
30
|
+
var ResizableHandle = ({
|
|
31
|
+
withHandle,
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}) => /* @__PURE__ */ jsx(
|
|
35
|
+
ResizablePrimitive.PanelResizeHandle,
|
|
36
|
+
{
|
|
37
|
+
className: cn(
|
|
38
|
+
"relative flex w-px items-center justify-center bg-border transition-colors after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",
|
|
39
|
+
className
|
|
40
|
+
),
|
|
41
|
+
...props,
|
|
42
|
+
children: withHandle ? /* @__PURE__ */ jsx("div", { className: "z-10 flex h-4 w-3 items-center justify-center rounded-sm border border-border bg-border", children: /* @__PURE__ */ jsx(GripVertical, { className: "size-2.5 text-muted-foreground" }) }) : null
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
export {
|
|
46
|
+
ResizableHandle,
|
|
47
|
+
ResizablePanel,
|
|
48
|
+
ResizablePanelGroup
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=resizable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/resizable.tsx","../src/lib/cn.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { GripVertical } from \"lucide-react\";\nimport * as ResizablePrimitive from \"react-resizable-panels\";\n\nimport { cn } from \"@/lib/cn\";\n\nconst ResizablePanelGroup = ({\n className,\n ...props\n}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (\n <ResizablePrimitive.PanelGroup\n className={cn(\n \"flex h-full w-full data-[panel-group-direction=vertical]:flex-col\",\n className\n )}\n {...props}\n />\n);\n\nconst ResizablePanel = ResizablePrimitive.Panel;\n\nconst ResizableHandle = ({\n withHandle,\n className,\n ...props\n}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {\n withHandle?: boolean;\n}) => (\n <ResizablePrimitive.PanelResizeHandle\n className={cn(\n \"relative flex w-px items-center justify-center bg-border transition-colors after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90\",\n className\n )}\n {...props}\n >\n {withHandle ? (\n <div className=\"z-10 flex h-4 w-3 items-center justify-center rounded-sm border border-border bg-border\">\n <GripVertical className=\"size-2.5 text-muted-foreground\" />\n </div>\n ) : null}\n </ResizablePrimitive.PanelResizeHandle>\n);\n\nexport { ResizablePanelGroup, ResizablePanel, ResizableHandle };\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"],"mappings":";;;AAGA,SAAS,oBAAoB;AAC7B,YAAY,wBAAwB;;;ACJpC,SAAS,YAA6B;AACtC,SAAS,eAAe;AAOjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ADEE;AAJF,IAAM,sBAAsB,CAAC;AAAA,EAC3B;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAoB;AAAA,EAAnB;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN;AAGF,IAAM,iBAAoC;AAE1C,IAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAGE;AAAA,EAAoB;AAAA,EAAnB;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEH,uBACC,oBAAC,SAAI,WAAU,2FACb,8BAAC,gBAAa,WAAU,kCAAiC,GAC3D,IACE;AAAA;AACN;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
3
|
+
|
|
4
|
+
declare const ScrollBar: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
interface ScrollAreaProps extends React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> {
|
|
6
|
+
orientation?: "vertical" | "horizontal" | "both";
|
|
7
|
+
/** Fade content out at the edges it can still scroll toward. */
|
|
8
|
+
fade?: boolean;
|
|
9
|
+
/** Length of the fade region (any CSS length). */
|
|
10
|
+
fadeSize?: string;
|
|
11
|
+
viewportClassName?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Custom-styled scrollbars (Radix) plus optional fade-edge masks that appear only on the edges with
|
|
15
|
+
* more content past them — a quiet upgrade for any overflowing region. The mask updates on scroll
|
|
16
|
+
* and resize, so it always reflects the real overflow state.
|
|
17
|
+
*/
|
|
18
|
+
declare const ScrollArea: React.ForwardRefExoticComponent<ScrollAreaProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
|
|
20
|
+
export { ScrollArea, type ScrollAreaProps, ScrollBar };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/ui/scroll-area.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
6
|
+
|
|
7
|
+
// src/lib/cn.ts
|
|
8
|
+
import { clsx } from "clsx";
|
|
9
|
+
import { twMerge } from "tailwind-merge";
|
|
10
|
+
function cn(...inputs) {
|
|
11
|
+
return twMerge(clsx(inputs));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// src/components/ui/scroll-area.tsx
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
var ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
|
|
17
|
+
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
18
|
+
{
|
|
19
|
+
ref,
|
|
20
|
+
orientation,
|
|
21
|
+
className: cn(
|
|
22
|
+
"flex touch-none select-none transition-colors",
|
|
23
|
+
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-px",
|
|
24
|
+
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-px",
|
|
25
|
+
className
|
|
26
|
+
),
|
|
27
|
+
...props,
|
|
28
|
+
children: /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border transition-colors hover:bg-muted-foreground/40" })
|
|
29
|
+
}
|
|
30
|
+
));
|
|
31
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
32
|
+
function fadeMask(axis, before, after, size) {
|
|
33
|
+
if (!before && !after) return void 0;
|
|
34
|
+
const dir = axis === "y" ? "to bottom" : "to right";
|
|
35
|
+
const start = before ? "transparent" : "black";
|
|
36
|
+
const end = after ? "transparent" : "black";
|
|
37
|
+
return `linear-gradient(${dir}, ${start} 0, black ${size}, black calc(100% - ${size}), ${end} 100%)`;
|
|
38
|
+
}
|
|
39
|
+
var ScrollArea = React.forwardRef(
|
|
40
|
+
({ className, children, orientation = "vertical", fade = true, fadeSize = "2rem", viewportClassName, ...props }, ref) => {
|
|
41
|
+
const viewportRef = React.useRef(null);
|
|
42
|
+
const [edges, setEdges] = React.useState({ top: false, bottom: false, left: false, right: false });
|
|
43
|
+
React.useEffect(() => {
|
|
44
|
+
const el = viewportRef.current;
|
|
45
|
+
if (!el) return;
|
|
46
|
+
const update = () => {
|
|
47
|
+
setEdges({
|
|
48
|
+
top: el.scrollTop > 1,
|
|
49
|
+
bottom: el.scrollTop + el.clientHeight < el.scrollHeight - 1,
|
|
50
|
+
left: el.scrollLeft > 1,
|
|
51
|
+
right: el.scrollLeft + el.clientWidth < el.scrollWidth - 1
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
update();
|
|
55
|
+
el.addEventListener("scroll", update, { passive: true });
|
|
56
|
+
const observer = new ResizeObserver(update);
|
|
57
|
+
observer.observe(el);
|
|
58
|
+
if (el.firstElementChild) observer.observe(el.firstElementChild);
|
|
59
|
+
return () => {
|
|
60
|
+
el.removeEventListener("scroll", update);
|
|
61
|
+
observer.disconnect();
|
|
62
|
+
};
|
|
63
|
+
}, [children]);
|
|
64
|
+
const mask = fade ? orientation === "horizontal" ? fadeMask("x", edges.left, edges.right, fadeSize) : fadeMask("y", edges.top, edges.bottom, fadeSize) : void 0;
|
|
65
|
+
return /* @__PURE__ */ jsxs(
|
|
66
|
+
ScrollAreaPrimitive.Root,
|
|
67
|
+
{
|
|
68
|
+
ref,
|
|
69
|
+
className: cn("relative overflow-hidden", className),
|
|
70
|
+
...props,
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
ScrollAreaPrimitive.Viewport,
|
|
74
|
+
{
|
|
75
|
+
ref: viewportRef,
|
|
76
|
+
className: cn("h-full w-full rounded-[inherit]", viewportClassName),
|
|
77
|
+
style: mask ? { WebkitMaskImage: mask, maskImage: mask } : void 0,
|
|
78
|
+
children
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
(orientation === "vertical" || orientation === "both") && /* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" }),
|
|
82
|
+
(orientation === "horizontal" || orientation === "both") && /* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" }),
|
|
83
|
+
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
90
|
+
export {
|
|
91
|
+
ScrollArea,
|
|
92
|
+
ScrollBar
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=scroll-area.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/scroll-area.tsx","../src/lib/cn.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\n\nimport { cn } from \"@/lib/cn\";\n\nconst ScrollBar = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>\n>(({ className, orientation = \"vertical\", ...props }, ref) => (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n orientation={orientation}\n className={cn(\n \"flex touch-none select-none transition-colors\",\n orientation === \"vertical\" && \"h-full w-2.5 border-l border-l-transparent p-px\",\n orientation === \"horizontal\" && \"h-2.5 flex-col border-t border-t-transparent p-px\",\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb className=\"relative flex-1 rounded-full bg-border transition-colors hover:bg-muted-foreground/40\" />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n));\nScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;\n\n/** Build a `mask-image` that fades whichever edges still have content past them. */\nfunction fadeMask(axis: \"y\" | \"x\", before: boolean, after: boolean, size: string): string | undefined {\n if (!before && !after) return undefined;\n const dir = axis === \"y\" ? \"to bottom\" : \"to right\";\n const start = before ? \"transparent\" : \"black\";\n const end = after ? \"transparent\" : \"black\";\n return `linear-gradient(${dir}, ${start} 0, black ${size}, black calc(100% - ${size}), ${end} 100%)`;\n}\n\nexport interface ScrollAreaProps\n extends React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> {\n orientation?: \"vertical\" | \"horizontal\" | \"both\";\n /** Fade content out at the edges it can still scroll toward. */\n fade?: boolean;\n /** Length of the fade region (any CSS length). */\n fadeSize?: string;\n viewportClassName?: string;\n}\n\n/**\n * Custom-styled scrollbars (Radix) plus optional fade-edge masks that appear only on the edges with\n * more content past them — a quiet upgrade for any overflowing region. The mask updates on scroll\n * and resize, so it always reflects the real overflow state.\n */\nconst ScrollArea = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.Root>,\n ScrollAreaProps\n>(\n (\n { className, children, orientation = \"vertical\", fade = true, fadeSize = \"2rem\", viewportClassName, ...props },\n ref\n ) => {\n const viewportRef = React.useRef<HTMLDivElement>(null);\n const [edges, setEdges] = React.useState({ top: false, bottom: false, left: false, right: false });\n\n React.useEffect(() => {\n const el = viewportRef.current;\n if (!el) return;\n const update = () => {\n setEdges({\n top: el.scrollTop > 1,\n bottom: el.scrollTop + el.clientHeight < el.scrollHeight - 1,\n left: el.scrollLeft > 1,\n right: el.scrollLeft + el.clientWidth < el.scrollWidth - 1,\n });\n };\n update();\n el.addEventListener(\"scroll\", update, { passive: true });\n const observer = new ResizeObserver(update);\n observer.observe(el);\n if (el.firstElementChild) observer.observe(el.firstElementChild);\n return () => {\n el.removeEventListener(\"scroll\", update);\n observer.disconnect();\n };\n }, [children]);\n\n const mask = fade\n ? orientation === \"horizontal\"\n ? fadeMask(\"x\", edges.left, edges.right, fadeSize)\n : fadeMask(\"y\", edges.top, edges.bottom, fadeSize)\n : undefined;\n\n return (\n <ScrollAreaPrimitive.Root\n ref={ref}\n className={cn(\"relative overflow-hidden\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n ref={viewportRef}\n className={cn(\"h-full w-full rounded-[inherit]\", viewportClassName)}\n style={mask ? { WebkitMaskImage: mask, maskImage: mask } : undefined}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n {(orientation === \"vertical\" || orientation === \"both\") && <ScrollBar orientation=\"vertical\" />}\n {(orientation === \"horizontal\" || orientation === \"both\") && <ScrollBar orientation=\"horizontal\" />}\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n );\n }\n);\nScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;\n\nexport { ScrollArea, ScrollBar };\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"],"mappings":";;;AAEA,YAAY,WAAW;AACvB,YAAY,yBAAyB;;;ACHrC,SAAS,YAA6B;AACtC,SAAS,eAAe;AAOjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ADYI,cAqEE,YArEF;AAfJ,IAAM,YAAkB,iBAGtB,CAAC,EAAE,WAAW,cAAc,YAAY,GAAG,MAAM,GAAG,QACpD;AAAA,EAAqB;AAAA,EAApB;AAAA,IACC;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA,gBAAgB,cAAc;AAAA,MAC9B,gBAAgB,gBAAgB;AAAA,MAChC;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEJ,8BAAqB,qCAApB,EAAoC,WAAU,yFAAwF;AAAA;AACzI,CACD;AACD,UAAU,cAAkC,wCAAoB;AAGhE,SAAS,SAAS,MAAiB,QAAiB,OAAgB,MAAkC;AACpG,MAAI,CAAC,UAAU,CAAC,MAAO,QAAO;AAC9B,QAAM,MAAM,SAAS,MAAM,cAAc;AACzC,QAAM,QAAQ,SAAS,gBAAgB;AACvC,QAAM,MAAM,QAAQ,gBAAg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B;AAAA,YAApB;AAAA,cACC,KAAK;AAAA,cACL,WAAW,GAAG,mCAAmC,iBAAiB;AAAA,cAClE,OAAO,OAAO,EAAE,iBAAiB,MAAM,WAAW,KAAK,IAAI;AAAA,cAE1D;AAAA;AAAA,UACH;AAAA,WACE,gBAAgB,cAAc,gBAAgB,WAAW,oBAAC,aAAU,aAAY,YAAW;AAAA,WAC3F,gBAAgB,gBAAgB,gBAAgB,WAAW,oBAAC,aAAU,aAAY,cAAa;AAAA,UACjG,oBAAqB,4BAApB,EAA2B;AAAA;AAAA;AAAA,IAC9B;AAAA,EAEJ;AACF;AACA,WAAW,cAAkC,yBAAK;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface SegmentedOption {
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
interface SegmentedControlProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
|
|
8
|
+
options: SegmentedOption[];
|
|
9
|
+
value?: string;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
onValueChange?: (value: string) => void;
|
|
12
|
+
size?: "sm" | "default";
|
|
13
|
+
}
|
|
14
|
+
declare const SegmentedControl: React.ForwardRefExoticComponent<SegmentedControlProps & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
|
|
16
|
+
export { SegmentedControl, type SegmentedControlProps, type SegmentedOption };
|