Skip to content

Commit

Permalink
BREAKING CHANGE(web): Remove error state from Checkbox, Radio, Text…
Browse files Browse the repository at this point in the history
…Field, and TextArea #DS-677

 ## Migration Guide

Instead of the `--error` modifier or `has-error` class, use `--danger` or `has-danger`
respectively. This applies to Checkbox, Radio, TextField, and TextArea.

- `<div class="TextField--error" …>` → `<div class="TextField--danger" …>`
- `<div class="TextField has-error" …>` → `<div class="TextField has-danger" …>`

Please refer back to these instructions or reach out to our team
if you encounter any issues during migration.
  • Loading branch information
crishpeen authored and literat committed Jul 21, 2023
1 parent 11c6ee6 commit 813d9c3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 24 deletions.
2 changes: 1 addition & 1 deletion packages/web/src/scss/components/Select/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Usage with helper text:
Validation states can be presented either by adding a CSS modifier class
(`Select--success`, `Select--warning`, `Select--danger`), or by adding
a JS interaction class when controlled by JavaScript (`has-success`,
`has-warning`, `has-danger`, `has-error`). See Validation state [dictionary][dictionary-validation].
`has-warning`, `has-danger`). See Validation state [dictionary][dictionary-validation].

```html
<div class="Select Select--success">
Expand Down
11 changes: 3 additions & 8 deletions packages/web/src/scss/components/TextArea/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@ Then you need to add data attribute `data-toggle="autoResize"` to the component.
## Validation States

Validation states can be presented either by adding a CSS modifier class
(`TextArea--success`, `TextArea--warning`, `TextArea--danger`, `TextArea--error`), or by adding
(`TextArea--success`, `TextArea--warning`, `TextArea--danger`), or by adding
a JS interaction class when controlled by JavaScript (`has-success`,
`has-warning`, `has-danger`, `has-error`). See Validation state [dictionary][dictionary-validation].

[**DEPRECATED**][deprecated] The value "error" in the dictionary will be replaced by the value "danger".
`has-warning`, `has-danger`). See Validation state [dictionary][dictionary-validation].

```html
<div class="TextArea TextArea--danger">
Expand All @@ -136,13 +134,11 @@ a JS interaction class when controlled by JavaScript (`has-success`,
### JavaScript-Controlled Validation Message

When implementing client-side form validation, use JS interaction state classes
(`has-success`, `has-warning`, `has-danger`, `has-error`) on the wrapping `<div>` element and
(`has-success`, `has-warning`, `has-danger`) on the wrapping `<div>` element and
render validation messages in a `<div>` with `data-element="validator_message"`
attribute. This way your JS remains disconnected from CSS that may or may not be
[prefixed].

[**DEPRECATED**][deprecated] The value "has-error" in the dictionary will be replaced by the value "has-danger".

**Remember this approach is only valid for vanilla JS implementation. React
components mix CSS with JS by design and handle prefixes their own way.**

Expand Down Expand Up @@ -196,4 +192,3 @@ The preferred one is the `body` element because this way it will affect all Text
[web-readme]: https://github.com/lmc-eu/spirit-design-system/blob/main/packages/web/README.md
[prefixed]: https://github.com/lmc-eu/spirit-design-system/tree/main/packages/web#prefixing-css-class-names
[dictionary-validation]: https://github.com/lmc-eu/spirit-design-system/blob/main/docs/DICTIONARIES.md#validation
[deprecated]: https://github.com/lmc-eu/spirit-design-system/tree/main/packages/web/README.md#deprecations
11 changes: 3 additions & 8 deletions packages/web/src/scss/components/TextField/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,9 @@ forget to change not only the input type but also `aria-pressed` and
## Validation States

Validation states can be presented either by adding a CSS modifier class
(`TextField--success`, `TextField--warning`, `TextField--danger`, `TextField--error`), or by adding
(`TextField--success`, `TextField--warning`, `TextField--danger`), or by adding
a JS interaction class when controlled by JavaScript (`has-success`,
`has-warning`, `has-danger`, `has-error`). See Validation state [dictionary][dictionary-validation].

[**DEPRECATED**][deprecated] The value "error" in the dictionary will be replaced by the value "danger".
`has-warning`, `has-danger`). See Validation state [dictionary][dictionary-validation].

```html
<div class="TextField TextField--danger">
Expand All @@ -176,13 +174,11 @@ a JS interaction class when controlled by JavaScript (`has-success`,
### JavaScript-Controlled Validation Message

When implementing client-side form validation, use JS interaction state classes
(`has-success`, `has-warning`, `has-danger`, `has-error`) on the wrapping `<div>` element and
(`has-success`, `has-warning`, `has-danger`) on the wrapping `<div>` element and
render validation messages in a `<div>` with `data-element="validator_message"`
attribute. This way your JS remains disconnected from CSS that may or may not be
[prefixed].

[**DEPRECATED**][deprecated] The value "has-error" in the dictionary will be replaced by the value "has-danger".

**Remember this approach is only valid for vanilla JS implementation. React
components mix CSS with JS by design and handle prefixes their own way.**

Expand Down Expand Up @@ -236,4 +232,3 @@ The preferred one is the `body` element because this way it will affect all Text

[prefixed]: https://github.com/lmc-eu/spirit-design-system/tree/main/packages/web#prefixing-css-class-names
[dictionary-validation]: https://github.com/lmc-eu/spirit-design-system/blob/main/docs/DICTIONARIES.md#validation
[deprecated]: https://github.com/lmc-eu/spirit-design-system/tree/main/packages/web/README.md#deprecations
7 changes: 0 additions & 7 deletions packages/web/src/scss/theme/_form-fields.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,6 @@ $validation-states: (
input-border-color: $input-border-color-danger,
message-color: $message-color-danger,
),

// @deprecated Will be removed in the next major version.
error:
(
input-border-color: $input-border-color-danger,
message-color: $message-color-danger,
),
);

// Item variant
Expand Down

0 comments on commit 813d9c3

Please sign in to comment.