@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
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { BaseElement, StyledElement, TemplateElement, defineElement, html, toString } from '@webtides/element-js';
2
+
3
+ export { BaseElement, StyledElement, TemplateElement, html, toString, defineElement };
package/package.json ADDED
@@ -0,0 +1,132 @@
1
+ {
2
+ "name": "@webtides/element-library",
3
+ "version": "0.1.0",
4
+ "description": "A set of web components built with @webtides/element-js",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "module": "index.js",
8
+ "types": "./types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./types/index.d.ts",
12
+ "default": "./index.js"
13
+ },
14
+ "./all": {
15
+ "types": "./types/all.d.ts",
16
+ "default": "./all.js"
17
+ },
18
+ "./*": {
19
+ "types": "./types/src/components/*/*.d.ts",
20
+ "default": "./src/components/*/*.js"
21
+ },
22
+ "./*/define": {
23
+ "types": "./types/src/components/*/*.define.d.ts",
24
+ "default": "./src/components/*/*.define.js"
25
+ },
26
+ "./themes/*.css": "./src/themes/*.css",
27
+ "./custom-elements.json": "./custom-elements.json",
28
+ "./web-types.json": "./web-types.json",
29
+ "./package.json": "./package.json"
30
+ },
31
+ "customElements": "custom-elements.json",
32
+ "web-types": "./web-types.json",
33
+ "sideEffects": [
34
+ "./all.js",
35
+ "./src/components/*/*.define.js"
36
+ ],
37
+ "files": [
38
+ "src/components/**/*.js",
39
+ "src/components/**/*.md",
40
+ "!src/components/**/*.stories.js",
41
+ "!src/components/**/*.test.*.js",
42
+ "src/themes/*.css",
43
+ "types/**/*.d.ts",
44
+ "all.js",
45
+ "index.js",
46
+ "custom-elements.json",
47
+ "web-types.json",
48
+ "patches",
49
+ "CHANGELOG.md"
50
+ ],
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/webtides/element-library.git"
54
+ },
55
+ "homepage": "https://webtides.github.io/element-library",
56
+ "bugs": {
57
+ "url": "https://github.com/webtides/element-library/issues"
58
+ },
59
+ "keywords": [
60
+ "web-components",
61
+ "custom-elements",
62
+ "element-js",
63
+ "webtides",
64
+ "ui-library",
65
+ "components"
66
+ ],
67
+ "author": "@webtides",
68
+ "license": "MIT",
69
+ "engines": {
70
+ "node": ">=20.19.0"
71
+ },
72
+ "dependencies": {
73
+ "@glidejs/glide": "~3.6.2",
74
+ "@webtides/element-js": "^1.2.11",
75
+ "lozad": "^1.16.0"
76
+ },
77
+ "devDependencies": {
78
+ "@custom-elements-manifest/analyzer": "^0.11.0",
79
+ "@storybook/addon-a11y": "^10.4.1",
80
+ "@storybook/addon-docs": "^10.4.1",
81
+ "@storybook/addon-links": "^10.4.1",
82
+ "@storybook/addon-vitest": "^10.4.1",
83
+ "@storybook/web-components": "^10.4.1",
84
+ "@storybook/web-components-vite": "^10.4.1",
85
+ "@vitest/browser": "^4.1.8",
86
+ "@vitest/browser-playwright": "^4.1.8",
87
+ "@vitest/coverage-istanbul": "^4.1.8",
88
+ "@vitest/ui": "^4.1.8",
89
+ "axe-core": "^4.12.0",
90
+ "custom-element-jet-brains-integration": "^1.7.0",
91
+ "eslint": "^10.4.1",
92
+ "eslint-config-prettier": "^10.1.8",
93
+ "eslint-plugin-import": "^2.32.0",
94
+ "eslint-plugin-prettier": "^5.5.6",
95
+ "eslint-plugin-storybook": "^10.4.1",
96
+ "globals": "^17.6.0",
97
+ "husky": "^9.1.7",
98
+ "lint-staged": "^17.0.7",
99
+ "lit": "^3.3.3",
100
+ "patch-package": "^8.0.1",
101
+ "playwright": "^1.60.0",
102
+ "prettier": "^3.8.3",
103
+ "storybook": "^10.4.1",
104
+ "typescript": "^6.0.3",
105
+ "vite": "^8.0.16",
106
+ "vitest": "^4.1.8"
107
+ },
108
+ "scripts": {
109
+ "dev": "storybook dev -p 3000 --no-open",
110
+ "lint": "eslint ./src/**/*.js",
111
+ "test": "vitest run",
112
+ "test:coverage": "vitest run --coverage",
113
+ "test:watch": "vitest",
114
+ "test:ui": "vitest --ui",
115
+ "build-storybook": "storybook build",
116
+ "analyze": "cem analyze --config custom-elements-manifest.config.mjs --outdir .",
117
+ "analyze:watch": "cem analyze --config custom-elements-manifest.config.mjs --outdir . --watch",
118
+ "build:types": "tsc -p tsconfig.json",
119
+ "prepack": "npm run analyze && npm run build:types",
120
+ "prepare": "husky && npm run analyze && npm run build:types",
121
+ "postinstall": "patch-package"
122
+ },
123
+ "lint-staged": {
124
+ "*.js": [
125
+ "eslint --fix",
126
+ "prettier --write"
127
+ ],
128
+ "*.{yaml,yml,md,json}": [
129
+ "prettier --write"
130
+ ]
131
+ }
132
+ }
@@ -0,0 +1,11 @@
1
+ diff --git a/node_modules/@glidejs/glide/src/components/html.js b/node_modules/@glidejs/glide/src/components/html.js
2
+ index e04eb23..bc3c2c4 100644
3
+ --- a/node_modules/@glidejs/glide/src/components/html.js
4
+ +++ b/node_modules/@glidejs/glide/src/components/html.js
5
+ @@ -1,5 +1,5 @@
6
+ import { warn } from '../utils/log'
7
+ -import { exist, toArray } from '../utils/dom'
8
+ +import { toArray } from '../utils/dom'
9
+ import { define } from '../utils/object'
10
+ import { isString } from '../utils/unit'
11
+
@@ -0,0 +1,47 @@
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
+ - `open` custom state on the host. Style with `:host(:state(open))` or `el-accordion:state(open)` from outside.
20
+
21
+ ### Changed
22
+
23
+ - BREAKING: renamed the component — tag `el-accordion-element` → `el-accordion`, import subpaths `@webtides/element-library/accordion-element` → `/accordion` (and `/accordion-element/define` → `/accordion/define`), and exported class `AccordionElement` → `Accordion`.
24
+ - BREAKING: renamed CSS parts `title-wrapper` → `title` and `content-wrapper` → `content` for consistency with the rest of the library (carousel, slider, amount-field). The internal `.content-wrapper` class is now `.content`.
25
+ - BREAKING: replaced the separate `open-icon` / `close-icon` parts with a single `icon` part — one SVG chevron that rotates 180° when open (animated with `--el-duration-md` / `--el-ease`) instead of swapping two `&vee;` / `&wedge;` text glyphs.
26
+ - Internal style now keys off `:host(:state(open))` instead of `:host([open='true'])`. The reflected `open` attribute is unchanged.
27
+ - Expand/collapse transition reads `--el-duration-md` and `--el-ease` (with the previous `0.3s ease-out` as fallback).
28
+
29
+ ### Fixed
30
+
31
+ - Collapsed content no longer leaves a visible sliver. The content padding moved from `.content` (which collapses to `height: 0`) onto a new inner `.content-inner` wrapper, so closing the accordion now also clips the padding. Previously only noticeable once a theme set `--el-space-3`.
32
+
33
+ ## Legacy (pre-merge)
34
+
35
+ 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.
36
+
37
+ ## [0.1.1] - 2021-07-21
38
+
39
+ ### Changed
40
+
41
+ update element-js version
42
+
43
+ ## [0.1.0] - 2020-03-15
44
+
45
+ ### Added
46
+
47
+ - initial release
@@ -0,0 +1,3 @@
1
+ import { define } from './accordion.js';
2
+
3
+ define();
@@ -0,0 +1,3 @@
1
+ export default {
2
+ TOGGLE: 'AccordionToggle',
3
+ };
@@ -0,0 +1,144 @@
1
+ import { TemplateElement, html, defineElement } from '@webtides/element-js';
2
+ import style from './accordion.style.js';
3
+ import Events from './accordion.events.js';
4
+
5
+ /**
6
+ * A collapsible content component that expands and collapses content sections with smooth
7
+ * animations. Features customizable header and content slots, automatic toggle functionality,
8
+ * and emits an event when its state changes.
9
+ *
10
+ * @element el-accordion
11
+ *
12
+ * @fires {CustomEvent<{ open: boolean }>} AccordionToggle - Fired when the accordion is
13
+ * toggled. The event bubbles up through the DOM. `detail.open` reflects the new open state.
14
+ *
15
+ * @slot header - Content to display in the accordion header/title area. Clicking this area
16
+ * toggles the accordion.
17
+ * @slot content - Content to display in the collapsible section of the accordion.
18
+ *
19
+ * @csspart title - The header container that wraps the `header` slot and toggle icon.
20
+ * @csspart content - The wrapper around the collapsible `content` slot.
21
+ * @csspart icon - The chevron icon; rotates 180° while the accordion is open.
22
+ *
23
+ * @cssstate open - Set while the accordion is expanded. Style with `:host(:state(open))` or
24
+ * `el-accordion:state(open)` from outside.
25
+ *
26
+ * @property {boolean} open - Controls whether the accordion is expanded (`true`) or collapsed
27
+ * (`false`). Reflected to the `open` attribute.
28
+ */
29
+ export default class Accordion extends TemplateElement {
30
+ constructor() {
31
+ super({ shadowRender: true, styles: [style], propertyOptions: { open: { reflect: true } } });
32
+ }
33
+
34
+ connected() {
35
+ if (!this.open) this.collapse();
36
+ if (this.open) this._internals.states.add('open');
37
+ }
38
+
39
+ properties() {
40
+ return {
41
+ open: false,
42
+ };
43
+ }
44
+
45
+ watch() {
46
+ return {
47
+ open: (open) => {
48
+ open === true ? this.expand() : this.collapse();
49
+ if (open) this._internals.states.add('open');
50
+ else this._internals.states.delete('open');
51
+ this.dispatch(Events.TOGGLE, { open: this.open });
52
+ },
53
+ };
54
+ }
55
+
56
+ events() {
57
+ return {
58
+ '[data-toggle]': {
59
+ click: () => {
60
+ this.toggle();
61
+ },
62
+ },
63
+ };
64
+ }
65
+
66
+ /**
67
+ * Toggles the accordion between open and closed states.
68
+ * @returns {void}
69
+ */
70
+ toggle() {
71
+ this.open = !this.open;
72
+ }
73
+
74
+ /**
75
+ * Closes the accordion with animation.
76
+ * @returns {void}
77
+ */
78
+ collapse() {
79
+ const contentHeight = this.$refs.content.scrollHeight;
80
+
81
+ const elementTransition = this.$refs.content.style.transition;
82
+ this.$refs.content.style.transition = '';
83
+
84
+ requestAnimationFrame(() => {
85
+ this.$refs.content.style.height = contentHeight + 'px';
86
+ this.$refs.content.style.transition = elementTransition;
87
+
88
+ requestAnimationFrame(() => {
89
+ this.$refs.content.style.height = 0 + 'px';
90
+ });
91
+ });
92
+
93
+ this.$refs.content.setAttribute('data-collapsed', 'true');
94
+ }
95
+
96
+ /**
97
+ * Opens the accordion with animation.
98
+ * @returns {void}
99
+ */
100
+ expand() {
101
+ const contentHeight = this.$refs.content.scrollHeight;
102
+ this.$refs.content.style.height = contentHeight + 'px';
103
+
104
+ this.$refs.content.setAttribute('data-collapsed', 'false');
105
+ }
106
+
107
+ template() {
108
+ return html`
109
+ <div part="title" ref="header" data-toggle>
110
+ <slot name="header"></slot>
111
+ ${this.iconsTemplate()}
112
+ </div>
113
+ <div part="content" class="content" ref="content">
114
+ <div class="content-inner">
115
+ <slot name="content"></slot>
116
+ </div>
117
+ </div>
118
+ `;
119
+ }
120
+
121
+ /** @private */
122
+ iconsTemplate() {
123
+ return html`
124
+ <span part="icon" class="icon" aria-hidden="true">
125
+ <svg
126
+ viewBox="0 0 24 24"
127
+ fill="none"
128
+ stroke="currentColor"
129
+ stroke-width="2"
130
+ stroke-linecap="round"
131
+ stroke-linejoin="round"
132
+ >
133
+ <polyline points="6 9 12 15 18 9"></polyline>
134
+ </svg>
135
+ </span>
136
+ `;
137
+ }
138
+ }
139
+
140
+ export function define() {
141
+ defineElement('el-accordion', Accordion);
142
+ }
143
+
144
+ export { html, defineElement, Events };
@@ -0,0 +1,71 @@
1
+ # Accordion
2
+
3
+ `accordion` is a collapsible content component that expands and collapses content sections with smooth animations. It features customizable header and content slots, automatic toggle functionality, and emits events when its state changes.
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/accordion/define';
17
+ ```
18
+
19
+ ```html
20
+ <el-accordion open="false">
21
+ <div slot="header">Accordion Header</div>
22
+ <div slot="content">Your content goes here...</div>
23
+ </el-accordion>
24
+ ```
25
+
26
+ ## API
27
+
28
+ #### Properties/Attribute
29
+
30
+ | Name | Type | Default | Description |
31
+ | --- | --- | --- | --- |
32
+ | `open` | `boolean` | `false` | Controls whether the accordion is expanded (true) or collapsed (false). This property is reflected to the element's attribute. |
33
+
34
+ #### Methods
35
+
36
+ | Name | Parameters | Description |
37
+ | ------------ | ---------- | ----------------------------------------------------- |
38
+ | `toggle()` | None | Toggles the accordion between open and closed states. |
39
+ | `expand()` | None | Opens the accordion with animation. |
40
+ | `collapse()` | None | Closes the accordion with animation. |
41
+
42
+ #### Events
43
+
44
+ | Name | Detail | Description |
45
+ | --- | --- | --- |
46
+ | `AccordionToggle` | `{ open: boolean }` | Fired when the accordion is toggled. The event bubbles up through the DOM. The detail contains the current open state. |
47
+
48
+ #### CSS Parts
49
+
50
+ | Name | Description |
51
+ | --------- | ------------------------------------------------------------------------ |
52
+ | `title` | The clickable header row (wraps the `header` slot and the chevron icon). |
53
+ | `content` | The collapsible content region. |
54
+ | `icon` | The chevron icon; rotates 180° while the accordion is open. |
55
+
56
+ #### CSS States
57
+
58
+ | Name | Description |
59
+ | --- | --- |
60
+ | `open` | Present on the host while the accordion is expanded. Style with `el-accordion:state(open)` or `:host(:state(open))`. |
61
+
62
+ #### CSS Custom Properties
63
+
64
+ This component is headless by default and reads the library's `--el-*` design tokens (e.g. `--el-color-bg`, `--el-color-border`, `--el-radius-md`, `--el-space-3`, `--el-duration-md`). Skin it by setting these via a theme — see the Storybook _Docs / Theming_ page.
65
+
66
+ #### Slots
67
+
68
+ | Name | Description |
69
+ | --------- | ------------------------------------------------------------------------------------------------ |
70
+ | `header` | Content to display in the accordion header/title area. Clicking this area toggles the accordion. |
71
+ | `content` | Content to display in the collapsible section of the accordion. |
@@ -0,0 +1,64 @@
1
+ const css = String.raw;
2
+
3
+ export default css`
4
+ :host {
5
+ display: block;
6
+ margin-bottom: var(--el-space-2, 0);
7
+ border: var(--el-border-width, 0) solid var(--el-color-border, transparent);
8
+ border-radius: var(--el-radius-md, 0);
9
+ background: var(--el-color-bg, transparent);
10
+
11
+ &[cloak='true'] {
12
+ svg {
13
+ display: none;
14
+ }
15
+ }
16
+ }
17
+
18
+ [part~='title'] {
19
+ display: flex;
20
+ padding: var(--el-space-3, 0) var(--el-space-3, 0);
21
+ cursor: pointer;
22
+ /* Divider between header and body — shown only while the item is open. */
23
+ border-bottom: var(--el-border-width, 0) solid transparent;
24
+ }
25
+
26
+ :host(:state(open)) [part~='title'] {
27
+ border-bottom-color: var(--el-color-border, transparent);
28
+ }
29
+
30
+ .icon {
31
+ display: flex;
32
+ flex-shrink: 0;
33
+ justify-content: center;
34
+ align-items: center;
35
+ margin-left: auto;
36
+ width: 1.25em;
37
+ height: 1.25em;
38
+ transition: transform var(--el-duration-md, 0.3s) var(--el-ease, ease-out);
39
+ }
40
+
41
+ .icon svg {
42
+ width: 100%;
43
+ height: 100%;
44
+ }
45
+
46
+ :host([cloak]) {
47
+ display: none;
48
+ }
49
+
50
+ :host(:state(open)) .icon {
51
+ transform: rotate(180deg);
52
+ }
53
+
54
+ .content {
55
+ overflow: hidden;
56
+ transition: height var(--el-duration-md, 0.3s) var(--el-ease, ease-out);
57
+ height: auto;
58
+ }
59
+
60
+ /* Padding lives on the inner wrapper so collapsing .content to height:0 clips it too. */
61
+ .content-inner {
62
+ padding: var(--el-space-3, 0) var(--el-space-3, 0);
63
+ }
64
+ `;
@@ -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
+ ### Fixed
18
+
19
+ - Single-open mode (`show-multiple="false"`) now correctly closes the previously open accordion when one starts open declaratively. The `connected()` preselection scan had an inverted guard (it ran only in multi-open mode) and queried the whole document instead of the group's own children.
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,3 @@
1
+ import { define } from './accordion-group.js';
2
+
3
+ define();
@@ -0,0 +1,63 @@
1
+ import { BaseElement, defineElement } from '@webtides/element-js';
2
+ import Events from '../accordion/accordion.events.js';
3
+
4
+ /**
5
+ * Container that manages multiple `<el-accordion>` children. When `showMultiple` is
6
+ * `false`, only one accordion can be open at a time; opening a new accordion closes the
7
+ * previously open one.
8
+ *
9
+ * @element el-accordion-group
10
+ *
11
+ * @slot - Default slot for `<el-accordion>` children.
12
+ *
13
+ * @property {boolean} showMultiple - When `false`, only one child accordion can be open at a
14
+ * time; opening a new accordion closes the previously open one. When `true`, multiple
15
+ * accordions can be open simultaneously.
16
+ */
17
+ export default class AccordionGroup extends BaseElement {
18
+ /** @private */
19
+ currentOpenElement = null;
20
+
21
+ properties() {
22
+ return {
23
+ showMultiple: true,
24
+ };
25
+ }
26
+
27
+ connected() {
28
+ if (this.showMultiple) return;
29
+
30
+ this.querySelectorAll('el-accordion').forEach((item) => {
31
+ if (item.hasAttribute('open') && item.getAttribute('open') === 'true') {
32
+ this.currentOpenElement = item;
33
+ }
34
+ });
35
+ }
36
+
37
+ events() {
38
+ return {
39
+ this: {
40
+ [Events.TOGGLE]: (event) => {
41
+ if (this.showMultiple) return;
42
+
43
+ const { open } = event.detail;
44
+
45
+ if (open) {
46
+ if (this.currentOpenElement) {
47
+ this.currentOpenElement.open = false;
48
+ }
49
+ this.currentOpenElement = event.target;
50
+ } else {
51
+ if (event.target === this.currentOpenElement) {
52
+ this.currentOpenElement = null;
53
+ }
54
+ }
55
+ },
56
+ },
57
+ };
58
+ }
59
+ }
60
+
61
+ export function define() {
62
+ defineElement('el-accordion-group', AccordionGroup);
63
+ }
@@ -0,0 +1,56 @@
1
+ # AccordionGroup
2
+
3
+ `accordion-group` is a container component that manages multiple accordion elements. It can control whether multiple accordions can be open simultaneously or enforce single-accordion-open behavior (only one accordion open at a time).
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/accordion-group/define';
17
+ ```
18
+
19
+ ```html
20
+ <!-- Allow only one accordion open at a time -->
21
+ <el-accordion-group show-multiple="false">
22
+ <el-accordion>
23
+ <div slot="header">First Accordion</div>
24
+ <div slot="content">First content...</div>
25
+ </el-accordion>
26
+
27
+ <el-accordion>
28
+ <div slot="header">Second Accordion</div>
29
+ <div slot="content">Second content...</div>
30
+ </el-accordion>
31
+ </el-accordion-group>
32
+ ```
33
+
34
+ ## API
35
+
36
+ #### Properties/Attribute
37
+
38
+ | Name | Type | Default | Description |
39
+ | --- | --- | --- | --- |
40
+ | `showMultiple` | `boolean` | `true` | When set to `false`, only one accordion element can be open at a time. Opening a new accordion will automatically close the previously open one. When `true`, multiple accordions can be open simultaneously. |
41
+
42
+ #### Methods
43
+
44
+ _None_
45
+
46
+ #### Events
47
+
48
+ _None_ (listens to `AccordionToggle` events from child accordion elements)
49
+
50
+ #### CSS Custom Properties
51
+
52
+ _None_
53
+
54
+ #### Slots
55
+
56
+ _None_ (uses default slot for accordion children)