@stackone/malachite 2.44.0 → 2.45.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.
@@ -1,42 +1,43 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { useRef as u, useCallback as d } from "react";
3
- import f from "./Tooltip.js";
4
- const T = ({
5
- text: o,
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useRef as u, useCallback as f } from "react";
3
+ import h from "./Tooltip.js";
4
+ const m = {
5
+ display: "block",
6
+ width: "100%",
7
+ overflow: "hidden",
8
+ whiteSpace: "nowrap",
9
+ textOverflow: "ellipsis"
10
+ }, b = ({
11
+ text: r,
6
12
  children: l,
7
13
  delay: i = 0.5,
8
- placement: n = "top",
9
- className: s = "",
14
+ placement: s = "top",
15
+ className: n = "",
10
16
  triggerAs: a,
11
- describesTrigger: c
17
+ describesTrigger: c,
18
+ suppressed: d
12
19
  }) => {
13
- const r = u(null), p = d(() => {
14
- const e = r.current;
20
+ const t = u(null), p = f(() => {
21
+ const e = t.current;
15
22
  return !!e && e.scrollWidth > e.clientWidth;
16
23
  }, []);
17
- return /* @__PURE__ */ t(
18
- f,
24
+ return /* @__PURE__ */ o(
25
+ h,
19
26
  {
20
- text: o,
27
+ text: r,
21
28
  delay: i,
22
- placement: n,
29
+ placement: s,
23
30
  wrapChildren: !1,
24
31
  isShrinkable: !0,
25
32
  shouldShow: p,
26
33
  triggerAs: a,
27
34
  describesTrigger: c,
28
- children: /* @__PURE__ */ t(
29
- "span",
30
- {
31
- ref: r,
32
- className: `block w-full overflow-hidden whitespace-nowrap text-ellipsis ${s}`.trim(),
33
- children: l
34
- }
35
- )
35
+ suppressed: d,
36
+ children: /* @__PURE__ */ o("span", { ref: t, className: n || void 0, style: m, children: l })
36
37
  }
37
38
  );
38
39
  };
39
40
  export {
40
- T as default
41
+ b as default
41
42
  };
42
43
  //# sourceMappingURL=TruncatedTooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TruncatedTooltip.js","sources":["../../src/components/TruncatedTooltip.tsx"],"sourcesContent":["import React, { useCallback, useRef } from 'react';\nimport Tooltip from './Tooltip';\n\nexport interface TruncatedTooltipProps {\n text: React.ReactNode | string;\n children: React.ReactNode;\n delay?: number;\n placement?: 'top' | 'bottom' | 'left' | 'right';\n className?: string;\n /** `span` where the tooltip sits inside inline content. Defaults to `div`. */\n triggerAs?: 'div' | 'span';\n /** False when `text` repeats the children, which are already in the DOM in full. */\n describesTrigger?: boolean;\n}\n\n/**\n * TruncatedTooltip renders its children in a single-line truncating container\n * (overflow:hidden + text-overflow:ellipsis + white-space:nowrap) and surfaces\n * the malachite Tooltip only when the content is actually being cut off.\n *\n * Truncation is checked at interaction time (Tooltip's `shouldShow`), not at\n * mount: a mount-time measurement forces a synchronous layout per instance,\n * and in large tables those reads interleave with other components' DOM writes\n * — hundreds of full layout passes per mounted batch (the Safari row-mount\n * stalls of ENG-1168). The ellipsis itself is pure CSS and needs no JS.\n */\nconst TruncatedTooltip: React.FC<TruncatedTooltipProps> = ({\n text,\n children,\n delay = 0.5,\n placement = 'top',\n className = '',\n triggerAs,\n describesTrigger,\n}) => {\n const containerRef = useRef<HTMLSpanElement | null>(null);\n\n // One layout read, on the user's hover/focus — never on the mount path.\n const isTruncated = useCallback(() => {\n const el = containerRef.current;\n return !!el && el.scrollWidth > el.clientWidth;\n }, []);\n\n return (\n <Tooltip\n text={text}\n delay={delay}\n placement={placement}\n wrapChildren={false}\n isShrinkable\n shouldShow={isTruncated}\n triggerAs={triggerAs}\n describesTrigger={describesTrigger}\n >\n <span\n ref={containerRef}\n className={`block w-full overflow-hidden whitespace-nowrap text-ellipsis ${className}`.trim()}\n >\n {children}\n </span>\n </Tooltip>\n );\n};\n\nexport default TruncatedTooltip;\n"],"names":["TruncatedTooltip","text","children","delay","placement","className","triggerAs","describesTrigger","containerRef","useRef","isTruncated","useCallback","el","jsx","Tooltip"],"mappings":";;;AA0BA,MAAMA,IAAoD,CAAC;AAAA,EACvD,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAAA,EACZ,WAAAC;AAAA,EACA,kBAAAC;AACJ,MAAM;AACF,QAAMC,IAAeC,EAA+B,IAAI,GAGlDC,IAAcC,EAAY,MAAM;AAClC,UAAMC,IAAKJ,EAAa;AACxB,WAAO,CAAC,CAACI,KAAMA,EAAG,cAAcA,EAAG;AAAA,EACvC,GAAG,CAAA,CAAE;AAEL,SACI,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,MAAAb;AAAA,MACA,OAAAE;AAAA,MACA,WAAAC;AAAA,MACA,cAAc;AAAA,MACd,cAAY;AAAA,MACZ,YAAYM;AAAA,MACZ,WAAAJ;AAAA,MACA,kBAAAC;AAAA,MAEA,UAAA,gBAAAM;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,KAAKL;AAAA,UACL,WAAW,gEAAgEH,CAAS,GAAG,KAAA;AAAA,UAEtF,UAAAH;AAAA,QAAA;AAAA,MAAA;AAAA,IACL;AAAA,EAAA;AAGZ;"}
1
+ {"version":3,"file":"TruncatedTooltip.js","sources":["../../src/components/TruncatedTooltip.tsx"],"sourcesContent":["import React, { useCallback, useRef } from 'react';\nimport Tooltip from './Tooltip';\n\nexport interface TruncatedTooltipProps {\n text: React.ReactNode | string;\n children: React.ReactNode;\n delay?: number;\n placement?: 'top' | 'bottom' | 'left' | 'right';\n className?: string;\n /** `span` where the tooltip sits inside inline content. Defaults to `div`. */\n triggerAs?: 'div' | 'span';\n /** False when `text` repeats the children, which are already in the DOM in full. */\n describesTrigger?: boolean;\n /** Keeps the tooltip shut, e.g. while the control it sits in has its own popup open. */\n suppressed?: boolean;\n}\n\n// Inline: in a menu portaled outside the shadow root, utility classes would not apply.\nconst TRUNCATE_STYLE: React.CSSProperties = {\n display: 'block',\n width: '100%',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n};\n\n/**\n * TruncatedTooltip renders its children in a single-line truncating container\n * (overflow:hidden + text-overflow:ellipsis + white-space:nowrap) and surfaces\n * the malachite Tooltip only when the content is actually being cut off.\n *\n * Truncation is checked at interaction time (Tooltip's `shouldShow`), not at\n * mount: a mount-time measurement forces a synchronous layout per instance,\n * and in large tables those reads interleave with other components' DOM writes\n * — hundreds of full layout passes per mounted batch (the Safari row-mount\n * stalls of ENG-1168). The ellipsis itself is pure CSS and needs no JS.\n */\nconst TruncatedTooltip: React.FC<TruncatedTooltipProps> = ({\n text,\n children,\n delay = 0.5,\n placement = 'top',\n className = '',\n triggerAs,\n describesTrigger,\n suppressed,\n}) => {\n const containerRef = useRef<HTMLSpanElement | null>(null);\n\n // One layout read, on the user's hover/focus — never on the mount path.\n const isTruncated = useCallback(() => {\n const el = containerRef.current;\n return !!el && el.scrollWidth > el.clientWidth;\n }, []);\n\n return (\n <Tooltip\n text={text}\n delay={delay}\n placement={placement}\n wrapChildren={false}\n isShrinkable\n shouldShow={isTruncated}\n triggerAs={triggerAs}\n describesTrigger={describesTrigger}\n suppressed={suppressed}\n >\n <span ref={containerRef} className={className || undefined} style={TRUNCATE_STYLE}>\n {children}\n </span>\n </Tooltip>\n );\n};\n\nexport default TruncatedTooltip;\n"],"names":["TRUNCATE_STYLE","TruncatedTooltip","text","children","delay","placement","className","triggerAs","describesTrigger","suppressed","containerRef","useRef","isTruncated","useCallback","el","jsx","Tooltip"],"mappings":";;;AAkBA,MAAMA,IAAsC;AAAA,EACxC,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,cAAc;AAClB,GAaMC,IAAoD,CAAC;AAAA,EACvD,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAAA,EACZ,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC;AACJ,MAAM;AACF,QAAMC,IAAeC,EAA+B,IAAI,GAGlDC,IAAcC,EAAY,MAAM;AAClC,UAAMC,IAAKJ,EAAa;AACxB,WAAO,CAAC,CAACI,KAAMA,EAAG,cAAcA,EAAG;AAAA,EACvC,GAAG,CAAA,CAAE;AAEL,SACI,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,MAAAd;AAAA,MACA,OAAAE;AAAA,MACA,WAAAC;AAAA,MACA,cAAc;AAAA,MACd,cAAY;AAAA,MACZ,YAAYO;AAAA,MACZ,WAAAL;AAAA,MACA,kBAAAC;AAAA,MACA,YAAAC;AAAA,MAEA,UAAA,gBAAAM,EAAC,UAAK,KAAKL,GAAc,WAAWJ,KAAa,QAAW,OAAON,GAC9D,UAAAG,EAAA,CACL;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
@@ -1,4 +1,8 @@
1
- const l = (o) => o ? [...o.querySelectorAll('button[role="menuitem"]:not(:disabled)')] : [], s = (o, t) => {
1
+ const l = (o) => o ? [
2
+ ...o.querySelectorAll(
3
+ 'button[role="menuitem"]:not(:disabled), a[role="menuitem"]'
4
+ )
5
+ ] : [], s = (o, t) => {
2
6
  const n = l(o), r = (t === "last" ? n[n.length - 1] : n[0]) ?? o;
3
7
  r == null || r.focus({ preventScroll: !0 });
4
8
  }, c = (o, t) => ({
@@ -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): HTMLButtonElement[] =>\n menu\n ? [...menu.querySelectorAll<HTMLButtonElement>('button[role=\"menuitem\"]:not(:disabled)')]\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: HTMLButtonElement[],\n current: EventTarget | null,\n key: string,\n): HTMLButtonElement | 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,CAAC,GAAGA,EAAK,iBAAoC,wCAAwC,CAAC,IACtF,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,MACgC;AAChC,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 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;"}
@@ -20,28 +20,28 @@ const y = {
20
20
  overflow: "hidden",
21
21
  textOverflow: "ellipsis",
22
22
  whiteSpace: "nowrap"
23
- }, h = { display: "inline-flex", flexShrink: 0 }, R = {
24
- ...h,
23
+ }, g = { display: "inline-flex", flexShrink: 0 }, R = {
24
+ ...g,
25
25
  color: "var(--malachite-text-dimmed, rgb(161, 161, 161))"
26
- }, n = "malachite-actionmenu-item-icon", a = "malachite-actionmenu-item", g = "data-malachite-actionmenu-tag", w = { display: "inline-flex", flexShrink: 0 }, I = { [g]: "" }, x = [
26
+ }, n = "malachite-actionmenu-item-icon", a = "malachite-actionmenu-item", h = "data-malachite-actionmenu-tag", w = { display: "inline-flex", flexShrink: 0 }, I = { [h]: "" }, x = [
27
27
  `.${a} { background: transparent; }`,
28
28
  `.${a}:not(:disabled):hover { background: var(--malachite-card-dimmed-background, rgb(247, 247, 247)); }`,
29
29
  `.${a}:focus-visible { outline: 2px solid var(--malachite-text-primary, rgb(10, 10, 10)); outline-offset: -2px; }`
30
- ], t = `.${a}[data-danger="hover"]`, c = `${t}:not(:disabled):is(:hover, :focus-visible)`, v = [
30
+ ], t = `.${a}[data-danger="hover"]`, c = `${t}:not(:disabled):is(:hover, :focus-visible)`, b = [
31
31
  `${t} { color: var(--malachite-text-primary, rgb(10, 10, 10)); }`,
32
32
  `${t}[data-tone="muted"] { color: var(--malachite-text-secondary, rgb(123, 123, 123)); }`,
33
33
  `${t} > .${n} { color: var(--malachite-text-dimmed, rgb(161, 161, 161)); }`,
34
34
  `${t}[aria-current] { color: ${d}; background: ${i}; }`,
35
35
  `${c} { color: var(--malachite-text-destructive, rgb(237, 53, 54)); background: var(--malachite-error-background-glass, rgba(197, 63, 63, 0.08)); }`,
36
36
  `${c} > .${n} { color: inherit; }`
37
- ], b = () => l("malachite-actionmenu-danger-hover-styles", v), A = () => (s(), b(), l("malachite-actionmenu-item-styles", x)), f = {
37
+ ], v = () => l("malachite-actionmenu-danger-hover-styles", b), A = () => (s(), v(), l("malachite-actionmenu-item-styles", x)), S = {
38
38
  default: "var(--malachite-text-primary, rgb(10, 10, 10))",
39
39
  muted: "var(--malachite-text-secondary, rgb(123, 123, 123))"
40
- }, E = (e, o) => {
40
+ }, f = (e, o) => {
41
41
  if (e.danger === !0)
42
42
  return "var(--malachite-text-destructive, rgb(237, 53, 54))";
43
43
  if (e.danger !== "hover")
44
- return e.current ? d : f[o];
44
+ return e.current ? d : S[o];
45
45
  }, $ = (e, o = "default") => e.type === "text" ? u : e.type === "divider" ? {
46
46
  height: 1,
47
47
  background: "var(--malachite-card-border, rgb(232, 232, 232))",
@@ -54,7 +54,7 @@ const y = {
54
54
  borderRadius: 8,
55
55
  fontSize: "var(--malachite-font-size-small, 13px)",
56
56
  fontWeight: 400,
57
- color: E(e, o),
57
+ color: f(e, o),
58
58
  background: e.current && e.danger !== "hover" ? i : void 0,
59
59
  cursor: e.disabled ? "not-allowed" : "pointer",
60
60
  opacity: e.disabled ? 0.5 : 1,
@@ -63,6 +63,8 @@ const y = {
63
63
  overflow: "hidden",
64
64
  border: "none",
65
65
  textAlign: "left",
66
+ textDecoration: "none",
67
+ boxSizing: "border-box",
66
68
  width: "100%"
67
69
  }, L = (e) => ({
68
70
  position: "fixed",
@@ -86,16 +88,16 @@ export {
86
88
  m as EMPTY_ITEM_STYLE,
87
89
  a as ITEM_CLASS,
88
90
  n as ITEM_ICON_CLASS,
89
- h as ITEM_ICON_LAYOUT,
91
+ g as ITEM_ICON_LAYOUT,
90
92
  R as ITEM_ICON_STYLE,
91
93
  O as LABEL_STYLE,
92
- g as TAG_HOST_ATTR,
94
+ h as TAG_HOST_ATTR,
93
95
  I as TAG_HOST_PROPS,
94
96
  w as TAG_HOST_STYLE,
95
97
  u as TEXT_ITEM_STYLE,
96
98
  y as TRIGGER_SIZES,
97
99
  A as ensureActionMenuStyles,
98
- b as ensureDangerOnHoverStyles,
100
+ v as ensureDangerOnHoverStyles,
99
101
  $ as itemStyle,
100
102
  L as menuStyle
101
103
  };
@@ -1 +1 @@
1
- {"version":3,"file":"actionMenuStyles.js","sources":["../../src/components/actionMenuStyles.ts"],"sourcesContent":["import type React from 'react';\nimport type { ActionMenuItem } from './actionMenuTypes';\nimport { MENU_SPECS, type MenuGeometry } from './floatingMenuGeometry';\nimport { injectStyleSheet } from './injectStyleSheet';\nimport { ensureOverlayStyles } from './portalOverlay';\nimport { SELECTED_ROW_BACKGROUND, SELECTED_ROW_FOREGROUND } from './selectedRow';\n\nexport const TRIGGER_SIZES: Record<'small' | 'xsmall', { icon: number; iconBox: string }> = {\n small: { icon: 16, iconBox: 'text-[16px] [&_svg]:size-[16px]!' },\n xsmall: { icon: 11, iconBox: 'text-[11px] [&_svg]:size-[11px]!' },\n};\n\nexport const LABEL_STYLE: React.CSSProperties = {\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n};\n\nexport const EMPTY_ITEM_STYLE: React.CSSProperties = {\n padding: '6px 10px',\n fontSize: 'var(--malachite-font-size-small, 13px)',\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n userSelect: 'none',\n};\n\nexport const TEXT_ITEM_STYLE: React.CSSProperties = {\n ...EMPTY_ITEM_STYLE,\n color: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n};\n\nexport const ITEM_ICON_LAYOUT: React.CSSProperties = { display: 'inline-flex', flexShrink: 0 };\n\nexport const ITEM_ICON_STYLE: React.CSSProperties = {\n ...ITEM_ICON_LAYOUT,\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n};\n\nexport const ITEM_ICON_CLASS = 'malachite-actionmenu-item-icon';\n\nexport const ITEM_CLASS = 'malachite-actionmenu-item';\n\nexport const TAG_HOST_ATTR = 'data-malachite-actionmenu-tag' as const;\n\nexport const TAG_HOST_STYLE: React.CSSProperties = { display: 'inline-flex', flexShrink: 0 };\n\nexport const TAG_HOST_PROPS = { [TAG_HOST_ATTR]: '' };\n\nconst ITEM_RULES = [\n `.${ITEM_CLASS} { background: transparent; }`,\n `.${ITEM_CLASS}:not(:disabled):hover { background: var(--malachite-card-dimmed-background, rgb(247, 247, 247)); }`,\n `.${ITEM_CLASS}:focus-visible { outline: 2px solid var(--malachite-text-primary, rgb(10, 10, 10)); outline-offset: -2px; }`,\n];\n\nconst DANGER_ON_HOVER = `.${ITEM_CLASS}[data-danger=\"hover\"]`;\nconst DANGER_ON_HOVER_ACTIVE = `${DANGER_ON_HOVER}:not(:disabled):is(:hover, :focus-visible)`;\n\nconst DANGER_ON_HOVER_RULES = [\n `${DANGER_ON_HOVER} { color: var(--malachite-text-primary, rgb(10, 10, 10)); }`,\n `${DANGER_ON_HOVER}[data-tone=\"muted\"] { color: var(--malachite-text-secondary, rgb(123, 123, 123)); }`,\n `${DANGER_ON_HOVER} > .${ITEM_ICON_CLASS} { color: var(--malachite-text-dimmed, rgb(161, 161, 161)); }`,\n `${DANGER_ON_HOVER}[aria-current] { color: ${SELECTED_ROW_FOREGROUND}; background: ${SELECTED_ROW_BACKGROUND}; }`,\n `${DANGER_ON_HOVER_ACTIVE} { color: var(--malachite-text-destructive, rgb(237, 53, 54)); background: var(--malachite-error-background-glass, rgba(197, 63, 63, 0.08)); }`,\n `${DANGER_ON_HOVER_ACTIVE} > .${ITEM_ICON_CLASS} { color: inherit; }`,\n];\n\nexport const ensureDangerOnHoverStyles = (): CSSStyleSheet | null =>\n injectStyleSheet('malachite-actionmenu-danger-hover-styles', DANGER_ON_HOVER_RULES);\n\nexport const ensureActionMenuStyles = (): CSSStyleSheet | null => {\n ensureOverlayStyles();\n ensureDangerOnHoverStyles();\n return injectStyleSheet('malachite-actionmenu-item-styles', ITEM_RULES);\n};\n\nexport type ActionMenuTone = 'default' | 'muted';\n\nconst ITEM_TEXT: Record<ActionMenuTone, string> = {\n default: 'var(--malachite-text-primary, rgb(10, 10, 10))',\n muted: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n};\n\ntype ActionItem = Exclude<ActionMenuItem, { type: 'text' } | { type: 'divider' }>;\n\nconst actionItemColor = (item: ActionItem, tone: ActionMenuTone): string | undefined => {\n if (item.danger === true) {\n return 'var(--malachite-text-destructive, rgb(237, 53, 54))';\n }\n if (item.danger === 'hover') {\n return undefined;\n }\n if (item.current) {\n return SELECTED_ROW_FOREGROUND;\n }\n return ITEM_TEXT[tone];\n};\n\nexport const itemStyle = (\n item: ActionMenuItem,\n tone: ActionMenuTone = 'default',\n): React.CSSProperties => {\n if (item.type === 'text') {\n return TEXT_ITEM_STYLE;\n }\n if (item.type === 'divider') {\n return {\n height: 1,\n background: 'var(--malachite-card-border, rgb(232, 232, 232))',\n margin: '4px 0',\n };\n }\n return {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n padding: '6px 10px',\n borderRadius: 8,\n fontSize: 'var(--malachite-font-size-small, 13px)',\n fontWeight: 400,\n color: actionItemColor(item, tone),\n background: item.current && item.danger !== 'hover' ? SELECTED_ROW_BACKGROUND : undefined,\n cursor: item.disabled ? 'not-allowed' : 'pointer',\n opacity: item.disabled ? 0.5 : 1,\n userSelect: 'none',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n border: 'none',\n textAlign: 'left',\n width: '100%',\n };\n};\n\nexport const menuStyle = (position: MenuGeometry | null): React.CSSProperties => ({\n position: 'fixed',\n top: position?.top ?? 0,\n left: position?.left ?? 0,\n width: position?.width,\n maxHeight: position?.maxHeight,\n overflowY: 'auto',\n background: MENU_SPECS.options.background,\n border: MENU_SPECS.options.border,\n borderRadius: MENU_SPECS.options.radius,\n boxShadow: MENU_SPECS.options.shadow,\n padding: MENU_SPECS.options.padding,\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n visibility: position ? 'visible' : 'hidden',\n opacity: position ? 1 : 0,\n});\n"],"names":["TRIGGER_SIZES","LABEL_STYLE","EMPTY_ITEM_STYLE","TEXT_ITEM_STYLE","ITEM_ICON_LAYOUT","ITEM_ICON_STYLE","ITEM_ICON_CLASS","ITEM_CLASS","TAG_HOST_ATTR","TAG_HOST_STYLE","TAG_HOST_PROPS","ITEM_RULES","DANGER_ON_HOVER","DANGER_ON_HOVER_ACTIVE","DANGER_ON_HOVER_RULES","SELECTED_ROW_FOREGROUND","SELECTED_ROW_BACKGROUND","ensureDangerOnHoverStyles","injectStyleSheet","ensureActionMenuStyles","ensureOverlayStyles","ITEM_TEXT","actionItemColor","item","tone","itemStyle","menuStyle","position","MENU_SPECS"],"mappings":";;;;AAOO,MAAMA,IAA+E;AAAA,EACxF,OAAO,EAAE,MAAM,IAAI,SAAS,mCAAA;AAAA,EAC5B,QAAQ,EAAE,MAAM,IAAI,SAAS,mCAAA;AACjC,GAEaC,IAAmC;AAAA,EAC5C,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAClB,GAEaC,IAAwC;AAAA,EACjD,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AAAA,EACP,YAAY;AAChB,GAEaC,IAAuC;AAAA,EAChD,GAAGD;AAAA,EACH,OAAO;A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EACT,cAAc;AAAA,EACd,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,OAAOD,EAAgBC,GAAMC,CAAI;AAAA,EACjC,YAAYD,EAAK,WAAWA,EAAK,WAAW,UAAUP,IAA0B;AAAA,EAChF,QAAQO,EAAK,WAAW,gBAAgB;AAAA,EACxC,SAASA,EAAK,WAAW,MAAM;AAAA,EAC/B,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AAAA,GAIFG,IAAY,CAACC,OAAwD;AAAA,EAC9E,UAAU;AAAA,EACV,MAAKA,KAAA,gBAAAA,EAAU,QAAO;AAAA,EACtB,OAAMA,KAAA,gBAAAA,EAAU,SAAQ;AAAA,EACxB,OAAOA,KAAA,gBAAAA,EAAU;AAAA,EACjB,WAAWA,KAAA,gBAAAA,EAAU;AAAA,EACrB,WAAW;AAAA,EACX,YAAYC,EAAW,QAAQ;AAAA,EAC/B,QAAQA,EAAW,QAAQ;AAAA,EAC3B,cAAcA,EAAW,QAAQ;AAAA,EACjC,WAAWA,EAAW,QAAQ;AAAA,EAC9B,SAASA,EAAW,QAAQ;AAAA,EAC5B,SAAS;AAAA,EACT,eAAe;AAAA,EACf,KAAK;AAAA,EACL,YAAYD,IAAW,YAAY;AAAA,EACnC,SAASA,IAAW,IAAI;AAC5B;"}
1
+ {"version":3,"file":"actionMenuStyles.js","sources":["../../src/components/actionMenuStyles.ts"],"sourcesContent":["import type React from 'react';\nimport type { ActionMenuItem } from './actionMenuTypes';\nimport { MENU_SPECS, type MenuGeometry } from './floatingMenuGeometry';\nimport { injectStyleSheet } from './injectStyleSheet';\nimport { ensureOverlayStyles } from './portalOverlay';\nimport { SELECTED_ROW_BACKGROUND, SELECTED_ROW_FOREGROUND } from './selectedRow';\n\nexport const TRIGGER_SIZES: Record<'small' | 'xsmall', { icon: number; iconBox: string }> = {\n small: { icon: 16, iconBox: 'text-[16px] [&_svg]:size-[16px]!' },\n xsmall: { icon: 11, iconBox: 'text-[11px] [&_svg]:size-[11px]!' },\n};\n\nexport const LABEL_STYLE: React.CSSProperties = {\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n};\n\nexport const EMPTY_ITEM_STYLE: React.CSSProperties = {\n padding: '6px 10px',\n fontSize: 'var(--malachite-font-size-small, 13px)',\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n userSelect: 'none',\n};\n\nexport const TEXT_ITEM_STYLE: React.CSSProperties = {\n ...EMPTY_ITEM_STYLE,\n color: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n};\n\nexport const ITEM_ICON_LAYOUT: React.CSSProperties = { display: 'inline-flex', flexShrink: 0 };\n\nexport const ITEM_ICON_STYLE: React.CSSProperties = {\n ...ITEM_ICON_LAYOUT,\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n};\n\nexport const ITEM_ICON_CLASS = 'malachite-actionmenu-item-icon';\n\nexport const ITEM_CLASS = 'malachite-actionmenu-item';\n\nexport const TAG_HOST_ATTR = 'data-malachite-actionmenu-tag' as const;\n\nexport const TAG_HOST_STYLE: React.CSSProperties = { display: 'inline-flex', flexShrink: 0 };\n\nexport const TAG_HOST_PROPS = { [TAG_HOST_ATTR]: '' };\n\nconst ITEM_RULES = [\n `.${ITEM_CLASS} { background: transparent; }`,\n `.${ITEM_CLASS}:not(:disabled):hover { background: var(--malachite-card-dimmed-background, rgb(247, 247, 247)); }`,\n `.${ITEM_CLASS}:focus-visible { outline: 2px solid var(--malachite-text-primary, rgb(10, 10, 10)); outline-offset: -2px; }`,\n];\n\nconst DANGER_ON_HOVER = `.${ITEM_CLASS}[data-danger=\"hover\"]`;\nconst DANGER_ON_HOVER_ACTIVE = `${DANGER_ON_HOVER}:not(:disabled):is(:hover, :focus-visible)`;\n\nconst DANGER_ON_HOVER_RULES = [\n `${DANGER_ON_HOVER} { color: var(--malachite-text-primary, rgb(10, 10, 10)); }`,\n `${DANGER_ON_HOVER}[data-tone=\"muted\"] { color: var(--malachite-text-secondary, rgb(123, 123, 123)); }`,\n `${DANGER_ON_HOVER} > .${ITEM_ICON_CLASS} { color: var(--malachite-text-dimmed, rgb(161, 161, 161)); }`,\n `${DANGER_ON_HOVER}[aria-current] { color: ${SELECTED_ROW_FOREGROUND}; background: ${SELECTED_ROW_BACKGROUND}; }`,\n `${DANGER_ON_HOVER_ACTIVE} { color: var(--malachite-text-destructive, rgb(237, 53, 54)); background: var(--malachite-error-background-glass, rgba(197, 63, 63, 0.08)); }`,\n `${DANGER_ON_HOVER_ACTIVE} > .${ITEM_ICON_CLASS} { color: inherit; }`,\n];\n\nexport const ensureDangerOnHoverStyles = (): CSSStyleSheet | null =>\n injectStyleSheet('malachite-actionmenu-danger-hover-styles', DANGER_ON_HOVER_RULES);\n\nexport const ensureActionMenuStyles = (): CSSStyleSheet | null => {\n ensureOverlayStyles();\n ensureDangerOnHoverStyles();\n return injectStyleSheet('malachite-actionmenu-item-styles', ITEM_RULES);\n};\n\nexport type ActionMenuTone = 'default' | 'muted';\n\nconst ITEM_TEXT: Record<ActionMenuTone, string> = {\n default: 'var(--malachite-text-primary, rgb(10, 10, 10))',\n muted: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n};\n\ntype ActionItem = Exclude<ActionMenuItem, { type: 'text' } | { type: 'divider' }>;\n\nconst actionItemColor = (item: ActionItem, tone: ActionMenuTone): string | undefined => {\n if (item.danger === true) {\n return 'var(--malachite-text-destructive, rgb(237, 53, 54))';\n }\n if (item.danger === 'hover') {\n return undefined;\n }\n if (item.current) {\n return SELECTED_ROW_FOREGROUND;\n }\n return ITEM_TEXT[tone];\n};\n\nexport const itemStyle = (\n item: ActionMenuItem,\n tone: ActionMenuTone = 'default',\n): React.CSSProperties => {\n if (item.type === 'text') {\n return TEXT_ITEM_STYLE;\n }\n if (item.type === 'divider') {\n return {\n height: 1,\n background: 'var(--malachite-card-border, rgb(232, 232, 232))',\n margin: '4px 0',\n };\n }\n return {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n padding: '6px 10px',\n borderRadius: 8,\n fontSize: 'var(--malachite-font-size-small, 13px)',\n fontWeight: 400,\n color: actionItemColor(item, tone),\n background: item.current && item.danger !== 'hover' ? SELECTED_ROW_BACKGROUND : undefined,\n cursor: item.disabled ? 'not-allowed' : 'pointer',\n opacity: item.disabled ? 0.5 : 1,\n userSelect: 'none',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n border: 'none',\n textAlign: 'left',\n textDecoration: 'none',\n boxSizing: 'border-box',\n width: '100%',\n };\n};\n\nexport const menuStyle = (position: MenuGeometry | null): React.CSSProperties => ({\n position: 'fixed',\n top: position?.top ?? 0,\n left: position?.left ?? 0,\n width: position?.width,\n maxHeight: position?.maxHeight,\n overflowY: 'auto',\n background: MENU_SPECS.options.background,\n border: MENU_SPECS.options.border,\n borderRadius: MENU_SPECS.options.radius,\n boxShadow: MENU_SPECS.options.shadow,\n padding: MENU_SPECS.options.padding,\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n visibility: position ? 'visible' : 'hidden',\n opacity: position ? 1 : 0,\n});\n"],"names":["TRIGGER_SIZES","LABEL_STYLE","EMPTY_ITEM_STYLE","TEXT_ITEM_STYLE","ITEM_ICON_LAYOUT","ITEM_ICON_STYLE","ITEM_ICON_CLASS","ITEM_CLASS","TAG_HOST_ATTR","TAG_HOST_STYLE","TAG_HOST_PROPS","ITEM_RULES","DANGER_ON_HOVER","DANGER_ON_HOVER_ACTIVE","DANGER_ON_HOVER_RULES","SELECTED_ROW_FOREGROUND","SELECTED_ROW_BACKGROUND","ensureDangerOnHoverStyles","injectStyleSheet","ensureActionMenuStyles","ensureOverlayStyles","ITEM_TEXT","actionItemColor","item","tone","itemStyle","menuStyle","position","MENU_SPECS"],"mappings":";;;;AAOO,MAAMA,IAA+E;AAAA,EACxF,OAAO,EAAE,MAAM,IAAI,SAAS,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Key && !i.shiftKey && !i.altKey;
2
+ export {
3
+ l as isPlainClick
4
+ };
5
+ //# sourceMappingURL=linkClick.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linkClick.js","sources":["../../src/components/linkClick.ts"],"sourcesContent":["import type React from 'react';\n\nexport const isPlainClick = (event: React.MouseEvent): boolean =>\n event.button === 0 && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey;\n"],"names":["isPlainClick","event"],"mappings":"AAEO,MAAMA,IAAe,CAACC,MACzBA,EAAM,WAAW,KAAK,CAACA,EAAM,WAAW,CAACA,EAAM,WAAW,CAACA,EAAM,YAAY,CAACA,EAAM;"}
@@ -1,10 +1,11 @@
1
1
  import { useContext as e, createContext as o } from "react";
2
- const a = { expanded: 260, collapsed: 60 }, c = 244, l = 100, t = o({ collapsed: !1 }), n = () => e(t).collapsed;
2
+ const c = { expanded: 260, collapsed: 60 }, n = 244, _ = 100, a = 0.2, t = o({ collapsed: !1 }), l = () => e(t).collapsed;
3
3
  export {
4
- c as SIDEBAR_POPOVER_WIDTH_PX,
5
- a as SIDEBAR_WIDTH_PX,
6
- l as SIDEBAR_Z_INDEX,
4
+ n as SIDEBAR_POPOVER_WIDTH_PX,
5
+ a as SIDEBAR_TOOLTIP_DELAY_S,
6
+ c as SIDEBAR_WIDTH_PX,
7
+ _ as SIDEBAR_Z_INDEX,
7
8
  t as SidebarContext,
8
- n as useSidebarCollapsed
9
+ l as useSidebarCollapsed
9
10
  };
10
11
  //# sourceMappingURL=sidebarContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sidebarContext.js","sources":["../../src/components/sidebarContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport const SIDEBAR_WIDTH_PX = { expanded: 260, collapsed: 60 } as const;\n\nexport const SIDEBAR_POPOVER_WIDTH_PX = 244;\n\nexport const SIDEBAR_Z_INDEX = 100;\n\nexport const SidebarContext = createContext({ collapsed: false });\n\nexport const useSidebarCollapsed = (): boolean => useContext(SidebarContext).collapsed;\n"],"names":["SIDEBAR_WIDTH_PX","SIDEBAR_POPOVER_WIDTH_PX","SIDEBAR_Z_INDEX","SidebarContext","createContext","useSidebarCollapsed","useContext"],"mappings":";AAEO,MAAMA,IAAmB,EAAE,UAAU,KAAK,WAAW,GAAA,GAE/CC,IAA2B,KAE3BC,IAAkB,KAElBC,IAAiBC,EAAc,EAAE,WAAW,IAAO,GAEnDC,IAAsB,MAAeC,EAAWH,CAAc,EAAE;"}
1
+ {"version":3,"file":"sidebarContext.js","sources":["../../src/components/sidebarContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport const SIDEBAR_WIDTH_PX = { expanded: 260, collapsed: 60 } as const;\n\nexport const SIDEBAR_POPOVER_WIDTH_PX = 244;\n\nexport const SIDEBAR_Z_INDEX = 100;\n\nexport const SIDEBAR_TOOLTIP_DELAY_S = 0.2;\n\nexport const SidebarContext = createContext({ collapsed: false });\n\nexport const useSidebarCollapsed = (): boolean => useContext(SidebarContext).collapsed;\n"],"names":["SIDEBAR_WIDTH_PX","SIDEBAR_POPOVER_WIDTH_PX","SIDEBAR_Z_INDEX","SIDEBAR_TOOLTIP_DELAY_S","SidebarContext","createContext","useSidebarCollapsed","useContext"],"mappings":";AAEO,MAAMA,IAAmB,EAAE,UAAU,KAAK,WAAW,GAAA,GAE/CC,IAA2B,KAE3BC,IAAkB,KAElBC,IAA0B,KAE1BC,IAAiBC,EAAc,EAAE,WAAW,IAAO,GAEnDC,IAAsB,MAAeC,EAAWH,CAAc,EAAE;"}
package/dist/index.d.ts CHANGED
@@ -101,6 +101,8 @@ export declare type ActionMenuItem = {
101
101
  key: string;
102
102
  label: default_2.ReactNode;
103
103
  onClick?: () => void;
104
+ /** Renders a link; a plain click runs `onClick` instead of following it, when one is given. */
105
+ href?: string;
104
106
  disabled?: boolean;
105
107
  /** `'hover'` turns the item destructive only on hover or focus. */
106
108
  danger?: boolean | 'hover';
@@ -3606,6 +3608,8 @@ export declare interface PopoverActionProps {
3606
3608
  icon: default_2.ReactNode;
3607
3609
  'aria-label': string;
3608
3610
  onClick?: () => void;
3611
+ /** Renders a link; a plain click runs `onClick` instead of following it, when one is given. */
3612
+ href?: string;
3609
3613
  disabled?: boolean;
3610
3614
  tooltip?: string;
3611
3615
  }
@@ -4145,6 +4149,8 @@ export declare const Sidebar: default_2.FC<SidebarProps> & {
4145
4149
 
4146
4150
  export declare const SIDEBAR_POPOVER_WIDTH_PX = 244;
4147
4151
 
4152
+ export declare const SIDEBAR_TOOLTIP_DELAY_S = 0.2;
4153
+
4148
4154
  export declare const SIDEBAR_WIDTH_PX: {
4149
4155
  readonly expanded: 260;
4150
4156
  readonly collapsed: 60;
@@ -4154,8 +4160,8 @@ export declare interface SidebarAccountProps extends SidebarButtonAttributes {
4154
4160
  avatar?: default_2.ReactNode;
4155
4161
  initials?: string;
4156
4162
  name: string;
4157
- /** Collapsed-rail tooltip, a node so `name` can be wrapped (it renders outside the button);
4158
- * should read as `name`. Defaults to `name`, `false` hides it; none when `name` is empty. */
4163
+ /** Collapsed-rail tooltip, and expanded when `name` is cut off; a node so `name` can be wrapped.
4164
+ * Should read as `name`. Defaults to `name`, `false` hides it; none when `name` is empty. */
4159
4165
  tooltip?: default_2.ReactNode;
4160
4166
  }
4161
4167
 
@@ -4174,6 +4180,10 @@ export declare interface SidebarSwitcherProps extends SidebarButtonAttributes {
4174
4180
  logo: default_2.ReactNode;
4175
4181
  title: string;
4176
4182
  subtitle?: string;
4183
+ /** Shown when `title` is cut off; a node so it can be wrapped. Defaults to `title`. */
4184
+ titleTooltip?: default_2.ReactNode;
4185
+ /** As `titleTooltip`, for `subtitle`. */
4186
+ subtitleTooltip?: default_2.ReactNode;
4177
4187
  }
4178
4188
 
4179
4189
  /**
@@ -5002,6 +5012,8 @@ export declare interface TruncatedTooltipProps {
5002
5012
  triggerAs?: 'div' | 'span';
5003
5013
  /** False when `text` repeats the children, which are already in the DOM in full. */
5004
5014
  describesTrigger?: boolean;
5015
+ /** Keeps the tooltip shut, e.g. while the control it sits in has its own popup open. */
5016
+ suppressed?: boolean;
5005
5017
  }
5006
5018
 
5007
5019
  export declare const Typography: {