From 8dc45d526f6be08d7e0e216efea420223acf5ccf Mon Sep 17 00:00:00 2001 From: Guillermo Arrieta Medina Date: Mon, 29 Dec 2025 11:32:56 -0600 Subject: [PATCH] Stepper de ejemplo integrado --- bun.lock | 5 + package.json | 1 + src/components/planes/App.css | 42 ++ src/components/planes/stepper.tsx | 163 ++++++ src/components/stepper.tsx | 534 ++++++++++++++++++ src/components/ui/separator.tsx | 26 + src/components/ui/textarea.tsx | 18 + src/routeTree.gen.ts | 114 ++-- src/routes/planes/$planId/route.tsx | 10 + src/routes/planes/_lista/nuevo.tsx | 29 + .../{planes.tsx => planes/_lista/route.tsx} | 8 +- src/routes/planes/index.tsx | 15 - 12 files changed, 905 insertions(+), 60 deletions(-) create mode 100644 src/components/planes/App.css create mode 100644 src/components/planes/stepper.tsx create mode 100644 src/components/stepper.tsx create mode 100644 src/components/ui/separator.tsx create mode 100644 src/components/ui/textarea.tsx create mode 100644 src/routes/planes/$planId/route.tsx create mode 100644 src/routes/planes/_lista/nuevo.tsx rename src/routes/{planes.tsx => planes/_lista/route.tsx} (97%) delete mode 100644 src/routes/planes/index.tsx diff --git a/bun.lock b/bun.lock index 189f5f9..d8d8025 100644 --- a/bun.lock +++ b/bun.lock @@ -12,6 +12,7 @@ "@radix-ui/react-separator": "^1.1.8", "@radix-ui/react-slot": "^1.2.4", "@radix-ui/react-tooltip": "^1.2.8", + "@stepperize/react": "^5.1.9", "@tailwindcss/vite": "^4.0.6", "@tanstack/react-devtools": "^0.7.0", "@tanstack/react-query": "^5.66.5", @@ -362,6 +363,10 @@ "@solid-primitives/utils": ["@solid-primitives/utils@6.3.2", "", { "peerDependencies": { "solid-js": "^1.6.12" } }, "sha512-hZ/M/qr25QOCcwDPOHtGjxTD8w2mNyVAYvcfgwzBHq2RwNqHNdDNsMZYap20+ruRwW4A3Cdkczyoz0TSxLCAPQ=="], + "@stepperize/core": ["@stepperize/core@1.2.7", "", { "peerDependencies": { "typescript": ">=5.0.2" } }, "sha512-XiUwLZ0XRAfaDK6AzWVgqvI/BcrylyplhUXKO8vzgRw0FTmyMKHAAbQLDvU//ZJAqnmG2cSLZDSkcwLxU5zSYA=="], + + "@stepperize/react": ["@stepperize/react@5.1.9", "", { "dependencies": { "@stepperize/core": "1.2.7" }, "peerDependencies": { "react": "^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-yBgw1I5Tx6/qZB4xTdVBaPGfTqH5aYS1WFB5vtR8+fwPeqd3YNuOnQ1pJM6w/xV/gvryuy31hbFw080lZc+/hw=="], + "@stylistic/eslint-plugin": ["@stylistic/eslint-plugin@5.6.1", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.9.0", "@typescript-eslint/types": "^8.47.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "estraverse": "^5.3.0", "picomatch": "^4.0.3" }, "peerDependencies": { "eslint": ">=9.0.0" } }, "sha512-JCs+MqoXfXrRPGbGmho/zGS/jMcn3ieKl/A8YImqib76C8kjgZwq5uUFzc30lJkMvcchuRn6/v8IApLxli3Jyw=="], "@tailwindcss/node": ["@tailwindcss/node@4.1.18", "", { "dependencies": { "@jridgewell/remapping": "^2.3.4", "enhanced-resolve": "^5.18.3", "jiti": "^2.6.1", "lightningcss": "1.30.2", "magic-string": "^0.30.21", "source-map-js": "^1.2.1", "tailwindcss": "4.1.18" } }, "sha512-DoR7U1P7iYhw16qJ49fgXUlry1t4CpXeErJHnQ44JgTSKMaZUdf17cfn5mHchfJ4KRBZRFA/Coo+MUF5+gOaCQ=="], diff --git a/package.json b/package.json index 95a361f..1b17817 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "@radix-ui/react-separator": "^1.1.8", "@radix-ui/react-slot": "^1.2.4", "@radix-ui/react-tooltip": "^1.2.8", + "@stepperize/react": "^5.1.9", "@tailwindcss/vite": "^4.0.6", "@tanstack/react-devtools": "^0.7.0", "@tanstack/react-query": "^5.66.5", diff --git a/src/components/planes/App.css b/src/components/planes/App.css new file mode 100644 index 0000000..b9d355d --- /dev/null +++ b/src/components/planes/App.css @@ -0,0 +1,42 @@ +#root { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + +.logo { + height: 6em; + padding: 1.5em; + will-change: filter; + transition: filter 300ms; +} +.logo:hover { + filter: drop-shadow(0 0 2em #646cffaa); +} +.logo.react:hover { + filter: drop-shadow(0 0 2em #61dafbaa); +} + +@keyframes logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} + +@media (prefers-reduced-motion: no-preference) { + a:nth-of-type(2) .logo { + animation: logo-spin infinite 20s linear; + } +} + +.card { + padding: 2em; +} + +.read-the-docs { + color: #888; +} diff --git a/src/components/planes/stepper.tsx b/src/components/planes/stepper.tsx new file mode 100644 index 0000000..569fa81 --- /dev/null +++ b/src/components/planes/stepper.tsx @@ -0,0 +1,163 @@ +import { defineStepper } from '@stepperize/react' +import * as React from 'react' + +import { Button } from '@/components/ui/button' +import { Input } from '@/components/ui/input' +import { Separator } from '@/components/ui/separator' +import { Textarea } from '@/components/ui/textarea' +// import './App.css' + +const { useStepper, steps, utils } = defineStepper( + { + id: 'shipping', + title: 'Shipping', + description: 'Enter your shipping details', + }, + { + id: 'payment', + title: 'Payment', + description: 'Enter your payment details', + }, + { id: 'complete', title: 'Complete', description: 'Checkout complete' }, +) + +function App() { + const stepper = useStepper() + + const currentIndex = utils.getIndex(stepper.current.id) + return ( +
+
+

Checkout

+
+ + Step {currentIndex + 1} of {steps.length} + +
+
+
+ +
+ {stepper.switch({ + shipping: () => , + payment: () => , + complete: () => , + })} + {!stepper.isLast ? ( +
+ + +
+ ) : ( + + )} +
+
+ ) +} + +const ShippingComponent = () => { + return ( +
+
+ + +
+
+ +