@webtides/element-library 0.3.1 → 0.5.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.
- package/CHANGELOG.md +300 -0
- package/README.md +72 -56
- package/all.js +16 -0
- package/catalog.js +17 -1
- package/custom-elements.json +15912 -10065
- package/package.json +1 -1
- package/src/components/accordion/accordion.changelog.md +11 -0
- package/src/components/accordion/accordion.js +15 -3
- package/src/components/accordion/accordion.readme.md +27 -1
- package/src/components/accordion/accordion.style.js +19 -0
- package/src/components/app-bar/app-bar.changelog.md +24 -0
- package/src/components/app-bar/app-bar.define.js +3 -0
- package/src/components/app-bar/app-bar.js +91 -0
- package/src/components/app-bar/app-bar.readme.md +130 -0
- package/src/components/app-bar/app-bar.style.js +103 -0
- package/src/components/app-frame/app-frame.changelog.md +59 -0
- package/src/components/app-frame/app-frame.define.js +3 -0
- package/src/components/app-frame/app-frame.events.js +6 -0
- package/src/components/app-frame/app-frame.js +1085 -0
- package/src/components/app-frame/app-frame.readme.md +425 -0
- package/src/components/app-frame/app-frame.style.js +534 -0
- package/src/components/button/button.changelog.md +21 -0
- package/src/components/button/button.events.js +3 -0
- package/src/components/button/button.js +145 -3
- package/src/components/button/button.readme.md +72 -4
- package/src/components/button/button.style.js +167 -8
- package/src/components/button-group/button-group.changelog.md +10 -0
- package/src/components/button-group/button-group.readme.md +2 -0
- package/src/components/button-group/button-group.style.js +6 -2
- package/src/components/checkbox-group-field/checkbox-group-field.changelog.md +6 -0
- package/src/components/checkbox-group-field/checkbox-group-field.js +7 -2
- package/src/components/checkbox-group-field/checkbox-group-field.readme.md +23 -1
- package/src/components/combobox-field/combobox-field.changelog.md +6 -0
- package/src/components/combobox-field/combobox-field.readme.md +8 -0
- package/src/components/combobox-field/combobox-field.style.js +2 -0
- package/src/components/date-field/date-field.changelog.md +6 -0
- package/src/components/date-field/date-field.readme.md +10 -0
- package/src/components/date-field/date-field.style.js +8 -3
- package/src/components/description-list/description-list.changelog.md +42 -0
- package/src/components/description-list/description-list.define.js +3 -0
- package/src/components/description-list/description-list.js +49 -0
- package/src/components/description-list/description-list.readme.md +161 -0
- package/src/components/description-list/description-list.style.js +169 -0
- package/src/components/dialog/dialog.changelog.md +7 -0
- package/src/components/dialog/dialog.readme.md +5 -0
- package/src/components/dialog/dialog.style.js +17 -2
- package/src/components/divider/divider.changelog.md +6 -0
- package/src/components/divider/divider.readme.md +1 -1
- package/src/components/divider/divider.style.js +6 -0
- package/src/components/drawer/drawer.changelog.md +7 -0
- package/src/components/drawer/drawer.readme.md +7 -6
- package/src/components/drawer/drawer.style.js +35 -2
- package/src/components/dropdown/dropdown.readme.md +6 -1
- package/src/components/file-field/file-field.changelog.md +8 -0
- package/src/components/file-field/file-field.js +135 -5
- package/src/components/file-field/file-field.readme.md +35 -6
- package/src/components/file-field/file-field.style.js +71 -0
- package/src/components/form-field/form-field.js +1 -1
- package/src/components/input-field/input-field.changelog.md +10 -0
- package/src/components/input-field/input-field.js +192 -14
- package/src/components/input-field/input-field.readme.md +88 -2
- package/src/components/input-field/input-field.style.js +2 -0
- package/src/components/list/list.changelog.md +30 -0
- package/src/components/list/list.define.js +3 -0
- package/src/components/list/list.js +68 -0
- package/src/components/list/list.readme.md +123 -0
- package/src/components/list/list.style.js +56 -0
- package/src/components/list-item/list-item.changelog.md +40 -0
- package/src/components/list-item/list-item.define.js +3 -0
- package/src/components/list-item/list-item.js +130 -0
- package/src/components/list-item/list-item.readme.md +144 -0
- package/src/components/list-item/list-item.style.js +246 -0
- package/src/components/menu/menu.changelog.md +44 -0
- package/src/components/menu/menu.define.js +3 -0
- package/src/components/menu/menu.events.js +5 -0
- package/src/components/menu/menu.js +793 -0
- package/src/components/menu/menu.readme.md +313 -0
- package/src/components/menu/menu.style.js +59 -0
- package/src/components/menu-group/menu-group.changelog.md +20 -0
- package/src/components/menu-group/menu-group.define.js +3 -0
- package/src/components/menu-group/menu-group.js +44 -0
- package/src/components/menu-group/menu-group.readme.md +74 -0
- package/src/components/menu-group/menu-group.style.js +38 -0
- package/src/components/menu-item/menu-item.changelog.md +32 -0
- package/src/components/menu-item/menu-item.define.js +3 -0
- package/src/components/menu-item/menu-item.js +168 -0
- package/src/components/menu-item/menu-item.readme.md +132 -0
- package/src/components/menu-item/menu-item.style.js +117 -0
- package/src/components/nav/nav.changelog.md +35 -0
- package/src/components/nav/nav.define.js +3 -0
- package/src/components/nav/nav.js +212 -0
- package/src/components/nav/nav.readme.md +248 -0
- package/src/components/nav/nav.style.js +269 -0
- package/src/components/nav-item/nav-item.changelog.md +25 -0
- package/src/components/nav-item/nav-item.define.js +3 -0
- package/src/components/nav-item/nav-item.js +75 -0
- package/src/components/nav-item/nav-item.readme.md +111 -0
- package/src/components/nav-item/nav-item.style.js +159 -0
- package/src/components/otp-field/otp-field.changelog.md +6 -0
- package/src/components/otp-field/otp-field.readme.md +8 -0
- package/src/components/otp-field/otp-field.style.js +8 -3
- package/src/components/pagination/pagination.changelog.md +8 -0
- package/src/components/pagination/pagination.js +123 -49
- package/src/components/pagination/pagination.readme.md +24 -6
- package/src/components/pagination/pagination.style.js +11 -1
- package/src/components/password-field/password-field.changelog.md +7 -0
- package/src/components/password-field/password-field.readme.md +11 -1
- package/src/components/password-field/password-field.style.js +2 -0
- package/src/components/popover/popover.changelog.md +6 -0
- package/src/components/popover/popover.style.js +1 -0
- package/src/components/radio-field/radio-field.changelog.md +6 -0
- package/src/components/radio-field/radio-field.js +7 -2
- package/src/components/radio-field/radio-field.readme.md +23 -1
- package/src/components/scroll-to-top/scroll-to-top.changelog.md +7 -5
- package/src/components/scroll-to-top/scroll-to-top.js +16 -12
- package/src/components/scroll-to-top/scroll-to-top.readme.md +2 -0
- package/src/components/segmented-field/segmented-field.changelog.md +27 -0
- package/src/components/segmented-field/segmented-field.define.js +3 -0
- package/src/components/segmented-field/segmented-field.js +175 -0
- package/src/components/segmented-field/segmented-field.readme.md +140 -0
- package/src/components/segmented-field/segmented-field.style.js +193 -0
- package/src/components/splitter/splitter.changelog.md +24 -0
- package/src/components/splitter/splitter.define.js +3 -0
- package/src/components/splitter/splitter.events.js +4 -0
- package/src/components/splitter/splitter.js +237 -0
- package/src/components/splitter/splitter.readme.md +164 -0
- package/src/components/splitter/splitter.style.js +100 -0
- package/src/components/status-bar/status-bar.changelog.md +25 -0
- package/src/components/status-bar/status-bar.define.js +3 -0
- package/src/components/status-bar/status-bar.js +74 -0
- package/src/components/status-bar/status-bar.readme.md +139 -0
- package/src/components/status-bar/status-bar.style.js +122 -0
- package/src/components/tab-group/tab-group.changelog.md +7 -0
- package/src/components/tab-group/tab-group.js +30 -9
- package/src/components/tab-group/tab-group.readme.md +14 -0
- package/src/components/textarea-field/textarea-field.changelog.md +6 -0
- package/src/components/textarea-field/textarea-field.js +14 -1
- package/src/components/textarea-field/textarea-field.readme.md +23 -1
- package/src/components/toast/toast.changelog.md +6 -0
- package/src/components/toast/toast.readme.md +5 -3
- package/src/components/toast/toast.style.js +22 -6
- package/src/components/toolbar/toolbar.changelog.md +24 -0
- package/src/components/toolbar/toolbar.define.js +3 -0
- package/src/components/toolbar/toolbar.js +233 -0
- package/src/components/toolbar/toolbar.readme.md +156 -0
- package/src/components/toolbar/toolbar.style.js +49 -0
- package/src/components/tooltip/tooltip.changelog.md +11 -0
- package/src/components/tooltip/tooltip.js +51 -4
- package/src/components/tooltip/tooltip.readme.md +26 -1
- package/src/components/tree/tree.changelog.md +23 -0
- package/src/components/tree/tree.define.js +3 -0
- package/src/components/tree/tree.js +138 -0
- package/src/components/tree/tree.readme.md +119 -0
- package/src/components/tree/tree.style.js +16 -0
- package/src/components/tree-item/tree-item.changelog.md +23 -0
- package/src/components/tree-item/tree-item.define.js +3 -0
- package/src/components/tree-item/tree-item.events.js +3 -0
- package/src/components/tree-item/tree-item.js +246 -0
- package/src/components/tree-item/tree-item.readme.md +128 -0
- package/src/components/tree-item/tree-item.style.js +226 -0
- package/src/styles/appearance.style.js +47 -0
- package/src/styles/choice-group.style.js +27 -1
- package/src/styles/input-control.style.js +87 -0
- package/src/styles/modal.style.js +14 -1
- package/src/styles/native.css +100 -0
- package/src/styles/size.style.js +41 -0
- package/src/utils/floating.js +15 -1
- package/src/utils/focus.js +69 -0
- package/src/utils/options.js +35 -0
- package/src/utils/scroll.js +24 -0
- package/src/utils/text-entry-attributes.js +13 -0
- package/types/all.d.ts +16 -0
- package/types/src/components/accordion/accordion.d.ts +3 -1
- package/types/src/components/app-bar/app-bar.d.ts +43 -0
- package/types/src/components/app-bar/app-bar.define.d.ts +1 -0
- package/types/src/components/app-bar/app-bar.style.d.ts +2 -0
- package/types/src/components/app-frame/app-frame.d.ts +497 -0
- package/types/src/components/app-frame/app-frame.define.d.ts +1 -0
- package/types/src/components/app-frame/app-frame.events.d.ts +7 -0
- package/types/src/components/app-frame/app-frame.style.d.ts +8 -0
- package/types/src/components/button/button.d.ts +61 -0
- package/types/src/components/button/button.events.d.ts +4 -0
- package/types/src/components/checkbox-group-field/checkbox-group-field.d.ts +5 -2
- package/types/src/components/combobox-field/combobox-field.d.ts +10 -0
- package/types/src/components/date-field/date-field.d.ts +10 -0
- package/types/src/components/description-list/description-list.d.ts +34 -0
- package/types/src/components/description-list/description-list.define.d.ts +1 -0
- package/types/src/components/description-list/description-list.style.d.ts +2 -0
- package/types/src/components/file-field/file-field.d.ts +68 -3
- package/types/src/components/form-field/form-field.d.ts +1 -1
- package/types/src/components/input-field/input-field.d.ts +99 -0
- package/types/src/components/list/list.d.ts +41 -0
- package/types/src/components/list/list.define.d.ts +1 -0
- package/types/src/components/list/list.style.d.ts +2 -0
- package/types/src/components/list-item/list-item.d.ts +64 -0
- package/types/src/components/list-item/list-item.define.d.ts +1 -0
- package/types/src/components/list-item/list-item.style.d.ts +2 -0
- package/types/src/components/menu/menu.d.ts +362 -0
- package/types/src/components/menu/menu.define.d.ts +1 -0
- package/types/src/components/menu/menu.events.d.ts +6 -0
- package/types/src/components/menu/menu.style.d.ts +2 -0
- package/types/src/components/menu-group/menu-group.d.ts +24 -0
- package/types/src/components/menu-group/menu-group.define.d.ts +1 -0
- package/types/src/components/menu-group/menu-group.style.d.ts +2 -0
- package/types/src/components/menu-item/menu-item.d.ts +80 -0
- package/types/src/components/menu-item/menu-item.define.d.ts +1 -0
- package/types/src/components/menu-item/menu-item.style.d.ts +2 -0
- package/types/src/components/nav/nav.d.ts +103 -0
- package/types/src/components/nav/nav.define.d.ts +1 -0
- package/types/src/components/nav/nav.style.d.ts +2 -0
- package/types/src/components/nav-item/nav-item.d.ts +39 -0
- package/types/src/components/nav-item/nav-item.define.d.ts +1 -0
- package/types/src/components/nav-item/nav-item.style.d.ts +2 -0
- package/types/src/components/otp-field/otp-field.d.ts +10 -0
- package/types/src/components/pagination/pagination.d.ts +31 -2
- package/types/src/components/password-field/password-field.d.ts +10 -0
- package/types/src/components/radio-field/radio-field.d.ts +5 -2
- package/types/src/components/scroll-to-top/scroll-to-top.d.ts +6 -5
- package/types/src/components/segmented-field/segmented-field.d.ts +85 -0
- package/types/src/components/segmented-field/segmented-field.define.d.ts +1 -0
- package/types/src/components/segmented-field/segmented-field.style.d.ts +2 -0
- package/types/src/components/splitter/splitter.d.ts +127 -0
- package/types/src/components/splitter/splitter.define.d.ts +1 -0
- package/types/src/components/splitter/splitter.events.d.ts +5 -0
- package/types/src/components/splitter/splitter.style.d.ts +2 -0
- package/types/src/components/status-bar/status-bar.d.ts +44 -0
- package/types/src/components/status-bar/status-bar.define.d.ts +1 -0
- package/types/src/components/status-bar/status-bar.style.d.ts +2 -0
- package/types/src/components/tab-group/tab-group.d.ts +17 -0
- package/types/src/components/textarea-field/textarea-field.d.ts +7 -0
- package/types/src/components/toolbar/toolbar.d.ts +96 -0
- package/types/src/components/toolbar/toolbar.define.d.ts +1 -0
- package/types/src/components/toolbar/toolbar.style.d.ts +2 -0
- package/types/src/components/tooltip/tooltip.d.ts +26 -0
- package/types/src/components/tree/tree.d.ts +62 -0
- package/types/src/components/tree/tree.define.d.ts +1 -0
- package/types/src/components/tree/tree.style.d.ts +2 -0
- package/types/src/components/tree-item/tree-item.d.ts +106 -0
- package/types/src/components/tree-item/tree-item.define.d.ts +1 -0
- package/types/src/components/tree-item/tree-item.events.d.ts +4 -0
- package/types/src/components/tree-item/tree-item.style.d.ts +2 -0
- package/types/src/styles/appearance.style.d.ts +31 -0
- package/types/src/styles/choice-group.style.d.ts +1 -1
- package/types/src/styles/input-control.style.d.ts +15 -0
- package/types/src/styles/modal.style.d.ts +5 -0
- package/types/src/styles/size.style.d.ts +24 -0
- package/types/src/utils/floating.d.ts +11 -0
- package/types/src/utils/focus.d.ts +25 -0
- package/types/src/utils/options.d.ts +17 -0
- package/types/src/utils/scroll.d.ts +11 -0
- package/types/src/utils/text-entry-attributes.d.ts +10 -0
- package/web-types.json +2935 -308
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { html, defineElement } from '@webtides/element-js';
|
|
2
2
|
import FormField from '../form-field/form-field.js';
|
|
3
3
|
import { focusLeft } from '../../utils/focus.js';
|
|
4
|
+
import { optionStartTemplate } from '../../utils/options.js';
|
|
4
5
|
import style from './checkbox-group-field.style.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -29,9 +30,12 @@ const REQUIRED_MESSAGE = 'Select at least one option.';
|
|
|
29
30
|
*
|
|
30
31
|
* @property {string[]} value - The values of the checked options, in the order of the options. As
|
|
31
32
|
* an attribute it is JSON: `value='["news", "offers"]'`.
|
|
32
|
-
* @property {Array<string | { value: string, label?: string, disabled?: boolean }>} options -
|
|
33
|
+
* @property {Array<string | { value: string, label?: string, disabled?: boolean, color?: string, icon?: string }>} options -
|
|
33
34
|
* Options to render. Accepts plain strings (`['News', 'Offers']`) or option objects
|
|
34
|
-
* (`[{ value, label, disabled? }]`). Strings are used as both value and label.
|
|
35
|
+
* (`[{ value, label, disabled? }]`). Strings are used as both value and label. An object can
|
|
36
|
+
* name a `color`, which is drawn as a dot in front of the label, and an `icon`, the address of
|
|
37
|
+
* an SVG symbol (`'#tag'`, `'/icons.svg#tag'`), which is drawn there as well. Both are
|
|
38
|
+
* decorations: the label stays the name of the option.
|
|
35
39
|
* @property {boolean} required - Whether at least one option has to be checked.
|
|
36
40
|
*/
|
|
37
41
|
export default class CheckboxGroupField extends FormField {
|
|
@@ -205,6 +209,7 @@ export default class CheckboxGroupField extends FormField {
|
|
|
205
209
|
aria-describedby="${this._describedBy()}"
|
|
206
210
|
/>
|
|
207
211
|
<span class="checkbox-indicator" aria-hidden="true"></span>
|
|
212
|
+
${optionStartTemplate(option)}
|
|
208
213
|
<span class="option-label">${label}</span>
|
|
209
214
|
</label>
|
|
210
215
|
`;
|
|
@@ -41,6 +41,28 @@ field.options = [
|
|
|
41
41
|
];
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
#### A colour or an icon in front of the label
|
|
45
|
+
|
|
46
|
+
Tags with a colour, calendars, categories with an icon: things a user knows by their colour are found by it where they are chosen. An option can name a `color`, which is drawn as a dot in front of its label, and an `icon`, the address of an SVG symbol, which is drawn there as well:
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<svg width="0" height="0" style="position:absolute" aria-hidden="true">
|
|
50
|
+
<symbol id="icon-archive" viewBox="0 0 24 24">…</symbol>
|
|
51
|
+
</svg>
|
|
52
|
+
|
|
53
|
+
<el-checkbox-group-field
|
|
54
|
+
name="tags"
|
|
55
|
+
label="Tags"
|
|
56
|
+
options='[{"value":"work","label":"Work","color":"#c81e1e"},{"value":"home","label":"Home","color":"#1e5fc8"},{"value":"archive","label":"Archive","icon":"#icon-archive"}]'
|
|
57
|
+
></el-checkbox-group-field>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- **`color`** is any colour of CSS. The dot has it where the user forces colours as well: it is the colour of a thing of the page, as the colour of a picture is.
|
|
61
|
+
- **`icon`** is the address of an SVG symbol: one of the page (`#icon-archive`) or of a file (`/icons.svg#archive`), as an option of [`el-segmented-field`](../segmented-field/segmented-field.readme.md) has it. The icon has the colour of the text and is 1.25em wide and high. An option with both shows the dot first.
|
|
62
|
+
- **Both are decorations.** They are hidden from assistive technology, and the label stays the name of the option: say in the label what the colour says to the eye.
|
|
63
|
+
- **As an attribute and as a property**, and in server-rendered markup: they are part of the option, as its label is.
|
|
64
|
+
- An option that names neither has nothing in front of its label, and a click on the dot or on the icon checks the option, as a click on its label does.
|
|
65
|
+
|
|
44
66
|
#### The value
|
|
45
67
|
|
|
46
68
|
`value` is the list of the checked values, in the order of the options. From a script it is an array; as an attribute it is JSON (`value='["tue", "thu"]'`). A new list checks and unchecks the options.
|
|
@@ -60,7 +82,7 @@ Inherits all of `form-field`'s properties (`name`, `value`, `required`, `disable
|
|
|
60
82
|
| Name | Type | Default | Description |
|
|
61
83
|
| --- | --- | --- | --- |
|
|
62
84
|
| `value` | `string[]` | `[]` | The values of the checked options, in the order of the options. As an attribute it is JSON. |
|
|
63
|
-
| `options` | `Array<string \| { value: string, label?: string, disabled?: boolean }>` | `[]` | Options to render. Strings are used as both value and label; objects allow a separate label/disabled. |
|
|
85
|
+
| `options` | `Array<string \| { value: string, label?: string, disabled?: boolean, color?: string, icon?: string }>` | `[]` | Options to render. Strings are used as both value and label; objects allow a separate label/disabled, and a `color` or an `icon` in front of the label. |
|
|
64
86
|
| `required` | `boolean` | `false` | Whether at least one option has to be checked. |
|
|
65
87
|
|
|
66
88
|
#### Events
|
|
@@ -12,6 +12,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
12
12
|
|
|
13
13
|
## Unreleased
|
|
14
14
|
|
|
15
|
+
## [0.5.0] - 2026-11-27
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Takes content of the page into its control, an element with `slot="start"` or `slot="end"`, and has the button that empties it (`clearable`, `clear-label`), as `el-input-field`, which it extends. ([#168](https://github.com/webtides/element-library/issues/168))
|
|
20
|
+
|
|
15
21
|
## [0.3.0] - 2026-11-17
|
|
16
22
|
|
|
17
23
|
### Added
|
|
@@ -84,6 +84,14 @@ The label, the help message, the control and the error message stack in a column
|
|
|
84
84
|
|
|
85
85
|
On a touch screen (`@media (any-pointer: coarse)`) the control is at least `--el-touch-target` high. Without that token, and on a fine pointer, the sizes stay as they are.
|
|
86
86
|
|
|
87
|
+
## Content in the control
|
|
88
|
+
|
|
89
|
+
As [`el-input-field`](../input-field/input-field.readme.md#content-in-the-control), which this field extends, it takes an element of the page with `slot="start"` or `slot="end"` into its control, and `clearable="true"` adds a button that empties it (`clear-label` is its name).
|
|
90
|
+
|
|
91
|
+
```html
|
|
92
|
+
<el-combobox-field name="city" label="City" options='["Berlin", "Bern"]' clearable="true"></el-combobox-field>
|
|
93
|
+
```
|
|
94
|
+
|
|
87
95
|
## Accessibility
|
|
88
96
|
|
|
89
97
|
- The control is a native text input with a list: the browser makes it a combobox for a screen reader, named by the label (`<label for>`), and announces the suggestions as it shows them.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import hostStyle from '../../styles/host.style.js';
|
|
2
2
|
import formControlStyle from '../../styles/form-control.style.js';
|
|
3
3
|
import sizeStyle from '../../styles/size.style.js';
|
|
4
|
+
import inputControlStyle from '../../styles/input-control.style.js';
|
|
4
5
|
|
|
5
6
|
const css = String.raw;
|
|
6
7
|
|
|
@@ -52,5 +53,6 @@ export default [
|
|
|
52
53
|
hostStyle('el-combobox-field'),
|
|
53
54
|
formControlStyle('el-combobox-field'),
|
|
54
55
|
sizeStyle('el-combobox-field'),
|
|
56
|
+
inputControlStyle('el-combobox-field'),
|
|
55
57
|
style,
|
|
56
58
|
].join('\n');
|
|
@@ -12,6 +12,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
12
12
|
|
|
13
13
|
## Unreleased
|
|
14
14
|
|
|
15
|
+
## [0.5.0] - 2026-11-27
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Takes content of the page into its control, an element with `slot="start"` or `slot="end"`, and has the button that empties it (`clearable`, `clear-label`), as `el-input-field`, which it extends. ([#168](https://github.com/webtides/element-library/issues/168))
|
|
20
|
+
|
|
15
21
|
## [0.3.0] - 2026-11-17
|
|
16
22
|
|
|
17
23
|
### Added
|
|
@@ -101,6 +101,16 @@ The label, the help message, the control and the error message stack in a column
|
|
|
101
101
|
|
|
102
102
|
On a touch screen (`@media (any-pointer: coarse)`) the control is at least `--el-touch-target` high. Without that token, and on a fine pointer, the sizes stay as they are.
|
|
103
103
|
|
|
104
|
+
## Content in the control
|
|
105
|
+
|
|
106
|
+
As [`el-input-field`](../input-field/input-field.readme.md#content-in-the-control), which this field extends, it takes an element of the page with `slot="start"` or `slot="end"` into its control, and `clearable="true"` adds a button that empties it (`clear-label` is its name).
|
|
107
|
+
|
|
108
|
+
```html
|
|
109
|
+
<el-date-field name="start" label="Start" type="time"><span slot="end">UTC</span></el-date-field>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The control of the browser has an icon of its own at its end, which opens the picker: content at the end stands after it.
|
|
113
|
+
|
|
104
114
|
## Accessibility
|
|
105
115
|
|
|
106
116
|
- The control is the native one for a date or a time, named by the label (`<label for>`). Its parts (day, month, year) are entered with the keyboard and changed with the arrow keys, and the picker of the browser brings its own keyboard handling.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import hostStyle from '../../styles/host.style.js';
|
|
2
2
|
import formControlStyle from '../../styles/form-control.style.js';
|
|
3
3
|
import sizeStyle from '../../styles/size.style.js';
|
|
4
|
+
import inputControlStyle from '../../styles/input-control.style.js';
|
|
4
5
|
|
|
5
6
|
const css = String.raw;
|
|
6
7
|
|
|
@@ -48,6 +49,10 @@ const style = css`
|
|
|
48
49
|
}
|
|
49
50
|
`;
|
|
50
51
|
|
|
51
|
-
export default [
|
|
52
|
-
'
|
|
53
|
-
)
|
|
52
|
+
export default [
|
|
53
|
+
hostStyle('el-date-field'),
|
|
54
|
+
formControlStyle('el-date-field'),
|
|
55
|
+
sizeStyle('el-date-field'),
|
|
56
|
+
inputControlStyle('el-date-field'),
|
|
57
|
+
style,
|
|
58
|
+
].join('\n');
|
|
@@ -0,0 +1,42 @@
|
|
|
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.5.0] - 2026-11-27
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- `--el-description-list-padding-block` sets the room above and below a row, and `--el-description-list-gap` the gap between a name and its value and in front of an action. Unset, they are `--el-space-3` and `--el-space-4` as before. ([#208](https://github.com/webtides/element-library/issues/208))
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- A page that gave the room back itself, with a padding for the `<dt>`, the `<dd>` and the `<dd data-action>` in a list and a margin for the `::before` of a `<dt>`, takes those rules out, the ones for a wide list as well: a padding of the page adds to the room now, and the line would be drawn a row too high. ([#208](https://github.com/webtides/element-library/issues/208))
|
|
24
|
+
- `--el-description-list-term-width` is the width of the names alone: the gap to the values comes after it. It was inside of that width before, so a list with the property set has its values begin one gap (`--el-space-4`) later, and its names have that much more room. Unset, nothing changes: the names and the gap take 40% of the list at most, as before. ([#208](https://github.com/webtides/element-library/issues/208))
|
|
25
|
+
- A `<dt>` and a `<dd>` are as high as their text, and a `<dd data-action>` as high as one line where the list is wide as well: the room of the row is around them, not in them. A background the page gives one of them covers its text, not the row. ([#208](https://github.com/webtides/element-library/issues/208))
|
|
26
|
+
- A list whose rows are all hidden keeps the room above its first and below its last row, which is a padding of the list. A list with nothing in it has no height, as before. ([#208](https://github.com/webtides/element-library/issues/208))
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- The list looks the same on a page whose stylesheet takes the margin, the padding and the border off every element and off what an element generates (`*, ::before, ::after { margin: 0; padding: 0; border: 0 solid; }`, the reset of Tailwind CSS v4). The room of a row was a padding of the `<dt>` and the `<dd>` of the page, the gap between a name and its value a padding as well, and the line was moved to its place with a margin (`::slotted`). A rule of the page wins over such a rule, whatever its specificity and its cascade layer: the rows had no room, a name stood right under the line, and the line was drawn below its place. The room is the gap between the rows of the grid and the padding of the list now, the gap a column of the grid, and the line is placed with `translate`. The list takes nothing from the margin, the padding or the border of a `<dt>` or a `<dd>`. On a page without a reset it is the same to the pixel. ([#208](https://github.com/webtides/element-library/issues/208))
|
|
31
|
+
|
|
32
|
+
## [0.4.0] - 2026-11-27
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- 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))
|
|
37
|
+
- 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.
|
|
38
|
+
- `--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.
|
|
39
|
+
- 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.
|
|
40
|
+
- 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.
|
|
41
|
+
- A long value breaks, inside of a word where it has to: the list is never wider than its place.
|
|
42
|
+
- 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,49 @@
|
|
|
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. The gap to the values comes after it. Unset, the column
|
|
25
|
+
* is as wide as the longest name, and takes 40% of the list at most together with that gap.
|
|
26
|
+
* @cssproperty --el-description-list-padding-block - The room above and below a row. Unset, it is
|
|
27
|
+
* `--el-space-3`, and `0.75rem` without a theme.
|
|
28
|
+
* @cssproperty --el-description-list-gap - The gap between a name and its value while they stand
|
|
29
|
+
* side by side, and in front of an action. Unset, it is `--el-space-4`, and `1rem` without a
|
|
30
|
+
* theme.
|
|
31
|
+
*/
|
|
32
|
+
export default class DescriptionList extends TemplateElement {
|
|
33
|
+
constructor() {
|
|
34
|
+
super({
|
|
35
|
+
styles: [style],
|
|
36
|
+
shadowRender: true,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
template() {
|
|
41
|
+
// The list is inside of the shadow root, and the names and values of the page are its
|
|
42
|
+
// children by way of the slot: that is part of the server-rendered markup, and needs no script.
|
|
43
|
+
return html`<dl part="base" class="list"><slot></slot></dl>`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function define() {
|
|
48
|
+
defineElement('el-description-list', DescriptionList);
|
|
49
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
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` | as wide as the longest name | The width of the column of the names while names and values stand side by side. The gap to the values comes after it. Unset, the column is as wide as the longest name, and takes 40% of the list at most together with that gap. |
|
|
66
|
+
| `--el-description-list-padding-block` | `--el-space-3` | The room above and below a row. Without a theme it is `0.75rem`. |
|
|
67
|
+
| `--el-description-list-gap` | `--el-space-4` | The gap between a name and its value while they stand side by side, and in front of an action. Without a theme it is `1rem`. |
|
|
68
|
+
|
|
69
|
+
## What the page writes
|
|
70
|
+
|
|
71
|
+
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.
|
|
72
|
+
|
|
73
|
+
- A `<dt>` for the name, then a `<dd>` for the value. A row begins with its `<dt>`.
|
|
74
|
+
- A name can have several values, a `<dd>` each. Each of them has a row of its own, without a line above it.
|
|
75
|
+
- `<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.
|
|
76
|
+
- 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: its colour, its size, its weight.
|
|
77
|
+
- The list takes nothing from the margin, the padding or the border of a `<dt>` or a `<dd>`. See [a reset of the page](#a-reset-of-the-page).
|
|
78
|
+
|
|
79
|
+
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.
|
|
80
|
+
|
|
81
|
+
## Narrow and wide
|
|
82
|
+
|
|
83
|
+
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.
|
|
84
|
+
|
|
85
|
+
- **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.
|
|
86
|
+
- **From 30rem** name and value stand side by side. The column of the names is as wide as the longest name, and with the gap after it 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.
|
|
87
|
+
|
|
88
|
+
`--el-description-list-term-width` sets the width of the names, so that two lists on a page have their values on one line. The values begin one gap (`--el-description-list-gap`) after it:
|
|
89
|
+
|
|
90
|
+
```css
|
|
91
|
+
el-description-list {
|
|
92
|
+
--el-description-list-term-width: 12rem;
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## An action
|
|
97
|
+
|
|
98
|
+
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.
|
|
99
|
+
|
|
100
|
+
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:
|
|
101
|
+
|
|
102
|
+
```html
|
|
103
|
+
<dd data-action><a href="/plan" aria-label="Change the plan">Change</a></dd>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
or with text that is not shown (`styles/utilities.css`):
|
|
107
|
+
|
|
108
|
+
```html
|
|
109
|
+
<dd data-action>
|
|
110
|
+
<a href="/plan">Change<span class="el-visually-hidden"> the plan</span></a>
|
|
111
|
+
</dd>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
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.
|
|
115
|
+
|
|
116
|
+
## Lines and spacing
|
|
117
|
+
|
|
118
|
+
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`.
|
|
119
|
+
|
|
120
|
+
Two properties set the spacing for a list, or for the page:
|
|
121
|
+
|
|
122
|
+
```css
|
|
123
|
+
el-description-list {
|
|
124
|
+
--el-description-list-padding-block: 0.5rem;
|
|
125
|
+
--el-description-list-gap: 2rem;
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## A reset of the page
|
|
130
|
+
|
|
131
|
+
A rule of the page for a `<dt>` or a `<dd>` wins over what the list says for them, and a reset has such a rule for every element, and for what an element generates: `*, ::before, ::after { margin: 0; padding: 0; border: 0 solid; }` in Tailwind CSS v4. The list looks the same on a page with that reset and on one without:
|
|
132
|
+
|
|
133
|
+
- **The room of a row is the list's**: the gap between the rows of its grid, and its own padding above the first and below the last row. Where a name stands above its value, the value is moved up to its name with a position.
|
|
134
|
+
- **The gap between a name and its value** is a column of the grid, and the one in front of an action an empty box the action begins with.
|
|
135
|
+
- **The line between two rows** is a box with a height and a fill, placed with `translate`: no border, and no margin.
|
|
136
|
+
|
|
137
|
+
A reset may take the margin, the padding and the border of every element and of every `::before` and `::after`. A padding or a margin the page gives a `<dt>` or a `<dd>` itself adds to the room of the row.
|
|
138
|
+
|
|
139
|
+
What the list does set on the elements of the page, and what a rule of the page for the same property would change: their column (`grid-column`), the colour, the size and the line height of a name, how a long word breaks (`overflow-wrap`), the position of a value in a narrow list (`position`, `inset-block-start`), and for an action its layout (`display: flex`), its height and the `::before` in front of its content. The `::before` of a name is the line.
|
|
140
|
+
|
|
141
|
+
A list with nothing in it has no height. One whose rows are all hidden keeps the room above its first and below its last row.
|
|
142
|
+
|
|
143
|
+
A long value breaks, inside of a word where it has to (a token, an address): the list is never wider than its place.
|
|
144
|
+
|
|
145
|
+
The list has no surface. Put it into an `el-card` for one. The `hidden` attribute hides it.
|
|
146
|
+
|
|
147
|
+
## Accessibility
|
|
148
|
+
|
|
149
|
+
- 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.
|
|
150
|
+
- An action is a `<dd>` as well: it belongs to the name of its row.
|
|
151
|
+
- The line between two rows is drawn in the text colour of the system where the user forces colours.
|
|
152
|
+
- The list has no name of its own. Put a heading in front of it.
|
|
153
|
+
|
|
154
|
+
## Server-side rendering
|
|
155
|
+
|
|
156
|
+
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.
|
|
157
|
+
|
|
158
|
+
## What it is not
|
|
159
|
+
|
|
160
|
+
- No way to edit a value in place. An action leads to where the value is changed.
|
|
161
|
+
- No list of rows that are links as a whole: that is [`el-list`](../list/list.readme.md).
|
|
@@ -0,0 +1,169 @@
|
|
|
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, whatever its
|
|
8
|
+
* specificity and its cascade layer, and a reset has such a rule for every element and for what an
|
|
9
|
+
* element generates: `*, ::before, ::after { margin: 0; padding: 0; border: 0 solid; }`.
|
|
10
|
+
*
|
|
11
|
+
* So the list takes nothing from the margin, the padding or the border of a name or a value. The
|
|
12
|
+
* room of a row is the gap between the rows of the grid, and the padding of the list above its
|
|
13
|
+
* first and below its last row. The gap between a name and its value is a column of the grid. The
|
|
14
|
+
* line between two rows is a box with a height, placed without a margin. What the rules below do
|
|
15
|
+
* set on the elements of the page is what such a reset leaves alone: the place in the grid, the
|
|
16
|
+
* text, a position.
|
|
17
|
+
*/
|
|
18
|
+
const style = css`
|
|
19
|
+
/* The list measures its own width: the layout follows the place the list has, not the
|
|
20
|
+
viewport. */
|
|
21
|
+
:host {
|
|
22
|
+
display: block;
|
|
23
|
+
container-type: inline-size;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.list {
|
|
27
|
+
--_el-description-list-padding: var(--el-description-list-padding-block, var(--el-space-3, 0.75rem));
|
|
28
|
+
--_el-description-list-gap: var(--el-description-list-gap, var(--el-space-4, 1rem));
|
|
29
|
+
|
|
30
|
+
display: grid;
|
|
31
|
+
/* A name above its value. The second column is the one of the actions; without an action
|
|
32
|
+
it has no width. */
|
|
33
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
34
|
+
align-items: start;
|
|
35
|
+
/* A name and its value are two rows of the grid here, and the gap is between every two
|
|
36
|
+
rows. A value is moved up by that gap, to its name (see below): what is left after it,
|
|
37
|
+
and the gap to the next name, are the room below this row and above the next. The
|
|
38
|
+
room above the first row is the padding of the list. */
|
|
39
|
+
row-gap: var(--_el-description-list-padding);
|
|
40
|
+
/* The lines between the rows are placed from here. */
|
|
41
|
+
position: relative;
|
|
42
|
+
margin: 0;
|
|
43
|
+
padding-block: var(--_el-description-list-padding) 0;
|
|
44
|
+
padding-inline: 0;
|
|
45
|
+
color: var(--el-color-fg, inherit);
|
|
46
|
+
font-family: var(--el-font-family, inherit);
|
|
47
|
+
font-size: var(--el-font-size-md, inherit);
|
|
48
|
+
line-height: var(--el-line-height, inherit);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* A list with nothing in it has no room for a row. A stylesheet in here cannot ask for less:
|
|
52
|
+
whether the element has a row in it (:has() in :host()) is not answered by every browser. */
|
|
53
|
+
:host(:empty) .list {
|
|
54
|
+
padding-block: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* ── Name ─────────────────────────────────────────────────────────────── */
|
|
58
|
+
|
|
59
|
+
/* Quieter than its value. Its line is as high as a line of the value, so the two stand on
|
|
60
|
+
one line side by side without being moved against each other. The margin is taken off: a
|
|
61
|
+
browser gives none to a dt, and the list counts on none. */
|
|
62
|
+
::slotted(dt) {
|
|
63
|
+
grid-column: 1 / -1;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
margin: 0;
|
|
66
|
+
color: var(--el-color-fg-muted, inherit);
|
|
67
|
+
font-size: var(--el-font-size-sm, 0.875em);
|
|
68
|
+
line-height: 1lh;
|
|
69
|
+
overflow-wrap: anywhere;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* ── Value ────────────────────────────────────────────────────────────── */
|
|
73
|
+
|
|
74
|
+
/* A long value breaks, inside of a word where it has to: it cannot widen the list. The margin
|
|
75
|
+
is the one the browser gives a dd. It stands right under its name: moved up by the gap of
|
|
76
|
+
the grid, with a position, which takes no room and which a reset leaves alone. */
|
|
77
|
+
::slotted(dd) {
|
|
78
|
+
grid-column: 1;
|
|
79
|
+
position: relative;
|
|
80
|
+
inset-block-start: calc(-1 * var(--_el-description-list-padding));
|
|
81
|
+
min-width: 0;
|
|
82
|
+
margin: 0;
|
|
83
|
+
overflow-wrap: anywhere;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* ── Action ───────────────────────────────────────────────────────────── */
|
|
87
|
+
|
|
88
|
+
/* At the end of the row, as high as one line of the value and with its content in the middle
|
|
89
|
+
of that line. A button is higher than a line: it reaches out of the box above and below, and
|
|
90
|
+
the row stays as high as a row without an action. */
|
|
91
|
+
::slotted(dd[data-action]) {
|
|
92
|
+
grid-column: 2;
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
height: 1lh;
|
|
96
|
+
overflow-wrap: normal;
|
|
97
|
+
white-space: nowrap;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* The gap to the value is an empty box in front of the content of the action, as wide as the
|
|
101
|
+
gap: the column of the actions has no width, and no gap, in a list without an action. */
|
|
102
|
+
::slotted(dd[data-action])::before {
|
|
103
|
+
content: '';
|
|
104
|
+
flex: none;
|
|
105
|
+
inline-size: var(--_el-description-list-gap);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* ── Line between two rows ────────────────────────────────────────────── */
|
|
109
|
+
|
|
110
|
+
/* A row begins with its name, and the line above a row is drawn by that name: over the whole
|
|
111
|
+
width of the list, in the middle of the room between two rows, which is where the row of
|
|
112
|
+
this name begins. It is a box with a height and a fill, not a border, and it is moved there
|
|
113
|
+
with translate, not with a margin: a reset of the page that takes the border and the margin
|
|
114
|
+
off every element reaches the name and what it generates, and wins there. Without a theme
|
|
115
|
+
the line has no height. */
|
|
116
|
+
::slotted(dt)::before {
|
|
117
|
+
content: '';
|
|
118
|
+
position: absolute;
|
|
119
|
+
inset-inline: 0;
|
|
120
|
+
height: var(--el-border-width, 0);
|
|
121
|
+
translate: 0 calc(-1 * var(--_el-description-list-padding));
|
|
122
|
+
background: var(--el-color-border, transparent);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* Nothing stands above the first row. */
|
|
126
|
+
::slotted(dt:first-child)::before {
|
|
127
|
+
content: none;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Forced colours take a fill away, and keep one that is a colour of the system. */
|
|
131
|
+
@media (forced-colors: active) {
|
|
132
|
+
::slotted(dt)::before {
|
|
133
|
+
background: CanvasText;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* ── Side by side ─────────────────────────────────────────────────────── */
|
|
138
|
+
|
|
139
|
+
/* From 30rem of the list itself: a column for the names, the gap, a column for the values and
|
|
140
|
+
one for the actions. The values of all rows begin on one line. A name and its value are one
|
|
141
|
+
row of the grid here, so the gap between two rows is the room below one and above the next,
|
|
142
|
+
and a value stays where it is. */
|
|
143
|
+
@container (min-width: 30rem) {
|
|
144
|
+
.list {
|
|
145
|
+
grid-template-columns:
|
|
146
|
+
var(--el-description-list-term-width, fit-content(calc(40% - var(--_el-description-list-gap))))
|
|
147
|
+
var(--_el-description-list-gap)
|
|
148
|
+
minmax(0, 1fr)
|
|
149
|
+
auto;
|
|
150
|
+
row-gap: calc(2 * var(--_el-description-list-padding));
|
|
151
|
+
padding-block: var(--_el-description-list-padding);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
::slotted(dt) {
|
|
155
|
+
grid-column: 1;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
::slotted(dd) {
|
|
159
|
+
grid-column: 3;
|
|
160
|
+
inset-block-start: 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
::slotted(dd[data-action]) {
|
|
164
|
+
grid-column: 4;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
`;
|
|
168
|
+
|
|
169
|
+
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.
|