feat(ui): add DataTable and Toaster, drop the legacy Table, fix overlay dialogs
DataTable replaces the 20-line Table scaffold entirely: columns, sorting, filtering, pagination, selection, bulk actions, comparison layout, sticky first column, custom HTML cells, and a remote source driven by a `request` output rather than a function prop (props travel as HTML attributes, so a function arrives as its own source text). Toaster replaces the hand-rolled status div: tone icons, actions, hover pause/resume and a progress bar. Overlays audit -- Modal and Drawer declared aria-modal="true" but nothing ever moved focus into the panel, so the @keydown handler on their root never ran and closeOnEscape did nothing. Focus, focus restore, a Tab trap and a body scroll lock now live in the reactive runtime, shared by both. ContextMenu placed pointer menus by subtracting a guessed 340x420 from the viewport, which pushed every menu that was not that size away from the pointer; it now positions at the pointer and lets the anchored clamp pull it back once it can be measured. The reactive runtime size budget moves 150k -> 175k to cover anchored overlays, dialog behaviour, the toaster and the DataTable client half. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -46,7 +46,7 @@ page ContextMenuDetail {
|
||||
<header><span><span class="icon-[lucide--code-2] size-4" aria-hidden="true"></span>Component code</span><button type="button" data-playground-copy><span class="icon-[lucide--copy] size-4" aria-hidden="true"></span>Copy</button></header>
|
||||
<pre><code data-playground-code><ContextMenu
|
||||
items='[
|
||||
{
|
||||
<span>{</span>
|
||||
"id": "context-menu-0-1",
|
||||
"key": "context-menu-0-1",
|
||||
"value": "primary",
|
||||
@@ -75,31 +75,31 @@ page ContextMenuDetail {
|
||||
"target": "_self",
|
||||
"ariaLabel": "Open primary workflow 1",
|
||||
"items": [
|
||||
{
|
||||
<span>{</span>
|
||||
"label": "Nested option A",
|
||||
"value": "nested-a"
|
||||
},
|
||||
{
|
||||
<span>}</span>,
|
||||
<span>{</span>
|
||||
"label": "Nested option B",
|
||||
"value": "nested-b"
|
||||
}
|
||||
<span>}</span>
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
<span>{</span>
|
||||
"label": "Documentation",
|
||||
"href": "#documentation"
|
||||
},
|
||||
{
|
||||
<span>}</span>,
|
||||
<span>{</span>
|
||||
"label": "API reference",
|
||||
"href": "#api-reference"
|
||||
}
|
||||
<span>}</span>
|
||||
],
|
||||
"values": [
|
||||
"Included",
|
||||
"Standard"
|
||||
]
|
||||
},
|
||||
{
|
||||
<span>}</span>,
|
||||
<span>{</span>
|
||||
"id": "context-menu-0-2",
|
||||
"key": "context-menu-0-2",
|
||||
"value": "secondary",
|
||||
@@ -128,30 +128,30 @@ page ContextMenuDetail {
|
||||
"target": "_self",
|
||||
"ariaLabel": "Open primary workflow 2",
|
||||
"items": [
|
||||
{
|
||||
<span>{</span>
|
||||
"label": "Nested option A",
|
||||
"value": "nested-a"
|
||||
},
|
||||
{
|
||||
<span>}</span>,
|
||||
<span>{</span>
|
||||
"label": "Nested option B",
|
||||
"value": "nested-b"
|
||||
}
|
||||
<span>}</span>
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
<span>{</span>
|
||||
"label": "Documentation",
|
||||
"href": "#documentation"
|
||||
},
|
||||
{
|
||||
<span>}</span>,
|
||||
<span>{</span>
|
||||
"label": "API reference",
|
||||
"href": "#api-reference"
|
||||
}
|
||||
<span>}</span>
|
||||
],
|
||||
"values": [
|
||||
"Included",
|
||||
"Standard"
|
||||
]
|
||||
}
|
||||
<span>}</span>
|
||||
]'
|
||||
title="Context Menu example"
|
||||
description="A polished default context menu for a modern application."
|
||||
@@ -216,27 +216,27 @@ page ContextMenuDetail {
|
||||
<header><span><span class="icon-[lucide--code-2] size-4" aria-hidden="true"></span>Component usage</span><small>.wrn</small></header>
|
||||
<pre><code><ContextMenu
|
||||
items='[
|
||||
{
|
||||
<span>{</span>
|
||||
"label": "Open dashboard",
|
||||
"description": "View the operational workspace",
|
||||
"value": "dashboard",
|
||||
"icon": "icon-[lucide--layout-dashboard]"
|
||||
},
|
||||
{
|
||||
<span>}</span>,
|
||||
<span>{</span>
|
||||
"label": "Share record",
|
||||
"value": "share",
|
||||
"icon": "icon-[lucide--share-2]",
|
||||
"shortcut": "Ctrl S"
|
||||
},
|
||||
{
|
||||
<span>}</span>,
|
||||
<span>{</span>
|
||||
"type": "divider"
|
||||
},
|
||||
{
|
||||
<span>}</span>,
|
||||
<span>{</span>
|
||||
"label": "Delete record",
|
||||
"value": "delete",
|
||||
"icon": "icon-[lucide--trash-2]",
|
||||
"danger": true
|
||||
}
|
||||
<span>}</span>
|
||||
]'
|
||||
title="Record actions"
|
||||
description="Right-click the target surface"
|
||||
@@ -269,27 +269,27 @@ page ContextMenuDetail {
|
||||
<header><span><span class="icon-[lucide--code-2] size-4" aria-hidden="true"></span>Component usage</span><small>.wrn</small></header>
|
||||
<pre><code><ContextMenu
|
||||
items='[
|
||||
{
|
||||
<span>{</span>
|
||||
"label": "Open dashboard",
|
||||
"description": "View the operational workspace",
|
||||
"value": "dashboard",
|
||||
"icon": "icon-[lucide--layout-dashboard]"
|
||||
},
|
||||
{
|
||||
<span>}</span>,
|
||||
<span>{</span>
|
||||
"label": "Share record",
|
||||
"value": "share",
|
||||
"icon": "icon-[lucide--share-2]",
|
||||
"shortcut": "Ctrl S"
|
||||
},
|
||||
{
|
||||
<span>}</span>,
|
||||
<span>{</span>
|
||||
"type": "divider"
|
||||
},
|
||||
{
|
||||
<span>}</span>,
|
||||
<span>{</span>
|
||||
"label": "Delete record",
|
||||
"value": "delete",
|
||||
"icon": "icon-[lucide--trash-2]",
|
||||
"danger": true
|
||||
}
|
||||
<span>}</span>
|
||||
]'
|
||||
trigger="click"
|
||||
align="center"
|
||||
@@ -327,27 +327,27 @@ page ContextMenuDetail {
|
||||
<header><span><span class="icon-[lucide--code-2] size-4" aria-hidden="true"></span>Component usage</span><small>.wrn</small></header>
|
||||
<pre><code><ContextMenu
|
||||
items='[
|
||||
{
|
||||
<span>{</span>
|
||||
"label": "Open dashboard",
|
||||
"description": "View the operational workspace",
|
||||
"value": "dashboard",
|
||||
"icon": "icon-[lucide--layout-dashboard]"
|
||||
},
|
||||
{
|
||||
<span>}</span>,
|
||||
<span>{</span>
|
||||
"label": "Share record",
|
||||
"value": "share",
|
||||
"icon": "icon-[lucide--share-2]",
|
||||
"shortcut": "Ctrl S"
|
||||
},
|
||||
{
|
||||
<span>}</span>,
|
||||
<span>{</span>
|
||||
"type": "divider"
|
||||
},
|
||||
{
|
||||
<span>}</span>,
|
||||
<span>{</span>
|
||||
"label": "Delete record",
|
||||
"value": "delete",
|
||||
"icon": "icon-[lucide--trash-2]",
|
||||
"danger": true
|
||||
}
|
||||
<span>}</span>
|
||||
]'
|
||||
trigger="both"
|
||||
placement="bottom-start"
|
||||
@@ -375,25 +375,25 @@ page ContextMenuDetail {
|
||||
@close='console.log(payload)'
|
||||
@select='console.log(payload)'
|
||||
@action='console.log(payload)'
|
||||
/></code></pre></section><section class="demo-code"><header><span><span class="icon-[lucide--radio] size-4" aria-hidden="true"></span>Direct output handlers</span><small>.js</small></header><pre><code>import { registerOutputHandler } from "@wrnexus/csr/outputs"
|
||||
/></code></pre></section><section class="demo-code"><header><span><span class="icon-[lucide--radio] size-4" aria-hidden="true"></span>Direct output handlers</span><small>.js</small></header><pre><code>import <span>{</span> registerOutputHandler <span>}</span> from "@wrnexus/csr/outputs"
|
||||
|
||||
const component = document.querySelector("[data-ui-component=\"ContextMenu\"], [data-component=\"ContextMenu\"]")
|
||||
|
||||
if (component) registerOutputHandler(component, "open", (payload) => {
|
||||
if (component) registerOutputHandler(component, "open", (payload) => <span>{</span>
|
||||
console.log("open", payload)
|
||||
})
|
||||
<span>}</span>)
|
||||
|
||||
if (component) registerOutputHandler(component, "close", (payload) => {
|
||||
if (component) registerOutputHandler(component, "close", (payload) => <span>{</span>
|
||||
console.log("close", payload)
|
||||
})
|
||||
<span>}</span>)
|
||||
|
||||
if (component) registerOutputHandler(component, "select", (payload) => {
|
||||
if (component) registerOutputHandler(component, "select", (payload) => <span>{</span>
|
||||
console.log("select", payload)
|
||||
})
|
||||
<span>}</span>)
|
||||
|
||||
if (component) registerOutputHandler(component, "action", (payload) => {
|
||||
if (component) registerOutputHandler(component, "action", (payload) => <span>{</span>
|
||||
console.log("action", payload)
|
||||
})</code></pre></section></div></div></section>
|
||||
<span>}</span>)</code></pre></section></div></div></section>
|
||||
<section id="api" class="detail-section"><div class="detail-section-heading"><span>Component API</span><h2>Props and configuration</h2><p>All content and behavior shown above is supplied through these props and slots.</p></div><div class="docs-table-wrap"><table class="docs-table"><thead><tr><th>Prop</th><th>Type</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td><code>items</code></td><td>unknown[]</td><td><code>[]</code></td><td>No</td></tr><tr><td><code>open</code></td><td>boolean</td><td><code>false</code></td><td>No</td></tr><tr><td><code>defaultOpen</code></td><td>boolean</td><td><code>false</code></td><td>No</td></tr><tr><td><code>trigger</code></td><td>string</td><td><code>"contextmenu"</code></td><td>No</td></tr><tr><td><code>placement</code></td><td>string</td><td><code>"pointer"</code></td><td>No</td></tr><tr><td><code>align</code></td><td>string</td><td><code>"start"</code></td><td>No</td></tr><tr><td><code>size</code></td><td>string</td><td><code>"default"</code></td><td>No</td></tr><tr><td><code>color</code></td><td>string</td><td><code>"primary"</code></td><td>No</td></tr><tr><td><code>variant</code></td><td>string</td><td><code>"raised"</code></td><td>No</td></tr><tr><td><code>title</code></td><td>string</td><td><code>""</code></td><td>No</td></tr><tr><td><code>description</code></td><td>string</td><td><code>""</code></td><td>No</td></tr><tr><td><code>label</code></td><td>string</td><td><code>"Context menu"</code></td><td>No</td></tr><tr><td><code>closeOnSelect</code></td><td>boolean</td><td><code>true</code></td><td>No</td></tr><tr><td><code>closeOnOutside</code></td><td>boolean</td><td><code>true</code></td><td>No</td></tr><tr><td><code>disabled</code></td><td>boolean</td><td><code>false</code></td><td>No</td></tr><tr><td><code>minWidth</code></td><td>string</td><td><code>"14rem"</code></td><td>No</td></tr><tr><td><code>maxWidth</code></td><td>string</td><td><code>"20rem"</code></td><td>No</td></tr><tr><td><code>class</code></td><td>string</td><td><code>""</code></td><td>No</td></tr></tbody></table></div></section>
|
||||
</main>
|
||||
<aside class="detail-aside">
|
||||
|
||||
Reference in New Issue
Block a user