@bison-lab/payload-core 3.33.0 → 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 +1 -1
- package/dist/admin.d.mts.map +1 -1
- package/dist/admin.mjs +153 -150
- package/dist/admin.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- 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
CHANGED
|
@@ -256,7 +256,7 @@ interface OrganizeByEntry {
|
|
|
256
256
|
collection: string;
|
|
257
257
|
/**
|
|
258
258
|
* When true, Manage organization can add and delete terms. Default
|
|
259
|
-
* false —
|
|
259
|
+
* false — linked collections stay read-only here.
|
|
260
260
|
*/
|
|
261
261
|
manage?: boolean;
|
|
262
262
|
/** Optional Theme family source for this facet's chips. */
|
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,0BAAA;;;;;;;cCnDhB,cAAA,EAAgB,sBAAA;;;;;;cCbhB,cAAA,EAAgB,sBAAA;;;cC0IhB,YAAA,EAAc,sBAAA;;;;;;;;iBCtIX,qBAAA,CAAA;;AVAhB;;;iBUQgB,eAAA,CAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA;;iBA0Bf,gBAAA,CAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;KCrCpB,gBAAA;AAAA,iBAkCI,mBAAA,CAAoB,IAAA,EAAM,gBAAA;;;;;;;cClC7B,gBAAA,EAAkB,sBAAA;;;;;;;cCIlB,SAAA,EAAW,wBAAA;;;;;;;;cCqBX,gBAAA,EAAkB,yBAAA;;;;;;iBC1Bf,aAAA,CAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;cCChB,aAAA,EAAe,wBAAA;;;;;;;;;cC2Bf,SAAA,EAAW,wBAAA;;;;;;;iBC1BR,aAAA,CAAc,KAAA,EAAO,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;cCAjD,aAAA,EAAe,wBAAA;;;;;;;;cC8Cf,UAAA,EAAY,0BAAA;;;;;;;;cChCZ,gBAAA,EAAkB,wBAAA;;;;;;;;;ArBZ/B;;csB0Ca,mBAAA,EAAqB,yBAAA;;;iBCflB,oBAAA,CAAA;EAAuB;AAAA;EAAc,QAAA,GAAW,SAAA;AAAA,IAAW,kBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCxB3D,iBAAA,CAAA;EAAoB;AAAA;EAAU,IAAA;AAAA,IAAc,kBAAA,CAAA,GAAA,CAAA,OAAA;;;UCmB3C,uBAAA;EACf,WAAA;EACA,OAAA;AAAA;;;UC5Be,aAAA;EACf,eAAA,GAAkB,uBAAA;AAAA;;;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;;;
|
|
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,0BAAA;;;;;;;cCnDhB,cAAA,EAAgB,sBAAA;;;;;;cCbhB,cAAA,EAAgB,sBAAA;;;cC0IhB,YAAA,EAAc,sBAAA;;;;;;;;iBCtIX,qBAAA,CAAA;;AVAhB;;;iBUQgB,eAAA,CAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA;;iBA0Bf,gBAAA,CAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;KCrCpB,gBAAA;AAAA,iBAkCI,mBAAA,CAAoB,IAAA,EAAM,gBAAA;;;;;;;cClC7B,gBAAA,EAAkB,sBAAA;;;;;;;cCIlB,SAAA,EAAW,wBAAA;;;;;;;;cCqBX,gBAAA,EAAkB,yBAAA;;;;;;iBC1Bf,aAAA,CAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;cCChB,aAAA,EAAe,wBAAA;;;;;;;;;cC2Bf,SAAA,EAAW,wBAAA;;;;;;;iBC1BR,aAAA,CAAc,KAAA,EAAO,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;cCAjD,aAAA,EAAe,wBAAA;;;;;;;;cC8Cf,UAAA,EAAY,0BAAA;;;;;;;;cChCZ,gBAAA,EAAkB,wBAAA;;;;;;;;;ArBZ/B;;csB0Ca,mBAAA,EAAqB,yBAAA;;;iBCflB,oBAAA,CAAA;EAAuB;AAAA;EAAc,QAAA,GAAW,SAAA;AAAA,IAAW,kBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCxB3D,iBAAA,CAAA;EAAoB;AAAA;EAAU,IAAA;AAAA,IAAc,kBAAA,CAAA,GAAA,CAAA,OAAA;;;UCmB3C,uBAAA;EACf,WAAA;EACA,OAAA;AAAA;;;UC5Be,aAAA;EACf,eAAA,GAAkB,uBAAA;AAAA;;;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";
|
|
@@ -4087,10 +4087,10 @@ const QUESTIONS_LIST_CSS = `
|
|
|
4087
4087
|
.bl-faq-library__answer{margin:0;color:var(--bl-kit-ink-muted);max-width:640px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
4088
4088
|
.bl-faq-library__chips{display:flex;flex-wrap:wrap;gap:5px}
|
|
4089
4089
|
.bl-faq-library__chip{font-size:12px;font-weight:650;padding:3px 7px}
|
|
4090
|
-
.bl-faq-library__chip--
|
|
4090
|
+
.bl-faq-library__chip--linked{background:var(--bl-kit-accent-soft);color:var(--bl-kit-accent,#2563eb)}
|
|
4091
4091
|
.bl-faq-library__chip--look{background:hsl(var(--look-tint));color:hsl(var(--look-ink))}
|
|
4092
4092
|
[data-theme="dark"] .bl-faq-library__chip--look{background:hsl(var(--look-tint-dark));color:hsl(var(--look-ink-dark))}
|
|
4093
|
-
.bl-faq-library__chip--
|
|
4093
|
+
.bl-faq-library__chip--managed{background:color-mix(in srgb,var(--theme-info-500,#1769aa) 12%,var(--bl-kit-surface));color:var(--theme-info-500,#1769aa)}
|
|
4094
4094
|
.bl-faq-library__used{font-size:12px;color:var(--bl-kit-ink-muted)}
|
|
4095
4095
|
.bl-faq-library__used strong{color:var(--bl-kit-ink);font-weight:700}
|
|
4096
4096
|
.bl-faq-library__empty{display:none;padding:55px;text-align:center;color:var(--bl-kit-ink-muted);border:1px solid var(--bl-kit-border);border-radius:var(--bl-kit-radius);background:var(--bl-kit-surface)}
|
|
@@ -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;
|
|
@@ -4207,6 +4214,29 @@ function lookMapsFromGlobal(doc, look) {
|
|
|
4207
4214
|
function resolveFamily(field, name, family, looks) {
|
|
4208
4215
|
return family || looks[field]?.[name.toLowerCase()] || void 0;
|
|
4209
4216
|
}
|
|
4217
|
+
function termSingular(label) {
|
|
4218
|
+
const lower = label.trim().toLowerCase();
|
|
4219
|
+
if (lower.endsWith("ies")) return `${lower.slice(0, -3)}y`;
|
|
4220
|
+
if (lower.endsWith("s") && !lower.endsWith("ss")) return lower.slice(0, -1);
|
|
4221
|
+
return lower;
|
|
4222
|
+
}
|
|
4223
|
+
function facetChipClass(entry) {
|
|
4224
|
+
return entry.manage ? "managed" : "linked";
|
|
4225
|
+
}
|
|
4226
|
+
function manageIntro(entries) {
|
|
4227
|
+
const linked = entries.filter((entry) => !entry.manage);
|
|
4228
|
+
const managed = entries.filter((entry) => entry.manage);
|
|
4229
|
+
const parts = [];
|
|
4230
|
+
if (linked.length > 0) {
|
|
4231
|
+
const labels = linked.map((entry) => entry.label).join(" and ");
|
|
4232
|
+
parts.push(`${labels}: read-only terms from linked collections.`);
|
|
4233
|
+
}
|
|
4234
|
+
if (managed.length > 0) {
|
|
4235
|
+
const labels = managed.map((entry) => entry.label).join(" and ");
|
|
4236
|
+
parts.push(`Create and delete ${labels} below.`);
|
|
4237
|
+
}
|
|
4238
|
+
return parts.join(" ");
|
|
4239
|
+
}
|
|
4210
4240
|
function useApi() {
|
|
4211
4241
|
const { config } = useConfig();
|
|
4212
4242
|
const base = `${config.serverURL}${config.routes.api}`;
|
|
@@ -4240,6 +4270,7 @@ function QuestionsList(props) {
|
|
|
4240
4270
|
}
|
|
4241
4271
|
function QuestionsListPage({ collectionSlug, organizeBy: organizeByProp }) {
|
|
4242
4272
|
const { setStepNav } = useStepNav();
|
|
4273
|
+
const { config } = useConfig();
|
|
4243
4274
|
const organizeBy = useOrganizeBy(collectionSlug, organizeByProp);
|
|
4244
4275
|
const request = useApi();
|
|
4245
4276
|
useEffect(() => {
|
|
@@ -4269,15 +4300,23 @@ function QuestionsListPage({ collectionSlug, organizeBy: organizeByProp }) {
|
|
|
4269
4300
|
const loadTerms = useCallback(async () => {
|
|
4270
4301
|
const next = {};
|
|
4271
4302
|
await Promise.all(organizeBy.map(async (entry) => {
|
|
4272
|
-
const
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
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
|
+
});
|
|
4278
4313
|
}));
|
|
4279
4314
|
setTerms(next);
|
|
4280
|
-
}, [
|
|
4315
|
+
}, [
|
|
4316
|
+
config.collections,
|
|
4317
|
+
organizeBy,
|
|
4318
|
+
request
|
|
4319
|
+
]);
|
|
4281
4320
|
const loadDocs = useCallback(async () => {
|
|
4282
4321
|
const where = { and: [] };
|
|
4283
4322
|
const and = where.and;
|
|
@@ -4559,7 +4598,7 @@ function QuestionsListPage({ collectionSlug, organizeBy: organizeByProp }) {
|
|
|
4559
4598
|
})] }),
|
|
4560
4599
|
organizeBy.map((entry) => {
|
|
4561
4600
|
const chips = chipsFrom$1(doc[entry.name]);
|
|
4562
|
-
const kind = entry
|
|
4601
|
+
const kind = facetChipClass(entry);
|
|
4563
4602
|
return /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx("div", {
|
|
4564
4603
|
className: "bl-faq-library__chips",
|
|
4565
4604
|
children: chips.length === 0 && !entry.manage ? /* @__PURE__ */ jsx("span", {
|
|
@@ -4614,7 +4653,7 @@ function QuestionsListPage({ collectionSlug, organizeBy: organizeByProp }) {
|
|
|
4614
4653
|
className: "bl-faq-library__manage-head",
|
|
4615
4654
|
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", { children: "Manage organization" }), /* @__PURE__ */ jsx("div", {
|
|
4616
4655
|
className: "bl-faq-library__taxmeta",
|
|
4617
|
-
children:
|
|
4656
|
+
children: manageIntro(organizeBy)
|
|
4618
4657
|
})] }), /* @__PURE__ */ jsx(Button$1, {
|
|
4619
4658
|
variant: "outline",
|
|
4620
4659
|
onClick: () => setManageOpen(false),
|
|
@@ -4662,7 +4701,7 @@ function QuestionsListPage({ collectionSlug, organizeBy: organizeByProp }) {
|
|
|
4662
4701
|
...current,
|
|
4663
4702
|
[entry.name]: event.target.value
|
|
4664
4703
|
})),
|
|
4665
|
-
placeholder: `New ${entry.label
|
|
4704
|
+
placeholder: `New ${termSingular(entry.label)} name`,
|
|
4666
4705
|
onKeyDown: (event) => {
|
|
4667
4706
|
if (event.key === "Enter") {
|
|
4668
4707
|
event.preventDefault();
|
|
@@ -4682,139 +4721,93 @@ function QuestionsListPage({ collectionSlug, organizeBy: organizeByProp }) {
|
|
|
4682
4721
|
})
|
|
4683
4722
|
]
|
|
4684
4723
|
}),
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
"
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
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`
|
|
4700
4783
|
}), /* @__PURE__ */ jsx(Button$1, {
|
|
4701
|
-
|
|
4702
|
-
variant: "
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
children: "×"
|
|
4706
|
-
})]
|
|
4707
|
-
}),
|
|
4708
|
-
/* @__PURE__ */ jsxs("div", {
|
|
4709
|
-
className: "bl-faq-library__modal-body",
|
|
4710
|
-
children: [
|
|
4711
|
-
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(Label, { children: "Question" }), /* @__PURE__ */ jsx(Input, {
|
|
4712
|
-
value: draftQuestion,
|
|
4713
|
-
onChange: (event) => setDraftQuestion(event.target.value),
|
|
4714
|
-
placeholder: "e.g. How long does recovery usually take?"
|
|
4715
|
-
})] }),
|
|
4716
|
-
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(Label, { children: "Answer" }), /* @__PURE__ */ jsx(Textarea, {
|
|
4717
|
-
value: draftAnswer,
|
|
4718
|
-
onChange: (event) => setDraftAnswer(event.target.value),
|
|
4719
|
-
placeholder: "Write the reusable answer…"
|
|
4720
|
-
})] }),
|
|
4721
|
-
organizeBy.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
4722
|
-
className: "bl-faq-library__section",
|
|
4723
|
-
children: "Organization"
|
|
4724
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
4725
|
-
className: "bl-faq-library__grid",
|
|
4726
|
-
children: organizeBy.map((entry) => /* @__PURE__ */ jsxs(Field, {
|
|
4727
|
-
as: "div",
|
|
4728
|
-
children: [
|
|
4729
|
-
/* @__PURE__ */ jsx(Label, { children: entry.label }),
|
|
4730
|
-
/* @__PURE__ */ jsx("div", {
|
|
4731
|
-
className: "bl-faq-library__choicebox",
|
|
4732
|
-
children: (terms[entry.name] ?? []).map((term) => {
|
|
4733
|
-
return /* @__PURE__ */ jsxs("label", {
|
|
4734
|
-
className: "bl-faq-library__choice",
|
|
4735
|
-
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
4736
|
-
checked: (draftFacets[entry.name] ?? []).some((id) => String(id) === String(term.id)),
|
|
4737
|
-
onCheckedChange: (value) => toggleFacet(entry.name, term.id, value === true)
|
|
4738
|
-
}), /* @__PURE__ */ jsx("span", { children: term.name })]
|
|
4739
|
-
}, String(term.id));
|
|
4740
|
-
})
|
|
4741
|
-
}),
|
|
4742
|
-
entry.manage ? inlineTopic?.field === entry.name ? /* @__PURE__ */ jsxs("form", {
|
|
4743
|
-
className: "bl-faq-library__inline-add",
|
|
4744
|
-
onSubmit: (event) => {
|
|
4745
|
-
event.preventDefault();
|
|
4746
|
-
addTerm(entry, inlineTopic.name);
|
|
4747
|
-
},
|
|
4748
|
-
children: [/* @__PURE__ */ jsx(Input, {
|
|
4749
|
-
autoFocus: true,
|
|
4750
|
-
value: inlineTopic.name,
|
|
4751
|
-
onChange: (event) => setInlineTopic({
|
|
4752
|
-
field: entry.name,
|
|
4753
|
-
name: event.target.value
|
|
4754
|
-
}),
|
|
4755
|
-
placeholder: "New topic name"
|
|
4756
|
-
}), /* @__PURE__ */ jsx(Button$1, {
|
|
4757
|
-
type: "submit",
|
|
4758
|
-
variant: "outline",
|
|
4759
|
-
disabled: busy,
|
|
4760
|
-
children: "Add"
|
|
4761
|
-
})]
|
|
4762
|
-
}) : /* @__PURE__ */ jsx("button", {
|
|
4763
|
-
type: "button",
|
|
4764
|
-
className: "bl-faq-library__addtag",
|
|
4765
|
-
onClick: () => setInlineTopic({
|
|
4766
|
-
field: entry.name,
|
|
4767
|
-
name: ""
|
|
4768
|
-
}),
|
|
4769
|
-
children: "+ Create new topic"
|
|
4770
|
-
}) : null,
|
|
4771
|
-
/* @__PURE__ */ jsx("small", {
|
|
4772
|
-
className: "bl-faq-library__hint",
|
|
4773
|
-
children: entry.manage ? "Use topics to group related FAQs across anatomy areas." : "Select every body area this FAQ applies to."
|
|
4774
|
-
})
|
|
4775
|
-
]
|
|
4776
|
-
}, entry.name))
|
|
4777
|
-
})] }) : null,
|
|
4778
|
-
/* @__PURE__ */ jsx("div", {
|
|
4779
|
-
className: "bl-faq-library__notice",
|
|
4780
|
-
children: "Pages should select FAQs from this library. Editing an FAQ here updates every page that references it."
|
|
4781
|
-
})
|
|
4782
|
-
]
|
|
4783
|
-
}),
|
|
4784
|
-
/* @__PURE__ */ jsxs("div", {
|
|
4785
|
-
className: "bl-faq-library__modal-foot",
|
|
4786
|
-
children: [/* @__PURE__ */ jsxs("label", {
|
|
4787
|
-
className: "bl-faq-library__published",
|
|
4788
|
-
children: [/* @__PURE__ */ jsx(Switch, {
|
|
4789
|
-
checked: published,
|
|
4790
|
-
onCheckedChange: setPublished
|
|
4791
|
-
}), "Published"]
|
|
4792
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
4793
|
-
className: "bl-faq-library__foot-actions",
|
|
4794
|
-
children: [/* @__PURE__ */ jsx(Button$1, {
|
|
4795
|
-
variant: "outline",
|
|
4796
|
-
onClick: () => setFaqOpen(false),
|
|
4797
|
-
children: "Cancel"
|
|
4798
|
-
}), /* @__PURE__ */ jsx(Button$1, {
|
|
4799
|
-
disabled: busy,
|
|
4800
|
-
onClick: () => void saveFaq(),
|
|
4801
|
-
children: "Save FAQ"
|
|
4802
|
-
})]
|
|
4784
|
+
type: "submit",
|
|
4785
|
+
variant: "outline",
|
|
4786
|
+
disabled: busy,
|
|
4787
|
+
children: "Add"
|
|
4803
4788
|
})]
|
|
4804
|
-
})
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
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
|
+
}),
|
|
4808
4801
|
/* @__PURE__ */ jsx(Dialog, {
|
|
4809
4802
|
open: Boolean(deleteFaq),
|
|
4810
4803
|
title: "Delete this FAQ?",
|
|
4804
|
+
description: "Pages using it would need another FAQ selected.",
|
|
4811
4805
|
cancelLabel: "Cancel",
|
|
4812
4806
|
confirmLabel: "Delete FAQ",
|
|
4813
4807
|
confirmVariant: "danger",
|
|
4814
4808
|
confirmDisabled: busy,
|
|
4815
4809
|
onCancel: () => setDeleteFaq(null),
|
|
4816
|
-
onConfirm: () => void confirmDeleteFaq()
|
|
4817
|
-
children: "Pages using it would need another FAQ selected."
|
|
4810
|
+
onConfirm: () => void confirmDeleteFaq()
|
|
4818
4811
|
}),
|
|
4819
4812
|
deleteTerm ? /* @__PURE__ */ jsx("div", {
|
|
4820
4813
|
className: "bl-nav-kit__modal",
|
|
@@ -4838,12 +4831,16 @@ function QuestionsListPage({ collectionSlug, organizeBy: organizeByProp }) {
|
|
|
4838
4831
|
children: [
|
|
4839
4832
|
"Delete “",
|
|
4840
4833
|
deleteTerm.term.name,
|
|
4841
|
-
"”
|
|
4834
|
+
"” ",
|
|
4835
|
+
termSingular(deleteTerm.entry.label),
|
|
4836
|
+
"?"
|
|
4842
4837
|
]
|
|
4843
4838
|
})]
|
|
4844
4839
|
}),
|
|
4845
4840
|
deleteTerm.count > 0 ? /* @__PURE__ */ jsxs("p", { children: [
|
|
4846
|
-
"This
|
|
4841
|
+
"This ",
|
|
4842
|
+
termSingular(deleteTerm.entry.label),
|
|
4843
|
+
" is currently assigned to",
|
|
4847
4844
|
" ",
|
|
4848
4845
|
/* @__PURE__ */ jsx("button", {
|
|
4849
4846
|
type: "button",
|
|
@@ -4862,8 +4859,14 @@ function QuestionsListPage({ collectionSlug, organizeBy: organizeByProp }) {
|
|
|
4862
4859
|
deleteTerm.count === 1 ? "" : "s"
|
|
4863
4860
|
] })
|
|
4864
4861
|
}),
|
|
4865
|
-
". Deleting it removes the
|
|
4866
|
-
|
|
4862
|
+
". Deleting it removes the ",
|
|
4863
|
+
termSingular(deleteTerm.entry.label),
|
|
4864
|
+
" assignment only."
|
|
4865
|
+
] }) : /* @__PURE__ */ jsxs("p", { children: [
|
|
4866
|
+
"This ",
|
|
4867
|
+
termSingular(deleteTerm.entry.label),
|
|
4868
|
+
" is not assigned to any FAQs."
|
|
4869
|
+
] }),
|
|
4867
4870
|
/* @__PURE__ */ jsxs("div", {
|
|
4868
4871
|
className: "bl-faq-library__impact",
|
|
4869
4872
|
children: [
|
|
@@ -4885,7 +4888,7 @@ function QuestionsListPage({ collectionSlug, organizeBy: organizeByProp }) {
|
|
|
4885
4888
|
variant: "danger",
|
|
4886
4889
|
disabled: busy,
|
|
4887
4890
|
onClick: () => void confirmDeleteTerm(),
|
|
4888
|
-
children:
|
|
4891
|
+
children: `Delete ${termSingular(deleteTerm.entry.label)}`
|
|
4889
4892
|
})]
|
|
4890
4893
|
})]
|
|
4891
4894
|
})]
|