@nadicodeai/ui 12.1.258 → 12.1.259
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/components/context-menu.d.ts +1 -1
- package/dist/components/context-menu.d.ts.map +1 -1
- package/dist/components/context-menu.js +2 -2
- package/dist/internal/record-grid.d.ts +5 -1
- package/dist/internal/record-grid.d.ts.map +1 -1
- package/dist/internal/record-grid.js +19 -12
- package/dist/showcase/usage.generated.js +1 -1
- package/package.json +2 -2
|
@@ -7,7 +7,7 @@ import { DropdownMenuCheckboxItem, DropdownMenuGroup, DropdownMenuItem, Dropdown
|
|
|
7
7
|
* @family Menus
|
|
8
8
|
* @when "Use ContextMenu for power-user shortcuts on right-click or long-press over a row, file, or canvas object." (https://vercel.com/geist/context-menu) "ContextMenu must never be the only entry point for an action. Mirror every item in a visible `Menu` trigger or row button so mouse-only and keyboard-only users have parity." (https://vercel.com/geist/context-menu) Ours: inside `@nadicodeai/ui` only, which does not export it: `ActionContextMenu` draws it for a record. A right-click on a canvas or a surface no record owns, whose commands are also reachable another way, is a composition built on it in this package.
|
|
9
9
|
* @instead "For a global command palette, use `CommandMenu`; for a dropdown opened from a visible trigger, use `Menu`." (https://vercel.com/geist/context-menu) Ours: those are `CommandDialog` and `DropdownMenu`. A record's right-click is `ActionContextMenu`, from the same data as its `ActionMenu`.
|
|
10
|
-
* @behaviour "Bind to right-click on desktop and long-press on touch. Suppress the native browser menu only on the trigger area, not the whole page." (https://vercel.com/geist/context-menu) "Position the menu at the pointer; if it would overflow the viewport, flip horizontally then vertically before clipping." (https://vercel.com/geist/context-menu) "Close on activation, Escape, and outside-click. Don’t close on hover-out." (https://vercel.com/geist/context-menu) Ours: a mouse still selects the trigger's text, so a person can copy an address from a row; on a touch screen, where a long press opens the menu, the text cannot be selected. The dropdown's surface and rows exactly,
|
|
10
|
+
* @behaviour "Bind to right-click on desktop and long-press on touch. Suppress the native browser menu only on the trigger area, not the whole page." (https://vercel.com/geist/context-menu) "Position the menu at the pointer; if it would overflow the viewport, flip horizontally then vertically before clipping." (https://vercel.com/geist/context-menu) "Close on activation, Escape, and outside-click. Don’t close on hover-out." (https://vercel.com/geist/context-menu) Ours: a mouse still selects the trigger's text, so a person can copy an address from a row; on a touch screen, where a long press opens the menu, the text cannot be selected. The dropdown's surface and rows exactly, its least width of 200 px included, opening 2 px right of the pointer and appearing at once, with no entry motion. A row that cannot be chosen keeps its place with its text muted, never dimmed. Destructive last, after a divider.
|
|
11
11
|
* @words "Items follow the same rules as `Menu`: Title Case `Verb + Noun` (`Open in New Tab`, `Copy URL`, `Delete Deployment`). Bare verbs are wrong." (https://vercel.com/geist/context-menu) "End with `…` only when activating opens a follow-up dialog (`Rename…`, `Move to Folder…`)." (https://vercel.com/geist/context-menu) "Group destructive items at the bottom with a divider and keep the destructive label `Verb + Noun`. `Delete` alone never ships." (https://vercel.com/geist/context-menu) Ours: sentence case, "Copy address", not Title Case. Identical to the visible menu's, in the same order; a command reached two ways reads the same both ways.
|
|
12
12
|
* @access "Trigger the keyboard menu key (`Shift+F10` on Windows/Linux, the menu key, or platform equivalent) to open the same menu without right-click." (https://vercel.com/geist/context-menu) "Up/Down arrows move focus, Enter/Space activates, Escape closes and returns focus to the row." (https://vercel.com/geist/context-menu) "Don’t bury destructive items behind nested submenus. One level deep keeps keyboard navigation predictable." (https://vercel.com/geist/context-menu) Ours: the trigger must itself be focusable or hold something that is. The content requires an `aria-label` naming the menu, because nothing visible labels a menu opened at the pointer.
|
|
13
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu.d.ts","sourceRoot":"","sources":["../../src/components/context-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAIlF,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAi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BAAqB,qBAS5E;AAED,iBAAS,uBAAuB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,wBAAwB,CAAC,qBAE5F;AAED,iBAAS,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,sBAAsB,CAAC,qBAExF;AAED,iBAAS,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,qBAEtF;AAED,iBAAS,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,qBAEtF;AAED,iBAAS,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,qBAEpF;AAED,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,CAAC"}
|
|
@@ -12,7 +12,7 @@ import { DropdownMenuCheckboxItem, DropdownMenuGroup, DropdownMenuItem, Dropdown
|
|
|
12
12
|
* @family Menus
|
|
13
13
|
* @when "Use ContextMenu for power-user shortcuts on right-click or long-press over a row, file, or canvas object." (https://vercel.com/geist/context-menu) "ContextMenu must never be the only entry point for an action. Mirror every item in a visible `Menu` trigger or row button so mouse-only and keyboard-only users have parity." (https://vercel.com/geist/context-menu) Ours: inside `@nadicodeai/ui` only, which does not export it: `ActionContextMenu` draws it for a record. A right-click on a canvas or a surface no record owns, whose commands are also reachable another way, is a composition built on it in this package.
|
|
14
14
|
* @instead "For a global command palette, use `CommandMenu`; for a dropdown opened from a visible trigger, use `Menu`." (https://vercel.com/geist/context-menu) Ours: those are `CommandDialog` and `DropdownMenu`. A record's right-click is `ActionContextMenu`, from the same data as its `ActionMenu`.
|
|
15
|
-
* @behaviour "Bind to right-click on desktop and long-press on touch. Suppress the native browser menu only on the trigger area, not the whole page." (https://vercel.com/geist/context-menu) "Position the menu at the pointer; if it would overflow the viewport, flip horizontally then vertically before clipping." (https://vercel.com/geist/context-menu) "Close on activation, Escape, and outside-click. Don’t close on hover-out." (https://vercel.com/geist/context-menu) Ours: a mouse still selects the trigger's text, so a person can copy an address from a row; on a touch screen, where a long press opens the menu, the text cannot be selected. The dropdown's surface and rows exactly,
|
|
15
|
+
* @behaviour "Bind to right-click on desktop and long-press on touch. Suppress the native browser menu only on the trigger area, not the whole page." (https://vercel.com/geist/context-menu) "Position the menu at the pointer; if it would overflow the viewport, flip horizontally then vertically before clipping." (https://vercel.com/geist/context-menu) "Close on activation, Escape, and outside-click. Don’t close on hover-out." (https://vercel.com/geist/context-menu) Ours: a mouse still selects the trigger's text, so a person can copy an address from a row; on a touch screen, where a long press opens the menu, the text cannot be selected. The dropdown's surface and rows exactly, its least width of 200 px included, opening 2 px right of the pointer and appearing at once, with no entry motion. A row that cannot be chosen keeps its place with its text muted, never dimmed. Destructive last, after a divider.
|
|
16
16
|
* @words "Items follow the same rules as `Menu`: Title Case `Verb + Noun` (`Open in New Tab`, `Copy URL`, `Delete Deployment`). Bare verbs are wrong." (https://vercel.com/geist/context-menu) "End with `…` only when activating opens a follow-up dialog (`Rename…`, `Move to Folder…`)." (https://vercel.com/geist/context-menu) "Group destructive items at the bottom with a divider and keep the destructive label `Verb + Noun`. `Delete` alone never ships." (https://vercel.com/geist/context-menu) Ours: sentence case, "Copy address", not Title Case. Identical to the visible menu's, in the same order; a command reached two ways reads the same both ways.
|
|
17
17
|
* @access "Trigger the keyboard menu key (`Shift+F10` on Windows/Linux, the menu key, or platform equivalent) to open the same menu without right-click." (https://vercel.com/geist/context-menu) "Up/Down arrows move focus, Enter/Space activates, Escape closes and returns focus to the row." (https://vercel.com/geist/context-menu) "Don’t bury destructive items behind nested submenus. One level deep keeps keyboard navigation predictable." (https://vercel.com/geist/context-menu) Ours: the trigger must itself be focusable or hold something that is. The content requires an `aria-label` naming the menu, because nothing visible labels a menu opened at the pointer.
|
|
18
18
|
*/
|
|
@@ -26,7 +26,7 @@ function ContextMenuTrigger({ className, ...props }) {
|
|
|
26
26
|
return (_jsx(ContextMenuPrimitive.Trigger, { "data-slot": "context-menu-trigger", className: cn("select-none [@media(hover:hover)_and_(pointer:fine)]:select-auto", className), ...props }));
|
|
27
27
|
}
|
|
28
28
|
function ContextMenuPopup({ className, align = "start", alignOffset = 0, density = "comfortable", side = "right", sideOffset = 2, ...props }) {
|
|
29
|
-
return (_jsx(ContextMenuPrimitive.Portal, { children: _jsx(ContextMenuPrimitive.Positioner, { className: "isolate z-50 outline-none", align: align, alignOffset: alignOffset, side: side, sideOffset: sideOffset, collisionPadding: 8, children: _jsx(ContextMenuPrimitive.Popup, { "data-slot": "context-menu-content", "data-density": density, className: cn("pointer-events-auto", menuSurface,
|
|
29
|
+
return (_jsx(ContextMenuPrimitive.Portal, { children: _jsx(ContextMenuPrimitive.Positioner, { className: "isolate z-50 outline-none", align: align, alignOffset: alignOffset, side: side, sideOffset: sideOffset, collisionPadding: 8, children: _jsx(ContextMenuPrimitive.Popup, { "data-slot": "context-menu-content", "data-nc-ui": "", "data-density": density, className: cn("pointer-events-auto", menuSurface, className), ...props }) }) }));
|
|
30
30
|
}
|
|
31
31
|
function ContextMenuContent({ "aria-label": name, ...props }) {
|
|
32
32
|
return _jsx(ContextMenuPopup, { "aria-label": name, ...props });
|
|
@@ -27,7 +27,11 @@ export type RecordGridCell = {
|
|
|
27
27
|
/** The record has no value for it: an `optional` column leaves it off the record's card. */
|
|
28
28
|
empty: boolean;
|
|
29
29
|
};
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* A press anywhere on a row that opens a record presses its one opening control, the element
|
|
32
|
+
* marked `data-row-link`: a link is followed, a button is pressed. A press on a control of the row
|
|
33
|
+
* is that control's alone.
|
|
34
|
+
*/
|
|
31
35
|
export declare function openRowOnClick(href: string | null | undefined): React.MouseEventHandler<HTMLElement> | undefined;
|
|
32
36
|
/**
|
|
33
37
|
* Records a person opens, in aligned columns on a wide card and one card per record on a narrow
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-grid.d.ts","sourceRoot":"","sources":["../../src/internal/record-grid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,mGAAmG;AACnG,KAAK,oBAAoB,GACrB;IACE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACjC,GACD,SAAS,CAAC;AAEd,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,oBAAoB,CAAC;IAC3B,mFAAmF;IACnF,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,IAAI,EAAE,WAAW,GAAG,YAAY,GAAG,SAAS,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,4FAA4F;IAC5F,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAeF
|
|
1
|
+
{"version":3,"file":"record-grid.d.ts","sourceR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T,EAAE;IACD,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACrC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAwBA;AAgBD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,MAAM,EACN,IAAI,EACJ,SAAS,EACT,GAAG,KAAK,EACT,EAAE;IACD,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;IACjC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACjC,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,qBAyEhD;AAED,oGAAoG;AACpG,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAWjF"}
|
|
@@ -16,7 +16,11 @@ function track(column) {
|
|
|
16
16
|
}
|
|
17
17
|
return column.size === undefined ? "minmax(0,1fr)" : `minmax(0,${column.size}px)`;
|
|
18
18
|
}
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* A press anywhere on a row that opens a record presses its one opening control, the element
|
|
21
|
+
* marked `data-row-link`: a link is followed, a button is pressed. A press on a control of the row
|
|
22
|
+
* is that control's alone.
|
|
23
|
+
*/
|
|
20
24
|
export function openRowOnClick(href) {
|
|
21
25
|
if (!href)
|
|
22
26
|
return undefined;
|
|
@@ -24,10 +28,10 @@ export function openRowOnClick(href) {
|
|
|
24
28
|
const target = event.target;
|
|
25
29
|
if (!(target instanceof Element) ||
|
|
26
30
|
!event.currentTarget.contains(target) ||
|
|
27
|
-
target.closest("a, button, input, select, textarea, label, [role='button'], [role='checkbox']")) {
|
|
31
|
+
target.closest("a, button, input, select, textarea, label, [role='button'], [role='checkbox'], [data-row-link]")) {
|
|
28
32
|
return;
|
|
29
33
|
}
|
|
30
|
-
event.currentTarget.querySelector("
|
|
34
|
+
event.currentTarget.querySelector("[data-row-link]")?.click();
|
|
31
35
|
};
|
|
32
36
|
}
|
|
33
37
|
// From 48rem of card the records stand in aligned columns; on a narrower card each record is a
|
|
@@ -54,24 +58,27 @@ const PLACE = {
|
|
|
54
58
|
trail: "order-3 shrink-0",
|
|
55
59
|
fact: "order-5 max-w-full",
|
|
56
60
|
};
|
|
61
|
+
function placeOf(cell, index, identityIndex) {
|
|
62
|
+
if (cell.identity)
|
|
63
|
+
return "identity";
|
|
64
|
+
if (cell.meta?.firstLine !== true)
|
|
65
|
+
return "fact";
|
|
66
|
+
return index < identityIndex ? "lead" : "trail";
|
|
67
|
+
}
|
|
57
68
|
/**
|
|
58
69
|
* One record: its row and, while it is edited, its form under it. A row that opens the record
|
|
59
70
|
* takes `accent` on hover, and any row on focus within and while its menu is open.
|
|
60
71
|
*/
|
|
61
72
|
export function RecordGridRow({ cells, editor, href, className, ...props }) {
|
|
62
73
|
const identityIndex = cells.findIndex((cell) => cell.identity);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
? index < identityIndex
|
|
68
|
-
? "lead"
|
|
69
|
-
: "trail"
|
|
70
|
-
: "fact";
|
|
74
|
+
const placed = cells.map((cell, index) => ({ cell, place: placeOf(cell, index, identityIndex) }));
|
|
75
|
+
// On a narrow card the facts wrap under the name, and an optional one the record lacks is hidden.
|
|
76
|
+
const factsUnder = placed.some(({ cell, place }) => place === "fact" && !(cell.meta?.optional === true && cell.empty));
|
|
77
|
+
return (_jsxs("div", { className: cn("border-b border-border transition-colors last:border-b-0 data-[interactive=true]:hover:bg-accent has-focus-visible:bg-accent has-[[aria-expanded=true]]:bg-accent", WIDE_GRID, className), "data-interactive": Boolean(href), role: "rowgroup", ...props, "data-slot": "record-grid-record", children: [_jsx("div", { className: cn("flex min-h-18 flex-wrap items-center gap-x-3 gap-y-2 px-(--card-spacing) py-4", WIDE_GRID, "@3xl/list:items-center @3xl/list:gap-0 @3xl/list:p-0", href && "cursor-pointer"), "data-href": href ?? undefined, "data-slot": "record-grid-row", onClick: openRowOnClick(href), role: "row", children: placed.map(({ cell, place }) => {
|
|
71
78
|
const wraps = cell.meta?.wraps === true;
|
|
72
79
|
const cut = place === "fact" && !wraps;
|
|
73
80
|
return (_jsxs(React.Fragment, { children: [_jsx("div", { className: cn("min-w-0 @3xl/list:order-none @3xl/list:px-2 @3xl/list:py-4 @3xl/list:first:pl-(--card-spacing) @3xl/list:last:pr-(--card-spacing) @3xl/list:last:text-right", PLACE[place], cut && "truncate", wraps && "whitespace-normal wrap-break-word @3xl/list:last:text-left", cell.meta?.numeric === true && "tabular-nums @3xl/list:text-right", cell.meta?.centered === true &&
|
|
74
|
-
"@3xl/list:text-center @3xl/list:last:text-center", cell.meta?.optional === true && cell.empty && "hidden @3xl/list:block"), "data-slot": "record-grid-cell", onFocus: cut ? titleWhenCut : undefined, onPointerEnter: cut ? titleWhenCut : undefined, role: "cell", children: cell.content }), cell.identity ? (_jsx("div", { "aria-hidden": "true", className: "order-4 h-0 basis-full @3xl/list:hidden" })) : null] }, cell.id));
|
|
81
|
+
"@3xl/list:text-center @3xl/list:last:text-center", cell.meta?.optional === true && cell.empty && "hidden @3xl/list:block"), "data-slot": "record-grid-cell", onFocus: cut ? titleWhenCut : undefined, onPointerEnter: cut ? titleWhenCut : undefined, role: "cell", children: cell.content }), cell.identity && factsUnder ? (_jsx("div", { "aria-hidden": "true", className: "order-4 h-0 basis-full @3xl/list:hidden" })) : null] }, cell.id));
|
|
75
82
|
}) }), editor ? (_jsx("div", { className: "@3xl/list:col-span-full", "data-slot": "table-row-editor", role: "row", children: _jsx("div", { className: "whitespace-normal", role: "cell", children: editor }) })) : null] }));
|
|
76
83
|
}
|
|
77
84
|
/** A section's heading inside the records: the name of the group the records under it belong to. */
|
|
@@ -1847,7 +1847,7 @@ export const USAGE = [
|
|
|
1847
1847
|
summary: "A menu that opens at the pointer on a right-click or a long press, from the dropdown's own parts.",
|
|
1848
1848
|
when: '"Use ContextMenu for power-user shortcuts on right-click or long-press over a row, file, or canvas object." (https://vercel.com/geist/context-menu) "ContextMenu must never be the only entry point for an action. Mirror every item in a visible `Menu` trigger or row button so mouse-only and keyboard-only users have parity." (https://vercel.com/geist/context-menu) Ours: inside `@nadicodeai/ui` only, which does not export it: `ActionContextMenu` draws it for a record. A right-click on a canvas or a surface no record owns, whose commands are also reachable another way, is a composition built on it in this package.',
|
|
1849
1849
|
instead: '"For a global command palette, use `CommandMenu`; for a dropdown opened from a visible trigger, use `Menu`." (https://vercel.com/geist/context-menu) Ours: those are `CommandDialog` and `DropdownMenu`. A record\'s right-click is `ActionContextMenu`, from the same data as its `ActionMenu`.',
|
|
1850
|
-
behaviour: '"Bind to right-click on desktop and long-press on touch. Suppress the native browser menu only on the trigger area, not the whole page." (https://vercel.com/geist/context-menu) "Position the menu at the pointer; if it would overflow the viewport, flip horizontally then vertically before clipping." (https://vercel.com/geist/context-menu) "Close on activation, Escape, and outside-click. Don’t close on hover-out." (https://vercel.com/geist/context-menu) Ours: a mouse still selects the trigger\'s text, so a person can copy an address from a row; on a touch screen, where a long press opens the menu, the text cannot be selected. The dropdown\'s surface and rows exactly,
|
|
1850
|
+
behaviour: '"Bind to right-click on desktop and long-press on touch. Suppress the native browser menu only on the trigger area, not the whole page." (https://vercel.com/geist/context-menu) "Position the menu at the pointer; if it would overflow the viewport, flip horizontally then vertically before clipping." (https://vercel.com/geist/context-menu) "Close on activation, Escape, and outside-click. Don’t close on hover-out." (https://vercel.com/geist/context-menu) Ours: a mouse still selects the trigger\'s text, so a person can copy an address from a row; on a touch screen, where a long press opens the menu, the text cannot be selected. The dropdown\'s surface and rows exactly, its least width of 200 px included, opening 2 px right of the pointer and appearing at once, with no entry motion. A row that cannot be chosen keeps its place with its text muted, never dimmed. Destructive last, after a divider.',
|
|
1851
1851
|
words: '"Items follow the same rules as `Menu`: Title Case `Verb + Noun` (`Open in New Tab`, `Copy URL`, `Delete Deployment`). Bare verbs are wrong." (https://vercel.com/geist/context-menu) "End with `…` only when activating opens a follow-up dialog (`Rename…`, `Move to Folder…`)." (https://vercel.com/geist/context-menu) "Group destructive items at the bottom with a divider and keep the destructive label `Verb + Noun`. `Delete` alone never ships." (https://vercel.com/geist/context-menu) Ours: sentence case, "Copy address", not Title Case. Identical to the visible menu\'s, in the same order; a command reached two ways reads the same both ways.',
|
|
1852
1852
|
access: '"Trigger the keyboard menu key (`Shift+F10` on Windows/Linux, the menu key, or platform equivalent) to open the same menu without right-click." (https://vercel.com/geist/context-menu) "Up/Down arrows move focus, Enter/Space activates, Escape closes and returns focus to the row." (https://vercel.com/geist/context-menu) "Don’t bury destructive items behind nested submenus. One level deep keeps keyboard navigation predictable." (https://vercel.com/geist/context-menu) Ours: the trigger must itself be focusable or hold something that is. The content requires an `aria-label` naming the menu, because nothing visible labels a menu opened at the pointer.',
|
|
1853
1853
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadicodeai/ui",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.259",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#jsx": "./src/jsx/index.ts",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@headless-tree/react": "1.8.0",
|
|
83
83
|
"@iconify-icons/logos": "^2.0.3",
|
|
84
84
|
"@iconify/react": "^6.0.2",
|
|
85
|
-
"@nadicodeai/design-system": "12.1.
|
|
85
|
+
"@nadicodeai/design-system": "12.1.259",
|
|
86
86
|
"@tanstack/react-table": "^9.3.1",
|
|
87
87
|
"@vgpu/wgsl": "0.6.0",
|
|
88
88
|
"class-variance-authority": "^0.7.1",
|