@sanity/ui 2.14.5 → 2.15.0
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/_chunks-cjs/_visual-editing.js +60 -42
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +60 -42
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_legacy/_visual-editing.esm.js +60 -42
- package/dist/_legacy/_visual-editing.esm.js.map +1 -1
- package/dist/index.d.mts +32 -6
- package/dist/index.d.ts +32 -6
- package/dist/index.esm.js +194 -180
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +192 -178
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +194 -180
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -17
- package/src/core/components/toast/styles.ts +64 -52
- package/src/core/components/toast/toast.tsx +123 -34
- package/src/core/components/toast/toastLayer.tsx +50 -0
- package/src/core/components/toast/toastProvider.tsx +56 -142
- package/src/core/components/toast/types.ts +6 -0
- package/src/core/constants.ts +42 -29
- package/src/core/primitives/popover/popoverCard.tsx +20 -8
- package/src/core/primitives/tooltip/tooltipCard.tsx +7 -6
package/dist/index.d.mts
CHANGED
|
@@ -2488,7 +2488,18 @@ export declare type ThemeShadow = ThemeShadow_2
|
|
|
2488
2488
|
* @public
|
|
2489
2489
|
*/
|
|
2490
2490
|
export declare function Toast(
|
|
2491
|
-
props: ToastProps &
|
|
2491
|
+
props: ToastProps &
|
|
2492
|
+
Omit<
|
|
2493
|
+
React.HTMLProps<HTMLDivElement>,
|
|
2494
|
+
| 'as'
|
|
2495
|
+
| 'height'
|
|
2496
|
+
| 'ref'
|
|
2497
|
+
| 'title'
|
|
2498
|
+
| 'onAnimationStart'
|
|
2499
|
+
| 'onDragStart'
|
|
2500
|
+
| 'onDragEnd'
|
|
2501
|
+
| 'onDrag'
|
|
2502
|
+
>,
|
|
2492
2503
|
): React.JSX.Element
|
|
2493
2504
|
|
|
2494
2505
|
export declare namespace Toast {
|
|
@@ -2500,9 +2511,26 @@ export declare namespace Toast {
|
|
|
2500
2511
|
*/
|
|
2501
2512
|
export declare interface ToastContextValue {
|
|
2502
2513
|
version: 0.0
|
|
2514
|
+
/**
|
|
2515
|
+
* Creates or updates a toast notification.
|
|
2516
|
+
* If a toast with the same ID already exists, it will be updated.
|
|
2517
|
+
* If an ID is not provided, a random one will be generated.
|
|
2518
|
+
* The returned ID can be used to programatically update a toast.
|
|
2519
|
+
*/
|
|
2503
2520
|
push: (params: ToastParams) => string
|
|
2504
2521
|
}
|
|
2505
2522
|
|
|
2523
|
+
/**
|
|
2524
|
+
* @public
|
|
2525
|
+
*/
|
|
2526
|
+
declare interface ToastLayerProps {
|
|
2527
|
+
children: React.ReactNode
|
|
2528
|
+
padding?: number | number[]
|
|
2529
|
+
paddingX?: number | number[]
|
|
2530
|
+
paddingY?: number | number[]
|
|
2531
|
+
gap?: number | number[]
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2506
2534
|
/**
|
|
2507
2535
|
* @public
|
|
2508
2536
|
*/
|
|
@@ -2522,11 +2550,12 @@ export declare interface ToastParams {
|
|
|
2522
2550
|
export declare interface ToastProps {
|
|
2523
2551
|
closable?: boolean
|
|
2524
2552
|
description?: React.ReactNode
|
|
2525
|
-
onClose
|
|
2553
|
+
onClose: () => void
|
|
2526
2554
|
radius?: number | number[]
|
|
2527
2555
|
title?: React.ReactNode
|
|
2528
2556
|
status?: 'error' | 'warning' | 'success' | 'info'
|
|
2529
2557
|
duration?: number
|
|
2558
|
+
updatedAt?: number
|
|
2530
2559
|
}
|
|
2531
2560
|
|
|
2532
2561
|
/**
|
|
@@ -2541,11 +2570,8 @@ export declare namespace ToastProvider {
|
|
|
2541
2570
|
/**
|
|
2542
2571
|
* @public
|
|
2543
2572
|
*/
|
|
2544
|
-
export declare interface ToastProviderProps {
|
|
2573
|
+
export declare interface ToastProviderProps extends Omit<ToastLayerProps, 'children'> {
|
|
2545
2574
|
children?: React.ReactNode
|
|
2546
|
-
padding?: number | number[]
|
|
2547
|
-
paddingX?: number | number[]
|
|
2548
|
-
paddingY?: number | number[]
|
|
2549
2575
|
zOffset?: number | number[]
|
|
2550
2576
|
}
|
|
2551
2577
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2488,7 +2488,18 @@ export declare type ThemeShadow = ThemeShadow_2
|
|
|
2488
2488
|
* @public
|
|
2489
2489
|
*/
|
|
2490
2490
|
export declare function Toast(
|
|
2491
|
-
props: ToastProps &
|
|
2491
|
+
props: ToastProps &
|
|
2492
|
+
Omit<
|
|
2493
|
+
React.HTMLProps<HTMLDivElement>,
|
|
2494
|
+
| 'as'
|
|
2495
|
+
| 'height'
|
|
2496
|
+
| 'ref'
|
|
2497
|
+
| 'title'
|
|
2498
|
+
| 'onAnimationStart'
|
|
2499
|
+
| 'onDragStart'
|
|
2500
|
+
| 'onDragEnd'
|
|
2501
|
+
| 'onDrag'
|
|
2502
|
+
>,
|
|
2492
2503
|
): React.JSX.Element
|
|
2493
2504
|
|
|
2494
2505
|
export declare namespace Toast {
|
|
@@ -2500,9 +2511,26 @@ export declare namespace Toast {
|
|
|
2500
2511
|
*/
|
|
2501
2512
|
export declare interface ToastContextValue {
|
|
2502
2513
|
version: 0.0
|
|
2514
|
+
/**
|
|
2515
|
+
* Creates or updates a toast notification.
|
|
2516
|
+
* If a toast with the same ID already exists, it will be updated.
|
|
2517
|
+
* If an ID is not provided, a random one will be generated.
|
|
2518
|
+
* The returned ID can be used to programatically update a toast.
|
|
2519
|
+
*/
|
|
2503
2520
|
push: (params: ToastParams) => string
|
|
2504
2521
|
}
|
|
2505
2522
|
|
|
2523
|
+
/**
|
|
2524
|
+
* @public
|
|
2525
|
+
*/
|
|
2526
|
+
declare interface ToastLayerProps {
|
|
2527
|
+
children: React.ReactNode
|
|
2528
|
+
padding?: number | number[]
|
|
2529
|
+
paddingX?: number | number[]
|
|
2530
|
+
paddingY?: number | number[]
|
|
2531
|
+
gap?: number | number[]
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2506
2534
|
/**
|
|
2507
2535
|
* @public
|
|
2508
2536
|
*/
|
|
@@ -2522,11 +2550,12 @@ export declare interface ToastParams {
|
|
|
2522
2550
|
export declare interface ToastProps {
|
|
2523
2551
|
closable?: boolean
|
|
2524
2552
|
description?: React.ReactNode
|
|
2525
|
-
onClose
|
|
2553
|
+
onClose: () => void
|
|
2526
2554
|
radius?: number | number[]
|
|
2527
2555
|
title?: React.ReactNode
|
|
2528
2556
|
status?: 'error' | 'warning' | 'success' | 'info'
|
|
2529
2557
|
duration?: number
|
|
2558
|
+
updatedAt?: number
|
|
2530
2559
|
}
|
|
2531
2560
|
|
|
2532
2561
|
/**
|
|
@@ -2541,11 +2570,8 @@ export declare namespace ToastProvider {
|
|
|
2541
2570
|
/**
|
|
2542
2571
|
* @public
|
|
2543
2572
|
*/
|
|
2544
|
-
export declare interface ToastProviderProps {
|
|
2573
|
+
export declare interface ToastProviderProps extends Omit<ToastLayerProps, 'children'> {
|
|
2545
2574
|
children?: React.ReactNode
|
|
2546
|
-
padding?: number | number[]
|
|
2547
|
-
paddingX?: number | number[]
|
|
2548
|
-
paddingY?: number | number[]
|
|
2549
2575
|
zOffset?: number | number[]
|
|
2550
2576
|
}
|
|
2551
2577
|
|
package/dist/index.esm.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { EMPTY_ARRAY, useElementSize, Code, isHTMLElement, isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, Box, _isEnterToClickElement, Card, Text, useArrayProp, EMPTY_RECORD, Button, Stack, Popover, TextInput, useClickOutsideEvent, _responsive, createGlobalScopedContext, Container, Flex, usePortal, useBoundaryElement, useLayer, useGlobalKeyDown, useTheme_v2, usePrefersReducedMotion, Portal, containsOrEqualsElement, Layer, responsivePaddingStyle, responsiveRadiusStyle,
|
|
2
|
-
import { Arrow, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Checkbox, ConditionalWrapper, ElementQuery,
|
|
1
|
+
import { EMPTY_ARRAY, useElementSize, Code, isHTMLElement, isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, Box, _isEnterToClickElement, Card, Text, useArrayProp, EMPTY_RECORD, Button, Stack, Popover, TextInput, useClickOutsideEvent, _responsive, createGlobalScopedContext, Container, Flex, usePortal, useBoundaryElement, useLayer, useGlobalKeyDown, useTheme_v2, usePrefersReducedMotion, Portal, containsOrEqualsElement, Layer, responsivePaddingStyle, responsiveRadiusStyle, Grid, LayerProvider, isRecord, _cardColorStyle, rem } from "./_legacy/_visual-editing.esm.js";
|
|
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
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";
|
|
9
|
+
import { motion, AnimatePresence } from "framer-motion";
|
|
9
10
|
import { getTheme_v2 as getTheme_v2$1 } from "./_legacy/getTheme_v2.esm.js";
|
|
10
|
-
import { AnimatePresence, motion } from "framer-motion";
|
|
11
11
|
function _getElements(element, elementsArg) {
|
|
12
12
|
const ret = [element];
|
|
13
13
|
for (const el of elementsArg)
|
|
@@ -390,7 +390,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
390
390
|
dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
|
|
391
391
|
}, [openButtonProps, dispatchOpen]), openButtonNode = useMemo(() => !disabled && !readOnly && openButton ? /* @__PURE__ */ jsx(Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsx(Button, { "aria-label": "Open", disabled: expanded, fontSize, icon: ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, [disabled, expanded, fontSize, handleOpenClick, openButton, openButtonBoxPadding, openButtonPadding, openButtonProps, readOnly]), inputValue = useMemo(() => query === null ? value !== null ? renderValue(value, currentOption) : "" : query, [currentOption, query, renderValue, value]), input = /* @__PURE__ */ jsx(TextInput, { ...restProps, "aria-activedescendant": activeItemId, "aria-autocomplete": "list", "aria-expanded": expanded, "aria-owns": listBoxId, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", border, clearButton, customValidity, disabled, fontSize, icon, iconRight: loading && AnimatedSpinnerIcon, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: inputElementRef, role: "combobox", spellCheck: !1, suffix: suffix || openButtonNode, value: inputValue }), handleListBoxKeyDown = useCallback((event_5) => {
|
|
392
392
|
event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
|
|
393
|
-
}, [listFocused]),
|
|
393
|
+
}, [listFocused]), content2 = useMemo(() => filteredOptions.length === 0 ? null : /* @__PURE__ */ jsx(ListBox, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: /* @__PURE__ */ jsx(Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", id: listBoxId, ref: listBoxElementRef, role: "listbox", space: 1, children: filteredOptions.map((option_0) => {
|
|
394
394
|
const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
|
|
395
395
|
return /* @__PURE__ */ jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: cloneElement(renderOption(option_0), {
|
|
396
396
|
disabled: loading,
|
|
@@ -398,12 +398,12 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
398
398
|
tabIndex: listFocused && active ? 0 : -1
|
|
399
399
|
}) }, option_0.value);
|
|
400
400
|
}) }) }), [activeValue, currentOption, filteredOptions, handleOptionSelect, handleListBoxKeyDown, id, listBox, listBoxId, listFocused, loading, renderOption]), results = useMemo(() => renderPopover ? renderPopover({
|
|
401
|
-
content,
|
|
401
|
+
content: content2,
|
|
402
402
|
hidden: !expanded,
|
|
403
403
|
inputElement: inputElementRef.current,
|
|
404
404
|
onMouseEnter: handlePopoverMouseEnter,
|
|
405
405
|
onMouseLeave: handlePopoverMouseLeave
|
|
406
|
-
}, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsx(Popover, { arrow: !1, constrainSize: !0, content, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius, ref: resultsPopoverElementRef, referenceElement: inputElementRef.current, ...popover }), [
|
|
406
|
+
}, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsx(Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius, ref: resultsPopoverElementRef, referenceElement: inputElementRef.current, ...popover }), [content2, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, popover, radius, renderPopover]);
|
|
407
407
|
return /* @__PURE__ */ jsxs(StyledAutocomplete, { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
|
|
408
408
|
input,
|
|
409
409
|
results
|
|
@@ -715,7 +715,7 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
715
715
|
}, t8 = [open], $[9] = open, $[10] = t7, $[11] = t8) : (t7 = $[10], t8 = $[11]), useEffect(t7, t8);
|
|
716
716
|
let t9;
|
|
717
717
|
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
|
|
718
|
-
setOpen(_temp$
|
|
718
|
+
setOpen(_temp$2), setShouldFocus(null);
|
|
719
719
|
}, $[12] = t9) : t9 = $[12];
|
|
720
720
|
const handleButtonClick = t9;
|
|
721
721
|
let t10;
|
|
@@ -817,7 +817,7 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
817
817
|
return $[57] !== menu || $[58] !== open || $[59] !== popoverProps || $[60] !== t25 ? (t26 = /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t25 }), $[57] = menu, $[58] = open, $[59] = popoverProps, $[60] = t25, $[61] = t26) : t26 = $[61], t26;
|
|
818
818
|
});
|
|
819
819
|
MenuButton.displayName = "ForwardRef(MenuButton)";
|
|
820
|
-
function _temp$
|
|
820
|
+
function _temp$2(v) {
|
|
821
821
|
return !v;
|
|
822
822
|
}
|
|
823
823
|
const keyframe = keyframes`
|
|
@@ -966,55 +966,7 @@ const TabPanel = forwardRef(function(props, ref) {
|
|
|
966
966
|
return $[3] !== flex || $[4] !== props.children || $[5] !== ref || $[6] !== restProps || $[7] !== t0 ? (t1 = /* @__PURE__ */ jsx(Box, { "data-ui": "TabPanel", ...restProps, flex, ref, role: "tabpanel", tabIndex: t0, children: props.children }), $[3] = flex, $[4] = props.children, $[5] = ref, $[6] = restProps, $[7] = t0, $[8] = t1) : t1 = $[8], t1;
|
|
967
967
|
});
|
|
968
968
|
TabPanel.displayName = "ForwardRef(TabPanel)";
|
|
969
|
-
const
|
|
970
|
-
displayName: "TextBox",
|
|
971
|
-
componentId: "sc-1rr7rxo-0"
|
|
972
|
-
})`overflow-x:auto;`, loadingAnimation = keyframes`
|
|
973
|
-
0% {
|
|
974
|
-
width: 0;
|
|
975
|
-
}
|
|
976
|
-
100% {
|
|
977
|
-
width: 100%;
|
|
978
|
-
}
|
|
979
|
-
`, LOADING_BAR_HEIGHT = 2;
|
|
980
|
-
function rootStyles(props) {
|
|
981
|
-
const {
|
|
982
|
-
color
|
|
983
|
-
} = getTheme_v2$1(props.theme), loadingBarColor = color.button.default[props.tone].enabled.bg;
|
|
984
|
-
return props.$duration ? css`
|
|
985
|
-
pointer-events: all;
|
|
986
|
-
width: 100%;
|
|
987
|
-
position: relative;
|
|
988
|
-
overflow: hidden;
|
|
989
|
-
overflow: clip;
|
|
990
|
-
padding-bottom: ${LOADING_BAR_HEIGHT}px;
|
|
991
|
-
&::before {
|
|
992
|
-
content: '';
|
|
993
|
-
position: absolute;
|
|
994
|
-
bottom: 0px;
|
|
995
|
-
height: ${LOADING_BAR_HEIGHT}px;
|
|
996
|
-
background: ${loadingBarColor};
|
|
997
|
-
animation-name: ${loadingAnimation};
|
|
998
|
-
animation-duration: ${props.$duration}ms;
|
|
999
|
-
animation-fill-mode: both;
|
|
1000
|
-
animation-timing-function: linear;
|
|
1001
|
-
opacity: var(${POPOVER_MOTION_CONTENT_OPACITY_PROPERTY}, 1);
|
|
1002
|
-
will-change: width;
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
& > * {
|
|
1006
|
-
opacity: var(${POPOVER_MOTION_CONTENT_OPACITY_PROPERTY}, 1);
|
|
1007
|
-
will-change: opacity;
|
|
1008
|
-
}
|
|
1009
|
-
` : css`
|
|
1010
|
-
pointer-events: all;
|
|
1011
|
-
& > * {
|
|
1012
|
-
opacity: var(${POPOVER_MOTION_CONTENT_OPACITY_PROPERTY}, 1);
|
|
1013
|
-
will-change: opacity;
|
|
1014
|
-
}
|
|
1015
|
-
`;
|
|
1016
|
-
}
|
|
1017
|
-
const STATUS_CARD_TONE = {
|
|
969
|
+
const LOADING_BAR_HEIGHT = 2, STATUS_CARD_TONE = {
|
|
1018
970
|
error: "critical",
|
|
1019
971
|
warning: "caution",
|
|
1020
972
|
success: "positive",
|
|
@@ -1024,18 +976,35 @@ const STATUS_CARD_TONE = {
|
|
|
1024
976
|
warning: "caution",
|
|
1025
977
|
success: "positive",
|
|
1026
978
|
info: "neutral"
|
|
1027
|
-
},
|
|
979
|
+
}, TextBox = styled(Flex).withConfig({
|
|
980
|
+
displayName: "TextBox",
|
|
981
|
+
componentId: "sc-1rr7rxo-0"
|
|
982
|
+
})`overflow-x:auto;`, StyledToast = styled(Card).withConfig({
|
|
983
|
+
displayName: "StyledToast",
|
|
984
|
+
componentId: "sc-1rr7rxo-1"
|
|
985
|
+
})`pointer-events:all;width:100%;position:relative;overflow:hidden;overflow:clip;&[data-has-duration]{padding-bottom:calc(${LOADING_BAR_HEIGHT}px / 2);}`, LoadingBar = styled.div.withConfig({
|
|
986
|
+
displayName: "LoadingBar",
|
|
987
|
+
componentId: "sc-1rr7rxo-2"
|
|
988
|
+
})`display:flex;position:absolute;bottom:0px;top:0px;left:0px;right:0px;pointer-events:none;z-index:-1;overflow:hidden;overflow:clip;background:transparent;align-items:flex-end;will-change:opacity;`, LoadingBarMask = styled(Card).withConfig({
|
|
989
|
+
displayName: "LoadingBarMask",
|
|
990
|
+
componentId: "sc-1rr7rxo-3"
|
|
991
|
+
})`position:absolute;top:0;left:-${LOADING_BAR_HEIGHT}px;right:-${LOADING_BAR_HEIGHT}px;bottom:${LOADING_BAR_HEIGHT}px;z-index:1;`, LoadingBarProgress = styled(Card).withConfig({
|
|
992
|
+
displayName: "LoadingBarProgress",
|
|
993
|
+
componentId: "sc-1rr7rxo-4"
|
|
994
|
+
})`display:block;height:100%;width:100%;transform-origin:0% 50%;background-color:${(props) => {
|
|
995
|
+
const {
|
|
996
|
+
color
|
|
997
|
+
} = getTheme_v2$1(props.theme);
|
|
998
|
+
return color.button.default[props.tone].enabled.bg;
|
|
999
|
+
}};`, ROLES = {
|
|
1028
1000
|
error: "alert",
|
|
1029
1001
|
warning: "alert",
|
|
1030
1002
|
success: "alert",
|
|
1031
1003
|
info: "alert"
|
|
1032
|
-
},
|
|
1033
|
-
displayName: "StyledToast",
|
|
1034
|
-
componentId: "sc-1icz8ea-0"
|
|
1035
|
-
})(rootStyles);
|
|
1004
|
+
}, LONG_ENOUGH_BUT_NOT_TOO_LONG = 1e3 * 60 * 60 * 24 * 24;
|
|
1036
1005
|
function Toast(props) {
|
|
1037
|
-
const $ = c(
|
|
1038
|
-
let closable, description, duration, onClose, restProps, status, t0, title;
|
|
1006
|
+
const $ = c(52);
|
|
1007
|
+
let closable, description, duration, onClose, restProps, status, t0, title, updatedAt;
|
|
1039
1008
|
$[0] !== props ? ({
|
|
1040
1009
|
closable,
|
|
1041
1010
|
description,
|
|
@@ -1044,151 +1013,196 @@ function Toast(props) {
|
|
|
1044
1013
|
radius: t0,
|
|
1045
1014
|
title,
|
|
1046
1015
|
status,
|
|
1016
|
+
updatedAt,
|
|
1047
1017
|
...restProps
|
|
1048
|
-
} = props, $[0] = props, $[1] = closable, $[2] = description, $[3] = duration, $[4] = onClose, $[5] = restProps, $[6] = status, $[7] = t0, $[8] = title) : (closable = $[1], description = $[2], duration = $[3], onClose = $[4], restProps = $[5], status = $[6], t0 = $[7], title = $[8]);
|
|
1049
|
-
const radius = t0 === void 0 ? 3 : t0, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status";
|
|
1018
|
+
} = props, $[0] = props, $[1] = closable, $[2] = description, $[3] = duration, $[4] = onClose, $[5] = restProps, $[6] = status, $[7] = t0, $[8] = title, $[9] = updatedAt) : (closable = $[1], description = $[2], duration = $[3], onClose = $[4], restProps = $[5], status = $[6], t0 = $[7], title = $[8], updatedAt = $[9]);
|
|
1019
|
+
const radius = t0 === void 0 ? 3 : t0, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status", visualDuration = usePrefersReducedMotion() ? 0 : 0.26;
|
|
1050
1020
|
let t1;
|
|
1051
|
-
$[
|
|
1021
|
+
$[10] !== visualDuration ? (t1 = visualDuration ? {
|
|
1022
|
+
type: "spring",
|
|
1023
|
+
visualDuration,
|
|
1024
|
+
bounce: 0.25
|
|
1025
|
+
} : {
|
|
1026
|
+
duration: 0
|
|
1027
|
+
}, $[10] = visualDuration, $[11] = t1) : t1 = $[11];
|
|
1028
|
+
const transition = t1;
|
|
1052
1029
|
let t2;
|
|
1053
|
-
$[
|
|
1030
|
+
$[12] !== duration ? (t2 = duration && isFinite(duration) && duration < LONG_ENOUGH_BUT_NOT_TOO_LONG, $[12] = duration, $[13] = t2) : t2 = $[13];
|
|
1031
|
+
const hasDuration = t2;
|
|
1054
1032
|
let t3;
|
|
1055
|
-
$[
|
|
1056
|
-
|
|
1057
|
-
t2
|
|
1058
|
-
] }) }), $[13] = t1, $[14] = t2, $[15] = t3) : t3 = $[15];
|
|
1033
|
+
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t3 = ["hidden", "initial"], $[14] = t3) : t3 = $[14];
|
|
1034
|
+
const initial = t3;
|
|
1059
1035
|
let t4;
|
|
1060
|
-
$[
|
|
1061
|
-
|
|
1062
|
-
} }) }), $[16] = buttonTone, $[17] = closable, $[18] = onClose, $[19] = t4) : t4 = $[19];
|
|
1036
|
+
$[15] === Symbol.for("react.memo_cache_sentinel") ? (t4 = ["visible", "slideIn"], $[15] = t4) : t4 = $[15];
|
|
1037
|
+
const animate = t4;
|
|
1063
1038
|
let t5;
|
|
1064
|
-
$[
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
let
|
|
1069
|
-
|
|
1039
|
+
$[16] === Symbol.for("react.memo_cache_sentinel") ? (t5 = ["hidden", "slideOut"], $[16] = t5) : t5 = $[16];
|
|
1040
|
+
const exit = t5, t6 = hasDuration ? "" : void 0;
|
|
1041
|
+
let t7;
|
|
1042
|
+
$[17] !== title ? (t7 = title && /* @__PURE__ */ jsx(Text, { size: 1, weight: "medium", children: title }), $[17] = title, $[18] = t7) : t7 = $[18];
|
|
1043
|
+
let t8;
|
|
1044
|
+
$[19] !== description || $[20] !== transition ? (t8 = description && /* @__PURE__ */ jsx(MotionText, { muted: !0, size: 1, variants: content, transition, children: description }), $[19] = description, $[20] = transition, $[21] = t8) : t8 = $[21];
|
|
1045
|
+
let t9;
|
|
1046
|
+
$[22] !== t7 || $[23] !== t8 ? (t9 = /* @__PURE__ */ jsx(TextBox, { flex: 1, padding: 3, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
1047
|
+
t7,
|
|
1048
|
+
t8
|
|
1049
|
+
] }) }), $[22] = t7, $[23] = t8, $[24] = t9) : t9 = $[24];
|
|
1050
|
+
let t10;
|
|
1051
|
+
$[25] !== buttonTone || $[26] !== closable || $[27] !== onClose ? (t10 = closable && /* @__PURE__ */ jsx(Box, { padding: 1, children: /* @__PURE__ */ jsx(Button, { as: "button", icon: CloseIcon, mode: "bleed", padding: 2, tone: buttonTone, onClick: onClose, style: {
|
|
1052
|
+
verticalAlign: "top"
|
|
1053
|
+
} }) }), $[25] = buttonTone, $[26] = closable, $[27] = onClose, $[28] = t10) : t10 = $[28];
|
|
1054
|
+
let t11;
|
|
1055
|
+
$[29] !== t10 || $[30] !== t9 || $[31] !== transition ? (t11 = /* @__PURE__ */ jsxs(MotionFlex, { align: "flex-start", variants: content, transition, children: [
|
|
1056
|
+
t9,
|
|
1057
|
+
t10
|
|
1058
|
+
] }), $[29] = t10, $[30] = t9, $[31] = transition, $[32] = t11) : t11 = $[32];
|
|
1059
|
+
let t12;
|
|
1060
|
+
$[33] !== cardTone || $[34] !== duration || $[35] !== hasDuration || $[36] !== onClose || $[37] !== radius || $[38] !== transition || $[39] !== updatedAt || $[40] !== visualDuration ? (t12 = hasDuration && /* @__PURE__ */ jsxs(MotionLoadingBar, { variants: content, transition, children: [
|
|
1061
|
+
/* @__PURE__ */ jsx(LoadingBarMask, { tone: cardTone, radius }),
|
|
1062
|
+
/* @__PURE__ */ jsx(MotionLoadingBarProgress, { tone: cardTone, initial: {
|
|
1063
|
+
scaleX: 0
|
|
1064
|
+
}, animate: {
|
|
1065
|
+
scaleX: 1
|
|
1066
|
+
}, transition: {
|
|
1067
|
+
delay: visualDuration,
|
|
1068
|
+
duration: duration / 1e3,
|
|
1069
|
+
ease: "linear"
|
|
1070
|
+
}, onAnimationComplete: onClose }, `progress-${updatedAt}`)
|
|
1071
|
+
] }), $[33] = cardTone, $[34] = duration, $[35] = hasDuration, $[36] = onClose, $[37] = radius, $[38] = transition, $[39] = updatedAt, $[40] = visualDuration, $[41] = t12) : t12 = $[41];
|
|
1072
|
+
let t13;
|
|
1073
|
+
return $[42] !== cardTone || $[43] !== radius || $[44] !== restProps || $[45] !== role || $[46] !== t11 || $[47] !== t12 || $[48] !== t6 || $[49] !== transition || $[50] !== visualDuration ? (t13 = /* @__PURE__ */ jsxs(MotionToast, { "data-ui": "Toast", role, ...restProps, "data-has-duration": t6, custom: visualDuration, radius, shadow: 2, tone: cardTone, forwardedAs: "li", layout: "position", variants: container, initial, animate, exit, transition, children: [
|
|
1074
|
+
t11,
|
|
1075
|
+
t12
|
|
1076
|
+
] }), $[42] = cardTone, $[43] = radius, $[44] = restProps, $[45] = role, $[46] = t11, $[47] = t12, $[48] = t6, $[49] = transition, $[50] = visualDuration, $[51] = t13) : t13 = $[51], t13;
|
|
1070
1077
|
}
|
|
1071
1078
|
Toast.displayName = "Toast";
|
|
1079
|
+
const container = {
|
|
1080
|
+
initial: {
|
|
1081
|
+
y: 32,
|
|
1082
|
+
scale: 0.5,
|
|
1083
|
+
zIndex: 1
|
|
1084
|
+
},
|
|
1085
|
+
hidden: {
|
|
1086
|
+
opacity: 0
|
|
1087
|
+
},
|
|
1088
|
+
visible: (visualDuration) => visualDuration ? {
|
|
1089
|
+
opacity: 1,
|
|
1090
|
+
transition: {
|
|
1091
|
+
when: "beforeChildren",
|
|
1092
|
+
staggerChildren: visualDuration / 3,
|
|
1093
|
+
duration: visualDuration / 3
|
|
1094
|
+
}
|
|
1095
|
+
} : {
|
|
1096
|
+
opacity: 1
|
|
1097
|
+
},
|
|
1098
|
+
slideIn: {
|
|
1099
|
+
y: 0,
|
|
1100
|
+
scale: 1
|
|
1101
|
+
},
|
|
1102
|
+
slideOut: {
|
|
1103
|
+
zIndex: 0,
|
|
1104
|
+
scale: 0.75
|
|
1105
|
+
}
|
|
1106
|
+
}, content = {
|
|
1107
|
+
initial: {
|
|
1108
|
+
willChange: "transform"
|
|
1109
|
+
},
|
|
1110
|
+
hidden: {
|
|
1111
|
+
opacity: 0
|
|
1112
|
+
},
|
|
1113
|
+
visible: {
|
|
1114
|
+
opacity: 1
|
|
1115
|
+
}
|
|
1116
|
+
}, MotionToast = motion.create(StyledToast), MotionFlex = motion.create(Flex), MotionText = motion.create(Text), MotionLoadingBar = motion.create(LoadingBar), MotionLoadingBarProgress = motion.create(LoadingBarProgress);
|
|
1072
1117
|
function useMounted() {
|
|
1073
|
-
return useSyncExternalStore(subscribe, _temp, _temp2);
|
|
1118
|
+
return useSyncExternalStore(subscribe, _temp$1, _temp2);
|
|
1074
1119
|
}
|
|
1075
1120
|
function _temp2() {
|
|
1076
1121
|
return !1;
|
|
1077
1122
|
}
|
|
1078
|
-
function _temp() {
|
|
1123
|
+
function _temp$1() {
|
|
1079
1124
|
return !0;
|
|
1080
1125
|
}
|
|
1081
1126
|
const subscribe = () => () => {
|
|
1082
1127
|
}, ToastContext = createGlobalScopedContext("@sanity/ui/context/toast", null);
|
|
1128
|
+
function ToastLayer(props) {
|
|
1129
|
+
const $ = c(9), {
|
|
1130
|
+
children,
|
|
1131
|
+
padding: t0,
|
|
1132
|
+
paddingX,
|
|
1133
|
+
paddingY,
|
|
1134
|
+
gap: t1
|
|
1135
|
+
} = props, padding = t0 === void 0 ? 4 : t0, gap = t1 === void 0 ? 3 : t1, {
|
|
1136
|
+
zIndex
|
|
1137
|
+
} = useLayer();
|
|
1138
|
+
let t2;
|
|
1139
|
+
$[0] !== zIndex ? (t2 = {
|
|
1140
|
+
zIndex
|
|
1141
|
+
}, $[0] = zIndex, $[1] = t2) : t2 = $[1];
|
|
1142
|
+
let t3;
|
|
1143
|
+
return $[2] !== children || $[3] !== gap || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== t2 ? (t3 = /* @__PURE__ */ jsx(StyledLayer, { forwardedAs: "ul", "data-ui": "ToastProvider", padding, paddingX, paddingY, gap, columns: 1, style: t2, children }), $[2] = children, $[3] = gap, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = t2, $[8] = t3) : t3 = $[8], t3;
|
|
1144
|
+
}
|
|
1145
|
+
ToastLayer.displayName = "ToastLayer";
|
|
1146
|
+
const StyledLayer = styled(Grid).withConfig({
|
|
1147
|
+
displayName: "StyledLayer",
|
|
1148
|
+
componentId: "sc-1tbwn58-0"
|
|
1149
|
+
})`box-sizing:border-box;position:fixed;right:0;bottom:0;list-style:none;pointer-events:none;max-width:420px;width:100%;`;
|
|
1083
1150
|
let toastId = 0;
|
|
1084
1151
|
function generateToastId() {
|
|
1085
1152
|
return String(toastId++);
|
|
1086
1153
|
}
|
|
1087
|
-
const StyledToastProvider = styled(Layer).withConfig({
|
|
1088
|
-
displayName: "StyledToastProvider",
|
|
1089
|
-
componentId: "sc-17mn6j-0"
|
|
1090
|
-
})`position:fixed;top:0;left:0;right:0;bottom:0;pointer-events:none;`, ToastContainer = styled.div.withConfig({
|
|
1091
|
-
displayName: "ToastContainer",
|
|
1092
|
-
componentId: "sc-17mn6j-1"
|
|
1093
|
-
})`box-sizing:border-box;position:absolute;right:0;bottom:0;max-width:420px;width:100%;`;
|
|
1094
1154
|
function ToastProvider(props) {
|
|
1095
|
-
const $ = c(
|
|
1155
|
+
const $ = c(13), {
|
|
1096
1156
|
children,
|
|
1097
|
-
padding
|
|
1157
|
+
padding,
|
|
1098
1158
|
paddingX,
|
|
1099
1159
|
paddingY,
|
|
1100
|
-
|
|
1101
|
-
|
|
1160
|
+
gap,
|
|
1161
|
+
zOffset: t0
|
|
1162
|
+
} = props, zOffset = t0 === void 0 ? 1 : t0;
|
|
1102
1163
|
let t1;
|
|
1103
1164
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
|
|
1104
|
-
const [state,
|
|
1105
|
-
let t2;
|
|
1106
|
-
$[1] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
1107
|
-
const toastsRef = useRef(t2), mounted = useMounted(), prefersReducedMotion = usePrefersReducedMotion();
|
|
1108
|
-
let t3, t4, t5, t6;
|
|
1109
|
-
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t4 = {
|
|
1110
|
-
opacity: 0,
|
|
1111
|
-
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: -1,
|
|
1112
|
-
y: 32,
|
|
1113
|
-
scale: 0.25,
|
|
1114
|
-
willChange: "transform"
|
|
1115
|
-
}, t5 = {
|
|
1116
|
-
opacity: 2,
|
|
1117
|
-
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 1,
|
|
1118
|
-
y: 0,
|
|
1119
|
-
scale: 1
|
|
1120
|
-
}, t6 = {
|
|
1121
|
-
opacity: 0,
|
|
1122
|
-
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: -1,
|
|
1123
|
-
scale: 0.5
|
|
1124
|
-
}, $[2] = t4, $[3] = t5, $[4] = t6) : (t4 = $[2], t5 = $[3], t6 = $[4]);
|
|
1125
|
-
const t7 = prefersReducedMotion ? 0 : 0.2;
|
|
1126
|
-
let t8;
|
|
1127
|
-
$[5] !== t7 ? (t8 = {
|
|
1128
|
-
initial: t4,
|
|
1129
|
-
animate: t5,
|
|
1130
|
-
exit: t6,
|
|
1131
|
-
transition: {
|
|
1132
|
-
duration: t7
|
|
1133
|
-
}
|
|
1134
|
-
}, $[5] = t7, $[6] = t8) : t8 = $[6], t3 = t8;
|
|
1135
|
-
const variants = t3;
|
|
1136
|
-
let t9, t10;
|
|
1137
|
-
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t10 = {
|
|
1165
|
+
const [state, setState] = useState(t1), mounted = useMounted();
|
|
1166
|
+
let t2, t3;
|
|
1167
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {
|
|
1138
1168
|
version: 0,
|
|
1139
1169
|
push: (params) => {
|
|
1140
|
-
const
|
|
1141
|
-
|
|
1170
|
+
const id = params.id || generateToastId(), duration = params.duration || 5e3;
|
|
1171
|
+
return startTransition(() => {
|
|
1142
1172
|
setState((prevState) => {
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
}
|
|
1158
|
-
}])), toastsRef.current[id] && (clearTimeout(toastsRef.current[id].timeoutId), delete toastsRef.current[id]), toastsRef.current[id] = {
|
|
1159
|
-
timeoutId: setTimeout(dismiss, duration)
|
|
1160
|
-
}, id;
|
|
1173
|
+
if (duration === 0.01)
|
|
1174
|
+
return prevState.filter((toast) => toast.id !== id);
|
|
1175
|
+
const dismiss = () => startTransition(() => setState((currentState) => currentState.filter((toast_0) => toast_0.id !== id)));
|
|
1176
|
+
return [...prevState.filter((toast_1) => toast_1.id !== id), {
|
|
1177
|
+
dismiss,
|
|
1178
|
+
id,
|
|
1179
|
+
updatedAt: Date.now(),
|
|
1180
|
+
params: {
|
|
1181
|
+
...params,
|
|
1182
|
+
duration
|
|
1183
|
+
}
|
|
1184
|
+
}];
|
|
1185
|
+
});
|
|
1186
|
+
}), id;
|
|
1161
1187
|
}
|
|
1162
|
-
}, $[
|
|
1163
|
-
const value =
|
|
1164
|
-
let
|
|
1165
|
-
$[8]
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
} of Object.values(toastsRef.current))
|
|
1169
|
-
clearTimeout(timeoutId_0);
|
|
1170
|
-
toastsRef.current = {};
|
|
1171
|
-
}, t12 = [], $[8] = t11, $[9] = t12) : (t11 = $[8], t12 = $[9]), useEffect(t11, t12);
|
|
1172
|
-
let t13;
|
|
1173
|
-
$[10] !== mounted || $[11] !== padding || $[12] !== paddingX || $[13] !== paddingY || $[14] !== prefersReducedMotion || $[15] !== state || $[16] !== variants || $[17] !== zOffset ? (t13 = mounted && /* @__PURE__ */ jsx(StyledToastProvider, { "data-ui": "ToastProvider", zOffset, children: /* @__PURE__ */ jsx(ToastContainer, { children: /* @__PURE__ */ jsx(Box, { padding, paddingX, paddingY, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, children: state.map((t142) => {
|
|
1174
|
-
const {
|
|
1175
|
-
dismiss: dismiss_0,
|
|
1176
|
-
id: id_0,
|
|
1177
|
-
params: params_0
|
|
1178
|
-
} = t142;
|
|
1179
|
-
return /* @__PURE__ */ jsx(motion.div, { layout: "position", initial: "initial", animate: "animate", exit: "exit", variants, transition: prefersReducedMotion ? {
|
|
1180
|
-
duration: 0
|
|
1181
|
-
} : {
|
|
1182
|
-
type: "spring",
|
|
1183
|
-
damping: 30,
|
|
1184
|
-
stiffness: 400
|
|
1185
|
-
}, children: /* @__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);
|
|
1186
|
-
}) }) }) }) }), $[10] = mounted, $[11] = padding, $[12] = paddingX, $[13] = paddingY, $[14] = prefersReducedMotion, $[15] = state, $[16] = variants, $[17] = zOffset, $[18] = t13) : t13 = $[18];
|
|
1187
|
-
let t14;
|
|
1188
|
-
return $[19] !== children || $[20] !== t13 ? (t14 = /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
|
|
1188
|
+
}, $[1] = t3) : t3 = $[1], t2 = t3;
|
|
1189
|
+
const value = t2;
|
|
1190
|
+
let t4;
|
|
1191
|
+
$[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t4 = mounted && /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, mode: "popLayout", children: state.map(_temp) }) }) }), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t4) : t4 = $[9];
|
|
1192
|
+
let t5;
|
|
1193
|
+
return $[10] !== children || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
|
|
1189
1194
|
children,
|
|
1190
|
-
|
|
1191
|
-
] }), $[
|
|
1195
|
+
t4
|
|
1196
|
+
] }), $[10] = children, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
|
|
1197
|
+
}
|
|
1198
|
+
function _temp(t0) {
|
|
1199
|
+
const {
|
|
1200
|
+
dismiss: dismiss_0,
|
|
1201
|
+
id: id_0,
|
|
1202
|
+
params: params_0,
|
|
1203
|
+
updatedAt
|
|
1204
|
+
} = t0;
|
|
1205
|
+
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, updatedAt }, id_0);
|
|
1192
1206
|
}
|
|
1193
1207
|
ToastProvider.displayName = "ToastProvider";
|
|
1194
1208
|
function useToast() {
|
|
@@ -1566,7 +1580,7 @@ const TreeGroup = memo(function(props) {
|
|
|
1566
1580
|
if (rootRef.current)
|
|
1567
1581
|
return registerItem(rootRef.current, itemPath.join("/"), expanded, selected);
|
|
1568
1582
|
}, [expanded, itemPath, registerItem, selected]);
|
|
1569
|
-
const
|
|
1583
|
+
const content2 = /* @__PURE__ */ jsxs(Flex, { padding, children: [
|
|
1570
1584
|
/* @__PURE__ */ jsxs(Box, { marginRight: space, style: {
|
|
1571
1585
|
visibility: IconComponent || children ? "visible" : "hidden",
|
|
1572
1586
|
pointerEvents: "none"
|
|
@@ -1579,10 +1593,10 @@ const TreeGroup = memo(function(props) {
|
|
|
1579
1593
|
/* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text }) })
|
|
1580
1594
|
] });
|
|
1581
1595
|
return href ? /* @__PURE__ */ jsxs(StyledTreeItem, { "data-selected": selected ? "" : void 0, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...restProps, onClick: handleClick, ref: rootRef, role: "none", children: [
|
|
1582
|
-
/* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, ref: treeitemRef, role: "treeitem", tabIndex, children:
|
|
1596
|
+
/* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, ref: treeitemRef, role: "treeitem", tabIndex, children: content2 }),
|
|
1583
1597
|
/* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsx(TreeGroup, { hidden: !expanded, children }) })
|
|
1584
1598
|
] }) : /* @__PURE__ */ jsxs(StyledTreeItem, { "data-selected": selected ? "" : void 0, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...restProps, "aria-expanded": expanded, onClick: handleClick, onKeyDown: handleKeyDown, ref: rootRef, role: "treeitem", tabIndex, children: [
|
|
1585
|
-
/* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, as: "div", "data-ui": "TreeItem__box", children:
|
|
1599
|
+
/* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, as: "div", "data-ui": "TreeItem__box", children: content2 }),
|
|
1586
1600
|
/* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsx(TreeGroup, { expanded, children }) })
|
|
1587
1601
|
] });
|
|
1588
1602
|
});
|