@sanity/ui 3.0.0-static.26 → 3.0.0-static.28
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 +1 -1
- package/dist/_chunks-cjs/_visual-editing.cjs +674 -804
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-cjs/refractor.cjs +2 -2
- package/dist/_chunks-cjs/refractor.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +652 -781
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/refractor.js +1 -1
- package/dist/_visual-editing.d.cts +1 -0
- package/dist/_visual-editing.d.ts +1 -0
- package/dist/css/layers.css +4 -0
- package/dist/css/primitives/popover/popover.css +4 -0
- package/dist/css.cjs +59 -50
- package/dist/css.cjs.map +1 -1
- package/dist/css.d.cts +14 -6
- package/dist/css.d.ts +14 -6
- package/dist/css.js +59 -50
- package/dist/css.js.map +1 -1
- package/dist/index.cjs +1995 -1813
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -0
- package/dist/index.d.cts +35 -17
- package/dist/index.d.ts +35 -17
- package/dist/index.js +2013 -1832
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +2605 -1075
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +2689 -1159
- package/dist/theme.js.map +1 -1
- package/exports/_visual-editing.ts +2 -2
- package/package.json +20 -38
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +13 -17
- package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
- package/src/core/components/autocomplete/constants.ts +3 -1
- package/src/core/components/autocomplete/types.ts +1 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +8 -3
- package/src/core/components/dialog/__workshop__/activate.tsx +11 -3
- package/src/core/components/dialog/__workshop__/panes.tsx +12 -5
- package/src/core/components/dialog/dialog.tsx +12 -13
- package/src/core/components/dialog/dialogCard.tsx +89 -53
- package/src/core/components/dialog/dialogContext.ts +1 -1
- package/src/core/components/dialog/dialogProvider.tsx +1 -1
- package/src/core/components/dialog/index.ts +1 -0
- package/src/core/components/dialog/isTargetWithinScope.ts +1 -1
- package/src/core/components/hotkeys/hotkeys.tsx +3 -2
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +12 -6
- package/src/core/components/menu/__workshop__/customSelectedState.tsx +1 -5
- package/src/core/components/menu/__workshop__/shouldFocus.tsx +1 -2
- package/src/core/components/menu/helpers.ts +1 -1
- package/src/core/components/menu/menu.tsx +6 -4
- package/src/core/components/menu/menuButton.tsx +5 -3
- package/src/core/components/menu/menuDivider.tsx +1 -1
- package/src/core/components/menu/menuGroup.tsx +8 -4
- package/src/core/components/menu/menuItem.tsx +4 -2
- package/src/core/components/tab/tab.tsx +2 -2
- package/src/core/components/tab/tabList.tsx +2 -2
- package/src/core/components/tab/tabPanel.tsx +2 -2
- package/src/core/components/toast/toast.tsx +7 -2
- package/src/core/components/toast/toastLayer.tsx +2 -2
- package/src/core/components/toast/toastProvider.tsx +1 -1
- package/src/core/components/tree/tree.tsx +2 -2
- package/src/core/components/tree/treeGroup.tsx +2 -2
- package/src/core/components/tree/treeItem.tsx +13 -6
- package/src/core/components/tree/types.ts +0 -1
- package/src/core/{utils → components}/virtualList/__workshop__/index.ts +1 -1
- package/src/core/{utils → components}/virtualList/virtualList.tsx +10 -5
- package/src/core/helpers/focus.ts +0 -8
- package/src/core/hooks/useArrayProp.ts +1 -1
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +1 -3
- package/src/core/hooks/useElementSize.ts +1 -1
- package/src/core/hooks/useResponsiveProp.ts +1 -1
- package/src/core/index.ts +83 -7
- package/src/core/observers/{elementSizeObserver.ts → elementSize.ts} +1 -1
- package/src/core/primitives/_selectable/index.ts +1 -0
- package/src/core/primitives/_selectable/selectable.tsx +13 -3
- package/src/core/{types/selectable.ts → primitives/_selectable/types.ts} +1 -1
- package/src/core/{utils → primitives}/arrow/arrow.tsx +1 -1
- package/src/core/primitives/avatar/avatar.tsx +4 -3
- package/src/core/primitives/avatar/avatarCounter.tsx +3 -3
- package/src/core/primitives/avatar/avatarStack.tsx +4 -4
- package/src/core/primitives/avatar/types.ts +17 -0
- package/src/core/primitives/badge/badge.tsx +4 -2
- package/src/core/primitives/badge/types.ts +11 -2
- package/src/core/primitives/box/__workshop__/responsive.tsx +0 -1
- package/src/core/primitives/box/box.tsx +1 -1
- package/src/core/primitives/box/index.ts +1 -0
- package/src/core/primitives/button/__workshop__/disabled.tsx +37 -51
- package/src/core/primitives/button/__workshop__/index.ts +5 -0
- package/src/core/primitives/button/__workshop__/textOverflow.tsx +13 -0
- package/src/core/primitives/button/button.tsx +15 -14
- package/src/core/primitives/button/index.ts +1 -0
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +2 -2
- package/src/core/primitives/card/card.tsx +1 -1
- package/src/core/primitives/card/types.ts +3 -0
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +9 -1
- package/src/core/primitives/checkbox/checkbox.tsx +3 -4
- package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +17 -42
- package/src/core/primitives/code/code.tsx +1 -1
- package/src/core/primitives/container/container.tsx +1 -1
- package/src/core/primitives/flex/flex.tsx +1 -1
- package/src/core/primitives/flex/index.ts +1 -0
- package/src/core/primitives/grid/grid.tsx +1 -1
- package/src/core/primitives/grid/index.ts +1 -0
- package/src/core/primitives/heading/heading.tsx +1 -1
- package/src/core/primitives/inline/inline.tsx +1 -1
- package/src/core/primitives/kbd/kbd.tsx +1 -1
- package/src/core/primitives/label/label.tsx +1 -1
- package/src/core/{utils → primitives}/layer/__workshop__/index.ts +1 -1
- package/src/core/{utils → primitives}/layer/layer.test.tsx +1 -1
- package/src/core/{utils → primitives}/layer/layer.tsx +2 -2
- package/src/core/{utils → primitives}/layer/layerCard.tsx +3 -3
- package/src/core/{utils → primitives}/layer/layerProvider.tsx +2 -1
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +12 -9
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +9 -8
- package/src/core/primitives/popover/constants.ts +1 -1
- package/src/core/primitives/popover/floating-ui/size.ts +1 -1
- package/src/core/primitives/popover/popover.tsx +8 -4
- package/src/core/primitives/popover/popoverLayer.tsx +4 -2
- package/src/core/primitives/popover/types.ts +5 -0
- package/src/core/primitives/radio/radio.tsx +2 -2
- package/src/core/primitives/select/select.tsx +2 -2
- package/src/core/{components → primitives}/skeleton/__workshop__/index.ts +1 -1
- package/src/core/{components → primitives}/skeleton/codeSkeleton.tsx +1 -1
- package/src/core/{components → primitives}/skeleton/headingSkeleton.tsx +1 -1
- package/src/core/{components → primitives}/skeleton/labelSkeleton.tsx +1 -1
- package/src/core/{components → primitives}/skeleton/skeleton.tsx +7 -8
- package/src/core/{components → primitives}/skeleton/textSkeleton.tsx +1 -1
- package/src/core/primitives/spinner/spinner.tsx +1 -1
- package/src/core/{utils → primitives}/srOnly/srOnly.tsx +1 -1
- package/src/core/primitives/stack/stack.tsx +2 -1
- package/src/core/primitives/switch/switch.tsx +2 -7
- package/src/core/primitives/text/__workshop__/colored.tsx +2 -2
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +17 -42
- package/src/core/primitives/text/text.tsx +3 -1
- package/src/core/primitives/textArea/__workshop__/plain.tsx +2 -2
- package/src/core/primitives/textArea/textArea.tsx +2 -2
- package/src/core/primitives/textInput/textInput.tsx +3 -2
- package/src/core/primitives/tooltip/constants.ts +1 -1
- package/src/core/primitives/tooltip/tooltip.tsx +6 -3
- package/src/core/primitives/tooltip/tooltipLayer.tsx +3 -2
- package/src/core/primitives/types.ts +8 -10
- package/src/core/types/radius.ts +1 -1
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +9 -5
- package/src/core/utils/elementQuery/elementQuery.tsx +2 -2
- package/src/core/utils/getElementRef.ts +1 -0
- package/src/core/utils/portal/portal.tsx +1 -1
- package/src/css/components/dialog/dialog.css.ts +26 -1
- package/src/css/components/dialog/dialog.ts +27 -7
- package/src/css/components/skeleton/skeleton.ts +3 -1
- package/src/css/components/skeleton/types.ts +3 -1
- package/src/css/index.ts +75 -5
- package/src/css/primitives/_input/input.ts +2 -1
- package/src/css/primitives/_input/types.ts +2 -1
- package/src/css/primitives/_selectable/_selectable.css.ts +32 -24
- package/src/css/primitives/_selectable/selectable.ts +1 -1
- package/src/css/primitives/_selectable/types.ts +1 -1
- package/src/css/primitives/avatar/avatar.css.ts +11 -2
- package/src/css/primitives/avatar/avatar.ts +1 -1
- package/src/css/primitives/badge/badge.css.ts +2 -1
- package/src/css/primitives/badge/types.ts +0 -2
- package/src/css/primitives/box/box.ts +35 -37
- package/src/css/primitives/box/types.ts +34 -36
- package/src/css/primitives/button/button.css.ts +4 -0
- package/src/css/primitives/button/button.ts +5 -2
- package/src/css/primitives/button/types.ts +4 -11
- package/src/css/primitives/card/__workshop__/color.tsx +70 -0
- package/src/css/primitives/card/__workshop__/index.ts +14 -0
- package/src/css/primitives/card/card.css.ts +4 -0
- package/src/css/primitives/code/code.ts +3 -1
- package/src/css/primitives/code/types.ts +2 -1
- package/src/css/primitives/container/container.ts +3 -1
- package/src/css/primitives/heading/heading.ts +4 -1
- package/src/css/primitives/heading/types.ts +3 -1
- package/src/css/primitives/kbd/kbd.ts +1 -1
- package/src/css/primitives/kbd/types.ts +1 -1
- package/src/css/primitives/label/label.css.ts +1 -0
- package/src/css/primitives/label/label.ts +4 -1
- package/src/css/primitives/label/types.ts +3 -1
- package/src/css/primitives/switch/switch.css.ts +1 -1
- package/src/css/primitives/text/text.ts +6 -1
- package/src/css/primitives/text/types.ts +5 -2
- package/src/css/props/width/types.ts +1 -1
- package/src/css/props/width/width.css.ts +3 -0
- package/src/theme/v2/build/buildTheme.test.ts +8 -8
- package/src/theme/v2/build/buildTheme.ts +32 -7
- package/src/theme/v3/defaultFonts.ts +6 -6
- package/src/theme/v3/defaultTokens.ts +1 -1
- package/bin/sanity-ui.cjs +0 -5
- package/dist/ui.css +0 -1
- package/src/cli/buildCommand.ts +0 -10
- package/src/cli/index.ts +0 -26
- package/src/core/components/autocomplete/index.ts +0 -2
- package/src/core/components/index.ts +0 -9
- package/src/core/helpers/index.ts +0 -5
- package/src/core/hooks/index.ts +0 -13
- package/src/core/observers/index.ts +0 -2
- package/src/core/primitives/index.ts +0 -27
- package/src/core/types/avatar.ts +0 -16
- package/src/core/types/card.ts +0 -4
- package/src/core/types/index.ts +0 -15
- package/src/core/types/popover.ts +0 -4
- package/src/core/utils/index.ts +0 -8
- package/src/css/__theme/index.ts +0 -16
- package/src/css/__theme/lib/contract/buildVarContract.ts +0 -78
- package/src/css/__theme/lib/contract/index.ts +0 -4
- package/src/css/__theme/lib/contract/types.ts +0 -17
- package/src/css/__theme/resolveTheme.ts +0 -865
- package/src/css/components/index.ts +0 -6
- package/src/css/primitives/index.ts +0 -24
- package/src/css/props/index.ts +0 -37
- package/src/css/utils/srOnly/index.ts +0 -1
- /package/src/core/{global.ts → __DEV__.ts} +0 -0
- /package/src/core/{types/dialog.ts → components/dialog/types.ts} +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/changingProps.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/elementScroll.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/infiniteList.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/windowScrolll.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/index.ts +0 -0
- /package/src/core/observers/{resizeObserver.ts → resize.ts} +0 -0
- /package/src/core/{utils → primitives}/arrow/cmds.ts +0 -0
- /package/src/core/{utils → primitives}/arrow/index.ts +0 -0
- /package/src/core/{types/badge.ts → primitives/badge/types2.ts} +0 -0
- /package/src/core/{types/box.ts → primitives/box/types.ts} +0 -0
- /package/src/core/{types/button.ts → primitives/button/types.ts} +0 -0
- /package/src/core/{types/flex.ts → primitives/flex/types.ts} +0 -0
- /package/src/core/{types/grid.ts → primitives/grid/types.ts} +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/_debug.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/multipleRoots.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/nested.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/responsiveZOffset.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/getLayerContext.test.ts +0 -0
- /package/src/core/{utils → primitives}/layer/getLayerContext.ts +0 -0
- /package/src/core/{utils → primitives}/layer/index.ts +0 -0
- /package/src/core/{utils → primitives}/layer/layerContext.ts +0 -0
- /package/src/core/{utils → primitives}/layer/types.ts +0 -0
- /package/src/core/{utils → primitives}/layer/useLayer.ts +0 -0
- /package/src/core/{components → primitives}/skeleton/__workshop__/delay.tsx +0 -0
- /package/src/core/{components → primitives}/skeleton/__workshop__/skeleton.tsx +0 -0
- /package/src/core/{components → primitives}/skeleton/index.ts +0 -0
- /package/src/core/{utils → primitives}/srOnly/index.ts +0 -0
- /package/src/core/types/{text.ts → textAlign.ts} +0 -0
- /package/src/css/{utils → primitives/srOnly}/index.ts +0 -0
- /package/src/css/{utils → primitives}/srOnly/srOnly.css.ts +0 -0
- /package/src/css/{utils → primitives}/srOnly/srOnly.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var jsxRuntime = require("react/jsx-runtime"),
|
|
2
|
+
var jsxRuntime = require("react/jsx-runtime"), compilerRuntime = require("react/compiler-runtime"), theme = require("@sanity/ui/theme"), react = require("react"), styledComponents = require("styled-components"), css = require("@sanity/ui/css"), useEffectEvent = require("use-effect-event"), icons = require("@sanity/icons"), reactIs = require("react-is"), reactDom$1 = require("@floating-ui/react-dom"), framerMotion = require("framer-motion"), reactDom = require("react-dom"), dynamic = require("@vanilla-extract/dynamic");
|
|
3
3
|
function getGlobalScope() {
|
|
4
4
|
if (typeof globalThis < "u") return globalThis;
|
|
5
5
|
if (typeof window < "u") return window;
|
|
@@ -14,7 +14,7 @@ function createGlobalScopedContext(key2, defaultValue) {
|
|
|
14
14
|
}
|
|
15
15
|
const CardContext = createGlobalScopedContext("@sanity/ui/context/card", null);
|
|
16
16
|
function CardProvider(props) {
|
|
17
|
-
const $ =
|
|
17
|
+
const $ = compilerRuntime.c(7), {
|
|
18
18
|
children,
|
|
19
19
|
tone,
|
|
20
20
|
scheme,
|
|
@@ -31,7 +31,7 @@ function CardProvider(props) {
|
|
|
31
31
|
}
|
|
32
32
|
const ThemeContext = createGlobalScopedContext("@sanity/ui/context/theme", null);
|
|
33
33
|
function ThemeProvider(props) {
|
|
34
|
-
const $ =
|
|
34
|
+
const $ = compilerRuntime.c(19), parentTheme = react.useContext(ThemeContext), {
|
|
35
35
|
children
|
|
36
36
|
} = props, scheme = props.scheme ?? (parentTheme?.scheme || "light"), rootTheme = props.theme ?? (parentTheme?.theme || null), tone = props.tone ?? (parentTheme?.tone || "default");
|
|
37
37
|
let t0;
|
|
@@ -77,7 +77,7 @@ function useRootTheme() {
|
|
|
77
77
|
return value;
|
|
78
78
|
}
|
|
79
79
|
function ThemeColorProvider(props) {
|
|
80
|
-
const $ =
|
|
80
|
+
const $ = compilerRuntime.c(5), {
|
|
81
81
|
children,
|
|
82
82
|
scheme,
|
|
83
83
|
tone
|
|
@@ -89,7 +89,7 @@ function useTheme() {
|
|
|
89
89
|
return styledComponents.useTheme();
|
|
90
90
|
}
|
|
91
91
|
function useTheme_v2() {
|
|
92
|
-
const $ =
|
|
92
|
+
const $ = compilerRuntime.c(2), t0 = styledComponents.useTheme();
|
|
93
93
|
let t1;
|
|
94
94
|
return $[0] !== t0 ? (t1 = theme.getTheme_v2(t0), $[0] = t0, $[1] = t1) : t1 = $[1], t1;
|
|
95
95
|
}
|
|
@@ -162,190 +162,8 @@ function _getArrayProp(val, defaultVal) {
|
|
|
162
162
|
function _getResponsiveProp(val, defaultVal) {
|
|
163
163
|
return val === void 0 ? defaultVal || EMPTY_ARRAY : isArray(val) || isRecord(val) ? val : [val];
|
|
164
164
|
}
|
|
165
|
-
function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
166
|
-
const $ = reactCompilerRuntime.c(9), elementsArg = t0 === void 0 ? _temp$5 : t0;
|
|
167
|
-
let t1;
|
|
168
|
-
$[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
|
|
169
|
-
if (!listener)
|
|
170
|
-
return;
|
|
171
|
-
const target = evt.target;
|
|
172
|
-
if (!(target instanceof Node))
|
|
173
|
-
return;
|
|
174
|
-
const resolvedBoundaryElement = boundaryElement?.();
|
|
175
|
-
if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target))
|
|
176
|
-
return;
|
|
177
|
-
const elements = elementsArg().flat();
|
|
178
|
-
for (const el of elements)
|
|
179
|
-
if (el && (target === el || el.contains(target)))
|
|
180
|
-
return;
|
|
181
|
-
listener(evt);
|
|
182
|
-
}, $[0] = boundaryElement, $[1] = elementsArg, $[2] = listener, $[3] = t1) : t1 = $[3];
|
|
183
|
-
const onEvent = useEffectEvent.useEffectEvent(t1), hasListener = !!listener;
|
|
184
|
-
let t2;
|
|
185
|
-
$[4] !== hasListener || $[5] !== onEvent ? (t2 = () => {
|
|
186
|
-
if (!hasListener)
|
|
187
|
-
return;
|
|
188
|
-
const handleEvent = (evt_0) => onEvent(evt_0);
|
|
189
|
-
return document.addEventListener("mousedown", handleEvent), () => {
|
|
190
|
-
document.removeEventListener("mousedown", handleEvent);
|
|
191
|
-
};
|
|
192
|
-
}, $[4] = hasListener, $[5] = onEvent, $[6] = t2) : t2 = $[6];
|
|
193
|
-
let t3;
|
|
194
|
-
$[7] !== hasListener ? (t3 = [hasListener], $[7] = hasListener, $[8] = t3) : t3 = $[8], react.useEffect(t2, t3), react.useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
|
|
195
|
-
}
|
|
196
|
-
function _temp$5() {
|
|
197
|
-
return EMPTY_ARRAY;
|
|
198
|
-
}
|
|
199
|
-
function useCustomValidity(ref, customValidity) {
|
|
200
|
-
const $ = reactCompilerRuntime.c(6);
|
|
201
|
-
let t0;
|
|
202
|
-
$[0] !== customValidity || $[1] !== ref.current ? (t0 = () => {
|
|
203
|
-
ref.current?.setCustomValidity(customValidity || "");
|
|
204
|
-
}, $[0] = customValidity, $[1] = ref.current, $[2] = t0) : t0 = $[2];
|
|
205
|
-
let t1;
|
|
206
|
-
$[3] !== customValidity || $[4] !== ref ? (t1 = [customValidity, ref], $[3] = customValidity, $[4] = ref, $[5] = t1) : t1 = $[5], react.useEffect(t0, t1);
|
|
207
|
-
}
|
|
208
|
-
const _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : resizeObserver.ResizeObserver, _elementSizeObserver = _createElementSizeObserver();
|
|
209
|
-
function _createElementRectValueListener() {
|
|
210
|
-
return {
|
|
211
|
-
subscribe(element, subscriber) {
|
|
212
|
-
const resizeObserver2 = new _ResizeObserver(([entry]) => {
|
|
213
|
-
subscriber({
|
|
214
|
-
_contentRect: entry.contentRect,
|
|
215
|
-
border: {
|
|
216
|
-
width: entry.borderBoxSize[0].inlineSize,
|
|
217
|
-
height: entry.borderBoxSize[0].blockSize
|
|
218
|
-
},
|
|
219
|
-
content: {
|
|
220
|
-
width: entry.contentRect.width,
|
|
221
|
-
height: entry.contentRect.height
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
return resizeObserver2.observe(element), () => {
|
|
226
|
-
resizeObserver2.unobserve(element), resizeObserver2.disconnect();
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
function _createElementSizeObserver() {
|
|
232
|
-
const disposeCache = /* @__PURE__ */ new WeakMap(), subscribersCache = /* @__PURE__ */ new WeakMap();
|
|
233
|
-
return {
|
|
234
|
-
subscribe(element, subscriber) {
|
|
235
|
-
const subscribers = subscribersCache.get(element) || [];
|
|
236
|
-
let dispose = disposeCache.get(element);
|
|
237
|
-
return subscribersCache.has(element) || (subscribersCache.set(element, subscribers), dispose = _createElementRectValueListener().subscribe(element, (elementRect) => {
|
|
238
|
-
for (const sub of subscribers)
|
|
239
|
-
sub(elementRect);
|
|
240
|
-
})), subscribers.push(subscriber), () => {
|
|
241
|
-
const idx = subscribers.indexOf(subscriber);
|
|
242
|
-
idx > -1 && subscribers.splice(idx, 1), subscribers.length === 0 && dispose && dispose();
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
function useElementSize(element) {
|
|
248
|
-
const $ = reactCompilerRuntime.c(3), [size2, setSize] = react.useState(null);
|
|
249
|
-
let t0, t1;
|
|
250
|
-
return $[0] !== element ? (t0 = () => {
|
|
251
|
-
if (element)
|
|
252
|
-
return _elementSizeObserver.subscribe(element, setSize);
|
|
253
|
-
}, t1 = [element], $[0] = element, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), react.useEffect(t0, t1), size2;
|
|
254
|
-
}
|
|
255
|
-
function useGlobalKeyDown(onKeyDown) {
|
|
256
|
-
const $ = reactCompilerRuntime.c(5);
|
|
257
|
-
let t0;
|
|
258
|
-
$[0] !== onKeyDown ? (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0) : t0 = $[1];
|
|
259
|
-
const handleKeyDown = useEffectEvent.useEffectEvent(t0);
|
|
260
|
-
let t1;
|
|
261
|
-
$[2] !== handleKeyDown ? (t1 = () => {
|
|
262
|
-
const handler = (event_0) => handleKeyDown(event_0);
|
|
263
|
-
return window.addEventListener("keydown", handler), () => window.removeEventListener("keydown", handler);
|
|
264
|
-
}, $[2] = handleKeyDown, $[3] = t1) : t1 = $[3];
|
|
265
|
-
let t2;
|
|
266
|
-
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[4] = t2) : t2 = $[4], react.useEffect(t1, t2);
|
|
267
|
-
}
|
|
268
|
-
function useMatchMedia(mediaQueryString, getServerSnapshot2) {
|
|
269
|
-
const $ = reactCompilerRuntime.c(4);
|
|
270
|
-
react.useDebugValue(mediaQueryString);
|
|
271
|
-
let t0;
|
|
272
|
-
$[0] !== mediaQueryString ? (t0 = (onStoreChange) => {
|
|
273
|
-
const media2 = window.matchMedia(mediaQueryString);
|
|
274
|
-
return media2.addEventListener("change", onStoreChange), () => media2.removeEventListener("change", onStoreChange);
|
|
275
|
-
}, $[0] = mediaQueryString, $[1] = t0) : t0 = $[1];
|
|
276
|
-
let t1;
|
|
277
|
-
return $[2] !== mediaQueryString ? (t1 = () => window.matchMedia(mediaQueryString).matches, $[2] = mediaQueryString, $[3] = t1) : t1 = $[3], react.useSyncExternalStore(t0, t1, getServerSnapshot2);
|
|
278
|
-
}
|
|
279
|
-
const media = Object.values(css.BREAKPOINTS);
|
|
280
|
-
function _getMediaQuery(media2, index) {
|
|
281
|
-
return index === 0 ? `screen and (max-width: ${media2[index + 1] - 1}px)` : index === media2.length - 1 ? `screen and (min-width: ${media2[index]}px)` : `screen and (min-width: ${media2[index]}px) and (max-width: ${media2[index + 1] - 1}px)`;
|
|
282
|
-
}
|
|
283
|
-
function _createMediaStore() {
|
|
284
|
-
const mediaLen = media.length;
|
|
285
|
-
let sizes;
|
|
286
|
-
const getSizes = () => {
|
|
287
|
-
if (!sizes) {
|
|
288
|
-
sizes = [];
|
|
289
|
-
for (let index = mediaLen; index > -1; index -= 1) {
|
|
290
|
-
const mediaQuery = _getMediaQuery(media, index);
|
|
291
|
-
sizes.push({
|
|
292
|
-
index,
|
|
293
|
-
mq: window.matchMedia(mediaQuery)
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
return sizes;
|
|
298
|
-
};
|
|
299
|
-
return {
|
|
300
|
-
getSnapshot: () => {
|
|
301
|
-
for (const {
|
|
302
|
-
index,
|
|
303
|
-
mq
|
|
304
|
-
} of getSizes())
|
|
305
|
-
if (mq.matches) return index;
|
|
306
|
-
return 0;
|
|
307
|
-
},
|
|
308
|
-
subscribe: (onStoreChange) => {
|
|
309
|
-
const disposeFns = [];
|
|
310
|
-
for (const {
|
|
311
|
-
mq
|
|
312
|
-
} of getSizes()) {
|
|
313
|
-
const handleChange = () => {
|
|
314
|
-
mq.matches && onStoreChange();
|
|
315
|
-
};
|
|
316
|
-
mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
|
|
317
|
-
}
|
|
318
|
-
return () => {
|
|
319
|
-
for (const disposeFn of disposeFns)
|
|
320
|
-
disposeFn();
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
function getServerSnapshot() {
|
|
326
|
-
return 0;
|
|
327
|
-
}
|
|
328
|
-
function useMediaIndex() {
|
|
329
|
-
const $ = reactCompilerRuntime.c(1);
|
|
330
|
-
let t0, t1;
|
|
331
|
-
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = _createMediaStore(), $[0] = t1) : t1 = $[0], t0 = t1;
|
|
332
|
-
const store = t0;
|
|
333
|
-
return react.useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
|
|
334
|
-
}
|
|
335
|
-
function usePrefersDark(t0) {
|
|
336
|
-
return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$4 : t0);
|
|
337
|
-
}
|
|
338
|
-
function _temp$4() {
|
|
339
|
-
return !1;
|
|
340
|
-
}
|
|
341
|
-
function usePrefersReducedMotion(t0) {
|
|
342
|
-
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$3 : t0);
|
|
343
|
-
}
|
|
344
|
-
function _temp$3() {
|
|
345
|
-
return !1;
|
|
346
|
-
}
|
|
347
165
|
function useResponsiveProp(val, defaultVal) {
|
|
348
|
-
const $ =
|
|
166
|
+
const $ = compilerRuntime.c(3);
|
|
349
167
|
let t0;
|
|
350
168
|
$[0] !== defaultVal || $[1] !== val ? (t0 = () => [_getResponsiveProp(val, defaultVal), JSON.stringify(val ?? defaultVal)], $[0] = defaultVal, $[1] = val, $[2] = t0) : t0 = $[2];
|
|
351
169
|
const [t1, setCache] = react.useState(t0), [cachedVal, cachedHash] = t1, hash = JSON.stringify(val ?? defaultVal);
|
|
@@ -353,7 +171,7 @@ function useResponsiveProp(val, defaultVal) {
|
|
|
353
171
|
}
|
|
354
172
|
const DEFAULT_BOX_ELEMENT = "div";
|
|
355
173
|
function Box(props) {
|
|
356
|
-
const $ =
|
|
174
|
+
const $ = compilerRuntime.c(154), t0 = props;
|
|
357
175
|
let alignItems, autoCols, autoFlow, autoRows, borderBottom, borderLeft, borderRight, borderTop, children, className, column, columnEnd, columnStart, columns, flex, flexDirection, flexWrap, gap, gapX, gapY, gridAutoColumns, gridAutoFlow, gridAutoRows, gridColumn, gridColumnEnd, gridColumnStart, gridRow, gridRowEnd, gridRowStart, gridTemplateColumns, gridTemplateRows, height, inset, insetBottom, insetLeft, insetRight, insetTop, justifyContent, marginBottom, marginLeft, marginRight, marginTop, marginX, marginY, maxWidth, muted, outline, overflow, overflowX, overflowY, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, pointerEvents, position, radius, rest, row, rowEnd, rowStart, rows, shadow, t1, t2, t3, t4, t5, t6, t7, t8, textAlign, width;
|
|
358
176
|
$[0] !== t0 ? ({
|
|
359
177
|
alignItems,
|
|
@@ -513,8 +331,8 @@ function Box(props) {
|
|
|
513
331
|
}
|
|
514
332
|
const DEFAULT_TEXT_ELEMENT = "div";
|
|
515
333
|
function Text(props) {
|
|
516
|
-
const $ =
|
|
517
|
-
let accent, align, children, className, flex, muted, rest, t1, t2, t3, textOverflowProp;
|
|
334
|
+
const $ = compilerRuntime.c(32), t0 = props;
|
|
335
|
+
let accent, align, children, className, flex, muted, rest, t1, t2, t3, t4, textOverflowProp;
|
|
518
336
|
$[0] !== t0 ? ({
|
|
519
337
|
accent,
|
|
520
338
|
align,
|
|
@@ -522,34 +340,36 @@ function Text(props) {
|
|
|
522
340
|
children,
|
|
523
341
|
className,
|
|
524
342
|
flex,
|
|
343
|
+
maxWidth: t2,
|
|
525
344
|
muted,
|
|
526
|
-
size:
|
|
345
|
+
size: t3,
|
|
527
346
|
textOverflow: textOverflowProp,
|
|
528
|
-
weight:
|
|
347
|
+
weight: t4,
|
|
529
348
|
...rest
|
|
530
|
-
} = t0, $[0] = t0, $[1] = accent, $[2] = align, $[3] = children, $[4] = className, $[5] = flex, $[6] = muted, $[7] = rest, $[8] = t1, $[9] = t2, $[10] = t3, $[11] = textOverflowProp) : (accent = $[1], align = $[2], children = $[3], className = $[4], flex = $[5], muted = $[6], rest = $[7], t1 = $[8], t2 = $[9], t3 = $[10],
|
|
531
|
-
const Element = t1 === void 0 ? DEFAULT_TEXT_ELEMENT : t1,
|
|
532
|
-
let
|
|
533
|
-
$[
|
|
349
|
+
} = t0, $[0] = t0, $[1] = accent, $[2] = align, $[3] = children, $[4] = className, $[5] = flex, $[6] = muted, $[7] = rest, $[8] = t1, $[9] = t2, $[10] = t3, $[11] = t4, $[12] = textOverflowProp) : (accent = $[1], align = $[2], children = $[3], className = $[4], flex = $[5], muted = $[6], rest = $[7], t1 = $[8], t2 = $[9], t3 = $[10], t4 = $[11], textOverflowProp = $[12]);
|
|
350
|
+
const Element = t1 === void 0 ? DEFAULT_TEXT_ELEMENT : t1, maxWidth = t2 === void 0 ? "fill" : t2, size2 = t3 === void 0 ? 2 : t3, weight = t4 === void 0 ? "regular" : t4;
|
|
351
|
+
let t5;
|
|
352
|
+
$[13] !== accent || $[14] !== align || $[15] !== className || $[16] !== flex || $[17] !== maxWidth || $[18] !== muted || $[19] !== size2 || $[20] !== weight ? (t5 = css.text({
|
|
534
353
|
className,
|
|
535
354
|
accent,
|
|
536
355
|
align,
|
|
537
356
|
flex,
|
|
357
|
+
maxWidth,
|
|
538
358
|
muted,
|
|
539
359
|
size: size2,
|
|
540
360
|
weight
|
|
541
|
-
}), $[
|
|
542
|
-
let t5;
|
|
543
|
-
$[20] !== textOverflowProp ? (t5 = css.textOverflow({
|
|
544
|
-
textOverflow: textOverflowProp
|
|
545
|
-
}), $[20] = textOverflowProp, $[21] = t5) : t5 = $[21];
|
|
361
|
+
}), $[13] = accent, $[14] = align, $[15] = className, $[16] = flex, $[17] = maxWidth, $[18] = muted, $[19] = size2, $[20] = weight, $[21] = t5) : t5 = $[21];
|
|
546
362
|
let t6;
|
|
547
|
-
$[22] !==
|
|
363
|
+
$[22] !== textOverflowProp ? (t6 = css.textOverflow({
|
|
364
|
+
textOverflow: textOverflowProp
|
|
365
|
+
}), $[22] = textOverflowProp, $[23] = t6) : t6 = $[23];
|
|
548
366
|
let t7;
|
|
549
|
-
|
|
367
|
+
$[24] !== children || $[25] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t6, children }), $[24] = children, $[25] = t6, $[26] = t7) : t7 = $[26];
|
|
368
|
+
let t8;
|
|
369
|
+
return $[27] !== Element || $[28] !== rest || $[29] !== t5 || $[30] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Element, { "data-ui": "Text", ...rest, className: t5, children: t7 }), $[27] = Element, $[28] = rest, $[29] = t5, $[30] = t7, $[31] = t8) : t8 = $[31], t8;
|
|
550
370
|
}
|
|
551
371
|
function AnimatedSpinnerIcon(props) {
|
|
552
|
-
const $ =
|
|
372
|
+
const $ = compilerRuntime.c(5);
|
|
553
373
|
let rest;
|
|
554
374
|
$[0] !== props ? ({
|
|
555
375
|
...rest
|
|
@@ -561,7 +381,7 @@ function AnimatedSpinnerIcon(props) {
|
|
|
561
381
|
}
|
|
562
382
|
const DEFAULT_SPINNER_ELEMENT = "div";
|
|
563
383
|
function Spinner(props) {
|
|
564
|
-
const $ =
|
|
384
|
+
const $ = compilerRuntime.c(11), t0 = props;
|
|
565
385
|
let className, rest, t1;
|
|
566
386
|
$[0] !== t0 ? ({
|
|
567
387
|
as: t1,
|
|
@@ -586,7 +406,6 @@ function Button(props) {
|
|
|
586
406
|
children,
|
|
587
407
|
className,
|
|
588
408
|
disabled,
|
|
589
|
-
display = "inline-flex",
|
|
590
409
|
flex,
|
|
591
410
|
fontSize = 1,
|
|
592
411
|
gap = props.space ?? props.padding ?? 3,
|
|
@@ -626,7 +445,6 @@ function Button(props) {
|
|
|
626
445
|
...rest,
|
|
627
446
|
className: css.button({
|
|
628
447
|
className,
|
|
629
|
-
display,
|
|
630
448
|
flex,
|
|
631
449
|
mode,
|
|
632
450
|
radius,
|
|
@@ -645,7 +463,7 @@ function Button(props) {
|
|
|
645
463
|
react.isValidElement(IconComponent) && IconComponent,
|
|
646
464
|
reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
647
465
|
] }),
|
|
648
|
-
text && /* @__PURE__ */ jsxRuntime.jsx(
|
|
466
|
+
text && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", maxWidth: "auto", children: /* @__PURE__ */ jsxRuntime.jsx(Text, { align: textAlign, as: "span", muted, size: fontSize, textOverflow, weight: textWeight, children: text }) }),
|
|
649
467
|
IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
|
|
650
468
|
react.isValidElement(IconRightComponent) && IconRightComponent,
|
|
651
469
|
reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
|
|
@@ -661,7 +479,7 @@ function useCard() {
|
|
|
661
479
|
}
|
|
662
480
|
const DEFAULT_CARD_ELEMENT = "div";
|
|
663
481
|
function Card(props) {
|
|
664
|
-
const $ =
|
|
482
|
+
const $ = compilerRuntime.c(38), t0 = props;
|
|
665
483
|
let className, disabled, pressed, rest, schemeProp, selected, style, t1, t2, t3, t4, t5;
|
|
666
484
|
$[0] !== t0 ? ({
|
|
667
485
|
__unstable_checkered: t1,
|
|
@@ -699,90 +517,22 @@ function Card(props) {
|
|
|
699
517
|
}
|
|
700
518
|
return node;
|
|
701
519
|
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
language: languageProp,
|
|
713
|
-
size: t2,
|
|
714
|
-
weight: t3,
|
|
715
|
-
...rest
|
|
716
|
-
} = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = languageProp, $[4] = rest, $[5] = t1, $[6] = t2, $[7] = t3) : (children = $[1], className = $[2], languageProp = $[3], rest = $[4], t1 = $[5], t2 = $[6], t3 = $[7]);
|
|
717
|
-
const Element = t1 === void 0 ? DEFAULT_CODE_ELEMENT : t1, size2 = t2 === void 0 ? 2 : t2, weight = t3 === void 0 ? "regular" : t3, language = typeof languageProp == "string" ? languageProp : void 0;
|
|
718
|
-
let t4;
|
|
719
|
-
$[8] !== className || $[9] !== size2 || $[10] !== weight ? (t4 = css.code({
|
|
720
|
-
className,
|
|
721
|
-
size: size2,
|
|
722
|
-
weight
|
|
723
|
-
}), $[8] = className, $[9] = size2, $[10] = weight, $[11] = t4) : t4 = $[11];
|
|
724
|
-
let t5;
|
|
725
|
-
$[12] !== children ? (t5 = /* @__PURE__ */ jsxRuntime.jsx("code", { children }), $[12] = children, $[13] = t5) : t5 = $[13];
|
|
726
|
-
let t6;
|
|
727
|
-
$[14] !== children || $[15] !== language ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(LazyRefractor, { language, value: children }), $[14] = children, $[15] = language, $[16] = t6) : t6 = $[16];
|
|
728
|
-
let t7;
|
|
729
|
-
$[17] !== t5 || $[18] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: t5, children: t6 }), $[17] = t5, $[18] = t6, $[19] = t7) : t7 = $[19];
|
|
730
|
-
let t8;
|
|
731
|
-
return $[20] !== Element || $[21] !== rest || $[22] !== t4 || $[23] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Element, { "data-ui": "Code", ...rest, className: t4, children: t7 }), $[20] = Element, $[21] = rest, $[22] = t4, $[23] = t7, $[24] = t8) : t8 = $[24], t8;
|
|
732
|
-
}
|
|
733
|
-
const DEFAULT_FLEX_ELEMENT = "div";
|
|
734
|
-
function Flex(props) {
|
|
735
|
-
const $ = reactCompilerRuntime.c(14), t0 = props;
|
|
736
|
-
let align, justify, rest, t1, t2, wrap;
|
|
737
|
-
$[0] !== t0 ? ({
|
|
738
|
-
align,
|
|
739
|
-
as: t1,
|
|
740
|
-
direction: t2,
|
|
741
|
-
justify,
|
|
742
|
-
wrap,
|
|
743
|
-
...rest
|
|
744
|
-
} = t0, $[0] = t0, $[1] = align, $[2] = justify, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = wrap) : (align = $[1], justify = $[2], rest = $[3], t1 = $[4], t2 = $[5], wrap = $[6]);
|
|
745
|
-
const as = t1 === void 0 ? DEFAULT_FLEX_ELEMENT : t1, direction = t2 === void 0 ? "row" : t2;
|
|
746
|
-
let t3;
|
|
747
|
-
return $[7] !== align || $[8] !== as || $[9] !== direction || $[10] !== justify || $[11] !== rest || $[12] !== wrap ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Flex", ...rest, alignItems: align, as, display: "flex", flexDirection: direction, flexWrap: wrap, justifyContent: justify }), $[7] = align, $[8] = as, $[9] = direction, $[10] = justify, $[11] = rest, $[12] = wrap, $[13] = t3) : t3 = $[13], t3;
|
|
520
|
+
function useMatchMedia(mediaQueryString, getServerSnapshot2) {
|
|
521
|
+
const $ = compilerRuntime.c(4);
|
|
522
|
+
react.useDebugValue(mediaQueryString);
|
|
523
|
+
let t0;
|
|
524
|
+
$[0] !== mediaQueryString ? (t0 = (onStoreChange) => {
|
|
525
|
+
const media2 = window.matchMedia(mediaQueryString);
|
|
526
|
+
return media2.addEventListener("change", onStoreChange), () => media2.removeEventListener("change", onStoreChange);
|
|
527
|
+
}, $[0] = mediaQueryString, $[1] = t0) : t0 = $[1];
|
|
528
|
+
let t1;
|
|
529
|
+
return $[2] !== mediaQueryString ? (t1 = () => window.matchMedia(mediaQueryString).matches, $[2] = mediaQueryString, $[3] = t1) : t1 = $[3], react.useSyncExternalStore(t0, t1, getServerSnapshot2);
|
|
748
530
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
const $ = reactCompilerRuntime.c(8), t0 = props;
|
|
752
|
-
let children, rest, t1;
|
|
753
|
-
$[0] !== t0 ? ({
|
|
754
|
-
as: t1,
|
|
755
|
-
children,
|
|
756
|
-
...rest
|
|
757
|
-
} = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1) : (children = $[1], rest = $[2], t1 = $[3]);
|
|
758
|
-
const as = t1 === void 0 ? DEFAULT_GRID_ELEMENT : t1;
|
|
759
|
-
let t2;
|
|
760
|
-
return $[4] !== as || $[5] !== children || $[6] !== rest ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Grid", ...rest, as, display: "grid", children }), $[4] = as, $[5] = children, $[6] = rest, $[7] = t2) : t2 = $[7], t2;
|
|
531
|
+
function usePrefersReducedMotion(t0) {
|
|
532
|
+
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$5 : t0);
|
|
761
533
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
const $ = reactCompilerRuntime.c(22), t0 = props;
|
|
765
|
-
let children, className, rest, t1, t2, t3, t4, t5;
|
|
766
|
-
$[0] !== t0 ? ({
|
|
767
|
-
as: t1,
|
|
768
|
-
children,
|
|
769
|
-
className,
|
|
770
|
-
display: t2,
|
|
771
|
-
fontSize: t3,
|
|
772
|
-
padding: t4,
|
|
773
|
-
radius: t5,
|
|
774
|
-
...rest
|
|
775
|
-
} = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = t3, $[7] = t4, $[8] = t5) : (children = $[1], className = $[2], rest = $[3], t1 = $[4], t2 = $[5], t3 = $[6], t4 = $[7], t5 = $[8]);
|
|
776
|
-
const as = t1 === void 0 ? DEFAULT_KBD_ELEMENT : t1, display = t2 === void 0 ? "inline-block" : t2, fontSize = t3 === void 0 ? 0 : t3, padding = t4 === void 0 ? 1 : t4, radius = t5 === void 0 ? 2 : t5, t6 = as;
|
|
777
|
-
let t7;
|
|
778
|
-
$[9] !== className || $[10] !== radius ? (t7 = css.kbd({
|
|
779
|
-
className,
|
|
780
|
-
radius
|
|
781
|
-
}), $[9] = className, $[10] = radius, $[11] = t7) : t7 = $[11];
|
|
782
|
-
let t8;
|
|
783
|
-
$[12] !== children || $[13] !== fontSize ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Text, { as: "span", muted: !0, size: fontSize, weight: "semibold", children }), $[12] = children, $[13] = fontSize, $[14] = t8) : t8 = $[14];
|
|
784
|
-
let t9;
|
|
785
|
-
return $[15] !== display || $[16] !== padding || $[17] !== rest || $[18] !== t6 || $[19] !== t7 || $[20] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "KBD", ...rest, as: t6, className: t7, display, muted: !0, padding, children: t8 }), $[15] = display, $[16] = padding, $[17] = rest, $[18] = t6, $[19] = t7, $[20] = t8, $[21] = t9) : t9 = $[21], t9;
|
|
534
|
+
function _temp$5() {
|
|
535
|
+
return !1;
|
|
786
536
|
}
|
|
787
537
|
const origin = {
|
|
788
538
|
name: "@sanity/ui/origin",
|
|
@@ -815,170 +565,83 @@ const origin = {
|
|
|
815
565
|
function clamp(num, min, max) {
|
|
816
566
|
return Math.min(Math.max(num, min), max);
|
|
817
567
|
}
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
568
|
+
const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/context/boundaryElement", null), DEFAULT_VALUE = {
|
|
569
|
+
version: 0,
|
|
570
|
+
element: null
|
|
571
|
+
};
|
|
572
|
+
function useBoundaryElement() {
|
|
573
|
+
const value = react.useContext(BoundaryElementContext);
|
|
574
|
+
if (value && (!isRecord(value) || value.version !== 0))
|
|
575
|
+
throw new Error("useBoundaryElement(): the context value is not compatible");
|
|
576
|
+
return value || DEFAULT_VALUE;
|
|
821
577
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
578
|
+
const key = "@sanity/ui/context/portal", elementKey = Symbol.for(`${key}/element`);
|
|
579
|
+
globalScope[elementKey] = null;
|
|
580
|
+
const defaultContextValue = {
|
|
581
|
+
version: 0,
|
|
582
|
+
boundaryElement: null,
|
|
583
|
+
get element() {
|
|
584
|
+
return typeof document > "u" ? null : (globalScope[elementKey] || (globalScope[elementKey] = document.createElement("div"), globalScope[elementKey].setAttribute("data-portal", ""), document.body.appendChild(globalScope[elementKey])), globalScope[elementKey]);
|
|
585
|
+
}
|
|
586
|
+
}, PortalContext = createGlobalScopedContext(key, defaultContextValue);
|
|
587
|
+
function usePortal() {
|
|
588
|
+
const value = react.useContext(PortalContext);
|
|
589
|
+
if (!value)
|
|
590
|
+
throw new Error("usePortal(): missing context value");
|
|
591
|
+
if (!isRecord(value) || value.version !== 0)
|
|
592
|
+
throw new Error("usePortal(): the context value is not compatible");
|
|
593
|
+
return value;
|
|
827
594
|
}
|
|
828
|
-
function
|
|
829
|
-
const
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
startControl,
|
|
841
|
-
endControl
|
|
842
|
-
});
|
|
843
|
-
} else
|
|
844
|
-
cmds.push({
|
|
845
|
-
type: "point",
|
|
846
|
-
...point
|
|
847
|
-
});
|
|
848
|
-
}
|
|
849
|
-
return cmds;
|
|
850
|
-
}
|
|
851
|
-
function compileCommands(cmds) {
|
|
852
|
-
return cmds.map((n, idx) => n.type === "point" ? `${idx === 0 ? "M" : "L"} ${n.x} ${n.y}` : n.type === "curve" ? `C ${n.startControl.x} ${n.startControl.y} ${n.endControl.x} ${n.endControl.y} ${n.curveEnd.x} ${n.curveEnd.y}` : "").join(" ");
|
|
595
|
+
function Portal(props) {
|
|
596
|
+
const $ = compilerRuntime.c(6), {
|
|
597
|
+
children,
|
|
598
|
+
__unstable_name: name
|
|
599
|
+
} = props, card = useCard(), portal = usePortal(), portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default;
|
|
600
|
+
if (!portalElement)
|
|
601
|
+
return null;
|
|
602
|
+
const t0 = card?.scheme || "light";
|
|
603
|
+
let t1;
|
|
604
|
+
$[0] !== children || $[1] !== t0 ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { tone: "transparent", scheme: t0, children }), $[0] = children, $[1] = t0, $[2] = t1) : t1 = $[2];
|
|
605
|
+
let t2;
|
|
606
|
+
return $[3] !== portalElement || $[4] !== t1 ? (t2 = reactDom.createPortal(t1, portalElement), $[3] = portalElement, $[4] = t1, $[5] = t2) : t2 = $[5], t2;
|
|
853
607
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
style,
|
|
864
|
-
...rest
|
|
865
|
-
} = t0, $[0] = t0, $[1] = h, $[2] = rest, $[3] = style, $[4] = t1, $[5] = t2, $[6] = w) : (h = $[1], rest = $[2], style = $[3], t1 = $[4], t2 = $[5], w = $[6]);
|
|
866
|
-
const Element = t1 === void 0 ? DEFAULT_ARROW_ELEMENT : t1, radius = t2 === void 0 ? 0 : t2, center = w / 2;
|
|
608
|
+
function PortalProvider(props) {
|
|
609
|
+
const $ = compilerRuntime.c(7), {
|
|
610
|
+
boundaryElement,
|
|
611
|
+
children,
|
|
612
|
+
element,
|
|
613
|
+
__unstable_elements: elementsProp
|
|
614
|
+
} = props, elements = useUnique(elementsProp), fallbackElement = react.useSyncExternalStore(emptySubscribe, _temp$4, _temp2$2);
|
|
615
|
+
let t0;
|
|
616
|
+
const t1 = boundaryElement || null, t2 = element || fallbackElement;
|
|
867
617
|
let t3;
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
}, {
|
|
876
|
-
x: center,
|
|
877
|
-
y: h - 1,
|
|
878
|
-
radius
|
|
879
|
-
}, {
|
|
880
|
-
x: w - radius,
|
|
881
|
-
y: 0,
|
|
882
|
-
radius
|
|
883
|
-
}, {
|
|
884
|
-
x: w,
|
|
885
|
-
y: 0
|
|
886
|
-
}], cmds = getRoundedCommands(points);
|
|
887
|
-
t3 = compileCommands(cmds);
|
|
888
|
-
const path = t3, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`;
|
|
618
|
+
$[0] !== elements || $[1] !== t1 || $[2] !== t2 ? (t3 = {
|
|
619
|
+
version: 0,
|
|
620
|
+
boundaryElement: t1,
|
|
621
|
+
element: t2,
|
|
622
|
+
elements
|
|
623
|
+
}, $[0] = elements, $[1] = t1, $[2] = t2, $[3] = t3) : t3 = $[3], t0 = t3;
|
|
624
|
+
const value = t0;
|
|
889
625
|
let t4;
|
|
890
|
-
$[
|
|
891
|
-
const t5 = `${w}px`;
|
|
892
|
-
let t6;
|
|
893
|
-
$[8] !== t5 ? (t6 = dynamic.assignInlineVars({
|
|
894
|
-
[css.vars.arrow.size]: t5
|
|
895
|
-
}), $[8] = t5, $[9] = t6) : t6 = $[9];
|
|
896
|
-
let t7;
|
|
897
|
-
$[10] !== style || $[11] !== t6 ? (t7 = {
|
|
898
|
-
...style,
|
|
899
|
-
...t6
|
|
900
|
-
}, $[10] = style, $[11] = t6, $[12] = t7) : t7 = $[12];
|
|
901
|
-
let t8;
|
|
902
|
-
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t8 = css._arrowSvg(), $[13] = t8) : t8 = $[13];
|
|
903
|
-
const t9 = `0 0 ${w} ${w}`;
|
|
904
|
-
let t10;
|
|
905
|
-
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t10 = css._arrowStrokeMask(), $[14] = t10) : t10 = $[14];
|
|
906
|
-
let t11;
|
|
907
|
-
$[15] !== w ? (t11 = /* @__PURE__ */ jsxRuntime.jsx("mask", { id: "stroke-mask", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { className: t10, x: 0, width: w, height: w, fill: "white" }) }), $[15] = w, $[16] = t11) : t11 = $[16];
|
|
908
|
-
let t12;
|
|
909
|
-
$[17] === Symbol.for("react.memo_cache_sentinel") ? (t12 = css._arrowStroke(), $[17] = t12) : t12 = $[17];
|
|
910
|
-
let t13;
|
|
911
|
-
$[18] !== strokePath ? (t13 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t12, d: strokePath, mask: "url(#stroke-mask)" }), $[18] = strokePath, $[19] = t13) : t13 = $[19];
|
|
912
|
-
let t14;
|
|
913
|
-
$[20] === Symbol.for("react.memo_cache_sentinel") ? (t14 = css._arrowShape(), $[20] = t14) : t14 = $[20];
|
|
914
|
-
let t15;
|
|
915
|
-
$[21] !== fillPath ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t14, d: fillPath }), $[21] = fillPath, $[22] = t15) : t15 = $[22];
|
|
916
|
-
let t16;
|
|
917
|
-
$[23] !== t11 || $[24] !== t13 || $[25] !== t15 || $[26] !== t9 || $[27] !== w ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: t8, width: w, height: w, viewBox: t9, children: [
|
|
918
|
-
t11,
|
|
919
|
-
t13,
|
|
920
|
-
t15
|
|
921
|
-
] }), $[23] = t11, $[24] = t13, $[25] = t15, $[26] = t9, $[27] = w, $[28] = t16) : t16 = $[28];
|
|
922
|
-
let t17;
|
|
923
|
-
return $[29] !== Element || $[30] !== rest || $[31] !== t16 || $[32] !== t7 ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(Element, { ...rest, className: t4, style: t7, children: t16 }), $[29] = Element, $[30] = rest, $[31] = t16, $[32] = t7, $[33] = t17) : t17 = $[33], t17;
|
|
626
|
+
return $[4] !== children || $[5] !== value ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(PortalContext.Provider, { value, children }), $[4] = children, $[5] = value, $[6] = t4) : t4 = $[6], t4;
|
|
924
627
|
}
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
628
|
+
function _temp2$2() {
|
|
629
|
+
return null;
|
|
630
|
+
}
|
|
631
|
+
function _temp$4() {
|
|
632
|
+
return document.body;
|
|
633
|
+
}
|
|
634
|
+
const emptySubscribe = () => () => {
|
|
928
635
|
};
|
|
929
|
-
function
|
|
930
|
-
const
|
|
931
|
-
|
|
932
|
-
throw new Error("useBoundaryElement(): the context value is not compatible");
|
|
933
|
-
return value || DEFAULT_VALUE;
|
|
636
|
+
function useUnique(value) {
|
|
637
|
+
const valueRef = react.useRef(value);
|
|
638
|
+
return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
|
|
934
639
|
}
|
|
935
|
-
function
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
return
|
|
940
|
-
}
|
|
941
|
-
function findMinBreakpoints(media2, width) {
|
|
942
|
-
const ret = [];
|
|
943
|
-
for (let i = 0; i < media2.length; i += 1)
|
|
944
|
-
media2[i] <= width && ret.push(i);
|
|
945
|
-
return ret;
|
|
946
|
-
}
|
|
947
|
-
const DEFAULT_ELEMENT_QUERY_ELEMENT = "div", DEFAULT_BREAKPOINTS = Object.values(css.BREAKPOINTS);
|
|
948
|
-
function ElementQuery(props) {
|
|
949
|
-
const $ = reactCompilerRuntime.c(21), t0 = props;
|
|
950
|
-
let children, forwardedRef, mediaProp, rest, t1;
|
|
951
|
-
$[0] !== t0 ? ({
|
|
952
|
-
as: t1,
|
|
953
|
-
children,
|
|
954
|
-
media: mediaProp,
|
|
955
|
-
ref: forwardedRef,
|
|
956
|
-
...rest
|
|
957
|
-
} = t0, $[0] = t0, $[1] = children, $[2] = forwardedRef, $[3] = mediaProp, $[4] = rest, $[5] = t1) : (children = $[1], forwardedRef = $[2], mediaProp = $[3], rest = $[4], t1 = $[5]);
|
|
958
|
-
const Element = t1 === void 0 ? DEFAULT_ELEMENT_QUERY_ELEMENT : t1, breakpoints = mediaProp ?? DEFAULT_BREAKPOINTS, [element, setElement] = react.useState(null), elementSize = useElementSize(element);
|
|
959
|
-
let t2;
|
|
960
|
-
t2 = elementSize?.border.width ?? window.innerWidth;
|
|
961
|
-
const width = t2;
|
|
962
|
-
let t3, t4;
|
|
963
|
-
if ($[6] !== breakpoints || $[7] !== width) {
|
|
964
|
-
const eq = findMaxBreakpoints(breakpoints, width);
|
|
965
|
-
t4 = eq.length ? eq.join(" ") : void 0, $[6] = breakpoints, $[7] = width, $[8] = t4;
|
|
966
|
-
} else
|
|
967
|
-
t4 = $[8];
|
|
968
|
-
t3 = t4;
|
|
969
|
-
const max = t3;
|
|
970
|
-
let t5, t6;
|
|
971
|
-
if ($[9] !== breakpoints || $[10] !== width) {
|
|
972
|
-
const eq_0 = findMinBreakpoints(breakpoints, width);
|
|
973
|
-
t6 = eq_0.length ? eq_0.join(" ") : void 0, $[9] = breakpoints, $[10] = width, $[11] = t6;
|
|
974
|
-
} else
|
|
975
|
-
t6 = $[11];
|
|
976
|
-
t5 = t6;
|
|
977
|
-
const min = t5;
|
|
978
|
-
let t7, t8;
|
|
979
|
-
$[12] !== element ? (t7 = () => element, t8 = [element], $[12] = element, $[13] = t7, $[14] = t8) : (t7 = $[13], t8 = $[14]), react.useImperativeHandle(forwardedRef, t7, t8);
|
|
980
|
-
let t9;
|
|
981
|
-
return $[15] !== Element || $[16] !== children || $[17] !== max || $[18] !== min || $[19] !== rest ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Element, { "data-ui": "ElementQuery", ...rest, "data-eq-max": max, "data-eq-min": min, ref: setElement, children }), $[15] = Element, $[16] = children, $[17] = max, $[18] = min, $[19] = rest, $[20] = t9) : t9 = $[20], t9;
|
|
640
|
+
function _isEqual(objA, objB) {
|
|
641
|
+
if (!objA || !objB)
|
|
642
|
+
return objA === objB;
|
|
643
|
+
const keysA = Object.keys(objA), keysB = Object.keys(objB);
|
|
644
|
+
return keysA.length !== keysB.length ? !1 : keysA.every((key2) => objA[key2] === objB[key2]);
|
|
982
645
|
}
|
|
983
646
|
function getLayerContext(contextValue) {
|
|
984
647
|
if (!isRecord(contextValue) || contextValue.version !== 0)
|
|
@@ -991,7 +654,7 @@ function getLayerContext(contextValue) {
|
|
|
991
654
|
}
|
|
992
655
|
const LayerContext = createGlobalScopedContext("@sanity/ui/context/layer", null);
|
|
993
656
|
function useLayer() {
|
|
994
|
-
const $ =
|
|
657
|
+
const $ = compilerRuntime.c(2), value = react.useContext(LayerContext);
|
|
995
658
|
if (!value)
|
|
996
659
|
throw new Error("useLayer(): missing context value");
|
|
997
660
|
try {
|
|
@@ -1004,7 +667,7 @@ function useLayer() {
|
|
|
1004
667
|
}
|
|
1005
668
|
const DEFAULT_LAYER_CARD_ELEMENT = "div";
|
|
1006
669
|
function LayerCard(props) {
|
|
1007
|
-
const $ =
|
|
670
|
+
const $ = compilerRuntime.c(27), t0 = props;
|
|
1008
671
|
let children, forwardedRef, onActivate, onFocus, rest, t1, t2, t3;
|
|
1009
672
|
$[0] !== t0 ? ({
|
|
1010
673
|
as: t1,
|
|
@@ -1043,8 +706,64 @@ function LayerCard(props) {
|
|
|
1043
706
|
let t10;
|
|
1044
707
|
return $[20] !== children || $[21] !== handleFocus || $[22] !== position || $[23] !== rest || $[24] !== t8 || $[25] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(Card, { "data-ui": "Layer", ...rest, as: t8, onFocus: handleFocus, position, ref, style: t9, children }), $[20] = children, $[21] = handleFocus, $[22] = position, $[23] = rest, $[24] = t8, $[25] = t9, $[26] = t10) : t10 = $[26], t10;
|
|
1045
708
|
}
|
|
709
|
+
const media = Object.values(css.BREAKPOINTS);
|
|
710
|
+
function _getMediaQuery(media2, index) {
|
|
711
|
+
return index === 0 ? `screen and (max-width: ${media2[index + 1] - 1}px)` : index === media2.length - 1 ? `screen and (min-width: ${media2[index]}px)` : `screen and (min-width: ${media2[index]}px) and (max-width: ${media2[index + 1] - 1}px)`;
|
|
712
|
+
}
|
|
713
|
+
function _createMediaStore() {
|
|
714
|
+
const mediaLen = media.length;
|
|
715
|
+
let sizes;
|
|
716
|
+
const getSizes = () => {
|
|
717
|
+
if (!sizes) {
|
|
718
|
+
sizes = [];
|
|
719
|
+
for (let index = mediaLen; index > -1; index -= 1) {
|
|
720
|
+
const mediaQuery = _getMediaQuery(media, index);
|
|
721
|
+
sizes.push({
|
|
722
|
+
index,
|
|
723
|
+
mq: window.matchMedia(mediaQuery)
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return sizes;
|
|
728
|
+
};
|
|
729
|
+
return {
|
|
730
|
+
getSnapshot: () => {
|
|
731
|
+
for (const {
|
|
732
|
+
index,
|
|
733
|
+
mq
|
|
734
|
+
} of getSizes())
|
|
735
|
+
if (mq.matches) return index;
|
|
736
|
+
return 0;
|
|
737
|
+
},
|
|
738
|
+
subscribe: (onStoreChange) => {
|
|
739
|
+
const disposeFns = [];
|
|
740
|
+
for (const {
|
|
741
|
+
mq
|
|
742
|
+
} of getSizes()) {
|
|
743
|
+
const handleChange = () => {
|
|
744
|
+
mq.matches && onStoreChange();
|
|
745
|
+
};
|
|
746
|
+
mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
|
|
747
|
+
}
|
|
748
|
+
return () => {
|
|
749
|
+
for (const disposeFn of disposeFns)
|
|
750
|
+
disposeFn();
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
function getServerSnapshot() {
|
|
756
|
+
return 0;
|
|
757
|
+
}
|
|
758
|
+
function useMediaIndex() {
|
|
759
|
+
const $ = compilerRuntime.c(1);
|
|
760
|
+
let t0, t1;
|
|
761
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = _createMediaStore(), $[0] = t1) : t1 = $[0], t0 = t1;
|
|
762
|
+
const store = t0;
|
|
763
|
+
return react.useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
|
|
764
|
+
}
|
|
1046
765
|
function LayerProvider(props) {
|
|
1047
|
-
const $ =
|
|
766
|
+
const $ = compilerRuntime.c(19), {
|
|
1048
767
|
children,
|
|
1049
768
|
zOffset: t0
|
|
1050
769
|
} = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = react.useContext(LayerContext);
|
|
@@ -1063,13 +782,13 @@ function LayerProvider(props) {
|
|
|
1063
782
|
[childLevel]: prevLen + 1
|
|
1064
783
|
};
|
|
1065
784
|
return setSize(Object.keys(nextState).length), nextState;
|
|
1066
|
-
}) : setSize(_temp$
|
|
785
|
+
}) : setSize(_temp$3), () => {
|
|
1067
786
|
childLevel !== void 0 ? setChildLayers((state_0) => {
|
|
1068
787
|
const nextState_0 = {
|
|
1069
788
|
...state_0
|
|
1070
789
|
};
|
|
1071
790
|
return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
|
|
1072
|
-
}) : setSize(_temp2$
|
|
791
|
+
}) : setSize(_temp2$1), parentDispose?.();
|
|
1073
792
|
};
|
|
1074
793
|
}, $[3] = parentRegisterChild, $[4] = setChildLayers, $[5] = t3) : t3 = $[5];
|
|
1075
794
|
const registerChild = t3;
|
|
@@ -1088,15 +807,15 @@ function LayerProvider(props) {
|
|
|
1088
807
|
let t8;
|
|
1089
808
|
return $[16] !== children || $[17] !== value ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(LayerContext.Provider, { value, children }), $[16] = children, $[17] = value, $[18] = t8) : t8 = $[18], t8;
|
|
1090
809
|
}
|
|
1091
|
-
function _temp2$
|
|
810
|
+
function _temp2$1(v_0) {
|
|
1092
811
|
return v_0 - 1;
|
|
1093
812
|
}
|
|
1094
|
-
function _temp$
|
|
813
|
+
function _temp$3(v) {
|
|
1095
814
|
return v + 1;
|
|
1096
815
|
}
|
|
1097
816
|
const DEFAULT_LAYER_ELEMENT = "div";
|
|
1098
817
|
function Layer(props) {
|
|
1099
|
-
const $ =
|
|
818
|
+
const $ = compilerRuntime.c(12), t0 = props;
|
|
1100
819
|
let children, rest, t1, t2;
|
|
1101
820
|
$[0] !== t0 ? ({
|
|
1102
821
|
as: t1,
|
|
@@ -1110,74 +829,6 @@ function Layer(props) {
|
|
|
1110
829
|
let t4;
|
|
1111
830
|
return $[9] !== t3 || $[10] !== zOffset ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(LayerProvider, { zOffset, children: t3 }), $[9] = t3, $[10] = zOffset, $[11] = t4) : t4 = $[11], t4;
|
|
1112
831
|
}
|
|
1113
|
-
const key = "@sanity/ui/context/portal", elementKey = Symbol.for(`${key}/element`);
|
|
1114
|
-
globalScope[elementKey] = null;
|
|
1115
|
-
const defaultContextValue = {
|
|
1116
|
-
version: 0,
|
|
1117
|
-
boundaryElement: null,
|
|
1118
|
-
get element() {
|
|
1119
|
-
return typeof document > "u" ? null : (globalScope[elementKey] || (globalScope[elementKey] = document.createElement("div"), globalScope[elementKey].setAttribute("data-portal", ""), document.body.appendChild(globalScope[elementKey])), globalScope[elementKey]);
|
|
1120
|
-
}
|
|
1121
|
-
}, PortalContext = createGlobalScopedContext(key, defaultContextValue);
|
|
1122
|
-
function usePortal() {
|
|
1123
|
-
const value = react.useContext(PortalContext);
|
|
1124
|
-
if (!value)
|
|
1125
|
-
throw new Error("usePortal(): missing context value");
|
|
1126
|
-
if (!isRecord(value) || value.version !== 0)
|
|
1127
|
-
throw new Error("usePortal(): the context value is not compatible");
|
|
1128
|
-
return value;
|
|
1129
|
-
}
|
|
1130
|
-
function Portal(props) {
|
|
1131
|
-
const $ = reactCompilerRuntime.c(6), {
|
|
1132
|
-
children,
|
|
1133
|
-
__unstable_name: name
|
|
1134
|
-
} = props, card = useCard(), portal = usePortal(), portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default;
|
|
1135
|
-
if (!portalElement)
|
|
1136
|
-
return null;
|
|
1137
|
-
const t0 = card?.scheme || "light";
|
|
1138
|
-
let t1;
|
|
1139
|
-
$[0] !== children || $[1] !== t0 ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { tone: "transparent", scheme: t0, children }), $[0] = children, $[1] = t0, $[2] = t1) : t1 = $[2];
|
|
1140
|
-
let t2;
|
|
1141
|
-
return $[3] !== portalElement || $[4] !== t1 ? (t2 = reactDom.createPortal(t1, portalElement), $[3] = portalElement, $[4] = t1, $[5] = t2) : t2 = $[5], t2;
|
|
1142
|
-
}
|
|
1143
|
-
function PortalProvider(props) {
|
|
1144
|
-
const $ = reactCompilerRuntime.c(7), {
|
|
1145
|
-
boundaryElement,
|
|
1146
|
-
children,
|
|
1147
|
-
element,
|
|
1148
|
-
__unstable_elements: elementsProp
|
|
1149
|
-
} = props, elements = useUnique(elementsProp), fallbackElement = react.useSyncExternalStore(emptySubscribe, _temp$1, _temp2$1);
|
|
1150
|
-
let t0;
|
|
1151
|
-
const t1 = boundaryElement || null, t2 = element || fallbackElement;
|
|
1152
|
-
let t3;
|
|
1153
|
-
$[0] !== elements || $[1] !== t1 || $[2] !== t2 ? (t3 = {
|
|
1154
|
-
version: 0,
|
|
1155
|
-
boundaryElement: t1,
|
|
1156
|
-
element: t2,
|
|
1157
|
-
elements
|
|
1158
|
-
}, $[0] = elements, $[1] = t1, $[2] = t2, $[3] = t3) : t3 = $[3], t0 = t3;
|
|
1159
|
-
const value = t0;
|
|
1160
|
-
let t4;
|
|
1161
|
-
return $[4] !== children || $[5] !== value ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(PortalContext.Provider, { value, children }), $[4] = children, $[5] = value, $[6] = t4) : t4 = $[6], t4;
|
|
1162
|
-
}
|
|
1163
|
-
function _temp2$1() {
|
|
1164
|
-
return null;
|
|
1165
|
-
}
|
|
1166
|
-
function _temp$1() {
|
|
1167
|
-
return document.body;
|
|
1168
|
-
}
|
|
1169
|
-
const emptySubscribe = () => () => {
|
|
1170
|
-
};
|
|
1171
|
-
function useUnique(value) {
|
|
1172
|
-
const valueRef = react.useRef(value);
|
|
1173
|
-
return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
|
|
1174
|
-
}
|
|
1175
|
-
function _isEqual(objA, objB) {
|
|
1176
|
-
if (!objA || !objB)
|
|
1177
|
-
return objA === objB;
|
|
1178
|
-
const keysA = Object.keys(objA), keysB = Object.keys(objB);
|
|
1179
|
-
return keysA.length !== keysB.length ? !1 : keysA.every((key2) => objA[key2] === objB[key2]);
|
|
1180
|
-
}
|
|
1181
832
|
const DEFAULT_POPOVER_DISTANCE = 4, DEFAULT_POPOVER_PADDING = 4, DEFAULT_POPOVER_ARROW_WIDTH = 19, DEFAULT_POPOVER_ARROW_HEIGHT = 8, DEFAULT_POPOVER_ARROW_RADIUS = 2, DEFAULT_POPOVER_MARGINS = [0, 0, 0, 0], DEFAULT_FALLBACK_PLACEMENTS$1 = {
|
|
1182
833
|
top: ["bottom", "left", "right"],
|
|
1183
834
|
"top-start": ["bottom-start", "left-start", "right-start"],
|
|
@@ -1233,8 +884,131 @@ function size(options) {
|
|
|
1233
884
|
}
|
|
1234
885
|
};
|
|
1235
886
|
}
|
|
887
|
+
function moveTowardsLength(movingPoint, targetPoint, amount) {
|
|
888
|
+
const width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
|
|
889
|
+
return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
|
|
890
|
+
}
|
|
891
|
+
function moveTowardsFractional(movingPoint, targetPoint, fraction) {
|
|
892
|
+
return {
|
|
893
|
+
x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
|
|
894
|
+
y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
function getRoundedCommands(points) {
|
|
898
|
+
const len = points.length, cmds = [];
|
|
899
|
+
for (let i = 0; i < len; i += 1) {
|
|
900
|
+
const point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
|
|
901
|
+
if (prevPoint && point.radius) {
|
|
902
|
+
const curveStart = moveTowardsLength(point, prevPoint, point.radius), curveEnd = moveTowardsLength(point, nextPoint, point.radius), startControl = moveTowardsFractional(curveStart, point, 0.5), endControl = moveTowardsFractional(point, curveEnd, 0.5);
|
|
903
|
+
cmds.push({
|
|
904
|
+
type: "point",
|
|
905
|
+
...curveStart
|
|
906
|
+
}), cmds.push({
|
|
907
|
+
type: "curve",
|
|
908
|
+
curveEnd,
|
|
909
|
+
startControl,
|
|
910
|
+
endControl
|
|
911
|
+
});
|
|
912
|
+
} else
|
|
913
|
+
cmds.push({
|
|
914
|
+
type: "point",
|
|
915
|
+
...point
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
return cmds;
|
|
919
|
+
}
|
|
920
|
+
function compileCommands(cmds) {
|
|
921
|
+
return cmds.map((n, idx) => n.type === "point" ? `${idx === 0 ? "M" : "L"} ${n.x} ${n.y}` : n.type === "curve" ? `C ${n.startControl.x} ${n.startControl.y} ${n.endControl.x} ${n.endControl.y} ${n.curveEnd.x} ${n.curveEnd.y}` : "").join(" ");
|
|
922
|
+
}
|
|
923
|
+
const DEFAULT_ARROW_ELEMENT = "div";
|
|
924
|
+
function Arrow(props) {
|
|
925
|
+
const $ = compilerRuntime.c(34), t0 = props;
|
|
926
|
+
let h, rest, style, t1, t2, w;
|
|
927
|
+
$[0] !== t0 ? ({
|
|
928
|
+
as: t1,
|
|
929
|
+
width: w,
|
|
930
|
+
height: h,
|
|
931
|
+
radius: t2,
|
|
932
|
+
style,
|
|
933
|
+
...rest
|
|
934
|
+
} = t0, $[0] = t0, $[1] = h, $[2] = rest, $[3] = style, $[4] = t1, $[5] = t2, $[6] = w) : (h = $[1], rest = $[2], style = $[3], t1 = $[4], t2 = $[5], w = $[6]);
|
|
935
|
+
const Element = t1 === void 0 ? DEFAULT_ARROW_ELEMENT : t1, radius = t2 === void 0 ? 0 : t2, center = w / 2;
|
|
936
|
+
let t3;
|
|
937
|
+
const points = [{
|
|
938
|
+
x: 0,
|
|
939
|
+
y: 0
|
|
940
|
+
}, {
|
|
941
|
+
x: radius,
|
|
942
|
+
y: 0,
|
|
943
|
+
radius
|
|
944
|
+
}, {
|
|
945
|
+
x: center,
|
|
946
|
+
y: h - 1,
|
|
947
|
+
radius
|
|
948
|
+
}, {
|
|
949
|
+
x: w - radius,
|
|
950
|
+
y: 0,
|
|
951
|
+
radius
|
|
952
|
+
}, {
|
|
953
|
+
x: w,
|
|
954
|
+
y: 0
|
|
955
|
+
}], cmds = getRoundedCommands(points);
|
|
956
|
+
t3 = compileCommands(cmds);
|
|
957
|
+
const path = t3, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`;
|
|
958
|
+
let t4;
|
|
959
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = css._arrow(), $[7] = t4) : t4 = $[7];
|
|
960
|
+
const t5 = `${w}px`;
|
|
961
|
+
let t6;
|
|
962
|
+
$[8] !== t5 ? (t6 = dynamic.assignInlineVars({
|
|
963
|
+
[css.vars.arrow.size]: t5
|
|
964
|
+
}), $[8] = t5, $[9] = t6) : t6 = $[9];
|
|
965
|
+
let t7;
|
|
966
|
+
$[10] !== style || $[11] !== t6 ? (t7 = {
|
|
967
|
+
...style,
|
|
968
|
+
...t6
|
|
969
|
+
}, $[10] = style, $[11] = t6, $[12] = t7) : t7 = $[12];
|
|
970
|
+
let t8;
|
|
971
|
+
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t8 = css._arrowSvg(), $[13] = t8) : t8 = $[13];
|
|
972
|
+
const t9 = `0 0 ${w} ${w}`;
|
|
973
|
+
let t10;
|
|
974
|
+
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t10 = css._arrowStrokeMask(), $[14] = t10) : t10 = $[14];
|
|
975
|
+
let t11;
|
|
976
|
+
$[15] !== w ? (t11 = /* @__PURE__ */ jsxRuntime.jsx("mask", { id: "stroke-mask", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { className: t10, x: 0, width: w, height: w, fill: "white" }) }), $[15] = w, $[16] = t11) : t11 = $[16];
|
|
977
|
+
let t12;
|
|
978
|
+
$[17] === Symbol.for("react.memo_cache_sentinel") ? (t12 = css._arrowStroke(), $[17] = t12) : t12 = $[17];
|
|
979
|
+
let t13;
|
|
980
|
+
$[18] !== strokePath ? (t13 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t12, d: strokePath, mask: "url(#stroke-mask)" }), $[18] = strokePath, $[19] = t13) : t13 = $[19];
|
|
981
|
+
let t14;
|
|
982
|
+
$[20] === Symbol.for("react.memo_cache_sentinel") ? (t14 = css._arrowShape(), $[20] = t14) : t14 = $[20];
|
|
983
|
+
let t15;
|
|
984
|
+
$[21] !== fillPath ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t14, d: fillPath }), $[21] = fillPath, $[22] = t15) : t15 = $[22];
|
|
985
|
+
let t16;
|
|
986
|
+
$[23] !== t11 || $[24] !== t13 || $[25] !== t15 || $[26] !== t9 || $[27] !== w ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: t8, width: w, height: w, viewBox: t9, children: [
|
|
987
|
+
t11,
|
|
988
|
+
t13,
|
|
989
|
+
t15
|
|
990
|
+
] }), $[23] = t11, $[24] = t13, $[25] = t15, $[26] = t9, $[27] = w, $[28] = t16) : t16 = $[28];
|
|
991
|
+
let t17;
|
|
992
|
+
return $[29] !== Element || $[30] !== rest || $[31] !== t16 || $[32] !== t7 ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(Element, { ...rest, className: t4, style: t7, children: t16 }), $[29] = Element, $[30] = rest, $[31] = t16, $[32] = t7, $[33] = t17) : t17 = $[33], t17;
|
|
993
|
+
}
|
|
994
|
+
const DEFAULT_FLEX_ELEMENT = "div";
|
|
995
|
+
function Flex(props) {
|
|
996
|
+
const $ = compilerRuntime.c(14), t0 = props;
|
|
997
|
+
let align, justify, rest, t1, t2, wrap;
|
|
998
|
+
$[0] !== t0 ? ({
|
|
999
|
+
align,
|
|
1000
|
+
as: t1,
|
|
1001
|
+
direction: t2,
|
|
1002
|
+
justify,
|
|
1003
|
+
wrap,
|
|
1004
|
+
...rest
|
|
1005
|
+
} = t0, $[0] = t0, $[1] = align, $[2] = justify, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = wrap) : (align = $[1], justify = $[2], rest = $[3], t1 = $[4], t2 = $[5], wrap = $[6]);
|
|
1006
|
+
const as = t1 === void 0 ? DEFAULT_FLEX_ELEMENT : t1, direction = t2 === void 0 ? "row" : t2;
|
|
1007
|
+
let t3;
|
|
1008
|
+
return $[7] !== align || $[8] !== as || $[9] !== direction || $[10] !== justify || $[11] !== rest || $[12] !== wrap ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Flex", ...rest, alignItems: align, as, display: "flex", flexDirection: direction, flexWrap: wrap, justifyContent: justify }), $[7] = align, $[8] = as, $[9] = direction, $[10] = justify, $[11] = rest, $[12] = wrap, $[13] = t3) : t3 = $[13], t3;
|
|
1009
|
+
}
|
|
1236
1010
|
function PopoverLayer(props) {
|
|
1237
|
-
const $ =
|
|
1011
|
+
const $ = compilerRuntime.c(65);
|
|
1238
1012
|
let animate, arrow, arrowRef, arrowX, arrowY, children, marginsProp, maxWidth, originX, originY, overflow, padding, placement, radius, referenceWidth, rest, shadow, strategy, style, t0, xProp, yProp;
|
|
1239
1013
|
$[0] !== props ? ({
|
|
1240
1014
|
__unstable_margins: marginsProp,
|
|
@@ -1309,7 +1083,7 @@ function PopoverLayer(props) {
|
|
|
1309
1083
|
}
|
|
1310
1084
|
const DEFAULT_POPOVER_ELEMENT = "div";
|
|
1311
1085
|
function ViewportOverlay() {
|
|
1312
|
-
const $ =
|
|
1086
|
+
const $ = compilerRuntime.c(2), {
|
|
1313
1087
|
zIndex
|
|
1314
1088
|
} = useLayer();
|
|
1315
1089
|
let t0;
|
|
@@ -1439,7 +1213,7 @@ function getElementRef$1(element) {
|
|
|
1439
1213
|
}
|
|
1440
1214
|
const DEFAULT_STACK_ELEMENT = "div";
|
|
1441
1215
|
function Stack(props) {
|
|
1442
|
-
const $ =
|
|
1216
|
+
const $ = compilerRuntime.c(13), t0 = props;
|
|
1443
1217
|
let className, gap, rest, space, t1;
|
|
1444
1218
|
$[0] !== t0 ? ({
|
|
1445
1219
|
as: t1,
|
|
@@ -1457,9 +1231,18 @@ function Stack(props) {
|
|
|
1457
1231
|
let t4;
|
|
1458
1232
|
return $[8] !== as || $[9] !== rest || $[10] !== t2 || $[11] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Stack", ...rest, as, gridAutoRows: "min", className: t2, display: "grid", gap: t3 }), $[8] = as, $[9] = rest, $[10] = t2, $[11] = t3, $[12] = t4) : t4 = $[12], t4;
|
|
1459
1233
|
}
|
|
1234
|
+
function useCustomValidity(ref, customValidity) {
|
|
1235
|
+
const $ = compilerRuntime.c(6);
|
|
1236
|
+
let t0;
|
|
1237
|
+
$[0] !== customValidity || $[1] !== ref.current ? (t0 = () => {
|
|
1238
|
+
ref.current?.setCustomValidity(customValidity || "");
|
|
1239
|
+
}, $[0] = customValidity, $[1] = ref.current, $[2] = t0) : t0 = $[2];
|
|
1240
|
+
let t1;
|
|
1241
|
+
$[3] !== customValidity || $[4] !== ref ? (t1 = [customValidity, ref], $[3] = customValidity, $[4] = ref, $[5] = t1) : t1 = $[5], react.useEffect(t0, t1);
|
|
1242
|
+
}
|
|
1460
1243
|
const DEFAULT_TEXT_INPUT_ELEMENT = "input";
|
|
1461
1244
|
function TextInput(props) {
|
|
1462
|
-
const $ =
|
|
1245
|
+
const $ = compilerRuntime.c(89), t0 = props;
|
|
1463
1246
|
let IconComponent, IconRightComponent, __unstable_disableFocusRing, className, clearButton, customValidity, forwardedRef, gap, onClear, prefix, readOnly, rest, suffix, t1, t2, t3, t4, t5, t6, t7, t8, width;
|
|
1464
1247
|
if ($[0] !== t0) {
|
|
1465
1248
|
const {
|
|
@@ -1493,7 +1276,7 @@ function TextInput(props) {
|
|
|
1493
1276
|
const Element = t1 === void 0 ? DEFAULT_TEXT_INPUT_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, disabled = t3 === void 0 ? !1 : t3, fontSize = t4 === void 0 ? 2 : t4, padding = t5 === void 0 ? 3 : t5, radius = t6 === void 0 ? 2 : t6, space = t7 === void 0 ? 3 : t7, type = t8 === void 0 ? "text" : t8, ref = react.useRef(null), responsivePadding = useResponsiveProp(padding), withClearButton = !!clearButton;
|
|
1494
1277
|
let t9;
|
|
1495
1278
|
$[23] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => ref.current, $[23] = t9) : t9 = $[23], react.useImperativeHandle(forwardedRef, t9), useCustomValidity(ref, customValidity);
|
|
1496
|
-
const handleClearMouseDown = _temp;
|
|
1279
|
+
const handleClearMouseDown = _temp$2;
|
|
1497
1280
|
let t10;
|
|
1498
1281
|
$[24] !== onClear ? (t10 = (event_0) => {
|
|
1499
1282
|
event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
|
|
@@ -1572,258 +1355,84 @@ function _temp2(t0) {
|
|
|
1572
1355
|
const [key2, value] = t0;
|
|
1573
1356
|
return value === 0 ? [key2, 0] : value === 1 ? [key2, 1] : value === 2 ? [key2, 1] : [key2, typeof value == "number" ? value - 2 : 0];
|
|
1574
1357
|
}
|
|
1575
|
-
function _temp(event) {
|
|
1358
|
+
function _temp$2(event) {
|
|
1576
1359
|
event.preventDefault(), event.stopPropagation();
|
|
1577
1360
|
}
|
|
1578
|
-
function
|
|
1579
|
-
const $ =
|
|
1580
|
-
let t0;
|
|
1581
|
-
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (nextState, delay) => {
|
|
1582
|
-
const action = () => {
|
|
1583
|
-
setState(nextState);
|
|
1584
|
-
};
|
|
1585
|
-
if (delayedAction.current && (clearTimeout(delayedAction.current), delayedAction.current = void 0), !delay)
|
|
1586
|
-
return action();
|
|
1587
|
-
delayedAction.current = setTimeout(action, delay);
|
|
1588
|
-
}, $[0] = t0) : t0 = $[0];
|
|
1589
|
-
const onStateChange = t0;
|
|
1361
|
+
function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
1362
|
+
const $ = compilerRuntime.c(9), elementsArg = t0 === void 0 ? _temp$1 : t0;
|
|
1590
1363
|
let t1;
|
|
1591
|
-
|
|
1364
|
+
$[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
|
|
1365
|
+
if (!listener)
|
|
1366
|
+
return;
|
|
1367
|
+
const target = evt.target;
|
|
1368
|
+
if (!(target instanceof Node))
|
|
1369
|
+
return;
|
|
1370
|
+
const resolvedBoundaryElement = boundaryElement?.();
|
|
1371
|
+
if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target))
|
|
1372
|
+
return;
|
|
1373
|
+
const elements = elementsArg().flat();
|
|
1374
|
+
for (const el of elements)
|
|
1375
|
+
if (el && (target === el || el.contains(target)))
|
|
1376
|
+
return;
|
|
1377
|
+
listener(evt);
|
|
1378
|
+
}, $[0] = boundaryElement, $[1] = elementsArg, $[2] = listener, $[3] = t1) : t1 = $[3];
|
|
1379
|
+
const onEvent = useEffectEvent.useEffectEvent(t1), hasListener = !!listener;
|
|
1380
|
+
let t2;
|
|
1381
|
+
$[4] !== hasListener || $[5] !== onEvent ? (t2 = () => {
|
|
1382
|
+
if (!hasListener)
|
|
1383
|
+
return;
|
|
1384
|
+
const handleEvent = (evt_0) => onEvent(evt_0);
|
|
1385
|
+
return document.addEventListener("mousedown", handleEvent), () => {
|
|
1386
|
+
document.removeEventListener("mousedown", handleEvent);
|
|
1387
|
+
};
|
|
1388
|
+
}, $[4] = hasListener, $[5] = onEvent, $[6] = t2) : t2 = $[6];
|
|
1389
|
+
let t3;
|
|
1390
|
+
$[7] !== hasListener ? (t3 = [hasListener], $[7] = hasListener, $[8] = t3) : t3 = $[8], react.useEffect(t2, t3), react.useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
|
|
1592
1391
|
}
|
|
1593
|
-
function
|
|
1594
|
-
|
|
1595
|
-
return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
|
|
1392
|
+
function _temp$1() {
|
|
1393
|
+
return EMPTY_ARRAY;
|
|
1596
1394
|
}
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
"
|
|
1609
|
-
"right-end": ["right", "right-start", "left-end", "top-end", "bottom-end"]
|
|
1610
|
-
}, TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/context/tooltipDelayGroup", null);
|
|
1611
|
-
function useTooltipDelayGroup() {
|
|
1612
|
-
return react.useContext(TooltipDelayGroupContext);
|
|
1395
|
+
function useGlobalKeyDown(onKeyDown) {
|
|
1396
|
+
const $ = compilerRuntime.c(5);
|
|
1397
|
+
let t0;
|
|
1398
|
+
$[0] !== onKeyDown ? (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0) : t0 = $[1];
|
|
1399
|
+
const handleKeyDown = useEffectEvent.useEffectEvent(t0);
|
|
1400
|
+
let t1;
|
|
1401
|
+
$[2] !== handleKeyDown ? (t1 = () => {
|
|
1402
|
+
const handler = (event_0) => handleKeyDown(event_0);
|
|
1403
|
+
return window.addEventListener("keydown", handler), () => window.removeEventListener("keydown", handler);
|
|
1404
|
+
}, $[2] = handleKeyDown, $[3] = t1) : t1 = $[3];
|
|
1405
|
+
let t2;
|
|
1406
|
+
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[4] = t2) : t2 = $[4], react.useEffect(t1, t2);
|
|
1613
1407
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
arrowRef,
|
|
1621
|
-
arrowX,
|
|
1622
|
-
arrowY,
|
|
1408
|
+
const DEFAULT_KBD_ELEMENT = "kbd";
|
|
1409
|
+
function KBD(props) {
|
|
1410
|
+
const $ = compilerRuntime.c(22), t0 = props;
|
|
1411
|
+
let children, className, rest, t1, t2, t3, t4, t5;
|
|
1412
|
+
$[0] !== t0 ? ({
|
|
1413
|
+
as: t1,
|
|
1623
1414
|
children,
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
radius,
|
|
1629
|
-
scheme,
|
|
1630
|
-
shadow,
|
|
1631
|
-
style,
|
|
1632
|
-
tone: t0,
|
|
1415
|
+
className,
|
|
1416
|
+
display: t2,
|
|
1417
|
+
fontSize: t3,
|
|
1418
|
+
padding: t4,
|
|
1419
|
+
radius: t5,
|
|
1633
1420
|
...rest
|
|
1634
|
-
} =
|
|
1635
|
-
const
|
|
1636
|
-
let t1;
|
|
1637
|
-
const t2 = animate ? "transform" : void 0;
|
|
1638
|
-
let t3;
|
|
1639
|
-
$[17] !== originX || $[18] !== originY || $[19] !== style || $[20] !== t2 ? (t3 = {
|
|
1640
|
-
originX,
|
|
1641
|
-
originY,
|
|
1642
|
-
willChange: t2,
|
|
1643
|
-
...style
|
|
1644
|
-
}, $[17] = originX, $[18] = originY, $[19] = style, $[20] = t2, $[21] = t3) : t3 = $[21], t1 = t3;
|
|
1645
|
-
const rootStyle = t1;
|
|
1646
|
-
let t4;
|
|
1647
|
-
const t5 = arrowX !== null ? arrowX : void 0, t6 = arrowY !== null ? arrowY : void 0;
|
|
1421
|
+
} = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = t3, $[7] = t4, $[8] = t5) : (children = $[1], className = $[2], rest = $[3], t1 = $[4], t2 = $[5], t3 = $[6], t4 = $[7], t5 = $[8]);
|
|
1422
|
+
const as = t1 === void 0 ? DEFAULT_KBD_ELEMENT : t1, display = t2 === void 0 ? "inline-block" : t2, fontSize = t3 === void 0 ? 0 : t3, padding = t4 === void 0 ? 1 : t4, radius = t5 === void 0 ? 2 : t5, t6 = as;
|
|
1648
1423
|
let t7;
|
|
1649
|
-
$[
|
|
1650
|
-
left: t5,
|
|
1651
|
-
top: t6,
|
|
1652
|
-
right: void 0,
|
|
1653
|
-
bottom: void 0
|
|
1654
|
-
}, $[22] = t5, $[23] = t6, $[24] = t7) : t7 = $[24], t4 = t7;
|
|
1655
|
-
const arrowStyle = t4, t8 = animate ? "" : void 0;
|
|
1656
|
-
let t9;
|
|
1657
|
-
$[25] !== animate ? (t9 = animate ? ["hidden", "initial"] : void 0, $[25] = animate, $[26] = t9) : t9 = $[26];
|
|
1658
|
-
let t10;
|
|
1659
|
-
$[27] !== animate ? (t10 = animate ? ["visible", "scaleIn"] : void 0, $[27] = animate, $[28] = t10) : t10 = $[28];
|
|
1660
|
-
let t11;
|
|
1661
|
-
$[29] !== animate ? (t11 = animate ? ["hidden", "scaleOut"] : void 0, $[29] = animate, $[30] = t11) : t11 = $[30];
|
|
1662
|
-
let t12;
|
|
1663
|
-
$[31] !== arrow || $[32] !== arrowRef || $[33] !== arrowStyle ? (t12 = arrow && /* @__PURE__ */ jsxRuntime.jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_TOOLTIP_ARROW_WIDTH, height: DEFAULT_TOOLTIP_ARROW_HEIGHT, radius: DEFAULT_TOOLTIP_ARROW_RADIUS }), $[31] = arrow, $[32] = arrowRef, $[33] = arrowStyle, $[34] = t12) : t12 = $[34];
|
|
1664
|
-
let t13;
|
|
1665
|
-
return $[35] !== children || $[36] !== padding || $[37] !== placement || $[38] !== radius || $[39] !== rest || $[40] !== rootStyle || $[41] !== scheme || $[42] !== shadow || $[43] !== t10 || $[44] !== t11 || $[45] !== t12 || $[46] !== t8 || $[47] !== t9 || $[48] !== tone ? (t13 = /* @__PURE__ */ jsxRuntime.jsxs(Layer, { "data-ui": "Tooltip__layer", ...rest, as: framerMotion.motion.div, "data-animate": t8, "data-placement": placement, padding, radius, scheme, shadow, style: rootStyle, variants: POPOVER_MOTION_PROPS.card, transition: POPOVER_MOTION_PROPS.transition, initial: t9, animate: t10, exit: t11, tone, children: [
|
|
1666
|
-
children,
|
|
1667
|
-
t12
|
|
1668
|
-
] }), $[35] = children, $[36] = padding, $[37] = placement, $[38] = radius, $[39] = rest, $[40] = rootStyle, $[41] = scheme, $[42] = shadow, $[43] = t10, $[44] = t11, $[45] = t12, $[46] = t8, $[47] = t9, $[48] = tone, $[49] = t13) : t13 = $[49], t13;
|
|
1669
|
-
}
|
|
1670
|
-
const DEFAULT_TOOLTIP_ELEMENT = "div";
|
|
1671
|
-
function Tooltip(props) {
|
|
1672
|
-
const boundaryElementContext = useBoundaryElement(), {
|
|
1673
|
-
animate: _animate = !1,
|
|
1674
|
-
arrow: arrowProp = !1,
|
|
1675
|
-
as = DEFAULT_TOOLTIP_ELEMENT,
|
|
1676
|
-
boundaryElement = boundaryElementContext?.element,
|
|
1677
|
-
children: childProp,
|
|
1424
|
+
$[9] !== className || $[10] !== radius ? (t7 = css.kbd({
|
|
1678
1425
|
className,
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
portal: portalProp,
|
|
1686
|
-
radius = 3,
|
|
1687
|
-
ref: forwardedRef,
|
|
1688
|
-
scheme,
|
|
1689
|
-
shadow = 2,
|
|
1690
|
-
zOffset = Z_OFFSETS.tooltip,
|
|
1691
|
-
tone = "inherit",
|
|
1692
|
-
...rest
|
|
1693
|
-
} = props, card = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, ref = react.useRef(null), [referenceElement, setReferenceElement] = react.useState(null), arrowRef = react.useRef(null), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = react.useState(0);
|
|
1694
|
-
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
1695
|
-
const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = react.useMemo(() => {
|
|
1696
|
-
const ret = [];
|
|
1697
|
-
return ret.push(reactDom$1.flip({
|
|
1698
|
-
boundary: boundaryElement || void 0,
|
|
1699
|
-
fallbackPlacements,
|
|
1700
|
-
padding: DEFAULT_TOOLTIP_PADDING,
|
|
1701
|
-
rootBoundary
|
|
1702
|
-
})), ret.push(reactDom$1.offset({
|
|
1703
|
-
mainAxis: DEFAULT_TOOLTIP_DISTANCE
|
|
1704
|
-
})), ret.push(reactDom$1.shift({
|
|
1705
|
-
boundary: boundaryElement || void 0,
|
|
1706
|
-
rootBoundary,
|
|
1707
|
-
padding: DEFAULT_TOOLTIP_PADDING
|
|
1708
|
-
})), arrowProp && ret.push(reactDom$1.arrow({
|
|
1709
|
-
element: arrowRef,
|
|
1710
|
-
padding: DEFAULT_TOOLTIP_PADDING
|
|
1711
|
-
})), animate && ret.push(origin), ret;
|
|
1712
|
-
}, [animate, arrowProp, boundaryElement, fallbackPlacements]), {
|
|
1713
|
-
floatingStyles,
|
|
1714
|
-
placement,
|
|
1715
|
-
middlewareData,
|
|
1716
|
-
refs,
|
|
1717
|
-
update
|
|
1718
|
-
} = reactDom$1.useFloating({
|
|
1719
|
-
middleware,
|
|
1720
|
-
placement: placementProp,
|
|
1721
|
-
whileElementsMounted: reactDom$1.autoUpdate,
|
|
1722
|
-
elements: {
|
|
1723
|
-
reference: referenceElement
|
|
1724
|
-
},
|
|
1725
|
-
transform: !1
|
|
1726
|
-
}), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = react.useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), {
|
|
1727
|
-
setIsGroupActive,
|
|
1728
|
-
setOpenTooltipId
|
|
1729
|
-
} = delayGroupContext || {}, showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : delay?.open || 0, closeDelayProp = typeof delay == "number" ? delay : delay?.close || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp, handleIsOpenChange = react.useCallback((open, immediate) => {
|
|
1730
|
-
if (isInsideGroup)
|
|
1731
|
-
if (open) {
|
|
1732
|
-
const groupedOpenDelay = immediate ? 0 : openDelay;
|
|
1733
|
-
setIsGroupActive?.(open, groupedOpenDelay), setOpenTooltipId?.(tooltipId, groupedOpenDelay);
|
|
1734
|
-
} else {
|
|
1735
|
-
const groupDeactivateDelay = closeDelay > 200 ? closeDelay : 200;
|
|
1736
|
-
setIsGroupActive?.(open, groupDeactivateDelay), setOpenTooltipId?.(null, immediate ? 0 : closeDelay);
|
|
1737
|
-
}
|
|
1738
|
-
else
|
|
1739
|
-
setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
|
|
1740
|
-
}, [isInsideGroup, openDelay, setIsGroupActive, setOpenTooltipId, tooltipId, closeDelay, setIsOpen]), handleBlur = react.useCallback((e) => {
|
|
1741
|
-
handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
|
|
1742
|
-
}, [childProp?.props, handleIsOpenChange]), handleClick = react.useCallback((e_0) => {
|
|
1743
|
-
handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
|
|
1744
|
-
}, [childProp?.props, handleIsOpenChange]), handleContextMenu = react.useCallback((e_1) => {
|
|
1745
|
-
handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
|
|
1746
|
-
}, [childProp?.props, handleIsOpenChange]), handleFocus = react.useCallback((e_2) => {
|
|
1747
|
-
handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
|
|
1748
|
-
}, [childProp?.props, handleIsOpenChange]), handleMouseEnter = react.useCallback((e_3) => {
|
|
1749
|
-
handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
|
|
1750
|
-
}, [childProp?.props, handleIsOpenChange]), handleMouseLeave = react.useCallback((e_4) => {
|
|
1751
|
-
handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
|
|
1752
|
-
}, [childProp?.props, handleIsOpenChange]);
|
|
1753
|
-
useCloseOnMouseLeave({
|
|
1754
|
-
handleIsOpenChange,
|
|
1755
|
-
referenceElement,
|
|
1756
|
-
showTooltip,
|
|
1757
|
-
isInsideGroup
|
|
1758
|
-
}), react.useEffect(() => {
|
|
1759
|
-
disabled && showTooltip && handleIsOpenChange(!1);
|
|
1760
|
-
}, [disabled, handleIsOpenChange, showTooltip]), react.useEffect(() => {
|
|
1761
|
-
!content && showTooltip && handleIsOpenChange(!1);
|
|
1762
|
-
}, [content, handleIsOpenChange, showTooltip]), react.useEffect(() => {
|
|
1763
|
-
if (!showTooltip) return;
|
|
1764
|
-
function handleWindowKeyDown(event) {
|
|
1765
|
-
event.key === "Escape" && handleIsOpenChange(!1, !0);
|
|
1766
|
-
}
|
|
1767
|
-
return window.addEventListener("keydown", handleWindowKeyDown), () => {
|
|
1768
|
-
window.removeEventListener("keydown", handleWindowKeyDown);
|
|
1769
|
-
};
|
|
1770
|
-
}, [handleIsOpenChange, showTooltip]), react.useLayoutEffect(() => {
|
|
1771
|
-
const availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
|
|
1772
|
-
setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2);
|
|
1773
|
-
}, [boundaryElement, portalElement]);
|
|
1774
|
-
const setArrow = react.useCallback((arrowEl) => {
|
|
1775
|
-
arrowRef.current = arrowEl, update();
|
|
1776
|
-
}, [update]), setFloating = react.useCallback((node) => {
|
|
1777
|
-
ref.current = node, refs.setFloating(node);
|
|
1778
|
-
}, [refs]), child = react.useMemo(() => childProp ? react.cloneElement(childProp, {
|
|
1779
|
-
onBlur: handleBlur,
|
|
1780
|
-
onFocus: handleFocus,
|
|
1781
|
-
onMouseEnter: handleMouseEnter,
|
|
1782
|
-
onMouseLeave: handleMouseLeave,
|
|
1783
|
-
onClick: handleClick,
|
|
1784
|
-
onContextMenu: handleContextMenu,
|
|
1785
|
-
ref: setReferenceElement
|
|
1786
|
-
}) : null, [childProp, handleBlur, handleClick, handleContextMenu, handleFocus, handleMouseEnter, handleMouseLeave]);
|
|
1787
|
-
if (react.useImperativeHandle(childProp ? getElementRef(childProp) : null, () => referenceElement, [referenceElement]), !child) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
1788
|
-
if (disabled) return child;
|
|
1789
|
-
const node_0 = /* @__PURE__ */ jsxRuntime.jsx(TooltipLayer, { "data-ui": "Tooltip", ...rest, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: css.tooltip({
|
|
1790
|
-
className
|
|
1791
|
-
}), originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, style: {
|
|
1792
|
-
...floatingStyles,
|
|
1793
|
-
maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0
|
|
1794
|
-
}, tone, zOffset, children: content }), children = showTooltip && (portalProp ? /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { tone: tone === "inherit" ? card?.tone ?? "default" : tone, scheme: scheme ?? "light", children: node_0 }) }) : node_0);
|
|
1795
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1796
|
-
animate ? /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children }) : children,
|
|
1797
|
-
child
|
|
1798
|
-
] });
|
|
1799
|
-
}
|
|
1800
|
-
function useCloseOnMouseLeave(t0) {
|
|
1801
|
-
const $ = reactCompilerRuntime.c(10), {
|
|
1802
|
-
handleIsOpenChange,
|
|
1803
|
-
referenceElement,
|
|
1804
|
-
showTooltip,
|
|
1805
|
-
isInsideGroup
|
|
1806
|
-
} = t0;
|
|
1807
|
-
let t1;
|
|
1808
|
-
$[0] !== handleIsOpenChange || $[1] !== referenceElement ? (t1 = (target, teardown) => {
|
|
1809
|
-
referenceElement && (referenceElement === target || target instanceof Node && referenceElement.contains(target) || (handleIsOpenChange(!1), teardown()));
|
|
1810
|
-
}, $[0] = handleIsOpenChange, $[1] = referenceElement, $[2] = t1) : t1 = $[2];
|
|
1811
|
-
const onMouseMove = useEffectEvent.useEffectEvent(t1);
|
|
1812
|
-
let t2;
|
|
1813
|
-
$[3] !== isInsideGroup || $[4] !== onMouseMove || $[5] !== showTooltip ? (t2 = () => {
|
|
1814
|
-
if (!showTooltip || isInsideGroup)
|
|
1815
|
-
return;
|
|
1816
|
-
const handleMouseMove = (event) => {
|
|
1817
|
-
onMouseMove(event.target, () => window.removeEventListener("mousemove", handleMouseMove));
|
|
1818
|
-
};
|
|
1819
|
-
return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
|
|
1820
|
-
}, $[3] = isInsideGroup, $[4] = onMouseMove, $[5] = showTooltip, $[6] = t2) : t2 = $[6];
|
|
1821
|
-
let t3;
|
|
1822
|
-
$[7] !== isInsideGroup || $[8] !== showTooltip ? (t3 = [isInsideGroup, showTooltip], $[7] = isInsideGroup, $[8] = showTooltip, $[9] = t3) : t3 = $[9], react.useEffect(t2, t3);
|
|
1426
|
+
radius
|
|
1427
|
+
}), $[9] = className, $[10] = radius, $[11] = t7) : t7 = $[11];
|
|
1428
|
+
let t8;
|
|
1429
|
+
$[12] !== children || $[13] !== fontSize ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Text, { as: "span", muted: !0, size: fontSize, weight: "semibold", children }), $[12] = children, $[13] = fontSize, $[14] = t8) : t8 = $[14];
|
|
1430
|
+
let t9;
|
|
1431
|
+
return $[15] !== display || $[16] !== padding || $[17] !== rest || $[18] !== t6 || $[19] !== t7 || $[20] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "KBD", ...rest, as: t6, className: t7, display, muted: !0, padding, children: t8 }), $[15] = display, $[16] = padding, $[17] = rest, $[18] = t6, $[19] = t7, $[20] = t8, $[21] = t9) : t9 = $[21], t9;
|
|
1823
1432
|
}
|
|
1824
1433
|
const DEFAULT_HOTKEYS_ELEMENT = "kbd";
|
|
1825
1434
|
function Hotkeys(props) {
|
|
1826
|
-
const $ =
|
|
1435
|
+
const $ = compilerRuntime.c(27), t0 = props;
|
|
1827
1436
|
let fontSize, gap, gapX, gapY, keys, padding, radius, rest, t1, t2;
|
|
1828
1437
|
$[0] !== t0 ? ({
|
|
1829
1438
|
as: t1,
|
|
@@ -1990,7 +1599,7 @@ function useMenuController(props) {
|
|
|
1990
1599
|
}
|
|
1991
1600
|
const DEFAULT_MENU_ELEMENT = "div";
|
|
1992
1601
|
function Menu(props) {
|
|
1993
|
-
const $ =
|
|
1602
|
+
const $ = compilerRuntime.c(58), t0 = props;
|
|
1994
1603
|
let _shouldFocus, children, className, forwardedRef, gap, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, registerElement, rest, t1, t2, t3;
|
|
1995
1604
|
if ($[0] !== t0) {
|
|
1996
1605
|
const {
|
|
@@ -2082,7 +1691,7 @@ function Menu(props) {
|
|
|
2082
1691
|
}
|
|
2083
1692
|
const DEFAULT_MENU_DIVIDER_ELEMENT = "hr";
|
|
2084
1693
|
function MenuDivider(props) {
|
|
2085
|
-
const $ =
|
|
1694
|
+
const $ = compilerRuntime.c(10), t0 = props;
|
|
2086
1695
|
let className, rest, t1;
|
|
2087
1696
|
$[0] !== t0 ? ({
|
|
2088
1697
|
as: t1,
|
|
@@ -2099,24 +1708,26 @@ function MenuDivider(props) {
|
|
|
2099
1708
|
}
|
|
2100
1709
|
const DEFAULT_SELECTABLE_ELEMENT = "button";
|
|
2101
1710
|
function Selectable(props) {
|
|
2102
|
-
const $ =
|
|
2103
|
-
let className, radius, rest, t1, tone;
|
|
1711
|
+
const $ = compilerRuntime.c(16), t0 = props;
|
|
1712
|
+
let className, radius, rest, selected, t1, tone;
|
|
2104
1713
|
$[0] !== t0 ? ({
|
|
2105
1714
|
as: t1,
|
|
2106
1715
|
className,
|
|
2107
1716
|
radius,
|
|
1717
|
+
selected,
|
|
2108
1718
|
tone,
|
|
2109
1719
|
...rest
|
|
2110
|
-
} = t0, $[0] = t0, $[1] = className, $[2] = radius, $[3] = rest, $[4] =
|
|
1720
|
+
} = t0, $[0] = t0, $[1] = className, $[2] = radius, $[3] = rest, $[4] = selected, $[5] = t1, $[6] = tone) : (className = $[1], radius = $[2], rest = $[3], selected = $[4], t1 = $[5], tone = $[6]);
|
|
2111
1721
|
const as = t1 === void 0 ? DEFAULT_SELECTABLE_ELEMENT : t1;
|
|
2112
1722
|
let t2;
|
|
2113
|
-
$[
|
|
1723
|
+
$[7] !== className || $[8] !== radius || $[9] !== tone ? (t2 = css._selectable({
|
|
2114
1724
|
className,
|
|
2115
1725
|
radius,
|
|
2116
1726
|
tone
|
|
2117
|
-
}), $[
|
|
2118
|
-
|
|
2119
|
-
|
|
1727
|
+
}), $[7] = className, $[8] = radius, $[9] = tone, $[10] = t2) : t2 = $[10];
|
|
1728
|
+
const t3 = selected ? "" : void 0;
|
|
1729
|
+
let t4;
|
|
1730
|
+
return $[11] !== as || $[12] !== rest || $[13] !== t2 || $[14] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(Box, { ...rest, as, className: t2, "data-selected": t3 }), $[11] = as, $[12] = rest, $[13] = t2, $[14] = t3, $[15] = t4) : t4 = $[15], t4;
|
|
2120
1731
|
}
|
|
2121
1732
|
function useMenu() {
|
|
2122
1733
|
const value = react.useContext(MenuContext);
|
|
@@ -2128,7 +1739,7 @@ function useMenu() {
|
|
|
2128
1739
|
}
|
|
2129
1740
|
const DEFAULT_MENU_GROUP_ELEMENT = "button";
|
|
2130
1741
|
function MenuGroup(props) {
|
|
2131
|
-
const $ =
|
|
1742
|
+
const $ = compilerRuntime.c(78), t0 = props;
|
|
2132
1743
|
let IconComponent, children, gap, menuProps, onClick, popover, rest, t1, t2, t3, t4, t5, t6, text;
|
|
2133
1744
|
$[0] !== t0 ? ({
|
|
2134
1745
|
as: t1,
|
|
@@ -2208,32 +1819,32 @@ function MenuGroup(props) {
|
|
|
2208
1819
|
return;
|
|
2209
1820
|
}
|
|
2210
1821
|
}, $[46] = t21) : t21 = $[46];
|
|
2211
|
-
const handleKeyDown = t21, t22 = as === "button" ? withinMenu : void 0, t23 = as
|
|
2212
|
-
let
|
|
2213
|
-
$[47] !== IconComponent || $[48] !== fontSize ? (
|
|
1822
|
+
const handleKeyDown = t21, t22 = as === "button" ? withinMenu : void 0, t23 = as === "button" ? "button" : void 0, t24 = gap ?? space;
|
|
1823
|
+
let t25;
|
|
1824
|
+
$[47] !== IconComponent || $[48] !== fontSize ? (t25 = IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize, children: [
|
|
2214
1825
|
react.isValidElement(IconComponent) && IconComponent,
|
|
2215
1826
|
reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
2216
|
-
] }), $[47] = IconComponent, $[48] = fontSize, $[49] =
|
|
1827
|
+
] }), $[47] = IconComponent, $[48] = fontSize, $[49] = t25) : t25 = $[49];
|
|
1828
|
+
let t26;
|
|
1829
|
+
$[50] !== fontSize || $[51] !== text ? (t26 = /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, textOverflow: "ellipsis", weight: "medium", children: text }) }), $[50] = fontSize, $[51] = text, $[52] = t26) : t26 = $[52];
|
|
1830
|
+
let t27;
|
|
1831
|
+
$[53] === Symbol.for("react.memo_cache_sentinel") ? (t27 = /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRightIcon, {}), $[53] = t27) : t27 = $[53];
|
|
2217
1832
|
let t28;
|
|
2218
|
-
$[
|
|
1833
|
+
$[54] !== fontSize ? (t28 = /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, children: t27 }), $[54] = fontSize, $[55] = t28) : t28 = $[55];
|
|
2219
1834
|
let t29;
|
|
2220
|
-
$[
|
|
1835
|
+
$[56] !== padding || $[57] !== t24 || $[58] !== t25 || $[59] !== t26 || $[60] !== t28 ? (t29 = /* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap: t24, padding, children: [
|
|
1836
|
+
t25,
|
|
1837
|
+
t26,
|
|
1838
|
+
t28
|
|
1839
|
+
] }), $[56] = padding, $[57] = t24, $[58] = t25, $[59] = t26, $[60] = t28, $[61] = t29) : t29 = $[61];
|
|
2221
1840
|
let t30;
|
|
2222
|
-
$[
|
|
1841
|
+
$[62] !== as || $[63] !== handleClick || $[64] !== handleMouseEnter || $[65] !== radius || $[66] !== rest || $[67] !== t22 || $[68] !== t23 || $[69] !== t29 || $[70] !== tone || $[71] !== withinMenu ? (t30 = /* @__PURE__ */ jsxRuntime.jsx(Selectable, { "data-ui": "MenuGroup", ...rest, "aria-pressed": t22, as, onClick: handleClick, onKeyDown: handleKeyDown, onMouseEnter: handleMouseEnter, radius, ref: setRootElement, selected: withinMenu, tabIndex: -1, tone, type: t23, children: t29 }), $[62] = as, $[63] = handleClick, $[64] = handleMouseEnter, $[65] = radius, $[66] = rest, $[67] = t22, $[68] = t23, $[69] = t29, $[70] = tone, $[71] = withinMenu, $[72] = t30) : t30 = $[72];
|
|
2223
1842
|
let t31;
|
|
2224
|
-
|
|
2225
|
-
t27,
|
|
2226
|
-
t28,
|
|
2227
|
-
t30
|
|
2228
|
-
] }), $[56] = padding, $[57] = t26, $[58] = t27, $[59] = t28, $[60] = t30, $[61] = t31) : t31 = $[61];
|
|
2229
|
-
let t32;
|
|
2230
|
-
$[62] !== as || $[63] !== handleClick || $[64] !== handleMouseEnter || $[65] !== radius || $[66] !== rest || $[67] !== t22 || $[68] !== t23 || $[69] !== t24 || $[70] !== t25 || $[71] !== t31 || $[72] !== tone ? (t32 = /* @__PURE__ */ jsxRuntime.jsx(Selectable, { "data-ui": "MenuGroup", ...rest, "aria-pressed": t22, as, "data-pressed": t23, "data-selected": t24, onClick: handleClick, onKeyDown: handleKeyDown, onMouseEnter: handleMouseEnter, radius, ref: setRootElement, tabIndex: -1, tone, type: t25, children: t31 }), $[62] = as, $[63] = handleClick, $[64] = handleMouseEnter, $[65] = radius, $[66] = rest, $[67] = t22, $[68] = t23, $[69] = t24, $[70] = t25, $[71] = t31, $[72] = tone, $[73] = t32) : t32 = $[73];
|
|
2231
|
-
let t33;
|
|
2232
|
-
return $[74] !== childMenu || $[75] !== open || $[76] !== popover || $[77] !== t32 ? (t33 = /* @__PURE__ */ jsxRuntime.jsx(Popover, { ...popover, content: childMenu, "data-ui": "MenuGroup__popover", open, children: t32 }), $[74] = childMenu, $[75] = open, $[76] = popover, $[77] = t32, $[78] = t33) : t33 = $[78], t33;
|
|
1843
|
+
return $[73] !== childMenu || $[74] !== open || $[75] !== popover || $[76] !== t30 ? (t31 = /* @__PURE__ */ jsxRuntime.jsx(Popover, { ...popover, content: childMenu, "data-ui": "MenuGroup__popover", open, children: t30 }), $[73] = childMenu, $[74] = open, $[75] = popover, $[76] = t30, $[77] = t31) : t31 = $[77], t31;
|
|
2233
1844
|
}
|
|
2234
1845
|
const DEFAULT_MENU_ITEM_ELEMENT = "button";
|
|
2235
1846
|
function MenuItem(props) {
|
|
2236
|
-
const $ =
|
|
1847
|
+
const $ = compilerRuntime.c(75), t0 = props;
|
|
2237
1848
|
let IconComponent, IconRightComponent, children, disabled, forwardedRef, gap, gapX, gapY, hotkeys, onClick, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, pressed, rest, selectedProp, t1, t2, t3, t4, t5, t6, text;
|
|
2238
1849
|
$[0] !== t0 ? ({
|
|
2239
1850
|
as: t1,
|
|
@@ -2321,7 +1932,7 @@ function MenuItem(props) {
|
|
|
2321
1932
|
}
|
|
2322
1933
|
const DEFAULT_TAB_ELEMENT = "button";
|
|
2323
1934
|
function Tab(props) {
|
|
2324
|
-
const $ =
|
|
1935
|
+
const $ = compilerRuntime.c(33), t0 = props;
|
|
2325
1936
|
let focused, forwardedRef, icon, id, label, onClick, onFocus, rest, selected, t1, t2, t3;
|
|
2326
1937
|
$[0] !== t0 ? ({
|
|
2327
1938
|
as: t1,
|
|
@@ -2360,7 +1971,7 @@ function Tab(props) {
|
|
|
2360
1971
|
}
|
|
2361
1972
|
const DEFAULT_TAB_LIST_ELEMENT = "div";
|
|
2362
1973
|
function TabList(props) {
|
|
2363
|
-
const $ =
|
|
1974
|
+
const $ = compilerRuntime.c(21), t0 = props;
|
|
2364
1975
|
let childrenProp, rest, t1, t2, t3, t4;
|
|
2365
1976
|
$[0] !== t0 ? ({
|
|
2366
1977
|
as: t1,
|
|
@@ -2394,6 +2005,271 @@ function TabList(props) {
|
|
|
2394
2005
|
function _isReactElement(node) {
|
|
2395
2006
|
return !!node;
|
|
2396
2007
|
}
|
|
2008
|
+
const DEFAULT_GRID_ELEMENT = "div";
|
|
2009
|
+
function Grid(props) {
|
|
2010
|
+
const $ = compilerRuntime.c(8), t0 = props;
|
|
2011
|
+
let children, rest, t1;
|
|
2012
|
+
$[0] !== t0 ? ({
|
|
2013
|
+
as: t1,
|
|
2014
|
+
children,
|
|
2015
|
+
...rest
|
|
2016
|
+
} = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1) : (children = $[1], rest = $[2], t1 = $[3]);
|
|
2017
|
+
const as = t1 === void 0 ? DEFAULT_GRID_ELEMENT : t1;
|
|
2018
|
+
let t2;
|
|
2019
|
+
return $[4] !== as || $[5] !== children || $[6] !== rest ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Grid", ...rest, as, display: "grid", children }), $[4] = as, $[5] = children, $[6] = rest, $[7] = t2) : t2 = $[7], t2;
|
|
2020
|
+
}
|
|
2021
|
+
function usePrefersDark(t0) {
|
|
2022
|
+
return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp : t0);
|
|
2023
|
+
}
|
|
2024
|
+
function _temp() {
|
|
2025
|
+
return !1;
|
|
2026
|
+
}
|
|
2027
|
+
function useDelayedState(initialState) {
|
|
2028
|
+
const $ = compilerRuntime.c(3), [state, setState] = react.useState(initialState), delayedAction = react.useRef(void 0);
|
|
2029
|
+
let t0;
|
|
2030
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (nextState, delay) => {
|
|
2031
|
+
const action = () => {
|
|
2032
|
+
setState(nextState);
|
|
2033
|
+
};
|
|
2034
|
+
if (delayedAction.current && (clearTimeout(delayedAction.current), delayedAction.current = void 0), !delay)
|
|
2035
|
+
return action();
|
|
2036
|
+
delayedAction.current = setTimeout(action, delay);
|
|
2037
|
+
}, $[0] = t0) : t0 = $[0];
|
|
2038
|
+
const onStateChange = t0;
|
|
2039
|
+
let t1;
|
|
2040
|
+
return $[1] !== state ? (t1 = [state, onStateChange], $[1] = state, $[2] = t1) : t1 = $[2], t1;
|
|
2041
|
+
}
|
|
2042
|
+
function getElementRef(element) {
|
|
2043
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
2044
|
+
return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
|
|
2045
|
+
}
|
|
2046
|
+
const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAULT_TOOLTIP_ARROW_RADIUS = 2, DEFAULT_TOOLTIP_DISTANCE = 4, DEFAULT_TOOLTIP_PADDING = 4, DEFAULT_FALLBACK_PLACEMENTS = {
|
|
2047
|
+
top: ["top-end", "top-start", "bottom", "left", "right"],
|
|
2048
|
+
"top-start": ["top", "top-end", "bottom-start", "left-start", "right-start"],
|
|
2049
|
+
"top-end": ["top", "top-start", "bottom-end", "left-end", "right-end"],
|
|
2050
|
+
bottom: ["bottom-end", "bottom-start", "top", "left", "right"],
|
|
2051
|
+
"bottom-start": ["bottom", "bottom-end", "top-start", "left-start", "right-start"],
|
|
2052
|
+
"bottom-end": ["bottom", "bottom-start", "top-end", "left-end", "right-end"],
|
|
2053
|
+
left: ["left-end", "left-start", "right", "top", "bottom"],
|
|
2054
|
+
"left-start": ["left", "left-end", "right-start", "top-start", "bottom-start"],
|
|
2055
|
+
"left-end": ["left", "left-start", "right-end", "top-end", "bottom-end"],
|
|
2056
|
+
right: ["right-end", "right-start", "left", "top", "bottom"],
|
|
2057
|
+
"right-start": ["right", "right-end", "left-start", "top-start", "bottom-start"],
|
|
2058
|
+
"right-end": ["right", "right-start", "left-end", "top-end", "bottom-end"]
|
|
2059
|
+
}, TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/context/tooltipDelayGroup", null);
|
|
2060
|
+
function useTooltipDelayGroup() {
|
|
2061
|
+
return react.useContext(TooltipDelayGroupContext);
|
|
2062
|
+
}
|
|
2063
|
+
function TooltipLayer(props) {
|
|
2064
|
+
const $ = compilerRuntime.c(50);
|
|
2065
|
+
let animate, arrow, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, rest, scheme, shadow, style, t0;
|
|
2066
|
+
$[0] !== props ? ({
|
|
2067
|
+
animate,
|
|
2068
|
+
arrow,
|
|
2069
|
+
arrowRef,
|
|
2070
|
+
arrowX,
|
|
2071
|
+
arrowY,
|
|
2072
|
+
children,
|
|
2073
|
+
originX,
|
|
2074
|
+
originY,
|
|
2075
|
+
padding,
|
|
2076
|
+
placement,
|
|
2077
|
+
radius,
|
|
2078
|
+
scheme,
|
|
2079
|
+
shadow,
|
|
2080
|
+
style,
|
|
2081
|
+
tone: t0,
|
|
2082
|
+
...rest
|
|
2083
|
+
} = props, $[0] = props, $[1] = animate, $[2] = arrow, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = originX, $[8] = originY, $[9] = padding, $[10] = placement, $[11] = radius, $[12] = rest, $[13] = scheme, $[14] = shadow, $[15] = style, $[16] = t0) : (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], originX = $[7], originY = $[8], padding = $[9], placement = $[10], radius = $[11], rest = $[12], scheme = $[13], shadow = $[14], style = $[15], t0 = $[16]);
|
|
2084
|
+
const tone = t0 === void 0 ? "inherit" : t0;
|
|
2085
|
+
let t1;
|
|
2086
|
+
const t2 = animate ? "transform" : void 0;
|
|
2087
|
+
let t3;
|
|
2088
|
+
$[17] !== originX || $[18] !== originY || $[19] !== style || $[20] !== t2 ? (t3 = {
|
|
2089
|
+
originX,
|
|
2090
|
+
originY,
|
|
2091
|
+
willChange: t2,
|
|
2092
|
+
...style
|
|
2093
|
+
}, $[17] = originX, $[18] = originY, $[19] = style, $[20] = t2, $[21] = t3) : t3 = $[21], t1 = t3;
|
|
2094
|
+
const rootStyle = t1;
|
|
2095
|
+
let t4;
|
|
2096
|
+
const t5 = arrowX !== null ? arrowX : void 0, t6 = arrowY !== null ? arrowY : void 0;
|
|
2097
|
+
let t7;
|
|
2098
|
+
$[22] !== t5 || $[23] !== t6 ? (t7 = {
|
|
2099
|
+
left: t5,
|
|
2100
|
+
top: t6,
|
|
2101
|
+
right: void 0,
|
|
2102
|
+
bottom: void 0
|
|
2103
|
+
}, $[22] = t5, $[23] = t6, $[24] = t7) : t7 = $[24], t4 = t7;
|
|
2104
|
+
const arrowStyle = t4, t8 = animate ? "" : void 0;
|
|
2105
|
+
let t9;
|
|
2106
|
+
$[25] !== animate ? (t9 = animate ? ["hidden", "initial"] : void 0, $[25] = animate, $[26] = t9) : t9 = $[26];
|
|
2107
|
+
let t10;
|
|
2108
|
+
$[27] !== animate ? (t10 = animate ? ["visible", "scaleIn"] : void 0, $[27] = animate, $[28] = t10) : t10 = $[28];
|
|
2109
|
+
let t11;
|
|
2110
|
+
$[29] !== animate ? (t11 = animate ? ["hidden", "scaleOut"] : void 0, $[29] = animate, $[30] = t11) : t11 = $[30];
|
|
2111
|
+
let t12;
|
|
2112
|
+
$[31] !== arrow || $[32] !== arrowRef || $[33] !== arrowStyle ? (t12 = arrow && /* @__PURE__ */ jsxRuntime.jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_TOOLTIP_ARROW_WIDTH, height: DEFAULT_TOOLTIP_ARROW_HEIGHT, radius: DEFAULT_TOOLTIP_ARROW_RADIUS }), $[31] = arrow, $[32] = arrowRef, $[33] = arrowStyle, $[34] = t12) : t12 = $[34];
|
|
2113
|
+
let t13;
|
|
2114
|
+
return $[35] !== children || $[36] !== padding || $[37] !== placement || $[38] !== radius || $[39] !== rest || $[40] !== rootStyle || $[41] !== scheme || $[42] !== shadow || $[43] !== t10 || $[44] !== t11 || $[45] !== t12 || $[46] !== t8 || $[47] !== t9 || $[48] !== tone ? (t13 = /* @__PURE__ */ jsxRuntime.jsxs(Layer, { "data-ui": "Tooltip__layer", ...rest, as: framerMotion.motion.div, "data-animate": t8, "data-placement": placement, padding, radius, scheme, shadow, style: rootStyle, variants: POPOVER_MOTION_PROPS.card, transition: POPOVER_MOTION_PROPS.transition, initial: t9, animate: t10, exit: t11, tone, children: [
|
|
2115
|
+
children,
|
|
2116
|
+
t12
|
|
2117
|
+
] }), $[35] = children, $[36] = padding, $[37] = placement, $[38] = radius, $[39] = rest, $[40] = rootStyle, $[41] = scheme, $[42] = shadow, $[43] = t10, $[44] = t11, $[45] = t12, $[46] = t8, $[47] = t9, $[48] = tone, $[49] = t13) : t13 = $[49], t13;
|
|
2118
|
+
}
|
|
2119
|
+
const DEFAULT_TOOLTIP_ELEMENT = "div";
|
|
2120
|
+
function Tooltip(props) {
|
|
2121
|
+
const boundaryElementContext = useBoundaryElement(), {
|
|
2122
|
+
animate: _animate = !1,
|
|
2123
|
+
arrow: arrowProp = !1,
|
|
2124
|
+
as = DEFAULT_TOOLTIP_ELEMENT,
|
|
2125
|
+
boundaryElement = boundaryElementContext?.element,
|
|
2126
|
+
children: childProp,
|
|
2127
|
+
className,
|
|
2128
|
+
content,
|
|
2129
|
+
delay,
|
|
2130
|
+
disabled,
|
|
2131
|
+
fallbackPlacements = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"],
|
|
2132
|
+
padding = 2,
|
|
2133
|
+
placement: placementProp = "bottom",
|
|
2134
|
+
portal: portalProp,
|
|
2135
|
+
radius = 3,
|
|
2136
|
+
ref: forwardedRef,
|
|
2137
|
+
scheme,
|
|
2138
|
+
shadow = 2,
|
|
2139
|
+
zOffset = Z_OFFSETS.tooltip,
|
|
2140
|
+
tone = "inherit",
|
|
2141
|
+
...rest
|
|
2142
|
+
} = props, card = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, ref = react.useRef(null), [referenceElement, setReferenceElement] = react.useState(null), arrowRef = react.useRef(null), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = react.useState(0);
|
|
2143
|
+
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
2144
|
+
const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = react.useMemo(() => {
|
|
2145
|
+
const ret = [];
|
|
2146
|
+
return ret.push(reactDom$1.flip({
|
|
2147
|
+
boundary: boundaryElement || void 0,
|
|
2148
|
+
fallbackPlacements,
|
|
2149
|
+
padding: DEFAULT_TOOLTIP_PADDING,
|
|
2150
|
+
rootBoundary
|
|
2151
|
+
})), ret.push(reactDom$1.offset({
|
|
2152
|
+
mainAxis: DEFAULT_TOOLTIP_DISTANCE
|
|
2153
|
+
})), ret.push(reactDom$1.shift({
|
|
2154
|
+
boundary: boundaryElement || void 0,
|
|
2155
|
+
rootBoundary,
|
|
2156
|
+
padding: DEFAULT_TOOLTIP_PADDING
|
|
2157
|
+
})), arrowProp && ret.push(reactDom$1.arrow({
|
|
2158
|
+
element: arrowRef,
|
|
2159
|
+
padding: DEFAULT_TOOLTIP_PADDING
|
|
2160
|
+
})), animate && ret.push(origin), ret;
|
|
2161
|
+
}, [animate, arrowProp, boundaryElement, fallbackPlacements]), {
|
|
2162
|
+
floatingStyles,
|
|
2163
|
+
placement,
|
|
2164
|
+
middlewareData,
|
|
2165
|
+
refs,
|
|
2166
|
+
update
|
|
2167
|
+
} = reactDom$1.useFloating({
|
|
2168
|
+
middleware,
|
|
2169
|
+
placement: placementProp,
|
|
2170
|
+
whileElementsMounted: reactDom$1.autoUpdate,
|
|
2171
|
+
elements: {
|
|
2172
|
+
reference: referenceElement
|
|
2173
|
+
},
|
|
2174
|
+
transform: !1
|
|
2175
|
+
}), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = react.useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), {
|
|
2176
|
+
setIsGroupActive,
|
|
2177
|
+
setOpenTooltipId
|
|
2178
|
+
} = delayGroupContext || {}, showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : delay?.open || 0, closeDelayProp = typeof delay == "number" ? delay : delay?.close || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp, handleIsOpenChange = react.useCallback((open, immediate) => {
|
|
2179
|
+
if (isInsideGroup)
|
|
2180
|
+
if (open) {
|
|
2181
|
+
const groupedOpenDelay = immediate ? 0 : openDelay;
|
|
2182
|
+
setIsGroupActive?.(open, groupedOpenDelay), setOpenTooltipId?.(tooltipId, groupedOpenDelay);
|
|
2183
|
+
} else {
|
|
2184
|
+
const groupDeactivateDelay = closeDelay > 200 ? closeDelay : 200;
|
|
2185
|
+
setIsGroupActive?.(open, groupDeactivateDelay), setOpenTooltipId?.(null, immediate ? 0 : closeDelay);
|
|
2186
|
+
}
|
|
2187
|
+
else
|
|
2188
|
+
setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
|
|
2189
|
+
}, [isInsideGroup, openDelay, setIsGroupActive, setOpenTooltipId, tooltipId, closeDelay, setIsOpen]), handleBlur = react.useCallback((e) => {
|
|
2190
|
+
handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
|
|
2191
|
+
}, [childProp?.props, handleIsOpenChange]), handleClick = react.useCallback((e_0) => {
|
|
2192
|
+
handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
|
|
2193
|
+
}, [childProp?.props, handleIsOpenChange]), handleContextMenu = react.useCallback((e_1) => {
|
|
2194
|
+
handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
|
|
2195
|
+
}, [childProp?.props, handleIsOpenChange]), handleFocus = react.useCallback((e_2) => {
|
|
2196
|
+
handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
|
|
2197
|
+
}, [childProp?.props, handleIsOpenChange]), handleMouseEnter = react.useCallback((e_3) => {
|
|
2198
|
+
handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
|
|
2199
|
+
}, [childProp?.props, handleIsOpenChange]), handleMouseLeave = react.useCallback((e_4) => {
|
|
2200
|
+
handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
|
|
2201
|
+
}, [childProp?.props, handleIsOpenChange]);
|
|
2202
|
+
useCloseOnMouseLeave({
|
|
2203
|
+
handleIsOpenChange,
|
|
2204
|
+
referenceElement,
|
|
2205
|
+
showTooltip,
|
|
2206
|
+
isInsideGroup
|
|
2207
|
+
}), react.useEffect(() => {
|
|
2208
|
+
disabled && showTooltip && handleIsOpenChange(!1);
|
|
2209
|
+
}, [disabled, handleIsOpenChange, showTooltip]), react.useEffect(() => {
|
|
2210
|
+
!content && showTooltip && handleIsOpenChange(!1);
|
|
2211
|
+
}, [content, handleIsOpenChange, showTooltip]), react.useEffect(() => {
|
|
2212
|
+
if (!showTooltip) return;
|
|
2213
|
+
function handleWindowKeyDown(event) {
|
|
2214
|
+
event.key === "Escape" && handleIsOpenChange(!1, !0);
|
|
2215
|
+
}
|
|
2216
|
+
return window.addEventListener("keydown", handleWindowKeyDown), () => {
|
|
2217
|
+
window.removeEventListener("keydown", handleWindowKeyDown);
|
|
2218
|
+
};
|
|
2219
|
+
}, [handleIsOpenChange, showTooltip]), react.useLayoutEffect(() => {
|
|
2220
|
+
const availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
|
|
2221
|
+
setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2);
|
|
2222
|
+
}, [boundaryElement, portalElement]);
|
|
2223
|
+
const setArrow = react.useCallback((arrowEl) => {
|
|
2224
|
+
arrowRef.current = arrowEl, update();
|
|
2225
|
+
}, [update]), setFloating = react.useCallback((node) => {
|
|
2226
|
+
ref.current = node, refs.setFloating(node);
|
|
2227
|
+
}, [refs]), child = react.useMemo(() => childProp ? react.cloneElement(childProp, {
|
|
2228
|
+
onBlur: handleBlur,
|
|
2229
|
+
onFocus: handleFocus,
|
|
2230
|
+
onMouseEnter: handleMouseEnter,
|
|
2231
|
+
onMouseLeave: handleMouseLeave,
|
|
2232
|
+
onClick: handleClick,
|
|
2233
|
+
onContextMenu: handleContextMenu,
|
|
2234
|
+
ref: setReferenceElement
|
|
2235
|
+
}) : null, [childProp, handleBlur, handleClick, handleContextMenu, handleFocus, handleMouseEnter, handleMouseLeave]);
|
|
2236
|
+
if (react.useImperativeHandle(childProp ? getElementRef(childProp) : null, () => referenceElement, [referenceElement]), !child) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
2237
|
+
if (disabled) return child;
|
|
2238
|
+
const node_0 = /* @__PURE__ */ jsxRuntime.jsx(TooltipLayer, { "data-ui": "Tooltip", ...rest, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: css.tooltip({
|
|
2239
|
+
className
|
|
2240
|
+
}), originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, style: {
|
|
2241
|
+
...floatingStyles,
|
|
2242
|
+
maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0
|
|
2243
|
+
}, tone, zOffset, children: content }), children = showTooltip && (portalProp ? /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { tone: tone === "inherit" ? card?.tone ?? "default" : tone, scheme: scheme ?? "light", children: node_0 }) }) : node_0);
|
|
2244
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2245
|
+
animate ? /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children }) : children,
|
|
2246
|
+
child
|
|
2247
|
+
] });
|
|
2248
|
+
}
|
|
2249
|
+
function useCloseOnMouseLeave(t0) {
|
|
2250
|
+
const $ = compilerRuntime.c(10), {
|
|
2251
|
+
handleIsOpenChange,
|
|
2252
|
+
referenceElement,
|
|
2253
|
+
showTooltip,
|
|
2254
|
+
isInsideGroup
|
|
2255
|
+
} = t0;
|
|
2256
|
+
let t1;
|
|
2257
|
+
$[0] !== handleIsOpenChange || $[1] !== referenceElement ? (t1 = (target, teardown) => {
|
|
2258
|
+
referenceElement && (referenceElement === target || target instanceof Node && referenceElement.contains(target) || (handleIsOpenChange(!1), teardown()));
|
|
2259
|
+
}, $[0] = handleIsOpenChange, $[1] = referenceElement, $[2] = t1) : t1 = $[2];
|
|
2260
|
+
const onMouseMove = useEffectEvent.useEffectEvent(t1);
|
|
2261
|
+
let t2;
|
|
2262
|
+
$[3] !== isInsideGroup || $[4] !== onMouseMove || $[5] !== showTooltip ? (t2 = () => {
|
|
2263
|
+
if (!showTooltip || isInsideGroup)
|
|
2264
|
+
return;
|
|
2265
|
+
const handleMouseMove = (event) => {
|
|
2266
|
+
onMouseMove(event.target, () => window.removeEventListener("mousemove", handleMouseMove));
|
|
2267
|
+
};
|
|
2268
|
+
return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
|
|
2269
|
+
}, $[3] = isInsideGroup, $[4] = onMouseMove, $[5] = showTooltip, $[6] = t2) : t2 = $[6];
|
|
2270
|
+
let t3;
|
|
2271
|
+
$[7] !== isInsideGroup || $[8] !== showTooltip ? (t3 = [isInsideGroup, showTooltip], $[7] = isInsideGroup, $[8] = showTooltip, $[9] = t3) : t3 = $[9], react.useEffect(t2, t3);
|
|
2272
|
+
}
|
|
2397
2273
|
exports.AnimatedSpinnerIcon = AnimatedSpinnerIcon;
|
|
2398
2274
|
exports.Arrow = Arrow;
|
|
2399
2275
|
exports.BoundaryElementContext = BoundaryElementContext;
|
|
@@ -2401,13 +2277,10 @@ exports.Box = Box;
|
|
|
2401
2277
|
exports.Button = Button;
|
|
2402
2278
|
exports.Card = Card;
|
|
2403
2279
|
exports.CardProvider = CardProvider;
|
|
2404
|
-
exports.Code = Code;
|
|
2405
2280
|
exports.DEFAULT_ARROW_ELEMENT = DEFAULT_ARROW_ELEMENT;
|
|
2406
2281
|
exports.DEFAULT_BOX_ELEMENT = DEFAULT_BOX_ELEMENT;
|
|
2407
2282
|
exports.DEFAULT_BUTTON_ELEMENT = DEFAULT_BUTTON_ELEMENT;
|
|
2408
2283
|
exports.DEFAULT_CARD_ELEMENT = DEFAULT_CARD_ELEMENT;
|
|
2409
|
-
exports.DEFAULT_CODE_ELEMENT = DEFAULT_CODE_ELEMENT;
|
|
2410
|
-
exports.DEFAULT_ELEMENT_QUERY_ELEMENT = DEFAULT_ELEMENT_QUERY_ELEMENT;
|
|
2411
2284
|
exports.DEFAULT_FLEX_ELEMENT = DEFAULT_FLEX_ELEMENT;
|
|
2412
2285
|
exports.DEFAULT_GRID_ELEMENT = DEFAULT_GRID_ELEMENT;
|
|
2413
2286
|
exports.DEFAULT_HOTKEYS_ELEMENT = DEFAULT_HOTKEYS_ELEMENT;
|
|
@@ -2418,6 +2291,7 @@ exports.DEFAULT_MENU_ELEMENT = DEFAULT_MENU_ELEMENT;
|
|
|
2418
2291
|
exports.DEFAULT_MENU_GROUP_ELEMENT = DEFAULT_MENU_GROUP_ELEMENT;
|
|
2419
2292
|
exports.DEFAULT_MENU_ITEM_ELEMENT = DEFAULT_MENU_ITEM_ELEMENT;
|
|
2420
2293
|
exports.DEFAULT_POPOVER_ELEMENT = DEFAULT_POPOVER_ELEMENT;
|
|
2294
|
+
exports.DEFAULT_SELECTABLE_ELEMENT = DEFAULT_SELECTABLE_ELEMENT;
|
|
2421
2295
|
exports.DEFAULT_SPINNER_ELEMENT = DEFAULT_SPINNER_ELEMENT;
|
|
2422
2296
|
exports.DEFAULT_STACK_ELEMENT = DEFAULT_STACK_ELEMENT;
|
|
2423
2297
|
exports.DEFAULT_TAB_ELEMENT = DEFAULT_TAB_ELEMENT;
|
|
@@ -2427,7 +2301,6 @@ exports.DEFAULT_TEXT_INPUT_ELEMENT = DEFAULT_TEXT_INPUT_ELEMENT;
|
|
|
2427
2301
|
exports.DEFAULT_TOOLTIP_ELEMENT = DEFAULT_TOOLTIP_ELEMENT;
|
|
2428
2302
|
exports.EMPTY_ARRAY = EMPTY_ARRAY;
|
|
2429
2303
|
exports.EMPTY_RECORD = EMPTY_RECORD;
|
|
2430
|
-
exports.ElementQuery = ElementQuery;
|
|
2431
2304
|
exports.Flex = Flex;
|
|
2432
2305
|
exports.Grid = Grid;
|
|
2433
2306
|
exports.Hotkeys = Hotkeys;
|
|
@@ -2453,8 +2326,6 @@ exports.ThemeProvider = ThemeProvider;
|
|
|
2453
2326
|
exports.Tooltip = Tooltip;
|
|
2454
2327
|
exports.TooltipDelayGroupContext = TooltipDelayGroupContext;
|
|
2455
2328
|
exports.Z_OFFSETS = Z_OFFSETS;
|
|
2456
|
-
exports._ResizeObserver = _ResizeObserver;
|
|
2457
|
-
exports._elementSizeObserver = _elementSizeObserver;
|
|
2458
2329
|
exports._getArrayProp = _getArrayProp;
|
|
2459
2330
|
exports._getResponsiveProp = _getResponsiveProp;
|
|
2460
2331
|
exports._isEnterToClickElement = _isEnterToClickElement;
|
|
@@ -2472,7 +2343,6 @@ exports.useCard = useCard;
|
|
|
2472
2343
|
exports.useClickOutsideEvent = useClickOutsideEvent;
|
|
2473
2344
|
exports.useCustomValidity = useCustomValidity;
|
|
2474
2345
|
exports.useDelayedState = useDelayedState;
|
|
2475
|
-
exports.useElementSize = useElementSize;
|
|
2476
2346
|
exports.useGlobalKeyDown = useGlobalKeyDown;
|
|
2477
2347
|
exports.useLayer = useLayer;
|
|
2478
2348
|
exports.useMatchMedia = useMatchMedia;
|