@reforma/components 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CopyButton/CopyButton.d.ts.map +1 -1
- package/dist/CopyButton/CopyButton.js +58 -58
- package/dist/CopyButton/CopyButton.js.map +1 -1
- package/dist/List/ListBox.d.ts.map +1 -1
- package/dist/List/ListBox.js +71 -69
- package/dist/List/ListBox.js.map +1 -1
- package/dist/List/ListBox.module.css +1 -1
- package/dist/List/useListHoverHighlight.d.ts.map +1 -1
- package/dist/List/useListHoverHighlight.js +72 -67
- package/dist/List/useListHoverHighlight.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyButton.d.ts","sourceRoot":"","sources":["../../src/CopyButton/CopyButton.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAOrD,wBAAsB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAS9D;AAED,uDAAuD;AACvD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,QAUnE;AAED,wBAAgB,eAAe,CAAC,QAAQ,SAAY;;;EAanD;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;IAC7F,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,WAAsB,EACtB,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"CopyButton.d.ts","sourceRoot":"","sources":["../../src/CopyButton/CopyButton.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAOrD,wBAAsB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAS9D;AAED,uDAAuD;AACvD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,QAUnE;AAED,wBAAgB,eAAe,CAAC,QAAQ,SAAY;;;EAanD;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;IAC7F,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,WAAsB,EACtB,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,QAA2B,EAC3B,YAAY,EAAE,SAAS,EACvB,GAAG,WAAW,EACjB,EAAE,eAAe,+BAkCjB"}
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import { Copy as d, Check as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { toast as
|
|
5
|
-
import { Tooltip as
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
1
|
+
import { Copy as d, Check as y } from "@reforma/icons/14";
|
|
2
|
+
import { useState as h, useRef as k, useEffect as v } from "react";
|
|
3
|
+
import { Button as T } from "../Button/Button.js";
|
|
4
|
+
import { toast as b } from "../Toast/Toast.js";
|
|
5
|
+
import { Tooltip as x } from "../Tooltip/Tooltip.js";
|
|
6
|
+
import c from "./CopyButton.module.css.js";
|
|
7
|
+
import { jsxs as m, jsx as n } from "react/jsx-runtime";
|
|
8
8
|
const N = 1500;
|
|
9
|
-
async function
|
|
9
|
+
async function g(t) {
|
|
10
10
|
try {
|
|
11
|
-
return await navigator.clipboard.writeText(
|
|
11
|
+
return await navigator.clipboard.writeText(t), !0;
|
|
12
12
|
} catch {
|
|
13
13
|
return !1;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
|
|
16
|
+
function P(t, o) {
|
|
17
|
+
g(t).then((e) => {
|
|
18
|
+
if (e) {
|
|
19
|
+
o();
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
b.error({
|
|
23
23
|
message: "Couldn't copy"
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const [
|
|
29
|
-
return
|
|
30
|
-
copied:
|
|
27
|
+
function j(t = N) {
|
|
28
|
+
const [o, e] = h(!1), r = k(void 0);
|
|
29
|
+
return v(() => () => clearTimeout(r.current), []), {
|
|
30
|
+
copied: o,
|
|
31
31
|
markCopied: () => {
|
|
32
|
-
|
|
32
|
+
e(!0), clearTimeout(r.current), r.current = setTimeout(() => e(!1), t);
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
value:
|
|
38
|
-
copiedLabel:
|
|
39
|
-
children:
|
|
40
|
-
tooltip:
|
|
41
|
-
tooltipPlacement:
|
|
42
|
-
iconOnly:
|
|
43
|
-
"aria-label":
|
|
44
|
-
...
|
|
36
|
+
function M({
|
|
37
|
+
value: t,
|
|
38
|
+
copiedLabel: o = "Copied",
|
|
39
|
+
children: e,
|
|
40
|
+
tooltip: r,
|
|
41
|
+
tooltipPlacement: u,
|
|
42
|
+
iconOnly: s = e == null,
|
|
43
|
+
"aria-label": l,
|
|
44
|
+
...f
|
|
45
45
|
}) {
|
|
46
46
|
const {
|
|
47
|
-
copied:
|
|
48
|
-
markCopied:
|
|
49
|
-
} =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
copied: i,
|
|
48
|
+
markCopied: C
|
|
49
|
+
} = j(), a = r ?? "Copy", p = /* @__PURE__ */ m(T, {
|
|
50
|
+
...f,
|
|
51
|
+
"aria-label": i ? o : l ?? (typeof a == "string" ? a : "Copy"),
|
|
52
|
+
iconOnly: s,
|
|
53
|
+
onPress: () => P(t, C),
|
|
54
|
+
children: [/* @__PURE__ */ m("span", {
|
|
55
|
+
className: c.icons,
|
|
56
|
+
"data-copied": i || void 0,
|
|
57
|
+
"aria-hidden": !0,
|
|
58
|
+
children: [/* @__PURE__ */ n("span", {
|
|
59
|
+
className: c.idle,
|
|
60
|
+
children: s ? e ?? /* @__PURE__ */ n(d, {}) : /* @__PURE__ */ n(d, {})
|
|
61
|
+
}), /* @__PURE__ */ n("span", {
|
|
62
|
+
className: c.done,
|
|
63
|
+
children: /* @__PURE__ */ n(y, {})
|
|
64
|
+
})]
|
|
65
|
+
}), !s && e]
|
|
66
|
+
});
|
|
67
|
+
return !s && r == null ? p : /* @__PURE__ */ n(x, {
|
|
68
|
+
content: i ? o : a,
|
|
69
|
+
delay: i ? 0 : void 0,
|
|
70
|
+
isOpen: i ? !0 : void 0,
|
|
71
|
+
placement: u,
|
|
55
72
|
shouldCloseOnPress: !1,
|
|
56
|
-
children:
|
|
57
|
-
...u,
|
|
58
|
-
"aria-label": n ? r : m ?? (typeof s == "string" ? s : "Copy"),
|
|
59
|
-
iconOnly: p,
|
|
60
|
-
onPress: () => g(e, l),
|
|
61
|
-
children: p ? /* @__PURE__ */ x("span", {
|
|
62
|
-
className: a.icons,
|
|
63
|
-
"data-copied": n || void 0,
|
|
64
|
-
"aria-hidden": !0,
|
|
65
|
-
children: [/* @__PURE__ */ o("span", {
|
|
66
|
-
className: a.idle,
|
|
67
|
-
children: t ?? /* @__PURE__ */ o(d, {})
|
|
68
|
-
}), /* @__PURE__ */ o("span", {
|
|
69
|
-
className: a.done,
|
|
70
|
-
children: /* @__PURE__ */ o(f, {})
|
|
71
|
-
})]
|
|
72
|
-
}) : t ?? /* @__PURE__ */ o(d, {})
|
|
73
|
-
})
|
|
73
|
+
children: p
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
export {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
M as CopyButton,
|
|
78
|
+
g as copyText,
|
|
79
|
+
P as copyWithFeedback,
|
|
80
|
+
j as useCopyFeedback
|
|
81
81
|
};
|
|
82
82
|
//# sourceMappingURL=CopyButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyButton.js","sources":["../../src/CopyButton/CopyButton.tsx"],"sourcesContent":["import { Check, Copy } from '@reforma/icons/14';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { Button, type ButtonProps } from '../Button';\nimport { toast } from '../Toast';\nimport { Tooltip } from '../Tooltip';\nimport styles from './CopyButton.module.css';\n\nconst COPIED_MS = 1500;\n\nexport async function copyText(value: string): Promise<boolean> {\n try {\n await navigator.clipboard.writeText(value);\n\n return true;\n }\n catch {\n return false;\n }\n}\n\n/** Copy `value`, then `onCopied` or an error toast. */\nexport function copyWithFeedback(value: string, onCopied: () => void) {\n void copyText(value).then((ok) => {\n if (ok) {\n onCopied();\n\n return;\n }\n\n toast.error({ message: 'Couldn\\'t copy' });\n });\n}\n\nexport function useCopyFeedback(duration = COPIED_MS) {\n const [copied, setCopied] = useState(false);\n const timerRef = useRef<ReturnType<typeof setTimeout>>(undefined);\n\n useEffect(() => () => clearTimeout(timerRef.current), []);\n\n const markCopied = () => {\n setCopied(true);\n clearTimeout(timerRef.current);\n timerRef.current = setTimeout(() => setCopied(false), duration);\n };\n\n return { copied, markCopied };\n}\n\nexport interface CopyButtonProps extends Omit<ButtonProps, 'href' | 'target' | 'rel' | 'onPress'> {\n value: string;\n copiedLabel?: string;\n}\n\nexport function CopyButton({\n value,\n copiedLabel = 'Copied',\n children,\n tooltip,\n tooltipPlacement,\n iconOnly =
|
|
1
|
+
{"version":3,"file":"CopyButton.js","sources":["../../src/CopyButton/CopyButton.tsx"],"sourcesContent":["import { Check, Copy } from '@reforma/icons/14';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { Button, type ButtonProps } from '../Button';\nimport { toast } from '../Toast';\nimport { Tooltip } from '../Tooltip';\nimport styles from './CopyButton.module.css';\n\nconst COPIED_MS = 1500;\n\nexport async function copyText(value: string): Promise<boolean> {\n try {\n await navigator.clipboard.writeText(value);\n\n return true;\n }\n catch {\n return false;\n }\n}\n\n/** Copy `value`, then `onCopied` or an error toast. */\nexport function copyWithFeedback(value: string, onCopied: () => void) {\n void copyText(value).then((ok) => {\n if (ok) {\n onCopied();\n\n return;\n }\n\n toast.error({ message: 'Couldn\\'t copy' });\n });\n}\n\nexport function useCopyFeedback(duration = COPIED_MS) {\n const [copied, setCopied] = useState(false);\n const timerRef = useRef<ReturnType<typeof setTimeout>>(undefined);\n\n useEffect(() => () => clearTimeout(timerRef.current), []);\n\n const markCopied = () => {\n setCopied(true);\n clearTimeout(timerRef.current);\n timerRef.current = setTimeout(() => setCopied(false), duration);\n };\n\n return { copied, markCopied };\n}\n\nexport interface CopyButtonProps extends Omit<ButtonProps, 'href' | 'target' | 'rel' | 'onPress'> {\n value: string;\n copiedLabel?: string;\n}\n\nexport function CopyButton({\n value,\n copiedLabel = 'Copied',\n children,\n tooltip,\n tooltipPlacement,\n iconOnly = children == null,\n 'aria-label': ariaLabel,\n ...buttonProps\n}: CopyButtonProps) {\n const { copied, markCopied } = useCopyFeedback();\n const idleContent = tooltip ?? 'Copy';\n const idleName = typeof idleContent === 'string' ? idleContent : 'Copy';\n const button = (\n <Button\n { ...buttonProps }\n aria-label={ copied ? copiedLabel : (ariaLabel ?? idleName) }\n iconOnly={ iconOnly }\n onPress={ () => copyWithFeedback(value, markCopied) }\n >\n <span className={ styles.icons } data-copied={ copied || undefined } aria-hidden>\n <span className={ styles.idle }>{ iconOnly ? (children ?? <Copy />) : <Copy /> }</span>\n <span className={ styles.done }><Check /></span>\n </span>\n { !iconOnly && children }\n </Button>\n );\n\n if (!iconOnly && tooltip == null) {\n return button;\n }\n\n return (\n <Tooltip\n content={ copied ? copiedLabel : idleContent }\n delay={ copied ? 0 : undefined }\n isOpen={ copied ? true : undefined }\n placement={ tooltipPlacement }\n shouldCloseOnPress={ false }\n >\n { button }\n </Tooltip>\n );\n}\n"],"names":["COPIED_MS","copyText","value","copyWithFeedback","onCopied","ok","toast","useCopyFeedback","duration","copied","setCopied","useState","timerRef","useRef","useEffect","CopyButton","copiedLabel","children","tooltip","tooltipPlacement","iconOnly","ariaLabel","buttonProps","markCopied","idleContent","button","Button","_jsxs","styles","_jsx","Copy","Check","Tooltip"],"mappings":";;;;;;;AAOA,MAAMA,IAAY;AAClB,eAAsBC,EAASC,GAAO;AACpC,MAAI;AACF,iBAAM,UAAU,UAAU,UAAUA,CAAK,GAClC;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAASC,EAAiBD,GAAOE,GAAU;AAChD,EAAKH,EAASC,CAAK,EAAE,KAAK,CAAAG,MAAM;AAC9B,QAAIA,GAAI;AACN,MAAAD,EAAA;AACA;AAAA,IACF;AACA,IAAAE,EAAM,MAAM;AAAA,MACV,SAAS;AAAA,IAAA,CACV;AAAA,EACH,CAAC;AACH;AACO,SAASC,EAAgBC,IAAWR,GAAW;AACpD,QAAM,CAACS,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpCC,IAAWC,EAAO,MAAS;AACjC,SAAAC,EAAU,MAAM,MAAM,aAAaF,EAAS,OAAO,GAAG,CAAA,CAAE,GAMjD;AAAA,IACL,QAAAH;AAAA,IACA,YAPiB,MAAM;AACvB,MAAAC,EAAU,EAAI,GACd,aAAaE,EAAS,OAAO,GAC7BA,EAAS,UAAU,WAAW,MAAMF,EAAU,EAAK,GAAGF,CAAQ;AAAA,IAChE;AAAA,EAGE;AAEJ;AACO,SAASO,EAAW;AAAA,EACzB,OAAAb;AAAA,EACA,aAAAc,IAAc;AAAA,EACd,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,UAAAC,IAAWH,KAAY;AAAA,EACvB,cAAcI;AAAA,EACd,GAAGC;AACL,GAAG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
|
-
import { toSet as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { ListBox as
|
|
1
|
+
import { toSet as y, cn as f, mergeRefs as S } from "@reforma/lib";
|
|
2
|
+
import { useRef as B, useState as p } from "react";
|
|
3
|
+
import { ListBox as v, Header as H, ListBoxItem as I, ListBoxSection as R } from "react-aria-components";
|
|
4
4
|
import o from "./ListBox.module.css.js";
|
|
5
|
-
import { renderListRowItemContent as
|
|
6
|
-
import { useListHoverHighlight as
|
|
7
|
-
import { useScrollActiveListItem as
|
|
5
|
+
import { renderListRowItemContent as h } from "./listRowItemContent.js";
|
|
6
|
+
import { useListHoverHighlight as K } from "./useListHoverHighlight.js";
|
|
7
|
+
import { useScrollActiveListItem as g } from "./useScrollActiveListItem.js";
|
|
8
8
|
import { jsx as l } from "react/jsx-runtime";
|
|
9
|
-
const
|
|
9
|
+
const A = {
|
|
10
10
|
itemHover: "item-hover",
|
|
11
11
|
itemSelected: "item-selected",
|
|
12
12
|
itemBoth: "item-both",
|
|
13
13
|
/** Visible until the row is hovered. */
|
|
14
14
|
itemRest: "item-rest"
|
|
15
15
|
};
|
|
16
|
+
function N(e, t) {
|
|
17
|
+
if (e.size !== t.size)
|
|
18
|
+
return !1;
|
|
19
|
+
for (const s of e)
|
|
20
|
+
if (!t.has(s))
|
|
21
|
+
return !1;
|
|
22
|
+
return !0;
|
|
23
|
+
}
|
|
16
24
|
function C({
|
|
17
|
-
className:
|
|
18
|
-
size:
|
|
19
|
-
selectionMode:
|
|
20
|
-
selectedKeys:
|
|
21
|
-
escapeKeyBehavior:
|
|
22
|
-
interactive:
|
|
25
|
+
className: e,
|
|
26
|
+
size: t = "sm",
|
|
27
|
+
selectionMode: s = "none",
|
|
28
|
+
selectedKeys: u,
|
|
29
|
+
escapeKeyBehavior: x = "none",
|
|
30
|
+
interactive: i = !0,
|
|
23
31
|
ref: r,
|
|
24
|
-
...
|
|
32
|
+
...d
|
|
25
33
|
}) {
|
|
26
|
-
const
|
|
27
|
-
return N(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
selectionMode: i,
|
|
37
|
-
selectedKeys: a,
|
|
38
|
-
escapeKeyBehavior: f,
|
|
39
|
-
"data-size": e,
|
|
40
|
-
"data-interactive": s || void 0,
|
|
41
|
-
...u
|
|
34
|
+
const a = B(null), m = y(u), [n, c] = p(m);
|
|
35
|
+
return N(n, m) || c(m), K(a, i), /* @__PURE__ */ l(v, {
|
|
36
|
+
ref: S(a, r),
|
|
37
|
+
className: f(o.list, e),
|
|
38
|
+
selectionMode: s,
|
|
39
|
+
selectedKeys: n,
|
|
40
|
+
escapeKeyBehavior: x,
|
|
41
|
+
"data-size": t,
|
|
42
|
+
"data-interactive": i || void 0,
|
|
43
|
+
...d
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
|
-
function
|
|
45
|
-
startAffix:
|
|
46
|
-
icon:
|
|
47
|
-
text:
|
|
48
|
-
description:
|
|
49
|
-
endAffix:
|
|
50
|
-
stacked:
|
|
46
|
+
function q({
|
|
47
|
+
startAffix: e,
|
|
48
|
+
icon: t,
|
|
49
|
+
text: s,
|
|
50
|
+
description: u,
|
|
51
|
+
endAffix: x,
|
|
52
|
+
stacked: i,
|
|
51
53
|
children: r,
|
|
52
|
-
className:
|
|
53
|
-
isDanger:
|
|
54
|
-
ref:
|
|
55
|
-
...
|
|
54
|
+
className: d,
|
|
55
|
+
isDanger: a,
|
|
56
|
+
ref: m,
|
|
57
|
+
...n
|
|
56
58
|
}) {
|
|
57
|
-
const
|
|
58
|
-
return
|
|
59
|
-
ref:
|
|
60
|
-
className:
|
|
59
|
+
const c = B(null), L = s || n.textValue || (typeof r == "string" ? r : void 0);
|
|
60
|
+
return g(c), /* @__PURE__ */ l(I, {
|
|
61
|
+
ref: S(c, m),
|
|
62
|
+
className: f(o.item, i && o.itemStacked, a && o.itemDanger, d),
|
|
61
63
|
textValue: L,
|
|
62
|
-
...
|
|
63
|
-
children:
|
|
64
|
-
icon:
|
|
65
|
-
description:
|
|
66
|
-
startAffix:
|
|
67
|
-
endAffix:
|
|
68
|
-
stacked:
|
|
64
|
+
...n,
|
|
65
|
+
children: h(r, {
|
|
66
|
+
icon: t,
|
|
67
|
+
description: u,
|
|
68
|
+
startAffix: e,
|
|
69
|
+
endAffix: x,
|
|
70
|
+
stacked: i,
|
|
69
71
|
textValue: L
|
|
70
72
|
})
|
|
71
73
|
});
|
|
72
74
|
}
|
|
73
|
-
function
|
|
74
|
-
className:
|
|
75
|
-
sticky:
|
|
76
|
-
...
|
|
75
|
+
function E({
|
|
76
|
+
className: e,
|
|
77
|
+
sticky: t,
|
|
78
|
+
...s
|
|
77
79
|
}) {
|
|
78
|
-
return /* @__PURE__ */ l(
|
|
79
|
-
className:
|
|
80
|
-
...
|
|
81
|
-
"data-sticky":
|
|
80
|
+
return /* @__PURE__ */ l(H, {
|
|
81
|
+
className: f(o.sectionHeader, e),
|
|
82
|
+
...s,
|
|
83
|
+
"data-sticky": t || void 0
|
|
82
84
|
});
|
|
83
85
|
}
|
|
84
|
-
function
|
|
85
|
-
className:
|
|
86
|
-
...
|
|
86
|
+
function F({
|
|
87
|
+
className: e,
|
|
88
|
+
...t
|
|
87
89
|
}) {
|
|
88
90
|
return /* @__PURE__ */ l(R, {
|
|
89
|
-
className:
|
|
90
|
-
...
|
|
91
|
+
className: f(o.section, e),
|
|
92
|
+
...t
|
|
91
93
|
});
|
|
92
94
|
}
|
|
93
95
|
export {
|
|
94
96
|
C as ListBox,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
E as ListBoxHeader,
|
|
98
|
+
q as ListBoxItem,
|
|
99
|
+
F as ListBoxSection,
|
|
100
|
+
A as listBoxItemDataShow
|
|
99
101
|
};
|
|
100
102
|
//# sourceMappingURL=ListBox.js.map
|
package/dist/List/ListBox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListBox.js","sources":["../../src/List/ListBox.tsx"],"sourcesContent":["import { cn, mergeRefs, toSet, type SelectionInput } from '@reforma/lib';\nimport {
|
|
1
|
+
{"version":3,"file":"ListBox.js","sources":["../../src/List/ListBox.tsx"],"sourcesContent":["import { cn, mergeRefs, toSet, type SelectionInput } from '@reforma/lib';\nimport { useRef, useState } from 'react';\nimport {\n Header as AriaHeader,\n ListBox as AriaListBox,\n ListBoxItem as AriaListBoxItem,\n ListBoxSection as AriaListBoxSection,\n type ListBoxItemProps as AriaListBoxItemProps,\n type Key,\n type ListBoxSectionProps,\n type ListBoxProps as RACListBoxProps,\n} from 'react-aria-components';\n\nimport styles from './ListBox.module.css';\nimport { renderListRowItemContent } from './listRowItemContent';\nimport { useListHoverHighlight } from './useListHoverHighlight';\nimport { useScrollActiveListItem } from './useScrollActiveListItem';\n\nimport type { HTMLAttributes, ReactNode, Ref } from 'react';\n\nexport type { ListBoxProps, ListBoxSectionProps } from 'react-aria-components';\n\nexport type ListBoxSize = 'sm' | 'md' | 'lg';\n\n/**\n * Valid `data-show` values on any descendant of a shared list row (e.g. a control in `endAffix`).\n * {@link GridListItem} and {@link ListBoxItem} both use `ListBox.module.css` (`.item`); name is historical.\n */\nexport const listBoxItemDataShow = {\n itemHover: 'item-hover',\n itemSelected: 'item-selected',\n itemBoth: 'item-both',\n /** Visible until the row is hovered. */\n itemRest: 'item-rest',\n} as const;\n\nexport type ListBoxItemDataShow = typeof listBoxItemDataShow[keyof typeof listBoxItemDataShow];\n\nexport interface ListBoxItemSlots {\n icon?: ReactNode;\n description?: ReactNode;\n startAffix?: ReactNode;\n endAffix?: ReactNode;\n stacked?: boolean;\n}\n\nexport type ListBoxItemProps<T extends object = object> = AriaListBoxItemProps<T>\n & ListBoxItemSlots & {\n text?: string;\n isDanger?: boolean;\n };\n\nexport interface ListBoxComponentProps<T extends object = object> extends Omit<RACListBoxProps<T>, 'selectedKeys'> {\n ref?: Ref<HTMLDivElement>;\n size?: ListBoxSize;\n /** Selected key(s). Pass a single Key, array, or Iterable (e.g. Set). */\n selectedKeys?: SelectionInput<Key>;\n /** When false, items do not show hover background. Use for plain/display-only lists. Default true. */\n interactive?: boolean;\n}\n\nfunction sameKeys<T>(left: Set<T>, right: Set<T>): boolean {\n if (left.size !== right.size) {\n return false;\n }\n\n for (const key of left) {\n if (!right.has(key)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * **List surface for option-like rows** (arrow-key listbox UX, ComboBox / Select overlays). Rows should not contain nested widgets that require Tab —\n * use {@link GridList} with `keyboardNavigationBehavior=\"tab\"` instead.\n *\n * Styled like {@link GridList} via shared `ListBox.module.css`; choose by interaction model and RAC composition (Select renders `ListBox`, not GridList).\n */\nexport function ListBox<T extends object>({\n className,\n size = 'sm',\n selectionMode = 'none',\n selectedKeys,\n escapeKeyBehavior = 'none',\n interactive = true,\n ref,\n ...props\n}: ListBoxComponentProps<T>) {\n const listRef = useRef<HTMLDivElement>(null);\n const nextKeys = toSet(selectedKeys);\n const [ selectedKeysSet, setSelectedKeysSet ] = useState(nextKeys);\n\n if (!sameKeys(selectedKeysSet, nextKeys)) {\n setSelectedKeysSet(nextKeys);\n }\n\n useListHoverHighlight(listRef, interactive);\n\n return (\n <AriaListBox\n ref={ mergeRefs(listRef, ref as Ref<HTMLDivElement>) }\n className={ cn(styles.list, className) }\n selectionMode={ selectionMode }\n selectedKeys={ selectedKeysSet }\n escapeKeyBehavior={ escapeKeyBehavior }\n data-size={ size }\n data-interactive={ interactive || undefined }\n { ...props }\n />\n );\n}\n\nexport function ListBoxItem<T extends object>({\n startAffix,\n icon,\n text,\n description,\n endAffix,\n stacked,\n children,\n className,\n isDanger,\n ref,\n ...props\n}: ListBoxItemProps<T> & { ref?: Ref<HTMLDivElement> }) {\n const itemRef = useRef<HTMLDivElement>(null);\n const textValue = text || props.textValue || (typeof children === 'string' ? children : undefined);\n\n useScrollActiveListItem(itemRef);\n\n return (\n <AriaListBoxItem\n ref={ mergeRefs(itemRef, ref) }\n className={ cn(styles.item, stacked && styles.itemStacked, isDanger && styles.itemDanger, className) }\n textValue={ textValue }\n { ...props }\n >\n { renderListRowItemContent(children, {\n icon,\n description,\n startAffix,\n endAffix,\n stacked,\n textValue,\n }) }\n </AriaListBoxItem>\n );\n}\n\nexport function ListBoxHeader({ className, sticky, ...props }: HTMLAttributes<HTMLElement> & { sticky?: boolean }) {\n return <AriaHeader className={ cn(styles.sectionHeader, className) } { ...props } data-sticky={ sticky || undefined } />;\n}\n\nexport function ListBoxSection<T extends object>({ className, ...props }: ListBoxSectionProps<T>) {\n return <AriaListBoxSection className={ cn(styles.section, className) } { ...props } />;\n}\n"],"names":["listBoxItemDataShow","sameKeys","left","right","key","ListBox","className","size","selectionMode","selectedKeys","escapeKeyBehavior","interactive","ref","props","listRef","useRef","nextKeys","toSet","selectedKeysSet","setSelectedKeysSet","useState","useListHoverHighlight","AriaListBox","mergeRefs","cn","styles","ListBoxItem","startAffix","icon","text","description","endAffix","stacked","children","isDanger","itemRef","textValue","useScrollActiveListItem","AriaListBoxItem","renderListRowItemContent","ListBoxHeader","sticky","AriaHeader","ListBoxSection","AriaListBoxSection"],"mappings":";;;;;;;;AAYO,MAAMA,IAAsB;AAAA,EACjC,WAAW;AAAA,EACX,cAAc;AAAA,EACd,UAAU;AAAA;AAAA,EAEV,UAAU;AACZ;AACA,SAASC,EAASC,GAAMC,GAAO;AAC7B,MAAID,EAAK,SAASC,EAAM;AACtB,WAAO;AAET,aAAWC,KAAOF;AAChB,QAAI,CAACC,EAAM,IAAIC,CAAG;AAChB,aAAO;AAGX,SAAO;AACT;AAQO,SAASC,EAAQ;AAAA,EACtB,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,eAAAC,IAAgB;AAAA,EAChB,cAAAC;AAAA,EACA,mBAAAC,IAAoB;AAAA,EACpB,aAAAC,IAAc;AAAA,EACd,KAAAC;AAAA,EACA,GAAGC;AACL,GAAG;AACD,QAAMC,IAAUC,EAA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ACD,2BAAyB6B,GAAY;AAAA,IACnC,WAAWlB,EAAGC,EAAO,eAAenB,CAAS;AAAA,IAC7C,GAAGO;AAAA,IACH,eAAe4B,KAAU;AAAA,EAAA,CAC1B;AACH;AACO,SAASE,EAAe;AAAA,EAC7B,WAAArC;AAAA,EACA,GAAGO;AACL,GAAG;AACD,2BAAyB+B,GAAoB;AAAA,IAC3C,WAAWpB,EAAGC,EAAO,SAASnB,CAAS;AAAA,IACvC,GAAGO;AAAA,EAAA,CACJ;AACH;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.ListBox_list_JpvdtZ{--reforma-listbox-gap: var(--spacing-xxs);--reforma-listbox-item-radius: var(--radius-sm);--reforma-listbox-item-height: var(--spacing-30);--reforma-listbox-item-padding: var(--spacing-
|
|
1
|
+
@layer components{.ListBox_list_JpvdtZ{--reforma-listbox-gap: var(--spacing-xxs);--reforma-listbox-item-radius: var(--radius-sm);--reforma-listbox-item-height: var(--spacing-30);--reforma-listbox-item-padding-inline: var(--spacing-lg);--reforma-listbox-item-padding: var(--spacing-sm) var(--reforma-listbox-item-padding-inline);--reforma-listbox-item-color: var(--color-text);--reforma-listbox-item-color--hover: var(--color-text);--reforma-listbox-item-bg--hover: var(--color-secondary-muted-light);--reforma-listbox-item-bg--selected: var(--color-secondary-muted);--reforma-listbox-item-color--selected: var(--color-secondary-content);--reforma-listbox-highlight-top: 0px;--reforma-listbox-highlight-left: 0px;--reforma-listbox-highlight-width: 0px;--reforma-listbox-highlight-height: 0px;--reforma-listbox-highlight-opacity: 0;--reforma-listbox-highlight-ease: cubic-bezier(.16, 1, .3, 1);--reforma-menu-separator-space: var(--spacing-xs);display:flex;position:relative;flex-direction:column;gap:var(--reforma-listbox-gap);width:100%}.ListBox_list_JpvdtZ[data-interactive]:before{position:absolute;top:var(--reforma-listbox-highlight-top);left:var(--reforma-listbox-highlight-left);opacity:var(--reforma-listbox-highlight-opacity);border-radius:calc(var(--reforma-listbox-item-radius) * var(--squircle-radius-factor));width:var(--reforma-listbox-highlight-width);height:var(--reforma-listbox-highlight-height);content:"";corner-shape:superellipse(var(--squircle-value));z-index:0;transition:opacity .1s;background-color:var(--reforma-listbox-item-bg--hover);pointer-events:none}.ListBox_list_JpvdtZ[data-interactive][data-highlight-ready]:before{transition:top var(--transition-duration-fast) var(--reforma-listbox-highlight-ease),left var(--transition-duration-fast) var(--reforma-listbox-highlight-ease),width var(--transition-duration-fast) var(--reforma-listbox-highlight-ease),height var(--transition-duration-fast) var(--reforma-listbox-highlight-ease),opacity .1s}.ListBox_list_JpvdtZ[data-interactive][data-highlight-danger]:before{background-color:var(--color-danger-muted-light)}.ListBox_scrollableContainer_geIIr1{width:100%}.ListBox_menuList_sQN3eW{outline:none}.ListBox_list_JpvdtZ[data-empty]{justify-content:center;align-items:center;padding:var(--spacing-md) var(--spacing-lg);min-height:var(--reforma-listbox-item-height);color:var(--color-secondary-muted-text);font-weight:400;font-size:var(--text-sm);line-height:var(--leading-sm);font-family:Onest,sans-serif;letter-spacing:0;text-align:center}.ListBox_item_8cmHfh{display:flex;position:relative;align-items:center;gap:var(--spacing-10);border-radius:calc(var(--reforma-listbox-item-radius) * var(--squircle-radius-factor));padding:var(--reforma-listbox-item-padding);width:100%;min-width:0;min-height:var(--reforma-listbox-item-height);corner-shape:superellipse(var(--squircle-value));z-index:1;cursor:pointer;outline:none;color:var(--reforma-listbox-item-color);-webkit-user-select:none;-moz-user-select:none;isolation:isolate;user-select:none;text-decoration:none}.ListBox_item_8cmHfh:has([data-hotkey]){padding-inline-end:var(--spacing-sm)}.ListBox_item_8cmHfh:has([slot=endAffix] button){padding-inline-end:calc((var(--reforma-listbox-item-height) - var(--spacing-24)) / 2)}.ListBox_item_8cmHfh:before{position:absolute;inset:0;border-radius:inherit;content:"";corner-shape:inherit;z-index:-1;transition:background-color var(--transition-duration-fast),border-radius var(--transition-duration-fast)}.ListBox_list_JpvdtZ[data-size=sm]{--reforma-listbox-item-radius: var(--radius-sm);--reforma-listbox-item-height: var(--spacing-30);--reforma-listbox-item-padding-inline: var(--spacing-lg);--reforma-listbox-item-padding: var(--spacing-sm) var(--reforma-listbox-item-padding-inline)}.ListBox_list_JpvdtZ[data-size=sm] .ListBox_itemLabel_ctFOvE{font-weight:400;font-size:var(--text-sm);line-height:var(--leading-sm);font-family:Onest,sans-serif;letter-spacing:0}.ListBox_list_JpvdtZ[data-size=md]{--reforma-listbox-item-radius: var(--radius-md);--reforma-listbox-item-height: var(--spacing-36);--reforma-listbox-item-padding-inline: var(--spacing-lg);--reforma-listbox-item-padding: var(--spacing-sm) var(--reforma-listbox-item-padding-inline)}.ListBox_list_JpvdtZ[data-size=md] .ListBox_itemLabel_ctFOvE{font-weight:400;font-size:var(--text-md);line-height:var(--leading-md);font-family:Onest,sans-serif;letter-spacing:0}.ListBox_list_JpvdtZ[data-size=lg]{--reforma-listbox-item-radius: var(--radius-lg);--reforma-listbox-item-height: var(--spacing-56);--reforma-listbox-item-padding-inline: var(--spacing-16);--reforma-listbox-item-padding: var(--spacing-10) var(--reforma-listbox-item-padding-inline)}.ListBox_list_JpvdtZ[data-size=lg] .ListBox_item_8cmHfh:has([data-hotkey]){padding-inline-end:var(--spacing-10)}.ListBox_list_JpvdtZ[data-size=lg] .ListBox_itemLabel_ctFOvE{font-weight:400;font-size:var(--text-lg);line-height:var(--leading-lg);font-family:Onest,sans-serif;letter-spacing:0}.ListBox_list_JpvdtZ[data-interactive] .ListBox_item_8cmHfh:hover:not([data-disabled]):not([data-selected]):not([data-highlighted]),.ListBox_item_8cmHfh:is([data-hovered],[data-focus-visible]):not([data-disabled]):not([data-selected]):not([data-highlighted]),.ListBox_item_8cmHfh[data-open]:not([data-disabled]):not([data-selected]):not([data-highlighted]){color:var(--reforma-listbox-item-color--hover)}.ListBox_item_8cmHfh[data-selected]:before,.ListBox_item_8cmHfh[data-highlighted]:before{background-color:var(--reforma-listbox-item-bg--selected)}.ListBox_item_8cmHfh[data-selected],.ListBox_item_8cmHfh[data-highlighted]{color:var(--reforma-listbox-item-color--selected)}.ListBox_list_JpvdtZ .ListBox_item_8cmHfh[data-selected]+.ListBox_item_8cmHfh[data-selected]{border-start-start-radius:0;border-start-end-radius:0}:is(.ListBox_list_JpvdtZ .ListBox_item_8cmHfh[data-selected]+.ListBox_item_8cmHfh[data-selected]):before{top:-1px}.ListBox_list_JpvdtZ .ListBox_item_8cmHfh[data-selected]:has(+.ListBox_item_8cmHfh[data-selected]){border-end-start-radius:0;border-end-end-radius:0}:is(.ListBox_list_JpvdtZ .ListBox_item_8cmHfh[data-selected]:has(+.ListBox_item_8cmHfh[data-selected])):before{bottom:-1px}.ListBox_item_8cmHfh[data-disabled]{opacity:var(--opacity-disabled);cursor:default}.ListBox_item_8cmHfh[data-focus-visible]{outline:none}.ListBox_item_8cmHfh[data-dragging]{display:none}.ListBox_list_JpvdtZ .react-aria-DropIndicator{margin-block:calc(var(--reforma-listbox-gap) * -1);padding:0;height:0;min-height:0;overflow:visible;pointer-events:none}.ListBox_itemDanger_ttnXKb{--reforma-listbox-item-color: var(--color-danger-text);--reforma-listbox-item-color--hover: var(--color-danger-text);--reforma-listbox-item-bg--hover: var(--color-danger-muted-light)}.ListBox_itemStart_2AUJbr{display:flex;flex:1 1 0;align-items:center;gap:var(--spacing-md);min-width:0}.ListBox_itemStacked_Quxi99{padding-block:var(--spacing-8);min-height:auto}.ListBox_itemStacked_Quxi99 .ListBox_itemStart_2AUJbr{align-items:flex-start}.ListBox_itemCopy_GCZhjt{display:flex;flex-direction:column;gap:1px;width:100%;min-width:0}.ListBox_itemCopy_GCZhjt .ListBox_itemLabel_ctFOvE{flex:0 1 auto;width:100%}.ListBox_itemEnd_o6zHrW{display:flex;flex:0 1 auto;justify-content:flex-end;align-items:center;gap:var(--spacing-md);min-width:0;max-width:60%}.ListBox_itemEnd_o6zHrW:empty{display:none}.ListBox_itemLabel_ctFOvE{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ListBox_itemDescription_SoJbTP{min-width:0;overflow:hidden;color:var(--color-secondary-muted-text);font-weight:400;font-size:var(--text-sm);line-height:var(--leading-sm);font-family:Onest,sans-serif;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.ListBox_itemStartAffix_BjHXOp{display:flex;flex-shrink:0;align-items:center;margin-left:calc(var(--spacing-md) * -1)}.ListBox_itemEnd_o6zHrW>*:not(button):not(:has(button)){min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ListBox_item_8cmHfh [data-show=item-hover],.ListBox_item_8cmHfh [data-show=item-selected],.ListBox_item_8cmHfh [data-show=item-both]{opacity:0;transition:opacity var(--transition-duration-fast) ease;pointer-events:none}.ListBox_item_8cmHfh [data-show=item-rest]{transition:opacity var(--transition-duration-fast) ease}.ListBox_item_8cmHfh[data-hovered] [data-show=item-hover],.ListBox_item_8cmHfh:hover [data-show=item-hover]{opacity:1;pointer-events:auto}.ListBox_item_8cmHfh[data-hovered] [data-show=item-rest],.ListBox_item_8cmHfh:hover [data-show=item-rest]{opacity:0;pointer-events:none}.ListBox_item_8cmHfh[data-selected] [data-show=item-selected]{opacity:1;pointer-events:auto}.ListBox_item_8cmHfh[data-hovered] [data-show=item-both],.ListBox_item_8cmHfh:hover [data-show=item-both],.ListBox_item_8cmHfh[data-selected] [data-show=item-both],.ListBox_item_8cmHfh:focus-within [data-show=item-both],.ListBox_item_8cmHfh[data-open] [data-show=item-both]{opacity:1;pointer-events:auto}.ListBox_menuSeparator_6r56jX{flex-shrink:0;margin-block:calc(var(--reforma-menu-separator-space) - var(--reforma-listbox-gap));border:none;background-color:var(--color-secondary-muted);padding:0;width:100%;height:1px}.ListBox_section_fHSjC3{display:flex;flex-direction:column;gap:var(--reforma-listbox-gap)}.ListBox_section_fHSjC3+.ListBox_section_fHSjC3{margin-top:var(--spacing-md)}.ListBox_sectionHeader_iHoMut{cursor:default;padding-inline:var(--reforma-listbox-item-padding-inline);padding-block:var(--spacing-6) var(--spacing-4);color:var(--color-secondary-muted-text);font-weight:400;font-weight:500;font-size:var(--text-xs);line-height:var(--leading-xs);font-family:Onest,sans-serif;letter-spacing:0}.ListBox_sectionHeader_iHoMut[data-sticky]{position:sticky;top:0;z-index:var(--z-raised);border-radius:calc(var(--radius-sm) * var(--squircle-radius-factor));background-color:var(--color-surface);corner-shape:superellipse(var(--squircle-value))}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useListHoverHighlight.d.ts","sourceRoot":"","sources":["../../src/List/useListHoverHighlight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useListHoverHighlight.d.ts","sourceRoot":"","sources":["../../src/List/useListHoverHighlight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AA0BlD,KAAK,UAAU,GAAG,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,WAAW,GAAG,IAAI,CAAC;AAUrE;;GAEG;AACH,wBAAgB,qBAAqB,CACjC,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,OAAO,EAChB,YAAY,GAAE,MAAqB,QA8OtC"}
|
|
@@ -1,92 +1,97 @@
|
|
|
1
|
-
import { useEffect as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
|
|
1
|
+
import { useEffect as X } from "react";
|
|
2
|
+
import F from "./ListBox.module.css.js";
|
|
3
|
+
const k = `.${F.item}`, R = 16, q = 150;
|
|
4
|
+
function D(o) {
|
|
5
|
+
let l = o.parentElement;
|
|
6
|
+
for (; l && l !== document.documentElement; ) {
|
|
7
|
+
const s = getComputedStyle(l).overflowY;
|
|
8
|
+
if (s === "auto" || s === "scroll")
|
|
9
|
+
return l;
|
|
10
|
+
l = l.parentElement;
|
|
11
|
+
}
|
|
12
|
+
return o;
|
|
6
13
|
}
|
|
7
|
-
function H(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
function H(o) {
|
|
15
|
+
return o instanceof HTMLElement ? o : o?.current ?? null;
|
|
16
|
+
}
|
|
17
|
+
function O(o, l, s = k) {
|
|
18
|
+
const Y = o instanceof HTMLElement ? o : null;
|
|
19
|
+
X(() => {
|
|
20
|
+
const t = H(o);
|
|
21
|
+
if (!t || !l)
|
|
12
22
|
return;
|
|
13
|
-
let
|
|
14
|
-
const
|
|
23
|
+
let u = !1, c = !1, m = 0, n = null, g = 0, p = 0, d = !1;
|
|
24
|
+
const v = (e) => {
|
|
15
25
|
if (!(e instanceof Element))
|
|
16
26
|
return null;
|
|
17
|
-
const r = e.closest(
|
|
27
|
+
const r = e.closest(s);
|
|
18
28
|
return !r || !t.contains(r) ? null : r;
|
|
19
|
-
},
|
|
20
|
-
if (!
|
|
29
|
+
}, $ = (e) => e.hasAttribute("data-disabled") || e.hasAttribute("data-selected") || e.hasAttribute("data-highlighted") || e.hasAttribute("data-nested-selected"), E = () => t.querySelector(`${s}[data-focus-visible]`), C = (e, r) => {
|
|
30
|
+
if (!n)
|
|
21
31
|
return !1;
|
|
22
|
-
const
|
|
23
|
-
return e >=
|
|
24
|
-
},
|
|
25
|
-
const r = t.getBoundingClientRect(),
|
|
26
|
-
t.style.setProperty("--reforma-listbox-highlight-top", `${
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
if (!e ||
|
|
31
|
-
|
|
32
|
+
const i = n.getBoundingClientRect();
|
|
33
|
+
return e >= i.left && e <= i.right && r >= i.top - R && r <= i.bottom + R;
|
|
34
|
+
}, M = (e) => {
|
|
35
|
+
const r = t.getBoundingClientRect(), i = e.getBoundingClientRect();
|
|
36
|
+
t.style.setProperty("--reforma-listbox-highlight-top", `${i.top - r.top + t.scrollTop}px`), t.style.setProperty("--reforma-listbox-highlight-left", `${i.left - r.left + t.scrollLeft}px`), t.style.setProperty("--reforma-listbox-highlight-width", `${i.width}px`), t.style.setProperty("--reforma-listbox-highlight-height", `${i.height}px`);
|
|
37
|
+
}, h = () => {
|
|
38
|
+
n = null, t.style.setProperty("--reforma-listbox-highlight-opacity", "0"), t.removeAttribute("data-highlight-ready"), t.removeAttribute("data-highlight-danger");
|
|
39
|
+
}, a = (e) => {
|
|
40
|
+
if (!e || $(e)) {
|
|
41
|
+
h();
|
|
32
42
|
return;
|
|
33
43
|
}
|
|
34
|
-
const r =
|
|
35
|
-
r && t.removeAttribute("data-highlight-ready"),
|
|
36
|
-
|
|
44
|
+
const r = n == null;
|
|
45
|
+
r && t.removeAttribute("data-highlight-ready"), n = e, M(e), t.toggleAttribute("data-highlight-danger", e.classList.contains(F.itemDanger)), t.style.setProperty("--reforma-listbox-highlight-opacity", "1"), r && requestAnimationFrame(() => {
|
|
46
|
+
n && t.setAttribute("data-highlight-ready", "");
|
|
37
47
|
});
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
|
|
48
|
+
}, L = (e, r, i) => {
|
|
49
|
+
u = !1;
|
|
50
|
+
const b = v(e);
|
|
51
|
+
if (b) {
|
|
52
|
+
b !== n && a(b);
|
|
43
53
|
return;
|
|
44
54
|
}
|
|
45
|
-
|
|
46
|
-
}, E = (e) => {
|
|
47
|
-
c = e.clientX, d = e.clientY, u = !0, v(e.target, e.clientX, e.clientY);
|
|
48
|
-
}, L = (e) => {
|
|
49
|
-
c = e.clientX, d = e.clientY, u = !0, v(document.elementFromPoint(e.clientX, e.clientY), e.clientX, e.clientY);
|
|
55
|
+
C(r, i) || h();
|
|
50
56
|
}, P = (e) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
g = e.clientX, p = e.clientY, d = !0, !c && L(e.target, e.clientX, e.clientY);
|
|
58
|
+
}, w = (e) => {
|
|
59
|
+
g = e.clientX, p = e.clientY, d = !0, !c && L(document.elementFromPoint(e.clientX, e.clientY), e.clientX, e.clientY);
|
|
60
|
+
}, x = (e) => {
|
|
61
|
+
if (!(e.relatedTarget instanceof Node && t.contains(e.relatedTarget)) && (d = !1, !n?.hasAttribute("data-open"))) {
|
|
62
|
+
if (u) {
|
|
63
|
+
a(E());
|
|
54
64
|
return;
|
|
55
65
|
}
|
|
56
|
-
|
|
66
|
+
h();
|
|
57
67
|
}
|
|
58
|
-
}, x = () => {
|
|
59
|
-
h = !0, requestAnimationFrame(() => {
|
|
60
|
-
h && l(p());
|
|
61
|
-
});
|
|
62
68
|
}, A = () => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
i && b(i);
|
|
75
|
-
}, w = () => {
|
|
76
|
-
i && t.setAttribute("data-highlight-ready", "");
|
|
77
|
-
}, F = new MutationObserver(() => {
|
|
78
|
-
i && l(i);
|
|
69
|
+
u = !0, requestAnimationFrame(() => {
|
|
70
|
+
u && a(E());
|
|
71
|
+
});
|
|
72
|
+
}, S = () => {
|
|
73
|
+
c = !1, d && a(v(document.elementFromPoint(g, p)));
|
|
74
|
+
}, f = () => {
|
|
75
|
+
window.clearTimeout(m), c || (c = !0, h()), m = window.setTimeout(S, q);
|
|
76
|
+
}, T = new MutationObserver(() => {
|
|
77
|
+
n && a(n);
|
|
79
78
|
});
|
|
80
|
-
|
|
79
|
+
T.observe(t, {
|
|
81
80
|
subtree: !0,
|
|
82
81
|
attributes: !0,
|
|
83
82
|
attributeFilter: ["data-selected", "data-disabled", "data-highlighted", "data-nested-selected"]
|
|
84
|
-
})
|
|
85
|
-
|
|
83
|
+
});
|
|
84
|
+
const y = D(t);
|
|
85
|
+
return t.addEventListener("pointerenter", w), t.addEventListener("pointermove", P), t.addEventListener("pointerleave", x), t.addEventListener("keydown", A), t.addEventListener("scroll", f, {
|
|
86
|
+
passive: !0
|
|
87
|
+
}), y !== t && y.addEventListener("scroll", f, {
|
|
88
|
+
passive: !0
|
|
89
|
+
}), a(t.querySelector(`${s}:hover`)), () => {
|
|
90
|
+
T.disconnect(), window.clearTimeout(m), t.removeEventListener("pointerenter", w), t.removeEventListener("pointermove", P), t.removeEventListener("pointerleave", x), t.removeEventListener("keydown", A), t.removeEventListener("scroll", f), y.removeEventListener("scroll", f), h(), t.style.removeProperty("--reforma-listbox-highlight-top"), t.style.removeProperty("--reforma-listbox-highlight-left"), t.style.removeProperty("--reforma-listbox-highlight-width"), t.style.removeProperty("--reforma-listbox-highlight-height"), t.style.removeProperty("--reforma-listbox-highlight-opacity");
|
|
86
91
|
};
|
|
87
|
-
}, [
|
|
92
|
+
}, [l, s, o, Y]);
|
|
88
93
|
}
|
|
89
94
|
export {
|
|
90
|
-
|
|
95
|
+
O as useListHoverHighlight
|
|
91
96
|
};
|
|
92
97
|
//# sourceMappingURL=useListHoverHighlight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useListHoverHighlight.js","sources":["../../src/List/useListHoverHighlight.ts"],"sourcesContent":["import { useEffect, type RefObject } from 'react';\n\nimport styles from './ListBox.module.css';\n\nconst DEFAULT_ITEM = `.${ styles.item }`;\n\n/** Keep the plate across the few pixels between rows. Empty space is farther than this. */\nconst ROW_GAP = 16;\n\ntype ListTarget = RefObject<HTMLElement | null> | HTMLElement | null;\n\nfunction resolveList(target: ListTarget): HTMLElement | null {\n if (target instanceof HTMLElement) {\n return target;\n }\n\n return target?.current ?? null;\n}\n\n/**\n * Slides one highlight plate across list/menu rows (hover + keyboard), instead of painting each row.\n */\nexport function useListHoverHighlight(\n list: ListTarget,\n enabled: boolean,\n itemSelector: string = DEFAULT_ITEM\n) {\n const listEl = list instanceof HTMLElement ? list : null;\n\n useEffect(() => {\n const root = resolveList(list);\n\n if (!root || !enabled) {\n return;\n }\n\n let followKeyboard = false;\n let current: HTMLElement | null = null;\n let pointerX = 0;\n let pointerY = 0;\n let hasPointer = false;\n\n const rowFrom = (target: EventTarget | null) => {\n if (!(target instanceof Element)) {\n return null;\n }\n\n const row = target.closest<HTMLElement>(itemSelector);\n\n if (!row || !root.contains(row)) {\n return null;\n }\n\n return row;\n };\n\n const blocked = (row: HTMLElement) => (\n row.hasAttribute('data-disabled')\n || row.hasAttribute('data-selected')\n || row.hasAttribute('data-highlighted')\n || row.hasAttribute('data-nested-selected')\n );\n\n const keyboardRow = () => (\n root.querySelector<HTMLElement>(`${ itemSelector }[data-focus-visible]`)\n );\n\n const besideCurrent = (x: number, y: number) => {\n if (!current) {\n return false;\n }\n\n const box = current.getBoundingClientRect();\n\n return x >= box.left && x <= box.right\n && y >= box.top - ROW_GAP && y <= box.bottom + ROW_GAP;\n };\n\n const setGeometry = (row: HTMLElement) => {\n const listRect = root.getBoundingClientRect();\n const rowRect = row.getBoundingClientRect();\n\n root.style.setProperty('--reforma-listbox-highlight-top', `${ rowRect.top - listRect.top + root.scrollTop }px`);\n root.style.setProperty('--reforma-listbox-highlight-left', `${ rowRect.left - listRect.left + root.scrollLeft }px`);\n root.style.setProperty('--reforma-listbox-highlight-width', `${ rowRect.width }px`);\n root.style.setProperty('--reforma-listbox-highlight-height', `${ rowRect.height }px`);\n };\n\n const hide = () => {\n current = null;\n root.style.setProperty('--reforma-listbox-highlight-opacity', '0');\n root.removeAttribute('data-highlight-ready');\n root.removeAttribute('data-highlight-danger');\n };\n\n const show = (row: HTMLElement | null) => {\n if (!row || blocked(row)) {\n hide();\n\n return;\n }\n\n const appeared = current == null;\n\n if (appeared) {\n root.removeAttribute('data-highlight-ready');\n }\n\n current = row;\n setGeometry(row);\n root.toggleAttribute('data-highlight-danger', row.classList.contains(styles.itemDanger));\n root.style.setProperty('--reforma-listbox-highlight-opacity', '1');\n\n if (appeared) {\n requestAnimationFrame(() => {\n if (current) {\n root.setAttribute('data-highlight-ready', '');\n }\n });\n }\n };\n\n const followPointer = (target: EventTarget | null, x: number, y: number) => {\n followKeyboard = false;\n const row = rowFrom(target);\n\n if (row) {\n if (row !== current) {\n show(row);\n }\n\n return;\n }\n\n if (!besideCurrent(x, y)) {\n hide();\n }\n };\n\n const onPointerMove = (event: PointerEvent) => {\n pointerX = event.clientX;\n pointerY = event.clientY;\n hasPointer = true;\n followPointer(event.target, event.clientX, event.clientY);\n };\n\n const onPointerEnter = (event: PointerEvent) => {\n pointerX = event.clientX;\n pointerY = event.clientY;\n hasPointer = true;\n followPointer(\n document.elementFromPoint(event.clientX, event.clientY),\n event.clientX,\n event.clientY\n );\n };\n\n const onPointerLeave = (event: PointerEvent) => {\n if (event.relatedTarget instanceof Node && root.contains(event.relatedTarget)) {\n return;\n }\n\n hasPointer = false;\n\n if (current?.hasAttribute('data-open')) {\n return;\n }\n\n if (followKeyboard) {\n show(keyboardRow());\n\n return;\n }\n\n hide();\n };\n\n const onKeyDown = () => {\n followKeyboard = true;\n requestAnimationFrame(() => {\n if (followKeyboard) {\n show(keyboardRow());\n }\n });\n };\n\n const onScroll = () => {\n root.removeAttribute('data-highlight-ready');\n\n // Virtualized lists recycle the hovered node; re-hit-test instead of following `current`.\n if (hasPointer) {\n const row = rowFrom(document.elementFromPoint(pointerX, pointerY));\n\n if (row) {\n show(row);\n\n return;\n }\n\n if (!besideCurrent(pointerX, pointerY)) {\n hide();\n\n return;\n }\n }\n\n if (current) {\n setGeometry(current);\n }\n };\n\n const onScrollEnd = () => {\n if (current) {\n root.setAttribute('data-highlight-ready', '');\n }\n };\n\n // Selection lands after pointerup. Re-run show so a blocked row drops the plate.\n const rowState = new MutationObserver(() => {\n if (current) {\n show(current);\n }\n });\n\n rowState.observe(root, {\n subtree: true,\n attributes: true,\n attributeFilter: ['data-selected', 'data-disabled', 'data-highlighted', 'data-nested-selected'],\n });\n\n root.addEventListener('pointerenter', onPointerEnter);\n root.addEventListener('pointermove', onPointerMove);\n root.addEventListener('pointerleave', onPointerLeave);\n root.addEventListener('keydown', onKeyDown);\n root.addEventListener('scroll', onScroll);\n root.addEventListener('scrollend', onScrollEnd);\n\n show(root.querySelector<HTMLElement>(`${ itemSelector }:hover`));\n\n return () => {\n rowState.disconnect();\n root.removeEventListener('pointerenter', onPointerEnter);\n root.removeEventListener('pointermove', onPointerMove);\n root.removeEventListener('pointerleave', onPointerLeave);\n root.removeEventListener('keydown', onKeyDown);\n root.removeEventListener('scroll', onScroll);\n root.removeEventListener('scrollend', onScrollEnd);\n hide();\n root.style.removeProperty('--reforma-listbox-highlight-top');\n root.style.removeProperty('--reforma-listbox-highlight-left');\n root.style.removeProperty('--reforma-listbox-highlight-width');\n root.style.removeProperty('--reforma-listbox-highlight-height');\n root.style.removeProperty('--reforma-listbox-highlight-opacity');\n };\n }, [enabled, itemSelector, list, listEl]);\n}\n"],"names":["DEFAULT_ITEM","styles","ROW_GAP","resolveList","target","useListHoverHighlight","list","enabled","itemSelector","listEl","useEffect","root","followKeyboard","current","pointerX","pointerY","hasPointer","rowFrom","row","blocked","keyboardRow","besideCurrent","x","y","box","setGeometry","listRect","rowRect","hide","show","appeared","followPointer","onPointerMove","event","onPointerEnter","onPointerLeave","onKeyDown","onScroll","onScrollEnd","rowState"],"mappings":";;AAEA,MAAMA,IAAe,IAAIC,EAAO,IAAI,IAG9BC,IAAU;AAChB,SAASC,EAAYC,GAAQ;AAC3B,SAAIA,aAAkB,cACbA,IAEFA,GAAQ,WAAW;AAC5B;AAKO,SAASC,EAAsBC,GAAMC,GAASC,IAAeR,GAAc;AAChF,QAAMS,IAASH,aAAgB,cAAcA,IAAO;AACpD,EAAAI,EAAU,MAAM;AACd,UAAMC,IAAOR,EAAYG,CAAI;AAC7B,QAAI,CAACK,KAAQ,CAACJ;AACZ;AAEF,QAAIK,IAAiB,IACjBC,IAAU,MACVC,IAAW,GACXC,IAAW,GACXC,IAAa;AACjB,UAAMC,IAAU,CAAAb,MAAU;AACxB,UAAI,EAAEA,aAAkB;AACtB,eAAO;AAET,YAAMc,IAAMd,EAAO,QAAQI,CAAY;AACvC,aAAI,CAACU,KAAO,CAACP,EAAK,SAASO,CAAG,IACrB,OAEFA;AAAA,IAC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9DA,EAAK,MAAM,eAAe,qCAAqC;AAAA,IACjE;AAAA,EACF,GAAG,CAACJ,GAASC,GAAcF,GAAMG,CAAM,CAAC;AAC1C;"}
|
|
1
|
+
{"version":3,"file":"useListHoverHighlight.js","sources":["../../src/List/useListHoverHighlight.ts"],"sourcesContent":["import { useEffect, type RefObject } from 'react';\n\nimport styles from './ListBox.module.css';\n\nconst DEFAULT_ITEM = `.${ styles.item }`;\n\n/** Keep the plate across the few pixels between rows. Empty space is farther than this. */\nconst ROW_GAP = 16;\nconst SCROLL_IDLE_MS = 150;\n\nfunction scrollPort(node: HTMLElement): HTMLElement {\n let current = node.parentElement;\n\n while (current && current !== document.documentElement) {\n const overflow = getComputedStyle(current).overflowY;\n\n if (overflow === 'auto' || overflow === 'scroll') {\n return current;\n }\n\n current = current.parentElement;\n }\n\n return node;\n}\n\ntype ListTarget = RefObject<HTMLElement | null> | HTMLElement | null;\n\nfunction resolveList(target: ListTarget): HTMLElement | null {\n if (target instanceof HTMLElement) {\n return target;\n }\n\n return target?.current ?? null;\n}\n\n/**\n * Slides one highlight plate across list/menu rows (hover + keyboard), instead of painting each row.\n */\nexport function useListHoverHighlight(\n list: ListTarget,\n enabled: boolean,\n itemSelector: string = DEFAULT_ITEM\n) {\n const listEl = list instanceof HTMLElement ? list : null;\n\n useEffect(() => {\n const root = resolveList(list);\n\n if (!root || !enabled) {\n return;\n }\n\n let followKeyboard = false;\n let scrolling = false;\n let scrollTimer = 0;\n let current: HTMLElement | null = null;\n let pointerX = 0;\n let pointerY = 0;\n let hasPointer = false;\n\n const rowFrom = (target: EventTarget | null) => {\n if (!(target instanceof Element)) {\n return null;\n }\n\n const row = target.closest<HTMLElement>(itemSelector);\n\n if (!row || !root.contains(row)) {\n return null;\n }\n\n return row;\n };\n\n const blocked = (row: HTMLElement) => (\n row.hasAttribute('data-disabled')\n || row.hasAttribute('data-selected')\n || row.hasAttribute('data-highlighted')\n || row.hasAttribute('data-nested-selected')\n );\n\n const keyboardRow = () => (\n root.querySelector<HTMLElement>(`${ itemSelector }[data-focus-visible]`)\n );\n\n const besideCurrent = (x: number, y: number) => {\n if (!current) {\n return false;\n }\n\n const box = current.getBoundingClientRect();\n\n return x >= box.left && x <= box.right\n && y >= box.top - ROW_GAP && y <= box.bottom + ROW_GAP;\n };\n\n const setGeometry = (row: HTMLElement) => {\n const listRect = root.getBoundingClientRect();\n const rowRect = row.getBoundingClientRect();\n\n root.style.setProperty('--reforma-listbox-highlight-top', `${ rowRect.top - listRect.top + root.scrollTop }px`);\n root.style.setProperty('--reforma-listbox-highlight-left', `${ rowRect.left - listRect.left + root.scrollLeft }px`);\n root.style.setProperty('--reforma-listbox-highlight-width', `${ rowRect.width }px`);\n root.style.setProperty('--reforma-listbox-highlight-height', `${ rowRect.height }px`);\n };\n\n const hide = () => {\n current = null;\n root.style.setProperty('--reforma-listbox-highlight-opacity', '0');\n root.removeAttribute('data-highlight-ready');\n root.removeAttribute('data-highlight-danger');\n };\n\n const show = (row: HTMLElement | null) => {\n if (!row || blocked(row)) {\n hide();\n\n return;\n }\n\n const appeared = current == null;\n\n if (appeared) {\n root.removeAttribute('data-highlight-ready');\n }\n\n current = row;\n setGeometry(row);\n root.toggleAttribute('data-highlight-danger', row.classList.contains(styles.itemDanger));\n root.style.setProperty('--reforma-listbox-highlight-opacity', '1');\n\n if (appeared) {\n requestAnimationFrame(() => {\n if (current) {\n root.setAttribute('data-highlight-ready', '');\n }\n });\n }\n };\n\n const followPointer = (target: EventTarget | null, x: number, y: number) => {\n followKeyboard = false;\n const row = rowFrom(target);\n\n if (row) {\n if (row !== current) {\n show(row);\n }\n\n return;\n }\n\n if (!besideCurrent(x, y)) {\n hide();\n }\n };\n\n const onPointerMove = (event: PointerEvent) => {\n pointerX = event.clientX;\n pointerY = event.clientY;\n hasPointer = true;\n\n if (scrolling) {\n return;\n }\n\n followPointer(event.target, event.clientX, event.clientY);\n };\n\n const onPointerEnter = (event: PointerEvent) => {\n pointerX = event.clientX;\n pointerY = event.clientY;\n hasPointer = true;\n\n if (scrolling) {\n return;\n }\n\n followPointer(\n document.elementFromPoint(event.clientX, event.clientY),\n event.clientX,\n event.clientY\n );\n };\n\n const onPointerLeave = (event: PointerEvent) => {\n if (event.relatedTarget instanceof Node && root.contains(event.relatedTarget)) {\n return;\n }\n\n hasPointer = false;\n\n if (current?.hasAttribute('data-open')) {\n return;\n }\n\n if (followKeyboard) {\n show(keyboardRow());\n\n return;\n }\n\n hide();\n };\n\n const onKeyDown = () => {\n followKeyboard = true;\n requestAnimationFrame(() => {\n if (followKeyboard) {\n show(keyboardRow());\n }\n });\n };\n\n const finishScroll = () => {\n scrolling = false;\n\n if (!hasPointer) {\n return;\n }\n\n show(rowFrom(document.elementFromPoint(pointerX, pointerY)));\n };\n\n const onScroll = () => {\n window.clearTimeout(scrollTimer);\n\n if (!scrolling) {\n scrolling = true;\n hide();\n }\n\n scrollTimer = window.setTimeout(finishScroll, SCROLL_IDLE_MS);\n };\n\n // Selection lands after pointerup. Re-run show so a blocked row drops the plate.\n const rowState = new MutationObserver(() => {\n if (current) {\n show(current);\n }\n });\n\n rowState.observe(root, {\n subtree: true,\n attributes: true,\n attributeFilter: ['data-selected', 'data-disabled', 'data-highlighted', 'data-nested-selected'],\n });\n\n const port = scrollPort(root);\n\n root.addEventListener('pointerenter', onPointerEnter);\n root.addEventListener('pointermove', onPointerMove);\n root.addEventListener('pointerleave', onPointerLeave);\n root.addEventListener('keydown', onKeyDown);\n root.addEventListener('scroll', onScroll, { passive: true });\n\n if (port !== root) {\n port.addEventListener('scroll', onScroll, { passive: true });\n }\n\n show(root.querySelector<HTMLElement>(`${ itemSelector }:hover`));\n\n return () => {\n rowState.disconnect();\n window.clearTimeout(scrollTimer);\n root.removeEventListener('pointerenter', onPointerEnter);\n root.removeEventListener('pointermove', onPointerMove);\n root.removeEventListener('pointerleave', onPointerLeave);\n root.removeEventListener('keydown', onKeyDown);\n root.removeEventListener('scroll', onScroll);\n port.removeEventListener('scroll', onScroll);\n hide();\n root.style.removeProperty('--reforma-listbox-highlight-top');\n root.style.removeProperty('--reforma-listbox-highlight-left');\n root.style.removeProperty('--reforma-listbox-highlight-width');\n root.style.removeProperty('--reforma-listbox-highlight-height');\n root.style.removeProperty('--reforma-listbox-highlight-opacity');\n };\n }, [enabled, itemSelector, list, listEl]);\n}\n"],"names":["DEFAULT_ITEM","styles","ROW_GAP","SCROLL_IDLE_MS","scrollPort","node","current","overflow","resolveList","target","useListHoverHighlight","list","enabled","itemSelector","listEl","useEffect","root","followKeyboard","scrolling","scrollTimer","pointerX","pointerY","hasPointer","rowFrom","row","blocked","keyboardRow","besideCurrent","x","y","box","setGeometry","listRect","rowRect","hide","show","appeared","followPointer","onPointerMove","event","onPointerEnter","onPointerLeave","onKeyDown","finishScroll","onScroll","rowState","port"],"mappings":";;AAEA,MAAMA,IAAe,IAAIC,EAAO,IAAI,IAG9BC,IAAU,IACVC,IAAiB;AACvB,SAASC,EAAWC,GAAM;AACxB,MAAIC,IAAUD,EAAK;AACnB,SAAOC,KAAWA,MAAY,SAAS,mBAAiB;AACtD,UAAMC,IAAW,iBAAiBD,CAAO,EAAE;AAC3C,QAAIC,MAAa,UAAUA,MAAa;AACtC,aAAOD;AAET,IAAAA,IAAUA,EAAQ;AAAA,EACpB;AACA,SAAOD;AACT;AACA,SAASG,EAAYC,GAAQ;AAC3B,SAAIA,aAAkB,cACbA,IAEFA,GAAQ,WAAW;AAC5B;AAKO,SAASC,EAAsBC,GAAMC,GAASC,IAAeb,GAAc;AAChF,QAAMc,IAASH,aAAgB,cAAcA,IAAO;AACpD,EAAAI,EAAU,MAAM;AACd,UAAMC,IAAOR,EAAYG,CAAI;AAC7B,QAAI,CAACK,KAAQ,CAACJ;AACZ;AAEF,QAAIK,IAAiB,IACjBC,IAAY,IACZC,IAAc,GACdb,IAAU,MACVc,IAAW,GACXC,IAAW,GACXC,IAAa;AACjB,UAAMC,IAAU,CAAAd,MAAU;AACxB,UAAI,EAAEA,aAAkB;AACtB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