@dinachi/cli 0.6.0 → 0.6.2
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 +142 -68
- package/package.json +1 -1
- package/templates/button/button.tsx +3 -1
- package/templates/menu/menu.tsx +20 -20
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import path3 from "path";
|
|
|
11
11
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
12
12
|
import ora from "ora";
|
|
13
13
|
import chalk from "chalk";
|
|
14
|
+
import prompts from "prompts";
|
|
14
15
|
|
|
15
16
|
// src/utils/registry.ts
|
|
16
17
|
import fs from "fs-extra";
|
|
@@ -374,25 +375,14 @@ var LOCK_FILE_MAP = [
|
|
|
374
375
|
{ file: "yarn.lock", manager: "yarn" },
|
|
375
376
|
{ file: "package-lock.json", manager: "npm" }
|
|
376
377
|
];
|
|
377
|
-
function
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
dirs.push(current);
|
|
382
|
-
const parent = path2.dirname(current);
|
|
383
|
-
if (parent === current) {
|
|
384
|
-
break;
|
|
378
|
+
function detectPackageManager(startDir = process.cwd()) {
|
|
379
|
+
for (const entry of LOCK_FILE_MAP) {
|
|
380
|
+
if (fs2.existsSync(path2.join(startDir, entry.file))) {
|
|
381
|
+
return entry.manager;
|
|
385
382
|
}
|
|
386
|
-
current = parent;
|
|
387
383
|
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
function detectManagerFromPackageJson(startDir) {
|
|
391
|
-
for (const dir of walkUpDirectories(startDir)) {
|
|
392
|
-
const packageJsonPath = path2.join(dir, "package.json");
|
|
393
|
-
if (!fs2.existsSync(packageJsonPath)) {
|
|
394
|
-
continue;
|
|
395
|
-
}
|
|
384
|
+
const packageJsonPath = path2.join(startDir, "package.json");
|
|
385
|
+
if (fs2.existsSync(packageJsonPath)) {
|
|
396
386
|
try {
|
|
397
387
|
const packageJson = JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
|
|
398
388
|
const value = packageJson.packageManager ?? "";
|
|
@@ -401,21 +391,6 @@ function detectManagerFromPackageJson(startDir) {
|
|
|
401
391
|
if (value.startsWith("bun@")) return "bun";
|
|
402
392
|
if (value.startsWith("npm@")) return "npm";
|
|
403
393
|
} catch {
|
|
404
|
-
continue;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
return null;
|
|
408
|
-
}
|
|
409
|
-
function detectPackageManager(startDir = process.cwd()) {
|
|
410
|
-
const packageJsonManager = detectManagerFromPackageJson(startDir);
|
|
411
|
-
if (packageJsonManager) {
|
|
412
|
-
return packageJsonManager;
|
|
413
|
-
}
|
|
414
|
-
for (const dir of walkUpDirectories(startDir)) {
|
|
415
|
-
for (const entry of LOCK_FILE_MAP) {
|
|
416
|
-
if (fs2.existsSync(path2.join(dir, entry.file))) {
|
|
417
|
-
return entry.manager;
|
|
418
|
-
}
|
|
419
394
|
}
|
|
420
395
|
}
|
|
421
396
|
return "npm";
|
|
@@ -668,6 +643,46 @@ ${withTrailingComma}
|
|
|
668
643
|
`;
|
|
669
644
|
return next;
|
|
670
645
|
}
|
|
646
|
+
function detectTailwindMajorVersion(projectRoot) {
|
|
647
|
+
const packageJsonPath = path3.join(projectRoot, "package.json");
|
|
648
|
+
if (!fs3.existsSync(packageJsonPath)) return 4;
|
|
649
|
+
try {
|
|
650
|
+
const raw = fs3.readFileSync(packageJsonPath, "utf-8");
|
|
651
|
+
const packageJson = JSON.parse(raw);
|
|
652
|
+
const deps = { ...packageJson.dependencies ?? {}, ...packageJson.devDependencies ?? {} };
|
|
653
|
+
const twVersion = deps.tailwindcss;
|
|
654
|
+
if (!twVersion) return 4;
|
|
655
|
+
const match = twVersion.match(/(\d+)/);
|
|
656
|
+
return match ? parseInt(match[1], 10) : 4;
|
|
657
|
+
} catch {
|
|
658
|
+
return 4;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
async function ensureTW4Plugin(deps, cssFilePath) {
|
|
662
|
+
if (!deps.includes("tailwindcss-animate")) {
|
|
663
|
+
return null;
|
|
664
|
+
}
|
|
665
|
+
if (!fs3.existsSync(cssFilePath)) {
|
|
666
|
+
return { skipped: true, path: cssFilePath };
|
|
667
|
+
}
|
|
668
|
+
const content = await fs3.readFile(cssFilePath, "utf-8");
|
|
669
|
+
if (content.includes("tailwindcss-animate")) {
|
|
670
|
+
return { exists: true, path: cssFilePath };
|
|
671
|
+
}
|
|
672
|
+
const pluginLine = '@plugin "tailwindcss-animate";';
|
|
673
|
+
const importMatch = content.match(/^@import\s+["']tailwindcss["'];?\s*$/m);
|
|
674
|
+
let updated;
|
|
675
|
+
if (importMatch) {
|
|
676
|
+
updated = content.replace(importMatch[0], `${importMatch[0].trimEnd()}
|
|
677
|
+
${pluginLine}
|
|
678
|
+
`);
|
|
679
|
+
} else {
|
|
680
|
+
updated = `${pluginLine}
|
|
681
|
+
${content}`;
|
|
682
|
+
}
|
|
683
|
+
await fs3.writeFile(cssFilePath, updated);
|
|
684
|
+
return { updated: true, path: cssFilePath };
|
|
685
|
+
}
|
|
671
686
|
async function ensureTailwindConfig(deps, projectRoot, configuredFileName) {
|
|
672
687
|
if (!deps.includes("tailwindcss-animate")) {
|
|
673
688
|
return null;
|
|
@@ -730,6 +745,19 @@ ${updatedContent}`;
|
|
|
730
745
|
function escapeRegex(value) {
|
|
731
746
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
732
747
|
}
|
|
748
|
+
function extractExportBlocks(content) {
|
|
749
|
+
const results = [];
|
|
750
|
+
const regex = /export\s+(?:type\s+)?{[^}]*}\s*from\s+['"]\.\/([^'"]+)['"]\s*;?/g;
|
|
751
|
+
let match;
|
|
752
|
+
while ((match = regex.exec(content)) !== null) {
|
|
753
|
+
results.push({ block: match[0].trimEnd(), modulePath: match[1] });
|
|
754
|
+
}
|
|
755
|
+
const starRegex = /export\s+\*\s+from\s+['"]\.\/([^'"]+)['"]\s*;?/g;
|
|
756
|
+
while ((match = starRegex.exec(content)) !== null) {
|
|
757
|
+
results.push({ block: match[0].trimEnd(), modulePath: match[1] });
|
|
758
|
+
}
|
|
759
|
+
return results;
|
|
760
|
+
}
|
|
733
761
|
async function handleIndexFile(sourcePath, targetPath, allFilesAdded, targetDir) {
|
|
734
762
|
const templateContent = stripTemplateDirective(await fs3.readFile(sourcePath, "utf-8"));
|
|
735
763
|
if (!fs3.existsSync(targetPath)) {
|
|
@@ -738,31 +766,30 @@ async function handleIndexFile(sourcePath, targetPath, allFilesAdded, targetDir)
|
|
|
738
766
|
return;
|
|
739
767
|
}
|
|
740
768
|
const existingContent = await fs3.readFile(targetPath, "utf-8");
|
|
741
|
-
const
|
|
742
|
-
const
|
|
743
|
-
for (const
|
|
744
|
-
const match = line.match(/from\s+['"]\.\/([^'"]+)['"]/);
|
|
745
|
-
if (!match) {
|
|
746
|
-
continue;
|
|
747
|
-
}
|
|
748
|
-
const modulePath = match[1];
|
|
769
|
+
const exportBlocks = extractExportBlocks(templateContent);
|
|
770
|
+
const blocksToAppend = [];
|
|
771
|
+
for (const { block, modulePath } of exportBlocks) {
|
|
749
772
|
const modulePathPattern = new RegExp(`from\\s+['"]\\./${escapeRegex(modulePath)}['"]`);
|
|
750
773
|
if (modulePathPattern.test(existingContent)) {
|
|
751
774
|
continue;
|
|
752
775
|
}
|
|
753
|
-
|
|
776
|
+
const normalized = block.endsWith(";") ? block : `${block};`;
|
|
777
|
+
blocksToAppend.push(normalized);
|
|
754
778
|
}
|
|
755
|
-
if (
|
|
779
|
+
if (blocksToAppend.length === 0) {
|
|
756
780
|
return;
|
|
757
781
|
}
|
|
758
782
|
const updatedContent = `${existingContent.trimEnd()}
|
|
759
|
-
${
|
|
783
|
+
${blocksToAppend.join("\n")}
|
|
760
784
|
`;
|
|
761
785
|
await fs3.writeFile(targetPath, updatedContent);
|
|
762
|
-
|
|
786
|
+
const indexPath = path3.join(targetDir, "index.ts");
|
|
787
|
+
if (!allFilesAdded.some((f) => f.path === indexPath)) {
|
|
788
|
+
allFilesAdded.push({ name: "index.ts", path: indexPath });
|
|
789
|
+
}
|
|
763
790
|
}
|
|
764
|
-
var addCommand = new Command("add").description("Add a component to your project").argument("[
|
|
765
|
-
async (
|
|
791
|
+
var addCommand = new Command("add").description("Add a component to your project").argument("[components...]", "Names of the components to add (optional when using --all)").option("-y, --yes", "Skip confirmation prompts").option("-o, --overwrite", "Overwrite existing files").option("-a, --all", "Install all available components").option("--skip-install", "Skip package installation").action(
|
|
792
|
+
async (componentNames, options) => {
|
|
766
793
|
const spinner = ora("Adding component...").start();
|
|
767
794
|
try {
|
|
768
795
|
const config = await getConfig();
|
|
@@ -785,7 +812,7 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
785
812
|
}
|
|
786
813
|
componentsToInstall = Array.from(allComponentsWithDeps);
|
|
787
814
|
} else {
|
|
788
|
-
if (
|
|
815
|
+
if (componentNames.length === 0) {
|
|
789
816
|
spinner.fail("\u274C Component name is required when not using --all flag.");
|
|
790
817
|
console.log("Available components:");
|
|
791
818
|
Object.keys(registry).forEach((name) => {
|
|
@@ -793,16 +820,23 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
793
820
|
});
|
|
794
821
|
process.exit(1);
|
|
795
822
|
}
|
|
796
|
-
const
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
823
|
+
for (const name of componentNames) {
|
|
824
|
+
if (!registry[name]) {
|
|
825
|
+
spinner.fail(`\u274C Component "${name}" not found.`);
|
|
826
|
+
console.log("Available components:");
|
|
827
|
+
Object.keys(registry).forEach((n) => {
|
|
828
|
+
console.log(` ${chalk.cyan(n)}`);
|
|
829
|
+
});
|
|
830
|
+
process.exit(1);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
const allWithDeps = /* @__PURE__ */ new Set();
|
|
834
|
+
for (const name of componentNames) {
|
|
835
|
+
allWithDeps.add(name);
|
|
836
|
+
const deps = getComponentDependencies(name);
|
|
837
|
+
deps.forEach((dep) => allWithDeps.add(dep));
|
|
804
838
|
}
|
|
805
|
-
componentsToInstall =
|
|
839
|
+
componentsToInstall = Array.from(allWithDeps);
|
|
806
840
|
}
|
|
807
841
|
if (!options.all) {
|
|
808
842
|
spinner.text = `Installing ${componentsToInstall.join(", ")}...`;
|
|
@@ -855,8 +889,19 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
855
889
|
continue;
|
|
856
890
|
}
|
|
857
891
|
if (fs3.existsSync(targetPath) && !options.overwrite) {
|
|
858
|
-
spinner.
|
|
859
|
-
|
|
892
|
+
spinner.stop();
|
|
893
|
+
const { overwrite } = await prompts({
|
|
894
|
+
type: "confirm",
|
|
895
|
+
name: "overwrite",
|
|
896
|
+
message: `${file.name} already exists. Overwrite?`,
|
|
897
|
+
initial: false
|
|
898
|
+
});
|
|
899
|
+
if (!overwrite) {
|
|
900
|
+
console.log(` ${chalk.yellow("\u2298")} Skipped ${file.name}`);
|
|
901
|
+
spinner.start();
|
|
902
|
+
continue;
|
|
903
|
+
}
|
|
904
|
+
spinner.start();
|
|
860
905
|
}
|
|
861
906
|
const templateContent = stripTemplateDirective(await fs3.readFile(sourcePath, "utf-8"));
|
|
862
907
|
const rewrittenContent = rewriteTemplateImports(templateContent, targetPath, utilsFilePath, libDir);
|
|
@@ -868,7 +913,11 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
868
913
|
}
|
|
869
914
|
}
|
|
870
915
|
spinner.text = "Updating Tailwind configuration...";
|
|
871
|
-
const
|
|
916
|
+
const tailwindMajor = detectTailwindMajorVersion(projectRoot);
|
|
917
|
+
const tailwindConfigInfo = tailwindMajor >= 4 ? await ensureTW4Plugin(
|
|
918
|
+
allDepsInstalled,
|
|
919
|
+
path3.resolve(projectRoot, config.tailwind?.css || "src/index.css")
|
|
920
|
+
) : await ensureTailwindConfig(
|
|
872
921
|
allDepsInstalled,
|
|
873
922
|
projectRoot,
|
|
874
923
|
config.tailwind?.config || "tailwind.config.js"
|
|
@@ -946,7 +995,7 @@ import { Command as Command2 } from "commander";
|
|
|
946
995
|
import { execSync as execSync2 } from "child_process";
|
|
947
996
|
import fs4 from "fs-extra";
|
|
948
997
|
import path4 from "path";
|
|
949
|
-
import
|
|
998
|
+
import prompts2 from "prompts";
|
|
950
999
|
import chalk2 from "chalk";
|
|
951
1000
|
import ora2 from "ora";
|
|
952
1001
|
function normalizeProjectPath(inputPath, projectRoot) {
|
|
@@ -967,7 +1016,7 @@ export function cn(...inputs: ClassValue[]) {
|
|
|
967
1016
|
}
|
|
968
1017
|
`;
|
|
969
1018
|
}
|
|
970
|
-
function
|
|
1019
|
+
function detectTailwindMajorVersion2(projectRoot) {
|
|
971
1020
|
const packageJsonPath = path4.join(projectRoot, "package.json");
|
|
972
1021
|
if (!fs4.existsSync(packageJsonPath)) return 4;
|
|
973
1022
|
try {
|
|
@@ -982,7 +1031,16 @@ function detectTailwindMajorVersion(projectRoot) {
|
|
|
982
1031
|
return 4;
|
|
983
1032
|
}
|
|
984
1033
|
}
|
|
985
|
-
|
|
1034
|
+
var DINACHI_THEME_PREFIXES = ["--color-", "--radius-"];
|
|
1035
|
+
function extractPreservedThemeVars(css) {
|
|
1036
|
+
const themeMatch = css.match(/@theme\s+inline\s*\{([^}]*)\}/);
|
|
1037
|
+
if (!themeMatch) return [];
|
|
1038
|
+
return themeMatch[1].split("\n").map((line) => line.trim()).filter((line) => {
|
|
1039
|
+
if (!line || line.startsWith("//") || line.startsWith("/*")) return false;
|
|
1040
|
+
return line.startsWith("--") && !DINACHI_THEME_PREFIXES.some((p) => line.startsWith(p));
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
function getThemeCSS(tailwindMajor, mode, preservedThemeVars = []) {
|
|
986
1044
|
const lightVars = `:root {
|
|
987
1045
|
--background: oklch(0.986 0.0034 145.5499);
|
|
988
1046
|
--foreground: oklch(0.1459 0.0497 142.4953);
|
|
@@ -1032,6 +1090,7 @@ function getThemeCSS(tailwindMajor, mode) {
|
|
|
1032
1090
|
parts.push('@import "tailwindcss";');
|
|
1033
1091
|
}
|
|
1034
1092
|
parts.push(lightVars, darkVars);
|
|
1093
|
+
const preservedLines = preservedThemeVars.length > 0 ? "\n" + preservedThemeVars.map((v) => ` ${v}`).join("\n") : "";
|
|
1035
1094
|
parts.push(`@theme inline {
|
|
1036
1095
|
--color-background: var(--background);
|
|
1037
1096
|
--color-foreground: var(--foreground);
|
|
@@ -1055,7 +1114,7 @@ function getThemeCSS(tailwindMajor, mode) {
|
|
|
1055
1114
|
--radius-sm: calc(var(--radius) - 4px);
|
|
1056
1115
|
--radius-md: calc(var(--radius) - 2px);
|
|
1057
1116
|
--radius-lg: var(--radius);
|
|
1058
|
-
--radius-xl: calc(var(--radius) + 4px)
|
|
1117
|
+
--radius-xl: calc(var(--radius) + 4px);${preservedLines}
|
|
1059
1118
|
}`);
|
|
1060
1119
|
parts.push(`@layer base {
|
|
1061
1120
|
* {
|
|
@@ -1081,6 +1140,16 @@ function getThemeCSS(tailwindMajor, mode) {
|
|
|
1081
1140
|
}
|
|
1082
1141
|
return parts.join("\n\n") + "\n";
|
|
1083
1142
|
}
|
|
1143
|
+
function stripConflictingCSS(css) {
|
|
1144
|
+
let result = css;
|
|
1145
|
+
result = result.replace(/@media\s*\(\s*prefers-color-scheme\s*:\s*dark\s*\)\s*\{[\s\S]*?\n\}/g, "");
|
|
1146
|
+
result = result.replace(/:root\s*\{[^}]*\}/g, "");
|
|
1147
|
+
result = result.replace(/\.dark\s*\{[^}]*\}/g, "");
|
|
1148
|
+
result = result.replace(/@theme\s+inline\s*\{[^}]*\}/g, "");
|
|
1149
|
+
result = result.replace(/(?:^|\n)body\s*\{[^}]*\}/g, "");
|
|
1150
|
+
result = result.replace(/\n{3,}/g, "\n\n");
|
|
1151
|
+
return result.trim();
|
|
1152
|
+
}
|
|
1084
1153
|
async function injectThemeCSS(cssFilePath, tailwindMajor) {
|
|
1085
1154
|
await fs4.ensureDir(path4.dirname(cssFilePath));
|
|
1086
1155
|
if (fs4.existsSync(cssFilePath)) {
|
|
@@ -1088,8 +1157,11 @@ async function injectThemeCSS(cssFilePath, tailwindMajor) {
|
|
|
1088
1157
|
if (existing.includes("--primary:")) {
|
|
1089
1158
|
return { path: cssFilePath, skipped: true };
|
|
1090
1159
|
}
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1160
|
+
const preservedVars = tailwindMajor >= 4 ? extractPreservedThemeVars(existing) : [];
|
|
1161
|
+
const cleaned = stripConflictingCSS(existing);
|
|
1162
|
+
const theme2 = getThemeCSS(tailwindMajor, "append", preservedVars);
|
|
1163
|
+
const result = cleaned.length > 0 ? cleaned + "\n\n" + theme2 : getThemeCSS(tailwindMajor, "full", preservedVars);
|
|
1164
|
+
await fs4.writeFile(cssFilePath, result);
|
|
1093
1165
|
return { path: cssFilePath, updated: true };
|
|
1094
1166
|
}
|
|
1095
1167
|
const theme = getThemeCSS(tailwindMajor, "full");
|
|
@@ -1267,7 +1339,9 @@ async function ensureAtAlias(projectRoot, srcDir, isTypeScript) {
|
|
|
1267
1339
|
}
|
|
1268
1340
|
}
|
|
1269
1341
|
const aliasTarget = srcDir === "." ? "*" : `${srcDir}/*`;
|
|
1270
|
-
const
|
|
1342
|
+
const aliasTargetAlt = srcDir === "." ? "./*" : `./${srcDir}/*`;
|
|
1343
|
+
const existingAlias = paths["@/*"]?.[0];
|
|
1344
|
+
const alreadyConfigured = compilerOptions.baseUrl === "." && existingAlias === aliasTarget || existingAlias === aliasTargetAlt;
|
|
1271
1345
|
if (alreadyConfigured) {
|
|
1272
1346
|
return { path: configPath };
|
|
1273
1347
|
}
|
|
@@ -1302,7 +1376,7 @@ var initCommand = new Command2("init").description("Initialize Dinachi UI in you
|
|
|
1302
1376
|
const projectConfig = detectProjectType();
|
|
1303
1377
|
console.log(chalk2.gray(`Detected ${projectConfig.framework} project`));
|
|
1304
1378
|
console.log();
|
|
1305
|
-
const response = await
|
|
1379
|
+
const response = await prompts2([
|
|
1306
1380
|
{
|
|
1307
1381
|
type: "text",
|
|
1308
1382
|
name: "componentsPath",
|
|
@@ -1332,7 +1406,7 @@ var initCommand = new Command2("init").description("Initialize Dinachi UI in you
|
|
|
1332
1406
|
const utilsContent = createUtilsFileContent();
|
|
1333
1407
|
await fs4.writeFile(utilsFilePath, utilsContent);
|
|
1334
1408
|
spinner.text = "Setting up color theme...";
|
|
1335
|
-
const tailwindMajor =
|
|
1409
|
+
const tailwindMajor = detectTailwindMajorVersion2(projectRoot);
|
|
1336
1410
|
const cssFilePath = path4.resolve(projectRoot, projectConfig.cssPath);
|
|
1337
1411
|
const themeCSSResult = await injectThemeCSS(cssFilePath, tailwindMajor);
|
|
1338
1412
|
let twColorConfigResult = null;
|
package/package.json
CHANGED
|
@@ -39,11 +39,13 @@ export interface ButtonProps
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const Button = React.forwardRef<HTMLElement, ButtonProps>(
|
|
42
|
-
({ className, variant, size, ...props }, ref) => {
|
|
42
|
+
({ className, variant, size, render, nativeButton, ...props }, ref) => {
|
|
43
43
|
return (
|
|
44
44
|
<BaseButton
|
|
45
45
|
className={cn(buttonVariants({ variant, size, className }))}
|
|
46
46
|
ref={ref}
|
|
47
|
+
render={render}
|
|
48
|
+
nativeButton={render ? (nativeButton ?? false) : nativeButton}
|
|
47
49
|
{...props}
|
|
48
50
|
/>
|
|
49
51
|
)
|
package/templates/menu/menu.tsx
CHANGED
|
@@ -30,8 +30,8 @@ const MenuTrigger = React.forwardRef<
|
|
|
30
30
|
"inline-flex h-10 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium",
|
|
31
31
|
"hover:bg-accent hover:text-accent-foreground",
|
|
32
32
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
33
|
-
"data-
|
|
34
|
-
"data-
|
|
33
|
+
"data-popup-open:bg-accent data-popup-open:text-accent-foreground",
|
|
34
|
+
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
35
35
|
className
|
|
36
36
|
)}
|
|
37
37
|
{...props}
|
|
@@ -75,10 +75,10 @@ const MenuContent = React.forwardRef<
|
|
|
75
75
|
<MenuPrimitive.Popup
|
|
76
76
|
ref={ref}
|
|
77
77
|
className={cn(
|
|
78
|
-
"z-50 min-w-
|
|
79
|
-
"origin-
|
|
80
|
-
"data-
|
|
81
|
-
"data-
|
|
78
|
+
"z-50 min-w-40 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
79
|
+
"origin-(--transform-origin) outline-none",
|
|
80
|
+
"data-starting-style:animate-in data-starting-style:fade-in-0 data-starting-style:zoom-in-95",
|
|
81
|
+
"data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:zoom-out-95",
|
|
82
82
|
className
|
|
83
83
|
)}
|
|
84
84
|
{...props}
|
|
@@ -99,8 +99,8 @@ const MenuItem = React.forwardRef<
|
|
|
99
99
|
className={cn(
|
|
100
100
|
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
101
101
|
"focus:bg-accent focus:text-accent-foreground",
|
|
102
|
-
"data-
|
|
103
|
-
"data-
|
|
102
|
+
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
103
|
+
"data-highlighted:bg-accent data-highlighted:text-accent-foreground",
|
|
104
104
|
inset && "pl-8",
|
|
105
105
|
className
|
|
106
106
|
)}
|
|
@@ -118,8 +118,8 @@ const MenuCheckboxItem = React.forwardRef<
|
|
|
118
118
|
className={cn(
|
|
119
119
|
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
|
|
120
120
|
"focus:bg-accent focus:text-accent-foreground",
|
|
121
|
-
"data-
|
|
122
|
-
"data-
|
|
121
|
+
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
122
|
+
"data-highlighted:bg-accent data-highlighted:text-accent-foreground",
|
|
123
123
|
className
|
|
124
124
|
)}
|
|
125
125
|
checked={checked}
|
|
@@ -150,14 +150,14 @@ const MenuRadioItem = React.forwardRef<
|
|
|
150
150
|
className={cn(
|
|
151
151
|
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
|
|
152
152
|
"focus:bg-accent focus:text-accent-foreground",
|
|
153
|
-
"data-
|
|
154
|
-
"data-
|
|
153
|
+
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
154
|
+
"data-highlighted:bg-accent data-highlighted:text-accent-foreground",
|
|
155
155
|
className
|
|
156
156
|
)}
|
|
157
157
|
{...props}
|
|
158
158
|
>
|
|
159
159
|
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
160
|
-
<Circle className="h-2 w-2 fill-current data-
|
|
160
|
+
<Circle className="h-2 w-2 fill-current data-checked:block data-unchecked:hidden" />
|
|
161
161
|
</span>
|
|
162
162
|
{children}
|
|
163
163
|
</MenuPrimitive.RadioItem>
|
|
@@ -226,9 +226,9 @@ const MenuSubTrigger = React.forwardRef<
|
|
|
226
226
|
className={cn(
|
|
227
227
|
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
228
228
|
"focus:bg-accent focus:text-accent-foreground",
|
|
229
|
-
"data-
|
|
230
|
-
"data-
|
|
231
|
-
"data-
|
|
229
|
+
"data-highlighted:bg-accent data-highlighted:text-accent-foreground",
|
|
230
|
+
"data-popup-open:bg-accent data-popup-open:text-accent-foreground",
|
|
231
|
+
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
232
232
|
inset && "pl-8",
|
|
233
233
|
className
|
|
234
234
|
)}
|
|
@@ -249,10 +249,10 @@ const MenuSubContent = React.forwardRef<
|
|
|
249
249
|
<MenuPrimitive.Popup
|
|
250
250
|
ref={ref}
|
|
251
251
|
className={cn(
|
|
252
|
-
"z-50 min-w-
|
|
253
|
-
"origin-
|
|
254
|
-
"data-
|
|
255
|
-
"data-
|
|
252
|
+
"z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
253
|
+
"origin-(--transform-origin) outline-none",
|
|
254
|
+
"data-starting-style:animate-in data-starting-style:fade-in-0 data-starting-style:zoom-in-95",
|
|
255
|
+
"data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:zoom-out-95",
|
|
256
256
|
className
|
|
257
257
|
)}
|
|
258
258
|
{...props}
|