@sanity/ui 3.0.0-static.28 → 3.0.0-static.29
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/README.md +5 -8
- package/dist/_chunks-cjs/_visual-editing.cjs +66 -66
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +67 -67
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/{css.cjs → css/index.cjs} +47 -37
- package/dist/css/index.cjs.map +1 -0
- package/dist/css/index.css +1 -0
- package/dist/{css.d.cts → css/index.d.cts} +13 -3
- package/dist/{css.d.ts → css/index.d.ts} +13 -3
- package/dist/{css.js → css/index.js} +47 -37
- package/dist/css/index.js.map +1 -0
- package/dist/index.cjs +104 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -9
- package/dist/index.d.ts +28 -9
- package/dist/index.js +107 -51
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/core/components/autocomplete/autocomplete.tsx +3 -3
- package/src/core/components/toast/toast.tsx +13 -14
- package/src/core/components/toast/toastProvider.tsx +14 -10
- package/src/core/index.ts +1 -0
- package/src/core/primitives/root/Root.tsx +89 -0
- package/src/core/primitives/root/__workshop__/boundary.tsx +5 -0
- package/src/core/primitives/root/__workshop__/index.ts +8 -0
- package/src/core/primitives/root/index.ts +1 -0
- package/src/css/components/toast/toast.css.ts +1 -0
- package/src/css/defaultTheme.css.ts +55 -2
- package/src/css/index.ts +2 -0
- package/src/css/primitives/root/index.ts +2 -0
- package/src/css/primitives/root/root.css.ts +15 -0
- package/src/css/primitives/root/root.ts +17 -0
- package/src/css/primitives/root/types.ts +10 -0
- package/dist/css.cjs.map +0 -1
- package/dist/css.js.map +0 -1
- package/dist/index.css +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -76,6 +76,7 @@ import {RGB as RGB_2} from '@sanity/ui/theme'
|
|
|
76
76
|
import {rgba as rgba_2} from '@sanity/ui/theme'
|
|
77
77
|
import {rgbToHex as rgbToHex_2} from '@sanity/ui/theme'
|
|
78
78
|
import {rgbToHsl as rgbToHsl_2} from '@sanity/ui/theme'
|
|
79
|
+
import {RootStyleProps} from '@sanity/ui/css'
|
|
79
80
|
import {RootTheme as RootTheme_2} from '@sanity/ui/theme'
|
|
80
81
|
import {screen as screen_3} from '@sanity/ui/theme'
|
|
81
82
|
import {SelectableStyleProps} from '@sanity/ui/css'
|
|
@@ -916,6 +917,9 @@ export declare const DEFAULT_POPOVER_ELEMENT = 'div'
|
|
|
916
917
|
/** @public */
|
|
917
918
|
export declare const DEFAULT_RADIO_ELEMENT = 'input'
|
|
918
919
|
|
|
920
|
+
/** @public */
|
|
921
|
+
export declare const DEFAULT_ROOT_ELEMENT = 'html'
|
|
922
|
+
|
|
919
923
|
/** @public */
|
|
920
924
|
export declare const DEFAULT_SELECT_ELEMENT = 'select'
|
|
921
925
|
|
|
@@ -958,7 +962,7 @@ export declare const DEFAULT_TEXT_INPUT_ELEMENT = 'input'
|
|
|
958
962
|
/** @beta */
|
|
959
963
|
export declare const DEFAULT_TEXT_SKELETON_ELEMENT = 'div'
|
|
960
964
|
|
|
961
|
-
/** @
|
|
965
|
+
/** @internal */
|
|
962
966
|
export declare const DEFAULT_TOAST_ELEMENT = 'li'
|
|
963
967
|
|
|
964
968
|
/** @public */
|
|
@@ -2140,6 +2144,24 @@ export declare const rgbToHex: typeof rgbToHex_2
|
|
|
2140
2144
|
*/
|
|
2141
2145
|
export declare const rgbToHsl: typeof rgbToHsl_2
|
|
2142
2146
|
|
|
2147
|
+
/**
|
|
2148
|
+
* The `Root` component.
|
|
2149
|
+
*
|
|
2150
|
+
* @public
|
|
2151
|
+
*/
|
|
2152
|
+
export declare function Root<E extends RootElementType = typeof DEFAULT_ROOT_ELEMENT>(
|
|
2153
|
+
props: RootProps<E>,
|
|
2154
|
+
): JSX.Element
|
|
2155
|
+
|
|
2156
|
+
/** @public */
|
|
2157
|
+
export declare type RootElementType = 'html' | 'body' | 'div'
|
|
2158
|
+
|
|
2159
|
+
/** @public */
|
|
2160
|
+
export declare interface RootOwnProps extends BoxOwnProps, RootStyleProps {}
|
|
2161
|
+
|
|
2162
|
+
/** @public */
|
|
2163
|
+
export declare type RootProps<E extends RootElementType = RootElementType> = Props<RootOwnProps, E>
|
|
2164
|
+
|
|
2143
2165
|
/**
|
|
2144
2166
|
* @public
|
|
2145
2167
|
* @deprecated Use `RootTheme` from `@sanity/ui/theme` instead.
|
|
@@ -2720,9 +2742,9 @@ export declare type ThemeShadow = ThemeShadow_2
|
|
|
2720
2742
|
/**
|
|
2721
2743
|
* The `Toast` component gives feedback to users when an action has taken place.
|
|
2722
2744
|
*
|
|
2723
|
-
* Toasts can be closed with a close button, or auto-dismiss
|
|
2745
|
+
* Toasts can be closed with a close button, or auto-dismiss when the duration expires.
|
|
2724
2746
|
*
|
|
2725
|
-
* @
|
|
2747
|
+
* @internal
|
|
2726
2748
|
*/
|
|
2727
2749
|
export declare function Toast<E extends ToastElementType = typeof DEFAULT_TOAST_ELEMENT>(
|
|
2728
2750
|
props: ToastProps<E>,
|
|
@@ -2740,7 +2762,7 @@ export declare interface ToastContextValue {
|
|
|
2740
2762
|
push: (params: ToastParams) => string
|
|
2741
2763
|
}
|
|
2742
2764
|
|
|
2743
|
-
/** @
|
|
2765
|
+
/** @internal */
|
|
2744
2766
|
export declare type ToastElementType = 'li' | ComponentType
|
|
2745
2767
|
|
|
2746
2768
|
/** @internal */
|
|
@@ -2755,17 +2777,14 @@ declare type ToastLayerProps<E extends ToastLayerElementType = ToastLayerElement
|
|
|
2755
2777
|
E
|
|
2756
2778
|
>
|
|
2757
2779
|
|
|
2758
|
-
/** @
|
|
2780
|
+
/** @internal */
|
|
2759
2781
|
export declare type ToastOwnProps = RadiusStyleProps & {
|
|
2760
2782
|
closable?: boolean
|
|
2761
2783
|
description?: ReactNode
|
|
2762
2784
|
onClose?: () => void
|
|
2763
2785
|
title?: ReactNode
|
|
2764
2786
|
status?: 'error' | 'warning' | 'success' | 'info'
|
|
2765
|
-
/** @deprecated */
|
|
2766
2787
|
duration?: number
|
|
2767
|
-
/** @deprecated */
|
|
2768
|
-
updatedAt?: number
|
|
2769
2788
|
}
|
|
2770
2789
|
|
|
2771
2790
|
/** @public */
|
|
@@ -2779,7 +2798,7 @@ export declare interface ToastParams {
|
|
|
2779
2798
|
status?: 'error' | 'warning' | 'success' | 'info'
|
|
2780
2799
|
}
|
|
2781
2800
|
|
|
2782
|
-
/** @
|
|
2801
|
+
/** @internal */
|
|
2783
2802
|
export declare type ToastProps<E extends ToastElementType = ToastElementType> = Props<
|
|
2784
2803
|
ToastOwnProps,
|
|
2785
2804
|
E
|
package/dist/index.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ import {RGB as RGB_2} from '@sanity/ui/theme'
|
|
|
76
76
|
import {rgba as rgba_2} from '@sanity/ui/theme'
|
|
77
77
|
import {rgbToHex as rgbToHex_2} from '@sanity/ui/theme'
|
|
78
78
|
import {rgbToHsl as rgbToHsl_2} from '@sanity/ui/theme'
|
|
79
|
+
import {RootStyleProps} from '@sanity/ui/css'
|
|
79
80
|
import {RootTheme as RootTheme_2} from '@sanity/ui/theme'
|
|
80
81
|
import {screen as screen_3} from '@sanity/ui/theme'
|
|
81
82
|
import {SelectableStyleProps} from '@sanity/ui/css'
|
|
@@ -916,6 +917,9 @@ export declare const DEFAULT_POPOVER_ELEMENT = 'div'
|
|
|
916
917
|
/** @public */
|
|
917
918
|
export declare const DEFAULT_RADIO_ELEMENT = 'input'
|
|
918
919
|
|
|
920
|
+
/** @public */
|
|
921
|
+
export declare const DEFAULT_ROOT_ELEMENT = 'html'
|
|
922
|
+
|
|
919
923
|
/** @public */
|
|
920
924
|
export declare const DEFAULT_SELECT_ELEMENT = 'select'
|
|
921
925
|
|
|
@@ -958,7 +962,7 @@ export declare const DEFAULT_TEXT_INPUT_ELEMENT = 'input'
|
|
|
958
962
|
/** @beta */
|
|
959
963
|
export declare const DEFAULT_TEXT_SKELETON_ELEMENT = 'div'
|
|
960
964
|
|
|
961
|
-
/** @
|
|
965
|
+
/** @internal */
|
|
962
966
|
export declare const DEFAULT_TOAST_ELEMENT = 'li'
|
|
963
967
|
|
|
964
968
|
/** @public */
|
|
@@ -2140,6 +2144,24 @@ export declare const rgbToHex: typeof rgbToHex_2
|
|
|
2140
2144
|
*/
|
|
2141
2145
|
export declare const rgbToHsl: typeof rgbToHsl_2
|
|
2142
2146
|
|
|
2147
|
+
/**
|
|
2148
|
+
* The `Root` component.
|
|
2149
|
+
*
|
|
2150
|
+
* @public
|
|
2151
|
+
*/
|
|
2152
|
+
export declare function Root<E extends RootElementType = typeof DEFAULT_ROOT_ELEMENT>(
|
|
2153
|
+
props: RootProps<E>,
|
|
2154
|
+
): JSX.Element
|
|
2155
|
+
|
|
2156
|
+
/** @public */
|
|
2157
|
+
export declare type RootElementType = 'html' | 'body' | 'div'
|
|
2158
|
+
|
|
2159
|
+
/** @public */
|
|
2160
|
+
export declare interface RootOwnProps extends BoxOwnProps, RootStyleProps {}
|
|
2161
|
+
|
|
2162
|
+
/** @public */
|
|
2163
|
+
export declare type RootProps<E extends RootElementType = RootElementType> = Props<RootOwnProps, E>
|
|
2164
|
+
|
|
2143
2165
|
/**
|
|
2144
2166
|
* @public
|
|
2145
2167
|
* @deprecated Use `RootTheme` from `@sanity/ui/theme` instead.
|
|
@@ -2720,9 +2742,9 @@ export declare type ThemeShadow = ThemeShadow_2
|
|
|
2720
2742
|
/**
|
|
2721
2743
|
* The `Toast` component gives feedback to users when an action has taken place.
|
|
2722
2744
|
*
|
|
2723
|
-
* Toasts can be closed with a close button, or auto-dismiss
|
|
2745
|
+
* Toasts can be closed with a close button, or auto-dismiss when the duration expires.
|
|
2724
2746
|
*
|
|
2725
|
-
* @
|
|
2747
|
+
* @internal
|
|
2726
2748
|
*/
|
|
2727
2749
|
export declare function Toast<E extends ToastElementType = typeof DEFAULT_TOAST_ELEMENT>(
|
|
2728
2750
|
props: ToastProps<E>,
|
|
@@ -2740,7 +2762,7 @@ export declare interface ToastContextValue {
|
|
|
2740
2762
|
push: (params: ToastParams) => string
|
|
2741
2763
|
}
|
|
2742
2764
|
|
|
2743
|
-
/** @
|
|
2765
|
+
/** @internal */
|
|
2744
2766
|
export declare type ToastElementType = 'li' | ComponentType
|
|
2745
2767
|
|
|
2746
2768
|
/** @internal */
|
|
@@ -2755,17 +2777,14 @@ declare type ToastLayerProps<E extends ToastLayerElementType = ToastLayerElement
|
|
|
2755
2777
|
E
|
|
2756
2778
|
>
|
|
2757
2779
|
|
|
2758
|
-
/** @
|
|
2780
|
+
/** @internal */
|
|
2759
2781
|
export declare type ToastOwnProps = RadiusStyleProps & {
|
|
2760
2782
|
closable?: boolean
|
|
2761
2783
|
description?: ReactNode
|
|
2762
2784
|
onClose?: () => void
|
|
2763
2785
|
title?: ReactNode
|
|
2764
2786
|
status?: 'error' | 'warning' | 'success' | 'info'
|
|
2765
|
-
/** @deprecated */
|
|
2766
2787
|
duration?: number
|
|
2767
|
-
/** @deprecated */
|
|
2768
|
-
updatedAt?: number
|
|
2769
2788
|
}
|
|
2770
2789
|
|
|
2771
2790
|
/** @public */
|
|
@@ -2779,7 +2798,7 @@ export declare interface ToastParams {
|
|
|
2779
2798
|
status?: 'error' | 'warning' | 'success' | 'info'
|
|
2780
2799
|
}
|
|
2781
2800
|
|
|
2782
|
-
/** @
|
|
2801
|
+
/** @internal */
|
|
2783
2802
|
export declare type ToastProps<E extends ToastElementType = ToastElementType> = Props<
|
|
2784
2803
|
ToastOwnProps,
|
|
2785
2804
|
E
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { 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 } from "@sanity/ui/theme";
|
|
2
|
-
import { isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, isHTMLElement, BoundaryElementContext, _isEnterToClickElement,
|
|
3
|
-
import { Arrow,
|
|
2
|
+
import { isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, isHTMLElement, BoundaryElementContext, _isEnterToClickElement, Selectable, Text, useResponsiveProp, EMPTY_ARRAY, EMPTY_RECORD, Box, Button, Stack, Popover, TextInput, AnimatedSpinnerIcon, useClickOutsideEvent, Flex, containsOrEqualsElement, usePortal, useBoundaryElement, useLayer, useGlobalKeyDown, Card, createGlobalScopedContext, usePrefersReducedMotion, Portal, Z_OFFSETS, Layer, Grid, LayerProvider, isRecord, _getArrayProp, useCustomValidity, PortalProvider, CardProvider, useDelayedState, TooltipDelayGroupContext } from "./_chunks-es/_visual-editing.js";
|
|
3
|
+
import { Arrow, DEFAULT_ARROW_ELEMENT, DEFAULT_BOX_ELEMENT, DEFAULT_BUTTON_ELEMENT, DEFAULT_CARD_ELEMENT, DEFAULT_FLEX_ELEMENT, DEFAULT_GRID_ELEMENT, DEFAULT_HOTKEYS_ELEMENT, DEFAULT_KBD_ELEMENT, DEFAULT_LAYER_ELEMENT, DEFAULT_MENU_DIVIDER_ELEMENT, DEFAULT_MENU_ELEMENT, DEFAULT_MENU_GROUP_ELEMENT, DEFAULT_MENU_ITEM_ELEMENT, DEFAULT_POPOVER_ELEMENT, DEFAULT_SELECTABLE_ELEMENT, DEFAULT_SPINNER_ELEMENT, DEFAULT_STACK_ELEMENT, DEFAULT_TAB_ELEMENT, DEFAULT_TAB_LIST_ELEMENT, DEFAULT_TEXT_ELEMENT, DEFAULT_TEXT_INPUT_ELEMENT, DEFAULT_TOOLTIP_ELEMENT, Hotkeys, KBD, Menu, MenuDivider, MenuGroup, MenuItem, Spinner, Tab, TabList, ThemeColorProvider, ThemeProvider, Tooltip, _getResponsiveProp, useCard, useMatchMedia, useMediaIndex, usePrefersDark, useRootTheme, useTheme, useTheme_v2, useTooltipDelayGroup } from "./_chunks-es/_visual-editing.js";
|
|
4
4
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
5
5
|
import { ChevronDownIcon, CloseIcon, ToggleArrowRightIcon, CheckmarkIcon, RemoveIcon } from "@sanity/icons";
|
|
6
6
|
import { useReducer, useCallback, useRef, useImperativeHandle, useMemo, useEffect, cloneElement, useState, Children, isValidElement, Fragment, useContext, useSyncExternalStore, startTransition, memo, useId, lazy, Suspense, Component } from "react";
|
|
7
7
|
import { c } from "react/compiler-runtime";
|
|
8
|
-
import { breadcrumbs, container as container$1, dialogCard, dialogHeader, dialogContent, dialogScrollerShadowTop, dialogScroller, dialogScrollerShadowBottom, dialogFooter, dialog, dialogContainer, toast, toastLayer, treeItem, vars, label, textOverflow, avatar, avatarArrow, avatarInitials, avatarImage, avatarImageOutline, avatarCounter, avatarStack, badge, checkbox, checkboxInput, checkboxPresentation, code, heading, radio, radioInput, radioPresentation, select, _inputElement, selectPresentation, skeleton, codeSkeleton, headingSkeleton, labelSkeleton, textSkeleton, srOnly, _switch, _switchElement, _switchPresentation, _switchTrack, _switchThumb, textArea, _inputPresentation, BREAKPOINTS } from "@sanity/ui/css";
|
|
8
|
+
import { breadcrumbs, container as container$1, dialogCard, dialogHeader, dialogContent, dialogScrollerShadowTop, dialogScroller, dialogScrollerShadowBottom, dialogFooter, dialog, dialogContainer, toast, toastLayer, treeItem, vars, label, textOverflow, avatar, avatarArrow, avatarInitials, avatarImage, avatarImageOutline, avatarCounter, avatarStack, badge, checkbox, checkboxInput, checkboxPresentation, code, heading, radio, radioInput, radioPresentation, box, root, select, _inputElement, selectPresentation, skeleton, codeSkeleton, headingSkeleton, labelSkeleton, textSkeleton, srOnly, _switch, _switchElement, _switchPresentation, _switchTrack, _switchThumb, textArea, _inputPresentation, BREAKPOINTS } from "@sanity/ui/css";
|
|
9
9
|
import { px, rem } from "@sanity/ui/css";
|
|
10
10
|
import { motion, AnimatePresence } from "framer-motion";
|
|
11
11
|
import { ResizeObserver } from "@juggle/resize-observer";
|
|
@@ -185,7 +185,7 @@ function Autocomplete(props) {
|
|
|
185
185
|
value
|
|
186
186
|
} = state, defaultRenderOption = useCallback(({
|
|
187
187
|
value: value_0
|
|
188
|
-
}) => /* @__PURE__ */ jsx(
|
|
188
|
+
}) => /* @__PURE__ */ jsx(Selectable, { as: "button", padding: paddingProp, radius: 2, children: /* @__PURE__ */ jsx(Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 }) }), [fontSize, paddingProp]), renderOption = typeof renderOptionProp == "function" ? renderOptionProp : defaultRenderOption, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = useRef(null), resultsPopoverElementRef = useRef(null), inputElementRef = useRef(null), listBoxElementRef = useRef(null), listFocusedRef = useRef(!1), valueRef = useRef(value), valuePropRef = useRef(valueProp), popoverMouseWithinRef = useRef(!1);
|
|
189
189
|
useImperativeHandle(forwardedRef, () => inputElementRef.current);
|
|
190
190
|
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = useResponsiveProp(paddingProp), currentOption = useMemo(() => value !== null ? options.find((o) => o.value === value) : void 0, [options, value]), filteredOptions = useMemo(() => options.filter((option) => query ? filterOption(query, option) : !0), [filterOption, options, query]), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur = useCallback((event) => {
|
|
191
191
|
setTimeout(() => {
|
|
@@ -751,7 +751,7 @@ function TabPanel(props) {
|
|
|
751
751
|
let t3;
|
|
752
752
|
return $[5] !== as || $[6] !== children || $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsx(Box, { "data-ui": "TabPanel", ...rest, as, role: "tabpanel", tabIndex: t2, children }), $[5] = as, $[6] = children, $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
|
|
753
753
|
}
|
|
754
|
-
const DEFAULT_TOAST_ELEMENT = "li", ROLES = {
|
|
754
|
+
const DEFAULT_TOAST_ELEMENT = "li", LONG_ENOUGH_BUT_NOT_TOO_LONG = 1e3 * 60 * 60 * 24 * 24, ROLES = {
|
|
755
755
|
error: "alert",
|
|
756
756
|
warning: "alert",
|
|
757
757
|
success: "alert",
|
|
@@ -768,65 +768,61 @@ const DEFAULT_TOAST_ELEMENT = "li", ROLES = {
|
|
|
768
768
|
info: "neutral"
|
|
769
769
|
};
|
|
770
770
|
function Toast(props) {
|
|
771
|
-
const $ = c(
|
|
772
|
-
let closable, description, onClose, rest, status, t1, t2, title;
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
...t102
|
|
785
|
-
} = t0;
|
|
786
|
-
t1 = t32, closable = t42, description = t52, onClose = t62, t2 = t72, title = t82, status = t92, rest = t102, $[0] = t0, $[1] = closable, $[2] = description, $[3] = onClose, $[4] = rest, $[5] = status, $[6] = t1, $[7] = t2, $[8] = title;
|
|
787
|
-
} else
|
|
788
|
-
closable = $[1], description = $[2], onClose = $[3], rest = $[4], status = $[5], t1 = $[6], t2 = $[7], title = $[8];
|
|
771
|
+
const $ = c(42), t0 = props;
|
|
772
|
+
let closable, description, duration, onClose, rest, status, t1, t2, title;
|
|
773
|
+
$[0] !== t0 ? ({
|
|
774
|
+
as: t1,
|
|
775
|
+
closable,
|
|
776
|
+
description,
|
|
777
|
+
duration,
|
|
778
|
+
onClose,
|
|
779
|
+
radius: t2,
|
|
780
|
+
title,
|
|
781
|
+
status,
|
|
782
|
+
...rest
|
|
783
|
+
} = t0, $[0] = t0, $[1] = closable, $[2] = description, $[3] = duration, $[4] = onClose, $[5] = rest, $[6] = status, $[7] = t1, $[8] = t2, $[9] = title) : (closable = $[1], description = $[2], duration = $[3], onClose = $[4], rest = $[5], status = $[6], t1 = $[7], t2 = $[8], title = $[9]);
|
|
789
784
|
const as = t1 === void 0 ? DEFAULT_TOAST_ELEMENT : t1, radius = t2 === void 0 ? 3 : t2, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status", visualDuration = usePrefersReducedMotion() ? 0 : 0.26;
|
|
790
785
|
let t3;
|
|
791
|
-
$[
|
|
786
|
+
$[10] !== visualDuration ? (t3 = visualDuration ? {
|
|
792
787
|
type: "spring",
|
|
793
788
|
visualDuration,
|
|
794
789
|
bounce: 0.25
|
|
795
790
|
} : {
|
|
796
791
|
duration: 0
|
|
797
|
-
}, $[
|
|
798
|
-
const transition = t3;
|
|
792
|
+
}, $[10] = visualDuration, $[11] = t3) : t3 = $[11];
|
|
793
|
+
const transition = t3, hasDuration = duration && isFinite(duration) && duration < LONG_ENOUGH_BUT_NOT_TOO_LONG;
|
|
799
794
|
let t4;
|
|
800
|
-
$[
|
|
795
|
+
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t4 = ["hidden", "initial"], $[12] = t4) : t4 = $[12];
|
|
801
796
|
const initial = t4;
|
|
802
797
|
let t5;
|
|
803
|
-
$[
|
|
798
|
+
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t5 = ["visible", "slideIn"], $[13] = t5) : t5 = $[13];
|
|
804
799
|
const animate = t5;
|
|
805
800
|
let t6;
|
|
806
|
-
$[
|
|
801
|
+
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t6 = ["hidden", "slideOut"], $[14] = t6) : t6 = $[14];
|
|
807
802
|
const exit = t6;
|
|
808
803
|
let t7;
|
|
809
|
-
$[
|
|
810
|
-
|
|
811
|
-
$[15] !== title ? (t8 = title && /* @__PURE__ */ jsx(Text, { size: 1, weight: "medium", children: title }), $[15] = title, $[16] = t8) : t8 = $[16];
|
|
804
|
+
$[15] === Symbol.for("react.memo_cache_sentinel") ? (t7 = toast(), $[15] = t7) : t7 = $[15];
|
|
805
|
+
const t8 = hasDuration ? "" : void 0;
|
|
812
806
|
let t9;
|
|
813
|
-
$[
|
|
807
|
+
$[16] !== title ? (t9 = title && /* @__PURE__ */ jsx(Text, { size: 1, weight: "medium", children: title }), $[16] = title, $[17] = t9) : t9 = $[17];
|
|
814
808
|
let t10;
|
|
815
|
-
$[
|
|
816
|
-
t8,
|
|
817
|
-
t9
|
|
818
|
-
] }) }), $[20] = t8, $[21] = t9, $[22] = t10) : t10 = $[22];
|
|
809
|
+
$[18] !== description || $[19] !== transition ? (t10 = description && /* @__PURE__ */ jsx(MotionText, { muted: !0, size: 1, variants: content, transition, children: description }), $[18] = description, $[19] = transition, $[20] = t10) : t10 = $[20];
|
|
819
810
|
let t11;
|
|
820
|
-
$[
|
|
821
|
-
|
|
822
|
-
|
|
811
|
+
$[21] !== t10 || $[22] !== t9 ? (t11 = /* @__PURE__ */ jsx(Flex, { flex: 1, overflowX: "auto", padding: 3, children: /* @__PURE__ */ jsxs(Stack, { gap: 3, children: [
|
|
812
|
+
t9,
|
|
813
|
+
t10
|
|
814
|
+
] }) }), $[21] = t10, $[22] = t9, $[23] = t11) : t11 = $[23];
|
|
823
815
|
let t12;
|
|
824
|
-
$[
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
] }), $[27] = t10, $[28] = t11, $[29] = transition, $[30] = t12) : t12 = $[30];
|
|
816
|
+
$[24] !== buttonTone || $[25] !== closable || $[26] !== onClose ? (t12 = closable && /* @__PURE__ */ jsx(Box, { padding: 1, children: /* @__PURE__ */ jsx(Button, { as: "button", icon: CloseIcon, mode: "bleed", padding: 2, tone: buttonTone, onClick: onClose, style: {
|
|
817
|
+
verticalAlign: "top"
|
|
818
|
+
} }) }), $[24] = buttonTone, $[25] = closable, $[26] = onClose, $[27] = t12) : t12 = $[27];
|
|
828
819
|
let t13;
|
|
829
|
-
|
|
820
|
+
$[28] !== t11 || $[29] !== t12 || $[30] !== transition ? (t13 = /* @__PURE__ */ jsxs(MotionFlex, { align: "flex-start", variants: content, transition, children: [
|
|
821
|
+
t11,
|
|
822
|
+
t12
|
|
823
|
+
] }), $[28] = t11, $[29] = t12, $[30] = transition, $[31] = t13) : t13 = $[31];
|
|
824
|
+
let t14;
|
|
825
|
+
return $[32] !== as || $[33] !== cardTone || $[34] !== radius || $[35] !== rest || $[36] !== role || $[37] !== t13 || $[38] !== t8 || $[39] !== transition || $[40] !== visualDuration ? (t14 = /* @__PURE__ */ jsx(MotionCard, { as, className: t7, "data-ui": "Toast", role, ...rest, custom: visualDuration, "data-has-duration": t8, radius, shadow: 2, tone: cardTone, layout: "position", variants: container, initial, animate, exit, transition, position: "relative", children: t13 }), $[32] = as, $[33] = cardTone, $[34] = radius, $[35] = rest, $[36] = role, $[37] = t13, $[38] = t8, $[39] = transition, $[40] = visualDuration, $[41] = t14) : t14 = $[41], t14;
|
|
830
826
|
}
|
|
831
827
|
const container = {
|
|
832
828
|
initial: {
|
|
@@ -917,16 +913,19 @@ function ToastProvider(props) {
|
|
|
917
913
|
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {
|
|
918
914
|
version: 0,
|
|
919
915
|
push: (params) => {
|
|
920
|
-
const id = params.id
|
|
916
|
+
const id = params.id ?? generateToastId(), duration = params.duration ?? 5e3;
|
|
921
917
|
return startTransition(() => {
|
|
922
918
|
setState((prevState) => {
|
|
923
919
|
if (duration === 0.01)
|
|
924
920
|
return prevState.filter((toast2) => toast2.id !== id);
|
|
925
|
-
const dismiss = () =>
|
|
921
|
+
const dismiss = () => {
|
|
922
|
+
startTransition(() => {
|
|
923
|
+
timeoutId && clearTimeout(timeoutId), setState((currentState) => currentState.filter((toast_0) => toast_0.id !== id));
|
|
924
|
+
});
|
|
925
|
+
}, timeoutId = setTimeout(dismiss, duration);
|
|
926
926
|
return [...prevState.filter((toast_1) => toast_1.id !== id), {
|
|
927
927
|
dismiss,
|
|
928
928
|
id,
|
|
929
|
-
updatedAt: Date.now(),
|
|
930
929
|
params: {
|
|
931
930
|
...params,
|
|
932
931
|
duration
|
|
@@ -949,10 +948,9 @@ function _temp$2(t0) {
|
|
|
949
948
|
const {
|
|
950
949
|
dismiss: dismiss_0,
|
|
951
950
|
id: id_0,
|
|
952
|
-
params: params_0
|
|
953
|
-
updatedAt
|
|
951
|
+
params: params_0
|
|
954
952
|
} = t0;
|
|
955
|
-
return /* @__PURE__ */ jsx(Toast, { closable: params_0.closable, description: params_0.description, onClose: dismiss_0, status: params_0.status, title: params_0.title, duration: params_0.duration
|
|
953
|
+
return /* @__PURE__ */ jsx(Toast, { closable: params_0.closable, description: params_0.description, onClose: dismiss_0, status: params_0.status, title: params_0.title, duration: params_0.duration }, id_0);
|
|
956
954
|
}
|
|
957
955
|
function useToast() {
|
|
958
956
|
const value = useContext(ToastContext);
|
|
@@ -1872,6 +1870,62 @@ function Radio(props) {
|
|
|
1872
1870
|
t9
|
|
1873
1871
|
] }), $[21] = style, $[22] = t3, $[23] = t8, $[24] = t10) : t10 = $[24], t10;
|
|
1874
1872
|
}
|
|
1873
|
+
const DEFAULT_ROOT_ELEMENT = "html";
|
|
1874
|
+
function Root(props) {
|
|
1875
|
+
const $ = c(39), t0 = props;
|
|
1876
|
+
let children, className, forwardedRef, rest, t1, t2, t3, t4;
|
|
1877
|
+
$[0] !== t0 ? ({
|
|
1878
|
+
as: t1,
|
|
1879
|
+
children,
|
|
1880
|
+
className,
|
|
1881
|
+
height: t2,
|
|
1882
|
+
ref: forwardedRef,
|
|
1883
|
+
scheme: t3,
|
|
1884
|
+
tone: t4,
|
|
1885
|
+
...rest
|
|
1886
|
+
} = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = forwardedRef, $[4] = rest, $[5] = t1, $[6] = t2, $[7] = t3, $[8] = t4) : (children = $[1], className = $[2], forwardedRef = $[3], rest = $[4], t1 = $[5], t2 = $[6], t3 = $[7], t4 = $[8]);
|
|
1887
|
+
const as = t1 === void 0 ? DEFAULT_ROOT_ELEMENT : t1, height = t2 === void 0 ? "fill" : t2, scheme = t3 === void 0 ? "light" : t3, tone = t4 === void 0 ? "transparent" : t4, ref = useRef(null);
|
|
1888
|
+
let t5;
|
|
1889
|
+
$[9] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[9] = t5) : t5 = $[9], useImperativeHandle(forwardedRef, t5);
|
|
1890
|
+
const [portalElement, setPortalElement] = useState(null), [boundaryElement, setBoundaryElement] = useState(null);
|
|
1891
|
+
let t6;
|
|
1892
|
+
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t6 = (el) => {
|
|
1893
|
+
setBoundaryElement(el), ref.current = el;
|
|
1894
|
+
}, $[10] = t6) : t6 = $[10];
|
|
1895
|
+
const handleRef = t6;
|
|
1896
|
+
let t7;
|
|
1897
|
+
$[11] !== children || $[12] !== portalElement ? (t7 = /* @__PURE__ */ jsx(PortalProvider, { element: portalElement, children }), $[11] = children, $[12] = portalElement, $[13] = t7) : t7 = $[13];
|
|
1898
|
+
let t8;
|
|
1899
|
+
$[14] !== boundaryElement || $[15] !== t7 ? (t8 = /* @__PURE__ */ jsx(BoundaryElementProvider, { element: boundaryElement, children: t7 }), $[14] = boundaryElement, $[15] = t7, $[16] = t8) : t8 = $[16];
|
|
1900
|
+
let t9;
|
|
1901
|
+
$[17] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsx("div", { "data-portal": "", ref: setPortalElement }), $[17] = t9) : t9 = $[17];
|
|
1902
|
+
let t10;
|
|
1903
|
+
$[18] !== t8 ? (t10 = /* @__PURE__ */ jsxs(ToastProvider, { children: [
|
|
1904
|
+
t8,
|
|
1905
|
+
t9
|
|
1906
|
+
] }), $[18] = t8, $[19] = t10) : t10 = $[19];
|
|
1907
|
+
let t11;
|
|
1908
|
+
$[20] !== scheme || $[21] !== t10 || $[22] !== tone ? (t11 = /* @__PURE__ */ jsx(LayerProvider, { children: /* @__PURE__ */ jsx(CardProvider, { scheme, tone, children: t10 }) }), $[20] = scheme, $[21] = t10, $[22] = tone, $[23] = t11) : t11 = $[23];
|
|
1909
|
+
let node = t11;
|
|
1910
|
+
if (as === "html") {
|
|
1911
|
+
let t122;
|
|
1912
|
+
$[24] !== height ? (t122 = box({
|
|
1913
|
+
height,
|
|
1914
|
+
margin: 0
|
|
1915
|
+
}), $[24] = height, $[25] = t122) : t122 = $[25];
|
|
1916
|
+
let t132;
|
|
1917
|
+
$[26] !== node || $[27] !== t122 ? (t132 = /* @__PURE__ */ jsx("body", { className: t122, children: node }), $[26] = node, $[27] = t122, $[28] = t132) : t132 = $[28], node = t132;
|
|
1918
|
+
}
|
|
1919
|
+
let t12;
|
|
1920
|
+
$[29] !== className || $[30] !== height || $[31] !== scheme || $[32] !== tone ? (t12 = root({
|
|
1921
|
+
className,
|
|
1922
|
+
height,
|
|
1923
|
+
scheme,
|
|
1924
|
+
tone
|
|
1925
|
+
}), $[29] = className, $[30] = height, $[31] = scheme, $[32] = tone, $[33] = t12) : t12 = $[33];
|
|
1926
|
+
let t13;
|
|
1927
|
+
return $[34] !== as || $[35] !== node || $[36] !== rest || $[37] !== t12 ? (t13 = /* @__PURE__ */ jsx(Box, { as, "data-ui": "Root", ...rest, className: t12, ref: handleRef, children: node }), $[34] = as, $[35] = node, $[36] = rest, $[37] = t12, $[38] = t13) : t13 = $[38], t13;
|
|
1928
|
+
}
|
|
1875
1929
|
const DEFAULT_SELECT_ELEMENT = "select";
|
|
1876
1930
|
function Select(props) {
|
|
1877
1931
|
const $ = c(38), t0 = props;
|
|
@@ -2274,6 +2328,7 @@ export {
|
|
|
2274
2328
|
DEFAULT_MENU_ITEM_ELEMENT,
|
|
2275
2329
|
DEFAULT_POPOVER_ELEMENT,
|
|
2276
2330
|
DEFAULT_RADIO_ELEMENT,
|
|
2331
|
+
DEFAULT_ROOT_ELEMENT,
|
|
2277
2332
|
DEFAULT_SELECTABLE_ELEMENT,
|
|
2278
2333
|
DEFAULT_SELECT_ELEMENT,
|
|
2279
2334
|
DEFAULT_SKELETON_ELEMENT,
|
|
@@ -2318,6 +2373,7 @@ export {
|
|
|
2318
2373
|
Portal,
|
|
2319
2374
|
PortalProvider,
|
|
2320
2375
|
Radio,
|
|
2376
|
+
Root,
|
|
2321
2377
|
Select,
|
|
2322
2378
|
Selectable,
|
|
2323
2379
|
Skeleton,
|