motion-ui-skill 2.0.0 → 2.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/README.md +71 -21
- package/SKILL.md +83 -9
- package/bin/index.mjs +2 -2
- package/bin/installer.mjs +6 -0
- package/catalog.json +1044 -139
- package/components/agents/thinking-states.tsx +156 -0
- package/components/buttons/aqua-button.tsx +145 -0
- package/components/buttons/ash-burst-button.tsx +528 -0
- package/components/buttons/brutal-button.tsx +68 -0
- package/components/buttons/chrome-button.tsx +444 -0
- package/components/buttons/click-powerup.tsx +203 -0
- package/components/buttons/command-button.tsx +226 -0
- package/components/buttons/confetti-button.tsx +132 -0
- package/components/buttons/cooldown-button.tsx +169 -0
- package/components/buttons/demonic-button.tsx +470 -0
- package/components/buttons/dither-button.tsx +192 -0
- package/components/buttons/doubt-button.tsx +240 -0
- package/components/buttons/evil-eye-button.tsx +563 -0
- package/components/buttons/frame-button.tsx +211 -0
- package/components/buttons/glitch-button.tsx +243 -0
- package/components/buttons/highlight-button.tsx +196 -0
- package/components/buttons/hold-button.tsx +245 -0
- package/components/buttons/minecraft-button.tsx +651 -0
- package/components/buttons/minimal-button.tsx +50 -0
- package/components/buttons/morph-status-button.tsx +264 -0
- package/components/buttons/movie-pass-button.tsx +205 -0
- package/components/buttons/realistic-switch.tsx +298 -0
- package/components/buttons/reveal-button.tsx +197 -0
- package/components/buttons/shiny-button.tsx +87 -0
- package/components/buttons/slide-to-detonate.tsx +444 -0
- package/components/buttons/sticky-button.tsx +184 -0
- package/components/buttons/thruster-button.tsx +920 -0
- package/components/buttons/troll-button.tsx +264 -0
- package/components/motion/banner-stacking.tsx +124 -0
- package/components/motion/delete-with-smoky-dissolve.tsx +145 -0
- package/components/motion/donut-chart.tsx +112 -0
- package/components/motion/drag-drop-with-physics.tsx +116 -0
- package/components/motion/dropdown-menu-morph.tsx +157 -0
- package/components/motion/get-pro-button.tsx +54 -0
- package/components/motion/image-open-tilt.tsx +79 -0
- package/components/motion/input-clear-with-dissolve.tsx +111 -0
- package/components/motion/learn-more-hover.tsx +71 -0
- package/components/motion/matrix-dot-loader.tsx +68 -0
- package/components/motion/organic-shimmer.tsx +49 -0
- package/components/motion/pro-gradient-text.tsx +46 -0
- package/components/motion/skeleton-loader-and-reveal.tsx +81 -0
- package/components/motion/spinner-to-check-morph.tsx +99 -0
- package/components/motion/spinning-counter.tsx +64 -0
- package/components/motion/text-morph.tsx +80 -0
- package/components/motion/texts-reveal.tsx +49 -0
- package/data/app-interface.csv +33 -0
- package/data/charts.csv +26 -0
- package/data/colors.csv +193 -0
- package/data/google-fonts.csv +1935 -0
- package/data/icons.csv +106 -0
- package/data/landing.csv +35 -0
- package/data/motion.csv +18 -0
- package/data/products.csv +193 -0
- package/data/react-performance.csv +45 -0
- package/data/stacks/angular.csv +51 -0
- package/data/stacks/astro.csv +54 -0
- package/data/stacks/avalonia.csv +57 -0
- package/data/stacks/flutter.csv +53 -0
- package/data/stacks/html-tailwind.csv +60 -0
- package/data/stacks/javafx.csv +76 -0
- package/data/stacks/jetpack-compose.csv +53 -0
- package/data/stacks/laravel.csv +51 -0
- package/data/stacks/nextjs.csv +62 -0
- package/data/stacks/nuxt-ui.csv +77 -0
- package/data/stacks/nuxtjs.csv +68 -0
- package/data/stacks/react-native.csv +52 -0
- package/data/stacks/react.csv +67 -0
- package/data/stacks/shadcn.csv +69 -0
- package/data/stacks/svelte.csv +56 -0
- package/data/stacks/swiftui.csv +51 -0
- package/data/stacks/threejs.csv +54 -0
- package/data/stacks/uno.csv +60 -0
- package/data/stacks/uwp.csv +56 -0
- package/data/stacks/vue.csv +50 -0
- package/data/stacks/winui.csv +60 -0
- package/data/stacks/wpf.csv +57 -0
- package/data/styles.csv +89 -0
- package/data/typography.csv +75 -0
- package/data/ui-reasoning.csv +193 -0
- package/data/ux-guidelines.csv +120 -0
- package/evals/catalog_eval.py +56 -0
- package/icons/annotations/loop-arrow.tsx +61 -0
- package/icons/brands/anthropic.tsx +26 -0
- package/icons/brands/apple.tsx +26 -0
- package/icons/brands/canva.tsx +26 -0
- package/icons/brands/claude-ai.tsx +26 -0
- package/icons/brands/discord.tsx +26 -0
- package/icons/brands/github.tsx +26 -0
- package/icons/brands/gmail.tsx +26 -0
- package/icons/brands/google.tsx +26 -0
- package/icons/brands/linkedin.tsx +29 -0
- package/icons/brands/microsoft.tsx +26 -0
- package/icons/brands/next-js.tsx +26 -0
- package/icons/brands/producthunt.tsx +26 -0
- package/icons/brands/react-js.tsx +29 -0
- package/icons/brands/shadcn-ui.tsx +26 -0
- package/icons/brands/tailwind-css.tsx +26 -0
- package/icons/brands/twitter.tsx +30 -0
- package/icons/brands/typescript.tsx +26 -0
- package/icons/brands/unsplash.tsx +27 -0
- package/icons/brands/vercel.tsx +26 -0
- package/icons/brands/whatsapp.tsx +26 -0
- package/package.json +9 -3
- package/prompts/install-motion-ui.md +17 -0
- package/references/agents/thinking-states.md +56 -0
- package/references/craft/aqua-button.md +53 -0
- package/references/craft/ash-burst-button.md +55 -0
- package/references/craft/brutal-button.md +52 -0
- package/references/craft/chrome-button.md +53 -0
- package/references/craft/click-powerup.md +53 -0
- package/references/craft/command-button.md +53 -0
- package/references/craft/confetti-button.md +54 -0
- package/references/craft/cooldown-button.md +54 -0
- package/references/craft/demonic-button.md +53 -0
- package/references/craft/dither-button.md +52 -0
- package/references/craft/doubt-button.md +53 -0
- package/references/craft/evil-eye-button.md +52 -0
- package/references/craft/frame-button.md +54 -0
- package/references/craft/glitch-button.md +52 -0
- package/references/craft/highlight-button.md +53 -0
- package/references/craft/hold-button.md +53 -0
- package/references/craft/minecraft-button.md +53 -0
- package/references/craft/minimal-button.md +52 -0
- package/references/craft/morph-status-button.md +53 -0
- package/references/craft/movie-pass-button.md +53 -0
- package/references/craft/realistic-switch.md +54 -0
- package/references/craft/reveal-button.md +53 -0
- package/references/craft/shiny-button.md +52 -0
- package/references/craft/slide-to-detonate.md +53 -0
- package/references/craft/sticky-button.md +54 -0
- package/references/craft/thruster-button.md +53 -0
- package/references/craft/troll-button.md +54 -0
- package/references/guides/design-intelligence.md +125 -0
- package/references/guides/interaction-transitions.md +56 -38
- package/references/guides/motion-polish-rules.md +75 -0
- package/references/guides/stack-best-practices.md +38 -0
- package/references/motion/banner-stacking.md +67 -0
- package/references/motion/delete-with-smoky-dissolve.md +60 -0
- package/references/motion/donut-chart.md +79 -0
- package/references/motion/drag-drop-with-physics.md +61 -0
- package/references/motion/dropdown-menu-morph.md +55 -0
- package/references/motion/get-pro-button.md +56 -0
- package/references/motion/image-open-tilt.md +60 -0
- package/references/motion/input-clear-with-dissolve.md +58 -0
- package/references/motion/learn-more-hover.md +56 -0
- package/references/motion/matrix-dot-loader.md +58 -0
- package/references/motion/organic-shimmer.md +63 -0
- package/references/motion/pro-gradient-text.md +57 -0
- package/references/motion/skeleton-loader-and-reveal.md +67 -0
- package/references/motion/spinner-to-check-morph.md +67 -0
- package/references/motion/spinning-counter.md +74 -0
- package/references/motion/text-morph.md +64 -0
- package/references/motion/texts-reveal.md +56 -0
- package/scripts/build_docs.py +39 -4
- package/scripts/core.py +993 -0
- package/scripts/design_system.py +1668 -0
- package/scripts/reasoning_contract.py +123 -0
- package/scripts/search.py +177 -0
- package/scripts/test_release.py +12 -0
- package/scripts/verify_skill.py +4 -4
- package/test/test_installer.mjs +133 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
type HoldState = "idle" | "holding" | "success";
|
|
7
|
+
|
|
8
|
+
export interface HoldButtonProps
|
|
9
|
+
extends Omit<
|
|
10
|
+
React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
11
|
+
"onClick" | "onAbort"
|
|
12
|
+
> {
|
|
13
|
+
/** Time in milliseconds the user must hold before the action fires. */
|
|
14
|
+
duration?: number;
|
|
15
|
+
/** Label shown while idle. */
|
|
16
|
+
label?: React.ReactNode;
|
|
17
|
+
/** Label shown while the button is being held. */
|
|
18
|
+
holdingLabel?: React.ReactNode;
|
|
19
|
+
/** Label shown once the action completes. */
|
|
20
|
+
successLabel?: React.ReactNode;
|
|
21
|
+
/** Fired when the hold reaches 100%. */
|
|
22
|
+
onConfirm?: () => void;
|
|
23
|
+
/** Fired when the hold is released early. Receives the progress (0-1) reached. */
|
|
24
|
+
onAbort?: (progress: number) => void;
|
|
25
|
+
/** Milliseconds to stay in the success state before resetting. Set to 0 to stay. */
|
|
26
|
+
resetAfter?: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const CheckIcon = () => (
|
|
30
|
+
<svg
|
|
31
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
32
|
+
viewBox="0 0 24 24"
|
|
33
|
+
fill="none"
|
|
34
|
+
stroke="currentColor"
|
|
35
|
+
strokeWidth="2.25"
|
|
36
|
+
strokeLinecap="round"
|
|
37
|
+
strokeLinejoin="round"
|
|
38
|
+
className="size-3.5 shrink-0"
|
|
39
|
+
aria-hidden
|
|
40
|
+
>
|
|
41
|
+
<path d="M20 6 9 17l-5-5" />
|
|
42
|
+
</svg>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
export const HoldButton = React.forwardRef<HTMLButtonElement, HoldButtonProps>(
|
|
46
|
+
(
|
|
47
|
+
{
|
|
48
|
+
duration = 1500,
|
|
49
|
+
label = "Hold to delete",
|
|
50
|
+
holdingLabel = "Keep holding…",
|
|
51
|
+
successLabel = "Deleted",
|
|
52
|
+
onConfirm,
|
|
53
|
+
onAbort,
|
|
54
|
+
resetAfter = 1400,
|
|
55
|
+
className,
|
|
56
|
+
disabled,
|
|
57
|
+
type = "button",
|
|
58
|
+
...props
|
|
59
|
+
},
|
|
60
|
+
ref,
|
|
61
|
+
) => {
|
|
62
|
+
const [state, setState] = React.useState<HoldState>("idle");
|
|
63
|
+
const [width, setWidth] = React.useState(0);
|
|
64
|
+
|
|
65
|
+
const buttonRef = React.useRef<HTMLButtonElement | null>(null);
|
|
66
|
+
const fillRef = React.useRef<HTMLSpanElement | null>(null);
|
|
67
|
+
const rafRef = React.useRef<number | null>(null);
|
|
68
|
+
const startRef = React.useRef(0);
|
|
69
|
+
const progressRef = React.useRef(0);
|
|
70
|
+
const resetTimeoutRef = React.useRef<number | null>(null);
|
|
71
|
+
|
|
72
|
+
const setButtonRef = (node: HTMLButtonElement | null) => {
|
|
73
|
+
buttonRef.current = node;
|
|
74
|
+
if (typeof ref === "function") ref(node);
|
|
75
|
+
else if (ref) ref.current = node;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// Keep the knockout label sized to the full button width so the reveal
|
|
79
|
+
// wipes cleanly left-to-right without distorting the text.
|
|
80
|
+
React.useEffect(() => {
|
|
81
|
+
const node = buttonRef.current;
|
|
82
|
+
if (!node || typeof ResizeObserver === "undefined") return;
|
|
83
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
84
|
+
setWidth(entry.contentRect.width + 32);
|
|
85
|
+
});
|
|
86
|
+
observer.observe(node);
|
|
87
|
+
return () => observer.disconnect();
|
|
88
|
+
}, []);
|
|
89
|
+
|
|
90
|
+
React.useEffect(() => {
|
|
91
|
+
return () => {
|
|
92
|
+
if (rafRef.current !== null) cancelAnimationFrame(rafRef.current);
|
|
93
|
+
if (resetTimeoutRef.current !== null) {
|
|
94
|
+
window.clearTimeout(resetTimeoutRef.current);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}, []);
|
|
98
|
+
|
|
99
|
+
const stopLoop = () => {
|
|
100
|
+
if (rafRef.current !== null) {
|
|
101
|
+
cancelAnimationFrame(rafRef.current);
|
|
102
|
+
rafRef.current = null;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const setFill = (value: number, animated: boolean) => {
|
|
107
|
+
progressRef.current = value;
|
|
108
|
+
const node = fillRef.current;
|
|
109
|
+
if (!node) return;
|
|
110
|
+
node.style.transition = animated ? "width 260ms ease-out" : "none";
|
|
111
|
+
node.style.width = `${value * 100}%`;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const complete = () => {
|
|
115
|
+
stopLoop();
|
|
116
|
+
setFill(1, false);
|
|
117
|
+
setState("success");
|
|
118
|
+
onConfirm?.();
|
|
119
|
+
if (resetAfter > 0) {
|
|
120
|
+
resetTimeoutRef.current = window.setTimeout(() => {
|
|
121
|
+
setFill(0, true);
|
|
122
|
+
setState("idle");
|
|
123
|
+
}, resetAfter);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const tick = (now: number) => {
|
|
128
|
+
const value = Math.min((now - startRef.current) / duration, 1);
|
|
129
|
+
setFill(value, false);
|
|
130
|
+
if (value >= 1) {
|
|
131
|
+
complete();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
rafRef.current = requestAnimationFrame(tick);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const startHold = () => {
|
|
138
|
+
if (disabled || state !== "idle") return;
|
|
139
|
+
if (resetTimeoutRef.current !== null) {
|
|
140
|
+
window.clearTimeout(resetTimeoutRef.current);
|
|
141
|
+
}
|
|
142
|
+
setState("holding");
|
|
143
|
+
startRef.current = performance.now();
|
|
144
|
+
setFill(0, false);
|
|
145
|
+
stopLoop();
|
|
146
|
+
rafRef.current = requestAnimationFrame(tick);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const cancelHold = () => {
|
|
150
|
+
if (state !== "holding") return;
|
|
151
|
+
stopLoop();
|
|
152
|
+
const reached = progressRef.current;
|
|
153
|
+
setState("idle");
|
|
154
|
+
setFill(0, true);
|
|
155
|
+
buttonRef.current?.animate?.(
|
|
156
|
+
[
|
|
157
|
+
{ transform: "translateX(0)" },
|
|
158
|
+
{ transform: "translateX(-4px)" },
|
|
159
|
+
{ transform: "translateX(4px)" },
|
|
160
|
+
{ transform: "translateX(-2px)" },
|
|
161
|
+
{ transform: "translateX(2px)" },
|
|
162
|
+
{ transform: "translateX(0)" },
|
|
163
|
+
],
|
|
164
|
+
{ duration: 300, easing: "ease-in-out" },
|
|
165
|
+
);
|
|
166
|
+
onAbort?.(reached);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const isSuccess = state === "success";
|
|
170
|
+
const isHolding = state === "holding";
|
|
171
|
+
|
|
172
|
+
const content = (
|
|
173
|
+
<>
|
|
174
|
+
{isSuccess ? <CheckIcon /> : null}
|
|
175
|
+
<span>
|
|
176
|
+
{isSuccess ? successLabel : isHolding ? holdingLabel : label}
|
|
177
|
+
</span>
|
|
178
|
+
</>
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<button
|
|
183
|
+
ref={setButtonRef}
|
|
184
|
+
type={type}
|
|
185
|
+
disabled={disabled}
|
|
186
|
+
aria-live="polite"
|
|
187
|
+
data-state={state}
|
|
188
|
+
onPointerDown={(e) => {
|
|
189
|
+
if (e.button !== 0 && e.pointerType === "mouse") return;
|
|
190
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
191
|
+
startHold();
|
|
192
|
+
}}
|
|
193
|
+
onPointerUp={cancelHold}
|
|
194
|
+
onPointerCancel={cancelHold}
|
|
195
|
+
onLostPointerCapture={cancelHold}
|
|
196
|
+
onKeyDown={(e) => {
|
|
197
|
+
if ((e.key === " " || e.key === "Enter") && !e.repeat) {
|
|
198
|
+
e.preventDefault();
|
|
199
|
+
startHold();
|
|
200
|
+
}
|
|
201
|
+
}}
|
|
202
|
+
onKeyUp={(e) => {
|
|
203
|
+
if (e.key === " " || e.key === "Enter") {
|
|
204
|
+
e.preventDefault();
|
|
205
|
+
cancelHold();
|
|
206
|
+
}
|
|
207
|
+
}}
|
|
208
|
+
onContextMenu={(e) => e.preventDefault()}
|
|
209
|
+
className={cn(
|
|
210
|
+
"relative inline-flex h-9 min-w-44 cursor-pointer items-center justify-center overflow-hidden rounded-[10px] px-4 text-sm font-medium text-neutral-50 outline-none select-none",
|
|
211
|
+
// Graded dark surface matching MinimalButton: dark outer hairline, faint inner ring, top highlight, soft drop.
|
|
212
|
+
"bg-linear-to-b from-[#353535] to-[#272727] shadow-[0_0_0_1px_rgb(0_0_0/0.9),inset_0_0_0_1px_rgb(255_255_255/0.06),inset_0_1px_0_rgb(255_255_255/0.14),0_1px_2px_rgb(0_0_0/0.25),0_4px_12px_-4px_rgb(0_0_0/0.4)]",
|
|
213
|
+
"transition-[scale,filter,box-shadow] duration-300 ease-[cubic-bezier(0.34,1.35,0.64,1)] hover:brightness-110",
|
|
214
|
+
"active:scale-[0.97] active:brightness-95 active:duration-100 active:ease-out active:shadow-[0_0_0_1px_rgb(0_0_0/0.9),inset_0_0_0_1px_rgb(255_255_255/0.05),inset_0_1px_0_rgb(255_255_255/0.08),0_0_1px_rgb(0_0_0/0.2),0_1px_3px_-2px_rgb(0_0_0/0.3)] motion-reduce:active:scale-100",
|
|
215
|
+
"touch-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",
|
|
216
|
+
className,
|
|
217
|
+
)}
|
|
218
|
+
{...props}
|
|
219
|
+
>
|
|
220
|
+
{/* Base label, visible where the fill has not yet covered. */}
|
|
221
|
+
<span className="relative z-10 inline-flex items-center gap-1.5">
|
|
222
|
+
{content}
|
|
223
|
+
</span>
|
|
224
|
+
|
|
225
|
+
{/* Fill overlay that wipes across and reveals a knockout inverted label. */}
|
|
226
|
+
<span
|
|
227
|
+
ref={fillRef}
|
|
228
|
+
aria-hidden
|
|
229
|
+
className="absolute inset-y-0 left-0 z-20 w-0 overflow-hidden bg-linear-to-b from-neutral-50 to-neutral-200"
|
|
230
|
+
>
|
|
231
|
+
<span
|
|
232
|
+
className="absolute inset-y-0 left-0 inline-flex items-center justify-center gap-1.5 text-neutral-900"
|
|
233
|
+
style={{ width: width ? `${width}px` : "100%" }}
|
|
234
|
+
>
|
|
235
|
+
{content}
|
|
236
|
+
</span>
|
|
237
|
+
</span>
|
|
238
|
+
</button>
|
|
239
|
+
);
|
|
240
|
+
},
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
HoldButton.displayName = "HoldButton";
|
|
244
|
+
|
|
245
|
+
export default HoldButton;
|