@arbidocs/blocks 0.4.88 → 0.4.89

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.
@@ -8,13 +8,13 @@ var chunkMUMH3Z6K_cjs = require('../chunk-MUMH3Z6K.cjs');
8
8
  var chunkJH6JTI76_cjs = require('../chunk-JH6JTI76.cjs');
9
9
  require('../chunk-2ZDFVRGV.cjs');
10
10
  var chunkO4YPVYPO_cjs = require('../chunk-O4YPVYPO.cjs');
11
- var chunkUCAYNE44_cjs = require('../chunk-UCAYNE44.cjs');
12
- var chunk5XZU64E2_cjs = require('../chunk-5XZU64E2.cjs');
11
+ var chunkTF6YMDZL_cjs = require('../chunk-TF6YMDZL.cjs');
12
+ var chunkMOJ5JQDN_cjs = require('../chunk-MOJ5JQDN.cjs');
13
13
  var chunkN26CXGXC_cjs = require('../chunk-N26CXGXC.cjs');
14
14
  var chunk7RGLTF76_cjs = require('../chunk-7RGLTF76.cjs');
15
+ require('../chunk-7D737FLE.cjs');
15
16
  require('../chunk-DETZZBG2.cjs');
16
17
  var chunk2CFW2ELM_cjs = require('../chunk-2CFW2ELM.cjs');
17
- require('../chunk-7D737FLE.cjs');
18
18
  var chunkQVBZESYQ_cjs = require('../chunk-QVBZESYQ.cjs');
19
19
  require('../chunk-ADOKTJHV.cjs');
20
20
  var chunkMP6FK43E_cjs = require('../chunk-MP6FK43E.cjs');
@@ -116,7 +116,7 @@ function ConnectedWorkspaceActivity({
116
116
  [feed.data]
117
117
  );
118
118
  return /* @__PURE__ */ jsxRuntime.jsx(
119
- chunkUCAYNE44_cjs.WorkspaceActivityList,
119
+ chunkTF6YMDZL_cjs.WorkspaceActivityList,
120
120
  {
121
121
  ...listProps,
122
122
  items,
@@ -142,7 +142,7 @@ function ConnectedWorkspaceNotificationMenu({
142
142
  });
143
143
  if (!workspaceId) return null;
144
144
  return /* @__PURE__ */ jsxRuntime.jsx(
145
- chunkUCAYNE44_cjs.WorkspaceNotificationMenu,
145
+ chunkTF6YMDZL_cjs.WorkspaceNotificationMenu,
146
146
  {
147
147
  ...menuProps,
148
148
  level,
@@ -161,7 +161,7 @@ function ConnectedThreadFollow({
161
161
  enabled: status === "authenticated"
162
162
  });
163
163
  if (!conversationId) return null;
164
- const Control = as === "menu-item" ? chunkUCAYNE44_cjs.ThreadFollowMenuItem : chunkUCAYNE44_cjs.ThreadFollowButton;
164
+ const Control = as === "menu-item" ? chunkTF6YMDZL_cjs.ThreadFollowMenuItem : chunkTF6YMDZL_cjs.ThreadFollowButton;
165
165
  return /* @__PURE__ */ jsxRuntime.jsx(
166
166
  Control,
167
167
  {
@@ -287,7 +287,7 @@ function StreamedArtifact({
287
287
  }
288
288
  var STARTING = /* @__PURE__ */ new Set(["pending", "running"]);
289
289
  function formValues(step, inputs) {
290
- const fields = chunk5XZU64E2_cjs.stepFields(step);
290
+ const fields = chunkMOJ5JQDN_cjs.stepFields(step);
291
291
  if (!fields.length) return void 0;
292
292
  if (step.kind === "form")
293
293
  return Object.fromEntries(fields.map((f) => [f.name, inputs[f.name] ?? ""]));
@@ -325,7 +325,7 @@ function useWorkflowThread(workflow, options = {}) {
325
325
  const { wsId } = chunkXMBYDLZQ_cjs.useWorkspaceDocs();
326
326
  const [threadId, setThreadId] = react.useState(options.conversationId);
327
327
  const [localInputs, setLocalInputs] = react.useState(
328
- () => chunk5XZU64E2_cjs.initialRunInputs(workflow, options.initialInputs)
328
+ () => chunkMOJ5JQDN_cjs.initialRunInputs(workflow, options.initialInputs)
329
329
  );
330
330
  const [edits, setEdits] = react.useState({});
331
331
  const [localStates, setLocalStates] = react.useState({});
@@ -345,12 +345,12 @@ function useWorkflowThread(workflow, options = {}) {
345
345
  );
346
346
  const conversation = conversations.data?.find((c) => c.external_id === threadId);
347
347
  const steps = react.useMemo(
348
- () => chunk5XZU64E2_cjs.workflowSteps(workflow).length > 0 ? chunk5XZU64E2_cjs.workflowSteps(workflow) : chunk5XZU64E2_cjs.fromPlanSteps(conversation?.plan?.steps ?? []),
348
+ () => chunkMOJ5JQDN_cjs.workflowSteps(workflow).length > 0 ? chunkMOJ5JQDN_cjs.workflowSteps(workflow) : chunkMOJ5JQDN_cjs.fromPlanSteps(conversation?.plan?.steps ?? []),
349
349
  [workflow, conversation?.plan?.steps]
350
350
  );
351
351
  const activity = react$1.useConversationActivity(threadId, { live: !!threadId });
352
352
  const serverStates = react.useMemo(
353
- () => chunk5XZU64E2_cjs.stepStatesFromActivity(activity.data ?? []),
353
+ () => chunkMOJ5JQDN_cjs.stepStatesFromActivity(activity.data ?? []),
354
354
  [activity.data]
355
355
  );
356
356
  const working = steps.some(
@@ -393,7 +393,7 @@ function useWorkflowThread(workflow, options = {}) {
393
393
  async (values, done) => {
394
394
  await ensureWorkspaceOpen();
395
395
  const created = await createWork.mutateAsync({
396
- title: chunk5XZU64E2_cjs.runThreadTitle(workflow, values).slice(0, 60),
396
+ title: chunkMOJ5JQDN_cjs.runThreadTitle(workflow, values).slice(0, 60),
397
397
  description: workflow.description || null,
398
398
  prompt: null,
399
399
  skill_ref: null,
@@ -405,7 +405,7 @@ function useWorkflowThread(workflow, options = {}) {
405
405
  criteria: [],
406
406
  max_passes: 3,
407
407
  documents: [],
408
- steps: chunk5XZU64E2_cjs.toPlanSteps(workflow, {
408
+ steps: chunkMOJ5JQDN_cjs.toPlanSteps(workflow, {
409
409
  inputs: values,
410
410
  resolveWorkflow: options.resolveWorkflow,
411
411
  compose: options.compose
@@ -492,7 +492,7 @@ function useWorkflowThread(workflow, options = {}) {
492
492
  const anyRunning = Object.values(states).some((s) => s.status === "running");
493
493
  const needsStart = !threadId || idle && !anyRunning;
494
494
  const runError = idle ? conversation?.last_error ?? null : null;
495
- const view = chunk5XZU64E2_cjs.useWorkflowView({
495
+ const view = chunkMOJ5JQDN_cjs.useWorkflowView({
496
496
  steps,
497
497
  states,
498
498
  inputs,
@@ -558,6 +558,8 @@ var DEFAULT_WORKFLOW_RUNNER_DIALOG_LABELS = {
558
558
  reviewDescription: "Each document against each review column.",
559
559
  document: "Document",
560
560
  empty: "\u2014",
561
+ showMore: "Show more",
562
+ showLess: "Show less",
561
563
  wordTitle: "Tracked changes"
562
564
  };
563
565
  var SIGN_PDF_RETRIES = 4;
@@ -571,7 +573,7 @@ function WorkflowSignDialog({
571
573
  const arbi = react$1.useArbi();
572
574
  const { user, ensureWorkspaceOpen } = chunkMUMH3Z6K_cjs.useConnection();
573
575
  const tools = documentTools.useOptionalDocumentTools();
574
- const { id, version: stepVersion } = chunk5XZU64E2_cjs.splitDocRef(docRef);
576
+ const { id, version: stepVersion } = chunkMOJ5JQDN_cjs.splitDocRef(docRef);
575
577
  const [version, setVersion] = react.useState(stepVersion);
576
578
  const [pdf, setPdf] = react.useState(null);
577
579
  const [preparing, setPreparing] = react.useState(false);
@@ -649,7 +651,7 @@ function WorkflowWordDialog({
649
651
  onClose,
650
652
  labels
651
653
  }) {
652
- const { id } = chunk5XZU64E2_cjs.splitDocRef(docRef);
654
+ const { id } = chunkMOJ5JQDN_cjs.splitDocRef(docRef);
653
655
  return /* @__PURE__ */ jsxRuntime.jsx(
654
656
  chunkULWRNGGE_cjs.ModalScaffold,
655
657
  {
@@ -699,18 +701,25 @@ function WorkflowReviewGridDialog({
699
701
  labels.loadingDocument
700
702
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full border-collapse text-sm", children: [
701
703
  /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
702
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "sticky left-0 border-b border-border bg-card p-2 text-left font-medium", children: labels.document }),
703
- columns.map((c) => /* @__PURE__ */ jsxRuntime.jsx("th", { className: "border-b border-border p-2 text-left font-medium", children: c.name }, c.id))
704
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "sticky left-0 z-10 border-b border-border bg-background p-2 text-left align-bottom font-medium", children: labels.document }),
705
+ columns.map((c) => /* @__PURE__ */ jsxRuntime.jsx(
706
+ "th",
707
+ {
708
+ className: "border-b border-border p-2 text-left align-bottom font-medium",
709
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${VALUE_WIDTH} line-clamp-2 break-words`, title: c.name, children: c.name })
710
+ },
711
+ c.id
712
+ ))
704
713
  ] }) }),
705
714
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: (docs.data ?? []).map((d) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { "data-testid": `workflow-review-grid-row-${d.external_id}`, children: [
706
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "sticky left-0 max-w-56 border-b border-border bg-card p-2 align-top", children: /* @__PURE__ */ jsxRuntime.jsx(Cell, { onClick: onOpenDocument && (() => onOpenDocument(d.external_id)), children: d.file_name ?? d.external_id }) }),
715
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "sticky left-0 z-10 border-b border-border bg-background p-2 align-top", children: /* @__PURE__ */ jsxRuntime.jsx(DocumentName, { onClick: onOpenDocument && (() => onOpenDocument(d.external_id)), children: d.file_name ?? d.external_id }) }),
707
716
  columns.map((c) => {
708
717
  const note = d.doctags?.find((t) => t.tag_ext_id === c.id)?.note;
709
718
  return /* @__PURE__ */ jsxRuntime.jsx(
710
719
  "td",
711
720
  {
712
- className: "max-w-72 border-b border-border p-2 align-top text-muted-foreground",
713
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "line-clamp-4 whitespace-pre-line", children: note || labels.empty })
721
+ className: "border-b border-border p-2 align-top text-muted-foreground",
722
+ children: /* @__PURE__ */ jsxRuntime.jsx(ReviewValue, { value: note || labels.empty, labels })
714
723
  },
715
724
  c.id
716
725
  );
@@ -720,16 +729,49 @@ function WorkflowReviewGridDialog({
720
729
  }
721
730
  );
722
731
  }
723
- function Cell({ onClick, children }) {
732
+ var DOCUMENT_WIDTH = "w-40 sm:w-56";
733
+ var VALUE_WIDTH = "min-w-48 max-w-80";
734
+ function DocumentName({ onClick, children }) {
735
+ const className = `${DOCUMENT_WIDTH} line-clamp-2 break-words text-left font-medium`;
724
736
  return onClick ? /* @__PURE__ */ jsxRuntime.jsx(
725
737
  "button",
726
738
  {
727
739
  type: "button",
728
740
  onClick,
729
- className: "truncate text-left font-medium text-primary hover:underline",
741
+ title: children,
742
+ className: `${className} text-primary hover:underline`,
730
743
  children
731
744
  }
732
- ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children });
745
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { title: children, className, children });
746
+ }
747
+ function ReviewValue({ value, labels }) {
748
+ const ref = react.useRef(null);
749
+ const [expanded, setExpanded] = react.useState(false);
750
+ const [clamped, setClamped] = react.useState(false);
751
+ react.useLayoutEffect(() => {
752
+ const el = ref.current;
753
+ if (el && !expanded) setClamped(el.scrollHeight > el.clientHeight + 1);
754
+ }, [value, expanded]);
755
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: VALUE_WIDTH, children: [
756
+ /* @__PURE__ */ jsxRuntime.jsx(
757
+ "div",
758
+ {
759
+ ref,
760
+ title: clamped && !expanded ? value : void 0,
761
+ className: `whitespace-pre-line break-words ${expanded ? "" : "line-clamp-4"}`,
762
+ children: value
763
+ }
764
+ ),
765
+ (clamped || expanded) && /* @__PURE__ */ jsxRuntime.jsx(
766
+ "button",
767
+ {
768
+ type: "button",
769
+ onClick: () => setExpanded((e) => !e),
770
+ className: "mt-1 text-xs font-medium text-primary hover:underline",
771
+ children: expanded ? labels.showLess : labels.showMore
772
+ }
773
+ )
774
+ ] });
733
775
  }
734
776
  var DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS = {
735
777
  notify: "Ask to approve",
@@ -783,7 +825,7 @@ function ConnectedWorkflowRunner({
783
825
  () => ({
784
826
  me: user?.externalId,
785
827
  openDocument: onOpenDocument && ((ref) => {
786
- const { id, version } = chunk5XZU64E2_cjs.splitDocRef(ref);
828
+ const { id, version } = chunkMOJ5JQDN_cjs.splitDocRef(ref);
787
829
  onOpenDocument(id, version);
788
830
  }),
789
831
  openDraft: onOpenDraft && ((draftId) => onOpenDraft(draftId)),
@@ -793,7 +835,7 @@ function ConnectedWorkflowRunner({
793
835
  const w = state.waiting;
794
836
  if (w?.doc_ext_id) setDialog({ kind: "sign", docRef: w.doc_ext_id });
795
837
  }),
796
- openRedline: hostActions?.openRedline ?? ((ref) => setDialog({ kind: "word", docRef: ref, title: nameOfDoc(chunk5XZU64E2_cjs.splitDocRef(ref).id) ?? "" })),
838
+ openRedline: hostActions?.openRedline ?? ((ref) => setDialog({ kind: "word", docRef: ref, title: nameOfDoc(chunkMOJ5JQDN_cjs.splitDocRef(ref).id) ?? "" })),
797
839
  openReview: hostActions?.openReview ?? ((tags, documents) => setDialog({ kind: "review", tags, documents }))
798
840
  }),
799
841
  [user?.externalId, onOpenDocument, onOpenDraft, onOpenMessage, hostActions, nameOfDoc, inThread]
@@ -929,7 +971,7 @@ function ConnectedWorkflowRunner({
929
971
  );
930
972
  };
931
973
  const runner = (compact) => /* @__PURE__ */ jsxRuntime.jsx(
932
- chunk5XZU64E2_cjs.WorkflowRunner,
974
+ chunkMOJ5JQDN_cjs.WorkflowRunner,
933
975
  {
934
976
  people,
935
977
  ...runnerProps,
@@ -975,10 +1017,10 @@ function ConnectedWorkflowRunner({
975
1017
  ) }),
976
1018
  inThread && conversationId ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
977
1019
  /* @__PURE__ */ jsxRuntime.jsx(
978
- chunk5XZU64E2_cjs.WorkflowStepBar,
1020
+ chunkMOJ5JQDN_cjs.WorkflowStepBar,
979
1021
  {
980
1022
  run: view,
981
- levels: chunk5XZU64E2_cjs.stepLevels(view.steps),
1023
+ levels: chunkMOJ5JQDN_cjs.stepLevels(view.steps),
982
1024
  doneTitle: (workflow.run.kind === "steps" ? workflow.run.completion?.title : void 0) ?? runnerProps.labels?.complete ?? "Done",
983
1025
  icon: (key) => key && runnerProps.renderIcon ? runnerProps.renderIcon(key) : void 0,
984
1026
  tid: (suffix) => `${testIdPrefix}-${suffix}`
@@ -1159,17 +1201,17 @@ function ConnectedTagTable({
1159
1201
  const fail = (e) => setError(e instanceof Error ? e.message : String(e));
1160
1202
  const snapshot = (data) => {
1161
1203
  const title = exportTitle ?? KIND_TITLES[kind];
1162
- const bytes = chunkUCAYNE44_cjs.tagTableDocx(data, {
1204
+ const bytes = chunkTF6YMDZL_cjs.tagTableDocx(data, {
1163
1205
  title,
1164
1206
  nameOf: (id) => people.find((p) => p.value === id)?.label
1165
1207
  });
1166
1208
  const stamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
1167
1209
  const name = `${title.replace(/[\\/:*?"<>|]+/g, "-")} (${stamp}).docx`;
1168
- return { blob: new Blob([bytes], { type: chunkUCAYNE44_cjs.DOCX_MIME_TYPE }), name };
1210
+ return { blob: new Blob([bytes], { type: chunkTF6YMDZL_cjs.DOCX_MIME_TYPE }), name };
1169
1211
  };
1170
1212
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1171
1213
  /* @__PURE__ */ jsxRuntime.jsx(
1172
- chunkUCAYNE44_cjs.TagTable,
1214
+ chunkTF6YMDZL_cjs.TagTable,
1173
1215
  {
1174
1216
  ...props,
1175
1217
  table,