From 581ae341ec465499a0e2698ce815419672d84ae7 Mon Sep 17 00:00:00 2001 From: Adam Kudrna Date: Tue, 15 Aug 2023 11:42:56 +0200 Subject: [PATCH] fixup! Refactor(web-twig): Use new `HelperText` component in all form fields --- .../src/Resources/components/Field/README.md | 47 +------------------ ...test with data set helperText.twig__1.html | 4 +- ... with data set validationText.twig__1.html | 4 +- .../tests/components-fixtures/helperText.twig | 5 +- .../components-fixtures/validationText.twig | 6 +-- 5 files changed, 11 insertions(+), 55 deletions(-) diff --git a/packages/web-twig/src/Resources/components/Field/README.md b/packages/web-twig/src/Resources/components/Field/README.md index 71ee8da135..23ce50aa5d 100644 --- a/packages/web-twig/src/Resources/components/Field/README.md +++ b/packages/web-twig/src/Resources/components/Field/README.md @@ -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 - -``` - -Advanced example: - -```twig - -``` - -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. diff --git a/packages/web-twig/tests/__snapshots__/ComponentsSnapshotTest__test with data set helperText.twig__1.html b/packages/web-twig/tests/__snapshots__/ComponentsSnapshotTest__test with data set helperText.twig__1.html index a33518c33e..d5663876ce 100644 --- a/packages/web-twig/tests/__snapshots__/ComponentsSnapshotTest__test with data set helperText.twig__1.html +++ b/packages/web-twig/tests/__snapshots__/ComponentsSnapshotTest__test with data set helperText.twig__1.html @@ -1,11 +1,11 @@ - + -
+
Helper text
diff --git a/packages/web-twig/tests/__snapshots__/ComponentsSnapshotTest__test with data set validationText.twig__1.html b/packages/web-twig/tests/__snapshots__/ComponentsSnapshotTest__test with data set validationText.twig__1.html index d94e726084..b2bc4c744a 100644 --- a/packages/web-twig/tests/__snapshots__/ComponentsSnapshotTest__test with data set validationText.twig__1.html +++ b/packages/web-twig/tests/__snapshots__/ComponentsSnapshotTest__test with data set validationText.twig__1.html @@ -1,11 +1,11 @@ - + -
+
Validation text
diff --git a/packages/web-twig/tests/components-fixtures/helperText.twig b/packages/web-twig/tests/components-fixtures/helperText.twig index cabbf21dbc..1d71a7655f 100644 --- a/packages/web-twig/tests/components-fixtures/helperText.twig +++ b/packages/web-twig/tests/components-fixtures/helperText.twig @@ -1,11 +1,10 @@ - - + + diff --git a/packages/web-twig/tests/components-fixtures/validationText.twig b/packages/web-twig/tests/components-fixtures/validationText.twig index bd90d54f13..6c6e63e479 100644 --- a/packages/web-twig/tests/components-fixtures/validationText.twig +++ b/packages/web-twig/tests/components-fixtures/validationText.twig @@ -1,15 +1,15 @@ - - + +