@pipelex/mthds-form 0.26.0 → 0.28.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/dist/{chunk-QWHUUMSB.js → chunk-4VAO6BDE.js} +4 -4
- package/dist/{chunk-QWHUUMSB.js.map → chunk-4VAO6BDE.js.map} +1 -1
- package/dist/{chunk-QINLJ5RM.js → chunk-56WECFBD.js} +6 -3
- package/dist/chunk-56WECFBD.js.map +1 -0
- package/dist/{chunk-RSYOZZZF.js → chunk-II5TOORN.js} +208 -50
- package/dist/chunk-II5TOORN.js.map +1 -0
- package/dist/{chunk-NSHGLM6A.js → chunk-L23R3JNQ.js} +2 -2
- package/dist/chunk-L23R3JNQ.js.map +1 -0
- package/dist/{chunk-JSPF4BQP.js → chunk-QQK6Y55E.js} +96 -3
- package/dist/chunk-QQK6Y55E.js.map +1 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +4 -4
- package/dist/core/native-content.d.ts +103 -1
- package/dist/core/native-content.js +1 -1
- package/dist/core/save-plan.js +3 -3
- package/dist/core/sources.d.ts +32 -7
- package/dist/core/sources.js +1 -1
- package/dist/core/stuff-files.js +2 -2
- package/dist/{field-renderer-CH-biG8C.d.ts → field-renderer-Dz03dpig.d.ts} +3 -2
- package/dist/generative/index.d.ts +1 -1
- package/dist/generative/index.js +5 -5
- package/dist/react/index.d.ts +95 -42
- package/dist/react/index.js +5 -5
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/chunk-JSPF4BQP.js.map +0 -1
- package/dist/chunk-NSHGLM6A.js.map +0 -1
- package/dist/chunk-QINLJ5RM.js.map +0 -1
- package/dist/chunk-RSYOZZZF.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { planFileSave, planStuffSave, splitFileName, typedFileStem } from './chunk-
|
|
1
|
+
import { planFileSave, planStuffSave, splitFileName, typedFileStem } from './chunk-4VAO6BDE.js';
|
|
2
2
|
import { seedInputs, closeOptionalStructures, openOptionalStructures } from './chunk-VH5CDQDR.js';
|
|
3
|
-
import { sourceFileValue, roomForChosenFiles, roomForDroppedFiles, addChosenFiles, placeDroppedFiles, chosenFilesAdded } from './chunk-
|
|
4
|
-
import { readStuffFile } from './chunk-
|
|
3
|
+
import { sourceFileValue, roomForChosenFiles, roomForDroppedFiles, addChosenFiles, placeDroppedFiles, chosenFilesAdded } from './chunk-L23R3JNQ.js';
|
|
4
|
+
import { readStuffFile } from './chunk-56WECFBD.js';
|
|
5
5
|
import { apiInputsFromRunValues, sameRunValues, runValuesFromInputs, setValueAtPath } from './chunk-ZX52CQJ4.js';
|
|
6
|
-
import { TYPED_SCALAR_MARKERS, viewableUrl, isNativeDateNode, isNativeHtmlNode, readHtmlContent, isNativeCompositeNode, readCompositeContent, isNativePageNode, nativeVerdictOf, isNativeValueNode, readDateContent, formatDateContent, readPageContent, readYesNoContent, readRatingContent, readChoiceContent, readDocumentContent, readImageContent, readDataUrl } from './chunk-
|
|
6
|
+
import { TYPED_SCALAR_MARKERS, viewableUrl, splitCitations, webHref, isNativeDateNode, isNativeHtmlNode, readHtmlContent, isNativeCompositeNode, readCompositeContent, isNativePageNode, nativeVerdictOf, isNativeSearchResultNode, readSearchResultContent, isNativeValueNode, readDateContent, formatDateContent, readPageContent, readYesNoContent, readRatingContent, readChoiceContent, readDocumentContent, readImageContent, readDataUrl, citedSource } from './chunk-QQK6Y55E.js';
|
|
7
7
|
import { buildRunFields } from './chunk-ZB4RYUKV.js';
|
|
8
8
|
import { conceptCategory } from './chunk-FABY3DEY.js';
|
|
9
9
|
import { acceptLabel, acceptMap, isAcceptedFile, normalizeMimeType, formatOfFilename, DOCUMENT_FORMATS, IMAGE_FORMATS } from './chunk-XCO6GTEC.js';
|
|
@@ -14,7 +14,7 @@ import { clsx } from 'clsx';
|
|
|
14
14
|
import { twMerge } from 'tailwind-merge';
|
|
15
15
|
import { ChevronDown, ChevronUp, Check, List, Braces, ListChecks, ToggleLeft, Hash, Image as Image$1, FileText, CalendarDays, Type, Folder, Search, X, ImageIcon, Loader2, ImageOff, Upload, Link2, EyeOff, Eye, Minus, Plus, Trash2, Sparkles, MoreHorizontal, TriangleAlert, FileDown, Copy, Download, ChevronRight, ExternalLink, ChevronLeft } from 'lucide-react';
|
|
16
16
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
17
|
-
import * as
|
|
17
|
+
import * as React9 from 'react';
|
|
18
18
|
import { createContext, use, useId, useMemo, useContext, useState, useEffect, useRef, useLayoutEffect, useCallback, Fragment as Fragment$1, useSyncExternalStore } from 'react';
|
|
19
19
|
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
20
20
|
import { useDropzone } from 'react-dropzone';
|
|
@@ -115,7 +115,7 @@ function fieldLabel(title, name, presentation) {
|
|
|
115
115
|
if (title !== void 0) return title;
|
|
116
116
|
return presentation === "app" ? humanizeFieldName(name) : name;
|
|
117
117
|
}
|
|
118
|
-
var Switch =
|
|
118
|
+
var Switch = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
119
119
|
SwitchPrimitives.Root,
|
|
120
120
|
{
|
|
121
121
|
className: cn(
|
|
@@ -290,6 +290,7 @@ var EN_FIELD_STRINGS = {
|
|
|
290
290
|
ratingLevel: (position) => `Level ${position}`,
|
|
291
291
|
pageNumber: (position) => `Page ${position}`,
|
|
292
292
|
extractedTable: "Table",
|
|
293
|
+
searchSources: "Sources",
|
|
293
294
|
viewImage: (name) => `View ${name}`,
|
|
294
295
|
imagePosition: (position, count) => `${position} of ${count}`,
|
|
295
296
|
previousImage: "Previous picture",
|
|
@@ -352,6 +353,7 @@ var EN_FIELD_STRINGS = {
|
|
|
352
353
|
replaceEnteredDescription: (name) => `Filling the form with \u201C${name}\u201D replaces every value in it.`,
|
|
353
354
|
replaceEnteredConfirm: "Replace",
|
|
354
355
|
exampleActions: (name) => `Actions for ${name}`,
|
|
356
|
+
openExample: "Open",
|
|
355
357
|
renameExample: "Rename",
|
|
356
358
|
deleteExample: "Delete",
|
|
357
359
|
renameExampleTitle: "Rename the example",
|
|
@@ -473,6 +475,7 @@ var FR_FIELD_STRINGS = {
|
|
|
473
475
|
ratingLevel: (position) => `Niveau ${position}`,
|
|
474
476
|
pageNumber: (position) => `Page ${position}`,
|
|
475
477
|
extractedTable: "Tableau",
|
|
478
|
+
searchSources: "Sources",
|
|
476
479
|
viewImage: (name) => `Voir ${name}`,
|
|
477
480
|
imagePosition: (position, count) => `${position} sur ${count}`,
|
|
478
481
|
previousImage: "Image pr\xE9c\xE9dente",
|
|
@@ -535,6 +538,7 @@ var FR_FIELD_STRINGS = {
|
|
|
535
538
|
replaceEnteredDescription: (name) => `Remplir le formulaire avec \xAB\xA0${name}\xA0\xBB remplace toutes ses valeurs.`,
|
|
536
539
|
replaceEnteredConfirm: "Remplacer",
|
|
537
540
|
exampleActions: (name) => `Actions pour ${name}`,
|
|
541
|
+
openExample: "Ouvrir",
|
|
538
542
|
renameExample: "Renommer",
|
|
539
543
|
deleteExample: "Supprimer",
|
|
540
544
|
renameExampleTitle: "Renommer l\u2019exemple",
|
|
@@ -793,6 +797,10 @@ function useSourcePages(load, key) {
|
|
|
793
797
|
updateItems
|
|
794
798
|
};
|
|
795
799
|
}
|
|
800
|
+
function drawsNothing(drawn) {
|
|
801
|
+
if (Array.isArray(drawn)) return drawn.every((item) => drawsNothing(item));
|
|
802
|
+
return drawn === null || drawn === void 0 || typeof drawn === "boolean" || drawn === "";
|
|
803
|
+
}
|
|
796
804
|
function DimRows({ count = 4 }) {
|
|
797
805
|
return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", "data-dim-rows": true, className: "divide-y divide-border", children: Array.from({ length: count }, (_, index) => /* @__PURE__ */ jsxs("div", { className: "flex min-h-16 items-center gap-3 px-4 py-3 opacity-60", children: [
|
|
798
806
|
/* @__PURE__ */ jsx("span", { className: "size-8 shrink-0 rounded-md bg-muted" }),
|
|
@@ -860,7 +868,7 @@ var keepPress = (event) => event.stopPropagation();
|
|
|
860
868
|
function DialogSurface({ children }) {
|
|
861
869
|
return /* @__PURE__ */ jsx("div", { className: "contents", onClick: keepPress, onMouseDown: keepPress, children });
|
|
862
870
|
}
|
|
863
|
-
var DialogOverlay =
|
|
871
|
+
var DialogOverlay = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
864
872
|
DialogPrimitive.Overlay,
|
|
865
873
|
{
|
|
866
874
|
ref,
|
|
@@ -869,7 +877,7 @@ var DialogOverlay = React5.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
869
877
|
}
|
|
870
878
|
));
|
|
871
879
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
872
|
-
var DialogContent =
|
|
880
|
+
var DialogContent = React9.forwardRef(({ className, layout = "dialog", returnFocus, onCloseAutoFocus, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogSurface, { children: [
|
|
873
881
|
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
874
882
|
/* @__PURE__ */ jsx(
|
|
875
883
|
DialogPrimitive.Content,
|
|
@@ -890,7 +898,7 @@ var DialogContent = React5.forwardRef(({ className, layout = "dialog", returnFoc
|
|
|
890
898
|
)
|
|
891
899
|
] }));
|
|
892
900
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
893
|
-
var DialogTitle =
|
|
901
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
894
902
|
DialogPrimitive.Title,
|
|
895
903
|
{
|
|
896
904
|
ref,
|
|
@@ -899,7 +907,7 @@ var DialogTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
899
907
|
}
|
|
900
908
|
));
|
|
901
909
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
902
|
-
var DialogDescription =
|
|
910
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
903
911
|
DialogPrimitive.Description,
|
|
904
912
|
{
|
|
905
913
|
ref,
|
|
@@ -931,7 +939,7 @@ var toggleVariants = cva(
|
|
|
931
939
|
}
|
|
932
940
|
}
|
|
933
941
|
);
|
|
934
|
-
var Toggle =
|
|
942
|
+
var Toggle = React9.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
935
943
|
TogglePrimitive.Root,
|
|
936
944
|
{
|
|
937
945
|
ref,
|
|
@@ -940,11 +948,11 @@ var Toggle = React5.forwardRef(({ className, variant, size, ...props }, ref) =>
|
|
|
940
948
|
}
|
|
941
949
|
));
|
|
942
950
|
Toggle.displayName = TogglePrimitive.Root.displayName;
|
|
943
|
-
var ToggleGroupContext =
|
|
951
|
+
var ToggleGroupContext = React9.createContext({
|
|
944
952
|
size: "default",
|
|
945
953
|
variant: "default"
|
|
946
954
|
});
|
|
947
|
-
var ToggleGroup =
|
|
955
|
+
var ToggleGroup = React9.forwardRef(({ className, variant, size, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
948
956
|
ToggleGroupPrimitive.Root,
|
|
949
957
|
{
|
|
950
958
|
ref,
|
|
@@ -954,8 +962,8 @@ var ToggleGroup = React5.forwardRef(({ className, variant, size, children, ...pr
|
|
|
954
962
|
}
|
|
955
963
|
));
|
|
956
964
|
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
957
|
-
var ToggleGroupItem =
|
|
958
|
-
const context =
|
|
965
|
+
var ToggleGroupItem = React9.forwardRef(({ className, children, variant, size, ...props }, ref) => {
|
|
966
|
+
const context = React9.useContext(ToggleGroupContext);
|
|
959
967
|
return /* @__PURE__ */ jsx(
|
|
960
968
|
ToggleGroupPrimitive.Item,
|
|
961
969
|
{
|
|
@@ -1266,9 +1274,6 @@ function rowMeta(s, file, format) {
|
|
|
1266
1274
|
}
|
|
1267
1275
|
return parts.join(" \xB7 ");
|
|
1268
1276
|
}
|
|
1269
|
-
function drawsNothing(glyph) {
|
|
1270
|
-
return glyph === null || glyph === void 0 || typeof glyph === "boolean" || glyph === "";
|
|
1271
|
-
}
|
|
1272
1277
|
function FileRow({
|
|
1273
1278
|
file,
|
|
1274
1279
|
formats,
|
|
@@ -1866,7 +1871,7 @@ function ClearButton({ disabled, onClick }) {
|
|
|
1866
1871
|
}
|
|
1867
1872
|
var Select = SelectPrimitive.Root;
|
|
1868
1873
|
var SelectValue = SelectPrimitive.Value;
|
|
1869
|
-
var SelectTrigger =
|
|
1874
|
+
var SelectTrigger = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
1870
1875
|
SelectPrimitive.Trigger,
|
|
1871
1876
|
{
|
|
1872
1877
|
ref,
|
|
@@ -1885,7 +1890,7 @@ var SelectTrigger = React5.forwardRef(({ className, children, ...props }, ref) =
|
|
|
1885
1890
|
}
|
|
1886
1891
|
));
|
|
1887
1892
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
1888
|
-
var SelectScrollUpButton =
|
|
1893
|
+
var SelectScrollUpButton = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1889
1894
|
SelectPrimitive.ScrollUpButton,
|
|
1890
1895
|
{
|
|
1891
1896
|
ref,
|
|
@@ -1895,7 +1900,7 @@ var SelectScrollUpButton = React5.forwardRef(({ className, ...props }, ref) => /
|
|
|
1895
1900
|
}
|
|
1896
1901
|
));
|
|
1897
1902
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
1898
|
-
var SelectScrollDownButton =
|
|
1903
|
+
var SelectScrollDownButton = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1899
1904
|
SelectPrimitive.ScrollDownButton,
|
|
1900
1905
|
{
|
|
1901
1906
|
ref,
|
|
@@ -1905,7 +1910,7 @@ var SelectScrollDownButton = React5.forwardRef(({ className, ...props }, ref) =>
|
|
|
1905
1910
|
}
|
|
1906
1911
|
));
|
|
1907
1912
|
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
1908
|
-
var SelectContent =
|
|
1913
|
+
var SelectContent = React9.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
1909
1914
|
SelectPrimitive.Content,
|
|
1910
1915
|
{
|
|
1911
1916
|
ref,
|
|
@@ -1933,7 +1938,7 @@ var SelectContent = React5.forwardRef(({ className, children, position = "popper
|
|
|
1933
1938
|
}
|
|
1934
1939
|
) }));
|
|
1935
1940
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
1936
|
-
var SelectLabel =
|
|
1941
|
+
var SelectLabel = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1937
1942
|
SelectPrimitive.Label,
|
|
1938
1943
|
{
|
|
1939
1944
|
ref,
|
|
@@ -1942,7 +1947,7 @@ var SelectLabel = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1942
1947
|
}
|
|
1943
1948
|
));
|
|
1944
1949
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
1945
|
-
var SelectItem =
|
|
1950
|
+
var SelectItem = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
1946
1951
|
SelectPrimitive.Item,
|
|
1947
1952
|
{
|
|
1948
1953
|
ref,
|
|
@@ -1958,7 +1963,7 @@ var SelectItem = React5.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
1958
1963
|
}
|
|
1959
1964
|
));
|
|
1960
1965
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
1961
|
-
var SelectSeparator =
|
|
1966
|
+
var SelectSeparator = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1962
1967
|
SelectPrimitive.Separator,
|
|
1963
1968
|
{
|
|
1964
1969
|
ref,
|
|
@@ -2927,7 +2932,7 @@ function FieldRenderer({ field, value, onChange, id, error, env }) {
|
|
|
2927
2932
|
}
|
|
2928
2933
|
}
|
|
2929
2934
|
var AlertDialog = AlertDialogPrimitive.Root;
|
|
2930
|
-
var AlertDialogContent =
|
|
2935
|
+
var AlertDialogContent = React9.forwardRef(({ className, returnFocus, onCloseAutoFocus, ...props }, ref) => /* @__PURE__ */ jsxs(DialogSurface, { children: [
|
|
2931
2936
|
/* @__PURE__ */ jsx(AlertDialogPrimitive.Overlay, { className: "fixed inset-0 z-50 bg-black/50" }),
|
|
2932
2937
|
/* @__PURE__ */ jsx(
|
|
2933
2938
|
AlertDialogPrimitive.Content,
|
|
@@ -2943,7 +2948,7 @@ var AlertDialogContent = React5.forwardRef(({ className, returnFocus, onCloseAut
|
|
|
2943
2948
|
)
|
|
2944
2949
|
] }));
|
|
2945
2950
|
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
2946
|
-
var AlertDialogTitle =
|
|
2951
|
+
var AlertDialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2947
2952
|
AlertDialogPrimitive.Title,
|
|
2948
2953
|
{
|
|
2949
2954
|
ref,
|
|
@@ -2952,7 +2957,7 @@ var AlertDialogTitle = React5.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
2952
2957
|
}
|
|
2953
2958
|
));
|
|
2954
2959
|
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
2955
|
-
var AlertDialogDescription =
|
|
2960
|
+
var AlertDialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2956
2961
|
AlertDialogPrimitive.Description,
|
|
2957
2962
|
{
|
|
2958
2963
|
ref,
|
|
@@ -2965,7 +2970,7 @@ var AlertDialogCancel = AlertDialogPrimitive.Cancel;
|
|
|
2965
2970
|
var AlertDialogAction = AlertDialogPrimitive.Action;
|
|
2966
2971
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
2967
2972
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
2968
|
-
var DropdownMenuContent =
|
|
2973
|
+
var DropdownMenuContent = React9.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2969
2974
|
DropdownMenuPrimitive.Content,
|
|
2970
2975
|
{
|
|
2971
2976
|
ref,
|
|
@@ -2978,7 +2983,7 @@ var DropdownMenuContent = React5.forwardRef(({ className, sideOffset = 4, ...pro
|
|
|
2978
2983
|
}
|
|
2979
2984
|
));
|
|
2980
2985
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
2981
|
-
var DropdownMenuItem =
|
|
2986
|
+
var DropdownMenuItem = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2982
2987
|
DropdownMenuPrimitive.Item,
|
|
2983
2988
|
{
|
|
2984
2989
|
ref,
|
|
@@ -3024,6 +3029,8 @@ function FillWithExample({
|
|
|
3024
3029
|
const afterControl = useRef(null);
|
|
3025
3030
|
const rows = useRef(/* @__PURE__ */ new Map());
|
|
3026
3031
|
const menus = useRef(/* @__PURE__ */ new Map());
|
|
3032
|
+
const handingOver = useRef(null);
|
|
3033
|
+
const latestChoice = useRef(() => void 0);
|
|
3027
3034
|
const afterRowDialog = useRef(null);
|
|
3028
3035
|
const register = (map, id) => (element) => {
|
|
3029
3036
|
map.set(id, element);
|
|
@@ -3044,7 +3051,12 @@ function FillWithExample({
|
|
|
3044
3051
|
setRenaming(null);
|
|
3045
3052
|
setDeleting(null);
|
|
3046
3053
|
}
|
|
3047
|
-
|
|
3054
|
+
const hidden = source.hideWhenEmpty === true && !open && (answer ?? hasExamples) !== true;
|
|
3055
|
+
if (hidden && (replacing || renaming || deleting)) {
|
|
3056
|
+
setReplacing(null);
|
|
3057
|
+
setRenaming(null);
|
|
3058
|
+
setDeleting(null);
|
|
3059
|
+
}
|
|
3048
3060
|
const closeList = () => {
|
|
3049
3061
|
if (source.hideWhenEmpty && pages.status === "ready") {
|
|
3050
3062
|
if (pages.items.length > 0) setHasExamples(true);
|
|
@@ -3060,13 +3072,27 @@ function FillWithExample({
|
|
|
3060
3072
|
if (disabled) return;
|
|
3061
3073
|
onFill(runValuesFromInputs(example.inputs, fields), example);
|
|
3062
3074
|
setReplacing(null);
|
|
3063
|
-
closeList();
|
|
3075
|
+
if (open) closeList();
|
|
3064
3076
|
};
|
|
3065
3077
|
const choose = (example) => {
|
|
3078
|
+
if (disabled) return;
|
|
3066
3079
|
if (touched) setReplacing(example);
|
|
3067
3080
|
else fill(example);
|
|
3068
3081
|
};
|
|
3069
|
-
|
|
3082
|
+
useEffect(() => {
|
|
3083
|
+
latestChoice.current = hidden ? () => void 0 : choose;
|
|
3084
|
+
return () => {
|
|
3085
|
+
latestChoice.current = () => void 0;
|
|
3086
|
+
};
|
|
3087
|
+
});
|
|
3088
|
+
if (hidden) return null;
|
|
3089
|
+
const manages = source.open !== void 0 || source.rename !== void 0 || source.delete !== void 0;
|
|
3090
|
+
const handOver2 = () => {
|
|
3091
|
+
const example = handingOver.current;
|
|
3092
|
+
handingOver.current = null;
|
|
3093
|
+
if (!example || !source.open) return;
|
|
3094
|
+
queueMicrotask(() => source.open?.(example, () => latestChoice.current(example)));
|
|
3095
|
+
};
|
|
3070
3096
|
const status = pages.status === "idle" || pages.status === "loading" ? s.examplesLoading : pages.status === "failed" ? s.examplesFailed : pages.more === "failed" ? s.loadMoreFailed : pages.items.length > 0 ? s.examplesShown(pages.items.length) : pages.empty ? s.examplesNone : s.examplesLoading;
|
|
3071
3097
|
const returnFromRowDialog = () => {
|
|
3072
3098
|
const next = afterRowDialog.current;
|
|
@@ -3109,6 +3135,7 @@ function FillWithExample({
|
|
|
3109
3135
|
className: "top-auto max-h-[calc(100dvh-1.5rem)]",
|
|
3110
3136
|
ref: sheet,
|
|
3111
3137
|
returnFocus: () => control.current ?? afterControl.current,
|
|
3138
|
+
onCloseAutoFocus: handOver2,
|
|
3112
3139
|
children: [
|
|
3113
3140
|
/* @__PURE__ */ jsx("div", { className: "px-4 pt-4 pb-3", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
3114
3141
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 space-y-1 pt-1", children: [
|
|
@@ -3141,7 +3168,13 @@ function FillWithExample({
|
|
|
3141
3168
|
"flex min-h-16 min-w-0 flex-1 items-center px-4 py-2.5 text-left transition-colors hover:bg-muted/60",
|
|
3142
3169
|
focusOutlineInsetClass
|
|
3143
3170
|
),
|
|
3144
|
-
children: /* @__PURE__ */ jsx(
|
|
3171
|
+
children: /* @__PURE__ */ jsx(
|
|
3172
|
+
ExampleRowText,
|
|
3173
|
+
{
|
|
3174
|
+
name: example.name,
|
|
3175
|
+
detail: source.renderDetail?.(example, fields)
|
|
3176
|
+
}
|
|
3177
|
+
)
|
|
3145
3178
|
}
|
|
3146
3179
|
),
|
|
3147
3180
|
manages && // Not modal, so the question a menu item opens takes
|
|
@@ -3160,6 +3193,16 @@ function FillWithExample({
|
|
|
3160
3193
|
}
|
|
3161
3194
|
),
|
|
3162
3195
|
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", children: [
|
|
3196
|
+
source.open && /* @__PURE__ */ jsx(
|
|
3197
|
+
DropdownMenuItem,
|
|
3198
|
+
{
|
|
3199
|
+
onSelect: () => {
|
|
3200
|
+
handingOver.current = example;
|
|
3201
|
+
closeList();
|
|
3202
|
+
},
|
|
3203
|
+
children: s.openExample
|
|
3204
|
+
}
|
|
3205
|
+
),
|
|
3163
3206
|
source.rename && /* @__PURE__ */ jsx(DropdownMenuItem, { onSelect: () => setRenaming(example), children: s.renameExample }),
|
|
3164
3207
|
source.delete && /* @__PURE__ */ jsx(
|
|
3165
3208
|
DropdownMenuItem,
|
|
@@ -3209,7 +3252,7 @@ function FillWithExample({
|
|
|
3209
3252
|
RenameExampleDialog,
|
|
3210
3253
|
{
|
|
3211
3254
|
example: renaming,
|
|
3212
|
-
rename: source.rename,
|
|
3255
|
+
rename: source.rename.bind(source),
|
|
3213
3256
|
returnFocus: returnFromRowDialog,
|
|
3214
3257
|
onDone: (renamed) => {
|
|
3215
3258
|
pages.updateItems(
|
|
@@ -3228,7 +3271,7 @@ function FillWithExample({
|
|
|
3228
3271
|
DeleteExampleDialog,
|
|
3229
3272
|
{
|
|
3230
3273
|
example: deleting,
|
|
3231
|
-
remove: source.delete,
|
|
3274
|
+
remove: source.delete.bind(source),
|
|
3232
3275
|
returnFocus: returnFromRowDialog,
|
|
3233
3276
|
onDone: (deleted) => {
|
|
3234
3277
|
const index = pages.items.findIndex((item) => item.id === deleted.id);
|
|
@@ -3245,6 +3288,22 @@ function FillWithExample({
|
|
|
3245
3288
|
)
|
|
3246
3289
|
] });
|
|
3247
3290
|
}
|
|
3291
|
+
function ExampleRowText({ name, detail }) {
|
|
3292
|
+
return /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
3293
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate text-[16px] font-medium text-foreground", children: name }),
|
|
3294
|
+
!drawsNothing(detail) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3295
|
+
" ",
|
|
3296
|
+
/* @__PURE__ */ jsx(
|
|
3297
|
+
"span",
|
|
3298
|
+
{
|
|
3299
|
+
"data-slot": "example-row-detail",
|
|
3300
|
+
className: "mt-0.5 block text-[13px] wrap-break-word text-muted-foreground",
|
|
3301
|
+
children: detail
|
|
3302
|
+
}
|
|
3303
|
+
)
|
|
3304
|
+
] })
|
|
3305
|
+
] });
|
|
3306
|
+
}
|
|
3248
3307
|
function RenameExampleDialog({
|
|
3249
3308
|
example,
|
|
3250
3309
|
rename,
|
|
@@ -4388,7 +4447,7 @@ function usePdfViewer() {
|
|
|
4388
4447
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
4389
4448
|
var TooltipRoot = TooltipPrimitive.Root;
|
|
4390
4449
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
4391
|
-
var TooltipContent =
|
|
4450
|
+
var TooltipContent = React9.forwardRef(({ className, sideOffset = 6, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
4392
4451
|
TooltipPrimitive.Content,
|
|
4393
4452
|
{
|
|
4394
4453
|
ref,
|
|
@@ -5604,13 +5663,14 @@ function isTextEntry(target) {
|
|
|
5604
5663
|
return target.isContentEditable || target.closest("input, textarea, select") !== null;
|
|
5605
5664
|
}
|
|
5606
5665
|
var LEX_OPTIONS = { gfm: true, breaks: true };
|
|
5607
|
-
function Markdown({ text, className, proseImages }) {
|
|
5608
|
-
const tokens =
|
|
5666
|
+
function Markdown({ text, className, proseImages, citations }) {
|
|
5667
|
+
const tokens = React9.useMemo(() => marked.lexer(text, LEX_OPTIONS), [text]);
|
|
5609
5668
|
const fromEnv = useProseImages();
|
|
5610
5669
|
const mode = proseImages ?? fromEnv;
|
|
5611
|
-
return /* @__PURE__ */ jsx(ProseImagesContext, { value: mode, children: /* @__PURE__ */ jsx("div", { className: cn("space-y-2 text-[13px] leading-relaxed text-foreground", className), children: /* @__PURE__ */ jsx(Blocks, { tokens }) }) });
|
|
5670
|
+
return /* @__PURE__ */ jsx(ProseImagesContext, { value: mode, children: /* @__PURE__ */ jsx(CitationsContext, { value: citations, children: /* @__PURE__ */ jsx("div", { className: cn("space-y-2 text-[13px] leading-relaxed text-foreground", className), children: /* @__PURE__ */ jsx(Blocks, { tokens }) }) }) });
|
|
5612
5671
|
}
|
|
5613
|
-
var ProseImagesContext =
|
|
5672
|
+
var ProseImagesContext = React9.createContext("link");
|
|
5673
|
+
var CitationsContext = React9.createContext(void 0);
|
|
5614
5674
|
var HEADING_CLASS = {
|
|
5615
5675
|
1: "text-[16px] font-semibold",
|
|
5616
5676
|
2: "text-[14.5px] font-semibold",
|
|
@@ -5727,7 +5787,7 @@ function InlineToken({ token }) {
|
|
|
5727
5787
|
switch (token.type) {
|
|
5728
5788
|
case "text": {
|
|
5729
5789
|
const text = token;
|
|
5730
|
-
return text.tokens ? /* @__PURE__ */ jsx(Inline, { tokens: text.tokens }) : /* @__PURE__ */ jsx(
|
|
5790
|
+
return text.tokens ? /* @__PURE__ */ jsx(Inline, { tokens: text.tokens }) : /* @__PURE__ */ jsx(CitedText, { text: decode(text.text) });
|
|
5731
5791
|
}
|
|
5732
5792
|
case "escape":
|
|
5733
5793
|
return /* @__PURE__ */ jsx(Fragment, { children: token.text });
|
|
@@ -5744,7 +5804,9 @@ function InlineToken({ token }) {
|
|
|
5744
5804
|
case "link": {
|
|
5745
5805
|
const link = token;
|
|
5746
5806
|
const href = safeHref(link.href);
|
|
5747
|
-
if (!href)
|
|
5807
|
+
if (!href) {
|
|
5808
|
+
return /* @__PURE__ */ jsx(CitationsContext, { value: void 0, children: /* @__PURE__ */ jsx(Inline, { tokens: link.tokens }) });
|
|
5809
|
+
}
|
|
5748
5810
|
return (
|
|
5749
5811
|
// The flag is set for everything under the anchor, so a nested `image`
|
|
5750
5812
|
// token knows not to open one of its own — see {@link ProseImage}.
|
|
@@ -5766,9 +5828,34 @@ function InlineToken({ token }) {
|
|
|
5766
5828
|
return /* @__PURE__ */ jsx(Fragment, { children: rawOf(token) });
|
|
5767
5829
|
}
|
|
5768
5830
|
}
|
|
5831
|
+
function CitedText({ text }) {
|
|
5832
|
+
const citations = React9.use(CitationsContext);
|
|
5833
|
+
const insideLink = React9.use(InsideLinkContext);
|
|
5834
|
+
if (!citations || insideLink) return /* @__PURE__ */ jsx(Fragment, { children: text });
|
|
5835
|
+
return /* @__PURE__ */ jsx(Fragment, { children: splitCitations(text).map((segment, index) => {
|
|
5836
|
+
const target = "citation" in segment ? citations(segment.citation) : void 0;
|
|
5837
|
+
const href = target ? webHref(target.href) : void 0;
|
|
5838
|
+
if (!target || !href) return /* @__PURE__ */ jsx(React9.Fragment, { children: segment.text }, index);
|
|
5839
|
+
return /* @__PURE__ */ jsx(
|
|
5840
|
+
"a",
|
|
5841
|
+
{
|
|
5842
|
+
href,
|
|
5843
|
+
target: "_blank",
|
|
5844
|
+
rel: "noopener noreferrer",
|
|
5845
|
+
title: target.label,
|
|
5846
|
+
className: cn(
|
|
5847
|
+
"mx-px whitespace-nowrap rounded-sm underline underline-offset-2",
|
|
5848
|
+
focusOutlineClass
|
|
5849
|
+
),
|
|
5850
|
+
children: segment.text
|
|
5851
|
+
},
|
|
5852
|
+
index
|
|
5853
|
+
);
|
|
5854
|
+
}) });
|
|
5855
|
+
}
|
|
5769
5856
|
function ProseImage({ token }) {
|
|
5770
|
-
const mode =
|
|
5771
|
-
const insideLink =
|
|
5857
|
+
const mode = React9.use(ProseImagesContext);
|
|
5858
|
+
const insideLink = React9.use(InsideLinkContext);
|
|
5772
5859
|
const src = proseImageUrl(token.href);
|
|
5773
5860
|
if (!src) return /* @__PURE__ */ jsx(Fragment, { children: token.text });
|
|
5774
5861
|
if (mode === "load") {
|
|
@@ -5794,7 +5881,7 @@ function ProseImage({ token }) {
|
|
|
5794
5881
|
}
|
|
5795
5882
|
);
|
|
5796
5883
|
}
|
|
5797
|
-
var InsideLinkContext =
|
|
5884
|
+
var InsideLinkContext = React9.createContext(false);
|
|
5798
5885
|
function proseImageUrl(href) {
|
|
5799
5886
|
const url = viewableUrl(href);
|
|
5800
5887
|
return url && /^https?:/.test(url) ? url : void 0;
|
|
@@ -7864,6 +7951,64 @@ function VerdictValue({ reading, prominent }) {
|
|
|
7864
7951
|
reading.measure !== void 0 && /* @__PURE__ */ jsx("p", { className: "text-[12.5px] text-muted-foreground", children: reading.measure })
|
|
7865
7952
|
] });
|
|
7866
7953
|
}
|
|
7954
|
+
function SearchResultValue({ content }) {
|
|
7955
|
+
const s = useFieldStrings();
|
|
7956
|
+
const headingId = useId();
|
|
7957
|
+
const citations = (citation) => {
|
|
7958
|
+
const source = citedSource(content, citation);
|
|
7959
|
+
return source?.href ? { href: source.href, label: source.title ?? source.address } : void 0;
|
|
7960
|
+
};
|
|
7961
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
7962
|
+
content.answer.trim() === "" ? /* @__PURE__ */ jsx(Absent, {}) : /* @__PURE__ */ jsx(Markdown, { text: content.answer, citations }),
|
|
7963
|
+
content.sources.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
7964
|
+
/* @__PURE__ */ jsx("p", { id: headingId, className: "text-[12px] font-medium text-muted-foreground", children: s.searchSources }),
|
|
7965
|
+
/* @__PURE__ */ jsx(
|
|
7966
|
+
"ul",
|
|
7967
|
+
{
|
|
7968
|
+
"aria-labelledby": headingId,
|
|
7969
|
+
className: "grid grid-cols-[max-content_minmax(0,1fr)] gap-x-2 gap-y-1",
|
|
7970
|
+
children: content.sources.map((source) => /* @__PURE__ */ jsxs(
|
|
7971
|
+
"li",
|
|
7972
|
+
{
|
|
7973
|
+
className: "col-span-2 grid grid-cols-subgrid items-baseline",
|
|
7974
|
+
children: [
|
|
7975
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-[11px] tabular-nums text-muted-foreground", children: source.citations.map((citation) => `[${citation}]`).join("") }),
|
|
7976
|
+
/* @__PURE__ */ jsx(SearchSource, { source })
|
|
7977
|
+
]
|
|
7978
|
+
},
|
|
7979
|
+
source.citations[0]
|
|
7980
|
+
))
|
|
7981
|
+
}
|
|
7982
|
+
)
|
|
7983
|
+
] })
|
|
7984
|
+
] });
|
|
7985
|
+
}
|
|
7986
|
+
function SearchSource({ source }) {
|
|
7987
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7988
|
+
/* @__PURE__ */ jsx(
|
|
7989
|
+
"span",
|
|
7990
|
+
{
|
|
7991
|
+
className: cn(
|
|
7992
|
+
"text-[13px] leading-5 wrap-anywhere text-foreground",
|
|
7993
|
+
source.href && "underline underline-offset-2"
|
|
7994
|
+
),
|
|
7995
|
+
children: source.title ?? source.address
|
|
7996
|
+
}
|
|
7997
|
+
),
|
|
7998
|
+
source.host && /* @__PURE__ */ jsx("span", { className: "block text-[12px] leading-4 text-muted-foreground wrap-anywhere", children: source.host })
|
|
7999
|
+
] });
|
|
8000
|
+
if (!source.href) return /* @__PURE__ */ jsx("div", { className: "min-w-0", children: body });
|
|
8001
|
+
return /* @__PURE__ */ jsx(
|
|
8002
|
+
"a",
|
|
8003
|
+
{
|
|
8004
|
+
href: source.href,
|
|
8005
|
+
target: "_blank",
|
|
8006
|
+
rel: "noopener noreferrer",
|
|
8007
|
+
className: cn("block min-w-0 rounded-sm max-sm:py-1.5", focusOutlineClass),
|
|
8008
|
+
children: body
|
|
8009
|
+
}
|
|
8010
|
+
);
|
|
8011
|
+
}
|
|
7867
8012
|
function isLongText(value) {
|
|
7868
8013
|
return typeof value === "string" && (value.includes("\n") || value.length > CELL_LENGTH_LIMIT);
|
|
7869
8014
|
}
|
|
@@ -7948,6 +8093,16 @@ function ResultNode({
|
|
|
7948
8093
|
/* @__PURE__ */ jsx(VerdictValue, { reading, prominent: whole })
|
|
7949
8094
|
] });
|
|
7950
8095
|
}
|
|
8096
|
+
const search = isApp && isNativeSearchResultNode(field) ? readSearchResultContent(unwrapped) : void 0;
|
|
8097
|
+
if (search) {
|
|
8098
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
8099
|
+
search.answer.trim() === "" ? header : /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
8100
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: header }),
|
|
8101
|
+
/* @__PURE__ */ jsx(CopyButton, { value: search.answer, label: s.copyText })
|
|
8102
|
+
] }),
|
|
8103
|
+
/* @__PURE__ */ jsx(SearchResultValue, { content: search })
|
|
8104
|
+
] });
|
|
8105
|
+
}
|
|
7951
8106
|
switch (field.kind) {
|
|
7952
8107
|
case "object": {
|
|
7953
8108
|
const memberValue = (child) => typeof unwrapped === "object" && unwrapped !== null ? ownProp(unwrapped, child.name) : void 0;
|
|
@@ -8033,9 +8188,12 @@ function ResultNode({
|
|
|
8033
8188
|
) : isApp && nativeVerdictOf(field.item) ? (
|
|
8034
8189
|
// Verdicts in `app`, one per line, each drawn by the verdict arm.
|
|
8035
8190
|
/* @__PURE__ */ jsx("div", { className: "divide-y divide-border/60 overflow-hidden rounded-lg border border-border", children: items.map((item, index) => /* @__PURE__ */ jsx("div", { className: "bg-card/40 px-3 py-1.5", children: /* @__PURE__ */ jsx(ResultAt, { segment: String(index), children: /* @__PURE__ */ jsx(ResultField, { field: field.item, value: item, depth: depth + 1, hideLabel: true }) }) }, index)) })
|
|
8036
|
-
) : columns ? (
|
|
8191
|
+
) : columns && !(isApp && isNativeSearchResultNode(field.item)) ? (
|
|
8037
8192
|
// Same shape every row: the labels are column headers, not per-row
|
|
8038
|
-
// labels. See `ObjectTable`.
|
|
8193
|
+
// labels. See `ObjectTable`. A list of search results in `app` is
|
|
8194
|
+
// the exception: a row would hide each answer's citations and its
|
|
8195
|
+
// sources until it is opened, so each search takes a card of its
|
|
8196
|
+
// own below and is drawn by the search arm. `studio` keeps the table.
|
|
8039
8197
|
/* @__PURE__ */ jsx(
|
|
8040
8198
|
ObjectTable,
|
|
8041
8199
|
{
|
|
@@ -8351,5 +8509,5 @@ function pdfFileName(field, value, baseName) {
|
|
|
8351
8509
|
}
|
|
8352
8510
|
|
|
8353
8511
|
export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, EN_FIELD_STRINGS, EnumField, FIELD_STRINGS_BY_LOCALE, FR_FIELD_STRINGS, FieldDomIdProvider, FieldPresentationProvider, FieldRenderer, FieldShell, FieldStringsProvider, FilePicker, FilePickerEntry, FillWithExample, HtmlPreview, ImageField, JsonView, ListField, Markdown, MethodForm, NumberField, ObjectField, OptionalToggle, PdfDownloadButton, ProseField, ResultEnvProvider, ResultField, ResultRoot, SUPPORTED_LOCALES, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, StuffViewer, Switch, TextField, ToggleGroup, ToggleGroupItem, UnknownField, checkedAccentClass, cn, fieldControlClass, fieldStringsFor, focusOutlineClass, humanizeFieldName, linkTextClass, renderHtmlPdf, resolveHtmlStorageUrls, saveInBrowser, selectedBorderClass, selectedFillClass, selectedFillStrongClass, useFieldDomId, useFieldPresentation, useFieldStrings, useMethodForm, useProseImages, useResolveRendition, useResolveShareUrl, useResolveUrl, useResolvedUrl };
|
|
8354
|
-
//# sourceMappingURL=chunk-
|
|
8355
|
-
//# sourceMappingURL=chunk-
|
|
8512
|
+
//# sourceMappingURL=chunk-II5TOORN.js.map
|
|
8513
|
+
//# sourceMappingURL=chunk-II5TOORN.js.map
|