-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor(web-twig): Use new
HelperText
component in all form fields
- Loading branch information
1 parent
79e650b
commit e1b90d1
Showing
12 changed files
with
70 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 2 additions & 45 deletions
47
packages/web-twig/src/Resources/components/Field/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,3 @@ | ||
# ValidationText | ||
# Form Field Subcomponents | ||
|
||
The validationText subcomponent displays validation texts for Field components like TextField, TextArea, Checkbox, FileUploader, etc. | ||
|
||
Basic example usage: | ||
|
||
```twig | ||
<ValidationText | ||
className="Component__validationText" | ||
validationState="danger" | ||
validationText="Danger validation text" | ||
/> | ||
``` | ||
|
||
Advanced example: | ||
|
||
```twig | ||
<ValidationText | ||
className="Component__validationText" | ||
elementType="span" | ||
validationState="danger" | ||
UNSAFE_validationText="Danger <strong>validation</strong> text" | ||
/> | ||
``` | ||
|
||
Without lexer: | ||
|
||
```twig | ||
{% embed "@spirit/validationText.twig" with { props: { | ||
className: 'Component__validationText', | ||
validationState: 'danger', | ||
validationText: 'Danger validation text' | ||
}} %}{% endembed %} | ||
``` | ||
|
||
## API | ||
|
||
| Prop name | Type | Default | Required | Description | | ||
| ----------------------- | -------------------- | ------- | -------- | ----------------------------------------------------------------------------- | | ||
| `className` | `string` | - | yes | ClassName of the ValidationText | | ||
| `elementType` | `string` | `div` | no | HTML tag to render, except if text is an array, then the root element is `ul` | | ||
| `validationState` | `string` | `null` | no | Validation State is used to determine if the component should be rendered | | ||
| `validationText` | `string`, `string[]` | - | yes\* | Validation text | | ||
| `UNSAFE_validationText` | `string`, `string[]` | - | yes\* | Validation text with HTML tags | | ||
|
||
\*: ValidationText is required. You can use the `validationText` for simple text or `UNSAFE_validationText` for HTML content. | ||
⚠️ All components in this directory are private and should not be used outside of Spirit components. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ig/tests/__snapshots__/ComponentsSnapshotTest__test with data set helperText.twig__1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 11 additions & 2 deletions
13
...ests/__snapshots__/ComponentsSnapshotTest__test with data set validationText.twig__1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 10 additions & 3 deletions
13
packages/web-twig/tests/components-fixtures/validationText.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters