@k2b/ui 0.64.0 → 0.65.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/base.css +3 -6
- package/dist/browser/actions/ContextMenu.js +1 -3
- package/dist/browser/actions/ContextMenu.js.map +1 -1
- package/dist/browser/actions/Dropdown.js +15 -69
- package/dist/browser/actions/Dropdown.js.map +1 -1
- package/dist/browser/actions/SortableList.js +1 -1
- package/dist/browser/actions/SortableList.js.map +1 -1
- package/dist/browser/actions/ViewTabs.js +5 -9
- package/dist/browser/actions/ViewTabs.js.map +1 -1
- package/dist/browser/actions/drag-and-drop.js +1 -1
- package/dist/browser/actions/drag-and-drop.js.map +1 -1
- package/dist/browser/actions/index.js.map +1 -1
- package/dist/browser/actions/menu-sheet.js +18 -80
- package/dist/browser/actions/menu-sheet.js.map +1 -1
- package/dist/browser/content/DataTable.js +197 -285
- package/dist/browser/content/DataTable.js.map +1 -1
- package/dist/browser/content/MessageRow.js +139 -115
- package/dist/browser/content/MessageRow.js.map +1 -1
- package/dist/browser/content/ProgressPath.js +25 -30
- package/dist/browser/content/ProgressPath.js.map +1 -1
- package/dist/browser/content/index.js +0 -2
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/feedback/dialog-core.js +0 -11
- package/dist/browser/feedback/dialog-core.js.map +1 -1
- package/dist/browser/internal/field.js +2 -2
- package/dist/browser/internal/field.js.map +1 -1
- package/dist/browser/intl/messages.js +1 -1
- package/dist/browser/intl/messages.js.map +1 -1
- package/dist/browser/layout/AppWorkspace.js +8 -16
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/Breadcrumbs.js +42 -188
- package/dist/browser/layout/Breadcrumbs.js.map +1 -1
- package/dist/browser/layout/DetailPanel.js +205 -209
- package/dist/browser/layout/DetailPanel.js.map +1 -1
- package/dist/browser/layout/PanelDialog.js +88 -176
- package/dist/browser/layout/PanelDialog.js.map +1 -1
- package/dist/browser/layout/app-workspace-controller.js +5 -12
- package/dist/browser/layout/app-workspace-controller.js.map +1 -1
- package/dist/browser/layout/app-workspace-state.js +2 -2
- package/dist/browser/layout/app-workspace-state.js.map +1 -1
- package/dist/browser/layout/index.js +0 -2
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/layout/workspace-messages.js +2 -12
- package/dist/browser/layout/workspace-messages.js.map +1 -1
- package/dist/browser/surfaces/NoticeCard.js +57 -69
- package/dist/browser/surfaces/NoticeCard.js.map +1 -1
- package/dist/browser/surfaces/Placeholder.js +5 -17
- package/dist/browser/surfaces/Placeholder.js.map +1 -1
- package/dist/browser/surfaces/Section.js +7 -22
- package/dist/browser/surfaces/Section.js.map +1 -1
- package/dist/browser/surfaces/StatusBadge.js +1 -5
- package/dist/browser/surfaces/StatusBadge.js.map +1 -1
- package/dist/browser/surfaces/index.js +0 -4
- package/dist/browser/surfaces/index.js.map +1 -1
- package/dist/ssr/actions/ContextMenu.js +1 -3
- package/dist/ssr/actions/ContextMenu.js.map +1 -1
- package/dist/ssr/actions/Dropdown.js +15 -69
- package/dist/ssr/actions/Dropdown.js.map +1 -1
- package/dist/ssr/actions/SortableList.js +1 -1
- package/dist/ssr/actions/SortableList.js.map +1 -1
- package/dist/ssr/actions/ViewTabs.js +5 -9
- package/dist/ssr/actions/ViewTabs.js.map +1 -1
- package/dist/ssr/actions/drag-and-drop.js +1 -1
- package/dist/ssr/actions/drag-and-drop.js.map +1 -1
- package/dist/ssr/actions/index.js.map +1 -1
- package/dist/ssr/actions/menu-sheet.js +10 -62
- package/dist/ssr/actions/menu-sheet.js.map +1 -1
- package/dist/ssr/content/DataTable.js +54 -64
- package/dist/ssr/content/DataTable.js.map +1 -1
- package/dist/ssr/content/MessageRow.js +30 -10
- package/dist/ssr/content/MessageRow.js.map +1 -1
- package/dist/ssr/content/ProgressPath.js +8 -14
- package/dist/ssr/content/ProgressPath.js.map +1 -1
- package/dist/ssr/content/index.js +0 -2
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/feedback/dialog-core.js +0 -11
- package/dist/ssr/feedback/dialog-core.js.map +1 -1
- package/dist/ssr/internal/field.js +2 -2
- package/dist/ssr/internal/field.js.map +1 -1
- package/dist/ssr/intl/messages.js +1 -1
- package/dist/ssr/intl/messages.js.map +1 -1
- package/dist/ssr/layout/AppWorkspace.js +8 -16
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/Breadcrumbs.js +26 -140
- package/dist/ssr/layout/Breadcrumbs.js.map +1 -1
- package/dist/ssr/layout/DetailPanel.js +68 -70
- package/dist/ssr/layout/DetailPanel.js.map +1 -1
- package/dist/ssr/layout/PanelDialog.js +8 -82
- package/dist/ssr/layout/PanelDialog.js.map +1 -1
- package/dist/ssr/layout/app-workspace-controller.js +5 -12
- package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
- package/dist/ssr/layout/app-workspace-state.js +2 -2
- package/dist/ssr/layout/app-workspace-state.js.map +1 -1
- package/dist/ssr/layout/index.js +0 -2
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/layout/workspace-messages.js +2 -12
- package/dist/ssr/layout/workspace-messages.js.map +1 -1
- package/dist/ssr/surfaces/NoticeCard.js +5 -7
- package/dist/ssr/surfaces/NoticeCard.js.map +1 -1
- package/dist/ssr/surfaces/Placeholder.js +4 -15
- package/dist/ssr/surfaces/Placeholder.js.map +1 -1
- package/dist/ssr/surfaces/Section.js +4 -7
- package/dist/ssr/surfaces/Section.js.map +1 -1
- package/dist/ssr/surfaces/StatusBadge.js +1 -5
- package/dist/ssr/surfaces/StatusBadge.js.map +1 -1
- package/dist/ssr/surfaces/index.js +0 -4
- package/dist/ssr/surfaces/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/Dropdown.d.ts +1 -35
- package/dist/types/actions/ViewTabs.d.ts +2 -3
- package/dist/types/actions/index.d.ts +1 -1
- package/dist/types/actions/menu-sheet.d.ts +1 -3
- package/dist/types/content/DataTable.d.ts +0 -19
- package/dist/types/content/MessageRow.d.ts +11 -0
- package/dist/types/content/ProgressPath.d.ts +6 -12
- package/dist/types/content/index.d.ts +0 -2
- package/dist/types/feedback/dialog-core.d.ts +0 -5
- package/dist/types/layout/AppWorkspace.d.ts +2 -10
- package/dist/types/layout/Breadcrumbs.d.ts +5 -10
- package/dist/types/layout/PanelDialog.d.ts +0 -19
- package/dist/types/layout/app-workspace-state.d.ts +2 -2
- package/dist/types/layout/index.d.ts +1 -5
- package/dist/types/layout/workspace-messages.d.ts +0 -5
- package/dist/types/surfaces/NoticeCard.d.ts +4 -6
- package/dist/types/surfaces/Placeholder.d.ts +0 -7
- package/dist/types/surfaces/Section.d.ts +2 -8
- package/dist/types/surfaces/StatusBadge.d.ts +1 -2
- package/dist/types/surfaces/index.d.ts +1 -9
- package/package.json +2 -7
- package/dist/browser/actions/menu-sheet-messages.js +0 -26
- package/dist/browser/actions/menu-sheet-messages.js.map +0 -1
- package/dist/browser/actions/menu-submenu-panel.js +0 -392
- package/dist/browser/actions/menu-submenu-panel.js.map +0 -1
- package/dist/browser/content/FileName.js +0 -68
- package/dist/browser/content/FileName.js.map +0 -1
- package/dist/browser/content/TaskRow.js +0 -129
- package/dist/browser/content/TaskRow.js.map +0 -1
- package/dist/browser/content/progress-path-messages.js +0 -22
- package/dist/browser/content/progress-path-messages.js.map +0 -1
- package/dist/browser/feedback/dialog-foot.js +0 -45
- package/dist/browser/feedback/dialog-foot.js.map +0 -1
- package/dist/browser/internal/renders-something.js +0 -3
- package/dist/browser/internal/renders-something.js.map +0 -1
- package/dist/browser/layout/FloatingPill.js +0 -33
- package/dist/browser/layout/FloatingPill.js.map +0 -1
- package/dist/browser/layout/StatusRow.js +0 -174
- package/dist/browser/layout/StatusRow.js.map +0 -1
- package/dist/browser/layout/panel-dialog-error.js +0 -44
- package/dist/browser/layout/panel-dialog-error.js.map +0 -1
- package/dist/browser/layout/panel-sheet-handle.js +0 -86
- package/dist/browser/layout/panel-sheet-handle.js.map +0 -1
- package/dist/browser/layout-check.js +0 -232
- package/dist/browser/layout-check.js.map +0 -1
- package/dist/browser/surfaces/Area.js +0 -205
- package/dist/browser/surfaces/Area.js.map +0 -1
- package/dist/browser/surfaces/FactGroup.js +0 -148
- package/dist/browser/surfaces/FactGroup.js.map +0 -1
- package/dist/browser/surfaces/FieldGrid.js +0 -34
- package/dist/browser/surfaces/FieldGrid.js.map +0 -1
- package/dist/browser/surfaces/RowGroup.js +0 -82
- package/dist/browser/surfaces/RowGroup.js.map +0 -1
- package/dist/browser/surfaces/flat-block-messages.js +0 -37
- package/dist/browser/surfaces/flat-block-messages.js.map +0 -1
- package/dist/ssr/actions/menu-sheet-messages.js +0 -26
- package/dist/ssr/actions/menu-sheet-messages.js.map +0 -1
- package/dist/ssr/actions/menu-submenu-panel.js +0 -295
- package/dist/ssr/actions/menu-submenu-panel.js.map +0 -1
- package/dist/ssr/content/FileName.js +0 -46
- package/dist/ssr/content/FileName.js.map +0 -1
- package/dist/ssr/content/TaskRow.js +0 -95
- package/dist/ssr/content/TaskRow.js.map +0 -1
- package/dist/ssr/content/progress-path-messages.js +0 -22
- package/dist/ssr/content/progress-path-messages.js.map +0 -1
- package/dist/ssr/feedback/dialog-foot.js +0 -45
- package/dist/ssr/feedback/dialog-foot.js.map +0 -1
- package/dist/ssr/internal/renders-something.js +0 -3
- package/dist/ssr/internal/renders-something.js.map +0 -1
- package/dist/ssr/layout/FloatingPill.js +0 -16
- package/dist/ssr/layout/FloatingPill.js.map +0 -1
- package/dist/ssr/layout/StatusRow.js +0 -93
- package/dist/ssr/layout/StatusRow.js.map +0 -1
- package/dist/ssr/layout/panel-dialog-error.js +0 -28
- package/dist/ssr/layout/panel-dialog-error.js.map +0 -1
- package/dist/ssr/layout/panel-sheet-handle.js +0 -66
- package/dist/ssr/layout/panel-sheet-handle.js.map +0 -1
- package/dist/ssr/layout-check.js +0 -232
- package/dist/ssr/layout-check.js.map +0 -1
- package/dist/ssr/surfaces/Area.js +0 -147
- package/dist/ssr/surfaces/Area.js.map +0 -1
- package/dist/ssr/surfaces/FactGroup.js +0 -106
- package/dist/ssr/surfaces/FactGroup.js.map +0 -1
- package/dist/ssr/surfaces/FieldGrid.js +0 -22
- package/dist/ssr/surfaces/FieldGrid.js.map +0 -1
- package/dist/ssr/surfaces/RowGroup.js +0 -60
- package/dist/ssr/surfaces/RowGroup.js.map +0 -1
- package/dist/ssr/surfaces/flat-block-messages.js +0 -37
- package/dist/ssr/surfaces/flat-block-messages.js.map +0 -1
- package/dist/types/actions/menu-sheet-messages.d.ts +0 -11
- package/dist/types/actions/menu-submenu-panel.d.ts +0 -27
- package/dist/types/content/FileName.d.ts +0 -23
- package/dist/types/content/TaskRow.d.ts +0 -33
- package/dist/types/content/progress-path-messages.d.ts +0 -8
- package/dist/types/feedback/dialog-foot.d.ts +0 -9
- package/dist/types/internal/renders-something.d.ts +0 -2
- package/dist/types/layout/FloatingPill.d.ts +0 -20
- package/dist/types/layout/StatusRow.d.ts +0 -54
- package/dist/types/layout/panel-dialog-error.d.ts +0 -9
- package/dist/types/layout/panel-sheet-handle.d.ts +0 -8
- package/dist/types/layout-check.d.ts +0 -52
- package/dist/types/surfaces/Area.d.ts +0 -38
- package/dist/types/surfaces/FactGroup.d.ts +0 -33
- package/dist/types/surfaces/FieldGrid.d.ts +0 -14
- package/dist/types/surfaces/RowGroup.d.ts +0 -20
- package/dist/types/surfaces/flat-block-messages.d.ts +0 -16
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { delegateEvents as _$delegateEvents } from "solid-js/web";
|
|
3
|
-
import { setProperty as _$setProperty } from "solid-js/web";
|
|
4
|
-
import { className as _$className } from "solid-js/web";
|
|
5
|
-
import { memo as _$memo } from "solid-js/web";
|
|
6
|
-
import { getNextMarker as _$getNextMarker } from "solid-js/web";
|
|
7
|
-
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
8
|
-
import { effect as _$effect } from "solid-js/web";
|
|
9
|
-
import { getNextElement as _$getNextElement } from "solid-js/web";
|
|
10
|
-
import { runHydrationEvents as _$runHydrationEvents } from "solid-js/web";
|
|
11
|
-
import { insert as _$insert } from "solid-js/web";
|
|
12
|
-
import { createComponent as _$createComponent } from "solid-js/web";
|
|
13
|
-
import { addEventListener as _$addEventListener } from "solid-js/web";
|
|
14
|
-
import { use as _$use } from "solid-js/web";
|
|
15
|
-
var _tmpl$ = /*#__PURE__*/_$template(`<div popover=manual role=menu class="k2b-dropdown__menu k2b-dropdown__submenu">`),
|
|
16
|
-
_tmpl$2 = /*#__PURE__*/_$template(`<div role=none class=k2b-dropdown__subgroup><button type=button tabindex=-1 aria-haspopup=menu><!$><!/><i class="ti ti-chevron-right k2b-dropdown__more"aria-hidden=true></i></button><!$><!/>`);
|
|
17
|
-
import { createEffect, createRoot, createSignal, createUniqueId, on, onCleanup, onMount, Show } from "solid-js";
|
|
18
|
-
import { inheritUiScope } from "../internal/portal-scope";
|
|
19
|
-
import { focusMenuRow, focusRowSegment } from "./menu-rows";
|
|
20
|
-
|
|
21
|
-
/** How long the pointer rests on a row before its submenu opens, or another row's closes it (K16). */
|
|
22
|
-
const DELAY = 150;
|
|
23
|
-
/** How long a move towards an open submenu keeps it open while the pointer crosses other rows. */
|
|
24
|
-
const CORRIDOR_DELAY = 300;
|
|
25
|
-
/** A menu, its submenu, and one more: deeper entries are not offered (K16). */
|
|
26
|
-
const MAX_DEPTH = 3;
|
|
27
|
-
|
|
28
|
-
/** The least room a menu keeps from the viewport's edge, as every menu does. */
|
|
29
|
-
const EDGE = 8;
|
|
30
|
-
const GAP = 4;
|
|
31
|
-
/**
|
|
32
|
-
* Where a submenu stands: beside its row, its first row level with it, on the side that has room; without room on
|
|
33
|
-
* either side it keeps to the viewport. Too low, it rises until its last row is level with its row's bottom.
|
|
34
|
-
*/
|
|
35
|
-
export const placeSubmenu = (row, parent, menu, viewport, rtl = false) => {
|
|
36
|
-
// Two objects side by side, 4 px apart as a menu stands from its trigger: their edges never meet (one line, one owner).
|
|
37
|
-
const right = parent.right + GAP;
|
|
38
|
-
const left = parent.left - menu.width - GAP;
|
|
39
|
-
const fitsRight = right + menu.width <= viewport.width - EDGE;
|
|
40
|
-
const fitsLeft = left >= EDGE;
|
|
41
|
-
const side = rtl ? fitsLeft || !fitsRight ? "left" : "right" : fitsRight || !fitsLeft ? "right" : "left";
|
|
42
|
-
const x = side === "right" ? right : left;
|
|
43
|
-
// The menu's 1 px edge stands above the row, so its first row lines up with the row that opened it.
|
|
44
|
-
let top = row.top - 1;
|
|
45
|
-
if (top + menu.height > viewport.height - EDGE) top = row.bottom + 1 - menu.height;
|
|
46
|
-
return {
|
|
47
|
-
left: Math.max(EDGE, Math.min(x, viewport.width - menu.width - EDGE)),
|
|
48
|
-
top: Math.max(EDGE, Math.min(top, viewport.height - menu.height - EDGE)),
|
|
49
|
-
side
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
const sign = (p, a, b) => (p.x - b.x) * (a.y - b.y) - (a.x - b.x) * (p.y - b.y);
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Whether `to` lies in the corridor from `from` to the submenu: the triangle between the earlier pointer position and
|
|
56
|
-
* the submenu's near edge. A pointer moving through it is on its way to the submenu.
|
|
57
|
-
*/
|
|
58
|
-
const inCorridor = (from, to, menu) => {
|
|
59
|
-
const edge = from.x <= menu.left ? menu.left : from.x >= menu.right ? menu.right : undefined;
|
|
60
|
-
if (edge === undefined) return false;
|
|
61
|
-
const top = {
|
|
62
|
-
x: edge,
|
|
63
|
-
y: menu.top - EDGE
|
|
64
|
-
};
|
|
65
|
-
const bottom = {
|
|
66
|
-
x: edge,
|
|
67
|
-
y: menu.bottom + EDGE
|
|
68
|
-
};
|
|
69
|
-
const d1 = sign(to, from, top);
|
|
70
|
-
const d2 = sign(to, top, bottom);
|
|
71
|
-
const d3 = sign(to, bottom, from);
|
|
72
|
-
const negative = d1 < 0 || d2 < 0 || d3 < 0;
|
|
73
|
-
const positive = d1 > 0 || d2 > 0 || d3 > 0;
|
|
74
|
-
return !(negative && positive);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
/** The actions and choices of a menu and its submenus, without sections or submenu rows. */
|
|
78
|
-
const flatEntries = items => items.flatMap(item => "items" in item ? flatEntries(item.items) : "submenu" in item ? flatEntries(item.submenu) : [item]);
|
|
79
|
-
|
|
80
|
-
/** The entries of the submenu `panel` that take focus, without those of a submenu open inside it. */
|
|
81
|
-
const ownEntries = panel => Array.from(panel.querySelectorAll(":is([role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio']):not([aria-disabled='true'])")).filter(entry => entry.closest(".k2b-dropdown__submenu") === panel);
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* One level of a menu: which of its rows has its submenu open. The pointer and the focus on the level's rows decide:
|
|
85
|
-
* after the pointer rests on a row, that row's submenu opens or the open one closes; a move towards the open submenu
|
|
86
|
-
* closes nothing; focus on another row closes it at once.
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
const levels = new WeakMap();
|
|
90
|
-
|
|
91
|
-
/** The level of the rows under `menu`, created with its first submenu row; it listens on the element around them. */
|
|
92
|
-
const levelOf = (menu, row) => {
|
|
93
|
-
const known = levels.get(menu);
|
|
94
|
-
if (known) return known;
|
|
95
|
-
const [open, setOpen] = createRoot(() => createSignal());
|
|
96
|
-
let timer;
|
|
97
|
-
let last;
|
|
98
|
-
let before;
|
|
99
|
-
let hovered;
|
|
100
|
-
const clear = () => {
|
|
101
|
-
clearTimeout(timer);
|
|
102
|
-
timer = undefined;
|
|
103
|
-
};
|
|
104
|
-
// In the submenu, nothing pending changes it; back on any row of this level, that row counts again.
|
|
105
|
-
const hold = () => {
|
|
106
|
-
clear();
|
|
107
|
-
hovered = undefined;
|
|
108
|
-
};
|
|
109
|
-
const set = next => {
|
|
110
|
-
clear();
|
|
111
|
-
hovered = undefined;
|
|
112
|
-
setOpen(() => next);
|
|
113
|
-
};
|
|
114
|
-
const level = {
|
|
115
|
-
open,
|
|
116
|
-
set,
|
|
117
|
-
hold
|
|
118
|
-
};
|
|
119
|
-
levels.set(menu, level);
|
|
120
|
-
// The rows of this level, not those of a submenu inside it.
|
|
121
|
-
const host = row.parentElement?.closest(".k2b-dropdown__submenu, [role='menu'], [role='dialog'], [role='listbox']");
|
|
122
|
-
const own = host?.classList.contains("k2b-dropdown__submenu") ? host : null;
|
|
123
|
-
const rowOf = target => {
|
|
124
|
-
const entry = target instanceof Element ? target.closest("[role^='menuitem']") : null;
|
|
125
|
-
return entry && entry.closest(".k2b-dropdown__submenu") === own ? entry : undefined;
|
|
126
|
-
};
|
|
127
|
-
host?.addEventListener("pointermove", event => {
|
|
128
|
-
// The browser repeats a move when the layout changes under a resting pointer; only a real move counts, so a
|
|
129
|
-
// submenu closed with the keyboard does not open again under it.
|
|
130
|
-
if (last && last.x === event.clientX && last.y === event.clientY) return;
|
|
131
|
-
before = last;
|
|
132
|
-
last = {
|
|
133
|
-
x: event.clientX,
|
|
134
|
-
y: event.clientY
|
|
135
|
-
};
|
|
136
|
-
const entry = rowOf(event.target);
|
|
137
|
-
if (event.pointerType === "touch" || !entry || entry === hovered) return;
|
|
138
|
-
hovered = entry;
|
|
139
|
-
clear();
|
|
140
|
-
const current = open();
|
|
141
|
-
if (current === entry) return;
|
|
142
|
-
const panel = current ? document.getElementById(`${current.id}-menu`) : null;
|
|
143
|
-
const towards = Boolean(panel && before && inCorridor(before, last, panel.getBoundingClientRect()));
|
|
144
|
-
timer = setTimeout(() => setOpen(() => entry), towards ? CORRIDOR_DELAY : DELAY);
|
|
145
|
-
});
|
|
146
|
-
// Leaving the menu, or the menu closing, ends anything pending; a closed menu keeps no submenu open.
|
|
147
|
-
host?.addEventListener("pointerleave", () => {
|
|
148
|
-
clear();
|
|
149
|
-
hovered = undefined;
|
|
150
|
-
});
|
|
151
|
-
host?.addEventListener("toggle", event => {
|
|
152
|
-
if (event.newState === "closed") set(undefined);
|
|
153
|
-
});
|
|
154
|
-
host?.addEventListener("focusin", event => {
|
|
155
|
-
const entry = rowOf(event.target);
|
|
156
|
-
if (entry && open() && entry !== open()) set(undefined);
|
|
157
|
-
});
|
|
158
|
-
return level;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* An open submenu beside its row. It shows in the top layer, owns its keys, and closes with the menu around it, a
|
|
163
|
-
* change of the window's size, or a scroll outside it.
|
|
164
|
-
*/
|
|
165
|
-
function SubmenuPanel(props) {
|
|
166
|
-
let panel;
|
|
167
|
-
// Read once: `level` comes from the <Show> around the panel, whose value is gone by the time the panel cleans up.
|
|
168
|
-
const level = props.level;
|
|
169
|
-
const row = props.row;
|
|
170
|
-
const rtl = () => getComputedStyle(row).direction === "rtl";
|
|
171
|
-
const place = () => {
|
|
172
|
-
if (!panel.isConnected) return;
|
|
173
|
-
const host = row.closest("[role='menu'], [role='dialog'], [role='listbox']") ?? row;
|
|
174
|
-
const at = placeSubmenu(row.getBoundingClientRect(), host.getBoundingClientRect(), panel.getBoundingClientRect(), {
|
|
175
|
-
width: window.innerWidth,
|
|
176
|
-
height: window.innerHeight
|
|
177
|
-
}, rtl());
|
|
178
|
-
panel.style.left = `${at.left}px`;
|
|
179
|
-
panel.style.top = `${at.top}px`;
|
|
180
|
-
panel.dataset.side = at.side;
|
|
181
|
-
};
|
|
182
|
-
const onKey = event => {
|
|
183
|
-
const items = ownEntries(panel);
|
|
184
|
-
if (focusMenuRow(items, event.key) || focusRowSegment(items, event.key)) {
|
|
185
|
-
event.preventDefault();
|
|
186
|
-
event.stopPropagation();
|
|
187
|
-
} else if (event.key === "Escape" || event.key === (rtl() ? "ArrowRight" : "ArrowLeft")) {
|
|
188
|
-
// Only this level closes; the menu around it stays, as the browser's own Escape would close it.
|
|
189
|
-
event.preventDefault();
|
|
190
|
-
event.stopPropagation();
|
|
191
|
-
props.hide();
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
// The menu around it closing, the window changing size, or a scroll outside it closes it too: it would come loose
|
|
195
|
-
// from its row.
|
|
196
|
-
const host = row.parentElement?.closest("[popover]");
|
|
197
|
-
const closed = event => {
|
|
198
|
-
if (event.type === "scroll" && event.target instanceof Node && panel.contains(event.target)) return;
|
|
199
|
-
if (event.type !== "toggle" || event.newState === "closed") level.set(undefined);
|
|
200
|
-
};
|
|
201
|
-
host?.addEventListener("toggle", closed);
|
|
202
|
-
window.addEventListener("resize", closed);
|
|
203
|
-
window.addEventListener("scroll", closed, true);
|
|
204
|
-
onCleanup(() => {
|
|
205
|
-
host?.removeEventListener("toggle", closed);
|
|
206
|
-
window.removeEventListener("resize", closed);
|
|
207
|
-
window.removeEventListener("scroll", closed, true);
|
|
208
|
-
// Closed by the pointer resting elsewhere or by a resize, with the keyboard inside: the focus goes back to its row
|
|
209
|
-
// rather than to the page.
|
|
210
|
-
// Another row's submenu opening takes the focus to that row instead, so the move does not close it again.
|
|
211
|
-
if (panel.contains(document.activeElement)) (level.open() ?? row).focus();
|
|
212
|
-
});
|
|
213
|
-
return (() => {
|
|
214
|
-
var _el$ = _$getNextElement(_tmpl$);
|
|
215
|
-
_el$.$$pointerdown = event => event.stopPropagation();
|
|
216
|
-
_el$.addEventListener("pointerenter", () => level.hold());
|
|
217
|
-
_$addEventListener(_el$, "keydown", onKey);
|
|
218
|
-
_$use(element => {
|
|
219
|
-
panel = element;
|
|
220
|
-
inheritUiScope(element, row);
|
|
221
|
-
queueMicrotask(() => {
|
|
222
|
-
if (!element.isConnected) return;
|
|
223
|
-
if (typeof element.showPopover === "function") element.showPopover();
|
|
224
|
-
place();
|
|
225
|
-
if (props.focusFirst) focusMenuRow(ownEntries(element), "Home");
|
|
226
|
-
});
|
|
227
|
-
}, _el$);
|
|
228
|
-
_$insert(_el$, _$createComponent(props.Items, {
|
|
229
|
-
get items() {
|
|
230
|
-
return props.items;
|
|
231
|
-
},
|
|
232
|
-
get close() {
|
|
233
|
-
return props.close;
|
|
234
|
-
},
|
|
235
|
-
get depth() {
|
|
236
|
-
return props.depth;
|
|
237
|
-
}
|
|
238
|
-
}));
|
|
239
|
-
_$effect(_p$ => {
|
|
240
|
-
var _v$ = `${props.id}-menu`,
|
|
241
|
-
_v$2 = props.label,
|
|
242
|
-
_v$3 = props.depth;
|
|
243
|
-
_v$ !== _p$.e && _$setAttribute(_el$, "id", _p$.e = _v$);
|
|
244
|
-
_v$2 !== _p$.t && _$setAttribute(_el$, "aria-label", _p$.t = _v$2);
|
|
245
|
-
_v$3 !== _p$.a && _$setAttribute(_el$, "data-depth", _p$.a = _v$3);
|
|
246
|
-
return _p$;
|
|
247
|
-
}, {
|
|
248
|
-
e: undefined,
|
|
249
|
-
t: undefined,
|
|
250
|
-
a: undefined
|
|
251
|
-
});
|
|
252
|
-
_$runHydrationEvents();
|
|
253
|
-
return _el$;
|
|
254
|
-
})();
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/** A row with "▸" that opens its submenu beside it, or in a phone sheet in the sheet's place (K16). */
|
|
258
|
-
export function SubmenuRow(props) {
|
|
259
|
-
const menu = props.menu;
|
|
260
|
-
// A list box cannot open a menu: there the entries stand under the row's name, as a section's do.
|
|
261
|
-
if (menu.role === "option") return _$createComponent(props.Items, {
|
|
262
|
-
get items() {
|
|
263
|
-
return [{
|
|
264
|
-
sectionLabel: props.item.label,
|
|
265
|
-
items: flatEntries(props.item.submenu)
|
|
266
|
-
}];
|
|
267
|
-
},
|
|
268
|
-
get close() {
|
|
269
|
-
return menu.close;
|
|
270
|
-
},
|
|
271
|
-
role: "option"
|
|
272
|
-
});
|
|
273
|
-
const id = `k2b-submenu-${createUniqueId().replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
274
|
-
// A fourth level is not offered (K16): its row stays, but cannot open.
|
|
275
|
-
const disabled = () => Boolean(props.item.disabled) || menu.depth >= MAX_DEPTH;
|
|
276
|
-
const [level, setLevel] = createSignal();
|
|
277
|
-
let focusFirst = false;
|
|
278
|
-
const open = () => level()?.open() === row;
|
|
279
|
-
let row;
|
|
280
|
-
onMount(() => {
|
|
281
|
-
if (!menu.drill) setLevel(levelOf(menu, row));
|
|
282
|
-
});
|
|
283
|
-
const show = moveFocus => {
|
|
284
|
-
if (disabled()) return;
|
|
285
|
-
if (menu.drill) return menu.drill(props.item, row);
|
|
286
|
-
focusFirst = moveFocus;
|
|
287
|
-
// Already open: the keyboard goes into it now.
|
|
288
|
-
const panel = document.getElementById(`${id}-menu`);
|
|
289
|
-
if (panel && moveFocus) focusMenuRow(ownEntries(panel), "Home");
|
|
290
|
-
level()?.set(row);
|
|
291
|
-
};
|
|
292
|
-
const onRowKey = event => {
|
|
293
|
-
if (event.key !== (getComputedStyle(row).direction === "rtl" ? "ArrowLeft" : "ArrowRight")) return;
|
|
294
|
-
event.preventDefault();
|
|
295
|
-
event.stopPropagation();
|
|
296
|
-
show(true);
|
|
297
|
-
};
|
|
298
|
-
// The row and its submenu stand together in an element without a role, as a menu holds only its entries.
|
|
299
|
-
return (() => {
|
|
300
|
-
var _el$2 = _$getNextElement(_tmpl$2),
|
|
301
|
-
_el$3 = _el$2.firstChild,
|
|
302
|
-
_el$5 = _el$3.firstChild,
|
|
303
|
-
[_el$6, _co$] = _$getNextMarker(_el$5.nextSibling),
|
|
304
|
-
_el$4 = _el$6.nextSibling,
|
|
305
|
-
_el$7 = _el$3.nextSibling,
|
|
306
|
-
[_el$8, _co$2] = _$getNextMarker(_el$7.nextSibling);
|
|
307
|
-
_el$3.$$click = event => {
|
|
308
|
-
event.preventDefault();
|
|
309
|
-
event.stopPropagation();
|
|
310
|
-
// Enter and Space click with no pointer: the keyboard goes into the submenu, a pointer stays where it is.
|
|
311
|
-
show(event.detail === 0);
|
|
312
|
-
};
|
|
313
|
-
_$addEventListener(_el$3, "keydown", onRowKey);
|
|
314
|
-
var _ref$ = row;
|
|
315
|
-
typeof _ref$ === "function" ? _$use(_ref$, _el$3) : row = _el$3;
|
|
316
|
-
_$setAttribute(_el$3, "id", id);
|
|
317
|
-
_$insert(_el$3, () => props.content({
|
|
318
|
-
...props.item,
|
|
319
|
-
children: props.item.label
|
|
320
|
-
}), _el$6, _co$);
|
|
321
|
-
_$insert(_el$2, _$createComponent(Show, {
|
|
322
|
-
get when() {
|
|
323
|
-
return _$memo(() => !!open())() && level();
|
|
324
|
-
},
|
|
325
|
-
children: current => _$createComponent(SubmenuPanel, {
|
|
326
|
-
id: id,
|
|
327
|
-
row: row,
|
|
328
|
-
get label() {
|
|
329
|
-
return props.item.label;
|
|
330
|
-
},
|
|
331
|
-
get items() {
|
|
332
|
-
return props.item.submenu;
|
|
333
|
-
},
|
|
334
|
-
get depth() {
|
|
335
|
-
return menu.depth + 1;
|
|
336
|
-
},
|
|
337
|
-
get close() {
|
|
338
|
-
return menu.close;
|
|
339
|
-
},
|
|
340
|
-
get level() {
|
|
341
|
-
return current();
|
|
342
|
-
},
|
|
343
|
-
focusFirst: focusFirst,
|
|
344
|
-
get Items() {
|
|
345
|
-
return props.Items;
|
|
346
|
-
},
|
|
347
|
-
hide: () => {
|
|
348
|
-
current().set(undefined);
|
|
349
|
-
row.focus();
|
|
350
|
-
}
|
|
351
|
-
})
|
|
352
|
-
}), _el$8, _co$2);
|
|
353
|
-
_$effect(_p$ => {
|
|
354
|
-
var _v$4 = menu.role,
|
|
355
|
-
_v$5 = `k2b-dropdown__item k2b-dropdown__item--submenu ${props.item.class ?? ""}`,
|
|
356
|
-
_v$6 = props.item.ariaLabel,
|
|
357
|
-
_v$7 = open(),
|
|
358
|
-
_v$8 = open() ? `${id}-menu` : undefined,
|
|
359
|
-
_v$9 = disabled() ? "true" : undefined,
|
|
360
|
-
_v$0 = disabled(),
|
|
361
|
-
_v$1 = open() ? "true" : undefined,
|
|
362
|
-
_v$10 = props.item.variant === "danger" ? "true" : undefined,
|
|
363
|
-
_v$11 = props.item.variant === "accent" ? "true" : undefined;
|
|
364
|
-
_v$4 !== _p$.e && _$setAttribute(_el$3, "role", _p$.e = _v$4);
|
|
365
|
-
_v$5 !== _p$.t && _$className(_el$3, _p$.t = _v$5);
|
|
366
|
-
_v$6 !== _p$.a && _$setAttribute(_el$3, "aria-label", _p$.a = _v$6);
|
|
367
|
-
_v$7 !== _p$.o && _$setAttribute(_el$3, "aria-expanded", _p$.o = _v$7);
|
|
368
|
-
_v$8 !== _p$.i && _$setAttribute(_el$3, "aria-controls", _p$.i = _v$8);
|
|
369
|
-
_v$9 !== _p$.n && _$setAttribute(_el$3, "aria-disabled", _p$.n = _v$9);
|
|
370
|
-
_v$0 !== _p$.s && _$setProperty(_el$3, "disabled", _p$.s = _v$0);
|
|
371
|
-
_v$1 !== _p$.h && _$setAttribute(_el$3, "data-open", _p$.h = _v$1);
|
|
372
|
-
_v$10 !== _p$.r && _$setAttribute(_el$3, "data-danger", _p$.r = _v$10);
|
|
373
|
-
_v$11 !== _p$.d && _$setAttribute(_el$3, "data-accent", _p$.d = _v$11);
|
|
374
|
-
return _p$;
|
|
375
|
-
}, {
|
|
376
|
-
e: undefined,
|
|
377
|
-
t: undefined,
|
|
378
|
-
a: undefined,
|
|
379
|
-
o: undefined,
|
|
380
|
-
i: undefined,
|
|
381
|
-
n: undefined,
|
|
382
|
-
s: undefined,
|
|
383
|
-
h: undefined,
|
|
384
|
-
r: undefined,
|
|
385
|
-
d: undefined
|
|
386
|
-
});
|
|
387
|
-
_$runHydrationEvents();
|
|
388
|
-
return _el$2;
|
|
389
|
-
})();
|
|
390
|
-
}
|
|
391
|
-
_$delegateEvents(["pointerdown", "click"]);
|
|
392
|
-
//# sourceMappingURL=menu-submenu-panel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["actions/menu-submenu-panel.tsx"],"sourcesContent":["import { type Accessor, createEffect, createRoot, createSignal, createUniqueId, type JSX, on, onCleanup, onMount, Show } from \"solid-js\";\nimport { inheritUiScope } from \"../internal/portal-scope\";\nimport type {\n DropdownAction,\n DropdownChoice,\n DropdownItem,\n DropdownItems,\n DropdownSubmenu,\n itemContent,\n MenuContextValue,\n} from \"./Dropdown\";\nimport { focusMenuRow, focusRowSegment } from \"./menu-rows\";\n\n/** How long the pointer rests on a row before its submenu opens, or another row's closes it (K16). */\nconst DELAY = 150;\n/** How long a move towards an open submenu keeps it open while the pointer crosses other rows. */\nconst CORRIDOR_DELAY = 300;\n/** A menu, its submenu, and one more: deeper entries are not offered (K16). */\nconst MAX_DEPTH = 3;\n\n/** The least room a menu keeps from the viewport's edge, as every menu does. */\nconst EDGE = 8;\nconst GAP = 4;\ntype Box = Pick<DOMRect, \"left\" | \"top\" | \"right\" | \"bottom\">;\n\n/**\n * Where a submenu stands: beside its row, its first row level with it, on the side that has room; without room on\n * either side it keeps to the viewport. Too low, it rises until its last row is level with its row's bottom.\n */\nexport const placeSubmenu = (\n row: Box,\n parent: Pick<DOMRect, \"left\" | \"right\">,\n menu: { width: number; height: number },\n viewport: { width: number; height: number },\n rtl = false,\n): { left: number; top: number; side: \"left\" | \"right\" } => {\n // Two objects side by side, 4 px apart as a menu stands from its trigger: their edges never meet (one line, one owner).\n const right = parent.right + GAP;\n const left = parent.left - menu.width - GAP;\n const fitsRight = right + menu.width <= viewport.width - EDGE;\n const fitsLeft = left >= EDGE;\n const side: \"left\" | \"right\" = rtl ? (fitsLeft || !fitsRight ? \"left\" : \"right\") : fitsRight || !fitsLeft ? \"right\" : \"left\";\n const x = side === \"right\" ? right : left;\n // The menu's 1 px edge stands above the row, so its first row lines up with the row that opened it.\n let top = row.top - 1;\n if (top + menu.height > viewport.height - EDGE) top = row.bottom + 1 - menu.height;\n return {\n left: Math.max(EDGE, Math.min(x, viewport.width - menu.width - EDGE)),\n top: Math.max(EDGE, Math.min(top, viewport.height - menu.height - EDGE)),\n side,\n };\n};\n\ntype Point = { x: number; y: number };\n\nconst sign = (p: Point, a: Point, b: Point) => (p.x - b.x) * (a.y - b.y) - (a.x - b.x) * (p.y - b.y);\n\n/**\n * Whether `to` lies in the corridor from `from` to the submenu: the triangle between the earlier pointer position and\n * the submenu's near edge. A pointer moving through it is on its way to the submenu.\n */\nconst inCorridor = (from: Point, to: Point, menu: Box): boolean => {\n const edge = from.x <= menu.left ? menu.left : from.x >= menu.right ? menu.right : undefined;\n if (edge === undefined) return false;\n const top = { x: edge, y: menu.top - EDGE };\n const bottom = { x: edge, y: menu.bottom + EDGE };\n const d1 = sign(to, from, top);\n const d2 = sign(to, top, bottom);\n const d3 = sign(to, bottom, from);\n const negative = d1 < 0 || d2 < 0 || d3 < 0;\n const positive = d1 > 0 || d2 > 0 || d3 > 0;\n return !(negative && positive);\n};\n\n/** The actions and choices of a menu and its submenus, without sections or submenu rows. */\nconst flatEntries = (items: readonly DropdownItem[]): (DropdownAction | DropdownChoice)[] =>\n items.flatMap((item) => (\"items\" in item ? flatEntries(item.items) : \"submenu\" in item ? flatEntries(item.submenu) : [item]));\n\n/** The entries of the submenu `panel` that take focus, without those of a submenu open inside it. */\nconst ownEntries = (panel: HTMLElement): HTMLElement[] =>\n Array.from(\n panel.querySelectorAll<HTMLElement>(\n \":is([role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio']):not([aria-disabled='true'])\",\n ),\n ).filter((entry) => entry.closest(\".k2b-dropdown__submenu\") === panel);\n\n/**\n * One level of a menu: which of its rows has its submenu open. The pointer and the focus on the level's rows decide:\n * after the pointer rests on a row, that row's submenu opens or the open one closes; a move towards the open submenu\n * closes nothing; focus on another row closes it at once.\n */\ntype MenuLevel = {\n open: Accessor<HTMLElement | undefined>;\n /** Opens a row's submenu, or closes the open one with `undefined`, at once. */\n set: (row: HTMLElement | undefined) => void;\n /** The pointer reached the open submenu: nothing pending changes it. */\n hold: () => void;\n};\n\nconst levels = new WeakMap<MenuContextValue, MenuLevel>();\n\n/** The level of the rows under `menu`, created with its first submenu row; it listens on the element around them. */\nconst levelOf = (menu: MenuContextValue, row: HTMLElement): MenuLevel => {\n const known = levels.get(menu);\n if (known) return known;\n const [open, setOpen] = createRoot(() => createSignal<HTMLElement>());\n let timer: ReturnType<typeof setTimeout> | undefined;\n let last: Point | undefined;\n let before: Point | undefined;\n let hovered: Element | undefined;\n const clear = () => {\n clearTimeout(timer);\n timer = undefined;\n };\n // In the submenu, nothing pending changes it; back on any row of this level, that row counts again.\n const hold = () => {\n clear();\n hovered = undefined;\n };\n const set = (next: HTMLElement | undefined) => {\n clear();\n hovered = undefined;\n setOpen(() => next);\n };\n const level: MenuLevel = { open, set, hold };\n levels.set(menu, level);\n // The rows of this level, not those of a submenu inside it.\n const host = row.parentElement?.closest<HTMLElement>(\".k2b-dropdown__submenu, [role='menu'], [role='dialog'], [role='listbox']\");\n const own = host?.classList.contains(\"k2b-dropdown__submenu\") ? host : null;\n const rowOf = (target: EventTarget | null) => {\n const entry = target instanceof Element ? target.closest(\"[role^='menuitem']\") : null;\n return entry && entry.closest(\".k2b-dropdown__submenu\") === own ? entry : undefined;\n };\n host?.addEventListener(\"pointermove\", (event) => {\n // The browser repeats a move when the layout changes under a resting pointer; only a real move counts, so a\n // submenu closed with the keyboard does not open again under it.\n if (last && last.x === event.clientX && last.y === event.clientY) return;\n before = last;\n last = { x: event.clientX, y: event.clientY };\n const entry = rowOf(event.target);\n if (event.pointerType === \"touch\" || !entry || entry === hovered) return;\n hovered = entry;\n clear();\n const current = open();\n if (current === entry) return;\n const panel = current ? document.getElementById(`${current.id}-menu`) : null;\n const towards = Boolean(panel && before && inCorridor(before, last, panel.getBoundingClientRect()));\n timer = setTimeout(() => setOpen(() => entry as HTMLElement), towards ? CORRIDOR_DELAY : DELAY);\n });\n // Leaving the menu, or the menu closing, ends anything pending; a closed menu keeps no submenu open.\n host?.addEventListener(\"pointerleave\", () => {\n clear();\n hovered = undefined;\n });\n host?.addEventListener(\"toggle\", (event) => {\n if ((event as ToggleEvent).newState === \"closed\") set(undefined);\n });\n host?.addEventListener(\"focusin\", (event) => {\n const entry = rowOf(event.target);\n if (entry && open() && entry !== open()) set(undefined);\n });\n return level;\n};\n\n/**\n * An open submenu beside its row. It shows in the top layer, owns its keys, and closes with the menu around it, a\n * change of the window's size, or a scroll outside it.\n */\nfunction SubmenuPanel(props: {\n id: string;\n row: HTMLButtonElement;\n label: string;\n items: readonly DropdownItem[];\n depth: number;\n close: (restoreFocus?: boolean) => void;\n level: MenuLevel;\n /** Whether the keyboard opened it, so its first entry takes the focus. */\n focusFirst: boolean;\n hide: () => void;\n Items: typeof DropdownItems;\n}): JSX.Element {\n let panel!: HTMLDivElement;\n // Read once: `level` comes from the <Show> around the panel, whose value is gone by the time the panel cleans up.\n const level = props.level;\n const row = props.row;\n const rtl = () => getComputedStyle(row).direction === \"rtl\";\n const place = () => {\n if (!panel.isConnected) return;\n const host = row.closest<HTMLElement>(\"[role='menu'], [role='dialog'], [role='listbox']\") ?? row;\n const at = placeSubmenu(\n row.getBoundingClientRect(),\n host.getBoundingClientRect(),\n panel.getBoundingClientRect(),\n { width: window.innerWidth, height: window.innerHeight },\n rtl(),\n );\n panel.style.left = `${at.left}px`;\n panel.style.top = `${at.top}px`;\n panel.dataset.side = at.side;\n };\n const onKey = (event: KeyboardEvent) => {\n const items = ownEntries(panel);\n if (focusMenuRow(items, event.key) || focusRowSegment(items, event.key)) {\n event.preventDefault();\n event.stopPropagation();\n } else if (event.key === \"Escape\" || event.key === (rtl() ? \"ArrowRight\" : \"ArrowLeft\")) {\n // Only this level closes; the menu around it stays, as the browser's own Escape would close it.\n event.preventDefault();\n event.stopPropagation();\n props.hide();\n }\n };\n // The menu around it closing, the window changing size, or a scroll outside it closes it too: it would come loose\n // from its row.\n const host = row.parentElement?.closest<HTMLElement>(\"[popover]\");\n const closed = (event: Event) => {\n if (event.type === \"scroll\" && event.target instanceof Node && panel.contains(event.target)) return;\n if (event.type !== \"toggle\" || (event as ToggleEvent).newState === \"closed\") level.set(undefined);\n };\n host?.addEventListener(\"toggle\", closed);\n window.addEventListener(\"resize\", closed);\n window.addEventListener(\"scroll\", closed, true);\n onCleanup(() => {\n host?.removeEventListener(\"toggle\", closed);\n window.removeEventListener(\"resize\", closed);\n window.removeEventListener(\"scroll\", closed, true);\n // Closed by the pointer resting elsewhere or by a resize, with the keyboard inside: the focus goes back to its row\n // rather than to the page.\n // Another row's submenu opening takes the focus to that row instead, so the move does not close it again.\n if (panel.contains(document.activeElement)) (level.open() ?? row).focus();\n });\n return (\n <div\n ref={(element) => {\n panel = element;\n inheritUiScope(element, row);\n queueMicrotask(() => {\n if (!element.isConnected) return;\n if (typeof element.showPopover === \"function\") element.showPopover();\n place();\n if (props.focusFirst) focusMenuRow(ownEntries(element), \"Home\");\n });\n }}\n id={`${props.id}-menu`}\n popover=\"manual\"\n role=\"menu\"\n aria-label={props.label}\n class=\"k2b-dropdown__menu k2b-dropdown__submenu\"\n data-depth={props.depth}\n on:keydown={onKey}\n onPointerEnter={() => level.hold()}\n onPointerDown={(event) => event.stopPropagation()}\n >\n <props.Items items={props.items} close={props.close} depth={props.depth} />\n </div>\n );\n}\n\n/** A row with \"▸\" that opens its submenu beside it, or in a phone sheet in the sheet's place (K16). */\nexport function SubmenuRow(props: {\n item: DropdownSubmenu;\n /** The level's menu: handed in, so this module needs nothing of the menu's code at run time. */\n menu: MenuContextValue;\n Items: typeof DropdownItems;\n content: typeof itemContent;\n}): JSX.Element {\n const menu = props.menu;\n // A list box cannot open a menu: there the entries stand under the row's name, as a section's do.\n if (menu.role === \"option\")\n return (\n <props.Items items={[{ sectionLabel: props.item.label, items: flatEntries(props.item.submenu) }]} close={menu.close} role=\"option\" />\n );\n const id = `k2b-submenu-${createUniqueId().replace(/[^a-zA-Z0-9_-]/g, \"-\")}`;\n // A fourth level is not offered (K16): its row stays, but cannot open.\n const disabled = () => Boolean(props.item.disabled) || menu.depth >= MAX_DEPTH;\n const [level, setLevel] = createSignal<MenuLevel>();\n let focusFirst = false;\n const open = () => level()?.open() === row;\n let row!: HTMLButtonElement;\n onMount(() => {\n if (!menu.drill) setLevel(levelOf(menu, row));\n });\n const show = (moveFocus: boolean) => {\n if (disabled()) return;\n if (menu.drill) return menu.drill(props.item, row);\n focusFirst = moveFocus;\n // Already open: the keyboard goes into it now.\n const panel = document.getElementById(`${id}-menu`);\n if (panel && moveFocus) focusMenuRow(ownEntries(panel), \"Home\");\n level()?.set(row);\n };\n const onRowKey = (event: KeyboardEvent) => {\n if (event.key !== (getComputedStyle(row).direction === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\")) return;\n event.preventDefault();\n event.stopPropagation();\n show(true);\n };\n // The row and its submenu stand together in an element without a role, as a menu holds only its entries.\n return (\n <div role=\"none\" class=\"k2b-dropdown__subgroup\">\n <button\n ref={row}\n id={id}\n type=\"button\"\n role={menu.role}\n tabIndex={-1}\n class={`k2b-dropdown__item k2b-dropdown__item--submenu ${props.item.class ?? \"\"}`}\n aria-label={props.item.ariaLabel}\n aria-haspopup=\"menu\"\n aria-expanded={open()}\n aria-controls={open() ? `${id}-menu` : undefined}\n aria-disabled={disabled() ? \"true\" : undefined}\n disabled={disabled()}\n data-open={open() ? \"true\" : undefined}\n data-danger={props.item.variant === \"danger\" ? \"true\" : undefined}\n data-accent={props.item.variant === \"accent\" ? \"true\" : undefined}\n on:keydown={onRowKey}\n onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n // Enter and Space click with no pointer: the keyboard goes into the submenu, a pointer stays where it is.\n show(event.detail === 0);\n }}\n >\n {props.content({ ...props.item, children: props.item.label })}\n <i class=\"ti ti-chevron-right k2b-dropdown__more\" aria-hidden=\"true\" />\n </button>\n <Show when={open() && level()}>\n {(current) => (\n <SubmenuPanel\n id={id}\n row={row}\n label={props.item.label}\n items={props.item.submenu}\n depth={menu.depth + 1}\n close={menu.close}\n level={current()}\n focusFirst={focusFirst}\n Items={props.Items}\n hide={() => {\n current().set(undefined);\n row.focus();\n }}\n />\n )}\n </Show>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAwB,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAY,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,QAAQ,UAAU;AACxI,SAAS,cAAc,QAAQ,0B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AA,OACT,IAAI,CAAC,CAAC,GAAG,MAAM,GAAG,SAAS;QAAA,QACzB,KAAK,CAAC,IAAI,CAAC,OAAO,KAAK,QAAQ,GAAG,MAAM,GAAG,SAAS;QAAA,QACpD,KAAK,CAAC,IAAI,CAAC,OAAO,KAAK,QAAQ,GAAG,MAAM,GAAG,SAAS;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;IAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;IAAA;IAAA;IAAA;EAAA;AAiCzE;AAAC","ignoreList":[]}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { getNextElement as _$getNextElement } from "solid-js/web";
|
|
3
|
-
import { runHydrationEvents as _$runHydrationEvents } from "solid-js/web";
|
|
4
|
-
import { getNextMarker as _$getNextMarker } from "solid-js/web";
|
|
5
|
-
import { insert as _$insert } from "solid-js/web";
|
|
6
|
-
import { spread as _$spread } from "solid-js/web";
|
|
7
|
-
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
8
|
-
import { memo as _$memo } from "solid-js/web";
|
|
9
|
-
var _tmpl$ = /*#__PURE__*/_$template(`<span><span class=k2b-sr-only></span><span class=k2b-file-name__stem aria-hidden=true></span><!$><!/>`),
|
|
10
|
-
_tmpl$2 = /*#__PURE__*/_$template(`<span class=k2b-file-name__ext aria-hidden=true>`);
|
|
11
|
-
import { splitProps } from "solid-js";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* A file name split before its ending: `{ stem: "Report 2026", ext: ".pdf" }`. A name without a dot, a hidden file
|
|
15
|
-
* such as `.env`, or a name that ends in a dot has no ending. A long ending (more than ten characters after the dot)
|
|
16
|
-
* counts as part of the name, so a dotted title does not read as a file type.
|
|
17
|
-
*/
|
|
18
|
-
export const splitFileName = name => {
|
|
19
|
-
const dot = name.lastIndexOf(".");
|
|
20
|
-
if (dot <= 0 || dot === name.length - 1 || name.length - dot - 1 > 10) return {
|
|
21
|
-
stem: name,
|
|
22
|
-
ext: ""
|
|
23
|
-
};
|
|
24
|
-
return {
|
|
25
|
-
stem: name.slice(0, dot),
|
|
26
|
-
ext: name.slice(dot)
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* A file name on one line that shortens before its ending (K15): `Quarterly rep….pdf`. The ending always stays, and
|
|
31
|
-
* the whole name is the hint on hover and the text a screen reader reads: the visible stem and ending are two flex
|
|
32
|
-
* items, which accessible names join with a space ("Notes .txt"), so they are hidden from assistive technology and
|
|
33
|
-
* the whole name stands beside them as screen-reader text. The screen-reader text is out of the flow, so the layout
|
|
34
|
-
* stays as it was.
|
|
35
|
-
*/
|
|
36
|
-
export function FileName(props) {
|
|
37
|
-
const [local, rest] = splitProps(props, ["name", "class"]);
|
|
38
|
-
const parts = () => splitFileName(local.name);
|
|
39
|
-
return (() => {
|
|
40
|
-
var _el$ = _$getNextElement(_tmpl$),
|
|
41
|
-
_el$2 = _el$.firstChild,
|
|
42
|
-
_el$3 = _el$2.nextSibling,
|
|
43
|
-
_el$4 = _el$3.nextSibling,
|
|
44
|
-
[_el$5, _co$] = _$getNextMarker(_el$4.nextSibling);
|
|
45
|
-
_$spread(_el$, _$mergeProps(rest, {
|
|
46
|
-
get ["class"]() {
|
|
47
|
-
return _$memo(() => !!local.class)() ? `k2b-file-name ${local.class}` : "k2b-file-name";
|
|
48
|
-
},
|
|
49
|
-
get title() {
|
|
50
|
-
return local.name;
|
|
51
|
-
}
|
|
52
|
-
}), false, true);
|
|
53
|
-
_$insert(_el$2, () => local.name);
|
|
54
|
-
_$insert(_el$3, () => parts().stem);
|
|
55
|
-
_$insert(_el$, (() => {
|
|
56
|
-
var _c$ = _$memo(() => !!parts().ext);
|
|
57
|
-
return () => _c$() ? (() => {
|
|
58
|
-
var _el$6 = _$getNextElement(_tmpl$2);
|
|
59
|
-
_$insert(_el$6, () => parts().ext);
|
|
60
|
-
return _el$6;
|
|
61
|
-
})() : null;
|
|
62
|
-
})(), _el$5, _co$);
|
|
63
|
-
_$runHydrationEvents();
|
|
64
|
-
return _el$;
|
|
65
|
-
})();
|
|
66
|
-
}
|
|
67
|
-
export default FileName;
|
|
68
|
-
//# sourceMappingURL=FileName.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["content/FileName.tsx"],"sourcesContent":["import { type JSX, splitProps } from \"solid-js\";\n\n/**\n * A file name split before its ending: `{ stem: \"Report 2026\", ext: \".pdf\" }`. A name without a dot, a hidden file\n * such as `.env`, or a name that ends in a dot has no ending. A long ending (more than ten characters after the dot)\n * counts as part of the name, so a dotted title does not read as a file type.\n */\nexport const splitFileName = (name: string): { stem: string; ext: string } => {\n const dot = name.lastIndexOf(\".\");\n if (dot <= 0 || dot === name.length - 1 || name.length - dot - 1 > 10) return { stem: name, ext: \"\" };\n return { stem: name.slice(0, dot), ext: name.slice(dot) };\n};\n\nexport type FileNameProps = Omit<JSX.HTMLAttributes<HTMLSpanElement>, \"children\"> & {\n /** The whole name, ending included. */\n name: string;\n};\n\n/**\n * A file name on one line that shortens before its ending (K15): `Quarterly rep….pdf`. The ending always stays, and\n * the whole name is the hint on hover and the text a screen reader reads: the visible stem and ending are two flex\n * items, which accessible names join with a space (\"Notes .txt\"), so they are hidden from assistive technology and\n * the whole name stands beside them as screen-reader text. The screen-reader text is out of the flow, so the layout\n * stays as it was.\n */\nexport function FileName(props: FileNameProps): JSX.Element {\n const [local, rest] = splitProps(props, [\"name\", \"class\"]);\n const parts = () => splitFileName(local.name);\n return (\n <span {...rest} class={local.class ? `k2b-file-name ${local.class}` : \"k2b-file-name\"} title={local.name}>\n <span class=\"k2b-sr-only\">{local.name}</span>\n <span class=\"k2b-file-name__stem\" aria-hidden=\"true\">\n {parts().stem}\n </span>\n {parts().ext ? (\n <span class=\"k2b-file-name__ext\" aria-hidden=\"true\">\n {parts().ext}\n </span>\n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MAAA,OAEZ,IAAI;IAAA;IAAA;IAAA;EAAA;AAGd;AAEA,eAAe,QAAQ","ignoreList":[]}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { className as _$className } from "solid-js/web";
|
|
3
|
-
import { effect as _$effect } from "solid-js/web";
|
|
4
|
-
import { getNextMarker as _$getNextMarker } from "solid-js/web";
|
|
5
|
-
import { createComponent as _$createComponent } from "solid-js/web";
|
|
6
|
-
import { getNextElement as _$getNextElement } from "solid-js/web";
|
|
7
|
-
import { insert as _$insert } from "solid-js/web";
|
|
8
|
-
import { use as _$use } from "solid-js/web";
|
|
9
|
-
import { memo as _$memo } from "solid-js/web";
|
|
10
|
-
var _tmpl$ = /*#__PURE__*/_$template(`<span class=k2b-count-chip>`),
|
|
11
|
-
_tmpl$2 = /*#__PURE__*/_$template(`<span class=k2b-task-row__detail>`),
|
|
12
|
-
_tmpl$3 = /*#__PURE__*/_$template(`<span class=k2b-task-row__body><i aria-hidden=true></i><span class=k2b-task-row__copy><span class=k2b-task-row__line><!$><!/><span class=k2b-task-row__text></span></span><!$><!/></span><span class=k2b-task-row__action></span><!$><!/>`);
|
|
13
|
-
import { createSignal, Show } from "solid-js";
|
|
14
|
-
import { Dynamic, isServer } from "solid-js/web";
|
|
15
|
-
import { Tooltip } from "../feedback/Tooltip";
|
|
16
|
-
/**
|
|
17
|
-
* A task that only has a date, such as items waiting for pickup until a day: the kind as a symbol, the count as a
|
|
18
|
-
* chip, one sentence and, at the end, the action word. The whole row is one link or button. What needs someone now
|
|
19
|
-
* and has a consequence is a notice cell instead (K10), not a task row.
|
|
20
|
-
* @example <TaskRow icon="ti ti-package-export" count={3} text="Unsold items are ready for pickup" detail="until Dec 12, 2026" action="Prepare handover" href="/handover" />
|
|
21
|
-
*/
|
|
22
|
-
export function TaskRow(props) {
|
|
23
|
-
let row;
|
|
24
|
-
let body;
|
|
25
|
-
let sentence;
|
|
26
|
-
// The full sentence shows as a hint only while it is cut; it is measured when a pointer or the keyboard arrives.
|
|
27
|
-
const [cut, setCut] = createSignal(false);
|
|
28
|
-
const measure = () => setCut(Boolean(sentence && sentence.scrollWidth > sentence.clientWidth + 1));
|
|
29
|
-
const link = () => props.href !== undefined && !props.disabled;
|
|
30
|
-
const element = () => props.href !== undefined ? "a" : "button";
|
|
31
|
-
return _$createComponent(Dynamic, {
|
|
32
|
-
get component() {
|
|
33
|
-
return element();
|
|
34
|
-
},
|
|
35
|
-
ref: node => {
|
|
36
|
-
row = node;
|
|
37
|
-
},
|
|
38
|
-
get ["class"]() {
|
|
39
|
-
return _$memo(() => !!props.class)() ? `k2b-task-row ${props.class}` : "k2b-task-row";
|
|
40
|
-
},
|
|
41
|
-
get href() {
|
|
42
|
-
return _$memo(() => !!link())() ? props.href : undefined;
|
|
43
|
-
},
|
|
44
|
-
get type() {
|
|
45
|
-
return element() === "button" ? "button" : undefined;
|
|
46
|
-
},
|
|
47
|
-
get disabled() {
|
|
48
|
-
return _$memo(() => element() === "button")() ? props.disabled : undefined;
|
|
49
|
-
},
|
|
50
|
-
get role() {
|
|
51
|
-
return props.disabled && element() === "a" ? "link" : undefined;
|
|
52
|
-
},
|
|
53
|
-
get ["aria-disabled"]() {
|
|
54
|
-
return props.disabled && element() === "a" ? "true" : undefined;
|
|
55
|
-
},
|
|
56
|
-
get ["aria-label"]() {
|
|
57
|
-
return props.label;
|
|
58
|
-
},
|
|
59
|
-
get ["data-detail"]() {
|
|
60
|
-
return props.detail !== undefined ? "" : undefined;
|
|
61
|
-
},
|
|
62
|
-
get title() {
|
|
63
|
-
return isServer ? props.text : undefined;
|
|
64
|
-
},
|
|
65
|
-
onClick: event => {
|
|
66
|
-
if (props.disabled) {
|
|
67
|
-
event.preventDefault();
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
props.onClick?.(event);
|
|
71
|
-
},
|
|
72
|
-
"on:pointerenter": measure,
|
|
73
|
-
"on:focusin": measure,
|
|
74
|
-
get children() {
|
|
75
|
-
var _el$ = _$getNextElement(_tmpl$3),
|
|
76
|
-
_el$2 = _el$.firstChild,
|
|
77
|
-
_el$3 = _el$2.nextSibling,
|
|
78
|
-
_el$4 = _el$3.firstChild,
|
|
79
|
-
_el$7 = _el$4.firstChild,
|
|
80
|
-
[_el$8, _co$] = _$getNextMarker(_el$7.nextSibling),
|
|
81
|
-
_el$6 = _el$8.nextSibling,
|
|
82
|
-
_el$0 = _el$4.nextSibling,
|
|
83
|
-
[_el$1, _co$2] = _$getNextMarker(_el$0.nextSibling),
|
|
84
|
-
_el$10 = _el$3.nextSibling,
|
|
85
|
-
_el$11 = _el$10.nextSibling,
|
|
86
|
-
[_el$12, _co$3] = _$getNextMarker(_el$11.nextSibling);
|
|
87
|
-
var _ref$ = body;
|
|
88
|
-
typeof _ref$ === "function" ? _$use(_ref$, _el$) : body = _el$;
|
|
89
|
-
_$insert(_el$4, _$createComponent(Show, {
|
|
90
|
-
get when() {
|
|
91
|
-
return props.count;
|
|
92
|
-
},
|
|
93
|
-
get children() {
|
|
94
|
-
var _el$5 = _$getNextElement(_tmpl$);
|
|
95
|
-
_$insert(_el$5, () => props.count);
|
|
96
|
-
return _el$5;
|
|
97
|
-
}
|
|
98
|
-
}), _el$8, _co$);
|
|
99
|
-
var _ref$2 = sentence;
|
|
100
|
-
typeof _ref$2 === "function" ? _$use(_ref$2, _el$6) : sentence = _el$6;
|
|
101
|
-
_$insert(_el$6, () => props.text);
|
|
102
|
-
_$insert(_el$3, _$createComponent(Show, {
|
|
103
|
-
get when() {
|
|
104
|
-
return props.detail !== undefined;
|
|
105
|
-
},
|
|
106
|
-
get children() {
|
|
107
|
-
var _el$9 = _$getNextElement(_tmpl$2);
|
|
108
|
-
_$insert(_el$9, () => props.detail);
|
|
109
|
-
return _el$9;
|
|
110
|
-
}
|
|
111
|
-
}), _el$1, _co$2);
|
|
112
|
-
_$insert(_el$10, () => props.action);
|
|
113
|
-
_$insert(_el$, _$createComponent(Tooltip, {
|
|
114
|
-
get content() {
|
|
115
|
-
return props.text;
|
|
116
|
-
},
|
|
117
|
-
target: () => body,
|
|
118
|
-
focusTarget: () => row,
|
|
119
|
-
get disabled() {
|
|
120
|
-
return !cut();
|
|
121
|
-
}
|
|
122
|
-
}), _el$12, _co$3);
|
|
123
|
-
_$effect(() => _$className(_el$2, `${props.icon} k2b-task-row__icon`));
|
|
124
|
-
return _el$;
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
export default TaskRow;
|
|
129
|
-
//# sourceMappingURL=TaskRow.js.map
|