@sanity/ui 2.14.4-canary.0 → 2.14.4-canary.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.
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import { EMPTY_ARRAY, useElementSize, Code, isHTMLElement, isHTMLAnchorElement,
2
2
  import { Arrow, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Checkbox, ConditionalWrapper, ElementQuery, Heading, Hotkeys, Inline, KBD, Label, Menu, MenuDivider, MenuGroup, MenuItem, PortalProvider, Radio, Select, Spinner, SrOnly, Switch, Tab, TabList, TextArea, ThemeColorProvider, ThemeProvider, Tooltip, TooltipDelayGroupContext, TooltipDelayGroupProvider, VirtualList, _ResizeObserver, _elementSizeObserver, _fillCSSObject, _getArrayProp, _getResponsiveSpace, _isScrollable, createColorTheme, hexToRgb, hslToRgb, multiply, parseColor, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, screen, studioTheme, useCustomValidity, useMatchMedia, useMediaIndex, usePrefersDark, useRootTheme, useTheme, useTooltipDelayGroup } from "./_legacy/_visual-editing.esm.js";
3
3
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
4
4
  import { SpinnerIcon, ChevronDownIcon, CloseIcon, ToggleArrowRightIcon } from "@sanity/icons";
5
- import { useState, useRef, useEffect, useImperativeHandle, Component, forwardRef, useReducer, useCallback, useMemo, cloneElement, Children, isValidElement, Fragment, useContext, useSyncExternalStore, memo, useId } from "react";
5
+ import { useState, useRef, useEffect, useImperativeHandle, Component, forwardRef, useReducer, useCallback, useMemo, cloneElement, Children, isValidElement, Fragment, useContext, useSyncExternalStore, startTransition, memo, useId } from "react";
6
6
  import { styled, keyframes, css } from "styled-components";
7
7
  import { c } from "react-compiler-runtime";
8
8
  import { getTheme_v2 } from "@sanity/ui/theme";
@@ -1139,25 +1139,32 @@ function ToastProvider(props) {
1139
1139
  $[1] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {
1140
1140
  version: 0,
1141
1141
  push: (params) => {
1142
- const id = params.id || generateToastId(), duration = params.duration || 5e3, dismiss = () => {
1142
+ const id = params.id || generateToastId(), duration = params.duration || 5e3;
1143
+ return startTransition(() => {
1143
1144
  setState((prevState) => {
1144
- const idx = prevState.findIndex((t) => t.id === id);
1145
- if (idx > -1) {
1146
- const toasts = prevState.slice(0);
1147
- return toasts.splice(idx, 1), toasts;
1148
- }
1149
- return prevState;
1145
+ const dismiss = () => {
1146
+ startTransition(() => {
1147
+ setState((prevState_0) => {
1148
+ const idx = prevState_0.findIndex((t) => t.id === id);
1149
+ if (idx > -1) {
1150
+ const toasts = prevState_0.slice(0);
1151
+ return toasts.splice(idx, 1), toasts;
1152
+ }
1153
+ return prevState_0;
1154
+ });
1155
+ });
1156
+ };
1157
+ return prevState.filter((t_0) => t_0.id !== id).concat([{
1158
+ dismiss,
1159
+ id,
1160
+ updatedAt: Date.now(),
1161
+ params: {
1162
+ ...params,
1163
+ duration
1164
+ }
1165
+ }]);
1150
1166
  });
1151
- };
1152
- return setState((prevState_0) => prevState_0.filter((t_0) => t_0.id !== id).concat([{
1153
- dismiss,
1154
- id,
1155
- updatedAt: Date.now(),
1156
- params: {
1157
- ...params,
1158
- duration
1159
- }
1160
- }])), id;
1167
+ }), id;
1161
1168
  }
1162
1169
  }, $[1] = t3) : t3 = $[1], t2 = t3;
1163
1170
  const value = t2;