@stackone/malachite 2.94.0 → 2.95.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,53 +1,57 @@
1
- import { useState as p, useLayoutEffect as g } from "react";
2
- const f = 120, m = (t) => t.parentElement ?? t.getRootNode().host ?? null, w = (t) => {
1
+ import { useState as y, useLayoutEffect as p } from "react";
2
+ const g = 120, m = (t) => t.parentElement ?? t.getRootNode().host ?? null, B = (t) => {
3
3
  const { overflowY: e } = getComputedStyle(t);
4
4
  return e === "auto" || e === "scroll";
5
- }, h = (t) => {
5
+ }, f = (t) => {
6
6
  const e = [];
7
7
  let o = m(t);
8
8
  for (; o && o !== document.documentElement && o !== document.body; ) {
9
- if (e.push(o), w(o))
9
+ if (e.push(o), B(o))
10
10
  return { ancestors: e, scroller: o };
11
11
  o = m(o);
12
12
  }
13
13
  return { ancestors: e, scroller: null };
14
- }, a = (t) => Number.parseFloat(t) || 0, y = (t) => {
14
+ }, a = (t) => Number.parseFloat(t) || 0, R = (t) => {
15
15
  const e = Array.from((t.parentElement ?? t.getRootNode()).children);
16
16
  return e.slice(e.indexOf(t) + 1);
17
- }, B = (t, e) => y(t).flatMap((o) => {
17
+ }, F = (t, e) => R(t).flatMap((o) => {
18
18
  const { position: n, display: r, marginBottom: s } = getComputedStyle(o), c = o.getBoundingClientRect();
19
19
  return n !== "fixed" && n !== "absolute" && r !== "none" && c.top >= e - 1 ? [c.bottom + a(s)] : [];
20
- }), R = (t, e) => {
20
+ }), C = (t, e) => {
21
21
  let o = 0, n = t, r = m(n);
22
22
  for (; r && r !== document.documentElement; ) {
23
- const s = n.getBoundingClientRect(), c = s.bottom + a(getComputedStyle(n).marginBottom), i = getComputedStyle(r);
24
- if (o += Math.max(c, ...B(n, s.bottom)) - s.bottom + a(i.paddingBottom) + a(i.borderBottomWidth), r === e)
23
+ const s = n.getBoundingClientRect(), c = s.bottom + a(getComputedStyle(n).marginBottom), l = getComputedStyle(r);
24
+ if (o += Math.max(c, ...F(n, s.bottom)) - s.bottom + a(l.paddingBottom) + a(l.borderBottomWidth), r === e)
25
25
  break;
26
26
  n = r, r = m(n);
27
27
  }
28
28
  return o;
29
- }, F = (t, e) => {
30
- const o = t.getBoundingClientRect(), n = R(t, e);
29
+ }, w = (t, e) => {
30
+ const o = t.getBoundingClientRect(), n = C(t, e);
31
31
  return e ? e.getBoundingClientRect().top + e.clientTop + e.clientHeight - (o.top + e.scrollTop) - n : window.innerHeight - (o.top + window.scrollY) - n;
32
- }, E = (t, e) => {
33
- const [o, n] = p();
34
- return g(() => {
32
+ }, S = (t, e, o) => {
33
+ const [n, r] = y();
34
+ return p(() => {
35
+ if (e && t) {
36
+ const { scroller: s } = f(t);
37
+ r(Math.max(g, Math.floor(w(t, s))));
38
+ }
39
+ }, [t, e, o]), p(() => {
35
40
  if (!e || !t)
36
41
  return;
37
- const { ancestors: r, scroller: s } = h(t), c = () => n(Math.max(f, Math.floor(F(t, s))));
38
- c();
39
- let i = 0;
40
- const u = () => {
41
- cancelAnimationFrame(i), i = requestAnimationFrame(c);
42
- }, l = typeof ResizeObserver > "u" ? null : new ResizeObserver(u);
43
- for (const d of r)
44
- l == null || l.observe(d);
45
- return window.addEventListener("resize", u), () => {
46
- cancelAnimationFrame(i), l == null || l.disconnect(), window.removeEventListener("resize", u);
42
+ const { ancestors: s, scroller: c } = f(t), l = () => r(Math.max(g, Math.floor(w(t, c))));
43
+ let u = 0;
44
+ const d = () => {
45
+ cancelAnimationFrame(u), u = requestAnimationFrame(l);
46
+ }, i = typeof ResizeObserver > "u" ? null : new ResizeObserver(d);
47
+ for (const h of s)
48
+ i == null || i.observe(h);
49
+ return window.addEventListener("resize", d), () => {
50
+ cancelAnimationFrame(u), i == null || i.disconnect(), window.removeEventListener("resize", d);
47
51
  };
48
- }, [t, e]), e ? o : void 0;
52
+ }, [t, e]), e ? n : void 0;
49
53
  };
50
54
  export {
51
- E as useFillHeight
55
+ S as useFillHeight
52
56
  };
53
57
  //# sourceMappingURL=useFillHeight.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFillHeight.js","sources":["../../../src/components/Table/useFillHeight.ts"],"sourcesContent":["import { useLayoutEffect, useState } from 'react';\n\n// A short window still shows a few rows rather than none.\nconst MIN_FILL_HEIGHT = 120;\n\n// The table renders inside a shadow root, so its page's layout continues at the host.\nconst parentAcrossShadow = (element: Element): Element | null =>\n element.parentElement ?? (element.getRootNode() as Partial<ShadowRoot>).host ?? null;\n\nconst scrollsVertically = (element: Element): boolean => {\n const { overflowY } = getComputedStyle(element);\n return overflowY === 'auto' || overflowY === 'scroll';\n};\n\n/** Every ancestor up to the nearest one that scrolls, and that scroller (none: the page). */\nconst ancestorsToScroller = (box: Element): { ancestors: Element[]; scroller: Element | null } => {\n const ancestors: Element[] = [];\n let node = parentAcrossShadow(box);\n while (node && node !== document.documentElement && node !== document.body) {\n ancestors.push(node);\n if (scrollsVertically(node)) {\n return { ancestors, scroller: node };\n }\n node = parentAcrossShadow(node);\n }\n return { ancestors, scroller: null };\n};\n\nconst px = (value: string): number => Number.parseFloat(value) || 0;\n\nconst siblingsAfter = (node: Element): Element[] => {\n const all = Array.from((node.parentElement ?? (node.getRootNode() as ParentNode)).children);\n return all.slice(all.indexOf(node) + 1);\n};\n\n/** Bottoms of the in-flow siblings laid out below `node`, not beside it as in a flex row. */\nconst bottomsBelow = (node: Element, nodeBottom: number): number[] =>\n siblingsAfter(node).flatMap((sibling) => {\n const { position, display, marginBottom } = getComputedStyle(sibling);\n const rect = sibling.getBoundingClientRect();\n const inFlow = position !== 'fixed' && position !== 'absolute' && display !== 'none';\n return inFlow && rect.top >= nodeBottom - 1 ? [rect.bottom + px(marginBottom)] : [];\n });\n\n/** Everything that has to fit after the box: at each level up to the scroller, what follows it\n * and the bottom padding and border around it. Summed rather than read off where the page ends,\n * as layouts stretched to the window's height end at its bottom whatever they hold. */\nconst spaceBelow = (box: Element, scroller: Element | null): number => {\n let below = 0;\n let node = box;\n let parent = parentAcrossShadow(node);\n while (parent && parent !== document.documentElement) {\n const nodeRect = node.getBoundingClientRect();\n const nodeBottom = nodeRect.bottom + px(getComputedStyle(node).marginBottom);\n const parentStyle = getComputedStyle(parent);\n below +=\n Math.max(nodeBottom, ...bottomsBelow(node, nodeRect.bottom)) -\n nodeRect.bottom +\n px(parentStyle.paddingBottom) +\n px(parentStyle.borderBottomWidth);\n if (parent === scroller) {\n break;\n }\n node = parent;\n parent = parentAcrossShadow(node);\n }\n return below;\n};\n\n/** From the box's top to the scroller's bottom, less everything laid out after the box. Taken as\n * if scrolled to the top, so a scrolled page settles back to fitting instead of keeping its overflow. */\nconst measureFill = (box: Element, scroller: Element | null): number => {\n const boxRect = box.getBoundingClientRect();\n const below = spaceBelow(box, scroller);\n if (!scroller) {\n return window.innerHeight - (boxRect.top + window.scrollY) - below;\n }\n const top = scroller.getBoundingClientRect().top + scroller.clientTop;\n return top + scroller.clientHeight - (boxRect.top + scroller.scrollTop) - below;\n};\n\n/** For `scrollHeight=\"fill\"`: the box's height, measured again whenever the page around it resizes. */\nexport const useFillHeight = (box: Element | null, enabled: boolean): number | undefined => {\n const [height, setHeight] = useState<number>();\n\n useLayoutEffect(() => {\n if (!enabled || !box) {\n return undefined;\n }\n const { ancestors, scroller } = ancestorsToScroller(box);\n const measure = () =>\n setHeight(Math.max(MIN_FILL_HEIGHT, Math.floor(measureFill(box, scroller))));\n measure();\n\n // A frame later, or the height set in response is reported back within the same frame.\n let frame = 0;\n const remeasure = () => {\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(measure);\n };\n const observer =\n typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(remeasure);\n for (const ancestor of ancestors) {\n observer?.observe(ancestor);\n }\n window.addEventListener('resize', remeasure);\n return () => {\n cancelAnimationFrame(frame);\n observer?.disconnect();\n window.removeEventListener('resize', remeasure);\n };\n }, [box, enabled]);\n\n return enabled ? height : undefined;\n};\n"],"names":["MIN_FILL_HEIGHT","parentAcrossShadow","element","scrollsVertically","overflowY","ancestorsToScroller","box","ancestors","node","px","value","siblingsAfter","all","bottomsBelow","nodeBottom","sibling","position","display","marginBottom","rect","spaceBelow","scroller","below","parent","nodeRect","parentStyle","measureFill","boxRect","useFillHeight","enabled","height","setHeight","useState","useLayoutEffect","measure","frame","remeasure","observer","ancestor"],"mappings":";AAGA,MAAMA,IAAkB,KAGlBC,IAAqB,CAACC,MACxBA,EAAQ,iBAAkBA,EAAQ,YAAA,EAAsC,QAAQ,MAE9EC,IAAoB,CAACD,MAA8B;AACrD,QAAM,EAAE,WAAAE,EAAA,IAAc,iBAAiBF,CAAO;AAC9C,SAAOE,MAAc,UAAUA,MAAc;AACjD,GAGMC,IAAsB,CAACC,MAAqE;AAC9F,QAAMC,IAAuB,CAAA;AAC7B,MAAIC,IAAOP,EAAmBK,CAAG;AACjC,SAAOE,KAAQA,MAAS,SAAS,mBAAmBA,MAAS,SAAS,QAAM;AAExE,QADAD,EAAU,KAAKC,CAAI,GACfL,EAAkBK,CAAI;AACtB,aAAO,EAAE,WAAAD,GAAW,UAAUC,EAAA;AAElC,IAAAA,IAAOP,EAAmBO,CAAI;AAAA,EAClC;AACA,SAAO,EAAE,WAAAD,GAAW,UAAU,KAAA;AAClC,GAEME,IAAK,CAACC,MAA0B,OAAO,WAAWA,CAAK,KAAK,GAE5DC,IAAgB,CAACH,MAA6B;AAChD,QAAMI,IAAM,MAAM,MAAMJ,EAAK,iBAAkBA,EAAK,YAAA,GAA8B,QAAQ;AAC1F,SAAOI,EAAI,MAAMA,EAAI,QAAQJ,CAAI,IAAI,CAAC;AAC1C,GAGMK,IAAe,CAACL,GAAeM,MACjCH,EAAcH,CAAI,EAAE,QAAQ,CAACO,MAAY;AACrC,QAAM,EAAE,UAAAC,GAAU,SAAAC,GAAS,cAAAC,EAAA,IAAiB,iBAAiBH,CAAO,GAC9DI,IAAOJ,EAAQ,sBAAA;AAErB,SADeC,MAAa,WAAWA,MAAa,cAAcC,MAAY,UAC7DE,EAA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AAM;AACpB,2BAAqBD,CAAK,GAC1BA,IAAQ,sBAAsBD,CAAO;AAAA,IACzC,GACMG,IACF,OAAO,iBAAmB,MAAc,OAAO,IAAI,eAAeD,CAAS;AAC/E,eAAWE,KAAY/B;AACnB,MAAA8B,KAAA,QAAAA,EAAU,QAAQC;AAEtB,kBAAO,iBAAiB,UAAUF,CAAS,GACpC,MAAM;AACT,2BAAqBD,CAAK,GAC1BE,KAAA,QAAAA,EAAU,cACV,OAAO,oBAAoB,UAAUD,CAAS;AAAA,IAClD;AAAA,EACJ,GAAG,CAAC9B,GAAKuB,CAAO,CAAC,GAEVA,IAAUC,IAAS;AAC9B;"}
1
+ {"version":3,"file":"useFillHeight.js","sources":["../../../src/components/Table/useFillHeight.ts"],"sourcesContent":["import { useLayoutEffect, useState } from 'react';\n\n// A short window still shows a few rows rather than none.\nconst MIN_FILL_HEIGHT = 120;\n\n// The table renders inside a shadow root, so its page's layout continues at the host.\nconst parentAcrossShadow = (element: Element): Element | null =>\n element.parentElement ?? (element.getRootNode() as Partial<ShadowRoot>).host ?? null;\n\nconst scrollsVertically = (element: Element): boolean => {\n const { overflowY } = getComputedStyle(element);\n return overflowY === 'auto' || overflowY === 'scroll';\n};\n\n/** Every ancestor up to the nearest one that scrolls, and that scroller (none: the page). */\nconst ancestorsToScroller = (box: Element): { ancestors: Element[]; scroller: Element | null } => {\n const ancestors: Element[] = [];\n let node = parentAcrossShadow(box);\n while (node && node !== document.documentElement && node !== document.body) {\n ancestors.push(node);\n if (scrollsVertically(node)) {\n return { ancestors, scroller: node };\n }\n node = parentAcrossShadow(node);\n }\n return { ancestors, scroller: null };\n};\n\nconst px = (value: string): number => Number.parseFloat(value) || 0;\n\nconst siblingsAfter = (node: Element): Element[] => {\n const all = Array.from((node.parentElement ?? (node.getRootNode() as ParentNode)).children);\n return all.slice(all.indexOf(node) + 1);\n};\n\n/** Bottoms of the in-flow siblings laid out below `node`, not beside it as in a flex row. */\nconst bottomsBelow = (node: Element, nodeBottom: number): number[] =>\n siblingsAfter(node).flatMap((sibling) => {\n const { position, display, marginBottom } = getComputedStyle(sibling);\n const rect = sibling.getBoundingClientRect();\n const inFlow = position !== 'fixed' && position !== 'absolute' && display !== 'none';\n return inFlow && rect.top >= nodeBottom - 1 ? [rect.bottom + px(marginBottom)] : [];\n });\n\n/** Everything that has to fit after the box: at each level up to the scroller, what follows it\n * and the bottom padding and border around it. Summed rather than read off where the page ends,\n * as layouts stretched to the window's height end at its bottom whatever they hold. */\nconst spaceBelow = (box: Element, scroller: Element | null): number => {\n let below = 0;\n let node = box;\n let parent = parentAcrossShadow(node);\n while (parent && parent !== document.documentElement) {\n const nodeRect = node.getBoundingClientRect();\n const nodeBottom = nodeRect.bottom + px(getComputedStyle(node).marginBottom);\n const parentStyle = getComputedStyle(parent);\n below +=\n Math.max(nodeBottom, ...bottomsBelow(node, nodeRect.bottom)) -\n nodeRect.bottom +\n px(parentStyle.paddingBottom) +\n px(parentStyle.borderBottomWidth);\n if (parent === scroller) {\n break;\n }\n node = parent;\n parent = parentAcrossShadow(node);\n }\n return below;\n};\n\n/** From the box's top to the scroller's bottom, less everything laid out after the box. Taken as\n * if scrolled to the top, so a scrolled page settles back to fitting instead of keeping its overflow. */\nconst measureFill = (box: Element, scroller: Element | null): number => {\n const boxRect = box.getBoundingClientRect();\n const below = spaceBelow(box, scroller);\n if (!scroller) {\n return window.innerHeight - (boxRect.top + window.scrollY) - below;\n }\n const top = scroller.getBoundingClientRect().top + scroller.clientTop;\n return top + scroller.clientHeight - (boxRect.top + scroller.scrollTop) - below;\n};\n\n/**\n * For `scrollHeight=\"fill\"`: the box's height, measured again whenever the page around it resizes.\n *\n * `layoutKey` names anything that changes what follows the box, such as a pager mounting. The\n * observers only see an ancestor resize and answer a frame later, by when the page has already\n * painted overflowing and drawn a scrollbar. A change of key measures again before paint.\n */\nexport const useFillHeight = (\n box: Element | null,\n enabled: boolean,\n layoutKey?: unknown,\n): number | undefined => {\n const [height, setHeight] = useState<number>();\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: layoutKey is why this runs again\n useLayoutEffect(() => {\n if (enabled && box) {\n const { scroller } = ancestorsToScroller(box);\n setHeight(Math.max(MIN_FILL_HEIGHT, Math.floor(measureFill(box, scroller))));\n }\n }, [box, enabled, layoutKey]);\n\n useLayoutEffect(() => {\n if (!enabled || !box) {\n return undefined;\n }\n const { ancestors, scroller } = ancestorsToScroller(box);\n const measure = () =>\n setHeight(Math.max(MIN_FILL_HEIGHT, Math.floor(measureFill(box, scroller))));\n\n // A frame later, or the height set in response is reported back within the same frame.\n let frame = 0;\n const remeasure = () => {\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(measure);\n };\n const observer =\n typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(remeasure);\n for (const ancestor of ancestors) {\n observer?.observe(ancestor);\n }\n window.addEventListener('resize', remeasure);\n return () => {\n cancelAnimationFrame(frame);\n observer?.disconnect();\n window.removeEventListener('resize', remeasure);\n };\n }, [box, enabled]);\n\n return enabled ? height : undefined;\n};\n"],"names":["MIN_FILL_HEIGHT","parentAcrossShadow","element","scrollsVertically","overflowY","ancestorsToScroller","box","ancestors","node","px","value","siblingsAfter","all","bottomsBelow","nodeBottom","sibling","position","display","marginBottom","rect","spaceBelow","scroller","below","parent","nodeRect","parentStyle","measureFill","boxRect","useFillHeight","enabled","layoutKey","height","setHeight","useState","useLayoutEffect","measure","frame","remeasure","observer","ancestor"],"mappings":";AAGA,MAAMA,IAAkB,KAGlBC,IAAqB,CAACC,MACxBA,EAAQ,iBAAkBA,EAAQ,YAAA,EAAsC,QAAQ,MAE9EC,IAAoB,CAACD,MAA8B;AACrD,QAAM,EAAE,WAAAE,EAAA,IAAc,iBAAiBF,CAAO;AAC9C,SAAOE,MAAc,UAAUA,MAAc;AACjD,GAGMC,IAAsB,CAACC,MAAqE;AAC9F,QAAMC,IAAuB,CAAA;AAC7B,MAAIC,IAAOP,EAAmBK,CAAG;AACjC,SAAOE,KAAQA,MAAS,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oBAAoB,UAAUD,CAAS;AAAA,IAClD;AAAA,EACJ,GAAG,CAAC/B,GAAKuB,CAAO,CAAC,GAEVA,IAAUE,IAAS;AAC9B;"}
package/dist/index.d.ts CHANGED
@@ -1036,6 +1036,11 @@ export declare interface CheckboxProps {
1036
1036
  onChange?: (checked: boolean) => void;
1037
1037
  disabled?: boolean;
1038
1038
  size?: number;
1039
+ /**
1040
+ * `warning` draws attention to this box in every state, unchecked included, for a choice
1041
+ * that needs a second look such as an unsaved change.
1042
+ */
1043
+ tone?: CheckboxTone;
1039
1044
  /**
1040
1045
  * Render a visual-only indicator (a non-interactive, non-focusable `<span>`,
1041
1046
  * `aria-hidden`) instead of an interactive checkbox. Use this inside a clickable
@@ -1048,6 +1053,8 @@ export declare interface CheckboxProps {
1048
1053
  id?: string;
1049
1054
  }
1050
1055
 
1056
+ export declare type CheckboxTone = 'default' | 'warning';
1057
+
1051
1058
  export declare const CheckCircleFilled: React.FC<IconProps_24>;
1052
1059
 
1053
1060
  export declare const CheckIcon: React.FC<IconProps_25>;