@flytedan/flytebot-design-system 0.95.0 → 0.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/index.cjs +511 -517
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -8
- package/dist/index.d.ts +10 -8
- package/dist/index.js +511 -517
- package/dist/index.js.map +1 -1
- package/package.json +10 -8
package/dist/index.js
CHANGED
|
@@ -1206,11 +1206,6 @@ function useClosingAnimation(open2, onClose, durationMs) {
|
|
|
1206
1206
|
return { closing: exiting, close: close2, rendered: open2 || exiting, exiting };
|
|
1207
1207
|
}
|
|
1208
1208
|
|
|
1209
|
-
// src/kits/inertWhen.ts
|
|
1210
|
-
function inertWhen(on) {
|
|
1211
|
-
return on ? { inert: "" } : {};
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
1209
|
// src/kits/useLastOpenValue.ts
|
|
1215
1210
|
import * as React11 from "react";
|
|
1216
1211
|
function useLastOpenValue(value, open2) {
|
|
@@ -1238,8 +1233,8 @@ function Drawer({ open: open2 = true, title: titleNow, label: labelNow, onClose,
|
|
|
1238
1233
|
if (!rendered) return null;
|
|
1239
1234
|
return createPortal2(
|
|
1240
1235
|
/* @__PURE__ */ jsxs7(StackedLayerProvider, { layer, children: [
|
|
1241
|
-
/* @__PURE__ */ jsx10("div", { className: "fd-scrim" + (closing ? " is-closing" : ""), style: { display: "block", zIndex: zIndex - LAYER_STEP }, onClick: close2,
|
|
1242
|
-
/* @__PURE__ */ jsxs7("aside", { ref: asideRef, className: ["fd-drawer", bare ? "is-bare" : "", closing ? "is-closing" : "", className].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", "aria-label": accessibleName, "aria-labelledby": bare || label ? void 0 : titleId, ...rest, style: { zIndex },
|
|
1236
|
+
/* @__PURE__ */ jsx10("div", { className: "fd-scrim" + (closing ? " is-closing" : ""), style: { display: "block", zIndex: zIndex - LAYER_STEP }, onClick: close2, inert: closing }),
|
|
1237
|
+
/* @__PURE__ */ jsxs7("aside", { ref: asideRef, className: ["fd-drawer", bare ? "is-bare" : "", closing ? "is-closing" : "", className].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", "aria-label": accessibleName, "aria-labelledby": bare || label ? void 0 : titleId, ...rest, style: { zIndex }, inert: closing, children: [
|
|
1243
1238
|
bare ? null : /* @__PURE__ */ jsxs7("div", { className: "fd-card-head", style: { flex: "none" }, children: [
|
|
1244
1239
|
/* @__PURE__ */ jsx10("span", { id: titleId, className: "fd-card-head-title", title: truncationTitle(title), children: title }),
|
|
1245
1240
|
onClose ? /* @__PURE__ */ jsx10("button", { type: "button", className: "fd-btn-icon", "aria-label": "Close", onClick: close2, children: /* @__PURE__ */ jsx10("i", { className: "ph ph-x" }) }) : null
|
|
@@ -1269,7 +1264,7 @@ function Modal({ open: open2 = true, title: titleNow, description: descriptionNo
|
|
|
1269
1264
|
{
|
|
1270
1265
|
className: "fd-scrim" + (closing ? " is-closing" : ""),
|
|
1271
1266
|
style: { zIndex: zIndex - LAYER_STEP },
|
|
1272
|
-
|
|
1267
|
+
inert: closing,
|
|
1273
1268
|
onClick: onClose ? (e) => {
|
|
1274
1269
|
if (e.target === e.currentTarget) close2();
|
|
1275
1270
|
} : void 0,
|
|
@@ -1864,7 +1859,7 @@ function SkeletonText({ lines = 3, width = ["100%", "92%", "64%"], size = 15, ga
|
|
|
1864
1859
|
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1865
1860
|
function ReservedSkeleton({ children, shape = "block", radius, className = "", ...rest }) {
|
|
1866
1861
|
return /* @__PURE__ */ jsxs16("div", { className: ["fd-skel-reserve", className].filter(Boolean).join(" "), ...rest, children: [
|
|
1867
|
-
/* @__PURE__ */ jsx23("div", { className: "fd-skel-reserve-content", "aria-hidden": "true",
|
|
1862
|
+
/* @__PURE__ */ jsx23("div", { className: "fd-skel-reserve-content", "aria-hidden": "true", inert: true, children }),
|
|
1868
1863
|
/* @__PURE__ */ jsx23(Skeleton, { className: "fd-skel-reserve-cover", shape, radius, w: "auto", h: "auto" })
|
|
1869
1864
|
] });
|
|
1870
1865
|
}
|
|
@@ -1885,12 +1880,11 @@ function Spinner({ size = "md", label = "Loading", className = "", style, ...res
|
|
|
1885
1880
|
}
|
|
1886
1881
|
|
|
1887
1882
|
// src/components/navigation/SidebarNav.tsx
|
|
1888
|
-
import * as React21 from "react";
|
|
1889
1883
|
import { jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1890
1884
|
function Tip({ label, children }) {
|
|
1891
1885
|
return /* @__PURE__ */ jsx25("span", { title: label, style: { display: "inline-flex", flex: "none" }, children });
|
|
1892
1886
|
}
|
|
1893
|
-
|
|
1887
|
+
function SidebarNav({ brand, groups = [], current: current2, onNavigate, footer, open: open2 = false, className = "", ref, ...rest }) {
|
|
1894
1888
|
return /* @__PURE__ */ jsxs17(
|
|
1895
1889
|
"nav",
|
|
1896
1890
|
{
|
|
@@ -1926,18 +1920,18 @@ var SidebarNav = React21.forwardRef(function SidebarNav2({ brand, groups = [], c
|
|
|
1926
1920
|
]
|
|
1927
1921
|
}
|
|
1928
1922
|
);
|
|
1929
|
-
}
|
|
1923
|
+
}
|
|
1930
1924
|
|
|
1931
1925
|
// src/components/navigation/Topbar.tsx
|
|
1932
|
-
import * as
|
|
1926
|
+
import * as React22 from "react";
|
|
1933
1927
|
|
|
1934
1928
|
// src/kits/useIsNarrow.ts
|
|
1935
|
-
import * as
|
|
1929
|
+
import * as React21 from "react";
|
|
1936
1930
|
function useIsNarrow(breakpoint) {
|
|
1937
|
-
const [narrow, setNarrow] =
|
|
1931
|
+
const [narrow, setNarrow] = React21.useState(
|
|
1938
1932
|
() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(`(max-width: ${breakpoint}px)`).matches
|
|
1939
1933
|
);
|
|
1940
|
-
|
|
1934
|
+
React21.useEffect(() => {
|
|
1941
1935
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
1942
1936
|
const mq = window.matchMedia(`(max-width: ${breakpoint}px)`);
|
|
1943
1937
|
const apply = () => setNarrow(mq.matches);
|
|
@@ -1961,11 +1955,11 @@ function Topbar({
|
|
|
1961
1955
|
...rest
|
|
1962
1956
|
}) {
|
|
1963
1957
|
const narrow = useIsNarrow(overflowBreakpoint);
|
|
1964
|
-
const [moreOpen, setMoreOpen] =
|
|
1965
|
-
const moreRef =
|
|
1958
|
+
const [moreOpen, setMoreOpen] = React22.useState(false);
|
|
1959
|
+
const moreRef = React22.useRef(null);
|
|
1966
1960
|
return /* @__PURE__ */ jsxs18("header", { className: ["fd-topbar", narrow ? "is-narrow" : "", className].filter(Boolean).join(" "), ...rest, children: [
|
|
1967
1961
|
onMenu ? /* @__PURE__ */ jsx26("button", { type: "button", className: "fd-btn-icon", "aria-label": "Menu", onClick: onMenu, children: /* @__PURE__ */ jsx26("i", { className: "ph ph-list" }) }) : null,
|
|
1968
|
-
/* @__PURE__ */ jsx26("nav", { className: "fd-crumb", "aria-label": "Breadcrumb", children: crumbs.map((c, i) => /* @__PURE__ */ jsxs18(
|
|
1962
|
+
/* @__PURE__ */ jsx26("nav", { className: "fd-crumb", "aria-label": "Breadcrumb", children: crumbs.map((c, i) => /* @__PURE__ */ jsxs18(React22.Fragment, { children: [
|
|
1969
1963
|
i > 0 ? /* @__PURE__ */ jsx26("i", { className: "ph ph-caret-right", style: { fontSize: 11, opacity: 0.6 }, "aria-hidden": "true" }) : null,
|
|
1970
1964
|
i === crumbs.length - 1 ? (
|
|
1971
1965
|
// MP-141: the current crumb mixes a static route label with (usually) a
|
|
@@ -2018,7 +2012,7 @@ function Topbar({
|
|
|
2018
2012
|
}
|
|
2019
2013
|
|
|
2020
2014
|
// src/kits/useResponsiveRail.ts
|
|
2021
|
-
import * as
|
|
2015
|
+
import * as React23 from "react";
|
|
2022
2016
|
|
|
2023
2017
|
// src/kits/overlayLayout.ts
|
|
2024
2018
|
var OVERLAY_BREAKPOINT = 1024;
|
|
@@ -2029,26 +2023,26 @@ function useOverlayLayout() {
|
|
|
2029
2023
|
// src/kits/useResponsiveRail.ts
|
|
2030
2024
|
function useResponsiveRail(options = {}) {
|
|
2031
2025
|
const { breakpoint = OVERLAY_BREAKPOINT, initialOpen = true, onPersist } = options;
|
|
2032
|
-
const navRef =
|
|
2026
|
+
const navRef = React23.useRef(null);
|
|
2033
2027
|
const overlay = useIsNarrow(breakpoint);
|
|
2034
|
-
const [open2, setOpenRaw] =
|
|
2035
|
-
const setOpen =
|
|
2028
|
+
const [open2, setOpenRaw] = React23.useState(() => overlay ? false : initialOpen);
|
|
2029
|
+
const setOpen = React23.useCallback(
|
|
2036
2030
|
(value) => {
|
|
2037
2031
|
setOpenRaw(value);
|
|
2038
2032
|
if (!overlay) onPersist?.(value);
|
|
2039
2033
|
},
|
|
2040
2034
|
[overlay, onPersist]
|
|
2041
2035
|
);
|
|
2042
|
-
const toggle =
|
|
2043
|
-
const close2 =
|
|
2044
|
-
const lastOverlay =
|
|
2045
|
-
|
|
2036
|
+
const toggle = React23.useCallback(() => setOpen(!open2), [open2, setOpen]);
|
|
2037
|
+
const close2 = React23.useCallback(() => setOpenRaw(false), []);
|
|
2038
|
+
const lastOverlay = React23.useRef(overlay);
|
|
2039
|
+
React23.useEffect(() => {
|
|
2046
2040
|
if (lastOverlay.current === overlay) return;
|
|
2047
2041
|
lastOverlay.current = overlay;
|
|
2048
2042
|
setOpenRaw(!overlay);
|
|
2049
2043
|
}, [overlay]);
|
|
2050
2044
|
const layer = useStackedLayer({ active: overlay && open2, containerRef: navRef, trap: true, onEscape: close2 });
|
|
2051
|
-
|
|
2045
|
+
React23.useEffect(() => {
|
|
2052
2046
|
if (!overlay || !open2) return;
|
|
2053
2047
|
const previousOverflow = document.body.style.overflow;
|
|
2054
2048
|
document.body.style.overflow = "hidden";
|
|
@@ -2060,15 +2054,15 @@ function useResponsiveRail(options = {}) {
|
|
|
2060
2054
|
}
|
|
2061
2055
|
|
|
2062
2056
|
// src/components/navigation/DockedSidePanel.tsx
|
|
2063
|
-
import * as
|
|
2057
|
+
import * as React25 from "react";
|
|
2064
2058
|
|
|
2065
2059
|
// src/kits/useResizableWidth.ts
|
|
2066
|
-
import * as
|
|
2060
|
+
import * as React24 from "react";
|
|
2067
2061
|
function useResizableWidth({ width, defaultWidth, minWidth, maxWidth, onChange }) {
|
|
2068
|
-
const clamp =
|
|
2069
|
-
const [internal, setInternal] =
|
|
2062
|
+
const clamp = React24.useCallback((w) => Math.max(minWidth, Math.min(maxWidth, w)), [minWidth, maxWidth]);
|
|
2063
|
+
const [internal, setInternal] = React24.useState(defaultWidth);
|
|
2070
2064
|
const shown = clamp(width ?? internal);
|
|
2071
|
-
const setWidth =
|
|
2065
|
+
const setWidth = React24.useCallback(
|
|
2072
2066
|
(requested) => {
|
|
2073
2067
|
const next = clamp(requested);
|
|
2074
2068
|
if (next === shown) return;
|
|
@@ -2086,12 +2080,12 @@ var KEY_STEP = 24;
|
|
|
2086
2080
|
function DockedSidePanel({ open: open2, children: childrenNow, ...widthOptions }) {
|
|
2087
2081
|
const { closing, rendered } = useClosingAnimation(open2, void 0, PANEL_EXIT_MS);
|
|
2088
2082
|
const children = useLastOpenValue(childrenNow, open2);
|
|
2089
|
-
const [animateEnter, setAnimateEnter] =
|
|
2083
|
+
const [animateEnter, setAnimateEnter] = React25.useState(!open2);
|
|
2090
2084
|
if (!open2 && !animateEnter) setAnimateEnter(true);
|
|
2091
2085
|
const { width, setWidth } = useResizableWidth(widthOptions);
|
|
2092
|
-
const drag =
|
|
2093
|
-
const [resizing, setResizing] =
|
|
2094
|
-
const boxRef =
|
|
2086
|
+
const drag = React25.useRef(null);
|
|
2087
|
+
const [resizing, setResizing] = React25.useState(false);
|
|
2088
|
+
const boxRef = React25.useRef(null);
|
|
2095
2089
|
usePublishCornerStackOffset(boxRef, rendered);
|
|
2096
2090
|
if (!rendered) return null;
|
|
2097
2091
|
const onPointerDown = (e) => {
|
|
@@ -2120,7 +2114,7 @@ function DockedSidePanel({ open: open2, children: childrenNow, ...widthOptions }
|
|
|
2120
2114
|
className: ["fd-sidepanel", animateEnter ? "is-entering" : "", closing ? "is-closing" : "", resizing ? "is-resizing" : ""].filter(Boolean).join(" "),
|
|
2121
2115
|
"data-open": open2 ? "true" : "false",
|
|
2122
2116
|
style: { width },
|
|
2123
|
-
|
|
2117
|
+
inert: !open2,
|
|
2124
2118
|
children: /* @__PURE__ */ jsxs19("div", { className: "fd-sidepanel-inner", style: { width }, children: [
|
|
2125
2119
|
/* @__PURE__ */ jsx27(
|
|
2126
2120
|
"div",
|
|
@@ -2282,20 +2276,20 @@ function installFlytedeskFavicon(url) {
|
|
|
2282
2276
|
}
|
|
2283
2277
|
|
|
2284
2278
|
// src/components/navigation/Tabs.tsx
|
|
2285
|
-
import * as
|
|
2279
|
+
import * as React26 from "react";
|
|
2286
2280
|
import { jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2287
2281
|
var FADE_WIDTH = 32;
|
|
2288
2282
|
function Tabs({ tabs = [], value, onChange, className = "", ...rest }) {
|
|
2289
|
-
const strip =
|
|
2290
|
-
const [more, setMore] =
|
|
2291
|
-
const measure =
|
|
2283
|
+
const strip = React26.useRef(null);
|
|
2284
|
+
const [more, setMore] = React26.useState({ start: false, end: false });
|
|
2285
|
+
const measure = React26.useCallback(() => {
|
|
2292
2286
|
const el = strip.current;
|
|
2293
2287
|
if (!el) return;
|
|
2294
2288
|
const start = el.scrollLeft > 1;
|
|
2295
2289
|
const end = el.scrollLeft + el.clientWidth < el.scrollWidth - 1;
|
|
2296
2290
|
setMore((m) => m.start === start && m.end === end ? m : { start, end });
|
|
2297
2291
|
}, []);
|
|
2298
|
-
|
|
2292
|
+
React26.useLayoutEffect(() => {
|
|
2299
2293
|
const el = strip.current;
|
|
2300
2294
|
measure();
|
|
2301
2295
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
@@ -2303,7 +2297,7 @@ function Tabs({ tabs = [], value, onChange, className = "", ...rest }) {
|
|
|
2303
2297
|
observer.observe(el);
|
|
2304
2298
|
return () => observer.disconnect();
|
|
2305
2299
|
}, [measure, tabs]);
|
|
2306
|
-
const revealActive =
|
|
2300
|
+
const revealActive = React26.useCallback(() => {
|
|
2307
2301
|
const el = strip.current;
|
|
2308
2302
|
const active = el?.querySelector('[aria-selected="true"]');
|
|
2309
2303
|
if (!el || !active || el.scrollWidth <= el.clientWidth) return;
|
|
@@ -2313,9 +2307,9 @@ function Tabs({ tabs = [], value, onChange, className = "", ...rest }) {
|
|
|
2313
2307
|
else if (tab.right > box.right - FADE_WIDTH) el.scrollLeft += tab.right - box.right + FADE_WIDTH;
|
|
2314
2308
|
measure();
|
|
2315
2309
|
}, [measure]);
|
|
2316
|
-
|
|
2310
|
+
React26.useLayoutEffect(revealActive, [value, revealActive]);
|
|
2317
2311
|
const tabKeys = tabs.map((t) => typeof t === "string" ? t : t.value).join(",");
|
|
2318
|
-
|
|
2312
|
+
React26.useLayoutEffect(() => {
|
|
2319
2313
|
const el = strip.current;
|
|
2320
2314
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
2321
2315
|
const observer = new ResizeObserver(revealActive);
|
|
@@ -2604,15 +2598,15 @@ function Toast({ title, children, tone = "success", onUndo, onDismiss, className
|
|
|
2604
2598
|
}
|
|
2605
2599
|
|
|
2606
2600
|
// src/components/feedback/ToastProvider.tsx
|
|
2607
|
-
import * as
|
|
2601
|
+
import * as React27 from "react";
|
|
2608
2602
|
import { jsx as jsx40, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2609
2603
|
var DEFAULT_TOAST_DURATION_MS = 5e3;
|
|
2610
|
-
var ToastContext =
|
|
2604
|
+
var ToastContext = React27.createContext(null);
|
|
2611
2605
|
function ToastProvider({ children }) {
|
|
2612
|
-
const [items, setItems] =
|
|
2613
|
-
const timers =
|
|
2614
|
-
const nextId =
|
|
2615
|
-
const dismiss =
|
|
2606
|
+
const [items, setItems] = React27.useState([]);
|
|
2607
|
+
const timers = React27.useRef(/* @__PURE__ */ new Map());
|
|
2608
|
+
const nextId = React27.useRef(1);
|
|
2609
|
+
const dismiss = React27.useCallback((id) => {
|
|
2616
2610
|
setItems((current2) => current2.filter((item2) => item2.id !== id));
|
|
2617
2611
|
const timer = timers.current.get(id);
|
|
2618
2612
|
if (timer !== void 0) {
|
|
@@ -2620,7 +2614,7 @@ function ToastProvider({ children }) {
|
|
|
2620
2614
|
timers.current.delete(id);
|
|
2621
2615
|
}
|
|
2622
2616
|
}, []);
|
|
2623
|
-
const show =
|
|
2617
|
+
const show = React27.useCallback(
|
|
2624
2618
|
(title, options = {}) => {
|
|
2625
2619
|
const { tone = "success", duration = DEFAULT_TOAST_DURATION_MS } = options;
|
|
2626
2620
|
const id = nextId.current++;
|
|
@@ -2629,36 +2623,36 @@ function ToastProvider({ children }) {
|
|
|
2629
2623
|
},
|
|
2630
2624
|
[dismiss]
|
|
2631
2625
|
);
|
|
2632
|
-
|
|
2626
|
+
React27.useEffect(() => {
|
|
2633
2627
|
const pending = timers.current;
|
|
2634
2628
|
return () => {
|
|
2635
2629
|
pending.forEach(clearTimeout);
|
|
2636
2630
|
pending.clear();
|
|
2637
2631
|
};
|
|
2638
2632
|
}, []);
|
|
2639
|
-
const api =
|
|
2633
|
+
const api = React27.useMemo(() => ({ show }), [show]);
|
|
2640
2634
|
return /* @__PURE__ */ jsxs31(ToastContext.Provider, { value: api, children: [
|
|
2641
2635
|
children,
|
|
2642
2636
|
/* @__PURE__ */ jsx40(CornerStackPortal, { slot: "toasts", children: /* @__PURE__ */ jsx40("div", { className: "fd-toast-region", "aria-live": "polite", children: items.map((item2) => /* @__PURE__ */ jsx40(Toast, { title: item2.title, tone: item2.tone, onDismiss: () => dismiss(item2.id) }, item2.id)) }) })
|
|
2643
2637
|
] });
|
|
2644
2638
|
}
|
|
2645
2639
|
function useToast() {
|
|
2646
|
-
const api =
|
|
2640
|
+
const api = React27.useContext(ToastContext);
|
|
2647
2641
|
if (!api) throw new Error("useToast must be used inside a <ToastProvider>");
|
|
2648
2642
|
return api;
|
|
2649
2643
|
}
|
|
2650
2644
|
|
|
2651
2645
|
// src/components/data/AnimNum.tsx
|
|
2652
|
-
import * as
|
|
2646
|
+
import * as React28 from "react";
|
|
2653
2647
|
import { Fragment as Fragment8, jsx as jsx41 } from "react/jsx-runtime";
|
|
2654
2648
|
function shouldSkipEasing() {
|
|
2655
2649
|
if (typeof document !== "undefined" && document.hidden) return true;
|
|
2656
2650
|
return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
|
|
2657
2651
|
}
|
|
2658
2652
|
function AnimNum({ value, format, duration = 550 }) {
|
|
2659
|
-
const [display, setDisplay] =
|
|
2660
|
-
const prev =
|
|
2661
|
-
|
|
2653
|
+
const [display, setDisplay] = React28.useState(value);
|
|
2654
|
+
const prev = React28.useRef(value);
|
|
2655
|
+
React28.useEffect(() => {
|
|
2662
2656
|
const from = prev.current;
|
|
2663
2657
|
const to = value;
|
|
2664
2658
|
prev.current = to;
|
|
@@ -2686,14 +2680,14 @@ function AnimNum({ value, format, duration = 550 }) {
|
|
|
2686
2680
|
}
|
|
2687
2681
|
|
|
2688
2682
|
// src/components/data/TrendChart.tsx
|
|
2689
|
-
import * as
|
|
2683
|
+
import * as React31 from "react";
|
|
2690
2684
|
|
|
2691
2685
|
// src/components/useMeasuredWidth.ts
|
|
2692
|
-
import * as
|
|
2686
|
+
import * as React29 from "react";
|
|
2693
2687
|
function useMeasuredWidth(fallback) {
|
|
2694
|
-
const [element, setElement] =
|
|
2695
|
-
const [width, setWidth] =
|
|
2696
|
-
|
|
2688
|
+
const [element, setElement] = React29.useState(null);
|
|
2689
|
+
const [width, setWidth] = React29.useState(fallback);
|
|
2690
|
+
React29.useLayoutEffect(() => {
|
|
2697
2691
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
2698
2692
|
const measure = () => {
|
|
2699
2693
|
const measured = Math.round(element.getBoundingClientRect().width);
|
|
@@ -2708,7 +2702,7 @@ function useMeasuredWidth(fallback) {
|
|
|
2708
2702
|
}
|
|
2709
2703
|
|
|
2710
2704
|
// src/components/data/SegmentedMeter.tsx
|
|
2711
|
-
import * as
|
|
2705
|
+
import * as React30 from "react";
|
|
2712
2706
|
|
|
2713
2707
|
// src/kits/files.ts
|
|
2714
2708
|
function formatBytes(n) {
|
|
@@ -2921,7 +2915,7 @@ function SegmentedMeter({
|
|
|
2921
2915
|
const pct = safeTotal ? Math.min(100, Math.round(used / safeTotal * 100)) : 0;
|
|
2922
2916
|
const w = (v) => safeTotal ? Math.max(0, Math.min(100, Number(v) / safeTotal * 100)) : 0;
|
|
2923
2917
|
const fill = (s, i) => s.color || (s.variant ? VARIANT_FILL[s.variant] : void 0) || CHART[i % CHART.length];
|
|
2924
|
-
const generatedId =
|
|
2918
|
+
const generatedId = React30.useId();
|
|
2925
2919
|
const uid2 = id || generatedId;
|
|
2926
2920
|
return /* @__PURE__ */ jsxs32("div", { className: ["fd-segmeter", className].filter(Boolean).join(" "), onClick, children: [
|
|
2927
2921
|
label || showTotal ? /* @__PURE__ */ jsxs32("div", { className: "fd-segmeter-head", children: [
|
|
@@ -3074,8 +3068,8 @@ function TrendChart({
|
|
|
3074
3068
|
onRetry,
|
|
3075
3069
|
className = ""
|
|
3076
3070
|
}) {
|
|
3077
|
-
const [activeId, setActiveId] =
|
|
3078
|
-
const [pointTip, setPointTip] =
|
|
3071
|
+
const [activeId, setActiveId] = React31.useState(null);
|
|
3072
|
+
const [pointTip, setPointTip] = React31.useState(null);
|
|
3079
3073
|
const isEmpty = state === "ready" && (!categories.length || !series.length || series.every((s) => !s.values.length));
|
|
3080
3074
|
const effectiveState = isEmpty ? "empty" : state;
|
|
3081
3075
|
const [plotRef, VBW] = useMeasuredWidth(INITIAL_WIDTH);
|
|
@@ -3189,7 +3183,7 @@ function TrendChart({
|
|
|
3189
3183
|
}
|
|
3190
3184
|
|
|
3191
3185
|
// src/components/data/DonutChart.tsx
|
|
3192
|
-
import * as
|
|
3186
|
+
import * as React32 from "react";
|
|
3193
3187
|
import { Fragment as Fragment9, jsx as jsx45, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3194
3188
|
var QUIET_FILL = "var(--n-300)";
|
|
3195
3189
|
function segmentColor(index, seg) {
|
|
@@ -3208,8 +3202,8 @@ function DonutChart({
|
|
|
3208
3202
|
onRetry,
|
|
3209
3203
|
className = ""
|
|
3210
3204
|
}) {
|
|
3211
|
-
const [activeId, setActiveId] =
|
|
3212
|
-
const ringRef =
|
|
3205
|
+
const [activeId, setActiveId] = React32.useState(null);
|
|
3206
|
+
const ringRef = React32.useRef(null);
|
|
3213
3207
|
const items = segments.filter((s) => Number(s.value) > 0);
|
|
3214
3208
|
const total = items.reduce((n, s) => n + Number(s.value), 0);
|
|
3215
3209
|
const isEmpty = state === "ready" && (!items.length || total <= 0);
|
|
@@ -3231,7 +3225,7 @@ function DonutChart({
|
|
|
3231
3225
|
const centerSmall = centerSubLabel != null ? centerSubLabel : dominant ? dominant.label : void 0;
|
|
3232
3226
|
const active = arcs.find((a) => a.seg.id === activeId) || null;
|
|
3233
3227
|
const layer = useStackedLayer({ active: activeId != null, containerRef: ringRef, onEscape: () => setActiveId(null), returnFocus: false });
|
|
3234
|
-
|
|
3228
|
+
React32.useEffect(() => {
|
|
3235
3229
|
if (!activeId) return;
|
|
3236
3230
|
const onDown = (e) => {
|
|
3237
3231
|
const t = e.target;
|
|
@@ -3340,7 +3334,7 @@ function DonutChart({
|
|
|
3340
3334
|
}
|
|
3341
3335
|
|
|
3342
3336
|
// src/components/data/BarList.tsx
|
|
3343
|
-
import * as
|
|
3337
|
+
import * as React33 from "react";
|
|
3344
3338
|
import { jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3345
3339
|
var wholePercent = (share) => formatPercent(Math.round(share * 100));
|
|
3346
3340
|
function BarList({
|
|
@@ -3357,7 +3351,7 @@ function BarList({
|
|
|
3357
3351
|
onRetry,
|
|
3358
3352
|
className = ""
|
|
3359
3353
|
}) {
|
|
3360
|
-
const ordered =
|
|
3354
|
+
const ordered = React33.useMemo(() => {
|
|
3361
3355
|
const list = sort ? [...rows].sort((a, b) => Number(b.value) - Number(a.value)) : rows;
|
|
3362
3356
|
return maxRows ? list.slice(0, maxRows) : list;
|
|
3363
3357
|
}, [rows, sort, maxRows]);
|
|
@@ -3499,7 +3493,7 @@ function FunnelChart({
|
|
|
3499
3493
|
}
|
|
3500
3494
|
|
|
3501
3495
|
// src/components/data/Clamp.tsx
|
|
3502
|
-
import * as
|
|
3496
|
+
import * as React34 from "react";
|
|
3503
3497
|
import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3504
3498
|
function Clamp({
|
|
3505
3499
|
children,
|
|
@@ -3511,16 +3505,16 @@ function Clamp({
|
|
|
3511
3505
|
onToggle,
|
|
3512
3506
|
className = ""
|
|
3513
3507
|
}) {
|
|
3514
|
-
const [open2, setOpen] =
|
|
3515
|
-
const [overflows, setOverflows] =
|
|
3516
|
-
const bodyRef =
|
|
3517
|
-
const charClamped =
|
|
3508
|
+
const [open2, setOpen] = React34.useState(false);
|
|
3509
|
+
const [overflows, setOverflows] = React34.useState(false);
|
|
3510
|
+
const bodyRef = React34.useRef(null);
|
|
3511
|
+
const charClamped = React34.useMemo(() => {
|
|
3518
3512
|
if (open2 || !maxChars || typeof text !== "string" || text.length <= maxChars) return null;
|
|
3519
3513
|
const cut = text.slice(0, maxChars);
|
|
3520
3514
|
const at = cut.lastIndexOf(" ");
|
|
3521
3515
|
return (at > maxChars * 0.6 ? cut.slice(0, at) : cut).trimEnd() + "\u2026";
|
|
3522
3516
|
}, [text, maxChars, open2]);
|
|
3523
|
-
|
|
3517
|
+
React34.useLayoutEffect(() => {
|
|
3524
3518
|
const node = bodyRef.current;
|
|
3525
3519
|
if (maxChars || !node || !maxHeight) return;
|
|
3526
3520
|
const measure = () => {
|
|
@@ -3782,16 +3776,16 @@ function StackedRows({ columns, rows, rowKey, loading, stale, skeletonRows, sort
|
|
|
3782
3776
|
}
|
|
3783
3777
|
|
|
3784
3778
|
// src/components/data/FilterBar.tsx
|
|
3785
|
-
import * as
|
|
3779
|
+
import * as React40 from "react";
|
|
3786
3780
|
|
|
3787
3781
|
// src/components/forms/NumberInput.tsx
|
|
3788
|
-
import * as
|
|
3782
|
+
import * as React37 from "react";
|
|
3789
3783
|
|
|
3790
3784
|
// src/components/forms/field.tsx
|
|
3791
|
-
import * as
|
|
3785
|
+
import * as React35 from "react";
|
|
3792
3786
|
import { jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3793
3787
|
function useFieldId(id) {
|
|
3794
|
-
const generated =
|
|
3788
|
+
const generated = React35.useId();
|
|
3795
3789
|
return id || generated;
|
|
3796
3790
|
}
|
|
3797
3791
|
function FieldLabel({ htmlFor, id, required = false, onClick, children }) {
|
|
@@ -3810,10 +3804,10 @@ function HiddenFieldLabel({ id, children }) {
|
|
|
3810
3804
|
}
|
|
3811
3805
|
|
|
3812
3806
|
// src/components/useLatest.ts
|
|
3813
|
-
import * as
|
|
3807
|
+
import * as React36 from "react";
|
|
3814
3808
|
function useLatest(value) {
|
|
3815
|
-
const ref =
|
|
3816
|
-
|
|
3809
|
+
const ref = React36.useRef(value);
|
|
3810
|
+
React36.useInsertionEffect(() => {
|
|
3817
3811
|
ref.current = value;
|
|
3818
3812
|
});
|
|
3819
3813
|
return ref;
|
|
@@ -3896,20 +3890,20 @@ function NumberInput({
|
|
|
3896
3890
|
const n = typeof v === "number" ? v : parseNumberText(v);
|
|
3897
3891
|
return n == null || Number.isNaN(n) ? null : n;
|
|
3898
3892
|
};
|
|
3899
|
-
const [text, setText] =
|
|
3900
|
-
const [editing, setEditing] =
|
|
3893
|
+
const [text, setText] = React37.useState(() => toText(value));
|
|
3894
|
+
const [editing, setEditing] = React37.useState(false);
|
|
3901
3895
|
const parsed = parseNumberText(text);
|
|
3902
3896
|
const invalidMessage = parsed == null ? null : Number.isNaN(parsed) ? "Enter a number" : integer && !Number.isInteger(parsed) ? "Enter a whole number" : parsed < lo ? "Must be \u2265 " + lo : parsed > hi ? "Must be \u2264 " + hi : null;
|
|
3903
3897
|
const valid = invalidMessage == null;
|
|
3904
|
-
const committedRef =
|
|
3898
|
+
const committedRef = React37.useRef(toNumber(value));
|
|
3905
3899
|
const onChangeRef = useLatest(onChange);
|
|
3906
3900
|
const onValidityChangeRef = useLatest(onValidityChange);
|
|
3907
|
-
const focusedRef =
|
|
3908
|
-
|
|
3901
|
+
const focusedRef = React37.useRef(false);
|
|
3902
|
+
React37.useEffect(() => {
|
|
3909
3903
|
committedRef.current = toNumber(value);
|
|
3910
3904
|
if (!focusedRef.current) setText(toText(value));
|
|
3911
3905
|
}, [value]);
|
|
3912
|
-
|
|
3906
|
+
React37.useLayoutEffect(() => {
|
|
3913
3907
|
onValidityChangeRef.current?.(valid);
|
|
3914
3908
|
}, [valid, onValidityChangeRef]);
|
|
3915
3909
|
const fire = (n) => {
|
|
@@ -3925,7 +3919,7 @@ function NumberInput({
|
|
|
3925
3919
|
return true;
|
|
3926
3920
|
};
|
|
3927
3921
|
const bumpRef = useLatest(bump);
|
|
3928
|
-
const holdTimer =
|
|
3922
|
+
const holdTimer = React37.useRef(null);
|
|
3929
3923
|
const release2 = () => {
|
|
3930
3924
|
if (holdTimer.current) clearTimeout(holdTimer.current);
|
|
3931
3925
|
holdTimer.current = null;
|
|
@@ -3944,7 +3938,7 @@ function NumberInput({
|
|
|
3944
3938
|
};
|
|
3945
3939
|
holdTimer.current = setTimeout(tick, HOLD_DELAY_MS);
|
|
3946
3940
|
};
|
|
3947
|
-
|
|
3941
|
+
React37.useEffect(() => () => {
|
|
3948
3942
|
if (holdTimer.current) clearTimeout(holdTimer.current);
|
|
3949
3943
|
}, []);
|
|
3950
3944
|
const current2 = committedRef.current;
|
|
@@ -4047,7 +4041,7 @@ function NumberInput({
|
|
|
4047
4041
|
}
|
|
4048
4042
|
|
|
4049
4043
|
// src/components/forms/DatePicker.tsx
|
|
4050
|
-
import * as
|
|
4044
|
+
import * as React38 from "react";
|
|
4051
4045
|
import { jsx as jsx53, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
4052
4046
|
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
4053
4047
|
var DOW = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
@@ -4080,10 +4074,10 @@ function Calendar({ value, range = false, onPick, initialMonth, months = 1 }) {
|
|
|
4080
4074
|
const today = /* @__PURE__ */ new Date();
|
|
4081
4075
|
const sel = range ? value || {} : { start: value, end: value };
|
|
4082
4076
|
const anchor = parse(sel.start) || parse(initialMonth) || today;
|
|
4083
|
-
const [vy, setVy] =
|
|
4084
|
-
const [vm, setVm] =
|
|
4085
|
-
const [mode2, setMode] =
|
|
4086
|
-
const [hover, setHover] =
|
|
4077
|
+
const [vy, setVy] = React38.useState(anchor.getFullYear());
|
|
4078
|
+
const [vm, setVm] = React38.useState(anchor.getMonth());
|
|
4079
|
+
const [mode2, setMode] = React38.useState("days");
|
|
4080
|
+
const [hover, setHover] = React38.useState(null);
|
|
4087
4081
|
const s = parse(sel.start), e = parse(sel.end);
|
|
4088
4082
|
const hoverEnd = range && s && !e && hover ? parse(hover) : null;
|
|
4089
4083
|
const inRange = (d) => {
|
|
@@ -4094,12 +4088,12 @@ function Calendar({ value, range = false, onPick, initialMonth, months = 1 }) {
|
|
|
4094
4088
|
const isEnd = (d) => !!e && iso(d) === iso(e);
|
|
4095
4089
|
const isEdge = (d) => isStart(d) || isEnd(d);
|
|
4096
4090
|
const nextY = vm === 11 ? vy + 1 : vy, nextM = (vm + 1) % 12;
|
|
4097
|
-
const [activeDate, setActiveDate] =
|
|
4091
|
+
const [activeDate, setActiveDate] = React38.useState(() => {
|
|
4098
4092
|
if (s) return s;
|
|
4099
4093
|
if (sameMonth(today, anchor.getFullYear(), anchor.getMonth())) return today;
|
|
4100
4094
|
return new Date(anchor.getFullYear(), anchor.getMonth(), 1);
|
|
4101
4095
|
});
|
|
4102
|
-
const calRef =
|
|
4096
|
+
const calRef = React38.useRef(null);
|
|
4103
4097
|
const pageToShow = (y, m) => {
|
|
4104
4098
|
const idx = y * 12 + m, firstIdx = vy * 12 + vm, secondIdx = firstIdx + 1;
|
|
4105
4099
|
if (idx === firstIdx || months > 1 && idx === secondIdx) return;
|
|
@@ -4116,7 +4110,7 @@ function Calendar({ value, range = false, onPick, initialMonth, months = 1 }) {
|
|
|
4116
4110
|
setActiveDate(next);
|
|
4117
4111
|
pageToShow(next.getFullYear(), next.getMonth());
|
|
4118
4112
|
};
|
|
4119
|
-
|
|
4113
|
+
React38.useEffect(() => {
|
|
4120
4114
|
const el = calRef.current?.querySelector('[data-iso="' + iso(activeDate) + '"]');
|
|
4121
4115
|
if (el) el.focus({ preventScroll: true });
|
|
4122
4116
|
}, [activeDate, vy, vm]);
|
|
@@ -4309,9 +4303,9 @@ function Calendar({ value, range = false, onPick, initialMonth, months = 1 }) {
|
|
|
4309
4303
|
}
|
|
4310
4304
|
function DatePicker({ label, help, error, required = false, disabled = false, range = false, value, onChange, placeholder, id, className = "", style, "aria-label": hiddenLabel, ...rest }) {
|
|
4311
4305
|
const { fieldId, labelId, ariaLabelledBy } = useTriggerLabelling(label, id, hiddenLabel);
|
|
4312
|
-
const [open2, setOpen] =
|
|
4313
|
-
const rootRef =
|
|
4314
|
-
const boxRef =
|
|
4306
|
+
const [open2, setOpen] = React38.useState(false);
|
|
4307
|
+
const rootRef = React38.useRef(null);
|
|
4308
|
+
const boxRef = React38.useRef(null);
|
|
4315
4309
|
const display = range ? value && value.start ? fmt(value.start) + (value.end ? " \u2192 " + fmt(value.end) : " \u2192 \u2026") : "" : fmt(value);
|
|
4316
4310
|
const toggle = () => {
|
|
4317
4311
|
if (!disabled) setOpen(!open2);
|
|
@@ -4400,9 +4394,9 @@ function Textarea({ label, help, error, required = false, rows = 4, disabled = f
|
|
|
4400
4394
|
}
|
|
4401
4395
|
|
|
4402
4396
|
// src/components/forms/listbox.ts
|
|
4403
|
-
import * as
|
|
4397
|
+
import * as React39 from "react";
|
|
4404
4398
|
function useListboxNav({ count, onSelect }) {
|
|
4405
|
-
const [active, setActive] =
|
|
4399
|
+
const [active, setActive] = React39.useState(-1);
|
|
4406
4400
|
return {
|
|
4407
4401
|
active,
|
|
4408
4402
|
setActive,
|
|
@@ -4415,7 +4409,7 @@ function useListboxNav({ count, onSelect }) {
|
|
|
4415
4409
|
};
|
|
4416
4410
|
}
|
|
4417
4411
|
function useListboxScrollIntoView(active, listRef, enabled) {
|
|
4418
|
-
|
|
4412
|
+
React39.useEffect(() => {
|
|
4419
4413
|
if (!enabled || active < 0 || !listRef.current) return;
|
|
4420
4414
|
const list = listRef.current;
|
|
4421
4415
|
const el = list.querySelector('[data-i="' + active + '"]');
|
|
@@ -4646,13 +4640,13 @@ function MultiSelectPanel({
|
|
|
4646
4640
|
onClose
|
|
4647
4641
|
}) {
|
|
4648
4642
|
const allowedOps = operatorsFor(field);
|
|
4649
|
-
const [draftOperator, setDraftOperator] =
|
|
4643
|
+
const [draftOperator, setDraftOperator] = React40.useState(value?.operator ?? allowedOps[0]);
|
|
4650
4644
|
const operator = allowedOps.length === 1 ? allowedOps[0] : value?.operator ?? draftOperator;
|
|
4651
4645
|
const selected = value?.values ?? [];
|
|
4652
4646
|
const selectedRef = useLatest(selected);
|
|
4653
4647
|
const operatorRef = useLatest(operator);
|
|
4654
|
-
const mountedRef =
|
|
4655
|
-
|
|
4648
|
+
const mountedRef = React40.useRef(true);
|
|
4649
|
+
React40.useEffect(() => {
|
|
4656
4650
|
mountedRef.current = true;
|
|
4657
4651
|
return () => {
|
|
4658
4652
|
mountedRef.current = false;
|
|
@@ -4666,20 +4660,20 @@ function MultiSelectPanel({
|
|
|
4666
4660
|
if (selectedRef.current.length > 0) commit(selectedRef.current, op);
|
|
4667
4661
|
else setDraftOperator(op);
|
|
4668
4662
|
};
|
|
4669
|
-
const [mode2, setMode] =
|
|
4670
|
-
const [query, setQuery] =
|
|
4671
|
-
const [asyncState, setAsyncState] =
|
|
4663
|
+
const [mode2, setMode] = React40.useState("search");
|
|
4664
|
+
const [query, setQuery] = React40.useState("");
|
|
4665
|
+
const [asyncState, setAsyncState] = React40.useState(
|
|
4672
4666
|
{ options: null, loading: !!field.loadOptions, error: false }
|
|
4673
4667
|
);
|
|
4674
|
-
const [retryTick, setRetryTick] =
|
|
4675
|
-
const inputRef =
|
|
4676
|
-
const listRef =
|
|
4677
|
-
const listId =
|
|
4668
|
+
const [retryTick, setRetryTick] = React40.useState(0);
|
|
4669
|
+
const inputRef = React40.useRef(null);
|
|
4670
|
+
const listRef = React40.useRef(null);
|
|
4671
|
+
const listId = React40.useId();
|
|
4678
4672
|
const loadOptionsRef = useLatest(field.loadOptions);
|
|
4679
|
-
|
|
4673
|
+
React40.useEffect(() => {
|
|
4680
4674
|
inputRef.current?.focus();
|
|
4681
4675
|
}, []);
|
|
4682
|
-
|
|
4676
|
+
React40.useEffect(() => {
|
|
4683
4677
|
const load = loadOptionsRef.current;
|
|
4684
4678
|
if (!load) return;
|
|
4685
4679
|
const controller = new AbortController();
|
|
@@ -4699,12 +4693,12 @@ function MultiSelectPanel({
|
|
|
4699
4693
|
};
|
|
4700
4694
|
}, [query, retryTick, loadOptionsRef]);
|
|
4701
4695
|
const options = field.loadOptions ? asyncState.options ?? [] : (field.options ?? []).filter((o) => o.label.toLowerCase().includes(query.toLowerCase()));
|
|
4702
|
-
const [panelWidth, setPanelWidth] =
|
|
4696
|
+
const [panelWidth, setPanelWidth] = React40.useState(PANEL_WIDTH.multiSelect);
|
|
4703
4697
|
const optionsRef = useLatest(options);
|
|
4704
4698
|
const labelsKey = options.map((o) => o.label).join("\0");
|
|
4705
|
-
const toggleRowRef =
|
|
4706
|
-
const toggleObserver =
|
|
4707
|
-
const fitToggles =
|
|
4699
|
+
const toggleRowRef = React40.useRef(null);
|
|
4700
|
+
const toggleObserver = React40.useRef(null);
|
|
4701
|
+
const fitToggles = React40.useCallback(() => {
|
|
4708
4702
|
const row = toggleRowRef.current;
|
|
4709
4703
|
const surface = row?.closest("[role=dialog]");
|
|
4710
4704
|
if (!row || !surface) return;
|
|
@@ -4715,7 +4709,7 @@ function MultiSelectPanel({
|
|
|
4715
4709
|
const wanted = Math.ceil(natural + used(surface) - used(row));
|
|
4716
4710
|
setPanelWidth((w) => Math.max(w, wanted));
|
|
4717
4711
|
}, []);
|
|
4718
|
-
const attachToggleRow =
|
|
4712
|
+
const attachToggleRow = React40.useCallback((row) => {
|
|
4719
4713
|
toggleObserver.current?.disconnect();
|
|
4720
4714
|
toggleObserver.current = null;
|
|
4721
4715
|
toggleRowRef.current = row;
|
|
@@ -4725,7 +4719,7 @@ function MultiSelectPanel({
|
|
|
4725
4719
|
toggleObserver.current = new ResizeObserver(fitToggles);
|
|
4726
4720
|
for (const toggle2 of Array.from(row.children)) toggleObserver.current.observe(toggle2);
|
|
4727
4721
|
}, [fitToggles]);
|
|
4728
|
-
|
|
4722
|
+
React40.useLayoutEffect(() => {
|
|
4729
4723
|
const measure = () => {
|
|
4730
4724
|
const label = document.getElementById(listId)?.querySelector(".fd-opt-label");
|
|
4731
4725
|
if (!label) return;
|
|
@@ -4755,17 +4749,17 @@ function MultiSelectPanel({
|
|
|
4755
4749
|
};
|
|
4756
4750
|
const nav = useListboxNav({ count: options.length, onSelect: (i) => toggle(options[i]) });
|
|
4757
4751
|
useListboxScrollIntoView(nav.active, listRef, hasListbox);
|
|
4758
|
-
|
|
4752
|
+
React40.useEffect(() => {
|
|
4759
4753
|
nav.setActive(0);
|
|
4760
4754
|
}, [query, options.length]);
|
|
4761
4755
|
const activeId = hasListbox && options[nav.active] ? listId + "-opt-" + nav.active : void 0;
|
|
4762
4756
|
const liveMessage = showLoading ? "Loading\u2026" : showError ? "Couldn't load options." : options.length === 0 ? query === "" && field.emptyText || "No matches" : atLimit ? "Limit reached: at most " + field.maxValues + " values" : "";
|
|
4763
|
-
const [pasteText, setPasteText] =
|
|
4764
|
-
const [pasteLoading, setPasteLoading] =
|
|
4765
|
-
const [unmatchedTokens, setUnmatchedTokens] =
|
|
4766
|
-
const [pasteError, setPasteError] =
|
|
4767
|
-
const pasteWrapRef =
|
|
4768
|
-
|
|
4757
|
+
const [pasteText, setPasteText] = React40.useState("");
|
|
4758
|
+
const [pasteLoading, setPasteLoading] = React40.useState(false);
|
|
4759
|
+
const [unmatchedTokens, setUnmatchedTokens] = React40.useState([]);
|
|
4760
|
+
const [pasteError, setPasteError] = React40.useState(null);
|
|
4761
|
+
const pasteWrapRef = React40.useRef(null);
|
|
4762
|
+
React40.useEffect(() => {
|
|
4769
4763
|
if (mode2 === "paste") pasteWrapRef.current?.querySelector("textarea")?.focus();
|
|
4770
4764
|
}, [mode2]);
|
|
4771
4765
|
const doResolve = () => {
|
|
@@ -4941,8 +4935,8 @@ function MultiSelectPanel({
|
|
|
4941
4935
|
);
|
|
4942
4936
|
}
|
|
4943
4937
|
function useTextValidity(onFlip) {
|
|
4944
|
-
const invalidRef =
|
|
4945
|
-
const [, rerender] =
|
|
4938
|
+
const invalidRef = React40.useRef(/* @__PURE__ */ new Set());
|
|
4939
|
+
const [, rerender] = React40.useReducer((n) => n + 1, 0);
|
|
4946
4940
|
const onFlipRef = useLatest(onFlip);
|
|
4947
4941
|
const record = (name, valid) => {
|
|
4948
4942
|
const invalid = invalidRef.current;
|
|
@@ -4985,15 +4979,15 @@ function sameValue(a, b) {
|
|
|
4985
4979
|
return true;
|
|
4986
4980
|
}
|
|
4987
4981
|
function useReseedFromProps(value, applies, reseed) {
|
|
4988
|
-
const seen =
|
|
4989
|
-
|
|
4982
|
+
const seen = React40.useRef(value);
|
|
4983
|
+
React40.useLayoutEffect(() => {
|
|
4990
4984
|
if (seen.current === value) return;
|
|
4991
4985
|
seen.current = value;
|
|
4992
4986
|
if (!sameValue(value, applies())) reseed(value);
|
|
4993
4987
|
}, [value, applies, reseed]);
|
|
4994
4988
|
}
|
|
4995
4989
|
function usePreserveFocusAcrossRemount(seed, fields) {
|
|
4996
|
-
const pendingName =
|
|
4990
|
+
const pendingName = React40.useRef(null);
|
|
4997
4991
|
const fieldsRef = useLatest(fields);
|
|
4998
4992
|
const capture = () => {
|
|
4999
4993
|
const active = document.activeElement;
|
|
@@ -5006,7 +5000,7 @@ function usePreserveFocusAcrossRemount(seed, fields) {
|
|
|
5006
5000
|
}
|
|
5007
5001
|
}
|
|
5008
5002
|
};
|
|
5009
|
-
|
|
5003
|
+
React40.useLayoutEffect(() => {
|
|
5010
5004
|
const name = pendingName.current;
|
|
5011
5005
|
if (!name) return;
|
|
5012
5006
|
pendingName.current = null;
|
|
@@ -5022,14 +5016,14 @@ function RangePanel({
|
|
|
5022
5016
|
onCommit,
|
|
5023
5017
|
onClose
|
|
5024
5018
|
}) {
|
|
5025
|
-
const [draft, setDraft] =
|
|
5026
|
-
const [seed, setSeed] =
|
|
5027
|
-
const minId =
|
|
5028
|
-
const maxId =
|
|
5029
|
-
const minWrapRef =
|
|
5030
|
-
const maxWrapRef =
|
|
5019
|
+
const [draft, setDraft] = React40.useState(() => rangeDraft(value));
|
|
5020
|
+
const [seed, setSeed] = React40.useState(0);
|
|
5021
|
+
const minId = React40.useId();
|
|
5022
|
+
const maxId = React40.useId();
|
|
5023
|
+
const minWrapRef = React40.useRef(null);
|
|
5024
|
+
const maxWrapRef = React40.useRef(null);
|
|
5031
5025
|
const preserveFocus = usePreserveFocusAcrossRemount(seed, { min: minWrapRef, max: maxWrapRef });
|
|
5032
|
-
const draftRef =
|
|
5026
|
+
const draftRef = React40.useRef(draft);
|
|
5033
5027
|
const shown = () => {
|
|
5034
5028
|
const { min, max } = draftRef.current;
|
|
5035
5029
|
return applicable(field, min == null && max == null ? void 0 : { min, max }, validity.allValid());
|
|
@@ -5121,15 +5115,15 @@ function DatePanel({
|
|
|
5121
5115
|
onClose
|
|
5122
5116
|
}) {
|
|
5123
5117
|
const maxDays = effectiveMaxDays(field);
|
|
5124
|
-
const [initial] =
|
|
5125
|
-
const [kind, setKind] =
|
|
5126
|
-
const [daysDraft, setDaysDraft] =
|
|
5127
|
-
const daysRef =
|
|
5128
|
-
const daysConfirmed =
|
|
5129
|
-
const [between, setBetween] =
|
|
5130
|
-
const [seed, setSeed] =
|
|
5131
|
-
const daysId =
|
|
5132
|
-
const daysWrapRef =
|
|
5118
|
+
const [initial] = React40.useState(() => dateDraft(field, value));
|
|
5119
|
+
const [kind, setKind] = React40.useState(initial.kind);
|
|
5120
|
+
const [daysDraft, setDaysDraft] = React40.useState(initial.days);
|
|
5121
|
+
const daysRef = React40.useRef(daysDraft);
|
|
5122
|
+
const daysConfirmed = React40.useRef(value?.kind === "withinDays");
|
|
5123
|
+
const [between, setBetween] = React40.useState(initial.between);
|
|
5124
|
+
const [seed, setSeed] = React40.useState(0);
|
|
5125
|
+
const daysId = React40.useId();
|
|
5126
|
+
const daysWrapRef = React40.useRef(null);
|
|
5133
5127
|
const preserveFocus = usePreserveFocusAcrossRemount(seed, { days: daysWrapRef });
|
|
5134
5128
|
const shownWithinDays = () => {
|
|
5135
5129
|
const days = daysRef.current;
|
|
@@ -5261,11 +5255,11 @@ function FieldHelpButton({ field, onFieldHelp }) {
|
|
|
5261
5255
|
) });
|
|
5262
5256
|
}
|
|
5263
5257
|
function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, onFieldHelp, align = "left", actions, onClearAll, showActiveCount = false, loading = false, loadingLabel = "Loading the filters", className = "", ...rest }) {
|
|
5264
|
-
const [panel, setPanel] =
|
|
5265
|
-
const editAnchorRef =
|
|
5266
|
-
const addAnchorRef =
|
|
5267
|
-
const textInputRef =
|
|
5268
|
-
const optionsRef =
|
|
5258
|
+
const [panel, setPanel] = React40.useState(null);
|
|
5259
|
+
const editAnchorRef = React40.useRef(null);
|
|
5260
|
+
const addAnchorRef = React40.useRef(null);
|
|
5261
|
+
const textInputRef = React40.useRef(null);
|
|
5262
|
+
const optionsRef = React40.useRef(null);
|
|
5269
5263
|
if (process.env.NODE_ENV !== "production") {
|
|
5270
5264
|
for (const f of fields) assertValidFieldDefinition(f);
|
|
5271
5265
|
}
|
|
@@ -5288,7 +5282,7 @@ function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, onFie
|
|
|
5288
5282
|
const editingField = panel && panel.kind === "edit" ? fields.find((f) => f.key === panel.key) : void 0;
|
|
5289
5283
|
const startEditing = (key) => setPanel({ kind: "edit", key });
|
|
5290
5284
|
const closeEditing = () => setPanel(null);
|
|
5291
|
-
|
|
5285
|
+
React40.useEffect(() => {
|
|
5292
5286
|
if (!panel || panel.kind !== "edit") return;
|
|
5293
5287
|
if (editingField?.type === "text") {
|
|
5294
5288
|
textInputRef.current?.focus();
|
|
@@ -5572,7 +5566,7 @@ function StatTile(props) {
|
|
|
5572
5566
|
}
|
|
5573
5567
|
|
|
5574
5568
|
// src/components/data/CodeBlock.tsx
|
|
5575
|
-
import * as
|
|
5569
|
+
import * as React41 from "react";
|
|
5576
5570
|
import { Fragment as Fragment12, jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
5577
5571
|
var JS_KW = /^(?:const|let|var|function|return|if|else|for|while|do|new|class|extends|import|from|export|default|await|async|try|catch|finally|throw|typeof|instanceof|of|in|switch|case|break|continue|delete|void|yield|static|get|set|this|super|interface|type|enum|implements|public|private|protected|readonly|abstract|as|satisfies|declare|namespace)$/;
|
|
5578
5572
|
var RULES = {
|
|
@@ -5728,7 +5722,7 @@ function tokenize(src, lang) {
|
|
|
5728
5722
|
return out;
|
|
5729
5723
|
}
|
|
5730
5724
|
function Highlighted({ code, lang }) {
|
|
5731
|
-
const toks =
|
|
5725
|
+
const toks = React41.useMemo(() => tokenize(code, lang), [code, lang]);
|
|
5732
5726
|
return /* @__PURE__ */ jsx60(Fragment12, { children: toks.map((tk, i) => tk.c ? /* @__PURE__ */ jsx60("span", { className: "tok-" + tk.c, children: tk.t }, i) : tk.t) });
|
|
5733
5727
|
}
|
|
5734
5728
|
function CodeBlock({
|
|
@@ -5742,8 +5736,8 @@ function CodeBlock({
|
|
|
5742
5736
|
actions,
|
|
5743
5737
|
className = ""
|
|
5744
5738
|
}) {
|
|
5745
|
-
const [wrap, setWrap] =
|
|
5746
|
-
const [open2, setOpen] =
|
|
5739
|
+
const [wrap, setWrap] = React41.useState(!!wrapDefault);
|
|
5740
|
+
const [open2, setOpen] = React41.useState(false);
|
|
5747
5741
|
const [copied, copy] = useCopyToClipboard();
|
|
5748
5742
|
const body = String(code).replace(/\n$/, "");
|
|
5749
5743
|
const lines = body.split("\n");
|
|
@@ -5772,7 +5766,7 @@ function CodeBlock({
|
|
|
5772
5766
|
] });
|
|
5773
5767
|
}
|
|
5774
5768
|
function DiffBlock({ diff = "", filename, collapseAfter = 34, className = "" }) {
|
|
5775
|
-
const [open2, setOpen] =
|
|
5769
|
+
const [open2, setOpen] = React41.useState(false);
|
|
5776
5770
|
const [copied, copy] = useCopyToClipboard();
|
|
5777
5771
|
const raw = String(diff).replace(/\n$/, "");
|
|
5778
5772
|
const all = raw.split("\n").map((line) => {
|
|
@@ -5818,7 +5812,7 @@ function DiffBlock({ diff = "", filename, collapseAfter = 34, className = "" })
|
|
|
5818
5812
|
}
|
|
5819
5813
|
|
|
5820
5814
|
// src/components/data/Markdown.tsx
|
|
5821
|
-
import * as
|
|
5815
|
+
import * as React42 from "react";
|
|
5822
5816
|
import { jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
5823
5817
|
var SAFE = /^(?:https?:|mailto:|tel:|#|\/|\.{1,2}\/)/i;
|
|
5824
5818
|
var safeHref = (h) => SAFE.test(String(h || "").trim()) ? String(h).trim() : null;
|
|
@@ -5861,7 +5855,7 @@ function hiddenInlineNodes(hidden, ctx, keyBase) {
|
|
|
5861
5855
|
const href = safeHref(d(g(2)));
|
|
5862
5856
|
out.push(href ? /* @__PURE__ */ jsx61("a", { href, title: g(3) ? d(g(3)) : void 0, target: /^https?:/i.test(href) ? "_blank" : void 0, rel: "noopener noreferrer", onClick: ctx.onLinkClick, children: hiddenInlineNodes(g(1), ctx, key()) }, key()) : /* @__PURE__ */ jsx61("span", { children: d(g(1)) }, key()));
|
|
5863
5857
|
} else if (kind === "cite") {
|
|
5864
|
-
out.push(ctx.renderCitation ? /* @__PURE__ */ jsx61(
|
|
5858
|
+
out.push(ctx.renderCitation ? /* @__PURE__ */ jsx61(React42.Fragment, { children: ctx.renderCitation(d(g(1))) }, key()) : /* @__PURE__ */ jsx61("sup", { className: "fd-md-cite", children: d(g(1)) }, key()));
|
|
5865
5859
|
} else if (kind === "strongem") out.push(/* @__PURE__ */ jsx61("strong", { children: /* @__PURE__ */ jsx61("em", { children: hiddenInlineNodes(g(1), ctx, key()) }) }, key()));
|
|
5866
5860
|
else if (kind === "strong") out.push(/* @__PURE__ */ jsx61("strong", { children: hiddenInlineNodes(g(1) || g(2), ctx, key()) }, key()));
|
|
5867
5861
|
else if (kind === "em") out.push(/* @__PURE__ */ jsx61("em", { children: hiddenInlineNodes(g(1) || g(2), ctx, key()) }, key()));
|
|
@@ -6048,7 +6042,7 @@ function Markdown({
|
|
|
6048
6042
|
tone = "default"
|
|
6049
6043
|
}) {
|
|
6050
6044
|
const ctx = { allowImages, headingOffset, renderCitation, onLinkClick, codeProps };
|
|
6051
|
-
const blocks =
|
|
6045
|
+
const blocks = React42.useMemo(() => parseBlocks(source), [source]);
|
|
6052
6046
|
return /* @__PURE__ */ jsx61("div", { className: mdClass("fd-md", size, tone, className), children: renderBlocks(blocks, ctx, "b") });
|
|
6053
6047
|
}
|
|
6054
6048
|
function MarkdownInline({ source = "", className = "", onLinkClick, size, tone }) {
|
|
@@ -6159,7 +6153,7 @@ function Pagination({
|
|
|
6159
6153
|
}
|
|
6160
6154
|
|
|
6161
6155
|
// src/components/data/RelativeTime.tsx
|
|
6162
|
-
import * as
|
|
6156
|
+
import * as React43 from "react";
|
|
6163
6157
|
import { jsxs as jsxs52 } from "react/jsx-runtime";
|
|
6164
6158
|
var MIN = 6e4;
|
|
6165
6159
|
var HOUR = 36e5;
|
|
@@ -6211,9 +6205,9 @@ function formatDuration(ms) {
|
|
|
6211
6205
|
return h + "h" + (m % 60 ? " " + m % 60 + "m" : "");
|
|
6212
6206
|
}
|
|
6213
6207
|
function RelativeTime({ value, prefix, className = "", refresh: refresh2 = true, ...rest }) {
|
|
6214
|
-
const [, force] =
|
|
6208
|
+
const [, force] = React43.useState(0);
|
|
6215
6209
|
const t = value instanceof Date ? value.getTime() : Date.parse(value);
|
|
6216
|
-
|
|
6210
|
+
React43.useEffect(() => {
|
|
6217
6211
|
if (!refresh2 || !t || isNaN(t)) return;
|
|
6218
6212
|
const abs = Math.abs(t - Date.now());
|
|
6219
6213
|
if (abs > DAY) return;
|
|
@@ -6229,7 +6223,7 @@ function RelativeTime({ value, prefix, className = "", refresh: refresh2 = true,
|
|
|
6229
6223
|
}
|
|
6230
6224
|
|
|
6231
6225
|
// src/components/data/ScoreMeter.tsx
|
|
6232
|
-
import * as
|
|
6226
|
+
import * as React44 from "react";
|
|
6233
6227
|
import { jsx as jsx64, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
6234
6228
|
function ScoreMeter({
|
|
6235
6229
|
score,
|
|
@@ -6244,10 +6238,10 @@ function ScoreMeter({
|
|
|
6244
6238
|
breakdownWidth = 280,
|
|
6245
6239
|
className = ""
|
|
6246
6240
|
}) {
|
|
6247
|
-
const [open2, setOpen] =
|
|
6248
|
-
const ref =
|
|
6241
|
+
const [open2, setOpen] = React44.useState(false);
|
|
6242
|
+
const ref = React44.useRef(null);
|
|
6249
6243
|
const value = Math.max(0, Math.min(100, Math.round(Number(score) || 0)));
|
|
6250
|
-
const body = /* @__PURE__ */ jsxs53(
|
|
6244
|
+
const body = /* @__PURE__ */ jsxs53(React44.Fragment, { children: [
|
|
6251
6245
|
/* @__PURE__ */ jsx64("span", { className: "fd-scoremeter-rail", style: { width }, "aria-hidden": "true", children: /* @__PURE__ */ jsx64(SegmentedMeter, { total: 100, segments, height, showTotal: false, showPercent: false, legend: false }) }),
|
|
6252
6246
|
showScore ? /* @__PURE__ */ jsx64("span", { className: "fd-scoremeter-value fd-tabular", "aria-hidden": "true", children: value }) : null
|
|
6253
6247
|
] });
|
|
@@ -6266,7 +6260,7 @@ function ScoreMeter({
|
|
|
6266
6260
|
}
|
|
6267
6261
|
);
|
|
6268
6262
|
}
|
|
6269
|
-
return /* @__PURE__ */ jsxs53(
|
|
6263
|
+
return /* @__PURE__ */ jsxs53(React44.Fragment, { children: [
|
|
6270
6264
|
/* @__PURE__ */ jsx64(
|
|
6271
6265
|
"button",
|
|
6272
6266
|
{
|
|
@@ -6297,11 +6291,11 @@ function ScoreMeter({
|
|
|
6297
6291
|
}
|
|
6298
6292
|
|
|
6299
6293
|
// src/components/actions/inlinePanel.tsx
|
|
6300
|
-
import * as
|
|
6294
|
+
import * as React45 from "react";
|
|
6301
6295
|
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
6302
6296
|
function useInlinePanel() {
|
|
6303
|
-
const [open2, setOpen] =
|
|
6304
|
-
const ref =
|
|
6297
|
+
const [open2, setOpen] = React45.useState(false);
|
|
6298
|
+
const ref = React45.useRef(null);
|
|
6305
6299
|
return { open: open2, setOpen, ref };
|
|
6306
6300
|
}
|
|
6307
6301
|
function InlinePanelSurface({ panel, align = "right", ...popover }) {
|
|
@@ -6472,7 +6466,7 @@ function SortMenu({
|
|
|
6472
6466
|
}
|
|
6473
6467
|
|
|
6474
6468
|
// src/components/data/StepList.tsx
|
|
6475
|
-
import * as
|
|
6469
|
+
import * as React46 from "react";
|
|
6476
6470
|
import { jsx as jsx67, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
6477
6471
|
var KIND_ICON = { tool: "wrench", search: "magnifying-glass", read: "file-text", write: "pencil-simple", reasoning: "brain", run: "terminal", fetch: "cloud-arrow-down" };
|
|
6478
6472
|
function StepList({
|
|
@@ -6486,9 +6480,9 @@ function StepList({
|
|
|
6486
6480
|
className = "",
|
|
6487
6481
|
active = false
|
|
6488
6482
|
}) {
|
|
6489
|
-
const [openState, setOpenState] =
|
|
6483
|
+
const [openState, setOpenState] = React46.useState(defaultOpen);
|
|
6490
6484
|
const open2 = openProp == null ? openState : openProp;
|
|
6491
|
-
const [expanded, setExpanded] =
|
|
6485
|
+
const [expanded, setExpanded] = React46.useState({});
|
|
6492
6486
|
if (!steps.length) return null;
|
|
6493
6487
|
const running = steps.some((s) => s.status === "running");
|
|
6494
6488
|
const failed = steps.filter((s) => s.status === "error").length;
|
|
@@ -6546,7 +6540,7 @@ function StepList({
|
|
|
6546
6540
|
}
|
|
6547
6541
|
|
|
6548
6542
|
// src/components/data/VirtualList.tsx
|
|
6549
|
-
import * as
|
|
6543
|
+
import * as React47 from "react";
|
|
6550
6544
|
import { jsx as jsx68, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
6551
6545
|
var VIRTUAL_LIST_BUFFER_ROWS = 20;
|
|
6552
6546
|
var VIRTUAL_LIST_ROW_GAP = 6;
|
|
@@ -6598,35 +6592,35 @@ function VirtualList({
|
|
|
6598
6592
|
className = "",
|
|
6599
6593
|
style
|
|
6600
6594
|
}) {
|
|
6601
|
-
const [scrollTop, setScrollTop] =
|
|
6602
|
-
const loaded =
|
|
6595
|
+
const [scrollTop, setScrollTop] = React47.useState(0);
|
|
6596
|
+
const loaded = React47.useMemo(
|
|
6603
6597
|
() => ({ firstItemIndex, count: items.length }),
|
|
6604
6598
|
[firstItemIndex, items.length]
|
|
6605
6599
|
);
|
|
6606
6600
|
const total = Math.max(totalCount == null ? 0 : totalCount, firstItemIndex + items.length);
|
|
6607
6601
|
const bandKey = firstItemIndex + ":" + items.length;
|
|
6608
|
-
const win =
|
|
6602
|
+
const win = React47.useMemo(
|
|
6609
6603
|
() => computeVirtualWindow({ scrollTop, viewportHeight: height, itemHeight, itemCount: total, loaded }),
|
|
6610
6604
|
[scrollTop, height, itemHeight, total, loaded]
|
|
6611
6605
|
);
|
|
6612
|
-
const need =
|
|
6606
|
+
const need = React47.useMemo(() => computeNeedMore(win, loaded), [win, loaded]);
|
|
6613
6607
|
const wantStart = need.start && hasMore?.start !== false;
|
|
6614
6608
|
const wantEnd = need.end && hasMore?.end !== false;
|
|
6615
6609
|
const bucket2 = Math.floor(win.visibleStart / VIRTUAL_LIST_BUFFER_ROWS);
|
|
6616
6610
|
const askKey = bandKey + "@" + bucket2;
|
|
6617
|
-
const asked =
|
|
6618
|
-
|
|
6611
|
+
const asked = React47.useRef({ start: null, end: null });
|
|
6612
|
+
React47.useEffect(() => {
|
|
6619
6613
|
if (loading || !wantStart || asked.current.start === askKey) return;
|
|
6620
6614
|
asked.current.start = askKey;
|
|
6621
6615
|
onNeedMore("start", win);
|
|
6622
6616
|
}, [wantStart, loading, askKey, onNeedMore, win]);
|
|
6623
|
-
|
|
6617
|
+
React47.useEffect(() => {
|
|
6624
6618
|
if (loading || !wantEnd || asked.current.end === askKey) return;
|
|
6625
6619
|
asked.current.end = askKey;
|
|
6626
6620
|
onNeedMore("end", win);
|
|
6627
6621
|
}, [wantEnd, loading, askKey, onNeedMore, win]);
|
|
6628
|
-
const lastKeysRef =
|
|
6629
|
-
const newKeys =
|
|
6622
|
+
const lastKeysRef = React47.useRef(null);
|
|
6623
|
+
const newKeys = React47.useMemo(() => {
|
|
6630
6624
|
const prev = lastKeysRef.current;
|
|
6631
6625
|
if (!prev) return /* @__PURE__ */ new Set();
|
|
6632
6626
|
const fresh = /* @__PURE__ */ new Set();
|
|
@@ -6636,7 +6630,7 @@ function VirtualList({
|
|
|
6636
6630
|
}
|
|
6637
6631
|
return fresh;
|
|
6638
6632
|
}, [items]);
|
|
6639
|
-
|
|
6633
|
+
React47.useEffect(() => {
|
|
6640
6634
|
lastKeysRef.current = new Set(items.map(keyOf));
|
|
6641
6635
|
}, [items]);
|
|
6642
6636
|
const gapStyle = { "--fd-vlist-gap": rowGap + "px" };
|
|
@@ -6681,7 +6675,7 @@ function VirtualList({
|
|
|
6681
6675
|
}
|
|
6682
6676
|
|
|
6683
6677
|
// src/components/data/EntityRow.tsx
|
|
6684
|
-
import * as
|
|
6678
|
+
import * as React48 from "react";
|
|
6685
6679
|
import { jsx as jsx69, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
6686
6680
|
var ENTITY_ROW_METRIC_WIDTH = 74;
|
|
6687
6681
|
var METRIC_TONE_COLOR = {
|
|
@@ -6694,7 +6688,7 @@ function EntityRowMetrics({ metrics, className = "", style }) {
|
|
|
6694
6688
|
const key = m.id || m.label || i;
|
|
6695
6689
|
const className2 = ["fd-erow-metric", m.tone && m.tone !== "default" ? "is-" + m.tone : "", m.tooltip != null ? "is-described" : ""].filter(Boolean).join(" ");
|
|
6696
6690
|
const tone = { color: METRIC_TONE_COLOR[m.tone || "default"] };
|
|
6697
|
-
const content = /* @__PURE__ */ jsxs57(
|
|
6691
|
+
const content = /* @__PURE__ */ jsxs57(React48.Fragment, { children: [
|
|
6698
6692
|
m.icon ? /* @__PURE__ */ jsx69("i", { className: "ph ph-" + m.icon, "aria-hidden": "true" }) : null,
|
|
6699
6693
|
/* @__PURE__ */ jsx69("span", { className: "fd-erow-metric-value fd-tabular", children: m.value }),
|
|
6700
6694
|
/* @__PURE__ */ jsx69("span", { className: "fd-sr", children: " " + m.label })
|
|
@@ -6786,7 +6780,7 @@ function EntityRow({
|
|
|
6786
6780
|
}
|
|
6787
6781
|
|
|
6788
6782
|
// src/components/data/TransferList.tsx
|
|
6789
|
-
import * as
|
|
6783
|
+
import * as React49 from "react";
|
|
6790
6784
|
import { createPortal as createPortal5 } from "react-dom";
|
|
6791
6785
|
|
|
6792
6786
|
// src/components/forms/Input.tsx
|
|
@@ -6892,12 +6886,12 @@ function TransferList({
|
|
|
6892
6886
|
listHeight = 440,
|
|
6893
6887
|
className = ""
|
|
6894
6888
|
}) {
|
|
6895
|
-
const [drag, setDrag] =
|
|
6896
|
-
const [dragOverSide, setDragOverSide] =
|
|
6897
|
-
const dragRef =
|
|
6898
|
-
const armedRef =
|
|
6899
|
-
const sideRefs =
|
|
6900
|
-
const hitTestSide =
|
|
6889
|
+
const [drag, setDrag] = React49.useState(null);
|
|
6890
|
+
const [dragOverSide, setDragOverSide] = React49.useState(null);
|
|
6891
|
+
const dragRef = React49.useRef(null);
|
|
6892
|
+
const armedRef = React49.useRef(null);
|
|
6893
|
+
const sideRefs = React49.useRef({ left: null, right: null });
|
|
6894
|
+
const hitTestSide = React49.useCallback((x, y) => {
|
|
6901
6895
|
for (const side of ["left", "right"]) {
|
|
6902
6896
|
const el = sideRefs.current[side];
|
|
6903
6897
|
if (!el) continue;
|
|
@@ -6906,7 +6900,7 @@ function TransferList({
|
|
|
6906
6900
|
}
|
|
6907
6901
|
return null;
|
|
6908
6902
|
}, []);
|
|
6909
|
-
const findItem =
|
|
6903
|
+
const findItem = React49.useCallback(
|
|
6910
6904
|
(side, key) => (side === "left" ? left.items : right.items).find((it) => keyOf(it) === key),
|
|
6911
6905
|
[left.items, right.items, keyOf]
|
|
6912
6906
|
);
|
|
@@ -6928,7 +6922,7 @@ function TransferList({
|
|
|
6928
6922
|
height: rect.height
|
|
6929
6923
|
};
|
|
6930
6924
|
};
|
|
6931
|
-
|
|
6925
|
+
React49.useEffect(() => {
|
|
6932
6926
|
const onMovePointer = (e) => {
|
|
6933
6927
|
const armed = armedRef.current;
|
|
6934
6928
|
if (!armed || e.pointerId !== armed.pointerId) return;
|
|
@@ -6981,7 +6975,7 @@ function TransferList({
|
|
|
6981
6975
|
window.removeEventListener("pointercancel", endDrag);
|
|
6982
6976
|
};
|
|
6983
6977
|
}, [hitTestSide, findItem, onMove]);
|
|
6984
|
-
|
|
6978
|
+
React49.useEffect(() => {
|
|
6985
6979
|
if (!drag || typeof document === "undefined") return;
|
|
6986
6980
|
const prev = document.body.style.userSelect;
|
|
6987
6981
|
document.body.style.userSelect = "none";
|
|
@@ -7098,7 +7092,7 @@ function FactList({ facts = [], className = "", ...rest }) {
|
|
|
7098
7092
|
}
|
|
7099
7093
|
|
|
7100
7094
|
// src/components/data/USChoropleth.tsx
|
|
7101
|
-
import * as
|
|
7095
|
+
import * as React51 from "react";
|
|
7102
7096
|
|
|
7103
7097
|
// src/components/data/usChoropleth/mapBox.ts
|
|
7104
7098
|
var MAP_WIDTH = 975;
|
|
@@ -7163,11 +7157,11 @@ function buildChoroplethModel(values, topN, givenTotal) {
|
|
|
7163
7157
|
}
|
|
7164
7158
|
|
|
7165
7159
|
// src/components/data/usChoropleth/useUsStateShapes.ts
|
|
7166
|
-
import * as
|
|
7160
|
+
import * as React50 from "react";
|
|
7167
7161
|
function useUsStateShapes() {
|
|
7168
|
-
const [token, setToken] =
|
|
7169
|
-
const [settled, setSettled] =
|
|
7170
|
-
|
|
7162
|
+
const [token, setToken] = React50.useState(0);
|
|
7163
|
+
const [settled, setSettled] = React50.useState(null);
|
|
7164
|
+
React50.useEffect(() => {
|
|
7171
7165
|
let current2 = true;
|
|
7172
7166
|
import("./usStateShapes-JJARDNLL.js").then(({ STATE_SHAPES }) => {
|
|
7173
7167
|
if (current2) setSettled({ token, state: { status: "ready", shapes: STATE_SHAPES } });
|
|
@@ -7209,7 +7203,7 @@ function nextCode(key, from) {
|
|
|
7209
7203
|
}
|
|
7210
7204
|
function StateMap({ shapes, model, figures, label, formatReadout }) {
|
|
7211
7205
|
const tip = useTooltip();
|
|
7212
|
-
const [stop, setStop] =
|
|
7206
|
+
const [stop, setStop] = React51.useState(US_STATE_CODES[0]);
|
|
7213
7207
|
const onKeyDown = (event) => {
|
|
7214
7208
|
const from = event.target.getAttribute("data-state");
|
|
7215
7209
|
const to = from && nextCode(event.key, from);
|
|
@@ -7257,8 +7251,8 @@ function StateTable({ model, valueLabel, formatValue }) {
|
|
|
7257
7251
|
return /* @__PURE__ */ jsx74(Collapsible, { title: TABLE_TITLE, children: /* @__PURE__ */ jsx74(DataTable, { columns, rows: model.rows, rowKey: "code", compact: true }) });
|
|
7258
7252
|
}
|
|
7259
7253
|
function USChoropleth({ values, label, valueLabel, formatValue, formatReadout, topN, total, className = "" }) {
|
|
7260
|
-
const model =
|
|
7261
|
-
const figures =
|
|
7254
|
+
const model = React51.useMemo(() => buildChoroplethModel(values, topN ?? 0, total), [values, topN, total]);
|
|
7255
|
+
const figures = React51.useMemo(() => new Map(model.rows.map((row) => [row.code, row])), [model]);
|
|
7262
7256
|
const { state, retry } = useUsStateShapes();
|
|
7263
7257
|
return /* @__PURE__ */ jsxs61("div", { className: ["fd-uschoro", className].filter(Boolean).join(" "), children: [
|
|
7264
7258
|
/* @__PURE__ */ jsxs61("div", { className: "fd-uschoro-layout", children: [
|
|
@@ -7293,13 +7287,13 @@ function USChoropleth({ values, label, valueLabel, formatValue, formatReadout, t
|
|
|
7293
7287
|
}
|
|
7294
7288
|
|
|
7295
7289
|
// src/components/data/ReferenceList.tsx
|
|
7296
|
-
import * as
|
|
7290
|
+
import * as React52 from "react";
|
|
7297
7291
|
import { jsx as jsx75, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
7298
7292
|
function textOf3(node) {
|
|
7299
7293
|
if (node == null || typeof node === "boolean") return "";
|
|
7300
7294
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
7301
7295
|
if (Array.isArray(node)) return node.map(textOf3).join(" ");
|
|
7302
|
-
if (
|
|
7296
|
+
if (React52.isValidElement(node)) return textOf3(node.props.children);
|
|
7303
7297
|
return "";
|
|
7304
7298
|
}
|
|
7305
7299
|
function matches(entry, needle) {
|
|
@@ -7318,9 +7312,9 @@ function Entries({ entries, mono }) {
|
|
|
7318
7312
|
function ReferenceList(props) {
|
|
7319
7313
|
const { mono = false, searchable = false, searchLabel = "Search", emptyMessage = "No matches", className = "", ...divProps } = props;
|
|
7320
7314
|
const { entries, sections, ...rest } = divProps;
|
|
7321
|
-
const [query, setQuery] =
|
|
7322
|
-
const [searchOpen, setSearchOpen] =
|
|
7323
|
-
const [uncontrolled, setUncontrolled] =
|
|
7315
|
+
const [query, setQuery] = React52.useState("");
|
|
7316
|
+
const [searchOpen, setSearchOpen] = React52.useState({});
|
|
7317
|
+
const [uncontrolled, setUncontrolled] = React52.useState({});
|
|
7324
7318
|
const needle = searchable ? query.trim().toLowerCase() : "";
|
|
7325
7319
|
const searching = needle !== "";
|
|
7326
7320
|
const onQuery = (value) => {
|
|
@@ -7372,11 +7366,11 @@ function ReferenceList(props) {
|
|
|
7372
7366
|
}
|
|
7373
7367
|
|
|
7374
7368
|
// src/components/forms/Checkbox.tsx
|
|
7375
|
-
import * as
|
|
7369
|
+
import * as React53 from "react";
|
|
7376
7370
|
import { jsx as jsx76, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
7377
7371
|
function Checkbox({ label, description, card = false, indeterminate = false, className = "", ...rest }) {
|
|
7378
|
-
const ref =
|
|
7379
|
-
|
|
7372
|
+
const ref = React53.useRef(null);
|
|
7373
|
+
React53.useEffect(() => {
|
|
7380
7374
|
if (ref.current) ref.current.indeterminate = indeterminate;
|
|
7381
7375
|
}, [indeterminate]);
|
|
7382
7376
|
return /* @__PURE__ */ jsxs63("label", { className: ["fd-choice", card ? "fd-choice-card" : "", className].filter(Boolean).join(" "), children: [
|
|
@@ -7423,7 +7417,7 @@ function Switch({ label, description, className = "", ...rest }) {
|
|
|
7423
7417
|
}
|
|
7424
7418
|
|
|
7425
7419
|
// src/components/forms/Select.tsx
|
|
7426
|
-
import * as
|
|
7420
|
+
import * as React54 from "react";
|
|
7427
7421
|
import { jsx as jsx79, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
7428
7422
|
var norm = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
7429
7423
|
function Select({
|
|
@@ -7451,12 +7445,12 @@ function Select({
|
|
|
7451
7445
|
const isOn = (v) => multiple ? vals.includes(v) : v === value;
|
|
7452
7446
|
const hasSearch = searchable === void 0 ? opts.length > 8 : searchable;
|
|
7453
7447
|
const { fieldId, labelId, ariaLabelledBy } = useTriggerLabelling(label, id, hiddenLabel);
|
|
7454
|
-
const [open2, setOpen] =
|
|
7455
|
-
const [q, setQ] =
|
|
7456
|
-
const rootRef =
|
|
7457
|
-
const boxRef =
|
|
7458
|
-
const listRef =
|
|
7459
|
-
const typeBuf =
|
|
7448
|
+
const [open2, setOpen] = React54.useState(false);
|
|
7449
|
+
const [q, setQ] = React54.useState("");
|
|
7450
|
+
const rootRef = React54.useRef(null);
|
|
7451
|
+
const boxRef = React54.useRef(null);
|
|
7452
|
+
const listRef = React54.useRef(null);
|
|
7453
|
+
const typeBuf = React54.useRef({ s: "", t: 0 });
|
|
7460
7454
|
const selected = multiple ? null : opts.find((o) => o.value === value);
|
|
7461
7455
|
const chosen = multiple ? opts.filter((o) => vals.includes(o.value)) : [];
|
|
7462
7456
|
const boxText = multiple ? chosen.length === 0 ? placeholder : chosen.length === 1 ? chosen[0].label : summary ? summary(chosen.map((o) => o.value)) : chosen.length + " selected" : selected ? selected.label : placeholder;
|
|
@@ -7592,7 +7586,7 @@ function Select({
|
|
|
7592
7586
|
),
|
|
7593
7587
|
q ? /* @__PURE__ */ jsx79("span", { className: "fd-body-sm fd-muted", children: visible.length }) : null
|
|
7594
7588
|
] }) : void 0,
|
|
7595
|
-
footer: multiple ? /* @__PURE__ */ jsxs66(
|
|
7589
|
+
footer: multiple ? /* @__PURE__ */ jsxs66(React54.Fragment, { children: [
|
|
7596
7590
|
/* @__PURE__ */ jsx79(
|
|
7597
7591
|
"button",
|
|
7598
7592
|
{
|
|
@@ -7623,7 +7617,7 @@ function Select({
|
|
|
7623
7617
|
'Nothing matches "',
|
|
7624
7618
|
q,
|
|
7625
7619
|
'".'
|
|
7626
|
-
] }) : groups.map((grp) => /* @__PURE__ */ jsxs66(
|
|
7620
|
+
] }) : groups.map((grp) => /* @__PURE__ */ jsxs66(React54.Fragment, { children: [
|
|
7627
7621
|
grp.g ? /* @__PURE__ */ jsx79("div", { className: "fd-pop-group", children: grp.g }) : null,
|
|
7628
7622
|
grp.items.map(({ o, i }) => /* @__PURE__ */ jsxs66(
|
|
7629
7623
|
"button",
|
|
@@ -7660,7 +7654,7 @@ function Select({
|
|
|
7660
7654
|
}
|
|
7661
7655
|
|
|
7662
7656
|
// src/components/forms/TimePicker.tsx
|
|
7663
|
-
import * as
|
|
7657
|
+
import * as React55 from "react";
|
|
7664
7658
|
import { jsx as jsx80, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
7665
7659
|
var pad = (n) => String(n).padStart(2, "0");
|
|
7666
7660
|
function ClockFace({ value = "09:00", onChange }) {
|
|
@@ -7669,9 +7663,9 @@ function ClockFace({ value = "09:00", onChange }) {
|
|
|
7669
7663
|
if (isNaN(m)) m = 0;
|
|
7670
7664
|
const pm = h24 >= 12;
|
|
7671
7665
|
const h12 = h24 % 12 === 0 ? 12 : h24 % 12;
|
|
7672
|
-
const [mode2, setMode] =
|
|
7673
|
-
const faceRef =
|
|
7674
|
-
const dragging =
|
|
7666
|
+
const [mode2, setMode] = React55.useState("h");
|
|
7667
|
+
const faceRef = React55.useRef(null);
|
|
7668
|
+
const dragging = React55.useRef(false);
|
|
7675
7669
|
const set = (h, mm, isPm) => onChange((isPm ? h % 12 + 12 : h % 12) + ":" + pad(mm));
|
|
7676
7670
|
const R = 108, NR = 80;
|
|
7677
7671
|
const nums = mode2 === "h" ? Array.from({ length: 12 }, (_, i) => i + 1) : Array.from({ length: 12 }, (_, i) => i * 5);
|
|
@@ -7744,9 +7738,9 @@ function ClockFace({ value = "09:00", onChange }) {
|
|
|
7744
7738
|
}
|
|
7745
7739
|
function TimePicker({ label, help, error, required = false, disabled = false, value = "", onChange, placeholder = "Pick a time", id, className = "", style }) {
|
|
7746
7740
|
const { fieldId, labelId, ariaLabelledBy } = useTriggerLabelling(label, id);
|
|
7747
|
-
const [open2, setOpen] =
|
|
7748
|
-
const rootRef =
|
|
7749
|
-
const boxRef =
|
|
7741
|
+
const [open2, setOpen] = React55.useState(false);
|
|
7742
|
+
const rootRef = React55.useRef(null);
|
|
7743
|
+
const boxRef = React55.useRef(null);
|
|
7750
7744
|
const disp = () => {
|
|
7751
7745
|
if (!value) return "";
|
|
7752
7746
|
const [h, m] = value.split(":").map(Number);
|
|
@@ -7789,7 +7783,7 @@ function TimePicker({ label, help, error, required = false, disabled = false, va
|
|
|
7789
7783
|
offset: 6,
|
|
7790
7784
|
width: 262,
|
|
7791
7785
|
role: "presentation",
|
|
7792
|
-
footer: /* @__PURE__ */ jsxs67(
|
|
7786
|
+
footer: /* @__PURE__ */ jsxs67(React55.Fragment, { children: [
|
|
7793
7787
|
/* @__PURE__ */ jsx80(
|
|
7794
7788
|
"button",
|
|
7795
7789
|
{
|
|
@@ -7817,7 +7811,7 @@ function TimePicker({ label, help, error, required = false, disabled = false, va
|
|
|
7817
7811
|
}
|
|
7818
7812
|
|
|
7819
7813
|
// src/components/forms/Slider.tsx
|
|
7820
|
-
import * as
|
|
7814
|
+
import * as React56 from "react";
|
|
7821
7815
|
import { jsx as jsx81, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
7822
7816
|
function Slider({
|
|
7823
7817
|
label,
|
|
@@ -7835,7 +7829,7 @@ function Slider({
|
|
|
7835
7829
|
...rest
|
|
7836
7830
|
}) {
|
|
7837
7831
|
const fieldId = useFieldId(id);
|
|
7838
|
-
const [dragging, setDragging] =
|
|
7832
|
+
const [dragging, setDragging] = React56.useState(false);
|
|
7839
7833
|
const v = value === void 0 ? min : Number(value);
|
|
7840
7834
|
const pct = max === min ? 0 : (v - min) / (max - min) * 100;
|
|
7841
7835
|
return /* @__PURE__ */ jsxs68("div", { className: ["fd-field", className].filter(Boolean).join(" "), children: [
|
|
@@ -7869,7 +7863,7 @@ function Slider({
|
|
|
7869
7863
|
}
|
|
7870
7864
|
|
|
7871
7865
|
// src/components/forms/RangeSlider.tsx
|
|
7872
|
-
import * as
|
|
7866
|
+
import * as React57 from "react";
|
|
7873
7867
|
import { jsx as jsx82, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
7874
7868
|
function RangeSlider({
|
|
7875
7869
|
label,
|
|
@@ -7889,9 +7883,9 @@ function RangeSlider({
|
|
|
7889
7883
|
}) {
|
|
7890
7884
|
const fmt2 = format || ((v) => String(v));
|
|
7891
7885
|
const [a, b] = value || [min, max];
|
|
7892
|
-
const [drag, setDrag] =
|
|
7893
|
-
const [focus, setFocus] =
|
|
7894
|
-
const railRef =
|
|
7886
|
+
const [drag, setDrag] = React57.useState(null);
|
|
7887
|
+
const [focus, setFocus] = React57.useState(null);
|
|
7888
|
+
const railRef = React57.useRef(null);
|
|
7895
7889
|
const pct = (v) => max === min ? 0 : (v - min) / (max - min) * 100;
|
|
7896
7890
|
const clampPair = (i, v) => {
|
|
7897
7891
|
v = Math.min(max, Math.max(min, Math.round(v / step) * step));
|
|
@@ -7906,7 +7900,7 @@ function RangeSlider({
|
|
|
7906
7900
|
const r = railRef.current.getBoundingClientRect();
|
|
7907
7901
|
return min + Math.min(1, Math.max(0, (e.clientX - r.left) / r.width)) * (max - min);
|
|
7908
7902
|
};
|
|
7909
|
-
|
|
7903
|
+
React57.useEffect(() => {
|
|
7910
7904
|
if (drag === null) return;
|
|
7911
7905
|
const mv = (e) => onChange && onChange(clampPair(drag, fromEvent(e)));
|
|
7912
7906
|
const upH = () => setDrag(null);
|
|
@@ -7987,7 +7981,7 @@ function RangeSlider({
|
|
|
7987
7981
|
/* @__PURE__ */ jsxs69("div", { className: "fd-range" + (hasLabels ? " has-labels" : ""), onPointerDown: onRailDown, children: [
|
|
7988
7982
|
/* @__PURE__ */ jsx82("span", { className: "fd-range-rail", ref: railRef }),
|
|
7989
7983
|
/* @__PURE__ */ jsx82("span", { className: "fd-range-fill", style: { left: pct(a) + "%", width: pct(b) - pct(a) + "%" } }),
|
|
7990
|
-
marks.map((m) => /* @__PURE__ */ jsxs69(
|
|
7984
|
+
marks.map((m) => /* @__PURE__ */ jsxs69(React57.Fragment, { children: [
|
|
7991
7985
|
/* @__PURE__ */ jsx82("span", { className: "fd-range-mark" + (m.value >= a && m.value <= b ? " is-in" : ""), style: { left: pct(m.value) + "%" } }),
|
|
7992
7986
|
m.label ? /* @__PURE__ */ jsx82("span", { className: "fd-range-mark-label", style: { left: pct(m.value) + "%" }, children: m.label }) : null
|
|
7993
7987
|
] }, m.value)),
|
|
@@ -8016,7 +8010,7 @@ function RangeSlider({
|
|
|
8016
8010
|
}
|
|
8017
8011
|
|
|
8018
8012
|
// src/components/forms/Dropzone.tsx
|
|
8019
|
-
import * as
|
|
8013
|
+
import * as React58 from "react";
|
|
8020
8014
|
import { jsx as jsx83, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
8021
8015
|
function Dropzone({
|
|
8022
8016
|
onFiles,
|
|
@@ -8031,8 +8025,8 @@ function Dropzone({
|
|
|
8031
8025
|
className = "",
|
|
8032
8026
|
style
|
|
8033
8027
|
}) {
|
|
8034
|
-
const [over, setOver] =
|
|
8035
|
-
const depth =
|
|
8028
|
+
const [over, setOver] = React58.useState(false);
|
|
8029
|
+
const depth = React58.useRef(0);
|
|
8036
8030
|
const has = (e) => {
|
|
8037
8031
|
const dt = e.dataTransfer;
|
|
8038
8032
|
if (!dt) return false;
|
|
@@ -8096,8 +8090,8 @@ function FilePickButton({
|
|
|
8096
8090
|
className = "",
|
|
8097
8091
|
children
|
|
8098
8092
|
}) {
|
|
8099
|
-
const ref =
|
|
8100
|
-
return /* @__PURE__ */ jsxs70(
|
|
8093
|
+
const ref = React58.useRef(null);
|
|
8094
|
+
return /* @__PURE__ */ jsxs70(React58.Fragment, { children: [
|
|
8101
8095
|
/* @__PURE__ */ jsx83(
|
|
8102
8096
|
"button",
|
|
8103
8097
|
{
|
|
@@ -8134,10 +8128,10 @@ function FilePickButton({
|
|
|
8134
8128
|
}
|
|
8135
8129
|
function useStagedFiles(upload, opts) {
|
|
8136
8130
|
const o = opts || {};
|
|
8137
|
-
const [items, setItems] =
|
|
8138
|
-
const controllers =
|
|
8131
|
+
const [items, setItems] = React58.useState([]);
|
|
8132
|
+
const controllers = React58.useRef({});
|
|
8139
8133
|
const patch = (id, next) => setItems((list) => list.map((f) => f.id === id ? Object.assign({}, f, next) : f));
|
|
8140
|
-
const run =
|
|
8134
|
+
const run = React58.useCallback((att) => {
|
|
8141
8135
|
if (!upload) return;
|
|
8142
8136
|
const ac = typeof AbortController !== "undefined" ? new AbortController() : null;
|
|
8143
8137
|
controllers.current[att.id] = ac;
|
|
@@ -8154,14 +8148,14 @@ function useStagedFiles(upload, opts) {
|
|
|
8154
8148
|
delete controllers.current[att.id];
|
|
8155
8149
|
});
|
|
8156
8150
|
}, [upload]);
|
|
8157
|
-
const add =
|
|
8151
|
+
const add = React58.useCallback((files) => {
|
|
8158
8152
|
if (!upload) return [];
|
|
8159
8153
|
const atts = Array.from(files).map((f) => toAttachment(f));
|
|
8160
8154
|
setItems((list) => list.concat(atts));
|
|
8161
8155
|
atts.forEach(run);
|
|
8162
8156
|
return atts;
|
|
8163
8157
|
}, [upload, run]);
|
|
8164
|
-
const remove =
|
|
8158
|
+
const remove = React58.useCallback((att) => {
|
|
8165
8159
|
const ac = controllers.current[att.id];
|
|
8166
8160
|
if (ac) {
|
|
8167
8161
|
try {
|
|
@@ -8172,10 +8166,10 @@ function useStagedFiles(upload, opts) {
|
|
|
8172
8166
|
}
|
|
8173
8167
|
setItems((list) => list.filter((f) => f.id !== att.id));
|
|
8174
8168
|
}, []);
|
|
8175
|
-
const retry =
|
|
8169
|
+
const retry = React58.useCallback((att) => {
|
|
8176
8170
|
run(att);
|
|
8177
8171
|
}, [run]);
|
|
8178
|
-
const clear =
|
|
8172
|
+
const clear = React58.useCallback(() => {
|
|
8179
8173
|
Object.values(controllers.current).forEach((ac) => {
|
|
8180
8174
|
try {
|
|
8181
8175
|
ac && ac.abort();
|
|
@@ -8302,7 +8296,7 @@ function FileGrid({ files = [], onOpen, onRemove, onRetry, tiles = true, maxHeig
|
|
|
8302
8296
|
import { MarkdownEditor, MarkdownImageUploadProvider, InlineMarkdownEdit, findUnstoredImages } from "@flytedan/markdown-editor";
|
|
8303
8297
|
|
|
8304
8298
|
// src/components/forms/CodeEditor.tsx
|
|
8305
|
-
import * as
|
|
8299
|
+
import * as React59 from "react";
|
|
8306
8300
|
import { EditorView, keymap, lineNumbers, placeholder as cmPlaceholder, drawSelection, Decoration } from "@codemirror/view";
|
|
8307
8301
|
import { EditorState as EditorState2, StateEffect, StateField, Compartment } from "@codemirror/state";
|
|
8308
8302
|
import { defaultKeymap, history, historyKeymap, indentMore, indentLess } from "@codemirror/commands";
|
|
@@ -8454,7 +8448,7 @@ function CodeEditor({
|
|
|
8454
8448
|
autoFocus = false
|
|
8455
8449
|
}) {
|
|
8456
8450
|
const fieldId = useFieldId(id);
|
|
8457
|
-
const diagnostics =
|
|
8451
|
+
const diagnostics = React59.useMemo(
|
|
8458
8452
|
() => [
|
|
8459
8453
|
...passedDiagnostics ?? [],
|
|
8460
8454
|
...language === "json" ? jsonModeDiagnostics(value, validate) : []
|
|
@@ -8463,18 +8457,18 @@ function CodeEditor({
|
|
|
8463
8457
|
);
|
|
8464
8458
|
const descId = fieldId + "-desc";
|
|
8465
8459
|
const liveId = fieldId + "-live";
|
|
8466
|
-
const hostRef =
|
|
8467
|
-
const viewRef =
|
|
8468
|
-
const valueRef =
|
|
8469
|
-
const onChangeRef =
|
|
8460
|
+
const hostRef = React59.useRef(null);
|
|
8461
|
+
const viewRef = React59.useRef(null);
|
|
8462
|
+
const valueRef = React59.useRef(value);
|
|
8463
|
+
const onChangeRef = React59.useRef(onChange);
|
|
8470
8464
|
onChangeRef.current = onChange;
|
|
8471
|
-
const editableCompartment =
|
|
8472
|
-
const languageCompartment =
|
|
8473
|
-
const readOnlyCompartment =
|
|
8474
|
-
const attributesCompartment =
|
|
8475
|
-
const errorRef =
|
|
8465
|
+
const editableCompartment = React59.useRef(new Compartment()).current;
|
|
8466
|
+
const languageCompartment = React59.useRef(new Compartment()).current;
|
|
8467
|
+
const readOnlyCompartment = React59.useRef(new Compartment()).current;
|
|
8468
|
+
const attributesCompartment = React59.useRef(new Compartment()).current;
|
|
8469
|
+
const errorRef = React59.useRef(error);
|
|
8476
8470
|
errorRef.current = error;
|
|
8477
|
-
const diagnosticsCountRef =
|
|
8471
|
+
const diagnosticsCountRef = React59.useRef(diagnostics.length);
|
|
8478
8472
|
diagnosticsCountRef.current = diagnostics.length;
|
|
8479
8473
|
function contentAttributes() {
|
|
8480
8474
|
return {
|
|
@@ -8484,7 +8478,7 @@ function CodeEditor({
|
|
|
8484
8478
|
...label ? { "aria-label": label } : {}
|
|
8485
8479
|
};
|
|
8486
8480
|
}
|
|
8487
|
-
|
|
8481
|
+
React59.useEffect(() => {
|
|
8488
8482
|
const host2 = hostRef.current;
|
|
8489
8483
|
if (!host2) return;
|
|
8490
8484
|
const updateListener = EditorView.updateListener.of((update) => {
|
|
@@ -8526,7 +8520,7 @@ function CodeEditor({
|
|
|
8526
8520
|
viewRef.current = null;
|
|
8527
8521
|
};
|
|
8528
8522
|
}, []);
|
|
8529
|
-
|
|
8523
|
+
React59.useEffect(() => {
|
|
8530
8524
|
const view = viewRef.current;
|
|
8531
8525
|
if (!view) return;
|
|
8532
8526
|
const current2 = view.state.doc.toString();
|
|
@@ -8535,22 +8529,22 @@ function CodeEditor({
|
|
|
8535
8529
|
}
|
|
8536
8530
|
valueRef.current = value;
|
|
8537
8531
|
}, [value]);
|
|
8538
|
-
|
|
8532
|
+
React59.useEffect(() => {
|
|
8539
8533
|
const view = viewRef.current;
|
|
8540
8534
|
if (!view) return;
|
|
8541
8535
|
view.dispatch({ effects: editableCompartment.reconfigure(EditorView.editable.of(!disabled)) });
|
|
8542
8536
|
}, [disabled, editableCompartment]);
|
|
8543
|
-
|
|
8537
|
+
React59.useEffect(() => {
|
|
8544
8538
|
const view = viewRef.current;
|
|
8545
8539
|
if (!view) return;
|
|
8546
8540
|
view.dispatch({ effects: languageCompartment.reconfigure(language === "json" ? jsonLang() : sqlLang()) });
|
|
8547
8541
|
}, [language, languageCompartment]);
|
|
8548
|
-
|
|
8542
|
+
React59.useEffect(() => {
|
|
8549
8543
|
const view = viewRef.current;
|
|
8550
8544
|
if (!view) return;
|
|
8551
8545
|
view.dispatch({ effects: readOnlyCompartment.reconfigure(EditorState2.readOnly.of(readOnly)) });
|
|
8552
8546
|
}, [readOnly, readOnlyCompartment]);
|
|
8553
|
-
|
|
8547
|
+
React59.useEffect(() => {
|
|
8554
8548
|
const view = viewRef.current;
|
|
8555
8549
|
if (!view) return;
|
|
8556
8550
|
view.dispatch({
|
|
@@ -8677,11 +8671,11 @@ function jsonPathPosition(text, path, anchor = "value") {
|
|
|
8677
8671
|
}
|
|
8678
8672
|
|
|
8679
8673
|
// src/components/forms/RadioGroup.tsx
|
|
8680
|
-
import * as
|
|
8674
|
+
import * as React60 from "react";
|
|
8681
8675
|
import { jsx as jsx86, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
8682
8676
|
function RadioGroup({ label, labelledBy, options, value, onChange, card = false, disabled = false, name, className = "" }) {
|
|
8683
|
-
const autoName =
|
|
8684
|
-
const labelId =
|
|
8677
|
+
const autoName = React60.useId();
|
|
8678
|
+
const labelId = React60.useId();
|
|
8685
8679
|
return /* @__PURE__ */ jsxs73("div", { role: "radiogroup", "aria-labelledby": labelledBy ?? labelId, "aria-disabled": disabled || void 0, className: ["fd-radiogroup", className].filter(Boolean).join(" "), children: [
|
|
8686
8680
|
labelledBy === void 0 && /* @__PURE__ */ jsx86("span", { id: labelId, className: "fd-radiogroup-label", children: label }),
|
|
8687
8681
|
options.map((o) => /* @__PURE__ */ jsx86(
|
|
@@ -8709,16 +8703,16 @@ function Fieldset({ busy = false, className = "", ...rest }) {
|
|
|
8709
8703
|
}
|
|
8710
8704
|
|
|
8711
8705
|
// src/components/platform/AccountMenu.tsx
|
|
8712
|
-
import * as
|
|
8706
|
+
import * as React62 from "react";
|
|
8713
8707
|
|
|
8714
8708
|
// src/kits/sessionContext.tsx
|
|
8715
|
-
import * as
|
|
8716
|
-
var SessionContext =
|
|
8709
|
+
import * as React61 from "react";
|
|
8710
|
+
var SessionContext = React61.createContext(null);
|
|
8717
8711
|
function SessionProvider({ value, children }) {
|
|
8718
|
-
return
|
|
8712
|
+
return React61.createElement(SessionContext.Provider, { value }, children);
|
|
8719
8713
|
}
|
|
8720
8714
|
function useSessionContext() {
|
|
8721
|
-
const ctx =
|
|
8715
|
+
const ctx = React61.useContext(SessionContext);
|
|
8722
8716
|
if (!ctx) {
|
|
8723
8717
|
throw new Error(
|
|
8724
8718
|
"useSessionContext() was called outside a <SessionProvider>. Wrap your app root in <SessionProvider value={...}> with your real session, or \u2014 in the docs site or a demo \u2014 in <DemoSessionProvider>, before rendering AccountMenu, Gate, ProfilePage or AppSwitcher."
|
|
@@ -8758,11 +8752,11 @@ function AccountMenu({
|
|
|
8758
8752
|
...rest
|
|
8759
8753
|
}) {
|
|
8760
8754
|
const { user, roles, can: can2, signOut: ctxSignOut, demo, pending } = useSessionContext();
|
|
8761
|
-
const [open2, setOpen] =
|
|
8762
|
-
const [switching, setSwitching] =
|
|
8763
|
-
const [signingOut, setSigningOut] =
|
|
8764
|
-
const [signOutError, setSignOutError] =
|
|
8765
|
-
const ref =
|
|
8755
|
+
const [open2, setOpen] = React62.useState(false);
|
|
8756
|
+
const [switching, setSwitching] = React62.useState(false);
|
|
8757
|
+
const [signingOut, setSigningOut] = React62.useState(false);
|
|
8758
|
+
const [signOutError, setSignOutError] = React62.useState(null);
|
|
8759
|
+
const ref = React62.useRef(null);
|
|
8766
8760
|
const visibleLinks = links.filter((l) => !l.perm || !pending && can2(l.perm));
|
|
8767
8761
|
const visibleGroups = groups.map((g) => ({ label: g.label, links: g.links.filter((l) => !l.perm || !pending && can2(l.perm)) })).filter((g) => g.links.length);
|
|
8768
8762
|
const closeMenu = () => {
|
|
@@ -8887,13 +8881,13 @@ function AccountMenu({
|
|
|
8887
8881
|
}
|
|
8888
8882
|
|
|
8889
8883
|
// src/components/platform/AppSwitcher.tsx
|
|
8890
|
-
import * as
|
|
8884
|
+
import * as React63 from "react";
|
|
8891
8885
|
import { jsx as jsx89, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
8892
8886
|
function AppSwitcher({ apps: appsProp, onNavigate, className = "" }) {
|
|
8893
8887
|
const { apps: contextApps } = useSessionContext();
|
|
8894
8888
|
const apps = appsProp ?? contextApps ?? [];
|
|
8895
|
-
const [open2, setOpen] =
|
|
8896
|
-
const anchorRef =
|
|
8889
|
+
const [open2, setOpen] = React63.useState(false);
|
|
8890
|
+
const anchorRef = React63.useRef(null);
|
|
8897
8891
|
if (!apps.length) return null;
|
|
8898
8892
|
const items = apps.map((app) => ({
|
|
8899
8893
|
id: app.key,
|
|
@@ -8907,7 +8901,7 @@ function AppSwitcher({ apps: appsProp, onNavigate, className = "" }) {
|
|
|
8907
8901
|
window.location.href = app.url;
|
|
8908
8902
|
}
|
|
8909
8903
|
}));
|
|
8910
|
-
return /* @__PURE__ */ jsxs75(
|
|
8904
|
+
return /* @__PURE__ */ jsxs75(React63.Fragment, { children: [
|
|
8911
8905
|
/* @__PURE__ */ jsx89("span", { ref: anchorRef, className: ["fd-appswitch-anchor", className].filter(Boolean).join(" "), style: { display: "inline-flex" }, children: /* @__PURE__ */ jsx89(
|
|
8912
8906
|
IconButton,
|
|
8913
8907
|
{
|
|
@@ -8936,10 +8930,10 @@ function AppSwitcher({ apps: appsProp, onNavigate, className = "" }) {
|
|
|
8936
8930
|
}
|
|
8937
8931
|
|
|
8938
8932
|
// src/components/platform/AppearanceMenu.tsx
|
|
8939
|
-
import * as
|
|
8933
|
+
import * as React66 from "react";
|
|
8940
8934
|
|
|
8941
8935
|
// src/kits/appearance.ts
|
|
8942
|
-
import * as
|
|
8936
|
+
import * as React64 from "react";
|
|
8943
8937
|
var DEFAULT_STORAGE_KEY = "fd-appearance";
|
|
8944
8938
|
var DEFAULT_PREFS = {
|
|
8945
8939
|
theme: "system",
|
|
@@ -9051,8 +9045,8 @@ function watchAppearance(store, root = document.documentElement) {
|
|
|
9051
9045
|
};
|
|
9052
9046
|
}
|
|
9053
9047
|
function useAppearancePrefs(store) {
|
|
9054
|
-
const prefs =
|
|
9055
|
-
const update =
|
|
9048
|
+
const prefs = React64.useSyncExternalStore(store.subscribe, store.getSnapshot);
|
|
9049
|
+
const update = React64.useCallback(
|
|
9056
9050
|
(patch) => {
|
|
9057
9051
|
store.write({ ...store.getSnapshot(), ...patch });
|
|
9058
9052
|
},
|
|
@@ -9062,15 +9056,15 @@ function useAppearancePrefs(store) {
|
|
|
9062
9056
|
}
|
|
9063
9057
|
|
|
9064
9058
|
// src/components/platform/AppearanceProvider.tsx
|
|
9065
|
-
import * as
|
|
9059
|
+
import * as React65 from "react";
|
|
9066
9060
|
import { jsx as jsx90 } from "react/jsx-runtime";
|
|
9067
|
-
var AppearanceStoreContext =
|
|
9061
|
+
var AppearanceStoreContext = React65.createContext(null);
|
|
9068
9062
|
function AppearanceProvider({ store, children }) {
|
|
9069
|
-
|
|
9063
|
+
React65.useLayoutEffect(() => watchAppearance(store), [store]);
|
|
9070
9064
|
return /* @__PURE__ */ jsx90(AppearanceStoreContext.Provider, { value: store, children });
|
|
9071
9065
|
}
|
|
9072
9066
|
function useAppearanceStore() {
|
|
9073
|
-
const store =
|
|
9067
|
+
const store = React65.useContext(AppearanceStoreContext);
|
|
9074
9068
|
if (!store) throw new Error("AppearanceMenu and useAppearanceStore must be rendered inside an <AppearanceProvider>.");
|
|
9075
9069
|
return store;
|
|
9076
9070
|
}
|
|
@@ -9090,10 +9084,10 @@ var TEXT_SCALE_OPTIONS = [
|
|
|
9090
9084
|
];
|
|
9091
9085
|
function AppearanceMenu({ className = "" }) {
|
|
9092
9086
|
const [prefs, update] = useAppearancePrefs(useAppearanceStore());
|
|
9093
|
-
const [open2, setOpen] =
|
|
9094
|
-
const anchorRef =
|
|
9087
|
+
const [open2, setOpen] = React66.useState(false);
|
|
9088
|
+
const anchorRef = React66.useRef(null);
|
|
9095
9089
|
const patch = (p) => update(p);
|
|
9096
|
-
return /* @__PURE__ */ jsxs76(
|
|
9090
|
+
return /* @__PURE__ */ jsxs76(React66.Fragment, { children: [
|
|
9097
9091
|
/* @__PURE__ */ jsx91("span", { ref: anchorRef, className: ["fd-appearance-anchor", className].filter(Boolean).join(" "), style: { display: "inline-flex" }, children: /* @__PURE__ */ jsx91(
|
|
9098
9092
|
IconButton,
|
|
9099
9093
|
{
|
|
@@ -9162,14 +9156,14 @@ function AppearanceMenu({ className = "" }) {
|
|
|
9162
9156
|
}
|
|
9163
9157
|
|
|
9164
9158
|
// src/components/platform/ApiSpecBrowser.tsx
|
|
9165
|
-
import * as
|
|
9159
|
+
import * as React67 from "react";
|
|
9166
9160
|
import { jsx as jsx92, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
9167
9161
|
var METHOD_TONE = { GET: "success", POST: "info", PATCH: "warning", PUT: "warning", DELETE: "danger" };
|
|
9168
9162
|
function Json({ obj }) {
|
|
9169
9163
|
return /* @__PURE__ */ jsx92("pre", { className: "fd-json", children: JSON.stringify(obj, null, 2) });
|
|
9170
9164
|
}
|
|
9171
9165
|
function Endpoint({ s, onRequest }) {
|
|
9172
|
-
const [tried, setTried] =
|
|
9166
|
+
const [tried, setTried] = React67.useState(null);
|
|
9173
9167
|
const run = async () => {
|
|
9174
9168
|
setTried("busy");
|
|
9175
9169
|
const t0 = (window.performance || Date).now();
|
|
@@ -9242,10 +9236,10 @@ function ApiSpecBrowser({
|
|
|
9242
9236
|
className = "",
|
|
9243
9237
|
...rest
|
|
9244
9238
|
}) {
|
|
9245
|
-
const [q, setQ] =
|
|
9246
|
-
const [method, setMethod] =
|
|
9247
|
-
const [mod, setMod] =
|
|
9248
|
-
const [listOnly, setListOnly] =
|
|
9239
|
+
const [q, setQ] = React67.useState("");
|
|
9240
|
+
const [method, setMethod] = React67.useState(null);
|
|
9241
|
+
const [mod, setMod] = React67.useState(null);
|
|
9242
|
+
const [listOnly, setListOnly] = React67.useState(false);
|
|
9249
9243
|
const activeModule = modules && modules.find((m) => m.id === mod);
|
|
9250
9244
|
const hits = spec.filter((s) => (!method || s.method === method) && (!listOnly || s.isList) && (!activeModule || activeModule.endpoints.indexOf(s.id) >= 0) && (!q || (s.path + " " + s.title + " " + s.purpose + " " + (s.usedBy || []).join(" ")).toLowerCase().includes(q.toLowerCase())));
|
|
9251
9245
|
const effGroups = groups && groups.length ? groups : [["All endpoints", spec.map((s) => s.id)]];
|
|
@@ -9324,7 +9318,7 @@ function ApiSpecBrowser({
|
|
|
9324
9318
|
}
|
|
9325
9319
|
|
|
9326
9320
|
// src/components/platform/ProfilePage.tsx
|
|
9327
|
-
import * as
|
|
9321
|
+
import * as React68 from "react";
|
|
9328
9322
|
import { jsx as jsx93, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
9329
9323
|
function fieldInitialValue(field, user) {
|
|
9330
9324
|
if (field.value) return field.value(user);
|
|
@@ -9360,21 +9354,21 @@ function ProfilePage({
|
|
|
9360
9354
|
}) {
|
|
9361
9355
|
const { user: sessionUser, roles, permissions, saveProfile: saveProfile2 } = useSessionContext();
|
|
9362
9356
|
const user = userProp || sessionUser;
|
|
9363
|
-
const initialFieldValues =
|
|
9357
|
+
const initialFieldValues = React68.useMemo(() => {
|
|
9364
9358
|
const values2 = {};
|
|
9365
9359
|
for (const field of fields) values2[field.key] = fieldInitialValue(field, user);
|
|
9366
9360
|
return values2;
|
|
9367
9361
|
}, [user.id, fields]);
|
|
9368
|
-
const initialNotify =
|
|
9362
|
+
const initialNotify = React68.useMemo(() => {
|
|
9369
9363
|
const values2 = {};
|
|
9370
9364
|
for (const n of notifications) values2[n.key] = !!user.notify?.[n.key];
|
|
9371
9365
|
return values2;
|
|
9372
9366
|
}, [user.id, notifications]);
|
|
9373
|
-
const [values, setValues] =
|
|
9374
|
-
const [notify, setNotify] =
|
|
9375
|
-
const [saving, setSaving] =
|
|
9376
|
-
const [saved, setSaved] =
|
|
9377
|
-
const [prevUserId, setPrevUserId] =
|
|
9367
|
+
const [values, setValues] = React68.useState(initialFieldValues);
|
|
9368
|
+
const [notify, setNotify] = React68.useState(initialNotify);
|
|
9369
|
+
const [saving, setSaving] = React68.useState(false);
|
|
9370
|
+
const [saved, setSaved] = React68.useState(false);
|
|
9371
|
+
const [prevUserId, setPrevUserId] = React68.useState(user.id);
|
|
9378
9372
|
if (user.id !== prevUserId) {
|
|
9379
9373
|
setPrevUserId(user.id);
|
|
9380
9374
|
setValues(initialFieldValues);
|
|
@@ -9562,7 +9556,7 @@ function ProfilePage({
|
|
|
9562
9556
|
}
|
|
9563
9557
|
|
|
9564
9558
|
// src/components/platform/SessionScreen.tsx
|
|
9565
|
-
import * as
|
|
9559
|
+
import * as React69 from "react";
|
|
9566
9560
|
import { Fragment as Fragment25, jsx as jsx94, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
9567
9561
|
var COPY = {
|
|
9568
9562
|
"signing-in": { busy: "Signing you in\u2026" },
|
|
@@ -9576,13 +9570,13 @@ function SessionScreen({ kind, error, onRetry, productName }) {
|
|
|
9576
9570
|
const copy = COPY[kind];
|
|
9577
9571
|
const busyMessage = "busy" in copy ? copy.busy : null;
|
|
9578
9572
|
const failureTitle = "failure" in copy ? copy.failure : null;
|
|
9579
|
-
const [announced, setAnnounced] =
|
|
9580
|
-
|
|
9573
|
+
const [announced, setAnnounced] = React69.useState("");
|
|
9574
|
+
React69.useEffect(() => {
|
|
9581
9575
|
setAnnounced(busyMessage ?? "");
|
|
9582
9576
|
}, [busyMessage]);
|
|
9583
|
-
const titleRef =
|
|
9577
|
+
const titleRef = React69.useRef(null);
|
|
9584
9578
|
const failed = failureTitle !== null;
|
|
9585
|
-
|
|
9579
|
+
React69.useEffect(() => {
|
|
9586
9580
|
titleRef.current?.focus({ preventScroll: true });
|
|
9587
9581
|
}, [failed]);
|
|
9588
9582
|
return /* @__PURE__ */ jsx94("main", { className: "fd-session-screen", children: /* @__PURE__ */ jsxs79("div", { className: "fd-session-screen-inner", children: [
|
|
@@ -9605,10 +9599,10 @@ function SessionScreen({ kind, error, onRetry, productName }) {
|
|
|
9605
9599
|
}
|
|
9606
9600
|
|
|
9607
9601
|
// src/components/platform/RoadmapTimeline.tsx
|
|
9608
|
-
import * as
|
|
9602
|
+
import * as React72 from "react";
|
|
9609
9603
|
|
|
9610
9604
|
// src/kits/session.ts
|
|
9611
|
-
import * as
|
|
9605
|
+
import * as React70 from "react";
|
|
9612
9606
|
var PERMISSION_CATALOG = [
|
|
9613
9607
|
{ group: "Plans", items: [
|
|
9614
9608
|
{ key: "plan.view", label: "View plans", detail: "Read any plan in the workspace." },
|
|
@@ -11175,8 +11169,8 @@ function roadmap(overrides) {
|
|
|
11175
11169
|
};
|
|
11176
11170
|
}
|
|
11177
11171
|
function useSession() {
|
|
11178
|
-
const [s, setS] =
|
|
11179
|
-
|
|
11172
|
+
const [s, setS] = React70.useState(getSession);
|
|
11173
|
+
React70.useEffect(() => subscribe(setS), []);
|
|
11180
11174
|
return s;
|
|
11181
11175
|
}
|
|
11182
11176
|
var SessionKit = {
|
|
@@ -11209,7 +11203,7 @@ var SessionKit = {
|
|
|
11209
11203
|
};
|
|
11210
11204
|
function DemoSessionProvider({ children }) {
|
|
11211
11205
|
const session = useSession();
|
|
11212
|
-
const value =
|
|
11206
|
+
const value = React70.useMemo(
|
|
11213
11207
|
() => ({
|
|
11214
11208
|
user: session.user,
|
|
11215
11209
|
roles: session.roles,
|
|
@@ -11225,11 +11219,11 @@ function DemoSessionProvider({ children }) {
|
|
|
11225
11219
|
}),
|
|
11226
11220
|
[session]
|
|
11227
11221
|
);
|
|
11228
|
-
return
|
|
11222
|
+
return React70.createElement(SessionProvider, { value }, children);
|
|
11229
11223
|
}
|
|
11230
11224
|
|
|
11231
11225
|
// src/kits/runtime.ts
|
|
11232
|
-
import * as
|
|
11226
|
+
import * as React71 from "react";
|
|
11233
11227
|
var WIRED_ENDPOINTS = [
|
|
11234
11228
|
// Nothing yet. Every id below would come from a real service:
|
|
11235
11229
|
// "plan.get", "placements.list", …
|
|
@@ -11400,8 +11394,8 @@ var RuntimeKit = {
|
|
|
11400
11394
|
};
|
|
11401
11395
|
RuntimeKit.declare(FEATURE_NEEDS);
|
|
11402
11396
|
function useRuntimeMode() {
|
|
11403
|
-
const [m, setM] =
|
|
11404
|
-
|
|
11397
|
+
const [m, setM] = React71.useState(RuntimeKit.getMode());
|
|
11398
|
+
React71.useEffect(() => RuntimeKit.subscribe(setM), []);
|
|
11405
11399
|
return m;
|
|
11406
11400
|
}
|
|
11407
11401
|
function useFeatureStatus(key) {
|
|
@@ -11484,12 +11478,12 @@ function RoadmapCard({ item: item2, byKey, onOpenFlag }) {
|
|
|
11484
11478
|
}
|
|
11485
11479
|
function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
|
|
11486
11480
|
const session = SessionKit.useSession();
|
|
11487
|
-
const [project, setProject] =
|
|
11488
|
-
const [q, setQ] =
|
|
11489
|
-
const scrollRef =
|
|
11490
|
-
const nowRef =
|
|
11491
|
-
const rm =
|
|
11492
|
-
const byKey =
|
|
11481
|
+
const [project, setProject] = React72.useState("");
|
|
11482
|
+
const [q, setQ] = React72.useState("");
|
|
11483
|
+
const scrollRef = React72.useRef(null);
|
|
11484
|
+
const nowRef = React72.useRef(null);
|
|
11485
|
+
const rm = React72.useMemo(() => SessionKit.roadmap({ isComplete: RuntimeKit.isComplete }), [session]);
|
|
11486
|
+
const byKey = React72.useMemo(() => {
|
|
11493
11487
|
const m = {};
|
|
11494
11488
|
rm.items.forEach((i) => {
|
|
11495
11489
|
m[i.key] = i;
|
|
@@ -11498,7 +11492,7 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
|
|
|
11498
11492
|
}, [rm]);
|
|
11499
11493
|
const items = rm.items.filter((i) => (!project || i.project === project) && (!q || (i.label + " " + i.description + " " + (i.backend || "") + " " + i.key).toLowerCase().includes(q.toLowerCase())));
|
|
11500
11494
|
const projects = [...new Set(rm.items.map((i) => i.project))];
|
|
11501
|
-
|
|
11495
|
+
React72.useEffect(() => {
|
|
11502
11496
|
let raf1 = 0, raf2 = 0;
|
|
11503
11497
|
const place = () => {
|
|
11504
11498
|
const box = scrollRef.current, mark = nowRef.current;
|
|
@@ -11572,7 +11566,7 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
|
|
|
11572
11566
|
lastPhase = item2.phase;
|
|
11573
11567
|
const inPhase = items.filter((i) => i.phase === item2.phase).length;
|
|
11574
11568
|
const isBoundary = n === firstPending;
|
|
11575
|
-
return /* @__PURE__ */ jsxs80(
|
|
11569
|
+
return /* @__PURE__ */ jsxs80(React72.Fragment, { children: [
|
|
11576
11570
|
showPhase ? /* @__PURE__ */ jsxs80("div", { className: "fd-rm-era", children: [
|
|
11577
11571
|
/* @__PURE__ */ jsxs80("span", { className: "fd-row", style: { gap: 8, flexWrap: "wrap", alignItems: "baseline" }, children: [
|
|
11578
11572
|
/* @__PURE__ */ jsx95("span", { style: { fontWeight: 700 }, children: item2.phase === 0 ? "Shipped" : "Phase " + item2.phase + " \u2014 " + item2.phaseName }),
|
|
@@ -11616,7 +11610,7 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
|
|
|
11616
11610
|
}
|
|
11617
11611
|
|
|
11618
11612
|
// src/components/platform/ComingSoon.tsx
|
|
11619
|
-
import * as
|
|
11613
|
+
import * as React73 from "react";
|
|
11620
11614
|
import { createPortal as createPortal6 } from "react-dom";
|
|
11621
11615
|
import { Fragment as Fragment27, jsx as jsx96, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
11622
11616
|
var BYPASS_STORE = "fd.soon.bypass.v1";
|
|
@@ -11634,8 +11628,8 @@ function writeBypassed(list) {
|
|
|
11634
11628
|
}
|
|
11635
11629
|
}
|
|
11636
11630
|
function useBypass(key) {
|
|
11637
|
-
const [on, setOn] =
|
|
11638
|
-
|
|
11631
|
+
const [on, setOn] = React73.useState(() => !!key && readBypassed().indexOf(key) >= 0);
|
|
11632
|
+
React73.useEffect(() => {
|
|
11639
11633
|
setOn(!!key && readBypassed().indexOf(key) >= 0);
|
|
11640
11634
|
}, [key]);
|
|
11641
11635
|
const set = (next) => {
|
|
@@ -11682,9 +11676,9 @@ function SoonCard({ label, detail, backend, eta, effort, onRoadmap, allowed, onB
|
|
|
11682
11676
|
] });
|
|
11683
11677
|
}
|
|
11684
11678
|
function useHoverCard(open2) {
|
|
11685
|
-
const anchor =
|
|
11686
|
-
const [pos, setPos] =
|
|
11687
|
-
|
|
11679
|
+
const anchor = React73.useRef(null);
|
|
11680
|
+
const [pos, setPos] = React73.useState(null);
|
|
11681
|
+
React73.useLayoutEffect(() => {
|
|
11688
11682
|
if (!open2 || !anchor.current) {
|
|
11689
11683
|
setPos(null);
|
|
11690
11684
|
return;
|
|
@@ -11793,7 +11787,7 @@ function ComingSoon({
|
|
|
11793
11787
|
] });
|
|
11794
11788
|
}
|
|
11795
11789
|
return /* @__PURE__ */ jsxs81("div", { className: ["fd-soon", className].filter(Boolean).join(" "), style: minHeight ? { minHeight } : void 0, ...rest, children: [
|
|
11796
|
-
/* @__PURE__ */ jsx96("div", { className: "fd-soon-under", style: { filter: "blur(" + blur + "px) saturate(.62)" },
|
|
11790
|
+
/* @__PURE__ */ jsx96("div", { className: "fd-soon-under", style: { filter: "blur(" + blur + "px) saturate(.62)" }, inert: true, "aria-hidden": "true", children }),
|
|
11797
11791
|
/* @__PURE__ */ jsx96("div", { className: "fd-soon-veil" }),
|
|
11798
11792
|
/* @__PURE__ */ jsx96("div", { className: "fd-soon-note", role: "note", children: /* @__PURE__ */ jsx96(
|
|
11799
11793
|
SoonCard,
|
|
@@ -11811,12 +11805,12 @@ function ComingSoon({
|
|
|
11811
11805
|
] });
|
|
11812
11806
|
}
|
|
11813
11807
|
function InlineSoon({ label, detail, backend, eta, effort, onRoadmap, allowed, onBypass, blur, tip, className, rest, children }) {
|
|
11814
|
-
const [open2, setOpen] =
|
|
11808
|
+
const [open2, setOpen] = React73.useState(false);
|
|
11815
11809
|
const [anchor, pos] = useHoverCard(open2);
|
|
11816
|
-
const hoverCardRef =
|
|
11810
|
+
const hoverCardRef = React73.useRef(null);
|
|
11817
11811
|
const hoverLayer = useStackedLayer({ active: open2, containerRef: hoverCardRef, returnFocus: false });
|
|
11818
11812
|
const zIndex = useLayerZIndex(hoverLayer);
|
|
11819
|
-
const close2 =
|
|
11813
|
+
const close2 = React73.useRef(null);
|
|
11820
11814
|
const show = () => {
|
|
11821
11815
|
if (close2.current) {
|
|
11822
11816
|
clearTimeout(close2.current);
|
|
@@ -11832,7 +11826,7 @@ function InlineSoon({ label, detail, backend, eta, effort, onRoadmap, allowed, o
|
|
|
11832
11826
|
setOpen(false);
|
|
11833
11827
|
}, 140);
|
|
11834
11828
|
};
|
|
11835
|
-
|
|
11829
|
+
React73.useEffect(() => () => {
|
|
11836
11830
|
if (close2.current) clearTimeout(close2.current);
|
|
11837
11831
|
}, []);
|
|
11838
11832
|
return /* @__PURE__ */ jsxs81(
|
|
@@ -11846,7 +11840,7 @@ function InlineSoon({ label, detail, backend, eta, effort, onRoadmap, allowed, o
|
|
|
11846
11840
|
onBlur: hide,
|
|
11847
11841
|
...rest,
|
|
11848
11842
|
children: [
|
|
11849
|
-
/* @__PURE__ */ jsx96("span", { className: "fd-soon-under", style: { filter: "blur(" + Math.min(blur, 1.1) + "px) saturate(.66)" },
|
|
11843
|
+
/* @__PURE__ */ jsx96("span", { className: "fd-soon-under", style: { filter: "blur(" + Math.min(blur, 1.1) + "px) saturate(.66)" }, inert: true, "aria-hidden": "true", children }),
|
|
11850
11844
|
/* @__PURE__ */ jsx96(
|
|
11851
11845
|
"button",
|
|
11852
11846
|
{
|
|
@@ -12284,7 +12278,7 @@ function SaturationDistribution({ campuses = [], floorBand, floorScore, onSelect
|
|
|
12284
12278
|
}
|
|
12285
12279
|
|
|
12286
12280
|
// src/components/planner/MixGap.tsx
|
|
12287
|
-
import * as
|
|
12281
|
+
import * as React74 from "react";
|
|
12288
12282
|
import { Fragment as Fragment29, jsx as jsx101, jsxs as jsxs86 } from "react/jsx-runtime";
|
|
12289
12283
|
var MIX_GAP_LAYOUT = {
|
|
12290
12284
|
trackHeight: 30,
|
|
@@ -12299,7 +12293,7 @@ function mixGapOffset(value, max) {
|
|
|
12299
12293
|
}
|
|
12300
12294
|
function MixGap({ rows = [], loading = false, className = "" }) {
|
|
12301
12295
|
const max = Math.max(1, ...rows.flatMap((r) => [r.target, r.realized]));
|
|
12302
|
-
const [hover, setHover] =
|
|
12296
|
+
const [hover, setHover] = React74.useState(null);
|
|
12303
12297
|
const toneOf = (gap) => gap >= -1 ? "ok" : gap >= -4 ? "warn" : "danger";
|
|
12304
12298
|
const TONE = { ok: "var(--ok-solid)", warn: "var(--warn-solid)", danger: "var(--danger-solid)" };
|
|
12305
12299
|
const { trackHeight, barHeight, targetWidth, labelGap } = MIX_GAP_LAYOUT;
|
|
@@ -12442,7 +12436,7 @@ function ChannelContribution({
|
|
|
12442
12436
|
}
|
|
12443
12437
|
|
|
12444
12438
|
// src/components/planner/BudgetReallocator.tsx
|
|
12445
|
-
import * as
|
|
12439
|
+
import * as React75 from "react";
|
|
12446
12440
|
import { Fragment as Fragment30, jsx as jsx103, jsxs as jsxs88 } from "react/jsx-runtime";
|
|
12447
12441
|
var bandFor = (crp) => crp >= 200 ? "dominant" : crp >= 100 ? "strong" : crp >= 50 ? "adequate" : "weak";
|
|
12448
12442
|
function BudgetReallocator({
|
|
@@ -12458,8 +12452,8 @@ function BudgetReallocator({
|
|
|
12458
12452
|
onCancel,
|
|
12459
12453
|
className = ""
|
|
12460
12454
|
}) {
|
|
12461
|
-
const [draft, setDraft] =
|
|
12462
|
-
|
|
12455
|
+
const [draft, setDraft] = React75.useState(spend);
|
|
12456
|
+
React75.useEffect(() => setDraft(spend), [spend]);
|
|
12463
12457
|
const dirty = draft !== spend;
|
|
12464
12458
|
const nextCrp = scoreFor ? scoreFor(draft) : crp;
|
|
12465
12459
|
const nextBand = bandFor(nextCrp);
|
|
@@ -12474,10 +12468,10 @@ function BudgetReallocator({
|
|
|
12474
12468
|
setDraft(spend);
|
|
12475
12469
|
if (onCancel) onCancel();
|
|
12476
12470
|
};
|
|
12477
|
-
const trackRef =
|
|
12478
|
-
const chipRef =
|
|
12479
|
-
const [chipLeft, setChipLeft] =
|
|
12480
|
-
|
|
12471
|
+
const trackRef = React75.useRef(null);
|
|
12472
|
+
const chipRef = React75.useRef(null);
|
|
12473
|
+
const [chipLeft, setChipLeft] = React75.useState(null);
|
|
12474
|
+
React75.useLayoutEffect(() => {
|
|
12481
12475
|
const track = trackRef.current;
|
|
12482
12476
|
if (!dirty || !track) {
|
|
12483
12477
|
setChipLeft(null);
|
|
@@ -12665,7 +12659,7 @@ function ImportanceTag({ level, showLabel = true, size = "sm", className = "", d
|
|
|
12665
12659
|
}
|
|
12666
12660
|
|
|
12667
12661
|
// src/components/planner/PreferenceMeter.tsx
|
|
12668
|
-
import * as
|
|
12662
|
+
import * as React76 from "react";
|
|
12669
12663
|
import { jsx as jsx106, jsxs as jsxs91 } from "react/jsx-runtime";
|
|
12670
12664
|
function preferenceScore(criteria) {
|
|
12671
12665
|
const earned = criteria.reduce((n, c) => n + (Number(c.earned) || 0), 0);
|
|
@@ -12695,7 +12689,7 @@ function PreferenceMeter({
|
|
|
12695
12689
|
className = ""
|
|
12696
12690
|
}) {
|
|
12697
12691
|
const value = score == null ? preferenceScore(criteria) : score;
|
|
12698
|
-
const segments =
|
|
12692
|
+
const segments = React76.useMemo(() => preferenceSegments(criteria), [criteria]);
|
|
12699
12693
|
return /* @__PURE__ */ jsx106(
|
|
12700
12694
|
ScoreMeter,
|
|
12701
12695
|
{
|
|
@@ -12734,13 +12728,13 @@ function PreferenceMeter({
|
|
|
12734
12728
|
}
|
|
12735
12729
|
|
|
12736
12730
|
// src/components/chat/AgentChatPanel.tsx
|
|
12737
|
-
import * as
|
|
12731
|
+
import * as React83 from "react";
|
|
12738
12732
|
|
|
12739
12733
|
// src/components/chat/chatEngine.ts
|
|
12740
|
-
import * as
|
|
12734
|
+
import * as React78 from "react";
|
|
12741
12735
|
|
|
12742
12736
|
// src/components/chat/chatStore.ts
|
|
12743
|
-
import * as
|
|
12737
|
+
import * as React77 from "react";
|
|
12744
12738
|
var safeStore = {
|
|
12745
12739
|
get(k) {
|
|
12746
12740
|
try {
|
|
@@ -12769,13 +12763,13 @@ function useChatDraft(owner, contextType, contextId, store = safeStore) {
|
|
|
12769
12763
|
if (owner === "") throw new Error("useChatDraft: draftOwner is an empty string; pass the signed-in user's id, or null for no owner.");
|
|
12770
12764
|
const key = owner === null ? null : draftKey(owner, contextType, contextId);
|
|
12771
12765
|
const read2 = (k) => k ? store.get(k) || "" : "";
|
|
12772
|
-
const [state, setState] =
|
|
12766
|
+
const [state, setState] = React77.useState(() => ({ key, text: read2(key) }));
|
|
12773
12767
|
let current2 = state;
|
|
12774
12768
|
if (state.key !== key) {
|
|
12775
12769
|
current2 = { key, text: read2(key) };
|
|
12776
12770
|
setState(current2);
|
|
12777
12771
|
}
|
|
12778
|
-
const setText =
|
|
12772
|
+
const setText = React77.useCallback((text) => {
|
|
12779
12773
|
if (key) {
|
|
12780
12774
|
if (text) {
|
|
12781
12775
|
store.set(key, text);
|
|
@@ -12834,33 +12828,33 @@ function useChatEngine(opts) {
|
|
|
12834
12828
|
onClear,
|
|
12835
12829
|
onFeedback
|
|
12836
12830
|
} = opts || {};
|
|
12837
|
-
const [status, setStatus] =
|
|
12838
|
-
const [threadId, setThreadId] =
|
|
12839
|
-
const [messages, setMessages] =
|
|
12840
|
-
const [queue, setQueue] =
|
|
12841
|
-
const [fatal, setFatal] =
|
|
12842
|
-
const [busy, setBusy] =
|
|
12843
|
-
const [turnStartedAt, setTurnStartedAt] =
|
|
12844
|
-
const listRef =
|
|
12845
|
-
const queueRef =
|
|
12846
|
-
const busyRef =
|
|
12847
|
-
const loadedRef =
|
|
12848
|
-
const stoppedRef =
|
|
12849
|
-
const abortRef =
|
|
12850
|
-
const serverCount =
|
|
12851
|
-
const serverIds =
|
|
12852
|
-
const liveTurn =
|
|
12853
|
-
const lastTurnOwn =
|
|
12854
|
-
const retired =
|
|
12855
|
-
const threadRef =
|
|
12856
|
-
const mounted =
|
|
12857
|
-
|
|
12831
|
+
const [status, setStatus] = React78.useState("idle");
|
|
12832
|
+
const [threadId, setThreadId] = React78.useState(null);
|
|
12833
|
+
const [messages, setMessages] = React78.useState([]);
|
|
12834
|
+
const [queue, setQueue] = React78.useState([]);
|
|
12835
|
+
const [fatal, setFatal] = React78.useState(null);
|
|
12836
|
+
const [busy, setBusy] = React78.useState(false);
|
|
12837
|
+
const [turnStartedAt, setTurnStartedAt] = React78.useState(null);
|
|
12838
|
+
const listRef = React78.useRef([]);
|
|
12839
|
+
const queueRef = React78.useRef([]);
|
|
12840
|
+
const busyRef = React78.useRef(false);
|
|
12841
|
+
const loadedRef = React78.useRef(false);
|
|
12842
|
+
const stoppedRef = React78.useRef(false);
|
|
12843
|
+
const abortRef = React78.useRef(null);
|
|
12844
|
+
const serverCount = React78.useRef(0);
|
|
12845
|
+
const serverIds = React78.useRef(/* @__PURE__ */ new Set());
|
|
12846
|
+
const liveTurn = React78.useRef(null);
|
|
12847
|
+
const lastTurnOwn = React78.useRef(/* @__PURE__ */ new Set());
|
|
12848
|
+
const retired = React78.useRef(/* @__PURE__ */ new Set());
|
|
12849
|
+
const threadRef = React78.useRef(null);
|
|
12850
|
+
const mounted = React78.useRef(true);
|
|
12851
|
+
React78.useEffect(() => {
|
|
12858
12852
|
mounted.current = true;
|
|
12859
12853
|
return () => {
|
|
12860
12854
|
mounted.current = false;
|
|
12861
12855
|
};
|
|
12862
12856
|
}, []);
|
|
12863
|
-
const describeWaitingRef =
|
|
12857
|
+
const describeWaitingRef = React78.useRef(describeWaiting);
|
|
12864
12858
|
describeWaitingRef.current = describeWaiting;
|
|
12865
12859
|
const commit = (next) => {
|
|
12866
12860
|
const derived = withWaiting(next, (pending) => describeWaitingRef.current(pending));
|
|
@@ -12879,7 +12873,7 @@ function useChatEngine(opts) {
|
|
|
12879
12873
|
}
|
|
12880
12874
|
return false;
|
|
12881
12875
|
};
|
|
12882
|
-
const loadThread =
|
|
12876
|
+
const loadThread = React78.useCallback(async (id) => {
|
|
12883
12877
|
const data = await apiAdapter.getThread(id);
|
|
12884
12878
|
const list = [...data && data.messages || []];
|
|
12885
12879
|
serverCount.current = list.length;
|
|
@@ -12921,7 +12915,7 @@ function useChatEngine(opts) {
|
|
|
12921
12915
|
packet: progress.packet ?? holder.packet
|
|
12922
12916
|
});
|
|
12923
12917
|
}
|
|
12924
|
-
|
|
12918
|
+
React78.useEffect(() => {
|
|
12925
12919
|
if (!apiAdapter) {
|
|
12926
12920
|
setStatus("idle");
|
|
12927
12921
|
setFatal(null);
|
|
@@ -13164,7 +13158,7 @@ function useChatEngine(opts) {
|
|
|
13164
13158
|
await dispatchTurn(turn);
|
|
13165
13159
|
}
|
|
13166
13160
|
}
|
|
13167
|
-
const send =
|
|
13161
|
+
const send = React78.useCallback((text, attachments) => {
|
|
13168
13162
|
const body = (text || "").trim();
|
|
13169
13163
|
if (!body && !(attachments && attachments.length)) return;
|
|
13170
13164
|
if (status === "disconnected") return;
|
|
@@ -13174,7 +13168,7 @@ function useChatEngine(opts) {
|
|
|
13174
13168
|
stoppedRef.current = false;
|
|
13175
13169
|
drain();
|
|
13176
13170
|
}, [status]);
|
|
13177
|
-
const stop =
|
|
13171
|
+
const stop = React78.useCallback(() => {
|
|
13178
13172
|
stoppedRef.current = true;
|
|
13179
13173
|
const ac = abortRef.current;
|
|
13180
13174
|
if (ac) {
|
|
@@ -13193,11 +13187,11 @@ function useChatEngine(opts) {
|
|
|
13193
13187
|
store.del(jobKey(threadRef.current));
|
|
13194
13188
|
}
|
|
13195
13189
|
}, [apiAdapter]);
|
|
13196
|
-
const removeQueued =
|
|
13190
|
+
const removeQueued = React78.useCallback((id) => {
|
|
13197
13191
|
queueRef.current = queueRef.current.filter((t) => t.id !== id);
|
|
13198
13192
|
setQueue(queueRef.current.slice());
|
|
13199
13193
|
}, []);
|
|
13200
|
-
const retry =
|
|
13194
|
+
const retry = React78.useCallback(() => {
|
|
13201
13195
|
const list = listRef.current;
|
|
13202
13196
|
let at = -1;
|
|
13203
13197
|
for (let i = list.length - 1; i >= 0; i--) if (list[i].role === "user") {
|
|
@@ -13214,19 +13208,19 @@ function useChatEngine(opts) {
|
|
|
13214
13208
|
setQueue(queueRef.current.slice());
|
|
13215
13209
|
drain();
|
|
13216
13210
|
}, []);
|
|
13217
|
-
const clear =
|
|
13211
|
+
const clear = React78.useCallback(() => {
|
|
13218
13212
|
commit([]);
|
|
13219
13213
|
serverCount.current = 0;
|
|
13220
13214
|
queueRef.current = [];
|
|
13221
13215
|
setQueue([]);
|
|
13222
13216
|
onClear && onClear();
|
|
13223
13217
|
}, [onClear]);
|
|
13224
|
-
const setFeedback =
|
|
13218
|
+
const setFeedback = React78.useCallback((id, value) => {
|
|
13225
13219
|
patch(id, (m) => ({ feedback: m.feedback === value ? null : value }));
|
|
13226
13220
|
const msg = listRef.current.find((m) => m.id === id);
|
|
13227
13221
|
onFeedback && onFeedback({ message: msg, feedback: msg ? msg.feedback : value });
|
|
13228
13222
|
}, [onFeedback]);
|
|
13229
|
-
const reload =
|
|
13223
|
+
const reload = React78.useCallback(async () => {
|
|
13230
13224
|
if (!threadRef.current) return;
|
|
13231
13225
|
setStatus("loading");
|
|
13232
13226
|
try {
|
|
@@ -13236,7 +13230,7 @@ function useChatEngine(opts) {
|
|
|
13236
13230
|
if (!fail(err)) setStatus("ready");
|
|
13237
13231
|
}
|
|
13238
13232
|
}, [loadThread]);
|
|
13239
|
-
const refresh2 =
|
|
13233
|
+
const refresh2 = React78.useCallback(async () => {
|
|
13240
13234
|
if (!threadRef.current) return;
|
|
13241
13235
|
try {
|
|
13242
13236
|
await mergeThread();
|
|
@@ -13273,10 +13267,10 @@ var ChatKit = {
|
|
|
13273
13267
|
};
|
|
13274
13268
|
|
|
13275
13269
|
// src/components/chat/ChatTranscript.tsx
|
|
13276
|
-
import * as
|
|
13270
|
+
import * as React80 from "react";
|
|
13277
13271
|
|
|
13278
13272
|
// src/components/chat/ChatTurn.tsx
|
|
13279
|
-
import * as
|
|
13273
|
+
import * as React79 from "react";
|
|
13280
13274
|
import { Fragment as Fragment32, jsx as jsx107, jsxs as jsxs92 } from "react/jsx-runtime";
|
|
13281
13275
|
function JsonView({ value }) {
|
|
13282
13276
|
let text;
|
|
@@ -13288,10 +13282,10 @@ function JsonView({ value }) {
|
|
|
13288
13282
|
return /* @__PURE__ */ jsx107(CodeBlock, { code: text, language: "json", collapseAfter: 18 });
|
|
13289
13283
|
}
|
|
13290
13284
|
function DecisionFooter({ packet, decision, state }) {
|
|
13291
|
-
const [pending, setPending] =
|
|
13292
|
-
const [failure, setFailure] =
|
|
13293
|
-
const mounted =
|
|
13294
|
-
|
|
13285
|
+
const [pending, setPending] = React79.useState(null);
|
|
13286
|
+
const [failure, setFailure] = React79.useState(null);
|
|
13287
|
+
const mounted = React79.useRef(true);
|
|
13288
|
+
React79.useEffect(() => {
|
|
13295
13289
|
mounted.current = true;
|
|
13296
13290
|
return () => {
|
|
13297
13291
|
mounted.current = false;
|
|
@@ -13349,7 +13343,7 @@ function PacketCard({ packet, schema, render, onApply, applied, decision }) {
|
|
|
13349
13343
|
] });
|
|
13350
13344
|
}
|
|
13351
13345
|
function ThinkingBlock({ text, durationMs, streaming, defaultOpen = false }) {
|
|
13352
|
-
const [open2, setOpen] =
|
|
13346
|
+
const [open2, setOpen] = React79.useState(defaultOpen);
|
|
13353
13347
|
if (!text) return null;
|
|
13354
13348
|
return /* @__PURE__ */ jsxs92("div", { className: "fdc-think" + (open2 ? " is-open" : ""), children: [
|
|
13355
13349
|
/* @__PURE__ */ jsxs92("button", { type: "button", className: "fdc-think-head", onClick: () => setOpen((v) => !v), "aria-expanded": open2, children: [
|
|
@@ -13366,7 +13360,7 @@ function ThinkingBlock({ text, durationMs, streaming, defaultOpen = false }) {
|
|
|
13366
13360
|
] });
|
|
13367
13361
|
}
|
|
13368
13362
|
function Citations({ items = [], onOpen }) {
|
|
13369
|
-
const [open2, setOpen] =
|
|
13363
|
+
const [open2, setOpen] = React79.useState(false);
|
|
13370
13364
|
if (!items.length) return null;
|
|
13371
13365
|
return /* @__PURE__ */ jsxs92("div", { className: "fdc-cites", children: [
|
|
13372
13366
|
/* @__PURE__ */ jsxs92("button", { type: "button", className: "fdc-cites-head", onClick: () => setOpen((v) => !v), "aria-expanded": open2, children: [
|
|
@@ -13392,7 +13386,7 @@ function clampText(text, max) {
|
|
|
13392
13386
|
return (at > max * 0.6 ? cut.slice(0, at) : cut).trimEnd() + "\u2026";
|
|
13393
13387
|
}
|
|
13394
13388
|
function MessageBody({ message: m, ctx }) {
|
|
13395
|
-
const [expanded, setExpanded] =
|
|
13389
|
+
const [expanded, setExpanded] = React79.useState(false);
|
|
13396
13390
|
const isUser = m.role === "user";
|
|
13397
13391
|
const raw = m.text || "";
|
|
13398
13392
|
const clamped = !expanded && !m.streaming ? clampText(raw, ctx.maxVisibleChars) : null;
|
|
@@ -13472,7 +13466,7 @@ function RunActions({ group, ctx }) {
|
|
|
13472
13466
|
] }),
|
|
13473
13467
|
isAssistant && ctx.onRetry ? /* @__PURE__ */ jsx107("button", { type: "button", className: "fdc-act", onClick: ctx.onRetry, "aria-label": "Retry this turn", children: /* @__PURE__ */ jsx107("i", { className: "ph ph-arrow-clockwise", "aria-hidden": "true" }) }) : null,
|
|
13474
13468
|
group.role === "user" && ctx.onEdit ? /* @__PURE__ */ jsx107("button", { type: "button", className: "fdc-act", onClick: () => ctx.onEdit(last), "aria-label": "Edit and resend", children: /* @__PURE__ */ jsx107("i", { className: "ph ph-pencil-simple", "aria-hidden": "true" }) }) : null,
|
|
13475
|
-
isAssistant && ctx.onFeedback ? /* @__PURE__ */ jsxs92(
|
|
13469
|
+
isAssistant && ctx.onFeedback ? /* @__PURE__ */ jsxs92(React79.Fragment, { children: [
|
|
13476
13470
|
/* @__PURE__ */ jsx107("button", { type: "button", className: "fdc-act" + (fb === "up" ? " is-on" : ""), onClick: () => ctx.onFeedback(last.id, "up"), "aria-pressed": fb === "up", "aria-label": "Good response", children: /* @__PURE__ */ jsx107("i", { className: "ph ph-thumbs-up", "aria-hidden": "true" }) }),
|
|
13477
13471
|
/* @__PURE__ */ jsx107("button", { type: "button", className: "fdc-act" + (fb === "down" ? " is-on" : ""), onClick: () => ctx.onFeedback(last.id, "down"), "aria-pressed": fb === "down", "aria-label": "Bad response", children: /* @__PURE__ */ jsx107("i", { className: "ph ph-thumbs-down", "aria-hidden": "true" }) })
|
|
13478
13472
|
] }) : null,
|
|
@@ -13567,10 +13561,10 @@ function ChatTranscript({
|
|
|
13567
13561
|
renderEmpty,
|
|
13568
13562
|
className = ""
|
|
13569
13563
|
}) {
|
|
13570
|
-
const scroller =
|
|
13571
|
-
const stick =
|
|
13572
|
-
const [pill, setPill] =
|
|
13573
|
-
const seen =
|
|
13564
|
+
const scroller = React80.useRef(null);
|
|
13565
|
+
const stick = React80.useRef(true);
|
|
13566
|
+
const [pill, setPill] = React80.useState(0);
|
|
13567
|
+
const seen = React80.useRef(0);
|
|
13574
13568
|
const toBottom = (smooth) => {
|
|
13575
13569
|
const el = scroller.current;
|
|
13576
13570
|
if (!el) return;
|
|
@@ -13589,7 +13583,7 @@ function ChatTranscript({
|
|
|
13589
13583
|
seen.current = messages.length;
|
|
13590
13584
|
}
|
|
13591
13585
|
};
|
|
13592
|
-
|
|
13586
|
+
React80.useLayoutEffect(() => {
|
|
13593
13587
|
const el = scroller.current;
|
|
13594
13588
|
if (!el) return;
|
|
13595
13589
|
if (stick.current) {
|
|
@@ -13597,7 +13591,7 @@ function ChatTranscript({
|
|
|
13597
13591
|
seen.current = messages.length;
|
|
13598
13592
|
} else setPill(Math.max(0, messages.length - seen.current));
|
|
13599
13593
|
}, [messages]);
|
|
13600
|
-
|
|
13594
|
+
React80.useEffect(() => {
|
|
13601
13595
|
const el = scroller.current;
|
|
13602
13596
|
const inner = el && el.firstChild;
|
|
13603
13597
|
if (!el || !inner || typeof ResizeObserver === "undefined") return;
|
|
@@ -13607,7 +13601,7 @@ function ChatTranscript({
|
|
|
13607
13601
|
ro.observe(inner);
|
|
13608
13602
|
return () => ro.disconnect();
|
|
13609
13603
|
}, []);
|
|
13610
|
-
const groups =
|
|
13604
|
+
const groups = React80.useMemo(() => groupMessages(messages), [messages]);
|
|
13611
13605
|
const empty = !messages.length && status === "ready";
|
|
13612
13606
|
return /* @__PURE__ */ jsxs93("div", { className: ["fdc-scroll", className].filter(Boolean).join(" "), ref: scroller, onScroll, children: [
|
|
13613
13607
|
/* @__PURE__ */ jsxs93("div", { className: "fdc-log", role: "log", "aria-label": "Conversation", children: [
|
|
@@ -13631,7 +13625,7 @@ function ChatTranscript({
|
|
|
13631
13625
|
const prev = groups[i - 1];
|
|
13632
13626
|
const k = dayKey(g.messages[0].timestamp);
|
|
13633
13627
|
const showDay = !!k && (!prev || dayKey(prev.messages[0].timestamp) !== k);
|
|
13634
|
-
return /* @__PURE__ */ jsxs93(
|
|
13628
|
+
return /* @__PURE__ */ jsxs93(React80.Fragment, { children: [
|
|
13635
13629
|
showDay ? /* @__PURE__ */ jsx108("div", { className: "fdc-day", children: /* @__PURE__ */ jsx108("span", { children: dayLabel(k) }) }) : null,
|
|
13636
13630
|
/* @__PURE__ */ jsx108(ChatTurn, { group: g, ctx })
|
|
13637
13631
|
] }, g.key || i);
|
|
@@ -13648,7 +13642,7 @@ function ChatTranscript({
|
|
|
13648
13642
|
var TranscriptKit = { groupMessages };
|
|
13649
13643
|
|
|
13650
13644
|
// src/components/chat/ChatComposer.tsx
|
|
13651
|
-
import * as
|
|
13645
|
+
import * as React81 from "react";
|
|
13652
13646
|
import { MarkdownEditor as MarkdownEditor2 } from "@flytedan/markdown-editor";
|
|
13653
13647
|
import { jsx as jsx109, jsxs as jsxs94 } from "react/jsx-runtime";
|
|
13654
13648
|
function ChatComposer({
|
|
@@ -13677,17 +13671,17 @@ function ChatComposer({
|
|
|
13677
13671
|
onReject,
|
|
13678
13672
|
onOpenAttachment
|
|
13679
13673
|
}) {
|
|
13680
|
-
const [text, setText] =
|
|
13681
|
-
const [trigger, setTrigger] =
|
|
13682
|
-
const [mentionItems, setMentionItems] =
|
|
13683
|
-
const [listening, setListening] =
|
|
13684
|
-
const [notice, setNotice] =
|
|
13685
|
-
const editor =
|
|
13686
|
-
const wrap =
|
|
13687
|
-
const stopVoice =
|
|
13674
|
+
const [text, setText] = React81.useState(draft || "");
|
|
13675
|
+
const [trigger, setTrigger] = React81.useState(null);
|
|
13676
|
+
const [mentionItems, setMentionItems] = React81.useState([]);
|
|
13677
|
+
const [listening, setListening] = React81.useState(false);
|
|
13678
|
+
const [notice, setNotice] = React81.useState(null);
|
|
13679
|
+
const editor = React81.useRef(null);
|
|
13680
|
+
const wrap = React81.useRef(null);
|
|
13681
|
+
const stopVoice = React81.useRef(null);
|
|
13688
13682
|
const staged = useStagedFiles(fileUploadHandler, { onError: () => {
|
|
13689
13683
|
} });
|
|
13690
|
-
|
|
13684
|
+
React81.useEffect(() => {
|
|
13691
13685
|
if (draft != null && draft !== text) setText(draft);
|
|
13692
13686
|
}, [draft]);
|
|
13693
13687
|
const change = (v) => {
|
|
@@ -13723,7 +13717,7 @@ function ChatComposer({
|
|
|
13723
13717
|
e.preventDefault();
|
|
13724
13718
|
staged.add(found.files);
|
|
13725
13719
|
};
|
|
13726
|
-
|
|
13720
|
+
React81.useEffect(() => {
|
|
13727
13721
|
if (!trigger || trigger.type !== "mention" || !mentionSources) {
|
|
13728
13722
|
setMentionItems([]);
|
|
13729
13723
|
return;
|
|
@@ -13741,7 +13735,7 @@ function ChatComposer({
|
|
|
13741
13735
|
const q = (trigger.query || "").toLowerCase();
|
|
13742
13736
|
setMentionItems(mentionSources.filter((m) => !q || (m.label + " " + (m.description || "")).toLowerCase().includes(q)));
|
|
13743
13737
|
}, [trigger, mentionSources]);
|
|
13744
|
-
const slashItems =
|
|
13738
|
+
const slashItems = React81.useMemo(() => {
|
|
13745
13739
|
if (!trigger || trigger.type !== "slash" || !slashCommands) return [];
|
|
13746
13740
|
const q = (trigger.query || "").toLowerCase();
|
|
13747
13741
|
return slashCommands.filter((c) => !q || (c.id + " " + c.label + " " + (c.description || "")).toLowerCase().includes(q));
|
|
@@ -13907,12 +13901,12 @@ function ChatComposer({
|
|
|
13907
13901
|
}
|
|
13908
13902
|
|
|
13909
13903
|
// src/components/chat/ChatSessionBar.tsx
|
|
13910
|
-
import * as
|
|
13904
|
+
import * as React82 from "react";
|
|
13911
13905
|
import { jsx as jsx110, jsxs as jsxs95 } from "react/jsx-runtime";
|
|
13912
13906
|
var compact2 = meterFormats.compact;
|
|
13913
13907
|
function ChatSessionBar({ sessionStats, contextUsage, usageLimits, onClear, extras }) {
|
|
13914
|
-
const [open2, setOpen] =
|
|
13915
|
-
const anchor =
|
|
13908
|
+
const [open2, setOpen] = React82.useState(false);
|
|
13909
|
+
const anchor = React82.useRef(null);
|
|
13916
13910
|
const stats = sessionStats || null;
|
|
13917
13911
|
const cu = contextUsage || null;
|
|
13918
13912
|
const limits = usageLimits || null;
|
|
@@ -13927,7 +13921,7 @@ function ChatSessionBar({ sessionStats, contextUsage, usageLimits, onClear, extr
|
|
|
13927
13921
|
if (stats && stats.runningTasks) bits.push(stats.runningTasks + " running task" + (stats.runningTasks === 1 ? "" : "s"));
|
|
13928
13922
|
if (cu) bits.push(pct + "% context");
|
|
13929
13923
|
const expandable = !!(cu || limits);
|
|
13930
|
-
return /* @__PURE__ */ jsxs95(
|
|
13924
|
+
return /* @__PURE__ */ jsxs95(React82.Fragment, { children: [
|
|
13931
13925
|
/* @__PURE__ */ jsxs95("div", { className: "fdc-bar", children: [
|
|
13932
13926
|
/* @__PURE__ */ jsxs95(
|
|
13933
13927
|
"button",
|
|
@@ -14070,7 +14064,7 @@ function ModelControls({
|
|
|
14070
14064
|
] })
|
|
14071
14065
|
});
|
|
14072
14066
|
}
|
|
14073
|
-
return /* @__PURE__ */ jsxs95(
|
|
14067
|
+
return /* @__PURE__ */ jsxs95(React82.Fragment, { children: [
|
|
14074
14068
|
/* @__PURE__ */ jsx110(
|
|
14075
14069
|
MenuButton,
|
|
14076
14070
|
{
|
|
@@ -14191,7 +14185,7 @@ function AgentChatPanel({
|
|
|
14191
14185
|
onEditMessage
|
|
14192
14186
|
}) {
|
|
14193
14187
|
const [panelRef, panelWidth] = useMeasuredWidth(NARROW_PANEL_WIDTH);
|
|
14194
|
-
const [applied, setApplied] =
|
|
14188
|
+
const [applied, setApplied] = React83.useState({});
|
|
14195
14189
|
const [draft, setDraft] = useChatDraft(draftOwner, contextType, contextId);
|
|
14196
14190
|
const engine = useChatEngine({
|
|
14197
14191
|
contextType,
|
|
@@ -14209,8 +14203,8 @@ function AgentChatPanel({
|
|
|
14209
14203
|
onFeedback
|
|
14210
14204
|
});
|
|
14211
14205
|
const { refresh: refresh2 } = engine;
|
|
14212
|
-
const lastReloadKey =
|
|
14213
|
-
|
|
14206
|
+
const lastReloadKey = React83.useRef(reloadKey);
|
|
14207
|
+
React83.useEffect(() => {
|
|
14214
14208
|
if (lastReloadKey.current === reloadKey) return;
|
|
14215
14209
|
lastReloadKey.current = reloadKey;
|
|
14216
14210
|
refresh2();
|
|
@@ -14374,7 +14368,7 @@ function AgentChatPanel({
|
|
|
14374
14368
|
}
|
|
14375
14369
|
|
|
14376
14370
|
// src/components/chat/QueryResultCard.tsx
|
|
14377
|
-
import * as
|
|
14371
|
+
import * as React84 from "react";
|
|
14378
14372
|
import { jsx as jsx112, jsxs as jsxs97 } from "react/jsx-runtime";
|
|
14379
14373
|
var STATUS2 = {
|
|
14380
14374
|
queued: { label: "Queued", tone: "neutral" },
|
|
@@ -14385,9 +14379,9 @@ var STATUS2 = {
|
|
|
14385
14379
|
};
|
|
14386
14380
|
var QUERY_EMPTY_MESSAGE = "No rows to show.";
|
|
14387
14381
|
function useElapsed(status, startedAt) {
|
|
14388
|
-
const [now, setNow] =
|
|
14382
|
+
const [now, setNow] = React84.useState(() => Date.now());
|
|
14389
14383
|
const running = status === "running" && startedAt != null;
|
|
14390
|
-
|
|
14384
|
+
React84.useEffect(() => {
|
|
14391
14385
|
if (!running) return;
|
|
14392
14386
|
const tick = setInterval(() => setNow(Date.now()), 1e3);
|
|
14393
14387
|
return () => clearInterval(tick);
|
|
@@ -14423,10 +14417,10 @@ function QueryResultCard({
|
|
|
14423
14417
|
}
|
|
14424
14418
|
|
|
14425
14419
|
// src/components/chat/CsvCard.tsx
|
|
14426
|
-
import * as
|
|
14420
|
+
import * as React86 from "react";
|
|
14427
14421
|
|
|
14428
14422
|
// src/kits/exports/exportState.ts
|
|
14429
|
-
import * as
|
|
14423
|
+
import * as React85 from "react";
|
|
14430
14424
|
|
|
14431
14425
|
// src/kits/exports/exportJob.ts
|
|
14432
14426
|
function isLiveExport(job) {
|
|
@@ -14450,9 +14444,9 @@ function exportStateOf(job, now) {
|
|
|
14450
14444
|
}
|
|
14451
14445
|
}
|
|
14452
14446
|
function useExpiryClock(job) {
|
|
14453
|
-
const [now, setNow] =
|
|
14447
|
+
const [now, setNow] = React85.useState(() => Date.now());
|
|
14454
14448
|
const { status, expiresAt } = job;
|
|
14455
|
-
|
|
14449
|
+
React85.useEffect(() => {
|
|
14456
14450
|
if (status !== "SUCCEEDED" || expiresAt === null) return;
|
|
14457
14451
|
const wait = Date.parse(expiresAt) - Date.now();
|
|
14458
14452
|
if (wait <= 0) return;
|
|
@@ -14462,14 +14456,14 @@ function useExpiryClock(job) {
|
|
|
14462
14456
|
return now;
|
|
14463
14457
|
}
|
|
14464
14458
|
function useLastListed(listed) {
|
|
14465
|
-
const [last, setLast] =
|
|
14459
|
+
const [last, setLast] = React85.useState(listed);
|
|
14466
14460
|
if (listed !== void 0 && listed !== last) setLast(listed);
|
|
14467
14461
|
return listed ?? last;
|
|
14468
14462
|
}
|
|
14469
14463
|
function useShownExport(held, exports, refresh2) {
|
|
14470
14464
|
const lastListed = useLastListed(exports.find((candidate) => candidate.id === held.id));
|
|
14471
14465
|
const unlisted = isLiveExport(held) && lastListed === void 0;
|
|
14472
|
-
|
|
14466
|
+
React85.useEffect(() => {
|
|
14473
14467
|
if (unlisted) refresh2();
|
|
14474
14468
|
}, [unlisted, refresh2]);
|
|
14475
14469
|
return isLiveExport(held) && lastListed !== void 0 ? lastListed : held;
|
|
@@ -14486,7 +14480,7 @@ var STATE = {
|
|
|
14486
14480
|
};
|
|
14487
14481
|
var CSV_FAILED_FALLBACK = "The CSV could not be made.";
|
|
14488
14482
|
function CsvCard({ job, keptNote, onDownload }) {
|
|
14489
|
-
const [downloading, setDownloading] =
|
|
14483
|
+
const [downloading, setDownloading] = React86.useState(false);
|
|
14490
14484
|
const now = useExpiryClock(job);
|
|
14491
14485
|
const state = exportStateOf(job, now);
|
|
14492
14486
|
const { label, tone } = STATE[state];
|
|
@@ -14519,7 +14513,7 @@ function CsvCard({ job, keptNote, onDownload }) {
|
|
|
14519
14513
|
}
|
|
14520
14514
|
|
|
14521
14515
|
// src/components/files/FileViewer.tsx
|
|
14522
|
-
import * as
|
|
14516
|
+
import * as React87 from "react";
|
|
14523
14517
|
import { jsx as jsx114, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
14524
14518
|
function previewKindOf(file) {
|
|
14525
14519
|
const mime = (file.mime || "").toLowerCase();
|
|
@@ -14576,13 +14570,13 @@ function parseDelimited(text, delimiter) {
|
|
|
14576
14570
|
return rows;
|
|
14577
14571
|
}
|
|
14578
14572
|
function usePreview(file, kind, resolveUrl) {
|
|
14579
|
-
const [state, setState] =
|
|
14580
|
-
const [attempt, setAttempt] =
|
|
14581
|
-
const resolveRef =
|
|
14582
|
-
|
|
14573
|
+
const [state, setState] = React87.useState({ status: "loading" });
|
|
14574
|
+
const [attempt, setAttempt] = React87.useState(0);
|
|
14575
|
+
const resolveRef = React87.useRef(resolveUrl);
|
|
14576
|
+
React87.useEffect(() => {
|
|
14583
14577
|
resolveRef.current = resolveUrl;
|
|
14584
14578
|
}, [resolveUrl]);
|
|
14585
|
-
|
|
14579
|
+
React87.useEffect(() => {
|
|
14586
14580
|
if (kind === "none") {
|
|
14587
14581
|
setState({ status: "ready" });
|
|
14588
14582
|
return;
|
|
@@ -14612,7 +14606,7 @@ function usePreview(file, kind, resolveUrl) {
|
|
|
14612
14606
|
if (ac) ac.abort();
|
|
14613
14607
|
};
|
|
14614
14608
|
}, [file.id, kind, attempt]);
|
|
14615
|
-
return { ...state, retry:
|
|
14609
|
+
return { ...state, retry: React87.useCallback(() => setAttempt((a) => a + 1), []) };
|
|
14616
14610
|
}
|
|
14617
14611
|
function PreviewBody({ file, kind, state }) {
|
|
14618
14612
|
if (kind === "image") return /* @__PURE__ */ jsx114("img", { className: "fd-fv-image", src: state.url, alt: file.name || "Preview" });
|
|
@@ -14657,13 +14651,13 @@ function PreviewBody({ file, kind, state }) {
|
|
|
14657
14651
|
] });
|
|
14658
14652
|
}
|
|
14659
14653
|
function FileViewer({ file, resolveUrl, sidePanel, sidePanelLabel = "Details", onClose, actions, className = "" }) {
|
|
14660
|
-
const kind =
|
|
14654
|
+
const kind = React87.useMemo(() => previewKindOf(file), [file]);
|
|
14661
14655
|
const preview = usePreview(file, kind, resolveUrl);
|
|
14662
|
-
const [tab, setTab] =
|
|
14663
|
-
const [downloading, setDownloading] =
|
|
14664
|
-
const [downloadError, setDownloadError] =
|
|
14656
|
+
const [tab, setTab] = React87.useState("preview");
|
|
14657
|
+
const [downloading, setDownloading] = React87.useState(false);
|
|
14658
|
+
const [downloadError, setDownloadError] = React87.useState(null);
|
|
14665
14659
|
const hasSide = sidePanel != null;
|
|
14666
|
-
|
|
14660
|
+
React87.useEffect(() => {
|
|
14667
14661
|
setTab("preview");
|
|
14668
14662
|
}, [file.id]);
|
|
14669
14663
|
const download = () => {
|
|
@@ -14730,7 +14724,7 @@ function FileViewer({ file, resolveUrl, sidePanel, sidePanelLabel = "Details", o
|
|
|
14730
14724
|
}
|
|
14731
14725
|
|
|
14732
14726
|
// src/components/files/FileBrowser.tsx
|
|
14733
|
-
import * as
|
|
14727
|
+
import * as React88 from "react";
|
|
14734
14728
|
import { Fragment as Fragment35, jsx as jsx115, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
14735
14729
|
function childrenOf(folders, parentId) {
|
|
14736
14730
|
return folders.filter((f) => f.parentId === parentId).sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -14840,8 +14834,8 @@ function FolderPickerMenu({
|
|
|
14840
14834
|
] });
|
|
14841
14835
|
}
|
|
14842
14836
|
function RowShell({ icon, name, meta, onOpen, draggableId, isDropTarget, onDropPayload, actions, className = "" }) {
|
|
14843
|
-
const [over, setOver] =
|
|
14844
|
-
const dragCounter =
|
|
14837
|
+
const [over, setOver] = React88.useState(false);
|
|
14838
|
+
const dragCounter = React88.useRef(0);
|
|
14845
14839
|
const dropHandlers = isDropTarget ? {
|
|
14846
14840
|
onDragEnter: (e) => {
|
|
14847
14841
|
if (!hasInternalPayload(e)) return;
|
|
@@ -14889,8 +14883,8 @@ function RowShell({ icon, name, meta, onOpen, draggableId, isDropTarget, onDropP
|
|
|
14889
14883
|
}
|
|
14890
14884
|
function TreeNode({ folder, depth, folders, currentFolderId, onNavigate, onMoveInto, canMove }) {
|
|
14891
14885
|
const kids = childrenOf(folders, folder.id);
|
|
14892
|
-
const [expanded, setExpanded] =
|
|
14893
|
-
|
|
14886
|
+
const [expanded, setExpanded] = React88.useState(() => currentFolderId != null && isSelfOrDescendant(folders, folder.id, currentFolderId));
|
|
14887
|
+
React88.useEffect(() => {
|
|
14894
14888
|
if (currentFolderId != null && isSelfOrDescendant(folders, folder.id, currentFolderId)) setExpanded(true);
|
|
14895
14889
|
}, [currentFolderId, folder.id, folders]);
|
|
14896
14890
|
const isCurrent = folder.id === currentFolderId;
|
|
@@ -14956,15 +14950,15 @@ function FileBrowser({
|
|
|
14956
14950
|
const canUpload = perm.canUpload !== false && !!onUpload;
|
|
14957
14951
|
const canRemoveFile = perm.canRemoveFile !== false && !!onRemoveFile;
|
|
14958
14952
|
const canDeleteFolder = perm.canDeleteFolder !== false && !!onDeleteFolder;
|
|
14959
|
-
const [createOpen, setCreateOpen] =
|
|
14960
|
-
const [createName, setCreateName] =
|
|
14961
|
-
const [renameTarget, setRenameTarget] =
|
|
14962
|
-
const [renameValue, setRenameValue] =
|
|
14963
|
-
const [deleteTarget, setDeleteTarget] =
|
|
14964
|
-
const uploadInputRef =
|
|
14965
|
-
const crumbFolders =
|
|
14966
|
-
const subfolders =
|
|
14967
|
-
const currentFiles =
|
|
14953
|
+
const [createOpen, setCreateOpen] = React88.useState(false);
|
|
14954
|
+
const [createName, setCreateName] = React88.useState("");
|
|
14955
|
+
const [renameTarget, setRenameTarget] = React88.useState(null);
|
|
14956
|
+
const [renameValue, setRenameValue] = React88.useState("");
|
|
14957
|
+
const [deleteTarget, setDeleteTarget] = React88.useState(null);
|
|
14958
|
+
const uploadInputRef = React88.useRef(null);
|
|
14959
|
+
const crumbFolders = React88.useMemo(() => ancestorsOf(folders, currentFolderId), [folders, currentFolderId]);
|
|
14960
|
+
const subfolders = React88.useMemo(() => childrenOf(folders, currentFolderId), [folders, currentFolderId]);
|
|
14961
|
+
const currentFiles = React88.useMemo(
|
|
14968
14962
|
() => files.filter((f) => f.folderId === currentFolderId).sort((a, b) => a.name.localeCompare(b.name)),
|
|
14969
14963
|
[files, currentFolderId]
|
|
14970
14964
|
);
|
|
@@ -15196,8 +15190,8 @@ function BreadcrumbCrumb({
|
|
|
15196
15190
|
isDropTarget,
|
|
15197
15191
|
onDropPayload
|
|
15198
15192
|
}) {
|
|
15199
|
-
const [over, setOver] =
|
|
15200
|
-
const dragCounter =
|
|
15193
|
+
const [over, setOver] = React88.useState(false);
|
|
15194
|
+
const dragCounter = React88.useRef(0);
|
|
15201
15195
|
const dropHandlers = isDropTarget ? {
|
|
15202
15196
|
onDragEnter: (e) => {
|
|
15203
15197
|
if (!hasInternalPayload(e)) return;
|
|
@@ -15226,7 +15220,7 @@ function BreadcrumbCrumb({
|
|
|
15226
15220
|
}
|
|
15227
15221
|
|
|
15228
15222
|
// src/kits/sessionAdapter.ts
|
|
15229
|
-
import * as
|
|
15223
|
+
import * as React89 from "react";
|
|
15230
15224
|
function toSwitcherEntries(apps, currentAppKey) {
|
|
15231
15225
|
return apps.filter((app) => app.url != null).map((app) => ({
|
|
15232
15226
|
key: app.key,
|
|
@@ -15240,7 +15234,7 @@ function useSessionContextValue(session, { currentAppKey }) {
|
|
|
15240
15234
|
const { user, apps, signOut, status } = session;
|
|
15241
15235
|
const authorized = status === "authenticated";
|
|
15242
15236
|
const pending = status === "unavailable";
|
|
15243
|
-
return
|
|
15237
|
+
return React89.useMemo(
|
|
15244
15238
|
() => ({
|
|
15245
15239
|
user: { id: user.id, name: user.name, email: user.email, sso: true },
|
|
15246
15240
|
roles: user.roles.map((r) => ({ id: r.key, name: r.name })),
|
|
@@ -15261,7 +15255,7 @@ function useSessionContextValue(session, { currentAppKey }) {
|
|
|
15261
15255
|
}
|
|
15262
15256
|
|
|
15263
15257
|
// src/kits/query.ts
|
|
15264
|
-
import * as
|
|
15258
|
+
import * as React90 from "react";
|
|
15265
15259
|
|
|
15266
15260
|
// src/kits/queryUrl.ts
|
|
15267
15261
|
var historyUrlAdapter = {
|
|
@@ -15399,38 +15393,38 @@ function requestFor(params, query, paging, after) {
|
|
|
15399
15393
|
}
|
|
15400
15394
|
var toError = (e) => e instanceof Error ? e : new Error(String(e));
|
|
15401
15395
|
function useServerTable({ endpoint, params, defaults, deps, prefsKey, paging = "page", url }) {
|
|
15402
|
-
const [base] =
|
|
15396
|
+
const [base] = React90.useState(() => {
|
|
15403
15397
|
const store = PREFS || window.PlannerPrefs;
|
|
15404
15398
|
const saved = prefsKey && store ? store.getTable(prefsKey) : {};
|
|
15405
15399
|
return { ...DEFAULTS, ...defaults || {}, ...saved.pageSize ? { pageSize: saved.pageSize } : {}, ...saved.sort ? { sort: saved.sort, dir: saved.dir || "desc" } : {} };
|
|
15406
15400
|
});
|
|
15407
|
-
const [mountParams] =
|
|
15408
|
-
const address =
|
|
15409
|
-
const [query, setQuery] =
|
|
15410
|
-
const savePref =
|
|
15401
|
+
const [mountParams] = React90.useState(() => url ? (url.adapter ?? historyUrlAdapter).read() : null);
|
|
15402
|
+
const address = React90.useRef(mountParams);
|
|
15403
|
+
const [query, setQuery] = React90.useState(() => url && mountParams ? readQueryFromUrl(mountParams, url.scope, base, paging) : base);
|
|
15404
|
+
const savePref = React90.useCallback((patch2) => {
|
|
15411
15405
|
const store = PREFS || window.PlannerPrefs;
|
|
15412
15406
|
if (prefsKey && store) store.setTable(prefsKey, patch2);
|
|
15413
15407
|
}, [prefsKey]);
|
|
15414
|
-
const [res, setRes] =
|
|
15415
|
-
const [loading, setLoading] =
|
|
15416
|
-
const [loadingMore, setLoadingMore] =
|
|
15417
|
-
const [failure, setFailure] =
|
|
15418
|
-
const [reloadToken, setReloadToken] =
|
|
15419
|
-
const moreController =
|
|
15408
|
+
const [res, setRes] = React90.useState(null);
|
|
15409
|
+
const [loading, setLoading] = React90.useState(true);
|
|
15410
|
+
const [loadingMore, setLoadingMore] = React90.useState(false);
|
|
15411
|
+
const [failure, setFailure] = React90.useState(null);
|
|
15412
|
+
const [reloadToken, setReloadToken] = React90.useState(0);
|
|
15413
|
+
const moreController = React90.useRef(null);
|
|
15420
15414
|
const depKey = (deps || []).join("|");
|
|
15421
15415
|
const paramKey = JSON.stringify(params || {});
|
|
15422
15416
|
const queryKey = JSON.stringify(query);
|
|
15423
|
-
const lifetime =
|
|
15424
|
-
|
|
15417
|
+
const lifetime = React90.useRef(null);
|
|
15418
|
+
React90.useEffect(() => {
|
|
15425
15419
|
const controller = new AbortController();
|
|
15426
15420
|
lifetime.current = controller;
|
|
15427
15421
|
return () => controller.abort();
|
|
15428
15422
|
}, []);
|
|
15429
|
-
const latest =
|
|
15430
|
-
|
|
15423
|
+
const latest = React90.useRef({ res, loading, query, params, endpoint, url, base });
|
|
15424
|
+
React90.useLayoutEffect(() => {
|
|
15431
15425
|
latest.current = { res, loading, query, params, endpoint, url, base };
|
|
15432
15426
|
});
|
|
15433
|
-
|
|
15427
|
+
React90.useEffect(() => {
|
|
15434
15428
|
const controller = new AbortController();
|
|
15435
15429
|
const { signal } = controller;
|
|
15436
15430
|
setLoading(true);
|
|
@@ -15466,7 +15460,7 @@ function useServerTable({ endpoint, params, defaults, deps, prefsKey, paging = "
|
|
|
15466
15460
|
};
|
|
15467
15461
|
}, [endpoint, queryKey, paramKey, depKey, paging, reloadToken]);
|
|
15468
15462
|
const adapter = url ? url.adapter ?? historyUrlAdapter : null;
|
|
15469
|
-
|
|
15463
|
+
React90.useEffect(() => {
|
|
15470
15464
|
if (!adapter) return;
|
|
15471
15465
|
return adapter.subscribe((params2) => {
|
|
15472
15466
|
const { url: u, base: b } = latest.current;
|
|
@@ -15816,12 +15810,12 @@ function createVersionStore(initialState, options) {
|
|
|
15816
15810
|
}
|
|
15817
15811
|
|
|
15818
15812
|
// src/kits/documentTitle.ts
|
|
15819
|
-
import * as
|
|
15813
|
+
import * as React91 from "react";
|
|
15820
15814
|
function formatDocumentTitle(routeTitle, appName) {
|
|
15821
15815
|
return [routeTitle, appName, "Flytedesk"].filter((part2) => !!part2 && part2.length > 0).join(" \xB7 ");
|
|
15822
15816
|
}
|
|
15823
15817
|
function useDocumentTitle(routeTitle, appName) {
|
|
15824
|
-
|
|
15818
|
+
React91.useEffect(() => {
|
|
15825
15819
|
if (typeof document === "undefined") return;
|
|
15826
15820
|
document.title = formatDocumentTitle(routeTitle, appName);
|
|
15827
15821
|
}, [routeTitle, appName]);
|
|
@@ -15924,17 +15918,17 @@ function createChatAdapter(transport, { onTurnStarted, deadlineMs = CHAT_CALL_DE
|
|
|
15924
15918
|
}
|
|
15925
15919
|
|
|
15926
15920
|
// src/kits/chatTransport/useChatThreads.ts
|
|
15927
|
-
import * as
|
|
15921
|
+
import * as React92 from "react";
|
|
15928
15922
|
var THREADS_LOAD_FAILED = "Your earlier conversations could not be loaded.";
|
|
15929
15923
|
var NEW_THREAD_FAILED = "A new conversation could not be started.";
|
|
15930
15924
|
function useChatThreads(transport, { deadlineMs = CHAT_CALL_DEADLINE_MS } = {}) {
|
|
15931
15925
|
const toast = useToast();
|
|
15932
|
-
const [threads, setThreads] =
|
|
15933
|
-
const [reads, setReads] =
|
|
15926
|
+
const [threads, setThreads] = React92.useState([]);
|
|
15927
|
+
const [reads, setReads] = React92.useState(0);
|
|
15934
15928
|
const transportRef = useLatest(transport);
|
|
15935
15929
|
const deadlineRef = useLatest(deadlineMs);
|
|
15936
|
-
const refresh2 =
|
|
15937
|
-
|
|
15930
|
+
const refresh2 = React92.useCallback(() => setReads((n) => n + 1), []);
|
|
15931
|
+
React92.useEffect(() => {
|
|
15938
15932
|
const controller = new AbortController();
|
|
15939
15933
|
const { signal } = controller;
|
|
15940
15934
|
withDeadline("listThreads", deadlineRef.current, transportRef.current.listThreads(signal)).then(
|
|
@@ -15947,7 +15941,7 @@ function useChatThreads(transport, { deadlineMs = CHAT_CALL_DEADLINE_MS } = {})
|
|
|
15947
15941
|
);
|
|
15948
15942
|
return () => controller.abort();
|
|
15949
15943
|
}, [reads, toast, transportRef, deadlineRef]);
|
|
15950
|
-
const startNewThread =
|
|
15944
|
+
const startNewThread = React92.useCallback(
|
|
15951
15945
|
(onCreated) => withDeadline("createThread", deadlineRef.current, transportRef.current.createThread()).then(
|
|
15952
15946
|
({ thread_id }) => {
|
|
15953
15947
|
onCreated(thread_id);
|
|
@@ -15975,15 +15969,15 @@ function createExportDownloader({
|
|
|
15975
15969
|
}
|
|
15976
15970
|
|
|
15977
15971
|
// src/kits/exports/useExportJobs.ts
|
|
15978
|
-
import * as
|
|
15972
|
+
import * as React93 from "react";
|
|
15979
15973
|
var EXPORT_POLL_INTERVAL_MS = 3e3;
|
|
15980
15974
|
var EXPORT_IDLE_POLL_INTERVAL_MS = 3e4;
|
|
15981
15975
|
function useExportJobs({ list, acknowledge }) {
|
|
15982
|
-
const [rows, setRows] =
|
|
15976
|
+
const [rows, setRows] = React93.useState([]);
|
|
15983
15977
|
const listRef = useLatest(list);
|
|
15984
15978
|
const acknowledgeRef = useLatest(acknowledge);
|
|
15985
|
-
const dismissing =
|
|
15986
|
-
const reload =
|
|
15979
|
+
const dismissing = React93.useRef(/* @__PURE__ */ new Set());
|
|
15980
|
+
const reload = React93.useCallback(
|
|
15987
15981
|
() => listRef.current().then(
|
|
15988
15982
|
(fresh) => setRows(fresh.filter((row) => !dismissing.current.has(row.id))),
|
|
15989
15983
|
() => {
|
|
@@ -15991,16 +15985,16 @@ function useExportJobs({ list, acknowledge }) {
|
|
|
15991
15985
|
),
|
|
15992
15986
|
[listRef]
|
|
15993
15987
|
);
|
|
15994
|
-
|
|
15988
|
+
React93.useEffect(() => {
|
|
15995
15989
|
void reload();
|
|
15996
15990
|
}, [reload]);
|
|
15997
15991
|
const anyLive = rows.some(isLiveExport);
|
|
15998
|
-
|
|
15992
|
+
React93.useEffect(() => {
|
|
15999
15993
|
const timer = setInterval(() => void reload(), anyLive ? EXPORT_POLL_INTERVAL_MS : EXPORT_IDLE_POLL_INTERVAL_MS);
|
|
16000
15994
|
return () => clearInterval(timer);
|
|
16001
15995
|
}, [anyLive, reload]);
|
|
16002
|
-
const refresh2 =
|
|
16003
|
-
const ackExport =
|
|
15996
|
+
const refresh2 = React93.useCallback(() => void reload(), [reload]);
|
|
15997
|
+
const ackExport = React93.useCallback(
|
|
16004
15998
|
(id) => {
|
|
16005
15999
|
dismissing.current.add(id);
|
|
16006
16000
|
setRows((current2) => current2.filter((row) => row.id !== id));
|
|
@@ -16022,7 +16016,7 @@ function useExportJobs({ list, acknowledge }) {
|
|
|
16022
16016
|
}
|
|
16023
16017
|
|
|
16024
16018
|
// src/kits/exports/ExportTray.tsx
|
|
16025
|
-
import * as
|
|
16019
|
+
import * as React94 from "react";
|
|
16026
16020
|
import { jsx as jsx116 } from "react/jsx-runtime";
|
|
16027
16021
|
var EXPORT_FAILED_FALLBACK = "Unknown error.";
|
|
16028
16022
|
function exportToJob(job, keptNote, onDownload) {
|
|
@@ -16041,7 +16035,7 @@ function exportToJob(job, keptNote, onDownload) {
|
|
|
16041
16035
|
return { ...base, status: "active" };
|
|
16042
16036
|
}
|
|
16043
16037
|
function ExportTray({ exports, keptNote, onDownload, onDismiss }) {
|
|
16044
|
-
const jobs2 =
|
|
16038
|
+
const jobs2 = React94.useMemo(() => exports.map((job) => exportToJob(job, keptNote, onDownload)), [exports, keptNote, onDownload]);
|
|
16045
16039
|
return /* @__PURE__ */ jsx116(JobTray, { jobs: jobs2, onDismiss });
|
|
16046
16040
|
}
|
|
16047
16041
|
export {
|