@sanity/ui 1.7.11 → 1.8.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/index.cjs.mjs +3 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.esm.js +133 -49
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +134 -47
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
- package/src/hooks/useDelayed.test.ts +66 -0
- package/src/hooks/useDelayedState.ts +29 -0
- package/src/primitives/tooltip/__workshop__/props.tsx +86 -11
- package/src/primitives/tooltip/index.ts +1 -0
- package/src/primitives/tooltip/tooltip.test.tsx +278 -0
- package/src/primitives/tooltip/tooltip.tsx +81 -23
- package/src/primitives/tooltip/tooltipDelayGroup/index.ts +4 -0
- package/src/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +13 -0
- package/src/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +61 -0
- package/src/primitives/tooltip/tooltipDelayGroup/types.ts +11 -0
- package/src/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +12 -0
- package/src/primitives/types.ts +10 -0
package/dist/index.cjs.mjs
CHANGED
|
@@ -57,6 +57,8 @@ export const ThemeProvider = cjs.ThemeProvider;
|
|
|
57
57
|
export const Toast = cjs.Toast;
|
|
58
58
|
export const ToastProvider = cjs.ToastProvider;
|
|
59
59
|
export const Tooltip = cjs.Tooltip;
|
|
60
|
+
export const TooltipDelayGroupContext = cjs.TooltipDelayGroupContext;
|
|
61
|
+
export const TooltipDelayGroupProvider = cjs.TooltipDelayGroupProvider;
|
|
60
62
|
export const Tree = cjs.Tree;
|
|
61
63
|
export const TreeItem = cjs.TreeItem;
|
|
62
64
|
export const VirtualList = cjs.VirtualList;
|
|
@@ -115,5 +117,6 @@ export const usePrefersReducedMotion = cjs.usePrefersReducedMotion;
|
|
|
115
117
|
export const useRootTheme = cjs.useRootTheme;
|
|
116
118
|
export const useTheme = cjs.useTheme;
|
|
117
119
|
export const useToast = cjs.useToast;
|
|
120
|
+
export const useTooltipDelayGroup = cjs.useTooltipDelayGroup;
|
|
118
121
|
export const useTree = cjs.useTree;
|
|
119
122
|
|
package/dist/index.d.ts
CHANGED
|
@@ -627,6 +627,16 @@ export declare function createColorTheme(
|
|
|
627
627
|
/** @internal */
|
|
628
628
|
export declare type CSSObject = StyledObject<any>
|
|
629
629
|
|
|
630
|
+
/**
|
|
631
|
+
* @beta
|
|
632
|
+
*/
|
|
633
|
+
export declare type Delay =
|
|
634
|
+
| number
|
|
635
|
+
| Partial<{
|
|
636
|
+
open: number
|
|
637
|
+
close: number
|
|
638
|
+
}>
|
|
639
|
+
|
|
630
640
|
/**
|
|
631
641
|
* @public
|
|
632
642
|
*/
|
|
@@ -2990,6 +3000,47 @@ export declare const Tooltip: ForwardRefExoticComponent<
|
|
|
2990
3000
|
RefAttributes<HTMLDivElement>
|
|
2991
3001
|
>
|
|
2992
3002
|
|
|
3003
|
+
/**
|
|
3004
|
+
* @beta
|
|
3005
|
+
*/
|
|
3006
|
+
export declare const TooltipDelayGroupContext: React.Context<TooltipDelayGroupContextValue | null>
|
|
3007
|
+
|
|
3008
|
+
/**
|
|
3009
|
+
* @beta
|
|
3010
|
+
*/
|
|
3011
|
+
export declare interface TooltipDelayGroupContextValue {
|
|
3012
|
+
isGroupActive: boolean
|
|
3013
|
+
setIsGroupActive: (nextState: React.SetStateAction<boolean>, delay?: number | undefined) => void
|
|
3014
|
+
setOpenTooltipId: (nextId: string | null, delay?: number | undefined) => void
|
|
3015
|
+
openDelay: number
|
|
3016
|
+
closeDelay: number
|
|
3017
|
+
openTooltipId: string | null
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
/**
|
|
3021
|
+
* @public
|
|
3022
|
+
* Provides context for a group of tooltip elements that should share a delay
|
|
3023
|
+
* which temporarily becomes 1 ms after the first floating element of the group opens.
|
|
3024
|
+
*/
|
|
3025
|
+
export declare function TooltipDelayGroupProvider(
|
|
3026
|
+
props: TooltipDelayGroupProviderProps,
|
|
3027
|
+
): React.ReactElement
|
|
3028
|
+
|
|
3029
|
+
/**
|
|
3030
|
+
* @public
|
|
3031
|
+
* */
|
|
3032
|
+
export declare interface TooltipDelayGroupProviderProps {
|
|
3033
|
+
children?: React.ReactNode
|
|
3034
|
+
/**
|
|
3035
|
+
* @public Handles the delays to open or close a tooltip inside a group
|
|
3036
|
+
*
|
|
3037
|
+
* If only a `number` is passed, it will be used for both opening and closing.
|
|
3038
|
+
*
|
|
3039
|
+
* If an object `{open: number; close:number}` is passed, it can be used to set different delays for each action.
|
|
3040
|
+
*/
|
|
3041
|
+
delay: Delay
|
|
3042
|
+
}
|
|
3043
|
+
|
|
2993
3044
|
/**
|
|
2994
3045
|
* @public
|
|
2995
3046
|
*/
|
|
@@ -3006,6 +3057,14 @@ export declare interface TooltipProps extends Omit<LayerProps, 'as'> {
|
|
|
3006
3057
|
portal?: boolean | string
|
|
3007
3058
|
scheme?: ThemeColorSchemeKey
|
|
3008
3059
|
shadow?: number | number[]
|
|
3060
|
+
/**
|
|
3061
|
+
* @public Adds a delay to open or close the tooltip. Defaults to 0.
|
|
3062
|
+
*
|
|
3063
|
+
* If only a `number` is passed, it will be used for both opening and closing.
|
|
3064
|
+
*
|
|
3065
|
+
* If an object `{open: number; close:number}` is passed, it can be used to set different delays for each action.
|
|
3066
|
+
*/
|
|
3067
|
+
delay?: Delay
|
|
3009
3068
|
}
|
|
3010
3069
|
|
|
3011
3070
|
/**
|
|
@@ -3189,6 +3248,11 @@ export declare function useTheme(): Theme
|
|
|
3189
3248
|
*/
|
|
3190
3249
|
export declare function useToast(): ToastContextValue
|
|
3191
3250
|
|
|
3251
|
+
/**
|
|
3252
|
+
* @beta
|
|
3253
|
+
*/
|
|
3254
|
+
export declare function useTooltipDelayGroup(): TooltipDelayGroupContextValue | null
|
|
3255
|
+
|
|
3192
3256
|
/**
|
|
3193
3257
|
* @beta
|
|
3194
3258
|
*/
|
package/dist/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import styled, { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css,
|
|
|
5
5
|
import { white as white$1, black as black$1, hues } from '@sanity/color';
|
|
6
6
|
import { SpinnerIcon, CheckmarkIcon, RemoveIcon, SelectIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon } from '@sanity/icons';
|
|
7
7
|
import Refractor from 'react-refractor';
|
|
8
|
-
import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from '@floating-ui/react-dom';
|
|
8
|
+
import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate, size as size$2 } from '@floating-ui/react-dom';
|
|
9
9
|
import { createPortal } from 'react-dom';
|
|
10
10
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
11
11
|
const EMPTY_ARRAY = [];
|
|
@@ -3061,9 +3061,9 @@ function getGlobalScope() {
|
|
|
3061
3061
|
throw new Error("@sanity/ui: could not locate global scope");
|
|
3062
3062
|
}
|
|
3063
3063
|
const globalScope = getGlobalScope();
|
|
3064
|
-
const key$
|
|
3065
|
-
globalScope[key$
|
|
3066
|
-
const ThemeContext = globalScope[key$
|
|
3064
|
+
const key$8 = Symbol.for("@sanity/ui/context/theme");
|
|
3065
|
+
globalScope[key$8] = globalScope[key$8] || createContext(null);
|
|
3066
|
+
const ThemeContext = globalScope[key$8];
|
|
3067
3067
|
function ThemeProvider(props) {
|
|
3068
3068
|
const parentTheme = useContext(ThemeContext);
|
|
3069
3069
|
const {
|
|
@@ -5256,9 +5256,9 @@ const KBD = forwardRef(function KBD2(props, ref) {
|
|
|
5256
5256
|
})
|
|
5257
5257
|
});
|
|
5258
5258
|
});
|
|
5259
|
-
const key$
|
|
5260
|
-
globalScope[key$
|
|
5261
|
-
const BoundaryElementContext = globalScope[key$
|
|
5259
|
+
const key$7 = Symbol.for("@sanity/ui/context/boundaryElement");
|
|
5260
|
+
globalScope[key$7] = globalScope[key$7] || createContext(null);
|
|
5261
|
+
const BoundaryElementContext = globalScope[key$7];
|
|
5262
5262
|
function BoundaryElementProvider(props) {
|
|
5263
5263
|
const {
|
|
5264
5264
|
children,
|
|
@@ -5387,9 +5387,9 @@ function getLayerContext(contextValue) {
|
|
|
5387
5387
|
}
|
|
5388
5388
|
throw new Error("could not get layer context");
|
|
5389
5389
|
}
|
|
5390
|
-
const key$
|
|
5391
|
-
globalScope[key$
|
|
5392
|
-
const LayerContext = globalScope[key$
|
|
5390
|
+
const key$6 = Symbol.for("@sanity/ui/context/layer");
|
|
5391
|
+
globalScope[key$6] = globalScope[key$6] || createContext(null);
|
|
5392
|
+
const LayerContext = globalScope[key$6];
|
|
5393
5393
|
function useLayer() {
|
|
5394
5394
|
const value = useContext(LayerContext);
|
|
5395
5395
|
if (!value) {
|
|
@@ -5626,7 +5626,7 @@ const Layer = forwardRef(function Layer2(props, ref) {
|
|
|
5626
5626
|
})
|
|
5627
5627
|
});
|
|
5628
5628
|
});
|
|
5629
|
-
const key$
|
|
5629
|
+
const key$5 = Symbol.for("@sanity/ui/context/portal");
|
|
5630
5630
|
const elementKey = Symbol.for("@sanity/ui/context/portal/element");
|
|
5631
5631
|
globalScope[elementKey] = null;
|
|
5632
5632
|
const defaultContextValue = {
|
|
@@ -5645,8 +5645,8 @@ const defaultContextValue = {
|
|
|
5645
5645
|
return globalScope[elementKey];
|
|
5646
5646
|
}
|
|
5647
5647
|
};
|
|
5648
|
-
globalScope[key$
|
|
5649
|
-
const PortalContext = globalScope[key$
|
|
5648
|
+
globalScope[key$5] = globalScope[key$5] || createContext(defaultContextValue);
|
|
5649
|
+
const PortalContext = globalScope[key$5];
|
|
5650
5650
|
function usePortal() {
|
|
5651
5651
|
const value = useContext(PortalContext);
|
|
5652
5652
|
if (!value) {
|
|
@@ -6812,6 +6812,22 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
|
|
|
6812
6812
|
}), suffixNode]
|
|
6813
6813
|
});
|
|
6814
6814
|
});
|
|
6815
|
+
function useDelayedState(initialState) {
|
|
6816
|
+
const [state, setState] = useState(initialState);
|
|
6817
|
+
const delayedAction = useRef();
|
|
6818
|
+
const onStateChange = useCallback((nextState, delay) => {
|
|
6819
|
+
const action = () => {
|
|
6820
|
+
setState(nextState);
|
|
6821
|
+
};
|
|
6822
|
+
if (delayedAction.current) {
|
|
6823
|
+
clearTimeout(delayedAction.current);
|
|
6824
|
+
delayedAction.current = void 0;
|
|
6825
|
+
}
|
|
6826
|
+
if (!delay) return action();
|
|
6827
|
+
delayedAction.current = setTimeout(action, delay);
|
|
6828
|
+
}, []);
|
|
6829
|
+
return [state, onStateChange];
|
|
6830
|
+
}
|
|
6815
6831
|
var __freeze$f = Object.freeze;
|
|
6816
6832
|
var __defProp$f = Object.defineProperty;
|
|
6817
6833
|
var __template$f = (cooked, raw) => __freeze$f(__defProp$f(cooked, "raw", {
|
|
@@ -6841,6 +6857,40 @@ const TooltipArrow = forwardRef(function TooltipArrow2(props, ref) {
|
|
|
6841
6857
|
})
|
|
6842
6858
|
});
|
|
6843
6859
|
});
|
|
6860
|
+
const key$4 = Symbol.for("@sanity/ui/context/tooltipDelayGroup");
|
|
6861
|
+
globalScope[key$4] = globalScope[key$4] || createContext(null);
|
|
6862
|
+
const TooltipDelayGroupContext = globalScope[key$4];
|
|
6863
|
+
function useTooltipDelayGroup() {
|
|
6864
|
+
const value = useContext(TooltipDelayGroupContext);
|
|
6865
|
+
return value;
|
|
6866
|
+
}
|
|
6867
|
+
function TooltipDelayGroupProvider(props) {
|
|
6868
|
+
const {
|
|
6869
|
+
children,
|
|
6870
|
+
delay
|
|
6871
|
+
} = props;
|
|
6872
|
+
const [isGroupActive, setIsGroupActive] = useDelayedState(false);
|
|
6873
|
+
const [openTooltipId, setOpenTooltipId] = useDelayedState(null);
|
|
6874
|
+
const isInsideContext = useTooltipDelayGroup();
|
|
6875
|
+
if (isInsideContext) {
|
|
6876
|
+
throw new Error("TooltipDelayGroupProvider cannot be nested inside another TooltipDelayGroupProvider");
|
|
6877
|
+
}
|
|
6878
|
+
const openDelay = typeof delay === "number" ? delay : (delay == null ? void 0 : delay.open) || 0;
|
|
6879
|
+
const closeDelay = typeof delay === "number" ? delay : (delay == null ? void 0 : delay.close) || 0;
|
|
6880
|
+
const value = useMemo(() => ({
|
|
6881
|
+
isGroupActive,
|
|
6882
|
+
setIsGroupActive,
|
|
6883
|
+
openTooltipId,
|
|
6884
|
+
setOpenTooltipId,
|
|
6885
|
+
// When the group is active, we want the next tooltip to open immediately.
|
|
6886
|
+
openDelay: isGroupActive ? 1 : openDelay,
|
|
6887
|
+
closeDelay
|
|
6888
|
+
}), [closeDelay, isGroupActive, openDelay, openTooltipId, setIsGroupActive, setOpenTooltipId]);
|
|
6889
|
+
return /* @__PURE__ */jsx(TooltipDelayGroupContext.Provider, {
|
|
6890
|
+
value,
|
|
6891
|
+
children
|
|
6892
|
+
});
|
|
6893
|
+
}
|
|
6844
6894
|
var __freeze$e = Object.freeze;
|
|
6845
6895
|
var __defProp$e = Object.defineProperty;
|
|
6846
6896
|
var __template$e = (cooked, raw) => __freeze$e(__defProp$e(cooked, "raw", {
|
|
@@ -6864,6 +6914,7 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
6864
6914
|
scheme,
|
|
6865
6915
|
shadow = 2,
|
|
6866
6916
|
zOffset = (_a2 = theme.sanity.layer) == null ? void 0 : _a2.tooltip.zOffset,
|
|
6917
|
+
delay,
|
|
6867
6918
|
...restProps
|
|
6868
6919
|
} = props;
|
|
6869
6920
|
const fallbackPlacements = useArrayProp(fallbackPlacementsProp);
|
|
@@ -6877,11 +6928,28 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
6877
6928
|
boundary: boundaryElement || void 0,
|
|
6878
6929
|
fallbackPlacements,
|
|
6879
6930
|
padding: 4,
|
|
6880
|
-
rootBoundary
|
|
6931
|
+
rootBoundary,
|
|
6932
|
+
mainAxis: false
|
|
6881
6933
|
}));
|
|
6882
6934
|
ret.push(offset({
|
|
6883
6935
|
mainAxis: 3
|
|
6884
6936
|
}));
|
|
6937
|
+
ret.push(size$2({
|
|
6938
|
+
apply(_ref22) {
|
|
6939
|
+
let {
|
|
6940
|
+
availableWidth,
|
|
6941
|
+
availableHeight,
|
|
6942
|
+
elements
|
|
6943
|
+
} = _ref22;
|
|
6944
|
+
Object.assign(elements.floating.style, {
|
|
6945
|
+
maxWidth: "".concat(availableWidth - 4 * 2, "px"),
|
|
6946
|
+
// the padding is `4px`
|
|
6947
|
+
maxHeight: "".concat(availableHeight - 4 * 2, "px")
|
|
6948
|
+
// the padding is `4px`
|
|
6949
|
+
});
|
|
6950
|
+
}
|
|
6951
|
+
}));
|
|
6952
|
+
|
|
6885
6953
|
ret.push(shift({
|
|
6886
6954
|
boundary: boundaryElement || void 0,
|
|
6887
6955
|
rootBoundary,
|
|
@@ -6894,23 +6962,16 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
6894
6962
|
return ret;
|
|
6895
6963
|
}, [boundaryElement, fallbackPlacements]);
|
|
6896
6964
|
const {
|
|
6897
|
-
|
|
6898
|
-
y,
|
|
6965
|
+
floatingStyles,
|
|
6899
6966
|
placement,
|
|
6900
6967
|
middlewareData,
|
|
6901
6968
|
refs,
|
|
6902
|
-
update
|
|
6903
|
-
strategy
|
|
6969
|
+
update
|
|
6904
6970
|
} = useFloating({
|
|
6905
6971
|
middleware,
|
|
6906
6972
|
placement: placementProp,
|
|
6907
6973
|
whileElementsMounted: autoUpdate
|
|
6908
6974
|
});
|
|
6909
|
-
const rootStyle = useMemo(() => ({
|
|
6910
|
-
position: strategy,
|
|
6911
|
-
top: y != null ? y : 0,
|
|
6912
|
-
left: x != null ? x : 0
|
|
6913
|
-
}), [strategy, x, y]);
|
|
6914
6975
|
const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
|
|
6915
6976
|
const arrowX = (_b = middlewareData.arrow) == null ? void 0 : _b.x;
|
|
6916
6977
|
const arrowY = (_c = middlewareData.arrow) == null ? void 0 : _c.y;
|
|
@@ -6924,18 +6985,41 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
6924
6985
|
if (staticSide) style[staticSide] = -15;
|
|
6925
6986
|
return style;
|
|
6926
6987
|
}, [arrowX, arrowY, staticSide]);
|
|
6927
|
-
const
|
|
6928
|
-
const
|
|
6929
|
-
const
|
|
6930
|
-
const
|
|
6931
|
-
const
|
|
6988
|
+
const tooltipId = useId();
|
|
6989
|
+
const [isOpen, setIsOpen] = useDelayedState(false);
|
|
6990
|
+
const delayGroupContext = useTooltipDelayGroup();
|
|
6991
|
+
const showTooltip = isOpen || (delayGroupContext == null ? void 0 : delayGroupContext.openTooltipId) === tooltipId;
|
|
6992
|
+
const isInsideGroup = delayGroupContext !== null;
|
|
6993
|
+
const openDelayProp = typeof delay === "number" ? delay : (delay == null ? void 0 : delay.open) || 0;
|
|
6994
|
+
const closeDelayProp = typeof delay === "number" ? delay : (delay == null ? void 0 : delay.close) || 0;
|
|
6995
|
+
const openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp;
|
|
6996
|
+
const closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp;
|
|
6997
|
+
const handleIsOpenChange = useCallback(open => {
|
|
6998
|
+
if (isInsideGroup) {
|
|
6999
|
+
if (open) {
|
|
7000
|
+
delayGroupContext.setIsGroupActive(open, openDelay);
|
|
7001
|
+
delayGroupContext.setOpenTooltipId(tooltipId, openDelay);
|
|
7002
|
+
} else {
|
|
7003
|
+
const minimumGroupDeactivateDelay = 200;
|
|
7004
|
+
const groupDeactivateDelay = closeDelay > minimumGroupDeactivateDelay ? closeDelay : minimumGroupDeactivateDelay;
|
|
7005
|
+
delayGroupContext.setIsGroupActive(open, groupDeactivateDelay);
|
|
7006
|
+
delayGroupContext.setOpenTooltipId(null, closeDelay);
|
|
7007
|
+
}
|
|
7008
|
+
} else {
|
|
7009
|
+
setIsOpen(open, open ? openDelay : closeDelay);
|
|
7010
|
+
}
|
|
7011
|
+
}, [isInsideGroup, delayGroupContext, openDelay, tooltipId, closeDelay, setIsOpen]);
|
|
7012
|
+
const handleBlur = useCallback(() => handleIsOpenChange(false), [handleIsOpenChange]);
|
|
7013
|
+
const handleFocus = useCallback(() => handleIsOpenChange(true), [handleIsOpenChange]);
|
|
7014
|
+
const handleMouseEnter = useCallback(() => handleIsOpenChange(true), [handleIsOpenChange]);
|
|
7015
|
+
const handleMouseLeave = useCallback(() => handleIsOpenChange(false), [handleIsOpenChange]);
|
|
6932
7016
|
useEffect(() => {
|
|
6933
7017
|
if (!isOpen) return;
|
|
6934
7018
|
function handleWindowMouseMove(event) {
|
|
6935
7019
|
if (!referenceElement) return;
|
|
6936
7020
|
const isHoveringReference = referenceElement === event.target || event.target instanceof Node && referenceElement.contains(event.target);
|
|
6937
7021
|
if (!isHoveringReference) {
|
|
6938
|
-
|
|
7022
|
+
handleIsOpenChange(false);
|
|
6939
7023
|
window.removeEventListener("mousemove", handleWindowMouseMove);
|
|
6940
7024
|
}
|
|
6941
7025
|
}
|
|
@@ -6943,13 +7027,13 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
6943
7027
|
return () => {
|
|
6944
7028
|
window.removeEventListener("mousemove", handleWindowMouseMove);
|
|
6945
7029
|
};
|
|
6946
|
-
}, [isOpen, referenceElement]);
|
|
7030
|
+
}, [isOpen, referenceElement, handleIsOpenChange]);
|
|
6947
7031
|
useEffect(() => {
|
|
6948
|
-
if (disabled)
|
|
6949
|
-
}, [disabled]);
|
|
7032
|
+
if (disabled) handleIsOpenChange(false);
|
|
7033
|
+
}, [disabled, handleIsOpenChange]);
|
|
6950
7034
|
useEffect(() => {
|
|
6951
|
-
if (!content)
|
|
6952
|
-
}, [content]);
|
|
7035
|
+
if (!content) handleIsOpenChange(false);
|
|
7036
|
+
}, [content, handleIsOpenChange]);
|
|
6953
7037
|
useEffect(() => refs.setReference(referenceElement), [referenceElement, refs]);
|
|
6954
7038
|
const setArrow = useCallback(arrowEl => {
|
|
6955
7039
|
arrowRef.current = arrowEl;
|
|
@@ -6984,7 +7068,7 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
6984
7068
|
"data-ui": "Tooltip",
|
|
6985
7069
|
...restProps,
|
|
6986
7070
|
ref: setFloating,
|
|
6987
|
-
style:
|
|
7071
|
+
style: floatingStyles,
|
|
6988
7072
|
zOffset,
|
|
6989
7073
|
children: /* @__PURE__ */jsxs(Card, {
|
|
6990
7074
|
"data-ui": "Tooltip__card",
|
|
@@ -7000,7 +7084,7 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
7000
7084
|
})
|
|
7001
7085
|
});
|
|
7002
7086
|
return /* @__PURE__ */jsxs(Fragment, {
|
|
7003
|
-
children: [child,
|
|
7087
|
+
children: [child, showTooltip && /* @__PURE__ */jsx(Fragment, {
|
|
7004
7088
|
children: portal ? /* @__PURE__ */jsx(Portal, {
|
|
7005
7089
|
__unstable_name: typeof portal === "string" ? portal : void 0,
|
|
7006
7090
|
children: root
|
|
@@ -7162,10 +7246,10 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
|
|
|
7162
7246
|
query,
|
|
7163
7247
|
value
|
|
7164
7248
|
} = state;
|
|
7165
|
-
const defaultRenderOption = useCallback(
|
|
7249
|
+
const defaultRenderOption = useCallback(_ref23 => {
|
|
7166
7250
|
let {
|
|
7167
7251
|
value: value2
|
|
7168
|
-
} =
|
|
7252
|
+
} = _ref23;
|
|
7169
7253
|
return /* @__PURE__ */jsx(Card, {
|
|
7170
7254
|
"data-as": "button",
|
|
7171
7255
|
padding: paddingProp,
|
|
@@ -7618,10 +7702,10 @@ const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
|
|
|
7618
7702
|
}, itemIndex))
|
|
7619
7703
|
});
|
|
7620
7704
|
});
|
|
7621
|
-
function dialogStyle(
|
|
7705
|
+
function dialogStyle(_ref24) {
|
|
7622
7706
|
let {
|
|
7623
7707
|
theme
|
|
7624
|
-
} =
|
|
7708
|
+
} = _ref24;
|
|
7625
7709
|
const color = theme.sanity.color.base;
|
|
7626
7710
|
return {
|
|
7627
7711
|
"&:not([hidden])": {
|
|
@@ -8683,15 +8767,15 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
|
|
|
8683
8767
|
var _a$6, _b$3, _c$1, _d;
|
|
8684
8768
|
const keyframe = keyframes(_a$6 || (_a$6 = __template$6(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
|
|
8685
8769
|
const animation = css(_b$3 || (_b$3 = __template$6(["\n background-image: linear-gradient(\n to right,\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-to),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from)\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ", ";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])), keyframe);
|
|
8686
|
-
const skeletonStyle = css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])),
|
|
8770
|
+
const skeletonStyle = css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref25 => {
|
|
8687
8771
|
let {
|
|
8688
8772
|
$visible
|
|
8689
|
-
} =
|
|
8773
|
+
} = _ref25;
|
|
8690
8774
|
return $visible ? 1 : 0;
|
|
8691
|
-
},
|
|
8775
|
+
}, _ref26 => {
|
|
8692
8776
|
let {
|
|
8693
8777
|
$animated
|
|
8694
|
-
} =
|
|
8778
|
+
} = _ref26;
|
|
8695
8779
|
return $animated ? animation : css(_c$1 || (_c$1 = __template$6(["\n background-color: var(--card-skeleton-color-from);\n "])));
|
|
8696
8780
|
});
|
|
8697
8781
|
const Root$4 = styled(Box)(responsiveRadiusStyle, skeletonStyle);
|
|
@@ -8722,12 +8806,12 @@ const Skeleton = forwardRef(function Skeleton2(props, ref) {
|
|
|
8722
8806
|
ref
|
|
8723
8807
|
});
|
|
8724
8808
|
});
|
|
8725
|
-
const Root$3 = styled(Skeleton)(
|
|
8809
|
+
const Root$3 = styled(Skeleton)(_ref27 => {
|
|
8726
8810
|
let {
|
|
8727
8811
|
$size,
|
|
8728
8812
|
$style,
|
|
8729
8813
|
theme
|
|
8730
|
-
} =
|
|
8814
|
+
} = _ref27;
|
|
8731
8815
|
const {
|
|
8732
8816
|
media
|
|
8733
8817
|
} = theme.sanity;
|
|
@@ -9074,12 +9158,12 @@ function ToastProvider(props) {
|
|
|
9074
9158
|
paddingY,
|
|
9075
9159
|
children: /* @__PURE__ */jsx(AnimatePresence, {
|
|
9076
9160
|
initial: false,
|
|
9077
|
-
children: state.map(
|
|
9161
|
+
children: state.map(_ref28 => {
|
|
9078
9162
|
let {
|
|
9079
9163
|
dismiss,
|
|
9080
9164
|
id,
|
|
9081
9165
|
params
|
|
9082
|
-
} =
|
|
9166
|
+
} = _ref28;
|
|
9083
9167
|
return /* @__PURE__ */jsx(motion.div, {
|
|
9084
9168
|
animate: {
|
|
9085
9169
|
opacity: 1,
|
|
@@ -9579,5 +9663,5 @@ const TreeItem = memo(function TreeItem2(props) {
|
|
|
9579
9663
|
})]
|
|
9580
9664
|
});
|
|
9581
9665
|
});
|
|
9582
|
-
export { Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, Card, Checkbox, Code, CodeSkeleton, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Radio, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Toast, ToastProvider, Tooltip, Tree, TreeItem, VirtualList, _ResizeObserver, _elementSizeObserver, _fillCSSObject, _getArrayProp, _getResponsiveSpace, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, _responsive, attemptFocus, containsOrEqualsElement, createColorTheme, focusFirstDescendant, focusLastDescendant, hexToRgb, hslToRgb, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply$1 as multiply, parseColor, rem, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, screen$1 as screen, studioTheme, useArrayProp, useBoundaryElement, useClickOutside, useCustomValidity, useDialog, useElementRect, useElementSize, useForwardedRef, useGlobalKeyDown, useLayer, useMediaIndex, usePortal, usePrefersDark, usePrefersReducedMotion, useRootTheme, useTheme, useToast, useTree };
|
|
9666
|
+
export { Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, Card, Checkbox, Code, CodeSkeleton, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Radio, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Toast, ToastProvider, Tooltip, TooltipDelayGroupContext, TooltipDelayGroupProvider, Tree, TreeItem, VirtualList, _ResizeObserver, _elementSizeObserver, _fillCSSObject, _getArrayProp, _getResponsiveSpace, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, _responsive, attemptFocus, containsOrEqualsElement, createColorTheme, focusFirstDescendant, focusLastDescendant, hexToRgb, hslToRgb, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply$1 as multiply, parseColor, rem, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, screen$1 as screen, studioTheme, useArrayProp, useBoundaryElement, useClickOutside, useCustomValidity, useDialog, useElementRect, useElementSize, useForwardedRef, useGlobalKeyDown, useLayer, useMediaIndex, usePortal, usePrefersDark, usePrefersReducedMotion, useRootTheme, useTheme, useToast, useTooltipDelayGroup, useTree };
|
|
9583
9667
|
//# sourceMappingURL=index.esm.js.map
|