@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.
Files changed (238) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/LICENSE +21 -0
  3. package/README.md +125 -0
  4. package/all.js +26 -0
  5. package/custom-elements.json +7683 -0
  6. package/index.js +3 -0
  7. package/package.json +132 -0
  8. package/patches/@glidejs+glide+3.6.2.patch +11 -0
  9. package/src/components/accordion/accordion.changelog.md +47 -0
  10. package/src/components/accordion/accordion.define.js +3 -0
  11. package/src/components/accordion/accordion.events.js +3 -0
  12. package/src/components/accordion/accordion.js +144 -0
  13. package/src/components/accordion/accordion.readme.md +71 -0
  14. package/src/components/accordion/accordion.style.js +64 -0
  15. package/src/components/accordion-group/accordion-group.changelog.md +35 -0
  16. package/src/components/accordion-group/accordion-group.define.js +3 -0
  17. package/src/components/accordion-group/accordion-group.js +63 -0
  18. package/src/components/accordion-group/accordion-group.readme.md +56 -0
  19. package/src/components/amount-field/amount-field.changelog.md +40 -0
  20. package/src/components/amount-field/amount-field.define.js +3 -0
  21. package/src/components/amount-field/amount-field.js +91 -0
  22. package/src/components/amount-field/amount-field.readme.md +65 -0
  23. package/src/components/amount-field/amount-field.style.js +58 -0
  24. package/src/components/button/button.changelog.md +19 -0
  25. package/src/components/button/button.define.js +3 -0
  26. package/src/components/button/button.js +174 -0
  27. package/src/components/button/button.readme.md +91 -0
  28. package/src/components/button/button.style.js +251 -0
  29. package/src/components/carousel/carousel.changelog.md +58 -0
  30. package/src/components/carousel/carousel.define.js +3 -0
  31. package/src/components/carousel/carousel.events.js +3 -0
  32. package/src/components/carousel/carousel.js +232 -0
  33. package/src/components/carousel/carousel.readme.md +78 -0
  34. package/src/components/carousel/carousel.style.js +142 -0
  35. package/src/components/carousel/glide/components/ShadowAnchors.js +12 -0
  36. package/src/components/carousel/glide/components/ShadowClones.js +41 -0
  37. package/src/components/carousel/glide/components/ShadowGaps.js +28 -0
  38. package/src/components/carousel/glide/components/ShadowHtml.js +32 -0
  39. package/src/components/checkbox-field/checkbox-field.changelog.md +47 -0
  40. package/src/components/checkbox-field/checkbox-field.define.js +3 -0
  41. package/src/components/checkbox-field/checkbox-field.js +102 -0
  42. package/src/components/checkbox-field/checkbox-field.readme.md +66 -0
  43. package/src/components/checkbox-field/checkbox-field.style.js +69 -0
  44. package/src/components/dialog/dialog.changelog.md +24 -0
  45. package/src/components/dialog/dialog.define.js +3 -0
  46. package/src/components/dialog/dialog.events.js +8 -0
  47. package/src/components/dialog/dialog.js +271 -0
  48. package/src/components/dialog/dialog.readme.md +122 -0
  49. package/src/components/dialog/dialog.style.js +124 -0
  50. package/src/components/dropdown/dropdown.changelog.md +39 -0
  51. package/src/components/dropdown/dropdown.define.js +3 -0
  52. package/src/components/dropdown/dropdown.js +98 -0
  53. package/src/components/dropdown/dropdown.readme.md +69 -0
  54. package/src/components/dropdown/dropdown.style.js +17 -0
  55. package/src/components/form-field/form-field.changelog.md +35 -0
  56. package/src/components/form-field/form-field.define.js +3 -0
  57. package/src/components/form-field/form-field.events.js +4 -0
  58. package/src/components/form-field/form-field.js +210 -0
  59. package/src/components/form-field/form-field.readme.md +80 -0
  60. package/src/components/form-field/form-field.style.js +25 -0
  61. package/src/components/input-field/input-field.changelog.md +39 -0
  62. package/src/components/input-field/input-field.define.js +3 -0
  63. package/src/components/input-field/input-field.js +71 -0
  64. package/src/components/input-field/input-field.readme.md +90 -0
  65. package/src/components/input-field/input-field.style.js +33 -0
  66. package/src/components/lazy-src/lazy-src.changelog.md +57 -0
  67. package/src/components/lazy-src/lazy-src.define.js +3 -0
  68. package/src/components/lazy-src/lazy-src.events.js +5 -0
  69. package/src/components/lazy-src/lazy-src.js +100 -0
  70. package/src/components/lazy-src/lazy-src.readme.md +63 -0
  71. package/src/components/notification/notification.changelog.md +22 -0
  72. package/src/components/notification/notification.define.js +3 -0
  73. package/src/components/notification/notification.events.js +6 -0
  74. package/src/components/notification/notification.js +280 -0
  75. package/src/components/notification/notification.readme.md +98 -0
  76. package/src/components/notification/notification.style.js +113 -0
  77. package/src/components/password-field/password-field.changelog.md +22 -0
  78. package/src/components/password-field/password-field.define.js +3 -0
  79. package/src/components/password-field/password-field.js +113 -0
  80. package/src/components/password-field/password-field.readme.md +60 -0
  81. package/src/components/password-field/password-field.style.js +62 -0
  82. package/src/components/radio-field/radio-field.changelog.md +21 -0
  83. package/src/components/radio-field/radio-field.define.js +3 -0
  84. package/src/components/radio-field/radio-field.js +140 -0
  85. package/src/components/radio-field/radio-field.readme.md +72 -0
  86. package/src/components/radio-field/radio-field.style.js +108 -0
  87. package/src/components/scroll-to/scroll-to.changelog.md +39 -0
  88. package/src/components/scroll-to/scroll-to.define.js +3 -0
  89. package/src/components/scroll-to/scroll-to.js +40 -0
  90. package/src/components/scroll-to/scroll-to.readme.md +50 -0
  91. package/src/components/scroll-to-top/scroll-to-top.changelog.md +39 -0
  92. package/src/components/scroll-to-top/scroll-to-top.define.js +3 -0
  93. package/src/components/scroll-to-top/scroll-to-top.js +78 -0
  94. package/src/components/scroll-to-top/scroll-to-top.readme.md +48 -0
  95. package/src/components/scroll-to-top/scroll-to-top.style.js +9 -0
  96. package/src/components/select-field/select-field.changelog.md +30 -0
  97. package/src/components/select-field/select-field.define.js +3 -0
  98. package/src/components/select-field/select-field.js +83 -0
  99. package/src/components/select-field/select-field.readme.md +131 -0
  100. package/src/components/select-field/select-field.style.js +24 -0
  101. package/src/components/slider/slider.changelog.md +177 -0
  102. package/src/components/slider/slider.define.js +3 -0
  103. package/src/components/slider/slider.events.js +4 -0
  104. package/src/components/slider/slider.js +338 -0
  105. package/src/components/slider/slider.readme.md +87 -0
  106. package/src/components/slider/slider.style.js +107 -0
  107. package/src/components/sticky/sticky.changelog.md +43 -0
  108. package/src/components/sticky/sticky.define.js +3 -0
  109. package/src/components/sticky/sticky.js +105 -0
  110. package/src/components/sticky/sticky.readme.md +63 -0
  111. package/src/components/sticky/sticky.style.js +21 -0
  112. package/src/components/svg-use/svg-use.changelog.md +41 -0
  113. package/src/components/svg-use/svg-use.define.js +3 -0
  114. package/src/components/svg-use/svg-use.js +39 -0
  115. package/src/components/svg-use/svg-use.readme.md +50 -0
  116. package/src/components/svg-use/svg-use.style.js +20 -0
  117. package/src/components/switch-field/switch-field.changelog.md +21 -0
  118. package/src/components/switch-field/switch-field.define.js +3 -0
  119. package/src/components/switch-field/switch-field.js +99 -0
  120. package/src/components/switch-field/switch-field.readme.md +58 -0
  121. package/src/components/switch-field/switch-field.style.js +98 -0
  122. package/src/components/tab-group/tab-group.changelog.md +35 -0
  123. package/src/components/tab-group/tab-group.define.js +3 -0
  124. package/src/components/tab-group/tab-group.js +109 -0
  125. package/src/components/tab-group/tab-group.readme.md +61 -0
  126. package/src/components/tab-group/tab-group.style.js +7 -0
  127. package/src/components/tab-link/tab-link.changelog.md +35 -0
  128. package/src/components/tab-link/tab-link.define.js +3 -0
  129. package/src/components/tab-link/tab-link.js +50 -0
  130. package/src/components/tab-link/tab-link.readme.md +66 -0
  131. package/src/components/tab-link/tab-link.style.js +32 -0
  132. package/src/components/tab-panel/tab-panel.changelog.md +39 -0
  133. package/src/components/tab-panel/tab-panel.define.js +3 -0
  134. package/src/components/tab-panel/tab-panel.js +30 -0
  135. package/src/components/tab-panel/tab-panel.readme.md +57 -0
  136. package/src/components/tab-panel/tab-panel.style.js +7 -0
  137. package/src/components/textarea-field/textarea-field.changelog.md +39 -0
  138. package/src/components/textarea-field/textarea-field.define.js +3 -0
  139. package/src/components/textarea-field/textarea-field.js +62 -0
  140. package/src/components/textarea-field/textarea-field.readme.md +102 -0
  141. package/src/components/textarea-field/textarea-field.style.js +7 -0
  142. package/src/components/transition-classes/transition-classes.changelog.md +39 -0
  143. package/src/components/transition-classes/transition-classes.define.js +3 -0
  144. package/src/components/transition-classes/transition-classes.js +154 -0
  145. package/src/components/transition-classes/transition-classes.readme.md +71 -0
  146. package/src/themes/default.css +165 -0
  147. package/src/themes/high-contrast.css +147 -0
  148. package/src/themes/sketchy.css +238 -0
  149. package/types/all.d.ts +1 -0
  150. package/types/index.d.ts +1 -0
  151. package/types/src/components/accordion/accordion.d.ts +60 -0
  152. package/types/src/components/accordion/accordion.define.d.ts +1 -0
  153. package/types/src/components/accordion/accordion.events.d.ts +4 -0
  154. package/types/src/components/accordion/accordion.style.d.ts +2 -0
  155. package/types/src/components/accordion-group/accordion-group.d.ts +28 -0
  156. package/types/src/components/accordion-group/accordion-group.define.d.ts +1 -0
  157. package/types/src/components/amount-field/amount-field.d.ts +53 -0
  158. package/types/src/components/amount-field/amount-field.define.d.ts +1 -0
  159. package/types/src/components/amount-field/amount-field.style.d.ts +2 -0
  160. package/types/src/components/button/button.d.ts +73 -0
  161. package/types/src/components/button/button.define.d.ts +1 -0
  162. package/types/src/components/button/button.style.d.ts +2 -0
  163. package/types/src/components/carousel/carousel.d.ts +79 -0
  164. package/types/src/components/carousel/carousel.define.d.ts +1 -0
  165. package/types/src/components/carousel/carousel.events.d.ts +4 -0
  166. package/types/src/components/carousel/carousel.style.d.ts +2 -0
  167. package/types/src/components/carousel/glide/components/ShadowAnchors.d.ts +1 -0
  168. package/types/src/components/carousel/glide/components/ShadowClones.d.ts +1 -0
  169. package/types/src/components/carousel/glide/components/ShadowGaps.d.ts +1 -0
  170. package/types/src/components/carousel/glide/components/ShadowHtml.d.ts +1 -0
  171. package/types/src/components/checkbox-field/checkbox-field.d.ts +69 -0
  172. package/types/src/components/checkbox-field/checkbox-field.define.d.ts +1 -0
  173. package/types/src/components/checkbox-field/checkbox-field.style.d.ts +2 -0
  174. package/types/src/components/dialog/dialog.d.ts +103 -0
  175. package/types/src/components/dialog/dialog.define.d.ts +1 -0
  176. package/types/src/components/dialog/dialog.events.d.ts +9 -0
  177. package/types/src/components/dialog/dialog.style.d.ts +2 -0
  178. package/types/src/components/dropdown/dropdown.d.ts +45 -0
  179. package/types/src/components/dropdown/dropdown.define.d.ts +1 -0
  180. package/types/src/components/dropdown/dropdown.style.d.ts +2 -0
  181. package/types/src/components/form-field/form-field.d.ts +110 -0
  182. package/types/src/components/form-field/form-field.define.d.ts +1 -0
  183. package/types/src/components/form-field/form-field.events.d.ts +5 -0
  184. package/types/src/components/form-field/form-field.style.d.ts +2 -0
  185. package/types/src/components/input-field/input-field.d.ts +38 -0
  186. package/types/src/components/input-field/input-field.define.d.ts +1 -0
  187. package/types/src/components/input-field/input-field.style.d.ts +2 -0
  188. package/types/src/components/lazy-src/lazy-src.d.ts +46 -0
  189. package/types/src/components/lazy-src/lazy-src.define.d.ts +1 -0
  190. package/types/src/components/lazy-src/lazy-src.events.d.ts +6 -0
  191. package/types/src/components/notification/notification.d.ts +92 -0
  192. package/types/src/components/notification/notification.define.d.ts +1 -0
  193. package/types/src/components/notification/notification.events.d.ts +7 -0
  194. package/types/src/components/notification/notification.style.d.ts +2 -0
  195. package/types/src/components/password-field/password-field.d.ts +66 -0
  196. package/types/src/components/password-field/password-field.define.d.ts +1 -0
  197. package/types/src/components/password-field/password-field.style.d.ts +2 -0
  198. package/types/src/components/radio-field/radio-field.d.ts +62 -0
  199. package/types/src/components/radio-field/radio-field.define.d.ts +1 -0
  200. package/types/src/components/radio-field/radio-field.style.d.ts +2 -0
  201. package/types/src/components/scroll-to/scroll-to.d.ts +24 -0
  202. package/types/src/components/scroll-to/scroll-to.define.d.ts +1 -0
  203. package/types/src/components/scroll-to-top/scroll-to-top.d.ts +32 -0
  204. package/types/src/components/scroll-to-top/scroll-to-top.define.d.ts +1 -0
  205. package/types/src/components/scroll-to-top/scroll-to-top.style.d.ts +2 -0
  206. package/types/src/components/select-field/select-field.d.ts +39 -0
  207. package/types/src/components/select-field/select-field.define.d.ts +1 -0
  208. package/types/src/components/select-field/select-field.style.d.ts +2 -0
  209. package/types/src/components/slider/slider.d.ts +129 -0
  210. package/types/src/components/slider/slider.define.d.ts +1 -0
  211. package/types/src/components/slider/slider.events.d.ts +5 -0
  212. package/types/src/components/slider/slider.style.d.ts +2 -0
  213. package/types/src/components/sticky/sticky.d.ts +47 -0
  214. package/types/src/components/sticky/sticky.define.d.ts +1 -0
  215. package/types/src/components/sticky/sticky.style.d.ts +2 -0
  216. package/types/src/components/svg-use/svg-use.d.ts +18 -0
  217. package/types/src/components/svg-use/svg-use.define.d.ts +1 -0
  218. package/types/src/components/svg-use/svg-use.style.d.ts +2 -0
  219. package/types/src/components/switch-field/switch-field.d.ts +67 -0
  220. package/types/src/components/switch-field/switch-field.define.d.ts +1 -0
  221. package/types/src/components/switch-field/switch-field.style.d.ts +2 -0
  222. package/types/src/components/tab-group/tab-group.d.ts +48 -0
  223. package/types/src/components/tab-group/tab-group.define.d.ts +1 -0
  224. package/types/src/components/tab-group/tab-group.style.d.ts +2 -0
  225. package/types/src/components/tab-link/tab-link.d.ts +30 -0
  226. package/types/src/components/tab-link/tab-link.define.d.ts +1 -0
  227. package/types/src/components/tab-link/tab-link.style.d.ts +2 -0
  228. package/types/src/components/tab-panel/tab-panel.d.ts +18 -0
  229. package/types/src/components/tab-panel/tab-panel.define.d.ts +1 -0
  230. package/types/src/components/tab-panel/tab-panel.style.d.ts +2 -0
  231. package/types/src/components/textarea-field/textarea-field.d.ts +34 -0
  232. package/types/src/components/textarea-field/textarea-field.define.d.ts +1 -0
  233. package/types/src/components/textarea-field/textarea-field.style.d.ts +2 -0
  234. package/types/src/components/transition-classes/transition-classes.d.ts +52 -0
  235. package/types/src/components/transition-classes/transition-classes.define.d.ts +1 -0
  236. package/types/src/utils/body-scroll.d.ts +4 -0
  237. package/types/src/utils/transitions.d.ts +9 -0
  238. package/web-types.json +3956 -0
@@ -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
+ <!-- ### Added -->
15
+ <!-- ### Changed -->
16
+ <!-- ### Removed -->
17
+ <!-- ### Fixed -->
18
+
19
+ ## [0.1.0] - 2026-06-03
20
+
21
+ ### Changed
22
+
23
+ - Migrated into the single-repo `@webtides/element-library` package. No API changes.
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,3 @@
1
+ import { define } from './textarea-field.js';
2
+
3
+ define();
@@ -0,0 +1,62 @@
1
+ import { html, defineElement, classMap } from '@webtides/element-js';
2
+ import FormField from '../form-field/form-field.js';
3
+ import style from './textarea-field.style.js';
4
+
5
+ /**
6
+ * Native `<textarea>` wrapper with label, help text, validation feedback (visual
7
+ * checkmark / cross indicators) and ARIA wiring. Extends `FormField` and inherits its
8
+ * label / help / error / required surface.
9
+ *
10
+ * @element el-textarea-field
11
+ *
12
+ * @fires {CustomEvent<string>} input-change - Fired when the textarea's value changes.
13
+ * `detail` is the new value. Bubbles.
14
+ *
15
+ * @property {string} placeholder - Placeholder text shown while the textarea is empty.
16
+ * @property {number} rows - Number of visible text rows. Forwarded to the underlying
17
+ * `<textarea>`'s `rows` attribute.
18
+ */
19
+ export default class TextareaField extends FormField {
20
+ constructor(options) {
21
+ super({ shadowRender: false, styles: [style], ...options });
22
+ }
23
+
24
+ properties() {
25
+ return {
26
+ ...super.properties(),
27
+ placeholder: '',
28
+ rows: 3,
29
+ };
30
+ }
31
+
32
+ /** @private */
33
+ fieldTemplate() {
34
+ const classes = { 'is-valid': !!this.valid, 'is-invalid': !this.valid };
35
+ return html`
36
+ <textarea
37
+ ref="input"
38
+ id="input-${this.name}"
39
+ name="${this.name}"
40
+ rows="${this.rows}"
41
+ placeholder="${this.placeholder}"
42
+ ?required="${this.required}"
43
+ ?disabled="${this.disabled}"
44
+ aria-describedby="${this.name}-help"
45
+ .value="${this.value ?? ''}"
46
+ ></textarea>
47
+ ${this.touched
48
+ ? html`
49
+ <div class="validity ${classMap(classes)}">
50
+ ${this.valid
51
+ ? html` <span class="valid h-4 w-4">&checkmark;</span> `
52
+ : html` <span class="invalid h-4 w-4" data-clear-input>&cross;</span> `}
53
+ </div>
54
+ `
55
+ : ''}
56
+ `;
57
+ }
58
+ }
59
+
60
+ export function define() {
61
+ defineElement('el-textarea-field', TextareaField);
62
+ }
@@ -0,0 +1,102 @@
1
+ # TextareaField
2
+
3
+ `textarea-field` is a web component that wraps the native HTML `<textarea>` element with enhanced functionality including label management, validation states, error messages, help text, and accessibility features. It extends the base `FormField` component and provides a complete multi-line text 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/textarea-field/define';
17
+ ```
18
+
19
+ ```html
20
+ <el-textarea-field
21
+ name="message"
22
+ label="Message"
23
+ placeholder="Enter your message"
24
+ rows="5"
25
+ help-message="Please provide as much detail as possible"
26
+ error-message="Message is required"
27
+ required
28
+ ></el-textarea-field>
29
+
30
+ <!-- With pre-filled value -->
31
+ <el-textarea-field name="bio" label="Biography" value="Tell us about yourself..." rows="8"></el-textarea-field>
32
+ ```
33
+
34
+ ## API
35
+
36
+ #### Properties/Attributes
37
+
38
+ | Name | Type | Default | Description |
39
+ | --- | --- | --- | --- |
40
+ | `name` | `string` | `''` | The name attribute for the textarea field, used for form submission and identification |
41
+ | `value` | `string` | `null` | The current text content of the textarea field |
42
+ | `placeholder` | `string` | `''` | Placeholder text displayed when the textarea is empty |
43
+ | `rows` | `number` | `3` | The number of visible text rows in the textarea |
44
+ | `required` | `boolean` | `false` | Whether the field is required for form submission |
45
+ | `disabled` | `boolean` | `false` | Whether the field is disabled and cannot be interacted with |
46
+ | `label` | `string` | `''` | Label text displayed above the textarea field |
47
+ | `labelScreenReaderOnly` | `boolean` | `false` | Whether to visually hide the label while keeping it accessible to screen readers |
48
+ | `helpMessage` | `string` | `''` | Help text displayed below the label to provide additional context |
49
+ | `errorMessage` | `string` | `''` | Error message displayed when validation fails and field is touched |
50
+ | `valid` | `boolean` | `true` | Whether the current textarea content is valid according to the field's constraints |
51
+ | `touched` | `boolean` | `false` | Whether the user has interacted with the field (focused and blurred) |
52
+
53
+ #### Methods
54
+
55
+ | Name | Parameters | Description |
56
+ | --- | --- | --- |
57
+ | `clearInput()` | None | Clears the textarea content, focuses the field, and resets the touched state |
58
+ | `onFocus()` | None | Internal method called when textarea receives focus, updates validation state |
59
+ | `onBlur()` | None | Internal method called when textarea loses focus, marks field as touched and updates validation |
60
+ | `onChange()` | None | Internal method called when textarea content changes, updates value and validation state |
61
+
62
+ #### Events
63
+
64
+ | Name | Detail | Description |
65
+ | -------------- | ---------------- | ------------------------------------------------------------------------ |
66
+ | `input-change` | `value` (string) | Dispatched when the textarea content changes. Bubbles up through the DOM |
67
+
68
+ #### CSS Custom Properties
69
+
70
+ This component is headless by default and inherits its styling — and the `--el-*` design tokens it reads — from `FormField`. Skin it by setting those tokens via a theme — see the Storybook _Docs / Theming_ page.
71
+
72
+ #### Slots
73
+
74
+ _None_ - The component generates its own textarea element internally
75
+
76
+ ## Accessibility
77
+
78
+ - Includes proper ARIA attributes (`aria-describedby`)
79
+ - Links labels to textareas via `for` attribute
80
+ - Supports screen reader only labels
81
+ - Visual validity indicators (✓ for valid, × for invalid) appear after field is touched
82
+ - Error messages are properly associated with the textarea field
83
+ - Help messages are linked via `aria-describedby`
84
+
85
+ ## Validation
86
+
87
+ The component provides real-time validation feedback:
88
+
89
+ - Validation state updates on focus, blur, and change events
90
+ - Visual indicators (checkmark for valid, cross for invalid) appear after the field is touched
91
+ - Error messages only display when field is touched and invalid
92
+ - Supports HTML5 validation attributes (required, disabled)
93
+ - Clicking the invalid indicator (×) clears the textarea content
94
+ - Tab key (keyCode 9) doesn't trigger change events to avoid false validation during navigation (inherited from `form-field`)
95
+
96
+ ## Features
97
+
98
+ - **Multi-line input**: Supports multiple rows of text input
99
+ - **Configurable height**: The `rows` attribute sets the number of visible rows
100
+ - **Touch-aware**: Supports both click and touch events for clearing input
101
+ - **Validation feedback**: Visual indicators show valid/invalid states after user interaction
102
+ - **Accessible**: Full ARIA support and proper semantic HTML structure
@@ -0,0 +1,7 @@
1
+ const css = String.raw;
2
+
3
+ export default css`
4
+ el-textarea-field {
5
+ display: block;
6
+ }
7
+ `;
@@ -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
+ <!-- ### Added -->
15
+ <!-- ### Changed -->
16
+ <!-- ### Removed -->
17
+ <!-- ### Fixed -->
18
+
19
+ ## [0.1.0] - 2026-06-03
20
+
21
+ ### Changed
22
+
23
+ - Migrated into the single-repo `@webtides/element-library` package. No API changes.
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-07-07
36
+
37
+ ### Added
38
+
39
+ - initial release
@@ -0,0 +1,3 @@
1
+ import { define } from './transition-classes.js';
2
+
3
+ define();
@@ -0,0 +1,154 @@
1
+ import { BaseElement, defineElement } from '@webtides/element-js';
2
+
3
+ /**
4
+ * Applies transition classes to the host element across `enter` / `enter-start` /
5
+ * `enter-end` and `leave` / `leave-start` / `leave-end` stages, driven by the `show`
6
+ * property. Each stage is read from a same-named attribute on the host (e.g.
7
+ * `enter="fade-in"` `enter-start="opacity-0"` `enter-end="opacity-100"`).
8
+ *
9
+ * @element el-transition-classes
10
+ *
11
+ * @slot - Default slot for the element(s) being transitioned.
12
+ *
13
+ * @attr enter - Space-separated classes added throughout the enter transition.
14
+ * @attr enter-start - Classes applied at the start of the enter transition.
15
+ * @attr enter-end - Classes applied at the end of the enter transition.
16
+ * @attr leave - Space-separated classes added throughout the leave transition.
17
+ * @attr leave-start - Classes applied at the start of the leave transition.
18
+ * @attr leave-end - Classes applied at the end of the leave transition.
19
+ *
20
+ * @property {boolean} show - When `true` the host plays the enter transition; when `false`
21
+ * the leave transition.
22
+ */
23
+ export default class TransitionClasses extends BaseElement {
24
+ /** @private */
25
+ initialClasses = '';
26
+
27
+ properties() {
28
+ return {
29
+ show: false,
30
+ };
31
+ }
32
+
33
+ connected() {
34
+ this.initialClasses = Array.from(this.classList) || [];
35
+ }
36
+
37
+ watch() {
38
+ return {
39
+ show: (show) => {
40
+ if (show) this.in();
41
+ else this.out();
42
+ },
43
+ };
44
+ }
45
+
46
+ /** @private */
47
+ stages(during, start, end, show, hide) {
48
+ return {
49
+ start: () => {
50
+ this.classList.add(...start);
51
+ },
52
+ during: () => {
53
+ this.classList.add(...during);
54
+ },
55
+ show: () => {
56
+ show();
57
+ },
58
+ end: () => {
59
+ // Don't remove classes that were in the original class attribute.
60
+ this.classList.remove(...start.filter((i) => !this.initialClasses.includes(i)));
61
+ this.classList.add(...end);
62
+ },
63
+ hide: () => {
64
+ hide();
65
+ },
66
+ };
67
+ }
68
+
69
+ /** @private */
70
+ classes(attribute) {
71
+ return this.getAttribute(attribute)
72
+ .split(' ')
73
+ .filter((token) => token !== '');
74
+ }
75
+
76
+ /** @private */
77
+ in() {
78
+ this.transition(
79
+ this.stages(
80
+ this.classes('enter'),
81
+ this.classes('enter-start'),
82
+ this.classes('enter-end'),
83
+ () => {
84
+ if (this.style.length === 1 && this.style.display === 'none') {
85
+ this.removeAttribute('style');
86
+ } else {
87
+ this.style.removeProperty('display');
88
+ }
89
+ },
90
+ () => {},
91
+ ),
92
+ );
93
+ }
94
+
95
+ /** @private */
96
+ out() {
97
+ this.transition(
98
+ this.stages(
99
+ this.classes('leave'),
100
+ this.classes('leave-start'),
101
+ this.classes('leave-end'),
102
+ () => {},
103
+ () => {
104
+ this.style.display = 'none';
105
+ },
106
+ ),
107
+ );
108
+ }
109
+
110
+ /**
111
+ * Play the enter transition (equivalent to setting `show = true`).
112
+ * @returns {void}
113
+ */
114
+ show() {
115
+ this.in();
116
+ }
117
+ /**
118
+ * Play the leave transition (equivalent to setting `show = false`).
119
+ * @returns {void}
120
+ */
121
+ hide() {
122
+ this.out();
123
+ }
124
+
125
+ /** @private */
126
+ transition(stages) {
127
+ stages.start();
128
+ stages.during();
129
+
130
+ requestAnimationFrame(() => {
131
+ // Note: Safari's transitionDuration property will list out comma separated transition durations
132
+ // for every single transition property. Let's grab the first one and call it a day.
133
+ let duration = Number(getComputedStyle(this).transitionDuration.replace(/,.*/, '').replace('s', '')) * 1000;
134
+
135
+ if (duration === 0) {
136
+ duration = Number(getComputedStyle(this).animationDuration.replace('s', '')) * 1000;
137
+ }
138
+
139
+ stages.show();
140
+
141
+ requestAnimationFrame(() => {
142
+ stages.end();
143
+
144
+ setTimeout(() => {
145
+ stages.hide();
146
+ }, duration);
147
+ });
148
+ });
149
+ }
150
+ }
151
+
152
+ export function define() {
153
+ defineElement('el-transition-classes', TransitionClasses);
154
+ }
@@ -0,0 +1,71 @@
1
+ # TransitionClasses
2
+
3
+ `transition-classes` applies transition classes to the host element across `enter` / `enter-start` / `enter-end` and `leave` / `leave-start` / `leave-end` stages, driven by the `show` property. Each stage is read from a same-named attribute on the host. It pairs well with utility-class frameworks (e.g. Tailwind) to animate elements in and out.
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/transition-classes/define';
17
+ ```
18
+
19
+ ```html
20
+ <el-transition-classes
21
+ show="true"
22
+ enter="transition duration-300"
23
+ enter-start="opacity-0"
24
+ enter-end="opacity-100"
25
+ leave="transition duration-200"
26
+ leave-start="opacity-100"
27
+ leave-end="opacity-0"
28
+ >
29
+ <div>I fade in and out</div>
30
+ </el-transition-classes>
31
+ ```
32
+
33
+ ## API
34
+
35
+ #### Properties/Attributes
36
+
37
+ | Name | Type | Default | Description |
38
+ | ------ | --------- | ------- | ----------------------------------------------------------------------------------- |
39
+ | `show` | `boolean` | `false` | When `true` the host plays the enter transition; when `false` the leave transition. |
40
+
41
+ The following attributes are read directly from the host (not properties) to determine the classes applied at each transition stage:
42
+
43
+ | Attribute | Description |
44
+ | ------------- | -------------------------------------------------------------- |
45
+ | `enter` | Space-separated classes added throughout the enter transition. |
46
+ | `enter-start` | Classes applied at the start of the enter transition. |
47
+ | `enter-end` | Classes applied at the end of the enter transition. |
48
+ | `leave` | Space-separated classes added throughout the leave transition. |
49
+ | `leave-start` | Classes applied at the start of the leave transition. |
50
+ | `leave-end` | Classes applied at the end of the leave transition. |
51
+
52
+ #### Methods
53
+
54
+ | Name | Parameters | Description |
55
+ | -------- | ---------- | ----------------------------------------------------------------- |
56
+ | `show()` | None | Play the enter transition (equivalent to setting `show = true`). |
57
+ | `hide()` | None | Play the leave transition (equivalent to setting `show = false`). |
58
+
59
+ #### Events
60
+
61
+ _None_
62
+
63
+ #### CSS Custom Properties
64
+
65
+ _None_
66
+
67
+ #### Slots
68
+
69
+ | Name | Description |
70
+ | ----------- | ---------------------------------- |
71
+ | _(default)_ | The element(s) being transitioned. |
@@ -0,0 +1,165 @@
1
+ /*
2
+ * @webtides/element-library — default theme
3
+ *
4
+ * Opt-in stylesheet that sets the --el-* design tokens at :root. Import once
5
+ * at the top of your app:
6
+ *
7
+ * import '@webtides/element-library/themes/default.css';
8
+ *
9
+ * Without this (or another) theme imported, components fall back to the
10
+ * null-ish defaults baked into each component's stylesheet — i.e. they stay
11
+ * headless (no borders, no decorative backgrounds, native controls untouched).
12
+ *
13
+ * Surface colors use light-dark(), so the theme automatically adapts when
14
+ * the page declares color-scheme. The :root rule below opts the document
15
+ * into both schemes; override on a parent if you need to force one mode.
16
+ */
17
+
18
+ :root {
19
+ color-scheme: light dark;
20
+
21
+ /* Color — surfaces & text */
22
+ --el-color-fg: light-dark(#111827, #f3f4f6);
23
+ --el-color-fg-muted: light-dark(#6b7280, #9ca3af);
24
+ --el-color-bg: light-dark(#ffffff, #0f1115);
25
+ --el-color-bg-muted: light-dark(#f3f4f6, #1c1f24);
26
+ --el-color-border: light-dark(#d1d5db, #2d3138);
27
+
28
+ /* Color — interactive & semantic */
29
+ --el-color-accent: light-dark(#2563eb, #60a5fa);
30
+ --el-color-success: light-dark(#16a34a, #4ade80);
31
+ --el-color-danger: light-dark(#dc2626, #f87171);
32
+ --el-color-focus-ring: var(--el-color-accent);
33
+
34
+ /* Spacing — 4px base */
35
+ --el-space-1: 0.25rem;
36
+ --el-space-2: 0.5rem;
37
+ --el-space-3: 0.75rem;
38
+ --el-space-4: 1rem;
39
+ --el-space-5: 1.5rem;
40
+
41
+ /* Radius */
42
+ --el-radius-sm: 2px;
43
+ --el-radius-md: 6px;
44
+ --el-radius-lg: 12px;
45
+
46
+ /* Border */
47
+ --el-border-width: 1px;
48
+
49
+ /* Typography — inherits system stack by default */
50
+ --el-font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
51
+ --el-font-size-sm: 0.875rem;
52
+ --el-font-size-md: 1rem;
53
+ --el-line-height: 1.5;
54
+
55
+ /* Shadow */
56
+ --el-shadow-md: 0 4px 12px light-dark(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.4));
57
+ --el-shadow-lg: 0 12px 24px light-dark(rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.5));
58
+
59
+ /* Motion */
60
+ --el-duration-md: 200ms;
61
+ --el-ease: cubic-bezier(0.2, 0, 0, 1);
62
+
63
+ /* Focus ring */
64
+ --el-focus-ring-width: 2px;
65
+ --el-focus-ring-offset: 2px;
66
+
67
+ /* Sizing */
68
+ --el-control-height: 2.5rem;
69
+ --el-touch-target: 2.75rem;
70
+
71
+ /* Dialog — overlay scrim dims the inert background; the panel reads the shared surface tokens */
72
+ --el-dialog-width: 31rem;
73
+ --el-dialog-overlay-background: light-dark(rgba(17, 24, 39, 0.5), rgba(0, 0, 0, 0.6));
74
+ }
75
+
76
+ /*
77
+ * Native form controls (input / textarea / select) live in light DOM, so the
78
+ * theme decorates them directly. Without this rule, consumers get the browser's
79
+ * native input look (headless default).
80
+ */
81
+ el-input-field input,
82
+ el-password-field input,
83
+ el-textarea-field textarea,
84
+ el-select-field select {
85
+ box-sizing: border-box;
86
+ width: 100%;
87
+ border: var(--el-border-width) solid var(--el-color-border);
88
+ border-radius: var(--el-radius-md);
89
+ padding: var(--el-space-2) var(--el-space-3);
90
+ background: var(--el-color-bg);
91
+ color: var(--el-color-fg);
92
+ font-family: var(--el-font-family);
93
+ font-size: var(--el-font-size-md);
94
+ line-height: var(--el-line-height);
95
+ transition:
96
+ border-color var(--el-duration-md) var(--el-ease),
97
+ box-shadow var(--el-duration-md) var(--el-ease);
98
+ }
99
+
100
+ el-input-field input,
101
+ el-password-field input,
102
+ el-select-field select {
103
+ min-height: var(--el-control-height);
104
+ }
105
+
106
+ el-input-field input:focus,
107
+ el-password-field input:focus,
108
+ el-textarea-field textarea:focus,
109
+ el-select-field select:focus {
110
+ outline: none;
111
+ border-color: var(--el-color-focus-ring);
112
+ box-shadow:
113
+ 0 0 0 var(--el-focus-ring-offset) var(--el-color-bg),
114
+ 0 0 0 calc(var(--el-focus-ring-offset) + var(--el-focus-ring-width)) var(--el-color-focus-ring);
115
+ }
116
+
117
+ el-input-field:state(invalid) input,
118
+ el-password-field:state(invalid) input,
119
+ el-textarea-field:state(invalid) textarea,
120
+ el-select-field:state(invalid) select {
121
+ border-color: var(--el-color-danger);
122
+ }
123
+
124
+ /*
125
+ * select-field renders both a native chevron AND a custom .dropdown-indicator.
126
+ * Suppress the native one and float the indicator inside the select so themed
127
+ * selects show a single, theme-able chevron.
128
+ */
129
+ el-select-field .field {
130
+ position: relative;
131
+ }
132
+
133
+ el-select-field select {
134
+ appearance: none;
135
+ -webkit-appearance: none;
136
+ padding-right: calc(var(--el-space-3) * 2 + var(--el-space-2));
137
+ }
138
+
139
+ el-select-field .dropdown-indicator {
140
+ display: flex;
141
+ align-items: center;
142
+ pointer-events: none;
143
+ position: absolute;
144
+ right: var(--el-space-3);
145
+ top: 50%;
146
+ transform: translateY(-50%);
147
+ color: var(--el-color-fg-muted);
148
+ }
149
+
150
+ /* Respect user motion + contrast preferences */
151
+
152
+ @media (prefers-reduced-motion: reduce) {
153
+ :root {
154
+ --el-duration-md: 0s;
155
+ }
156
+ }
157
+
158
+ @media (prefers-contrast: more) {
159
+ :root {
160
+ --el-color-fg: light-dark(#000000, #ffffff);
161
+ --el-color-border: light-dark(#000000, #ffffff);
162
+ --el-border-width: 2px;
163
+ --el-focus-ring-width: 3px;
164
+ }
165
+ }