sanity 5.3.0-next.15 → 5.3.0-next.16
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/lib/_chunks-es/package.js +1 -1
- package/lib/_chunks-es/version.js +1 -1
- package/lib/index.js +54 -43
- package/lib/index.js.map +1 -1
- package/package.json +13 -13
|
@@ -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.3.0-next.
|
|
10
|
+
"5.3.0-next.16+0e6cb2006d";
|
|
11
11
|
} catch {
|
|
12
12
|
}
|
|
13
13
|
const SANITY_VERSION = buildVersion || `${version}-dev`;
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
3
|
import * as PathUtils from "@sanity/util/paths";
|
|
4
|
-
import { toString, FOCUS_TERMINATOR, startsWith, isEqual as isEqual$3, pathFor, get as get$1, trimLeft, trimChildPath as trimChildPath$1
|
|
4
|
+
import { toString, FOCUS_TERMINATOR, startsWith, isEqual as isEqual$3, pathFor, get as get$1, trimLeft, fromString, trimChildPath as trimChildPath$1 } from "@sanity/util/paths";
|
|
5
5
|
import React, { forwardRef, useRef, useState, useId, useCallback, useMemo, useImperativeHandle, useEffect, isValidElement, Fragment, cloneElement, memo, useContext, useSyncExternalStore, Suspense, useReducer, startTransition, Component, useLayoutEffect, useEffectEvent, createContext, useDebugValue, PureComponent, Children, useTransition, useInsertionEffect, lazy, useDeferredValue, version, StrictMode } from "react";
|
|
6
6
|
import deepEquals from "react-fast-compare";
|
|
7
7
|
import { WorkspacesContext, LocaleContext, MediaLibraryIdsContext, PerspectiveContext, UserColorManagerContext, ResourceCacheContext, EventsContext, WorkspaceContext, DocumentChangeContext, ReviewChangesContext, DiffContext, PresenceContext, FormBuilderContext, ValidationContext, PortableTextMarkersContext, PortableTextMemberItemsContext, ChangeIndicatorTrackerContextStore, ChangeIndicatorTrackerContextGetSnapshot, FormCallbacksContext, ReferenceInputOptionsContext, DocumentIdContext, HoveredFieldContext, FieldActionsContext, FormValueContext, ReferenceItemRefContext, GetFormValueContext, EnhancedObjectDialogContext, DocumentFieldActionsContext, SortableItemIdContext, VirtualizerScrollInstanceContext, FullscreenPTEContext, PresenceTrackerContextStore, PresenceTrackerContextGetSnapshot, FormFieldPresenceContext, SourceContext, PortableTextMemberItemElementRefsContext, ScrollContext, AssetLimitUpsellContext, DialogStackContext, ReleasesUpsellContext, ReleasesMetadataContext, TableContext, SearchContext, SingleDocReleaseEnabledContext, SingleDocReleaseUpsellContext, SingleDocReleaseContext, ActiveWorkspaceMatcherContext, CalendarContext, AppIdCacheContext, CommentsAuthoringPathContext, CommentsIntentContext, CommentInputContext, CommentsContext, CommentsEnabledContext, CommentsOnboardingContext, CommentsSelectedPathContext, CommentsUpsellContext, AddonDatasetContext, SanityCreateConfigContext, ScheduledPublishingEnabledContext, SchedulesContext, SchedulePublishUpsellContext, DocumentActionPropsContext, TasksEnabledContext, IsLastPaneContext, MentionUserContext, TasksNavigationContext, TasksContext, TasksUpsellContext, RouterHistoryContext, ColorSchemeSetValueContext, ColorSchemeValueContext, DocumentLimitUpsellContext, NavbarContext, FreeTrialContext, LiveUserApplicationContext, PackageVersionInfoContext, StudioAnnouncementContext, CopyPasteContext, UserApplicationCacheContext, PreviewCardContext, ZIndexContext, zIndexContextDefaults } from "sanity/_singletons";
|
|
@@ -28048,7 +28048,15 @@ const TimeZoneButton = (props2) => {
|
|
|
28048
28048
|
display: block;
|
|
28049
28049
|
}
|
|
28050
28050
|
}
|
|
28051
|
-
|
|
28051
|
+
`;
|
|
28052
|
+
function sanitizeTimeZoneKeyId(id2) {
|
|
28053
|
+
try {
|
|
28054
|
+
return fromString(id2).map((segment) => isKeySegment(segment) ? `key-${segment._key}` : typeof segment == "number" ? `idx-${segment}` : segment).join(".");
|
|
28055
|
+
} catch {
|
|
28056
|
+
return id2.replace(/[[\]="']/g, "-");
|
|
28057
|
+
}
|
|
28058
|
+
}
|
|
28059
|
+
const Root$n = styled(Card)`
|
|
28052
28060
|
line-height: 1;
|
|
28053
28061
|
`, serialize$2 = (date) => date.toISOString();
|
|
28054
28062
|
function parseOptions$1(options = {}) {
|
|
@@ -28080,7 +28088,7 @@ function enforceTimeStep$1(dateString, timeStep) {
|
|
|
28080
28088
|
return serialize$2(leftOver !== 0 ? setMinutes(date, minutes - leftOver) : date);
|
|
28081
28089
|
}
|
|
28082
28090
|
function DateTimeInput$2(props2) {
|
|
28083
|
-
const $ = c(
|
|
28091
|
+
const $ = c(77), {
|
|
28084
28092
|
onChange,
|
|
28085
28093
|
schemaType,
|
|
28086
28094
|
value,
|
|
@@ -28117,64 +28125,67 @@ function DateTimeInput$2(props2) {
|
|
|
28117
28125
|
const t4 = useFormValue(t3);
|
|
28118
28126
|
let t5;
|
|
28119
28127
|
$[3] !== t4 ? (t5 = getPublishedId(t4), $[3] = t4, $[4] = t5) : t5 = $[4];
|
|
28120
|
-
const
|
|
28121
|
-
let
|
|
28122
|
-
$[5] !==
|
|
28128
|
+
const published = t5;
|
|
28129
|
+
let t6;
|
|
28130
|
+
$[5] !== id2 ? (t6 = sanitizeTimeZoneKeyId(id2), $[5] = id2, $[6] = t6) : t6 = $[6];
|
|
28131
|
+
const t7 = `${published}.${t6}${allowTimeZoneSwitch ? "" : ".fixed"}`;
|
|
28123
28132
|
let t8;
|
|
28124
|
-
$[7] !==
|
|
28133
|
+
$[7] !== value ? (t8 = value ? new Date(value) : void 0, $[7] = value, $[8] = t8) : t8 = $[8];
|
|
28134
|
+
let t9;
|
|
28135
|
+
$[9] !== displayTimeZone || $[10] !== t7 || $[11] !== t8 ? (t9 = {
|
|
28125
28136
|
type: "input",
|
|
28126
28137
|
defaultTimeZone: displayTimeZone,
|
|
28127
|
-
id:
|
|
28128
|
-
relativeDate:
|
|
28129
|
-
}, $[
|
|
28130
|
-
const timeZoneScope =
|
|
28138
|
+
id: t7,
|
|
28139
|
+
relativeDate: t8
|
|
28140
|
+
}, $[9] = displayTimeZone, $[10] = t7, $[11] = t8, $[12] = t9) : t9 = $[12];
|
|
28141
|
+
const timeZoneScope = t9, {
|
|
28131
28142
|
timeZone
|
|
28132
28143
|
} = useTimeZone(timeZoneScope);
|
|
28133
|
-
let
|
|
28134
|
-
$[
|
|
28144
|
+
let t10;
|
|
28145
|
+
$[13] !== onChange || $[14] !== timeStep ? (t10 = (nextDate) => {
|
|
28135
28146
|
let date = nextDate;
|
|
28136
28147
|
date !== null && timeStep > 1 && (date = enforceTimeStep$1(date, timeStep)), onChange(date === null ? unset() : set(date));
|
|
28137
|
-
}, $[
|
|
28138
|
-
const handleChange =
|
|
28139
|
-
let t10;
|
|
28140
|
-
$[14] !== dateFormat || $[15] !== timeFormat || $[16] !== timeZone.name ? (t10 = (date_0) => format$1(date_0, `${dateFormat} ${timeFormat}`, {
|
|
28141
|
-
timeZone: timeZone.name
|
|
28142
|
-
}), $[14] = dateFormat, $[15] = timeFormat, $[16] = timeZone.name, $[17] = t10) : t10 = $[17];
|
|
28143
|
-
const formatInputValue = t10;
|
|
28148
|
+
}, $[13] = onChange, $[14] = timeStep, $[15] = t10) : t10 = $[15];
|
|
28149
|
+
const handleChange = t10;
|
|
28144
28150
|
let t11;
|
|
28145
|
-
$[
|
|
28146
|
-
|
|
28151
|
+
$[16] !== dateFormat || $[17] !== timeFormat || $[18] !== timeZone.name ? (t11 = (date_0) => format$1(date_0, `${dateFormat} ${timeFormat}`, {
|
|
28152
|
+
timeZone: timeZone.name
|
|
28153
|
+
}), $[16] = dateFormat, $[17] = timeFormat, $[18] = timeZone.name, $[19] = t11) : t11 = $[19];
|
|
28154
|
+
const formatInputValue = t11;
|
|
28147
28155
|
let t12;
|
|
28148
|
-
$[20] !==
|
|
28149
|
-
const
|
|
28156
|
+
$[20] !== timeZone.name ? (t12 = getDeserializer(timeZone.name), $[20] = timeZone.name, $[21] = t12) : t12 = $[21];
|
|
28157
|
+
const deserialize2 = t12;
|
|
28150
28158
|
let t13;
|
|
28151
|
-
$[24] !==
|
|
28152
|
-
const
|
|
28153
|
-
let
|
|
28154
|
-
$[26] !==
|
|
28159
|
+
$[22] !== dateFormat || $[23] !== timeFormat || $[24] !== timeZone.name ? (t13 = (inputValue) => parse$2(inputValue, `${dateFormat} ${timeFormat}`, timeZone.name), $[22] = dateFormat, $[23] = timeFormat, $[24] = timeZone.name, $[25] = t13) : t13 = $[25];
|
|
28160
|
+
const parseInputValue = t13;
|
|
28161
|
+
let t14;
|
|
28162
|
+
$[26] !== t ? (t14 = getCalendarLabels(t), $[26] = t, $[27] = t14) : t14 = $[27];
|
|
28163
|
+
const calendarLabels = t14, t15 = `field-${id2}`, t16 = !!focused;
|
|
28164
|
+
let t17;
|
|
28165
|
+
$[28] !== allowTimeZoneSwitch || $[29] !== displayTimeZone || $[30] !== t || $[31] !== timeZone.alternativeName || $[32] !== timeZone.offset || $[33] !== timeZoneScope || $[34] !== title ? (t17 = displayTimeZone && /* @__PURE__ */ jsx(TimeZoneButtonElementQuery$1, { children: /* @__PURE__ */ jsx(TimeZoneButton, { tooltipContent: /* @__PURE__ */ jsx(Translate, { t, i18nKey: "time-zone.time-zone-tooltip-input", values: {
|
|
28155
28166
|
title,
|
|
28156
28167
|
alternativeName: timeZone.alternativeName,
|
|
28157
28168
|
offset: timeZone.offset
|
|
28158
|
-
} }), allowTimeZoneSwitch, useElementQueries: !0, timeZoneScope }) }), $[
|
|
28159
|
-
let t17;
|
|
28160
|
-
$[34] !== id2 || $[35] !== schemaType.deprecated || $[36] !== schemaType.description || $[37] !== schemaType.title || $[38] !== t16 || $[39] !== validation2 ? (t17 = /* @__PURE__ */ jsx(Stack, { space: 2, children: /* @__PURE__ */ jsx(FormFieldHeaderText, { deprecated: schemaType.deprecated, description: schemaType.description, inputId: id2, validation: validation2, title: schemaType.title, suffix: t16 }) }), $[34] = id2, $[35] = schemaType.deprecated, $[36] = schemaType.description, $[37] = schemaType.title, $[38] = t16, $[39] = validation2, $[40] = t17) : t17 = $[40];
|
|
28169
|
+
} }), allowTimeZoneSwitch, useElementQueries: !0, timeZoneScope }) }), $[28] = allowTimeZoneSwitch, $[29] = displayTimeZone, $[30] = t, $[31] = timeZone.alternativeName, $[32] = timeZone.offset, $[33] = timeZoneScope, $[34] = title, $[35] = t17) : t17 = $[35];
|
|
28161
28170
|
let t18;
|
|
28162
|
-
$[
|
|
28171
|
+
$[36] !== id2 || $[37] !== schemaType.deprecated || $[38] !== schemaType.description || $[39] !== schemaType.title || $[40] !== t17 || $[41] !== validation2 ? (t18 = /* @__PURE__ */ jsx(Stack, { space: 2, children: /* @__PURE__ */ jsx(FormFieldHeaderText, { deprecated: schemaType.deprecated, description: schemaType.description, inputId: id2, validation: validation2, title: schemaType.title, suffix: t17 }) }), $[36] = id2, $[37] = schemaType.deprecated, $[38] = schemaType.description, $[39] = schemaType.title, $[40] = t17, $[41] = validation2, $[42] = t18) : t18 = $[42];
|
|
28163
28172
|
let t19;
|
|
28164
|
-
$[50]
|
|
28165
|
-
|
|
28166
|
-
|
|
28167
|
-
|
|
28173
|
+
$[43] !== actions || $[44] !== comments2 || $[45] !== hovered || $[46] !== id2 || $[47] !== presence || $[48] !== slot || $[49] !== t16 || $[50] !== t18 ? (t19 = /* @__PURE__ */ jsx(Box, { flex: 1, paddingY: 2, children: /* @__PURE__ */ jsx(FormFieldBaseHeader, { __internal_comments: comments2, __internal_slot: slot, actions, fieldFocused: t16, fieldHovered: hovered, presence, inputId: id2, content: t18 }) }), $[43] = actions, $[44] = comments2, $[45] = hovered, $[46] = id2, $[47] = presence, $[48] = slot, $[49] = t16, $[50] = t18, $[51] = t19) : t19 = $[51];
|
|
28174
|
+
let t20;
|
|
28175
|
+
$[52] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t20 = /* @__PURE__ */ jsx(FormFieldStatus, { maxAvatars: 1, position: "top" }), $[52] = t20) : t20 = $[52];
|
|
28176
|
+
const t21 = !!focused;
|
|
28168
28177
|
let t22;
|
|
28169
|
-
$[
|
|
28178
|
+
$[53] !== calendarLabels || $[54] !== deserialize2 || $[55] !== elementProps || $[56] !== formatInputValue || $[57] !== handleChange || $[58] !== parseInputValue || $[59] !== schemaType.placeholder || $[60] !== timeStep || $[61] !== timeZoneScope || $[62] !== value ? (t22 = /* @__PURE__ */ jsx("div", { "data-testid": "change-bar-wrapper", children: /* @__PURE__ */ jsx("div", { "data-testid": "change-bar__field-wrapper", children: /* @__PURE__ */ jsx(CommonDateTimeInput$1, { ...elementProps, calendarLabels, deserialize: deserialize2, formatInputValue, onChange: handleChange, parseInputValue, placeholder: schemaType.placeholder, serialize: serialize$2, timeStep, selectTime: !0, value, timeZoneScope }) }) }), $[53] = calendarLabels, $[54] = deserialize2, $[55] = elementProps, $[56] = formatInputValue, $[57] = handleChange, $[58] = parseInputValue, $[59] = schemaType.placeholder, $[60] = timeStep, $[61] = timeZoneScope, $[62] = value, $[63] = t22) : t22 = $[63];
|
|
28170
28179
|
let t23;
|
|
28171
|
-
$[
|
|
28172
|
-
t18,
|
|
28173
|
-
t19,
|
|
28174
|
-
t22
|
|
28175
|
-
] }), $[67] = t18, $[68] = t22, $[69] = t23) : t23 = $[69];
|
|
28180
|
+
$[64] !== changed || $[65] !== path || $[66] !== t21 || $[67] !== t22 ? (t23 = /* @__PURE__ */ jsx(ChangeIndicator, { hasFocus: t21, isChanged: changed, path, children: t22 }), $[64] = changed, $[65] = path, $[66] = t21, $[67] = t22, $[68] = t23) : t23 = $[68];
|
|
28176
28181
|
let t24;
|
|
28177
|
-
|
|
28182
|
+
$[69] !== t19 || $[70] !== t23 ? (t24 = /* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
|
|
28183
|
+
t19,
|
|
28184
|
+
t20,
|
|
28185
|
+
t23
|
|
28186
|
+
] }), $[69] = t19, $[70] = t23, $[71] = t24) : t24 = $[71];
|
|
28187
|
+
let t25;
|
|
28188
|
+
return $[72] !== onMouseEnter || $[73] !== onMouseLeave || $[74] !== t15 || $[75] !== t24 ? (t25 = /* @__PURE__ */ jsx(Root$n, { onMouseEnter, onMouseLeave, "data-testid": t15, radius: 2, children: t24 }), $[72] = onMouseEnter, $[73] = onMouseLeave, $[74] = t15, $[75] = t24, $[76] = t25) : t25 = $[76], t25;
|
|
28178
28189
|
}
|
|
28179
28190
|
function EmailInput(props2) {
|
|
28180
28191
|
const $ = c(3), {
|