@bison-lab/payload-core 3.33.1 → 3.33.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/README.md +6 -4
- package/dist/admin.d.mts.map +1 -1
- package/dist/admin.mjs +110 -144
- package/dist/admin.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/navigation.d.mts +2 -2
- package/dist/navigation.mjs +2 -2
- package/dist/{published-DECGVhsR.mjs → published-BltDUYZv.mjs} +26 -16
- package/dist/published-BltDUYZv.mjs.map +1 -0
- package/dist/{published-C_BV1MhL.d.mts → published-y1Nrly7r.d.mts} +18 -7
- package/dist/{published-C_BV1MhL.d.mts.map → published-y1Nrly7r.d.mts.map} +1 -1
- package/package.json +3 -3
- package/dist/published-DECGVhsR.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -409,9 +409,10 @@ place of the stock blocks UI. The Header edit view is
|
|
|
409
409
|
`@bison-lab/payload-blocks/admin#AdminWorkspace`. Footer is the same
|
|
410
410
|
workspace on `navigation-footer`; `footer` is a group whose Field is
|
|
411
411
|
`@bison-lab/payload-blocks/admin#FooterColumnsField`. Columns hold
|
|
412
|
-
sections (a required section label plus links).
|
|
413
|
-
|
|
414
|
-
Brand
|
|
412
|
+
sections (a required section label plus links). Link-column desktop
|
|
413
|
+
widths add to 100% of the space beside the logo, not of the full footer.
|
|
414
|
+
Brand copy and social URLs sit on
|
|
415
|
+
the Logo column. The copyright line and "Built by Bison Lab." are
|
|
415
416
|
code-locked. A site that already generates the blocks admin map picks
|
|
416
417
|
both editors up with `payload generate:importmap`; until it does, those
|
|
417
418
|
slots render as nothing. `bar` stores hide on scroll, shared viewport,
|
|
@@ -420,7 +421,8 @@ looks stay on chrome roles, not a variants array on this document. A
|
|
|
420
421
|
Footer consume runs `payload generate:importmap`, `payload generate:types`,
|
|
421
422
|
and `payload migrate:create` — existing `footer.columns` rows are
|
|
422
423
|
`{ heading, links }` and need a wrap into `{ desktop, sections }`.
|
|
423
|
-
|
|
424
|
+
Link-column widths that used to include the logo in the 100% need a
|
|
425
|
+
remap (`Normalize desktop`). `getNavigation` returns `{ header, footer, bar }`.
|
|
424
426
|
|
|
425
427
|
A site that already stored footer columns on the `nav` document copies
|
|
426
428
|
`footer.columns` onto the new global, then drops the footer fields from
|
package/dist/admin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.mts","names":[],"sources":["../src/admin/color-field.tsx","../src/admin/color-scale-field.tsx","../src/admin/library-field.tsx","../src/admin/font-field.tsx","../src/admin/pairing-field.tsx","../src/admin/appearance-field.tsx","../src/admin/grey-scale-field.tsx","../src/admin/contrast-report.tsx","../src/admin/section-heading.tsx","../src/admin/publish-child.tsx","../src/admin/save-button.tsx","../src/admin/preview-mode.tsx","../src/admin/identity-fallback.tsx","../src/admin/look-field.tsx","../src/admin/roles-matrix-field.tsx","../src/admin/roles-row-label.tsx","../src/admin/role-slug-field.tsx","../src/admin/slug-field.tsx","../src/admin/page-title-cell.tsx","../src/admin/role-name-field.tsx","../src/admin/roles-field.tsx","../src/admin/roles-grants-field.tsx","../src/admin/features-matrix-field.tsx","../src/admin/document-title-actions.tsx","../src/admin/document-create-new.tsx","../src/admin-nav/types.ts","../src/admin/admin-nav.tsx","../src/admin/admin-nav-row-label.tsx","../src/admin/admin-nav-item-row-label.tsx","../src/admin/admin-nav-entity-field.tsx","../src/questions/types.ts","../src/admin/questions-list.tsx","../src/admin/media-alt-autofill.tsx","../src/admin/media-list-view.tsx"],"mappings":";;;;;;;;;;;cAWa,UAAA,EAAY,wBAAA;;;;;;;cCsBZ,eAAA,EAAiB,yBAAA;;;;;;;;;cCOjB,YAAA,EAAc,yBAAA;;;;;;;;;cCtBd,SAAA,EAAW,0BAAA;;;;;;;cCNX,YAAA,EAAc,sBAAA;;;;;;;cCCd,eAAA,EAAiB,yBAAA;;;ALF9B;;;;AAAA,cM4Da,cAAA,EAAgB,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AA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;iBCGhB,oBAAA,CAAA,GAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;cCEvB,mBAAA,EAAqB,wBAAA;;;;;;;;A7BClC;U8BFiB,cAAA;;EAEf,MAAA;E9ByED;E8BvEC,IAAA;;EAEA,KAAA;E7BkBW;E6BhBX,MAAA;AAAA;AAAA,UAGe,eAAA;E7BgEhB;E6B9DC,IAAA;;EAEA,KAAA;E5BgBW;E4BdX,UAAA;;;;;EAKA,MAAA;;EAEA,IAAA,GAAO,cAAA;AAAA;;;
|
|
1
|
+
{"version":3,"file":"admin.d.mts","names":[],"sources":["../src/admin/color-field.tsx","../src/admin/color-scale-field.tsx","../src/admin/library-field.tsx","../src/admin/font-field.tsx","../src/admin/pairing-field.tsx","../src/admin/appearance-field.tsx","../src/admin/grey-scale-field.tsx","../src/admin/contrast-report.tsx","../src/admin/section-heading.tsx","../src/admin/publish-child.tsx","../src/admin/save-button.tsx","../src/admin/preview-mode.tsx","../src/admin/identity-fallback.tsx","../src/admin/look-field.tsx","../src/admin/roles-matrix-field.tsx","../src/admin/roles-row-label.tsx","../src/admin/role-slug-field.tsx","../src/admin/slug-field.tsx","../src/admin/page-title-cell.tsx","../src/admin/role-name-field.tsx","../src/admin/roles-field.tsx","../src/admin/roles-grants-field.tsx","../src/admin/features-matrix-field.tsx","../src/admin/document-title-actions.tsx","../src/admin/document-create-new.tsx","../src/admin-nav/types.ts","../src/admin/admin-nav.tsx","../src/admin/admin-nav-row-label.tsx","../src/admin/admin-nav-item-row-label.tsx","../src/admin/admin-nav-entity-field.tsx","../src/questions/types.ts","../src/admin/questions-list.tsx","../src/admin/media-alt-autofill.tsx","../src/admin/media-list-view.tsx"],"mappings":";;;;;;;;;;;cAWa,UAAA,EAAY,wBAAA;;;;;;;cCsBZ,eAAA,EAAiB,yBAAA;;;;;;;;;cCOjB,YAAA,EAAc,yBAAA;;;;;;;;;cCtBd,SA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;A1BGpB;;;iB0B6CgB,QAAA,CAAA;EAAW;AAAA,GAAmB,aAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;iBCnD3C,gBAAA,CAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;iBCGhB,oBAAA,CAAA,GAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;cCEvB,mBAAA,EAAqB,wBAAA;;;;;;;;A7BClC;U8BFiB,cAAA;;EAEf,MAAA;E9ByED;E8BvEC,IAAA;;EAEA,KAAA;E7BkBW;E6BhBX,MAAA;AAAA;AAAA,UAGe,eAAA;E7BgEhB;E6B9DC,IAAA;;EAEA,KAAA;E5BgBW;E4BdX,UAAA;;;;;EAKA,MAAA;;EAEA,IAAA,GAAO,cAAA;AAAA;;;iBCwKO,aAAA,CACd,KAAA,EAAO,mBAAA;EAAwB,UAAA,YAAsB,eAAA;AAAA,IAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;iBC/L1D,gBAAA,CAAA;EAAmB;AAAA;EAAU,IAAA;AAAA;;;iBC2G7B,aAAA,CAAc,KAAA,EAAO,mBAAA,GAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/admin.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { ArrayField, Button, CheckboxInput, DefaultCell, FieldDescription, Field
|
|
|
4
4
|
import { GREY_SCALES, SHADE_STEPS, contrastForeground, contrastRatio, createColorScale, deriveDarkPalette, deriveLightPalette, hexToHSL, hslToString, includedShadeSteps, isThemeHex, presetHints, setColorScaleInclude } from "@bison-lab/tokens";
|
|
5
5
|
import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { Badge, Button as Button$1, Checkbox, Chip, ConfirmDialog, DeleteGlyph, Dialog, EditGlyph, Field, Input, KitProvider, Label, MainHead, Page, Pagination, Popover, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Switch, Table, TableActions, TableCell, TableHead, TableRow, Textarea, Thumbnail } from "@bison-lab/admin-ui";
|
|
7
|
+
import { Badge, Button as Button$1, Checkbox, Chip, ConfirmDialog, DeleteGlyph, Dialog, EditGlyph, Field, Fold, Input, KitProvider, Label, MainHead, Page, Pagination, Popover, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Stack, Switch, Table, TableActions, TableCell, TableHead, TableRow, Textarea, Thumbnail } from "@bison-lab/admin-ui";
|
|
8
8
|
import { HexColorPicker } from "react-colorful";
|
|
9
9
|
import { createPortal } from "react-dom";
|
|
10
10
|
import { findFont, fontFaceCss, isFontId } from "@bison-lab/fonts";
|
|
@@ -4109,14 +4109,10 @@ const QUESTIONS_LIST_CSS = `
|
|
|
4109
4109
|
.bl-faq-library__taxrow .bl-faq-library__taxmeta{display:inline-flex;align-items:center;gap:14px}
|
|
4110
4110
|
.bl-faq-library__addrow{display:flex;gap:7px;padding:10px;border-top:1px solid var(--bl-kit-border);background:var(--bl-kit-surface-well)}
|
|
4111
4111
|
.bl-faq-library__addrow .bl-nav-kit__input{flex:1;min-width:0}
|
|
4112
|
-
.bl-faq-library__modal .bl-nav-kit__modal-card
|
|
4112
|
+
.bl-faq-library__modal .bl-nav-kit__modal-card{width:min(760px,calc(100vw - 2rem))}
|
|
4113
4113
|
.bl-faq-library__modal-card{width:min(760px,calc(100vw - 2rem));max-height:calc(100vh - 48px);overflow:auto;background:var(--bl-kit-surface);border:1px solid var(--bl-kit-border);border-radius:var(--bl-kit-radius-lg);box-shadow:var(--bl-kit-shadow)}
|
|
4114
|
-
.bl-faq-library__modal-head{display:flex;justify-content:space-between;align-items:center;padding:18px 22px;border-bottom:1px solid var(--bl-kit-border);position:sticky;top:0;background:var(--bl-kit-surface);z-index:2}
|
|
4115
|
-
.bl-faq-library__modal-head h2{margin:0;font-size:20px}
|
|
4116
|
-
.bl-faq-library__modal-body{padding:20px 22px}
|
|
4117
4114
|
.bl-faq-library__grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
|
|
4118
4115
|
.bl-faq-library__section{font-weight:800;margin:4px 0 12px;padding-top:14px;border-top:1px solid var(--bl-kit-border-divider)}
|
|
4119
|
-
.bl-faq-library__hint{display:block;margin-top:6px;color:var(--bl-kit-ink-muted);font-size:12px}
|
|
4120
4116
|
.bl-faq-library__choicebox{border:1px solid var(--bl-kit-border-strong);border-radius:var(--bl-kit-radius-sm);overflow:hidden;background:var(--bl-kit-surface)}
|
|
4121
4117
|
.bl-faq-library__choice{display:flex;align-items:center;gap:9px;margin:0;padding:9px 11px;border-bottom:1px solid var(--bl-kit-border-divider);cursor:pointer;font-weight:500}
|
|
4122
4118
|
.bl-faq-library__choice:last-child{border-bottom:0}
|
|
@@ -4124,7 +4120,8 @@ const QUESTIONS_LIST_CSS = `
|
|
|
4124
4120
|
.bl-faq-library__addtag{border:0;background:transparent;color:var(--bl-kit-accent,#2563eb);padding:8px 0 0;cursor:pointer;font-weight:650}
|
|
4125
4121
|
.bl-faq-library__addtag:hover{text-decoration:underline}
|
|
4126
4122
|
.bl-faq-library__inline-add{display:flex;gap:7px;margin-top:8px}
|
|
4127
|
-
.bl-faq-
|
|
4123
|
+
.bl-faq-library__modal .bl-nav-kit__fold-body{padding:0 12px 12px}
|
|
4124
|
+
.bl-faq-library__modal .bl-nav-kit__fold .bl-faq-library__choicebox{margin-top:2px}
|
|
4128
4125
|
.bl-faq-library__modal-foot{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:16px 22px;border-top:1px solid var(--bl-kit-border);position:sticky;bottom:0;background:var(--bl-kit-surface)}
|
|
4129
4126
|
.bl-faq-library__published{display:flex;align-items:center;gap:8px;color:var(--bl-kit-ink-muted);cursor:pointer}
|
|
4130
4127
|
.bl-faq-library__foot-actions{display:flex;gap:8px}
|
|
@@ -4161,9 +4158,19 @@ function idsFrom(value) {
|
|
|
4161
4158
|
if (!Array.isArray(value)) return [];
|
|
4162
4159
|
return value.map(asId).filter((id) => id !== null);
|
|
4163
4160
|
}
|
|
4164
|
-
function
|
|
4165
|
-
|
|
4166
|
-
return "";
|
|
4161
|
+
function stringField(doc, key) {
|
|
4162
|
+
const value = doc[key];
|
|
4163
|
+
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
4164
|
+
}
|
|
4165
|
+
function titleFieldFor(collectionSlug, collections) {
|
|
4166
|
+
const title = collections.find((entry) => entry.slug === collectionSlug)?.admin?.useAsTitle;
|
|
4167
|
+
return typeof title === "string" && title.trim() ? title : "name";
|
|
4168
|
+
}
|
|
4169
|
+
/** Label from the collection title field, then `name`, then `title`. */
|
|
4170
|
+
function termName(value, titleField = "name") {
|
|
4171
|
+
if (!value || typeof value !== "object") return "";
|
|
4172
|
+
const rec = value;
|
|
4173
|
+
return stringField(rec, titleField) || stringField(rec, "name") || stringField(rec, "title");
|
|
4167
4174
|
}
|
|
4168
4175
|
function familyFromDoc(value) {
|
|
4169
4176
|
if (!value || typeof value !== "object") return void 0;
|
|
@@ -4230,10 +4237,6 @@ function manageIntro(entries) {
|
|
|
4230
4237
|
}
|
|
4231
4238
|
return parts.join(" ");
|
|
4232
4239
|
}
|
|
4233
|
-
function facetHint(entry) {
|
|
4234
|
-
if (entry.manage) return `Use ${entry.label.toLowerCase()} to group related FAQs.`;
|
|
4235
|
-
return `Select every ${termSingular(entry.label)} this FAQ applies to.`;
|
|
4236
|
-
}
|
|
4237
4240
|
function useApi() {
|
|
4238
4241
|
const { config } = useConfig();
|
|
4239
4242
|
const base = `${config.serverURL}${config.routes.api}`;
|
|
@@ -4267,6 +4270,7 @@ function QuestionsList(props) {
|
|
|
4267
4270
|
}
|
|
4268
4271
|
function QuestionsListPage({ collectionSlug, organizeBy: organizeByProp }) {
|
|
4269
4272
|
const { setStepNav } = useStepNav();
|
|
4273
|
+
const { config } = useConfig();
|
|
4270
4274
|
const organizeBy = useOrganizeBy(collectionSlug, organizeByProp);
|
|
4271
4275
|
const request = useApi();
|
|
4272
4276
|
useEffect(() => {
|
|
@@ -4296,15 +4300,23 @@ function QuestionsListPage({ collectionSlug, organizeBy: organizeByProp }) {
|
|
|
4296
4300
|
const loadTerms = useCallback(async () => {
|
|
4297
4301
|
const next = {};
|
|
4298
4302
|
await Promise.all(organizeBy.map(async (entry) => {
|
|
4299
|
-
const
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4303
|
+
const titleField = titleFieldFor(entry.collection, config.collections);
|
|
4304
|
+
const data = await request(`/${entry.collection}?limit=200&sort=${encodeURIComponent(titleField)}&depth=0`);
|
|
4305
|
+
next[entry.name] = (data.docs ?? []).map((doc) => {
|
|
4306
|
+
const id = asId(doc) ?? String(doc.id ?? "");
|
|
4307
|
+
return {
|
|
4308
|
+
id,
|
|
4309
|
+
name: termName(doc, titleField) || String(id),
|
|
4310
|
+
family: familyFromDoc(doc)
|
|
4311
|
+
};
|
|
4312
|
+
});
|
|
4305
4313
|
}));
|
|
4306
4314
|
setTerms(next);
|
|
4307
|
-
}, [
|
|
4315
|
+
}, [
|
|
4316
|
+
config.collections,
|
|
4317
|
+
organizeBy,
|
|
4318
|
+
request
|
|
4319
|
+
]);
|
|
4308
4320
|
const loadDocs = useCallback(async () => {
|
|
4309
4321
|
const where = { and: [] };
|
|
4310
4322
|
const and = where.and;
|
|
@@ -4709,139 +4721,93 @@ function QuestionsListPage({ collectionSlug, organizeBy: organizeByProp }) {
|
|
|
4709
4721
|
})
|
|
4710
4722
|
]
|
|
4711
4723
|
}),
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
"
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4724
|
+
/* @__PURE__ */ jsxs(Dialog, {
|
|
4725
|
+
open: faqOpen,
|
|
4726
|
+
className: "bl-faq-library__modal",
|
|
4727
|
+
title: editing ? "Edit FAQ" : "New FAQ",
|
|
4728
|
+
description: "Pages should select FAQs from this library. Editing an FAQ here updates every page that references it.",
|
|
4729
|
+
cancelLabel: "Cancel",
|
|
4730
|
+
confirmLabel: "Save FAQ",
|
|
4731
|
+
confirmDisabled: busy,
|
|
4732
|
+
onCancel: () => setFaqOpen(false),
|
|
4733
|
+
onConfirm: () => void saveFaq(),
|
|
4734
|
+
footerStart: /* @__PURE__ */ jsxs("label", {
|
|
4735
|
+
className: "bl-faq-library__published",
|
|
4736
|
+
children: [/* @__PURE__ */ jsx(Switch, {
|
|
4737
|
+
checked: published,
|
|
4738
|
+
onCheckedChange: setPublished
|
|
4739
|
+
}), "Published"]
|
|
4740
|
+
}),
|
|
4741
|
+
children: [
|
|
4742
|
+
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(Label, { children: "Question" }), /* @__PURE__ */ jsx(Input, {
|
|
4743
|
+
value: draftQuestion,
|
|
4744
|
+
onChange: (event) => setDraftQuestion(event.target.value),
|
|
4745
|
+
placeholder: "e.g. How long does recovery usually take?"
|
|
4746
|
+
})] }),
|
|
4747
|
+
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(Label, { children: "Answer" }), /* @__PURE__ */ jsx(Textarea, {
|
|
4748
|
+
value: draftAnswer,
|
|
4749
|
+
onChange: (event) => setDraftAnswer(event.target.value),
|
|
4750
|
+
placeholder: "Write the reusable answer…"
|
|
4751
|
+
})] }),
|
|
4752
|
+
organizeBy.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
4753
|
+
className: "bl-faq-library__section",
|
|
4754
|
+
children: "Organization"
|
|
4755
|
+
}), /* @__PURE__ */ jsx(Stack, { children: organizeBy.map((entry) => /* @__PURE__ */ jsxs(Fold, {
|
|
4756
|
+
title: entry.label,
|
|
4757
|
+
defaultOpen: true,
|
|
4758
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
4759
|
+
className: "bl-faq-library__choicebox",
|
|
4760
|
+
children: (terms[entry.name] ?? []).map((term) => {
|
|
4761
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
4762
|
+
className: "bl-faq-library__choice",
|
|
4763
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
4764
|
+
checked: (draftFacets[entry.name] ?? []).some((id) => String(id) === String(term.id)),
|
|
4765
|
+
onCheckedChange: (value) => toggleFacet(entry.name, term.id, value === true)
|
|
4766
|
+
}), /* @__PURE__ */ jsx("span", { children: term.name })]
|
|
4767
|
+
}, String(term.id));
|
|
4768
|
+
})
|
|
4769
|
+
}), entry.manage ? inlineTopic?.field === entry.name ? /* @__PURE__ */ jsxs("form", {
|
|
4770
|
+
className: "bl-faq-library__inline-add",
|
|
4771
|
+
onSubmit: (event) => {
|
|
4772
|
+
event.preventDefault();
|
|
4773
|
+
addTerm(entry, inlineTopic.name);
|
|
4774
|
+
},
|
|
4775
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
4776
|
+
autoFocus: true,
|
|
4777
|
+
value: inlineTopic.name,
|
|
4778
|
+
onChange: (event) => setInlineTopic({
|
|
4779
|
+
field: entry.name,
|
|
4780
|
+
name: event.target.value
|
|
4781
|
+
}),
|
|
4782
|
+
placeholder: `New ${termSingular(entry.label)} name`
|
|
4727
4783
|
}), /* @__PURE__ */ jsx(Button$1, {
|
|
4728
|
-
|
|
4729
|
-
variant: "
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
children: "×"
|
|
4733
|
-
})]
|
|
4734
|
-
}),
|
|
4735
|
-
/* @__PURE__ */ jsxs("div", {
|
|
4736
|
-
className: "bl-faq-library__modal-body",
|
|
4737
|
-
children: [
|
|
4738
|
-
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(Label, { children: "Question" }), /* @__PURE__ */ jsx(Input, {
|
|
4739
|
-
value: draftQuestion,
|
|
4740
|
-
onChange: (event) => setDraftQuestion(event.target.value),
|
|
4741
|
-
placeholder: "e.g. How long does recovery usually take?"
|
|
4742
|
-
})] }),
|
|
4743
|
-
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(Label, { children: "Answer" }), /* @__PURE__ */ jsx(Textarea, {
|
|
4744
|
-
value: draftAnswer,
|
|
4745
|
-
onChange: (event) => setDraftAnswer(event.target.value),
|
|
4746
|
-
placeholder: "Write the reusable answer…"
|
|
4747
|
-
})] }),
|
|
4748
|
-
organizeBy.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
4749
|
-
className: "bl-faq-library__section",
|
|
4750
|
-
children: "Organization"
|
|
4751
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
4752
|
-
className: "bl-faq-library__grid",
|
|
4753
|
-
children: organizeBy.map((entry) => /* @__PURE__ */ jsxs(Field, {
|
|
4754
|
-
as: "div",
|
|
4755
|
-
children: [
|
|
4756
|
-
/* @__PURE__ */ jsx(Label, { children: entry.label }),
|
|
4757
|
-
/* @__PURE__ */ jsx("div", {
|
|
4758
|
-
className: "bl-faq-library__choicebox",
|
|
4759
|
-
children: (terms[entry.name] ?? []).map((term) => {
|
|
4760
|
-
return /* @__PURE__ */ jsxs("label", {
|
|
4761
|
-
className: "bl-faq-library__choice",
|
|
4762
|
-
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
4763
|
-
checked: (draftFacets[entry.name] ?? []).some((id) => String(id) === String(term.id)),
|
|
4764
|
-
onCheckedChange: (value) => toggleFacet(entry.name, term.id, value === true)
|
|
4765
|
-
}), /* @__PURE__ */ jsx("span", { children: term.name })]
|
|
4766
|
-
}, String(term.id));
|
|
4767
|
-
})
|
|
4768
|
-
}),
|
|
4769
|
-
entry.manage ? inlineTopic?.field === entry.name ? /* @__PURE__ */ jsxs("form", {
|
|
4770
|
-
className: "bl-faq-library__inline-add",
|
|
4771
|
-
onSubmit: (event) => {
|
|
4772
|
-
event.preventDefault();
|
|
4773
|
-
addTerm(entry, inlineTopic.name);
|
|
4774
|
-
},
|
|
4775
|
-
children: [/* @__PURE__ */ jsx(Input, {
|
|
4776
|
-
autoFocus: true,
|
|
4777
|
-
value: inlineTopic.name,
|
|
4778
|
-
onChange: (event) => setInlineTopic({
|
|
4779
|
-
field: entry.name,
|
|
4780
|
-
name: event.target.value
|
|
4781
|
-
}),
|
|
4782
|
-
placeholder: `New ${termSingular(entry.label)} name`
|
|
4783
|
-
}), /* @__PURE__ */ jsx(Button$1, {
|
|
4784
|
-
type: "submit",
|
|
4785
|
-
variant: "outline",
|
|
4786
|
-
disabled: busy,
|
|
4787
|
-
children: "Add"
|
|
4788
|
-
})]
|
|
4789
|
-
}) : /* @__PURE__ */ jsx("button", {
|
|
4790
|
-
type: "button",
|
|
4791
|
-
className: "bl-faq-library__addtag",
|
|
4792
|
-
onClick: () => setInlineTopic({
|
|
4793
|
-
field: entry.name,
|
|
4794
|
-
name: ""
|
|
4795
|
-
}),
|
|
4796
|
-
children: `+ Create new ${termSingular(entry.label)}`
|
|
4797
|
-
}) : null,
|
|
4798
|
-
/* @__PURE__ */ jsx("small", {
|
|
4799
|
-
className: "bl-faq-library__hint",
|
|
4800
|
-
children: facetHint(entry)
|
|
4801
|
-
})
|
|
4802
|
-
]
|
|
4803
|
-
}, entry.name))
|
|
4804
|
-
})] }) : null,
|
|
4805
|
-
/* @__PURE__ */ jsx("div", {
|
|
4806
|
-
className: "bl-faq-library__notice",
|
|
4807
|
-
children: "Pages should select FAQs from this library. Editing an FAQ here updates every page that references it."
|
|
4808
|
-
})
|
|
4809
|
-
]
|
|
4810
|
-
}),
|
|
4811
|
-
/* @__PURE__ */ jsxs("div", {
|
|
4812
|
-
className: "bl-faq-library__modal-foot",
|
|
4813
|
-
children: [/* @__PURE__ */ jsxs("label", {
|
|
4814
|
-
className: "bl-faq-library__published",
|
|
4815
|
-
children: [/* @__PURE__ */ jsx(Switch, {
|
|
4816
|
-
checked: published,
|
|
4817
|
-
onCheckedChange: setPublished
|
|
4818
|
-
}), "Published"]
|
|
4819
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
4820
|
-
className: "bl-faq-library__foot-actions",
|
|
4821
|
-
children: [/* @__PURE__ */ jsx(Button$1, {
|
|
4822
|
-
variant: "outline",
|
|
4823
|
-
onClick: () => setFaqOpen(false),
|
|
4824
|
-
children: "Cancel"
|
|
4825
|
-
}), /* @__PURE__ */ jsx(Button$1, {
|
|
4826
|
-
disabled: busy,
|
|
4827
|
-
onClick: () => void saveFaq(),
|
|
4828
|
-
children: "Save FAQ"
|
|
4829
|
-
})]
|
|
4784
|
+
type: "submit",
|
|
4785
|
+
variant: "outline",
|
|
4786
|
+
disabled: busy,
|
|
4787
|
+
children: "Add"
|
|
4830
4788
|
})]
|
|
4831
|
-
})
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4789
|
+
}) : /* @__PURE__ */ jsx("button", {
|
|
4790
|
+
type: "button",
|
|
4791
|
+
className: "bl-faq-library__addtag",
|
|
4792
|
+
onClick: () => setInlineTopic({
|
|
4793
|
+
field: entry.name,
|
|
4794
|
+
name: ""
|
|
4795
|
+
}),
|
|
4796
|
+
children: `+ Create new ${termSingular(entry.label)}`
|
|
4797
|
+
}) : null]
|
|
4798
|
+
}, entry.name)) })] }) : null
|
|
4799
|
+
]
|
|
4800
|
+
}),
|
|
4835
4801
|
/* @__PURE__ */ jsx(Dialog, {
|
|
4836
4802
|
open: Boolean(deleteFaq),
|
|
4837
4803
|
title: "Delete this FAQ?",
|
|
4804
|
+
description: "Pages using it would need another FAQ selected.",
|
|
4838
4805
|
cancelLabel: "Cancel",
|
|
4839
4806
|
confirmLabel: "Delete FAQ",
|
|
4840
4807
|
confirmVariant: "danger",
|
|
4841
4808
|
confirmDisabled: busy,
|
|
4842
4809
|
onCancel: () => setDeleteFaq(null),
|
|
4843
|
-
onConfirm: () => void confirmDeleteFaq()
|
|
4844
|
-
children: "Pages using it would need another FAQ selected."
|
|
4810
|
+
onConfirm: () => void confirmDeleteFaq()
|
|
4845
4811
|
}),
|
|
4846
4812
|
deleteTerm ? /* @__PURE__ */ jsx("div", {
|
|
4847
4813
|
className: "bl-nav-kit__modal",
|