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
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/ui/segmented-control.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { motion, useReducedMotion } from "motion/react";
|
|
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/lib/motion-presets.ts
|
|
15
|
+
var spring = {
|
|
16
|
+
/** Quick, decisive — buttons, indicators, dropdowns. */
|
|
17
|
+
snappy: { type: "spring", stiffness: 420, damping: 32, mass: 0.8 },
|
|
18
|
+
/** Calm and weighty — dialogs, cards, larger surfaces. */
|
|
19
|
+
soft: { type: "spring", stiffness: 180, damping: 26 },
|
|
20
|
+
/** Playful overshoot — badges, toggles, delight moments. Use sparingly. */
|
|
21
|
+
bouncy: { type: "spring", stiffness: 480, damping: 18, mass: 0.9 }
|
|
22
|
+
};
|
|
23
|
+
var tween = {
|
|
24
|
+
/** The signature easing — an expressive ease-out for orchestrated reveals. */
|
|
25
|
+
smooth: { type: "tween", duration: 0.45, ease: [0.22, 1, 0.36, 1] },
|
|
26
|
+
/** Faster variant for small elements. */
|
|
27
|
+
quick: { type: "tween", duration: 0.28, ease: [0.22, 1, 0.36, 1] },
|
|
28
|
+
/** Longer, settled curve for drawing charts, count-ups, and progress fills. */
|
|
29
|
+
draw: { type: "tween", duration: 1.1, ease: [0.16, 1, 0.3, 1] }
|
|
30
|
+
};
|
|
31
|
+
var fadeUp = {
|
|
32
|
+
hidden: { opacity: 0, y: 18 },
|
|
33
|
+
visible: { opacity: 1, y: 0, transition: tween.smooth }
|
|
34
|
+
};
|
|
35
|
+
var fadeIn = {
|
|
36
|
+
hidden: { opacity: 0 },
|
|
37
|
+
visible: { opacity: 1, transition: tween.smooth }
|
|
38
|
+
};
|
|
39
|
+
var scaleIn = {
|
|
40
|
+
hidden: { opacity: 0, scale: 0.96 },
|
|
41
|
+
visible: { opacity: 1, scale: 1, transition: spring.soft }
|
|
42
|
+
};
|
|
43
|
+
var slideInLeft = {
|
|
44
|
+
hidden: { opacity: 0, x: -28 },
|
|
45
|
+
visible: { opacity: 1, x: 0, transition: tween.smooth }
|
|
46
|
+
};
|
|
47
|
+
var slideInRight = {
|
|
48
|
+
hidden: { opacity: 0, x: 28 },
|
|
49
|
+
visible: { opacity: 1, x: 0, transition: tween.smooth }
|
|
50
|
+
};
|
|
51
|
+
var blurIn = {
|
|
52
|
+
hidden: { opacity: 0, filter: "blur(12px)" },
|
|
53
|
+
visible: { opacity: 1, filter: "blur(0px)", transition: tween.smooth }
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// src/components/ui/segmented-control.tsx
|
|
57
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
58
|
+
function useControllableState({
|
|
59
|
+
prop,
|
|
60
|
+
defaultProp,
|
|
61
|
+
onChange
|
|
62
|
+
}) {
|
|
63
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultProp);
|
|
64
|
+
const isControlled = prop !== void 0;
|
|
65
|
+
const value = isControlled ? prop : uncontrolled;
|
|
66
|
+
const setValue = React.useCallback(
|
|
67
|
+
(next) => {
|
|
68
|
+
if (!isControlled) setUncontrolled(next);
|
|
69
|
+
onChange?.(next);
|
|
70
|
+
},
|
|
71
|
+
[isControlled, onChange]
|
|
72
|
+
);
|
|
73
|
+
return [value, setValue];
|
|
74
|
+
}
|
|
75
|
+
var SegmentedControl = React.forwardRef(
|
|
76
|
+
({
|
|
77
|
+
className,
|
|
78
|
+
options,
|
|
79
|
+
value,
|
|
80
|
+
defaultValue,
|
|
81
|
+
onValueChange,
|
|
82
|
+
size = "default",
|
|
83
|
+
...props
|
|
84
|
+
}, ref) => {
|
|
85
|
+
const [active, setActive] = useControllableState({
|
|
86
|
+
prop: value,
|
|
87
|
+
defaultProp: defaultValue ?? options[0]?.value ?? "",
|
|
88
|
+
onChange: onValueChange
|
|
89
|
+
});
|
|
90
|
+
const layoutId = React.useId();
|
|
91
|
+
const reduced = useReducedMotion();
|
|
92
|
+
return /* @__PURE__ */ jsx(
|
|
93
|
+
"div",
|
|
94
|
+
{
|
|
95
|
+
ref,
|
|
96
|
+
role: "tablist",
|
|
97
|
+
className: cn(
|
|
98
|
+
"inline-flex items-center gap-1 rounded-lg bg-muted p-1",
|
|
99
|
+
className
|
|
100
|
+
),
|
|
101
|
+
...props,
|
|
102
|
+
children: options.map((option) => {
|
|
103
|
+
const isActive = option.value === active;
|
|
104
|
+
return /* @__PURE__ */ jsxs(
|
|
105
|
+
"button",
|
|
106
|
+
{
|
|
107
|
+
type: "button",
|
|
108
|
+
role: "tab",
|
|
109
|
+
"aria-selected": isActive,
|
|
110
|
+
onClick: () => setActive(option.value),
|
|
111
|
+
className: cn(
|
|
112
|
+
"relative inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
113
|
+
size === "sm" ? "px-2.5 py-1 text-xs" : "px-3.5 py-1.5 text-sm",
|
|
114
|
+
isActive ? "text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
115
|
+
),
|
|
116
|
+
children: [
|
|
117
|
+
isActive ? /* @__PURE__ */ jsx(
|
|
118
|
+
motion.span,
|
|
119
|
+
{
|
|
120
|
+
layoutId: `${layoutId}-segment`,
|
|
121
|
+
transition: reduced ? { duration: 0 } : spring.snappy,
|
|
122
|
+
className: "absolute inset-0 z-0 rounded-md bg-card shadow-soft"
|
|
123
|
+
}
|
|
124
|
+
) : null,
|
|
125
|
+
/* @__PURE__ */ jsx("span", { className: "relative z-10", children: option.label })
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
option.value
|
|
129
|
+
);
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
SegmentedControl.displayName = "SegmentedControl";
|
|
136
|
+
export {
|
|
137
|
+
SegmentedControl
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=segmented-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/segmented-control.tsx","../src/lib/cn.ts","../src/lib/motion-presets.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@/lib/cn\";\nimport { spring } from \"@/lib/motion-presets\";\n\nfunction useControllableState<T>({\n prop,\n defaultProp,\n onChange,\n}: {\n prop: T | undefined;\n defaultProp: T;\n onChange?: (value: T) => void;\n}): [T, (next: T) => void] {\n const [uncontrolled, setUncontrolled] = React.useState(defaultProp);\n const isControlled = prop !== undefined;\n const value = isControlled ? (prop as T) : uncontrolled;\n const setValue = React.useCallback(\n (next: T) => {\n if (!isControlled) setUncontrolled(next);\n onChange?.(next);\n },\n [isControlled, onChange]\n );\n return [value, setValue];\n}\n\nexport interface SegmentedOption {\n label: React.ReactNode;\n value: string;\n}\n\nexport interface SegmentedControlProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\"> {\n options: SegmentedOption[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n size?: \"sm\" | \"default\";\n}\n\nconst SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedControlProps>(\n (\n {\n className,\n options,\n value,\n defaultValue,\n onValueChange,\n size = \"default\",\n ...props\n },\n ref\n ) => {\n const [active, setActive] = useControllableState({\n prop: value,\n defaultProp: defaultValue ?? options[0]?.value ?? \"\",\n onChange: onValueChange,\n });\n const layoutId = React.useId();\n const reduced = useReducedMotion();\n\n return (\n <div\n ref={ref}\n role=\"tablist\"\n className={cn(\n \"inline-flex items-center gap-1 rounded-lg bg-muted p-1\",\n className\n )}\n {...props}\n >\n {options.map((option) => {\n const isActive = option.value === active;\n return (\n <button\n key={option.value}\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n onClick={() => setActive(option.value)}\n className={cn(\n \"relative inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n size === \"sm\" ? \"px-2.5 py-1 text-xs\" : \"px-3.5 py-1.5 text-sm\",\n isActive\n ? \"text-foreground\"\n : \"text-muted-foreground hover:text-foreground\"\n )}\n >\n {isActive ? (\n <motion.span\n layoutId={`${layoutId}-segment`}\n transition={reduced ? { duration: 0 } : spring.snappy}\n className=\"absolute inset-0 z-0 rounded-md bg-card shadow-soft\"\n />\n ) : null}\n <span className=\"relative z-10\">{option.label}</span>\n </button>\n );\n })}\n </div>\n );\n }\n);\nSegmentedControl.displayName = \"SegmentedControl\";\n\nexport { SegmentedControl };\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,QAAQ,wBAAwB;;;ACHzC,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,EAE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;AAAA,oBACrB,YAAY,UAAU,EAAE,UAAU,EAAE,IAAI,OAAO;AAAA,oBAC/C,WAAU;AAAA;AAAA,gBACZ,IACE;AAAA,gBACJ,oBAAC,UAAK,WAAU,iBAAiB,iBAAO,OAAM;AAAA;AAAA;AAAA,YApBzC,OAAO;AAAA,UAqBd;AAAA,QAEJ,CAAC;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,iBAAiB,cAAc;","names":[]}
|
package/dist/select.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
|
+
|
|
4
|
+
declare const Select: React.FC<SelectPrimitive.SelectProps>;
|
|
5
|
+
declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
7
|
+
declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
|
|
13
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue };
|
package/dist/select.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/ui/select.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
6
|
+
import { Check, ChevronDown, ChevronUp } from "lucide-react";
|
|
7
|
+
import { motion } from "motion/react";
|
|
8
|
+
|
|
9
|
+
// src/lib/cn.ts
|
|
10
|
+
import { clsx } from "clsx";
|
|
11
|
+
import { twMerge } from "tailwind-merge";
|
|
12
|
+
function cn(...inputs) {
|
|
13
|
+
return twMerge(clsx(inputs));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/lib/motion-presets.ts
|
|
17
|
+
var spring = {
|
|
18
|
+
/** Quick, decisive — buttons, indicators, dropdowns. */
|
|
19
|
+
snappy: { type: "spring", stiffness: 420, damping: 32, mass: 0.8 },
|
|
20
|
+
/** Calm and weighty — dialogs, cards, larger surfaces. */
|
|
21
|
+
soft: { type: "spring", stiffness: 180, damping: 26 },
|
|
22
|
+
/** Playful overshoot — badges, toggles, delight moments. Use sparingly. */
|
|
23
|
+
bouncy: { type: "spring", stiffness: 480, damping: 18, mass: 0.9 }
|
|
24
|
+
};
|
|
25
|
+
var tween = {
|
|
26
|
+
/** The signature easing — an expressive ease-out for orchestrated reveals. */
|
|
27
|
+
smooth: { type: "tween", duration: 0.45, ease: [0.22, 1, 0.36, 1] },
|
|
28
|
+
/** Faster variant for small elements. */
|
|
29
|
+
quick: { type: "tween", duration: 0.28, ease: [0.22, 1, 0.36, 1] },
|
|
30
|
+
/** Longer, settled curve for drawing charts, count-ups, and progress fills. */
|
|
31
|
+
draw: { type: "tween", duration: 1.1, ease: [0.16, 1, 0.3, 1] }
|
|
32
|
+
};
|
|
33
|
+
var fadeUp = {
|
|
34
|
+
hidden: { opacity: 0, y: 18 },
|
|
35
|
+
visible: { opacity: 1, y: 0, transition: tween.smooth }
|
|
36
|
+
};
|
|
37
|
+
var fadeIn = {
|
|
38
|
+
hidden: { opacity: 0 },
|
|
39
|
+
visible: { opacity: 1, transition: tween.smooth }
|
|
40
|
+
};
|
|
41
|
+
var scaleIn = {
|
|
42
|
+
hidden: { opacity: 0, scale: 0.96 },
|
|
43
|
+
visible: { opacity: 1, scale: 1, transition: spring.soft }
|
|
44
|
+
};
|
|
45
|
+
var slideInLeft = {
|
|
46
|
+
hidden: { opacity: 0, x: -28 },
|
|
47
|
+
visible: { opacity: 1, x: 0, transition: tween.smooth }
|
|
48
|
+
};
|
|
49
|
+
var slideInRight = {
|
|
50
|
+
hidden: { opacity: 0, x: 28 },
|
|
51
|
+
visible: { opacity: 1, x: 0, transition: tween.smooth }
|
|
52
|
+
};
|
|
53
|
+
var blurIn = {
|
|
54
|
+
hidden: { opacity: 0, filter: "blur(12px)" },
|
|
55
|
+
visible: { opacity: 1, filter: "blur(0px)", transition: tween.smooth }
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/components/ui/select.tsx
|
|
59
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
60
|
+
var Select = SelectPrimitive.Root;
|
|
61
|
+
var SelectGroup = SelectPrimitive.Group;
|
|
62
|
+
var SelectValue = SelectPrimitive.Value;
|
|
63
|
+
var SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
64
|
+
SelectPrimitive.Trigger,
|
|
65
|
+
{
|
|
66
|
+
ref,
|
|
67
|
+
className: cn(
|
|
68
|
+
"flex h-10 w-full items-center justify-between gap-2 whitespace-nowrap rounded-lg border border-input bg-card px-3.5 py-2 text-sm text-foreground shadow-xs transition-colors data-[placeholder]:text-muted-foreground focus:border-ring focus:outline-none focus:ring-2 focus:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:truncate",
|
|
69
|
+
className
|
|
70
|
+
),
|
|
71
|
+
...props,
|
|
72
|
+
children: [
|
|
73
|
+
children,
|
|
74
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-4 shrink-0 opacity-60" }) })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
));
|
|
78
|
+
SelectTrigger.displayName = "SelectTrigger";
|
|
79
|
+
var SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
80
|
+
SelectPrimitive.Content,
|
|
81
|
+
{
|
|
82
|
+
ref,
|
|
83
|
+
position,
|
|
84
|
+
sideOffset: 6,
|
|
85
|
+
className: "z-50",
|
|
86
|
+
...props,
|
|
87
|
+
children: /* @__PURE__ */ jsxs(
|
|
88
|
+
motion.div,
|
|
89
|
+
{
|
|
90
|
+
initial: { opacity: 0, scale: 0.97 },
|
|
91
|
+
animate: { opacity: 1, scale: 1 },
|
|
92
|
+
transition: tween.quick,
|
|
93
|
+
style: { transformOrigin: "var(--radix-select-content-transform-origin)" },
|
|
94
|
+
className: cn(
|
|
95
|
+
"max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lift",
|
|
96
|
+
position === "popper" && "w-[var(--radix-select-trigger-width)]",
|
|
97
|
+
className
|
|
98
|
+
),
|
|
99
|
+
children: [
|
|
100
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ScrollUpButton, { className: "flex items-center justify-center py-1 text-muted-foreground", children: /* @__PURE__ */ jsx(ChevronUp, { className: "size-4" }) }),
|
|
101
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Viewport, { className: "p-1", children }),
|
|
102
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ScrollDownButton, { className: "flex items-center justify-center py-1 text-muted-foreground", children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-4" }) })
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
) }));
|
|
108
|
+
SelectContent.displayName = "SelectContent";
|
|
109
|
+
var SelectLabel = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
110
|
+
SelectPrimitive.Label,
|
|
111
|
+
{
|
|
112
|
+
ref,
|
|
113
|
+
className: cn("px-2 py-1.5 text-xs font-medium text-muted-foreground", className),
|
|
114
|
+
...props
|
|
115
|
+
}
|
|
116
|
+
));
|
|
117
|
+
SelectLabel.displayName = "SelectLabel";
|
|
118
|
+
var SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
119
|
+
SelectPrimitive.Item,
|
|
120
|
+
{
|
|
121
|
+
ref,
|
|
122
|
+
className: cn(
|
|
123
|
+
"relative flex w-full cursor-pointer select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
124
|
+
className
|
|
125
|
+
),
|
|
126
|
+
...props,
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "size-4 text-primary" }) }) }),
|
|
129
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
));
|
|
133
|
+
SelectItem.displayName = "SelectItem";
|
|
134
|
+
var SelectSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
135
|
+
SelectPrimitive.Separator,
|
|
136
|
+
{
|
|
137
|
+
ref,
|
|
138
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
139
|
+
...props
|
|
140
|
+
}
|
|
141
|
+
));
|
|
142
|
+
SelectSeparator.displayName = "SelectSeparator";
|
|
143
|
+
export {
|
|
144
|
+
Select,
|
|
145
|
+
SelectContent,
|
|
146
|
+
SelectGroup,
|
|
147
|
+
SelectItem,
|
|
148
|
+
SelectLabel,
|
|
149
|
+
SelectSeparator,
|
|
150
|
+
SelectTrigger,
|
|
151
|
+
SelectValue
|
|
152
|
+
};
|
|
153
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/select.tsx","../src/lib/cn.ts","../src/lib/motion-presets.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { Check, ChevronDown, ChevronUp } from \"lucide-react\";\nimport { motion } from \"motion/react\";\n\nimport { cn } from \"@/lib/cn\";\nimport { tween } from \"@/lib/motion-presets\";\n\nconst Select = SelectPrimitive.Root;\nconst SelectGroup = SelectPrimitive.Group;\nconst SelectValue = SelectPrimitive.Value;\n\nconst SelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex h-10 w-full items-center justify-between gap-2 whitespace-nowrap rounded-lg border border-input bg-card px-3.5 py-2 text-sm text-foreground shadow-xs transition-colors data-[placeholder]:text-muted-foreground focus:border-ring focus:outline-none focus:ring-2 focus:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:truncate\",\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDown className=\"size-4 shrink-0 opacity-60\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = \"SelectTrigger\";\n\nconst SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = \"popper\", ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n position={position}\n sideOffset={6}\n className=\"z-50\"\n {...props}\n >\n <motion.div\n initial={{ opacity: 0, scale: 0.97 }}\n animate={{ opacity: 1, scale: 1 }}\n transition={tween.quick}\n style={{ transformOrigin: \"var(--radix-select-content-transform-origin)\" }}\n className={cn(\n \"max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lift\",\n position === \"popper\" && \"w-[var(--radix-select-trigger-width)]\",\n className\n )}\n >\n <SelectPrimitive.ScrollUpButton className=\"flex items-center justify-center py-1 text-muted-foreground\">\n <ChevronUp className=\"size-4\" />\n </SelectPrimitive.ScrollUpButton>\n <SelectPrimitive.Viewport className=\"p-1\">\n {children}\n </SelectPrimitive.Viewport>\n <SelectPrimitive.ScrollDownButton className=\"flex items-center justify-center py-1 text-muted-foreground\">\n <ChevronDown className=\"size-4\" />\n </SelectPrimitive.ScrollDownButton>\n </motion.div>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n));\nSelectContent.displayName = \"SelectContent\";\n\nconst SelectLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\"px-2 py-1.5 text-xs font-medium text-muted-foreground\", className)}\n {...props}\n />\n));\nSelectLabel.displayName = \"SelectLabel\";\n\nconst SelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-pointer select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-4 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"size-4 text-primary\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n));\nSelectItem.displayName = \"SelectItem\";\n\nconst SelectSeparator = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n));\nSelectSeparator.displayName = \"SelectSeparator\";\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\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,YAAY,qBAAqB;AACjC,SAAS,OAAO,aAAa,iBAAiB;AAC9C,SAAS,cAAc;;;ACLvB,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,MAA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EAAhB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEJ;AAAA,0BAAC,UAAK,WAAU,2DACd,8BAAiB,+BAAhB,EACC,8BAAC,SAAM,WAAU,uBAAsB,GACzC,GACF;AAAA,MACA,oBAAiB,0BAAhB,EAA0B,UAAS;AAAA;AAAA;AACtC,CACD;AACD,WAAW,cAAc;AAEzB,IAAM,kBAAwB,iBAG5B,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAiB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,6BAA6B,SAAS;AAAA,IACnD,GAAG;AAAA;AACN,CACD;AACD,gBAAgB,cAAc;","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
3
|
+
|
|
4
|
+
declare const Separator: React.ForwardRefExoticComponent<Omit<SeparatorPrimitive.SeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
|
|
6
|
+
export { Separator };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/ui/separator.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
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/separator.tsx
|
|
15
|
+
import { jsx } from "react/jsx-runtime";
|
|
16
|
+
var Separator = React.forwardRef(
|
|
17
|
+
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
18
|
+
SeparatorPrimitive.Root,
|
|
19
|
+
{
|
|
20
|
+
ref,
|
|
21
|
+
decorative,
|
|
22
|
+
orientation,
|
|
23
|
+
className: cn(
|
|
24
|
+
"shrink-0 bg-border",
|
|
25
|
+
orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
|
|
26
|
+
className
|
|
27
|
+
),
|
|
28
|
+
...props
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
);
|
|
32
|
+
Separator.displayName = "Separator";
|
|
33
|
+
export {
|
|
34
|
+
Separator
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=separator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/separator.tsx","../src/lib/cn.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\";\n\nimport { cn } from \"@/lib/cn\";\n\nconst Separator = React.forwardRef<\n React.ElementRef<typeof SeparatorPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(\n (\n { className, orientation = \"horizontal\", decorative = true, ...props },\n ref\n ) => (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-px w-full\" : \"h-full w-px\",\n className\n )}\n {...props}\n />\n )\n);\nSeparator.displayName = \"Separator\";\n\nexport { Separator };\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,wBAAwB;;;ACHpC,SAAS,YAA6B;AACtC,SAAS,eAAe;AAOjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ADKI;AARJ,IAAM,YAAkB;AAAA,EAItB,CACE,EAAE,WAAW,cAAc,cAAc,aAAa,MAAM,GAAG,MAAM,GACrE,QAEA;AAAA,IAAoB;AAAA,IAAnB;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA,gBAAgB,eAAe,gBAAgB;AAAA,QAC/C;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AACA,UAAU,cAAc;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { LucideIcon } from 'lucide-react';
|
|
3
|
+
|
|
4
|
+
interface SidebarItem {
|
|
5
|
+
label: string;
|
|
6
|
+
icon: LucideIcon;
|
|
7
|
+
value: string;
|
|
8
|
+
badge?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
interface SidebarSection {
|
|
11
|
+
title?: string;
|
|
12
|
+
items: SidebarItem[];
|
|
13
|
+
}
|
|
14
|
+
interface SidebarProps extends React.HTMLAttributes<HTMLElement> {
|
|
15
|
+
sections: SidebarSection[];
|
|
16
|
+
activeValue?: string;
|
|
17
|
+
defaultActiveValue?: string;
|
|
18
|
+
onActiveChange?: (value: string) => void;
|
|
19
|
+
brand?: React.ReactNode;
|
|
20
|
+
footer?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
declare const Sidebar: React.ForwardRefExoticComponent<SidebarProps & React.RefAttributes<HTMLElement>>;
|
|
23
|
+
|
|
24
|
+
export { Sidebar, type SidebarItem, type SidebarProps, type SidebarSection };
|
package/dist/sidebar.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/application/sidebar.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { motion, useReducedMotion } from "motion/react";
|
|
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/lib/motion-presets.ts
|
|
15
|
+
var spring = {
|
|
16
|
+
/** Quick, decisive — buttons, indicators, dropdowns. */
|
|
17
|
+
snappy: { type: "spring", stiffness: 420, damping: 32, mass: 0.8 },
|
|
18
|
+
/** Calm and weighty — dialogs, cards, larger surfaces. */
|
|
19
|
+
soft: { type: "spring", stiffness: 180, damping: 26 },
|
|
20
|
+
/** Playful overshoot — badges, toggles, delight moments. Use sparingly. */
|
|
21
|
+
bouncy: { type: "spring", stiffness: 480, damping: 18, mass: 0.9 }
|
|
22
|
+
};
|
|
23
|
+
var tween = {
|
|
24
|
+
/** The signature easing — an expressive ease-out for orchestrated reveals. */
|
|
25
|
+
smooth: { type: "tween", duration: 0.45, ease: [0.22, 1, 0.36, 1] },
|
|
26
|
+
/** Faster variant for small elements. */
|
|
27
|
+
quick: { type: "tween", duration: 0.28, ease: [0.22, 1, 0.36, 1] },
|
|
28
|
+
/** Longer, settled curve for drawing charts, count-ups, and progress fills. */
|
|
29
|
+
draw: { type: "tween", duration: 1.1, ease: [0.16, 1, 0.3, 1] }
|
|
30
|
+
};
|
|
31
|
+
var fadeUp = {
|
|
32
|
+
hidden: { opacity: 0, y: 18 },
|
|
33
|
+
visible: { opacity: 1, y: 0, transition: tween.smooth }
|
|
34
|
+
};
|
|
35
|
+
var fadeIn = {
|
|
36
|
+
hidden: { opacity: 0 },
|
|
37
|
+
visible: { opacity: 1, transition: tween.smooth }
|
|
38
|
+
};
|
|
39
|
+
var scaleIn = {
|
|
40
|
+
hidden: { opacity: 0, scale: 0.96 },
|
|
41
|
+
visible: { opacity: 1, scale: 1, transition: spring.soft }
|
|
42
|
+
};
|
|
43
|
+
var slideInLeft = {
|
|
44
|
+
hidden: { opacity: 0, x: -28 },
|
|
45
|
+
visible: { opacity: 1, x: 0, transition: tween.smooth }
|
|
46
|
+
};
|
|
47
|
+
var slideInRight = {
|
|
48
|
+
hidden: { opacity: 0, x: 28 },
|
|
49
|
+
visible: { opacity: 1, x: 0, transition: tween.smooth }
|
|
50
|
+
};
|
|
51
|
+
var blurIn = {
|
|
52
|
+
hidden: { opacity: 0, filter: "blur(12px)" },
|
|
53
|
+
visible: { opacity: 1, filter: "blur(0px)", transition: tween.smooth }
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// src/components/application/sidebar.tsx
|
|
57
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
58
|
+
function useControllableState({
|
|
59
|
+
prop,
|
|
60
|
+
defaultProp,
|
|
61
|
+
onChange
|
|
62
|
+
}) {
|
|
63
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultProp);
|
|
64
|
+
const isControlled = prop !== void 0;
|
|
65
|
+
const value = isControlled ? prop : uncontrolled;
|
|
66
|
+
const setValue = React.useCallback(
|
|
67
|
+
(next) => {
|
|
68
|
+
if (!isControlled) setUncontrolled(next);
|
|
69
|
+
onChange?.(next);
|
|
70
|
+
},
|
|
71
|
+
[isControlled, onChange]
|
|
72
|
+
);
|
|
73
|
+
return [value, setValue];
|
|
74
|
+
}
|
|
75
|
+
var Sidebar = React.forwardRef(
|
|
76
|
+
({
|
|
77
|
+
className,
|
|
78
|
+
sections,
|
|
79
|
+
activeValue,
|
|
80
|
+
defaultActiveValue,
|
|
81
|
+
onActiveChange,
|
|
82
|
+
brand,
|
|
83
|
+
footer,
|
|
84
|
+
...props
|
|
85
|
+
}, ref) => {
|
|
86
|
+
const firstValue = sections[0]?.items[0]?.value ?? "";
|
|
87
|
+
const [active, setActive] = useControllableState({
|
|
88
|
+
prop: activeValue,
|
|
89
|
+
defaultProp: defaultActiveValue ?? firstValue,
|
|
90
|
+
onChange: onActiveChange
|
|
91
|
+
});
|
|
92
|
+
const layoutId = React.useId();
|
|
93
|
+
const reduced = useReducedMotion();
|
|
94
|
+
return /* @__PURE__ */ jsxs(
|
|
95
|
+
"aside",
|
|
96
|
+
{
|
|
97
|
+
ref,
|
|
98
|
+
className: cn(
|
|
99
|
+
"flex h-full w-60 flex-col gap-4 border-r border-border bg-card p-3",
|
|
100
|
+
className
|
|
101
|
+
),
|
|
102
|
+
...props,
|
|
103
|
+
children: [
|
|
104
|
+
brand ? /* @__PURE__ */ jsx("div", { className: "px-2 py-2", children: brand }) : null,
|
|
105
|
+
/* @__PURE__ */ jsx("nav", { className: "flex flex-1 flex-col gap-5", children: sections.map((section, si) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
106
|
+
section.title ? /* @__PURE__ */ jsx("p", { className: "px-3 pb-1 text-xs font-medium uppercase tracking-wider text-muted-foreground", children: section.title }) : null,
|
|
107
|
+
section.items.map((item) => {
|
|
108
|
+
const Icon = item.icon;
|
|
109
|
+
const isActive = item.value === active;
|
|
110
|
+
return /* @__PURE__ */ jsxs(
|
|
111
|
+
"button",
|
|
112
|
+
{
|
|
113
|
+
type: "button",
|
|
114
|
+
onClick: () => setActive(item.value),
|
|
115
|
+
"aria-current": isActive ? "page" : void 0,
|
|
116
|
+
className: cn(
|
|
117
|
+
"relative flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
118
|
+
isActive ? "text-primary" : "text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
119
|
+
),
|
|
120
|
+
children: [
|
|
121
|
+
isActive ? /* @__PURE__ */ jsx(
|
|
122
|
+
motion.span,
|
|
123
|
+
{
|
|
124
|
+
layoutId: `${layoutId}-sidebar-active`,
|
|
125
|
+
transition: reduced ? { duration: 0 } : spring.snappy,
|
|
126
|
+
className: "absolute inset-0 rounded-lg bg-primary/10"
|
|
127
|
+
}
|
|
128
|
+
) : null,
|
|
129
|
+
/* @__PURE__ */ jsxs("span", { className: "relative z-10 flex flex-1 items-center gap-3", children: [
|
|
130
|
+
/* @__PURE__ */ jsx(Icon, { className: "size-4" }),
|
|
131
|
+
item.label,
|
|
132
|
+
item.badge ? /* @__PURE__ */ jsx("span", { className: "ml-auto", children: item.badge }) : null
|
|
133
|
+
] })
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
item.value
|
|
137
|
+
);
|
|
138
|
+
})
|
|
139
|
+
] }, si)) }),
|
|
140
|
+
footer ? /* @__PURE__ */ jsx("div", { className: "mt-auto", children: footer }) : null
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
Sidebar.displayName = "Sidebar";
|
|
147
|
+
export {
|
|
148
|
+
Sidebar
|
|
149
|
+
};
|
|
150
|
+
//# sourceMappingURL=sidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/application/sidebar.tsx","../src/lib/cn.ts","../src/lib/motion-presets.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { motion, useReducedMotion } from \"motion/react\";\nimport { type LucideIcon } from \"lucide-react\";\n\nimport { cn } from \"@/lib/cn\";\nimport { spring } from \"@/lib/motion-presets\";\n\nfunction useControllableState<T>({\n prop,\n defaultProp,\n onChange,\n}: {\n prop: T | undefined;\n defaultProp: T;\n onChange?: (value: T) => void;\n}): [T, (next: T) => void] {\n const [uncontrolled, setUncontrolled] = React.useState(defaultProp);\n const isControlled = prop !== undefined;\n const value = isControlled ? (prop as T) : uncontrolled;\n const setValue = React.useCallback(\n (next: T) => {\n if (!isControlled) setUncontrolled(next);\n onChange?.(next);\n },\n [isControlled, onChange]\n );\n return [value, setValue];\n}\n\nexport interface SidebarItem {\n label: string;\n icon: LucideIcon;\n value: string;\n badge?: React.ReactNode;\n}\n\nexport interface SidebarSection {\n title?: string;\n items: SidebarItem[];\n}\n\nexport interface SidebarProps extends React.HTMLAttributes<HTMLElement> {\n sections: SidebarSection[];\n activeValue?: string;\n defaultActiveValue?: string;\n onActiveChange?: (value: string) => void;\n brand?: React.ReactNode;\n footer?: React.ReactNode;\n}\n\nexport const Sidebar = React.forwardRef<HTMLElement, SidebarProps>(\n (\n {\n className,\n sections,\n activeValue,\n defaultActiveValue,\n onActiveChange,\n brand,\n footer,\n ...props\n },\n ref\n ) => {\n const firstValue = sections[0]?.items[0]?.value ?? \"\";\n const [active, setActive] = useControllableState({\n prop: activeValue,\n defaultProp: defaultActiveValue ?? firstValue,\n onChange: onActiveChange,\n });\n const layoutId = React.useId();\n const reduced = useReducedMotion();\n\n return (\n <aside\n ref={ref}\n className={cn(\n \"flex h-full w-60 flex-col gap-4 border-r border-border bg-card p-3\",\n className\n )}\n {...props}\n >\n {brand ? <div className=\"px-2 py-2\">{brand}</div> : null}\n\n <nav className=\"flex flex-1 flex-col gap-5\">\n {sections.map((section, si) => (\n <div key={si} className=\"flex flex-col gap-1\">\n {section.title ? (\n <p className=\"px-3 pb-1 text-xs font-medium uppercase tracking-wider text-muted-foreground\">\n {section.title}\n </p>\n ) : null}\n {section.items.map((item) => {\n const Icon = item.icon;\n const isActive = item.value === active;\n return (\n <button\n key={item.value}\n type=\"button\"\n onClick={() => setActive(item.value)}\n aria-current={isActive ? \"page\" : undefined}\n className={cn(\n \"relative flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n isActive\n ? \"text-primary\"\n : \"text-muted-foreground hover:bg-accent hover:text-foreground\"\n )}\n >\n {isActive ? (\n <motion.span\n layoutId={`${layoutId}-sidebar-active`}\n transition={reduced ? { duration: 0 } : spring.snappy}\n className=\"absolute inset-0 rounded-lg bg-primary/10\"\n />\n ) : null}\n <span className=\"relative z-10 flex flex-1 items-center gap-3\">\n <Icon className=\"size-4\" />\n {item.label}\n {item.badge ? (\n <span className=\"ml-auto\">{item.badge}</span>\n ) : null}\n </span>\n </button>\n );\n })}\n </div>\n ))}\n </nav>\n\n {footer ? <div className=\"mt-auto\">{footer}</div> : null}\n </aside>\n );\n }\n);\nSidebar.displayName = \"Sidebar\";\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,QAAQ,wBAAwB;;;ACHzC,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,E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