@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.d.cts CHANGED
@@ -49,6 +49,10 @@ interface NavAction {
49
49
  confirm?: {
50
50
  label: string;
51
51
  };
52
+ /** F092.32 — a dimmed value right-aligned before the chevron («Type …… All ›»). */
53
+ value?: string;
54
+ /** F092.32 — a divider line before this item, to separate groups. */
55
+ separator?: boolean;
52
56
  }
53
57
  interface NavSection<Icon = unknown> {
54
58
  /** A sub-heading inside one group, e.g. "I dag" / "I går". */
package/dist/preact.d.ts CHANGED
@@ -49,6 +49,10 @@ interface NavAction {
49
49
  confirm?: {
50
50
  label: string;
51
51
  };
52
+ /** F092.32 — a dimmed value right-aligned before the chevron («Type …… All ›»). */
53
+ value?: string;
54
+ /** F092.32 — a divider line before this item, to separate groups. */
55
+ separator?: boolean;
52
56
  }
53
57
  interface NavSection<Icon = unknown> {
54
58
  /** A sub-heading inside one group, e.g. "I dag" / "I går". */
package/dist/preact.js CHANGED
@@ -544,6 +544,7 @@ function ItemActionsMenu(props) {
544
544
  const [pos, setPos] = useState(void 0);
545
545
  const view = stack[stack.length - 1];
546
546
  const closed = useRef(false);
547
+ const [kbd, setKbd] = useState(() => props.anchor.matches(":focus-visible"));
547
548
  const close = (refocus = true) => {
548
549
  if (closed.current) return;
549
550
  closed.current = true;
@@ -619,6 +620,7 @@ function ItemActionsMenu(props) {
619
620
  const view2 = stack2[stack2.length - 1];
620
621
  if (!view2) return;
621
622
  e.stopPropagation();
623
+ setKbd(true);
622
624
  if (e.key === "Escape") {
623
625
  e.preventDefault();
624
626
  return close();
@@ -661,7 +663,7 @@ function ItemActionsMenu(props) {
661
663
  "div",
662
664
  {
663
665
  ref: menu,
664
- class: "bas-rowmenu",
666
+ class: "bas-rowmenu" + (kbd ? " is-kbd" : ""),
665
667
  role: "menu",
666
668
  tabIndex: -1,
667
669
  "aria-label": view.kind === "list" && view.title ? view.title : props.label,
@@ -673,28 +675,32 @@ function ItemActionsMenu(props) {
673
675
  /* @__PURE__ */ jsx(IconChevronLeft, {}),
674
676
  /* @__PURE__ */ jsx("span", { children: view.kind === "list" ? view.title : view.action.label })
675
677
  ] }) : null,
676
- view.kind === "list" ? view.actions.map((a, i) => /* @__PURE__ */ jsxs(
677
- "button",
678
- {
679
- type: "button",
680
- role: "menuitem",
681
- ref: (el) => {
682
- items.current[i] = el;
678
+ view.kind === "list" ? view.actions.map((a, i) => [
679
+ a.separator ? /* @__PURE__ */ jsx("div", { class: "bas-rowmenu__sep", role: "separator" }, `${a.id}-sep`) : null,
680
+ /* @__PURE__ */ jsxs(
681
+ "button",
682
+ {
683
+ type: "button",
684
+ role: "menuitem",
685
+ ref: (el) => {
686
+ items.current[i] = el;
687
+ },
688
+ tabIndex: i === hi ? 0 : -1,
689
+ class: "bas-rowmenu__item" + (i === hi ? " is-active" : "") + (a.danger ? " is-danger" : "") + (armed === a.id ? " is-armed" : ""),
690
+ "data-testid": `${pre}-action-${a.id}`,
691
+ onMouseEnter: () => setHi(i),
692
+ onFocus: () => setHi(i),
693
+ onClick: () => pick(a),
694
+ children: [
695
+ a.icon ? /* @__PURE__ */ jsx("span", { class: "bas-rowmenu__icon", children: a.icon }) : null,
696
+ /* @__PURE__ */ jsx("span", { class: "bas-rowmenu__label", children: armed === a.id && a.confirm ? a.confirm.label : a.label }),
697
+ a.value ? /* @__PURE__ */ jsx("span", { class: "bas-rowmenu__value", "data-testid": `${pre}-action-${a.id}-value`, children: a.value }) : null,
698
+ a.submenu?.length ? /* @__PURE__ */ jsx(IconChevronRight, {}) : a.kbd ? /* @__PURE__ */ jsx("kbd", { class: "bas-rowmenu__kbd", children: a.kbd.toUpperCase() }) : null
699
+ ]
683
700
  },
684
- tabIndex: i === hi ? 0 : -1,
685
- class: "bas-rowmenu__item" + (i === hi ? " is-active" : "") + (a.danger ? " is-danger" : "") + (armed === a.id ? " is-armed" : ""),
686
- "data-testid": `${pre}-action-${a.id}`,
687
- onMouseEnter: () => setHi(i),
688
- onFocus: () => setHi(i),
689
- onClick: () => pick(a),
690
- children: [
691
- a.icon ? /* @__PURE__ */ jsx("span", { class: "bas-rowmenu__icon", children: a.icon }) : null,
692
- /* @__PURE__ */ jsx("span", { class: "bas-rowmenu__label", children: armed === a.id && a.confirm ? a.confirm.label : a.label }),
693
- a.submenu?.length ? /* @__PURE__ */ jsx(IconChevronRight, {}) : a.kbd ? /* @__PURE__ */ jsx("kbd", { class: "bas-rowmenu__kbd", children: a.kbd.toUpperCase() }) : null
694
- ]
695
- },
696
- a.id
697
- )) : /* @__PURE__ */ jsxs(
701
+ a.id
702
+ )
703
+ ]) : /* @__PURE__ */ jsxs(
698
704
  "form",
699
705
  {
700
706
  class: "bas-rowmenu__form",