sanity 6.3.0-next.49 → 6.3.0-next.55

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.
@@ -3359,16 +3359,56 @@ const MemoReleaseDocumentPreview = memo(function(t0) {
3359
3359
  const isGoingToBePublished = t1;
3360
3360
  let t2;
3361
3361
  return $[2] !== documentRevision || $[3] !== isGoingToBePublished || $[4] !== item.document._id || $[5] !== item.document._type || $[6] !== releaseId || $[7] !== releaseState ? (t2 = /* @__PURE__ */ jsx(ReleaseDocumentPreview, { documentId: item.document._id, documentTypeName: item.document._type, releaseId, releaseState, documentRevision, isGoingToBePublished }), $[2] = documentRevision, $[3] = isGoingToBePublished, $[4] = item.document._id, $[5] = item.document._type, $[6] = releaseId, $[7] = releaseState, $[8] = t2) : t2 = $[8], t2;
3362
- }, (prev, next) => prev.item.memoKey === next.item.memoKey && prev.releaseId === next.releaseId), MemoDocumentType = memo(function(t0) {
3363
- const $ = c(5), {
3362
+ }, (prev, next) => prev.item.memoKey === next.item.memoKey && prev.releaseId === next.releaseId), TruncatedSpan = styled.span.withConfig({
3363
+ displayName: "TruncatedSpan",
3364
+ componentId: "sc-eeeb2q-0"
3365
+ })`display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;`;
3366
+ function DocumentType(t0) {
3367
+ const $ = c(15), {
3364
3368
  type
3365
3369
  } = t0, schema = useSchema();
3366
3370
  let t1;
3367
- $[0] !== schema || $[1] !== type ? (t1 = schema.get(type), $[0] = schema, $[1] = type, $[2] = t1) : t1 = $[2];
3368
- const t2 = t1?.title || "Not found";
3371
+ $[0] !== schema || $[1] !== type ? (t1 = schema.get(type)?.title || "Not found", $[0] = schema, $[1] = type, $[2] = t1) : t1 = $[2];
3372
+ const title = t1, elementRef = useRef(null), [isTruncated, setIsTruncated] = useState(!1);
3373
+ let t2;
3374
+ $[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t2 = () => {
3375
+ const element = elementRef.current;
3376
+ element && setIsTruncated(element.scrollWidth > element.clientWidth);
3377
+ }, $[3] = t2) : t2 = $[3];
3378
+ const checkTruncation = t2;
3369
3379
  let t3;
3370
- return $[3] !== t2 ? (t3 = /* @__PURE__ */ jsx(Text, { size: 1, children: t2 }), $[3] = t2, $[4] = t3) : t3 = $[4], t3;
3371
- }, (prev, next) => prev.type === next.type), documentActionColumn = (t) => ({
3380
+ $[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t3 = (element_0) => {
3381
+ if (elementRef.current = element_0, !element_0)
3382
+ return;
3383
+ checkTruncation();
3384
+ const observer = new ResizeObserver(checkTruncation);
3385
+ observer.observe(element_0);
3386
+ let cancelled = !1;
3387
+ return document.fonts?.ready?.then(() => {
3388
+ cancelled || checkTruncation();
3389
+ }), () => {
3390
+ cancelled = !0, observer.disconnect(), elementRef.current = null;
3391
+ };
3392
+ }, $[4] = t3) : t3 = $[4];
3393
+ const measureRef = t3;
3394
+ let t4;
3395
+ $[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t4 = () => {
3396
+ checkTruncation();
3397
+ }, $[5] = t4) : t4 = $[5];
3398
+ let t5;
3399
+ $[6] !== title ? (t5 = [title, checkTruncation], $[6] = title, $[7] = t5) : t5 = $[7], useEffect(t4, t5);
3400
+ let t6;
3401
+ $[8] !== title ? (t6 = /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(TruncatedSpan, { ref: measureRef, children: title }) }), $[8] = title, $[9] = t6) : t6 = $[9];
3402
+ const textElement = t6;
3403
+ if (isTruncated) {
3404
+ let t7;
3405
+ $[10] !== title ? (t7 = /* @__PURE__ */ jsx(Text, { size: 1, children: title }), $[10] = title, $[11] = t7) : t7 = $[11];
3406
+ let t8;
3407
+ return $[12] !== t7 || $[13] !== textElement ? (t8 = /* @__PURE__ */ jsx(Tooltip, { portal: !0, content: t7, children: textElement }), $[12] = t7, $[13] = textElement, $[14] = t8) : t8 = $[14], t8;
3408
+ }
3409
+ return textElement;
3410
+ }
3411
+ const MemoDocumentType = memo(DocumentType, (prev, next) => prev.type === next.type), documentActionColumn = (t) => ({
3372
3412
  id: "action",
3373
3413
  width: null,
3374
3414
  style: {
@@ -3392,16 +3432,17 @@ const MemoReleaseDocumentPreview = memo(function(t0) {
3392
3432
  ...releaseState === "archived" || releaseState === "published" ? [] : [documentActionColumn(t)],
3393
3433
  {
3394
3434
  id: "document._type",
3395
- width: null,
3396
- style: {
3397
- minWidth: 100
3398
- },
3435
+ // Header and body rows are independent flexboxes, so a content-sized column (width: null)
3436
+ // settles at different widths in each and misaligns. A fixed width keeps them in sync.
3437
+ width: 150,
3399
3438
  sorting: !0,
3400
3439
  header: (props) => /* @__PURE__ */ jsx(Flex, { ...props.headerProps, paddingY: 3, sizing: "border", children: /* @__PURE__ */ jsx(Headers.SortHeaderButton, { text: t("table-header.type"), ...props }) }),
3401
3440
  cell: ({
3402
3441
  cellProps,
3403
3442
  datum
3404
- }) => /* @__PURE__ */ jsx(Flex, { align: "center", ...cellProps, children: /* @__PURE__ */ jsx(Box, { paddingX: 2, children: !datum.isLoading && /* @__PURE__ */ jsx(MemoDocumentType, { type: datum.document._type }) }) })
3443
+ }) => /* @__PURE__ */ jsx(Flex, { align: "center", ...cellProps, children: /* @__PURE__ */ jsx(Box, { paddingX: 2, style: {
3444
+ minWidth: 0
3445
+ }, children: !datum.isLoading && /* @__PURE__ */ jsx(MemoDocumentType, { type: datum.document._type }) }) })
3405
3446
  },
3406
3447
  {
3407
3448
  id: "search",