@dinachi/cli 0.6.2 → 0.7.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/LICENSE +21 -0
- package/dist/index.js +122 -33
- package/package.json +3 -4
- package/templates/alert-dialog/alert-dialog.tsx +60 -45
- package/templates/autocomplete/autocomplete.tsx +23 -17
- package/templates/badge/badge.tsx +58 -119
- package/templates/card/card.tsx +1 -1
- package/templates/checkbox/checkbox.tsx +16 -14
- package/templates/combobox/combobox.tsx +22 -16
- package/templates/context-menu/context-menu.tsx +124 -186
- package/templates/context-menu/index.ts +3 -1
- package/templates/dialog/dialog.tsx +26 -27
- package/templates/drawer/drawer.tsx +23 -21
- package/templates/field/field.tsx +5 -15
- package/templates/form/form.tsx +9 -66
- package/templates/label/index.ts +1 -0
- package/templates/label/label.tsx +21 -0
- package/templates/menu/index.ts +2 -0
- package/templates/menu/menu.tsx +59 -61
- package/templates/menubar/index.ts +1 -0
- package/templates/menubar/menubar.tsx +52 -71
- package/templates/navigation-menu/navigation-menu.tsx +61 -18
- package/templates/popover/index.ts +4 -1
- package/templates/popover/popover.tsx +89 -34
- package/templates/preview-card/preview-card.tsx +19 -5
- package/templates/radio/index.ts +1 -1
- package/templates/radio/radio.tsx +30 -14
- package/templates/select/select.tsx +83 -76
- package/templates/skeleton/index.ts +1 -0
- package/templates/skeleton/skeleton.tsx +12 -0
- package/templates/slider/slider.tsx +9 -15
- package/templates/switch/switch.tsx +15 -11
- package/templates/tabs/tabs.tsx +2 -2
- package/templates/toast/toast.tsx +76 -48
- package/templates/toggle/toggle.tsx +0 -17
- package/templates/toggle-group/toggle-group.tsx +8 -3
- package/templates/toolbar/toolbar.tsx +5 -4
- package/templates/tooltip/tooltip.tsx +9 -54
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DinachiUI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -202,6 +202,13 @@ function getComponentRegistry() {
|
|
|
202
202
|
dependencies: ["@base-ui/react"],
|
|
203
203
|
utilityDependencies: ["cn"]
|
|
204
204
|
},
|
|
205
|
+
label: {
|
|
206
|
+
name: "label",
|
|
207
|
+
description: "A styled label component for form fields.",
|
|
208
|
+
files: [{ name: "label.tsx" }, { name: "index.ts" }],
|
|
209
|
+
dependencies: [],
|
|
210
|
+
utilityDependencies: ["cn"]
|
|
211
|
+
},
|
|
205
212
|
menu: {
|
|
206
213
|
name: "menu",
|
|
207
214
|
description: "A popup menu for actions and options triggered by a button.",
|
|
@@ -262,7 +269,7 @@ function getComponentRegistry() {
|
|
|
262
269
|
name: "radio",
|
|
263
270
|
description: "A radio input and group for selecting a single option from a set.",
|
|
264
271
|
files: [{ name: "radio.tsx" }, { name: "index.ts" }],
|
|
265
|
-
dependencies: ["@base-ui/react"
|
|
272
|
+
dependencies: ["@base-ui/react"],
|
|
266
273
|
utilityDependencies: ["cn"]
|
|
267
274
|
},
|
|
268
275
|
"scroll-area": {
|
|
@@ -286,6 +293,13 @@ function getComponentRegistry() {
|
|
|
286
293
|
dependencies: ["@base-ui/react"],
|
|
287
294
|
utilityDependencies: ["cn"]
|
|
288
295
|
},
|
|
296
|
+
skeleton: {
|
|
297
|
+
name: "skeleton",
|
|
298
|
+
description: "A placeholder loading animation component.",
|
|
299
|
+
files: [{ name: "skeleton.tsx" }, { name: "index.ts" }],
|
|
300
|
+
dependencies: [],
|
|
301
|
+
utilityDependencies: ["cn"]
|
|
302
|
+
},
|
|
289
303
|
slider: {
|
|
290
304
|
name: "slider",
|
|
291
305
|
description: "An input where the user selects a value from within a given range.",
|
|
@@ -472,6 +486,7 @@ var DEPENDENCY_VERSION_MAP = {
|
|
|
472
486
|
"lucide-react": "^0.552.0",
|
|
473
487
|
"class-variance-authority": "^0.7.1",
|
|
474
488
|
"tailwindcss-animate": "^1.0.7",
|
|
489
|
+
"tw-animate-css": "^1.3.4",
|
|
475
490
|
"clsx": "^2.1.1",
|
|
476
491
|
"tailwind-merge": "^3.3.1"
|
|
477
492
|
};
|
|
@@ -566,9 +581,23 @@ function resolveConfiguredPath(aliasOrPath, projectRoot, compilerConfig) {
|
|
|
566
581
|
}
|
|
567
582
|
return path3.resolve(projectRoot, normalized);
|
|
568
583
|
}
|
|
569
|
-
function
|
|
570
|
-
|
|
571
|
-
const
|
|
584
|
+
function tryResolveAsAlias(absoluteFilePath, compilerConfig) {
|
|
585
|
+
if (!compilerConfig) return null;
|
|
586
|
+
for (const [pattern, targets] of Object.entries(compilerConfig.paths)) {
|
|
587
|
+
if (!pattern.includes("*") || !targets[0]?.includes("*")) continue;
|
|
588
|
+
const [prefix] = pattern.split("*");
|
|
589
|
+
const [targetPrefix] = targets[0].split("*");
|
|
590
|
+
const targetBase = path3.resolve(compilerConfig.baseUrl, targetPrefix);
|
|
591
|
+
const rel = path3.relative(targetBase, absoluteFilePath).replace(/\\/g, "/");
|
|
592
|
+
if (!rel.startsWith("..")) {
|
|
593
|
+
return prefix + stripExtension(rel);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
return null;
|
|
597
|
+
}
|
|
598
|
+
function rewriteTemplateImports(content, targetFilePath, utilsFilePath, libDirPath, compilerConfig) {
|
|
599
|
+
const utilsImportPath = tryResolveAsAlias(utilsFilePath, compilerConfig) ?? toImportPath(targetFilePath, utilsFilePath);
|
|
600
|
+
const variantsImportPath = tryResolveAsAlias(path3.join(libDirPath, "variants.ts"), compilerConfig) ?? toImportPath(targetFilePath, path3.join(libDirPath, "variants.ts"));
|
|
572
601
|
return content.replace(/(['"])@\/lib\/utils\1/g, `$1${utilsImportPath}$1`).replace(/(['"])@\/lib\/variants\1/g, `$1${variantsImportPath}$1`);
|
|
573
602
|
}
|
|
574
603
|
function getComponentDependencies(componentName, visited = /* @__PURE__ */ new Set()) {
|
|
@@ -659,25 +688,25 @@ function detectTailwindMajorVersion(projectRoot) {
|
|
|
659
688
|
}
|
|
660
689
|
}
|
|
661
690
|
async function ensureTW4Plugin(deps, cssFilePath) {
|
|
662
|
-
if (!deps.includes("tailwindcss-animate")) {
|
|
691
|
+
if (!deps.includes("tw-animate-css") && !deps.includes("tailwindcss-animate")) {
|
|
663
692
|
return null;
|
|
664
693
|
}
|
|
665
694
|
if (!fs3.existsSync(cssFilePath)) {
|
|
666
695
|
return { skipped: true, path: cssFilePath };
|
|
667
696
|
}
|
|
668
697
|
const content = await fs3.readFile(cssFilePath, "utf-8");
|
|
669
|
-
if (content.includes("tailwindcss-animate")) {
|
|
698
|
+
if (content.includes("tw-animate-css") || content.includes("tailwindcss-animate")) {
|
|
670
699
|
return { exists: true, path: cssFilePath };
|
|
671
700
|
}
|
|
672
|
-
const
|
|
701
|
+
const importLine = '@import "tw-animate-css";';
|
|
673
702
|
const importMatch = content.match(/^@import\s+["']tailwindcss["'];?\s*$/m);
|
|
674
703
|
let updated;
|
|
675
704
|
if (importMatch) {
|
|
676
705
|
updated = content.replace(importMatch[0], `${importMatch[0].trimEnd()}
|
|
677
|
-
${
|
|
706
|
+
${importLine}
|
|
678
707
|
`);
|
|
679
708
|
} else {
|
|
680
|
-
updated = `${
|
|
709
|
+
updated = `${importLine}
|
|
681
710
|
${content}`;
|
|
682
711
|
}
|
|
683
712
|
await fs3.writeFile(cssFilePath, updated);
|
|
@@ -904,7 +933,7 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
904
933
|
spinner.start();
|
|
905
934
|
}
|
|
906
935
|
const templateContent = stripTemplateDirective(await fs3.readFile(sourcePath, "utf-8"));
|
|
907
|
-
const rewrittenContent = rewriteTemplateImports(templateContent, targetPath, utilsFilePath, libDir);
|
|
936
|
+
const rewrittenContent = rewriteTemplateImports(templateContent, targetPath, utilsFilePath, libDir, compilerPathConfig);
|
|
908
937
|
await fs3.writeFile(targetPath, rewrittenContent);
|
|
909
938
|
allFilesAdded.push({ name: file.name, path: targetPath });
|
|
910
939
|
}
|
|
@@ -914,6 +943,17 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
914
943
|
}
|
|
915
944
|
spinner.text = "Updating Tailwind configuration...";
|
|
916
945
|
const tailwindMajor = detectTailwindMajorVersion(projectRoot);
|
|
946
|
+
if (tailwindMajor >= 4) {
|
|
947
|
+
const idx = allDepsInstalled.indexOf("tailwindcss-animate");
|
|
948
|
+
if (idx !== -1) {
|
|
949
|
+
allDepsInstalled[idx] = "tw-animate-css";
|
|
950
|
+
}
|
|
951
|
+
for (let i = 0; i < allDepsInstalled.length; i++) {
|
|
952
|
+
if (allDepsInstalled[i] === "tailwindcss-animate") {
|
|
953
|
+
allDepsInstalled[i] = "tw-animate-css";
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
}
|
|
917
957
|
const tailwindConfigInfo = tailwindMajor >= 4 ? await ensureTW4Plugin(
|
|
918
958
|
allDepsInstalled,
|
|
919
959
|
path3.resolve(projectRoot, config.tailwind?.css || "src/index.css")
|
|
@@ -953,14 +993,15 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
953
993
|
console.log(` ${chalk.green("+")} ${file.path}`);
|
|
954
994
|
});
|
|
955
995
|
if (tailwindConfigInfo) {
|
|
996
|
+
const animatePackage = tailwindMajor >= 4 ? "tw-animate-css" : "tailwindcss-animate";
|
|
956
997
|
console.log();
|
|
957
998
|
if (tailwindConfigInfo.created) {
|
|
958
|
-
console.log(` ${chalk.green("+")} ${tailwindConfigInfo.path} (created with
|
|
999
|
+
console.log(` ${chalk.green("+")} ${tailwindConfigInfo.path} (created with ${animatePackage} plugin)`);
|
|
959
1000
|
} else if (tailwindConfigInfo.updated) {
|
|
960
|
-
console.log(` ${chalk.blue("~")} ${tailwindConfigInfo.path} (updated with
|
|
1001
|
+
console.log(` ${chalk.blue("~")} ${tailwindConfigInfo.path} (updated with ${animatePackage} plugin)`);
|
|
961
1002
|
} else if (tailwindConfigInfo.skipped) {
|
|
962
1003
|
console.log(
|
|
963
|
-
` ${chalk.yellow("!")} ${tailwindConfigInfo.path} (could not safely update automatically; add
|
|
1004
|
+
` ${chalk.yellow("!")} ${tailwindConfigInfo.path} (could not safely update automatically; add ${animatePackage} manually)`
|
|
964
1005
|
);
|
|
965
1006
|
}
|
|
966
1007
|
}
|
|
@@ -1058,6 +1099,10 @@ function getThemeCSS(tailwindMajor, mode, preservedThemeVars = []) {
|
|
|
1058
1099
|
--accent-foreground: oklch(0.1459 0.0497 142.4953);
|
|
1059
1100
|
--destructive: oklch(0.5248 0.1368 20.8317);
|
|
1060
1101
|
--destructive-foreground: oklch(1 0 0);
|
|
1102
|
+
--success: oklch(0.5882 0.1655 145.39);
|
|
1103
|
+
--success-foreground: oklch(1 0 0);
|
|
1104
|
+
--warning: oklch(0.6365 0.1639 55.49);
|
|
1105
|
+
--warning-foreground: oklch(1 0 0);
|
|
1061
1106
|
--border: oklch(0.9239 0.0017 145.5613);
|
|
1062
1107
|
--input: oklch(0.8481 0.0105 145.4823);
|
|
1063
1108
|
--ring: oklch(0.1459 0.0497 142.4953);
|
|
@@ -1080,6 +1125,10 @@ function getThemeCSS(tailwindMajor, mode, preservedThemeVars = []) {
|
|
|
1080
1125
|
--accent-foreground: oklch(0.9742 0.0101 131.3574);
|
|
1081
1126
|
--destructive: oklch(0.2258 0.0524 12.6119);
|
|
1082
1127
|
--destructive-foreground: oklch(1 0 0);
|
|
1128
|
+
--success: oklch(0.5484 0.1497 145.39);
|
|
1129
|
+
--success-foreground: oklch(1 0 0);
|
|
1130
|
+
--warning: oklch(0.5966 0.1499 55.49);
|
|
1131
|
+
--warning-foreground: oklch(1 0 0);
|
|
1083
1132
|
--border: oklch(0.1811 0.0128 129.2819);
|
|
1084
1133
|
--input: oklch(0.2213 0.0193 135.2915);
|
|
1085
1134
|
--ring: oklch(0.9248 0.0051 145.5339);
|
|
@@ -1108,6 +1157,10 @@ function getThemeCSS(tailwindMajor, mode, preservedThemeVars = []) {
|
|
|
1108
1157
|
--color-accent-foreground: var(--accent-foreground);
|
|
1109
1158
|
--color-destructive: var(--destructive);
|
|
1110
1159
|
--color-destructive-foreground: var(--destructive-foreground);
|
|
1160
|
+
--color-success: var(--success);
|
|
1161
|
+
--color-success-foreground: var(--success-foreground);
|
|
1162
|
+
--color-warning: var(--warning);
|
|
1163
|
+
--color-warning-foreground: var(--warning-foreground);
|
|
1111
1164
|
--color-border: var(--border);
|
|
1112
1165
|
--color-input: var(--input);
|
|
1113
1166
|
--color-ring: var(--ring);
|
|
@@ -1187,6 +1240,14 @@ function getTW3ColorExtend() {
|
|
|
1187
1240
|
DEFAULT: "var(--destructive)",
|
|
1188
1241
|
foreground: "var(--destructive-foreground)",
|
|
1189
1242
|
},
|
|
1243
|
+
success: {
|
|
1244
|
+
DEFAULT: "var(--success)",
|
|
1245
|
+
foreground: "var(--success-foreground)",
|
|
1246
|
+
},
|
|
1247
|
+
warning: {
|
|
1248
|
+
DEFAULT: "var(--warning)",
|
|
1249
|
+
foreground: "var(--warning-foreground)",
|
|
1250
|
+
},
|
|
1190
1251
|
muted: {
|
|
1191
1252
|
DEFAULT: "var(--muted)",
|
|
1192
1253
|
foreground: "var(--muted-foreground)",
|
|
@@ -1364,7 +1425,7 @@ async function ensureAtAlias(projectRoot, srcDir, isTypeScript) {
|
|
|
1364
1425
|
return { path: configPath, skipped: true };
|
|
1365
1426
|
}
|
|
1366
1427
|
}
|
|
1367
|
-
var initCommand = new Command2("init").description("Initialize Dinachi UI in your project").option("--skip-install", "Skip package installation").action(async (options) => {
|
|
1428
|
+
var initCommand = new Command2("init").description("Initialize Dinachi UI in your project").option("--skip-install", "Skip package installation").option("-y, --yes", "Accept all defaults without prompting").action(async (options) => {
|
|
1368
1429
|
console.log(chalk2.bold.cyan("\u{1F3A8} Welcome to Dinachi UI!"));
|
|
1369
1430
|
console.log();
|
|
1370
1431
|
const projectRoot = process.cwd();
|
|
@@ -1376,28 +1437,40 @@ var initCommand = new Command2("init").description("Initialize Dinachi UI in you
|
|
|
1376
1437
|
const projectConfig = detectProjectType();
|
|
1377
1438
|
console.log(chalk2.gray(`Detected ${projectConfig.framework} project`));
|
|
1378
1439
|
console.log();
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1440
|
+
let componentsPath;
|
|
1441
|
+
let utilsPath;
|
|
1442
|
+
if (options.yes) {
|
|
1443
|
+
componentsPath = projectConfig.componentsPath;
|
|
1444
|
+
utilsPath = projectConfig.utilsPath;
|
|
1445
|
+
console.log(chalk2.gray(`Components: ${componentsPath}`));
|
|
1446
|
+
console.log(chalk2.gray(`Utilities: ${utilsPath}`));
|
|
1447
|
+
console.log();
|
|
1448
|
+
} else {
|
|
1449
|
+
const response = await prompts2([
|
|
1450
|
+
{
|
|
1451
|
+
type: "text",
|
|
1452
|
+
name: "componentsPath",
|
|
1453
|
+
message: "Where would you like to install components?",
|
|
1454
|
+
initial: projectConfig.componentsPath
|
|
1455
|
+
},
|
|
1456
|
+
{
|
|
1457
|
+
type: "text",
|
|
1458
|
+
name: "utilsPath",
|
|
1459
|
+
message: "Where would you like to install utilities?",
|
|
1460
|
+
initial: projectConfig.utilsPath
|
|
1461
|
+
}
|
|
1462
|
+
]);
|
|
1463
|
+
if (!response.componentsPath || !response.utilsPath) {
|
|
1464
|
+
console.log(chalk2.red("\u274C Setup cancelled."));
|
|
1465
|
+
process.exit(1);
|
|
1391
1466
|
}
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
console.log(chalk2.red("\u274C Setup cancelled."));
|
|
1395
|
-
process.exit(1);
|
|
1467
|
+
componentsPath = response.componentsPath;
|
|
1468
|
+
utilsPath = response.utilsPath;
|
|
1396
1469
|
}
|
|
1397
1470
|
const spinner = ora2("Setting up Dinachi UI...").start();
|
|
1398
1471
|
try {
|
|
1399
|
-
const normalizedComponentsPath = normalizeProjectPath(
|
|
1400
|
-
const normalizedUtilsPath = normalizeProjectPath(
|
|
1472
|
+
const normalizedComponentsPath = normalizeProjectPath(componentsPath, projectRoot);
|
|
1473
|
+
const normalizedUtilsPath = normalizeProjectPath(utilsPath, projectRoot);
|
|
1401
1474
|
const componentsDirPath = path4.resolve(projectRoot, normalizedComponentsPath);
|
|
1402
1475
|
const utilsDirPath = path4.resolve(projectRoot, normalizedUtilsPath);
|
|
1403
1476
|
const utilsFilePath = path4.join(utilsDirPath, "utils.ts");
|
|
@@ -1425,7 +1498,7 @@ var initCommand = new Command2("init").description("Initialize Dinachi UI in you
|
|
|
1425
1498
|
const configContent = JSON.stringify(
|
|
1426
1499
|
{
|
|
1427
1500
|
style: "default",
|
|
1428
|
-
rsc: projectConfig.framework
|
|
1501
|
+
rsc: detectRsc(projectRoot, projectConfig.framework),
|
|
1429
1502
|
tsx: true,
|
|
1430
1503
|
tailwind: {
|
|
1431
1504
|
config: projectConfig.tailwindConfig,
|
|
@@ -1516,6 +1589,22 @@ var initCommand = new Command2("init").description("Initialize Dinachi UI in you
|
|
|
1516
1589
|
process.exit(1);
|
|
1517
1590
|
}
|
|
1518
1591
|
});
|
|
1592
|
+
function detectRsc(projectRoot, framework) {
|
|
1593
|
+
const configPath = path4.join(projectRoot, "components.json");
|
|
1594
|
+
if (fs4.existsSync(configPath)) {
|
|
1595
|
+
try {
|
|
1596
|
+
const existing = JSON.parse(fs4.readFileSync(configPath, "utf-8"));
|
|
1597
|
+
if (typeof existing.rsc === "boolean") return existing.rsc;
|
|
1598
|
+
} catch {
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
if (framework !== "next.js") return false;
|
|
1602
|
+
const hasAppRouter = fs4.existsSync(path4.join(projectRoot, "app")) || fs4.existsSync(path4.join(projectRoot, "src", "app"));
|
|
1603
|
+
const hasPagesRouter = fs4.existsSync(path4.join(projectRoot, "pages")) || fs4.existsSync(path4.join(projectRoot, "src", "pages"));
|
|
1604
|
+
if (hasAppRouter) return true;
|
|
1605
|
+
if (hasPagesRouter) return false;
|
|
1606
|
+
return true;
|
|
1607
|
+
}
|
|
1519
1608
|
function detectProjectType() {
|
|
1520
1609
|
const packageJsonPath = path4.join(process.cwd(), "package.json");
|
|
1521
1610
|
if (!fs4.existsSync(packageJsonPath)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dinachi/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "CLI for adding Dinachi UI components to your project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -15,12 +15,11 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/
|
|
18
|
+
"url": "git+https://github.com/raymond-UI/dinachiUI.git"
|
|
19
19
|
},
|
|
20
20
|
"homepage": "https://dinachi.dev",
|
|
21
21
|
"bin": {
|
|
22
|
-
"dinachi": "dist/index.js"
|
|
23
|
-
"dinachi-ui": "dist/index.js"
|
|
22
|
+
"dinachi": "dist/index.js"
|
|
24
23
|
},
|
|
25
24
|
"files": [
|
|
26
25
|
"dist",
|
|
@@ -1,46 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
import { AlertDialog as BaseAlertDialog } from "@base-ui/react";
|
|
3
|
-
import { cn } from "@/lib/utils";
|
|
1
|
+
"use client"
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { AlertDialog as BaseAlertDialog } from "@base-ui/react/alert-dialog"
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const AlertDialog = BaseAlertDialog.Root
|
|
8
|
+
const AlertDialogTrigger = BaseAlertDialog.Trigger
|
|
9
|
+
const AlertDialogPortal = BaseAlertDialog.Portal
|
|
10
|
+
|
|
11
|
+
const AlertDialogBackdrop = React.forwardRef<
|
|
12
|
+
HTMLDivElement,
|
|
13
|
+
React.ComponentProps<typeof BaseAlertDialog.Backdrop>
|
|
10
14
|
>(({ className, ...props }, ref) => (
|
|
11
|
-
<BaseAlertDialog.
|
|
15
|
+
<BaseAlertDialog.Backdrop
|
|
12
16
|
ref={ref}
|
|
13
17
|
className={cn(
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"bg-primary text-primary-foreground hover:bg-primary/90",
|
|
18
|
-
"h-10 px-4 py-2",
|
|
18
|
+
"fixed inset-0 z-50 bg-black/80",
|
|
19
|
+
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
20
|
+
"transition-all duration-150",
|
|
19
21
|
className
|
|
20
22
|
)}
|
|
21
23
|
{...props}
|
|
22
24
|
/>
|
|
23
|
-
))
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const AlertDialogPortal = BaseAlertDialog.Portal;
|
|
25
|
+
))
|
|
26
|
+
AlertDialogBackdrop.displayName = "AlertDialogBackdrop"
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const AlertDialogViewport = React.forwardRef<
|
|
29
29
|
HTMLDivElement,
|
|
30
|
-
React.ComponentProps<typeof BaseAlertDialog.
|
|
30
|
+
React.ComponentProps<typeof BaseAlertDialog.Viewport>
|
|
31
31
|
>(({ className, ...props }, ref) => (
|
|
32
|
-
<BaseAlertDialog.
|
|
32
|
+
<BaseAlertDialog.Viewport
|
|
33
33
|
ref={ref}
|
|
34
34
|
className={cn(
|
|
35
|
-
"fixed inset-0 z-50
|
|
36
|
-
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
37
|
-
"transition-all duration-150",
|
|
35
|
+
"fixed inset-0 z-50 flex items-center justify-center overflow-auto",
|
|
38
36
|
className
|
|
39
37
|
)}
|
|
40
38
|
{...props}
|
|
41
39
|
/>
|
|
42
|
-
))
|
|
43
|
-
|
|
40
|
+
))
|
|
41
|
+
AlertDialogViewport.displayName = "AlertDialogViewport"
|
|
44
42
|
|
|
45
43
|
const AlertDialogPopup = React.forwardRef<
|
|
46
44
|
HTMLDivElement,
|
|
@@ -49,7 +47,7 @@ const AlertDialogPopup = React.forwardRef<
|
|
|
49
47
|
<BaseAlertDialog.Popup
|
|
50
48
|
ref={ref}
|
|
51
49
|
className={cn(
|
|
52
|
-
"
|
|
50
|
+
"w-[95%] max-w-lg gap-4 rounded-lg border bg-background p-6 shadow-lg",
|
|
53
51
|
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
54
52
|
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
55
53
|
"transition-all duration-150",
|
|
@@ -57,8 +55,8 @@ const AlertDialogPopup = React.forwardRef<
|
|
|
57
55
|
)}
|
|
58
56
|
{...props}
|
|
59
57
|
/>
|
|
60
|
-
))
|
|
61
|
-
AlertDialogPopup.displayName = "AlertDialogPopup"
|
|
58
|
+
))
|
|
59
|
+
AlertDialogPopup.displayName = "AlertDialogPopup"
|
|
62
60
|
|
|
63
61
|
const AlertDialogTitle = React.forwardRef<
|
|
64
62
|
HTMLHeadingElement,
|
|
@@ -66,11 +64,11 @@ const AlertDialogTitle = React.forwardRef<
|
|
|
66
64
|
>(({ className, ...props }, ref) => (
|
|
67
65
|
<BaseAlertDialog.Title
|
|
68
66
|
ref={ref}
|
|
69
|
-
className={cn("text-lg font-
|
|
67
|
+
className={cn("text-lg font-medium leading-none tracking-tight", className)}
|
|
70
68
|
{...props}
|
|
71
69
|
/>
|
|
72
|
-
))
|
|
73
|
-
AlertDialogTitle.displayName = "AlertDialogTitle"
|
|
70
|
+
))
|
|
71
|
+
AlertDialogTitle.displayName = "AlertDialogTitle"
|
|
74
72
|
|
|
75
73
|
const AlertDialogDescription = React.forwardRef<
|
|
76
74
|
HTMLParagraphElement,
|
|
@@ -81,8 +79,8 @@ const AlertDialogDescription = React.forwardRef<
|
|
|
81
79
|
className={cn("text-sm text-muted-foreground", className)}
|
|
82
80
|
{...props}
|
|
83
81
|
/>
|
|
84
|
-
))
|
|
85
|
-
AlertDialogDescription.displayName = "AlertDialogDescription"
|
|
82
|
+
))
|
|
83
|
+
AlertDialogDescription.displayName = "AlertDialogDescription"
|
|
86
84
|
|
|
87
85
|
const AlertDialogAction = React.forwardRef<
|
|
88
86
|
HTMLButtonElement,
|
|
@@ -91,15 +89,15 @@ const AlertDialogAction = React.forwardRef<
|
|
|
91
89
|
<BaseAlertDialog.Close
|
|
92
90
|
ref={ref}
|
|
93
91
|
className={cn(
|
|
94
|
-
"inline-flex h-10 items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-
|
|
92
|
+
"inline-flex h-10 items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors",
|
|
95
93
|
"hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
96
94
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
97
95
|
className
|
|
98
96
|
)}
|
|
99
97
|
{...props}
|
|
100
98
|
/>
|
|
101
|
-
))
|
|
102
|
-
AlertDialogAction.displayName = "AlertDialogAction"
|
|
99
|
+
))
|
|
100
|
+
AlertDialogAction.displayName = "AlertDialogAction"
|
|
103
101
|
|
|
104
102
|
const AlertDialogCancel = React.forwardRef<
|
|
105
103
|
HTMLButtonElement,
|
|
@@ -108,15 +106,15 @@ const AlertDialogCancel = React.forwardRef<
|
|
|
108
106
|
<BaseAlertDialog.Close
|
|
109
107
|
ref={ref}
|
|
110
108
|
className={cn(
|
|
111
|
-
"inline-flex h-10 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-
|
|
109
|
+
"inline-flex h-10 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors",
|
|
112
110
|
"hover:bg-accent hover:text-accent-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
113
111
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
114
112
|
className
|
|
115
113
|
)}
|
|
116
114
|
{...props}
|
|
117
115
|
/>
|
|
118
|
-
))
|
|
119
|
-
AlertDialogCancel.displayName = "AlertDialogCancel"
|
|
116
|
+
))
|
|
117
|
+
AlertDialogCancel.displayName = "AlertDialogCancel"
|
|
120
118
|
|
|
121
119
|
const AlertDialogHeader = ({
|
|
122
120
|
className,
|
|
@@ -129,8 +127,8 @@ const AlertDialogHeader = ({
|
|
|
129
127
|
)}
|
|
130
128
|
{...props}
|
|
131
129
|
/>
|
|
132
|
-
)
|
|
133
|
-
AlertDialogHeader.displayName = "AlertDialogHeader"
|
|
130
|
+
)
|
|
131
|
+
AlertDialogHeader.displayName = "AlertDialogHeader"
|
|
134
132
|
|
|
135
133
|
const AlertDialogFooter = ({
|
|
136
134
|
className,
|
|
@@ -138,19 +136,35 @@ const AlertDialogFooter = ({
|
|
|
138
136
|
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
139
137
|
<div
|
|
140
138
|
className={cn(
|
|
141
|
-
"flex flex-col-reverse sm:flex-row sm:justify-end
|
|
139
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end mt-1.5",
|
|
142
140
|
className
|
|
143
141
|
)}
|
|
144
142
|
{...props}
|
|
145
143
|
/>
|
|
146
|
-
)
|
|
147
|
-
AlertDialogFooter.displayName = "AlertDialogFooter"
|
|
144
|
+
)
|
|
145
|
+
AlertDialogFooter.displayName = "AlertDialogFooter"
|
|
146
|
+
|
|
147
|
+
const AlertDialogContent = React.forwardRef<
|
|
148
|
+
HTMLDivElement,
|
|
149
|
+
React.ComponentProps<typeof BaseAlertDialog.Popup>
|
|
150
|
+
>(({ className, children, ...props }, ref) => (
|
|
151
|
+
<AlertDialogPortal>
|
|
152
|
+
<AlertDialogBackdrop />
|
|
153
|
+
<AlertDialogViewport>
|
|
154
|
+
<AlertDialogPopup ref={ref} className={className} {...props}>
|
|
155
|
+
{children}
|
|
156
|
+
</AlertDialogPopup>
|
|
157
|
+
</AlertDialogViewport>
|
|
158
|
+
</AlertDialogPortal>
|
|
159
|
+
))
|
|
160
|
+
AlertDialogContent.displayName = "AlertDialogContent"
|
|
148
161
|
|
|
149
162
|
export {
|
|
150
163
|
AlertDialog,
|
|
151
164
|
AlertDialogTrigger,
|
|
152
165
|
AlertDialogPortal,
|
|
153
166
|
AlertDialogBackdrop,
|
|
167
|
+
AlertDialogViewport,
|
|
154
168
|
AlertDialogPopup,
|
|
155
169
|
AlertDialogTitle,
|
|
156
170
|
AlertDialogDescription,
|
|
@@ -158,4 +172,5 @@ export {
|
|
|
158
172
|
AlertDialogCancel,
|
|
159
173
|
AlertDialogHeader,
|
|
160
174
|
AlertDialogFooter,
|
|
161
|
-
|
|
175
|
+
AlertDialogContent,
|
|
176
|
+
}
|
|
@@ -17,9 +17,9 @@ const AutocompleteInput = React.forwardRef<
|
|
|
17
17
|
<AutocompletePrimitive.Input
|
|
18
18
|
ref={ref}
|
|
19
19
|
className={cn(
|
|
20
|
-
"flex h-10 w-full
|
|
20
|
+
"flex h-10 w-full bg-transparent px-3 py-2 text-sm",
|
|
21
21
|
"placeholder:text-muted-foreground",
|
|
22
|
-
"focus:outline-none
|
|
22
|
+
"focus:outline-none",
|
|
23
23
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
24
24
|
className
|
|
25
25
|
)}
|
|
@@ -35,8 +35,8 @@ const AutocompleteTrigger = React.forwardRef<
|
|
|
35
35
|
<AutocompletePrimitive.Trigger
|
|
36
36
|
ref={ref}
|
|
37
37
|
className={cn(
|
|
38
|
-
"inline-flex h-10 items-center justify-center
|
|
39
|
-
"focus-visible:outline-none
|
|
38
|
+
"inline-flex h-10 items-center justify-center px-3",
|
|
39
|
+
"focus-visible:outline-none",
|
|
40
40
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
41
41
|
className
|
|
42
42
|
)}
|
|
@@ -71,24 +71,30 @@ AutocompleteClear.displayName = "AutocompleteClear"
|
|
|
71
71
|
|
|
72
72
|
const AutocompleteContent = React.forwardRef<
|
|
73
73
|
React.ComponentRef<typeof AutocompletePrimitive.Popup>,
|
|
74
|
-
React.ComponentPropsWithoutRef<typeof AutocompletePrimitive.Popup>
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
React.ComponentPropsWithoutRef<typeof AutocompletePrimitive.Popup> & {
|
|
75
|
+
readonly portal?: boolean
|
|
76
|
+
}
|
|
77
|
+
>(({ className, portal = true, ...props }, ref) => {
|
|
78
|
+
const content = (
|
|
77
79
|
<AutocompletePrimitive.Positioner sideOffset={4}>
|
|
78
80
|
<AutocompletePrimitive.Popup
|
|
79
81
|
ref={ref}
|
|
80
82
|
className={cn(
|
|
81
|
-
"relative z-50 min-w-
|
|
82
|
-
"origin-
|
|
83
|
-
"data-
|
|
84
|
-
"data-
|
|
83
|
+
"relative z-50 min-w-(--anchor-width) overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
84
|
+
"origin-(--transform-origin) outline-none",
|
|
85
|
+
"data-starting-style:animate-in data-starting-style:fade-in-0 data-starting-style:zoom-in-95",
|
|
86
|
+
"data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:zoom-out-95",
|
|
85
87
|
className
|
|
86
88
|
)}
|
|
87
89
|
{...props}
|
|
88
90
|
/>
|
|
89
91
|
</AutocompletePrimitive.Positioner>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
if (!portal) return content
|
|
95
|
+
|
|
96
|
+
return <AutocompletePortal>{content}</AutocompletePortal>
|
|
97
|
+
})
|
|
92
98
|
AutocompleteContent.displayName = "AutocompleteContent"
|
|
93
99
|
|
|
94
100
|
const AutocompleteList = React.forwardRef<
|
|
@@ -112,9 +118,9 @@ const AutocompleteItem = React.forwardRef<
|
|
|
112
118
|
<AutocompletePrimitive.Item
|
|
113
119
|
ref={ref}
|
|
114
120
|
className={cn(
|
|
115
|
-
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
116
|
-
"data-
|
|
117
|
-
"data-
|
|
121
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm lg:text-base outline-none",
|
|
122
|
+
"data-highlighted:bg-accent font-normal data-highlighted:text-accent-foreground",
|
|
123
|
+
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
118
124
|
inset && "pl-8",
|
|
119
125
|
className
|
|
120
126
|
)}
|
|
@@ -151,7 +157,7 @@ const AutocompleteEmpty = React.forwardRef<
|
|
|
151
157
|
>(({ className, ...props }, ref) => (
|
|
152
158
|
<AutocompletePrimitive.Empty
|
|
153
159
|
ref={ref}
|
|
154
|
-
className={cn("
|
|
160
|
+
className={cn("p-2 text-center text-sm text-muted-foreground", className)}
|
|
155
161
|
{...props}
|
|
156
162
|
/>
|
|
157
163
|
))
|