@broberg/app-shell 0.21.0 → 0.22.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/preact.cjs CHANGED
@@ -546,6 +546,7 @@ function ItemActionsMenu(props) {
546
546
  const [pos, setPos] = hooks.useState(void 0);
547
547
  const view = stack[stack.length - 1];
548
548
  const closed = hooks.useRef(false);
549
+ const [kbd, setKbd] = hooks.useState(() => props.anchor.matches(":focus-visible"));
549
550
  const close = (refocus = true) => {
550
551
  if (closed.current) return;
551
552
  closed.current = true;
@@ -621,6 +622,7 @@ function ItemActionsMenu(props) {
621
622
  const view2 = stack2[stack2.length - 1];
622
623
  if (!view2) return;
623
624
  e.stopPropagation();
625
+ setKbd(true);
624
626
  if (e.key === "Escape") {
625
627
  e.preventDefault();
626
628
  return close();
@@ -663,7 +665,7 @@ function ItemActionsMenu(props) {
663
665
  "div",
664
666
  {
665
667
  ref: menu,
666
- class: "bas-rowmenu",
668
+ class: "bas-rowmenu" + (kbd ? " is-kbd" : ""),
667
669
  role: "menu",
668
670
  tabIndex: -1,
669
671
  "aria-label": view.kind === "list" && view.title ? view.title : props.label,
@@ -675,28 +677,32 @@ function ItemActionsMenu(props) {
675
677
  /* @__PURE__ */ jsxRuntime.jsx(IconChevronLeft, {}),
676
678
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: view.kind === "list" ? view.title : view.action.label })
677
679
  ] }) : null,
678
- view.kind === "list" ? view.actions.map((a, i) => /* @__PURE__ */ jsxRuntime.jsxs(
679
- "button",
680
- {
681
- type: "button",
682
- role: "menuitem",
683
- ref: (el) => {
684
- items.current[i] = el;
680
+ view.kind === "list" ? view.actions.map((a, i) => [
681
+ a.separator ? /* @__PURE__ */ jsxRuntime.jsx("div", { class: "bas-rowmenu__sep", role: "separator" }, `${a.id}-sep`) : null,
682
+ /* @__PURE__ */ jsxRuntime.jsxs(
683
+ "button",
684
+ {
685
+ type: "button",
686
+ role: "menuitem",
687
+ ref: (el) => {
688
+ items.current[i] = el;
689
+ },
690
+ tabIndex: i === hi ? 0 : -1,
691
+ class: "bas-rowmenu__item" + (i === hi ? " is-active" : "") + (a.danger ? " is-danger" : "") + (armed === a.id ? " is-armed" : ""),
692
+ "data-testid": `${pre}-action-${a.id}`,
693
+ onMouseEnter: () => setHi(i),
694
+ onFocus: () => setHi(i),
695
+ onClick: () => pick(a),
696
+ children: [
697
+ a.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { class: "bas-rowmenu__icon", children: a.icon }) : null,
698
+ /* @__PURE__ */ jsxRuntime.jsx("span", { class: "bas-rowmenu__label", children: armed === a.id && a.confirm ? a.confirm.label : a.label }),
699
+ a.value ? /* @__PURE__ */ jsxRuntime.jsx("span", { class: "bas-rowmenu__value", "data-testid": `${pre}-action-${a.id}-value`, children: a.value }) : null,
700
+ a.submenu?.length ? /* @__PURE__ */ jsxRuntime.jsx(IconChevronRight, {}) : a.kbd ? /* @__PURE__ */ jsxRuntime.jsx("kbd", { class: "bas-rowmenu__kbd", children: a.kbd.toUpperCase() }) : null
701
+ ]
685
702
  },
686
- tabIndex: i === hi ? 0 : -1,
687
- class: "bas-rowmenu__item" + (i === hi ? " is-active" : "") + (a.danger ? " is-danger" : "") + (armed === a.id ? " is-armed" : ""),
688
- "data-testid": `${pre}-action-${a.id}`,
689
- onMouseEnter: () => setHi(i),
690
- onFocus: () => setHi(i),
691
- onClick: () => pick(a),
692
- children: [
693
- a.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { class: "bas-rowmenu__icon", children: a.icon }) : null,
694
- /* @__PURE__ */ jsxRuntime.jsx("span", { class: "bas-rowmenu__label", children: armed === a.id && a.confirm ? a.confirm.label : a.label }),
695
- a.submenu?.length ? /* @__PURE__ */ jsxRuntime.jsx(IconChevronRight, {}) : a.kbd ? /* @__PURE__ */ jsxRuntime.jsx("kbd", { class: "bas-rowmenu__kbd", children: a.kbd.toUpperCase() }) : null
696
- ]
697
- },
698
- a.id
699
- )) : /* @__PURE__ */ jsxRuntime.jsxs(
703
+ a.id
704
+ )
705
+ ]) : /* @__PURE__ */ jsxRuntime.jsxs(
700
706
  "form",
701
707
  {
702
708
  class: "bas-rowmenu__form",