@webtides/element-library 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +193 -0
- package/README.md +72 -56
- package/all.js +16 -0
- package/catalog.js +17 -1
- package/custom-elements.json +14723 -10220
- 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 +15 -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 +161 -7
- 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/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 +61 -0
- 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,139 @@
|
|
|
1
|
+
# Status Bar
|
|
2
|
+
|
|
3
|
+
`status-bar` is the narrow line of state at the lower edge of a tool for a desktop, an editor or an administration: whether the connection is there, what is selected, how many entries there are, a task that runs in the background, the version. It has entries at its start and at its end, in one row that keeps its height.
|
|
4
|
+
|
|
5
|
+
It is not the status bar of the system on a phone (the time, the battery). An [`el-app-frame`](../app-frame/app-frame.readme.md) deals with that one by its safe areas.
|
|
6
|
+
|
|
7
|
+
## How to use
|
|
8
|
+
|
|
9
|
+
#### Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm i --save @webtides/element-library
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
#### Use
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import '@webtides/element-library/status-bar/define';
|
|
19
|
+
import '@webtides/element-library/button/define';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<el-status-bar>
|
|
24
|
+
<span>Connected</span>
|
|
25
|
+
<span>128 entries</span>
|
|
26
|
+
<span role="status">Saved at 10:32</span>
|
|
27
|
+
<el-button slot="end">main</el-button>
|
|
28
|
+
<span slot="end">v1.4.2</span>
|
|
29
|
+
</el-status-bar>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## API
|
|
33
|
+
|
|
34
|
+
#### Properties/Attributes
|
|
35
|
+
|
|
36
|
+
_None._
|
|
37
|
+
|
|
38
|
+
#### Methods
|
|
39
|
+
|
|
40
|
+
_None._
|
|
41
|
+
|
|
42
|
+
#### Events
|
|
43
|
+
|
|
44
|
+
_None._
|
|
45
|
+
|
|
46
|
+
#### Slots
|
|
47
|
+
|
|
48
|
+
| Name | Description |
|
|
49
|
+
| --------- | ------------------------------------------------------------------------------------- |
|
|
50
|
+
| (default) | The entries at the start of the bar. They give way first where the bar is too narrow. |
|
|
51
|
+
| `end` | The entries at the end of the bar. |
|
|
52
|
+
|
|
53
|
+
#### CSS Parts
|
|
54
|
+
|
|
55
|
+
| Name | Description |
|
|
56
|
+
| ------- | ------------------------------------------------- |
|
|
57
|
+
| `base` | The bar: its surface and the line to the content. |
|
|
58
|
+
| `row` | The row of the entries, which keeps its height. |
|
|
59
|
+
| `start` | The entries at the start. |
|
|
60
|
+
| `end` | The entries at the end. |
|
|
61
|
+
|
|
62
|
+
#### CSS Custom Properties
|
|
63
|
+
|
|
64
|
+
Reads `--el-color-bg` and `--el-color-fg-muted` for its surface and its text, `--el-color-border` and `--el-border-width` for the line to the content, `--el-control-height` for its height, `--el-font-size-sm` for its text, `--el-space-2` and `--el-space-3` for its gaps and its padding, `--el-focus-ring-width` for the ring of a button in it, and `--el-touch-target` on a touch screen.
|
|
65
|
+
|
|
66
|
+
## The entries
|
|
67
|
+
|
|
68
|
+
An entry is an element the page writes into the bar. Each is one line and as wide as it is, with a gap to the next.
|
|
69
|
+
|
|
70
|
+
- **A text** is a `<span>`.
|
|
71
|
+
- **An icon** that stands alone has a name: `<svg role="img" aria-label="Connected">`. In front of a text it is a decoration (`aria-hidden="true"`), and the entry lays the two out itself (`display: inline-flex; align-items: center; gap: 0.375em`): the bar does not reach into an entry, and a reset of the page makes an `svg` a block as a rule.
|
|
72
|
+
- **A button** is an [`el-button`](../button/button.readme.md). In the bar it is as high as the bar and plain, and has the small text of the bar. The bar says so in CSS properties that are inherited and writes nothing onto the button: one that names a size or an appearance of its own keeps it. A button with an icon alone is `circle="true"` with an `aria-label`.
|
|
73
|
+
- **A small component**: an [`el-spinner`](../spinner/spinner.readme.md) is as large as the text, an [`el-progress-bar`](../progress-bar/progress-bar.readme.md) gets a width of `6rem` (a rule of the page for the element sets another).
|
|
74
|
+
- An `el-divider` with `orientation="vertical"` between two entries is as high as their text.
|
|
75
|
+
|
|
76
|
+
The entries at the start are in the default slot, the ones at the end in the slot `end`. Start and end follow the reading direction.
|
|
77
|
+
|
|
78
|
+
## The height
|
|
79
|
+
|
|
80
|
+
The bar is lower than a control: seven tenths of `--el-control-height` (`1.75rem` of `2.5rem`). It keeps that height whatever is in it, a button and a text in two lines as well: what is higher than the bar is cut.
|
|
81
|
+
|
|
82
|
+
## Entries that do not fit
|
|
83
|
+
|
|
84
|
+
Nothing wraps, and no entry lies on another.
|
|
85
|
+
|
|
86
|
+
- The entries at the start give way first: their group is cut at its end, so the last of them go.
|
|
87
|
+
- The entries at the end stay. Only a bar that is narrower than they are cuts them as well.
|
|
88
|
+
- A button in the part that is cut is still reached with the Tab key. The bar shows it while it has the focus, and its first entries again after that.
|
|
89
|
+
|
|
90
|
+
So what must stay in view goes to the end, or to the front of the start. A bar has no menu for what does not fit: an application for a phone leaves the bar out (`wide-only="footer"` on the frame).
|
|
91
|
+
|
|
92
|
+
## An entry that is announced
|
|
93
|
+
|
|
94
|
+
The bar is no live region: a count that changes with every click would be read out all the time. The page marks the one entry whose change matters, and a screen reader announces it when it has nothing else to say:
|
|
95
|
+
|
|
96
|
+
```html
|
|
97
|
+
<el-status-bar>
|
|
98
|
+
<span>Line 12, column 4</span>
|
|
99
|
+
<span role="status">Saved at 10:32</span>
|
|
100
|
+
</el-status-bar>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The entry is in the page from the start, also while it is empty: a live region that comes with its first text is not announced by every screen reader.
|
|
104
|
+
|
|
105
|
+
## In the frame of an application
|
|
106
|
+
|
|
107
|
+
In the footer of an [`el-app-frame`](../app-frame/app-frame.readme.md) the bar draws its surface as far as the surface of the region reaches: to the lower edge of the screen and to its sides. Its entries stay clear of them. The region says how far that is, so the bar needs nothing from the page:
|
|
108
|
+
|
|
109
|
+
```html
|
|
110
|
+
<el-app-frame>
|
|
111
|
+
<main id="main">…</main>
|
|
112
|
+
<footer slot="footer">
|
|
113
|
+
<el-status-bar>
|
|
114
|
+
<span>Connected</span>
|
|
115
|
+
<span slot="end">v1.4.2</span>
|
|
116
|
+
</el-status-bar>
|
|
117
|
+
</footer>
|
|
118
|
+
</el-app-frame>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
- The bar is no landmark. The `footer` around it is the one of the page.
|
|
122
|
+
- The line to the content is the one of the region there, and the bar leaves its own out.
|
|
123
|
+
- A colour of its own goes on the part: `el-status-bar::part(base) { background: var(--el-color-bg-muted); }`.
|
|
124
|
+
|
|
125
|
+
## On a touch screen
|
|
126
|
+
|
|
127
|
+
The bar is at least `--el-touch-target` high where the pointer is a finger (`@media (any-pointer: coarse)`), and an `el-button` in it is at least that wide and high. Without the token nothing changes.
|
|
128
|
+
|
|
129
|
+
## Server-side rendering
|
|
130
|
+
|
|
131
|
+
The bar renders on a server with `@webtides/element-js-ssr-renderer`. Its look is its stylesheet: the row, its height, what is cut and the surface in a frame are there before the script has run, and nothing moves when the element takes over. The script does one thing: it shows the first entries again after a button in the part that is cut has lost the focus.
|
|
132
|
+
|
|
133
|
+
## Accessibility
|
|
134
|
+
|
|
135
|
+
- The bar has no role and no name. Its entries are read in the order of the page: the ones at the start, then the ones at the end.
|
|
136
|
+
- An entry whose change is announced is marked by the page (`role="status"`).
|
|
137
|
+
- A button in the bar is a stop of the Tab key and shows its focus ring inside of itself: around it there is the edge of the bar, and under the bar the edge of the screen.
|
|
138
|
+
- An icon that stands alone needs a name, and so does a button with an icon alone.
|
|
139
|
+
- Without a theme the bar paints nothing and reads as the page does, in a light and in a dark scheme. The line to the content is a border: it stays where the user forces colours, and it is there without a theme then.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import hostStyle from '../../styles/host.style.js';
|
|
2
|
+
|
|
3
|
+
const css = String.raw;
|
|
4
|
+
|
|
5
|
+
const style = css`
|
|
6
|
+
:host {
|
|
7
|
+
display: block;
|
|
8
|
+
/* Lower than a control: seven tenths of its height, so the bar follows the theme. */
|
|
9
|
+
--_el-status-bar-height: calc(var(--el-control-height, 2.5rem) * 0.7);
|
|
10
|
+
/* A line to the content, which the region of a frame draws itself where the bar is in one.
|
|
11
|
+
Where the user forces colours it is there without a theme as well. */
|
|
12
|
+
--_el-status-bar-line-width: var(--el-border-width, 0px);
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* What the bar tells the controls in it, in properties that are inherited: a button is as
|
|
16
|
+
* high as the bar and has its small text, it is plain, and its focus ring is inside of it.
|
|
17
|
+
* Around the button there is the edge of the bar, and under the bar the edge of the screen.
|
|
18
|
+
*/
|
|
19
|
+
--_el-context-size-height: var(--_el-status-bar-height);
|
|
20
|
+
--_el-context-size-padding-block: 0px;
|
|
21
|
+
--_el-context-size-padding-inline: var(--el-space-2, 0.5em);
|
|
22
|
+
--_el-context-size-font-size: var(--el-font-size-sm, 0.875rem);
|
|
23
|
+
--_el-context-appearance-plain: ;
|
|
24
|
+
--_el-context-focus-ring-offset: calc(-1 * var(--el-focus-ring-width, 2px));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* On a touch screen the bar is at least as high as a finger needs, and so is a button in it.
|
|
28
|
+
Without the token it stays as it is. */
|
|
29
|
+
@media (any-pointer: coarse) {
|
|
30
|
+
:host {
|
|
31
|
+
--_el-status-bar-height: max(calc(var(--el-control-height, 2.5rem) * 0.7), var(--el-touch-target, 0px));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@media (forced-colors: active) {
|
|
36
|
+
:host {
|
|
37
|
+
--_el-status-bar-line-width: max(var(--el-border-width, 0px), 1px);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
* The surface. In a region of an el-app-frame it reaches as far as the surface of the region:
|
|
43
|
+
* to the lower edge of the screen and to its sides. The region says how far, and that room is
|
|
44
|
+
* padding here, so the entries stay clear of it. Outside of a frame the room is nothing.
|
|
45
|
+
*
|
|
46
|
+
* The margins are on the bar and not on the element: a reset of the page (margin: 0 for
|
|
47
|
+
* everything) wins over a rule for the host, and the bar would have the room twice.
|
|
48
|
+
*/
|
|
49
|
+
.bar {
|
|
50
|
+
margin-block: calc(-1 * var(--_el-context-inset-block-start, 0px))
|
|
51
|
+
calc(-1 * var(--_el-context-inset-block-end, 0px));
|
|
52
|
+
margin-inline: calc(-1 * var(--_el-context-inset-inline-start, 0px))
|
|
53
|
+
calc(-1 * var(--_el-context-inset-inline-end, 0px));
|
|
54
|
+
padding-block: var(--_el-context-inset-block-start, 0px) var(--_el-context-inset-block-end, 0px);
|
|
55
|
+
padding-inline: var(--_el-context-inset-inline-start, 0px) var(--_el-context-inset-inline-end, 0px);
|
|
56
|
+
background: var(--el-color-bg, transparent);
|
|
57
|
+
color: var(--el-color-fg-muted, inherit);
|
|
58
|
+
border-block-start: var(--_el-context-line-block-start, var(--_el-status-bar-line-width)) solid
|
|
59
|
+
var(--el-color-border, transparent);
|
|
60
|
+
font-size: var(--el-font-size-sm, 0.875rem);
|
|
61
|
+
line-height: 1.2;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* One row with a height of its own: whatever is in the bar, it is as high as without it. */
|
|
65
|
+
.row {
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
block-size: var(--_el-status-bar-height);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/*
|
|
72
|
+
* The two groups. Each has the room to the edge of the bar and to the other group as its own
|
|
73
|
+
* padding: what is cut off is cut at the edge of the bar, and the focus ring of an entry at
|
|
74
|
+
* the edge of a group has room.
|
|
75
|
+
*
|
|
76
|
+
* Where the bar is too narrow, the entries at the start give way: the group is cut at its end,
|
|
77
|
+
* and the group at the end keeps its entries. Only a bar that is narrower than the group at
|
|
78
|
+
* the end cuts that one as well. Nothing wraps, and no entry lies on another.
|
|
79
|
+
*
|
|
80
|
+
* Cut and not clipped: the browser moves a group to show a button in the part that is cut when
|
|
81
|
+
* the keyboard gets to it.
|
|
82
|
+
*/
|
|
83
|
+
.start,
|
|
84
|
+
.end {
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
gap: var(--el-space-3, 0.75rem);
|
|
88
|
+
box-sizing: border-box;
|
|
89
|
+
block-size: 100%;
|
|
90
|
+
min-inline-size: 0;
|
|
91
|
+
padding-inline: var(--el-space-3, 0.75rem);
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.start {
|
|
96
|
+
flex: 1 1000 auto;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.end {
|
|
100
|
+
flex: 0 1 auto;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* An entry is one line, and as wide as it is. A rule of the page for the element wins over
|
|
104
|
+
this. */
|
|
105
|
+
::slotted(*) {
|
|
106
|
+
flex: none;
|
|
107
|
+
white-space: nowrap;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* A progress bar is as wide as its place, and an entry has none: it gets a width. */
|
|
111
|
+
::slotted(el-progress-bar) {
|
|
112
|
+
inline-size: 6rem;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* A divider between two entries is as high as their text. */
|
|
116
|
+
::slotted(el-divider) {
|
|
117
|
+
align-self: center;
|
|
118
|
+
height: 1.2em;
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
|
|
122
|
+
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 group finds its panels and links also when `name` and `for` were set as properties. It compared the `name` and the `for` attribute with `selected`, and a framework that creates the elements in the browser sets the property where the element has one (Svelte 5, for example after a hot reload of a component): such a panel had no attribute, the group matched none, hid every panel and took `aria-selected` from every link. The group reads the property now and falls back to the attribute, on start and with every selection. `el-tab-panel` and `el-tab-link` do not reflect the two properties. ([#196](https://github.com/webtides/element-library/issues/196))
|
|
20
|
+
- A `name` that is a number works: `selected="2"`, `for="2"` and `name="2"` belong together, also after a click on the link. element-js reads such an attribute as a number, and the group compared it with the text of the attribute; it compares texts now. ([#196](https://github.com/webtides/element-library/issues/196))
|
|
21
|
+
|
|
15
22
|
## [0.3.0] - 2026-11-17
|
|
16
23
|
|
|
17
24
|
### Added
|
|
@@ -17,6 +17,9 @@ let tabLinkIds = 0;
|
|
|
17
17
|
* The links and panels need not be defined, or be there, when the group connects: it marks the
|
|
18
18
|
* selection with attributes and styles, and takes in parts that are added later.
|
|
19
19
|
*
|
|
20
|
+
* The group finds a panel by its `name` and a link by its `for`. It reads the property and falls
|
|
21
|
+
* back to the attribute, so it makes no difference which of the two a framework has set.
|
|
22
|
+
*
|
|
20
23
|
* @element el-tab-group
|
|
21
24
|
*
|
|
22
25
|
* @slot - Default slot containing `<el-tab-link>` and `<el-tab-panel>` children.
|
|
@@ -93,9 +96,8 @@ export default class TabGroup extends StyledElement {
|
|
|
93
96
|
|
|
94
97
|
// select first tab if none was selected declarative
|
|
95
98
|
if (!this.selected && this.tabPanels.length > 0) {
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
this.selectTab(firstPanel.getAttribute('name') ?? firstPanel.name);
|
|
99
|
+
const firstName = this._keyOf(this.tabPanels[0], 'name');
|
|
100
|
+
if (firstName !== null) this.selectTab(firstName);
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
this.updateSelection();
|
|
@@ -125,26 +127,45 @@ export default class TabGroup extends StyledElement {
|
|
|
125
127
|
this.selected = name;
|
|
126
128
|
}
|
|
127
129
|
|
|
130
|
+
/**
|
|
131
|
+
* What a link (`for`) or a panel (`name`) is found by, as a text: the property, and the
|
|
132
|
+
* attribute when the property has no value.
|
|
133
|
+
*
|
|
134
|
+
* A framework that creates the elements in the browser hands the value over as a property
|
|
135
|
+
* when the element has one, and then there is no attribute. An element whose tag is not
|
|
136
|
+
* defined yet has the attribute alone. Both sides of a comparison are texts: element-js
|
|
137
|
+
* parses the attribute `name="1"` to a number, and `getAttribute()` gives a text.
|
|
138
|
+
* @private
|
|
139
|
+
* @param {Element} element
|
|
140
|
+
* @param {'for' | 'name'} key
|
|
141
|
+
* @returns {string | null}
|
|
142
|
+
*/
|
|
143
|
+
_keyOf(element, key) {
|
|
144
|
+
const value = element[key] ?? element.getAttribute(key);
|
|
145
|
+
return value === null || value === undefined ? null : String(value);
|
|
146
|
+
}
|
|
147
|
+
|
|
128
148
|
/** @private */
|
|
129
149
|
updateSelection() {
|
|
130
150
|
const tabLinks = [...this.tabLinks];
|
|
151
|
+
const selected = this.selected === null || this.selected === undefined ? null : String(this.selected);
|
|
152
|
+
const isFor = (tabLink, name) => name !== null && this._keyOf(tabLink, 'for') === name;
|
|
131
153
|
// The one link in the tab order: the selected one, or the first that can be used.
|
|
132
154
|
const tabStop =
|
|
133
|
-
tabLinks.find((tabLink) => tabLink
|
|
155
|
+
tabLinks.find((tabLink) => isFor(tabLink, selected)) ??
|
|
134
156
|
tabLinks.find((tabLink) => !tabLink.hasAttribute('disabled'));
|
|
135
157
|
|
|
136
158
|
for (const tabLink of tabLinks) {
|
|
137
|
-
const isSelected = tabLink.getAttribute('for') === this.selected;
|
|
138
159
|
// An el-tab-link shows its `active` state from this attribute.
|
|
139
|
-
tabLink.setAttribute('aria-selected',
|
|
160
|
+
tabLink.setAttribute('aria-selected', isFor(tabLink, selected) ? 'true' : 'false');
|
|
140
161
|
tabLink.setAttribute('tabindex', tabLink === tabStop ? '0' : '-1');
|
|
141
162
|
}
|
|
142
163
|
|
|
143
164
|
for (const tabPanel of this.tabPanels) {
|
|
144
|
-
const panelName =
|
|
145
|
-
tabPanel.style['display'] = panelName ===
|
|
165
|
+
const panelName = this._keyOf(tabPanel, 'name');
|
|
166
|
+
tabPanel.style['display'] = panelName !== null && panelName === selected ? 'block' : 'none';
|
|
146
167
|
|
|
147
|
-
const tabLink = tabLinks.find((link) => link
|
|
168
|
+
const tabLink = tabLinks.find((link) => isFor(link, panelName));
|
|
148
169
|
if (tabLink) {
|
|
149
170
|
if (!tabLink.id) tabLink.id = `el-tab-link-${++tabLinkIds}`;
|
|
150
171
|
tabPanel.setAttribute('aria-labelledby', tabLink.id);
|
|
@@ -65,6 +65,20 @@ _None_
|
|
|
65
65
|
| ----------- | -------------------------------------------------- |
|
|
66
66
|
| _(default)_ | The `<el-tab-link>` and `<el-tab-panel>` children. |
|
|
67
67
|
|
|
68
|
+
## How the group finds its parts
|
|
69
|
+
|
|
70
|
+
A panel is found by its `name`, a link by its `for`. The group reads the property of the element and falls back to the attribute when the property has no value. So it makes no difference which of the two is set:
|
|
71
|
+
|
|
72
|
+
- Markup written as HTML, and markup a server rendered, has the attributes.
|
|
73
|
+
- A framework that creates the elements in the browser hands a value to a custom element as a property when the element has one (Svelte 5 does, for example after a hot reload of a component). Such a panel has no `name` attribute, and such a link no `for` attribute.
|
|
74
|
+
- A link or a panel whose tag is not defined yet has the attribute alone.
|
|
75
|
+
|
|
76
|
+
`el-tab-panel` and `el-tab-link` do not reflect the two properties: a selector like `el-tab-panel[name="general"]` finds a panel only where the attribute was written.
|
|
77
|
+
|
|
78
|
+
The values are compared as texts. `name="1"` is the panel of `for="1"` and of `selected="1"`, although element-js reads such an attribute as a number.
|
|
79
|
+
|
|
80
|
+
The group reads `name` and `for` when it starts, when a link or a panel is added or removed, and with every selection. A `name` or a `for` that changes while the selection stays is taken with the next of these, the same for a property and for an attribute.
|
|
81
|
+
|
|
68
82
|
## Lazy definition and parts that come later
|
|
69
83
|
|
|
70
84
|
The group does not need its links and panels to be defined, or to be there, when it starts.
|
|
@@ -12,6 +12,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
12
12
|
|
|
13
13
|
## Unreleased
|
|
14
14
|
|
|
15
|
+
## [0.4.0] - 2026-11-27
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- On a phone whose page reaches under the notch and the home indicator (`viewport-fit=cover`), a toast could lie under them. The distance of the stack from an edge (`--el-toast-inset`) is on top of the room the system takes there now, and the stack is no wider than what is between the two sides. Elsewhere nothing changes. ([#183](https://github.com/webtides/element-library/issues/183))
|
|
20
|
+
|
|
15
21
|
## [0.3.0] - 2026-11-17
|
|
16
22
|
|
|
17
23
|
### Added
|
|
@@ -80,9 +80,9 @@ _None of its own._ A toast fires the events of a notification (`notification-sho
|
|
|
80
80
|
|
|
81
81
|
#### CSS Custom Properties
|
|
82
82
|
|
|
83
|
-
| Name
|
|
84
|
-
|
|
|
85
|
-
| `--el-toast-inset` | The distance of the stack from the edges of the viewport. Unset, it is `--el-space-4`. |
|
|
83
|
+
| Name | Description |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| `--el-toast-inset` | The distance of the stack from the edges of the viewport, on top of the room the system takes there on a phone. Unset, it is `--el-space-4`. |
|
|
86
86
|
|
|
87
87
|
Reads the standard library design tokens `--el-space-4` and `--el-space-2` (the gap between two toasts). The look of a toast is the look of `el-notification`.
|
|
88
88
|
|
|
@@ -138,6 +138,8 @@ The first toast is at the edge, the next ones follow towards the middle of the v
|
|
|
138
138
|
|
|
139
139
|
The region lets the pointer through: what is beside and between the toasts can be clicked.
|
|
140
140
|
|
|
141
|
+
Where a page reaches under the notch and the home indicator of a phone (`viewport-fit=cover` in its viewport, or a web app on the home screen), the distance is on top of the room the system takes at that edge of the screen: a toast at the top is below the status bar, one at the bottom above the home indicator. Without it, and on a desktop, that room is nothing.
|
|
142
|
+
|
|
141
143
|
## More toasts than places
|
|
142
144
|
|
|
143
145
|
With `max` the region shows no more than that many toasts at once. A toast beyond that waits, in the order the toasts came, and is shown when a place is free: when a toast before it is gone, not when it starts to leave.
|
|
@@ -8,14 +8,23 @@ const style = css`
|
|
|
8
8
|
bar) goes. Before the script has run it is a fixed box in the same place. */
|
|
9
9
|
:host {
|
|
10
10
|
--_el-toast-inset: var(--el-toast-inset, var(--el-space-4, 1rem));
|
|
11
|
+
/*
|
|
12
|
+
* The distance from an edge of the viewport is on top of the room the system takes there
|
|
13
|
+
* on a phone: the notch, the rounded corners, the home indicator. Nothing where the page
|
|
14
|
+
* does not reach under them (no viewport-fit=cover), and on a desktop.
|
|
15
|
+
*/
|
|
16
|
+
--_el-toast-top: calc(var(--_el-toast-inset) + env(safe-area-inset-top, 0px));
|
|
17
|
+
--_el-toast-bottom: calc(var(--_el-toast-inset) + env(safe-area-inset-bottom, 0px));
|
|
18
|
+
--_el-toast-start: calc(var(--_el-toast-inset) + env(safe-area-inset-left, 0px));
|
|
19
|
+
--_el-toast-end: calc(var(--_el-toast-inset) + env(safe-area-inset-right, 0px));
|
|
11
20
|
|
|
12
21
|
position: fixed;
|
|
13
22
|
inset: auto;
|
|
14
23
|
/* The default, top-end. */
|
|
15
|
-
top: var(--_el-toast-
|
|
16
|
-
inset-inline-end: var(--_el-toast-
|
|
24
|
+
top: var(--_el-toast-top);
|
|
25
|
+
inset-inline-end: var(--_el-toast-end);
|
|
17
26
|
/* Never wider than the viewport between the two distances. */
|
|
18
|
-
max-width: calc(100% -
|
|
27
|
+
max-width: calc(100% - var(--_el-toast-start) - var(--_el-toast-end));
|
|
19
28
|
padding: 0;
|
|
20
29
|
border: 0;
|
|
21
30
|
background: none;
|
|
@@ -25,14 +34,21 @@ const style = css`
|
|
|
25
34
|
pointer-events: none;
|
|
26
35
|
}
|
|
27
36
|
|
|
37
|
+
/* Asked of the host: the sides of the screen are left and right, start and end follow the
|
|
38
|
+
direction of the text. */
|
|
39
|
+
:host(:dir(rtl)) {
|
|
40
|
+
--_el-toast-start: calc(var(--_el-toast-inset) + env(safe-area-inset-right, 0px));
|
|
41
|
+
--_el-toast-end: calc(var(--_el-toast-inset) + env(safe-area-inset-left, 0px));
|
|
42
|
+
}
|
|
43
|
+
|
|
28
44
|
:host([placement^='bottom']) {
|
|
29
45
|
top: auto;
|
|
30
|
-
bottom: var(--_el-toast-
|
|
46
|
+
bottom: var(--_el-toast-bottom);
|
|
31
47
|
}
|
|
32
48
|
|
|
33
49
|
:host([placement$='-start']) {
|
|
34
50
|
inset-inline-end: auto;
|
|
35
|
-
inset-inline-start: var(--_el-toast-
|
|
51
|
+
inset-inline-start: var(--_el-toast-start);
|
|
36
52
|
}
|
|
37
53
|
|
|
38
54
|
/* In the middle: the box reaches from one side to the other, and the stack puts the toasts
|
|
@@ -40,7 +56,7 @@ const style = css`
|
|
|
40
56
|
takes them from the host. */
|
|
41
57
|
:host([placement='top']),
|
|
42
58
|
:host([placement='bottom']) {
|
|
43
|
-
inset-inline: var(--_el-toast-
|
|
59
|
+
inset-inline: var(--_el-toast-start) var(--_el-toast-end);
|
|
44
60
|
width: auto;
|
|
45
61
|
}
|
|
46
62
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this component live here. Versions refer to the parent `@webtides/element-library` release (see root [`CHANGELOG.md`](../../../CHANGELOG.md)); components no longer version independently.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
When your PR touches this component, add an entry under Unreleased and
|
|
9
|
+
mirror it (prefixed with the component name) in root CHANGELOG.md.
|
|
10
|
+
Uncomment headings as needed.
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
## Unreleased
|
|
14
|
+
|
|
15
|
+
## [0.4.0] - 2026-11-27
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Initial `el-toolbar`: the row of controls over a list or a view. A toolbar for assistive technology (`role="toolbar"`, named by `label`), with what the page writes into it as its controls: `el-button`, `el-button-group`, `el-segmented-field`, and `el-divider` between two groups. ([#194](https://github.com/webtides/element-library/issues/194))
|
|
20
|
+
- `size` and `appearance` are the size and the appearance of the controls that have none of their own: of every `el-button` in the toolbar, also inside of a group, and `size` of an `el-segmented-field`. A toolbar that names none has controls of the medium size and plain buttons. A control that names its own keeps it, the defaults included. The toolbar does not write to its controls: it says both in CSS properties that are inherited.
|
|
21
|
+
- The controls stand in a row with a gap of `--el-space-2`. What is slotted into `end` stands at the end; start and end follow the reading direction. A toolbar with more controls than its width takes breaks into a second line.
|
|
22
|
+
- One stop of the Tab key, as the WAI-ARIA toolbar pattern says: the arrow keys move the focus between the controls and around the ends, Home and End go to the first and the last one, and Tab leaves the toolbar and comes back to the control that had the focus last. The options of an `el-segmented-field` are controls of the toolbar: the left and right arrow keys go through them, Space and the up and down keys choose. In a control that takes text the keys belong to that control.
|
|
23
|
+
- An `el-button` with an `aria-label`, a button with an icon alone, shows that name as a tooltip, for the pointer and for the focus of the keyboard. The tooltips are `el-tooltip` elements in the shadow root of the toolbar (`::part(tooltip)`); the toolbar imports the tooltip, and with it `@floating-ui/dom`.
|
|
24
|
+
- The look is the stylesheets alone: a server-rendered toolbar does not change when the elements take over. The script adds the keyboard and the tooltips.
|