@pipelex/mthds-form 0.36.0 → 0.36.2
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-ROM2KLQD.js → chunk-7SOGQRMN.js} +95 -41
- package/dist/chunk-7SOGQRMN.js.map +1 -0
- package/dist/generative/index.js +1 -1
- package/dist/react/index.d.ts +14 -6
- package/dist/react/index.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/chunk-ROM2KLQD.js.map +0 -1
|
@@ -7168,11 +7168,12 @@ function FileRef({
|
|
|
7168
7168
|
storageUrl,
|
|
7169
7169
|
mimeType,
|
|
7170
7170
|
filename,
|
|
7171
|
+
label: named,
|
|
7171
7172
|
file
|
|
7172
7173
|
}) {
|
|
7173
7174
|
const s = useFieldStrings();
|
|
7174
7175
|
const encoded = encodedFileSummary(url, s);
|
|
7175
|
-
const label = filename ? filename : encoded ?? pathLabel(url);
|
|
7176
|
+
const label = named ?? (filename ? filename : encoded ?? pathLabel(url));
|
|
7176
7177
|
const reference = encoded ?? url;
|
|
7177
7178
|
const title = mimeType ? `${reference} \xB7 ${mimeType}` : reference;
|
|
7178
7179
|
const href = viewableUrl(url);
|
|
@@ -7194,7 +7195,7 @@ function FileRef({
|
|
|
7194
7195
|
"span",
|
|
7195
7196
|
{
|
|
7196
7197
|
title,
|
|
7197
|
-
className: "min-w-0 truncate font-mono text-[12px] text-muted-foreground",
|
|
7198
|
+
className: "min-w-0 truncate font-mono text-[12px] text-muted-foreground max-sm:leading-11",
|
|
7198
7199
|
children: label
|
|
7199
7200
|
}
|
|
7200
7201
|
),
|
|
@@ -7382,10 +7383,12 @@ function PdfUnavailable({
|
|
|
7382
7383
|
function ConvertedDocumentPreview({
|
|
7383
7384
|
ask,
|
|
7384
7385
|
name,
|
|
7385
|
-
file
|
|
7386
|
+
file,
|
|
7387
|
+
whole
|
|
7386
7388
|
}) {
|
|
7387
7389
|
const s = useFieldStrings();
|
|
7388
7390
|
const { answer, retry } = useDocumentPdf(ask);
|
|
7391
|
+
const size = whole ? WHOLE_RESULT_FRAME : NESTED_FRAME;
|
|
7389
7392
|
const preparing = useRef(null);
|
|
7390
7393
|
const retried = useRef(false);
|
|
7391
7394
|
useEffect(() => {
|
|
@@ -7401,7 +7404,7 @@ function ConvertedDocumentPreview({
|
|
|
7401
7404
|
role: "status",
|
|
7402
7405
|
tabIndex: -1,
|
|
7403
7406
|
className: cn(
|
|
7404
|
-
|
|
7407
|
+
size,
|
|
7405
7408
|
"flex items-center justify-center gap-2 rounded-lg border border-border bg-card/40 text-[12px] text-muted-foreground outline-none"
|
|
7406
7409
|
),
|
|
7407
7410
|
children: [
|
|
@@ -7412,35 +7415,47 @@ function ConvertedDocumentPreview({
|
|
|
7412
7415
|
);
|
|
7413
7416
|
}
|
|
7414
7417
|
if (answer.state === "failed") {
|
|
7415
|
-
return /* @__PURE__ */ jsxs(
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7418
|
+
return /* @__PURE__ */ jsxs(
|
|
7419
|
+
"div",
|
|
7420
|
+
{
|
|
7421
|
+
className: cn(
|
|
7422
|
+
"flex flex-col gap-3 rounded-lg border border-border bg-card/40 px-3.5 py-3",
|
|
7423
|
+
whole ? cn(size, "items-center justify-center") : "sm:flex-row sm:items-center"
|
|
7424
|
+
),
|
|
7425
|
+
children: [
|
|
7426
|
+
/* @__PURE__ */ jsxs(
|
|
7427
|
+
"p",
|
|
7428
|
+
{
|
|
7429
|
+
role: "alert",
|
|
7430
|
+
className: cn(
|
|
7431
|
+
"flex min-w-0 items-start gap-2 text-[12.5px] leading-relaxed text-muted-foreground",
|
|
7432
|
+
!whole && "flex-1"
|
|
7433
|
+
),
|
|
7434
|
+
children: [
|
|
7435
|
+
/* @__PURE__ */ jsx(TriangleAlert, { "aria-hidden": true, className: "mt-0.5 size-3.5 shrink-0" }),
|
|
7436
|
+
/* @__PURE__ */ jsx("span", { children: answer.message ?? s.documentPdfFailed })
|
|
7437
|
+
]
|
|
7438
|
+
}
|
|
7439
|
+
),
|
|
7440
|
+
/* @__PURE__ */ jsx(
|
|
7441
|
+
"button",
|
|
7442
|
+
{
|
|
7443
|
+
type: "button",
|
|
7444
|
+
onClick: () => {
|
|
7445
|
+
retried.current = true;
|
|
7446
|
+
retry();
|
|
7447
|
+
},
|
|
7448
|
+
className: cn(CARD_ACTION, "text-foreground", focusOutlineClass),
|
|
7449
|
+
children: s.tryAgain
|
|
7450
|
+
}
|
|
7451
|
+
)
|
|
7452
|
+
]
|
|
7453
|
+
}
|
|
7454
|
+
);
|
|
7440
7455
|
}
|
|
7441
7456
|
const gated = answer.state === "ready" ? viewableUrl(answer.url) : void 0;
|
|
7442
7457
|
const url = gated && frameableUrl({ url: gated, fromResolver: true });
|
|
7443
|
-
if (url) return /* @__PURE__ */ jsx(DocumentPreview, { url, name, pdf: true, file, whole
|
|
7458
|
+
if (url) return /* @__PURE__ */ jsx(DocumentPreview, { url, name, pdf: true, file, whole });
|
|
7444
7459
|
return /* @__PURE__ */ jsx(
|
|
7445
7460
|
"p",
|
|
7446
7461
|
{
|
|
@@ -7450,32 +7465,49 @@ function ConvertedDocumentPreview({
|
|
|
7450
7465
|
}
|
|
7451
7466
|
);
|
|
7452
7467
|
}
|
|
7453
|
-
function DocumentValue({
|
|
7468
|
+
function DocumentValue({
|
|
7469
|
+
value,
|
|
7470
|
+
whole = false,
|
|
7471
|
+
startsOpen = false
|
|
7472
|
+
}) {
|
|
7454
7473
|
const s = useFieldStrings();
|
|
7455
7474
|
const resolve = useResolveUrl();
|
|
7456
7475
|
const resolveDocumentPdf = useResolveDocumentPdf();
|
|
7457
7476
|
const isApp = useFieldPresentation() === "app";
|
|
7458
|
-
const [open, setOpen] = useState(
|
|
7477
|
+
const [open, setOpen] = useState(startsOpen);
|
|
7459
7478
|
const file = useStuffFile("document", value);
|
|
7460
7479
|
const content = readDocumentContent(value);
|
|
7461
7480
|
if (!content) return /* @__PURE__ */ jsx(Absent, {});
|
|
7462
|
-
const
|
|
7481
|
+
const label = fileLabel(content.url, content.filename, s);
|
|
7482
|
+
const title = content.title?.trim();
|
|
7483
|
+
const heading = title && title !== label ? title : void 0;
|
|
7484
|
+
const name = title || label;
|
|
7463
7485
|
const preview = previewableUrl(content, resolve);
|
|
7464
7486
|
const pdf = preview !== void 0 && isPdfDocument(content, preview);
|
|
7465
|
-
const opened = whole && isApp && pdf;
|
|
7466
7487
|
const askPdf = preview === void 0 && !browserRenders(content, content.url) ? resolveDocumentPdf?.(content.url, {
|
|
7467
7488
|
filename: content.filename,
|
|
7468
7489
|
mimeType: content.mimeType
|
|
7469
7490
|
}) : void 0;
|
|
7491
|
+
const opened = whole && isApp && (preview !== void 0 || askPdf !== void 0);
|
|
7470
7492
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
7471
7493
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-start gap-2.5", children: [
|
|
7472
|
-
/* @__PURE__ */ jsx(
|
|
7494
|
+
/* @__PURE__ */ jsx(
|
|
7495
|
+
FileText,
|
|
7496
|
+
{
|
|
7497
|
+
"aria-hidden": true,
|
|
7498
|
+
className: cn(
|
|
7499
|
+
"mt-0.5 size-4 shrink-0 text-muted-foreground",
|
|
7500
|
+
!heading && "max-sm:mt-3.5"
|
|
7501
|
+
)
|
|
7502
|
+
}
|
|
7503
|
+
),
|
|
7473
7504
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 space-y-0.5", children: [
|
|
7474
|
-
|
|
7505
|
+
heading && /* @__PURE__ */ jsx("span", { className: "block truncate text-[13px] text-foreground", children: heading }),
|
|
7475
7506
|
/* @__PURE__ */ jsx(
|
|
7476
7507
|
FileRef,
|
|
7477
7508
|
{
|
|
7478
7509
|
url: paintableUrl(content, resolve) ?? content.url,
|
|
7510
|
+
label,
|
|
7479
7511
|
storageUrl: content.url,
|
|
7480
7512
|
mimeType: content.mimeType,
|
|
7481
7513
|
...content.filename ? { filename: content.filename } : {},
|
|
@@ -7502,7 +7534,16 @@ function DocumentValue({ value, whole = false }) {
|
|
|
7502
7534
|
)
|
|
7503
7535
|
] }),
|
|
7504
7536
|
preview && (opened || open) && /* @__PURE__ */ jsx(DocumentPreview, { url: preview, name, pdf, file, whole: opened }),
|
|
7505
|
-
askPdf && open && /* @__PURE__ */ jsx(
|
|
7537
|
+
askPdf && (opened || open) && /* @__PURE__ */ jsx(
|
|
7538
|
+
ConvertedDocumentPreview,
|
|
7539
|
+
{
|
|
7540
|
+
ask: askPdf,
|
|
7541
|
+
name,
|
|
7542
|
+
file,
|
|
7543
|
+
whole: opened
|
|
7544
|
+
},
|
|
7545
|
+
content.url
|
|
7546
|
+
)
|
|
7506
7547
|
] });
|
|
7507
7548
|
}
|
|
7508
7549
|
var TILE_RENDITION_SIDE = 576;
|
|
@@ -8569,6 +8610,17 @@ function PanelResult({
|
|
|
8569
8610
|
}) {
|
|
8570
8611
|
return /* @__PURE__ */ jsx(PanelResultContext, { value: hostHeaded ? HOST_HEADED_PANEL : TITLED_PANEL, children });
|
|
8571
8612
|
}
|
|
8613
|
+
var DeliveredDocumentContext = createContext(false);
|
|
8614
|
+
function loneDocumentMember(field) {
|
|
8615
|
+
let lone;
|
|
8616
|
+
for (const child of field.fields) {
|
|
8617
|
+
if (child.kind === "list" && child.item.kind === "document") return void 0;
|
|
8618
|
+
if (child.kind !== "document") continue;
|
|
8619
|
+
if (lone !== void 0) return void 0;
|
|
8620
|
+
lone = child.name;
|
|
8621
|
+
}
|
|
8622
|
+
return lone;
|
|
8623
|
+
}
|
|
8572
8624
|
function ResultField(props) {
|
|
8573
8625
|
const location = useResultLocation();
|
|
8574
8626
|
const panel = use(PanelResultContext);
|
|
@@ -8590,6 +8642,7 @@ function ResultNode({
|
|
|
8590
8642
|
const pdfShown = usePdfSaveShown();
|
|
8591
8643
|
const location = useResultLocation();
|
|
8592
8644
|
const isApp = useFieldPresentation() === "app";
|
|
8645
|
+
const delivered = use(DeliveredDocumentContext);
|
|
8593
8646
|
const header = hideLabel ? null : /* @__PURE__ */ jsx(Label2, { field, describe: true });
|
|
8594
8647
|
const copyText = (field.kind === "text" || field.kind === "prose") && typeof unwrapped === "string" && unwrapped !== "" ? unwrapped : void 0;
|
|
8595
8648
|
if (isNativeDateNode(field)) {
|
|
@@ -8655,6 +8708,7 @@ function ResultNode({
|
|
|
8655
8708
|
case "object": {
|
|
8656
8709
|
const memberValue = (child) => typeof unwrapped === "object" && unwrapped !== null ? ownProp(unwrapped, child.name) : void 0;
|
|
8657
8710
|
const sharesALine = (child) => isInlineColumn(child) && !(isApp && child.kind === "text" && isLongText(unwrap(child, memberValue(child))));
|
|
8711
|
+
const lone = whole && isApp ? loneDocumentMember(field) : void 0;
|
|
8658
8712
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
8659
8713
|
header,
|
|
8660
8714
|
/* @__PURE__ */ jsx(
|
|
@@ -8689,7 +8743,7 @@ function ResultNode({
|
|
|
8689
8743
|
sharesALine(child) ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
8690
8744
|
/* @__PURE__ */ jsx("div", { className: "min-w-0", children: /* @__PURE__ */ jsx(Label2, { field: child, describe: true }) }),
|
|
8691
8745
|
/* @__PURE__ */ jsx("div", { className: "flex min-w-0 justify-end **:data-chips:justify-end", children: /* @__PURE__ */ jsx("div", { className: "min-w-0 text-left wrap-break-word", children: /* @__PURE__ */ jsx(LeafValue, { field: child, value: memberValue(child) }) }) })
|
|
8692
|
-
] }, child.name) : /* @__PURE__ */ jsx("div", { className: "col-span-2 min-w-0", children: /* @__PURE__ */ jsx(ResultAt, { segment: child.name, children: /* @__PURE__ */ jsx(ResultField, { field: child, value: memberValue(child), depth: depth + 1 }) }) }, child.name)
|
|
8746
|
+
] }, child.name) : /* @__PURE__ */ jsx("div", { className: "col-span-2 min-w-0", children: /* @__PURE__ */ jsx(ResultAt, { segment: child.name, children: child.name === lone ? /* @__PURE__ */ jsx(DeliveredDocumentContext, { value: true, children: /* @__PURE__ */ jsx(ResultField, { field: child, value: memberValue(child), depth: depth + 1 }) }) : /* @__PURE__ */ jsx(ResultField, { field: child, value: memberValue(child), depth: depth + 1 }) }) }, child.name)
|
|
8693
8747
|
)
|
|
8694
8748
|
)
|
|
8695
8749
|
}
|
|
@@ -8813,7 +8867,7 @@ function ResultNode({
|
|
|
8813
8867
|
headed && /* @__PURE__ */ jsx(Label2, { field, describe: true, unseen: true }),
|
|
8814
8868
|
/* @__PURE__ */ jsx("div", { className: "float-right ml-2", children: /* @__PURE__ */ jsx(CopyButton, { value: copyText, label: s.copyText }) })
|
|
8815
8869
|
] }),
|
|
8816
|
-
typeset !== void 0 ? /* @__PURE__ */ jsx(Markdown, { text: typeset }) : field.kind === "document" && whole ? /* @__PURE__ */ jsx(DocumentValue, { value: unwrapped, whole:
|
|
8870
|
+
typeset !== void 0 ? /* @__PURE__ */ jsx(Markdown, { text: typeset }) : field.kind === "document" && (whole || delivered) ? /* @__PURE__ */ jsx(DocumentValue, { value: unwrapped, whole, startsOpen: delivered }) : /* @__PURE__ */ jsx(LeafValue, { field, value })
|
|
8817
8871
|
]
|
|
8818
8872
|
}
|
|
8819
8873
|
);
|
|
@@ -9127,5 +9181,5 @@ function pdfFileName(field, value, baseName) {
|
|
|
9127
9181
|
}
|
|
9128
9182
|
|
|
9129
9183
|
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, actionShadowClass, checkedAccentClass, cn, enumLabeler, fieldControlClass, fieldLabel, fieldStringsFor, focusOutlineClass, headingClass, isThenable, linkTextClass, panelFlatShadowClass, panelRaisedShadowClass, panelSurfaceClass, renderHtmlPdf, resolveHtmlStorageUrls, saveInBrowser, selectedBorderClass, selectedFillClass, selectedFillStrongClass, useFieldDomId, useFieldPresentation, useFieldStrings, useMethodForm, useProseImages, useResolveDocumentPdf, useResolveRendition, useResolveShareUrl, useResolveUrl, useResolvedUrl };
|
|
9130
|
-
//# sourceMappingURL=chunk-
|
|
9131
|
-
//# sourceMappingURL=chunk-
|
|
9184
|
+
//# sourceMappingURL=chunk-7SOGQRMN.js.map
|
|
9185
|
+
//# sourceMappingURL=chunk-7SOGQRMN.js.map
|