strata-react 1.0.40 → 1.0.42

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.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { a as Textarea, c as Tooltip, d as typeSteps, i as NativeSelect, l as KeyText, n as Field, o as useFieldControl, r as Input, s as controlHeight, t as ChoiceGroup, u as cn } from "./field-DeKNvGox.js";
2
2
  import { a as toDate, i as format, n as NBSP, r as createFormat, t as MISSING } from "./format-B32-PVi2.js";
3
- import { a as useAsyncAction, c as KeysLegend, d as useInView, i as AsyncButton, l as isTypingTarget, n as NumberField, o as Toolbar, r as Slider, s as ToolbarSeparator, t as ColorField, u as useHotkeys } from "./value-controls-FO4zQiHP.js";
4
- import { a as readErrorBody, c as RowAction, i as fieldErrorsOf, l as buttonVariants, n as describeActionError, o as Button, r as describeHttpError, s as IconButton, t as HttpError } from "./errors-BunUBqpA.js";
5
- import { a as toLoad, c as toast, i as staleOf, l as toastTimeout, n as createQueryClient, o as useLoad, r as fetchJson, s as StrataToastRegion, t as StrataQueryProvider, u as overlaySurface } from "./query-D163gXXZ.js";
3
+ import { a as useAsyncAction, c as KeysLegend, d as useInView, i as AsyncButton, l as isTypingTarget, n as NumberField, o as Toolbar, r as Slider, s as ToolbarSeparator, t as ColorField, u as useHotkeys } from "./value-controls-DxbyeTQd.js";
4
+ import { a as readErrorBody, c as RowAction, i as fieldErrorsOf, l as buttonVariants, n as describeActionError, o as Button, r as describeHttpError, s as IconButton, t as HttpError, u as isDev } from "./errors-ByjNcEDc.js";
5
+ import { a as toLoad, c as toast, i as staleOf, l as toastTimeout, n as createQueryClient, o as useLoad, r as fetchJson, s as StrataToastRegion, t as StrataQueryProvider, u as overlaySurface } from "./query-ib0ScvU2.js";
6
6
  import { n as useSharedCursor, r as geo, t as CursorScope } from "./cursor-DDGBPiTJ.js";
7
7
  import { a as useColorScheme, i as colorSchemeScript, n as ColorSchemeChoice, o as useSystemColorScheme, r as ThemeProvider, s as Density, t as COLOR_SCHEME_STORAGE_KEY } from "./theme-DVaIxyNn.js";
8
8
  import * as React from "react";
@@ -177,6 +177,19 @@ function useCommands(commands, { enabled = true, platform } = {}) {
177
177
  window.addEventListener("keydown", onKeyDown);
178
178
  return () => window.removeEventListener("keydown", onKeyDown);
179
179
  }, [enabled, where]);
180
+ if (isDev()) warnOnClashes(commands, where);
181
+ }
182
+ function warnOnClashes(commands, platform) {
183
+ const seen = /* @__PURE__ */ new Map();
184
+ for (const c of commands) {
185
+ for (const k of c.keys ?? []) {
186
+ const shown = formatChord(k, platform);
187
+ const other = seen.get(shown);
188
+ if (other && other !== c.id) console.warn(`strata-react: "${shown}" is bound to both "${other}" and "${c.id}"; the first wins.`);
189
+ else seen.set(shown, c.id);
190
+ }
191
+ if (c.keys?.some((k) => isReservedChord(k, platform)) && !c.claim) console.warn(`strata-react: "${c.id}" uses a chord the browser keeps for itself; add \`claim: true\` to take it over.`);
192
+ }
180
193
  }
181
194
  /** The shortcut a command shows in menus and legends ("⌘Z", "Ctrl+Z"), or undefined. */
182
195
  function commandShortcut(c, platform = detectPlatform()) {
@@ -3450,7 +3463,7 @@ var keyPlayers = (() => {
3450
3463
  get: () => snapshot,
3451
3464
  add(id) {
3452
3465
  ids.add(id);
3453
- if (ids.size === 2 && !warned && typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
3466
+ if (ids.size === 2 && !warned && isDev()) {
3454
3467
  warned = true;
3455
3468
  console.warn("strata-react: several MediaPlayers are on this page, so Space, K, J, L and M go to the one last played or focused. Pass shortcuts={false} to one you bind your own keys for.");
3456
3469
  }
@@ -8287,6 +8300,98 @@ function frameBoxToShares(rect, v, frame) {
8287
8300
  }
8288
8301
  // src/components/compare-parts.tsx
8289
8302
  var VIEWPORT_HEIGHT = "max(16rem, calc(100svh - 14rem))";
8303
+ /** The tallest each row of frames may be so that all of `chrome` and `rows` rows fit in `space` pixels. Pure, so it is tested without a layout. */
8304
+ function fitFrames({ space, chrome, rows, min = 120 }) {
8305
+ return Math.max(min, Math.floor((space - chrome) / Math.max(1, rows)));
8306
+ }
8307
+ /** Frame cap for what the caller asked for: a measured height for `"fit"` and in full screen (whatever the caller passed, so the frame fills what the controls leave), the guess for `"viewport"`, the caller's own length otherwise. */
8308
+ function frameCap(maxHeight, fit, full) {
8309
+ if ((maxHeight === "fit" || full) && fit !== null) return `${fit}px`;
8310
+ return maxHeight === "viewport" || maxHeight === "fit" ? VIEWPORT_HEIGHT : maxHeight;
8311
+ }
8312
+ /**
8313
+ * How tall each frame may be for the pair and everything around it to fit the window (issue #229), measured, not
8314
+ * guessed. In the page: the window's height from the top of `root` (as the page is at its top), less what `root` draws
8315
+ * besides its frames (toolbar, captions, footer, legend: the bottom of its last child, not its height, which a stretched
8316
+ * full-screen section would inflate), less what follows it (later siblings of it and of its ancestors, then `reserve` for
8317
+ * padding and gaps the caller knows). In full screen: the window from the top of `root`, nothing after. Divided by the
8318
+ * rows of frames (side by side is one row; below `sm` it is two) and floored at `MIN_FIT`. Frames are found by
8319
+ * `data-viewport-frame`, so an app never queries for them. Null until measured, or when `enabled` is false.
8320
+ */
8321
+ function useFitHeight(root, { enabled, full, reserve = 0 }) {
8322
+ const [fit, setFit] = React.useState(null);
8323
+ React.useLayoutEffect(() => {
8324
+ if (!enabled) {
8325
+ setFit(null);
8326
+ return;
8327
+ }
8328
+ const el = root.current;
8329
+ if (!el) return;
8330
+ const measure = () => {
8331
+ const frames = [...el.querySelectorAll("[data-viewport-frame]")].map((f) => f.getBoundingClientRect());
8332
+ if (!frames.length) return;
8333
+ const top = el.getBoundingClientRect().top;
8334
+ const rows = [];
8335
+ for (const r of frames) {
8336
+ const row = rows.find((x) => Math.abs(x.top - r.top) < 2);
8337
+ if (row) row.height = Math.max(row.height, r.height);
8338
+ else rows.push({
8339
+ top: r.top,
8340
+ height: r.height
8341
+ });
8342
+ }
8343
+ const chrome = Math.max(el.lastElementChild?.getBoundingClientRect().bottom ?? 0, ...frames.map((r) => r.bottom)) - top - rows.reduce((sum, r) => sum + r.height, 0);
8344
+ const windowHeight = document.documentElement.clientHeight;
8345
+ let space;
8346
+ if (full) {
8347
+ const pad = el.parentElement ? parseFloat(getComputedStyle(el.parentElement).paddingBottom) || 0 : 0;
8348
+ space = windowHeight - top - pad;
8349
+ } else {
8350
+ let after = 0;
8351
+ for (let n = el; n && n !== document.body; n = n.parentElement) for (let sib = n.nextElementSibling; sib; sib = sib.nextElementSibling) {
8352
+ const position = getComputedStyle(sib).position;
8353
+ if (position !== "fixed" && position !== "absolute") after += sib.getBoundingClientRect().height;
8354
+ }
8355
+ space = windowHeight - (top + window.scrollY) - after - reserve;
8356
+ }
8357
+ const next = fitFrames({
8358
+ space,
8359
+ chrome,
8360
+ rows: rows.length
8361
+ });
8362
+ setFit((was) => was !== null && Math.abs(was - next) <= 1 ? was : next);
8363
+ };
8364
+ let frame = 0;
8365
+ const schedule = () => {
8366
+ cancelAnimationFrame(frame);
8367
+ frame = requestAnimationFrame(measure);
8368
+ };
8369
+ measure();
8370
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(schedule);
8371
+ observer?.observe(el);
8372
+ observer?.observe(document.body);
8373
+ const changes = new MutationObserver(schedule);
8374
+ changes.observe(el, {
8375
+ childList: true,
8376
+ subtree: true
8377
+ });
8378
+ window.addEventListener("resize", schedule);
8379
+ document.addEventListener("fullscreenchange", schedule);
8380
+ return () => {
8381
+ cancelAnimationFrame(frame);
8382
+ observer?.disconnect();
8383
+ changes.disconnect();
8384
+ window.removeEventListener("resize", schedule);
8385
+ document.removeEventListener("fullscreenchange", schedule);
8386
+ };
8387
+ }, [
8388
+ root,
8389
+ enabled,
8390
+ full,
8391
+ reserve
8392
+ ]);
8393
+ return fit;
8394
+ }
8290
8395
  /** What a pair's frames do with a click (issue #201): the same answer as the keys, only where a click is unambiguous. Blind: only a candidate's `label` is ever said. */
8291
8396
  function makePicker(a, b, onPick, words) {
8292
8397
  const choose = words?.choose ?? ((label) => `Click to choose ${label}`);
@@ -8373,7 +8478,7 @@ function Picture({ c, blind, missing, onNatural, imgRef, pixelated }) {
8373
8478
  style: pixelated ? { imageRendering: "pixelated" } : void 0,
8374
8479
  onLoad: (e) => {
8375
8480
  setState("ready");
8376
- onNatural?.(e.currentTarget.naturalWidth, e.currentTarget.naturalHeight);
8481
+ if (e.currentTarget.naturalWidth && e.currentTarget.naturalHeight) onNatural?.(e.currentTarget.naturalWidth, e.currentTarget.naturalHeight);
8377
8482
  },
8378
8483
  onError: () => setState("failed"),
8379
8484
  className: "absolute inset-0 size-full object-contain"
@@ -8723,6 +8828,7 @@ var ViewportFrame = React.forwardRef(function ViewportFrame({ label, aspect, vie
8723
8828
  return /* @__PURE__ */ jsxs("div", {
8724
8829
  ref,
8725
8830
  role: "group",
8831
+ "data-viewport-frame": "",
8726
8832
  "aria-label": label,
8727
8833
  "aria-roledescription": "zoomable picture",
8728
8834
  tabIndex: 0,
@@ -9034,7 +9140,7 @@ var ALL_MODES = [
9034
9140
  "difference"
9035
9141
  ];
9036
9142
  /** Two pictures to judge, side by side or laid over each other, zoomed and panned together, and full screen. */
9037
- function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_MODES, regions, onPick, pick = true, pickWords, keys = true, extraShortcuts = [], footer, maxHeight, cannotCompare = "Could not read these pictures to compare their pixels.", readPixels, defaultDifference = "brightness", className }) {
9143
+ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_MODES, regions, onPick, pick = true, pickWords, keys = true, extraShortcuts = [], footer, maxHeight, reserve, cannotCompare = "Could not read these pictures to compare their pixels.", readPixels, defaultDifference = "brightness", className }) {
9038
9144
  const { viewport, setViewport } = useViewport();
9039
9145
  const [full, setFull] = React.useState(false);
9040
9146
  const pairKey = `${a.media.src}|${b.media.src}`;
@@ -9050,6 +9156,12 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
9050
9156
  const frameRef = React.useRef(null);
9051
9157
  const imgRef = React.useRef(null);
9052
9158
  const aspect = natural ? natural[0] / natural[1] : 3 / 2;
9159
+ const sectionRef = React.useRef(null);
9160
+ const fit = useFitHeight(sectionRef, {
9161
+ enabled: maxHeight === "fit" || full,
9162
+ full,
9163
+ reserve
9164
+ });
9053
9165
  const rg = useRegions({
9054
9166
  regions,
9055
9167
  viewport,
@@ -9101,7 +9213,7 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
9101
9213
  onBox: rg.add,
9102
9214
  outline: rg.peek,
9103
9215
  aspect,
9104
- maxHeight: maxHeight === "viewport" ? VIEWPORT_HEIGHT : maxHeight
9216
+ maxHeight: frameCap(maxHeight, fit, full)
9105
9217
  };
9106
9218
  let body;
9107
9219
  if (mode === "side") body = /* @__PURE__ */ jsx("div", {
@@ -9233,6 +9345,7 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
9233
9345
  onActiveChange: setFull,
9234
9346
  className,
9235
9347
  children: /* @__PURE__ */ jsxs("section", {
9348
+ ref: sectionRef,
9236
9349
  "aria-label": label,
9237
9350
  className: cn("grid gap-3", full && "min-h-0 flex-1 content-start overflow-auto"),
9238
9351
  children: [
@@ -10533,7 +10646,7 @@ var MODE_LABEL = {
10533
10646
  blink: "Blink"
10534
10647
  };
10535
10648
  /** Two videos to judge by eye on one clock: side by side, swipe, fade or blink, zoomed together, with matched sound and full screen. */
10536
- function CompareVideo({ label, a, b, blind, missing, mode, onModeChange, rates = SLOW_RATES, regions, moments = [], loop: loopProp, onLoopChange, audio = "a", onPick, pick = true, pickWords, autoPlay = false, loopWhole = false, pixelated = "zoomed", maxHeight, keys = true, extraShortcuts = [], footer, className }) {
10649
+ function CompareVideo({ label, a, b, blind, missing, mode, onModeChange, rates = SLOW_RATES, regions, moments = [], loop: loopProp, onLoopChange, audio = "a", onPick, pick = true, pickWords, autoPlay = false, loopWhole = false, pixelated = "zoomed", maxHeight, reserve, keys = true, extraShortcuts = [], footer, className }) {
10537
10650
  const clock = useVideoClock({
10538
10651
  fps: a.media.fps ?? 30,
10539
10652
  loop: loopProp,
@@ -10553,6 +10666,12 @@ function CompareVideo({ label, a, b, blind, missing, mode, onModeChange, rates =
10553
10666
  const frameWidth = useWidth(frameRef);
10554
10667
  const { wanted, failed } = clock;
10555
10668
  const aspect = a.media.width / a.media.height;
10669
+ const sectionRef = React.useRef(null);
10670
+ const fit = useFitHeight(sectionRef, {
10671
+ enabled: maxHeight === "fit" || full,
10672
+ full,
10673
+ reserve
10674
+ });
10556
10675
  const natural = [a.media.width, a.media.height];
10557
10676
  const frameHeight = frameWidth / aspect;
10558
10677
  const sharpFor = (c) => {
@@ -10596,7 +10715,7 @@ function CompareVideo({ label, a, b, blind, missing, mode, onModeChange, rates =
10596
10715
  onBox: wanted ? void 0 : rg.add,
10597
10716
  outline: rg.peek,
10598
10717
  aspect,
10599
- maxHeight: maxHeight === "viewport" ? VIEWPORT_HEIGHT : maxHeight
10718
+ maxHeight: frameCap(maxHeight, fit, full)
10600
10719
  };
10601
10720
  const shortcuts = [
10602
10721
  ...extraShortcuts,
@@ -10696,6 +10815,7 @@ function CompareVideo({ label, a, b, blind, missing, mode, onModeChange, rates =
10696
10815
  onActiveChange: setFull,
10697
10816
  className,
10698
10817
  children: /* @__PURE__ */ jsxs("section", {
10818
+ ref: sectionRef,
10699
10819
  "aria-label": label,
10700
10820
  className: cn("grid gap-3", full && "min-h-0 flex-1 content-start overflow-auto"),
10701
10821
  children: [
@@ -13305,7 +13425,7 @@ function Children({ node }) {
13305
13425
  return /* @__PURE__ */ jsx(Nodes, { nodes: load.data });
13306
13426
  }
13307
13427
  /** A hierarchy whose children load as each node opens (a `useChildren` hook per open node): a skeleton row, a Try again row and an "empty" row per node, type-ahead and arrow keys, single selection, open state optionally in the URL, always virtualised. */
13308
- function Tree({ label, roots, useChildren, nodeKey, nodeLabel, isBranch, renderNode, selected, onSelect, choices, expanded, loadingRow, emptyRow, height = "24rem", className }) {
13428
+ function Tree({ label, roots, useChildren, nodeKey, nodeLabel, isBranch, renderNode, selected, onSelect, choices, expanded, beforeOpen, loadingRow, emptyRow, height = "24rem", className }) {
13309
13429
  const nodes = React.useRef(/* @__PURE__ */ new Map()).current;
13310
13430
  const childKeys = React.useRef(/* @__PURE__ */ new Map()).current;
13311
13431
  const below = (key) => (childKeys.get(key) ?? []).flatMap((k) => [k, ...below(k)]);
@@ -13441,7 +13561,14 @@ function Tree({ label, roots, useChildren, nodeKey, nodeLabel, isBranch, renderN
13441
13561
  selectedKeys: choices ? displayKeys : selected === null ? [] : [selected],
13442
13562
  onSelectionChange: choices ? chooseMany : choose,
13443
13563
  expandedKeys: expanded.expanded,
13444
- onExpandedChange: (keys) => expanded.onChange(new Set([...keys].map(String).filter((k) => !isNote(k)))),
13564
+ onExpandedChange: (keys) => {
13565
+ const next = new Set([...keys].map(String).filter((k) => !isNote(k)));
13566
+ if (beforeOpen) for (const k of [...next]) {
13567
+ const node = nodes.get(k);
13568
+ if (!expanded.isOpen(k) && node !== void 0 && beforeOpen(node) === false) next.delete(k);
13569
+ }
13570
+ expanded.onChange(next);
13571
+ },
13445
13572
  renderEmptyState: () => /* @__PURE__ */ jsx("p", {
13446
13573
  className: "p-3 type-body-sm text-muted-foreground",
13447
13574
  children: emptyRow
@@ -13498,8 +13625,22 @@ var parentOf = (path) => {
13498
13625
  /** Every folder from the top down to `path`, which the tree must have open to show it. */
13499
13626
  var ancestorsOf = (path) => parts(path).slice(0, -1).map((_, i, a) => `${SEP}${a.slice(0, i + 1).join(SEP)}`);
13500
13627
  /** A server folder chooser: a lazy tree, a breadcrumb that is also editable text, Up, recents, a New folder field that shows the server's refusal, and Choose this folder as the one filled button. */
13501
- function FolderPicker({ label, useFolders, value, onChange, onChoose, expanded, recent, onCreate, topLabel = "Top", emptyRow = "No folders", height = "18rem", className }) {
13628
+ function FolderPicker({ label, useFolders: useListing, value, onChange, onChoose, expanded, recent, canChoose, chooseLabel = "Choose this folder", onOpen, onCreate, topLabel = "Top", emptyRow = "No folders", height = "18rem", className }) {
13629
+ const useFolders = (path) => {
13630
+ const l = useListing(path);
13631
+ return l.status === "ready" && !Array.isArray(l.data) ? {
13632
+ ...l,
13633
+ data: l.data.folders
13634
+ } : l;
13635
+ };
13502
13636
  const roots = useFolders(null);
13637
+ const siblings = useFolders(value ? parentOf(value) : null);
13638
+ const own = useListing(value);
13639
+ const folder = value && siblings.status === "ready" ? siblings.data.find((f) => f.path === value) : void 0;
13640
+ const footer = value && own.status === "ready" && !Array.isArray(own.data) ? own.data.footer : void 0;
13641
+ const verdict = value && canChoose ? canChoose(value, folder) : true;
13642
+ const reason = typeof verdict === "string" ? verdict : void 0;
13643
+ const reasonId = React.useId();
13503
13644
  const [editing, setEditing] = React.useState(false);
13504
13645
  const [text, setText] = React.useState("");
13505
13646
  const go = (path) => onChange(path);
@@ -13569,14 +13710,17 @@ function FolderPicker({ label, useFolders, value, onChange, onChoose, expanded,
13569
13710
  "aria-hidden": true,
13570
13711
  className: "text-muted-foreground",
13571
13712
  children: "/"
13572
- }), /* @__PURE__ */ jsx(Button, {
13573
- size: "sm",
13574
- variant: "ghost",
13575
- title: path,
13576
- onPress: () => go(path),
13577
- "aria-current": last ? "location" : void 0,
13578
- className: cn("max-w-48 truncate", last && "font-medium"),
13579
- children: c
13713
+ }), /* @__PURE__ */ jsx(Tooltip, {
13714
+ label: path,
13715
+ side: "bottom",
13716
+ children: /* @__PURE__ */ jsx(Button, {
13717
+ size: "sm",
13718
+ variant: "ghost",
13719
+ onPress: () => go(path),
13720
+ "aria-current": last ? "location" : void 0,
13721
+ className: cn("max-w-48 truncate", last && "font-medium"),
13722
+ children: c
13723
+ })
13580
13724
  })]
13581
13725
  }, path);
13582
13726
  })]
@@ -13597,16 +13741,30 @@ function FolderPicker({ label, useFolders, value, onChange, onChoose, expanded,
13597
13741
  roots,
13598
13742
  useChildren: (f) => useFolders(f.path),
13599
13743
  nodeKey: (f) => f.path,
13600
- nodeLabel: (f) => f.name,
13744
+ nodeLabel: (f) => f.badge ? `${f.name}, ${f.badge}` : f.name,
13745
+ beforeOpen: onOpen ? (f) => {
13746
+ if (onOpen(f) !== "choose") return true;
13747
+ go(f.path);
13748
+ onChoose(f.path);
13749
+ return false;
13750
+ } : void 0,
13601
13751
  renderNode: (f) => /* @__PURE__ */ jsxs("span", {
13602
13752
  className: "flex min-w-0 items-baseline gap-2",
13603
- children: [/* @__PURE__ */ jsx("span", {
13604
- className: "truncate",
13605
- children: f.name
13606
- }), f.count !== void 0 && /* @__PURE__ */ jsx("span", {
13607
- className: "type-caption tabular-nums text-muted-foreground",
13608
- children: format.integer(f.count)
13609
- })]
13753
+ children: [
13754
+ /* @__PURE__ */ jsx("span", {
13755
+ className: "truncate",
13756
+ children: f.name
13757
+ }),
13758
+ f.badge && /* @__PURE__ */ jsx(Status, {
13759
+ tone: f.tone ?? "neutral",
13760
+ className: "self-center",
13761
+ children: f.badge
13762
+ }),
13763
+ f.count !== void 0 && /* @__PURE__ */ jsx("span", {
13764
+ className: "type-caption tabular-nums text-muted-foreground",
13765
+ children: format.integer(f.count)
13766
+ })
13767
+ ]
13610
13768
  }),
13611
13769
  selected: value,
13612
13770
  onSelect: (key) => onChange(key),
@@ -13622,13 +13780,16 @@ function FolderPicker({ label, useFolders, value, onChange, onChoose, expanded,
13622
13780
  children: [/* @__PURE__ */ jsx("span", {
13623
13781
  className: "type-caption text-muted-foreground",
13624
13782
  children: "Recent"
13625
- }), recent.map((r) => /* @__PURE__ */ jsx(Button, {
13626
- size: "sm",
13627
- variant: "outline",
13628
- title: r,
13629
- onPress: () => go(r),
13630
- className: "max-w-64 truncate font-mono",
13631
- children: r
13783
+ }), recent.map((r) => /* @__PURE__ */ jsx(Tooltip, {
13784
+ label: r,
13785
+ side: "bottom",
13786
+ children: /* @__PURE__ */ jsx(Button, {
13787
+ size: "sm",
13788
+ variant: "outline",
13789
+ onPress: () => go(r),
13790
+ className: "max-w-64 truncate font-mono",
13791
+ children: r
13792
+ })
13632
13793
  }, r))]
13633
13794
  }),
13634
13795
  onCreate && /* @__PURE__ */ jsx("form", {
@@ -13661,14 +13822,23 @@ function FolderPicker({ label, useFolders, value, onChange, onChoose, expanded,
13661
13822
  })
13662
13823
  })
13663
13824
  }),
13664
- /* @__PURE__ */ jsx("div", {
13665
- className: "flex justify-end",
13666
- children: /* @__PURE__ */ jsx(Button, {
13825
+ footer && /* @__PURE__ */ jsx("p", {
13826
+ className: "type-body-sm text-muted-foreground",
13827
+ children: footer
13828
+ }),
13829
+ /* @__PURE__ */ jsxs("div", {
13830
+ className: "flex flex-wrap items-center justify-end gap-3",
13831
+ children: [reason && /* @__PURE__ */ jsx("p", {
13832
+ id: reasonId,
13833
+ className: "min-w-0 flex-1 type-body-sm text-muted-foreground",
13834
+ children: reason
13835
+ }), /* @__PURE__ */ jsx(Button, {
13667
13836
  variant: "default",
13668
- disabled: !value,
13837
+ disabled: !value || reason !== void 0,
13838
+ "aria-describedby": reason ? reasonId : void 0,
13669
13839
  onPress: () => value && onChoose(value),
13670
- children: "Choose this folder"
13671
- })
13840
+ children: chooseLabel
13841
+ })]
13672
13842
  })
13673
13843
  ]
13674
13844
  });