@webtides/element-library 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +109 -0
- package/LICENSE +21 -0
- package/README.md +125 -0
- package/all.js +26 -0
- package/custom-elements.json +7683 -0
- package/index.js +3 -0
- package/package.json +132 -0
- package/patches/@glidejs+glide+3.6.2.patch +11 -0
- package/src/components/accordion/accordion.changelog.md +47 -0
- package/src/components/accordion/accordion.define.js +3 -0
- package/src/components/accordion/accordion.events.js +3 -0
- package/src/components/accordion/accordion.js +144 -0
- package/src/components/accordion/accordion.readme.md +71 -0
- package/src/components/accordion/accordion.style.js +64 -0
- package/src/components/accordion-group/accordion-group.changelog.md +35 -0
- package/src/components/accordion-group/accordion-group.define.js +3 -0
- package/src/components/accordion-group/accordion-group.js +63 -0
- package/src/components/accordion-group/accordion-group.readme.md +56 -0
- package/src/components/amount-field/amount-field.changelog.md +40 -0
- package/src/components/amount-field/amount-field.define.js +3 -0
- package/src/components/amount-field/amount-field.js +91 -0
- package/src/components/amount-field/amount-field.readme.md +65 -0
- package/src/components/amount-field/amount-field.style.js +58 -0
- package/src/components/button/button.changelog.md +19 -0
- package/src/components/button/button.define.js +3 -0
- package/src/components/button/button.js +174 -0
- package/src/components/button/button.readme.md +91 -0
- package/src/components/button/button.style.js +251 -0
- package/src/components/carousel/carousel.changelog.md +58 -0
- package/src/components/carousel/carousel.define.js +3 -0
- package/src/components/carousel/carousel.events.js +3 -0
- package/src/components/carousel/carousel.js +232 -0
- package/src/components/carousel/carousel.readme.md +78 -0
- package/src/components/carousel/carousel.style.js +142 -0
- package/src/components/carousel/glide/components/ShadowAnchors.js +12 -0
- package/src/components/carousel/glide/components/ShadowClones.js +41 -0
- package/src/components/carousel/glide/components/ShadowGaps.js +28 -0
- package/src/components/carousel/glide/components/ShadowHtml.js +32 -0
- package/src/components/checkbox-field/checkbox-field.changelog.md +47 -0
- package/src/components/checkbox-field/checkbox-field.define.js +3 -0
- package/src/components/checkbox-field/checkbox-field.js +102 -0
- package/src/components/checkbox-field/checkbox-field.readme.md +66 -0
- package/src/components/checkbox-field/checkbox-field.style.js +69 -0
- package/src/components/dialog/dialog.changelog.md +24 -0
- package/src/components/dialog/dialog.define.js +3 -0
- package/src/components/dialog/dialog.events.js +8 -0
- package/src/components/dialog/dialog.js +271 -0
- package/src/components/dialog/dialog.readme.md +122 -0
- package/src/components/dialog/dialog.style.js +124 -0
- package/src/components/dropdown/dropdown.changelog.md +39 -0
- package/src/components/dropdown/dropdown.define.js +3 -0
- package/src/components/dropdown/dropdown.js +98 -0
- package/src/components/dropdown/dropdown.readme.md +69 -0
- package/src/components/dropdown/dropdown.style.js +17 -0
- package/src/components/form-field/form-field.changelog.md +35 -0
- package/src/components/form-field/form-field.define.js +3 -0
- package/src/components/form-field/form-field.events.js +4 -0
- package/src/components/form-field/form-field.js +210 -0
- package/src/components/form-field/form-field.readme.md +80 -0
- package/src/components/form-field/form-field.style.js +25 -0
- package/src/components/input-field/input-field.changelog.md +39 -0
- package/src/components/input-field/input-field.define.js +3 -0
- package/src/components/input-field/input-field.js +71 -0
- package/src/components/input-field/input-field.readme.md +90 -0
- package/src/components/input-field/input-field.style.js +33 -0
- package/src/components/lazy-src/lazy-src.changelog.md +57 -0
- package/src/components/lazy-src/lazy-src.define.js +3 -0
- package/src/components/lazy-src/lazy-src.events.js +5 -0
- package/src/components/lazy-src/lazy-src.js +100 -0
- package/src/components/lazy-src/lazy-src.readme.md +63 -0
- package/src/components/notification/notification.changelog.md +22 -0
- package/src/components/notification/notification.define.js +3 -0
- package/src/components/notification/notification.events.js +6 -0
- package/src/components/notification/notification.js +280 -0
- package/src/components/notification/notification.readme.md +98 -0
- package/src/components/notification/notification.style.js +113 -0
- package/src/components/password-field/password-field.changelog.md +22 -0
- package/src/components/password-field/password-field.define.js +3 -0
- package/src/components/password-field/password-field.js +113 -0
- package/src/components/password-field/password-field.readme.md +60 -0
- package/src/components/password-field/password-field.style.js +62 -0
- package/src/components/radio-field/radio-field.changelog.md +21 -0
- package/src/components/radio-field/radio-field.define.js +3 -0
- package/src/components/radio-field/radio-field.js +140 -0
- package/src/components/radio-field/radio-field.readme.md +72 -0
- package/src/components/radio-field/radio-field.style.js +108 -0
- package/src/components/scroll-to/scroll-to.changelog.md +39 -0
- package/src/components/scroll-to/scroll-to.define.js +3 -0
- package/src/components/scroll-to/scroll-to.js +40 -0
- package/src/components/scroll-to/scroll-to.readme.md +50 -0
- package/src/components/scroll-to-top/scroll-to-top.changelog.md +39 -0
- package/src/components/scroll-to-top/scroll-to-top.define.js +3 -0
- package/src/components/scroll-to-top/scroll-to-top.js +78 -0
- package/src/components/scroll-to-top/scroll-to-top.readme.md +48 -0
- package/src/components/scroll-to-top/scroll-to-top.style.js +9 -0
- package/src/components/select-field/select-field.changelog.md +30 -0
- package/src/components/select-field/select-field.define.js +3 -0
- package/src/components/select-field/select-field.js +83 -0
- package/src/components/select-field/select-field.readme.md +131 -0
- package/src/components/select-field/select-field.style.js +24 -0
- package/src/components/slider/slider.changelog.md +177 -0
- package/src/components/slider/slider.define.js +3 -0
- package/src/components/slider/slider.events.js +4 -0
- package/src/components/slider/slider.js +338 -0
- package/src/components/slider/slider.readme.md +87 -0
- package/src/components/slider/slider.style.js +107 -0
- package/src/components/sticky/sticky.changelog.md +43 -0
- package/src/components/sticky/sticky.define.js +3 -0
- package/src/components/sticky/sticky.js +105 -0
- package/src/components/sticky/sticky.readme.md +63 -0
- package/src/components/sticky/sticky.style.js +21 -0
- package/src/components/svg-use/svg-use.changelog.md +41 -0
- package/src/components/svg-use/svg-use.define.js +3 -0
- package/src/components/svg-use/svg-use.js +39 -0
- package/src/components/svg-use/svg-use.readme.md +50 -0
- package/src/components/svg-use/svg-use.style.js +20 -0
- package/src/components/switch-field/switch-field.changelog.md +21 -0
- package/src/components/switch-field/switch-field.define.js +3 -0
- package/src/components/switch-field/switch-field.js +99 -0
- package/src/components/switch-field/switch-field.readme.md +58 -0
- package/src/components/switch-field/switch-field.style.js +98 -0
- package/src/components/tab-group/tab-group.changelog.md +35 -0
- package/src/components/tab-group/tab-group.define.js +3 -0
- package/src/components/tab-group/tab-group.js +109 -0
- package/src/components/tab-group/tab-group.readme.md +61 -0
- package/src/components/tab-group/tab-group.style.js +7 -0
- package/src/components/tab-link/tab-link.changelog.md +35 -0
- package/src/components/tab-link/tab-link.define.js +3 -0
- package/src/components/tab-link/tab-link.js +50 -0
- package/src/components/tab-link/tab-link.readme.md +66 -0
- package/src/components/tab-link/tab-link.style.js +32 -0
- package/src/components/tab-panel/tab-panel.changelog.md +39 -0
- package/src/components/tab-panel/tab-panel.define.js +3 -0
- package/src/components/tab-panel/tab-panel.js +30 -0
- package/src/components/tab-panel/tab-panel.readme.md +57 -0
- package/src/components/tab-panel/tab-panel.style.js +7 -0
- package/src/components/textarea-field/textarea-field.changelog.md +39 -0
- package/src/components/textarea-field/textarea-field.define.js +3 -0
- package/src/components/textarea-field/textarea-field.js +62 -0
- package/src/components/textarea-field/textarea-field.readme.md +102 -0
- package/src/components/textarea-field/textarea-field.style.js +7 -0
- package/src/components/transition-classes/transition-classes.changelog.md +39 -0
- package/src/components/transition-classes/transition-classes.define.js +3 -0
- package/src/components/transition-classes/transition-classes.js +154 -0
- package/src/components/transition-classes/transition-classes.readme.md +71 -0
- package/src/themes/default.css +165 -0
- package/src/themes/high-contrast.css +147 -0
- package/src/themes/sketchy.css +238 -0
- package/types/all.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/src/components/accordion/accordion.d.ts +60 -0
- package/types/src/components/accordion/accordion.define.d.ts +1 -0
- package/types/src/components/accordion/accordion.events.d.ts +4 -0
- package/types/src/components/accordion/accordion.style.d.ts +2 -0
- package/types/src/components/accordion-group/accordion-group.d.ts +28 -0
- package/types/src/components/accordion-group/accordion-group.define.d.ts +1 -0
- package/types/src/components/amount-field/amount-field.d.ts +53 -0
- package/types/src/components/amount-field/amount-field.define.d.ts +1 -0
- package/types/src/components/amount-field/amount-field.style.d.ts +2 -0
- package/types/src/components/button/button.d.ts +73 -0
- package/types/src/components/button/button.define.d.ts +1 -0
- package/types/src/components/button/button.style.d.ts +2 -0
- package/types/src/components/carousel/carousel.d.ts +79 -0
- package/types/src/components/carousel/carousel.define.d.ts +1 -0
- package/types/src/components/carousel/carousel.events.d.ts +4 -0
- package/types/src/components/carousel/carousel.style.d.ts +2 -0
- package/types/src/components/carousel/glide/components/ShadowAnchors.d.ts +1 -0
- package/types/src/components/carousel/glide/components/ShadowClones.d.ts +1 -0
- package/types/src/components/carousel/glide/components/ShadowGaps.d.ts +1 -0
- package/types/src/components/carousel/glide/components/ShadowHtml.d.ts +1 -0
- package/types/src/components/checkbox-field/checkbox-field.d.ts +69 -0
- package/types/src/components/checkbox-field/checkbox-field.define.d.ts +1 -0
- package/types/src/components/checkbox-field/checkbox-field.style.d.ts +2 -0
- package/types/src/components/dialog/dialog.d.ts +103 -0
- package/types/src/components/dialog/dialog.define.d.ts +1 -0
- package/types/src/components/dialog/dialog.events.d.ts +9 -0
- package/types/src/components/dialog/dialog.style.d.ts +2 -0
- package/types/src/components/dropdown/dropdown.d.ts +45 -0
- package/types/src/components/dropdown/dropdown.define.d.ts +1 -0
- package/types/src/components/dropdown/dropdown.style.d.ts +2 -0
- package/types/src/components/form-field/form-field.d.ts +110 -0
- package/types/src/components/form-field/form-field.define.d.ts +1 -0
- package/types/src/components/form-field/form-field.events.d.ts +5 -0
- package/types/src/components/form-field/form-field.style.d.ts +2 -0
- package/types/src/components/input-field/input-field.d.ts +38 -0
- package/types/src/components/input-field/input-field.define.d.ts +1 -0
- package/types/src/components/input-field/input-field.style.d.ts +2 -0
- package/types/src/components/lazy-src/lazy-src.d.ts +46 -0
- package/types/src/components/lazy-src/lazy-src.define.d.ts +1 -0
- package/types/src/components/lazy-src/lazy-src.events.d.ts +6 -0
- package/types/src/components/notification/notification.d.ts +92 -0
- package/types/src/components/notification/notification.define.d.ts +1 -0
- package/types/src/components/notification/notification.events.d.ts +7 -0
- package/types/src/components/notification/notification.style.d.ts +2 -0
- package/types/src/components/password-field/password-field.d.ts +66 -0
- package/types/src/components/password-field/password-field.define.d.ts +1 -0
- package/types/src/components/password-field/password-field.style.d.ts +2 -0
- package/types/src/components/radio-field/radio-field.d.ts +62 -0
- package/types/src/components/radio-field/radio-field.define.d.ts +1 -0
- package/types/src/components/radio-field/radio-field.style.d.ts +2 -0
- package/types/src/components/scroll-to/scroll-to.d.ts +24 -0
- package/types/src/components/scroll-to/scroll-to.define.d.ts +1 -0
- package/types/src/components/scroll-to-top/scroll-to-top.d.ts +32 -0
- package/types/src/components/scroll-to-top/scroll-to-top.define.d.ts +1 -0
- package/types/src/components/scroll-to-top/scroll-to-top.style.d.ts +2 -0
- package/types/src/components/select-field/select-field.d.ts +39 -0
- package/types/src/components/select-field/select-field.define.d.ts +1 -0
- package/types/src/components/select-field/select-field.style.d.ts +2 -0
- package/types/src/components/slider/slider.d.ts +129 -0
- package/types/src/components/slider/slider.define.d.ts +1 -0
- package/types/src/components/slider/slider.events.d.ts +5 -0
- package/types/src/components/slider/slider.style.d.ts +2 -0
- package/types/src/components/sticky/sticky.d.ts +47 -0
- package/types/src/components/sticky/sticky.define.d.ts +1 -0
- package/types/src/components/sticky/sticky.style.d.ts +2 -0
- package/types/src/components/svg-use/svg-use.d.ts +18 -0
- package/types/src/components/svg-use/svg-use.define.d.ts +1 -0
- package/types/src/components/svg-use/svg-use.style.d.ts +2 -0
- package/types/src/components/switch-field/switch-field.d.ts +67 -0
- package/types/src/components/switch-field/switch-field.define.d.ts +1 -0
- package/types/src/components/switch-field/switch-field.style.d.ts +2 -0
- package/types/src/components/tab-group/tab-group.d.ts +48 -0
- package/types/src/components/tab-group/tab-group.define.d.ts +1 -0
- package/types/src/components/tab-group/tab-group.style.d.ts +2 -0
- package/types/src/components/tab-link/tab-link.d.ts +30 -0
- package/types/src/components/tab-link/tab-link.define.d.ts +1 -0
- package/types/src/components/tab-link/tab-link.style.d.ts +2 -0
- package/types/src/components/tab-panel/tab-panel.d.ts +18 -0
- package/types/src/components/tab-panel/tab-panel.define.d.ts +1 -0
- package/types/src/components/tab-panel/tab-panel.style.d.ts +2 -0
- package/types/src/components/textarea-field/textarea-field.d.ts +34 -0
- package/types/src/components/textarea-field/textarea-field.define.d.ts +1 -0
- package/types/src/components/textarea-field/textarea-field.style.d.ts +2 -0
- package/types/src/components/transition-classes/transition-classes.d.ts +52 -0
- package/types/src/components/transition-classes/transition-classes.define.d.ts +1 -0
- package/types/src/utils/body-scroll.d.ts +4 -0
- package/types/src/utils/transitions.d.ts +9 -0
- package/web-types.json +3956 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Dropdown
|
|
2
|
+
|
|
3
|
+
`dropdown` is a component that creates a toggleable dropdown menu with trigger and content slots. It handles click-outside and escape key interactions to automatically close the dropdown when the user clicks outside or presses the Escape key.
|
|
4
|
+
|
|
5
|
+
## How to use
|
|
6
|
+
|
|
7
|
+
#### Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm i --save @webtides/element-library
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
#### Use
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import '@webtides/element-library/dropdown/define';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<el-dropdown>
|
|
21
|
+
<button slot="trigger">Open Menu</button>
|
|
22
|
+
<div slot="content">
|
|
23
|
+
<a href="#">Menu Item 1</a>
|
|
24
|
+
<a href="#">Menu Item 2</a>
|
|
25
|
+
<a href="#">Menu Item 3</a>
|
|
26
|
+
</div>
|
|
27
|
+
</el-dropdown>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
#### Properties/Attribute
|
|
33
|
+
|
|
34
|
+
| Name | Type | Default | Description |
|
|
35
|
+
| ------ | --------- | ------- | ----------------------------------------------------------- |
|
|
36
|
+
| `open` | `boolean` | `false` | Controls whether the dropdown content is visible or hidden. |
|
|
37
|
+
|
|
38
|
+
#### Methods
|
|
39
|
+
|
|
40
|
+
_None_
|
|
41
|
+
|
|
42
|
+
#### Events
|
|
43
|
+
|
|
44
|
+
_None_
|
|
45
|
+
|
|
46
|
+
#### CSS Parts
|
|
47
|
+
|
|
48
|
+
| Name | Description |
|
|
49
|
+
| --------- | ----------------------------------------------------------- |
|
|
50
|
+
| `trigger` | The `<slot>` holding the trigger element. |
|
|
51
|
+
| `panel` | The floating container rendered while the dropdown is open. |
|
|
52
|
+
| `content` | The `<slot>` holding the dropdown content. |
|
|
53
|
+
|
|
54
|
+
#### CSS States
|
|
55
|
+
|
|
56
|
+
| Name | Description |
|
|
57
|
+
| ------ | ------------------------------------------------------------------------------------- |
|
|
58
|
+
| `open` | Present on the host while the dropdown is open. Style with `el-dropdown:state(open)`. |
|
|
59
|
+
|
|
60
|
+
#### CSS Custom Properties
|
|
61
|
+
|
|
62
|
+
This component is headless by default and reads the library's `--el-*` design tokens (e.g. `--el-color-bg`, `--el-color-border`, `--el-radius-lg`, `--el-shadow-lg`). Skin it by setting these via a theme — see the Storybook _Docs / Theming_ page.
|
|
63
|
+
|
|
64
|
+
#### Slots
|
|
65
|
+
|
|
66
|
+
| Name | Description |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| `trigger` | The element that opens the dropdown when clicked. Automatically has the `show-dropdown` attribute applied. |
|
|
69
|
+
| `content` | The dropdown content that appears when the dropdown is open. Only rendered when `open` is `true`. |
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const css = String.raw;
|
|
2
|
+
|
|
3
|
+
export default css`
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
position: relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
[part~='panel'] {
|
|
10
|
+
background: var(--el-color-bg, transparent);
|
|
11
|
+
color: var(--el-color-fg, inherit);
|
|
12
|
+
border: var(--el-border-width, 0) solid var(--el-color-border, transparent);
|
|
13
|
+
border-radius: var(--el-radius-lg, 0);
|
|
14
|
+
padding: var(--el-space-3, 0);
|
|
15
|
+
box-shadow: var(--el-shadow-lg, none);
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this component live here. Versions refer to the parent `@webtides/element-library` release (see root [`CHANGELOG.md`](../../../CHANGELOG.md)); components no longer version independently.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
When your PR touches this component, add an entry under Unreleased and
|
|
9
|
+
mirror it (prefixed with the component name) in root CHANGELOG.md.
|
|
10
|
+
Uncomment headings as needed.
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
## Unreleased
|
|
14
|
+
|
|
15
|
+
## [0.1.0] - 2026-06-03
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- `touched`, `valid` and `invalid` custom states on the host. Inherited by all subclasses (`InputField`, `CheckboxField`, `TextareaField`, `AmountField`, `SelectField`). The inner `.field.is-touched / .is-valid / .is-invalid` classes still exist; they remain the internal hook for event delegation and shadow-DOM rendered subclasses.
|
|
20
|
+
|
|
21
|
+
## Legacy (pre-merge)
|
|
22
|
+
|
|
23
|
+
The version numbers below predate the single-package merge and refer to the component's former standalone npm package, not the current `@webtides/element-library` version. Kept for historical reference.
|
|
24
|
+
|
|
25
|
+
## 0.1.1 (2021-07-21)
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
update element-js version
|
|
30
|
+
|
|
31
|
+
## [0.1.0] - 2020-03-15
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- initial release
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { TemplateElement, html, defineElement, classMap } from '@webtides/element-js';
|
|
2
|
+
import FormFieldEvents from './form-field.events.js';
|
|
3
|
+
import style from './form-field.style.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base class for form input components. Provides label, help text, error message,
|
|
7
|
+
* validation and touched-state plumbing. Intended to be extended (`InputField`,
|
|
8
|
+
* `CheckboxField`, `TextareaField`, `AmountField`, …); subclasses override
|
|
9
|
+
* `fieldTemplate()` to render their actual input.
|
|
10
|
+
*
|
|
11
|
+
* @element el-form-field
|
|
12
|
+
*
|
|
13
|
+
* @fires {CustomEvent<string>} input-change - Fired when the field's `value` changes.
|
|
14
|
+
* `detail` is the new value. Bubbles.
|
|
15
|
+
*
|
|
16
|
+
* @cssstate touched - Set on the host once the user has focused and blurred the field.
|
|
17
|
+
* Inherited by all subclasses (`InputField`, `CheckboxField`, `TextareaField`,
|
|
18
|
+
* `AmountField`, `SelectField`).
|
|
19
|
+
* @cssstate valid - Set on the host while the field currently passes validation.
|
|
20
|
+
* @cssstate invalid - Set on the host while the field currently fails validation.
|
|
21
|
+
*
|
|
22
|
+
* @property {string} name - Form name for the underlying input.
|
|
23
|
+
* @property {string | null} value - Current value of the field.
|
|
24
|
+
* @property {boolean} required - Whether the field is required for form submission.
|
|
25
|
+
* @property {boolean} disabled - Whether the field is disabled.
|
|
26
|
+
* @property {string} label - Label text displayed for the field.
|
|
27
|
+
* @property {boolean} labelScreenReaderOnly - When `true`, the label is visually hidden but
|
|
28
|
+
* still announced to screen readers (via an `sr-only` class).
|
|
29
|
+
* @property {string} errorMessage - Error message displayed when the field is invalid and has
|
|
30
|
+
* been touched.
|
|
31
|
+
* @property {string} helpMessage - Helper text displayed below the field.
|
|
32
|
+
* @property {boolean} valid - Whether the field currently passes validation.
|
|
33
|
+
* @property {boolean} touched - Whether the user has interacted with the field (focused and
|
|
34
|
+
* blurred). Validation messages only surface when this is `true`.
|
|
35
|
+
*/
|
|
36
|
+
export default class FormField extends TemplateElement {
|
|
37
|
+
constructor(options) {
|
|
38
|
+
super({ shadowRender: false, styles: [style], ...options });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
connected() {
|
|
42
|
+
if (!!this.$refs.input?.value || this.valid === false) {
|
|
43
|
+
this.touched = true;
|
|
44
|
+
}
|
|
45
|
+
this.syncValidationStates();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
properties() {
|
|
49
|
+
return {
|
|
50
|
+
name: '',
|
|
51
|
+
value: null,
|
|
52
|
+
required: false,
|
|
53
|
+
disabled: false,
|
|
54
|
+
|
|
55
|
+
label: '',
|
|
56
|
+
labelScreenReaderOnly: false,
|
|
57
|
+
errorMessage: '',
|
|
58
|
+
helpMessage: '',
|
|
59
|
+
|
|
60
|
+
valid: true,
|
|
61
|
+
touched: false,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
watch() {
|
|
66
|
+
return {
|
|
67
|
+
value: (value) => {
|
|
68
|
+
this.dispatch(FormFieldEvents.INPUT_CHANGE, value);
|
|
69
|
+
},
|
|
70
|
+
valid: () => this.syncValidationStates(),
|
|
71
|
+
touched: () => this.syncValidationStates(),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** @private */
|
|
76
|
+
syncValidationStates() {
|
|
77
|
+
if (this.touched) this._internals.states.add('touched');
|
|
78
|
+
else this._internals.states.delete('touched');
|
|
79
|
+
if (this.valid) {
|
|
80
|
+
this._internals.states.add('valid');
|
|
81
|
+
this._internals.states.delete('invalid');
|
|
82
|
+
} else {
|
|
83
|
+
this._internals.states.delete('valid');
|
|
84
|
+
this._internals.states.add('invalid');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
events() {
|
|
89
|
+
return {
|
|
90
|
+
'[ref=input]': {
|
|
91
|
+
focus: () => {
|
|
92
|
+
this.onFocus();
|
|
93
|
+
},
|
|
94
|
+
blur: () => {
|
|
95
|
+
this.onBlur();
|
|
96
|
+
},
|
|
97
|
+
keyup: (event) => {
|
|
98
|
+
// don't trigger change when tabbing through inputs
|
|
99
|
+
if (event.keyCode !== 9) {
|
|
100
|
+
this.onChange();
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
change: () => {
|
|
104
|
+
this.onChange();
|
|
105
|
+
this.dispatch(FormFieldEvents.INPUT_CHANGE, this.$refs.input.value);
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
'.is-invalid': {
|
|
109
|
+
focus: () => {
|
|
110
|
+
this.onBlur();
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
'[data-clear-input]': {
|
|
114
|
+
click: () => {
|
|
115
|
+
this.clearInput();
|
|
116
|
+
},
|
|
117
|
+
touchstart: () => {
|
|
118
|
+
this.clearInput();
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Called when the input receives focus. Refreshes validation state.
|
|
126
|
+
* @returns {void}
|
|
127
|
+
*/
|
|
128
|
+
onFocus() {
|
|
129
|
+
this.valid = this.$refs.input.validity.valid;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Called when the input loses focus. Marks the field as touched and refreshes
|
|
134
|
+
* validation state.
|
|
135
|
+
* @returns {void}
|
|
136
|
+
*/
|
|
137
|
+
onBlur() {
|
|
138
|
+
this.touched = true;
|
|
139
|
+
this.valid = this.$refs.input.validity.valid;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Called when the input value changes. Updates `value` and refreshes validation.
|
|
144
|
+
* @returns {void}
|
|
145
|
+
*/
|
|
146
|
+
onChange() {
|
|
147
|
+
this.value = this.$refs.input.value;
|
|
148
|
+
this.valid = this.$refs.input.validity.valid;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Clears the input value, refocuses it, and resets the touched state.
|
|
153
|
+
* @returns {void}
|
|
154
|
+
*/
|
|
155
|
+
clearInput() {
|
|
156
|
+
this.$refs.input.focus();
|
|
157
|
+
this.$refs.input.value = '';
|
|
158
|
+
this.touched = false;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** @private */
|
|
162
|
+
classes() {
|
|
163
|
+
return {
|
|
164
|
+
field: classMap({ 'is-valid': !!this.valid, 'is-invalid': !this.valid, 'is-touched': !!this.touched }),
|
|
165
|
+
label: classMap({ 'sr-only': this.labelScreenReaderOnly }),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
template() {
|
|
170
|
+
return html`
|
|
171
|
+
${this.labelTemplate()} ${this.helpTemplate()}
|
|
172
|
+
<div class="field ${this.classes().field}">${this.fieldTemplate()}</div>
|
|
173
|
+
${this.errorTemplate()}
|
|
174
|
+
`;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** @private */
|
|
178
|
+
labelTemplate() {
|
|
179
|
+
if (!this.label) return null;
|
|
180
|
+
return html`
|
|
181
|
+
<label ref="label" for="input-${this.name}" class="${this.classes().label}"> ${this.label} </label>
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Subclass extension point. Override to render the actual input element(s).
|
|
187
|
+
* @returns {unknown}
|
|
188
|
+
*/
|
|
189
|
+
fieldTemplate() {
|
|
190
|
+
return html` <!-- IMPLEMENT FIELD --> `;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** @private */
|
|
194
|
+
helpTemplate() {
|
|
195
|
+
return html` <span id="${this.name}-help-message" class="message help-message">${this.helpMessage}</span> `;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** @private */
|
|
199
|
+
errorTemplate() {
|
|
200
|
+
if (!(this.touched && this.errorMessage && !this.valid)) return null;
|
|
201
|
+
|
|
202
|
+
return html` <span id="${this.name}-error-message" class="message error-message">${this.errorMessage}</span> `;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export function define() {
|
|
207
|
+
defineElement('el-form-field', FormField);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export { FormField, FormFieldEvents };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# FormField
|
|
2
|
+
|
|
3
|
+
`form-field` is a base form input component that provides common functionality for form fields including labels, validation, error messages, help text, and state management. This component is designed to be extended by specific field types (like `input-field`, `checkbox-field`, `textarea-field`, etc.).
|
|
4
|
+
|
|
5
|
+
## How to use
|
|
6
|
+
|
|
7
|
+
#### Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm i --save @webtides/element-library
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
#### Use
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import '@webtides/element-library/form-field/define';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This component is typically used as a base class for other form field components rather than being used directly. However, it can be used directly if you implement the `fieldTemplate()` method:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<el-form-field
|
|
23
|
+
name="username"
|
|
24
|
+
label="Username"
|
|
25
|
+
required="true"
|
|
26
|
+
error-message="Username is required"
|
|
27
|
+
help-message="Choose a unique username"
|
|
28
|
+
>
|
|
29
|
+
</el-form-field>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## API
|
|
33
|
+
|
|
34
|
+
#### Properties/Attribute
|
|
35
|
+
|
|
36
|
+
| Name | Type | Default | Description |
|
|
37
|
+
| --- | --- | --- | --- |
|
|
38
|
+
| `name` | `string` | `''` | The name attribute for the form field. |
|
|
39
|
+
| `value` | `string` | `null` | The current value of the form field. |
|
|
40
|
+
| `required` | `boolean` | `false` | Whether the field is required for form submission. |
|
|
41
|
+
| `disabled` | `boolean` | `false` | Whether the field is disabled. |
|
|
42
|
+
| `label` | `string` | `''` | The label text displayed for the field. |
|
|
43
|
+
| `labelScreenReaderOnly` | `boolean` | `false` | Whether to hide the label visually (but keep it accessible to screen readers). |
|
|
44
|
+
| `errorMessage` | `string` | `''` | Error message to display when validation fails and field is touched. |
|
|
45
|
+
| `helpMessage` | `string` | `''` | Helper text to display below the field. |
|
|
46
|
+
| `valid` | `boolean` | `true` | Whether the field passes validation. |
|
|
47
|
+
| `touched` | `boolean` | `false` | Whether the field has been interacted with (focused and blurred). |
|
|
48
|
+
|
|
49
|
+
#### Methods
|
|
50
|
+
|
|
51
|
+
| Name | Parameters | Description |
|
|
52
|
+
| -------------- | ---------- | ------------------------------------------------------------------------ |
|
|
53
|
+
| `onFocus()` | None | Called when the input receives focus. Updates validation state. |
|
|
54
|
+
| `onBlur()` | None | Called when the input loses focus. Marks field as touched and validates. |
|
|
55
|
+
| `onChange()` | None | Called when the input value changes. Updates value and validation state. |
|
|
56
|
+
| `clearInput()` | None | Focuses the input, clears its value, and resets the touched state. |
|
|
57
|
+
|
|
58
|
+
#### Events
|
|
59
|
+
|
|
60
|
+
| Name | Detail | Description |
|
|
61
|
+
| -------------- | ------- | --------------------------------------------------------------- |
|
|
62
|
+
| `input-change` | `value` | Fired when the field value changes. Bubbles up through the DOM. |
|
|
63
|
+
|
|
64
|
+
#### CSS States
|
|
65
|
+
|
|
66
|
+
Custom states reflected on the host (and inherited by `input-field`, `select-field`, `textarea-field`, `checkbox-field` and `amount-field`). Style with `el-input-field:state(invalid)`, etc.
|
|
67
|
+
|
|
68
|
+
| Name | Description |
|
|
69
|
+
| --------- | ---------------------------------------------------- |
|
|
70
|
+
| `valid` | Present while the field passes validation. |
|
|
71
|
+
| `invalid` | Present while the field fails validation. |
|
|
72
|
+
| `touched` | Present once the field has been focused and blurred. |
|
|
73
|
+
|
|
74
|
+
#### CSS Custom Properties
|
|
75
|
+
|
|
76
|
+
This component is headless by default and reads the library's `--el-*` design tokens (e.g. `--el-color-fg`, `--el-color-fg-muted`, `--el-space-1`). Skin it by setting these via a theme — see the Storybook _Docs / Theming_ page.
|
|
77
|
+
|
|
78
|
+
#### Slots
|
|
79
|
+
|
|
80
|
+
_None_ (Component uses template methods instead of slots)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const css = String.raw;
|
|
2
|
+
|
|
3
|
+
export default css`
|
|
4
|
+
el-form-field,
|
|
5
|
+
el-input-field,
|
|
6
|
+
el-password-field,
|
|
7
|
+
el-textarea-field,
|
|
8
|
+
el-select-field,
|
|
9
|
+
el-amount-field,
|
|
10
|
+
el-checkbox-field,
|
|
11
|
+
el-radio-field,
|
|
12
|
+
el-switch-field {
|
|
13
|
+
display: block;
|
|
14
|
+
|
|
15
|
+
> label {
|
|
16
|
+
display: block;
|
|
17
|
+
margin-bottom: var(--el-space-1, 0);
|
|
18
|
+
color: var(--el-color-fg, inherit);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
> .help-message {
|
|
22
|
+
color: var(--el-color-fg-muted, inherit);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this component live here. Versions refer to the parent `@webtides/element-library` release (see root [`CHANGELOG.md`](../../../CHANGELOG.md)); components no longer version independently.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
When your PR touches this component, add an entry under Unreleased and
|
|
9
|
+
mirror it (prefixed with the component name) in root CHANGELOG.md.
|
|
10
|
+
Uncomment headings as needed.
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
## Unreleased
|
|
14
|
+
|
|
15
|
+
## [0.1.0] - 2026-06-03
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Hardcoded values in the stylesheet now reference design tokens with the previous values as fallbacks: `--el-space-1` / `--el-space-2` for gaps, `--el-color-success` / `--el-color-danger` for validity icon colors, `--el-font-size-sm` for the help/error message text.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- The `pattern` attribute is now omitted entirely when `pattern` is unset, via element-js's `optionalAttribute` directive. It previously fell back to a `[sS]*` regex — meant as "match anything" but actually matching only runs of `s` / `S` — which made the field report any ordinary value as invalid. The directive that allows omitting the attribute didn't exist when the fallback was introduced.
|
|
24
|
+
|
|
25
|
+
## Legacy (pre-merge)
|
|
26
|
+
|
|
27
|
+
The version numbers below predate the single-package merge and refer to the component's former standalone npm package, not the current `@webtides/element-library` version. Kept for historical reference.
|
|
28
|
+
|
|
29
|
+
## [0.1.1] - 2021-07-21
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
update element-js version
|
|
34
|
+
|
|
35
|
+
## [0.1.0] - 2020-03-15
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- initial release
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { html, defineElement, classMap, when, optionalAttribute } from '@webtides/element-js';
|
|
2
|
+
import FormField from '../form-field/form-field.js';
|
|
3
|
+
import style from './input-field.style.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Native `<input>` wrapper with label, help text, validation feedback (visual checkmark /
|
|
7
|
+
* cross indicators) and ARIA wiring. Extends `FormField` and inherits its label / help /
|
|
8
|
+
* error / required surface.
|
|
9
|
+
*
|
|
10
|
+
* @element el-input-field
|
|
11
|
+
*
|
|
12
|
+
* @fires {CustomEvent<string>} input-change - Fired when the input's value changes.
|
|
13
|
+
* `detail` is the new value. Bubbles.
|
|
14
|
+
*
|
|
15
|
+
* @property {string} type - Native `type` attribute of the underlying `<input>` (e.g.
|
|
16
|
+
* `'text'`, `'email'`, `'password'`, `'tel'`, `'url'`).
|
|
17
|
+
* @property {string} placeholder - Placeholder text shown while the input is empty.
|
|
18
|
+
* @property {string | false} pattern - Regular expression used as the input's `pattern`
|
|
19
|
+
* attribute. When `false` (the default), the `pattern` attribute is omitted entirely, so
|
|
20
|
+
* the field applies no pattern constraint.
|
|
21
|
+
*/
|
|
22
|
+
export default class InputField extends FormField {
|
|
23
|
+
constructor(options) {
|
|
24
|
+
super({ shadowRender: false, styles: [style], ...options });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
properties() {
|
|
28
|
+
return {
|
|
29
|
+
...super.properties(),
|
|
30
|
+
type: 'text',
|
|
31
|
+
placeholder: '',
|
|
32
|
+
pattern: false,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** @private */
|
|
37
|
+
fieldTemplate() {
|
|
38
|
+
return html`
|
|
39
|
+
<input
|
|
40
|
+
ref="input"
|
|
41
|
+
id="input-${this.name}"
|
|
42
|
+
name="${this.name}"
|
|
43
|
+
type="${this.type}"
|
|
44
|
+
value="${this.value}"
|
|
45
|
+
placeholder="${this.placeholder}"
|
|
46
|
+
?required="${this.required}"
|
|
47
|
+
?disabled="${this.disabled}"
|
|
48
|
+
${optionalAttribute(this.pattern, 'pattern', this.pattern)}
|
|
49
|
+
aria-describedby="${this.name}-help-message"
|
|
50
|
+
aria-invalid="${this.valid ? 'false' : 'true'}"
|
|
51
|
+
aria-errormessage="${this.name}-error-message"
|
|
52
|
+
/>
|
|
53
|
+
${when(
|
|
54
|
+
this.touched,
|
|
55
|
+
html`
|
|
56
|
+
<div class="validity ${classMap({ 'is-valid': !!this.valid, 'is-invalid': !this.valid })}">
|
|
57
|
+
${when(
|
|
58
|
+
this.valid,
|
|
59
|
+
html` <span class="valid h-4 w-4">✓</span> `,
|
|
60
|
+
html` <span class="invalid h-4 w-4" data-clear-input>✗</span> `,
|
|
61
|
+
)}
|
|
62
|
+
</div>
|
|
63
|
+
`,
|
|
64
|
+
)}
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function define() {
|
|
70
|
+
defineElement('el-input-field', InputField);
|
|
71
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# InputField
|
|
2
|
+
|
|
3
|
+
`input-field` is a web component that wraps the native HTML `<input>` element with additional functionality including label management, validation states, error messages, help text, and accessibility features. It extends the base `FormField` component and provides a complete form input solution with built-in validation feedback.
|
|
4
|
+
|
|
5
|
+
## How to use
|
|
6
|
+
|
|
7
|
+
#### Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm i --save @webtides/element-library
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
#### Use
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import '@webtides/element-library/input-field/define';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<el-input-field
|
|
21
|
+
name="email"
|
|
22
|
+
type="email"
|
|
23
|
+
label="Email Address"
|
|
24
|
+
placeholder="Enter your email"
|
|
25
|
+
help-message="We'll never share your email"
|
|
26
|
+
error-message="Please enter a valid email address"
|
|
27
|
+
required
|
|
28
|
+
></el-input-field>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
#### Properties/Attributes
|
|
34
|
+
|
|
35
|
+
| Name | Type | Default | Description |
|
|
36
|
+
| --- | --- | --- | --- |
|
|
37
|
+
| `name` | `string` | `''` | The name attribute for the input field, used for form submission and identification |
|
|
38
|
+
| `value` | `string` | `null` | The current value of the input field |
|
|
39
|
+
| `type` | `string` | `'text'` | The type of input field (e.g., 'text', 'email', 'password', 'tel', 'url', etc.) |
|
|
40
|
+
| `placeholder` | `string` | `''` | Placeholder text displayed when the input is empty |
|
|
41
|
+
| `pattern` | `string\|boolean` | `false` | Regular expression pattern for input validation. If false, allows any input |
|
|
42
|
+
| `required` | `boolean` | `false` | Whether the field is required for form submission |
|
|
43
|
+
| `disabled` | `boolean` | `false` | Whether the field is disabled and cannot be interacted with |
|
|
44
|
+
| `label` | `string` | `''` | Label text displayed above the input field |
|
|
45
|
+
| `labelScreenReaderOnly` | `boolean` | `false` | Whether to visually hide the label while keeping it accessible to screen readers |
|
|
46
|
+
| `helpMessage` | `string` | `''` | Help text displayed below the label to provide additional context |
|
|
47
|
+
| `errorMessage` | `string` | `''` | Error message displayed when validation fails and field is touched |
|
|
48
|
+
| `valid` | `boolean` | `true` | Whether the current input value is valid according to the field's constraints |
|
|
49
|
+
| `touched` | `boolean` | `false` | Whether the user has interacted with the field (focused and blurred) |
|
|
50
|
+
|
|
51
|
+
#### Methods
|
|
52
|
+
|
|
53
|
+
| Name | Parameters | Description |
|
|
54
|
+
| --- | --- | --- |
|
|
55
|
+
| `clearInput()` | None | Clears the input value, focuses the field, and resets the touched state |
|
|
56
|
+
| `onFocus()` | None | Internal method called when input receives focus, updates validation state |
|
|
57
|
+
| `onBlur()` | None | Internal method called when input loses focus, marks field as touched and updates validation |
|
|
58
|
+
| `onChange()` | None | Internal method called when input value changes, updates value and validation state |
|
|
59
|
+
|
|
60
|
+
#### Events
|
|
61
|
+
|
|
62
|
+
| Name | Detail | Description |
|
|
63
|
+
| -------------- | ---------------- | ------------------------------------------------------------------- |
|
|
64
|
+
| `input-change` | `value` (string) | Dispatched when the input value changes. Bubbles up through the DOM |
|
|
65
|
+
|
|
66
|
+
#### CSS Custom Properties
|
|
67
|
+
|
|
68
|
+
This component is headless by default and reads the library's `--el-*` design tokens (e.g. `--el-color-success`, `--el-color-danger`, `--el-font-size-sm`, `--el-space-2`), on top of the styling it inherits from `FormField`. Skin it by setting these via a theme — see the Storybook _Docs / Theming_ page.
|
|
69
|
+
|
|
70
|
+
#### Slots
|
|
71
|
+
|
|
72
|
+
_None_ - The component generates its own input element internally
|
|
73
|
+
|
|
74
|
+
## Accessibility
|
|
75
|
+
|
|
76
|
+
- Includes proper ARIA attributes (`aria-describedby`, `aria-invalid`, `aria-errormessage`)
|
|
77
|
+
- Links labels to inputs via `for` attribute
|
|
78
|
+
- Supports screen reader only labels
|
|
79
|
+
- Visual validity indicators (✓ for valid, × for invalid)
|
|
80
|
+
- Error messages are properly associated with the input field
|
|
81
|
+
|
|
82
|
+
## Validation
|
|
83
|
+
|
|
84
|
+
The component provides real-time validation feedback:
|
|
85
|
+
|
|
86
|
+
- Validation state updates on focus, blur, and change events
|
|
87
|
+
- Visual indicators appear after the field is touched
|
|
88
|
+
- Error messages only display when field is touched and invalid
|
|
89
|
+
- Supports HTML5 validation attributes (required, pattern, type)
|
|
90
|
+
- Clicking the invalid indicator (×) clears the input
|