shadcn-nextjs-page-generator 1.0.2 → 1.0.4

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 CHANGED
@@ -572,7 +572,7 @@ function generateComponent(config) {
572
572
  const hasAnimations = animations.listAnimations || animations.cardAnimations;
573
573
  const imports = `'use client';
574
574
 
575
- ${hasAnimations ? `import { motion } from 'framer-motion';` : ""}
575
+ ${hasAnimations ? `import { motion, type Variants } from 'framer-motion';` : ""}
576
576
  import { useEffect, useState } from 'react';
577
577
  import { ${entityName} } from '../../domain/entities/${moduleName}.entity';
578
578
  import { Get${entityName}sUseCase } from '../../application/use-cases/get-${moduleName}s.use-case';
@@ -632,7 +632,7 @@ import {
632
632
  ${includeRowSelection ? `import { Checkbox } from "@/components/ui/checkbox";` : ""}`;
633
633
  const animationVariants = hasAnimations ? `
634
634
  // Framer Motion animation variants
635
- const containerVariants = {
635
+ const containerVariants: Variants = {
636
636
  hidden: { opacity: 0 },
637
637
  visible: {
638
638
  opacity: 1,
@@ -642,7 +642,7 @@ const containerVariants = {
642
642
  }
643
643
  };
644
644
 
645
- const itemVariants = {
645
+ const itemVariants: Variants = {
646
646
  hidden: { opacity: 0, x: -20 },
647
647
  visible: {
648
648
  opacity: 1,
@@ -650,6 +650,10 @@ const itemVariants = {
650
650
  transition: { duration: ${animations.intensity === "bold" ? "0.3" : animations.intensity === "subtle" ? "0.15" : "0.2"} }
651
651
  }
652
652
  };
653
+ ${animations.listAnimations ? `
654
+ // Create motion-wrapped TableRow component
655
+ const MotionTableRow = motion(TableRow);
656
+ ` : ""}
653
657
  ` : "";
654
658
  const dataFetchingCode = isTanStack ? `
655
659
  // TanStack Query data fetching
@@ -952,7 +956,7 @@ ${tableHeaders}
952
956
  ) : (
953
957
  ${animations.listAnimations ? `
954
958
  data.map((item, index) => (
955
- <motion.tr
959
+ <MotionTableRow
956
960
  key={item.id}
957
961
  variants={itemVariants}
958
962
  initial="hidden"
@@ -989,7 +993,7 @@ ${tableCells}
989
993
  </DropdownMenu>
990
994
  </div>
991
995
  </TableCell>
992
- ${animations.listAnimations ? `</motion.tr>` : `</TableRow>`}
996
+ ${animations.listAnimations ? `</MotionTableRow>` : `</TableRow>`}
993
997
  ))
994
998
  )}
995
999
  </TableBody>
@@ -1298,7 +1302,7 @@ ${mockDataFields}
1298
1302
  ${fetchFunction}`;
1299
1303
  const imports = `'use client';
1300
1304
 
1301
- ${hasAnimations ? `import { motion } from 'framer-motion';` : ""}
1305
+ ${hasAnimations ? `import { motion, type Variants } from 'framer-motion';` : ""}
1302
1306
  import { useEffect, useState } from 'react';
1303
1307
  ${isTanStack ? `import { useQuery } from '@tanstack/react-query';` : ""}
1304
1308
  import { Button } from '@/components/ui/button';
@@ -1355,7 +1359,7 @@ import {
1355
1359
  ${includeRowSelection ? `import { Checkbox } from "@/components/ui/checkbox";` : ""}`;
1356
1360
  const animationVariants = hasAnimations ? `
1357
1361
  // Framer Motion animation variants
1358
- const containerVariants = {
1362
+ const containerVariants: Variants = {
1359
1363
  hidden: { opacity: 0 },
1360
1364
  visible: {
1361
1365
  opacity: 1,
@@ -1365,7 +1369,7 @@ const containerVariants = {
1365
1369
  }
1366
1370
  };
1367
1371
 
1368
- const itemVariants = {
1372
+ const itemVariants: Variants = {
1369
1373
  hidden: { opacity: 0, x: -20 },
1370
1374
  visible: {
1371
1375
  opacity: 1,
@@ -1373,6 +1377,10 @@ const itemVariants = {
1373
1377
  transition: { duration: ${animations.intensity === "bold" ? "0.3" : animations.intensity === "subtle" ? "0.15" : "0.2"} }
1374
1378
  }
1375
1379
  };
1380
+ ${animations.listAnimations ? `
1381
+ // Create motion-wrapped TableRow component
1382
+ const MotionTableRow = motion(TableRow);
1383
+ ` : ""}
1376
1384
  ` : "";
1377
1385
  const rowSelectionCode = includeRowSelection ? `
1378
1386
  const [selectedRows, setSelectedRows] = useState<Set<string>>(new Set());
@@ -1626,7 +1634,7 @@ ${tableHeaders}
1626
1634
  ) : (
1627
1635
  ${animations.listAnimations ? `
1628
1636
  data.map((item, index) => (
1629
- <motion.tr
1637
+ <MotionTableRow
1630
1638
  key={item.id}
1631
1639
  variants={itemVariants}
1632
1640
  initial="hidden"
@@ -1663,7 +1671,7 @@ ${tableCells}
1663
1671
  </DropdownMenu>
1664
1672
  </div>
1665
1673
  </TableCell>
1666
- ${animations.listAnimations ? `</motion.tr>` : `</TableRow>`}
1674
+ ${animations.listAnimations ? `</MotionTableRow>` : `</TableRow>`}
1667
1675
  ))
1668
1676
  )}
1669
1677
  </TableBody>
@@ -1860,6 +1868,7 @@ async function run() {
1860
1868
  process.exit(1);
1861
1869
  }
1862
1870
  }
1871
+ run();
1863
1872
  export {
1864
1873
  run
1865
1874
  };