diff --git a/.docs/README.md b/.docs/README.md
deleted file mode 100644
index 31cfeae..0000000
--- a/.docs/README.md
+++ /dev/null
@@ -1,155 +0,0 @@
-# Contributte\Form-wizzard
-
-## Content
-
-- [Usage - how use it](#usage)
- - [Register extension](#register-extension)
- - [Component](#component)
- - [Presenter](#presenter)
- - [Template](#template)
-
-
-## Usage
-
-### Register extension
-
-```neon
-extensions:
- - Contributte\FormWizard\DI\WizardExtension
-```
-
-## Component
-
-```php
-
-use Nette\Application\UI\Form;
-
-class Wizard extends Contributte\FormWizard\Wizard {
-
- private array $stepNames = [
- 1 => "Skip username",
- 2 => "Username",
- 3 => "Email",
- ];
-
- protected function finish(): void
- {
- $values = $this->getValues();
- }
-
- protected function startup(): void
- {
- $this->skipStepIf(2, function (array $values): bool {
- return isset($values[1]) && $values[1]['skip'] === true;
- });
- $this->setDefaultValues(2, function (Form $form, array $values) {
- $data = [
- 'username' => 'john_doe'
- ];
- $form->setDefaults($data);
- });
- }
-
- public function getStepData(int $step): array
- {
- return [
- 'name' => $this->stepNames[$step]
- ];
- }
-
- protected function createStep1(): Form
- {
- $form = $this->createForm();
-
- $form->addCheckbox('skip', 'Skip username');
-
- $form->addSubmit(self::NEXT_SUBMIT_NAME, 'Next');
-
- return $form;
- }
-
- protected function createStep2(): Form
- {
- $form = $this->createForm();
-
- $form->addText('username', 'Username')
- ->setRequired();
-
- $form->addSubmit(self::PREV_SUBMIT_NAME, 'Back');
- $form->addSubmit(self::NEXT_SUBMIT_NAME, 'Next');
-
- return $form;
- }
-
- protected function createStep3(): Form
- {
- $form = $this->createForm();
-
- $form->addText('email', 'Email')
- ->setRequired();
-
- $form->addSubmit(self::PREV_SUBMIT_NAME, 'Back');
- $form->addSubmit(self::FINISH_SUBMIT_NAME, 'Register');
-
- return $form;
- }
-}
-```
-
-```neon
-services:
- - Wizard
-```
-
-## Presenter
-
-```php
-
-final class HomepagePresenter extends Nette\Application\UI\Presenter {
-
- /** @var Wizard @inject */
- public $wizard;
-
- public function handleChangeStep(int $step): void
- {
- $this['wizard']->setStep($step);
-
- $this->redirect('wizard'); // Optional, hides parameter from URL
- }
-
- protected function createComponentWizard(): Wizard
- {
- return $this->wizard;
- }
-
-}
-
-```
-
-## Template
-
-```latte
-
-
-
- {step 1}
- {control $form}
- {/step}
-
- {step 2}
- {control $form}
- {/step}
-
- {step 3}
- {control $form}
- {/step}
-
- {step success}
- Registration was successful
- {/step}
-
-```
diff --git a/README.md b/README.md
index c15b153..0462e75 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,16 @@
Website 🚀 contributte.org | Contact 👨🏻💻 f3l1x.io | Twitter 🐦 @contributte
-## Usage
+Multi-step form wizard for Nette applications. Build form flows with separate steps, navigation, default values, and conditional skipping.
+
+## Versions
+
+| State | Version | Branch | PHP |
+|--------|---------|----------|---------|
+| dev | `^4.1` | `master` | `>=8.1` |
+| stable | `^4.0` | `master` | `>=8.1` |
+
+## Installation
To install latest version of `contributte/forms-wizard` use [Composer](https://getcomposer.org).
@@ -26,17 +35,146 @@ To install latest version of `contributte/forms-wizard` use [Composer](https://g
composer require contributte/forms-wizard
```
-## Documentation
+## Usage
-For details on how to use this package, check out our [documentation](.docs).
+### Register Extension
+```neon
+extensions:
+ - Contributte\FormWizard\DI\WizardExtension
+```
-## Versions
+### Component
+
+```php
+use Contributte\FormWizard\Wizard as BaseWizard;
+use Nette\Application\UI\Form;
+
+class Wizard extends BaseWizard
+{
+ private array $stepNames = [
+ 1 => 'Skip username',
+ 2 => 'Username',
+ 3 => 'Email',
+ ];
+
+ protected function finish(): void
+ {
+ $values = $this->getValues();
+ }
+
+ protected function startup(): void
+ {
+ $this->skipStepIf(2, function (array $values): bool {
+ return isset($values[1]) && $values[1]['skip'] === true;
+ });
+
+ $this->setDefaultValues(2, function (Form $form, array $values): void {
+ $form->setDefaults([
+ 'username' => 'john_doe',
+ ]);
+ });
+ }
+
+ public function getStepData(int $step): array
+ {
+ return [
+ 'name' => $this->stepNames[$step],
+ ];
+ }
+
+ protected function createStep1(): Form
+ {
+ $form = $this->createForm();
+
+ $form->addCheckbox('skip', 'Skip username');
+ $form->addSubmit(self::NEXT_SUBMIT_NAME, 'Next');
+
+ return $form;
+ }
+
+ protected function createStep2(): Form
+ {
+ $form = $this->createForm();
+
+ $form->addText('username', 'Username')
+ ->setRequired();
+
+ $form->addSubmit(self::PREV_SUBMIT_NAME, 'Back');
+ $form->addSubmit(self::NEXT_SUBMIT_NAME, 'Next');
-| State | Version | Branch | PHP |
-|-------------|--------|----------|---------|
-| dev | `^4.1` | `master` | `>=8.1` |
-| stable | `^4.0` | `master` | `>=8.1` |
+ return $form;
+ }
+
+ protected function createStep3(): Form
+ {
+ $form = $this->createForm();
+
+ $form->addText('email', 'Email')
+ ->setRequired();
+
+ $form->addSubmit(self::PREV_SUBMIT_NAME, 'Back');
+ $form->addSubmit(self::FINISH_SUBMIT_NAME, 'Register');
+
+ return $form;
+ }
+}
+```
+
+```neon
+services:
+ - Wizard
+```
+
+### Presenter
+
+```php
+final class HomepagePresenter extends Nette\Application\UI\Presenter
+{
+ /** @var Wizard @inject */
+ public $wizard;
+
+ public function handleChangeStep(int $step): void
+ {
+ $this['wizard']->setStep($step);
+
+ $this->redirect('wizard'); // Optional, hides parameter from URL.
+ }
+
+ protected function createComponentWizard(): Wizard
+ {
+ return $this->wizard;
+ }
+}
+```
+
+### Template
+
+```latte
+
+
+
+ {step 1}
+ {control $form}
+ {/step}
+
+ {step 2}
+ {control $form}
+ {/step}
+
+ {step 3}
+ {control $form}
+ {/step}
+
+ {step success}
+ Registration was successful
+ {/step}
+
+```
## Development