sanity 6.4.0 → 6.4.1-next.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.
@@ -10485,6 +10485,9 @@ interface ReleasesUpsellContextValue {
10485
10485
  interface DocumentValidationStatus extends ValidationStatus {
10486
10486
  hasError: boolean;
10487
10487
  }
10488
+ /**
10489
+ * TODO: Rename this fo DocumentInBundle, adapt in releases and variants to it's own specific types.
10490
+ */
10488
10491
  interface DocumentInRelease {
10489
10492
  memoKey: string;
10490
10493
  isPending?: boolean;
@@ -214,7 +214,7 @@ import { UnarchiveIcon } from "@sanity/icons/Unarchive";
214
214
  import { ShareIcon } from "@sanity/icons/Share";
215
215
  import { TargetIcon } from "@sanity/icons/Target";
216
216
  import { TextIcon } from "@sanity/icons/Text";
217
- import { Headers, Table } from "./Table.js";
217
+ import { Headers, searchDocumentRelease, Table } from "./searchDocumentRelease.js";
218
218
  import { isSameDay } from "date-fns/isSameDay";
219
219
  import { CalendarDay, CalendarFilter } from "./CalendarFilter.js";
220
220
  import { useReleasesMetadataProvider } from "./ReleasesMetadataProvider.js";
@@ -3615,29 +3615,6 @@ function UpdatedAtCell(t0) {
3615
3615
  let t6;
3616
3616
  return $[13] !== cellProps || $[14] !== t5 ? (t6 = /* @__PURE__ */ jsx(Flex, { ...cellProps, align: "center", paddingX: 2, paddingY: 3, style: t2, sizing: "border", children: t5 }), $[13] = cellProps, $[14] = t5, $[15] = t6) : t6 = $[15], t6;
3617
3617
  }
3618
- function extractSearchableText(value, depth = 0, visited = []) {
3619
- if (typeof value > "u" || value === null || depth > 3) return "";
3620
- if (typeof value == "string") return value;
3621
- if (typeof value == "number") return value.toString();
3622
- if (Array.isArray(value))
3623
- return value.map((item) => typeof item == "object" && item.children && item._type === "block" ? item.children.map((child) => child.text).join(" ").trim() : Array.isArray(item) ? extractSearchableText(item, depth + 1, visited) : item.toString().trim()).filter(Boolean).join(" ");
3624
- if (typeof value == "object" && value !== null) {
3625
- if (visited.includes(value)) return "";
3626
- visited.push(value);
3627
- const entries = Object.entries(value);
3628
- if (entries.length > 0 && entries.every(([key, val]) => typeof val != "boolean" && !key.startsWith("_")))
3629
- return entries.map(([, val]) => extractSearchableText(val, depth + 1, visited)).filter(Boolean).join(" ");
3630
- const title = "title" in value && typeof value.title == "string" ? value.title.toString().trim() : void 0, name = "name" in value && typeof value.name == "string" ? value.name.toString().trim() : void 0, text = "text" in value && typeof value.text == "string" ? value.text.toString().trim() : void 0;
3631
- return title || name || text ? [title, name, text].filter(Boolean).join(" ") : entries.filter(([key]) => !key.startsWith("_")).map(([, val]) => extractSearchableText(val, depth + 1, visited)).filter(Boolean).join(" ");
3632
- }
3633
- return "";
3634
- }
3635
- function searchDocumentRelease(document2, searchTerm) {
3636
- if (!searchTerm || searchTerm.trim().length === 0 || !document2.title && !document2.name)
3637
- return !1;
3638
- const title = extractSearchableText(document2.title), name = extractSearchableText(document2.name), normalizedSearchTerm = searchTerm.toLowerCase().trim(), normalizedTitle = title.toLowerCase(), normalizedName = name.toLowerCase(), hasTitle = normalizedTitle.trim().length > 0, hasName = normalizedName.trim().length > 0, combinedText = `${normalizedTitle} ${normalizedName}`, allWordsMatch = normalizedSearchTerm.split(/\s+/).filter((word) => word.length > 0).every((word) => hasTitle && normalizedTitle.includes(word) || hasName && normalizedName.includes(word) || combinedText.includes(word)), documentInSearchTerm = hasName && normalizedSearchTerm.includes(normalizedName) || hasTitle && normalizedSearchTerm.includes(normalizedTitle);
3639
- return allWordsMatch || documentInSearchTerm;
3640
- }
3641
3618
  const FULL_HEIGHT_STYLE = {
3642
3619
  height: "100%"
3643
3620
  }, SCROLL_CONTAINER_STYLE = {