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,240 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import {
|
|
5
|
+
AnimatePresence,
|
|
6
|
+
motion,
|
|
7
|
+
useReducedMotion,
|
|
8
|
+
type Variants,
|
|
9
|
+
} from "motion/react";
|
|
10
|
+
import { cn } from "@/lib/utils";
|
|
11
|
+
|
|
12
|
+
type DoubtState = "idle" | "doubting" | "success";
|
|
13
|
+
|
|
14
|
+
export interface DoubtButtonProps
|
|
15
|
+
extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onClick"> {
|
|
16
|
+
/** Label shown before any doubt has been cast. Falls back to `label`. */
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/** Label shown in the idle state when no children are provided. */
|
|
19
|
+
label?: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Escalating confirmation prompts shown one per click. The final prompt, when
|
|
22
|
+
* clicked, fires `onConfirm`. The user must click `confirmations.length + 1`
|
|
23
|
+
* times total before the real action runs.
|
|
24
|
+
*/
|
|
25
|
+
confirmations?: React.ReactNode[];
|
|
26
|
+
/** Label flashed once the user finally pushes through every doubt. */
|
|
27
|
+
successLabel?: React.ReactNode;
|
|
28
|
+
/** Fired only after the last confirmation is clicked. */
|
|
29
|
+
onConfirm?: () => void;
|
|
30
|
+
/** Milliseconds to stay in the success state before resetting. Set to 0 to stay. */
|
|
31
|
+
resetAfter?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const DEFAULT_CONFIRMATIONS: string[] = [
|
|
35
|
+
"Are you sure?",
|
|
36
|
+
"Really, truly sure?",
|
|
37
|
+
"There is no undo. Still?",
|
|
38
|
+
"Think of the consequences.",
|
|
39
|
+
"I am obligated to ask again.",
|
|
40
|
+
"Last chance. Absolutely certain?",
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
const CheckIcon = () => (
|
|
44
|
+
<svg
|
|
45
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
46
|
+
viewBox="0 0 24 24"
|
|
47
|
+
fill="none"
|
|
48
|
+
stroke="currentColor"
|
|
49
|
+
strokeWidth="2.25"
|
|
50
|
+
strokeLinecap="round"
|
|
51
|
+
strokeLinejoin="round"
|
|
52
|
+
className="size-3.5 shrink-0"
|
|
53
|
+
aria-hidden
|
|
54
|
+
>
|
|
55
|
+
<path d="M20 6 9 17l-5-5" />
|
|
56
|
+
</svg>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const labelVariants: Variants = {
|
|
60
|
+
enter: { y: 8, opacity: 0 },
|
|
61
|
+
center: { y: 0, opacity: 1 },
|
|
62
|
+
exit: { y: -8, opacity: 0 },
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const DoubtButton = React.forwardRef<
|
|
66
|
+
HTMLButtonElement,
|
|
67
|
+
DoubtButtonProps
|
|
68
|
+
>(
|
|
69
|
+
(
|
|
70
|
+
{
|
|
71
|
+
children,
|
|
72
|
+
label = "Delete everything",
|
|
73
|
+
confirmations = DEFAULT_CONFIRMATIONS,
|
|
74
|
+
successLabel = "Too late.",
|
|
75
|
+
onConfirm,
|
|
76
|
+
resetAfter = 1600,
|
|
77
|
+
className,
|
|
78
|
+
disabled,
|
|
79
|
+
type = "button",
|
|
80
|
+
...props
|
|
81
|
+
},
|
|
82
|
+
ref,
|
|
83
|
+
) => {
|
|
84
|
+
const reduceMotion = useReducedMotion();
|
|
85
|
+
|
|
86
|
+
// 0 = idle; 1..steps show confirmations[index - 1]; clicking the last fires.
|
|
87
|
+
const [index, setIndex] = React.useState(0);
|
|
88
|
+
const [state, setState] = React.useState<DoubtState>("idle");
|
|
89
|
+
const [shakeKey, setShakeKey] = React.useState(0);
|
|
90
|
+
|
|
91
|
+
const resetTimeoutRef = React.useRef<number | null>(null);
|
|
92
|
+
|
|
93
|
+
const steps = confirmations.length;
|
|
94
|
+
|
|
95
|
+
const clearResetTimeout = () => {
|
|
96
|
+
if (resetTimeoutRef.current !== null) {
|
|
97
|
+
window.clearTimeout(resetTimeoutRef.current);
|
|
98
|
+
resetTimeoutRef.current = null;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
React.useEffect(() => () => clearResetTimeout(), []);
|
|
103
|
+
|
|
104
|
+
const handleClick = () => {
|
|
105
|
+
if (disabled || state === "success") return;
|
|
106
|
+
|
|
107
|
+
// No confirmations configured: behave like a normal one-shot button.
|
|
108
|
+
if (steps === 0) {
|
|
109
|
+
fire();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (index < steps) {
|
|
114
|
+
setIndex((i) => i + 1);
|
|
115
|
+
setState("doubting");
|
|
116
|
+
setShakeKey((k) => k + 1);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
fire();
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const fire = () => {
|
|
124
|
+
clearResetTimeout();
|
|
125
|
+
setState("success");
|
|
126
|
+
setIndex(0);
|
|
127
|
+
onConfirm?.();
|
|
128
|
+
if (resetAfter > 0) {
|
|
129
|
+
resetTimeoutRef.current = window.setTimeout(() => {
|
|
130
|
+
setState("idle");
|
|
131
|
+
}, resetAfter);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const isSuccess = state === "success";
|
|
136
|
+
|
|
137
|
+
// Share of doubts answered, drawn as a hairline along the bottom edge.
|
|
138
|
+
const progress = isSuccess ? 1 : steps === 0 ? 0 : index / steps;
|
|
139
|
+
|
|
140
|
+
const currentLabel: React.ReactNode = isSuccess
|
|
141
|
+
? successLabel
|
|
142
|
+
: index === 0
|
|
143
|
+
? (children ?? label)
|
|
144
|
+
: confirmations[index - 1];
|
|
145
|
+
|
|
146
|
+
// A stable key so AnimatePresence animates between distinct prompts.
|
|
147
|
+
const labelKey = isSuccess ? "success" : `step-${index}`;
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<button
|
|
151
|
+
ref={ref}
|
|
152
|
+
type={type}
|
|
153
|
+
disabled={disabled}
|
|
154
|
+
aria-live="polite"
|
|
155
|
+
data-state={state}
|
|
156
|
+
onClick={handleClick}
|
|
157
|
+
className={cn(
|
|
158
|
+
"relative inline-flex h-9 min-w-48 cursor-pointer items-center justify-center overflow-hidden rounded-[10px] px-4 text-sm font-medium text-neutral-50 outline-none select-none",
|
|
159
|
+
// Graded dark surface matching MinimalButton: dark outer hairline, faint inner ring, top highlight, soft drop.
|
|
160
|
+
"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)]",
|
|
161
|
+
"transition-[scale,filter,box-shadow] duration-300 ease-[cubic-bezier(0.34,1.35,0.64,1)] hover:brightness-110",
|
|
162
|
+
"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",
|
|
163
|
+
"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",
|
|
164
|
+
className,
|
|
165
|
+
)}
|
|
166
|
+
{...props}
|
|
167
|
+
>
|
|
168
|
+
<motion.span
|
|
169
|
+
key={shakeKey}
|
|
170
|
+
animate={
|
|
171
|
+
reduceMotion || shakeKey === 0 || isSuccess
|
|
172
|
+
? undefined
|
|
173
|
+
: { x: [0, -4, 4, -2, 2, 0] }
|
|
174
|
+
}
|
|
175
|
+
transition={{ duration: 0.3, ease: "easeInOut" }}
|
|
176
|
+
className="inline-flex items-center gap-1.5"
|
|
177
|
+
>
|
|
178
|
+
{isSuccess ? <CheckIcon /> : null}
|
|
179
|
+
<span className="relative inline-grid">
|
|
180
|
+
{/* Invisible widest prompt reserves width so the button never jumps. */}
|
|
181
|
+
<span
|
|
182
|
+
aria-hidden
|
|
183
|
+
className="invisible col-start-1 row-start-1 whitespace-nowrap"
|
|
184
|
+
>
|
|
185
|
+
{[label, successLabel, ...confirmations].reduce<React.ReactNode>(
|
|
186
|
+
(widest, candidate) =>
|
|
187
|
+
String(extractText(candidate)).length >
|
|
188
|
+
String(extractText(widest)).length
|
|
189
|
+
? candidate
|
|
190
|
+
: widest,
|
|
191
|
+
"",
|
|
192
|
+
)}
|
|
193
|
+
</span>
|
|
194
|
+
<AnimatePresence mode="popLayout" initial={false}>
|
|
195
|
+
<motion.span
|
|
196
|
+
key={labelKey}
|
|
197
|
+
variants={reduceMotion ? undefined : labelVariants}
|
|
198
|
+
initial="enter"
|
|
199
|
+
animate="center"
|
|
200
|
+
exit="exit"
|
|
201
|
+
transition={{ duration: 0.18, ease: "easeOut" }}
|
|
202
|
+
className="col-start-1 row-start-1 whitespace-nowrap text-center"
|
|
203
|
+
>
|
|
204
|
+
{currentLabel}
|
|
205
|
+
</motion.span>
|
|
206
|
+
</AnimatePresence>
|
|
207
|
+
</span>
|
|
208
|
+
</motion.span>
|
|
209
|
+
|
|
210
|
+
{steps > 0 && (
|
|
211
|
+
<span
|
|
212
|
+
aria-hidden
|
|
213
|
+
className="absolute inset-x-0 bottom-0 h-0.5 origin-left bg-current opacity-50 transition-transform duration-300 ease-out"
|
|
214
|
+
style={{ transform: `scaleX(${progress})` }}
|
|
215
|
+
/>
|
|
216
|
+
)}
|
|
217
|
+
</button>
|
|
218
|
+
);
|
|
219
|
+
},
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
function extractText(node: React.ReactNode): string {
|
|
223
|
+
if (node === null || node === undefined || typeof node === "boolean") {
|
|
224
|
+
return "";
|
|
225
|
+
}
|
|
226
|
+
if (typeof node === "string" || typeof node === "number") {
|
|
227
|
+
return String(node);
|
|
228
|
+
}
|
|
229
|
+
if (Array.isArray(node)) {
|
|
230
|
+
return node.map(extractText).join("");
|
|
231
|
+
}
|
|
232
|
+
if (React.isValidElement<{ children?: React.ReactNode }>(node)) {
|
|
233
|
+
return extractText(node.props.children);
|
|
234
|
+
}
|
|
235
|
+
return "";
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
DoubtButton.displayName = "DoubtButton";
|
|
239
|
+
|
|
240
|
+
export default DoubtButton;
|