create-bdpa-react-scaffold 1.8.7 → 1.8.9
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 +14 -37
- package/package.json +1 -1
package/create-ui-lib.js
CHANGED
|
@@ -354,9 +354,15 @@ module.exports = {
|
|
|
354
354
|
write("vite.config.mts", `
|
|
355
355
|
import { defineConfig } from "vite";
|
|
356
356
|
import react from "@vitejs/plugin-react-swc";
|
|
357
|
+
import path from "path";
|
|
357
358
|
|
|
358
359
|
export default defineConfig({
|
|
359
360
|
plugins: [react()],
|
|
361
|
+
resolve: {
|
|
362
|
+
alias: {
|
|
363
|
+
"@": path.resolve(__dirname, "./src"),
|
|
364
|
+
},
|
|
365
|
+
},
|
|
360
366
|
server: {
|
|
361
367
|
host: true,
|
|
362
368
|
port: 3000
|
|
@@ -650,7 +656,7 @@ export function cn(...inputs) {
|
|
|
650
656
|
`);
|
|
651
657
|
|
|
652
658
|
write("src/index.js", `
|
|
653
|
-
export {
|
|
659
|
+
export { Button } from "./components/ui/button.jsx";
|
|
654
660
|
export { default as Card } from "./components/ui/Card.jsx";
|
|
655
661
|
export { default as Input } from "./components/ui/Input.jsx";
|
|
656
662
|
export { default as FormField } from "./components/ui/FormField.jsx";
|
|
@@ -786,7 +792,7 @@ function Dashboard() {
|
|
|
786
792
|
</FormField>
|
|
787
793
|
|
|
788
794
|
<div className="flex gap-2 pt-2">
|
|
789
|
-
<Button
|
|
795
|
+
<Button>Save</Button>
|
|
790
796
|
<Button variant="secondary">Cancel</Button>
|
|
791
797
|
</div>
|
|
792
798
|
</div>
|
|
@@ -803,9 +809,9 @@ function Dashboard() {
|
|
|
803
809
|
<Card>
|
|
804
810
|
<h2 className="text-lg font-semibold mb-4">Button Variants</h2>
|
|
805
811
|
<div className="flex flex-wrap gap-3">
|
|
806
|
-
<Button
|
|
812
|
+
<Button>Primary</Button>
|
|
807
813
|
<Button variant="secondary">Secondary</Button>
|
|
808
|
-
<Button variant="
|
|
814
|
+
<Button variant="destructive">Danger</Button>
|
|
809
815
|
<Button variant="outline">Outline</Button>
|
|
810
816
|
</div>
|
|
811
817
|
</Card>
|
|
@@ -891,37 +897,8 @@ export default function App() {
|
|
|
891
897
|
// UI Components
|
|
892
898
|
// -------------------------------
|
|
893
899
|
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
variant = "primary",
|
|
897
|
-
children,
|
|
898
|
-
className = "",
|
|
899
|
-
...props
|
|
900
|
-
}) {
|
|
901
|
-
const base =
|
|
902
|
-
"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";
|
|
903
|
-
|
|
904
|
-
const variants = {
|
|
905
|
-
primary:
|
|
906
|
-
"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",
|
|
907
|
-
secondary:
|
|
908
|
-
"bg-gray-200 text-gray-900 hover:bg-gray-300 focus:ring-gray-400",
|
|
909
|
-
danger:
|
|
910
|
-
"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",
|
|
911
|
-
outline:
|
|
912
|
-
"border border-gray-300 text-gray-800 hover:bg-gray-100 focus:ring-gray-400"
|
|
913
|
-
};
|
|
914
|
-
|
|
915
|
-
return (
|
|
916
|
-
<button
|
|
917
|
-
className={\`\${base} \${variants[variant]} \${className}\`}
|
|
918
|
-
{...props}
|
|
919
|
-
>
|
|
920
|
-
{children}
|
|
921
|
-
</button>
|
|
922
|
-
);
|
|
923
|
-
}
|
|
924
|
-
`);
|
|
900
|
+
// Note: Button component is provided by shadcn/ui (src/components/ui/button.jsx)
|
|
901
|
+
// Installed via: npx shadcn@latest add button
|
|
925
902
|
|
|
926
903
|
write("src/components/ui/Card.jsx", `
|
|
927
904
|
export default function Card({ children, className = "" }) {
|
|
@@ -1203,7 +1180,7 @@ export function ToastProvider({ children }) {
|
|
|
1203
1180
|
// -------------------------------
|
|
1204
1181
|
|
|
1205
1182
|
write("src/pages/auth/Login.jsx", `
|
|
1206
|
-
import Button from "
|
|
1183
|
+
import { Button } from "@/components/ui/button";
|
|
1207
1184
|
import Input from "../../components/ui/Input.jsx";
|
|
1208
1185
|
import Card from "../../components/ui/Card.jsx";
|
|
1209
1186
|
|
|
@@ -1232,7 +1209,7 @@ export default function Login({ onSubmit }) {
|
|
|
1232
1209
|
}`);
|
|
1233
1210
|
|
|
1234
1211
|
write("src/pages/auth/Register.jsx", `
|
|
1235
|
-
import Button from "
|
|
1212
|
+
import { Button } from "@/components/ui/button";
|
|
1236
1213
|
import Input from "../../components/ui/Input.jsx";
|
|
1237
1214
|
import Card from "../../components/ui/Card.jsx";
|
|
1238
1215
|
|