@porsche-design-system/components-react 4.8.0-rc.0 → 4.8.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.
@@ -0,0 +1,191 @@
1
+ # Popover: Priority navigation
2
+
3
+ When horizontal space is limited, navigation items that no longer fit are collapsed into a popover behind a "More" trigger, keeping the bar on a single line. Items move in and out of the popover as the available width changes.
4
+
5
+ - **Type:** Pattern
6
+ - **Components:** [`p-button`](../../../components/p-button/p-button.md), [`p-heading`](../../../components/p-heading/p-heading.md), [`p-link-pure`](../../../components/p-link-pure/p-link-pure.md), [`p-popover`](../../../components/p-popover/p-popover.md), [`p-tag`](../../../components/p-tag/p-tag.md), [`p-text`](../../../components/p-text/p-text.md)
7
+ - **Conventions and stylesheet:** shared by all examples, see [examples.md](../../../examples.md)
8
+
9
+ ## Markup
10
+
11
+ ```html
12
+ <html lang="en">
13
+ <body>
14
+ <main id="main" class="grid-template">
15
+ <section class="col-wide py-fluid-lg grid gap-fluid-md">
16
+ <p-heading tag="h1" size="xl">Priority navigation</p-heading>
17
+ <p-text>
18
+ Resize the window: navigation entries that no longer fit collapse into the “More” popover, so the bar keeps
19
+ its height and no entry is cut off.
20
+ </p-text>
21
+ <nav
22
+ class="overflow-hidden -mx-[calc(var(--spacing-static-xs)*2+4px)] px-[calc(var(--spacing-static-xs)*2+4px)]"
23
+ aria-label="Sections"
24
+ >
25
+ <ul
26
+ id="nav-bar"
27
+ class="flex items-center gap-static-md min-h-[3rem] whitespace-nowrap border-b border-contrast-lower *:shrink-0"
28
+ >
29
+ <li>
30
+ <p-link-pure class="p-static-xs -m-static-xs" icon="none"><a href="#">Some Item 1</a></p-link-pure>
31
+ </li>
32
+ <li>
33
+ <p-link-pure class="p-static-xs -m-static-xs" icon="none">
34
+ <a href="#">
35
+ Some Item 2
36
+ <p-tag class="ms-static-xs" variant="secondary" compact>43</p-tag>
37
+ </a>
38
+ </p-link-pure>
39
+ </li>
40
+ <li>
41
+ <p-link-pure class="p-static-xs -m-static-xs" icon="none"><a href="#">Some Item 3</a></p-link-pure>
42
+ </li>
43
+ <li>
44
+ <p-link-pure class="p-static-xs -m-static-xs" icon="none"><a href="#">Some Item 4</a></p-link-pure>
45
+ </li>
46
+ <li>
47
+ <p-link-pure class="p-static-xs -m-static-xs" icon="none"><a href="#">Some Item 5</a></p-link-pure>
48
+ </li>
49
+ <li>
50
+ <p-link-pure class="p-static-xs -m-static-xs" icon="none"><a href="#">Some Item 6</a></p-link-pure>
51
+ </li>
52
+ <li>
53
+ <p-link-pure class="p-static-xs -m-static-xs" icon="none"><a href="#">Some Item 7</a></p-link-pure>
54
+ </li>
55
+ <li>
56
+ <p-link-pure class="p-static-xs -m-static-xs" icon="none"><a href="#">Some Item 8</a></p-link-pure>
57
+ </li>
58
+ <li>
59
+ <p-link-pure class="p-static-xs -m-static-xs" icon="none"><a href="#">Some Item 9</a></p-link-pure>
60
+ </li>
61
+ <li id="more-trigger" class="ms-auto" hidden>
62
+ <p-popover id="more-popover" class="[--p-popover-w:240px]">
63
+ <p-button
64
+ slot="button"
65
+ id="more-button"
66
+ type="button"
67
+ variant="secondary"
68
+ compact="true"
69
+ icon="arrow-head-down"
70
+ aria="{ 'aria-expanded': false }"
71
+ >
72
+ More
73
+ </p-button>
74
+ <ul id="overflow-list" class="grid gap-static-md *:grid"></ul>
75
+ </p-popover>
76
+ </li>
77
+ </ul>
78
+ </nav>
79
+ </section>
80
+ </main>
81
+ <script type="module" src="main.js"></script>
82
+ </body>
83
+ </html>
84
+ ```
85
+
86
+ ## Script
87
+
88
+ ```js
89
+ import { componentsReady } from '@porsche-design-system/components-js';
90
+
91
+ // DO NOT USE IN PRODUCTION!
92
+ // EXAMPLE CODE FOR DEMONSTRATION PURPOSE ONLY.
93
+
94
+ // Behaviour of the priority navigation: keep the bar on one line by moving the entries that no longer fit into
95
+ // the "More" popover, and back out again when there is room.
96
+ //
97
+ // The popover is used in *controlled* mode – "open" is set from here, even to "false" on load – so the page
98
+ // always knows whether it is expanded and can mirror that onto the "aria-expanded" of its trigger.
99
+
100
+ const navBar = document.getElementById('nav-bar');
101
+ const moreTrigger = document.getElementById('more-trigger');
102
+ const morePopover = document.getElementById('more-popover');
103
+ const moreButton = document.getElementById('more-button');
104
+ const overflowList = document.getElementById('overflow-list');
105
+
106
+ const fits = () => navBar.scrollWidth <= navBar.clientWidth;
107
+
108
+ const setExpanded = (isExpanded) => {
109
+ moreButton.aria = { 'aria-expanded': isExpanded };
110
+ };
111
+
112
+ const setOpen = (isOpen) => {
113
+ morePopover.open = isOpen;
114
+ setExpanded(isOpen);
115
+ };
116
+
117
+ setOpen(false);
118
+
119
+ moreButton.addEventListener('click', () => setOpen(!morePopover.open));
120
+
121
+ // Escape, a click outside or focus leaving the panel request a close in controlled mode.
122
+ morePopover.addEventListener('dismiss', () => setOpen(false));
123
+
124
+ // The trigger has to be shown to reserve its own width while measuring; it is taken out again only once the
125
+ // popover ends up empty. A trigger that is no longer there cannot be expanded, so its state is reset with it.
126
+ const syncTrigger = () => {
127
+ moreTrigger.hidden = overflowList.children.length === 0;
128
+ if (moreTrigger.hidden && morePopover.open) {
129
+ setOpen(false);
130
+ }
131
+ };
132
+
133
+ // Incremental and idempotent: instead of emptying the popover on every resize (which makes an open one flicker),
134
+ // only the minimum number of entries is moved. When the boundary does not change, no DOM mutation happens at all
135
+ // – so an open popover stays perfectly still.
136
+ const recalc = () => {
137
+ // Show the trigger, so its width is accounted for while measuring.
138
+ moreTrigger.hidden = false;
139
+
140
+ // Too wide → push entries from the end of the bar into the popover until the bar fits again.
141
+ while (!fits()) {
142
+ const lastVisible = moreTrigger.previousElementSibling;
143
+ if (!lastVisible) {
144
+ break; // Nothing left to collapse.
145
+ }
146
+ overflowList.insertBefore(lastVisible, overflowList.firstChild);
147
+ }
148
+
149
+ // Room to spare → try pulling entries back out, one at a time. If the pulled entry no longer fits, put it
150
+ // straight back and stop, which is what keeps the boundary from oscillating.
151
+ while (overflowList.firstElementChild) {
152
+ navBar.insertBefore(overflowList.firstElementChild, moreTrigger);
153
+ if (!fits()) {
154
+ overflowList.insertBefore(moreTrigger.previousElementSibling, overflowList.firstChild);
155
+ break;
156
+ }
157
+ }
158
+
159
+ syncTrigger();
160
+ };
161
+
162
+ // The entries are "p-link-pure" elements, so their width is only final once the components have upgraded –
163
+ // measuring before that would collapse entries that do fit.
164
+ componentsReady(navBar).then(recalc);
165
+
166
+ // Coalesce bursts of resize events into a single measurement per animation frame.
167
+ //
168
+ // A ResizeObserver can fire many times in quick succession (e.g. while the user drags the window edge, dozens of
169
+ // callbacks per second). Running the layout-reading "recalc" on every single one is wasteful and can cause
170
+ // visible jitter, so at most one run per frame is scheduled:
171
+ // - "pendingFrame" holds the id of a pending requestAnimationFrame, or "null" when none is scheduled.
172
+ // - The first event schedules a frame; any further events arriving before it runs are ignored, because a recalc is
173
+ // already queued and will read the *latest* layout when it executes.
174
+ // - Inside the frame "pendingFrame" is reset first, so the next burst can schedule a fresh run.
175
+ //
176
+ // Skipping events is safe: the observer is only a "something changed" signal – it never feeds a size into
177
+ // "recalc", which re-measures the live layout itself. Do not capture a width here and pass it in, as that would
178
+ // drop data on the skipped events.
179
+ let pendingFrame = null;
180
+ const scheduleRecalc = () => {
181
+ if (pendingFrame !== null) {
182
+ return; // A recalc is already queued for the next frame.
183
+ }
184
+ pendingFrame = requestAnimationFrame(() => {
185
+ pendingFrame = null;
186
+ recalc();
187
+ });
188
+ };
189
+
190
+ new ResizeObserver(scheduleRecalc).observe(navBar);
191
+ ```
@@ -0,0 +1,397 @@
1
+ # Admin panel
2
+
3
+ The template is designed for internal tools and management interfaces that require a clear, efficient, and data-driven layout. It's built to help administrators oversee and manage content, users, or system settings with ease — whether that's monitoring key metrics, managing user accounts, or configuring application settings.
4
+
5
+ - **Type:** Template
6
+ - **Components:** [`p-accordion`](../../components/p-accordion/p-accordion.md), [`p-button`](../../components/p-button/p-button.md), [`p-button-pure`](../../components/p-button-pure/p-button-pure.md), [`p-canvas`](../../components/p-canvas/p-canvas.md), [`p-checkbox`](../../components/p-checkbox/p-checkbox.md), [`p-divider`](../../components/p-divider/p-divider.md), [`p-heading`](../../components/p-heading/p-heading.md), [`p-input-search`](../../components/p-input-search/p-input-search.md), [`p-link-pure`](../../components/p-link-pure/p-link-pure.md), [`p-modal`](../../components/p-modal/p-modal.md), [`p-popover`](../../components/p-popover/p-popover.md), [`p-select`](../../components/p-select/p-select.md), [`p-table`](../../components/p-table/p-table.md), [`p-tabs-bar`](../../components/p-tabs-bar/p-tabs-bar.md), [`p-text`](../../components/p-text/p-text.md)
7
+ - **Conventions and stylesheet:** shared by all examples, see [examples.md](../../examples.md)
8
+
9
+ ## Markup
10
+
11
+ ```html
12
+ <html lang="en" class="scheme-light-dark bg-surface">
13
+ <body>
14
+ <p-canvas id="admin-canvas">
15
+ <a href="#" slot="title">Admin Panel</a>
16
+ <p-button
17
+ id="search-button"
18
+ slot="header-end"
19
+ icon="search"
20
+ variant="secondary"
21
+ compact="true"
22
+ hide-label="true"
23
+ aria="{ 'aria-haspopup': 'dialog' }"
24
+ >
25
+ Open search
26
+ </p-button>
27
+ <p-button
28
+ id="settings-button"
29
+ slot="header-end"
30
+ icon="user"
31
+ variant="secondary"
32
+ compact="true"
33
+ hide-label="true"
34
+ aria="{ 'aria-expanded': false }"
35
+ >
36
+ Open settings sidebar
37
+ </p-button>
38
+ <div class="@container grid grid-cols-12 gap-x-fluid-md">
39
+ <div class="col-span-full flex gap-static-md items-center">
40
+ <p-heading size="xl" tag="h1">Porsche Models</p-heading>
41
+ <p-button type="button" icon="plus" compact="true">Add model</p-button>
42
+ </div>
43
+ <p-tabs-bar id="model-tabs" class="col-span-full mt-fluid-lg" background="surface" active-tab-index="0">
44
+ <button type="button">Overview</button>
45
+ <button type="button">Drafts</button>
46
+ </p-tabs-bar>
47
+ <p-popover>
48
+ <p-button
49
+ class="col-span-full mt-fluid-md justify-self-start"
50
+ slot="button"
51
+ variant="secondary"
52
+ type="button"
53
+ compact="true"
54
+ icon="filter"
55
+ >
56
+ Filter
57
+ </p-button>
58
+ <form class="space-y-fluid-sm" aria-label="Filter models">
59
+ <p-checkbox label="New Car" name="new-car"></p-checkbox>
60
+ <p-checkbox label="Used Car" name="used-car"></p-checkbox>
61
+ <p-checkbox label="Reserved" name="reserved"></p-checkbox>
62
+ <p-checkbox label="Delivered" name="delivered"></p-checkbox>
63
+ <p-checkbox label="Archived" name="archived"></p-checkbox>
64
+ </form>
65
+ </p-popover>
66
+ <p-table
67
+ class="[--p-table-scroll-indicator-top:64px] [--p-table-scroll-indicator-bottom:var(--spacing-static-md)] col-span-full mt-fluid-sm"
68
+ caption="Porsche Models"
69
+ sticky
70
+ >
71
+ <p-table-head>
72
+ <p-table-head-row>
73
+ <p-table-head-cell>Model</p-table-head-cell>
74
+ <p-table-head-cell>Interest</p-table-head-cell>
75
+ <p-table-head-cell>VIN</p-table-head-cell>
76
+ <p-table-head-cell>Purchase Intention</p-table-head-cell>
77
+ <p-table-head-cell>Status</p-table-head-cell>
78
+ <p-table-head-cell>Comment</p-table-head-cell>
79
+ <p-table-head-cell>Lead ID</p-table-head-cell>
80
+ <p-table-head-cell>Action</p-table-head-cell>
81
+ </p-table-head-row>
82
+ </p-table-head>
83
+ <p-table-body>
84
+ <p-table-row>
85
+ <p-table-cell>
86
+ <img src="/examples/media/718.webp" width="80" height="45" alt="Porsche 718 Cayman" />
87
+ </p-table-cell>
88
+ <p-table-cell>New Car</p-table-cell>
89
+ <p-table-cell>
90
+ <p-link-pure underline icon="none"><a href="#">5GAKVCKD8EJ335750</a></p-link-pure>
91
+ </p-table-cell>
92
+ <p-table-cell>08/2021</p-table-cell>
93
+ <p-table-cell>Won</p-table-cell>
94
+ <p-table-cell class="min-w-[10rem]" multiline>-</p-table-cell>
95
+ <p-table-cell>
96
+ 0000824402
97
+ <p-popover><p-text>Some additional content</p-text></p-popover>
98
+ </p-table-cell>
99
+ <p-table-cell class="flex gap-static-md">
100
+ <p-button-pure type="button" icon="edit" hide-label="true">Edit 718 Cayman</p-button-pure>
101
+ <p-button-pure type="button" icon="delete" hide-label="true">Delete 718 Cayman</p-button-pure>
102
+ </p-table-cell>
103
+ </p-table-row>
104
+ <p-table-row>
105
+ <p-table-cell>
106
+ <img src="/examples/media/911.webp" width="80" height="45" alt="Porsche 911 Carrera" />
107
+ </p-table-cell>
108
+ <p-table-cell>Used Car</p-table-cell>
109
+ <p-table-cell>
110
+ <p-link-pure underline icon="none"><a href="#">WP0ZZZ99ZTS392124</a></p-link-pure>
111
+ </p-table-cell>
112
+ <p-table-cell>09/2021</p-table-cell>
113
+ <p-table-cell>Won</p-table-cell>
114
+ <p-table-cell class="min-w-[10rem]" multiline>-</p-table-cell>
115
+ <p-table-cell>
116
+ 0000824408
117
+ <p-popover><p-text>Some additional content</p-text></p-popover>
118
+ </p-table-cell>
119
+ <p-table-cell class="flex gap-static-md">
120
+ <p-button-pure type="button" icon="edit" hide-label="true">Edit 911 Carrera</p-button-pure>
121
+ <p-button-pure type="button" icon="delete" hide-label="true">Delete 911 Carrera</p-button-pure>
122
+ </p-table-cell>
123
+ </p-table-row>
124
+ </p-table-body>
125
+ </p-table>
126
+ <div class="col-span-full mt-fluid-lg grid grid-cols-subgrid gap-y-fluid-lg">
127
+ <div class="col-span-full @2xl:col-span-4 grid gap-fluid-sm">
128
+ <p-heading size="md" tag="h2">Your Favorites</p-heading>
129
+ <ul class="grid gap-fluid-xs">
130
+ <li>
131
+ <p-link-pure><a href="#">New Relic</a></p-link-pure>
132
+ </li>
133
+ <li>
134
+ <p-link-pure><a href="#">Bise</a></p-link-pure>
135
+ </li>
136
+ <li>
137
+ <p-link-pure><a href="#">AWS</a></p-link-pure>
138
+ </li>
139
+ <li>
140
+ <p-link-pure><a href="#">GRBX Integration Manager</a></p-link-pure>
141
+ </li>
142
+ <li>
143
+ <p-link-pure><a href="#">Cloud Documentation</a></p-link-pure>
144
+ </li>
145
+ </ul>
146
+ </div>
147
+ <div class="col-span-full @2xl:col-span-4 grid gap-fluid-sm">
148
+ <p-heading size="md" tag="h2">Most Suggested</p-heading>
149
+ <ul class="grid gap-fluid-xs">
150
+ <li>
151
+ <p-link-pure><a href="#">Grafana</a></p-link-pure>
152
+ </li>
153
+ <li>
154
+ <p-link-pure><a href="#">New Relic</a></p-link-pure>
155
+ </li>
156
+ <li>
157
+ <p-link-pure><a href="#">BISE Scanners</a></p-link-pure>
158
+ </li>
159
+ <li>
160
+ <p-link-pure><a href="#">Integration Manager</a></p-link-pure>
161
+ </li>
162
+ <li>
163
+ <p-link-pure><a href="#">Prisma Cloud</a></p-link-pure>
164
+ </li>
165
+ </ul>
166
+ </div>
167
+ <div class="col-span-full @2xl:col-span-4 grid gap-fluid-sm">
168
+ <p-heading size="md" tag="h2">Quick Links</p-heading>
169
+ <ul class="grid gap-fluid-xs">
170
+ <li>
171
+ <p-link-pure><a href="#">Tools &amp; Services</a></p-link-pure>
172
+ </li>
173
+ <li>
174
+ <p-link-pure><a href="#">Quick Guide</a></p-link-pure>
175
+ </li>
176
+ <li>
177
+ <p-link-pure><a href="#">Integration Manager</a></p-link-pure>
178
+ </li>
179
+ <li>
180
+ <p-link-pure><a href="#">Confluence</a></p-link-pure>
181
+ </li>
182
+ <li>
183
+ <p-link-pure><a href="#">News</a></p-link-pure>
184
+ </li>
185
+ </ul>
186
+ </div>
187
+ </div>
188
+ </div>
189
+ <div slot="sidebar-start">
190
+ <nav id="sidebar-nav" class="flex flex-col gap-static-sm" aria-label="Main">
191
+ <p-heading class="mt-static-md first:mt-0" tag="h2" size="2xs" color="contrast-medium">Fleet</p-heading>
192
+ <p-accordion class="[&>:not([slot]):not(:last-child)]:mb-static-sm" compact>
193
+ <p-heading slot="summary" tag="h3" size="sm" weight="semibold">Models</p-heading>
194
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">911</a></p-link-pure>
195
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Taycan</a></p-link-pure>
196
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Macan</a></p-link-pure>
197
+ </p-accordion>
198
+ <p-accordion class="[&>:not([slot]):not(:last-child)]:mb-static-sm" compact>
199
+ <p-heading slot="summary" tag="h3" size="sm" weight="semibold">Configurations</p-heading>
200
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Exterior</a></p-link-pure>
201
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Interior</a></p-link-pure>
202
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Wheels</a></p-link-pure>
203
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Packages</a></p-link-pure>
204
+ </p-accordion>
205
+ <p-accordion class="[&>:not([slot]):not(:last-child)]:mb-static-sm" compact>
206
+ <p-heading slot="summary" tag="h3" size="sm" weight="semibold">Inventory</p-heading>
207
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">In stock</a></p-link-pure>
208
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">In transit</a></p-link-pure>
209
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Reserved</a></p-link-pure>
210
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Delivered</a></p-link-pure>
211
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Returned</a></p-link-pure>
212
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Archived</a></p-link-pure>
213
+ </p-accordion>
214
+ <p-heading class="mt-static-md first:mt-0" tag="h2" size="2xs" color="contrast-medium">Sales</p-heading>
215
+ <p-accordion class="[&>:not([slot]):not(:last-child)]:mb-static-sm" compact>
216
+ <p-heading slot="summary" tag="h3" size="sm" weight="semibold">Leads</p-heading>
217
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">New</a></p-link-pure>
218
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Qualified</a></p-link-pure>
219
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Won</a></p-link-pure>
220
+ </p-accordion>
221
+ <p-accordion class="[&>:not([slot]):not(:last-child)]:mb-static-sm" compact>
222
+ <p-heading slot="summary" tag="h3" size="sm" weight="semibold">Contracts</p-heading>
223
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Drafts</a></p-link-pure>
224
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Signed</a></p-link-pure>
225
+ </p-accordion>
226
+ <p-heading class="mt-static-md first:mt-0" tag="h2" size="2xs" color="contrast-medium">
227
+ Administration
228
+ </p-heading>
229
+ <p-accordion class="[&>:not([slot]):not(:last-child)]:mb-static-sm" compact>
230
+ <p-heading slot="summary" tag="h3" size="sm" weight="semibold">Users</p-heading>
231
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">People</a></p-link-pure>
232
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Roles</a></p-link-pure>
233
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Invitations</a></p-link-pure>
234
+ </p-accordion>
235
+ <p-accordion class="[&>:not([slot]):not(:last-child)]:mb-static-sm" compact>
236
+ <p-heading slot="summary" tag="h3" size="sm" weight="semibold">Dealers</p-heading>
237
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Locations</a></p-link-pure>
238
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Opening hours</a></p-link-pure>
239
+ </p-accordion>
240
+ <p-accordion class="[&>:not([slot]):not(:last-child)]:mb-static-sm" compact>
241
+ <p-heading slot="summary" tag="h3" size="sm" weight="semibold">Integrations</p-heading>
242
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Webhooks</a></p-link-pure>
243
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">API keys</a></p-link-pure>
244
+ </p-accordion>
245
+ <p-accordion class="[&>:not([slot]):not(:last-child)]:mb-static-sm" compact>
246
+ <p-heading slot="summary" tag="h3" size="sm" weight="semibold">Billing</p-heading>
247
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Invoices</a></p-link-pure>
248
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Payment methods</a></p-link-pure>
249
+ </p-accordion>
250
+ <p-accordion class="[&>:not([slot]):not(:last-child)]:mb-static-sm" compact>
251
+ <p-heading slot="summary" tag="h3" size="sm" weight="semibold">Audit log</p-heading>
252
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Sign-ins</a></p-link-pure>
253
+ <p-link-pure class="w-full ps-static-sm" icon="none"><a href="#">Changes</a></p-link-pure>
254
+ </p-accordion>
255
+ </nav>
256
+ <p-divider class="my-fluid-lg"></p-divider>
257
+ <footer class="grid gap-static-xs justify-items-start">
258
+ <p-text size="2xs" color="contrast-medium">
259
+ © 2026 Dr. Ing. h.c. F. Porsche AG.
260
+ <ul class="flex flex-col gap-fluid-xs mt-fluid-xs">
261
+ <li>
262
+ <p-link-pure icon="none" size="inherit" color="inherit" underline>
263
+ <a href="#">Privacy Policy</a>
264
+ </p-link-pure>
265
+ </li>
266
+ <li>
267
+ <p-link-pure icon="none" size="inherit" color="inherit" underline>
268
+ <a href="#">Legal Notice</a>
269
+ </p-link-pure>
270
+ </li>
271
+ <li>
272
+ <p-link-pure icon="none" size="inherit" color="inherit" underline><a href="#">License</a></p-link-pure>
273
+ </li>
274
+ <li>
275
+ <p-link-pure icon="none" size="inherit" color="inherit" underline>
276
+ <a href="#">Accessibility Statement</a>
277
+ </p-link-pure>
278
+ </li>
279
+ </ul>
280
+ </p-text>
281
+ </footer>
282
+ </div>
283
+ <div slot="sidebar-end">
284
+ <div class="flex gap-fluid-sm items-center">
285
+ <span
286
+ class="w-16 h-16 aspect-square rounded-full bg-surface text-contrast-medium text-lg grid place-content-center"
287
+ aria-hidden="true"
288
+ >
289
+ FP
290
+ </span>
291
+ <p-text>
292
+ Ferdinand Porsche
293
+ <br />
294
+ <span class="text-contrast-medium">Admin</span>
295
+ </p-text>
296
+ </div>
297
+ <p-divider class="my-fluid-md"></p-divider>
298
+ <p-link-pure class="my-static-xs w-full" icon="user"><a href="#">Account</a></p-link-pure>
299
+ <p-link-pure class="my-static-xs w-full" icon="configurate"><a href="#">Settings</a></p-link-pure>
300
+ <p-link-pure class="my-static-xs w-full" icon="chart"><a href="#">Analytics</a></p-link-pure>
301
+ <p-link-pure class="my-static-xs w-full" icon="information"><a href="#">Help</a></p-link-pure>
302
+ <p-divider class="my-fluid-md"></p-divider>
303
+ <p-select id="scheme-select" name="color-scheme" value="scheme-light-dark" label="Color Scheme" compact>
304
+ <p-select-option value="scheme-light">Light</p-select-option>
305
+ <p-select-option value="scheme-dark">Dark</p-select-option>
306
+ <p-select-option value="scheme-light-dark">Light Dark</p-select-option>
307
+ </p-select>
308
+ <p-divider class="my-fluid-md"></p-divider>
309
+ <p-button class="w-full" type="button" icon="none">Logout</p-button>
310
+ </div>
311
+ </p-canvas>
312
+ <p-modal id="search-dialog" class="[--p-modal-width:min(50rem,80vw)]" aria="{ 'aria-label': 'Search' }">
313
+ <p-heading size="md" tag="h2">What are you looking for?</p-heading>
314
+ <p-input-search
315
+ class="mt-fluid-md"
316
+ name="query"
317
+ label="Search"
318
+ indicator
319
+ clear
320
+ placeholder="Search"
321
+ hide-label="true"
322
+ ></p-input-search>
323
+ </p-modal>
324
+ <script type="module" src="main.js"></script>
325
+ </body>
326
+ </html>
327
+ ```
328
+
329
+ ## Script
330
+
331
+ ```js
332
+ // DO NOT USE IN PRODUCTION!
333
+ // EXAMPLE CODE FOR DEMONSTRATION PURPOSE ONLY.
334
+
335
+ // Behaviour of the admin panel: the two sidebars of the canvas, the categories of its navigation, the tabs above
336
+ // the list, the search dialog and the color scheme switch.
337
+ //
338
+ // Every one of them is used in *controlled* mode: the components report what the user asked for and this page
339
+ // writes the new state back. That is what lets the sidebar affordance mirror its sidebar onto "aria-expanded" and
340
+ // the search dialog be opened from a button that is not part of it. None of these events bubbles, so each element
341
+ // is wired up itself rather than through a listener on a container.
342
+
343
+ const canvas = document.getElementById('admin-canvas');
344
+ const searchButton = document.getElementById('search-button');
345
+ const searchDialog = document.getElementById('search-dialog');
346
+ const settingsButton = document.getElementById('settings-button');
347
+ const sidebarNav = document.getElementById('sidebar-nav');
348
+ const modelTabs = document.getElementById('model-tabs');
349
+ const schemeSelect = document.getElementById('scheme-select');
350
+
351
+ // Keeps the affordance and the sidebar it opens in sync. "hide-label" only hides the label visually, so the
352
+ // button keeps its accessible name and only the state has to be announced.
353
+ const setSettingsOpen = (isOpen) => {
354
+ canvas.sidebarEndOpen = isOpen;
355
+ settingsButton.aria = { 'aria-expanded': isOpen };
356
+ };
357
+
358
+ canvas.addEventListener('sidebarStartUpdate', (e) => {
359
+ canvas.sidebarStartOpen = e.detail.open;
360
+ });
361
+ canvas.addEventListener('sidebarEndDismiss', () => setSettingsOpen(false));
362
+ settingsButton.addEventListener('click', () => setSettingsOpen(!canvas.sidebarEndOpen));
363
+
364
+ // The navigation starts out beside the content where there is room for it, and collapsed below that, where the
365
+ // canvas turns it into a flyout on top of the page.
366
+ canvas.sidebarStartOpen = window.matchMedia('(min-width: 760px)').matches;
367
+
368
+ for (const accordion of sidebarNav.querySelectorAll('p-accordion')) {
369
+ accordion.addEventListener('update', (e) => {
370
+ accordion.open = e.detail.open;
371
+ });
372
+ }
373
+
374
+ modelTabs.addEventListener('update', (e) => {
375
+ modelTabs.activeTabIndex = e.detail.activeTabIndex;
376
+ });
377
+
378
+ searchButton.addEventListener('click', () => {
379
+ searchDialog.open = true;
380
+ });
381
+
382
+ // Escape, a click outside or the close button request a close in controlled mode – the component restores focus
383
+ // to the element the dialog was opened from itself, so only the state has to be written back.
384
+ searchDialog.addEventListener('dismiss', () => {
385
+ searchDialog.open = false;
386
+ });
387
+
388
+ // The color scheme is a class on the document element, so it reaches the sidebars as well – they are rendered on
389
+ // top of the page and would not be covered by a scheme set further down. The three class names appear nowhere in
390
+ // the markup, which is why they are listed here: Tailwind scans this page too and therefore emits all three.
391
+ const schemes = ['scheme-light', 'scheme-dark', 'scheme-light-dark'];
392
+
393
+ schemeSelect.addEventListener('change', (e) => {
394
+ document.documentElement.classList.remove(...schemes);
395
+ document.documentElement.classList.add(e.detail.value);
396
+ });
397
+ ```