@design.estate/dees-catalog 24.2.0 → 24.3.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/dist_bundle/bundle.js +6164 -5263
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-SSD44HAU.js → chunk-4UZGSPGV.js} +8 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-SSD44HAU.js.map → chunk-4UZGSPGV.js.map} +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-YUJKYSDX.js → chunk-7CM7S6EQ.js} +3 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-347GWLFZ.js → chunk-R6EBIDCM.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-5P7JLMRS.js → de-LD3JG4AD.js} +5 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-LD3JG4AD.js.map +1 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-PC4PYTOT.js → dees-modal-Z3DSEMNI.js} +3 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-GFHNW2QR.js → dees-workspace-terminal-KPB3RVGL.js} +4 -4
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/es-J75P6Y7U.js +1461 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/es-J75P6Y7U.js.map +1 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/fr-FXZISX5I.js +1461 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/fr-FXZISX5I.js.map +1 -0
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/00group-appui/appui.helpers.d.ts +6 -0
- package/dist_ts_web/elements/00group-appui/appui.helpers.js +7 -1
- package/dist_ts_web/elements/00group-appui/dees-appui/dees-appui.js +7 -10
- package/dist_ts_web/elements/00group-appui/dees-appui-detailpane/dees-appui-detailpane.d.ts +88 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-detailpane/dees-appui-detailpane.demo.d.ts +34 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-detailpane/dees-appui-detailpane.demo.js +317 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-detailpane/dees-appui-detailpane.js +510 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-detailpane/index.d.ts +1 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-detailpane/index.js +2 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-page/dees-appui-page.d.ts +43 -17
- package/dist_ts_web/elements/00group-appui/dees-appui-page/dees-appui-page.demo.d.ts +2 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-page/dees-appui-page.demo.js +28 -3
- package/dist_ts_web/elements/00group-appui/dees-appui-page/dees-appui-page.js +113 -152
- package/dist_ts_web/elements/00group-appui/dees-appui-secondarytabs/dees-appui-secondarytabs.d.ts +68 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-secondarytabs/dees-appui-secondarytabs.demo.d.ts +4 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-secondarytabs/dees-appui-secondarytabs.demo.js +57 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-secondarytabs/dees-appui-secondarytabs.js +357 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-secondarytabs/index.d.ts +1 -0
- package/dist_ts_web/elements/00group-appui/dees-appui-secondarytabs/index.js +2 -0
- package/dist_ts_web/elements/00group-appui/index.d.ts +2 -0
- package/dist_ts_web/elements/00group-appui/index.js +3 -1
- package/dist_ts_web/elements/00group-feedback/dees-statusbutton/dees-statusbutton.demo.js +6 -6
- package/dist_ts_web/elements/00group-media/dees-pdf-viewer/component.d.ts +10 -0
- package/dist_ts_web/elements/00group-media/dees-pdf-viewer/component.js +38 -6
- package/dist_ts_web/elements/00group-media/dees-pdf-viewer/styles.js +4 -1
- package/dist_ts_web/i18n/de.d.ts +12 -0
- package/dist_ts_web/i18n/de.js +4 -1
- package/dist_ts_web/i18n/es.d.ts +5780 -0
- package/dist_ts_web/i18n/es.js +1452 -0
- package/dist_ts_web/i18n/fr.d.ts +5780 -0
- package/dist_ts_web/i18n/fr.js +1452 -0
- package/dist_ts_web/i18n/messages.d.ts +13 -1
- package/dist_ts_web/i18n/messages.js +8 -2
- package/package.json +2 -2
- package/readme.md +133 -16
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/00group-appui/appui.helpers.ts +7 -0
- package/ts_web/elements/00group-appui/dees-appui/dees-appui.ts +6 -10
- package/ts_web/elements/00group-appui/dees-appui-detailpane/dees-appui-detailpane.demo.ts +267 -0
- package/ts_web/elements/00group-appui/dees-appui-detailpane/dees-appui-detailpane.ts +451 -0
- package/ts_web/elements/00group-appui/dees-appui-detailpane/index.ts +1 -0
- package/ts_web/elements/00group-appui/dees-appui-page/dees-appui-page.demo.ts +30 -2
- package/ts_web/elements/00group-appui/dees-appui-page/dees-appui-page.ts +113 -148
- package/ts_web/elements/00group-appui/dees-appui-secondarytabs/dees-appui-secondarytabs.demo.ts +62 -0
- package/ts_web/elements/00group-appui/dees-appui-secondarytabs/dees-appui-secondarytabs.ts +299 -0
- package/ts_web/elements/00group-appui/dees-appui-secondarytabs/index.ts +1 -0
- package/ts_web/elements/00group-appui/index.ts +2 -0
- package/ts_web/elements/00group-feedback/dees-statusbutton/dees-statusbutton.demo.ts +5 -5
- package/ts_web/elements/00group-media/dees-pdf-viewer/component.ts +37 -5
- package/ts_web/elements/00group-media/dees-pdf-viewer/styles.ts +3 -0
- package/ts_web/i18n/de.ts +3 -0
- package/ts_web/i18n/es.ts +1452 -0
- package/ts_web/i18n/fr.ts +1452 -0
- package/ts_web/i18n/messages.ts +8 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-5P7JLMRS.js.map +0 -1
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-YUJKYSDX.js.map → chunk-7CM7S6EQ.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-347GWLFZ.js.map → chunk-R6EBIDCM.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-PC4PYTOT.js.map → dees-modal-Z3DSEMNI.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-GFHNW2QR.js.map → dees-workspace-terminal-KPB3RVGL.js.map} +0 -0
|
@@ -11,10 +11,8 @@ import type { IAppLocationItem } from '../../interfaces/applocation.js';
|
|
|
11
11
|
import type { IContentHeadingAction } from '../../interfaces/contentheading.js';
|
|
12
12
|
import { themeDefaultStyles } from '../../00theme.js';
|
|
13
13
|
import { OverlayScrollbarController, overlayScrollbarStyles } from '../../00scrollbars.js';
|
|
14
|
-
import '../../00group-utility/dees-icon/dees-icon.js';
|
|
15
14
|
import '../dees-appui-contentheading/dees-appui-contentheading.js';
|
|
16
|
-
import
|
|
17
|
-
import { normalizeIconName } from '../appui.helpers.js';
|
|
15
|
+
import '../dees-appui-secondarytabs/dees-appui-secondarytabs.js';
|
|
18
16
|
import { demoFunc } from './dees-appui-page.demo.js';
|
|
19
17
|
|
|
20
18
|
declare global {
|
|
@@ -44,24 +42,44 @@ export interface IAppuiPageTabSelectEvent {
|
|
|
44
42
|
/** How wide a page's content may grow. */
|
|
45
43
|
export type TAppuiPageContentWidth = 'default' | 'wide' | 'full';
|
|
46
44
|
|
|
45
|
+
/**
|
|
46
|
+
* How a page lays out its content: `'scroll'`, the content as tall as it is,
|
|
47
|
+
* scrolling with the page; or `'fill'`, the content filling the page's height
|
|
48
|
+
* edge to edge, for a list or a detail pane that scrolls inside itself.
|
|
49
|
+
*/
|
|
50
|
+
export type TAppuiPageLayout = 'scroll' | 'fill';
|
|
51
|
+
|
|
47
52
|
/**
|
|
48
53
|
* A view's page inside `dees-appui`: its header — breadcrumbs, title, status,
|
|
49
54
|
* description and actions — optional tabs, and the content below, within one
|
|
50
55
|
* max-width and one padding, so every view of an app lines up. The header is a
|
|
51
|
-
* `dees-appui-contentheading`, with its hairline across the page's width
|
|
52
|
-
*
|
|
56
|
+
* `dees-appui-contentheading`, with its hairline across the page's width; the
|
|
57
|
+
* tabs stand in a stripe of their own under it, a `dees-appui-secondarytabs`
|
|
58
|
+
* with its own hairline, the selected tab's line lying on it.
|
|
53
59
|
*
|
|
54
60
|
* Slots: the default slot is the content; `status` sits beside the title (a
|
|
55
61
|
* `dees-badge`); `description` replaces the `description` text with markup;
|
|
56
|
-
* `
|
|
57
|
-
*
|
|
62
|
+
* `tools` takes controls before the declared `actions` — the list's search
|
|
63
|
+
* (`dees-table-search`), filters, the status button (`dees-statusbutton`);
|
|
64
|
+
* `actions` adds controls after them. A failing action reports `page-action`
|
|
65
|
+
* as its source.
|
|
58
66
|
*
|
|
59
67
|
* The primary action comes last, at the end of the title row; where the title
|
|
60
|
-
* and the actions do not fit in one row, and always below 700px of
|
|
61
|
-
* the actions stand under the title. The tabs
|
|
62
|
-
* arrow keys move along them in the writing direction,
|
|
63
|
-
* ends, and Enter, Space or a click select one, which
|
|
64
|
-
* `selectedTab` and is reported as a bubbling, composed
|
|
68
|
+
* and the tools and actions do not fit in one row, and always below 700px of
|
|
69
|
+
* page width, the tools and actions stand under the title together. The tabs
|
|
70
|
+
* are one Tab stop: the arrow keys move along them in the writing direction,
|
|
71
|
+
* Home and End go to the ends, and Enter, Space or a click select one, which
|
|
72
|
+
* reflects as `selectedTab` and is reported as a bubbling, composed
|
|
73
|
+
* `tab-select`. The content is their tab panel, named by the selected tab.
|
|
74
|
+
*
|
|
75
|
+
* `layout="fill"` makes an integrated list page: the page takes its
|
|
76
|
+
* container's height, the heading and the tabs keep theirs, and the content
|
|
77
|
+
* fills the rest edge to edge — no max-width, no side inset, no bottom
|
|
78
|
+
* padding — without the page scrolling, so a list or a `dees-appui-detailpane`
|
|
79
|
+
* fills it and scrolls inside itself (the content area scrolls only what does
|
|
80
|
+
* not). The heading and the tabs drop the max-width too, and the content
|
|
81
|
+
* declares the page's inset as the region inset, `--dees-inset-inline`, so a
|
|
82
|
+
* frameless list's first column stands under the title.
|
|
65
83
|
*/
|
|
66
84
|
@customElement('dees-appui-page')
|
|
67
85
|
export class DeesAppuiPage extends DeesElement {
|
|
@@ -97,10 +115,18 @@ export class DeesAppuiPage extends DeesElement {
|
|
|
97
115
|
@property({ type: String, reflect: true })
|
|
98
116
|
accessor contentWidth: TAppuiPageContentWidth = 'default';
|
|
99
117
|
|
|
100
|
-
/**
|
|
118
|
+
/**
|
|
119
|
+
* `'scroll'` (the default): the content as tall as it is, in the max-width;
|
|
120
|
+
* `'fill'`: the content fills the page's height edge to edge, and what it
|
|
121
|
+
* holds scrolls inside itself.
|
|
122
|
+
*/
|
|
123
|
+
@property({ type: String, reflect: true })
|
|
124
|
+
accessor layout: TAppuiPageLayout = 'scroll';
|
|
125
|
+
|
|
126
|
+
/** The content area's scrollbars under `fill`, where it scrolls what does not scroll itself. */
|
|
101
127
|
private readonly scrollbars = new OverlayScrollbarController(
|
|
102
128
|
this,
|
|
103
|
-
() => this.shadowRoot?.querySelector<HTMLElement>('.
|
|
129
|
+
() => (this.layout === 'fill' ? this.shadowRoot?.querySelector<HTMLElement>('.content') : undefined),
|
|
104
130
|
);
|
|
105
131
|
|
|
106
132
|
public static styles = [
|
|
@@ -124,7 +150,7 @@ export class DeesAppuiPage extends DeesElement {
|
|
|
124
150
|
--appui-page-max-width: var(--dees-appui-page-max-width, none);
|
|
125
151
|
}
|
|
126
152
|
|
|
127
|
-
/* The page's side inset: the header's and the content's. */
|
|
153
|
+
/* The page's side inset: the header's, the tabs' and the content's. */
|
|
128
154
|
.frame {
|
|
129
155
|
--page-inset: var(--dees-spacing-2xl);
|
|
130
156
|
}
|
|
@@ -134,6 +160,11 @@ export class DeesAppuiPage extends DeesElement {
|
|
|
134
160
|
--dees-appui-contentheading-max-width: var(--appui-page-max-width);
|
|
135
161
|
}
|
|
136
162
|
|
|
163
|
+
dees-appui-secondarytabs {
|
|
164
|
+
--dees-inset-inline: var(--page-inset);
|
|
165
|
+
--dees-appui-secondarytabs-max-width: var(--appui-page-max-width);
|
|
166
|
+
}
|
|
167
|
+
|
|
137
168
|
::slotted([slot='status']) {
|
|
138
169
|
flex: none;
|
|
139
170
|
}
|
|
@@ -146,83 +177,6 @@ export class DeesAppuiPage extends DeesElement {
|
|
|
146
177
|
min-width: 0;
|
|
147
178
|
}
|
|
148
179
|
|
|
149
|
-
/* Inset: the tab row scrolls, and would clip a ring drawn outside a tab. */
|
|
150
|
-
.tab:focus-visible {
|
|
151
|
-
outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring);
|
|
152
|
-
outline-offset: -2px;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/* The selected tab's line lies on the heading's hairline: the row reaches over it.
|
|
156
|
-
The first tab's label stands at the title's inset; its hover face reaches into the inset.
|
|
157
|
-
The frame is what the heading's tabs slot holds, so the row's scrollbar goes into the
|
|
158
|
-
slot with it, and the box that scrollbar is placed in. */
|
|
159
|
-
.tabsFrame {
|
|
160
|
-
position: relative;
|
|
161
|
-
min-width: 0;
|
|
162
|
-
margin-top: var(--dees-spacing-xs);
|
|
163
|
-
margin-bottom: calc(-1 * var(--dees-line-width-hairline));
|
|
164
|
-
margin-inline-start: calc(-1 * var(--dees-spacing-md));
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.tabs {
|
|
168
|
-
display: flex;
|
|
169
|
-
gap: var(--dees-spacing-xs);
|
|
170
|
-
overflow-x: auto;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.tab {
|
|
174
|
-
position: relative;
|
|
175
|
-
display: inline-flex;
|
|
176
|
-
align-items: center;
|
|
177
|
-
gap: var(--dees-spacing-sm);
|
|
178
|
-
flex: none;
|
|
179
|
-
height: var(--dees-control-height-lg);
|
|
180
|
-
margin-bottom: var(--dees-spacing-sm);
|
|
181
|
-
padding: 0 var(--dees-spacing-md);
|
|
182
|
-
border: 0;
|
|
183
|
-
border-radius: var(--dees-radius-md);
|
|
184
|
-
background: transparent;
|
|
185
|
-
color: var(--dees-color-text-secondary);
|
|
186
|
-
font: inherit;
|
|
187
|
-
font-size: var(--dees-font-footnote-size);
|
|
188
|
-
font-weight: 500;
|
|
189
|
-
white-space: nowrap;
|
|
190
|
-
cursor: pointer;
|
|
191
|
-
transition: background var(--dees-transition-fast) var(--dees-ease-standard),
|
|
192
|
-
color var(--dees-transition-fast) var(--dees-ease-standard);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.tab:hover {
|
|
196
|
-
background: var(--dees-color-hover);
|
|
197
|
-
color: var(--dees-color-text-primary);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.tab[aria-selected='true'] {
|
|
201
|
-
color: var(--dees-color-text-primary);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.tab[aria-selected='true']::after {
|
|
205
|
-
content: '';
|
|
206
|
-
position: absolute;
|
|
207
|
-
inset-inline: var(--dees-spacing-md);
|
|
208
|
-
bottom: calc(-1 * var(--dees-spacing-sm));
|
|
209
|
-
height: 2px;
|
|
210
|
-
border-radius: 1px;
|
|
211
|
-
background: var(--dees-color-text-primary);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.tabBadge {
|
|
215
|
-
min-width: 16px;
|
|
216
|
-
padding: 0 var(--dees-spacing-xs);
|
|
217
|
-
border-radius: var(--dees-radius-full);
|
|
218
|
-
background: var(--dees-color-fill-secondary);
|
|
219
|
-
color: var(--dees-color-text-secondary);
|
|
220
|
-
font-size: var(--dees-font-caption2-size);
|
|
221
|
-
line-height: 16px;
|
|
222
|
-
text-align: center;
|
|
223
|
-
box-sizing: border-box;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
180
|
.content {
|
|
227
181
|
display: grid;
|
|
228
182
|
gap: var(--dees-spacing-lg);
|
|
@@ -243,10 +197,53 @@ export class DeesAppuiPage extends DeesElement {
|
|
|
243
197
|
}
|
|
244
198
|
}
|
|
245
199
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
200
|
+
/* The integrated list: the page as tall as its container, the content the
|
|
201
|
+
rest of it, edge to edge, at the page's inset as the region inset. */
|
|
202
|
+
:host([layout='fill']) {
|
|
203
|
+
--appui-page-max-width: none;
|
|
204
|
+
height: 100%;
|
|
205
|
+
min-height: 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
:host([layout='fill']) .frame {
|
|
209
|
+
display: flex;
|
|
210
|
+
flex-direction: column;
|
|
211
|
+
height: 100%;
|
|
212
|
+
min-height: 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
:host([layout='fill']) dees-appui-contentheading,
|
|
216
|
+
:host([layout='fill']) dees-appui-secondarytabs {
|
|
217
|
+
flex: none;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/* The box the content's scrollbars are placed in. */
|
|
221
|
+
:host([layout='fill']) .page {
|
|
222
|
+
position: relative;
|
|
223
|
+
flex: 1 1 0;
|
|
224
|
+
display: flex;
|
|
225
|
+
flex-direction: column;
|
|
226
|
+
max-width: none;
|
|
227
|
+
min-height: 0;
|
|
228
|
+
margin: 0;
|
|
229
|
+
padding: 0;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
:host([layout='fill']) .content {
|
|
233
|
+
--dees-inset-inline: var(--page-inset);
|
|
234
|
+
flex: 1 1 0;
|
|
235
|
+
display: flex;
|
|
236
|
+
flex-direction: column;
|
|
237
|
+
gap: 0;
|
|
238
|
+
min-height: 0;
|
|
239
|
+
overflow: auto;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* Each part of the content takes the room it is given: a list or a detail
|
|
243
|
+
pane fills it, and scrolls inside itself. */
|
|
244
|
+
:host([layout='fill']) .content > slot::slotted(*) {
|
|
245
|
+
flex: 1 0 auto;
|
|
246
|
+
min-width: 0;
|
|
250
247
|
}
|
|
251
248
|
`,
|
|
252
249
|
];
|
|
@@ -264,16 +261,20 @@ export class DeesAppuiPage extends DeesElement {
|
|
|
264
261
|
>
|
|
265
262
|
<slot name="status" slot="status"></slot>
|
|
266
263
|
<slot name="description" slot="description">${this.description}</slot>
|
|
264
|
+
<slot name="tools" slot="tools"></slot>
|
|
267
265
|
<slot name="actions" slot="actions"></slot>
|
|
268
|
-
${tabs.length
|
|
269
|
-
? html`<div class="tabsFrame" slot="tabs"><div class="tabs" role="tablist" aria-label=${this.heading} @keydown=${this.handleTabKeydown}>
|
|
270
|
-
${tabs.map((tab, index) => this.renderTab(tab, index, tab.key === selected?.key))}
|
|
271
|
-
</div></div>`
|
|
272
|
-
: ''}
|
|
273
266
|
</dees-appui-contentheading>
|
|
267
|
+
${tabs.length && selected
|
|
268
|
+
? html`<dees-appui-secondarytabs
|
|
269
|
+
.tabs=${tabs}
|
|
270
|
+
.selectedTab=${selected.key}
|
|
271
|
+
.label=${this.heading}
|
|
272
|
+
@tab-select=${this.handleTabSelect}
|
|
273
|
+
></dees-appui-secondarytabs>`
|
|
274
|
+
: ''}
|
|
274
275
|
<div class="page">
|
|
275
276
|
${tabs.length && selected
|
|
276
|
-
? html`<div class="content" id="panel" role="tabpanel" aria-
|
|
277
|
+
? html`<div class="content" id="panel" role="tabpanel" aria-label=${selected.label}>
|
|
277
278
|
<slot></slot>
|
|
278
279
|
</div>`
|
|
279
280
|
: html`<div class="content"><slot></slot></div>`}
|
|
@@ -282,34 +283,14 @@ export class DeesAppuiPage extends DeesElement {
|
|
|
282
283
|
`;
|
|
283
284
|
}
|
|
284
285
|
|
|
285
|
-
private renderTab(tab: IAppuiPageTab, index: number, selected: boolean): TemplateResult {
|
|
286
|
-
return html`<button
|
|
287
|
-
class="tab"
|
|
288
|
-
type="button"
|
|
289
|
-
role="tab"
|
|
290
|
-
id=${`tab-${index}`}
|
|
291
|
-
aria-selected=${selected ? 'true' : 'false'}
|
|
292
|
-
aria-controls="panel"
|
|
293
|
-
@click=${() => this.selectTab(tab)}
|
|
294
|
-
>
|
|
295
|
-
${tab.iconName
|
|
296
|
-
? html`<dees-icon aria-hidden="true" .icon=${normalizeIconName(tab.iconName)} iconSize="14"></dees-icon>`
|
|
297
|
-
: ''}
|
|
298
|
-
<span>${tab.label}</span>
|
|
299
|
-
${tab.badge !== undefined && tab.badge !== '' ? html`<span class="tabBadge">${tab.badge}</span>` : ''}
|
|
300
|
-
</button>`;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
286
|
/**
|
|
304
|
-
*
|
|
305
|
-
*
|
|
287
|
+
* The tabs name the content as the panel they control: an element reference,
|
|
288
|
+
* since the panel lies outside their shadow root.
|
|
306
289
|
*/
|
|
307
290
|
public updated(changedProperties: Map<string | number | symbol, unknown>): void {
|
|
308
291
|
super.updated(changedProperties);
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
const stop = focused ?? buttons.find((button) => button.getAttribute('aria-selected') === 'true');
|
|
312
|
-
for (const button of buttons) button.tabIndex = button === stop ? 0 : -1;
|
|
292
|
+
const tabs = this.shadowRoot?.querySelector('dees-appui-secondarytabs');
|
|
293
|
+
if (tabs) tabs.controlsElement = this.shadowRoot!.querySelector<HTMLElement>('#panel');
|
|
313
294
|
}
|
|
314
295
|
|
|
315
296
|
/** The selected tab: the one `selectedTab` names, else the first. */
|
|
@@ -317,27 +298,11 @@ export class DeesAppuiPage extends DeesElement {
|
|
|
317
298
|
return this.tabs.find((tab) => tab.key === this.selectedTab) ?? this.tabs[0];
|
|
318
299
|
}
|
|
319
300
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
composed: true,
|
|
327
|
-
}));
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/** Arrow keys follow the writing direction, Home and End go to the ends; the focus moves, the selection waits for Enter. */
|
|
331
|
-
private readonly handleTabKeydown = (event: KeyboardEvent) => {
|
|
332
|
-
const buttons = [...(this.shadowRoot?.querySelectorAll<HTMLButtonElement>('.tab') ?? [])];
|
|
333
|
-
const current = buttons.findIndex((button) => event.composedPath().includes(button));
|
|
334
|
-
if (current < 0) return;
|
|
335
|
-
const rtl = getComputedStyle(this).direction === 'rtl';
|
|
336
|
-
const key = rtl && event.key === 'ArrowLeft' ? 'ArrowRight' : rtl && event.key === 'ArrowRight' ? 'ArrowLeft' : event.key;
|
|
337
|
-
const next = nextRovingIndex(key, current, buttons.length, 'horizontal');
|
|
338
|
-
if (next === null) return;
|
|
339
|
-
event.preventDefault();
|
|
340
|
-
for (const button of buttons) button.tabIndex = button === buttons[next] ? 0 : -1;
|
|
341
|
-
buttons[next].focus();
|
|
301
|
+
/**
|
|
302
|
+
* The tabs' own `tab-select` is the page's: it leaves the page bubbling and
|
|
303
|
+
* composed, once, with `selectedTab` already following it.
|
|
304
|
+
*/
|
|
305
|
+
private readonly handleTabSelect = (event: CustomEvent<IAppuiPageTabSelectEvent>) => {
|
|
306
|
+
this.selectedTab = event.detail.key;
|
|
342
307
|
};
|
|
343
308
|
}
|
package/ts_web/elements/00group-appui/dees-appui-secondarytabs/dees-appui-secondarytabs.demo.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { html } from '@design.estate/dees-element';
|
|
2
|
+
import { demoCode, demoOutput, demoPage, demoSection, showDemoResult } from '../../../demos/templates.js';
|
|
3
|
+
import type { IAppuiPageTab, IAppuiPageTabSelectEvent } from '../dees-appui-page/dees-appui-page.js';
|
|
4
|
+
import '../dees-appui-contentheading/dees-appui-contentheading.js';
|
|
5
|
+
import '../../00group-feedback/dees-badge/dees-badge.js';
|
|
6
|
+
|
|
7
|
+
const subViews: IAppuiPageTab[] = [
|
|
8
|
+
{ key: 'routes', label: 'Routes', badge: 9 },
|
|
9
|
+
{ key: 'redirects', label: 'Derived redirects', badge: 5 },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
const subViewText: Record<string, string> = {
|
|
13
|
+
routes: 'The routes of the network, whoever created them: 9 routes.',
|
|
14
|
+
redirects: 'The redirects the routes derive, from http :80 to https :443: 5 redirects.',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const recordParts: IAppuiPageTab[] = [
|
|
18
|
+
{ key: 'overview', label: 'Overview', iconName: 'lucide:LayoutDashboard' },
|
|
19
|
+
{ key: 'edges', label: 'Edges', iconName: 'lucide:Network', badge: 4 },
|
|
20
|
+
{ key: 'routes', label: 'Routes', iconName: 'lucide:Route', badge: 12 },
|
|
21
|
+
{ key: 'certificates', label: 'Certificates', iconName: 'lucide:ShieldCheck' },
|
|
22
|
+
{ key: 'firewall', label: 'Firewall', iconName: 'lucide:BrickWall' },
|
|
23
|
+
{ key: 'config', label: 'Configuration', iconName: 'lucide:FileCode' },
|
|
24
|
+
{ key: 'activity', label: 'Activity', iconName: 'lucide:History', badge: 'new' },
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const frameStyle = 'background: var(--dees-color-bg-canvas); border: 1px solid var(--dees-color-border-subtle); border-radius: var(--dees-radius-xl); overflow: hidden;';
|
|
28
|
+
const panelStyle = 'margin: 0; padding: 16px 32px 24px; color: var(--dees-color-text-secondary); font-size: 13px;';
|
|
29
|
+
|
|
30
|
+
/** Writes the selected tab into the section's panel and its result line. */
|
|
31
|
+
const showSelection = (texts: Record<string, string> | null) => (event: CustomEvent<IAppuiPageTabSelectEvent>) => {
|
|
32
|
+
const tabs = event.currentTarget as HTMLElement;
|
|
33
|
+
const panel = tabs.parentElement?.querySelector<HTMLElement>('.panel-text');
|
|
34
|
+
if (panel) panel.textContent = texts?.[event.detail.key] ?? `The ${event.detail.tab.label} of gw-fra-1.`;
|
|
35
|
+
showDemoResult(tabs, `tab-select: ${event.detail.key}`);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** A page's sub-views and a record's parts, each as a stripe under its heading. */
|
|
39
|
+
export const demoFunc = () => demoPage('Secondary tabs', 'A view\'s second level of tabs: the sub-views of a page or the parts of a record, in a stripe of their own under the heading, with the selected tab\'s line on the stripe\'s hairline.', html`
|
|
40
|
+
${demoSection('A page\'s sub-views', 'Two lists of one page, switched by the tabs under its heading. Click a tab, or move with the arrow keys and press Enter; the first label stands under the title.', html`
|
|
41
|
+
<div style=${frameStyle}>
|
|
42
|
+
<dees-appui-contentheading heading="Routes" description="Network · 9 routes, whoever created them"></dees-appui-contentheading>
|
|
43
|
+
<dees-appui-secondarytabs label="Routes" .tabs=${subViews} selectedTab="routes" @tab-select=${showSelection(subViewText)}></dees-appui-secondarytabs>
|
|
44
|
+
<p class="panel-text" style=${panelStyle}>${subViewText.routes}</p>
|
|
45
|
+
</div>
|
|
46
|
+
${demoOutput('Select a tab.')}
|
|
47
|
+
${demoCode(`<dees-appui-secondarytabs label="Routes" .tabs=\${[
|
|
48
|
+
{ key: 'routes', label: 'Routes', badge: 9 },
|
|
49
|
+
{ key: 'redirects', label: 'Derived redirects', badge: 5 },
|
|
50
|
+
]} selectedTab="routes" @tab-select=\${(event) => this.show(event.detail.key)}></dees-appui-secondarytabs>`)}
|
|
51
|
+
`)}
|
|
52
|
+
${demoSection('A record\'s parts', 'The parts of a gateway, with icons and counts. In 480px the row does not fit: it scrolls sideways under an overlay scrollbar, and a selected tab scrolls into view.', html`
|
|
53
|
+
<div style=${`${frameStyle} max-width: 480px;`}>
|
|
54
|
+
<dees-appui-contentheading heading="gw-fra-1" description="Gateway · Frankfurt · r418 applied">
|
|
55
|
+
<dees-badge slot="status" tone="success" text="Online" rounded></dees-badge>
|
|
56
|
+
</dees-appui-contentheading>
|
|
57
|
+
<dees-appui-secondarytabs label="gw-fra-1" .tabs=${recordParts} selectedTab="overview" @tab-select=${showSelection(null)}></dees-appui-secondarytabs>
|
|
58
|
+
<p class="panel-text" style=${panelStyle}>The Overview of gw-fra-1.</p>
|
|
59
|
+
</div>
|
|
60
|
+
${demoOutput('Select a tab.')}
|
|
61
|
+
`)}
|
|
62
|
+
`);
|