@webtides/element-library 0.3.1 → 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 (195) hide show
  1. package/CHANGELOG.md +193 -0
  2. package/README.md +72 -56
  3. package/all.js +16 -0
  4. package/catalog.js +17 -1
  5. package/custom-elements.json +14723 -10220
  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 +15 -0
  23. package/src/components/button/button.events.js +3 -0
  24. package/src/components/button/button.js +145 -3
  25. package/src/components/button/button.readme.md +72 -4
  26. package/src/components/button/button.style.js +161 -7
  27. package/src/components/description-list/description-list.changelog.md +25 -0
  28. package/src/components/description-list/description-list.define.js +3 -0
  29. package/src/components/description-list/description-list.js +44 -0
  30. package/src/components/description-list/description-list.readme.md +135 -0
  31. package/src/components/description-list/description-list.style.js +140 -0
  32. package/src/components/dialog/dialog.changelog.md +7 -0
  33. package/src/components/dialog/dialog.readme.md +5 -0
  34. package/src/components/dialog/dialog.style.js +17 -2
  35. package/src/components/drawer/drawer.changelog.md +7 -0
  36. package/src/components/drawer/drawer.readme.md +7 -6
  37. package/src/components/drawer/drawer.style.js +35 -2
  38. package/src/components/dropdown/dropdown.readme.md +6 -1
  39. package/src/components/list/list.changelog.md +24 -0
  40. package/src/components/list/list.define.js +3 -0
  41. package/src/components/list/list.js +66 -0
  42. package/src/components/list/list.readme.md +122 -0
  43. package/src/components/list/list.style.js +56 -0
  44. package/src/components/list-item/list-item.changelog.md +24 -0
  45. package/src/components/list-item/list-item.define.js +3 -0
  46. package/src/components/list-item/list-item.js +128 -0
  47. package/src/components/list-item/list-item.readme.md +126 -0
  48. package/src/components/list-item/list-item.style.js +234 -0
  49. package/src/components/menu/menu.changelog.md +27 -0
  50. package/src/components/menu/menu.define.js +3 -0
  51. package/src/components/menu/menu.events.js +5 -0
  52. package/src/components/menu/menu.js +570 -0
  53. package/src/components/menu/menu.readme.md +272 -0
  54. package/src/components/menu/menu.style.js +55 -0
  55. package/src/components/menu-group/menu-group.changelog.md +20 -0
  56. package/src/components/menu-group/menu-group.define.js +3 -0
  57. package/src/components/menu-group/menu-group.js +44 -0
  58. package/src/components/menu-group/menu-group.readme.md +74 -0
  59. package/src/components/menu-group/menu-group.style.js +38 -0
  60. package/src/components/menu-item/menu-item.changelog.md +24 -0
  61. package/src/components/menu-item/menu-item.define.js +3 -0
  62. package/src/components/menu-item/menu-item.js +130 -0
  63. package/src/components/menu-item/menu-item.readme.md +94 -0
  64. package/src/components/menu-item/menu-item.style.js +87 -0
  65. package/src/components/nav/nav.changelog.md +35 -0
  66. package/src/components/nav/nav.define.js +3 -0
  67. package/src/components/nav/nav.js +212 -0
  68. package/src/components/nav/nav.readme.md +248 -0
  69. package/src/components/nav/nav.style.js +269 -0
  70. package/src/components/nav-item/nav-item.changelog.md +25 -0
  71. package/src/components/nav-item/nav-item.define.js +3 -0
  72. package/src/components/nav-item/nav-item.js +75 -0
  73. package/src/components/nav-item/nav-item.readme.md +111 -0
  74. package/src/components/nav-item/nav-item.style.js +159 -0
  75. package/src/components/pagination/pagination.changelog.md +8 -0
  76. package/src/components/pagination/pagination.js +123 -49
  77. package/src/components/pagination/pagination.readme.md +24 -6
  78. package/src/components/pagination/pagination.style.js +11 -1
  79. package/src/components/scroll-to-top/scroll-to-top.changelog.md +7 -5
  80. package/src/components/scroll-to-top/scroll-to-top.js +16 -12
  81. package/src/components/scroll-to-top/scroll-to-top.readme.md +2 -0
  82. package/src/components/segmented-field/segmented-field.changelog.md +27 -0
  83. package/src/components/segmented-field/segmented-field.define.js +3 -0
  84. package/src/components/segmented-field/segmented-field.js +175 -0
  85. package/src/components/segmented-field/segmented-field.readme.md +140 -0
  86. package/src/components/segmented-field/segmented-field.style.js +193 -0
  87. package/src/components/splitter/splitter.changelog.md +24 -0
  88. package/src/components/splitter/splitter.define.js +3 -0
  89. package/src/components/splitter/splitter.events.js +4 -0
  90. package/src/components/splitter/splitter.js +237 -0
  91. package/src/components/splitter/splitter.readme.md +164 -0
  92. package/src/components/splitter/splitter.style.js +100 -0
  93. package/src/components/status-bar/status-bar.changelog.md +25 -0
  94. package/src/components/status-bar/status-bar.define.js +3 -0
  95. package/src/components/status-bar/status-bar.js +74 -0
  96. package/src/components/status-bar/status-bar.readme.md +139 -0
  97. package/src/components/status-bar/status-bar.style.js +122 -0
  98. package/src/components/tab-group/tab-group.changelog.md +7 -0
  99. package/src/components/tab-group/tab-group.js +30 -9
  100. package/src/components/tab-group/tab-group.readme.md +14 -0
  101. package/src/components/toast/toast.changelog.md +6 -0
  102. package/src/components/toast/toast.readme.md +5 -3
  103. package/src/components/toast/toast.style.js +22 -6
  104. package/src/components/toolbar/toolbar.changelog.md +24 -0
  105. package/src/components/toolbar/toolbar.define.js +3 -0
  106. package/src/components/toolbar/toolbar.js +233 -0
  107. package/src/components/toolbar/toolbar.readme.md +156 -0
  108. package/src/components/toolbar/toolbar.style.js +49 -0
  109. package/src/components/tooltip/tooltip.changelog.md +11 -0
  110. package/src/components/tooltip/tooltip.js +51 -4
  111. package/src/components/tooltip/tooltip.readme.md +26 -1
  112. package/src/components/tree/tree.changelog.md +23 -0
  113. package/src/components/tree/tree.define.js +3 -0
  114. package/src/components/tree/tree.js +138 -0
  115. package/src/components/tree/tree.readme.md +119 -0
  116. package/src/components/tree/tree.style.js +16 -0
  117. package/src/components/tree-item/tree-item.changelog.md +23 -0
  118. package/src/components/tree-item/tree-item.define.js +3 -0
  119. package/src/components/tree-item/tree-item.events.js +3 -0
  120. package/src/components/tree-item/tree-item.js +246 -0
  121. package/src/components/tree-item/tree-item.readme.md +128 -0
  122. package/src/components/tree-item/tree-item.style.js +226 -0
  123. package/src/styles/appearance.style.js +47 -0
  124. package/src/styles/choice-group.style.js +1 -1
  125. package/src/styles/modal.style.js +14 -1
  126. package/src/styles/size.style.js +41 -0
  127. package/src/utils/focus.js +69 -0
  128. package/src/utils/scroll.js +24 -0
  129. package/types/all.d.ts +16 -0
  130. package/types/src/components/accordion/accordion.d.ts +3 -1
  131. package/types/src/components/app-bar/app-bar.d.ts +43 -0
  132. package/types/src/components/app-bar/app-bar.define.d.ts +1 -0
  133. package/types/src/components/app-bar/app-bar.style.d.ts +2 -0
  134. package/types/src/components/app-frame/app-frame.d.ts +491 -0
  135. package/types/src/components/app-frame/app-frame.define.d.ts +1 -0
  136. package/types/src/components/app-frame/app-frame.events.d.ts +7 -0
  137. package/types/src/components/app-frame/app-frame.style.d.ts +8 -0
  138. package/types/src/components/button/button.d.ts +61 -0
  139. package/types/src/components/button/button.events.d.ts +4 -0
  140. package/types/src/components/description-list/description-list.d.ts +29 -0
  141. package/types/src/components/description-list/description-list.define.d.ts +1 -0
  142. package/types/src/components/description-list/description-list.style.d.ts +2 -0
  143. package/types/src/components/list/list.d.ts +39 -0
  144. package/types/src/components/list/list.define.d.ts +1 -0
  145. package/types/src/components/list/list.style.d.ts +2 -0
  146. package/types/src/components/list-item/list-item.d.ts +62 -0
  147. package/types/src/components/list-item/list-item.define.d.ts +1 -0
  148. package/types/src/components/list-item/list-item.style.d.ts +2 -0
  149. package/types/src/components/menu/menu.d.ts +266 -0
  150. package/types/src/components/menu/menu.define.d.ts +1 -0
  151. package/types/src/components/menu/menu.events.d.ts +6 -0
  152. package/types/src/components/menu/menu.style.d.ts +2 -0
  153. package/types/src/components/menu-group/menu-group.d.ts +24 -0
  154. package/types/src/components/menu-group/menu-group.define.d.ts +1 -0
  155. package/types/src/components/menu-group/menu-group.style.d.ts +2 -0
  156. package/types/src/components/menu-item/menu-item.d.ts +59 -0
  157. package/types/src/components/menu-item/menu-item.define.d.ts +1 -0
  158. package/types/src/components/menu-item/menu-item.style.d.ts +2 -0
  159. package/types/src/components/nav/nav.d.ts +103 -0
  160. package/types/src/components/nav/nav.define.d.ts +1 -0
  161. package/types/src/components/nav/nav.style.d.ts +2 -0
  162. package/types/src/components/nav-item/nav-item.d.ts +39 -0
  163. package/types/src/components/nav-item/nav-item.define.d.ts +1 -0
  164. package/types/src/components/nav-item/nav-item.style.d.ts +2 -0
  165. package/types/src/components/pagination/pagination.d.ts +31 -2
  166. package/types/src/components/scroll-to-top/scroll-to-top.d.ts +6 -5
  167. package/types/src/components/segmented-field/segmented-field.d.ts +85 -0
  168. package/types/src/components/segmented-field/segmented-field.define.d.ts +1 -0
  169. package/types/src/components/segmented-field/segmented-field.style.d.ts +2 -0
  170. package/types/src/components/splitter/splitter.d.ts +127 -0
  171. package/types/src/components/splitter/splitter.define.d.ts +1 -0
  172. package/types/src/components/splitter/splitter.events.d.ts +5 -0
  173. package/types/src/components/splitter/splitter.style.d.ts +2 -0
  174. package/types/src/components/status-bar/status-bar.d.ts +44 -0
  175. package/types/src/components/status-bar/status-bar.define.d.ts +1 -0
  176. package/types/src/components/status-bar/status-bar.style.d.ts +2 -0
  177. package/types/src/components/tab-group/tab-group.d.ts +17 -0
  178. package/types/src/components/toolbar/toolbar.d.ts +96 -0
  179. package/types/src/components/toolbar/toolbar.define.d.ts +1 -0
  180. package/types/src/components/toolbar/toolbar.style.d.ts +2 -0
  181. package/types/src/components/tooltip/tooltip.d.ts +26 -0
  182. package/types/src/components/tree/tree.d.ts +62 -0
  183. package/types/src/components/tree/tree.define.d.ts +1 -0
  184. package/types/src/components/tree/tree.style.d.ts +2 -0
  185. package/types/src/components/tree-item/tree-item.d.ts +106 -0
  186. package/types/src/components/tree-item/tree-item.define.d.ts +1 -0
  187. package/types/src/components/tree-item/tree-item.events.d.ts +4 -0
  188. package/types/src/components/tree-item/tree-item.style.d.ts +2 -0
  189. package/types/src/styles/appearance.style.d.ts +31 -0
  190. package/types/src/styles/choice-group.style.d.ts +1 -1
  191. package/types/src/styles/modal.style.d.ts +5 -0
  192. package/types/src/styles/size.style.d.ts +24 -0
  193. package/types/src/utils/focus.d.ts +25 -0
  194. package/types/src/utils/scroll.d.ts +11 -0
  195. package/web-types.json +2530 -393
@@ -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));
@@ -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
+ - On a phone whose page reaches under the notch and the home indicator (`viewport-fit=cover`), the header of a drawer was under the status bar and its footer under the home indicator. The surface still reaches the three edges it lies against, and its header, its body and its footer keep clear of that room now. The size the page gives is the one of what is in the drawer, and the room is on top. Elsewhere nothing changes. ([#183](https://github.com/webtides/element-library/issues/183))
20
+ - What is in a drawer and would keep the edges of the screen clear itself (an `el-app-bar`, an `el-nav`) is told that the surface does so, and adds no room of its own.
21
+
15
22
  ## [0.3.0] - 2026-11-17
16
23
 
17
24
  ### Added
@@ -134,13 +134,14 @@ On a touch screen (`@media (any-pointer: coarse)`) the close button is at least
134
134
 
135
135
  The drawer is never wider or higher than the viewport. On a narrow screen a drawer at the start or the end covers the page, and the close button is the way back.
136
136
 
137
- A page that reaches under the notch and the home indicator of a phone (`viewport-fit=cover`) keeps the content of the drawer clear of them itself:
137
+ ## On a phone
138
138
 
139
- ```css
140
- el-drawer::part(base) {
141
- padding-block-end: env(safe-area-inset-bottom);
142
- }
143
- ```
139
+ Where a page reaches under the notch and the home indicator of a phone (`viewport-fit=cover` in its viewport, or a web app on the home screen), the system takes room at the edges of the screen. The surface of the drawer reaches the three edges it lies against, and its header, its body and its footer keep clear of that room: the header starts below the status bar, the footer ends above the home indicator.
140
+
141
+ - The room is padding of the surface (`::part(base)`), on the edges the drawer lies against and not on the one that faces the page.
142
+ - `--el-drawer-size` is the size of what is in the drawer. The room of the screen is on top of it.
143
+ - What is in a drawer and keeps the edges of the screen clear when it is alone, an [`el-app-bar`](../app-bar/app-bar.readme.md) or an [`el-nav`](../nav/nav.readme.md), is told that the drawer does so, and adds no room of its own.
144
+ - Without `viewport-fit=cover`, and on a desktop, the room is nothing and the drawer is as before.
144
145
 
145
146
  ## Opening and closing
146
147
 
@@ -10,9 +10,27 @@ const border = 'var(--el-border-width, 0)';
10
10
  *
11
11
  * The first rule is the drawer at the end of the line, which is also what a placement that is none
12
12
  * of the four gets. The other placements change what differs.
13
+ *
14
+ * On a phone the system takes room at the edges of the screen, where the page reaches under them
15
+ * (viewport-fit=cover): the notch, the rounded corners, the home indicator. The surface of the
16
+ * drawer reaches the three edges it lies against, and its header, its body and its footer stay
17
+ * clear of that room: it is padding of the surface, which the modal module reads. The size the
18
+ * page gives a drawer is the one of what is in it, and the room is on top. Elsewhere the room is
19
+ * nothing.
13
20
  */
14
21
  const style = css`
15
22
  dialog {
23
+ /* The room of the system at the edges of the screen, by the direction of the text. */
24
+ --_el-drawer-screen-top: env(safe-area-inset-top, 0px);
25
+ --_el-drawer-screen-bottom: env(safe-area-inset-bottom, 0px);
26
+ --_el-drawer-screen-start: env(safe-area-inset-left, 0px);
27
+ --_el-drawer-screen-end: env(safe-area-inset-right, 0px);
28
+ /* The edges the drawer lies against: all but the one that faces the page. */
29
+ --_el-modal-inset-block-start: var(--_el-drawer-screen-top);
30
+ --_el-modal-inset-block-end: var(--_el-drawer-screen-bottom);
31
+ --_el-modal-inset-inline-start: 0px;
32
+ --_el-modal-inset-inline-end: var(--_el-drawer-screen-end);
33
+
16
34
  /* The direction the end of a line is in: 1 for the right, -1 for the left. */
17
35
  --_el-drawer-end: 1;
18
36
  /* How far the drawer is out of the viewport before it is shown. */
@@ -28,7 +46,9 @@ const style = css`
28
46
  margin: 0;
29
47
  max-inline-size: 100%;
30
48
  max-block-size: 100%;
31
- inline-size: var(--el-drawer-size, 25rem);
49
+ inline-size: calc(
50
+ var(--el-drawer-size, 25rem) + var(--_el-modal-inset-inline-start) + var(--_el-modal-inset-inline-end)
51
+ );
32
52
  /* From edge to edge: the browser gives a dialog the height of its content. */
33
53
  block-size: auto;
34
54
 
@@ -46,9 +66,13 @@ const style = css`
46
66
  \`:dir(rtl)\` for an element inside the shadow root. */
47
67
  :host(:dir(rtl)) dialog {
48
68
  --_el-drawer-end: -1;
69
+ --_el-drawer-screen-start: env(safe-area-inset-right, 0px);
70
+ --_el-drawer-screen-end: env(safe-area-inset-left, 0px);
49
71
  }
50
72
 
51
73
  :host([placement='start']) dialog {
74
+ --_el-modal-inset-inline-start: var(--_el-drawer-screen-start);
75
+ --_el-modal-inset-inline-end: 0px;
52
76
  --_el-drawer-x: calc(-100% * var(--_el-drawer-end));
53
77
  inset-inline: 0 auto;
54
78
  border-inline-width: 0 ${border};
@@ -58,14 +82,22 @@ const style = css`
58
82
  /* Across the viewport, and as high as the content unless a size is given. */
59
83
  :host([placement='top']) dialog,
60
84
  :host([placement='bottom']) dialog {
85
+ --_el-modal-inset-inline-start: var(--_el-drawer-screen-start);
86
+ --_el-modal-inset-inline-end: var(--_el-drawer-screen-end);
87
+ /* The size of the page and the room of the system on top of it. Without a size the
88
+ property is not valid, and the drawer is as high as its content. */
89
+ --_el-drawer-block-size: calc(
90
+ var(--el-drawer-size) + var(--_el-modal-inset-block-start) + var(--_el-modal-inset-block-end)
91
+ );
61
92
  --_el-drawer-x: 0;
62
93
  inset-inline: 0;
63
94
  inline-size: auto;
64
- block-size: var(--el-drawer-size, auto);
95
+ block-size: var(--_el-drawer-block-size, auto);
65
96
  border-inline-width: 0;
66
97
  }
67
98
 
68
99
  :host([placement='top']) dialog {
100
+ --_el-modal-inset-block-end: 0px;
69
101
  --_el-drawer-y: -100%;
70
102
  inset-block-end: auto;
71
103
  border-block-end-width: ${border};
@@ -73,6 +105,7 @@ const style = css`
73
105
  }
74
106
 
75
107
  :host([placement='bottom']) dialog {
108
+ --_el-modal-inset-block-start: 0px;
76
109
  --_el-drawer-y: 100%;
77
110
  inset-block-start: auto;
78
111
  border-block-start-width: ${border};
@@ -1,6 +1,11 @@
1
1
  # Dropdown
2
2
 
3
- `dropdown` is a component that creates a toggleable dropdown menu with trigger and content slots. It handles click-outside and escape key interactions to automatically close the dropdown when the user clicks outside or presses the Escape key.
3
+ `dropdown` is a component that shows and hides a panel for a trigger, with trigger and content slots. It closes when the user clicks outside or presses the Escape key.
4
+
5
+ The panel is in the flow of the page: it takes room below its trigger, and what follows moves down. That is what the dropdown is for, a part of the page that opens in its place. For the two things it is often taken for, there are elements of their own:
6
+
7
+ - **A menu of actions** behind a button is an [`el-menu`](../menu/menu.readme.md): entries with roles, the keyboard through them, and a panel that floats.
8
+ - **A panel that floats** next to its anchor, with any content, is an [`el-popover`](../popover/popover.readme.md).
4
9
 
5
10
  ## How to use
6
11
 
@@ -0,0 +1,24 @@
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-list`: a list of rows, for messages, articles, files or the entries of a settings page. It is the list for assistive technology (`role="list"`, named by `label`), and every `el-list-item` slotted into it is an item of that list. ([#192](https://github.com/webtides/element-library/issues/192))
20
+ - The texts of all rows begin on one line, after the widest start of the list: the list has a column for the start and one for the rest, and a row takes them over (`subgrid`). A list without a start in any row has no first column.
21
+ - `density` (`'default'` or `'compact'`): `--el-space-3` or `--el-space-2` above and below the texts of a row.
22
+ - `appearance`: `'plain'` (the default) has no surface and reaches from edge to edge of its place; `'outlined'` and `'filled'` are the surfaces of `el-card`. Between two rows is a line in `--el-color-border`. Without a theme the list paints nothing.
23
+ - `--el-list-padding-inline` is the padding of a row at its start and its end, `--el-space-4` unset. With `0` a list in the body of an `el-card` has its rows on the line of the other content.
24
+ - The list runs no script: a server-rendered list is complete without JavaScript, and looks the same before and after the element takes over.
@@ -0,0 +1,3 @@
1
+ import { define } from './list.js';
2
+
3
+ define();
@@ -0,0 +1,66 @@
1
+ import { TemplateElement, defineElement, html, spreadAttributes } from '@webtides/element-js';
2
+ import style from './list.style.js';
3
+
4
+ /**
5
+ * A list of rows: messages, articles, files, the entries of a settings page. The list is the
6
+ * surface and the list for assistive technology; every `el-list-item` slotted into it is one row.
7
+ * It gives its rows one density, one line between two of them and one place where their texts
8
+ * begin, whatever stands at the start of a row.
9
+ *
10
+ * Pure presentation: the list runs no script of its own, so a server-rendered list is complete
11
+ * before the element takes over.
12
+ *
13
+ * @element el-list
14
+ *
15
+ * @slot - The rows: `el-list-item` elements.
16
+ *
17
+ * @csspart base - The list (`role="list"`) and its surface.
18
+ *
19
+ * @cssproperty --el-list-padding-inline - The padding of a row at its start and its end. Unset, it
20
+ * is `--el-space-4`, and `1rem` without a theme. Read by the rows, so it can be set on the list
21
+ * or for the page.
22
+ *
23
+ * @property {string} label - The name of the list for assistive technology. Unset, the list has
24
+ * none.
25
+ * @property {'default'|'compact'} density - How much room a row has above and below its texts.
26
+ * Default `'default'`. Reflected to the `density` attribute.
27
+ * @property {'plain'|'outlined'|'filled'} appearance - How the surface is painted: not at all, so
28
+ * the list reaches from edge to edge of its place, or as a card with the background of the page
29
+ * or a muted fill, a border and round corners. Default `'plain'`. Reflected to the `appearance`
30
+ * attribute.
31
+ */
32
+ export default class List extends TemplateElement {
33
+ constructor() {
34
+ super({
35
+ styles: [style],
36
+ shadowRender: true,
37
+ // The stylesheet selects the host by these attributes.
38
+ propertyOptions: {
39
+ density: { reflect: true },
40
+ appearance: { reflect: true },
41
+ },
42
+ });
43
+ }
44
+
45
+ properties() {
46
+ return {
47
+ label: '',
48
+ density: 'default',
49
+ appearance: 'plain',
50
+ };
51
+ }
52
+
53
+ template() {
54
+ // The role is inside of the shadow root, not on the element: it is part of the
55
+ // server-rendered markup that way, and needs no script.
56
+ return html`
57
+ <div part="base" class="list" role="list" ${spreadAttributes({ 'aria-label': this.label || undefined })}>
58
+ <slot></slot>
59
+ </div>
60
+ `;
61
+ }
62
+ }
63
+
64
+ export function define() {
65
+ defineElement('el-list', List);
66
+ }