sanity 5.1.1-next.10 → 5.1.1-next.11

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.
@@ -1,4 +1,4 @@
1
- var version = "5.1.1-next.10+0378dce557", peerDependencies = {
1
+ var version = "5.1.1-next.11+ee5da89184", peerDependencies = {
2
2
  "styled-components": "^6.1.15"
3
3
  };
4
4
  export {
@@ -7,7 +7,7 @@ try {
7
7
  try {
8
8
  buildVersion = buildVersion || // This is replaced by `@sanity/pkg-utils` at build time
9
9
  // and must always be references by its full static name, e.g. no optional chaining, no `if (process && process.env)` etc.
10
- "5.1.1-next.10+0378dce557";
10
+ "5.1.1-next.11+ee5da89184";
11
11
  } catch {
12
12
  }
13
13
  const SANITY_VERSION = buildVersion || `${version}-dev`;
package/lib/index.js CHANGED
@@ -51063,7 +51063,7 @@ function createFieldDefinitionDictionary(fieldDefinitions) {
51063
51063
  return fieldDefinitions.reduce((acc, val) => (acc[val.id] = val, acc), {});
51064
51064
  }
51065
51065
  function generateFieldId(field) {
51066
- return [field.type, field.fieldPath, field.filterName, field.documentTypes.join(",")].join("-");
51066
+ return [field.type, field.fieldPath, field.title].join("-");
51067
51067
  }
51068
51068
  function getDocumentFieldDefinitions(supportedFieldTypes, documentTypes, objectTypes) {
51069
51069
  const supportedFieldTypeSet = new Set(supportedFieldTypes);
@@ -51164,7 +51164,7 @@ function resolveFilterName(schemaType) {
51164
51164
  function sortFieldDefinitions(a, b) {
51165
51165
  return a.title.localeCompare(b.title) || a.titlePath.slice(0, -1).join("/").localeCompare(b.titlePath.slice(0, -1).join("/")) || a.fieldPath.localeCompare(b.fieldPath);
51166
51166
  }
51167
- const RECENT_SEARCH_VERSION$1 = 2, STORED_SEARCHES_NAMESPACE = "studio.search.recent", defaultValue = {
51167
+ const RECENT_SEARCH_VERSION$1 = 3, STORED_SEARCHES_NAMESPACE = "studio.search.recent", defaultValue = {
51168
51168
  version: RECENT_SEARCH_VERSION$1,
51169
51169
  recentSearches: []
51170
51170
  };
@@ -51193,7 +51193,7 @@ function useStoredSearch() {
51193
51193
  let t5;
51194
51194
  return $[13] !== set2 || $[14] !== value ? (t5 = [value, set2], $[13] = set2, $[14] = value, $[15] = t5) : t5 = $[15], t5;
51195
51195
  }
51196
- const MAX_RECENT_SEARCHES = 5, RECENT_SEARCH_VERSION = 2;
51196
+ const MAX_RECENT_SEARCHES = 5, RECENT_SEARCH_VERSION = 3;
51197
51197
  function useRecentSearchesStore() {
51198
51198
  const $ = c(18), [storedSearch, setStoredSearch] = useStoredSearch(), schema2 = useSchema(), {
51199
51199
  search: t0
@@ -51367,6 +51367,11 @@ function _temp$1S() {
51367
51367
  padding: "0 0.25rem"
51368
51368
  } }, 0);
51369
51369
  }
51370
+ const RecentSearchClicked = defineEvent({
51371
+ name: "Recent Search Viewed",
51372
+ version: 1,
51373
+ description: "User clicked on a recent search item to reapply it"
51374
+ });
51370
51375
  function DocumentTypesPill(t0) {
51371
51376
  const $ = c(6), {
51372
51377
  availableCharacters,
@@ -51418,7 +51423,7 @@ const DEFAULT_COMBINED_TYPE_COUNT = 40, RecentSearchItemButton = styled(Button$1
51418
51423
  }
51419
51424
  `;
51420
51425
  function RecentSearchItem(t0) {
51421
- const $ = c(36);
51426
+ const $ = c(37);
51422
51427
  let index, rest, t1, value;
51423
51428
  $[0] !== t0 ? ({
51424
51429
  index,
@@ -51428,52 +51433,52 @@ function RecentSearchItem(t0) {
51428
51433
  } = t0, $[0] = t0, $[1] = index, $[2] = rest, $[3] = t1, $[4] = value) : (index = $[1], rest = $[2], t1 = $[3], value = $[4]);
51429
51434
  const maxVisibleTypePillChars = t1 === void 0 ? DEFAULT_COMBINED_TYPE_COUNT : t1, {
51430
51435
  dispatch
51431
- } = useSearchState(), recentSearchesStore = useRecentSearchesStore(), availableCharacters = maxVisibleTypePillChars - value.query.length;
51436
+ } = useSearchState(), recentSearchesStore = useRecentSearchesStore(), telemetry = useTelemetry(), availableCharacters = maxVisibleTypePillChars - value.query.length;
51432
51437
  let t2;
51433
- $[5] !== dispatch || $[6] !== recentSearchesStore || $[7] !== value ? (t2 = () => {
51438
+ $[5] !== dispatch || $[6] !== recentSearchesStore || $[7] !== telemetry || $[8] !== value ? (t2 = () => {
51434
51439
  dispatch({
51435
51440
  type: "TERMS_SET",
51436
51441
  filters: value?.filters,
51437
51442
  terms: value
51438
- }), recentSearchesStore && recentSearchesStore?.addSearch(value, value?.filters);
51439
- }, $[5] = dispatch, $[6] = recentSearchesStore, $[7] = value, $[8] = t2) : t2 = $[8];
51443
+ }), recentSearchesStore && recentSearchesStore?.addSearch(value, value?.filters), telemetry.log(RecentSearchClicked);
51444
+ }, $[5] = dispatch, $[6] = recentSearchesStore, $[7] = telemetry, $[8] = value, $[9] = t2) : t2 = $[9];
51440
51445
  const handleClick = t2;
51441
51446
  let t3;
51442
- $[9] !== index || $[10] !== recentSearchesStore ? (t3 = (event) => {
51447
+ $[10] !== index || $[11] !== recentSearchesStore ? (t3 = (event) => {
51443
51448
  event.stopPropagation(), recentSearchesStore && recentSearchesStore?.removeSearchAtIndex(index);
51444
- }, $[9] = index, $[10] = recentSearchesStore, $[11] = t3) : t3 = $[11];
51449
+ }, $[10] = index, $[11] = recentSearchesStore, $[12] = t3) : t3 = $[12];
51445
51450
  const handleDelete = t3;
51446
51451
  let t4;
51447
- $[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t4 = /* @__PURE__ */ jsxs(Inline, { paddingY: 2, children: [
51452
+ $[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t4 = /* @__PURE__ */ jsxs(Inline, { paddingY: 2, children: [
51448
51453
  /* @__PURE__ */ jsx(Text$1, { muted: !0, size: 1, children: /* @__PURE__ */ jsx(ClockIcon, {}) }),
51449
51454
  /* @__PURE__ */ jsx(Text$1, { children: "\u200B" })
51450
- ] }), $[12] = t4) : t4 = $[12];
51455
+ ] }), $[13] = t4) : t4 = $[13];
51451
51456
  let t5;
51452
- $[13] !== value.query ? (t5 = value.query && /* @__PURE__ */ jsx(SearchItemQueryFlex, { align: "center", paddingY: 2, children: /* @__PURE__ */ jsx(Text$1, { muted: !0, size: 1, textOverflow: "ellipsis", weight: "medium", children: value.query }) }), $[13] = value.query, $[14] = t5) : t5 = $[14];
51457
+ $[14] !== value.query ? (t5 = value.query && /* @__PURE__ */ jsx(SearchItemQueryFlex, { align: "center", paddingY: 2, children: /* @__PURE__ */ jsx(Text$1, { muted: !0, size: 1, textOverflow: "ellipsis", weight: "medium", children: value.query }) }), $[14] = value.query, $[15] = t5) : t5 = $[15];
51453
51458
  let t6;
51454
- $[15] !== availableCharacters || $[16] !== value.types ? (t6 = value.types.length > 0 && /* @__PURE__ */ jsx(SearchItemPillsBox, { children: /* @__PURE__ */ jsx(DocumentTypesPill, { availableCharacters, types: value.types }) }), $[15] = availableCharacters, $[16] = value.types, $[17] = t6) : t6 = $[17];
51459
+ $[16] !== availableCharacters || $[17] !== value.types ? (t6 = value.types.length > 0 && /* @__PURE__ */ jsx(SearchItemPillsBox, { children: /* @__PURE__ */ jsx(DocumentTypesPill, { availableCharacters, types: value.types }) }), $[16] = availableCharacters, $[17] = value.types, $[18] = t6) : t6 = $[18];
51455
51460
  let t7;
51456
- $[18] !== value.filters ? (t7 = value?.filters?.map(_temp$1R), $[18] = value.filters, $[19] = t7) : t7 = $[19];
51461
+ $[19] !== value.filters ? (t7 = value?.filters?.map(_temp$1R), $[19] = value.filters, $[20] = t7) : t7 = $[20];
51457
51462
  let t8;
51458
- $[20] !== t5 || $[21] !== t6 || $[22] !== t7 ? (t8 = /* @__PURE__ */ jsxs(Flex, { align: "stretch", flex: 1, gap: 2, justify: "flex-start", marginLeft: 3, wrap: "wrap", children: [
51463
+ $[21] !== t5 || $[22] !== t6 || $[23] !== t7 ? (t8 = /* @__PURE__ */ jsxs(Flex, { align: "stretch", flex: 1, gap: 2, justify: "flex-start", marginLeft: 3, wrap: "wrap", children: [
51459
51464
  t5,
51460
51465
  t6,
51461
51466
  t7
51462
- ] }), $[20] = t5, $[21] = t6, $[22] = t7, $[23] = t8) : t8 = $[23];
51467
+ ] }), $[21] = t5, $[22] = t6, $[23] = t7, $[24] = t8) : t8 = $[24];
51463
51468
  let t9;
51464
- $[24] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsx(Flex, { padding: 2, children: /* @__PURE__ */ jsx(Text$1, { size: 1, children: /* @__PURE__ */ jsx(CloseIcon, {}) }) }), $[24] = t9) : t9 = $[24];
51469
+ $[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsx(Flex, { padding: 2, children: /* @__PURE__ */ jsx(Text$1, { size: 1, children: /* @__PURE__ */ jsx(CloseIcon, {}) }) }), $[25] = t9) : t9 = $[25];
51465
51470
  let t10;
51466
- $[25] !== handleDelete ? (t10 = /* @__PURE__ */ jsx(Flex, { align: "center", children: /* @__PURE__ */ jsx(CloseButtonDiv, { onClick: handleDelete, children: t9 }) }), $[25] = handleDelete, $[26] = t10) : t10 = $[26];
51471
+ $[26] !== handleDelete ? (t10 = /* @__PURE__ */ jsx(Flex, { align: "center", children: /* @__PURE__ */ jsx(CloseButtonDiv, { onClick: handleDelete, children: t9 }) }), $[26] = handleDelete, $[27] = t10) : t10 = $[27];
51467
51472
  let t11;
51468
- $[27] !== t10 || $[28] !== t8 ? (t11 = /* @__PURE__ */ jsxs(Flex, { align: "stretch", children: [
51473
+ $[28] !== t10 || $[29] !== t8 ? (t11 = /* @__PURE__ */ jsxs(Flex, { align: "stretch", children: [
51469
51474
  t4,
51470
51475
  t8,
51471
51476
  t10
51472
- ] }), $[27] = t10, $[28] = t8, $[29] = t11) : t11 = $[29];
51477
+ ] }), $[28] = t10, $[29] = t8, $[30] = t11) : t11 = $[30];
51473
51478
  let t12;
51474
- $[30] !== handleClick || $[31] !== t11 ? (t12 = /* @__PURE__ */ jsx(RecentSearchItemButton, { mode: "bleed", onClick: handleClick, paddingLeft: 3, paddingRight: 1, paddingY: 1, tabIndex: -1, children: t11 }), $[30] = handleClick, $[31] = t11, $[32] = t12) : t12 = $[32];
51479
+ $[31] !== handleClick || $[32] !== t11 ? (t12 = /* @__PURE__ */ jsx(RecentSearchItemButton, { mode: "bleed", onClick: handleClick, paddingLeft: 3, paddingRight: 1, paddingY: 1, tabIndex: -1, children: t11 }), $[31] = handleClick, $[32] = t11, $[33] = t12) : t12 = $[33];
51475
51480
  let t13;
51476
- return $[33] !== rest || $[34] !== t12 ? (t13 = /* @__PURE__ */ jsx(Box, { ...rest, children: t12 }), $[33] = rest, $[34] = t12, $[35] = t13) : t13 = $[35], t13;
51481
+ return $[34] !== rest || $[35] !== t12 ? (t13 = /* @__PURE__ */ jsx(Box, { ...rest, children: t12 }), $[34] = rest, $[35] = t12, $[36] = t13) : t13 = $[36], t13;
51477
51482
  }
51478
51483
  function _temp$1R(filter2, i) {
51479
51484
  return /* @__PURE__ */ jsx(FilterPill, { filter: filter2 }, i);