@webtides/element-library 0.4.0 → 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 +107 -0
- package/custom-elements.json +1543 -199
- package/package.json +1 -1
- package/src/components/app-frame/app-frame.changelog.md +14 -0
- package/src/components/app-frame/app-frame.js +14 -2
- package/src/components/app-frame/app-frame.readme.md +12 -3
- package/src/components/app-frame/app-frame.style.js +7 -0
- package/src/components/button/button.changelog.md +6 -0
- package/src/components/button/button.style.js +6 -1
- 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 +17 -0
- package/src/components/description-list/description-list.js +7 -2
- package/src/components/description-list/description-list.readme.md +30 -4
- package/src/components/description-list/description-list.style.js +57 -28
- 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/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 +6 -0
- package/src/components/list/list.js +2 -0
- package/src/components/list/list.readme.md +1 -0
- package/src/components/list-item/list-item.changelog.md +16 -0
- package/src/components/list-item/list-item.js +2 -0
- package/src/components/list-item/list-item.readme.md +19 -1
- package/src/components/list-item/list-item.style.js +23 -11
- package/src/components/menu/menu.changelog.md +17 -0
- package/src/components/menu/menu.js +293 -70
- package/src/components/menu/menu.readme.md +47 -6
- package/src/components/menu/menu.style.js +6 -2
- package/src/components/menu-item/menu-item.changelog.md +8 -0
- package/src/components/menu-item/menu-item.js +41 -3
- package/src/components/menu-item/menu-item.readme.md +45 -7
- package/src/components/menu-item/menu-item.style.js +30 -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/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/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/styles/choice-group.style.js +26 -0
- package/src/styles/input-control.style.js +87 -0
- package/src/styles/native.css +100 -0
- package/src/utils/floating.js +15 -1
- package/src/utils/options.js +35 -0
- package/src/utils/text-entry-attributes.js +13 -0
- package/types/src/components/app-frame/app-frame.d.ts +7 -1
- 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 +7 -2
- 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 +2 -0
- package/types/src/components/list-item/list-item.d.ts +2 -0
- package/types/src/components/menu/menu.d.ts +105 -9
- package/types/src/components/menu-item/menu-item.d.ts +21 -0
- package/types/src/components/otp-field/otp-field.d.ts +10 -0
- 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/textarea-field/textarea-field.d.ts +7 -0
- package/types/src/styles/input-control.style.d.ts +15 -0
- package/types/src/utils/floating.d.ts +11 -0
- package/types/src/utils/options.d.ts +17 -0
- package/types/src/utils/text-entry-attributes.d.ts +10 -0
- package/web-types.json +514 -24
package/package.json
CHANGED
|
@@ -12,6 +12,20 @@ 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
|
+
- `skip-landmark-label` is the name of that landmark for assistive technology, `Skip link` by default. The page gives it a name in its language, and one no other navigation of the page has: two navigations of one name are one too many (`landmark-unique`). ([#209](https://github.com/webtides/element-library/issues/209))
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- The frame has a landmark of its own now, where it had none: a page sees one more navigation in its list of landmarks. A page that worked around the finding, with a skip link of its own in its banner and `el-app-frame::part(skip-link) { display: none }`, takes both out: it would have two skip links, or a navigation with nothing in it. ([#209](https://github.com/webtides/element-library/issues/209))
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- The link that skips to the content lies in a landmark: a navigation (`<nav>`) of the frame, the part `skip-landmark`. A page whose shell is a frame was reported by axe on every view (`region: el-app-frame,.skip`): content outside of a landmark. axe lets a skip link stand alone, and knows one by its place in front of the first link of the page that leads elsewhere; the link of the frame is in a shadow root, and so is the first link of most views (an `el-nav-item`), so neither is in front of the other in the document. A link the page writes in front of the frame is reported for the same reason. The link stays the first stop of the Tab key, where the frame is narrow and where it is wide, does what it did, and has its text from `skip-label`. The landmark takes no room, and is in server-rendered markup. ([#209](https://github.com/webtides/element-library/issues/209))
|
|
28
|
+
|
|
15
29
|
## [0.4.0] - 2026-11-27
|
|
16
30
|
|
|
17
31
|
### Added
|
|
@@ -56,7 +56,8 @@ const ECHO = 200;
|
|
|
56
56
|
* landmarks, and slots them: `<header slot="header">`, `<nav slot="navigation" aria-label="…">`,
|
|
57
57
|
* `<main id="…">`, `<aside slot="aside">`, `<footer slot="footer">`. The frame adds the layout,
|
|
58
58
|
* the room for the notch and the home indicator of a phone, and a link that skips to the content
|
|
59
|
-
* as the first stop of the Tab key.
|
|
59
|
+
* as the first stop of the Tab key. That link lies in the one landmark the frame has of its own,
|
|
60
|
+
* a navigation the page names (`skip-landmark-label`): content of a page belongs into a landmark.
|
|
60
61
|
*
|
|
61
62
|
* From the width `wide-from` names, the navigation and the aside are columns beside the content,
|
|
62
63
|
* and each scrolls on its own. Where the frame is narrow, the content and the aside are one
|
|
@@ -101,6 +102,7 @@ const ECHO = 200;
|
|
|
101
102
|
* @slot footer - The region at the lower edge. Left out while it is empty.
|
|
102
103
|
*
|
|
103
104
|
* @csspart base - The frame: the grid of the regions.
|
|
105
|
+
* @csspart skip-landmark - The landmark the skip link lies in: a `<nav>`.
|
|
104
106
|
* @csspart skip-link - The link that skips to the content. It shows while it has the focus.
|
|
105
107
|
* @csspart header - The region at the top. Its surface reaches under the status bar of a phone.
|
|
106
108
|
* @csspart navigation - The region at the start side, where the frame is wide.
|
|
@@ -136,6 +138,9 @@ const ECHO = 200;
|
|
|
136
138
|
*
|
|
137
139
|
* @property {string} skipLabel - The text of the link that skips to the content. Default
|
|
138
140
|
* `'Skip to content'`.
|
|
141
|
+
* @property {string} skipLandmarkLabel - The name of the landmark that link lies in, a
|
|
142
|
+
* navigation, for assistive technology. It has to differ from the names of the other
|
|
143
|
+
* navigations of the page. Default `'Skip link'`.
|
|
139
144
|
* @property {'30rem'|'40rem'|'48rem'|'64rem'|'80rem'} wideFrom - The width of the frame from
|
|
140
145
|
* which the navigation and the aside are columns beside the content. One of the steps the
|
|
141
146
|
* stylesheet knows, another value is the default. Default `'48rem'`.
|
|
@@ -285,6 +290,7 @@ export default class AppFrame extends TemplateElement {
|
|
|
285
290
|
properties() {
|
|
286
291
|
return {
|
|
287
292
|
skipLabel: 'Skip to content',
|
|
293
|
+
skipLandmarkLabel: 'Skip link',
|
|
288
294
|
wideFrom: DEFAULT_STEP,
|
|
289
295
|
narrowOnly: '',
|
|
290
296
|
wideOnly: '',
|
|
@@ -1027,8 +1033,14 @@ export default class AppFrame extends TemplateElement {
|
|
|
1027
1033
|
.map(([region, size]) => `--_el-app-frame-${region}-size: ${Math.round(Number(size))}px;`)
|
|
1028
1034
|
.join(' ');
|
|
1029
1035
|
|
|
1036
|
+
// The link lies in a landmark of the frame: a tool that checks a page finds the content
|
|
1037
|
+
// outside of one otherwise, and it cannot see that this is a skip link, which may stand
|
|
1038
|
+
// alone. It knows one by its place in front of the first link that leads elsewhere, and a
|
|
1039
|
+
// link in a shadow root is in front of nothing in the document.
|
|
1030
1040
|
return html`
|
|
1031
|
-
<
|
|
1041
|
+
<nav part="skip-landmark" class="skip-landmark" aria-label="${this.skipLandmarkLabel}">
|
|
1042
|
+
<a part="skip-link" class="skip" href="#${id || ''}">${this.skipLabel}</a>
|
|
1043
|
+
</nav>
|
|
1032
1044
|
<div
|
|
1033
1045
|
part="base"
|
|
1034
1046
|
ref="base"
|
|
@@ -41,6 +41,7 @@ A page that reaches under the notch and the home indicator of a phone says so in
|
|
|
41
41
|
| Name | Type | Default | Description |
|
|
42
42
|
| --- | --- | --- | --- |
|
|
43
43
|
| `skip-label` | `string` | `'Skip to content'` | The text of the link that skips to the content. |
|
|
44
|
+
| `skip-landmark-label` | `string` | `'Skip link'` | The name of the landmark that link lies in, a navigation, for assistive technology. It has to differ from the names of the other navigations of the page. |
|
|
44
45
|
| `wide-from` | `'30rem' \| '40rem' \| '48rem' \| '64rem' \| '80rem'` | `'48rem'` | The width of the frame from which the navigation and the aside are columns beside the content. Another value is the default. |
|
|
45
46
|
| `narrow-only` | `string` | `''` | The regions that are there only where the frame is narrow: `header`, `navigation`, `aside`, `footer`, with a space between them. |
|
|
46
47
|
| `wide-only` | `string` | `''` | The regions that are there only where the frame is wide, named the same way. |
|
|
@@ -89,6 +90,7 @@ _None._
|
|
|
89
90
|
| Name | Description |
|
|
90
91
|
| --------------------- | -------------------------------------------------------------------------------------- |
|
|
91
92
|
| `base` | The frame: the grid of the regions. |
|
|
93
|
+
| `skip-landmark` | The landmark the skip link lies in: a `<nav>`. |
|
|
92
94
|
| `skip-link` | The link that skips to the content. It shows while it has the focus. |
|
|
93
95
|
| `header` | The region at the top. Its surface reaches under the status bar of a phone. |
|
|
94
96
|
| `navigation` | The region at the start side, where the frame is wide. |
|
|
@@ -129,8 +131,9 @@ The frame knows regions, not what they mean: the footer is a bar of destinations
|
|
|
129
131
|
| `aside` | `<aside slot="aside">` | complementary |
|
|
130
132
|
| `footer` | `<footer slot="footer">` | contentinfo |
|
|
131
133
|
|
|
132
|
-
- The frame adds no landmark
|
|
133
|
-
-
|
|
134
|
+
- The frame adds no landmark for a region. A component that is a navigation itself, an `el-breadcrumb` for example, goes into the slot without a `nav` around it: the landmark would be there twice.
|
|
135
|
+
- The frame has one landmark of its own: a navigation around its [link that skips to the content](#the-link-that-skips-to-the-content), with the name `skip-landmark-label` gives it.
|
|
136
|
+
- A page with two navigations gives each a name (`aria-label`), so a screen reader can tell them apart. The navigation of the skip link is one of them, and has a name: a navigation of the page needs another one, or none.
|
|
134
137
|
- The frame cannot make sure of the landmarks. A `<div slot="header">` is laid out as a header and is none.
|
|
135
138
|
|
|
136
139
|
## What scrolls
|
|
@@ -308,9 +311,14 @@ frame.addEventListener('app-frame-resize-end', ({ detail }) => {
|
|
|
308
311
|
The first stop of the Tab key in the frame is a link that skips the header and the navigation. It is off the screen until it has the focus, and shows in the corner at the start then.
|
|
309
312
|
|
|
310
313
|
- Its text is `skip-label`: `<el-app-frame skip-label="Zum Inhalt">`.
|
|
314
|
+
- It lies in a landmark of the frame, a navigation (`<nav>`) with the name of `skip-landmark-label`, `Skip link` by default: `<el-app-frame skip-landmark-label="Sprunglink">`. Give it a name in the language of the page, and one that no other navigation of the page has. The landmark takes no room.
|
|
311
315
|
- It leads to the `main` of the page, or to the first element in the default slot. Give that element an **id**: the link is a link to it (`href="#main"`), which works before the script has run. Without an id the link needs the script.
|
|
312
316
|
- After it, the content is in view from its start, the keys scroll it, and the Tab key goes on with the first control in it. The address of the page stays as it is.
|
|
313
317
|
|
|
318
|
+
**Why a landmark.** All content of a page belongs into a landmark, and a tool that checks a page says so (the rule `region` of axe). Such a tool lets a skip link stand alone, and knows one by its place: in front of the first link of the page that leads elsewhere. It compares the two in the document. The link of the frame is in a shadow root, and so is the first link of most views, in an `el-nav-item` or an `el-list-item`: neither is in front of the other, and the link was reported on every page with a frame. A link the page writes in front of the frame is reported for the same reason. A link in a landmark is content in a landmark, on every view.
|
|
319
|
+
|
|
320
|
+
A page that had a skip link of its own for that reason, and hid the one of the frame (`el-app-frame::part(skip-link) { display: none }`), takes both out: it would have two skip links, or a landmark with nothing in it.
|
|
321
|
+
|
|
314
322
|
## On a phone
|
|
315
323
|
|
|
316
324
|
With `viewport-fit=cover`, and as a web app on the home screen, the page reaches under the notch, the rounded corners and the home indicator. The frame keeps what the user reads and taps clear of them:
|
|
@@ -409,8 +417,9 @@ Without server rendering, the regions of the page are below each other until the
|
|
|
409
417
|
|
|
410
418
|
## Accessibility
|
|
411
419
|
|
|
412
|
-
- The landmarks are the elements of the page, see above. The frame has
|
|
420
|
+
- The landmarks of the regions are the elements of the page, see above. The frame has one of its own, the navigation around its skip link, and its other parts have no role.
|
|
413
421
|
- The skip link is the first stop of the Tab key, and has a surface and a border of its own, without a theme as well.
|
|
422
|
+
- A page whose shell is the frame, with a header, a navigation and a `main`, has no finding of the default rules of axe (4.14), checked as a whole document: `region`, `landmark-unique` and `landmark-no-duplicate-banner` among them.
|
|
414
423
|
- The lines between the regions are borders. They stay where the user forces colours, and they are there without a theme then: nothing else tells two regions apart.
|
|
415
424
|
- Without a theme the frame paints nothing: it reads as the page does, in a light and in a dark scheme.
|
|
416
425
|
- Start and end follow the reading direction: in a text that runs from right to left the navigation is at the right.
|
|
@@ -78,6 +78,12 @@ const style = css`
|
|
|
78
78
|
|
|
79
79
|
/* ── The link that skips to the content ───────────────────────────────── */
|
|
80
80
|
|
|
81
|
+
/* The landmark around the link has no box of its own to see: the link is out of the flow, so
|
|
82
|
+
the landmark has no height, and the frame under it begins at the upper edge. */
|
|
83
|
+
.skip-landmark {
|
|
84
|
+
display: block;
|
|
85
|
+
}
|
|
86
|
+
|
|
81
87
|
.skip {
|
|
82
88
|
position: absolute;
|
|
83
89
|
z-index: 1;
|
|
@@ -518,6 +524,7 @@ const printStyle = css`
|
|
|
518
524
|
display: none;
|
|
519
525
|
}
|
|
520
526
|
|
|
527
|
+
.skip-landmark,
|
|
521
528
|
.skip {
|
|
522
529
|
display: none;
|
|
523
530
|
}
|
|
@@ -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
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- In an `el-button-group` the control of a button with a neighbour in front lies on the border of that neighbour by itself: it reads the width from the group (`--_el-group-overlap`, internal and inherited), where the group gave the element a negative margin before. The element of such a button stands beside its neighbour and is narrower than its control by that border. Outside of a group nothing changes. ([#206](https://github.com/webtides/element-library/issues/206))
|
|
20
|
+
|
|
15
21
|
## [0.4.0] - 2026-11-27
|
|
16
22
|
|
|
17
23
|
### Added
|
|
@@ -29,7 +29,6 @@ const style = css`
|
|
|
29
29
|
align-items: center;
|
|
30
30
|
justify-content: center;
|
|
31
31
|
gap: var(--el-space-2, 0.5em);
|
|
32
|
-
width: 100%;
|
|
33
32
|
/* The size of the button: its own, from the size module. A button in a toolbar reads the
|
|
34
33
|
size of the toolbar first, see "In a container" below. */
|
|
35
34
|
--_el-button-height: var(--_el-size-height);
|
|
@@ -47,6 +46,12 @@ const style = css`
|
|
|
47
46
|
border-end-start-radius: var(--_el-group-radius-start, var(--_el-button-radius));
|
|
48
47
|
border-start-end-radius: var(--_el-group-radius-end, var(--_el-button-radius));
|
|
49
48
|
border-end-end-radius: var(--_el-group-radius-end, var(--_el-button-radius));
|
|
49
|
+
/* And with a neighbour in front the control lies on the border of that neighbour: it is
|
|
50
|
+
pulled over the element by the width the group names (--_el-group-overlap), and is
|
|
51
|
+
wider than the element by as much, so it ends where the element ends. Outside of a
|
|
52
|
+
group the width is nothing. */
|
|
53
|
+
margin-inline-start: calc(-1 * var(--_el-group-overlap, 0px));
|
|
54
|
+
width: calc(100% + var(--_el-group-overlap, 0px));
|
|
50
55
|
font-family: var(--el-font-family, inherit);
|
|
51
56
|
font-size: var(--_el-button-font-size);
|
|
52
57
|
font-weight: 600;
|
|
@@ -12,6 +12,16 @@ 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
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- A page that put the overlap back itself, with a negative margin for the buttons of a group, takes that rule out: the buttons would lie on each other by two borders. ([#206](https://github.com/webtides/element-library/issues/206))
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- The buttons of a group lie on the border of their neighbour on a page whose stylesheet takes the margin off every element (`* { margin: 0 }`, the reset of Tailwind CSS v4). The group pulled a button over the border of the one in front of it with a negative margin of the button (`::slotted`), and a rule of the page wins over such a rule: two outlined buttons had two lines between them, and the group was wider by a border for every button after the first. The group names the width of the border in a property that inherits now (`--_el-group-overlap`), and the button pulls its control over it. ([#206](https://github.com/webtides/element-library/issues/206))
|
|
24
|
+
|
|
15
25
|
## [0.3.0] - 2026-11-17
|
|
16
26
|
|
|
17
27
|
### Added
|
|
@@ -68,6 +68,8 @@ _None._ The group takes the radius and the border width from the tokens of the t
|
|
|
68
68
|
|
|
69
69
|
The group does this with its stylesheet alone. It runs no script on its buttons and writes nothing onto them: a button that is added, moved or taken away is joined at once, and a server-rendered group does not change when the elements take over.
|
|
70
70
|
|
|
71
|
+
It tells its buttons in properties that inherit, and a button joins itself: the group takes nothing from the margin, the padding or the border of the elements slotted into it. So a reset of the page that takes the margin off every element (`* { margin: 0 }`) changes nothing. The element of a button with a neighbour in front stands beside that neighbour; its control, which has the border, lies on the border of the neighbour.
|
|
72
|
+
|
|
71
73
|
## What the buttons bring
|
|
72
74
|
|
|
73
75
|
`variant`, `appearance`, `size`, `pill` and `disabled` stay with every button. The group does not pass anything on. Give every button of a group the same `size`; a mix of appearances works, a mix of sizes does not line up.
|
|
@@ -19,11 +19,15 @@ const style = css`
|
|
|
19
19
|
/* With a neighbour in front: square corners at the start, and the border at the start lies on
|
|
20
20
|
the border at the end of that neighbour, so the two share one line. For a filled button
|
|
21
21
|
that line is a quarter of its text colour on its fill, which shows between two fills of
|
|
22
|
-
one colour. currentColor is taken where the button paints the line, not here.
|
|
22
|
+
one colour. currentColor is taken where the button paints the line, not here.
|
|
23
|
+
|
|
24
|
+
The group names the width of that border, and the button pulls its control over it. A
|
|
25
|
+
margin of the slotted element would do the same, and would be gone on a page that takes
|
|
26
|
+
the margin off every element: a rule of the page wins over a ::slotted rule. */
|
|
23
27
|
::slotted(:not(:first-child)) {
|
|
24
28
|
--_el-group-radius-start: 0px;
|
|
25
29
|
--_el-group-divider: color-mix(in srgb, currentColor 25%, transparent);
|
|
26
|
-
|
|
30
|
+
--_el-group-overlap: var(--el-border-width, 1px);
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
/* With a neighbour behind: square corners at the end. */
|
|
@@ -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
|
+
- An option can show something in front of its label: `color` is a colour that is drawn as a dot, `icon` the address of an SVG symbol, as an option of `el-segmented-field` has it. Things a user knows by their colour, tags or calendars, are found by it where they are chosen. Both are decorations, hidden from assistive technology: the label stays the name of the option. They are part of the option, so they work for options as an attribute and as a property, and are in server-rendered markup. The dot keeps its colour where the user forces colours. ([#198](https://github.com/webtides/element-library/issues/198))
|
|
20
|
+
|
|
15
21
|
## [0.3.0] - 2026-11-17
|
|
16
22
|
|
|
17
23
|
### Added
|
|
@@ -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');
|
|
@@ -12,6 +12,23 @@ 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
|
+
- `--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
|
+
|
|
15
32
|
## [0.4.0] - 2026-11-27
|
|
16
33
|
|
|
17
34
|
### Added
|
|
@@ -21,8 +21,13 @@ import style from './description-list.style.js';
|
|
|
21
21
|
* @csspart base - The `<dl>`.
|
|
22
22
|
*
|
|
23
23
|
* @cssproperty --el-description-list-term-width - The width of the column of the names while
|
|
24
|
-
* names and values stand side by side.
|
|
25
|
-
* 40% of the list at most.
|
|
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.
|
|
26
31
|
*/
|
|
27
32
|
export default class DescriptionList extends TemplateElement {
|
|
28
33
|
constructor() {
|
|
@@ -62,7 +62,9 @@ _None._
|
|
|
62
62
|
|
|
63
63
|
| Name | Default | Description |
|
|
64
64
|
| --- | --- | --- |
|
|
65
|
-
| `--el-description-list-term-width` |
|
|
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`. |
|
|
66
68
|
|
|
67
69
|
## What the page writes
|
|
68
70
|
|
|
@@ -71,7 +73,8 @@ The element takes the place of the `<dl>`: the `<dl>` itself is inside of the el
|
|
|
71
73
|
- A `<dt>` for the name, then a `<dd>` for the value. A row begins with its `<dt>`.
|
|
72
74
|
- A name can have several values, a `<dd>` each. Each of them has a row of its own, without a line above it.
|
|
73
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.
|
|
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
|
|
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).
|
|
75
78
|
|
|
76
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.
|
|
77
80
|
|
|
@@ -80,9 +83,9 @@ A tool that checks the markup of the page alone reports a `<dt>` that is not in
|
|
|
80
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.
|
|
81
84
|
|
|
82
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.
|
|
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.
|
|
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.
|
|
84
87
|
|
|
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:
|
|
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:
|
|
86
89
|
|
|
87
90
|
```css
|
|
88
91
|
el-description-list {
|
|
@@ -114,6 +117,29 @@ On a touch screen an `el-button` is at least `--el-touch-target` high and wide.
|
|
|
114
117
|
|
|
115
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`.
|
|
116
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
|
+
|
|
117
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.
|
|
118
144
|
|
|
119
145
|
The list has no surface. Put it into an `el-card` for one. The `hidden` attribute hides it.
|