@arbidocs/react 0.4.16 → 0.4.18

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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkEEOGV7GV_cjs = require('../chunk-EEOGV7GV.cjs');
3
+ var chunkSJBGNP7E_cjs = require('../chunk-SJBGNP7E.cjs');
4
4
  var chunkPATLJSAO_cjs = require('../chunk-PATLJSAO.cjs');
5
5
  var chunkEOOHRPFM_cjs = require('../chunk-EOOHRPFM.cjs');
6
6
  require('../chunk-S6A6FSG7.cjs');
@@ -134,7 +134,7 @@ function flattenChunks(chunks, options) {
134
134
  const text = (chunks ?? []).map((c) => (c.content ?? "").trim()).join("\n\n");
135
135
  if (!options?.unescape) return text;
136
136
  return chunkPATLJSAO_cjs.normalizeMarkdown(
137
- chunkEEOGV7GV_cjs.repairParsedStructure(chunkEEOGV7GV_cjs.repairParsedTitle(chunkEEOGV7GV_cjs.unescapeMarkdown(text)))
137
+ chunkSJBGNP7E_cjs.repairParsedStructure(chunkSJBGNP7E_cjs.repairParsedTitle(chunkSJBGNP7E_cjs.unescapeMarkdown(text)))
138
138
  ).replace(/\n$/, "");
139
139
  }
140
140
  var DOC_ID = /^doc/;
@@ -342,7 +342,7 @@ function useArtifactText(docId, options) {
342
342
  const enabled = (options?.enabled ?? true) && isDocumentId(docId) && arbi.hasWorkspace;
343
343
  const query = reactQuery.useQuery({
344
344
  // Under the shared `parsedDoc` key, so a document's invalidation reaches it too.
345
- queryKey: [...chunkEEOGV7GV_cjs.arbiQueryKeys.parsedDoc(docId ?? "", "marker"), "artifact-text"],
345
+ queryKey: [...chunkSJBGNP7E_cjs.arbiQueryKeys.parsedDoc(docId ?? "", "marker"), "artifact-text"],
346
346
  queryFn: async () => {
347
347
  const parsed = await arbi.documents.getParsedContent(docId, "marker");
348
348
  if (!parsed.chunks?.some((c) => c.content?.trim())) throw new NotParsedYetError();
@@ -384,7 +384,7 @@ function useArtifactText(docId, options) {
384
384
 
385
385
  // src/artifacts/useArtifactSession.ts
386
386
  function useArtifactVersions(workspaceId, docId) {
387
- const { data: documents } = chunkEEOGV7GV_cjs.useDocuments(workspaceId);
387
+ const { data: documents } = chunkSJBGNP7E_cjs.useDocuments(workspaceId);
388
388
  return react.useMemo(
389
389
  () => toArtifactVersions(buildVersionChain(documents ?? [], docId)),
390
390
  [documents, docId]
@@ -406,7 +406,7 @@ function useSaveArtifactVersion() {
406
406
  }
407
407
  );
408
408
  if (workspaceId) {
409
- await queryClient.invalidateQueries({ queryKey: chunkEEOGV7GV_cjs.arbiQueryKeys.documents(workspaceId) });
409
+ await queryClient.invalidateQueries({ queryKey: chunkSJBGNP7E_cjs.arbiQueryKeys.documents(workspaceId) });
410
410
  }
411
411
  return { docId: result.doc_ext_ids?.[0] };
412
412
  }
@@ -554,7 +554,7 @@ function useStreamedArtifact({
554
554
  let stored;
555
555
  if (clean) stored = clean(content);
556
556
  else {
557
- const report = chunkEEOGV7GV_cjs.cleanDraftWithReport(content);
557
+ const report = chunkSJBGNP7E_cjs.cleanDraftWithReport(content);
558
558
  stored = report.text;
559
559
  setCleaned(report);
560
560
  onCleaned?.(report);
@@ -595,35 +595,35 @@ function useStreamedArtifact({
595
595
 
596
596
  Object.defineProperty(exports, "cleanDraftMarkdown", {
597
597
  enumerable: true,
598
- get: function () { return chunkEEOGV7GV_cjs.cleanDraftMarkdown; }
598
+ get: function () { return chunkSJBGNP7E_cjs.cleanDraftMarkdown; }
599
599
  });
600
600
  Object.defineProperty(exports, "cleanDraftWithReport", {
601
601
  enumerable: true,
602
- get: function () { return chunkEEOGV7GV_cjs.cleanDraftWithReport; }
602
+ get: function () { return chunkSJBGNP7E_cjs.cleanDraftWithReport; }
603
603
  });
604
604
  Object.defineProperty(exports, "promoteBoldTitle", {
605
605
  enumerable: true,
606
- get: function () { return chunkEEOGV7GV_cjs.promoteBoldTitle; }
606
+ get: function () { return chunkSJBGNP7E_cjs.promoteBoldTitle; }
607
607
  });
608
608
  Object.defineProperty(exports, "repairParsedStructure", {
609
609
  enumerable: true,
610
- get: function () { return chunkEEOGV7GV_cjs.repairParsedStructure; }
610
+ get: function () { return chunkSJBGNP7E_cjs.repairParsedStructure; }
611
611
  });
612
612
  Object.defineProperty(exports, "repairParsedTitle", {
613
613
  enumerable: true,
614
- get: function () { return chunkEEOGV7GV_cjs.repairParsedTitle; }
614
+ get: function () { return chunkSJBGNP7E_cjs.repairParsedTitle; }
615
615
  });
616
616
  Object.defineProperty(exports, "stripAgentPreamble", {
617
617
  enumerable: true,
618
- get: function () { return chunkEEOGV7GV_cjs.stripAgentPreamble; }
618
+ get: function () { return chunkSJBGNP7E_cjs.stripAgentPreamble; }
619
619
  });
620
620
  Object.defineProperty(exports, "unescapeMarkdown", {
621
621
  enumerable: true,
622
- get: function () { return chunkEEOGV7GV_cjs.unescapeMarkdown; }
622
+ get: function () { return chunkSJBGNP7E_cjs.unescapeMarkdown; }
623
623
  });
624
624
  Object.defineProperty(exports, "unwrapCitationLinks", {
625
625
  enumerable: true,
626
- get: function () { return chunkEEOGV7GV_cjs.unwrapCitationLinks; }
626
+ get: function () { return chunkSJBGNP7E_cjs.unwrapCitationLinks; }
627
627
  });
628
628
  Object.defineProperty(exports, "buildHybridRedlineMarkdown", {
629
629
  enumerable: true,
@@ -1,5 +1,5 @@
1
- import { repairParsedStructure, repairParsedTitle, unescapeMarkdown, arbiQueryKeys, useDocuments, cleanDraftWithReport } from '../chunk-3Q3MMZVU.js';
2
- export { cleanDraftMarkdown, cleanDraftWithReport, promoteBoldTitle, repairParsedStructure, repairParsedTitle, stripAgentPreamble, unescapeMarkdown, unwrapCitationLinks } from '../chunk-3Q3MMZVU.js';
1
+ import { repairParsedStructure, repairParsedTitle, unescapeMarkdown, arbiQueryKeys, useDocuments, cleanDraftWithReport } from '../chunk-JJSPTHI2.js';
2
+ export { cleanDraftMarkdown, cleanDraftWithReport, promoteBoldTitle, repairParsedStructure, repairParsedTitle, stripAgentPreamble, unescapeMarkdown, unwrapCitationLinks } from '../chunk-JJSPTHI2.js';
3
3
  import { revertRedlineRegion, buildHybridRedlineWithRegions, buildHybridRedlineMarkdown, normalizeMarkdown } from '../chunk-43AKLNBC.js';
4
4
  export { buildHybridRedlineMarkdown, buildHybridRedlineWithRegions, normalizeMarkdown, revertRedlineRegion } from '../chunk-43AKLNBC.js';
5
5
  import { MarkdownRenderer } from '../chunk-6YSHODMG.js';
@@ -287,6 +287,7 @@ function IconToggle({
287
287
  disabled,
288
288
  "data-testid": dataTestId,
289
289
  "aria-pressed": isMixed ? "mixed" : isActive,
290
+ "aria-label": label ?? tooltipText,
290
291
  className: `
291
292
  group/toggle relative inline-flex items-center h-4 w-8 rounded-full
292
293
  pointer-coarse:after:absolute pointer-coarse:after:left-1/2 pointer-coarse:after:top-1/2 pointer-coarse:after:size-11 pointer-coarse:after:-translate-x-1/2 pointer-coarse:after:-translate-y-1/2 pointer-coarse:after:content-['']
@@ -325,6 +326,66 @@ function IconToggle({
325
326
  ] }) : button
326
327
  ] });
327
328
  }
329
+ var COLORS = {
330
+ text: "text-primary",
331
+ bg: "bg-primary"
332
+ };
333
+ function isItemShared(item) {
334
+ return item.shared === true || item.is_shared === true;
335
+ }
336
+ function VisibilityToggle({
337
+ items,
338
+ onToggle,
339
+ disabled = false,
340
+ disabledTooltip,
341
+ disablePrivate = false,
342
+ showLabel = true,
343
+ showTooltip = true,
344
+ tooltipActive,
345
+ tooltipInactive,
346
+ tooltipMixed,
347
+ label = "Visibility",
348
+ workspaceLabel = "workspace",
349
+ "data-testid": dataTestId
350
+ }) {
351
+ const itemsArray = React.useMemo(() => Array.isArray(items) ? items : [items], [items]);
352
+ const { isAllShared, isMixed } = React.useMemo(() => {
353
+ if (itemsArray.length === 0) return { isAllShared: false, isMixed: false };
354
+ const sharedCount = itemsArray.filter(isItemShared).length;
355
+ return {
356
+ isAllShared: sharedCount === itemsArray.length,
357
+ isMixed: sharedCount > 0 && sharedCount < itemsArray.length
358
+ };
359
+ }, [itemsArray]);
360
+ const isSingle = itemsArray.length === 1;
361
+ const defaultTooltipActive = `Hide${isSingle ? "" : " all"} from ${workspaceLabel} members`;
362
+ const defaultTooltipInactive = `Make${isSingle ? "" : " all"} visible to ${workspaceLabel} members`;
363
+ const defaultTooltipMixed = `Make all visible to ${workspaceLabel} members (some already shared)`;
364
+ const handleToggle = () => {
365
+ const shouldShare = !isAllShared;
366
+ if (disablePrivate && !shouldShare) return;
367
+ onToggle(shouldShare);
368
+ };
369
+ return /* @__PURE__ */ jsxRuntime.jsx(
370
+ IconToggle,
371
+ {
372
+ icon: lucideReact.Share2,
373
+ isActive: isAllShared,
374
+ onToggle: handleToggle,
375
+ colors: COLORS,
376
+ disabled: disabled || itemsArray.length === 0,
377
+ disabledTooltip,
378
+ showLabel,
379
+ showTooltip,
380
+ label,
381
+ isMixed,
382
+ tooltipActive: tooltipActive || defaultTooltipActive,
383
+ tooltipInactive: tooltipInactive || defaultTooltipInactive,
384
+ tooltipMixed: tooltipMixed || defaultTooltipMixed,
385
+ "data-testid": dataTestId
386
+ }
387
+ );
388
+ }
328
389
  var DictateContext = React.createContext(null);
329
390
  function DictateProvider({
330
391
  transcribe,
@@ -3025,9 +3086,9 @@ var ENTITY_MAPPINGS = {
3025
3086
  },
3026
3087
  CONVERSATION: {
3027
3088
  NAMES: {
3028
- SINGULAR: "Chat",
3029
- PLURAL: "Chats",
3030
- NEW: "New ARBI Chat"
3089
+ SINGULAR: "Task",
3090
+ PLURAL: "Tasks",
3091
+ NEW: "New"
3031
3092
  },
3032
3093
  ICONS: {
3033
3094
  DEFAULT: lucideReact.MessagesSquare,
@@ -3816,6 +3877,7 @@ exports.UserMenu = UserMenu;
3816
3877
  exports.VISIBILITY_ICONS = VISIBILITY_ICONS;
3817
3878
  exports.VidIcon = VidIcon;
3818
3879
  exports.VisibilityIcon = VisibilityIcon;
3880
+ exports.VisibilityToggle = VisibilityToggle;
3819
3881
  exports.badgeVariants = badgeVariants;
3820
3882
  exports.buttonVariants = buttonVariants;
3821
3883
  exports.cardVariants = cardVariants;
@@ -3835,5 +3897,5 @@ exports.getTagTypeLabel = getTagTypeLabel;
3835
3897
  exports.getWorkspaceColor = getWorkspaceColor;
3836
3898
  exports.toggleVariants = toggleVariants;
3837
3899
  exports.useAudioRecorder = useAudioRecorder;
3838
- //# sourceMappingURL=chunk-CVBY6RKG.cjs.map
3839
- //# sourceMappingURL=chunk-CVBY6RKG.cjs.map
3900
+ //# sourceMappingURL=chunk-C3Q4TYFW.cjs.map
3901
+ //# sourceMappingURL=chunk-C3Q4TYFW.cjs.map