create-bdpa-react-scaffold 1.8.6 → 1.8.8
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/create-ui-lib.js +20 -39
- package/package.json +1 -1
package/create-ui-lib.js
CHANGED
|
@@ -64,12 +64,22 @@ function installShadcn(cwd) {
|
|
|
64
64
|
console.log("\n🎨 Installing shadcn/ui components (all)...");
|
|
65
65
|
const result = spawnSync(
|
|
66
66
|
npxCmd,
|
|
67
|
-
[
|
|
67
|
+
[
|
|
68
|
+
"shadcn@latest", "add",
|
|
69
|
+
"accordion", "alert", "alert-dialog", "aspect-ratio", "avatar", "badge",
|
|
70
|
+
"button", "calendar", "card", "carousel", "checkbox", "collapsible",
|
|
71
|
+
"command", "dialog", "drawer", "dropdown-menu", "form", "hover-card",
|
|
72
|
+
"input", "label", "menubar", "navigation-menu", "popover", "progress",
|
|
73
|
+
"radio-group", "scroll-area", "select", "separator", "sheet", "skeleton",
|
|
74
|
+
"slider", "sonner", "switch", "table", "tabs", "textarea", "toast",
|
|
75
|
+
"toggle", "tooltip",
|
|
76
|
+
"--yes", "--overwrite"
|
|
77
|
+
],
|
|
68
78
|
{ stdio: "inherit", cwd }
|
|
69
79
|
);
|
|
70
80
|
if (result.status !== 0) {
|
|
71
81
|
console.warn(`\n⚠️ shadcn install exited with status ${result.status}.`);
|
|
72
|
-
console.warn(" Run manually: npx shadcn@latest add
|
|
82
|
+
console.warn(" Run manually: npx shadcn@latest add accordion alert alert-dialog aspect-ratio avatar badge button calendar card carousel checkbox collapsible command dialog drawer dropdown-menu form hover-card input label menubar navigation-menu popover progress radio-group scroll-area select separator sheet skeleton slider sonner switch table tabs textarea toast toggle tooltip");
|
|
73
83
|
} else {
|
|
74
84
|
console.log("\n✅ shadcn/ui components installed.");
|
|
75
85
|
}
|
|
@@ -640,7 +650,7 @@ export function cn(...inputs) {
|
|
|
640
650
|
`);
|
|
641
651
|
|
|
642
652
|
write("src/index.js", `
|
|
643
|
-
export {
|
|
653
|
+
export { Button } from "./components/ui/button.jsx";
|
|
644
654
|
export { default as Card } from "./components/ui/Card.jsx";
|
|
645
655
|
export { default as Input } from "./components/ui/Input.jsx";
|
|
646
656
|
export { default as FormField } from "./components/ui/FormField.jsx";
|
|
@@ -776,7 +786,7 @@ function Dashboard() {
|
|
|
776
786
|
</FormField>
|
|
777
787
|
|
|
778
788
|
<div className="flex gap-2 pt-2">
|
|
779
|
-
<Button
|
|
789
|
+
<Button>Save</Button>
|
|
780
790
|
<Button variant="secondary">Cancel</Button>
|
|
781
791
|
</div>
|
|
782
792
|
</div>
|
|
@@ -793,9 +803,9 @@ function Dashboard() {
|
|
|
793
803
|
<Card>
|
|
794
804
|
<h2 className="text-lg font-semibold mb-4">Button Variants</h2>
|
|
795
805
|
<div className="flex flex-wrap gap-3">
|
|
796
|
-
<Button
|
|
806
|
+
<Button>Primary</Button>
|
|
797
807
|
<Button variant="secondary">Secondary</Button>
|
|
798
|
-
<Button variant="
|
|
808
|
+
<Button variant="destructive">Danger</Button>
|
|
799
809
|
<Button variant="outline">Outline</Button>
|
|
800
810
|
</div>
|
|
801
811
|
</Card>
|
|
@@ -881,37 +891,8 @@ export default function App() {
|
|
|
881
891
|
// UI Components
|
|
882
892
|
// -------------------------------
|
|
883
893
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
variant = "primary",
|
|
887
|
-
children,
|
|
888
|
-
className = "",
|
|
889
|
-
...props
|
|
890
|
-
}) {
|
|
891
|
-
const base =
|
|
892
|
-
"inline-flex items-center justify-center px-4 py-2 rounded-md font-semibold text-sm transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2";
|
|
893
|
-
|
|
894
|
-
const variants = {
|
|
895
|
-
primary:
|
|
896
|
-
"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",
|
|
897
|
-
secondary:
|
|
898
|
-
"bg-gray-200 text-gray-900 hover:bg-gray-300 focus:ring-gray-400",
|
|
899
|
-
danger:
|
|
900
|
-
"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",
|
|
901
|
-
outline:
|
|
902
|
-
"border border-gray-300 text-gray-800 hover:bg-gray-100 focus:ring-gray-400"
|
|
903
|
-
};
|
|
904
|
-
|
|
905
|
-
return (
|
|
906
|
-
<button
|
|
907
|
-
className={\`\${base} \${variants[variant]} \${className}\`}
|
|
908
|
-
{...props}
|
|
909
|
-
>
|
|
910
|
-
{children}
|
|
911
|
-
</button>
|
|
912
|
-
);
|
|
913
|
-
}
|
|
914
|
-
`);
|
|
894
|
+
// Note: Button component is provided by shadcn/ui (src/components/ui/button.jsx)
|
|
895
|
+
// Installed via: npx shadcn@latest add button
|
|
915
896
|
|
|
916
897
|
write("src/components/ui/Card.jsx", `
|
|
917
898
|
export default function Card({ children, className = "" }) {
|
|
@@ -1193,7 +1174,7 @@ export function ToastProvider({ children }) {
|
|
|
1193
1174
|
// -------------------------------
|
|
1194
1175
|
|
|
1195
1176
|
write("src/pages/auth/Login.jsx", `
|
|
1196
|
-
import Button from "
|
|
1177
|
+
import { Button } from "@/components/ui/button";
|
|
1197
1178
|
import Input from "../../components/ui/Input.jsx";
|
|
1198
1179
|
import Card from "../../components/ui/Card.jsx";
|
|
1199
1180
|
|
|
@@ -1222,7 +1203,7 @@ export default function Login({ onSubmit }) {
|
|
|
1222
1203
|
}`);
|
|
1223
1204
|
|
|
1224
1205
|
write("src/pages/auth/Register.jsx", `
|
|
1225
|
-
import Button from "
|
|
1206
|
+
import { Button } from "@/components/ui/button";
|
|
1226
1207
|
import Input from "../../components/ui/Input.jsx";
|
|
1227
1208
|
import Card from "../../components/ui/Card.jsx";
|
|
1228
1209
|
|