@webtides/element-library 0.3.0 → 0.4.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 (199) hide show
  1. package/CHANGELOG.md +208 -0
  2. package/README.md +72 -56
  3. package/all.js +16 -0
  4. package/catalog.js +17 -1
  5. package/custom-elements.json +14731 -10193
  6. package/package.json +1 -1
  7. package/src/components/accordion/accordion.changelog.md +11 -0
  8. package/src/components/accordion/accordion.js +15 -3
  9. package/src/components/accordion/accordion.readme.md +27 -1
  10. package/src/components/accordion/accordion.style.js +19 -0
  11. package/src/components/app-bar/app-bar.changelog.md +24 -0
  12. package/src/components/app-bar/app-bar.define.js +3 -0
  13. package/src/components/app-bar/app-bar.js +91 -0
  14. package/src/components/app-bar/app-bar.readme.md +130 -0
  15. package/src/components/app-bar/app-bar.style.js +103 -0
  16. package/src/components/app-frame/app-frame.changelog.md +45 -0
  17. package/src/components/app-frame/app-frame.define.js +3 -0
  18. package/src/components/app-frame/app-frame.events.js +6 -0
  19. package/src/components/app-frame/app-frame.js +1073 -0
  20. package/src/components/app-frame/app-frame.readme.md +416 -0
  21. package/src/components/app-frame/app-frame.style.js +527 -0
  22. package/src/components/button/button.changelog.md +25 -0
  23. package/src/components/button/button.events.js +3 -0
  24. package/src/components/button/button.js +209 -14
  25. package/src/components/button/button.readme.md +82 -6
  26. package/src/components/button/button.style.js +161 -7
  27. package/src/components/checkbox-field/checkbox-field.changelog.md +6 -0
  28. package/src/components/checkbox-field/checkbox-field.js +7 -1
  29. package/src/components/description-list/description-list.changelog.md +25 -0
  30. package/src/components/description-list/description-list.define.js +3 -0
  31. package/src/components/description-list/description-list.js +44 -0
  32. package/src/components/description-list/description-list.readme.md +135 -0
  33. package/src/components/description-list/description-list.style.js +140 -0
  34. package/src/components/dialog/dialog.changelog.md +7 -0
  35. package/src/components/dialog/dialog.readme.md +5 -0
  36. package/src/components/dialog/dialog.style.js +17 -2
  37. package/src/components/drawer/drawer.changelog.md +7 -0
  38. package/src/components/drawer/drawer.readme.md +7 -6
  39. package/src/components/drawer/drawer.style.js +35 -2
  40. package/src/components/dropdown/dropdown.readme.md +6 -1
  41. package/src/components/list/list.changelog.md +24 -0
  42. package/src/components/list/list.define.js +3 -0
  43. package/src/components/list/list.js +66 -0
  44. package/src/components/list/list.readme.md +122 -0
  45. package/src/components/list/list.style.js +56 -0
  46. package/src/components/list-item/list-item.changelog.md +24 -0
  47. package/src/components/list-item/list-item.define.js +3 -0
  48. package/src/components/list-item/list-item.js +128 -0
  49. package/src/components/list-item/list-item.readme.md +126 -0
  50. package/src/components/list-item/list-item.style.js +234 -0
  51. package/src/components/menu/menu.changelog.md +27 -0
  52. package/src/components/menu/menu.define.js +3 -0
  53. package/src/components/menu/menu.events.js +5 -0
  54. package/src/components/menu/menu.js +570 -0
  55. package/src/components/menu/menu.readme.md +272 -0
  56. package/src/components/menu/menu.style.js +55 -0
  57. package/src/components/menu-group/menu-group.changelog.md +20 -0
  58. package/src/components/menu-group/menu-group.define.js +3 -0
  59. package/src/components/menu-group/menu-group.js +44 -0
  60. package/src/components/menu-group/menu-group.readme.md +74 -0
  61. package/src/components/menu-group/menu-group.style.js +38 -0
  62. package/src/components/menu-item/menu-item.changelog.md +24 -0
  63. package/src/components/menu-item/menu-item.define.js +3 -0
  64. package/src/components/menu-item/menu-item.js +130 -0
  65. package/src/components/menu-item/menu-item.readme.md +94 -0
  66. package/src/components/menu-item/menu-item.style.js +87 -0
  67. package/src/components/nav/nav.changelog.md +35 -0
  68. package/src/components/nav/nav.define.js +3 -0
  69. package/src/components/nav/nav.js +212 -0
  70. package/src/components/nav/nav.readme.md +248 -0
  71. package/src/components/nav/nav.style.js +269 -0
  72. package/src/components/nav-item/nav-item.changelog.md +25 -0
  73. package/src/components/nav-item/nav-item.define.js +3 -0
  74. package/src/components/nav-item/nav-item.js +75 -0
  75. package/src/components/nav-item/nav-item.readme.md +111 -0
  76. package/src/components/nav-item/nav-item.style.js +159 -0
  77. package/src/components/pagination/pagination.changelog.md +8 -0
  78. package/src/components/pagination/pagination.js +123 -49
  79. package/src/components/pagination/pagination.readme.md +24 -6
  80. package/src/components/pagination/pagination.style.js +11 -1
  81. package/src/components/scroll-to-top/scroll-to-top.changelog.md +7 -5
  82. package/src/components/scroll-to-top/scroll-to-top.js +16 -12
  83. package/src/components/scroll-to-top/scroll-to-top.readme.md +2 -0
  84. package/src/components/segmented-field/segmented-field.changelog.md +27 -0
  85. package/src/components/segmented-field/segmented-field.define.js +3 -0
  86. package/src/components/segmented-field/segmented-field.js +175 -0
  87. package/src/components/segmented-field/segmented-field.readme.md +140 -0
  88. package/src/components/segmented-field/segmented-field.style.js +193 -0
  89. package/src/components/splitter/splitter.changelog.md +24 -0
  90. package/src/components/splitter/splitter.define.js +3 -0
  91. package/src/components/splitter/splitter.events.js +4 -0
  92. package/src/components/splitter/splitter.js +237 -0
  93. package/src/components/splitter/splitter.readme.md +164 -0
  94. package/src/components/splitter/splitter.style.js +100 -0
  95. package/src/components/status-bar/status-bar.changelog.md +25 -0
  96. package/src/components/status-bar/status-bar.define.js +3 -0
  97. package/src/components/status-bar/status-bar.js +74 -0
  98. package/src/components/status-bar/status-bar.readme.md +139 -0
  99. package/src/components/status-bar/status-bar.style.js +122 -0
  100. package/src/components/switch-field/switch-field.changelog.md +6 -0
  101. package/src/components/switch-field/switch-field.js +7 -1
  102. package/src/components/tab-group/tab-group.changelog.md +7 -0
  103. package/src/components/tab-group/tab-group.js +30 -9
  104. package/src/components/tab-group/tab-group.readme.md +14 -0
  105. package/src/components/toast/toast.changelog.md +6 -0
  106. package/src/components/toast/toast.readme.md +5 -3
  107. package/src/components/toast/toast.style.js +22 -6
  108. package/src/components/toolbar/toolbar.changelog.md +24 -0
  109. package/src/components/toolbar/toolbar.define.js +3 -0
  110. package/src/components/toolbar/toolbar.js +233 -0
  111. package/src/components/toolbar/toolbar.readme.md +156 -0
  112. package/src/components/toolbar/toolbar.style.js +49 -0
  113. package/src/components/tooltip/tooltip.changelog.md +11 -0
  114. package/src/components/tooltip/tooltip.js +51 -4
  115. package/src/components/tooltip/tooltip.readme.md +26 -1
  116. package/src/components/tree/tree.changelog.md +23 -0
  117. package/src/components/tree/tree.define.js +3 -0
  118. package/src/components/tree/tree.js +138 -0
  119. package/src/components/tree/tree.readme.md +119 -0
  120. package/src/components/tree/tree.style.js +16 -0
  121. package/src/components/tree-item/tree-item.changelog.md +23 -0
  122. package/src/components/tree-item/tree-item.define.js +3 -0
  123. package/src/components/tree-item/tree-item.events.js +3 -0
  124. package/src/components/tree-item/tree-item.js +246 -0
  125. package/src/components/tree-item/tree-item.readme.md +128 -0
  126. package/src/components/tree-item/tree-item.style.js +226 -0
  127. package/src/styles/appearance.style.js +47 -0
  128. package/src/styles/choice-group.style.js +1 -1
  129. package/src/styles/modal.style.js +14 -1
  130. package/src/styles/size.style.js +41 -0
  131. package/src/utils/focus.js +69 -0
  132. package/src/utils/scroll.js +24 -0
  133. package/types/all.d.ts +16 -0
  134. package/types/src/components/accordion/accordion.d.ts +3 -1
  135. package/types/src/components/app-bar/app-bar.d.ts +43 -0
  136. package/types/src/components/app-bar/app-bar.define.d.ts +1 -0
  137. package/types/src/components/app-bar/app-bar.style.d.ts +2 -0
  138. package/types/src/components/app-frame/app-frame.d.ts +491 -0
  139. package/types/src/components/app-frame/app-frame.define.d.ts +1 -0
  140. package/types/src/components/app-frame/app-frame.events.d.ts +7 -0
  141. package/types/src/components/app-frame/app-frame.style.d.ts +8 -0
  142. package/types/src/components/button/button.d.ts +97 -7
  143. package/types/src/components/button/button.events.d.ts +4 -0
  144. package/types/src/components/description-list/description-list.d.ts +29 -0
  145. package/types/src/components/description-list/description-list.define.d.ts +1 -0
  146. package/types/src/components/description-list/description-list.style.d.ts +2 -0
  147. package/types/src/components/list/list.d.ts +39 -0
  148. package/types/src/components/list/list.define.d.ts +1 -0
  149. package/types/src/components/list/list.style.d.ts +2 -0
  150. package/types/src/components/list-item/list-item.d.ts +62 -0
  151. package/types/src/components/list-item/list-item.define.d.ts +1 -0
  152. package/types/src/components/list-item/list-item.style.d.ts +2 -0
  153. package/types/src/components/menu/menu.d.ts +266 -0
  154. package/types/src/components/menu/menu.define.d.ts +1 -0
  155. package/types/src/components/menu/menu.events.d.ts +6 -0
  156. package/types/src/components/menu/menu.style.d.ts +2 -0
  157. package/types/src/components/menu-group/menu-group.d.ts +24 -0
  158. package/types/src/components/menu-group/menu-group.define.d.ts +1 -0
  159. package/types/src/components/menu-group/menu-group.style.d.ts +2 -0
  160. package/types/src/components/menu-item/menu-item.d.ts +59 -0
  161. package/types/src/components/menu-item/menu-item.define.d.ts +1 -0
  162. package/types/src/components/menu-item/menu-item.style.d.ts +2 -0
  163. package/types/src/components/nav/nav.d.ts +103 -0
  164. package/types/src/components/nav/nav.define.d.ts +1 -0
  165. package/types/src/components/nav/nav.style.d.ts +2 -0
  166. package/types/src/components/nav-item/nav-item.d.ts +39 -0
  167. package/types/src/components/nav-item/nav-item.define.d.ts +1 -0
  168. package/types/src/components/nav-item/nav-item.style.d.ts +2 -0
  169. package/types/src/components/pagination/pagination.d.ts +31 -2
  170. package/types/src/components/scroll-to-top/scroll-to-top.d.ts +6 -5
  171. package/types/src/components/segmented-field/segmented-field.d.ts +85 -0
  172. package/types/src/components/segmented-field/segmented-field.define.d.ts +1 -0
  173. package/types/src/components/segmented-field/segmented-field.style.d.ts +2 -0
  174. package/types/src/components/splitter/splitter.d.ts +127 -0
  175. package/types/src/components/splitter/splitter.define.d.ts +1 -0
  176. package/types/src/components/splitter/splitter.events.d.ts +5 -0
  177. package/types/src/components/splitter/splitter.style.d.ts +2 -0
  178. package/types/src/components/status-bar/status-bar.d.ts +44 -0
  179. package/types/src/components/status-bar/status-bar.define.d.ts +1 -0
  180. package/types/src/components/status-bar/status-bar.style.d.ts +2 -0
  181. package/types/src/components/tab-group/tab-group.d.ts +17 -0
  182. package/types/src/components/toolbar/toolbar.d.ts +96 -0
  183. package/types/src/components/toolbar/toolbar.define.d.ts +1 -0
  184. package/types/src/components/toolbar/toolbar.style.d.ts +2 -0
  185. package/types/src/components/tooltip/tooltip.d.ts +26 -0
  186. package/types/src/components/tree/tree.d.ts +62 -0
  187. package/types/src/components/tree/tree.define.d.ts +1 -0
  188. package/types/src/components/tree/tree.style.d.ts +2 -0
  189. package/types/src/components/tree-item/tree-item.d.ts +106 -0
  190. package/types/src/components/tree-item/tree-item.define.d.ts +1 -0
  191. package/types/src/components/tree-item/tree-item.events.d.ts +4 -0
  192. package/types/src/components/tree-item/tree-item.style.d.ts +2 -0
  193. package/types/src/styles/appearance.style.d.ts +31 -0
  194. package/types/src/styles/choice-group.style.d.ts +1 -1
  195. package/types/src/styles/modal.style.d.ts +5 -0
  196. package/types/src/styles/size.style.d.ts +24 -0
  197. package/types/src/utils/focus.d.ts +25 -0
  198. package/types/src/utils/scroll.d.ts +11 -0
  199. package/web-types.json +2530 -393
@@ -11,6 +11,13 @@ const style = css`
11
11
  vertical-align: middle;
12
12
  }
13
13
 
14
+ /* The button that opens the navigation of an el-app-frame is not there where the navigation
15
+ is a column beside the content. The frame says so in a property that is inherited, so this
16
+ holds before any script has run. Outside of a frame the button is as any other. */
17
+ :host([data-navigation-toggle]) {
18
+ display: var(--_el-context-navigation-toggle-display, inline-block);
19
+ }
20
+
14
21
  /* ── Base control ─────────────────────────────────────────────────────── */
15
22
 
16
23
  .button {
@@ -23,8 +30,14 @@ const style = css`
23
30
  justify-content: center;
24
31
  gap: var(--el-space-2, 0.5em);
25
32
  width: 100%;
26
- min-height: var(--_el-size-height);
27
- padding: var(--_el-size-padding-block) var(--_el-size-padding-inline);
33
+ /* The size of the button: its own, from the size module. A button in a toolbar reads the
34
+ size of the toolbar first, see "In a container" below. */
35
+ --_el-button-height: var(--_el-size-height);
36
+ --_el-button-padding-block: var(--_el-size-padding-block);
37
+ --_el-button-padding-inline: var(--_el-size-padding-inline);
38
+ --_el-button-font-size: var(--_el-size-font-size);
39
+ min-height: var(--_el-button-height);
40
+ padding: var(--_el-button-padding-block) var(--_el-button-padding-inline);
28
41
  border: var(--el-border-width, 1px) solid transparent;
29
42
  /* The radius of the shape on all four corners. A row of joined buttons (el-button-group)
30
43
  takes it away from the corners that face a neighbour, with --_el-group-radius-start
@@ -35,7 +48,7 @@ const style = css`
35
48
  border-start-end-radius: var(--_el-group-radius-end, var(--_el-button-radius));
36
49
  border-end-end-radius: var(--_el-group-radius-end, var(--_el-button-radius));
37
50
  font-family: var(--el-font-family, inherit);
38
- font-size: var(--_el-size-font-size);
51
+ font-size: var(--_el-button-font-size);
39
52
  font-weight: 600;
40
53
  line-height: var(--el-line-height, 1.5);
41
54
  text-align: center;
@@ -82,7 +95,9 @@ const style = css`
82
95
  gives it one. */
83
96
  .button:focus-visible {
84
97
  outline: var(--el-focus-ring-width, 2px) solid var(--el-color-focus-ring, transparent);
85
- outline-offset: var(--el-focus-ring-offset, 2px);
98
+ /* A container that has the edge of the screen around it, an el-status-bar, says where the
99
+ ring is: inside of the button. */
100
+ outline-offset: var(--_el-context-focus-ring-offset, var(--el-focus-ring-offset, 2px));
86
101
  }
87
102
 
88
103
  /* Without a theme the ring is inside of the control, in the colour of the label. Nothing says
@@ -124,6 +139,54 @@ const style = css`
124
139
  text-decoration: underline;
125
140
  }
126
141
 
142
+ /* ── Pressed ──────────────────────────────────────────────────────────── */
143
+
144
+ /* A toggle button that is pressed (aria-pressed, from the toggle property or from the page)
145
+ has a ring inside of its edge, in the colour of its label. The ring is a shape, so it tells
146
+ the button apart in every variant and appearance, and without a colour to rely on: it is a
147
+ border, which forced colours keep. It has the corners of the button, the joined ones of a
148
+ group as well, and leaves the border of the button alone: the line to a neighbour stays. */
149
+ .button[aria-pressed='true']::before {
150
+ content: '';
151
+ position: absolute;
152
+ inset: 0;
153
+ border: 0.125rem solid currentColor;
154
+ border-radius: inherit;
155
+ pointer-events: none;
156
+ }
157
+
158
+ /* A button without a fill gets a tint of its text colour as well, one step more than under
159
+ the pointer. A fill is not changed: the text on it would lose contrast. */
160
+ :host([appearance='outlined']) .button[aria-pressed='true'],
161
+ :host([appearance='plain']) .button[aria-pressed='true'] {
162
+ background: color-mix(in srgb, currentColor 16%, transparent);
163
+ }
164
+
165
+ @media (hover: hover) {
166
+ :host([appearance='outlined']) .button[aria-pressed='true']:hover,
167
+ :host([appearance='plain']) .button[aria-pressed='true']:hover {
168
+ background: color-mix(in srgb, currentColor 20%, transparent);
169
+ }
170
+ }
171
+
172
+ :host([appearance='outlined']) .button[aria-pressed='true']:active,
173
+ :host([appearance='plain']) .button[aria-pressed='true']:active {
174
+ background: color-mix(in srgb, currentColor 28%, transparent);
175
+ }
176
+
177
+ /* Without a theme the focus ring is inside of the control as well. It moves further in, so a
178
+ pressed button with the focus shows two rings and not one that is a little wider. */
179
+ .button[aria-pressed='true']:focus-visible::after {
180
+ inset: calc(var(--el-border-width, 1px) + 0.25rem);
181
+ }
182
+
183
+ /* Forced colours leave the ring as the only mark: it is wider there. */
184
+ @media (forced-colors: active) {
185
+ .button[aria-pressed='true']::before {
186
+ border-width: 0.1875rem;
187
+ }
188
+ }
189
+
127
190
  /* ── Shapes ───────────────────────────────────────────────────────────── */
128
191
 
129
192
  .button--pill {
@@ -132,8 +195,8 @@ const style = css`
132
195
 
133
196
  .button--circle {
134
197
  --_el-button-radius: 50%;
135
- width: var(--_el-size-height);
136
- height: var(--_el-size-height);
198
+ width: var(--_el-button-height);
199
+ height: var(--_el-button-height);
137
200
  min-height: 0;
138
201
  padding: 0;
139
202
  aspect-ratio: 1;
@@ -151,6 +214,97 @@ const style = css`
151
214
  border-inline-start-color: var(--_el-group-divider, var(--_el-variant-fill-border));
152
215
  }
153
216
 
217
+ /* ── In a container ───────────────────────────────────────────────────── */
218
+
219
+ /* A container that gives its controls one size and one appearance, a toolbar, says so in
220
+ properties that are inherited (see sizeContextStyle() and appearanceContextStyle()). A
221
+ button reads them while the page has not set the attribute on the button itself: the
222
+ template marks the control then. Outside of such a container the properties are not set,
223
+ and every value below falls back to the one the button has without them. */
224
+
225
+ .button--inherit-size {
226
+ --_el-button-height: var(--_el-context-size-height, var(--_el-size-height));
227
+ --_el-button-padding-block: var(--_el-context-size-padding-block, var(--_el-size-padding-block));
228
+ --_el-button-padding-inline: var(--_el-context-size-padding-inline, var(--_el-size-padding-inline));
229
+ --_el-button-font-size: var(--_el-context-size-font-size, var(--_el-size-font-size));
230
+ }
231
+
232
+ /* The appearance of the container is a switch that is set or not. In front of a value it gives
233
+ a property that is valid only where the switch is set. */
234
+ .button--inherit-appearance {
235
+ --_el-button-if-plain: var(--_el-context-appearance-plain) transparent;
236
+ --_el-button-if-outlined: var(--_el-context-appearance-outlined) transparent;
237
+ --_el-button-if-outlined-border: var(--_el-context-appearance-outlined) var(--_el-variant-border);
238
+ --_el-button-if-plain-text: var(--_el-context-appearance-plain) var(--_el-variant-text);
239
+ --_el-button-if-outlined-text: var(--_el-context-appearance-outlined) var(--_el-variant-text);
240
+ --_el-button-if-plain-none: var(--_el-context-appearance-plain) none;
241
+ --_el-button-if-outlined-none: var(--_el-context-appearance-outlined) none;
242
+ }
243
+
244
+ /* The three colours of the appearance module, and the line to a neighbour in a group. The
245
+ rules weigh as much as the ones for a filled button and come after them. A button whose
246
+ appearance is its own has no mark, and keeps the rules of its attribute. */
247
+ :host .button--inherit-appearance {
248
+ background: var(--_el-button-if-plain, var(--_el-button-if-outlined, var(--_el-variant-fill)));
249
+ border-color: var(--_el-button-if-plain, var(--_el-button-if-outlined-border, var(--_el-variant-fill-border)));
250
+ border-inline-start-color: var(
251
+ --_el-button-if-plain,
252
+ var(--_el-button-if-outlined-border, var(--_el-group-divider, var(--_el-variant-fill-border)))
253
+ );
254
+ color: var(--_el-button-if-plain-text, var(--_el-button-if-outlined-text, var(--_el-variant-on-fill)));
255
+ }
256
+
257
+ /* Under the pointer and pressed down: a tint of the text colour where the button has no fill,
258
+ as an outlined button has. A plain button of a toolbar gets it as well: it is an icon as a
259
+ rule, and an icon has nothing to underline. */
260
+ @media (hover: hover) {
261
+ :host .button--inherit-appearance:hover {
262
+ --_el-button-if-plain-tint: var(--_el-context-appearance-plain)
263
+ color-mix(in srgb, currentColor 12%, transparent);
264
+ --_el-button-if-outlined-tint: var(--_el-context-appearance-outlined)
265
+ color-mix(in srgb, currentColor 12%, transparent);
266
+ background: var(--_el-button-if-plain-tint, var(--_el-button-if-outlined-tint, var(--_el-variant-fill)));
267
+ filter: var(--_el-button-if-plain-none, var(--_el-button-if-outlined-none, brightness(0.95)));
268
+ }
269
+ }
270
+
271
+ :host .button--inherit-appearance:active {
272
+ --_el-button-if-plain-tint: var(--_el-context-appearance-plain)
273
+ color-mix(in srgb, currentColor 24%, transparent);
274
+ --_el-button-if-outlined-tint: var(--_el-context-appearance-outlined)
275
+ color-mix(in srgb, currentColor 24%, transparent);
276
+ background: var(--_el-button-if-plain-tint, var(--_el-button-if-outlined-tint, var(--_el-variant-fill)));
277
+ filter: var(--_el-button-if-plain-none, var(--_el-button-if-outlined-none, brightness(0.88)));
278
+ }
279
+
280
+ /* A pressed toggle button: the tint of a button without a fill, one step more than under the
281
+ pointer. */
282
+ :host .button--inherit-appearance[aria-pressed='true'] {
283
+ --_el-button-if-plain-tint: var(--_el-context-appearance-plain)
284
+ color-mix(in srgb, currentColor 16%, transparent);
285
+ --_el-button-if-outlined-tint: var(--_el-context-appearance-outlined)
286
+ color-mix(in srgb, currentColor 16%, transparent);
287
+ background: var(--_el-button-if-plain-tint, var(--_el-button-if-outlined-tint, var(--_el-variant-fill)));
288
+ }
289
+
290
+ @media (hover: hover) {
291
+ :host .button--inherit-appearance[aria-pressed='true']:hover {
292
+ --_el-button-if-plain-tint: var(--_el-context-appearance-plain)
293
+ color-mix(in srgb, currentColor 20%, transparent);
294
+ --_el-button-if-outlined-tint: var(--_el-context-appearance-outlined)
295
+ color-mix(in srgb, currentColor 20%, transparent);
296
+ background: var(--_el-button-if-plain-tint, var(--_el-button-if-outlined-tint, var(--_el-variant-fill)));
297
+ }
298
+ }
299
+
300
+ :host .button--inherit-appearance[aria-pressed='true']:active {
301
+ --_el-button-if-plain-tint: var(--_el-context-appearance-plain)
302
+ color-mix(in srgb, currentColor 28%, transparent);
303
+ --_el-button-if-outlined-tint: var(--_el-context-appearance-outlined)
304
+ color-mix(in srgb, currentColor 28%, transparent);
305
+ background: var(--_el-button-if-plain-tint, var(--_el-button-if-outlined-tint, var(--_el-variant-fill)));
306
+ }
307
+
154
308
  /* ── Touch screens ────────────────────────────────────────────────────── */
155
309
 
156
310
  /* On a coarse pointer no size or shape falls below --el-touch-target in either direction.
@@ -158,7 +312,7 @@ const style = css`
158
312
  @media (any-pointer: coarse) {
159
313
  .button {
160
314
  min-width: var(--el-touch-target, auto);
161
- min-height: max(var(--_el-size-height), var(--el-touch-target, 0px));
315
+ min-height: max(var(--_el-button-height), var(--el-touch-target, 0px));
162
316
  }
163
317
 
164
318
  /* A circle has a fixed width and height. The minimum wins over both, so it stays round. */
@@ -12,6 +12,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
12
12
 
13
13
  ## Unreleased
14
14
 
15
+ ## [0.3.1] - 2026-11-17
16
+
17
+ ### Fixed
18
+
19
+ - `checked` set from outside moves the checkbox, also after the user has pressed it. The field wrote the `checked` attribute of its native input alone, which is the default of the control: after a press the control no longer follows it. `field.checked = false`, or the `checked` attribute, took the check mark away, while the native checkbox stayed checked and the form went on submitting the value. The field now writes the property of the input as well, before it dispatches `input-change`. ([#185](https://github.com/webtides/element-library/issues/185))
20
+
15
21
  ## [0.3.0] - 2026-11-17
16
22
 
17
23
  ### Changed
@@ -50,7 +50,13 @@ export default class CheckboxField extends FormField {
50
50
  this.setAttribute('checked', checked ? 'true' : 'false');
51
51
  if (checked) this._internals.states.add('checked');
52
52
  else this._internals.states.delete('checked');
53
- this.dispatch(FormFieldEvents.INPUT_CHANGE, this.$refs.input.value);
53
+ // The `checked` attribute the template writes is only the default of the control:
54
+ // once the user has pressed it, the browser no longer follows the attribute. So a
55
+ // state from outside is written to the control as well, before the event says
56
+ // that it has changed.
57
+ const input = this.$refs.input;
58
+ if (input.checked !== !!checked) input.checked = !!checked;
59
+ this.dispatch(FormFieldEvents.INPUT_CHANGE, input.value);
54
60
  },
55
61
  };
56
62
  }
@@ -0,0 +1,25 @@
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.4.0] - 2026-11-27
16
+
17
+ ### Added
18
+
19
+ - Initial `el-description-list`: rows of a name and its value, for a settings page or the page of an entry. The element is the native `<dl>` (it is inside of the shadow root), and the page writes the names as `<dt>` and the values as `<dd>` into it. ([#195](https://github.com/webtides/element-library/issues/195))
20
+ - Below 30rem of its own width a name stands above its value; from 30rem the two stand side by side, with the values of all rows on one line. The list measures itself (a container query), not the viewport.
21
+ - `--el-description-list-term-width` sets the width of the column of the names. Unset, it is as wide as the longest name, and 40% of the list at most.
22
+ - A `<dd data-action>` ends its row in an action, a link or a small button: at the end of the row, in the middle of the first line of the value. A row with a button is as high as a row without one.
23
+ - A row has `--el-space-3` above and below, and a line in `--el-color-border` above every row but the first, over the whole width. The line is not a border, so a reset of the page that takes the border off every element leaves it. Where the user forces colours it is drawn in the text colour of the system.
24
+ - A long value breaks, inside of a word where it has to: the list is never wider than its place.
25
+ - The list runs no script: a server-rendered list is laid out before the element takes over, and looks the same after.
@@ -0,0 +1,3 @@
1
+ import { define } from './description-list.js';
2
+
3
+ define();
@@ -0,0 +1,44 @@
1
+ import { TemplateElement, defineElement, html } from '@webtides/element-js';
2
+ import style from './description-list.style.js';
3
+
4
+ /**
5
+ * Rows of a name and its value, for a settings page or the page of an entry: the address, the
6
+ * plan, the day it was created. The element is the native `<dl>`; the page writes the names as
7
+ * `<dt>` and the values as `<dd>` into it, as it would into a `<dl>`.
8
+ *
9
+ * In a narrow place a name stands above its value. From a width of 30rem, which the list measures
10
+ * on itself, the two stand side by side, and the values of all rows begin on one line. A row can
11
+ * end in an action: a `<dd data-action>` with a link or a button in it.
12
+ *
13
+ * Pure presentation: the list runs no script of its own, so a server-rendered list is complete
14
+ * before the element takes over.
15
+ *
16
+ * @element el-description-list
17
+ *
18
+ * @slot - The rows: for each one a `<dt>` with the name, a `<dd>` with the value (or several),
19
+ * and, to end the row in an action, a `<dd data-action>` with a link or a button.
20
+ *
21
+ * @csspart base - The `<dl>`.
22
+ *
23
+ * @cssproperty --el-description-list-term-width - The width of the column of the names while
24
+ * names and values stand side by side. Unset, the column is as wide as the longest name, and
25
+ * 40% of the list at most.
26
+ */
27
+ export default class DescriptionList extends TemplateElement {
28
+ constructor() {
29
+ super({
30
+ styles: [style],
31
+ shadowRender: true,
32
+ });
33
+ }
34
+
35
+ template() {
36
+ // The list is inside of the shadow root, and the names and values of the page are its
37
+ // children by way of the slot: that is part of the server-rendered markup, and needs no script.
38
+ return html`<dl part="base" class="list"><slot></slot></dl>`;
39
+ }
40
+ }
41
+
42
+ export function define() {
43
+ defineElement('el-description-list', DescriptionList);
44
+ }
@@ -0,0 +1,135 @@
1
+ # DescriptionList
2
+
3
+ `description-list` shows values under their names: the address, the plan, the day an entry was created. It is the native `<dl>`; the page writes the names as `<dt>` and the values as `<dd>` into it. In a narrow place a name stands above its value, in a wide one the two stand side by side, with the values of all rows on one line. A row can end in an action.
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/description-list/define';
17
+ ```
18
+
19
+ ```html
20
+ <el-description-list>
21
+ <dt>Plan</dt>
22
+ <dd>Team, 12 seats</dd>
23
+ <dd data-action>
24
+ <el-button size="small" appearance="plain" href="/plan" aria-label="Change the plan">Change</el-button>
25
+ </dd>
26
+
27
+ <dt>Address</dt>
28
+ <dd>12 Garden Road<br />1017 Amsterdam</dd>
29
+
30
+ <dt>Created</dt>
31
+ <dd><time datetime="2026-03-12">12 March 2026</time></dd>
32
+ </el-description-list>
33
+ ```
34
+
35
+ ## API
36
+
37
+ #### Properties/Attributes
38
+
39
+ _None._
40
+
41
+ #### Methods
42
+
43
+ _None._
44
+
45
+ #### Events
46
+
47
+ _None._
48
+
49
+ #### Slots
50
+
51
+ | Name | Description |
52
+ | --- | --- |
53
+ | (default) | The rows: for each one a `<dt>` with the name, a `<dd>` with the value (or several), and, to end the row in an action, a `<dd data-action>`. |
54
+
55
+ #### CSS Parts
56
+
57
+ | Name | Description |
58
+ | ------ | ----------- |
59
+ | `base` | The `<dl>`. |
60
+
61
+ #### CSS Custom Properties
62
+
63
+ | Name | Default | Description |
64
+ | --- | --- | --- |
65
+ | `--el-description-list-term-width` | `fit-content(40%)` | The width of the column of the names while names and values stand side by side. Unset, the column is as wide as the longest name, and 40% of the list at most. |
66
+
67
+ ## What the page writes
68
+
69
+ The element takes the place of the `<dl>`: the `<dl>` itself is inside of the element, and what the page writes into the element are its children.
70
+
71
+ - A `<dt>` for the name, then a `<dd>` for the value. A row begins with its `<dt>`.
72
+ - A name can have several values, a `<dd>` each. Each of them has a row of its own, without a line above it.
73
+ - `<dt>` and `<dd>` are direct children of the element. A `<div>` around a name and its value, as a `<dl>` allows it, is not laid out: the list cannot reach into it.
74
+ - The look of a name and of a value is given to the elements of the page (`::slotted`). A rule of the page for `dt` or `dd` wins over it, property by property. What a reset usually sets on them (the box model, the border, the margin) is not used by the list, so it looks the same with and without one.
75
+
76
+ A tool that checks the markup of the page alone reports a `<dt>` that is not in a `<dl>`. In the tree the browser lays out and reads to assistive technology, it is.
77
+
78
+ ## Narrow and wide
79
+
80
+ The list measures its own width (a container query), not the one of the viewport. So it stacks in a narrow column of a wide page, a drawer for example.
81
+
82
+ - **Below 30rem** a name stands above its value, in the smaller and quieter text of the theme. An action stands at the end of the row, on the line of the value.
83
+ - **From 30rem** name and value stand side by side. The column of the names is as wide as the longest name, and 40% of the list at most; a longer name breaks. The values of all rows begin on one line, and the actions end on one.
84
+
85
+ `--el-description-list-term-width` sets the width of the names, so that two lists on a page have their values on one line:
86
+
87
+ ```css
88
+ el-description-list {
89
+ --el-description-list-term-width: 12rem;
90
+ }
91
+ ```
92
+
93
+ ## An action
94
+
95
+ A `<dd data-action>` ends its row in an action: a link, or a small plain button. It stands at the end of the row, in the middle of the first line of the value. A button is higher than a line of text; it reaches out of that line, and the row stays as high as a row without an action.
96
+
97
+ The action has to say what it changes. "Change" five times in a list tells a screen reader user nothing, who may reach the control without its row. Give it a name that starts with what can be seen and goes on with the name of the row:
98
+
99
+ ```html
100
+ <dd data-action><a href="/plan" aria-label="Change the plan">Change</a></dd>
101
+ ```
102
+
103
+ or with text that is not shown (`styles/utilities.css`):
104
+
105
+ ```html
106
+ <dd data-action>
107
+ <a href="/plan">Change<span class="el-visually-hidden"> the plan</span></a>
108
+ </dd>
109
+ ```
110
+
111
+ On a touch screen an `el-button` is at least `--el-touch-target` high and wide. A plain link is as large as its text.
112
+
113
+ ## Lines and spacing
114
+
115
+ A row has `--el-space-3` above and below, and between names and values is `--el-space-4`. Above every row but the first is a line in `--el-color-border`, `--el-border-width` high, over the whole width of the list. Without a theme the list has no line; the spacing falls back to `0.75rem` and `1rem`.
116
+
117
+ A long value breaks, inside of a word where it has to (a token, an address): the list is never wider than its place.
118
+
119
+ The list has no surface. Put it into an `el-card` for one. The `hidden` attribute hides it.
120
+
121
+ ## Accessibility
122
+
123
+ - The list is a `<dl>`, a name a `<dt>` and a value a `<dd>`: a screen reader announces a description list, and reads a value with its name.
124
+ - An action is a `<dd>` as well: it belongs to the name of its row.
125
+ - The line between two rows is drawn in the text colour of the system where the user forces colours.
126
+ - The list has no name of its own. Put a heading in front of it.
127
+
128
+ ## Server-side rendering
129
+
130
+ The `<dl>` is part of the server-rendered markup (Declarative Shadow DOM), and the names and the values are what the page wrote. The list runs no script: it is laid out, narrow or wide, before its JavaScript has loaded, and looks the same after.
131
+
132
+ ## What it is not
133
+
134
+ - No way to edit a value in place. An action leads to where the value is changed.
135
+ - No list of rows that are links as a whole: that is [`el-list`](../list/list.readme.md).
@@ -0,0 +1,140 @@
1
+ import hostStyle from '../../styles/host.style.js';
2
+
3
+ const css = String.raw;
4
+
5
+ /*
6
+ * The names and the values are elements of the page, slotted into the list. A rule for them here
7
+ * (::slotted) loses against every rule of the page for the same property, a reset included. So
8
+ * the rules below set what a reset leaves alone: the place in the grid, the padding, the text.
9
+ * The line between two rows is not a border for that reason.
10
+ */
11
+ const style = css`
12
+ /* The list measures its own width: the layout follows the place the list has, not the
13
+ viewport. */
14
+ :host {
15
+ display: block;
16
+ container-type: inline-size;
17
+ }
18
+
19
+ .list {
20
+ --_el-description-list-padding: var(--el-space-3, 0.75rem);
21
+ --_el-description-list-gap: var(--el-space-4, 1rem);
22
+
23
+ display: grid;
24
+ /* A name above its value. The second column is the one of the actions; without an action
25
+ it has no width. */
26
+ grid-template-columns: minmax(0, 1fr) auto;
27
+ align-items: start;
28
+ /* The lines between the rows are placed from here. */
29
+ position: relative;
30
+ margin: 0;
31
+ color: var(--el-color-fg, inherit);
32
+ font-family: var(--el-font-family, inherit);
33
+ font-size: var(--el-font-size-md, inherit);
34
+ line-height: var(--el-line-height, inherit);
35
+ }
36
+
37
+ /* ── Name ─────────────────────────────────────────────────────────────── */
38
+
39
+ /* Quieter than its value. Its line is as high as a line of the value, so the two stand on
40
+ one line side by side without being moved against each other. */
41
+ ::slotted(dt) {
42
+ grid-column: 1 / -1;
43
+ min-width: 0;
44
+ margin: 0;
45
+ padding-block-start: var(--_el-description-list-padding);
46
+ color: var(--el-color-fg-muted, inherit);
47
+ font-size: var(--el-font-size-sm, 0.875em);
48
+ line-height: 1lh;
49
+ overflow-wrap: anywhere;
50
+ }
51
+
52
+ /* ── Value ────────────────────────────────────────────────────────────── */
53
+
54
+ /* A long value breaks, inside of a word where it has to: it cannot widen the list. The margin
55
+ is the one the browser gives a dd. */
56
+ ::slotted(dd) {
57
+ grid-column: 1;
58
+ min-width: 0;
59
+ margin: 0;
60
+ padding-block-end: var(--_el-description-list-padding);
61
+ overflow-wrap: anywhere;
62
+ }
63
+
64
+ /* ── Action ───────────────────────────────────────────────────────────── */
65
+
66
+ /* At the end of the row, as high as one line of the value and with its content in the middle
67
+ of that line. A button is higher than a line: it reaches out of the box above and below, and
68
+ the row stays as high as a row without an action. The box has no padding above and below,
69
+ so its height is the same whichever way the page counts the sizes of its elements. */
70
+ ::slotted(dd[data-action]) {
71
+ grid-column: 2;
72
+ display: flex;
73
+ align-items: center;
74
+ height: 1lh;
75
+ padding-block: 0;
76
+ padding-inline-start: var(--_el-description-list-gap);
77
+ overflow-wrap: normal;
78
+ white-space: nowrap;
79
+ }
80
+
81
+ /* ── Line between two rows ────────────────────────────────────────────── */
82
+
83
+ /* A row begins with its name, and the line above a row is drawn by that name: over the whole
84
+ width of the list, at the upper edge of the name. It is a box with a height and a fill, not
85
+ a border: a reset of the page that takes the border off every element reaches the name and
86
+ what it generates, and wins there. Without a theme the line has no height. */
87
+ ::slotted(dt)::before {
88
+ content: '';
89
+ position: absolute;
90
+ inset-inline: 0;
91
+ height: var(--el-border-width, 0);
92
+ margin-block-start: calc(-1 * var(--_el-description-list-padding));
93
+ background: var(--el-color-border, transparent);
94
+ }
95
+
96
+ /* Nothing stands above the first row. */
97
+ ::slotted(dt:first-child)::before {
98
+ content: none;
99
+ }
100
+
101
+ /* Forced colours take a fill away, and keep one that is a colour of the system. */
102
+ @media (forced-colors: active) {
103
+ ::slotted(dt)::before {
104
+ background: CanvasText;
105
+ }
106
+ }
107
+
108
+ /* ── Side by side ─────────────────────────────────────────────────────── */
109
+
110
+ /* From 30rem of the list itself: a column for the names, one for the values and one for the
111
+ actions. The values of all rows begin on one line. */
112
+ @container (min-width: 30rem) {
113
+ .list {
114
+ grid-template-columns:
115
+ var(--el-description-list-term-width, fit-content(40%))
116
+ minmax(0, 1fr)
117
+ auto;
118
+ }
119
+
120
+ ::slotted(dt) {
121
+ grid-column: 1;
122
+ padding-block: var(--_el-description-list-padding);
123
+ padding-inline-end: var(--_el-description-list-gap);
124
+ }
125
+
126
+ ::slotted(dd) {
127
+ grid-column: 2;
128
+ padding-block: var(--_el-description-list-padding);
129
+ }
130
+
131
+ /* The line of the value begins after the padding of the row. */
132
+ ::slotted(dd[data-action]) {
133
+ grid-column: 3;
134
+ height: calc(1lh + 2 * var(--_el-description-list-padding));
135
+ padding-block: 0;
136
+ }
137
+ }
138
+ `;
139
+
140
+ export default [hostStyle(), style].join('\n');
@@ -12,6 +12,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
12
12
 
13
13
  ## Unreleased
14
14
 
15
+ ## [0.4.0] - 2026-11-27
16
+
17
+ ### Fixed
18
+
19
+ - A dialog is never higher than what the browser shows. Its greatest height counted the address bar of a phone in (`100vh`), so the footer of a long dialog was below the edge while the bar was there. It follows the bar now (`100dvh`). ([#183](https://github.com/webtides/element-library/issues/183))
20
+ - On a phone whose page reaches under the notch and the home indicator (`viewport-fit=cover`), the dialog keeps out of the room the system takes at the edges of the screen, and is in the middle of what is left. Elsewhere nothing changes.
21
+
15
22
  ## [0.3.0] - 2026-11-17
16
23
 
17
24
  ### Changed
@@ -131,6 +131,11 @@ See the Storybook _Docs / Theming_ page for the full token reference.
131
131
 
132
132
  On a touch screen (`@media (any-pointer: coarse)`) the close button is at least `--el-touch-target` wide and high. Its icon keeps its size, and the header grows with the button. Without that token, and on a fine pointer, the sizes stay as they are.
133
133
 
134
+ ## On a phone
135
+
136
+ - **The dialog is never higher than what the browser shows.** Its greatest height follows the address bar of a phone (`100dvh`): with the bar there, a dialog with a long body is shorter, its body scrolls, and its footer stays in view. It keeps `--el-space-4` to every edge.
137
+ - **Where a page reaches under the notch and the home indicator** (`viewport-fit=cover` in its viewport, or a web app on the home screen), the dialog keeps out of the room the system takes at the edges of the screen, and is in the middle of what is left. Without it, and on a desktop, that room is nothing.
138
+
134
139
  ## Accessibility
135
140
 
136
141
  - Opening calls `showModal()`, so focus is trapped, the rest of the page is `inert`, and focus is restored to the previously focused element on close.
@@ -5,16 +5,31 @@ const css = String.raw;
5
5
  /*
6
6
  * What is the dialog's own: a box in the middle of the viewport, which fades in and rises a little.
7
7
  * The paint of the surface, the backdrop and the parts are in the modal module.
8
+ *
9
+ * The middle is the one of what the user can see and reach. On a phone the system takes room at
10
+ * the edges of the screen, the notch and the home indicator, where the page reaches under them
11
+ * (viewport-fit=cover): the box keeps out of that room. Elsewhere the room is nothing.
8
12
  */
9
13
  const style = css`
10
14
  dialog {
15
+ --_el-dialog-top: env(safe-area-inset-top, 0px);
16
+ --_el-dialog-right: env(safe-area-inset-right, 0px);
17
+ --_el-dialog-bottom: env(safe-area-inset-bottom, 0px);
18
+ --_el-dialog-left: env(safe-area-inset-left, 0px);
19
+
20
+ /* The browser centres a modal dialog between the four edges of the viewport. */
21
+ inset: var(--_el-dialog-top) var(--_el-dialog-right) var(--_el-dialog-bottom) var(--_el-dialog-left);
11
22
  margin: auto;
12
23
  border: var(--el-border-width, 0) solid var(--el-color-border, transparent);
13
24
  border-radius: var(--el-radius-lg, 0);
14
25
 
15
26
  width: var(--el-dialog-width, 31rem);
16
- max-width: calc(100vw - 2 * var(--el-space-4, 1rem));
17
- max-height: calc(100vh - 2 * var(--el-space-4, 1rem));
27
+ max-width: calc(100vw - 2 * var(--el-space-4, 1rem) - var(--_el-dialog-left) - var(--_el-dialog-right));
28
+ /* Never higher than what the browser shows. 100vh is the height with the address bar of a
29
+ phone taken in: while the bar is there, the footer of a long dialog would be below the
30
+ edge. A browser that does not know the dynamic unit keeps the line before it. */
31
+ max-height: calc(100vh - 2 * var(--el-space-4, 1rem) - var(--_el-dialog-top) - var(--_el-dialog-bottom));
32
+ max-height: calc(100dvh - 2 * var(--el-space-4, 1rem) - var(--_el-dialog-top) - var(--_el-dialog-bottom));
18
33
 
19
34
  opacity: 0;
20
35
  transform: translateY(var(--el-dialog-enter-offset, 0.5rem));