@flanksource/clicky-ui 0.3.52 → 0.3.54
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/components/clipboard.cjs +76 -11
- package/dist/components/clipboard.cjs.map +1 -1
- package/dist/components/clipboard.d.ts +37 -6
- package/dist/components/clipboard.d.ts.map +1 -1
- package/dist/components/clipboard.js +75 -12
- package/dist/components/clipboard.js.map +1 -1
- package/dist/components.cjs +2 -0
- package/dist/components.d.ts +1 -1
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +2 -2
- package/dist/data/MatrixTreeTable.cjs +94 -0
- package/dist/data/MatrixTreeTable.cjs.map +1 -0
- package/dist/data/MatrixTreeTable.d.ts +40 -0
- package/dist/data/MatrixTreeTable.d.ts.map +1 -0
- package/dist/data/MatrixTreeTable.js +92 -0
- package/dist/data/MatrixTreeTable.js.map +1 -0
- package/dist/data/TaskManager.cjs +39 -32
- package/dist/data/TaskManager.cjs.map +1 -1
- package/dist/data/TaskManager.d.ts +6 -1
- package/dist/data/TaskManager.d.ts.map +1 -1
- package/dist/data/TaskManager.js +39 -32
- package/dist/data/TaskManager.js.map +1 -1
- package/dist/data/TreeDataTable.cjs +52 -0
- package/dist/data/TreeDataTable.cjs.map +1 -0
- package/dist/data/TreeDataTable.d.ts +17 -0
- package/dist/data/TreeDataTable.d.ts.map +1 -0
- package/dist/data/TreeDataTable.js +52 -0
- package/dist/data/TreeDataTable.js.map +1 -0
- package/dist/data/clicky-export/ClickyExportDialog.cjs +4 -3
- package/dist/data/clicky-export/ClickyExportDialog.cjs.map +1 -1
- package/dist/data/clicky-export/ClickyExportDialog.d.ts +4 -1
- package/dist/data/clicky-export/ClickyExportDialog.d.ts.map +1 -1
- package/dist/data/clicky-export/ClickyExportDialog.js +4 -3
- package/dist/data/clicky-export/ClickyExportDialog.js.map +1 -1
- package/dist/data/test-runner/MatrixMarks.cjs +212 -0
- package/dist/data/test-runner/MatrixMarks.cjs.map +1 -0
- package/dist/data/test-runner/MatrixMarks.d.ts +76 -0
- package/dist/data/test-runner/MatrixMarks.d.ts.map +1 -0
- package/dist/data/test-runner/MatrixMarks.js +205 -0
- package/dist/data/test-runner/MatrixMarks.js.map +1 -0
- package/dist/data/test-runner/TestDetailPanel.cjs +3 -0
- package/dist/data/test-runner/TestDetailPanel.cjs.map +1 -1
- package/dist/data/test-runner/TestDetailPanel.d.ts.map +1 -1
- package/dist/data/test-runner/TestDetailPanel.js +3 -0
- package/dist/data/test-runner/TestDetailPanel.js.map +1 -1
- package/dist/data/test-runner/index.d.ts +2 -0
- package/dist/data/test-runner/index.d.ts.map +1 -1
- package/dist/data/test-runner/matrix-marks.cjs +119 -0
- package/dist/data/test-runner/matrix-marks.cjs.map +1 -0
- package/dist/data/test-runner/matrix-marks.d.ts +154 -0
- package/dist/data/test-runner/matrix-marks.d.ts.map +1 -0
- package/dist/data/test-runner/matrix-marks.js +113 -0
- package/dist/data/test-runner/matrix-marks.js.map +1 -0
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/data.cjs +27 -0
- package/dist/data.d.ts +3 -0
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +6 -1
- package/dist/hooks/use-task-run.cjs +22 -9
- package/dist/hooks/use-task-run.cjs.map +1 -1
- package/dist/hooks/use-task-run.d.ts +2 -0
- package/dist/hooks/use-task-run.d.ts.map +1 -1
- package/dist/hooks/use-task-run.js +22 -9
- package/dist/hooks/use-task-run.js.map +1 -1
- package/dist/index.cjs +29 -0
- package/dist/index.js +7 -2
- package/dist/lib/tree-rows.cjs +63 -0
- package/dist/lib/tree-rows.cjs.map +1 -0
- package/dist/lib/tree-rows.d.ts +36 -0
- package/dist/lib/tree-rows.d.ts.map +1 -0
- package/dist/lib/tree-rows.js +60 -0
- package/dist/lib/tree-rows.js.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
let react = require("react");
|
|
2
2
|
// src/components/clipboard.ts
|
|
3
|
+
function richBlob(payload, type, pick) {
|
|
4
|
+
return payload.then((resolved) => {
|
|
5
|
+
const value = pick(resolved);
|
|
6
|
+
if (typeof value !== "string") throw new Error(`Rich copy payload has no ${type === "text/html" ? "html" : "text"} string`);
|
|
7
|
+
return new Blob([value], { type });
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* copyRich writes `payload` as one ClipboardItem carrying both `text/html` and
|
|
12
|
+
* `text/plain`. The item is built from Promise<Blob>s and written before the
|
|
13
|
+
* payload settles, so a payload fetched from the server after the click still
|
|
14
|
+
* counts as inside the user gesture (Safari and Chrome both require that).
|
|
15
|
+
* Rejects when the browser lacks ClipboardItem or `navigator.clipboard.write`,
|
|
16
|
+
* or when the payload rejects — never degrading to a text-only copy.
|
|
17
|
+
*/
|
|
18
|
+
async function copyRich(payload) {
|
|
19
|
+
const pending = Promise.resolve(payload);
|
|
20
|
+
await writeClipboardItem("Rich copy", {
|
|
21
|
+
"text/html": richBlob(pending, "text/html", (resolved) => resolved.html),
|
|
22
|
+
"text/plain": richBlob(pending, "text/plain", (resolved) => resolved.text)
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* copyPendingText writes text that is still loading as a `text/plain`-only
|
|
27
|
+
* ClipboardItem, started before the text settles so it stays inside the user
|
|
28
|
+
* gesture. `copyText` cannot: awaiting the text first would leave the gesture.
|
|
29
|
+
* Rejects when the browser lacks ClipboardItem or `navigator.clipboard.write`,
|
|
30
|
+
* or when the text rejects or is not a string.
|
|
31
|
+
*/
|
|
32
|
+
async function copyPendingText(text) {
|
|
33
|
+
await writeClipboardItem("Text copy", { "text/plain": text.then((value) => {
|
|
34
|
+
if (typeof value !== "string") throw new Error("Text copy payload is not a string");
|
|
35
|
+
return new Blob([value], { type: "text/plain" });
|
|
36
|
+
}) });
|
|
37
|
+
}
|
|
38
|
+
async function writeClipboardItem(what, blobs) {
|
|
39
|
+
if (typeof ClipboardItem === "undefined") throw new Error(`${what} is unsupported: this browser has no ClipboardItem`);
|
|
40
|
+
if (typeof navigator === "undefined" || typeof navigator.clipboard?.write !== "function") throw new Error(`${what} is unsupported: navigator.clipboard.write is unavailable (insecure origin or blocked by the host)`);
|
|
41
|
+
for (const blob of Object.values(blobs)) blob.catch(() => void 0);
|
|
42
|
+
await navigator.clipboard.write([new ClipboardItem(blobs)]);
|
|
43
|
+
await Promise.all(Object.values(blobs));
|
|
44
|
+
}
|
|
3
45
|
async function copyText(text) {
|
|
4
46
|
if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) try {
|
|
5
47
|
await navigator.clipboard.writeText(text);
|
|
@@ -24,29 +66,52 @@ async function copyText(text) {
|
|
|
24
66
|
if (!copied) throw new Error("Browser rejected the copy request");
|
|
25
67
|
}
|
|
26
68
|
/**
|
|
27
|
-
* Drives a copy affordance's transient feedback
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
69
|
+
* Drives a copy affordance's transient feedback. `copy(text)` writes plain text
|
|
70
|
+
* and flips `state` to `copied`/`error`, reverting after `resetMs`. `copy` with
|
|
71
|
+
* `{ plain: Promise<string> }` goes through `copyPendingText`, and with a rich
|
|
72
|
+
* payload (or a promise of one) through `copyRich`; both keep `state`
|
|
73
|
+
* `pending` until the clipboard write settles, then `copied`/`error`, reverting
|
|
74
|
+
* after `resetMs`. Only the latest copy updates `state`, and nothing does once
|
|
75
|
+
* the component unmounts.
|
|
31
76
|
*/
|
|
32
77
|
function useCopyFlash(resetMs = 1500) {
|
|
33
78
|
const [state, setState] = (0, react.useState)("idle");
|
|
34
79
|
const timer = (0, react.useRef)(null);
|
|
80
|
+
const latest = (0, react.useRef)(0);
|
|
35
81
|
(0, react.useEffect)(() => () => {
|
|
82
|
+
latest.current += 1;
|
|
36
83
|
if (timer.current !== null) clearTimeout(timer.current);
|
|
37
84
|
}, []);
|
|
85
|
+
const scheduleReset = (0, react.useCallback)(() => {
|
|
86
|
+
if (timer.current !== null) clearTimeout(timer.current);
|
|
87
|
+
timer.current = setTimeout(() => {
|
|
88
|
+
timer.current = null;
|
|
89
|
+
setState("idle");
|
|
90
|
+
}, resetMs);
|
|
91
|
+
}, [resetMs]);
|
|
38
92
|
return {
|
|
39
93
|
state,
|
|
40
|
-
copy: (0, react.useCallback)((
|
|
41
|
-
|
|
94
|
+
copy: (0, react.useCallback)((payload) => {
|
|
95
|
+
const id = ++latest.current;
|
|
96
|
+
if (typeof payload === "string") {
|
|
97
|
+
copyText(payload).then(() => id === latest.current && setState("copied"), () => id === latest.current && setState("error"));
|
|
98
|
+
scheduleReset();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
42
101
|
if (timer.current !== null) clearTimeout(timer.current);
|
|
43
|
-
timer.current =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
102
|
+
timer.current = null;
|
|
103
|
+
setState("pending");
|
|
104
|
+
const settle = (next) => {
|
|
105
|
+
if (id !== latest.current) return;
|
|
106
|
+
setState(next);
|
|
107
|
+
scheduleReset();
|
|
108
|
+
};
|
|
109
|
+
("plain" in payload ? copyPendingText(payload.plain) : copyRich(payload)).then(() => settle("copied"), () => settle("error"));
|
|
110
|
+
}, [scheduleReset])
|
|
48
111
|
};
|
|
49
112
|
}
|
|
113
|
+
exports.copyPendingText = copyPendingText;
|
|
114
|
+
exports.copyRich = copyRich;
|
|
50
115
|
exports.copyText = copyText;
|
|
51
116
|
exports.useCopyFlash = useCopyFlash;
|
|
52
117
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.cjs","names":["useState","useRef","useCallback"],"sources":["../../src/components/clipboard.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport type CopyFlashState = \"idle\" | \"copied\" | \"error\";\n\n// copyText writes text to the clipboard, falling back to a hidden-textarea\n// execCommand(\"copy\") when the async Clipboard API is unavailable or rejects —\n// an insecure (http) origin, or an embedded WebView where writeText is denied.\n// Rejects when both paths fail so callers can surface the failure instead of a\n// copy button that silently does nothing.\nexport async function copyText(text: string): Promise<void> {\n if (typeof navigator !== \"undefined\" && navigator.clipboard?.writeText) {\n try {\n await navigator.clipboard.writeText(text);\n return;\n } catch {\n // Fall through to the user-gesture copy path below.\n }\n }\n // execCommand is absent in jsdom and deprecated in browsers, so treat a\n // missing one as a rejection rather than letting a TypeError escape.\n if (typeof document === \"undefined\" || typeof document.execCommand !== \"function\") {\n throw new Error(\"Browser rejected the copy request\");\n }\n const textarea = document.createElement(\"textarea\");\n textarea.value = text;\n textarea.style.position = \"fixed\";\n textarea.style.opacity = \"0\";\n document.body.appendChild(textarea);\n textarea.focus();\n textarea.select();\n let copied = false;\n try {\n copied = document.execCommand(\"copy\");\n } catch {\n copied = false;\n } finally {\n document.body.removeChild(textarea);\n }\n if (!copied) throw new Error(\"Browser rejected the copy request\");\n}\n\n/**\n * Drives a copy affordance's transient feedback
|
|
1
|
+
{"version":3,"file":"clipboard.cjs","names":["useState","useRef","useCallback"],"sources":["../../src/components/clipboard.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport type CopyFlashState = \"idle\" | \"pending\" | \"copied\" | \"error\";\n\n/** Rich text for the clipboard: `html` pastes formatted, `text` is the plain alternative. */\nexport type RichClipboardPayload = { text: string; html: string };\n\n/** Plain text that is still loading, copied as a `text/plain`-only ClipboardItem. */\nexport type PendingTextPayload = { plain: Promise<string> };\n\n/** What `useCopyFlash().copy` accepts: plain text (possibly still loading), or a rich payload that may still be loading. */\nexport type CopyFlashPayload =\n | string\n | PendingTextPayload\n | RichClipboardPayload\n | Promise<RichClipboardPayload>;\n\nfunction richBlob(\n payload: Promise<RichClipboardPayload>,\n type: \"text/html\" | \"text/plain\",\n pick: (payload: RichClipboardPayload) => unknown,\n): Promise<Blob> {\n return payload.then((resolved) => {\n const value = pick(resolved);\n if (typeof value !== \"string\") {\n throw new Error(`Rich copy payload has no ${type === \"text/html\" ? \"html\" : \"text\"} string`);\n }\n return new Blob([value], { type });\n });\n}\n\n/**\n * copyRich writes `payload` as one ClipboardItem carrying both `text/html` and\n * `text/plain`. The item is built from Promise<Blob>s and written before the\n * payload settles, so a payload fetched from the server after the click still\n * counts as inside the user gesture (Safari and Chrome both require that).\n * Rejects when the browser lacks ClipboardItem or `navigator.clipboard.write`,\n * or when the payload rejects — never degrading to a text-only copy.\n */\nexport async function copyRich(\n payload: Promise<RichClipboardPayload> | RichClipboardPayload,\n): Promise<void> {\n const pending = Promise.resolve(payload);\n await writeClipboardItem(\"Rich copy\", {\n \"text/html\": richBlob(pending, \"text/html\", (resolved) => resolved.html),\n \"text/plain\": richBlob(pending, \"text/plain\", (resolved) => resolved.text),\n });\n}\n\n/**\n * copyPendingText writes text that is still loading as a `text/plain`-only\n * ClipboardItem, started before the text settles so it stays inside the user\n * gesture. `copyText` cannot: awaiting the text first would leave the gesture.\n * Rejects when the browser lacks ClipboardItem or `navigator.clipboard.write`,\n * or when the text rejects or is not a string.\n */\nexport async function copyPendingText(text: Promise<string>): Promise<void> {\n await writeClipboardItem(\"Text copy\", {\n \"text/plain\": text.then((value) => {\n if (typeof value !== \"string\") throw new Error(\"Text copy payload is not a string\");\n return new Blob([value], { type: \"text/plain\" });\n }),\n });\n}\n\nasync function writeClipboardItem(what: string, blobs: Record<string, Promise<Blob>>): Promise<void> {\n if (typeof ClipboardItem === \"undefined\") {\n throw new Error(`${what} is unsupported: this browser has no ClipboardItem`);\n }\n if (typeof navigator === \"undefined\" || typeof navigator.clipboard?.write !== \"function\") {\n throw new Error(\n `${what} is unsupported: navigator.clipboard.write is unavailable (insecure origin or blocked by the host)`,\n );\n }\n // The browser may stop reading the item after the first rejected blob; the\n // rejection still reaches the caller through the Promise.all below.\n for (const blob of Object.values(blobs)) blob.catch(() => undefined);\n await navigator.clipboard.write([new ClipboardItem(blobs)]);\n await Promise.all(Object.values(blobs));\n}\n\n// copyText writes text to the clipboard, falling back to a hidden-textarea\n// execCommand(\"copy\") when the async Clipboard API is unavailable or rejects —\n// an insecure (http) origin, or an embedded WebView where writeText is denied.\n// Rejects when both paths fail so callers can surface the failure instead of a\n// copy button that silently does nothing.\nexport async function copyText(text: string): Promise<void> {\n if (typeof navigator !== \"undefined\" && navigator.clipboard?.writeText) {\n try {\n await navigator.clipboard.writeText(text);\n return;\n } catch {\n // Fall through to the user-gesture copy path below.\n }\n }\n // execCommand is absent in jsdom and deprecated in browsers, so treat a\n // missing one as a rejection rather than letting a TypeError escape.\n if (typeof document === \"undefined\" || typeof document.execCommand !== \"function\") {\n throw new Error(\"Browser rejected the copy request\");\n }\n const textarea = document.createElement(\"textarea\");\n textarea.value = text;\n textarea.style.position = \"fixed\";\n textarea.style.opacity = \"0\";\n document.body.appendChild(textarea);\n textarea.focus();\n textarea.select();\n let copied = false;\n try {\n copied = document.execCommand(\"copy\");\n } catch {\n copied = false;\n } finally {\n document.body.removeChild(textarea);\n }\n if (!copied) throw new Error(\"Browser rejected the copy request\");\n}\n\n/**\n * Drives a copy affordance's transient feedback. `copy(text)` writes plain text\n * and flips `state` to `copied`/`error`, reverting after `resetMs`. `copy` with\n * `{ plain: Promise<string> }` goes through `copyPendingText`, and with a rich\n * payload (or a promise of one) through `copyRich`; both keep `state`\n * `pending` until the clipboard write settles, then `copied`/`error`, reverting\n * after `resetMs`. Only the latest copy updates `state`, and nothing does once\n * the component unmounts.\n */\nexport function useCopyFlash(resetMs = 1500): {\n state: CopyFlashState;\n copy: (payload: CopyFlashPayload) => void;\n} {\n const [state, setState] = useState<CopyFlashState>(\"idle\");\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const latest = useRef(0);\n\n useEffect(\n () => () => {\n latest.current += 1;\n if (timer.current !== null) clearTimeout(timer.current);\n },\n [],\n );\n\n const scheduleReset = useCallback(() => {\n if (timer.current !== null) clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n timer.current = null;\n setState(\"idle\");\n }, resetMs);\n }, [resetMs]);\n\n const copy = useCallback(\n (payload: CopyFlashPayload) => {\n const id = ++latest.current;\n if (typeof payload === \"string\") {\n void copyText(payload).then(\n () => id === latest.current && setState(\"copied\"),\n () => id === latest.current && setState(\"error\"),\n );\n scheduleReset();\n return;\n }\n if (timer.current !== null) clearTimeout(timer.current);\n timer.current = null;\n setState(\"pending\");\n const settle = (next: CopyFlashState) => {\n if (id !== latest.current) return;\n setState(next);\n scheduleReset();\n };\n const write = \"plain\" in payload ? copyPendingText(payload.plain) : copyRich(payload);\n void write.then(\n () => settle(\"copied\"),\n () => settle(\"error\"),\n );\n },\n [scheduleReset],\n );\n\n return { state, copy };\n}\n"],"mappings":";;AAiBA,SAAS,SACP,SACA,MACA,MACe;CACf,OAAO,QAAQ,MAAM,aAAa;EAChC,MAAM,QAAQ,KAAK,QAAQ;EAC3B,IAAI,OAAO,UAAU,UACnB,MAAM,IAAI,MAAM,4BAA4B,SAAS,cAAc,SAAS,OAAO,QAAQ;EAE7F,OAAO,IAAI,KAAK,CAAC,KAAK,GAAG,EAAE,KAAK,CAAC;CACnC,CAAC;AACH;;;;;;;;;AAUA,eAAsB,SACpB,SACe;CACf,MAAM,UAAU,QAAQ,QAAQ,OAAO;CACvC,MAAM,mBAAmB,aAAa;EACpC,aAAa,SAAS,SAAS,cAAc,aAAa,SAAS,IAAI;EACvE,cAAc,SAAS,SAAS,eAAe,aAAa,SAAS,IAAI;CAC3E,CAAC;AACH;;;;;;;;AASA,eAAsB,gBAAgB,MAAsC;CAC1E,MAAM,mBAAmB,aAAa,EACpC,cAAc,KAAK,MAAM,UAAU;EACjC,IAAI,OAAO,UAAU,UAAU,MAAM,IAAI,MAAM,mCAAmC;EAClF,OAAO,IAAI,KAAK,CAAC,KAAK,GAAG,EAAE,MAAM,aAAa,CAAC;CACjD,CAAC,EACH,CAAC;AACH;AAEA,eAAe,mBAAmB,MAAc,OAAqD;CACnG,IAAI,OAAO,kBAAkB,aAC3B,MAAM,IAAI,MAAM,GAAG,KAAK,mDAAmD;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BC,MAAAA,YAAAA,OAAkB;EACtC,IAAI,MAAM,YAAY,MAAM,aAAa,MAAM,OAAO;EACtD,MAAM,UAAU,iBAAiB;GAC/B,MAAM,UAAU;GAChB,SAAS,MAAM;EACjB,GAAG,OAAO;CACZ,GAAG,CAAC,OAAO,CAAC;CA8BZ,OAAO;EAAE;EAAO,OAAA,GA5BHA,MAAAA,YAAAA,EACV,YAA8B;GAC7B,MAAM,KAAK,EAAE,OAAO;GACpB,IAAI,OAAO,YAAY,UAAU;IAC/B,SAAc,OAAO,CAAC,CAAC,WACf,OAAO,OAAO,WAAW,SAAS,QAAQ,SAC1C,OAAO,OAAO,WAAW,SAAS,OAAO,CACjD;IACA,cAAc;IACd;GACF;GACA,IAAI,MAAM,YAAY,MAAM,aAAa,MAAM,OAAO;GACtD,MAAM,UAAU;GAChB,SAAS,SAAS;GAClB,MAAM,UAAU,SAAyB;IACvC,IAAI,OAAO,OAAO,SAAS;IAC3B,SAAS,IAAI;IACb,cAAc;GAChB;GAEA,CADc,WAAW,UAAU,gBAAgB,QAAQ,KAAK,IAAI,SAAS,OAAO,EAAA,CACzE,WACH,OAAO,QAAQ,SACf,OAAO,OAAO,CACtB;EACF,GACA,CAAC,aAAa,CAGA;CAAK;AACvB"}
|
|
@@ -1,13 +1,44 @@
|
|
|
1
|
-
export type CopyFlashState = "idle" | "copied" | "error";
|
|
1
|
+
export type CopyFlashState = "idle" | "pending" | "copied" | "error";
|
|
2
|
+
/** Rich text for the clipboard: `html` pastes formatted, `text` is the plain alternative. */
|
|
3
|
+
export type RichClipboardPayload = {
|
|
4
|
+
text: string;
|
|
5
|
+
html: string;
|
|
6
|
+
};
|
|
7
|
+
/** Plain text that is still loading, copied as a `text/plain`-only ClipboardItem. */
|
|
8
|
+
export type PendingTextPayload = {
|
|
9
|
+
plain: Promise<string>;
|
|
10
|
+
};
|
|
11
|
+
/** What `useCopyFlash().copy` accepts: plain text (possibly still loading), or a rich payload that may still be loading. */
|
|
12
|
+
export type CopyFlashPayload = string | PendingTextPayload | RichClipboardPayload | Promise<RichClipboardPayload>;
|
|
13
|
+
/**
|
|
14
|
+
* copyRich writes `payload` as one ClipboardItem carrying both `text/html` and
|
|
15
|
+
* `text/plain`. The item is built from Promise<Blob>s and written before the
|
|
16
|
+
* payload settles, so a payload fetched from the server after the click still
|
|
17
|
+
* counts as inside the user gesture (Safari and Chrome both require that).
|
|
18
|
+
* Rejects when the browser lacks ClipboardItem or `navigator.clipboard.write`,
|
|
19
|
+
* or when the payload rejects — never degrading to a text-only copy.
|
|
20
|
+
*/
|
|
21
|
+
export declare function copyRich(payload: Promise<RichClipboardPayload> | RichClipboardPayload): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* copyPendingText writes text that is still loading as a `text/plain`-only
|
|
24
|
+
* ClipboardItem, started before the text settles so it stays inside the user
|
|
25
|
+
* gesture. `copyText` cannot: awaiting the text first would leave the gesture.
|
|
26
|
+
* Rejects when the browser lacks ClipboardItem or `navigator.clipboard.write`,
|
|
27
|
+
* or when the text rejects or is not a string.
|
|
28
|
+
*/
|
|
29
|
+
export declare function copyPendingText(text: Promise<string>): Promise<void>;
|
|
2
30
|
export declare function copyText(text: string): Promise<void>;
|
|
3
31
|
/**
|
|
4
|
-
* Drives a copy affordance's transient feedback
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
32
|
+
* Drives a copy affordance's transient feedback. `copy(text)` writes plain text
|
|
33
|
+
* and flips `state` to `copied`/`error`, reverting after `resetMs`. `copy` with
|
|
34
|
+
* `{ plain: Promise<string> }` goes through `copyPendingText`, and with a rich
|
|
35
|
+
* payload (or a promise of one) through `copyRich`; both keep `state`
|
|
36
|
+
* `pending` until the clipboard write settles, then `copied`/`error`, reverting
|
|
37
|
+
* after `resetMs`. Only the latest copy updates `state`, and nothing does once
|
|
38
|
+
* the component unmounts.
|
|
8
39
|
*/
|
|
9
40
|
export declare function useCopyFlash(resetMs?: number): {
|
|
10
41
|
state: CopyFlashState;
|
|
11
|
-
copy: (
|
|
42
|
+
copy: (payload: CopyFlashPayload) => void;
|
|
12
43
|
};
|
|
13
44
|
//# sourceMappingURL=clipboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/components/clipboard.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/components/clipboard.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAErE,6FAA6F;AAC7F,MAAM,MAAM,oBAAoB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAElE,qFAAqF;AACrF,MAAM,MAAM,kBAAkB,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAE5D,4HAA4H;AAC5H,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,kBAAkB,GAClB,oBAAoB,GACpB,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAgBlC;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,oBAAoB,GAC5D,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAO1E;AAuBD,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8B1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,OAAO,SAAO,GAAG;IAC5C,KAAK,EAAE,cAAc,CAAC;IACtB,IAAI,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC3C,CAkDA"}
|
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
2
|
// src/components/clipboard.ts
|
|
3
|
+
function richBlob(payload, type, pick) {
|
|
4
|
+
return payload.then((resolved) => {
|
|
5
|
+
const value = pick(resolved);
|
|
6
|
+
if (typeof value !== "string") throw new Error(`Rich copy payload has no ${type === "text/html" ? "html" : "text"} string`);
|
|
7
|
+
return new Blob([value], { type });
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* copyRich writes `payload` as one ClipboardItem carrying both `text/html` and
|
|
12
|
+
* `text/plain`. The item is built from Promise<Blob>s and written before the
|
|
13
|
+
* payload settles, so a payload fetched from the server after the click still
|
|
14
|
+
* counts as inside the user gesture (Safari and Chrome both require that).
|
|
15
|
+
* Rejects when the browser lacks ClipboardItem or `navigator.clipboard.write`,
|
|
16
|
+
* or when the payload rejects — never degrading to a text-only copy.
|
|
17
|
+
*/
|
|
18
|
+
async function copyRich(payload) {
|
|
19
|
+
const pending = Promise.resolve(payload);
|
|
20
|
+
await writeClipboardItem("Rich copy", {
|
|
21
|
+
"text/html": richBlob(pending, "text/html", (resolved) => resolved.html),
|
|
22
|
+
"text/plain": richBlob(pending, "text/plain", (resolved) => resolved.text)
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* copyPendingText writes text that is still loading as a `text/plain`-only
|
|
27
|
+
* ClipboardItem, started before the text settles so it stays inside the user
|
|
28
|
+
* gesture. `copyText` cannot: awaiting the text first would leave the gesture.
|
|
29
|
+
* Rejects when the browser lacks ClipboardItem or `navigator.clipboard.write`,
|
|
30
|
+
* or when the text rejects or is not a string.
|
|
31
|
+
*/
|
|
32
|
+
async function copyPendingText(text) {
|
|
33
|
+
await writeClipboardItem("Text copy", { "text/plain": text.then((value) => {
|
|
34
|
+
if (typeof value !== "string") throw new Error("Text copy payload is not a string");
|
|
35
|
+
return new Blob([value], { type: "text/plain" });
|
|
36
|
+
}) });
|
|
37
|
+
}
|
|
38
|
+
async function writeClipboardItem(what, blobs) {
|
|
39
|
+
if (typeof ClipboardItem === "undefined") throw new Error(`${what} is unsupported: this browser has no ClipboardItem`);
|
|
40
|
+
if (typeof navigator === "undefined" || typeof navigator.clipboard?.write !== "function") throw new Error(`${what} is unsupported: navigator.clipboard.write is unavailable (insecure origin or blocked by the host)`);
|
|
41
|
+
for (const blob of Object.values(blobs)) blob.catch(() => void 0);
|
|
42
|
+
await navigator.clipboard.write([new ClipboardItem(blobs)]);
|
|
43
|
+
await Promise.all(Object.values(blobs));
|
|
44
|
+
}
|
|
3
45
|
async function copyText(text) {
|
|
4
46
|
if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) try {
|
|
5
47
|
await navigator.clipboard.writeText(text);
|
|
@@ -24,29 +66,50 @@ async function copyText(text) {
|
|
|
24
66
|
if (!copied) throw new Error("Browser rejected the copy request");
|
|
25
67
|
}
|
|
26
68
|
/**
|
|
27
|
-
* Drives a copy affordance's transient feedback
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
69
|
+
* Drives a copy affordance's transient feedback. `copy(text)` writes plain text
|
|
70
|
+
* and flips `state` to `copied`/`error`, reverting after `resetMs`. `copy` with
|
|
71
|
+
* `{ plain: Promise<string> }` goes through `copyPendingText`, and with a rich
|
|
72
|
+
* payload (or a promise of one) through `copyRich`; both keep `state`
|
|
73
|
+
* `pending` until the clipboard write settles, then `copied`/`error`, reverting
|
|
74
|
+
* after `resetMs`. Only the latest copy updates `state`, and nothing does once
|
|
75
|
+
* the component unmounts.
|
|
31
76
|
*/
|
|
32
77
|
function useCopyFlash(resetMs = 1500) {
|
|
33
78
|
const [state, setState] = useState("idle");
|
|
34
79
|
const timer = useRef(null);
|
|
80
|
+
const latest = useRef(0);
|
|
35
81
|
useEffect(() => () => {
|
|
82
|
+
latest.current += 1;
|
|
36
83
|
if (timer.current !== null) clearTimeout(timer.current);
|
|
37
84
|
}, []);
|
|
85
|
+
const scheduleReset = useCallback(() => {
|
|
86
|
+
if (timer.current !== null) clearTimeout(timer.current);
|
|
87
|
+
timer.current = setTimeout(() => {
|
|
88
|
+
timer.current = null;
|
|
89
|
+
setState("idle");
|
|
90
|
+
}, resetMs);
|
|
91
|
+
}, [resetMs]);
|
|
38
92
|
return {
|
|
39
93
|
state,
|
|
40
|
-
copy: useCallback((
|
|
41
|
-
|
|
94
|
+
copy: useCallback((payload) => {
|
|
95
|
+
const id = ++latest.current;
|
|
96
|
+
if (typeof payload === "string") {
|
|
97
|
+
copyText(payload).then(() => id === latest.current && setState("copied"), () => id === latest.current && setState("error"));
|
|
98
|
+
scheduleReset();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
42
101
|
if (timer.current !== null) clearTimeout(timer.current);
|
|
43
|
-
timer.current =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
102
|
+
timer.current = null;
|
|
103
|
+
setState("pending");
|
|
104
|
+
const settle = (next) => {
|
|
105
|
+
if (id !== latest.current) return;
|
|
106
|
+
setState(next);
|
|
107
|
+
scheduleReset();
|
|
108
|
+
};
|
|
109
|
+
("plain" in payload ? copyPendingText(payload.plain) : copyRich(payload)).then(() => settle("copied"), () => settle("error"));
|
|
110
|
+
}, [scheduleReset])
|
|
48
111
|
};
|
|
49
112
|
}
|
|
50
|
-
export { copyText, useCopyFlash };
|
|
113
|
+
export { copyPendingText, copyRich, copyText, useCopyFlash };
|
|
51
114
|
|
|
52
115
|
//# sourceMappingURL=clipboard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.js","names":[],"sources":["../../src/components/clipboard.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport type CopyFlashState = \"idle\" | \"copied\" | \"error\";\n\n// copyText writes text to the clipboard, falling back to a hidden-textarea\n// execCommand(\"copy\") when the async Clipboard API is unavailable or rejects —\n// an insecure (http) origin, or an embedded WebView where writeText is denied.\n// Rejects when both paths fail so callers can surface the failure instead of a\n// copy button that silently does nothing.\nexport async function copyText(text: string): Promise<void> {\n if (typeof navigator !== \"undefined\" && navigator.clipboard?.writeText) {\n try {\n await navigator.clipboard.writeText(text);\n return;\n } catch {\n // Fall through to the user-gesture copy path below.\n }\n }\n // execCommand is absent in jsdom and deprecated in browsers, so treat a\n // missing one as a rejection rather than letting a TypeError escape.\n if (typeof document === \"undefined\" || typeof document.execCommand !== \"function\") {\n throw new Error(\"Browser rejected the copy request\");\n }\n const textarea = document.createElement(\"textarea\");\n textarea.value = text;\n textarea.style.position = \"fixed\";\n textarea.style.opacity = \"0\";\n document.body.appendChild(textarea);\n textarea.focus();\n textarea.select();\n let copied = false;\n try {\n copied = document.execCommand(\"copy\");\n } catch {\n copied = false;\n } finally {\n document.body.removeChild(textarea);\n }\n if (!copied) throw new Error(\"Browser rejected the copy request\");\n}\n\n/**\n * Drives a copy affordance's transient feedback
|
|
1
|
+
{"version":3,"file":"clipboard.js","names":[],"sources":["../../src/components/clipboard.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport type CopyFlashState = \"idle\" | \"pending\" | \"copied\" | \"error\";\n\n/** Rich text for the clipboard: `html` pastes formatted, `text` is the plain alternative. */\nexport type RichClipboardPayload = { text: string; html: string };\n\n/** Plain text that is still loading, copied as a `text/plain`-only ClipboardItem. */\nexport type PendingTextPayload = { plain: Promise<string> };\n\n/** What `useCopyFlash().copy` accepts: plain text (possibly still loading), or a rich payload that may still be loading. */\nexport type CopyFlashPayload =\n | string\n | PendingTextPayload\n | RichClipboardPayload\n | Promise<RichClipboardPayload>;\n\nfunction richBlob(\n payload: Promise<RichClipboardPayload>,\n type: \"text/html\" | \"text/plain\",\n pick: (payload: RichClipboardPayload) => unknown,\n): Promise<Blob> {\n return payload.then((resolved) => {\n const value = pick(resolved);\n if (typeof value !== \"string\") {\n throw new Error(`Rich copy payload has no ${type === \"text/html\" ? \"html\" : \"text\"} string`);\n }\n return new Blob([value], { type });\n });\n}\n\n/**\n * copyRich writes `payload` as one ClipboardItem carrying both `text/html` and\n * `text/plain`. The item is built from Promise<Blob>s and written before the\n * payload settles, so a payload fetched from the server after the click still\n * counts as inside the user gesture (Safari and Chrome both require that).\n * Rejects when the browser lacks ClipboardItem or `navigator.clipboard.write`,\n * or when the payload rejects — never degrading to a text-only copy.\n */\nexport async function copyRich(\n payload: Promise<RichClipboardPayload> | RichClipboardPayload,\n): Promise<void> {\n const pending = Promise.resolve(payload);\n await writeClipboardItem(\"Rich copy\", {\n \"text/html\": richBlob(pending, \"text/html\", (resolved) => resolved.html),\n \"text/plain\": richBlob(pending, \"text/plain\", (resolved) => resolved.text),\n });\n}\n\n/**\n * copyPendingText writes text that is still loading as a `text/plain`-only\n * ClipboardItem, started before the text settles so it stays inside the user\n * gesture. `copyText` cannot: awaiting the text first would leave the gesture.\n * Rejects when the browser lacks ClipboardItem or `navigator.clipboard.write`,\n * or when the text rejects or is not a string.\n */\nexport async function copyPendingText(text: Promise<string>): Promise<void> {\n await writeClipboardItem(\"Text copy\", {\n \"text/plain\": text.then((value) => {\n if (typeof value !== \"string\") throw new Error(\"Text copy payload is not a string\");\n return new Blob([value], { type: \"text/plain\" });\n }),\n });\n}\n\nasync function writeClipboardItem(what: string, blobs: Record<string, Promise<Blob>>): Promise<void> {\n if (typeof ClipboardItem === \"undefined\") {\n throw new Error(`${what} is unsupported: this browser has no ClipboardItem`);\n }\n if (typeof navigator === \"undefined\" || typeof navigator.clipboard?.write !== \"function\") {\n throw new Error(\n `${what} is unsupported: navigator.clipboard.write is unavailable (insecure origin or blocked by the host)`,\n );\n }\n // The browser may stop reading the item after the first rejected blob; the\n // rejection still reaches the caller through the Promise.all below.\n for (const blob of Object.values(blobs)) blob.catch(() => undefined);\n await navigator.clipboard.write([new ClipboardItem(blobs)]);\n await Promise.all(Object.values(blobs));\n}\n\n// copyText writes text to the clipboard, falling back to a hidden-textarea\n// execCommand(\"copy\") when the async Clipboard API is unavailable or rejects —\n// an insecure (http) origin, or an embedded WebView where writeText is denied.\n// Rejects when both paths fail so callers can surface the failure instead of a\n// copy button that silently does nothing.\nexport async function copyText(text: string): Promise<void> {\n if (typeof navigator !== \"undefined\" && navigator.clipboard?.writeText) {\n try {\n await navigator.clipboard.writeText(text);\n return;\n } catch {\n // Fall through to the user-gesture copy path below.\n }\n }\n // execCommand is absent in jsdom and deprecated in browsers, so treat a\n // missing one as a rejection rather than letting a TypeError escape.\n if (typeof document === \"undefined\" || typeof document.execCommand !== \"function\") {\n throw new Error(\"Browser rejected the copy request\");\n }\n const textarea = document.createElement(\"textarea\");\n textarea.value = text;\n textarea.style.position = \"fixed\";\n textarea.style.opacity = \"0\";\n document.body.appendChild(textarea);\n textarea.focus();\n textarea.select();\n let copied = false;\n try {\n copied = document.execCommand(\"copy\");\n } catch {\n copied = false;\n } finally {\n document.body.removeChild(textarea);\n }\n if (!copied) throw new Error(\"Browser rejected the copy request\");\n}\n\n/**\n * Drives a copy affordance's transient feedback. `copy(text)` writes plain text\n * and flips `state` to `copied`/`error`, reverting after `resetMs`. `copy` with\n * `{ plain: Promise<string> }` goes through `copyPendingText`, and with a rich\n * payload (or a promise of one) through `copyRich`; both keep `state`\n * `pending` until the clipboard write settles, then `copied`/`error`, reverting\n * after `resetMs`. Only the latest copy updates `state`, and nothing does once\n * the component unmounts.\n */\nexport function useCopyFlash(resetMs = 1500): {\n state: CopyFlashState;\n copy: (payload: CopyFlashPayload) => void;\n} {\n const [state, setState] = useState<CopyFlashState>(\"idle\");\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const latest = useRef(0);\n\n useEffect(\n () => () => {\n latest.current += 1;\n if (timer.current !== null) clearTimeout(timer.current);\n },\n [],\n );\n\n const scheduleReset = useCallback(() => {\n if (timer.current !== null) clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n timer.current = null;\n setState(\"idle\");\n }, resetMs);\n }, [resetMs]);\n\n const copy = useCallback(\n (payload: CopyFlashPayload) => {\n const id = ++latest.current;\n if (typeof payload === \"string\") {\n void copyText(payload).then(\n () => id === latest.current && setState(\"copied\"),\n () => id === latest.current && setState(\"error\"),\n );\n scheduleReset();\n return;\n }\n if (timer.current !== null) clearTimeout(timer.current);\n timer.current = null;\n setState(\"pending\");\n const settle = (next: CopyFlashState) => {\n if (id !== latest.current) return;\n setState(next);\n scheduleReset();\n };\n const write = \"plain\" in payload ? copyPendingText(payload.plain) : copyRich(payload);\n void write.then(\n () => settle(\"copied\"),\n () => settle(\"error\"),\n );\n },\n [scheduleReset],\n );\n\n return { state, copy };\n}\n"],"mappings":";;AAiBA,SAAS,SACP,SACA,MACA,MACe;CACf,OAAO,QAAQ,MAAM,aAAa;EAChC,MAAM,QAAQ,KAAK,QAAQ;EAC3B,IAAI,OAAO,UAAU,UACnB,MAAM,IAAI,MAAM,4BAA4B,SAAS,cAAc,SAAS,OAAO,QAAQ;EAE7F,OAAO,IAAI,KAAK,CAAC,KAAK,GAAG,EAAE,KAAK,CAAC;CACnC,CAAC;AACH;;;;;;;;;AAUA,eAAsB,SACpB,SACe;CACf,MAAM,UAAU,QAAQ,QAAQ,OAAO;CACvC,MAAM,mBAAmB,aAAa;EACpC,aAAa,SAAS,SAAS,cAAc,aAAa,SAAS,IAAI;EACvE,cAAc,SAAS,SAAS,eAAe,aAAa,SAAS,IAAI;CAC3E,CAAC;AACH;;;;;;;;AASA,eAAsB,gBAAgB,MAAsC;CAC1E,MAAM,mBAAmB,aAAa,EACpC,cAAc,KAAK,MAAM,UAAU;EACjC,IAAI,OAAO,UAAU,UAAU,MAAM,IAAI,MAAM,mCAAmC;EAClF,OAAO,IAAI,KAAK,CAAC,KAAK,GAAG,EAAE,MAAM,aAAa,CAAC;CACjD,CAAC,EACH,CAAC;AACH;AAEA,eAAe,mBAAmB,MAAc,OAAqD;CACnG,IAAI,OAAO,kBAAkB,aAC3B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,OAAO;EACtD,MAAM,UAAU,iBAAiB;GAC/B,MAAM,UAAU;GAChB,SAAS,MAAM;EACjB,GAAG,OAAO;CACZ,GAAG,CAAC,OAAO,CAAC;CA8BZ,OAAO;EAAE;EAAO,MA5BH,aACV,YAA8B;GAC7B,MAAM,KAAK,EAAE,OAAO;GACpB,IAAI,OAAO,YAAY,UAAU;IAC/B,SAAc,OAAO,CAAC,CAAC,WACf,OAAO,OAAO,WAAW,SAAS,QAAQ,SAC1C,OAAO,OAAO,WAAW,SAAS,OAAO,CACjD;IACA,cAAc;IACd;GACF;GACA,IAAI,MAAM,YAAY,MAAM,aAAa,MAAM,OAAO;GACtD,MAAM,UAAU;GAChB,SAAS,SAAS;GAClB,MAAM,UAAU,SAAyB;IACvC,IAAI,OAAO,OAAO,SAAS;IAC3B,SAAS,IAAI;IACb,cAAc;GAChB;GAEA,CADc,WAAW,UAAU,gBAAgB,QAAQ,KAAK,IAAI,SAAS,OAAO,EAAA,CACzE,WACH,OAAO,QAAQ,SACf,OAAO,OAAO,CACtB;EACF,GACA,CAAC,aAAa,CAGA;CAAK;AACvB"}
|
package/dist/components.cjs
CHANGED
|
@@ -186,6 +186,8 @@ exports.applyPostExtensions = require_json_schema_form_extensions.applyPostExten
|
|
|
186
186
|
exports.buildJSONPathNode = require_jsonPathTree.buildJSONPathNode;
|
|
187
187
|
exports.buildOnePasswordReference = require_OnePasswordSelector_model.buildOnePasswordReference;
|
|
188
188
|
exports.buttonVariants = require_button_variants.buttonVariants;
|
|
189
|
+
exports.copyPendingText = require_clipboard.copyPendingText;
|
|
190
|
+
exports.copyRich = require_clipboard.copyRich;
|
|
189
191
|
exports.copyText = require_clipboard.copyText;
|
|
190
192
|
exports.createLazyJSONPathTree = require_jsonPathTree.createLazyJSONPathTree;
|
|
191
193
|
exports.createSecretFormExtensions = require_secret_form_extension.createSecretFormExtensions;
|
package/dist/components.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { Loading, LoadingBar, LoadingDots, type LoadingProps, type LoadingSize,
|
|
|
6
6
|
export { buttonVariants } from './components/button-variants.js';
|
|
7
7
|
export { IconButton, type IconButtonProps } from './components/IconButton.js';
|
|
8
8
|
export { CopyButton, type CopyButtonProps } from './components/CopyButton.js';
|
|
9
|
-
export { copyText, useCopyFlash, type CopyFlashState, } from './components/clipboard.js';
|
|
9
|
+
export { copyPendingText, copyRich, copyText, useCopyFlash, type CopyFlashPayload, type CopyFlashState, type PendingTextPayload, type RichClipboardPayload, } from './components/clipboard.js';
|
|
10
10
|
export { SplitButton, type SplitButtonProps } from './components/SplitButton.js';
|
|
11
11
|
export { InputField, type InputFieldProps } from './components/InputField.js';
|
|
12
12
|
export { DimensionField, type DimensionFieldProps, } from './components/DimensionField.js';
|
package/dist/components.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,OAAO,EACP,UAAU,EACV,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EACL,QAAQ,EACR,YAAY,EAC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ClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,oBAAoB,GAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,QAAQ,EACR,KAAK,YAAY,EACjB,KAAK,SAAS,GACf,MAAM,yBAAyB,CAAC"}
|
package/dist/components.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Loading, LoadingBar, LoadingDots } from "./components/loading.js";
|
|
|
6
6
|
import { Button } from "./components/button.js";
|
|
7
7
|
import { ErrorWrapper } from "./components/ErrorWrapper.js";
|
|
8
8
|
import { IconButton } from "./components/IconButton.js";
|
|
9
|
-
import { copyText, useCopyFlash } from "./components/clipboard.js";
|
|
9
|
+
import { copyPendingText, copyRich, copyText, useCopyFlash } from "./components/clipboard.js";
|
|
10
10
|
import { CopyButton } from "./components/CopyButton.js";
|
|
11
11
|
import { zIndex } from "./overlay/zIndex.js";
|
|
12
12
|
import { useEscapeLayer, useFloatingZIndex, useModalStack, useTourLayer } from "./overlay/modalStack.js";
|
|
@@ -95,4 +95,4 @@ import { CommandPalette } from "./overlay/CommandPalette.js";
|
|
|
95
95
|
import { CommandPaletteTrigger } from "./overlay/CommandPaletteTrigger.js";
|
|
96
96
|
import { useToast } from "./overlay/toast-context.js";
|
|
97
97
|
import { ToastProvider } from "./overlay/Toast.js";
|
|
98
|
-
export { AccordionList, AppLayout, AppShell, AppSidebar, Button, CLICKY_FORMAT_OPTIONS, COMMON_CRON_SUGGESTIONS, CONNECTION_LOG_LEVELS, COUNTRY_OPTIONS, CellActionButton, CellActions, Checkbox, Combobox, CommandPalette, CommandPaletteTrigger, ConfirmDialog, ConnectionLoggingPolicy, ContextMenu, CopyButton, CountryFlag, CountryPicker, DEFAULT_CRON, DEFAULT_FORM_SIZE, DEFAULT_PREFERENCES_STORAGE_KEY, DEFAULT_PREFERRED_ENDPOINT_PORTS, DateField, DatePicker, DateTimePicker, DensitySwitcher, DetailEmptyState, DimensionField, DropdownMenu, EndpointSelector, ErrorWrapper, Field, FieldErrorText, FilterBar, FilterBarFilterPanel, FormErrorSummary, FormLookupProvider, FormatOptionsDropdown, HoverCard, IconButton, IconMenuPicker, InputField, ItemActions, ItemBadge, ItemGlyph, JSONPathField, JSONPathPlayground, JsonSchemaForm, ListMenu, ListMenuActionBar, ListMenuHeader, ListMenuItem, ListMenuSection, Loading, LoadingBar, LoadingDots, Modal, MultiSelect, NamespacePicker, OnePasswordSelector, Panel, RangeSlider, ScheduleEditor, SearchInput, SecretKeySelector, Section, SegmentedControl, Select, SplitButton, SplitPane, Switch, Tabs, ThemeSwitcher, TimeRange, ToastProvider, Tour, TourProvider, TreePickerField, TriStateMultiSelect, TriStateToggle, WorkloadPicker, Workspace, applyFilterExtensions, applyPostExtensions, buildJSONPathNode, buildOnePasswordReference, buttonVariants, copyText, createLazyJSONPathTree, createSecretFormExtensions, createUnitFormExtensions, effectiveProperties, formatUnitAwareValue, getCountryOption, isConnectionLoggingCapability, isCountryCode, isOpenStringMap, isTourFinished, kindForValue, literalSegments, loadedWorkloads, localStorageTourStorage, matchesIf, memoryTourStorage, nextTriState, parseEndpointValue, parseOnePasswordReference, parseSecretRef, parseUnitAwareValue, parseWorkloadKey, preferredEndpointPort, readPreferences, rehydrateRefs, resolveControl, resolveLookupScope, serializeEndpointValue, serializeSecretRef, templateValuePre, useConfirm, useConfirmMemory, useCopyFlash, useEscapeLayer, useFloatingZIndex, useForm, useListMenuSelection, useLookupFetcher, useModalStack, useToast, useTour, useTourLayer, visibleConnectionLogEvents, workloadKey, writePreferences, zIndex };
|
|
98
|
+
export { AccordionList, AppLayout, AppShell, AppSidebar, Button, CLICKY_FORMAT_OPTIONS, COMMON_CRON_SUGGESTIONS, CONNECTION_LOG_LEVELS, COUNTRY_OPTIONS, CellActionButton, CellActions, Checkbox, Combobox, CommandPalette, CommandPaletteTrigger, ConfirmDialog, ConnectionLoggingPolicy, ContextMenu, CopyButton, CountryFlag, CountryPicker, DEFAULT_CRON, DEFAULT_FORM_SIZE, DEFAULT_PREFERENCES_STORAGE_KEY, DEFAULT_PREFERRED_ENDPOINT_PORTS, DateField, DatePicker, DateTimePicker, DensitySwitcher, DetailEmptyState, DimensionField, DropdownMenu, EndpointSelector, ErrorWrapper, Field, FieldErrorText, FilterBar, FilterBarFilterPanel, FormErrorSummary, FormLookupProvider, FormatOptionsDropdown, HoverCard, IconButton, IconMenuPicker, InputField, ItemActions, ItemBadge, ItemGlyph, JSONPathField, JSONPathPlayground, JsonSchemaForm, ListMenu, ListMenuActionBar, ListMenuHeader, ListMenuItem, ListMenuSection, Loading, LoadingBar, LoadingDots, Modal, MultiSelect, NamespacePicker, OnePasswordSelector, Panel, RangeSlider, ScheduleEditor, SearchInput, SecretKeySelector, Section, SegmentedControl, Select, SplitButton, SplitPane, Switch, Tabs, ThemeSwitcher, TimeRange, ToastProvider, Tour, TourProvider, TreePickerField, TriStateMultiSelect, TriStateToggle, WorkloadPicker, Workspace, applyFilterExtensions, applyPostExtensions, buildJSONPathNode, buildOnePasswordReference, buttonVariants, copyPendingText, copyRich, copyText, createLazyJSONPathTree, createSecretFormExtensions, createUnitFormExtensions, effectiveProperties, formatUnitAwareValue, getCountryOption, isConnectionLoggingCapability, isCountryCode, isOpenStringMap, isTourFinished, kindForValue, literalSegments, loadedWorkloads, localStorageTourStorage, matchesIf, memoryTourStorage, nextTriState, parseEndpointValue, parseOnePasswordReference, parseSecretRef, parseUnitAwareValue, parseWorkloadKey, preferredEndpointPort, readPreferences, rehydrateRefs, resolveControl, resolveLookupScope, serializeEndpointValue, serializeSecretRef, templateValuePre, useConfirm, useConfirmMemory, useCopyFlash, useEscapeLayer, useFloatingZIndex, useForm, useListMenuSelection, useLookupFetcher, useModalStack, useToast, useTour, useTourLayer, visibleConnectionLogEvents, workloadKey, writePreferences, zIndex };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
const require_utils = require("../lib/utils.cjs");
|
|
2
|
+
const require_UiChevronDown = require("../icons/components/UiChevronDown.cjs");
|
|
3
|
+
const require_UiChevronRight = require("../icons/components/UiChevronRight.cjs");
|
|
4
|
+
const require_MatrixTable = require("./MatrixTable.cjs");
|
|
5
|
+
const require_tree_rows = require("../lib/tree-rows.cjs");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
// src/data/MatrixTreeTable.tsx
|
|
8
|
+
/** The chevron that opens or closes a tree row; `label` names the row for assistive tech. */
|
|
9
|
+
function TreeRowToggle({ open, label, onToggle }) {
|
|
10
|
+
const Icon = open ? require_UiChevronDown.UiChevronDown : require_UiChevronRight.UiChevronRight;
|
|
11
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
12
|
+
type: "button",
|
|
13
|
+
"aria-expanded": open,
|
|
14
|
+
"aria-label": `${open ? "Collapse" : "Expand"} ${label}`,
|
|
15
|
+
className: "inline-flex size-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground",
|
|
16
|
+
onClick: (event) => {
|
|
17
|
+
event.stopPropagation();
|
|
18
|
+
onToggle();
|
|
19
|
+
},
|
|
20
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { className: "size-3.5" })
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
var TREE_STEP_REM = 1.25;
|
|
24
|
+
/**
|
|
25
|
+
* The indent and chevron that lead a tree row's label. Parents get a toggle
|
|
26
|
+
* (`onToggle` + `label`); leaves get a chevron-sized spacer so they line up.
|
|
27
|
+
*/
|
|
28
|
+
function TreeRowLead({ depth, open = false, label, onToggle, children }) {
|
|
29
|
+
if (onToggle && label === void 0) throw new Error("TreeRowLead needs a label to name its toggle");
|
|
30
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
31
|
+
"data-tree-depth": depth,
|
|
32
|
+
className: "inline-flex min-w-0 items-center gap-1",
|
|
33
|
+
style: { paddingLeft: `${depth * TREE_STEP_REM}rem` },
|
|
34
|
+
children: [onToggle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeRowToggle, {
|
|
35
|
+
open,
|
|
36
|
+
label,
|
|
37
|
+
onToggle
|
|
38
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
39
|
+
"aria-hidden": true,
|
|
40
|
+
className: "size-4 shrink-0"
|
|
41
|
+
}), children]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A MatrixTable whose rows form a tree: parent nodes are collapsible group
|
|
46
|
+
* bands that span every column, leaves are data rows, both indented by depth.
|
|
47
|
+
*/
|
|
48
|
+
function MatrixTreeTable({ roots, getChildren, getKey, renderLabel, getAriaLabel, getCells, getGroupClassName, expanded, onExpandedChange, defaultExpanded, ...table }) {
|
|
49
|
+
const { rows, toggle } = require_tree_rows.useTreeRows(roots, {
|
|
50
|
+
getChildren,
|
|
51
|
+
getKey
|
|
52
|
+
}, {
|
|
53
|
+
...expanded !== void 0 ? { expanded } : {},
|
|
54
|
+
...onExpandedChange ? { onExpandedChange } : {},
|
|
55
|
+
...defaultExpanded !== void 0 ? { defaultExpanded } : {}
|
|
56
|
+
});
|
|
57
|
+
const matrixRows = rows.map((row) => {
|
|
58
|
+
const label = renderLabel(row.node, {
|
|
59
|
+
depth: row.depth,
|
|
60
|
+
open: row.open,
|
|
61
|
+
hasChildren: row.hasChildren
|
|
62
|
+
});
|
|
63
|
+
if (!row.hasChildren) return {
|
|
64
|
+
key: row.key,
|
|
65
|
+
label: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeRowLead, {
|
|
66
|
+
depth: row.depth,
|
|
67
|
+
children: label
|
|
68
|
+
}),
|
|
69
|
+
cells: getCells(row.node)
|
|
70
|
+
};
|
|
71
|
+
const className = require_utils.cn(row.depth > 0 && "bg-muted/30 font-medium", getGroupClassName?.(row.node, row.depth));
|
|
72
|
+
return {
|
|
73
|
+
type: "group",
|
|
74
|
+
key: row.key,
|
|
75
|
+
...className ? { className } : {},
|
|
76
|
+
label: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeRowLead, {
|
|
77
|
+
depth: row.depth,
|
|
78
|
+
open: row.open,
|
|
79
|
+
label: getAriaLabel(row.node),
|
|
80
|
+
onToggle: () => toggle(row),
|
|
81
|
+
children: label
|
|
82
|
+
})
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MatrixTable.MatrixTable, {
|
|
86
|
+
...table,
|
|
87
|
+
rows: matrixRows
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
exports.MatrixTreeTable = MatrixTreeTable;
|
|
91
|
+
exports.TreeRowLead = TreeRowLead;
|
|
92
|
+
exports.TreeRowToggle = TreeRowToggle;
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=MatrixTreeTable.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatrixTreeTable.cjs","names":["UiChevronDown","UiChevronRight","useTreeRows","cn","MatrixTable"],"sources":["../../src/data/MatrixTreeTable.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { UiChevronDown, UiChevronRight } from \"../icons\";\nimport { cn } from \"../lib/utils\";\nimport { useTreeRows, type TreeExpansionProps, type TreeRowsAccessors } from \"../lib/tree-rows\";\nimport { MatrixTable, type MatrixTableGroupRow, type MatrixTableProps, type MatrixTableRow } from \"./MatrixTable\";\n\nexport type TreeLabelContext = { depth: number; open: boolean; hasChildren: boolean };\n\nexport type MatrixTreeTableProps<T> = Omit<MatrixTableProps, \"rows\"> &\n TreeRowsAccessors<T> &\n TreeExpansionProps<T> & {\n roots: T[];\n renderLabel: (node: T, context: TreeLabelContext) => ReactNode;\n /** Names a parent node in its expand/collapse button. */\n getAriaLabel: (node: T) => string;\n /** Cells of a leaf row, one per column. Parent nodes render as group bands. */\n getCells: (node: T) => ReactNode[];\n getGroupClassName?: (node: T, depth: number) => string | undefined;\n };\n\n/** The chevron that opens or closes a tree row; `label` names the row for assistive tech. */\nexport function TreeRowToggle({ open, label, onToggle }: { open: boolean; label: string; onToggle: () => void }) {\n const Icon = open ? UiChevronDown : UiChevronRight;\n return (\n <button\n type=\"button\"\n aria-expanded={open}\n aria-label={`${open ? \"Collapse\" : \"Expand\"} ${label}`}\n className=\"inline-flex size-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground\"\n onClick={(event) => { event.stopPropagation(); onToggle(); }}\n >\n <Icon className=\"size-3.5\" />\n </button>\n );\n}\n\n// One tree level: the chevron (1rem) plus its gap (0.25rem), so a child's text\n// starts one step right of its parent's text.\nconst TREE_STEP_REM = 1.25;\n\n/**\n * The indent and chevron that lead a tree row's label. Parents get a toggle\n * (`onToggle` + `label`); leaves get a chevron-sized spacer so they line up.\n */\nexport function TreeRowLead({ depth, open = false, label, onToggle, children }: { depth: number; open?: boolean; label?: string; onToggle?: () => void; children: ReactNode }) {\n if (onToggle && label === undefined) throw new Error(\"TreeRowLead needs a label to name its toggle\");\n return (\n <span data-tree-depth={depth} className=\"inline-flex min-w-0 items-center gap-1\" style={{ paddingLeft: `${depth * TREE_STEP_REM}rem` }}>\n {onToggle ? <TreeRowToggle open={open} label={label!} onToggle={onToggle} /> : <span aria-hidden className=\"size-4 shrink-0\" />}\n {children}\n </span>\n );\n}\n\n/**\n * A MatrixTable whose rows form a tree: parent nodes are collapsible group\n * bands that span every column, leaves are data rows, both indented by depth.\n */\nexport function MatrixTreeTable<T>({\n roots,\n getChildren,\n getKey,\n renderLabel,\n getAriaLabel,\n getCells,\n getGroupClassName,\n expanded,\n onExpandedChange,\n defaultExpanded,\n ...table\n}: MatrixTreeTableProps<T>) {\n const { rows, toggle } = useTreeRows(roots, { getChildren, getKey }, {\n ...(expanded !== undefined ? { expanded } : {}),\n ...(onExpandedChange ? { onExpandedChange } : {}),\n ...(defaultExpanded !== undefined ? { defaultExpanded } : {}),\n });\n const matrixRows = rows.map((row): MatrixTableRow | MatrixTableGroupRow => {\n const label = renderLabel(row.node, { depth: row.depth, open: row.open, hasChildren: row.hasChildren });\n if (!row.hasChildren) return { key: row.key, label: <TreeRowLead depth={row.depth}>{label}</TreeRowLead>, cells: getCells(row.node) };\n // MatrixTable's depth would indent a second time, so nested bands get its softer style here.\n const className = cn(row.depth > 0 && \"bg-muted/30 font-medium\", getGroupClassName?.(row.node, row.depth));\n return {\n type: \"group\",\n key: row.key,\n ...(className ? { className } : {}),\n label: <TreeRowLead depth={row.depth} open={row.open} label={getAriaLabel(row.node)} onToggle={() => toggle(row)}>{label}</TreeRowLead>,\n };\n });\n return <MatrixTable {...table} rows={matrixRows} />;\n}\n"],"mappings":";;;;;;;;AAqBA,SAAgB,cAAc,EAAE,MAAM,OAAO,YAAoE;CAC/G,MAAM,OAAO,OAAOA,sBAAAA,gBAAgBC,uBAAAA;CACpC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;EACE,MAAK;EACL,iBAAe;EACf,cAAY,GAAG,OAAO,aAAa,SAAS,GAAG;EAC/C,WAAU;EACV,UAAU,UAAU;GAAE,MAAM,gBAAgB;GAAG,SAAS;EAAG;EAE3D,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAM,WAAU,WAAY,CAAA;CACtB,CAAA;AAEZ;AAIA,IAAM,gBAAgB;;;;;AAMtB,SAAgB,YAAY,EAAE,OAAO,OAAO,OAAO,OAAO,UAAU,YAA2G;CAC7K,IAAI,YAAY,UAAU,KAAA,GAAW,MAAM,IAAI,MAAM,8CAA8C;CACnG,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;EAAM,mBAAiB;EAAO,WAAU;EAAyC,OAAO,EAAE,aAAa,GAAG,QAAQ,cAAc,KAAK;EAArI,UAAA,CACG,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAAC,eA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D;EAAa,GAAI;EAAO,MAAM;CAAa,CAAA;AACpD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TreeExpansionProps, TreeRowsAccessors } from '../lib/tree-rows.js';
|
|
3
|
+
import { MatrixTableProps } from './MatrixTable.js';
|
|
4
|
+
export type TreeLabelContext = {
|
|
5
|
+
depth: number;
|
|
6
|
+
open: boolean;
|
|
7
|
+
hasChildren: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type MatrixTreeTableProps<T> = Omit<MatrixTableProps, "rows"> & TreeRowsAccessors<T> & TreeExpansionProps<T> & {
|
|
10
|
+
roots: T[];
|
|
11
|
+
renderLabel: (node: T, context: TreeLabelContext) => ReactNode;
|
|
12
|
+
/** Names a parent node in its expand/collapse button. */
|
|
13
|
+
getAriaLabel: (node: T) => string;
|
|
14
|
+
/** Cells of a leaf row, one per column. Parent nodes render as group bands. */
|
|
15
|
+
getCells: (node: T) => ReactNode[];
|
|
16
|
+
getGroupClassName?: (node: T, depth: number) => string | undefined;
|
|
17
|
+
};
|
|
18
|
+
/** The chevron that opens or closes a tree row; `label` names the row for assistive tech. */
|
|
19
|
+
export declare function TreeRowToggle({ open, label, onToggle }: {
|
|
20
|
+
open: boolean;
|
|
21
|
+
label: string;
|
|
22
|
+
onToggle: () => void;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* The indent and chevron that lead a tree row's label. Parents get a toggle
|
|
26
|
+
* (`onToggle` + `label`); leaves get a chevron-sized spacer so they line up.
|
|
27
|
+
*/
|
|
28
|
+
export declare function TreeRowLead({ depth, open, label, onToggle, children }: {
|
|
29
|
+
depth: number;
|
|
30
|
+
open?: boolean;
|
|
31
|
+
label?: string;
|
|
32
|
+
onToggle?: () => void;
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
/**
|
|
36
|
+
* A MatrixTable whose rows form a tree: parent nodes are collapsible group
|
|
37
|
+
* bands that span every column, leaves are data rows, both indented by depth.
|
|
38
|
+
*/
|
|
39
|
+
export declare function MatrixTreeTable<T>({ roots, getChildren, getKey, renderLabel, getAriaLabel, getCells, getGroupClassName, expanded, onExpandedChange, defaultExpanded, ...table }: MatrixTreeTableProps<T>): import("react").JSX.Element;
|
|
40
|
+
//# sourceMappingURL=MatrixTreeTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatrixTreeTable.d.ts","sourceRoot":"","sources":["../../src/data/MatrixTreeTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAAe,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAyC,KAAK,gBAAgB,EAAuB,MAAM,eAAe,CAAC;AAElH,MAAM,MAAM,gBAAgB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtF,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAClE,iBAAiB,CAAC,CAAC,CAAC,GACpB,kBAAkB,CAAC,CAAC,CAAC,GAAG;IACtB,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,gBAAgB,KAAK,SAAS,CAAC;IAC/D,yDAAyD;IACzD,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAClC,+EAA+E;IAC/E,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,EAAE,CAAC;IACnC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,C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