@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,98 @@
1
+ const css = String.raw;
2
+
3
+ export default css`
4
+ el-switch-field {
5
+ display: block;
6
+
7
+ .field > label {
8
+ display: inline-flex;
9
+ align-items: center;
10
+ gap: var(--el-space-2, 0.5em);
11
+ cursor: pointer;
12
+ }
13
+
14
+ .field > label:has(input:disabled) {
15
+ cursor: not-allowed;
16
+ }
17
+
18
+ /* The native checkbox is replaced by the track/thumb; hide it visually but keep it in the
19
+ accessibility tree and focusable. */
20
+ input[type='checkbox'] {
21
+ position: absolute;
22
+ width: 1px;
23
+ height: 1px;
24
+ margin: 0;
25
+ padding: 0;
26
+ border: 0;
27
+ opacity: 0;
28
+ overflow: hidden;
29
+ white-space: nowrap;
30
+ clip: rect(0 0 0 0);
31
+ clip-path: inset(50%);
32
+ }
33
+
34
+ /* Reflect keyboard focus onto the custom track. */
35
+ input[type='checkbox']:focus-visible + .switch-track {
36
+ outline: var(--el-focus-ring-width, 2px) solid var(--el-color-accent, currentColor);
37
+ outline-offset: 2px;
38
+ }
39
+
40
+ .switch-track {
41
+ position: relative;
42
+ display: inline-block;
43
+ flex: none;
44
+ box-sizing: border-box;
45
+ /* Track is sized in em so it scales with the surrounding font-size. */
46
+ width: 2.4em;
47
+ height: 1.4em;
48
+ border: var(--el-border-width, 1px) solid var(--el-color-border, currentColor);
49
+ border-radius: 999px;
50
+ background: var(--el-color-bg, transparent);
51
+ transition:
52
+ background var(--el-duration-md, 0s) var(--el-ease, linear),
53
+ border-color var(--el-duration-md, 0s) var(--el-ease, linear);
54
+ }
55
+
56
+ .switch-thumb {
57
+ position: absolute;
58
+ top: 50%;
59
+ left: 0.15em;
60
+ width: 1.1em;
61
+ height: 1.1em;
62
+ border-radius: 50%;
63
+ /* Visible against the headless (transparent) track via currentColor. */
64
+ background: var(--el-color-border, currentColor);
65
+ transform: translateY(-50%);
66
+ transition:
67
+ transform var(--el-duration-md, 0s) var(--el-ease, linear),
68
+ background var(--el-duration-md, 0s) var(--el-ease, linear);
69
+ }
70
+
71
+ input[type='checkbox']:checked + .switch-track {
72
+ background: var(--el-color-accent, currentColor);
73
+ border-color: var(--el-color-accent, currentColor);
74
+ }
75
+
76
+ /* Slide the thumb to the right edge and flip it to the surface color so it reads on the fill. */
77
+ input[type='checkbox']:checked + .switch-track .switch-thumb {
78
+ transform: translate(calc(2.4em - 1.1em - 0.3em), -50%);
79
+ background: var(--el-color-bg, Canvas);
80
+ }
81
+
82
+ input[type='checkbox']:disabled + .switch-track {
83
+ opacity: 0.5;
84
+ }
85
+
86
+ .message {
87
+ display: block;
88
+ }
89
+
90
+ .help-message {
91
+ color: var(--el-color-fg-muted, inherit);
92
+ }
93
+
94
+ .error-message {
95
+ color: var(--el-color-danger, inherit);
96
+ }
97
+ }
98
+ `;
@@ -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
+ ### Changed
18
+
19
+ - Selection is now mirrored onto child `<el-tab-link>` elements via the `active` custom state instead of the `[active]` attribute. The `selected` attribute on `<el-tab-group>` itself is unchanged.
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-11-10
32
+
33
+ ### Added
34
+
35
+ - initial release
@@ -0,0 +1,3 @@
1
+ import { define } from './tab-group.js';
2
+
3
+ define();
@@ -0,0 +1,109 @@
1
+ import { StyledElement, defineElement } from '@webtides/element-js';
2
+ import style from './tab-group.style.js';
3
+
4
+ /**
5
+ * Container that pairs `<el-tab-link>` children with `<el-tab-panel>` children and shows
6
+ * one panel at a time. Listens for `tab-select` events bubbled from `<el-tab-link>` and
7
+ * mirrors the active selection onto the `selected` attribute (reflected).
8
+ *
9
+ * @element el-tab-group
10
+ *
11
+ * @slot - Default slot containing `<el-tab-link>` and `<el-tab-panel>` children.
12
+ *
13
+ * @property {string | undefined} selected - Name of the currently selected tab. Matches a
14
+ * `<el-tab-panel>`'s `name`. Reflected to the `selected` attribute.
15
+ * @property {string} linkSelector - Selector used to find tab link children.
16
+ * @property {string} panelSelector - Selector used to find tab panel children.
17
+ */
18
+ export default class TabGroup extends StyledElement {
19
+ /** @private */
20
+ tabLinks = [];
21
+ /** @private */
22
+ tabPanels = [];
23
+
24
+ constructor() {
25
+ super({ styles: [style], propertyOptions: { selected: { reflect: true } } });
26
+ }
27
+
28
+ properties() {
29
+ return {
30
+ selected: undefined,
31
+ linkSelector: 'el-tab-link',
32
+ panelSelector: 'el-tab-panel',
33
+ };
34
+ }
35
+
36
+ watch() {
37
+ return {
38
+ selected: () => {
39
+ this.updateSelection();
40
+ },
41
+ };
42
+ }
43
+
44
+ connected() {
45
+ this.tabLinks = this.queryTabLinks();
46
+ this.tabPanels = this.queryTabPanels();
47
+
48
+ // select first tab if none was selected declarative
49
+ if (!this.selected && this.tabPanels.length > 0) {
50
+ const firstPanel = this.tabPanels[0];
51
+ this.selectTab(firstPanel.name);
52
+ }
53
+
54
+ this.updateSelection();
55
+
56
+ // this.setAttribute('cloak', 'false');
57
+ }
58
+
59
+ events() {
60
+ return {
61
+ this: {
62
+ 'tab-select': (event) => {
63
+ const { selected } = event.detail;
64
+ this.selected = selected;
65
+ },
66
+ },
67
+ };
68
+ }
69
+
70
+ /**
71
+ * Programmatically activate the panel with the given name.
72
+ * @param {string} name - The `name` of the target `<el-tab-panel>`.
73
+ * @returns {void}
74
+ */
75
+ selectTab(name) {
76
+ this.selected = name;
77
+ }
78
+
79
+ /** @private */
80
+ updateSelection() {
81
+ for (const tabLink of this.tabLinks) {
82
+ const panelName = tabLink.getAttribute('for');
83
+ if (panelName === this.selected) {
84
+ tabLink._internals.states.add('active');
85
+ } else {
86
+ tabLink._internals.states.delete('active');
87
+ }
88
+ }
89
+
90
+ for (const tabPanel of this.tabPanels) {
91
+ const panelName = tabPanel.getAttribute('name');
92
+ tabPanel.style['display'] = panelName === this.selected ? 'block' : 'none';
93
+ }
94
+ }
95
+
96
+ /** @private */
97
+ queryTabLinks() {
98
+ return this.querySelectorAll(this.linkSelector);
99
+ }
100
+
101
+ /** @private */
102
+ queryTabPanels() {
103
+ return this.querySelectorAll(this.panelSelector);
104
+ }
105
+ }
106
+
107
+ export function define() {
108
+ defineElement('el-tab-group', TabGroup);
109
+ }
@@ -0,0 +1,61 @@
1
+ # TabGroup
2
+
3
+ `tab-group` is a container that pairs `<el-tab-link>` children with `<el-tab-panel>` children and shows one panel at a time. It listens for `tab-select` events bubbled from `<el-tab-link>` and mirrors the active selection onto the `selected` attribute (reflected). When no tab is selected declaratively, the first panel is shown.
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/tab-group/define';
17
+ ```
18
+
19
+ ```html
20
+ <el-tab-group selected="general">
21
+ <el-tab-link for="general">General</el-tab-link>
22
+ <el-tab-link for="custom">Custom</el-tab-link>
23
+ <el-tab-link for="advanced">Advanced</el-tab-link>
24
+ <el-tab-link for="disabled" disabled>Disabled</el-tab-link>
25
+
26
+ <el-tab-panel name="general">This is the general tab panel.</el-tab-panel>
27
+ <el-tab-panel name="custom">This is the custom tab panel.</el-tab-panel>
28
+ <el-tab-panel name="advanced">This is the advanced tab panel.</el-tab-panel>
29
+ <el-tab-panel name="disabled">This is a disabled tab panel.</el-tab-panel>
30
+ </el-tab-group>
31
+ ```
32
+
33
+ ## API
34
+
35
+ #### Properties/Attributes
36
+
37
+ | Name | Type | Default | Description |
38
+ | --- | --- | --- | --- |
39
+ | `selected` | `string \| undefined` | `undefined` | Name of the currently selected tab. Matches an `<el-tab-panel>`'s `name`. Reflected to the `selected` attribute. |
40
+ | `linkSelector` | `string` | `'el-tab-link'` | Selector used to find tab link children. |
41
+ | `panelSelector` | `string` | `'el-tab-panel'` | Selector used to find tab panel children. |
42
+
43
+ #### Methods
44
+
45
+ | Name | Parameters | Description |
46
+ | ----------------- | -------------- | -------------------------------------------------------- |
47
+ | `selectTab(name)` | `name: string` | Programmatically activate the panel with the given name. |
48
+
49
+ #### Events
50
+
51
+ _None_ (listens to `tab-select` events from child `<el-tab-link>` elements)
52
+
53
+ #### CSS Custom Properties
54
+
55
+ _None_
56
+
57
+ #### Slots
58
+
59
+ | Name | Description |
60
+ | ----------- | -------------------------------------------------- |
61
+ | _(default)_ | The `<el-tab-link>` and `<el-tab-panel>` children. |
@@ -0,0 +1,7 @@
1
+ const css = String.raw;
2
+
3
+ export default css`
4
+ el-tab-group {
5
+ display: block;
6
+ }
7
+ `;
@@ -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
+ ### Changed
18
+
19
+ - BREAKING: the active state is now exposed as a custom state (`:state(active)`) instead of the `[active]` attribute. `<el-tab-group>` toggles it on each link as the selection changes. Consumers should use `el-tab-link:state(active) { … }`.
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-11-10
32
+
33
+ ### Added
34
+
35
+ - initial release
@@ -0,0 +1,3 @@
1
+ import { define } from './tab-link.js';
2
+
3
+ define();
@@ -0,0 +1,50 @@
1
+ import { StyledElement, defineElement } from '@webtides/element-js';
2
+ import style from './tab-link.style.js';
3
+
4
+ /**
5
+ * Clickable label for a `<el-tab-panel>`. Dispatches a bubbling `tab-select` event with
6
+ * `detail.selected` set to its `for` attribute when clicked (unless `disabled`). Used
7
+ * inside `<el-tab-group>`.
8
+ *
9
+ * @element el-tab-link
10
+ *
11
+ * @fires {CustomEvent<{ selected: string }>} tab-select - Fired on click. `detail.selected`
12
+ * is the `for` value, used by `<el-tab-group>` to activate the matching panel. Bubbles
13
+ * and crosses shadow boundaries.
14
+ *
15
+ * @slot - Default slot for the tab label content.
16
+ *
17
+ * @cssstate active - Set by the parent `<el-tab-group>` while this link's panel is the
18
+ * selected one. Style with `el-tab-link:state(active) { … }`.
19
+ *
20
+ * @property {string | undefined} for - Name of the panel this link activates (matches a
21
+ * `<el-tab-panel>`'s `name`).
22
+ */
23
+ export default class TabLink extends StyledElement {
24
+ constructor() {
25
+ super({ styles: [style] });
26
+ }
27
+
28
+ properties() {
29
+ return {
30
+ for: undefined,
31
+ };
32
+ }
33
+
34
+ events() {
35
+ return {
36
+ this: {
37
+ click: (event) => {
38
+ event.preventDefault();
39
+ event.stopPropagation();
40
+ if (this.hasAttribute('disabled')) return;
41
+ this.dispatch('tab-select', { selected: this.for });
42
+ },
43
+ },
44
+ };
45
+ }
46
+ }
47
+
48
+ export function define() {
49
+ defineElement('el-tab-link', TabLink);
50
+ }
@@ -0,0 +1,66 @@
1
+ # TabLink
2
+
3
+ `tab-link` is a clickable label for a `<el-tab-panel>`. It dispatches a bubbling `tab-select` event with `detail.selected` set to its `for` attribute when clicked (unless `disabled`). It is used inside a `<el-tab-group>`.
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/tab-link/define';
17
+ ```
18
+
19
+ ```html
20
+ <el-tab-group selected="general">
21
+ <el-tab-link for="general">General</el-tab-link>
22
+ <el-tab-link for="custom">Custom</el-tab-link>
23
+ <el-tab-link for="advanced">Advanced</el-tab-link>
24
+ <el-tab-link for="disabled" disabled>Disabled</el-tab-link>
25
+
26
+ <el-tab-panel name="general">This is the general tab panel.</el-tab-panel>
27
+ <el-tab-panel name="custom">This is the custom tab panel.</el-tab-panel>
28
+ <el-tab-panel name="advanced">This is the advanced tab panel.</el-tab-panel>
29
+ <el-tab-panel name="disabled">This is a disabled tab panel.</el-tab-panel>
30
+ </el-tab-group>
31
+ ```
32
+
33
+ ## API
34
+
35
+ #### Properties/Attributes
36
+
37
+ | Name | Type | Default | Description |
38
+ | --- | --- | --- | --- |
39
+ | `for` | `string \| undefined` | `undefined` | Name of the panel this link activates (matches an `<el-tab-panel>`'s `name`). |
40
+ | `disabled` | `boolean` | `false` | When present, the link does not dispatch `tab-select` on click. |
41
+
42
+ #### Methods
43
+
44
+ _None_
45
+
46
+ #### Events
47
+
48
+ | Name | Detail | Description |
49
+ | --- | --- | --- |
50
+ | `tab-select` | `{ selected: string }` | Fired on click. `detail.selected` is the `for` value, used by `<el-tab-group>` to activate the matching panel. Bubbles and crosses shadow boundaries. |
51
+
52
+ #### CSS Custom Properties
53
+
54
+ This component is headless by default and reads the library's `--el-*` design tokens (e.g. `--el-color-accent`, `--el-color-fg`, `--el-border-width`). Skin it by setting these via a theme — see the Storybook _Docs / Theming_ page.
55
+
56
+ #### CSS States
57
+
58
+ | Name | Description |
59
+ | --- | --- |
60
+ | `active` | Set by the parent `<el-tab-group>` while this link's panel is the selected one. Style with `el-tab-link:state(active) { … }`. |
61
+
62
+ #### Slots
63
+
64
+ | Name | Description |
65
+ | ----------- | ---------------------- |
66
+ | _(default)_ | The tab label content. |
@@ -0,0 +1,32 @@
1
+ const css = String.raw;
2
+
3
+ export default css`
4
+ el-tab-link {
5
+ display: inline-block;
6
+ padding: var(--el-space-2, 0) var(--el-space-3, 0);
7
+ color: var(--el-color-fg-muted, inherit);
8
+ background: var(--el-color-bg, transparent);
9
+ border: var(--el-border-width, 0) solid var(--el-color-border, transparent);
10
+ border-radius: var(--el-radius-sm, 0);
11
+ transition:
12
+ color var(--el-duration-md, 0s) var(--el-ease, linear),
13
+ background-color var(--el-duration-md, 0s) var(--el-ease, linear),
14
+ border-color var(--el-duration-md, 0s) var(--el-ease, linear);
15
+
16
+ &:hover {
17
+ cursor: pointer;
18
+ color: var(--el-color-fg, inherit);
19
+ }
20
+
21
+ &:state(active) {
22
+ color: var(--el-color-fg, inherit);
23
+ background: var(--el-color-bg-muted, transparent);
24
+ border-color: var(--el-color-accent, transparent);
25
+ }
26
+
27
+ &[disabled] {
28
+ opacity: 0.5;
29
+ cursor: not-allowed;
30
+ }
31
+ }
32
+ `;
@@ -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-11-10
36
+
37
+ ### Added
38
+
39
+ - initial release
@@ -0,0 +1,3 @@
1
+ import { define } from './tab-panel.js';
2
+
3
+ define();
@@ -0,0 +1,30 @@
1
+ import { StyledElement, defineElement } from '@webtides/element-js';
2
+ import style from './tab-panel.style.js';
3
+
4
+ /**
5
+ * Content panel paired with an `<el-tab-link>` by `name`. Visibility is driven by the
6
+ * parent `<el-tab-group>`, which toggles `display: block / none` based on the active
7
+ * selection.
8
+ *
9
+ * @element el-tab-panel
10
+ *
11
+ * @slot - Default slot for the panel's content.
12
+ *
13
+ * @property {string | undefined} name - Identifier matched by a `<el-tab-link for="…">` to
14
+ * activate this panel.
15
+ */
16
+ export default class TabPanel extends StyledElement {
17
+ constructor() {
18
+ super({ styles: [style] });
19
+ }
20
+
21
+ properties() {
22
+ return {
23
+ name: undefined,
24
+ };
25
+ }
26
+ }
27
+
28
+ export function define() {
29
+ defineElement('el-tab-panel', TabPanel);
30
+ }
@@ -0,0 +1,57 @@
1
+ # TabPanel
2
+
3
+ `tab-panel` contains the content associated with a tab. It is paired with an `<el-tab-link>` by `name`, and its visibility is driven by the parent `<el-tab-group>`, which toggles `display: block / none` based on the active selection.
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/tab-panel/define';
17
+ ```
18
+
19
+ ```html
20
+ <el-tab-group selected="general">
21
+ <el-tab-link for="general">General</el-tab-link>
22
+ <el-tab-link for="custom">Custom</el-tab-link>
23
+ <el-tab-link for="advanced">Advanced</el-tab-link>
24
+ <el-tab-link for="disabled" disabled>Disabled</el-tab-link>
25
+
26
+ <el-tab-panel name="general">This is the general tab panel.</el-tab-panel>
27
+ <el-tab-panel name="custom">This is the custom tab panel.</el-tab-panel>
28
+ <el-tab-panel name="advanced">This is the advanced tab panel.</el-tab-panel>
29
+ <el-tab-panel name="disabled">This is a disabled tab panel.</el-tab-panel>
30
+ </el-tab-group>
31
+ ```
32
+
33
+ ## API
34
+
35
+ #### Properties/Attributes
36
+
37
+ | Name | Type | Default | Description |
38
+ | --- | --- | --- | --- |
39
+ | `name` | `string \| undefined` | `undefined` | Identifier matched by an `<el-tab-link for="…">` to activate this panel. |
40
+
41
+ #### Methods
42
+
43
+ _None_
44
+
45
+ #### Events
46
+
47
+ _None_
48
+
49
+ #### CSS Custom Properties
50
+
51
+ _None_
52
+
53
+ #### Slots
54
+
55
+ | Name | Description |
56
+ | ----------- | -------------------- |
57
+ | _(default)_ | The panel's content. |
@@ -0,0 +1,7 @@
1
+ const css = String.raw;
2
+
3
+ export default css`
4
+ el-tab-panel {
5
+ display: block;
6
+ }
7
+ `;