@sanity/ui 2.0.0-beta.8 → 2.0.0-gamma.1

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/dist/index.esm.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { buildTheme, createColorTheme as createColorTheme$1, hexToRgb as hexToRgb$1, hslToRgb as hslToRgb$1, multiply as multiply$1, parseColor as parseColor$1, rgbToHex as rgbToHex$1, rgbToHsl as rgbToHsl$1, rgba as rgba$1, screen as screen$1, getTheme_v2, getScopedTheme } from '@sanity/ui/theme';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { useMemo, useState, useRef, useEffect, createContext, useContext, useSyncExternalStore, useLayoutEffect, forwardRef, useId, useCallback, cloneElement, isValidElement, createElement, Component, memo, useReducer, Children, Fragment as Fragment$1, startTransition } from 'react';
4
+ import ReactIs, { isElement as isElement$1, isFragment, isValidElementType } from 'react-is';
4
5
  import styled, { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, keyframes } from 'styled-components';
5
6
  import { SpinnerIcon, CheckmarkIcon, RemoveIcon, ChevronDownIcon, CloseIcon, ChevronRightIcon, ToggleArrowRightIcon } from '@sanity/icons';
6
7
  import Refractor from 'react-refractor';
@@ -17,363 +18,25 @@ const rgbToHsl = rgbToHsl$1;
17
18
  const rgba = rgba$1;
18
19
  const screen = screen$1;
19
20
  const studioTheme = buildTheme();
20
- function getDefaultExportFromCjs(x) {
21
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
22
- }
23
- var reactIs = {
24
- exports: {}
25
- };
26
- var reactIs_development = {};
27
-
28
- /**
29
- * @license React
30
- * react-is.development.js
31
- *
32
- * Copyright (c) Facebook, Inc. and its affiliates.
33
- *
34
- * This source code is licensed under the MIT license found in the
35
- * LICENSE file in the root directory of this source tree.
36
- */
37
-
38
- var hasRequiredReactIs_development;
39
- function requireReactIs_development() {
40
- if (hasRequiredReactIs_development) return reactIs_development;
41
- hasRequiredReactIs_development = 1;
42
- if (process.env.NODE_ENV !== "production") {
43
- (function () {
44
- // ATTENTION
45
- // When adding new symbols to this file,
46
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
47
- // The Symbol used to tag the ReactElement-like types.
48
- var REACT_ELEMENT_TYPE = Symbol.for('react.element');
49
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
50
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
51
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
52
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
53
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
54
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
55
- var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
56
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
57
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
58
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
59
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
60
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
61
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
62
-
63
- // -----------------------------------------------------------------------------
64
-
65
- var enableScopeAPI = false; // Experimental Create Event Handle API.
66
- var enableCacheElement = false;
67
- var enableTransitionTracing = false; // No known bugs, but needs performance testing
68
-
69
- var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
70
- // stuff. Intended to enable React core members to more easily debug scheduling
71
- // issues in DEV builds.
72
-
73
- var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
74
-
75
- var REACT_MODULE_REFERENCE;
76
- {
77
- REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
78
- }
79
- function isValidElementType(type) {
80
- if (typeof type === 'string' || typeof type === 'function') {
81
- return true;
82
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
83
-
84
- if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
85
- return true;
86
- }
87
- if (typeof type === 'object' && type !== null) {
88
- if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE ||
89
- // This needs to include all possible module reference object
90
- // types supported by any Flight configuration anywhere since
91
- // we don't know which Flight build this will end up being used
92
- // with.
93
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
94
- return true;
95
- }
96
- }
97
- return false;
98
- }
99
- function typeOf(object) {
100
- if (typeof object === 'object' && object !== null) {
101
- var $$typeof = object.$$typeof;
102
- switch ($$typeof) {
103
- case REACT_ELEMENT_TYPE:
104
- var type = object.type;
105
- switch (type) {
106
- case REACT_FRAGMENT_TYPE:
107
- case REACT_PROFILER_TYPE:
108
- case REACT_STRICT_MODE_TYPE:
109
- case REACT_SUSPENSE_TYPE:
110
- case REACT_SUSPENSE_LIST_TYPE:
111
- return type;
112
- default:
113
- var $$typeofType = type && type.$$typeof;
114
- switch ($$typeofType) {
115
- case REACT_SERVER_CONTEXT_TYPE:
116
- case REACT_CONTEXT_TYPE:
117
- case REACT_FORWARD_REF_TYPE:
118
- case REACT_LAZY_TYPE:
119
- case REACT_MEMO_TYPE:
120
- case REACT_PROVIDER_TYPE:
121
- return $$typeofType;
122
- default:
123
- return $$typeof;
124
- }
125
- }
126
- case REACT_PORTAL_TYPE:
127
- return $$typeof;
128
- }
129
- }
130
- return undefined;
131
- }
132
- var ContextConsumer = REACT_CONTEXT_TYPE;
133
- var ContextProvider = REACT_PROVIDER_TYPE;
134
- var Element = REACT_ELEMENT_TYPE;
135
- var ForwardRef = REACT_FORWARD_REF_TYPE;
136
- var Fragment = REACT_FRAGMENT_TYPE;
137
- var Lazy = REACT_LAZY_TYPE;
138
- var Memo = REACT_MEMO_TYPE;
139
- var Portal = REACT_PORTAL_TYPE;
140
- var Profiler = REACT_PROFILER_TYPE;
141
- var StrictMode = REACT_STRICT_MODE_TYPE;
142
- var Suspense = REACT_SUSPENSE_TYPE;
143
- var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
144
- var hasWarnedAboutDeprecatedIsAsyncMode = false;
145
- var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
146
-
147
- function isAsyncMode(object) {
148
- {
149
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
150
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
151
-
152
- console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
153
- }
154
- }
155
- return false;
156
- }
157
- function isConcurrentMode(object) {
158
- {
159
- if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
160
- hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
161
-
162
- console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
163
- }
164
- }
165
- return false;
166
- }
167
- function isContextConsumer(object) {
168
- return typeOf(object) === REACT_CONTEXT_TYPE;
169
- }
170
- function isContextProvider(object) {
171
- return typeOf(object) === REACT_PROVIDER_TYPE;
172
- }
173
- function isElement(object) {
174
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
175
- }
176
- function isForwardRef(object) {
177
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
178
- }
179
- function isFragment(object) {
180
- return typeOf(object) === REACT_FRAGMENT_TYPE;
181
- }
182
- function isLazy(object) {
183
- return typeOf(object) === REACT_LAZY_TYPE;
184
- }
185
- function isMemo(object) {
186
- return typeOf(object) === REACT_MEMO_TYPE;
187
- }
188
- function isPortal(object) {
189
- return typeOf(object) === REACT_PORTAL_TYPE;
190
- }
191
- function isProfiler(object) {
192
- return typeOf(object) === REACT_PROFILER_TYPE;
193
- }
194
- function isStrictMode(object) {
195
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
196
- }
197
- function isSuspense(object) {
198
- return typeOf(object) === REACT_SUSPENSE_TYPE;
199
- }
200
- function isSuspenseList(object) {
201
- return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
202
- }
203
- reactIs_development.ContextConsumer = ContextConsumer;
204
- reactIs_development.ContextProvider = ContextProvider;
205
- reactIs_development.Element = Element;
206
- reactIs_development.ForwardRef = ForwardRef;
207
- reactIs_development.Fragment = Fragment;
208
- reactIs_development.Lazy = Lazy;
209
- reactIs_development.Memo = Memo;
210
- reactIs_development.Portal = Portal;
211
- reactIs_development.Profiler = Profiler;
212
- reactIs_development.StrictMode = StrictMode;
213
- reactIs_development.Suspense = Suspense;
214
- reactIs_development.SuspenseList = SuspenseList;
215
- reactIs_development.isAsyncMode = isAsyncMode;
216
- reactIs_development.isConcurrentMode = isConcurrentMode;
217
- reactIs_development.isContextConsumer = isContextConsumer;
218
- reactIs_development.isContextProvider = isContextProvider;
219
- reactIs_development.isElement = isElement;
220
- reactIs_development.isForwardRef = isForwardRef;
221
- reactIs_development.isFragment = isFragment;
222
- reactIs_development.isLazy = isLazy;
223
- reactIs_development.isMemo = isMemo;
224
- reactIs_development.isPortal = isPortal;
225
- reactIs_development.isProfiler = isProfiler;
226
- reactIs_development.isStrictMode = isStrictMode;
227
- reactIs_development.isSuspense = isSuspense;
228
- reactIs_development.isSuspenseList = isSuspenseList;
229
- reactIs_development.isValidElementType = isValidElementType;
230
- reactIs_development.typeOf = typeOf;
231
- })();
232
- }
233
- return reactIs_development;
234
- }
235
- var reactIs_production_min = {};
236
-
237
- /**
238
- * @license React
239
- * react-is.production.min.js
240
- *
241
- * Copyright (c) Facebook, Inc. and its affiliates.
242
- *
243
- * This source code is licensed under the MIT license found in the
244
- * LICENSE file in the root directory of this source tree.
245
- */
246
-
247
- var hasRequiredReactIs_production_min;
248
- function requireReactIs_production_min() {
249
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
250
- hasRequiredReactIs_production_min = 1;
251
- var b = Symbol.for("react.element"),
252
- c = Symbol.for("react.portal"),
253
- d = Symbol.for("react.fragment"),
254
- e = Symbol.for("react.strict_mode"),
255
- f = Symbol.for("react.profiler"),
256
- g = Symbol.for("react.provider"),
257
- h = Symbol.for("react.context"),
258
- k = Symbol.for("react.server_context"),
259
- l = Symbol.for("react.forward_ref"),
260
- m = Symbol.for("react.suspense"),
261
- n = Symbol.for("react.suspense_list"),
262
- p = Symbol.for("react.memo"),
263
- q = Symbol.for("react.lazy"),
264
- t = Symbol.for("react.offscreen"),
265
- u;
266
- u = Symbol.for("react.module.reference");
267
- function v(a) {
268
- if ("object" === typeof a && null !== a) {
269
- var r = a.$$typeof;
270
- switch (r) {
271
- case b:
272
- switch (a = a.type, a) {
273
- case d:
274
- case f:
275
- case e:
276
- case m:
277
- case n:
278
- return a;
279
- default:
280
- switch (a = a && a.$$typeof, a) {
281
- case k:
282
- case h:
283
- case l:
284
- case q:
285
- case p:
286
- case g:
287
- return a;
288
- default:
289
- return r;
290
- }
291
- }
292
- case c:
293
- return r;
294
- }
295
- }
296
- }
297
- reactIs_production_min.ContextConsumer = h;
298
- reactIs_production_min.ContextProvider = g;
299
- reactIs_production_min.Element = b;
300
- reactIs_production_min.ForwardRef = l;
301
- reactIs_production_min.Fragment = d;
302
- reactIs_production_min.Lazy = q;
303
- reactIs_production_min.Memo = p;
304
- reactIs_production_min.Portal = c;
305
- reactIs_production_min.Profiler = f;
306
- reactIs_production_min.StrictMode = e;
307
- reactIs_production_min.Suspense = m;
308
- reactIs_production_min.SuspenseList = n;
309
- reactIs_production_min.isAsyncMode = function () {
310
- return !1;
311
- };
312
- reactIs_production_min.isConcurrentMode = function () {
313
- return !1;
314
- };
315
- reactIs_production_min.isContextConsumer = function (a) {
316
- return v(a) === h;
317
- };
318
- reactIs_production_min.isContextProvider = function (a) {
319
- return v(a) === g;
320
- };
321
- reactIs_production_min.isElement = function (a) {
322
- return "object" === typeof a && null !== a && a.$$typeof === b;
323
- };
324
- reactIs_production_min.isForwardRef = function (a) {
325
- return v(a) === l;
326
- };
327
- reactIs_production_min.isFragment = function (a) {
328
- return v(a) === d;
329
- };
330
- reactIs_production_min.isLazy = function (a) {
331
- return v(a) === q;
332
- };
333
- reactIs_production_min.isMemo = function (a) {
334
- return v(a) === p;
335
- };
336
- reactIs_production_min.isPortal = function (a) {
337
- return v(a) === c;
338
- };
339
- reactIs_production_min.isProfiler = function (a) {
340
- return v(a) === f;
341
- };
342
- reactIs_production_min.isStrictMode = function (a) {
343
- return v(a) === e;
344
- };
345
- reactIs_production_min.isSuspense = function (a) {
346
- return v(a) === m;
347
- };
348
- reactIs_production_min.isSuspenseList = function (a) {
349
- return v(a) === n;
350
- };
351
- reactIs_production_min.isValidElementType = function (a) {
352
- return "string" === typeof a || "function" === typeof a || a === d || a === f || a === e || a === m || a === n || a === t || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || void 0 !== a.getModuleId) ? !0 : !1;
353
- };
354
- reactIs_production_min.typeOf = v;
355
- return reactIs_production_min;
356
- }
357
- if (process.env.NODE_ENV === 'production') {
358
- reactIs.exports = requireReactIs_production_min();
359
- } else {
360
- reactIs.exports = requireReactIs_development();
361
- }
362
- var reactIsExports = reactIs.exports;
363
- var ReactIs = /*@__PURE__*/getDefaultExportFromCjs(reactIsExports);
364
21
  const EMPTY_ARRAY = [];
365
22
  const EMPTY_RECORD = {};
23
+ const POPOVER_MOTION_CONTENT_OPACITY_PROPERTY = "--motion-content-opacity";
366
24
  const POPOVER_MOTION_PROPS = {
367
25
  initial: {
368
26
  opacity: 0.5,
369
- scale: 0.97
27
+ [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
28
+ scale: 0.97,
29
+ willChange: "transform"
370
30
  },
371
31
  animate: {
372
- opacity: 1,
32
+ opacity: [null, 1, 1],
33
+ [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [null, null, 1],
373
34
  scale: 1
374
35
  },
375
36
  exit: {
376
- opacity: 0,
37
+ // @ts-expect-error -- passing null a second time is valid: https://github.com/framer/motion/blob/b9ce4c42914c3916ea523609c5b032dfc72718bb/packages/framer-motion/src/animation/utils/keyframes.ts#L34C22-L34C22
38
+ opacity: [null, null, 0],
39
+ [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [null, 0, 0],
377
40
  scale: 0.97
378
41
  },
379
42
  transition: {
@@ -872,7 +535,7 @@ var gatherActiveObservationsAtDepth = function (depth) {
872
535
  });
873
536
  });
874
537
  };
875
- var process$1 = function () {
538
+ var process = function () {
876
539
  var depth = 0;
877
540
  gatherActiveObservationsAtDepth(depth);
878
541
  while (hasActiveObservations()) {
@@ -953,7 +616,7 @@ var Scheduler = function () {
953
616
  queueResizeObserver(function () {
954
617
  var elementsHaveResized = false;
955
618
  try {
956
- elementsHaveResized = process$1();
619
+ elementsHaveResized = process();
957
620
  } finally {
958
621
  scheduled = false;
959
622
  timeout = until - time();
@@ -1886,7 +1549,7 @@ function textInputRepresentationStyle(props) {
1886
1549
  color,
1887
1550
  input
1888
1551
  } = getTheme_v2(props.theme);
1889
- return css(_c$c || (_c$c = __template$F(["\n --input-box-shadow: none;\n\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: block;\n pointer-events: none;\n z-index: 0;\n\n background-color: var(--card-bg-color);\n box-shadow: var(--input-box-shadow);\n\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n\n &[data-scheme='", "'][data-tone='", "'] {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n /* enabled */\n *:not(:disabled) + &[data-border] {\n --input-box-shadow: ", ";\n }\n\n /* invalid */\n *:not(:disabled):invalid + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n /* focused */\n *:not(:disabled):focus + & {\n &[data-border] {\n --input-box-shadow: ", ";\n }\n\n &:not([data-border]) {\n --input-box-shadow: ", ";\n }\n }\n\n /* disabled */\n *:disabled + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n /* readOnly */\n *:read-only + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n }\n\n /* hovered */\n @media (hover: hover) {\n *:not(:disabled):not(:read-only):not(:invalid):hover + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n }\n\n *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n }\n "])), $hasPrefix ? 0 : void 0, $hasPrefix ? 0 : void 0, $hasSuffix ? 0 : void 0, $hasSuffix ? 0 : void 0, $scheme, $tone, color.input.default.enabled.bg, color.input.default.enabled.fg, focusRingBorderStyle({
1552
+ return css(_c$c || (_c$c = __template$F(["\n --input-box-shadow: none;\n\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: block;\n pointer-events: none;\n z-index: 0;\n\n background-color: var(--card-bg-color);\n box-shadow: var(--input-box-shadow);\n\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n\n &[data-scheme='", "'][data-tone='", "'] {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n /* enabled */\n *:not(:disabled) + &[data-border] {\n --input-box-shadow: ", ";\n }\n\n /* invalid */\n *:not(:disabled):invalid + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n /* focused */\n *:not(:disabled):focus + & {\n &[data-border] {\n --input-box-shadow: ", ";\n }\n\n &:not([data-border]) {\n --input-box-shadow: ", ";\n }\n }\n\n /* disabled */\n *:not(:invalid):disabled + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n --card-icon-color: ", " !important;\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n *:invalid:disabled + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n --card-icon-color: ", " !important;\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n /* readOnly */\n *:not(:invalid):read-only + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n }\n\n *:invalid:read-only + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n }\n\n /* hovered */\n @media (hover: hover) {\n *:not(:disabled):not(:read-only):not(:invalid):hover + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n }\n\n *:invalid:not(:disabled):not(:read-only):hover + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n }\n\n *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border] {\n --input-box-shadow: ", ";\n }\n\n *:invalid:not(:disabled):not(:read-only):not(:focus):hover + &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n }\n "])), $hasPrefix ? 0 : void 0, $hasPrefix ? 0 : void 0, $hasSuffix ? 0 : void 0, $hasSuffix ? 0 : void 0, $scheme, $tone, color.input.default.enabled.bg, color.input.default.enabled.fg, focusRingBorderStyle({
1890
1553
  color: color.input.default.enabled.border,
1891
1554
  width: input.border.width
1892
1555
  }), color.input.invalid.enabled.bg, color.input.invalid.enabled.fg, focusRingBorderStyle({
@@ -1900,12 +1563,18 @@ function textInputRepresentationStyle(props) {
1900
1563
  focusRing: input.text.focusRing
1901
1564
  }), $unstableDisableFocusRing ? void 0 : focusRingStyle({
1902
1565
  focusRing: input.text.focusRing
1903
- }), color.input.default.disabled.bg, color.input.default.disabled.fg, focusRingBorderStyle({
1566
+ }), color.input.default.disabled.bg, color.input.default.disabled.fg, color.input.default.disabled.fg, focusRingBorderStyle({
1904
1567
  color: color.input.default.disabled.border,
1905
1568
  width: input.border.width
1906
- }), color.input.default.readOnly.bg, color.input.default.readOnly.fg, color.input.default.hovered.bg, color.input.default.hovered.fg, focusRingBorderStyle({
1569
+ }), color.input.invalid.disabled.bg, color.input.invalid.disabled.fg, color.input.invalid.disabled.fg, focusRingBorderStyle({
1570
+ color: color.input.invalid.disabled.border,
1571
+ width: input.border.width
1572
+ }), color.input.default.readOnly.bg, color.input.default.readOnly.fg, color.input.invalid.readOnly.bg, color.input.invalid.readOnly.fg, color.input.default.hovered.bg, color.input.default.hovered.fg, color.input.invalid.hovered.bg, color.input.invalid.hovered.fg, focusRingBorderStyle({
1907
1573
  color: color.input.default.hovered.border,
1908
1574
  width: input.border.width
1575
+ }), focusRingBorderStyle({
1576
+ color: color.input.invalid.hovered.border,
1577
+ width: input.border.width
1909
1578
  }));
1910
1579
  }
1911
1580
  function responsiveMarginStyle(props) {
@@ -2343,7 +2012,7 @@ const AvatarCounter = forwardRef(function AvatarCounter2(props, ref) {
2343
2012
  });
2344
2013
  function childrenToElementArray(children) {
2345
2014
  const childrenArray = Array.isArray(children) ? children : [children];
2346
- return childrenArray.filter(node => reactIsExports.isElement(node) || reactIsExports.isFragment(node) || typeof node === "string");
2015
+ return childrenArray.filter(node => isElement$1(node) || isFragment(node) || typeof node === "string");
2347
2016
  }
2348
2017
  var __freeze$B = Object.freeze;
2349
2018
  var __defProp$C = Object.defineProperty;
@@ -2828,20 +2497,17 @@ const Button = forwardRef(function Button2(props, ref) {
2828
2497
  gap: space,
2829
2498
  children: [icon && /* @__PURE__ */jsxs(Text, {
2830
2499
  size: fontSize,
2831
- children: [isValidElement(icon) && icon, reactIsExports.isValidElementType(icon) && createElement(icon)]
2832
- }), text && /* @__PURE__ */jsx(Box, {
2833
- flex: iconRight ? 1 : void 0,
2834
- children: /* @__PURE__ */jsx(Text, {
2835
- muted,
2836
- align: textAlign,
2837
- size: fontSize,
2838
- textOverflow: "ellipsis",
2839
- weight: button.textWeight,
2840
- children: text
2841
- })
2500
+ children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
2501
+ }), text && /* @__PURE__ */jsx(Text, {
2502
+ muted,
2503
+ align: textAlign,
2504
+ size: fontSize,
2505
+ textOverflow: "ellipsis",
2506
+ weight: button.textWeight,
2507
+ children: text
2842
2508
  }), iconRight && /* @__PURE__ */jsxs(Text, {
2843
2509
  size: fontSize,
2844
- children: [isValidElement(iconRight) && iconRight, reactIsExports.isValidElementType(iconRight) && createElement(iconRight)]
2510
+ children: [isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && createElement(iconRight)]
2845
2511
  })]
2846
2512
  })
2847
2513
  }), children && /* @__PURE__ */jsx(Box, {
@@ -2913,7 +2579,7 @@ const Card = forwardRef(function Card2(props, ref) {
2913
2579
  tone: toneProp = "default",
2914
2580
  ...restProps
2915
2581
  } = props;
2916
- const as = reactIsExports.isValidElementType(asProp) ? asProp : "div";
2582
+ const as = isValidElementType(asProp) ? asProp : "div";
2917
2583
  const rootTheme = useRootTheme();
2918
2584
  const tone = toneProp === "inherit" ? rootTheme.tone : toneProp;
2919
2585
  return /* @__PURE__ */jsx(ThemeColorProvider, {
@@ -3265,7 +2931,7 @@ function headingBaseStyle(props) {
3265
2931
  const {
3266
2932
  font
3267
2933
  } = getTheme_v2(props.theme);
3268
- return css(_c$8 || (_c$8 = __template$s(["\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_a$s || (_a$s = __template$s(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_b$g || (_b$g = __template$s(["\n color: var(--card-muted-fg-color);\n "]))), font.code.family);
2934
+ return css(_c$8 || (_c$8 = __template$s(["\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & strong {\n font-weight: ", ";\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_a$s || (_a$s = __template$s(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_b$g || (_b$g = __template$s(["\n color: var(--card-muted-fg-color);\n "]))), font.code.family, font.heading.weights.bold);
3269
2935
  }
3270
2936
  var __freeze$r = Object.freeze;
3271
2937
  var __defProp$s = Object.defineProperty;
@@ -4282,7 +3948,7 @@ var __template$m = (cooked, raw) => __freeze$m(__defProp$m(cooked, "raw", {
4282
3948
  value: __freeze$m(raw || cooked.slice())
4283
3949
  }));
4284
3950
  var _a$m;
4285
- const MotionCard$1 = styled(motion(Card))(_a$m || (_a$m = __template$m(["\n &:not([hidden]) {\n display: flex;\n }\n flex-direction: column;\n width: max-content;\n min-width: min-content;\n"])));
3951
+ const MotionCard$1 = styled(motion(Card))(_a$m || (_a$m = __template$m(["\n &:not([hidden]) {\n display: flex;\n }\n flex-direction: column;\n width: max-content;\n min-width: min-content;\n & > * {\n opacity: var(", ", 1);\n will-change: opacity;\n }\n"])), POPOVER_MOTION_CONTENT_OPACITY_PROPERTY);
4286
3952
  const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
4287
3953
  const {
4288
3954
  __unstable_margins: marginsProp,
@@ -4322,8 +3988,9 @@ const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
4322
3988
  top: y,
4323
3989
  width,
4324
3990
  zIndex,
3991
+ willChange: animate ? "transform" : void 0,
4325
3992
  ...style
4326
- }), [originX, originY, strategy, style, width, x, y, zIndex]);
3993
+ }), [animate, originX, originY, strategy, style, width, x, y, zIndex]);
4327
3994
  const arrowStyle = useMemo(() => ({
4328
3995
  left: arrowX !== null ? arrowX : void 0,
4329
3996
  top: arrowY !== null ? arrowY : void 0,
@@ -4835,9 +4502,9 @@ function switchRepresentationStyles(props) {
4835
4502
  color,
4836
4503
  input
4837
4504
  } = getTheme_v2(props.theme);
4838
- return css(_c$5 || (_c$5 = __template$j(["\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ", ";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input[data-read-only]:disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n "])), color.input.default.enabled.border, color.input.default.enabled.bg, rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2), focusRingStyle({
4505
+ return css(_c$5 || (_c$5 = __template$j(["\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ", ";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input[data-read-only]:disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:checked[data-read-only]:disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n "])), color.input.default.enabled.border, color.input.default.enabled.bg, rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2), focusRingStyle({
4839
4506
  focusRing: input.switch.focusRing
4840
- }), color.input.default.enabled.fg, color.input.default.enabled.bg, color.input.default.hovered.border, color.input.default.hovered.bg, color.input.default.enabled.fg, color.input.default.enabled.bg, color.input.default.disabled.border, color.input.default.disabled.bg, color.input.default.readOnly.border, color.input.default.readOnly.bg);
4507
+ }), color.input.default.enabled.fg, color.input.default.enabled.bg, color.input.default.hovered.border, color.input.default.hovered.bg, color.input.default.enabled.fg, color.input.default.enabled.bg, color.input.default.disabled.border, color.input.default.disabled.bg, color.input.default.readOnly.border, color.input.default.readOnly.bg, color.input.default.readOnly.fg, color.input.default.readOnly.bg);
4841
4508
  }
4842
4509
  function switchTrackStyles(props) {
4843
4510
  const {
@@ -5052,13 +4719,13 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
5052
4719
  padding,
5053
4720
  children: /* @__PURE__ */jsxs(Text, {
5054
4721
  size: fontSize,
5055
- children: [isValidElement(icon) && icon, reactIsExports.isValidElementType(icon) && createElement(icon)]
4722
+ children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
5056
4723
  })
5057
4724
  }), !$hasClearButton && iconRight && /* @__PURE__ */jsx(RightBox, {
5058
4725
  padding,
5059
4726
  children: /* @__PURE__ */jsxs(Text, {
5060
4727
  size: fontSize,
5061
- children: [isValidElement(iconRight) && iconRight, reactIsExports.isValidElementType(iconRight) && createElement(iconRight)]
4728
+ children: [isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && createElement(iconRight)]
5062
4729
  })
5063
4730
  })]
5064
4731
  }), [__unstable_disableFocusRing, border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix]);
@@ -5170,7 +4837,7 @@ var __template$g = (cooked, raw) => __freeze$g(__defProp$g(cooked, "raw", {
5170
4837
  value: __freeze$g(raw || cooked.slice())
5171
4838
  }));
5172
4839
  var _a$g;
5173
- const MotionCard = styled(motion(Card))(_a$g || (_a$g = __template$g([""])));
4840
+ const MotionCard = styled(motion(Card))(_a$g || (_a$g = __template$g(["\n & > * {\n opacity: var(", ", 1);\n will-change: opacity;\n }\n"])), POPOVER_MOTION_CONTENT_OPACITY_PROPERTY);
5174
4841
  const TooltipCard = memo(forwardRef(function TooltipCard2(props, ref) {
5175
4842
  const {
5176
4843
  animate,
@@ -5192,8 +4859,9 @@ const TooltipCard = memo(forwardRef(function TooltipCard2(props, ref) {
5192
4859
  const rootStyle = useMemo(() => ({
5193
4860
  originX,
5194
4861
  originY,
4862
+ willChange: animate ? "transform" : void 0,
5195
4863
  ...style
5196
- }), [originX, originY, style]);
4864
+ }), [animate, originX, originY, style]);
5197
4865
  const arrowStyle = useMemo(() => ({
5198
4866
  left: arrowX !== null ? arrowX : void 0,
5199
4867
  top: arrowY !== null ? arrowY : void 0,
@@ -6151,7 +5819,7 @@ function responsiveDialogPositionStyle(props) {
6151
5819
  }));
6152
5820
  }
6153
5821
  function animationDialogStyle(props) {
6154
- if (!props.animate) return css(_a$c || (_a$c = __template$c([""])));
5822
+ if (!props.$animate) return css(_a$c || (_a$c = __template$c([""])));
6155
5823
  return css(_b$7 || (_b$7 = __template$c(["\n @keyframes zoomIn {\n from {\n opacity: 0;\n transform: scale(0.95);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n }\n @keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n animation: fadeIn 200ms ease-out;\n // Animates the dialog card.\n & > [data-ui='DialogCard'] {\n animation: zoomIn 200ms ease-out;\n }\n "])));
6156
5824
  }
6157
5825
  const key$3 = Symbol.for("@sanity/ui/context/dialog");
@@ -6374,6 +6042,7 @@ const Dialog = forwardRef(function Dialog2(props, ref) {
6374
6042
  __unstable_name: portalProp,
6375
6043
  children: /* @__PURE__ */jsxs(Root$7, {
6376
6044
  ...restProps,
6045
+ $animate: animate,
6377
6046
  $padding: padding,
6378
6047
  $position: position,
6379
6048
  "aria-labelledby": labelId,
@@ -6386,7 +6055,6 @@ const Dialog = forwardRef(function Dialog2(props, ref) {
6386
6055
  ref,
6387
6056
  role: "dialog",
6388
6057
  zOffset,
6389
- animate,
6390
6058
  children: [/* @__PURE__ */jsx("div", {
6391
6059
  ref: preDivRef,
6392
6060
  tabIndex: 0
@@ -6862,7 +6530,7 @@ const MenuButton = forwardRef(function MenuButton2(props, ref) {
6862
6530
  registerElement,
6863
6531
  shouldFocus
6864
6532
  }), [buttonElement, handleMenuClickOutside, handleMenuEscape, handleItemClick, id, handleBlur, registerElement, shouldFocus]);
6865
- const menu = reactIsExports.isElement(menuProp) ? cloneElement(menuProp, menuProps) : null;
6533
+ const menu = isElement$1(menuProp) ? cloneElement(menuProp, menuProps) : null;
6866
6534
  const setButtonRef = useCallback(el => {
6867
6535
  if (typeof ref === "function") {
6868
6536
  ref(el);
@@ -6871,7 +6539,7 @@ const MenuButton = forwardRef(function MenuButton2(props, ref) {
6871
6539
  }
6872
6540
  setButtonElement(el);
6873
6541
  }, [ref]);
6874
- const button = useMemo(() => reactIsExports.isElement(buttonProp) ? cloneElement(buttonProp, {
6542
+ const button = useMemo(() => isElement$1(buttonProp) ? cloneElement(buttonProp, {
6875
6543
  "data-ui": "MenuButton",
6876
6544
  id,
6877
6545
  onClick: handleButtonClick,
@@ -7058,7 +6726,7 @@ function MenuGroup(props) {
7058
6726
  padding,
7059
6727
  children: [icon && /* @__PURE__ */jsxs(Text, {
7060
6728
  size: fontSize,
7061
- children: [isValidElement(icon) && icon, reactIsExports.isValidElementType(icon) && createElement(icon)]
6729
+ children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
7062
6730
  }), /* @__PURE__ */jsx(Box, {
7063
6731
  flex: 1,
7064
6732
  children: /* @__PURE__ */jsx(Text, {
@@ -7161,7 +6829,7 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
7161
6829
  ...paddingProps,
7162
6830
  children: [icon && /* @__PURE__ */jsxs(Text, {
7163
6831
  size: fontSize,
7164
- children: [isValidElement(icon) && icon, reactIsExports.isValidElementType(icon) && createElement(icon)]
6832
+ children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
7165
6833
  }), text && /* @__PURE__ */jsx(Box, {
7166
6834
  flex: 1,
7167
6835
  children: /* @__PURE__ */jsx(Text, {
@@ -7179,7 +6847,7 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
7179
6847
  }
7180
6848
  }), iconRight && /* @__PURE__ */jsxs(Text, {
7181
6849
  size: fontSize,
7182
- children: [isValidElement(iconRight) && iconRight, reactIsExports.isValidElementType(iconRight) && createElement(iconRight)]
6850
+ children: [isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && createElement(iconRight)]
7183
6851
  })]
7184
6852
  }), children && /* @__PURE__ */jsx(Box, {
7185
6853
  as: "span",
@@ -7436,13 +7104,19 @@ const STATUS_CARD_TONE = {
7436
7104
  success: "positive",
7437
7105
  info: "primary"
7438
7106
  };
7107
+ const BUTTON_TONE = {
7108
+ error: "critical",
7109
+ warning: "caution",
7110
+ success: "positive",
7111
+ info: "primary"
7112
+ };
7439
7113
  const ROLES = {
7440
7114
  error: "alert",
7441
7115
  warning: "alert",
7442
7116
  success: "alert",
7443
7117
  info: "alert"
7444
7118
  };
7445
- const Root$2 = styled(Card)(_a$3 || (_a$3 = __template$3(["\n pointer-events: all;\n"])));
7119
+ const Root$2 = styled(Card)(_a$3 || (_a$3 = __template$3(["\n pointer-events: all;\n & > * {\n opacity: var(", ", 1);\n will-change: opacity;\n }\n"])), POPOVER_MOTION_CONTENT_OPACITY_PROPERTY);
7446
7120
  const TextBox = styled(Flex)(_b$2 || (_b$2 = __template$3(["\n overflow-x: auto;\n"])));
7447
7121
  function Toast(props) {
7448
7122
  const {
@@ -7455,6 +7129,7 @@ function Toast(props) {
7455
7129
  ...restProps
7456
7130
  } = props;
7457
7131
  const cardTone = status ? STATUS_CARD_TONE[status] : "default";
7132
+ const buttonTone = status ? BUTTON_TONE[status] : "default";
7458
7133
  const role = status ? ROLES[status] : "status";
7459
7134
  return /* @__PURE__ */jsx(Root$2, {
7460
7135
  "data-ui": "Toast",
@@ -7488,6 +7163,7 @@ function Toast(props) {
7488
7163
  icon: CloseIcon,
7489
7164
  mode: "bleed",
7490
7165
  padding: 2,
7166
+ tone: buttonTone,
7491
7167
  onClick: onClose,
7492
7168
  style: {
7493
7169
  verticalAlign: "top"
@@ -7597,12 +7273,14 @@ function ToastProvider(props) {
7597
7273
  } = _ref12;
7598
7274
  return /* @__PURE__ */jsx(motion.div, {
7599
7275
  animate: {
7600
- opacity: 1,
7276
+ opacity: [0, 1, 1],
7277
+ [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
7601
7278
  y: 0,
7602
7279
  scale: 1
7603
7280
  },
7604
7281
  exit: {
7605
- opacity: 0,
7282
+ opacity: [1, 1, 0],
7283
+ [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
7606
7284
  scale: 0.5,
7607
7285
  transition: {
7608
7286
  duration: 0.2
@@ -7610,8 +7288,10 @@ function ToastProvider(props) {
7610
7288
  },
7611
7289
  initial: {
7612
7290
  opacity: 0,
7291
+ [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
7613
7292
  y: 32,
7614
- scale: 0.25
7293
+ scale: 0.25,
7294
+ willChange: "transform"
7615
7295
  },
7616
7296
  layout: "position",
7617
7297
  transition: {