ruler-components 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.
Files changed (114) hide show
  1. package/AGENTS.md +9 -0
  2. package/CLAUDE.md +1 -0
  3. package/LICENSE +21 -0
  4. package/README.md +45 -0
  5. package/app/docs/[slug]/page.tsx +147 -0
  6. package/app/docs/layout.tsx +26 -0
  7. package/app/docs/page.tsx +148 -0
  8. package/app/favicon.ico +0 -0
  9. package/app/globals.css +168 -0
  10. package/app/icon.png +0 -0
  11. package/app/layout.tsx +90 -0
  12. package/app/opengraph-image.tsx +10 -0
  13. package/app/page.tsx +34 -0
  14. package/app/twitter-image.tsx +10 -0
  15. package/components/docs/accordion-doc-page.tsx +352 -0
  16. package/components/docs/alert-doc-page.tsx +293 -0
  17. package/components/docs/allinput-doc-page.tsx +183 -0
  18. package/components/docs/avatar-doc-page.tsx +424 -0
  19. package/components/docs/badge-doc-page.tsx +363 -0
  20. package/components/docs/button-doc-page.tsx +406 -0
  21. package/components/docs/card-doc-page.tsx +364 -0
  22. package/components/docs/checkbox-doc-page.tsx +277 -0
  23. package/components/docs/colors-doc-page.tsx +430 -0
  24. package/components/docs/dialog-doc-page.tsx +364 -0
  25. package/components/docs/docs-footer.tsx +11 -0
  26. package/components/docs/docs-mobile-menu-bar.tsx +22 -0
  27. package/components/docs/docs-mobile-nav-context.tsx +27 -0
  28. package/components/docs/docs-page.tsx +263 -0
  29. package/components/docs/docs-search.tsx +303 -0
  30. package/components/docs/docs-sidebar.tsx +165 -0
  31. package/components/docs/docs-topbar.tsx +32 -0
  32. package/components/docs/dropdown-doc-page.tsx +522 -0
  33. package/components/docs/getting-started-doc-page.tsx +205 -0
  34. package/components/docs/label-doc-page.tsx +173 -0
  35. package/components/docs/loaders-doc-page.tsx +244 -0
  36. package/components/docs/menu-doc-page.tsx +373 -0
  37. package/components/docs/modal-doc-page.tsx +436 -0
  38. package/components/docs/next-steps.tsx +53 -0
  39. package/components/docs/pagination-doc-page.tsx +316 -0
  40. package/components/docs/progress-doc-page.tsx +387 -0
  41. package/components/docs/radio-doc-page.tsx +270 -0
  42. package/components/docs/skeleton-doc-page.tsx +230 -0
  43. package/components/docs/stepper-doc-page.tsx +309 -0
  44. package/components/docs/switch-doc-page.tsx +264 -0
  45. package/components/docs/table-doc-page.tsx +689 -0
  46. package/components/docs/tabs-doc-page.tsx +359 -0
  47. package/components/docs/theming-doc-page.tsx +243 -0
  48. package/components/docs/tooltip-doc-page.tsx +357 -0
  49. package/components/docs/usage-section.tsx +21 -0
  50. package/components/icons/discord.tsx +9 -0
  51. package/components/icons/github.tsx +9 -0
  52. package/components/icons/x.tsx +9 -0
  53. package/components/installation-section.tsx +34 -0
  54. package/components/landing/feature-highlights.tsx +105 -0
  55. package/components/landing/footer-strip.tsx +45 -0
  56. package/components/landing/hero-card.tsx +14 -0
  57. package/components/landing/hero-spotlight.tsx +126 -0
  58. package/components/landing/hero.tsx +64 -0
  59. package/components/landing/navbar.tsx +44 -0
  60. package/components/landing/quick-start-section.tsx +59 -0
  61. package/components/landing/site-footer.tsx +55 -0
  62. package/components/theme-provider.tsx +60 -0
  63. package/components/ui/accordion.tsx +174 -0
  64. package/components/ui/alert.tsx +103 -0
  65. package/components/ui/allinput.tsx +210 -0
  66. package/components/ui/avatar.tsx +179 -0
  67. package/components/ui/badge.tsx +52 -0
  68. package/components/ui/button.tsx +75 -0
  69. package/components/ui/card.tsx +105 -0
  70. package/components/ui/checkbox.tsx +130 -0
  71. package/components/ui/code-block.tsx +60 -0
  72. package/components/ui/data-table.tsx +235 -0
  73. package/components/ui/dialog.tsx +173 -0
  74. package/components/ui/dropdown.tsx +78 -0
  75. package/components/ui/feature-card.tsx +38 -0
  76. package/components/ui/input.tsx +44 -0
  77. package/components/ui/label.tsx +110 -0
  78. package/components/ui/loaders.tsx +139 -0
  79. package/components/ui/menu.tsx +118 -0
  80. package/components/ui/modal.tsx +399 -0
  81. package/components/ui/package-manager-tabs.tsx +40 -0
  82. package/components/ui/pagination.tsx +200 -0
  83. package/components/ui/progress.tsx +134 -0
  84. package/components/ui/radio.tsx +262 -0
  85. package/components/ui/skeleton.tsx +102 -0
  86. package/components/ui/steppers.tsx +309 -0
  87. package/components/ui/switch.tsx +153 -0
  88. package/components/ui/table.tsx +58 -0
  89. package/components/ui/tabs.tsx +166 -0
  90. package/components/ui/theme-toggle.tsx +60 -0
  91. package/components/ui/tooltip.tsx +238 -0
  92. package/data/color-palette.ts +35 -0
  93. package/data/docs-nav.ts +84 -0
  94. package/eslint.config.mjs +18 -0
  95. package/index.ts +8 -0
  96. package/lib/cn.ts +4 -0
  97. package/lib/color.ts +85 -0
  98. package/lib/og-image.tsx +138 -0
  99. package/lib/theme.ts +33 -0
  100. package/next.config.ts +7 -0
  101. package/package.json +30 -0
  102. package/postcss.config.mjs +7 -0
  103. package/public/dark.png +0 -0
  104. package/public/dark1.png +0 -0
  105. package/public/dark2.png +0 -0
  106. package/public/file.svg +1 -0
  107. package/public/globe.svg +1 -0
  108. package/public/light.png +0 -0
  109. package/public/light1.png +0 -0
  110. package/public/next.svg +1 -0
  111. package/public/vercel.svg +1 -0
  112. package/public/video/hero-demo.mp4 +0 -0
  113. package/public/window.svg +1 -0
  114. package/tsconfig.json +34 -0
@@ -0,0 +1,406 @@
1
+ "use client";
2
+
3
+ import React, { useState } from "react";
4
+ import {
5
+ ArrowRight,
6
+ Check,
7
+ CheckCircle2,
8
+ Copy,
9
+ Download,
10
+ Loader2,
11
+ Mail,
12
+ MousePointerClick,
13
+ Plus,
14
+ Sparkles,
15
+ Trash2,
16
+ } from "lucide-react";
17
+ import { Button, type ButtonProps } from "@/components/ui/button";
18
+ import { Badge } from "@/components/ui/badge";
19
+ import {
20
+ Card,
21
+ CardContent,
22
+ CardDescription,
23
+ CardHeader,
24
+ CardTitle,
25
+ } from "@/components/ui/card";
26
+ import {
27
+ DocsAccessibility,
28
+ DocsApiSection,
29
+ DocsApiTable,
30
+ DocsDemoPanel,
31
+ DocsPage,
32
+ DocsPageHeader,
33
+ DocsSection,
34
+ DocsSectionGrid,
35
+ } from "@/components/docs/docs-page";
36
+ import { Tooltip } from "@/components/ui/tooltip";
37
+ import { cn } from "@/lib/cn";
38
+
39
+ type Variant = NonNullable<ButtonProps["variant"]>;
40
+ type Size = NonNullable<ButtonProps["size"]>;
41
+
42
+ const VARIANTS: { value: Variant; label: string }[] = [
43
+ { value: "primary", label: "Primary" },
44
+ { value: "white", label: "White" },
45
+ { value: "outline", label: "Outline" },
46
+ { value: "ghost", label: "Ghost" },
47
+ ];
48
+
49
+ const SIZES: Size[] = ["sm", "md", "lg"];
50
+
51
+ function codeFor(variant: Variant, size: Size, disabled: boolean) {
52
+ const props = [
53
+ variant !== "primary" && `variant="${variant}"`,
54
+ size !== "md" && `size="${size}"`,
55
+ disabled && "disabled",
56
+ ]
57
+ .filter(Boolean)
58
+ .join(" ");
59
+ const open = props ? `<Button ${props}>` : "<Button>";
60
+ return `${open}Button</Button>`;
61
+ }
62
+
63
+ const API_ROWS = [
64
+ { prop: "variant", type: '"primary" | "white" | "outline" | "ghost"', default: '"primary"', description: "The visual style variant" },
65
+ { prop: "size", type: '"sm" | "md" | "lg"', default: '"md"', description: "The size of the button" },
66
+ { prop: "disabled", type: "boolean", default: "false", description: "Disables the button" },
67
+ { prop: "children", type: "ReactNode", default: "—", description: "Button label or content" },
68
+ { prop: "className", type: "string", default: "—", description: "Additional CSS classes" },
69
+ ];
70
+
71
+ const ACCESSIBILITY_ITEMS = [
72
+ "Use native button elements for actions — not divs or spans.",
73
+ "Provide visible focus states for keyboard users.",
74
+ "Icon-only buttons must include an accessible label.",
75
+ "Disabled buttons should not be the only way to convey unavailable actions.",
76
+ "Loading states should preserve button dimensions and announce status.",
77
+ ];
78
+
79
+ export function ButtonDocPage() {
80
+ const [loading, setLoading] = React.useState(false);
81
+ const [variant, setVariant] = useState<Variant>("primary");
82
+ const [size, setSize] = useState<Size>("md");
83
+ const [disabled, setDisabled] = useState(false);
84
+ const [copied, setCopied] = useState(false);
85
+
86
+ const snippet = codeFor(variant, size, disabled);
87
+
88
+ function copySnippet() {
89
+ navigator.clipboard.writeText(snippet).catch(() => {});
90
+ setCopied(true);
91
+ setTimeout(() => setCopied(false), 1200);
92
+ }
93
+
94
+ const handleLoadingDemo = () => {
95
+ setLoading(true);
96
+ window.setTimeout(() => setLoading(false), 1800);
97
+ };
98
+
99
+ return (
100
+ <DocsPage>
101
+ <DocsPageHeader
102
+ icon={MousePointerClick}
103
+ title="Button"
104
+ description="Triggers actions and navigation — from primary CTAs to quiet ghost controls in toolbars and forms."
105
+ />
106
+
107
+ <DocsSection
108
+ first
109
+ title="Playground"
110
+ description="Build a button and copy the exact markup — every combination, live."
111
+ >
112
+ <div className="overflow-hidden rounded-2xl border border-zinc-200 shadow-[0_2px_8px_rgba(0,0,0,0.04)] dark:border-zinc-800 dark:shadow-[0_2px_8px_rgba(0,0,0,0.2)]">
113
+ <div className="relative flex min-h-[11rem] items-center justify-center overflow-hidden bg-zinc-50 p-6 dark:bg-zinc-900/40">
114
+ <div
115
+ aria-hidden
116
+ className="pointer-events-none absolute inset-0 opacity-[0.4] dark:opacity-[0.15]"
117
+ style={{
118
+ backgroundImage:
119
+ "linear-gradient(to right, rgb(161 161 170 / 0.35) 1px, transparent 1px), linear-gradient(to bottom, rgb(161 161 170 / 0.35) 1px, transparent 1px)",
120
+ backgroundSize: "24px 24px",
121
+ }}
122
+ />
123
+ <div
124
+ key={`${variant}-${size}-${disabled}`}
125
+ className="relative animate-[pagination-pop_0.2s_ease-out]"
126
+ >
127
+ <Button variant={variant} size={size} disabled={disabled}>
128
+ Button
129
+ </Button>
130
+ </div>
131
+ </div>
132
+
133
+ <div className="flex flex-col gap-5 border-t border-zinc-200 p-5 dark:border-zinc-800">
134
+ <div className="flex flex-wrap items-start justify-between gap-6">
135
+ <div>
136
+ <p className="mb-2 text-xs font-medium uppercase tracking-wide text-zinc-400 dark:text-zinc-500">
137
+ Variant
138
+ </p>
139
+ <div className="flex flex-wrap items-center gap-1 rounded-lg border border-zinc-200 bg-zinc-50 p-1 dark:border-zinc-800 dark:bg-zinc-900/60">
140
+ {VARIANTS.map((v) => (
141
+ <button
142
+ key={v.value}
143
+ type="button"
144
+ onClick={() => setVariant(v.value)}
145
+ className={cn(
146
+ "rounded-md px-3 py-1.5 text-xs font-medium transition-colors",
147
+ variant === v.value
148
+ ? "bg-white text-zinc-900 shadow-sm dark:bg-zinc-800 dark:text-white"
149
+ : "text-zinc-500 hover:text-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-200"
150
+ )}
151
+ >
152
+ {v.label}
153
+ </button>
154
+ ))}
155
+ </div>
156
+ </div>
157
+
158
+ <div>
159
+ <p className="mb-2 text-xs font-medium uppercase tracking-wide text-zinc-400 dark:text-zinc-500">
160
+ Size
161
+ </p>
162
+ <div className="flex flex-wrap items-center gap-1 rounded-lg border border-zinc-200 bg-zinc-50 p-1 dark:border-zinc-800 dark:bg-zinc-900/60">
163
+ {SIZES.map((s) => (
164
+ <button
165
+ key={s}
166
+ type="button"
167
+ onClick={() => setSize(s)}
168
+ className={cn(
169
+ "rounded-md px-3 py-1.5 text-xs font-medium uppercase tracking-wide transition-colors",
170
+ size === s
171
+ ? "bg-white text-zinc-900 shadow-sm dark:bg-zinc-800 dark:text-white"
172
+ : "text-zinc-500 hover:text-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-200"
173
+ )}
174
+ >
175
+ {s}
176
+ </button>
177
+ ))}
178
+ </div>
179
+ </div>
180
+
181
+ <div>
182
+ <p className="mb-2 text-xs font-medium uppercase tracking-wide text-zinc-400 dark:text-zinc-500">
183
+ Disabled
184
+ </p>
185
+ <button
186
+ type="button"
187
+ onClick={() => setDisabled((v) => !v)}
188
+ className={cn(
189
+ "flex h-[2.125rem] items-center gap-2 rounded-lg border px-3 text-xs font-medium transition-colors",
190
+ disabled
191
+ ? "border-zinc-900 bg-zinc-900 text-white dark:border-white dark:bg-white dark:text-zinc-900"
192
+ : "border-zinc-200 text-zinc-500 hover:border-zinc-300 dark:border-zinc-700 dark:text-zinc-400"
193
+ )}
194
+ >
195
+ {disabled ? "On" : "Off"}
196
+ </button>
197
+ </div>
198
+ </div>
199
+
200
+ <div className="flex items-center justify-between gap-3 rounded-xl bg-zinc-900 px-4 py-3 dark:bg-black">
201
+ <pre className="overflow-x-auto font-mono text-[13px] leading-relaxed text-zinc-100">
202
+ <code>{snippet}</code>
203
+ </pre>
204
+ <Tooltip content={copied ? "Copied!" : "Copy code"}>
205
+ <button
206
+ type="button"
207
+ onClick={copySnippet}
208
+ className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-zinc-400 transition-colors hover:bg-white/10 hover:text-white"
209
+ >
210
+ {copied ? <Check className="h-4 w-4 text-emerald-400" /> : <Copy className="h-4 w-4" />}
211
+ </button>
212
+ </Tooltip>
213
+ </div>
214
+ </div>
215
+ </div>
216
+ </DocsSection>
217
+
218
+ <DocsSection
219
+ title="Variants"
220
+ description="Four weights for different emphasis levels in your interface."
221
+ >
222
+ <DocsDemoPanel>
223
+ <Button variant="primary">Primary</Button>
224
+ <Button variant="white">White</Button>
225
+ <Button variant="outline">Outline</Button>
226
+ <Button variant="ghost">Ghost</Button>
227
+ </DocsDemoPanel>
228
+ </DocsSection>
229
+
230
+ <DocsSection
231
+ title="Sizes"
232
+ description="Three sizes to match density — from compact toolbars to hero CTAs."
233
+ contentClassName="flex flex-wrap items-end gap-4"
234
+ >
235
+ <div className="flex flex-col items-center gap-2">
236
+ <Button size="sm">Small</Button>
237
+ <span className="text-xs text-zinc-400">sm</span>
238
+ </div>
239
+ <div className="flex flex-col items-center gap-2">
240
+ <Button size="md">Medium</Button>
241
+ <span className="text-xs text-zinc-400">md</span>
242
+ </div>
243
+ <div className="flex flex-col items-center gap-2">
244
+ <Button size="lg">Large</Button>
245
+ <span className="text-xs text-zinc-400">lg</span>
246
+ </div>
247
+ </DocsSection>
248
+
249
+ <DocsSection>
250
+ <DocsSectionGrid className="lg:grid-cols-2">
251
+ <Card>
252
+ <CardHeader>
253
+ <CardTitle className="text-base">With Icons</CardTitle>
254
+ <CardDescription>Leading icons add clarity without extra words.</CardDescription>
255
+ </CardHeader>
256
+ <CardContent className="flex flex-wrap gap-2">
257
+ <Button>
258
+ <Mail className="h-4 w-4" />
259
+ Send email
260
+ </Button>
261
+ <Button variant="ghost">
262
+ <Download className="h-4 w-4" />
263
+ Download
264
+ </Button>
265
+ <Button variant="ghost" size="sm" aria-label="Add item" className="h-8 w-8 p-0">
266
+ <Plus className="h-4 w-4" />
267
+ </Button>
268
+ <Button
269
+ variant="ghost"
270
+ size="sm"
271
+ aria-label="Delete"
272
+ className="h-8 w-8 p-0 text-red-500 hover:text-red-600 dark:text-red-400"
273
+ >
274
+ <Trash2 className="h-4 w-4" />
275
+ </Button>
276
+ </CardContent>
277
+ </Card>
278
+
279
+ <Card>
280
+ <CardHeader>
281
+ <CardTitle className="text-base">Loading State</CardTitle>
282
+ <CardDescription>Preserve layout while an async action runs.</CardDescription>
283
+ </CardHeader>
284
+ <CardContent className="flex flex-wrap items-center gap-3">
285
+ <Button onClick={handleLoadingDemo} disabled={loading}>
286
+ {loading ? (
287
+ <>
288
+ <Loader2 className="h-4 w-4 animate-spin" />
289
+ Saving…
290
+ </>
291
+ ) : (
292
+ "Save changes"
293
+ )}
294
+ </Button>
295
+ <Button variant="ghost" disabled={loading}>Cancel</Button>
296
+ </CardContent>
297
+ </Card>
298
+ </DocsSectionGrid>
299
+ </DocsSection>
300
+
301
+ <DocsSection
302
+ title="On Dark Surfaces"
303
+ description="White and outline variants are designed for dark backgrounds and media overlays."
304
+ >
305
+ <DocsDemoPanel dark>
306
+ <Button variant="white">Get started</Button>
307
+ <Button
308
+ variant="outline"
309
+ className="border-white/20 bg-white/5 text-white shadow-none hover:border-white/35 hover:bg-white/10 hover:text-white"
310
+ >
311
+ Learn more
312
+ </Button>
313
+ <Button
314
+ variant="ghost"
315
+ className="text-zinc-300 hover:bg-white/10 hover:text-white"
316
+ >
317
+ <Sparkles className="h-4 w-4" />
318
+ Upgrade
319
+ </Button>
320
+ </DocsDemoPanel>
321
+ </DocsSection>
322
+
323
+ <DocsSection>
324
+ <DocsSectionGrid className="lg:grid-cols-2">
325
+ <Card className="overflow-hidden">
326
+ <CardHeader className="border-b border-zinc-100 dark:border-zinc-800">
327
+ <div className="flex items-start justify-between gap-3">
328
+ <div>
329
+ <CardTitle>Upgrade to Pro</CardTitle>
330
+ <CardDescription>Unlock advanced features for your team.</CardDescription>
331
+ </div>
332
+ <Badge variant="info">New</Badge>
333
+ </div>
334
+ </CardHeader>
335
+ <CardContent className="pt-6">
336
+ <ul className="space-y-2.5 text-sm text-zinc-600 dark:text-zinc-300">
337
+ <li className="flex items-center gap-2">
338
+ <CheckCircle2 className="h-4 w-4 shrink-0 text-green-500" />
339
+ Unlimited projects
340
+ </li>
341
+ <li className="flex items-center gap-2">
342
+ <CheckCircle2 className="h-4 w-4 shrink-0 text-green-500" />
343
+ Priority support
344
+ </li>
345
+ <li className="flex items-center gap-2">
346
+ <CheckCircle2 className="h-4 w-4 shrink-0 text-green-500" />
347
+ Advanced analytics
348
+ </li>
349
+ </ul>
350
+ <div className="mt-6 flex flex-wrap gap-2">
351
+ <Button size="sm" className="flex-1 sm:flex-none">
352
+ Start free trial
353
+ <ArrowRight className="h-4 w-4" />
354
+ </Button>
355
+ <Button variant="ghost" size="sm">Compare plans</Button>
356
+ </div>
357
+ </CardContent>
358
+ </Card>
359
+
360
+ <Card>
361
+ <CardHeader>
362
+ <CardTitle className="text-base">Button Group</CardTitle>
363
+ <CardDescription>Pair primary and secondary actions with clear hierarchy.</CardDescription>
364
+ </CardHeader>
365
+ <CardContent>
366
+ <div className="rounded-xl border border-zinc-200 bg-zinc-50 p-4 dark:border-zinc-800 dark:bg-zinc-900/50">
367
+ <p className="text-sm font-medium text-zinc-800 dark:text-zinc-100">
368
+ Delete this project?
369
+ </p>
370
+ <p className="mt-1 text-xs text-zinc-500 dark:text-zinc-400">
371
+ This action cannot be undone. All data will be permanently removed.
372
+ </p>
373
+ <div className="mt-4 flex flex-wrap gap-2">
374
+ <Button size="sm" variant="ghost">Cancel</Button>
375
+ <Button
376
+ size="sm"
377
+ className="bg-red-600 text-white shadow-[0_1px_2px_rgba(220,38,38,0.3),0_4px_12px_rgba(220,38,38,0.2)] hover:bg-red-500 hover:-translate-y-0.5 hover:shadow-[0_4px_16px_rgba(220,38,38,0.35)] dark:bg-red-600 dark:hover:bg-red-500"
378
+ >
379
+ Delete project
380
+ </Button>
381
+ </div>
382
+ </div>
383
+ </CardContent>
384
+ </Card>
385
+ </DocsSectionGrid>
386
+ </DocsSection>
387
+
388
+ <DocsSection title="Disabled">
389
+ <Card className="max-w-md">
390
+ <CardContent className="flex flex-wrap items-center gap-3 pt-6">
391
+ <Button disabled>Primary</Button>
392
+ <Button variant="ghost" disabled>Ghost</Button>
393
+ <Button variant="outline" disabled className="border-zinc-300 text-zinc-400 dark:border-zinc-700">
394
+ Outline
395
+ </Button>
396
+ </CardContent>
397
+ </Card>
398
+ </DocsSection>
399
+
400
+ <DocsApiSection>
401
+ <DocsApiTable title="API Reference" rows={API_ROWS} />
402
+ <DocsAccessibility items={ACCESSIBILITY_ITEMS} />
403
+ </DocsApiSection>
404
+ </DocsPage>
405
+ );
406
+ }