Skip to content

New component stepper #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: v1.0.0-alpha3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e8f30eb
stepperPage - added demo
mako3577 Nov 9, 2023
52284c2
new component - stepper - created componend with basic funcionalities
mlazaru Nov 17, 2023
1f8a247
stepper - added 'vertical' option, fixed invalid styles in stepperSte…
mlazaru Nov 20, 2023
b797abc
stepper - imported stepper in index.tsx, created separated demo examples
mlazaru Nov 21, 2023
2b54daa
stepper - changed type 'vertical' to 'type', improved horizontal step…
mlazaru Nov 21, 2023
27adb7c
stepper - fixed head classes
mlazaru Nov 21, 2023
38314a1
stepper - improved typing, removed unused props, improved code readab…
mlazaru Nov 22, 2023
7854395
stepper - prepared demo and docs
mlazaru Nov 23, 2023
56a70b7
stepper - added custom validation demo
mlazaru Nov 27, 2023
5661ecd
stepper - added 'noEditable' option. Updated styles.
mako3577 Nov 28, 2023
e4bba77
fix(stepper) - changed vertical step height calculating to gridTempla…
mako3577 Jan 30, 2024
7fa782d
feat(stepper) - added 'linear', 'customValidation', crated demo examples
mako3577 Feb 5, 2024
494f0b3
fix(stepper) - fixed types in stepper, stepperTheme, stepperStepTheme
mako3577 Feb 13, 2024
f53127a
refactor(stepper) - minor refactoring, changed inline style to tailwi…
mako3577 Feb 13, 2024
571f2f7
doc(stepper) - added stepper linear and linear with custom validation…
mako3577 Feb 13, 2024
c09a7b3
feat(stepper) - added 'noEditable' option
mako3577 Feb 15, 2024
7971810
Revert "stepper - added 'noEditable' option. Updated styles."
mako3577 Feb 15, 2024
10b5de6
Merge branch 'stepper-custom-validation' of https://github.com/mdboot…
mako3577 Feb 15, 2024
6e2612b
stepper - added padding to stepperContentWrapper
mako3577 Feb 15, 2024
d224658
doc(stepper) - added noEditable demo, updated api section
mako3577 Feb 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions site/content/docs/react/components/stepper/a-ss.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
---

<li class="mb-1 pl-[9px] text-[0.85rem]" data-te-spy-active>
<a href="#api-section-import">Import</a>
</li>
<li class="mb-1 pl-[9px] text-[0.85rem]">
<a href="#api-section-properties">Properties</a>
</li>
<li class="mb-1 pl-[9px] text-[0.85rem]">
<a href="#api-section-events">Events</a>
</li>
779 changes: 779 additions & 0 deletions site/content/docs/react/components/stepper/a.html

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions site/content/docs/react/components/stepper/index-ss.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
---

<li class="mb-1 pl-[9px] text-[0.85rem]" data-te-spy-active>
<a href="#basic">Basic example </a>
</li>
<li class="mb-1 pl-[9px] text-[0.85rem]">
<a href="#controlled-step">Controlled step</a>
</li>
<li class="mb-1 pl-[9px] text-[0.85rem]">
<a href="#vertical">Vertical</a>
</li>
<li class="mb-1 pl-[9px] text-[0.85rem]">
<a href="#no-editable">No editable</a>
</li>
<li class="mb-1 pl-[9px] text-[0.85rem]">
<a href="#linear">Linear</a>
</li>
<li class="mb-1 pl-[9px] text-[0.85rem]">
<a href="#linear-custom-validation">Linear with custom validation</a>
</li>
823 changes: 823 additions & 0 deletions site/content/docs/react/components/stepper/index.html

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions site/static/search-react.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@
"keywords": ["loading"],
"category": "Components"
},
{
"href": "/docs/react/components/stepper/",
"name": "Stepper",
"keywords": ["stepper", "progress", "steps", "wizard"],
"category": "Components"
},
{
"href": "/docs/react/forms/checkbox/",
"name": "Checkbox",
Expand Down
8 changes: 8 additions & 0 deletions src/demo/pages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import ToastsPage from "./pages/components/toasts/ToastsPage";
import SelectPage from "./pages/forms/select/SelectPage";
import CarouselPage from "./pages/components/carousel/CarouselPage";
import VideoCarouselPage from "./pages/components/video-carousel/VideoCarouselPage";
import StepperPage from "./pages/components/stepper/StepperPage";

//examples pages
import ButtonExamples from "./pages/components/buttons/exampleList";
Expand Down Expand Up @@ -94,6 +95,7 @@ import ToastsExamples from "./pages/components/toasts/exampleList";
import SelectExamples from "./pages/forms/select/exampleList";
import CarouselExamples from "./pages/components/carousel/exampleList";
import VideoCarouselExamples from "./pages/components/video-carousel/exampleList";
import StepperExamples from "./pages/components/stepper/exampleList";

interface Pages {
name: string;
Expand Down Expand Up @@ -197,6 +199,11 @@ const componentsPages: Pages[] = [
path: "/components/video-carousel",
element: <VideoCarouselPage />,
},
{
name: "stepper",
path: "/components/stepper",
element: <StepperPage />,
},
];

const contentStylesPages: Pages[] = [
Expand Down Expand Up @@ -408,6 +415,7 @@ export const examplesPages: Pages[] = [
...SelectExamples,
...CarouselExamples,
...VideoCarouselExamples,
...StepperExamples,
];

export default demoPages;
79 changes: 79 additions & 0 deletions src/demo/pages/components/stepper/StepperPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React from "react";
import StepperControlledStep from "./examples/StepperControlledStep";
import StepperVerticalExample from "./examples/StepperVerticalExample";
import StepperBasicExample from "./examples/StepperBasicExample";
import StepperNoEditable from "./examples/StepperNoEditable";
import StepperLinearExample from "./examples/StepperLinear";
import StepperLinearCustomValidationExample from "./examples/StepperLinearCustomValidation";

const StepperPage = () => {
return (
<div
className="
max-w-[540px] sm:max-w-[604px] md:max-w-[720px] lg:max-w-[972px]
xl:max-w-full xl:px-12 2xl:max-w-[1400px] mx-auto
flex"
>
<div className="flex w-full flex-col">
<h2 className="text-2xl font-semibold text-neutral-700 dark:text-neutral-300 mb-6 h-">
Basic example
</h2>
<div className="rounded-lg border dark:border-neutral-600 p-4">
<StepperBasicExample />
</div>

<hr className="my-10" />

<h2 className="text-2xl font-semibold text-neutral-700 dark:text-neutral-300 mb-6">
Controlled active step
</h2>

<div className="rounded-lg border dark:border-neutral-600 p-4">
<StepperControlledStep />
</div>

<hr className="my-10" />

<h2 className="text-2xl font-semibold text-neutral-700 dark:text-neutral-300 mb-6">
Vertical stepper
</h2>

<div className="rounded-lg border dark:border-neutral-600 p-4 w-1/2">
<StepperVerticalExample />
</div>

<hr className="my-10" />

<h2 className="text-2xl font-semibold text-neutral-700 dark:text-neutral-300 mb-6">
Stepper with no editable steps
</h2>

<div className="rounded-lg border dark:border-neutral-600 p-4">
<StepperNoEditable />
</div>

<hr className="my-10" />

<h2 className="text-2xl font-semibold text-neutral-700 dark:text-neutral-300 mb-6">
Linear stepper
</h2>

<div className="rounded-lg border dark:border-neutral-600 p-4">
<StepperLinearExample />
</div>

<hr className="my-10" />

<h2 className="text-2xl font-semibold text-neutral-700 dark:text-neutral-300 mb-6">
Linear stepper with custom validation
</h2>

<div className="rounded-lg border dark:border-neutral-600 p-4">
<StepperLinearCustomValidationExample />
</div>
</div>
</div>
);
};

export default StepperPage;
40 changes: 40 additions & 0 deletions src/demo/pages/components/stepper/exampleList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from "react";
import StepperBasicExample from "./examples/StepperBasicExample";
import StepperControlledStep from "./examples/StepperControlledStep";
import StepperVerticalExample from "./examples/StepperVerticalExample";
import StepperLinearExample from "./examples/StepperLinear";
import StepperLinearCustomValidationExample from "./examples/StepperLinearCustomValidation";
import StepperNoEditable from "./examples/StepperNoEditable";

export default [
{
name: "StepperBasicExample",
path: "/components/stepper/examples/stepper-basic-example",
element: <StepperBasicExample />,
},
{
name: "StepperControlledStep",
path: "/components/stepper/examples/stepper-controlled-step",
element: <StepperControlledStep />,
},
{
name: "StepperVerticalExample",
path: "/components/stepper/examples/stepper-vertical-example",
element: <StepperVerticalExample />,
},
{
name: "StepperNoEditable",
path: "/components/stepper/examples/stepper-no-editable-example",
element: <StepperNoEditable />,
},
{
name: "StepperLinearExample",
path: "/components/stepper/examples/stepper-linear-example",
element: <StepperLinearExample />,
},
{
name: "StepperLinearCustomValidationExample",
path: "/components/stepper/examples/stepper-linear-custom-validation-example",
element: <StepperLinearCustomValidationExample />,
},
];
21 changes: 21 additions & 0 deletions src/demo/pages/components/stepper/examples/StepperBasicExample.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from "react";
import { TEStepper, TEStepperStep } from "tw-elements-react";

export default function StepperBasicExample(): JSX.Element {
return (
<TEStepper>
<TEStepperStep headText="Step 1" headIcon="1">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
</TEStepperStep>
<TEStepperStep headText="Step 2" headIcon={"2"}>
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
ut aliquip ex ea commodo consequat.
</TEStepperStep>
<TEStepperStep headText="Step 3" headIcon={"3"}>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
dolore eu fugiat nulla pariatur.
</TEStepperStep>
</TEStepper>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React, { useState } from "react";
import { TEStepper, TEStepperStep } from "tw-elements-react";

export default function StepperControlledStep(): JSX.Element {
const [activeStep, setActiveStep] = useState<number>(1);

return (
<TEStepper
activeStep={activeStep}
onChange={(_, next) => {
setActiveStep(next);
}}
>
<TEStepperStep headText="Step 1" headIcon={"1"}>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
</TEStepperStep>
<TEStepperStep headText="Step 2" headIcon={"2"}>
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
ut aliquip ex ea commodo consequat.
</TEStepperStep>
<TEStepperStep headText="Step 3" headIcon={"3"}>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
dolore eu fugiat nulla pariatur.
</TEStepperStep>
</TEStepper>
);
}
42 changes: 42 additions & 0 deletions src/demo/pages/components/stepper/examples/StepperLinear.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from "react";
import { TEStepper, TEStepperStep, TEInput } from "tw-elements-react";

export default function StepperLinearExample() {
return (
<form>
<TEStepper linear>
<TEStepperStep headText="Step 1" headIcon={"1"}>
<h3 className="text-lg font-semibold mb-4">
Enter your email and start the adventure of your life!
</h3>

<div className="w-1/2 mx-auto">
<TEInput type="email" label="Email (required)" required />
</div>
</TEStepperStep>
<TEStepperStep headText="Step 2" headIcon={"2"}>
<h3 className="text-lg font-semibold mb-4">
You're almost there! Just a few more details!
</h3>
<div className="w-1/2 mx-auto mb-4">
<TEInput label="First Name" autoComplete="given-name" required />
</div>
<div className="w-1/2 mx-auto mb-4">
<TEInput label="Last Name" autoComplete="family-name" required />
</div>

<div className="w-1/2 mx-auto mb-4">
<TEInput label="Phone" autoComplete="tel" required />
</div>
</TEStepperStep>
<TEStepperStep headText="Step 3" headIcon={"3"}>
<div className="text-center mt-10 mb-10">
<h3 className="text-lg font-semibold mb-4">
You're all set! We will contact you soon!
</h3>
</div>
</TEStepperStep>
</TEStepper>
</form>
);
}
Loading