anentrypoint-design 0.0.249 → 0.0.250
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/247420.js +10 -10
- package/package.json +1 -1
- package/src/components/shell.js +29 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anentrypoint-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.250",
|
|
4
4
|
"description": "247420 design system SDK — webjsx + modified ripple-ui, single-file ESM bundle for reproducible use of the AnEntrypoint design.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/247420.js",
|
package/src/components/shell.js
CHANGED
|
@@ -245,6 +245,33 @@ export function Crumb({ trail = [], leaf = '', right } = {}) {
|
|
|
245
245
|
return h('div', { class: 'app-crumb' }, ...parts);
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
+
// ArrowUp/ArrowDown/Home/End move focus between sidebar links without
|
|
249
|
+
// altering tabindex -- every link stays naturally Tab-reachable (a plain
|
|
250
|
+
// link list, not a role=tablist), arrows are a same-list quick-nav shortcut
|
|
251
|
+
// layered on top, mirroring the roving-nav affordance Tabs already has
|
|
252
|
+
// (editor-primitives.js) but without roving-tabindex's activate-on-move
|
|
253
|
+
// semantics, since a nav link's "activation" is a real navigation the user
|
|
254
|
+
// should still choose deliberately with Enter/click.
|
|
255
|
+
function onSideLinkKeyDown(e) {
|
|
256
|
+
let dir = 0;
|
|
257
|
+
if (e.key === 'ArrowDown') dir = 1;
|
|
258
|
+
else if (e.key === 'ArrowUp') dir = -1;
|
|
259
|
+
else if (e.key === 'Home' || e.key === 'End') dir = e.key === 'Home' ? 'first' : 'last';
|
|
260
|
+
else return;
|
|
261
|
+
const side = e.currentTarget.closest('.app-side');
|
|
262
|
+
if (!side) return;
|
|
263
|
+
const links = Array.from(side.querySelectorAll('a'));
|
|
264
|
+
const curIdx = links.indexOf(e.currentTarget);
|
|
265
|
+
if (curIdx === -1) return;
|
|
266
|
+
e.preventDefault();
|
|
267
|
+
let nextIdx;
|
|
268
|
+
if (dir === 'first') nextIdx = 0;
|
|
269
|
+
else if (dir === 'last') nextIdx = links.length - 1;
|
|
270
|
+
else nextIdx = (curIdx + dir + links.length) % links.length;
|
|
271
|
+
const next = links[nextIdx];
|
|
272
|
+
if (next) next.focus();
|
|
273
|
+
}
|
|
274
|
+
|
|
248
275
|
export function Side({ sections = [] } = {}) {
|
|
249
276
|
return h('aside', { class: 'app-side', role: 'navigation', 'aria-label': 'sidebar navigation' }, ...sections.map(sec => {
|
|
250
277
|
const groupId = 'side-group-' + String(sec.group).replace(/\W+/g, '-').toLowerCase();
|
|
@@ -261,7 +288,8 @@ export function Side({ sections = [] } = {}) {
|
|
|
261
288
|
class: active ? 'active' : '',
|
|
262
289
|
'aria-current': active ? 'page' : null,
|
|
263
290
|
'aria-label': label + countLabel,
|
|
264
|
-
onclick: onClick
|
|
291
|
+
onclick: onClick,
|
|
292
|
+
onkeydown: onSideLinkKeyDown
|
|
265
293
|
},
|
|
266
294
|
glyph != null ? Glyph({ children: glyph, color }) : h('span', { class: 'glyph', 'aria-hidden': 'true' }),
|
|
267
295
|
h('span', {}, label),
|