@srcroot/ui 0.0.8 → 0.0.12
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/dist/index.js +183 -50
- package/package.json +5 -5
- package/registry/design-tokens.css +21 -1
- package/registry/sidebar.tsx +10 -14
- package/registry/themes/gray.css +24 -0
- package/registry/themes/neutral.css +24 -0
- package/registry/themes/slate.css +24 -0
- package/registry/themes/stone.css +24 -0
- package/registry/themes/zinc.css +24 -0
package/dist/index.js
CHANGED
|
@@ -250,7 +250,7 @@ var THEMES = {
|
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
};
|
|
253
|
-
function
|
|
253
|
+
function generateCssVariablesV3(themeName) {
|
|
254
254
|
const theme = THEMES[themeName];
|
|
255
255
|
if (!theme) return "";
|
|
256
256
|
const lightVars = Object.entries(theme.light).map(([key, value]) => ` --${key}: ${value};`).join("\n");
|
|
@@ -263,10 +263,31 @@ function generateCssVariables(themeName) {
|
|
|
263
263
|
:root {
|
|
264
264
|
${lightVars}
|
|
265
265
|
--radius: 0.5rem;
|
|
266
|
+
--sidebar-width: 16rem;
|
|
267
|
+
--sidebar-width-mobile: 18rem;
|
|
268
|
+
--sidebar-width-collapsed: 3rem;
|
|
269
|
+
--sidebar-width-icon: 3rem;
|
|
270
|
+
--header-height: 3.5rem;
|
|
271
|
+
--sidebar-background: 0 0% 98%;
|
|
272
|
+
--sidebar-foreground: 240 5.3% 26.1%;
|
|
273
|
+
--sidebar-primary: 240 5.9% 10%;
|
|
274
|
+
--sidebar-primary-foreground: 0 0% 98%;
|
|
275
|
+
--sidebar-accent: 240 4.8% 95.9%;
|
|
276
|
+
--sidebar-accent-foreground: 240 5.9% 10%;
|
|
277
|
+
--sidebar-border: 220 13% 91%;
|
|
278
|
+
--sidebar-ring: 217.2 91.2% 59.8%;
|
|
266
279
|
}
|
|
267
280
|
|
|
268
281
|
.dark {
|
|
269
282
|
${darkVars}
|
|
283
|
+
--sidebar-background: 240 5.9% 10%;
|
|
284
|
+
--sidebar-foreground: 240 4.8% 95.9%;
|
|
285
|
+
--sidebar-primary: 224.3 76.3% 48%;
|
|
286
|
+
--sidebar-primary-foreground: 0 0% 100%;
|
|
287
|
+
--sidebar-accent: 240 3.7% 15.9%;
|
|
288
|
+
--sidebar-accent-foreground: 240 4.8% 95.9%;
|
|
289
|
+
--sidebar-border: 240 3.7% 15.9%;
|
|
290
|
+
--sidebar-ring: 217.2 91.2% 59.8%;
|
|
270
291
|
}
|
|
271
292
|
}
|
|
272
293
|
|
|
@@ -297,6 +318,109 @@ ${darkVars}
|
|
|
297
318
|
}
|
|
298
319
|
`;
|
|
299
320
|
}
|
|
321
|
+
function generateCssVariablesV4(themeName) {
|
|
322
|
+
const theme = THEMES[themeName];
|
|
323
|
+
if (!theme) return "";
|
|
324
|
+
const lightVars = Object.entries(theme.light).map(([key, value]) => ` --${key}: ${value};`).join("\n");
|
|
325
|
+
const darkVars = Object.entries(theme.dark).map(([key, value]) => ` --${key}: ${value};`).join("\n");
|
|
326
|
+
const lightVarsHsl = Object.entries(theme.light).map(([key, value]) => ` --${key}: hsl(${value});`).join("\n");
|
|
327
|
+
const darkVarsHsl = Object.entries(theme.dark).map(([key, value]) => ` --${key}: hsl(${value});`).join("\n");
|
|
328
|
+
return `@import "tailwindcss";
|
|
329
|
+
|
|
330
|
+
:root {
|
|
331
|
+
${lightVarsHsl}
|
|
332
|
+
--radius: 0.5rem;
|
|
333
|
+
--sidebar-width: 16rem;
|
|
334
|
+
--sidebar-width-mobile: 18rem;
|
|
335
|
+
--sidebar-width-collapsed: 3rem;
|
|
336
|
+
--sidebar-width-icon: 3rem;
|
|
337
|
+
--header-height: 3.5rem;
|
|
338
|
+
--sidebar-background: 0 0% 98%;
|
|
339
|
+
--sidebar-foreground: 240 5.3% 26.1%;
|
|
340
|
+
--sidebar-primary: 240 5.9% 10%;
|
|
341
|
+
--sidebar-primary-foreground: 0 0% 98%;
|
|
342
|
+
--sidebar-accent: 240 4.8% 95.9%;
|
|
343
|
+
--sidebar-accent-foreground: 240 5.9% 10%;
|
|
344
|
+
--sidebar-border: 220 13% 91%;
|
|
345
|
+
--sidebar-ring: 217.2 91.2% 59.8%;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
@theme inline {
|
|
349
|
+
--color-border: var(--border);
|
|
350
|
+
--color-input: var(--input);
|
|
351
|
+
--color-ring: var(--ring);
|
|
352
|
+
--color-background: var(--background);
|
|
353
|
+
--color-foreground: var(--foreground);
|
|
354
|
+
|
|
355
|
+
--color-primary: var(--primary);
|
|
356
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
357
|
+
|
|
358
|
+
--color-secondary: var(--secondary);
|
|
359
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
360
|
+
|
|
361
|
+
--color-destructive: var(--destructive);
|
|
362
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
363
|
+
|
|
364
|
+
--color-muted: var(--muted);
|
|
365
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
366
|
+
|
|
367
|
+
--color-accent: var(--accent);
|
|
368
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
369
|
+
|
|
370
|
+
--color-popover: var(--popover);
|
|
371
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
372
|
+
|
|
373
|
+
--color-card: var(--card);
|
|
374
|
+
--color-card-foreground: var(--card-foreground);
|
|
375
|
+
|
|
376
|
+
--color-sidebar: var(--sidebar-background);
|
|
377
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
378
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
379
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
380
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
381
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
382
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
383
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
384
|
+
|
|
385
|
+
--radius-lg: var(--radius);
|
|
386
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
387
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
388
|
+
|
|
389
|
+
/* Accordion Animations */
|
|
390
|
+
--animate-accordion-down: accordion-down 0.2s ease-out;
|
|
391
|
+
--animate-accordion-up: accordion-up 0.2s ease-out;
|
|
392
|
+
|
|
393
|
+
@keyframes accordion-down {
|
|
394
|
+
from { height: 0; }
|
|
395
|
+
to { height: var(--radix-accordion-content-height); }
|
|
396
|
+
}
|
|
397
|
+
@keyframes accordion-up {
|
|
398
|
+
from { height: var(--radix-accordion-content-height); }
|
|
399
|
+
to { height: 0; }
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
@media (prefers-color-scheme: dark) {
|
|
404
|
+
:root {
|
|
405
|
+
${darkVarsHsl}
|
|
406
|
+
--sidebar-background: 240 5.9% 10%;
|
|
407
|
+
--sidebar-foreground: 240 4.8% 95.9%;
|
|
408
|
+
--sidebar-primary: 224.3 76.3% 48%;
|
|
409
|
+
--sidebar-primary-foreground: 0 0% 100%;
|
|
410
|
+
--sidebar-accent: 240 3.7% 15.9%;
|
|
411
|
+
--sidebar-accent-foreground: 240 4.8% 95.9%;
|
|
412
|
+
--sidebar-border: 240 3.7% 15.9%;
|
|
413
|
+
--sidebar-ring: 217.2 91.2% 59.8%;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
body {
|
|
418
|
+
background: var(--background);
|
|
419
|
+
color: var(--foreground);
|
|
420
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
421
|
+
}
|
|
422
|
+
`;
|
|
423
|
+
}
|
|
300
424
|
var TAILWIND_CONFIG = `import type { Config } from "tailwindcss"
|
|
301
425
|
|
|
302
426
|
const config: Config = {
|
|
@@ -348,23 +472,47 @@ const config: Config = {
|
|
|
348
472
|
md: "calc(var(--radius) - 2px)",
|
|
349
473
|
sm: "calc(var(--radius) - 4px)",
|
|
350
474
|
},
|
|
475
|
+
keyframes: {
|
|
476
|
+
"accordion-down": {
|
|
477
|
+
from: { height: "0" },
|
|
478
|
+
to: { height: "var(--radix-accordion-content-height)" },
|
|
479
|
+
},
|
|
480
|
+
"accordion-up": {
|
|
481
|
+
from: { height: "var(--radix-accordion-content-height)" },
|
|
482
|
+
to: { height: "0" },
|
|
483
|
+
},
|
|
484
|
+
},
|
|
485
|
+
animation: {
|
|
486
|
+
"accordion-down": "accordion-down 0.2s ease-out",
|
|
487
|
+
"accordion-up": "accordion-up 0.2s ease-out",
|
|
488
|
+
},
|
|
351
489
|
},
|
|
352
490
|
},
|
|
353
|
-
plugins: [],
|
|
491
|
+
plugins: [require("tailwindcss-animate")],
|
|
354
492
|
}
|
|
355
493
|
|
|
356
494
|
export default config
|
|
357
495
|
`;
|
|
358
496
|
async function init(options) {
|
|
359
497
|
const cwd = path.resolve(options.cwd);
|
|
360
|
-
|
|
498
|
+
const userAgent = process.env.npm_config_user_agent || "";
|
|
499
|
+
const isYarn = userAgent.includes("yarn");
|
|
500
|
+
const isPnpm = userAgent.includes("pnpm");
|
|
501
|
+
const isBun = userAgent.includes("bun");
|
|
502
|
+
const packageManager = isPnpm ? "pnpm" : isYarn ? "yarn" : isBun ? "bun" : "npm";
|
|
503
|
+
const installCmd = isPnpm ? "add" : isYarn ? "add" : isBun ? "add" : "install";
|
|
504
|
+
console.log(chalk.cyan("\n\u{1F680} Initializing @srcroot/ui...\n"));
|
|
361
505
|
const packageJsonPath = path.join(cwd, "package.json");
|
|
362
506
|
if (!fs.existsSync(packageJsonPath)) {
|
|
363
507
|
console.log(chalk.red("Error: No package.json found. Please run this in a project directory."));
|
|
364
508
|
process.exit(1);
|
|
365
509
|
}
|
|
366
|
-
const
|
|
367
|
-
const
|
|
510
|
+
const pkg = await fs.readJson(packageJsonPath);
|
|
511
|
+
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
512
|
+
const tailwindVersion = allDeps["tailwindcss"] || "";
|
|
513
|
+
const isTailwind4 = tailwindVersion.includes("^4") || tailwindVersion.startsWith("4") || allDeps["@tailwindcss/postcss"];
|
|
514
|
+
const srcDir = fs.existsSync(path.join(cwd, "src")) ? path.join(cwd, "src") : cwd;
|
|
515
|
+
const appDir = path.join(srcDir, "app");
|
|
368
516
|
const isAppRouter = fs.existsSync(appDir);
|
|
369
517
|
const libDir = path.join(srcDir, "lib");
|
|
370
518
|
const componentsDir = path.join(srcDir, "components", "ui");
|
|
@@ -387,71 +535,55 @@ async function init(options) {
|
|
|
387
535
|
selectedTheme = themeResponse.theme;
|
|
388
536
|
}
|
|
389
537
|
}
|
|
390
|
-
if (!options.yes) {
|
|
391
|
-
const response = await prompts([
|
|
392
|
-
{
|
|
393
|
-
type: "confirm",
|
|
394
|
-
name: "proceed",
|
|
395
|
-
message: `This will create files in ${chalk.cyan(cwd)} with ${chalk.cyan(THEMES[selectedTheme].name)} theme. Continue?`,
|
|
396
|
-
initial: true
|
|
397
|
-
}
|
|
398
|
-
]);
|
|
399
|
-
if (!response.proceed) {
|
|
400
|
-
console.log(chalk.yellow("Cancelled."));
|
|
401
|
-
process.exit(0);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
538
|
const spinner = ora("Creating project structure...").start();
|
|
405
539
|
try {
|
|
406
540
|
await fs.ensureDir(libDir);
|
|
407
541
|
await fs.ensureDir(componentsDir);
|
|
408
542
|
const utilsPath = path.join(libDir, "utils.ts");
|
|
409
543
|
await fs.writeFile(utilsPath, UTILS_CONTENT);
|
|
410
|
-
spinner.succeed(`Created ${chalk.cyan(
|
|
544
|
+
spinner.succeed(`Created ${chalk.cyan(path.relative(cwd, utilsPath))}`);
|
|
411
545
|
spinner.start(`Setting up ${chalk.cyan(THEMES[selectedTheme].name)} theme...`);
|
|
412
546
|
const stylesDir = path.dirname(globalsPath);
|
|
413
547
|
await fs.ensureDir(stylesDir);
|
|
414
|
-
const cssContent =
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
} else {
|
|
421
|
-
spinner.info(`CSS variables already exist in ${chalk.cyan(path.relative(cwd, globalsPath))}`);
|
|
422
|
-
}
|
|
423
|
-
} else {
|
|
424
|
-
await fs.writeFile(globalsPath, cssContent);
|
|
425
|
-
spinner.succeed(`Created ${chalk.cyan(path.relative(cwd, globalsPath))} with ${chalk.cyan(THEMES[selectedTheme].name)} theme`);
|
|
426
|
-
}
|
|
427
|
-
spinner.start("Setting up Tailwind config...");
|
|
428
|
-
const tailwindConfigPath = path.join(cwd, "tailwind.config.ts");
|
|
429
|
-
if (!fs.existsSync(tailwindConfigPath)) {
|
|
548
|
+
const cssContent = isTailwind4 ? generateCssVariablesV4(selectedTheme) : generateCssVariablesV3(selectedTheme);
|
|
549
|
+
await fs.writeFile(globalsPath, cssContent);
|
|
550
|
+
spinner.succeed(`Updated ${chalk.cyan(path.relative(cwd, globalsPath))} with ${chalk.cyan(THEMES[selectedTheme].name)} theme (${isTailwind4 ? "Tailwind 4" : "Tailwind 3"})`);
|
|
551
|
+
if (!isTailwind4) {
|
|
552
|
+
spinner.start("Setting up Tailwind config...");
|
|
553
|
+
const tailwindConfigPath = path.join(cwd, "tailwind.config.ts");
|
|
430
554
|
await fs.writeFile(tailwindConfigPath, TAILWIND_CONFIG);
|
|
431
555
|
spinner.succeed(`Created ${chalk.cyan("tailwind.config.ts")}`);
|
|
432
556
|
} else {
|
|
433
|
-
spinner.info(
|
|
557
|
+
spinner.info(`Tailwind 4 detected - skipping ${chalk.cyan("tailwind.config.ts")}`);
|
|
434
558
|
}
|
|
435
559
|
spinner.start("Checking dependencies...");
|
|
436
|
-
const
|
|
437
|
-
const
|
|
560
|
+
const currentPkg = await fs.readJson(packageJsonPath);
|
|
561
|
+
const currentDeps = { ...currentPkg.dependencies, ...currentPkg.devDependencies };
|
|
438
562
|
const missing = [];
|
|
439
|
-
const requiredDeps =
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
563
|
+
const requiredDeps = {
|
|
564
|
+
"clsx": "clsx@2.1.1",
|
|
565
|
+
"tailwind-merge": "tailwind-merge@3.4.0",
|
|
566
|
+
"class-variance-authority": "class-variance-authority@0.7.1",
|
|
567
|
+
"lucide-react": "lucide-react@0.561.0"
|
|
568
|
+
};
|
|
569
|
+
if (!isTailwind4) {
|
|
570
|
+
requiredDeps["tailwindcss-animate"] = "tailwindcss-animate";
|
|
571
|
+
}
|
|
572
|
+
for (const [depName, installCmd2] of Object.entries(requiredDeps)) {
|
|
573
|
+
if (!currentDeps[depName]) {
|
|
574
|
+
missing.push(installCmd2);
|
|
443
575
|
}
|
|
444
576
|
}
|
|
445
577
|
if (missing.length > 0) {
|
|
446
|
-
spinner.text = `Installing dependencies: ${missing.join(", ")}...`;
|
|
578
|
+
spinner.text = `Installing dependencies via ${packageManager}: ${missing.join(", ")}...`;
|
|
447
579
|
try {
|
|
448
580
|
const { execSync } = await import("child_process");
|
|
449
|
-
execSync(
|
|
581
|
+
execSync(`${packageManager} ${installCmd} ${missing.join(" ")}`, { stdio: "ignore", cwd });
|
|
450
582
|
spinner.succeed("Dependencies installed");
|
|
451
583
|
} catch {
|
|
452
584
|
spinner.fail("Failed to install dependencies automatically");
|
|
453
585
|
console.log(chalk.dim(`
|
|
454
|
-
Please manually run:
|
|
586
|
+
Please manually run: ${packageManager} ${installCmd} ${missing.join(" ")}
|
|
455
587
|
`));
|
|
456
588
|
}
|
|
457
589
|
} else {
|
|
@@ -459,6 +591,7 @@ Please manually run: npm install ${missing.join(" ")}
|
|
|
459
591
|
}
|
|
460
592
|
console.log(chalk.green("\n\u2705 Project initialized successfully!\n"));
|
|
461
593
|
console.log(`Theme: ${chalk.cyan(THEMES[selectedTheme].name)}`);
|
|
594
|
+
console.log(`Tailwind: ${chalk.cyan(isTailwind4 ? "v4" : "v3")}`);
|
|
462
595
|
console.log("\nNext steps:");
|
|
463
596
|
console.log(chalk.dim(" npx @srcroot/ui add button"));
|
|
464
597
|
console.log(chalk.dim(" npx @srcroot/ui add --all"));
|
|
@@ -856,7 +989,7 @@ async function add(components, options) {
|
|
|
856
989
|
}
|
|
857
990
|
if (invalidComponents.length > 0) {
|
|
858
991
|
console.log(chalk2.red(`Unknown components: ${invalidComponents.join(", ")}`));
|
|
859
|
-
console.log(chalk2.dim("\nRun 'srcroot
|
|
992
|
+
console.log(chalk2.dim("\nRun '@srcroot/ui list' to see available components."));
|
|
860
993
|
process.exit(1);
|
|
861
994
|
}
|
|
862
995
|
const toInstall = /* @__PURE__ */ new Set();
|
|
@@ -946,13 +1079,13 @@ async function list() {
|
|
|
946
1079
|
});
|
|
947
1080
|
console.log();
|
|
948
1081
|
}
|
|
949
|
-
console.log(chalk3.dim("Usage: npx srcroot
|
|
1082
|
+
console.log(chalk3.dim("Usage: npx @srcroot/ui add <component>\n"));
|
|
950
1083
|
}
|
|
951
1084
|
|
|
952
1085
|
// src/cli/index.ts
|
|
953
1086
|
var program = new Command();
|
|
954
|
-
program.name("@srcroot/ui").description("Add polymorphic, accessible UI components to your project").version("0.0.
|
|
955
|
-
program.command("init").description("Initialize your project with srcroot
|
|
1087
|
+
program.name("@srcroot/ui").description("Add polymorphic, accessible UI components to your project").version("0.0.12");
|
|
1088
|
+
program.command("init").description("Initialize your project with @srcroot/ui").option("-y, --yes", "Skip confirmation prompts", false).option("-t, --theme <theme>", "Color theme (slate, neutral, stone, zinc, gray)").option("--cwd <path>", "Working directory", process.cwd()).action(init);
|
|
956
1089
|
program.command("add").description("Add components to your project").argument("[components...]", "Components to add").option("-y, --yes", "Skip confirmation prompts", false).option("-o, --overwrite", "Overwrite existing files", false).option("-a, --all", "Add all available components", false).option("--cwd <path>", "Working directory", process.cwd()).action(add);
|
|
957
1090
|
program.command("list").description("List all available components").action(list);
|
|
958
1091
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srcroot/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "A shadcn-style CLI UI library with polymorphic, accessible React components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": "^18.0.0 || ^19.0.0",
|
|
41
41
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
42
|
-
"lucide-react": "^0.
|
|
42
|
+
"lucide-react": "^0.561.0",
|
|
43
43
|
"cmdk": "^1.0.0",
|
|
44
|
-
"class-variance-authority": "^0.7.
|
|
45
|
-
"clsx": "^2.
|
|
46
|
-
"tailwind-merge": "^
|
|
44
|
+
"class-variance-authority": "^0.7.1",
|
|
45
|
+
"clsx": "^2.1.1",
|
|
46
|
+
"tailwind-merge": "^3.4.0",
|
|
47
47
|
"tailwindcss": "^3.0.0 || ^4.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
@@ -103,8 +103,19 @@
|
|
|
103
103
|
COMPONENT TOKENS
|
|
104
104
|
======================================== */
|
|
105
105
|
--sidebar-width: 16rem;
|
|
106
|
-
--sidebar-width-
|
|
106
|
+
--sidebar-width-mobile: 18rem;
|
|
107
|
+
--sidebar-width-collapsed: 3rem;
|
|
108
|
+
--sidebar-width-icon: 3rem;
|
|
107
109
|
--header-height: 3.5rem;
|
|
110
|
+
|
|
111
|
+
--sidebar-background: 0 0% 98%;
|
|
112
|
+
--sidebar-foreground: 240 5.3% 26.1%;
|
|
113
|
+
--sidebar-primary: 240 5.9% 10%;
|
|
114
|
+
--sidebar-primary-foreground: 0 0% 98%;
|
|
115
|
+
--sidebar-accent: 240 4.8% 95.9%;
|
|
116
|
+
--sidebar-accent-foreground: 240 5.9% 10%;
|
|
117
|
+
--sidebar-border: 220 13% 91%;
|
|
118
|
+
--sidebar-ring: 217.2 91.2% 59.8%;
|
|
108
119
|
}
|
|
109
120
|
|
|
110
121
|
/* ========================================
|
|
@@ -142,6 +153,15 @@
|
|
|
142
153
|
--input: 217.2 32.6% 17.5%;
|
|
143
154
|
--ring: 212.7 26.8% 83.9%;
|
|
144
155
|
|
|
156
|
+
--sidebar-background: 240 5.9% 10%;
|
|
157
|
+
--sidebar-foreground: 240 4.8% 95.9%;
|
|
158
|
+
--sidebar-primary: 224.3 76.3% 48%;
|
|
159
|
+
--sidebar-primary-foreground: 0 0% 100%;
|
|
160
|
+
--sidebar-accent: 240 3.7% 15.9%;
|
|
161
|
+
--sidebar-accent-foreground: 240 4.8% 95.9%;
|
|
162
|
+
--sidebar-border: 240 3.7% 15.9%;
|
|
163
|
+
--sidebar-ring: 217.2 91.2% 59.8%;
|
|
164
|
+
|
|
145
165
|
--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
|
|
146
166
|
--shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4);
|
|
147
167
|
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
|
package/registry/sidebar.tsx
CHANGED
|
@@ -8,9 +8,7 @@ import { cn } from "@/lib/utils"
|
|
|
8
8
|
import { Button } from "@/components/ui/button"
|
|
9
9
|
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@/components/ui/sheet"
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
const SIDEBAR_WIDTH_MOBILE = "18rem"
|
|
13
|
-
const SIDEBAR_WIDTH_ICON = "3rem"
|
|
11
|
+
|
|
14
12
|
|
|
15
13
|
const SidebarContext = React.createContext<{
|
|
16
14
|
state: "expanded" | "collapsed"
|
|
@@ -87,8 +85,6 @@ const SidebarProvider = React.forwardRef<
|
|
|
87
85
|
<div
|
|
88
86
|
style={
|
|
89
87
|
{
|
|
90
|
-
"--sidebar-width": SIDEBAR_WIDTH,
|
|
91
|
-
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
92
88
|
...style,
|
|
93
89
|
} as React.CSSProperties
|
|
94
90
|
}
|
|
@@ -131,7 +127,7 @@ const Sidebar = React.forwardRef<
|
|
|
131
127
|
return (
|
|
132
128
|
<div
|
|
133
129
|
className={cn(
|
|
134
|
-
"flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",
|
|
130
|
+
"flex h-full w-[var(--sidebar-width)] flex-col bg-sidebar text-sidebar-foreground",
|
|
135
131
|
className
|
|
136
132
|
)}
|
|
137
133
|
ref={ref}
|
|
@@ -148,10 +144,10 @@ const Sidebar = React.forwardRef<
|
|
|
148
144
|
<SheetContent
|
|
149
145
|
data-sidebar="sidebar"
|
|
150
146
|
data-mobile="true"
|
|
151
|
-
className="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
|
|
147
|
+
className="w-[var(--sidebar-width)] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
|
|
152
148
|
style={
|
|
153
149
|
{
|
|
154
|
-
"--sidebar-width":
|
|
150
|
+
"--sidebar-width": "var(--sidebar-width-mobile)",
|
|
155
151
|
} as React.CSSProperties
|
|
156
152
|
}
|
|
157
153
|
side={side}
|
|
@@ -181,26 +177,26 @@ const Sidebar = React.forwardRef<
|
|
|
181
177
|
{/* Visual Gap for Sidebar (Fixed placeholder) */}
|
|
182
178
|
<div
|
|
183
179
|
className={cn(
|
|
184
|
-
"duration-200 relative h-svh w-[--sidebar-width] bg-transparent transition-[width] ease-linear",
|
|
180
|
+
"duration-200 relative h-svh w-[var(--sidebar-width)] bg-transparent transition-[width] ease-linear",
|
|
185
181
|
"group-data-[collapsible=offcanvas]:w-0",
|
|
186
182
|
"group-data-[side=right]:rotate-180",
|
|
187
183
|
variant === "floating" || variant === "inset"
|
|
188
|
-
? "group-data-[collapsible=icon]
|
|
189
|
-
: "group-data-[collapsible=icon]
|
|
184
|
+
? "group-data-[collapsible=icon]:!w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]"
|
|
185
|
+
: "group-data-[collapsible=icon]:!w-[var(--sidebar-width-icon)]"
|
|
190
186
|
)}
|
|
191
187
|
/>
|
|
192
188
|
|
|
193
189
|
{/* Actual Fixed Sidebar */}
|
|
194
190
|
<div
|
|
195
191
|
className={cn(
|
|
196
|
-
"duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex",
|
|
192
|
+
"duration-200 fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] ease-linear md:flex",
|
|
197
193
|
side === "left"
|
|
198
194
|
? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
|
|
199
195
|
: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
200
196
|
// Adjustments for floating/inset
|
|
201
197
|
variant === "floating" || variant === "inset"
|
|
202
|
-
? "p-2 group-data-[collapsible=icon]
|
|
203
|
-
: "group-data-[collapsible=icon]
|
|
198
|
+
? "p-2 group-data-[collapsible=icon]:!w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+_2px)]"
|
|
199
|
+
: "group-data-[collapsible=icon]:!w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
204
200
|
className
|
|
205
201
|
)}
|
|
206
202
|
{...props}
|
package/registry/themes/gray.css
CHANGED
|
@@ -43,6 +43,21 @@
|
|
|
43
43
|
--ring: 224 71.4% 4.1%;
|
|
44
44
|
|
|
45
45
|
--radius: 0.5rem;
|
|
46
|
+
|
|
47
|
+
--sidebar-width: 16rem;
|
|
48
|
+
--sidebar-width-mobile: 18rem;
|
|
49
|
+
--sidebar-width-collapsed: 3rem;
|
|
50
|
+
--sidebar-width-icon: 3rem;
|
|
51
|
+
--header-height: 3.5rem;
|
|
52
|
+
|
|
53
|
+
--sidebar-background: 0 0% 98%;
|
|
54
|
+
--sidebar-foreground: 224 71.4% 4.1%;
|
|
55
|
+
--sidebar-primary: 220.9 39.3% 11%;
|
|
56
|
+
--sidebar-primary-foreground: 210 20% 98%;
|
|
57
|
+
--sidebar-accent: 220 14.3% 95.9%;
|
|
58
|
+
--sidebar-accent-foreground: 220.9 39.3% 11%;
|
|
59
|
+
--sidebar-border: 220 13% 91%;
|
|
60
|
+
--sidebar-ring: 224 71.4% 4.1%;
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
.dark {
|
|
@@ -82,5 +97,14 @@
|
|
|
82
97
|
--border: 215 27.9% 16.9%;
|
|
83
98
|
--input: 215 27.9% 16.9%;
|
|
84
99
|
--ring: 216 12.2% 83.9%;
|
|
100
|
+
|
|
101
|
+
--sidebar-background: 224 71.4% 10%;
|
|
102
|
+
--sidebar-foreground: 210 20% 98%;
|
|
103
|
+
--sidebar-primary: 210 20% 98%;
|
|
104
|
+
--sidebar-primary-foreground: 220.9 39.3% 11%;
|
|
105
|
+
--sidebar-accent: 215 27.9% 16.9%;
|
|
106
|
+
--sidebar-accent-foreground: 210 20% 98%;
|
|
107
|
+
--sidebar-border: 215 27.9% 16.9%;
|
|
108
|
+
--sidebar-ring: 216 12.2% 83.9%;
|
|
85
109
|
}
|
|
86
110
|
}
|
|
@@ -43,6 +43,21 @@
|
|
|
43
43
|
--ring: 0 0% 3.9%;
|
|
44
44
|
|
|
45
45
|
--radius: 0.5rem;
|
|
46
|
+
|
|
47
|
+
--sidebar-width: 16rem;
|
|
48
|
+
--sidebar-width-mobile: 18rem;
|
|
49
|
+
--sidebar-width-collapsed: 3rem;
|
|
50
|
+
--sidebar-width-icon: 3rem;
|
|
51
|
+
--header-height: 3.5rem;
|
|
52
|
+
|
|
53
|
+
--sidebar-background: 0 0% 98%;
|
|
54
|
+
--sidebar-foreground: 0 0% 3.9%;
|
|
55
|
+
--sidebar-primary: 0 0% 9%;
|
|
56
|
+
--sidebar-primary-foreground: 0 0% 98%;
|
|
57
|
+
--sidebar-accent: 0 0% 96.1%;
|
|
58
|
+
--sidebar-accent-foreground: 0 0% 9%;
|
|
59
|
+
--sidebar-border: 0 0% 89.8%;
|
|
60
|
+
--sidebar-ring: 0 0% 3.9%;
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
.dark {
|
|
@@ -82,5 +97,14 @@
|
|
|
82
97
|
--border: 0 0% 14.9%;
|
|
83
98
|
--input: 0 0% 14.9%;
|
|
84
99
|
--ring: 0 0% 83.1%;
|
|
100
|
+
|
|
101
|
+
--sidebar-background: 0 0% 10%;
|
|
102
|
+
--sidebar-foreground: 0 0% 98%;
|
|
103
|
+
--sidebar-primary: 0 0% 98%;
|
|
104
|
+
--sidebar-primary-foreground: 0 0% 9%;
|
|
105
|
+
--sidebar-accent: 0 0% 14.9%;
|
|
106
|
+
--sidebar-accent-foreground: 0 0% 98%;
|
|
107
|
+
--sidebar-border: 0 0% 14.9%;
|
|
108
|
+
--sidebar-ring: 0 0% 83.1%;
|
|
85
109
|
}
|
|
86
110
|
}
|
|
@@ -43,6 +43,21 @@
|
|
|
43
43
|
--ring: 222.2 84% 4.9%;
|
|
44
44
|
|
|
45
45
|
--radius: 0.5rem;
|
|
46
|
+
|
|
47
|
+
--sidebar-width: 16rem;
|
|
48
|
+
--sidebar-width-mobile: 18rem;
|
|
49
|
+
--sidebar-width-collapsed: 3rem;
|
|
50
|
+
--sidebar-width-icon: 3rem;
|
|
51
|
+
--header-height: 3.5rem;
|
|
52
|
+
|
|
53
|
+
--sidebar-background: 0 0% 98%;
|
|
54
|
+
--sidebar-foreground: 222.2 84% 4.9%;
|
|
55
|
+
--sidebar-primary: 222.2 47.4% 11.2%;
|
|
56
|
+
--sidebar-primary-foreground: 210 40% 98%;
|
|
57
|
+
--sidebar-accent: 210 40% 96.1%;
|
|
58
|
+
--sidebar-accent-foreground: 222.2 47.4% 11.2%;
|
|
59
|
+
--sidebar-border: 214.3 31.8% 91.4%;
|
|
60
|
+
--sidebar-ring: 222.2 84% 4.9%;
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
.dark {
|
|
@@ -82,5 +97,14 @@
|
|
|
82
97
|
--border: 217.2 32.6% 17.5%;
|
|
83
98
|
--input: 217.2 32.6% 17.5%;
|
|
84
99
|
--ring: 212.7 26.8% 83.9%;
|
|
100
|
+
|
|
101
|
+
--sidebar-background: 222.2 84% 10%;
|
|
102
|
+
--sidebar-foreground: 210 40% 98%;
|
|
103
|
+
--sidebar-primary: 210 40% 98%;
|
|
104
|
+
--sidebar-primary-foreground: 222.2 47.4% 11.2%;
|
|
105
|
+
--sidebar-accent: 217.2 32.6% 17.5%;
|
|
106
|
+
--sidebar-accent-foreground: 210 40% 98%;
|
|
107
|
+
--sidebar-border: 217.2 32.6% 17.5%;
|
|
108
|
+
--sidebar-ring: 212.7 26.8% 83.9%;
|
|
85
109
|
}
|
|
86
110
|
}
|
|
@@ -43,6 +43,21 @@
|
|
|
43
43
|
--ring: 24 9.8% 10%;
|
|
44
44
|
|
|
45
45
|
--radius: 0.5rem;
|
|
46
|
+
|
|
47
|
+
--sidebar-width: 16rem;
|
|
48
|
+
--sidebar-width-mobile: 18rem;
|
|
49
|
+
--sidebar-width-collapsed: 3rem;
|
|
50
|
+
--sidebar-width-icon: 3rem;
|
|
51
|
+
--header-height: 3.5rem;
|
|
52
|
+
|
|
53
|
+
--sidebar-background: 0 0% 98%;
|
|
54
|
+
--sidebar-foreground: 24 9.8% 10%;
|
|
55
|
+
--sidebar-primary: 24 9.8% 10%;
|
|
56
|
+
--sidebar-primary-foreground: 60 9.1% 97.8%;
|
|
57
|
+
--sidebar-accent: 60 4.8% 95.9%;
|
|
58
|
+
--sidebar-accent-foreground: 24 9.8% 10%;
|
|
59
|
+
--sidebar-border: 20 5.9% 90%;
|
|
60
|
+
--sidebar-ring: 24 9.8% 10%;
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
.dark {
|
|
@@ -82,5 +97,14 @@
|
|
|
82
97
|
--border: 12 6.5% 15.1%;
|
|
83
98
|
--input: 12 6.5% 15.1%;
|
|
84
99
|
--ring: 24 5.7% 82.9%;
|
|
100
|
+
|
|
101
|
+
--sidebar-background: 24 9.8% 14%;
|
|
102
|
+
--sidebar-foreground: 60 9.1% 97.8%;
|
|
103
|
+
--sidebar-primary: 60 9.1% 97.8%;
|
|
104
|
+
--sidebar-primary-foreground: 24 9.8% 10%;
|
|
105
|
+
--sidebar-accent: 12 6.5% 15.1%;
|
|
106
|
+
--sidebar-accent-foreground: 60 9.1% 97.8%;
|
|
107
|
+
--sidebar-border: 12 6.5% 15.1%;
|
|
108
|
+
--sidebar-ring: 24 5.7% 82.9%;
|
|
85
109
|
}
|
|
86
110
|
}
|
package/registry/themes/zinc.css
CHANGED
|
@@ -43,6 +43,21 @@
|
|
|
43
43
|
--ring: 240 10% 3.9%;
|
|
44
44
|
|
|
45
45
|
--radius: 0.5rem;
|
|
46
|
+
|
|
47
|
+
--sidebar-width: 16rem;
|
|
48
|
+
--sidebar-width-mobile: 18rem;
|
|
49
|
+
--sidebar-width-collapsed: 3rem;
|
|
50
|
+
--sidebar-width-icon: 3rem;
|
|
51
|
+
--header-height: 3.5rem;
|
|
52
|
+
|
|
53
|
+
--sidebar-background: 0 0% 98%;
|
|
54
|
+
--sidebar-foreground: 240 5.3% 26.1%;
|
|
55
|
+
--sidebar-primary: 240 5.9% 10%;
|
|
56
|
+
--sidebar-primary-foreground: 0 0% 98%;
|
|
57
|
+
--sidebar-accent: 240 4.8% 95.9%;
|
|
58
|
+
--sidebar-accent-foreground: 240 5.9% 10%;
|
|
59
|
+
--sidebar-border: 220 13% 91%;
|
|
60
|
+
--sidebar-ring: 217.2 91.2% 59.8%;
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
.dark {
|
|
@@ -82,5 +97,14 @@
|
|
|
82
97
|
--border: 240 3.7% 15.9%;
|
|
83
98
|
--input: 240 3.7% 15.9%;
|
|
84
99
|
--ring: 240 4.9% 83.9%;
|
|
100
|
+
|
|
101
|
+
--sidebar-background: 240 5.9% 10%;
|
|
102
|
+
--sidebar-foreground: 240 4.8% 95.9%;
|
|
103
|
+
--sidebar-primary: 224.3 76.3% 48%;
|
|
104
|
+
--sidebar-primary-foreground: 0 0% 100%;
|
|
105
|
+
--sidebar-accent: 240 3.7% 15.9%;
|
|
106
|
+
--sidebar-accent-foreground: 240 4.8% 95.9%;
|
|
107
|
+
--sidebar-border: 240 3.7% 15.9%;
|
|
108
|
+
--sidebar-ring: 217.2 91.2% 59.8%;
|
|
85
109
|
}
|
|
86
110
|
}
|