@webtides/element-library 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +208 -0
- package/README.md +72 -56
- package/all.js +16 -0
- package/catalog.js +17 -1
- package/custom-elements.json +14731 -10193
- 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 +45 -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 +1073 -0
- package/src/components/app-frame/app-frame.readme.md +416 -0
- package/src/components/app-frame/app-frame.style.js +527 -0
- package/src/components/button/button.changelog.md +25 -0
- package/src/components/button/button.events.js +3 -0
- package/src/components/button/button.js +209 -14
- package/src/components/button/button.readme.md +82 -6
- package/src/components/button/button.style.js +161 -7
- package/src/components/checkbox-field/checkbox-field.changelog.md +6 -0
- package/src/components/checkbox-field/checkbox-field.js +7 -1
- package/src/components/description-list/description-list.changelog.md +25 -0
- package/src/components/description-list/description-list.define.js +3 -0
- package/src/components/description-list/description-list.js +44 -0
- package/src/components/description-list/description-list.readme.md +135 -0
- package/src/components/description-list/description-list.style.js +140 -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/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/list/list.changelog.md +24 -0
- package/src/components/list/list.define.js +3 -0
- package/src/components/list/list.js +66 -0
- package/src/components/list/list.readme.md +122 -0
- package/src/components/list/list.style.js +56 -0
- package/src/components/list-item/list-item.changelog.md +24 -0
- package/src/components/list-item/list-item.define.js +3 -0
- package/src/components/list-item/list-item.js +128 -0
- package/src/components/list-item/list-item.readme.md +126 -0
- package/src/components/list-item/list-item.style.js +234 -0
- package/src/components/menu/menu.changelog.md +27 -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 +570 -0
- package/src/components/menu/menu.readme.md +272 -0
- package/src/components/menu/menu.style.js +55 -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 +24 -0
- package/src/components/menu-item/menu-item.define.js +3 -0
- package/src/components/menu-item/menu-item.js +130 -0
- package/src/components/menu-item/menu-item.readme.md +94 -0
- package/src/components/menu-item/menu-item.style.js +87 -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/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/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/switch-field/switch-field.changelog.md +6 -0
- package/src/components/switch-field/switch-field.js +7 -1
- 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/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 +1 -1
- package/src/styles/modal.style.js +14 -1
- package/src/styles/size.style.js +41 -0
- package/src/utils/focus.js +69 -0
- package/src/utils/scroll.js +24 -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 +491 -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 +97 -7
- package/types/src/components/button/button.events.d.ts +4 -0
- package/types/src/components/description-list/description-list.d.ts +29 -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/list/list.d.ts +39 -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 +62 -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 +266 -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 +59 -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/pagination/pagination.d.ts +31 -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/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/modal.style.d.ts +5 -0
- package/types/src/styles/size.style.d.ts +24 -0
- package/types/src/utils/focus.d.ts +25 -0
- package/types/src/utils/scroll.d.ts +11 -0
- package/web-types.json +2530 -393
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# ListItem
|
|
2
|
+
|
|
3
|
+
`list-item` is one row of an [`el-list`](../list/list.readme.md). It has the parts a row has everywhere: something at the start, a title, a line under it, something at the end, and a control of its own after that. With `href` the row is a link as a whole.
|
|
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/list/define';
|
|
17
|
+
import '@webtides/element-library/list-item/define';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<el-list label="Files">
|
|
22
|
+
<el-list-item href="/files/notes.pdf">
|
|
23
|
+
<el-svg-use slot="start" name="file"></el-svg-use>
|
|
24
|
+
notes.pdf
|
|
25
|
+
<span slot="description">240 KB</span>
|
|
26
|
+
<el-badge slot="end" pill="true">3</el-badge>
|
|
27
|
+
<el-button slot="action" size="small" appearance="plain" aria-label="Remove notes.pdf">✕</el-button>
|
|
28
|
+
</el-list-item>
|
|
29
|
+
</el-list>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> Boolean attributes are passed as strings (`current="true"`), matching the rest of the library.
|
|
33
|
+
|
|
34
|
+
## API
|
|
35
|
+
|
|
36
|
+
#### Properties/Attributes
|
|
37
|
+
|
|
38
|
+
| Name | Type | Default | Description |
|
|
39
|
+
| --- | --- | --- | --- |
|
|
40
|
+
| `href` | `string` | `''` | The address the row leads to. Unset, the row is no link. |
|
|
41
|
+
| `target` | `string` | `''` | Where to open the address (only with `href`). |
|
|
42
|
+
| `rel` | `string` | `'noreferrer noopener'` | `rel` attribute for the link, written when `target` is set. |
|
|
43
|
+
| `current` | `boolean` | `false` | The row is the current or the chosen one: it gets `aria-current`, a bar at its start and a heavier title. |
|
|
44
|
+
| `mark` | `string` | `''` | Marks the row with a dot in the padding at its start. The text is read in front of the title. Unset, the row has no mark. |
|
|
45
|
+
| `truncate` | `boolean` | `false` | Cuts the title and the line under it after one line, with an ellipsis. |
|
|
46
|
+
|
|
47
|
+
#### Methods
|
|
48
|
+
|
|
49
|
+
_None._
|
|
50
|
+
|
|
51
|
+
#### Events
|
|
52
|
+
|
|
53
|
+
_None._
|
|
54
|
+
|
|
55
|
+
#### Slots
|
|
56
|
+
|
|
57
|
+
| Name | Description |
|
|
58
|
+
| --- | --- |
|
|
59
|
+
| (default) | The title of the row. |
|
|
60
|
+
| `description` | The line under the title. |
|
|
61
|
+
| `start` | What stands in front of the texts: an icon, an avatar. |
|
|
62
|
+
| `end` | What stands at the end of the row and belongs to it: a value, a count, a chevron. In a row that is a link it is part of the target of the link. |
|
|
63
|
+
| `action` | A control at the very end: a button, a switch, a menu. In a row that is a link it lies on top of the link and is a target of its own. |
|
|
64
|
+
|
|
65
|
+
#### CSS Parts
|
|
66
|
+
|
|
67
|
+
| Name | Description |
|
|
68
|
+
| ------------- | ---------------------------------------------------- |
|
|
69
|
+
| `base` | The row: an item of the list. |
|
|
70
|
+
| `mark` | The dot of `mark`, in the padding at the start. |
|
|
71
|
+
| `start` | The region of the `start` slot. |
|
|
72
|
+
| `text` | The title and the line under it. |
|
|
73
|
+
| `title` | The title: an `<a>` with `href`, a `<span>` without. |
|
|
74
|
+
| `description` | The region of the `description` slot. |
|
|
75
|
+
| `end` | The region of the `end` slot. |
|
|
76
|
+
| `action` | The region of the `action` slot. |
|
|
77
|
+
|
|
78
|
+
#### CSS Custom Properties
|
|
79
|
+
|
|
80
|
+
| Name | Default | Description |
|
|
81
|
+
| --- | --- | --- |
|
|
82
|
+
| `--el-list-padding-inline` | `--el-space-4` | The padding of the row at its start and its end. Set on the list, or for the page. Without a theme it is `1rem`. |
|
|
83
|
+
|
|
84
|
+
## A row that is a link
|
|
85
|
+
|
|
86
|
+
With `href` the title is a native link, and the target of that link is the whole row: the padding, the start, the texts and the end. A click anywhere on the row follows the link, and it is a real link there: the context menu, a middle click and "open in a new tab" work as on any link. The name of the link is the title alone; the line under it and the end are text beside it.
|
|
87
|
+
|
|
88
|
+
The link takes the keyboard focus once, and its focus ring is drawn around the row, inside of it.
|
|
89
|
+
|
|
90
|
+
On a touch screen (`@media (any-pointer: coarse)`) a row that is a link is at least `--el-touch-target` high.
|
|
91
|
+
|
|
92
|
+
## `end` and `action`
|
|
93
|
+
|
|
94
|
+
Both stand at the end of the row, `end` first.
|
|
95
|
+
|
|
96
|
+
- **`end`** is for what belongs to the row: a value, a count, a time, a chevron. In a row that is a link, a click on it follows the link.
|
|
97
|
+
- **`action`** is for a control: a button, a switch, a menu. It lies on top of the link and is a target of its own, with a place of its own in the tab order after the link.
|
|
98
|
+
|
|
99
|
+
A control belongs into `action`. In `end` it would lie under the link of the row, and a click on it would follow the link. In a row without `href` the two only differ in their order and their colour.
|
|
100
|
+
|
|
101
|
+
## The current row
|
|
102
|
+
|
|
103
|
+
`current` marks the row of the page the user is on, or the row that is chosen: the message that is open beside the list. A row with `href` gets `aria-current="page"` on its link, a row without gets `aria-current="true"`.
|
|
104
|
+
|
|
105
|
+
It is told apart by a tint of the text colour, by a bar at its start in the accent colour and by a heavier title. The bar and the weight do not depend on a colour: where the user forces colours, the bar is drawn in a colour of the system.
|
|
106
|
+
|
|
107
|
+
## A mark
|
|
108
|
+
|
|
109
|
+
`mark="Unread"` draws a dot in the padding at the start of the row, in the accent colour. It is out of the flow: a row with a mark has its start and its texts where a row without one has them. The text of the attribute is for assistive technology: it is read in front of the title, and it is part of the name of the link ("Unread Ada Lovelace"). Write it in the language of the page.
|
|
110
|
+
|
|
111
|
+
## Long texts
|
|
112
|
+
|
|
113
|
+
A title that is longer than the row breaks into more lines, and so does the line under it. A text without a space (an address, a word a user typed) breaks inside of the word: a row is never wider than its list. What is in `end` takes half of the row at most and breaks after that.
|
|
114
|
+
|
|
115
|
+
`truncate="true"` cuts the title and the line under it after one line, with an ellipsis. What is cut is not shown anywhere else; use it where the row leads to the whole text.
|
|
116
|
+
|
|
117
|
+
## Accessibility
|
|
118
|
+
|
|
119
|
+
- The row has `role="listitem"`. Use it in an `el-list`, which is the list.
|
|
120
|
+
- A row with `href` holds one link, named by the title. The texts beside it are read with the row.
|
|
121
|
+
- An icon or an avatar in `start` that only repeats the title should be hidden from assistive technology (`aria-hidden="true"`), or have a name that adds something.
|
|
122
|
+
- A control in `action` needs a name that says which row it acts on ("Remove notes.pdf"), because a screen reader user may reach it without the row.
|
|
123
|
+
|
|
124
|
+
## Server-side rendering
|
|
125
|
+
|
|
126
|
+
The row, its link and its parts are part of the server-rendered markup (Declarative Shadow DOM). The row runs no script: it looks the same before and after its JavaScript has loaded, and its link works before that.
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import hostStyle from '../../styles/host.style.js';
|
|
2
|
+
|
|
3
|
+
const css = String.raw;
|
|
4
|
+
|
|
5
|
+
const style = css`
|
|
6
|
+
/*
|
|
7
|
+
* A row of the grid of its list: it spans the two columns and takes them over, so its start is
|
|
8
|
+
* in the first one and its texts begin where the texts of the other rows do. A row that is in
|
|
9
|
+
* no list has two columns of its own.
|
|
10
|
+
*/
|
|
11
|
+
:host {
|
|
12
|
+
display: grid;
|
|
13
|
+
grid-column: 1 / -1;
|
|
14
|
+
grid-template-columns: var(--_el-list-columns, auto minmax(0, 1fr));
|
|
15
|
+
min-width: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.item {
|
|
19
|
+
/* What the list tells its rows ends here: a row of another list in the content of this
|
|
20
|
+
one is in no grid of this list. */
|
|
21
|
+
--_el-list-columns: initial;
|
|
22
|
+
--_el-list-item-padding-inline: var(--el-list-padding-inline, var(--el-space-4, 1rem));
|
|
23
|
+
--_el-list-item-gap: var(--el-space-3, 0.75rem);
|
|
24
|
+
|
|
25
|
+
display: grid;
|
|
26
|
+
grid-column: 1 / -1;
|
|
27
|
+
grid-template-columns: subgrid;
|
|
28
|
+
align-items: center;
|
|
29
|
+
/* The link of a row is as large as this box, and the control at its end lies on top of
|
|
30
|
+
the link. Both stay inside of the row. */
|
|
31
|
+
position: relative;
|
|
32
|
+
isolation: isolate;
|
|
33
|
+
min-width: 0;
|
|
34
|
+
padding: var(--_el-list-padding-block, var(--el-space-3, 0.75rem)) var(--_el-list-item-padding-inline);
|
|
35
|
+
color: var(--el-color-fg, inherit);
|
|
36
|
+
font-family: var(--el-font-family, inherit);
|
|
37
|
+
font-size: var(--el-font-size-md, inherit);
|
|
38
|
+
line-height: var(--el-line-height, inherit);
|
|
39
|
+
transition: background var(--el-duration-md, 0s) var(--el-ease, linear);
|
|
40
|
+
/* The line between two rows. Without a theme it has no width. It is drawn inside of the
|
|
41
|
+
shadow root: a reset of the page that takes the border off every element reaches the
|
|
42
|
+
host, and wins there. */
|
|
43
|
+
border-block-start: var(--el-border-width, 0) solid var(--el-color-border, transparent);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Nothing stands above the first row. */
|
|
47
|
+
:host(:first-of-type) .item {
|
|
48
|
+
border-block-start: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* ── Start ────────────────────────────────────────────────────────────── */
|
|
52
|
+
|
|
53
|
+
.start {
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* The gap to the texts comes with what is slotted, so a row without a start has none, and a
|
|
59
|
+
list without a start in any row has no first column. A margin of the page wins over it. */
|
|
60
|
+
::slotted([slot='start']) {
|
|
61
|
+
flex: none;
|
|
62
|
+
margin-inline-end: var(--_el-list-item-gap);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* ── Mark ─────────────────────────────────────────────────────────────── */
|
|
66
|
+
|
|
67
|
+
/* A dot in the middle of the padding at the start of the row. It is out of the flow, so a row
|
|
68
|
+
with a mark has its start and its texts where a row without one has them. A border draws
|
|
69
|
+
it: forced colours take a background away. */
|
|
70
|
+
.mark {
|
|
71
|
+
position: absolute;
|
|
72
|
+
inset-block-start: 50%;
|
|
73
|
+
inset-inline-start: calc(var(--_el-list-item-padding-inline) / 2);
|
|
74
|
+
translate: -50% -50%;
|
|
75
|
+
width: 0;
|
|
76
|
+
height: 0;
|
|
77
|
+
border: 0.25rem solid var(--el-color-accent, currentColor);
|
|
78
|
+
border-radius: 50%;
|
|
79
|
+
pointer-events: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:host(:dir(rtl)) .mark {
|
|
83
|
+
translate: 50% -50%;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* The text of the mark is for assistive technology alone. */
|
|
87
|
+
.mark-text {
|
|
88
|
+
position: absolute;
|
|
89
|
+
width: 1px;
|
|
90
|
+
height: 1px;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
clip-path: inset(50%);
|
|
93
|
+
white-space: nowrap;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* ── Texts ────────────────────────────────────────────────────────────── */
|
|
97
|
+
|
|
98
|
+
.body {
|
|
99
|
+
grid-column: 2;
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
min-width: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* A text a user typed cannot widen the row: it breaks, inside of a word where it has to. */
|
|
106
|
+
.text {
|
|
107
|
+
display: flex;
|
|
108
|
+
flex: 1 1 auto;
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
min-width: 0;
|
|
111
|
+
overflow-wrap: anywhere;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.title {
|
|
115
|
+
display: block;
|
|
116
|
+
min-width: 0;
|
|
117
|
+
color: inherit;
|
|
118
|
+
text-decoration: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.description {
|
|
122
|
+
display: block;
|
|
123
|
+
min-width: 0;
|
|
124
|
+
color: var(--el-color-fg-muted, inherit);
|
|
125
|
+
font-size: var(--el-font-size-sm, 0.875em);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.item--truncate .title,
|
|
129
|
+
.item--truncate .description {
|
|
130
|
+
overflow: hidden;
|
|
131
|
+
text-overflow: ellipsis;
|
|
132
|
+
white-space: nowrap;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* ── End ──────────────────────────────────────────────────────────────── */
|
|
136
|
+
|
|
137
|
+
/* A value, a count, a chevron: it takes the width it has, up to half of the row, and breaks
|
|
138
|
+
after that. */
|
|
139
|
+
.end {
|
|
140
|
+
display: flex;
|
|
141
|
+
flex: 0 1 auto;
|
|
142
|
+
align-items: center;
|
|
143
|
+
min-width: 0;
|
|
144
|
+
max-width: 50%;
|
|
145
|
+
color: var(--el-color-fg-muted, inherit);
|
|
146
|
+
font-size: var(--el-font-size-sm, 0.875em);
|
|
147
|
+
overflow-wrap: anywhere;
|
|
148
|
+
text-align: end;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.action {
|
|
152
|
+
display: flex;
|
|
153
|
+
flex: none;
|
|
154
|
+
align-items: center;
|
|
155
|
+
/* On top of the link of the row: a control here is a target of its own. */
|
|
156
|
+
position: relative;
|
|
157
|
+
z-index: 1;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
::slotted([slot='end']),
|
|
161
|
+
::slotted([slot='action']) {
|
|
162
|
+
margin-inline-start: var(--_el-list-item-gap);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* ── A row that is a link ─────────────────────────────────────────────── */
|
|
166
|
+
|
|
167
|
+
/* The link is the title, and its target is the whole row: the box of the row, drawn by the
|
|
168
|
+
link. It lies on the start, the texts and the end, and under the control at the very end. */
|
|
169
|
+
a.title::after {
|
|
170
|
+
content: '';
|
|
171
|
+
position: absolute;
|
|
172
|
+
inset: 0;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.item--link {
|
|
176
|
+
cursor: pointer;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* A tint of the text colour, which shows on every background. Hover only where the pointer
|
|
180
|
+
can hover: a touch screen leaves :hover on the row that was tapped last. */
|
|
181
|
+
@media (hover: hover) {
|
|
182
|
+
.item--link:has(a.title:hover) {
|
|
183
|
+
background: color-mix(in srgb, currentColor 8%, transparent);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.item--link:has(a.title:active) {
|
|
188
|
+
background: color-mix(in srgb, currentColor 16%, transparent);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/* The ring of a theme, and without one a ring in the colour of the text. It is drawn around
|
|
192
|
+
the row and inside of it: a list with round corners clips what is outside. */
|
|
193
|
+
a.title:focus-visible {
|
|
194
|
+
outline: none;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
a.title:focus-visible::after {
|
|
198
|
+
outline: var(--el-focus-ring-width, 2px) solid var(--el-color-focus-ring, currentColor);
|
|
199
|
+
outline-offset: calc(-1 * var(--el-focus-ring-width, 2px));
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* ── The current row ──────────────────────────────────────────────────── */
|
|
203
|
+
|
|
204
|
+
/* A fill, a bar at the start and a heavier title. The bar and the weight tell the row apart
|
|
205
|
+
without a colour; the bar is a border, which forced colours keep. */
|
|
206
|
+
.item--current {
|
|
207
|
+
background: color-mix(in srgb, currentColor 8%, transparent);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.item--current::before {
|
|
211
|
+
content: '';
|
|
212
|
+
position: absolute;
|
|
213
|
+
inset-block: 0;
|
|
214
|
+
inset-inline-start: 0;
|
|
215
|
+
border-inline-start: 0.1875rem solid var(--el-color-accent, currentColor);
|
|
216
|
+
pointer-events: none;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.item--current .title {
|
|
220
|
+
font-weight: var(--el-font-weight-semibold, 600);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* ── Touch screens ────────────────────────────────────────────────────── */
|
|
224
|
+
|
|
225
|
+
/* On a coarse pointer a row that is a link is at least --el-touch-target high. Without the
|
|
226
|
+
token the sizes stay as they are. */
|
|
227
|
+
@media (any-pointer: coarse) {
|
|
228
|
+
.item--link {
|
|
229
|
+
min-height: var(--el-touch-target, auto);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
`;
|
|
233
|
+
|
|
234
|
+
export default [hostStyle(), style].join('\n');
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this component live here. Versions refer to the parent `@webtides/element-library` release (see root [`CHANGELOG.md`](../../../CHANGELOG.md)); components no longer version independently.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
When your PR touches this component, add an entry under Unreleased and
|
|
9
|
+
mirror it (prefixed with the component name) in root CHANGELOG.md.
|
|
10
|
+
Uncomment headings as needed.
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
## Unreleased
|
|
14
|
+
|
|
15
|
+
## [0.4.0] - 2026-11-27
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Initial `el-menu`: a menu button. A button of the page in the `trigger` slot opens a list of actions, which are `el-menu-item` elements. To assistive technology it is a menu (`role="menu"`) of menu items, and the button says that it opens one and whether it is open (`aria-haspopup="menu"`, `aria-expanded`). ([#167](https://github.com/webtides/element-library/issues/167))
|
|
20
|
+
- A click, `Enter`, `Space` and `ArrowDown` on the button open the menu and put the focus on its first entry, `ArrowUp` on its last. In the menu the arrow keys move through the entries and around the ends, `Home` and `End` go to the first and to the last, and a letter goes to the next entry that starts with it.
|
|
21
|
+
- `Escape` closes the menu and gives the focus back to the button. The Tab key closes it and moves on, and a click beside it closes it.
|
|
22
|
+
- Choosing an entry closes the menu and fires `menu-select`, with the entry in `detail.item` and its `value` in `detail.value`. `menu-show` and `menu-hide` tell of the menu itself, `open` (reflected) and `:state(open)` say whether it is shown, and `show()`, `hide()` and `toggle()` open and close it from a script.
|
|
23
|
+
- The panel is a native popover in the top layer: nothing clips it, and it moves nothing on the page. It is placed at the button with Floating UI, at the side `placement` names (`bottom-start` by default) with a gap of `distance`, on the other side without room there, and never outside of the viewport. A long menu scrolls in what the browser shows. The menu opens and closes that popover itself (`popover="manual"`): a pointer that goes down beside it closes it, `Escape` in the menu closes it and leaves a dialog around it open, and a menu that opens closes the one before it. One the platform closes (`auto`) would be gone when the finger of a long press is lifted.
|
|
24
|
+
- A surface, a border and a shadow from the tokens, with the colours of the system without a theme. `--el-menu-min-width` (`10rem`) and `--el-menu-max-width` (`20rem`) bound its width. An `el-divider` in the menu is a line between two entries.
|
|
25
|
+
- `showAt(place, opener)`: one menu for many things, the rows of a list. It opens the menu at a point of the viewport, for a right click or a long press, with the corner of the menu at the point and the menu inside of the viewport, or at an element of the page, the button of a row, placed as at its own button. ([#186](https://github.com/webtides/element-library/issues/186))
|
|
26
|
+
- What the menu is opened for is its `opener`: the property while the menu is open, `detail.opener` of `menu-select`, and what gets the focus back. An open menu moves when `showAt()` is called again, and tells of both rows (`menu-hide`, `menu-show`).
|
|
27
|
+
- A button of the page that says that it opens a menu (`aria-haspopup="menu"`) is told whether the menu is open for it (`aria-expanded`), and gives the menu its name while it has no `label`.
|