@flytedan/flytebot-design-system 0.87.4 → 0.87.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2788,7 +2788,7 @@ var JOBS_LAYER = ROOT_STEP - 1;
2788
2788
  var SLOTS = ["jobs", "toasts"];
2789
2789
  var references = /* @__PURE__ */ new Map();
2790
2790
  var host = null;
2791
- var hostObserver = null;
2791
+ var jobsObserver = null;
2792
2792
  var slotElements = /* @__PURE__ */ new Map();
2793
2793
  var SLOT_LAYERS = { jobs: JOBS_LAYER, toasts: OVERLAY_CEILING };
2794
2794
  function createHost() {
@@ -2806,8 +2806,8 @@ function createHost() {
2806
2806
  const jobs2 = slotElements.get("jobs");
2807
2807
  publishInset(jobs2);
2808
2808
  if (typeof ResizeObserver === "function") {
2809
- hostObserver = new ResizeObserver(() => publishInset(jobs2));
2810
- hostObserver.observe(jobs2);
2809
+ jobsObserver = new ResizeObserver(() => publishInset(jobs2));
2810
+ jobsObserver.observe(jobs2);
2811
2811
  }
2812
2812
  return stack;
2813
2813
  }
@@ -2826,8 +2826,8 @@ function release(slot) {
2826
2826
  if (remaining > 0) references.set(slot, remaining);
2827
2827
  else references.delete(slot);
2828
2828
  if (references.size === 0 && host) {
2829
- hostObserver?.disconnect();
2830
- hostObserver = null;
2829
+ jobsObserver?.disconnect();
2830
+ jobsObserver = null;
2831
2831
  document.documentElement.style.removeProperty(CORNER_STACK_INSET_PROPERTY);
2832
2832
  host.remove();
2833
2833
  host = null;
@@ -2877,7 +2877,14 @@ function useSheetOpenMark(active) {
2877
2877
 
2878
2878
  // src/components/loading/ProgressBar.tsx
2879
2879
  var import_jsx_runtime19 = require("react/jsx-runtime");
2880
- function ProgressBar({ value, label, showValue = false, className = "", ...rest }) {
2880
+ function ProgressBar({
2881
+ value,
2882
+ label,
2883
+ "aria-label": ariaLabel = label,
2884
+ showValue = false,
2885
+ className = "",
2886
+ ...rest
2887
+ }) {
2881
2888
  const indeterminate = value === void 0 || value === null;
2882
2889
  const pct = indeterminate ? 0 : Math.max(0, Math.min(100, value));
2883
2890
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: ["fd-stack", className].filter(Boolean).join(" "), style: { gap: 8 }, children: [
@@ -2896,7 +2903,7 @@ function ProgressBar({ value, label, showValue = false, className = "", ...rest
2896
2903
  "aria-valuenow": indeterminate ? void 0 : pct,
2897
2904
  "aria-valuemin": 0,
2898
2905
  "aria-valuemax": 100,
2899
- "aria-label": label,
2906
+ "aria-label": ariaLabel,
2900
2907
  ...rest,
2901
2908
  children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "fd-progress-fill", style: indeterminate ? void 0 : { width: pct + "%" } })
2902
2909
  }
@@ -2955,7 +2962,7 @@ function JobCard({ job, onDismiss }) {
2955
2962
  ] }),
2956
2963
  job.note ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "fd-job-card-note fd-secondary", children: job.note }) : null,
2957
2964
  job.status === "active" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "fd-job-card-progress", children: [
2958
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ProgressBar, { value: job.progress, label: title }),
2965
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ProgressBar, { value: job.progress, "aria-label": title }),
2959
2966
  job.progressNote ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "fd-job-card-note fd-secondary", children: job.progressNote }) : null
2960
2967
  ] }) : null,
2961
2968
  job.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "fd-job-card-done", children: [
@@ -17494,9 +17501,10 @@ function useExportJobs({ list, acknowledge }) {
17494
17501
  const [rows, setRows] = React95.useState([]);
17495
17502
  const listRef = useLatest(list);
17496
17503
  const acknowledgeRef = useLatest(acknowledge);
17504
+ const dismissing = React95.useRef(/* @__PURE__ */ new Set());
17497
17505
  const reload = React95.useCallback(
17498
17506
  () => listRef.current().then(
17499
- (fresh) => setRows(fresh),
17507
+ (fresh) => setRows(fresh.filter((row) => !dismissing.current.has(row.id))),
17500
17508
  () => {
17501
17509
  }
17502
17510
  ),
@@ -17513,8 +17521,19 @@ function useExportJobs({ list, acknowledge }) {
17513
17521
  const refresh2 = React95.useCallback(() => void reload(), [reload]);
17514
17522
  const ackExport = React95.useCallback(
17515
17523
  (id) => {
17524
+ dismissing.current.add(id);
17516
17525
  setRows((current2) => current2.filter((row) => row.id !== id));
17517
- void acknowledgeRef.current(id).then(reload, reload);
17526
+ void acknowledgeRef.current(id).then(
17527
+ () => {
17528
+ dismissing.current.delete(id);
17529
+ return reload();
17530
+ },
17531
+ (error) => {
17532
+ dismissing.current.delete(id);
17533
+ console.error(`Dismissing export ${id} failed; it is back in the tray.`, error);
17534
+ return reload();
17535
+ }
17536
+ );
17518
17537
  },
17519
17538
  [acknowledgeRef, reload]
17520
17539
  );