diff --git a/.storybook/preview.js b/.storybook/preview.js
index e5e9a38c0..69cccf7ce 100755
--- a/.storybook/preview.js
+++ b/.storybook/preview.js
@@ -29,7 +29,7 @@ async function run() {
showRoots: true,
storySort: sortEachDepth([
['Intro', 'Forms', 'Buttons', 'Overlays', 'Navigation', 'Localize', 'Icons', '...'],
- ['Intro', 'Features Overview', '...', 'System'],
+ ['Intro', 'Features Overview', '...', 'Validation', 'System'],
['Overview', '...', '_internals'],
]),
},
diff --git a/packages/checkbox-group/README.md b/packages/checkbox-group/README.md
index 5bb008418..87b1561e0 100644
--- a/packages/checkbox-group/README.md
+++ b/packages/checkbox-group/README.md
@@ -8,7 +8,7 @@ You should use [lion-checkbox](../checkbox/)'s inside this element.
## Live Demo/Documentation
-> See our [storybook](http://lion-web-components.netlify.com/?path=/docs/forms-checkbox-group) for a live demo and API documentation
+> See our [storybook](http://lion-web-components.netlify.com/?path=/docs/forms-checkbox-group--default-story) for a live demo and API documentation
## How to use
diff --git a/packages/checkbox-group/stories/index.stories.mdx b/packages/checkbox-group/stories/index.stories.mdx
index 9e5acda9a..dadaf1126 100644
--- a/packages/checkbox-group/stories/index.stories.mdx
+++ b/packages/checkbox-group/stories/index.stories.mdx
@@ -37,11 +37,11 @@ Its purpose is to provide a way for users to check **multiple** options amongst
```
-> Make sure that the checkbox-group also has a name attribute, this is necessary for the [lion-form](?path=/docs/forms-form)'s serialization result.
+> Make sure that the checkbox-group also has a name attribute, this is necessary for the [lion-form](?path=/docs/forms-form-overview--page)'s serialization result.
## Features
-Since it extends from [lion-fieldset](?path=/docs/forms-fieldset), it has all the features a fieldset has.
+Since it extends from [lion-fieldset](?path=/docs/forms-fieldset-overview--page), it has all the features a fieldset has.
## How to use
diff --git a/packages/fieldset/README.md b/packages/fieldset/README.md
index b4b3bd6af..f7c857fea 100644
--- a/packages/fieldset/README.md
+++ b/packages/fieldset/README.md
@@ -6,7 +6,7 @@
## Live Demo/Documentation
-> See our [storybook](http://lion-web-components.netlify.com/?path=/docs/forms-fieldset) for a live demo and documentation
+> See our [storybook](http://lion-web-components.netlify.com/?path=/docs/forms-fieldset-overview--page) for a live demo and documentation
## How to use
diff --git a/packages/fieldset/stories/overview.stories.mdx b/packages/fieldset/stories/overview.stories.mdx
new file mode 100644
index 000000000..4edaa7310
--- /dev/null
+++ b/packages/fieldset/stories/overview.stories.mdx
@@ -0,0 +1,41 @@
+import { Story, Meta, html } from '@open-wc/demoing-storybook';
+import '@lion/input/lion-input.js';
+import { localize } from '@lion/localize';
+import { loadDefaultFeedbackMessages, MinLength, Validator, Required } from '@lion/validate';
+import '../lion-fieldset.js';
+import './helpers/demo-fieldset-child.js';
+
+
+
+# Fieldset
+
+`lion-fieldset` groups multiple input fields or other fieldsets together.
+
+We have three specific fieldset implementations:
+
+- [lion-form](?path=/docs/forms-form-overview--page)
+- [lion-checkbox-group](?path=/docs/forms-checkbox-group--default-story)
+- [lion-radio-group](?path=/docs/forms-radio-group--default-story)
+
+```html
+
+
+
+
+```
+
+A native fieldset element should always have a legend-element for a11y purposes.
+However, our fieldset element is not native and should not have a legend-element.
+Our fieldset instead has a label attribute or you can add a label with a div- or heading-element using `slot="label"`.
+
+## Features
+
+- Easy retrieval of form data based on field names
+- Advanced user interaction scenarios via [interaction states](?path=/docs/forms-system-interaction-states--interaction-states)
+- Can have [validate](?path=/docs/forms-validation-overview--page) on fieldset level and shows the validation feedback below the fieldset
+- Can disable input fields on fieldset level
+- Accessible out of the box
+
+## Examples
+
+For examples please look at [Fieldset Examples](?path=/docs/forms-fieldset-examples--default-story).
diff --git a/packages/form-system/stories/10-intro.stories.mdx b/packages/form-system/stories/10-intro.stories.mdx
index 191eade71..c67614875 100644
--- a/packages/form-system/stories/10-intro.stories.mdx
+++ b/packages/form-system/stories/10-intro.stories.mdx
@@ -6,7 +6,7 @@ The Form System allows you to create complex forms with various validations in a
## Features
-- Built in [validate](?path=/docs/forms-system-validate-system) for error/warning/info/success
+- Built in [validate](?path=/docs/forms-validation-overview--page) for error/warning/info/success
- Formatting of values
- Accessible
@@ -14,12 +14,13 @@ For a more in depth description look into the [Form System Overview](?path=/docs
## Packages
-| Package | Description |
-| ---------------------------------------------------- | ---------------------------------- |
+| Package | Description |
+| ---------------------------------------------------- | ------------------------------------------------- |
| [checkbox](?path=/docs/forms-checkbox--default-story) | Checkbox form element |
| [checkbox-group](?path=/docs/forms-checkbox-group--default-story) | Group of checkboxes |
| [field](?path=/docs/forms-field--default-story) | Base class for all inputs |
-| [form](?path=/docs/forms-form--default-story) | Wrapper for multiple form elements |
+| [fieldset](?path=/docs/forms-fieldset-overview--page) | Group for form inputs |
+| [form](?path=/docs/forms-form-overview--page) | Wrapper for multiple form elements |
| [input](?path=/docs/forms-input--default-story) | Input element for strings |
| [input-amount](?path=/docs/forms-input-amount--default-story) | Input element for amounts |
| [input-date](?path=/docs/forms-input-date--default-story) | Input element for dates |
diff --git a/packages/validate/stories/02-ValidationExamples.stories.mdx b/packages/form-system/stories/17-Validation-Examples.stories.mdx
similarity index 91%
rename from packages/validate/stories/02-ValidationExamples.stories.mdx
rename to packages/form-system/stories/17-Validation-Examples.stories.mdx
index 77235d573..b6177d87e 100644
--- a/packages/validate/stories/02-ValidationExamples.stories.mdx
+++ b/packages/form-system/stories/17-Validation-Examples.stories.mdx
@@ -1,6 +1,6 @@
import { Meta, Story, html } from '@open-wc/demoing-storybook';
/* eslint-disable import/no-extraneous-dependencies */
-import { LionInput } from '@lion/input';
+import { LionInput } from '@lion/input/index.js';
import '@lion/input-amount/lion-input-amount.js';
import '@lion/input-date/lion-input-date.js';
import '@lion/input-email/lion-input-email.js';
@@ -23,12 +23,15 @@ import {
MinNumber,
Required,
Validator,
-} from '../index.js';
+} from '@lion/validate';
-
+
## Required Validator
+The required validator can be put onto every form field element and will make sure that element is not empty.
+For an input that may mean that it is not an empty string while for a checkbox group it means at least one checkbox needs to be checked.
+
{html`
@@ -41,6 +44,8 @@ import {
## String Validators
+Useful on input elements it allows to define how many characters can be entered.
+
{html`
```
-
## Number Validators
+Number validations assume that it's modelValue is actually a number.
+Therefore it may only be used on input that have an appropriate parser/formatter like the input-amount.
+
{html`
{() => {
const today = new Date();
@@ -230,6 +239,9 @@ const tomorrow = new Date(year, month, day + 1);
## Validation Types
+When defining your own component you can decide to allow for multiple types of validation.
+By default only `error` is used however there are certainly use cases where warning or success messages make sense.
+
{() => {
try {
@@ -287,16 +299,16 @@ const tomorrow = new Date(year, month, day + 1);
```js
- try {
- class MyTypesInput extends LionInput {
- static get validationTypes() {
- return ['error', 'warning', 'info', 'success'];
- }
- }
- customElements.define('my-types-input', MyTypesInput);
- } catch (err) {
- // expected as it is a demo
+try {
+ class MyTypesInput extends LionInput {
+ static get validationTypes() {
+ return ['error', 'warning', 'info', 'success'];
}
+ }
+ customElements.define('my-types-input', MyTypesInput);
+} catch (err) {
+ // expected as it is a demo
+}
```
```html
@@ -343,6 +355,9 @@ const tomorrow = new Date(year, month, day + 1);
## Custom Validators
+Here is an example how you can make your own validator and providing the error messages directly within.
+You can even hard code localization in there if needed or you can use a localization system.
+
{() => {
class MyValidator extends Validator {
@@ -404,6 +419,8 @@ class MyValidator extends Validator {
## Override default messages
+Oftern
+
{html`
@@ -40,30 +40,30 @@ On top of this, they offer:
Platform field wrappers add all of the functionality described above to native form elements.
-- [LionInput](?path=/docs/forms-input), a wrapper for ``
-- [LionTextarea](?path=/docs/forms-textarea), a wrapper for `
+