@stackone/malachite 2.81.0 → 2.82.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LevelMeter.js","sources":["../../src/components/LevelMeter.tsx"],"sourcesContent":["import type React from 'react';\n\nexport type LevelMeterStep = 'on' | 'partial' | 'off';\n\nexport interface LevelMeterProps {\n /** One bar per step, shortest first. */\n steps: readonly LevelMeterStep[];\n /** Only when it stands alone; beside text naming the level it is decorative. */\n label?: string;\n className?: string;\n}\n\nconst BAR_WIDTH_PX = 4;\nconst FIRST_BAR_PX = 6;\nconst BAR_RISE_PX = 3;\n\nconst ON = 'var(--malachite-accent-foreground, rgb(2, 122, 66))';\nconst PARTIAL_FILL = 'var(--malachite-accent-background-glass, rgba(0, 175, 102, 0.08))';\nconst OFF_OUTLINE = 'var(--malachite-text-secondary, rgb(123, 123, 123))';\n\nconst STEP_STYLES: Record<LevelMeterStep, React.CSSProperties> = {\n on: { background: ON, borderColor: ON },\n partial: { background: PARTIAL_FILL, borderColor: ON },\n off: { background: 'transparent', borderColor: OFF_OUTLINE },\n};\n\n// Inline, not Tailwind: menus portal outside the shadow root's stylesheet.\nexport const LevelMeter: React.FC<LevelMeterProps> = ({ steps, label, className }) => (\n <span\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n className={className}\n style={{\n display: 'inline-flex',\n flexShrink: 0,\n alignItems: 'flex-end',\n gap: 2,\n height: FIRST_BAR_PX + BAR_RISE_PX * Math.max(steps.length - 1, 0),\n }}\n >\n {steps.map((step, index) => (\n <span\n key={index}\n data-step={step}\n style={{\n width: BAR_WIDTH_PX,\n height: FIRST_BAR_PX + BAR_RISE_PX * index,\n borderRadius: 1,\n boxSizing: 'border-box',\n borderWidth: 1,\n borderStyle: 'solid',\n ...STEP_STYLES[step],\n }}\n />\n ))}\n </span>\n);\n\nexport default LevelMeter;\n"],"names":["BAR_WIDTH_PX","FIRST_BAR_PX","BAR_RISE_PX","ON","PARTIAL_FILL","OFF_OUTLINE","STEP_STYLES","LevelMeter","steps","label","className","jsx","step","index"],"mappings":";AAYA,MAAMA,IAAe,GACfC,IAAe,GACfC,IAAc,GAEdC,IAAK,uDACLC,IAAe,qEACfC,IAAc,uDAEdC,IAA2D;AAAA,EAC7D,IAAI,EAAE,YAAYH,GAAI,aAAaA,EAAA;AAAA,EACnC,SAAS,EAAE,YAAYC,GAAc,aAAaD,EAAA;AAAA,EAClD,KAAK,EAAE,YAAY,eAAe,aAAaE,EAAA;AACnD,GAGaE,IAAwC,CAAC,EAAE,OAAAC,GAAO,OAAAC,GAAO,WAAAC,QAClE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,MAAMF,IAAQ,QAAQ;AAAA,IACtB,cAAYA;AAAA,IACZ,eAAaA,IAAQ,SAAY;AAAA,IACjC,WAAAC;AAAA,IACA,OAAO;AAAA,MACH,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,KAAK;AAAA,MACL,QAAQT,IAAeC,IAAc,KAAK,IAAIM,EAAM,SAAS,GAAG,CAAC;AAAA,IAAA;AAAA,IAGpE,UAAAA,EAAM,IAAI,CAACI,GAAMC,MACd,gBAAAF;AAAA,MAAC;AAAA,MAAA;AAAA,QAEG,aAAWC;AAAA,QACX,OAAO;AAAA,UACH,OAAOZ;AAAA,UACP,QAAQC,IAAeC,IAAcW;AAAA,UACrC,cAAc;AAAA,UACd,WAAW;AAAA,UACX,aAAa;AAAA,UACb,aAAa;AAAA,UACb,GAAGP,EAAYM,CAAI;AAAA,QAAA;AAAA,MACvB;AAAA,MAVKC;AAAA,IAAA,CAYZ;AAAA,EAAA;AACL;"}
@@ -1,137 +1,135 @@
1
- import { jsx as n, jsxs as u, Fragment as v } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as u, Fragment as v } from "react/jsx-runtime";
2
2
  import { forwardRef as x, useContext as f, useRef as h, useLayoutEffect as b } from "react";
3
3
  import { Button as g } from "./Button.js";
4
- import T from "./Tooltip.js";
5
- import { BORDER as c, NO_SCROLLBAR as N } from "./chromeStyles.js";
6
- import { FOCUS_RING_INSET as y } from "./focusRing.js";
7
- import { isPlainClick as S } from "./linkClick.js";
8
- import { PopoverShownContext as w } from "./popoverTree.js";
9
- import { safeHref as R } from "./safeHref.js";
10
- const F = ({ title: e, action: r, divider: t = !0 }) => /* @__PURE__ */ u(
4
+ import N from "./Tooltip.js";
5
+ import { BORDER as l, NO_SCROLLBAR as y } from "./chromeStyles.js";
6
+ import { FOCUS_RING_INSET as S } from "./focusRing.js";
7
+ import { isPlainClick as w } from "./linkClick.js";
8
+ import { PopoverShownContext as E } from "./popoverTree.js";
9
+ import { safeHref as P } from "./safeHref.js";
10
+ import { scrollRowIntoList as R } from "./scrollRowIntoList.js";
11
+ const M = ({ title: e, action: t, divider: r = !0 }) => /* @__PURE__ */ u(
11
12
  "div",
12
13
  {
13
- className: `flex items-center justify-between border-0 ${t ? `border-b border-solid ${c} px-5 py-4` : "px-5 pt-4 pb-[4px]"} text-[12px] leading-[15px] font-normal text-[var(--malachite-text-dimmed,rgb(161,161,161))]`,
14
+ className: `flex items-center justify-between border-0 ${r ? `border-b border-solid ${l} px-5 py-4` : "px-5 pt-4 pb-[4px]"} text-[12px] leading-[15px] font-normal text-[var(--malachite-text-dimmed,rgb(161,161,161))]`,
14
15
  children: [
15
- /* @__PURE__ */ n("span", { children: e }),
16
- r
16
+ /* @__PURE__ */ o("span", { children: e }),
17
+ t
17
18
  ]
18
19
  }
19
- ), E = '[aria-current]:not([aria-current="false"]):not([aria-current=""]), [aria-selected="true"], [role="radio"][aria-checked="true"]', P = ["aria-current", "aria-selected", "aria-checked"], m = (e) => {
20
- const r = e.querySelector(E);
21
- if (!r)
22
- return !1;
23
- const t = e.getBoundingClientRect().top + e.clientTop, { top: l, bottom: o } = r.getBoundingClientRect(), a = l - t + e.scrollTop, i = o - t + e.scrollTop;
24
- return a < e.scrollTop ? e.scrollTop = a : i > e.scrollTop + e.clientHeight && (e.scrollTop = i - e.clientHeight), !0;
25
- }, U = ({ children: e, scrollToSelected: r = !1 }) => {
26
- const t = f(w), l = h(null);
20
+ ), T = '[aria-current]:not([aria-current="false"]):not([aria-current=""]), [aria-selected="true"], [role="radio"][aria-checked="true"]', C = ["aria-current", "aria-selected", "aria-checked"], m = (e) => {
21
+ const t = e.querySelector(T);
22
+ return t ? (R(e, t), !0) : !1;
23
+ }, q = ({ children: e, scrollToSelected: t = !1 }) => {
24
+ const r = f(E), i = h(null);
27
25
  return b(() => {
28
- const o = l.current;
29
- if (!r || !t || !o || m(o))
26
+ const a = i.current;
27
+ if (!t || !r || !a || m(a))
30
28
  return;
31
- const a = new MutationObserver(() => {
32
- m(o) && a.disconnect();
29
+ const n = new MutationObserver(() => {
30
+ m(a) && n.disconnect();
33
31
  });
34
- return a.observe(o, {
32
+ return n.observe(a, {
35
33
  childList: !0,
36
34
  subtree: !0,
37
35
  attributes: !0,
38
- attributeFilter: P
39
- }), () => a.disconnect();
40
- }, [r, t]), /* @__PURE__ */ n(
36
+ attributeFilter: C
37
+ }), () => n.disconnect();
38
+ }, [t, r]), /* @__PURE__ */ o(
41
39
  "div",
42
40
  {
43
- ref: l,
44
- className: `flex max-h-80 flex-col gap-[2px] overflow-y-auto p-2 ${N}`,
41
+ ref: i,
42
+ className: `flex max-h-80 flex-col gap-[2px] overflow-y-auto p-2 ${y}`,
45
43
  children: e
46
44
  }
47
45
  );
48
- }, C = x(
49
- ({ children: e }, r) => /* @__PURE__ */ n("div", { ref: r, className: `border-0 border-t border-solid ${c} p-2`, children: e })
46
+ }, $ = x(
47
+ ({ children: e }, t) => /* @__PURE__ */ o("div", { ref: t, className: `border-0 border-t border-solid ${l} p-2`, children: e })
50
48
  );
51
- C.displayName = "Popover.Section";
52
- const M = ({ children: e }) => /* @__PURE__ */ n("div", { className: "px-3 py-2 text-[length:var(--malachite-font-size-small,13px)] text-[var(--malachite-text-dimmed,rgb(161,161,161))] select-none", children: e }), q = ({ children: e }) => /* @__PURE__ */ n("div", { className: "px-2 pt-2", children: e }), G = ({ children: e }) => /* @__PURE__ */ n(
49
+ $.displayName = "Popover.Section";
50
+ const G = ({ children: e }) => /* @__PURE__ */ o("div", { className: "px-3 py-2 text-[length:var(--malachite-font-size-small,13px)] text-[var(--malachite-text-dimmed,rgb(161,161,161))] select-none", children: e }), V = ({ children: e }) => /* @__PURE__ */ o("div", { className: "px-2 pt-2", children: e }), W = ({ children: e }) => /* @__PURE__ */ o(
53
51
  "div",
54
52
  {
55
- className: `border-0 border-t border-solid ${c} px-5 py-3 text-[length:var(--malachite-font-size-xsmall,11px)] leading-4 text-[var(--malachite-text-secondary,rgb(123,123,123))]`,
53
+ className: `border-0 border-t border-solid ${l} px-5 py-3 text-[length:var(--malachite-font-size-xsmall,11px)] leading-4 text-[var(--malachite-text-secondary,rgb(123,123,123))]`,
56
54
  children: e
57
55
  }
58
- ), $ = {
56
+ ), O = {
59
57
  default: "text-[var(--malachite-text-secondary,rgb(123,123,123))]",
60
58
  error: "text-[var(--malachite-text-error,rgb(237,53,54))]"
61
- }, O = (e) => e != null && e !== !1 && e !== "", _ = x(
62
- ({ message: e, tone: r = "default", action: t, focusable: l = !1 }, o) => {
63
- const a = O(e);
59
+ }, _ = (e) => e != null && e !== !1 && e !== "", I = x(
60
+ ({ message: e, tone: t = "default", action: r, focusable: i = !1 }, a) => {
61
+ const n = _(e);
64
62
  return /* @__PURE__ */ u(v, { children: [
65
- /* @__PURE__ */ n(
63
+ /* @__PURE__ */ o(
66
64
  "div",
67
65
  {
68
- ref: o,
66
+ ref: a,
69
67
  role: "status",
70
- tabIndex: l ? -1 : void 0,
71
- className: a ? "outline-none" : "sr-only",
72
- children: a && /* @__PURE__ */ n(
68
+ tabIndex: i ? -1 : void 0,
69
+ className: n ? "outline-none" : "sr-only",
70
+ children: n && /* @__PURE__ */ o(
73
71
  "div",
74
72
  {
75
- className: `px-3 py-2 text-[length:var(--malachite-font-size-small,13px)] ${$[r]}`,
73
+ className: `px-3 py-2 text-[length:var(--malachite-font-size-small,13px)] ${O[t]}`,
76
74
  children: e
77
75
  }
78
76
  )
79
77
  }
80
78
  ),
81
- a && t && /* @__PURE__ */ n("div", { className: "px-3 pb-2", children: /* @__PURE__ */ n(
79
+ n && r && /* @__PURE__ */ o("div", { className: "px-3 pb-2", children: /* @__PURE__ */ o(
82
80
  g,
83
81
  {
84
82
  variant: "outline",
85
83
  size: "small",
86
- loading: t.pending,
87
- onClick: t.onClick,
88
- children: t.label
84
+ loading: r.pending,
85
+ onClick: r.onClick,
86
+ children: r.label
89
87
  }
90
88
  ) })
91
89
  ] });
92
90
  }
93
91
  );
94
- _.displayName = "Popover.Status";
95
- const V = ({
92
+ I.displayName = "Popover.Status";
93
+ const X = ({
96
94
  icon: e,
97
- "aria-label": r,
98
- onClick: t,
99
- href: l,
100
- disabled: o = !1,
101
- tooltip: a
95
+ "aria-label": t,
96
+ onClick: r,
97
+ href: i,
98
+ disabled: a = !1,
99
+ tooltip: n
102
100
  }) => {
103
- const i = o ? void 0 : R(l), s = `m-0 inline-flex size-5 items-center justify-center rounded-[var(--malachite-radius-sm,4px)] border-0 bg-transparent p-0 transition-colors duration-150 [&_svg]:size-3! ${o ? "cursor-not-allowed text-[var(--malachite-text-placeholder,rgb(187,187,187))] opacity-50" : "cursor-pointer text-[var(--malachite-text-placeholder,rgb(187,187,187))] hover:bg-[var(--malachite-pillbutton-background,rgb(241,241,241))] hover:text-[var(--malachite-text-secondary,rgb(123,123,123))]"} ${y}`, p = i !== void 0 ? /* @__PURE__ */ n(
101
+ const s = a ? void 0 : P(i), c = `m-0 inline-flex size-5 items-center justify-center rounded-[var(--malachite-radius-sm,4px)] border-0 bg-transparent p-0 transition-colors duration-150 [&_svg]:size-3! ${a ? "cursor-not-allowed text-[var(--malachite-text-placeholder,rgb(187,187,187))] opacity-50" : "cursor-pointer text-[var(--malachite-text-placeholder,rgb(187,187,187))] hover:bg-[var(--malachite-pillbutton-background,rgb(241,241,241))] hover:text-[var(--malachite-text-secondary,rgb(123,123,123))]"} ${S}`, d = s !== void 0 ? /* @__PURE__ */ o(
104
102
  "a",
105
103
  {
106
- href: i,
107
- "aria-label": r,
108
- onClick: (d) => {
109
- S(d) && t && (d.preventDefault(), t());
104
+ href: s,
105
+ "aria-label": t,
106
+ onClick: (p) => {
107
+ w(p) && r && (p.preventDefault(), r());
110
108
  },
111
- className: `no-underline ${s}`,
109
+ className: `no-underline ${c}`,
112
110
  children: e
113
111
  }
114
- ) : /* @__PURE__ */ n(
112
+ ) : /* @__PURE__ */ o(
115
113
  "button",
116
114
  {
117
115
  type: "button",
118
- "aria-label": r,
119
- "aria-disabled": o || void 0,
120
- onClick: o ? void 0 : t,
121
- className: s,
116
+ "aria-label": t,
117
+ "aria-disabled": a || void 0,
118
+ onClick: a ? void 0 : r,
119
+ className: c,
122
120
  children: e
123
121
  }
124
122
  );
125
- return a ? /* @__PURE__ */ n(T, { text: a, children: p }) : p;
123
+ return n ? /* @__PURE__ */ o(N, { text: n, children: d }) : d;
126
124
  };
127
125
  export {
128
- V as PopoverAction,
129
- M as PopoverEmpty,
130
- F as PopoverHeader,
131
- U as PopoverList,
132
- G as PopoverNote,
133
- q as PopoverSearch,
134
- C as PopoverSection,
135
- _ as PopoverStatus
126
+ X as PopoverAction,
127
+ G as PopoverEmpty,
128
+ M as PopoverHeader,
129
+ q as PopoverList,
130
+ W as PopoverNote,
131
+ V as PopoverSearch,
132
+ $ as PopoverSection,
133
+ I as PopoverStatus
136
134
  };
137
135
  //# sourceMappingURL=PopoverParts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverParts.js","sources":["../../src/components/PopoverParts.tsx"],"sourcesContent":["import React, { forwardRef, useContext, useLayoutEffect, useRef } from 'react';\nimport Button from './Button';\nimport Tooltip from './Tooltip';\nimport { BORDER, NO_SCROLLBAR } from './chromeStyles';\nimport { FOCUS_RING_INSET } from './focusRing';\nimport { isPlainClick } from './linkClick';\nimport { PopoverShownContext } from './popoverTree';\nimport { safeHref } from './safeHref';\n\nexport interface PopoverHeaderProps {\n title: string;\n action?: React.ReactNode;\n /** `false` drops the rule and sits the header 4px over the list. */\n divider?: boolean;\n}\n\nexport const PopoverHeader: React.FC<PopoverHeaderProps> = ({ title, action, divider = true }) => (\n <div\n className={`flex items-center justify-between border-0 ${divider ? `border-b border-solid ${BORDER} px-5 py-4` : 'px-5 pt-4 pb-[4px]'} text-[12px] leading-[15px] font-normal text-[var(--malachite-text-dimmed,rgb(161,161,161))]`}\n >\n <span>{title}</span>\n {action}\n </div>\n);\n\nconst SELECTED_ROW =\n '[aria-current]:not([aria-current=\"false\"]):not([aria-current=\"\"]), [aria-selected=\"true\"], [role=\"radio\"][aria-checked=\"true\"]';\nconst SELECTION_ATTRIBUTES = ['aria-current', 'aria-selected', 'aria-checked'];\n\n// Not `scrollIntoView`: that also scrolls every scrollable ancestor, the page included.\nconst scrollSelectedRowIntoView = (list: HTMLElement): boolean => {\n const row = list.querySelector<HTMLElement>(SELECTED_ROW);\n if (!row) {\n return false;\n }\n const listTop = list.getBoundingClientRect().top + list.clientTop;\n const { top, bottom } = row.getBoundingClientRect();\n const rowTop = top - listTop + list.scrollTop;\n const rowBottom = bottom - listTop + list.scrollTop;\n if (rowTop < list.scrollTop) {\n list.scrollTop = rowTop;\n } else if (rowBottom > list.scrollTop + list.clientHeight) {\n list.scrollTop = rowBottom - list.clientHeight;\n }\n return true;\n};\n\nexport interface PopoverListProps {\n children: React.ReactNode;\n /**\n * Scrolls the list to its selected row (`aria-current`, `aria-selected` or a checked radio)\n * each time the popover is shown, once that row mounts. Only the list scrolls.\n */\n scrollToSelected?: boolean;\n}\n\nexport const PopoverList: React.FC<PopoverListProps> = ({ children, scrollToSelected = false }) => {\n const shown = useContext(PopoverShownContext);\n const listRef = useRef<HTMLDivElement>(null);\n\n // Before paint, so a shown panel never draws a frame at the top and then jumps.\n useLayoutEffect(() => {\n const list = listRef.current;\n if (!scrollToSelected || !shown || !list || scrollSelectedRowIntoView(list)) {\n return;\n }\n const observer = new MutationObserver(() => {\n if (scrollSelectedRowIntoView(list)) {\n observer.disconnect();\n }\n });\n observer.observe(list, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: SELECTION_ATTRIBUTES,\n });\n return () => observer.disconnect();\n }, [scrollToSelected, shown]);\n\n return (\n <div\n ref={listRef}\n className={`flex max-h-80 flex-col gap-[2px] overflow-y-auto p-2 ${NO_SCROLLBAR}`}\n >\n {children}\n </div>\n );\n};\n\nexport const PopoverSection = forwardRef<HTMLDivElement, { children: React.ReactNode }>(\n ({ children }, ref) => (\n <div ref={ref} className={`border-0 border-t border-solid ${BORDER} p-2`}>\n {children}\n </div>\n ),\n);\nPopoverSection.displayName = 'Popover.Section';\n\nexport const PopoverEmpty: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <div className=\"px-3 py-2 text-[length:var(--malachite-font-size-small,13px)] text-[var(--malachite-text-dimmed,rgb(161,161,161))] select-none\">\n {children}\n </div>\n);\n\nexport const PopoverSearch: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <div className=\"px-2 pt-2\">{children}</div>\n);\n\nexport const PopoverNote: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <div\n className={`border-0 border-t border-solid ${BORDER} px-5 py-3 text-[length:var(--malachite-font-size-xsmall,11px)] leading-4 text-[var(--malachite-text-secondary,rgb(123,123,123))]`}\n >\n {children}\n </div>\n);\n\nexport type PopoverStatusTone = 'default' | 'error';\n\nexport interface PopoverStatusAction {\n label: string;\n onClick: () => void;\n /** Shows the button's spinner and ignores clicks, e.g. while a retry is in flight. */\n pending?: boolean;\n}\n\nexport interface PopoverStatusProps {\n /**\n * What the panel is waiting on, or why it is empty. Clear it rather than unmount the part:\n * only a region already in the tree announces a new message.\n */\n message?: React.ReactNode;\n tone?: PopoverStatusTone;\n /** A button under the message that resolves it, such as Retry. Shown only with a message. */\n action?: PopoverStatusAction;\n /** Lets the region take focus from script (`tabIndex={-1}`), e.g. from `initialFocus`. */\n focusable?: boolean;\n}\n\nconst STATUS_TONE_TEXT: Record<PopoverStatusTone, string> = {\n default: 'text-[var(--malachite-text-secondary,rgb(123,123,123))]',\n error: 'text-[var(--malachite-text-error,rgb(237,53,54))]',\n};\n\nconst hasMessage = (message: React.ReactNode): boolean =>\n message !== undefined && message !== null && message !== false && message !== '';\n\nexport const PopoverStatus = forwardRef<HTMLDivElement, PopoverStatusProps>(\n ({ message, tone = 'default', action, focusable = false }, ref) => {\n const shown = hasMessage(message);\n return (\n <>\n {/* Stays `status` while empty and for errors: a role or aria-hidden changed with the\n text is not reliably announced. No ring: a focus target, not a control. */}\n <div\n ref={ref}\n role=\"status\"\n tabIndex={focusable ? -1 : undefined}\n className={shown ? 'outline-none' : 'sr-only'}\n >\n {shown && (\n <div\n className={`px-3 py-2 text-[length:var(--malachite-font-size-small,13px)] ${STATUS_TONE_TEXT[tone]}`}\n >\n {message}\n </div>\n )}\n </div>\n {shown && action && (\n <div className=\"px-3 pb-2\">\n <Button\n variant=\"outline\"\n size=\"small\"\n loading={action.pending}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n </div>\n )}\n </>\n );\n },\n);\nPopoverStatus.displayName = 'Popover.Status';\n\nexport interface PopoverActionProps {\n icon: React.ReactNode;\n 'aria-label': string;\n onClick?: () => void;\n /** Renders a link; a plain click runs `onClick` instead of following it, when one is given. */\n href?: string;\n disabled?: boolean;\n tooltip?: string;\n}\n\nexport const PopoverAction: React.FC<PopoverActionProps> = ({\n icon,\n 'aria-label': ariaLabel,\n onClick,\n href: rawHref,\n disabled = false,\n tooltip,\n}) => {\n const href = disabled ? undefined : safeHref(rawHref);\n const className = `m-0 inline-flex size-5 items-center justify-center rounded-[var(--malachite-radius-sm,4px)] border-0 bg-transparent p-0 transition-colors duration-150 [&_svg]:size-3! ${disabled ? 'cursor-not-allowed text-[var(--malachite-text-placeholder,rgb(187,187,187))] opacity-50' : `cursor-pointer text-[var(--malachite-text-placeholder,rgb(187,187,187))] hover:bg-[var(--malachite-pillbutton-background,rgb(241,241,241))] hover:text-[var(--malachite-text-secondary,rgb(123,123,123))]`} ${FOCUS_RING_INSET}`;\n const button =\n href !== undefined ? (\n <a\n href={href}\n aria-label={ariaLabel}\n onClick={(event) => {\n if (isPlainClick(event) && onClick) {\n event.preventDefault();\n onClick();\n }\n }}\n className={`no-underline ${className}`}\n >\n {icon}\n </a>\n ) : (\n <button\n type=\"button\"\n aria-label={ariaLabel}\n aria-disabled={disabled || undefined}\n onClick={disabled ? undefined : onClick}\n className={className}\n >\n {icon}\n </button>\n );\n return tooltip ? <Tooltip text={tooltip}>{button}</Tooltip> : button;\n};\n"],"names":["PopoverHeader","title","action","divider","jsxs","BORDER","jsx","SELECTED_ROW","SELECTION_ATTRIBUTES","scrollSelectedRowIntoView","list","row","listTop","top","bottom","rowTop","rowBottom","PopoverList","children","scrollToSelected","shown","useContext","PopoverShownContext","listRef","useRef","useLayoutEffect","observer","NO_SCROLLBAR","PopoverSection","forwardRef","ref","PopoverEmpty","PopoverSearch","PopoverNote","STATUS_TONE_TEXT","hasMessage","message","PopoverStatus","tone","focusable","Fragment","Button","PopoverAction","icon","ariaLabel","onClick","rawHref","disabled","tooltip","href","safeHref","className","FOCUS_RING_INSET","button","event","isPlainClick","Tooltip"],"mappings":";;;;;;;;;AAgBO,MAAMA,IAA8C,CAAC,EAAE,OAAAC,GAAO,QAAAC,GAAQ,SAAAC,IAAU,SACnF,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,WAAW,8CAA8CD,IAAU,yBAAyBE,CAAM,eAAe,oBAAoB;AAAA,IAErI,UAAA;AAAA,MAAA,gBAAAC,EAAC,UAAM,UAAAL,EAAA,CAAM;AAAA,MACZC;AAAA,IAAA;AAAA,EAAA;AACL,GAGEK,IACF,kIACEC,IAAuB,CAAC,gBAAgB,iBAAiB,cAAc,GAGvEC,IAA4B,CAACC,MAA+B;AAC9D,QAAMC,I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ACZ,CACJ;AAAA,IAAA,GAER;AAAA,EAER;AACJ;AACAmC,EAAc,cAAc;AAYrB,MAAMK,IAA8C,CAAC;AAAA,EACxD,MAAAC;AAAA,EACA,cAAcC;AAAA,EACd,SAAAC;AAAA,EACA,MAAMC;AAAA,EACN,UAAAC,IAAW;AAAA,EACX,SAAAC;AACJ,MAAM;AACF,QAAMC,IAAOF,IAAW,SAAYG,EAASJ,CAAO,GAC9CK,IAAY,0KAA0KJ,IAAW,4FAA4F,2MAA2M,IAAIK,CAAgB,IAC5fC,IACFJ,MAAS,SACL,gBAAA3C;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,MAAA2C;AAAA,MACA,cAAYL;AAAA,MACZ,SAAS,CAACU,MAAU;AAChB,QAAIC,EAAaD,CAAK,KAAKT,MACvBS,EAAM,eAAA,GACNT,EAAA;AAAA,MAER;AAAA,MACA,WAAW,gBAAgBM,CAAS;AAAA,MAEnC,UAAAR;AAAA,IAAA;AAAA,EAAA,IAGL,gBAAArC;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,MAAK;AAAA,MACL,cAAYsC;AAAA,MACZ,iBAAeG,KAAY;AAAA,MAC3B,SAASA,IAAW,SAAYF;AAAA,MAChC,WAAAM;AAAA,MAEC,UAAAR;AAAA,IAAA;AAAA,EAAA;AAGb,SAAOK,IAAU,gBAAA1C,EAACkD,GAAA,EAAQ,MAAMR,GAAU,aAAO,IAAaK;AAClE;"}
1
+ {"version":3,"file":"PopoverParts.js","sources":["../../src/components/PopoverParts.tsx"],"sourcesContent":["import React, { forwardRef, useContext, useLayoutEffect, useRef } from 'react';\nimport Button from './Button';\nimport Tooltip from './Tooltip';\nimport { BORDER, NO_SCROLLBAR } from './chromeStyles';\nimport { FOCUS_RING_INSET } from './focusRing';\nimport { isPlainClick } from './linkClick';\nimport { PopoverShownContext } from './popoverTree';\nimport { safeHref } from './safeHref';\nimport { scrollRowIntoList } from './scrollRowIntoList';\n\nexport interface PopoverHeaderProps {\n title: string;\n action?: React.ReactNode;\n /** `false` drops the rule and sits the header 4px over the list. */\n divider?: boolean;\n}\n\nexport const PopoverHeader: React.FC<PopoverHeaderProps> = ({ title, action, divider = true }) => (\n <div\n className={`flex items-center justify-between border-0 ${divider ? `border-b border-solid ${BORDER} px-5 py-4` : 'px-5 pt-4 pb-[4px]'} text-[12px] leading-[15px] font-normal text-[var(--malachite-text-dimmed,rgb(161,161,161))]`}\n >\n <span>{title}</span>\n {action}\n </div>\n);\n\nconst SELECTED_ROW =\n '[aria-current]:not([aria-current=\"false\"]):not([aria-current=\"\"]), [aria-selected=\"true\"], [role=\"radio\"][aria-checked=\"true\"]';\nconst SELECTION_ATTRIBUTES = ['aria-current', 'aria-selected', 'aria-checked'];\n\n// Not `scrollIntoView`: that also scrolls every scrollable ancestor, the page included.\nconst scrollSelectedRowIntoView = (list: HTMLElement): boolean => {\n const row = list.querySelector<HTMLElement>(SELECTED_ROW);\n if (!row) {\n return false;\n }\n scrollRowIntoList(list, row);\n return true;\n};\n\nexport interface PopoverListProps {\n children: React.ReactNode;\n /**\n * Scrolls the list to its selected row (`aria-current`, `aria-selected` or a checked radio)\n * each time the popover is shown, once that row mounts. Only the list scrolls.\n */\n scrollToSelected?: boolean;\n}\n\nexport const PopoverList: React.FC<PopoverListProps> = ({ children, scrollToSelected = false }) => {\n const shown = useContext(PopoverShownContext);\n const listRef = useRef<HTMLDivElement>(null);\n\n // Before paint, so a shown panel never draws a frame at the top and then jumps.\n useLayoutEffect(() => {\n const list = listRef.current;\n if (!scrollToSelected || !shown || !list || scrollSelectedRowIntoView(list)) {\n return;\n }\n const observer = new MutationObserver(() => {\n if (scrollSelectedRowIntoView(list)) {\n observer.disconnect();\n }\n });\n observer.observe(list, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: SELECTION_ATTRIBUTES,\n });\n return () => observer.disconnect();\n }, [scrollToSelected, shown]);\n\n return (\n <div\n ref={listRef}\n className={`flex max-h-80 flex-col gap-[2px] overflow-y-auto p-2 ${NO_SCROLLBAR}`}\n >\n {children}\n </div>\n );\n};\n\nexport const PopoverSection = forwardRef<HTMLDivElement, { children: React.ReactNode }>(\n ({ children }, ref) => (\n <div ref={ref} className={`border-0 border-t border-solid ${BORDER} p-2`}>\n {children}\n </div>\n ),\n);\nPopoverSection.displayName = 'Popover.Section';\n\nexport const PopoverEmpty: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <div className=\"px-3 py-2 text-[length:var(--malachite-font-size-small,13px)] text-[var(--malachite-text-dimmed,rgb(161,161,161))] select-none\">\n {children}\n </div>\n);\n\nexport const PopoverSearch: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <div className=\"px-2 pt-2\">{children}</div>\n);\n\nexport const PopoverNote: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <div\n className={`border-0 border-t border-solid ${BORDER} px-5 py-3 text-[length:var(--malachite-font-size-xsmall,11px)] leading-4 text-[var(--malachite-text-secondary,rgb(123,123,123))]`}\n >\n {children}\n </div>\n);\n\nexport type PopoverStatusTone = 'default' | 'error';\n\nexport interface PopoverStatusAction {\n label: string;\n onClick: () => void;\n /** Shows the button's spinner and ignores clicks, e.g. while a retry is in flight. */\n pending?: boolean;\n}\n\nexport interface PopoverStatusProps {\n /**\n * What the panel is waiting on, or why it is empty. Clear it rather than unmount the part:\n * only a region already in the tree announces a new message.\n */\n message?: React.ReactNode;\n tone?: PopoverStatusTone;\n /** A button under the message that resolves it, such as Retry. Shown only with a message. */\n action?: PopoverStatusAction;\n /** Lets the region take focus from script (`tabIndex={-1}`), e.g. from `initialFocus`. */\n focusable?: boolean;\n}\n\nconst STATUS_TONE_TEXT: Record<PopoverStatusTone, string> = {\n default: 'text-[var(--malachite-text-secondary,rgb(123,123,123))]',\n error: 'text-[var(--malachite-text-error,rgb(237,53,54))]',\n};\n\nconst hasMessage = (message: React.ReactNode): boolean =>\n message !== undefined && message !== null && message !== false && message !== '';\n\nexport const PopoverStatus = forwardRef<HTMLDivElement, PopoverStatusProps>(\n ({ message, tone = 'default', action, focusable = false }, ref) => {\n const shown = hasMessage(message);\n return (\n <>\n {/* Stays `status` while empty and for errors: a role or aria-hidden changed with the\n text is not reliably announced. No ring: a focus target, not a control. */}\n <div\n ref={ref}\n role=\"status\"\n tabIndex={focusable ? -1 : undefined}\n className={shown ? 'outline-none' : 'sr-only'}\n >\n {shown && (\n <div\n className={`px-3 py-2 text-[length:var(--malachite-font-size-small,13px)] ${STATUS_TONE_TEXT[tone]}`}\n >\n {message}\n </div>\n )}\n </div>\n {shown && action && (\n <div className=\"px-3 pb-2\">\n <Button\n variant=\"outline\"\n size=\"small\"\n loading={action.pending}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n </div>\n )}\n </>\n );\n },\n);\nPopoverStatus.displayName = 'Popover.Status';\n\nexport interface PopoverActionProps {\n icon: React.ReactNode;\n 'aria-label': string;\n onClick?: () => void;\n /** Renders a link; a plain click runs `onClick` instead of following it, when one is given. */\n href?: string;\n disabled?: boolean;\n tooltip?: string;\n}\n\nexport const PopoverAction: React.FC<PopoverActionProps> = ({\n icon,\n 'aria-label': ariaLabel,\n onClick,\n href: rawHref,\n disabled = false,\n tooltip,\n}) => {\n const href = disabled ? undefined : safeHref(rawHref);\n const className = `m-0 inline-flex size-5 items-center justify-center rounded-[var(--malachite-radius-sm,4px)] border-0 bg-transparent p-0 transition-colors duration-150 [&_svg]:size-3! ${disabled ? 'cursor-not-allowed text-[var(--malachite-text-placeholder,rgb(187,187,187))] opacity-50' : `cursor-pointer text-[var(--malachite-text-placeholder,rgb(187,187,187))] hover:bg-[var(--malachite-pillbutton-background,rgb(241,241,241))] hover:text-[var(--malachite-text-secondary,rgb(123,123,123))]`} ${FOCUS_RING_INSET}`;\n const button =\n href !== undefined ? (\n <a\n href={href}\n aria-label={ariaLabel}\n onClick={(event) => {\n if (isPlainClick(event) && onClick) {\n event.preventDefault();\n onClick();\n }\n }}\n className={`no-underline ${className}`}\n >\n {icon}\n </a>\n ) : (\n <button\n type=\"button\"\n aria-label={ariaLabel}\n aria-disabled={disabled || undefined}\n onClick={disabled ? undefined : onClick}\n className={className}\n >\n {icon}\n </button>\n );\n return tooltip ? <Tooltip text={tooltip}>{button}</Tooltip> : button;\n};\n"],"names":["PopoverHeader","title","action","divider","jsxs","BORDER","jsx","SELECTED_ROW","SELECTION_ATTRIBUTES","scrollSelectedRowIntoView","list","row","scrollRowIntoList","PopoverList","children","scrollToSelected","shown","useContext","PopoverShownContext","listRef","useRef","useLayoutEffect","observer","NO_SCROLLBAR","PopoverSection","forwardRef","ref","PopoverEmpty","PopoverSearch","PopoverNote","STATUS_TONE_TEXT","hasMessage","message","PopoverStatus","tone","focusable","Fragment","Button","PopoverAction","icon","ariaLabel","onClick","rawHref","disabled","tooltip","href","safeHref","className","FOCUS_RING_INSET","button","event","isPlainClick","Tooltip"],"mappings":";;;;;;;;;;AAiBO,MAAMA,IAA8C,CAAC,EAAE,OAAAC,GAAO,QAAAC,GAAQ,SAAAC,IAAU,SACnF,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,WAAW,8CAA8CD,IAAU,yBAAyBE,CAAM,eAAe,oBAAoB;AAAA,IAErI,UAAA;AAAA,MAAA,gBAAAC,EAAC,UAAM,UAAAL,EAAA,CAAM;AAAA,MACZC;AAAA,IAAA;AAAA,EAAA;AACL,GAGEK,IACF,kIACEC,IAAuB,CAAC,gBAAgB,iBAAiB,cAAc,GAGvEC,IAA4B,CAACC,MAA+B;AAC9D,QAAMC,IAAMD,EAAK,cAA2BH,CAAY;AACxD,SAAKI,KAGLC,EAAkBF,GAAMC,CAAG,GACpB,MAHI;AAIf,GAWaE,IAA0C,CAAC,EAAE,UAAAC,GAAU,kBAAAC,IAAmB,SAAY;AAC/F,QAAMC,IAAQC,EAAWC,CAAmB,GACtCC,IAAUC,EAAuB,IAAI;AAG3C,SAAAC,EAAgB,MAAM;AAClB,UAAMX,IAAOS,EAAQ;AACrB,QAAI,CAACJ,KAAoB,CAACC,KAAS,CAACN,KAAQD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;AAAA,EAAA,IAGL,gBAAAjC;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,MAAK;AAAA,MACL,cAAYkC;AAAA,MACZ,iBAAeG,KAAY;AAAA,MAC3B,SAASA,IAAW,SAAYF;AAAA,MAChC,WAAAM;AAAA,MAEC,UAAAR;AAAA,IAAA;AAAA,EAAA;AAGb,SAAOK,IAAU,gBAAAtC,EAAC8C,GAAA,EAAQ,MAAMR,GAAU,aAAO,IAAaK;AAClE;"}
@@ -1,9 +1,9 @@
1
- import { jsxs as s, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
2
  import { useRef as j, useState as L, useLayoutEffect as z } from "react";
3
3
  import { Button as A } from "./Button.js";
4
4
  import R from "./CustomIcons/ArrowLeftIcon.js";
5
- import { GLASS_SURFACE_STYLE as B } from "./glassSurface.js";
6
- const E = {
5
+ import { GLASS_SURFACE_STYLE as _ } from "./glassSurface.js";
6
+ const B = {
7
7
  default: "px-6 pt-4 min-h-[var(--malachite-control-height-small,28px)]",
8
8
  large: "h-[60px] px-[28px] max-sm:h-[52px] max-sm:px-[16px]"
9
9
  }, F = ({
@@ -16,11 +16,11 @@ const E = {
16
16
  stepper: g,
17
17
  trailing: w,
18
18
  banner: r,
19
- header: t,
19
+ header: s,
20
20
  footer: l,
21
21
  footerGlass: N = !1,
22
- footerAlign: y = "full",
23
- center: b = !1,
22
+ footerAlign: b = "full",
23
+ center: y = !1,
24
24
  contentWidth: a = 480,
25
25
  minWidth: c,
26
26
  children: k,
@@ -37,18 +37,18 @@ const E = {
37
37
  m();
38
38
  const x = new ResizeObserver(m);
39
39
  return x.observe(i), () => x.disconnect();
40
- }, [l]), /* @__PURE__ */ s(
40
+ }, [l]), /* @__PURE__ */ t(
41
41
  "div",
42
42
  {
43
43
  className: `w-full h-screen flex flex-col overflow-hidden bg-[var(--malachite-card-sunken-background)] ${S}`,
44
44
  style: c ? { minWidth: `${c}px` } : void 0,
45
45
  children: [
46
- /* @__PURE__ */ s(
46
+ /* @__PURE__ */ t(
47
47
  "div",
48
48
  {
49
- className: `w-full shrink-0 flex items-center justify-between ${E[u]}`,
49
+ className: `w-full shrink-0 flex items-center justify-between ${B[u]}`,
50
50
  children: [
51
- /* @__PURE__ */ s("div", { className: "flex items-center gap-[16px] min-w-0", children: [
51
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-[16px] min-w-0", children: [
52
52
  p ? /* @__PURE__ */ e(
53
53
  A,
54
54
  {
@@ -64,7 +64,7 @@ const E = {
64
64
  ) : d ? /* @__PURE__ */ e("span", { className: "w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0" }) : null,
65
65
  v
66
66
  ] }),
67
- /* @__PURE__ */ s("div", { className: "flex items-center gap-[16px]", children: [
67
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-[16px]", children: [
68
68
  w ?? null,
69
69
  g ?? null
70
70
  ] })
@@ -72,19 +72,19 @@ const E = {
72
72
  }
73
73
  ),
74
74
  r ? /* @__PURE__ */ e("div", { className: "w-full shrink-0 px-[12px] pt-[12px]", children: r }) : null,
75
- t ? /* @__PURE__ */ e("div", { className: "w-full shrink-0 flex flex-col items-center px-6 pt-8", children: /* @__PURE__ */ e(
75
+ s ? /* @__PURE__ */ e("div", { className: "w-full shrink-0 flex flex-col items-center px-6 pt-8", children: /* @__PURE__ */ e(
76
76
  "div",
77
77
  {
78
78
  className: "w-full flex flex-col items-center gap-[24px]",
79
79
  style: { maxWidth: `${a}px` },
80
- children: t
80
+ children: s
81
81
  }
82
82
  ) }) : null,
83
- /* @__PURE__ */ s("div", { className: "relative flex-1 min-h-0", children: [
83
+ /* @__PURE__ */ t("div", { className: "relative flex-1 min-h-0", children: [
84
84
  /* @__PURE__ */ e(
85
85
  "div",
86
86
  {
87
- className: `absolute inset-0 overflow-y-auto flex flex-col items-center px-6 ${b ? "justify-center" : "justify-start"}`,
87
+ className: `absolute inset-0 overflow-y-auto [scrollbar-gutter:stable_both-edges] flex flex-col items-center px-6 ${y ? "justify-center" : "justify-start"}`,
88
88
  style: {
89
89
  // Reserve the overlaid footer's height plus a gap, so the last item
90
90
  // clears the footer with breathing room (not flush against it, which
@@ -99,7 +99,7 @@ const E = {
99
99
  maxWidth: `${a}px`,
100
100
  // Top padding lives on the scrolling content — NOT the scrollport —
101
101
  // so a `position: sticky` child pins flush to the top with no gap.
102
- paddingTop: t ? "32px" : "48px"
102
+ paddingTop: s ? "32px" : "48px"
103
103
  },
104
104
  children: k
105
105
  }
@@ -111,8 +111,8 @@ const E = {
111
111
  {
112
112
  ref: n,
113
113
  className: "absolute inset-x-0 bottom-0 z-20",
114
- style: N ? B : void 0,
115
- children: y === "content" ? /* @__PURE__ */ e("div", { className: "flex justify-center px-6 pt-4 pb-3", children: /* @__PURE__ */ e("div", { className: "w-full", style: { maxWidth: `${a}px` }, children: l }) }) : l
114
+ style: N ? _ : void 0,
115
+ children: b === "content" ? /* @__PURE__ */ e("div", { className: "flex justify-center px-6 pt-4 pb-3", children: /* @__PURE__ */ e("div", { className: "w-full", style: { maxWidth: `${a}px` }, children: l }) }) : l
116
116
  }
117
117
  ) : null
118
118
  ] })
@@ -1 +1 @@
1
- {"version":3,"file":"WizardLayout.js","sources":["../../src/components/WizardLayout.tsx"],"sourcesContent":["import React, { useLayoutEffect, useRef, useState } from 'react';\nimport Button from './Button';\nimport ArrowLeftIcon from './CustomIcons/ArrowLeftIcon';\nimport { GLASS_SURFACE_STYLE } from './glassSurface';\n\nexport interface WizardLayoutProps {\n /** Renders the outline back button in the top-left slot. */\n showBack?: boolean;\n onBack?: () => void;\n backDisabled?: boolean;\n /** `false` drops the hidden back button's square, so `leading` sits at the same inset as `trailing`. */\n reserveBack?: boolean;\n /** `large`: a 60px bar with 28px insets (52px and 16px below 640px), items centred. */\n topBarSize?: 'default' | 'large';\n /** Top-left slot beside the back button — e.g. a user avatar menu. */\n leading?: React.ReactNode;\n /** Right top-bar slot (sits just before `stepper`) — e.g. a theme toggle. */\n stepper?: React.ReactNode;\n /** Far-right top-bar slot — e.g. a theme toggle. */\n trailing?: React.ReactNode;\n /** A page-wide notice under the top bar, above `header`. */\n banner?: React.ReactNode;\n /**\n * Pinned below the top bar and always visible while the content scrolls —\n * e.g. connection logos + a step title. Rendered in the same centred column\n * as the content (`contentWidth`).\n */\n header?: React.ReactNode;\n /** Pinned to the bottom of the screen — typically a <FooterNav /> or a primary CTA. */\n footer?: React.ReactNode;\n /**\n * Give the pinned footer a frosted-glass treatment (translucent background +\n * backdrop blur) so scrolling content shows through it. The footer already sits\n * above sticky body content, so it reads as glass over the scrolling list.\n */\n footerGlass?: boolean;\n /** `content` holds the footer to the content column, so a full-width action lines up with the list. */\n footerAlign?: 'full' | 'content';\n /** Vertically centre the content (used for terminal/success screens). */\n center?: boolean;\n /** Max width of the centered content column. */\n contentWidth?: number;\n /** Minimum width of the whole layout, below which it scrolls horizontally. */\n minWidth?: number;\n children?: React.ReactNode;\n className?: string;\n}\n\nconst TOP_BAR_CLASSES: Record<NonNullable<WizardLayoutProps['topBarSize']>, string> = {\n default: 'px-6 pt-4 min-h-[var(--malachite-control-height-small,28px)]',\n large: 'h-[60px] px-[28px] max-sm:h-[52px] max-sm:px-[16px]',\n};\n\nconst WizardLayout: React.FC<WizardLayoutProps> = ({\n showBack = false,\n onBack,\n backDisabled = false,\n reserveBack = true,\n topBarSize = 'default',\n leading,\n stepper,\n trailing,\n banner,\n header,\n footer,\n footerGlass = false,\n footerAlign = 'full',\n center = false,\n contentWidth = 480,\n minWidth,\n children,\n className = '',\n}) => {\n // The footer overlays the bottom of the scroll area (so content can glass under\n // it). Measure it so the scroll content reserves matching bottom space and the\n // last item is never hidden behind it.\n const footerRef = useRef<HTMLDivElement>(null);\n const [footerHeight, setFooterHeight] = useState(0);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: re-run when the footer node mounts/unmounts so the observer attaches to the current element.\n useLayoutEffect(() => {\n const el = footerRef.current;\n if (!el) {\n setFooterHeight(0);\n return;\n }\n const update = () => setFooterHeight(el.offsetHeight);\n update();\n const observer = new ResizeObserver(update);\n observer.observe(el);\n return () => observer.disconnect();\n }, [footer]);\n\n return (\n <div\n className={`w-full h-screen flex flex-col overflow-hidden bg-[var(--malachite-card-sunken-background)] ${className}`}\n style={minWidth ? { minWidth: `${minWidth}px` } : undefined}\n >\n <div\n className={`w-full shrink-0 flex items-center justify-between ${TOP_BAR_CLASSES[topBarSize]}`}\n >\n <div className=\"flex items-center gap-[16px] min-w-0\">\n {showBack ? (\n <Button\n variant=\"outline\"\n size=\"small\"\n iconOnly\n icon={<ArrowLeftIcon size={14} />}\n disabled={backDisabled}\n onClick={onBack}\n aria-label=\"Back\"\n className=\"w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0\"\n />\n ) : reserveBack ? (\n <span className=\"w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0\" />\n ) : null}\n {leading}\n </div>\n <div className=\"flex items-center gap-[16px]\">\n {trailing ?? null}\n {stepper ?? null}\n </div>\n </div>\n\n {banner ? <div className=\"w-full shrink-0 px-[12px] pt-[12px]\">{banner}</div> : null}\n\n {header ? (\n <div className=\"w-full shrink-0 flex flex-col items-center px-6 pt-8\">\n <div\n className=\"w-full flex flex-col items-center gap-[24px]\"\n style={{ maxWidth: `${contentWidth}px` }}\n >\n {header}\n </div>\n </div>\n ) : null}\n\n <div className=\"relative flex-1 min-h-0\">\n <div\n className={`absolute inset-0 overflow-y-auto flex flex-col items-center px-6 ${\n center ? 'justify-center' : 'justify-start'\n }`}\n style={{\n // Reserve the overlaid footer's height plus a gap, so the last item\n // clears the footer with breathing room (not flush against it, which\n // reads as hidden content continuing underneath).\n paddingBottom: footer ? `${footerHeight + 24}px` : '48px',\n }}\n >\n <div\n className=\"w-full flex flex-col items-center gap-[40px]\"\n style={{\n maxWidth: `${contentWidth}px`,\n // Top padding lives on the scrolling content — NOT the scrollport —\n // so a `position: sticky` child pins flush to the top with no gap.\n paddingTop: header ? '32px' : '48px',\n }}\n >\n {children}\n </div>\n </div>\n\n {footer ? (\n <div\n ref={footerRef}\n // z-20 keeps the pinned footer above sticky body content (e.g. a\n // sticky Accordion header at z-10) so it can't paint over the footer.\n className=\"absolute inset-x-0 bottom-0 z-20\"\n style={footerGlass ? GLASS_SURFACE_STYLE : undefined}\n >\n {footerAlign === 'content' ? (\n <div className=\"flex justify-center px-6 pt-4 pb-3\">\n <div className=\"w-full\" style={{ maxWidth: `${contentWidth}px` }}>\n {footer}\n </div>\n </div>\n ) : (\n footer\n )}\n </div>\n ) : null}\n </div>\n </div>\n );\n};\n\nexport default WizardLayout;\nexport { WizardLayout };\n"],"names":["TOP_BAR_CLASSES","WizardLayout","showBack","onBack","backDisabled","reserveBack","topBarSize","leading","stepper","trailing","banner","header","footer","footerGlass","footerAlign","center","contentWidth","minWidth","children","className","footerRef","useRef","footerHeight","setFooterHeight","useState","useLayoutEffect","el","update","observer","jsxs","jsx","Button","ArrowLeftIcon","GLASS_SURFACE_STYLE"],"mappings":";;;;;AAgDA,MAAMA,IAAgF;AAAA,EAClF,SAAS;AAAA,EACT,OAAO;AACX,GAEMC,IAA4C,CAAC;AAAA,EAC/C,UAAAC,IAAW;AAAA,EACX,QAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,aAAAC,IAAc;AAAA,EACd,YAAAC,IAAa;AAAA,EACb,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,cAAAC,IAAe;AAAA,EACf,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAChB,MAAM;AAIF,QAAMC,IAAYC,EAAuB,IAAI,GACvC,CAACC,GAAcC,CAAe,IAAIC,EAAS,CAAC;AAGlD,SAAAC,E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E/EnB,IACG,gBAAAmB,EAAC,OAAA,EAAI,WAAU,wDACX,UAAA,gBAAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,WAAU;AAAA,YACV,OAAO,EAAE,UAAU,GAAGd,CAAY,KAAA;AAAA,YAEjC,UAAAL;AAAA,UAAA;AAAA,QAAA,GAET,IACA;AAAA,QAEJ,gBAAAkB,EAAC,OAAA,EAAI,WAAU,2BACX,UAAA;AAAA,UAAA,gBAAAC;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,WAAW,oEACPf,IAAS,mBAAmB,eAChC;AAAA,cACA,OAAO;AAAA;AAAA;AAAA;AAAA,gBAIH,eAAeH,IAAS,GAAGU,IAAe,EAAE,OAAO;AAAA,cAAA;AAAA,cAGvD,UAAA,gBAAAQ;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACG,WAAU;AAAA,kBACV,OAAO;AAAA,oBACH,UAAU,GAAGd,CAAY;AAAA;AAAA;AAAA,oBAGzB,YAAYL,IAAS,SAAS;AAAA,kBAAA;AAAA,kBAGjC,UAAAO;AAAA,gBAAA;AAAA,cAAA;AAAA,YACL;AAAA,UAAA;AAAA,UAGHN,IACG,gBAAAkB;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,KAAKV;AAAA,cAGL,WAAU;AAAA,cACV,OAAOP,IAAcoB,IAAsB;AAAA,cAE1C,gBAAgB,YACb,gBAAAH,EAAC,SAAI,WAAU,sCACX,4BAAC,OAAA,EAAI,WAAU,UAAS,OAAO,EAAE,UAAU,GAAGd,CAAY,QACrD,UAAAJ,EAAA,CACL,GACJ,IAEAA;AAAA,YAAA;AAAA,UAAA,IAGR;AAAA,QAAA,EAAA,CACR;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
1
+ {"version":3,"file":"WizardLayout.js","sources":["../../src/components/WizardLayout.tsx"],"sourcesContent":["import React, { useLayoutEffect, useRef, useState } from 'react';\nimport Button from './Button';\nimport ArrowLeftIcon from './CustomIcons/ArrowLeftIcon';\nimport { GLASS_SURFACE_STYLE } from './glassSurface';\n\nexport interface WizardLayoutProps {\n /** Renders the outline back button in the top-left slot. */\n showBack?: boolean;\n onBack?: () => void;\n backDisabled?: boolean;\n /** `false` drops the hidden back button's square, so `leading` sits at the same inset as `trailing`. */\n reserveBack?: boolean;\n /** `large`: a 60px bar with 28px insets (52px and 16px below 640px), items centred. */\n topBarSize?: 'default' | 'large';\n /** Top-left slot beside the back button — e.g. a user avatar menu. */\n leading?: React.ReactNode;\n /** Right top-bar slot (sits just before `stepper`) — e.g. a theme toggle. */\n stepper?: React.ReactNode;\n /** Far-right top-bar slot — e.g. a theme toggle. */\n trailing?: React.ReactNode;\n /** A page-wide notice under the top bar, above `header`. */\n banner?: React.ReactNode;\n /**\n * Pinned below the top bar and always visible while the content scrolls —\n * e.g. connection logos + a step title. Rendered in the same centred column\n * as the content (`contentWidth`).\n */\n header?: React.ReactNode;\n /** Pinned to the bottom of the screen — typically a <FooterNav /> or a primary CTA. */\n footer?: React.ReactNode;\n /**\n * Give the pinned footer a frosted-glass treatment (translucent background +\n * backdrop blur) so scrolling content shows through it. The footer already sits\n * above sticky body content, so it reads as glass over the scrolling list.\n */\n footerGlass?: boolean;\n /** `content` holds the footer to the content column, so a full-width action lines up with the list. */\n footerAlign?: 'full' | 'content';\n /** Vertically centre the content (used for terminal/success screens). */\n center?: boolean;\n /** Max width of the centered content column. */\n contentWidth?: number;\n /** Minimum width of the whole layout, below which it scrolls horizontally. */\n minWidth?: number;\n children?: React.ReactNode;\n className?: string;\n}\n\nconst TOP_BAR_CLASSES: Record<NonNullable<WizardLayoutProps['topBarSize']>, string> = {\n default: 'px-6 pt-4 min-h-[var(--malachite-control-height-small,28px)]',\n large: 'h-[60px] px-[28px] max-sm:h-[52px] max-sm:px-[16px]',\n};\n\nconst WizardLayout: React.FC<WizardLayoutProps> = ({\n showBack = false,\n onBack,\n backDisabled = false,\n reserveBack = true,\n topBarSize = 'default',\n leading,\n stepper,\n trailing,\n banner,\n header,\n footer,\n footerGlass = false,\n footerAlign = 'full',\n center = false,\n contentWidth = 480,\n minWidth,\n children,\n className = '',\n}) => {\n // The footer overlays the bottom of the scroll area (so content can glass under\n // it). Measure it so the scroll content reserves matching bottom space and the\n // last item is never hidden behind it.\n const footerRef = useRef<HTMLDivElement>(null);\n const [footerHeight, setFooterHeight] = useState(0);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: re-run when the footer node mounts/unmounts so the observer attaches to the current element.\n useLayoutEffect(() => {\n const el = footerRef.current;\n if (!el) {\n setFooterHeight(0);\n return;\n }\n const update = () => setFooterHeight(el.offsetHeight);\n update();\n const observer = new ResizeObserver(update);\n observer.observe(el);\n return () => observer.disconnect();\n }, [footer]);\n\n return (\n <div\n className={`w-full h-screen flex flex-col overflow-hidden bg-[var(--malachite-card-sunken-background)] ${className}`}\n style={minWidth ? { minWidth: `${minWidth}px` } : undefined}\n >\n <div\n className={`w-full shrink-0 flex items-center justify-between ${TOP_BAR_CLASSES[topBarSize]}`}\n >\n <div className=\"flex items-center gap-[16px] min-w-0\">\n {showBack ? (\n <Button\n variant=\"outline\"\n size=\"small\"\n iconOnly\n icon={<ArrowLeftIcon size={14} />}\n disabled={backDisabled}\n onClick={onBack}\n aria-label=\"Back\"\n className=\"w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0\"\n />\n ) : reserveBack ? (\n <span className=\"w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0\" />\n ) : null}\n {leading}\n </div>\n <div className=\"flex items-center gap-[16px]\">\n {trailing ?? null}\n {stepper ?? null}\n </div>\n </div>\n\n {banner ? <div className=\"w-full shrink-0 px-[12px] pt-[12px]\">{banner}</div> : null}\n\n {header ? (\n <div className=\"w-full shrink-0 flex flex-col items-center px-6 pt-8\">\n <div\n className=\"w-full flex flex-col items-center gap-[24px]\"\n style={{ maxWidth: `${contentWidth}px` }}\n >\n {header}\n </div>\n </div>\n ) : null}\n\n <div className=\"relative flex-1 min-h-0\">\n {/* The gutter is held on both edges so a classic scrollbar keeps the content\n centred on the page, in line with the pinned header and the overlaid footer. */}\n <div\n className={`absolute inset-0 overflow-y-auto [scrollbar-gutter:stable_both-edges] flex flex-col items-center px-6 ${\n center ? 'justify-center' : 'justify-start'\n }`}\n style={{\n // Reserve the overlaid footer's height plus a gap, so the last item\n // clears the footer with breathing room (not flush against it, which\n // reads as hidden content continuing underneath).\n paddingBottom: footer ? `${footerHeight + 24}px` : '48px',\n }}\n >\n <div\n className=\"w-full flex flex-col items-center gap-[40px]\"\n style={{\n maxWidth: `${contentWidth}px`,\n // Top padding lives on the scrolling content — NOT the scrollport —\n // so a `position: sticky` child pins flush to the top with no gap.\n paddingTop: header ? '32px' : '48px',\n }}\n >\n {children}\n </div>\n </div>\n\n {footer ? (\n <div\n ref={footerRef}\n // z-20 keeps the pinned footer above sticky body content (e.g. a\n // sticky Accordion header at z-10) so it can't paint over the footer.\n className=\"absolute inset-x-0 bottom-0 z-20\"\n style={footerGlass ? GLASS_SURFACE_STYLE : undefined}\n >\n {footerAlign === 'content' ? (\n <div className=\"flex justify-center px-6 pt-4 pb-3\">\n <div className=\"w-full\" style={{ maxWidth: `${contentWidth}px` }}>\n {footer}\n </div>\n </div>\n ) : (\n footer\n )}\n </div>\n ) : null}\n </div>\n </div>\n );\n};\n\nexport default WizardLayout;\nexport { WizardLayout };\n"],"names":["TOP_BAR_CLASSES","WizardLayout","showBack","onBack","backDisabled","reserveBack","topBarSize","leading","stepper","trailing","banner","header","footer","footerGlass","footerAlign","center","contentWidth","minWidth","children","className","footerRef","useRef","footerHeight","setFooterHeight","useState","useLayoutEffect","el","update","observer","jsxs","jsx","Button","ArrowLeftIcon","GLASS_SURFACE_STYLE"],"mappings":";;;;;AAgDA,MAAMA,IAAgF;AAAA,EAClF,SAAS;AAAA,EACT,OAAO;AACX,GAEMC,IAA4C,CAAC;AAAA,EAC/C,UAAAC,IAAW;AAAA,EACX,QAAAC;AAAA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U;AAAA,cACV,OAAOP,IAAcoB,IAAsB;AAAA,cAE1C,gBAAgB,YACb,gBAAAH,EAAC,SAAI,WAAU,sCACX,4BAAC,OAAA,EAAI,WAAU,UAAS,OAAO,EAAE,UAAU,GAAGd,CAAY,QACrD,UAAAJ,EAAA,CACL,GACJ,IAEAA;AAAA,YAAA;AAAA,UAAA,IAGR;AAAA,QAAA,EAAA,CACR;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
@@ -1,27 +1,41 @@
1
- const l = (o) => o ? [
2
- ...o.querySelectorAll(
3
- 'button[role="menuitem"]:not(:disabled), a[role="menuitem"]'
4
- )
5
- ] : [], s = (o, t) => {
6
- const n = l(o), r = (t === "last" ? n[n.length - 1] : n[0]) ?? o;
7
- r == null || r.focus({ preventScroll: !0 });
8
- }, c = (o, t) => ({
1
+ import { ITEM_CLASS as l } from "./actionMenuStyles.js";
2
+ import { scrollRowIntoList as n } from "./scrollRowIntoList.js";
3
+ const e = (o) => o ? [...o.querySelectorAll(`.${l}:not(:disabled)`)] : [], i = (o, t) => {
4
+ const r = e(o), c = (t === "last" ? r[r.length - 1] : r[0]) ?? o;
5
+ c == null || c.focus({ preventScroll: !0 });
6
+ }, h = (o, t) => {
7
+ const r = e(o).find((c) => c.getAttribute("aria-checked") === "true");
8
+ if (!r) {
9
+ i(o, t);
10
+ return;
11
+ }
12
+ r.focus({ preventScroll: !0 });
13
+ }, g = (o) => {
14
+ const t = e(o).find((r) => r.getAttribute("aria-checked") === "true");
15
+ o && t && n(o, t);
16
+ }, w = (o, t) => ({
9
17
  ArrowDown: "first",
10
18
  ArrowUp: t.startsWith("top") ? "last" : void 0,
11
19
  ArrowRight: t.startsWith("right") ? "first" : void 0
12
- })[o], g = (o, t, n) => {
13
- const r = o.indexOf(t), e = r === -1 ? o.length : r;
20
+ })[o], A = (o, t, r) => {
21
+ const c = o.indexOf(t), s = c === -1 ? o.length : c;
14
22
  return {
15
- ArrowDown: o[(r + 1) % o.length],
16
- ArrowUp: o[(e - 1 + o.length) % o.length],
23
+ ArrowDown: o[(c + 1) % o.length],
24
+ ArrowUp: o[(s - 1 + o.length) % o.length],
17
25
  Home: o[0],
18
26
  End: o[o.length - 1]
19
- }[n];
27
+ }[r];
28
+ }, a = (o) => {
29
+ const t = o == null ? void 0 : o.querySelector(":focus");
30
+ o && t && n(o, t);
20
31
  };
21
32
  export {
22
- c as edgeForTriggerKey,
23
- l as enabledItems,
24
- s as focusEdge,
25
- g as itemForMenuKey
33
+ w as edgeForTriggerKey,
34
+ e as enabledItems,
35
+ i as focusEdge,
36
+ h as focusOpeningItem,
37
+ A as itemForMenuKey,
38
+ g as scrollCheckedIntoView,
39
+ a as scrollFocusedIntoView
26
40
  };
27
41
  //# sourceMappingURL=actionMenuKeyboard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"actionMenuKeyboard.js","sources":["../../src/components/actionMenuKeyboard.ts"],"sourcesContent":["import type { ActionMenuPlacement } from './actionMenuTypes';\n\nexport type MenuEdge = 'first' | 'last';\n\nexport const enabledItems = (menu: HTMLElement | null): HTMLElement[] =>\n menu\n ? [\n ...menu.querySelectorAll<HTMLElement>(\n 'button[role=\"menuitem\"]:not(:disabled), a[role=\"menuitem\"]',\n ),\n ]\n : [];\n\nexport const focusEdge = (menu: HTMLElement | null, edge: MenuEdge): void => {\n const items = enabledItems(menu);\n const target = (edge === 'last' ? items[items.length - 1] : items[0]) ?? menu;\n target?.focus({ preventScroll: true });\n};\n\nexport const edgeForTriggerKey = (\n key: string,\n placement: ActionMenuPlacement,\n): MenuEdge | undefined =>\n ({\n ArrowDown: 'first',\n ArrowUp: placement.startsWith('top') ? 'last' : undefined,\n ArrowRight: placement.startsWith('right') ? 'first' : undefined,\n })[key] as MenuEdge | undefined;\n\nexport const itemForMenuKey = (\n items: HTMLElement[],\n current: EventTarget | null,\n key: string,\n): HTMLElement | undefined => {\n const index = items.indexOf(current as HTMLButtonElement);\n const from = index === -1 ? items.length : index;\n return {\n ArrowDown: items[(index + 1) % items.length],\n ArrowUp: items[(from - 1 + items.length) % items.length],\n Home: items[0],\n End: items[items.length - 1],\n }[key];\n};\n"],"names":["enabledItems","menu","focusEdge","edge","items","target","edgeForTriggerKey","key","placement","itemForMenuKey","current","index","from"],"mappings":"AAIO,MAAMA,IAAe,CAACC,MACzBA,IACM;AAAA,EACI,GAAGA,EAAK;AAAA,IACJ;AAAA,EAAA;AAER,IACA,CAAA,GAEGC,IAAY,CAACD,GAA0BE,MAAyB;AACzE,QAAMC,IAAQJ,EAAaC,CAAI,GACzBI,KAAUF,MAAS,SAASC,EAAMA,EAAM,SAAS,CAAC,IAAIA,EAAM,CAAC,MAAMH;AACzE,EAAAI,KAAA,QAAAA,EAAQ,MAAM,EAAE,eAAe,GAAA;AACnC,GAEaC,IAAoB,CAC7BC,GACAC,OAEC;AAAA,EACG,WAAW;AAAA,EACX,SAASA,EAAU,WAAW,KAAK,IAAI,SAAS;AAAA,EAChD,YAAYA,EAAU,WAAW,OAAO,IAAI,UAAU;AAC1D,GAAGD,CAAG,GAEGE,IAAiB,CAC1BL,GACAM,GACAH,MAC0B;AAC1B,QAAMI,IAAQP,EAAM,QAAQM,CAA4B,GAClDE,IAAOD,MAAU,KAAKP,EAAM,SAASO;AAC3C,SAAO;AAAA,IACH,WAAWP,GAAOO,IAAQ,KAAKP,EAAM,MAAM;AAAA,IAC3C,SAASA,GAAOQ,IAAO,IAAIR,EAAM,UAAUA,EAAM,MAAM;AAAA,IACvD,MAAMA,EAAM,CAAC;AAAA,IACb,KAAKA,EAAMA,EAAM,SAAS,CAAC;AAAA,EAAA,EAC7BG,CAAG;AACT;"}
1
+ {"version":3,"file":"actionMenuKeyboard.js","sources":["../../src/components/actionMenuKeyboard.ts"],"sourcesContent":["import { ITEM_CLASS } from './actionMenuStyles';\nimport type { ActionMenuPlacement } from './actionMenuTypes';\nimport { scrollRowIntoList } from './scrollRowIntoList';\n\nexport type MenuEdge = 'first' | 'last';\n\nexport const enabledItems = (menu: HTMLElement | null): HTMLElement[] =>\n menu ? [...menu.querySelectorAll<HTMLElement>(`.${ITEM_CLASS}:not(:disabled)`)] : [];\n\nexport const focusEdge = (menu: HTMLElement | null, edge: MenuEdge): void => {\n const items = enabledItems(menu);\n const target = (edge === 'last' ? items[items.length - 1] : items[0]) ?? menu;\n target?.focus({ preventScroll: true });\n};\n\nexport const focusOpeningItem = (menu: HTMLElement | null, edge: MenuEdge): void => {\n const checked = enabledItems(menu).find((item) => item.getAttribute('aria-checked') === 'true');\n if (!checked) {\n focusEdge(menu, edge);\n return;\n }\n checked.focus({ preventScroll: true });\n};\n\nexport const scrollCheckedIntoView = (menu: HTMLElement | null): void => {\n const checked = enabledItems(menu).find((item) => item.getAttribute('aria-checked') === 'true');\n if (menu && checked) {\n scrollRowIntoList(menu, checked);\n }\n};\n\nexport const edgeForTriggerKey = (\n key: string,\n placement: ActionMenuPlacement,\n): MenuEdge | undefined =>\n ({\n ArrowDown: 'first',\n ArrowUp: placement.startsWith('top') ? 'last' : undefined,\n ArrowRight: placement.startsWith('right') ? 'first' : undefined,\n })[key] as MenuEdge | undefined;\n\nexport const itemForMenuKey = (\n items: HTMLElement[],\n current: EventTarget | null,\n key: string,\n): HTMLElement | undefined => {\n const index = items.indexOf(current as HTMLButtonElement);\n const from = index === -1 ? items.length : index;\n return {\n ArrowDown: items[(index + 1) % items.length],\n ArrowUp: items[(from - 1 + items.length) % items.length],\n Home: items[0],\n End: items[items.length - 1],\n }[key];\n};\n\nexport const scrollFocusedIntoView = (menu: HTMLElement | null): void => {\n const focused = menu?.querySelector<HTMLElement>(':focus');\n if (menu && focused) {\n scrollRowIntoList(menu, focused);\n }\n};\n"],"names":["enabledItems","menu","ITEM_CLASS","focusEdge","edge","items","target","focusOpeningItem","checked","item","scrollCheckedIntoView","scrollRowIntoList","edgeForTriggerKey","key","placement","itemForMenuKey","current","index","from","scrollFocusedIntoView","focused"],"mappings":";;AAMO,MAAMA,IAAe,CAACC,MACzBA,IAAO,CAAC,G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