ruler-components 0.1.1 → 0.1.3

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 (118) hide show
  1. package/dist/index.d.mts +458 -0
  2. package/dist/index.d.ts +458 -0
  3. package/dist/index.js +3618 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.mjs +3467 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +21 -2
  8. package/AGENTS.md +0 -9
  9. package/CLAUDE.md +0 -1
  10. package/app/docs/[slug]/page.tsx +0 -147
  11. package/app/docs/layout.tsx +0 -26
  12. package/app/docs/page.tsx +0 -148
  13. package/app/favicon.ico +0 -0
  14. package/app/globals.css +0 -168
  15. package/app/icon.png +0 -0
  16. package/app/layout.tsx +0 -90
  17. package/app/opengraph-image.tsx +0 -10
  18. package/app/page.tsx +0 -34
  19. package/app/twitter-image.tsx +0 -10
  20. package/components/docs/accordion-doc-page.tsx +0 -352
  21. package/components/docs/alert-doc-page.tsx +0 -293
  22. package/components/docs/allinput-doc-page.tsx +0 -183
  23. package/components/docs/avatar-doc-page.tsx +0 -424
  24. package/components/docs/badge-doc-page.tsx +0 -363
  25. package/components/docs/button-doc-page.tsx +0 -406
  26. package/components/docs/card-doc-page.tsx +0 -364
  27. package/components/docs/checkbox-doc-page.tsx +0 -277
  28. package/components/docs/colors-doc-page.tsx +0 -430
  29. package/components/docs/dialog-doc-page.tsx +0 -364
  30. package/components/docs/docs-footer.tsx +0 -11
  31. package/components/docs/docs-mobile-menu-bar.tsx +0 -22
  32. package/components/docs/docs-mobile-nav-context.tsx +0 -27
  33. package/components/docs/docs-page.tsx +0 -263
  34. package/components/docs/docs-search.tsx +0 -303
  35. package/components/docs/docs-sidebar.tsx +0 -165
  36. package/components/docs/docs-topbar.tsx +0 -32
  37. package/components/docs/dropdown-doc-page.tsx +0 -522
  38. package/components/docs/getting-started-doc-page.tsx +0 -205
  39. package/components/docs/label-doc-page.tsx +0 -173
  40. package/components/docs/loaders-doc-page.tsx +0 -244
  41. package/components/docs/menu-doc-page.tsx +0 -373
  42. package/components/docs/modal-doc-page.tsx +0 -436
  43. package/components/docs/next-steps.tsx +0 -53
  44. package/components/docs/pagination-doc-page.tsx +0 -316
  45. package/components/docs/progress-doc-page.tsx +0 -387
  46. package/components/docs/radio-doc-page.tsx +0 -270
  47. package/components/docs/skeleton-doc-page.tsx +0 -230
  48. package/components/docs/stepper-doc-page.tsx +0 -309
  49. package/components/docs/switch-doc-page.tsx +0 -264
  50. package/components/docs/table-doc-page.tsx +0 -689
  51. package/components/docs/tabs-doc-page.tsx +0 -359
  52. package/components/docs/theming-doc-page.tsx +0 -243
  53. package/components/docs/tooltip-doc-page.tsx +0 -357
  54. package/components/docs/usage-section.tsx +0 -21
  55. package/components/icons/discord.tsx +0 -9
  56. package/components/icons/github.tsx +0 -9
  57. package/components/icons/x.tsx +0 -9
  58. package/components/installation-section.tsx +0 -34
  59. package/components/landing/feature-highlights.tsx +0 -105
  60. package/components/landing/footer-strip.tsx +0 -45
  61. package/components/landing/hero-card.tsx +0 -14
  62. package/components/landing/hero-spotlight.tsx +0 -126
  63. package/components/landing/hero.tsx +0 -64
  64. package/components/landing/navbar.tsx +0 -44
  65. package/components/landing/quick-start-section.tsx +0 -59
  66. package/components/landing/site-footer.tsx +0 -55
  67. package/components/theme-provider.tsx +0 -60
  68. package/components/ui/accordion.tsx +0 -174
  69. package/components/ui/alert.tsx +0 -103
  70. package/components/ui/allinput.tsx +0 -210
  71. package/components/ui/avatar.tsx +0 -179
  72. package/components/ui/badge.tsx +0 -52
  73. package/components/ui/button.tsx +0 -75
  74. package/components/ui/card.tsx +0 -105
  75. package/components/ui/checkbox.tsx +0 -130
  76. package/components/ui/code-block.tsx +0 -60
  77. package/components/ui/data-table.tsx +0 -235
  78. package/components/ui/dialog.tsx +0 -173
  79. package/components/ui/dropdown.tsx +0 -78
  80. package/components/ui/feature-card.tsx +0 -38
  81. package/components/ui/input.tsx +0 -44
  82. package/components/ui/label.tsx +0 -110
  83. package/components/ui/loaders.tsx +0 -139
  84. package/components/ui/menu.tsx +0 -118
  85. package/components/ui/modal.tsx +0 -399
  86. package/components/ui/package-manager-tabs.tsx +0 -40
  87. package/components/ui/pagination.tsx +0 -200
  88. package/components/ui/progress.tsx +0 -134
  89. package/components/ui/radio.tsx +0 -262
  90. package/components/ui/skeleton.tsx +0 -102
  91. package/components/ui/steppers.tsx +0 -309
  92. package/components/ui/switch.tsx +0 -153
  93. package/components/ui/table.tsx +0 -58
  94. package/components/ui/tabs.tsx +0 -166
  95. package/components/ui/theme-toggle.tsx +0 -60
  96. package/components/ui/tooltip.tsx +0 -238
  97. package/data/color-palette.ts +0 -35
  98. package/data/docs-nav.ts +0 -84
  99. package/eslint.config.mjs +0 -18
  100. package/index.ts +0 -8
  101. package/lib/cn.ts +0 -4
  102. package/lib/color.ts +0 -85
  103. package/lib/og-image.tsx +0 -138
  104. package/lib/theme.ts +0 -33
  105. package/next.config.ts +0 -7
  106. package/postcss.config.mjs +0 -7
  107. package/public/dark.png +0 -0
  108. package/public/dark1.png +0 -0
  109. package/public/dark2.png +0 -0
  110. package/public/file.svg +0 -1
  111. package/public/globe.svg +0 -1
  112. package/public/light.png +0 -0
  113. package/public/light1.png +0 -0
  114. package/public/next.svg +0 -1
  115. package/public/vercel.svg +0 -1
  116. package/public/video/hero-demo.mp4 +0 -0
  117. package/public/window.svg +0 -1
  118. package/tsconfig.json +0 -34
@@ -1,316 +0,0 @@
1
- "use client";
2
-
3
- import React from "react";
4
- import { Check, Copy, FileText, MoreHorizontal } from "lucide-react";
5
- import { Pagination, type PaginationProps } from "@/components/ui/pagination";
6
- import { Card } from "@/components/ui/card";
7
- import { Tooltip } from "@/components/ui/tooltip";
8
- import {
9
- DocsAccessibility,
10
- DocsApiSection,
11
- DocsApiTable,
12
- DocsDemoPanel,
13
- DocsPage,
14
- DocsPageHeader,
15
- DocsSection,
16
- DocsSectionGrid,
17
- DocsSubsection,
18
- } from "@/components/docs/docs-page";
19
- import { cn } from "@/lib/cn";
20
-
21
- const API_ROWS = [
22
- { prop: "page", type: "number", default: "—", description: "The current active page (1-indexed)" },
23
- { prop: "totalPages", type: "number", default: "—", description: "The total number of pages" },
24
- { prop: "onPageChange", type: "(page: number) => void", default: "—", description: "Called when the user selects a page" },
25
- { prop: "siblingCount", type: "number", default: "1", description: "Page buttons shown on either side of the current page" },
26
- { prop: "variant", type: '"default" | "simple"', default: '"default"', description: "Numbered page buttons, or a minimal previous/next control" },
27
- { prop: "size", type: '"small" | "half" | "full"', default: '"small"', description: "How much horizontal space the control takes up — content width, half, or full width of its container" },
28
- { prop: "className", type: "string", default: "—", description: "Additional CSS classes" },
29
- ];
30
-
31
- const ACCESSIBILITY_ITEMS = [
32
- "The root <nav> carries aria-label=\"Pagination\" so assistive tech can identify the control.",
33
- "The active page button is marked with aria-current=\"page\".",
34
- "Previous and Next disable at the first and last page instead of wrapping around.",
35
- "Ellipsis markers are decorative and hidden from screen readers.",
36
- "Prefer the simple variant on narrow viewports where numbered buttons would wrap awkwardly.",
37
- ];
38
-
39
- type PlaygroundVariant = NonNullable<PaginationProps["variant"]>;
40
- type PlaygroundSize = NonNullable<PaginationProps["size"]>;
41
-
42
- const PLAYGROUND_VARIANTS: { value: PlaygroundVariant; label: string }[] = [
43
- { value: "default", label: "Default" },
44
- { value: "simple", label: "Simple" },
45
- ];
46
-
47
- const PLAYGROUND_SIZES: PlaygroundSize[] = ["small", "half", "full"];
48
-
49
- const PLAYGROUND_TOTAL_PAGES = [5, 10, 20, 50];
50
-
51
- function codeFor(page: number, totalPages: number, variant: PlaygroundVariant, size: PlaygroundSize) {
52
- const props = [
53
- `page={${page}}`,
54
- `totalPages={${totalPages}}`,
55
- "onPageChange={setPage}",
56
- variant !== "default" && `variant="${variant}"`,
57
- size !== "small" && `size="${size}"`,
58
- ].filter(Boolean);
59
- return `<Pagination\n ${props.join("\n ")}\n/>`;
60
- }
61
-
62
- const SEARCH_RESULTS = [
63
- "Getting started with ruler.ui",
64
- "Installing the CLI",
65
- "Theming your design tokens",
66
- "Building accessible forms",
67
- "Customizing the Button component",
68
- "Dark mode best practices",
69
- "Data Table search and filters",
70
- "Writing your first component",
71
- "Migrating from v1 to v2",
72
- "Understanding the Card variants",
73
- "Icon usage guidelines",
74
- "Typography scale reference",
75
- "Spacing and layout primitives",
76
- "Building a settings page",
77
- "Handling async loading states",
78
- "Composing Dropdown menus",
79
- "Keyboard navigation patterns",
80
- "Testing your components",
81
- "Publishing to npm",
82
- "Contributing guidelines",
83
- ];
84
- const RESULTS_PAGE_SIZE = 5;
85
-
86
- export function PaginationDocPage() {
87
- const [playgroundPage, setPlaygroundPage] = React.useState(4);
88
- const [playgroundTotalPages, setPlaygroundTotalPages] = React.useState(10);
89
- const [playgroundVariant, setPlaygroundVariant] = React.useState<PlaygroundVariant>("default");
90
- const [playgroundSize, setPlaygroundSize] = React.useState<PlaygroundSize>("small");
91
- const [copied, setCopied] = React.useState(false);
92
-
93
- const playgroundSnippet = codeFor(playgroundPage, playgroundTotalPages, playgroundVariant, playgroundSize);
94
-
95
- function copySnippet() {
96
- navigator.clipboard.writeText(playgroundSnippet).catch(() => {});
97
- setCopied(true);
98
- setTimeout(() => setCopied(false), 1200);
99
- }
100
-
101
- function setPlaygroundTotal(total: number) {
102
- setPlaygroundTotalPages(total);
103
- setPlaygroundPage((p) => Math.min(p, total));
104
- }
105
-
106
- const [defaultPage, setDefaultPage] = React.useState(4);
107
- const [simplePage, setSimplePage] = React.useState(2);
108
- const [siblingPageA, setSiblingPageA] = React.useState(6);
109
- const [siblingPageB, setSiblingPageB] = React.useState(6);
110
- const [resultsPage, setResultsPage] = React.useState(1);
111
- const [smallSizePage, setSmallSizePage] = React.useState(3);
112
- const [halfSizePage, setHalfSizePage] = React.useState(3);
113
- const [fullSizePage, setFullSizePage] = React.useState(3);
114
-
115
- const resultsTotalPages = Math.ceil(SEARCH_RESULTS.length / RESULTS_PAGE_SIZE);
116
- const pagedResults = SEARCH_RESULTS.slice(
117
- (resultsPage - 1) * RESULTS_PAGE_SIZE,
118
- resultsPage * RESULTS_PAGE_SIZE,
119
- );
120
-
121
- return (
122
- <DocsPage>
123
- <DocsPageHeader
124
- icon={MoreHorizontal}
125
- title="Pagination"
126
- description="Lets people move through paged content — numbered pages, or a minimal previous/next control."
127
- />
128
-
129
- <DocsSection
130
- first
131
- title="Playground"
132
- description="Build a pagination control and copy the exact markup — every combination, live."
133
- >
134
- <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)]">
135
- <div className="relative flex min-h-[11rem] items-center justify-center overflow-hidden bg-zinc-50 p-6 dark:bg-zinc-900/40">
136
- <div
137
- aria-hidden
138
- className="pointer-events-none absolute inset-0 opacity-[0.4] dark:opacity-[0.15]"
139
- style={{
140
- backgroundImage:
141
- "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)",
142
- backgroundSize: "24px 24px",
143
- }}
144
- />
145
- <div className="relative w-full max-w-md">
146
- <Pagination
147
- page={playgroundPage}
148
- totalPages={playgroundTotalPages}
149
- onPageChange={setPlaygroundPage}
150
- variant={playgroundVariant}
151
- size={playgroundSize}
152
- />
153
- </div>
154
- </div>
155
-
156
- <div className="flex flex-col gap-5 border-t border-zinc-200 p-5 dark:border-zinc-800">
157
- <div className="flex flex-wrap items-start justify-between gap-6">
158
- <div>
159
- <p className="mb-2 text-xs font-medium uppercase tracking-wide text-zinc-400 dark:text-zinc-500">
160
- Variant
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
- {PLAYGROUND_VARIANTS.map((v) => (
164
- <button
165
- key={v.value}
166
- type="button"
167
- onClick={() => setPlaygroundVariant(v.value)}
168
- className={cn(
169
- "rounded-md px-3 py-1.5 text-xs font-medium uppercase tracking-wide transition-colors",
170
- playgroundVariant === v.value
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
- {v.label}
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
- Size
184
- </p>
185
- <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">
186
- {PLAYGROUND_SIZES.map((s) => (
187
- <button
188
- key={s}
189
- type="button"
190
- onClick={() => setPlaygroundSize(s)}
191
- className={cn(
192
- "rounded-md px-3 py-1.5 text-xs font-medium uppercase tracking-wide transition-colors",
193
- playgroundSize === s
194
- ? "bg-white text-zinc-900 shadow-sm dark:bg-zinc-800 dark:text-white"
195
- : "text-zinc-500 hover:text-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-200"
196
- )}
197
- >
198
- {s}
199
- </button>
200
- ))}
201
- </div>
202
- </div>
203
-
204
- <div>
205
- <p className="mb-2 text-xs font-medium uppercase tracking-wide text-zinc-400 dark:text-zinc-500">
206
- Total pages
207
- </p>
208
- <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">
209
- {PLAYGROUND_TOTAL_PAGES.map((total) => (
210
- <button
211
- key={total}
212
- type="button"
213
- onClick={() => setPlaygroundTotal(total)}
214
- className={cn(
215
- "rounded-md px-3 py-1.5 text-xs font-medium tabular-nums transition-colors",
216
- playgroundTotalPages === total
217
- ? "bg-white text-zinc-900 shadow-sm dark:bg-zinc-800 dark:text-white"
218
- : "text-zinc-500 hover:text-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-200"
219
- )}
220
- >
221
- {total}
222
- </button>
223
- ))}
224
- </div>
225
- </div>
226
- </div>
227
-
228
- <div className="flex items-center justify-between gap-3 rounded-xl bg-zinc-900 px-4 py-3 dark:bg-black">
229
- <pre className="overflow-x-auto font-mono text-[13px] leading-relaxed text-zinc-100">
230
- <code>{playgroundSnippet}</code>
231
- </pre>
232
- <Tooltip content={copied ? "Copied!" : "Copy code"}>
233
- <button
234
- type="button"
235
- onClick={copySnippet}
236
- 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"
237
- >
238
- {copied ? <Check className="h-4 w-4 text-emerald-400" /> : <Copy className="h-4 w-4" />}
239
- </button>
240
- </Tooltip>
241
- </div>
242
- </div>
243
- </div>
244
- </DocsSection>
245
-
246
- <DocsSection
247
- title="Default"
248
- description="Numbered page buttons with automatic ellipses for long ranges."
249
- >
250
- <DocsDemoPanel>
251
- <Pagination page={defaultPage} totalPages={12} onPageChange={setDefaultPage} />
252
- </DocsDemoPanel>
253
- </DocsSection>
254
-
255
- <DocsSection
256
- title="Sizes"
257
- description="Control how much horizontal space the control takes up — content width, half, or full width of its container."
258
- contentClassName="flex flex-col gap-6"
259
- >
260
- <DocsSubsection title="Small" description="Shrinks to fit its content — the default, ideal for inline placement.">
261
- <Pagination size="small" page={smallSizePage} totalPages={8} onPageChange={setSmallSizePage} />
262
- </DocsSubsection>
263
- <DocsSubsection title="Half" description="Fills half of its container width.">
264
- <Pagination size="half" page={halfSizePage} totalPages={8} onPageChange={setHalfSizePage} />
265
- </DocsSubsection>
266
- <DocsSubsection title="Full" description="Stretches to fill its container — great for table and card footers.">
267
- <Pagination size="full" page={fullSizePage} totalPages={8} onPageChange={setFullSizePage} />
268
- </DocsSubsection>
269
- </DocsSection>
270
-
271
- <DocsSection title="Simple" description="A compact previous/next control with a page indicator — ideal for tight spaces.">
272
- <DocsDemoPanel>
273
- <Pagination variant="simple" page={simplePage} totalPages={5} onPageChange={setSimplePage} className="w-full max-w-sm" />
274
- </DocsDemoPanel>
275
- </DocsSection>
276
-
277
- <DocsSection title="Sibling Count" description="Control how many page buttons show on either side of the current page.">
278
- <DocsSectionGrid>
279
- <DocsSubsection title="siblingCount={0}" description="Only the current page, first, last, and ellipses.">
280
- <Pagination page={siblingPageA} totalPages={20} onPageChange={setSiblingPageA} siblingCount={0} />
281
- </DocsSubsection>
282
- <DocsSubsection title="siblingCount={2}" description="Two pages on either side of the current page.">
283
- <Pagination page={siblingPageB} totalPages={20} onPageChange={setSiblingPageB} siblingCount={2} />
284
- </DocsSubsection>
285
- </DocsSectionGrid>
286
- </DocsSection>
287
-
288
- <DocsSection title="In Context" description="Pagination works with any list, not just tables.">
289
- <Card className="max-w-lg p-2">
290
- <ul className="flex flex-col">
291
- {pagedResults.map((result) => (
292
- <li
293
- key={result}
294
- className="flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm text-zinc-700 hover:bg-zinc-50 dark:text-zinc-300 dark:hover:bg-zinc-800/60"
295
- >
296
- <FileText className="h-4 w-4 shrink-0 text-zinc-400" />
297
- {result}
298
- </li>
299
- ))}
300
- </ul>
301
- <div className="flex items-center justify-between gap-3 border-t border-zinc-100 px-3 pt-3 dark:border-zinc-800">
302
- <p className="text-xs text-zinc-500 dark:text-zinc-400">
303
- {SEARCH_RESULTS.length} results
304
- </p>
305
- <Pagination page={resultsPage} totalPages={resultsTotalPages} onPageChange={setResultsPage} siblingCount={0} />
306
- </div>
307
- </Card>
308
- </DocsSection>
309
-
310
- <DocsApiSection>
311
- <DocsApiTable title="API Reference" rows={API_ROWS} />
312
- <DocsAccessibility items={ACCESSIBILITY_ITEMS} />
313
- </DocsApiSection>
314
- </DocsPage>
315
- );
316
- }