@sanity/ui 3.0.0-static.27 → 3.0.0-static.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -8
- package/dist/_chunks-cjs/_visual-editing.cjs +744 -874
- 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 +788 -917
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/refractor.js +1 -1
- package/dist/{css.cjs → css/index.cjs} +72 -53
- package/dist/css/index.cjs.map +1 -0
- package/dist/css/index.css +1 -0
- package/dist/{css.d.ts → css/index.d.cts} +26 -8
- package/dist/{css.d.cts → css/index.d.ts} +26 -8
- package/dist/{css.js → css/index.js} +72 -53
- package/dist/css/index.js.map +1 -0
- package/dist/css/layers.css +4 -0
- package/dist/css/primitives/popover/popover.css +4 -0
- package/dist/index.cjs +2049 -1811
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -26
- package/dist/index.d.ts +62 -26
- package/dist/index.js +2056 -1819
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +7 -7
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.js +7 -7
- package/dist/theme.js.map +1 -1
- package/exports/_visual-editing.ts +1 -1
- package/package.json +14 -19
- 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 +15 -19
- 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 -6
- package/src/core/components/dialog/dialogCard.tsx +89 -54
- 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 -3
- 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 +21 -17
- package/src/core/components/toast/toastLayer.tsx +3 -2
- package/src/core/components/toast/toastProvider.tsx +15 -11
- 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/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 +84 -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/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 +2 -1
- 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/primitives/layer/layer.test.tsx +1 -1
- package/src/core/primitives/layer/layer.tsx +2 -2
- package/src/core/primitives/layer/layerCard.tsx +3 -3
- package/src/core/primitives/layer/layerProvider.tsx +2 -1
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +12 -10
- 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 +7 -4
- package/src/core/primitives/popover/popoverLayer.tsx +2 -1
- package/src/core/primitives/popover/types.ts +5 -0
- package/src/core/primitives/radio/radio.tsx +2 -2
- package/src/core/primitives/root/Root.tsx +89 -0
- package/src/core/primitives/root/__workshop__/boundary.tsx +5 -0
- package/src/core/primitives/root/__workshop__/index.ts +8 -0
- package/src/core/primitives/root/index.ts +1 -0
- package/src/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/primitives/srOnly/srOnly.tsx +1 -1
- package/src/core/primitives/stack/stack.tsx +1 -1
- package/src/core/primitives/switch/switch.tsx +1 -6
- 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 +5 -3
- package/src/core/primitives/tooltip/tooltipLayer.tsx +1 -1
- 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/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/components/toast/toast.css.ts +1 -0
- package/src/css/defaultTheme.css.ts +55 -2
- package/src/css/index.ts +77 -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 +8 -4
- package/src/css/primitives/avatar/avatar.ts +1 -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.ts +4 -1
- package/src/css/primitives/label/types.ts +3 -1
- package/src/css/primitives/root/index.ts +2 -0
- package/src/css/primitives/root/root.css.ts +15 -0
- package/src/css/primitives/root/root.ts +17 -0
- package/src/css/primitives/root/types.ts +10 -0
- package/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/theme/v3/defaultFonts.ts +6 -6
- package/src/theme/v3/defaultTokens.ts +1 -1
- package/bin/sanity-ui.cjs +0 -5
- package/dist/css.cjs.map +0 -1
- package/dist/css.js.map +0 -1
- 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 -10
- 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 -30
- 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 -4
- 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/observers/{resizeObserver.ts → resize.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/{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/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,305 +162,16 @@ 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);
|
|
352
170
|
return hash !== cachedHash && setCache([_getResponsiveProp(val, defaultVal), hash]), cachedVal;
|
|
353
171
|
}
|
|
354
|
-
function moveTowardsLength(movingPoint, targetPoint, amount) {
|
|
355
|
-
const width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
|
|
356
|
-
return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
|
|
357
|
-
}
|
|
358
|
-
function moveTowardsFractional(movingPoint, targetPoint, fraction) {
|
|
359
|
-
return {
|
|
360
|
-
x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
|
|
361
|
-
y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
function getRoundedCommands(points) {
|
|
365
|
-
const len = points.length, cmds = [];
|
|
366
|
-
for (let i = 0; i < len; i += 1) {
|
|
367
|
-
const point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
|
|
368
|
-
if (prevPoint && point.radius) {
|
|
369
|
-
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);
|
|
370
|
-
cmds.push({
|
|
371
|
-
type: "point",
|
|
372
|
-
...curveStart
|
|
373
|
-
}), cmds.push({
|
|
374
|
-
type: "curve",
|
|
375
|
-
curveEnd,
|
|
376
|
-
startControl,
|
|
377
|
-
endControl
|
|
378
|
-
});
|
|
379
|
-
} else
|
|
380
|
-
cmds.push({
|
|
381
|
-
type: "point",
|
|
382
|
-
...point
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
return cmds;
|
|
386
|
-
}
|
|
387
|
-
function compileCommands(cmds) {
|
|
388
|
-
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(" ");
|
|
389
|
-
}
|
|
390
|
-
const DEFAULT_ARROW_ELEMENT = "div";
|
|
391
|
-
function Arrow(props) {
|
|
392
|
-
const $ = reactCompilerRuntime.c(34), t0 = props;
|
|
393
|
-
let h, rest, style, t1, t2, w;
|
|
394
|
-
$[0] !== t0 ? ({
|
|
395
|
-
as: t1,
|
|
396
|
-
width: w,
|
|
397
|
-
height: h,
|
|
398
|
-
radius: t2,
|
|
399
|
-
style,
|
|
400
|
-
...rest
|
|
401
|
-
} = 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]);
|
|
402
|
-
const Element = t1 === void 0 ? DEFAULT_ARROW_ELEMENT : t1, radius = t2 === void 0 ? 0 : t2, center = w / 2;
|
|
403
|
-
let t3;
|
|
404
|
-
const points = [{
|
|
405
|
-
x: 0,
|
|
406
|
-
y: 0
|
|
407
|
-
}, {
|
|
408
|
-
x: radius,
|
|
409
|
-
y: 0,
|
|
410
|
-
radius
|
|
411
|
-
}, {
|
|
412
|
-
x: center,
|
|
413
|
-
y: h - 1,
|
|
414
|
-
radius
|
|
415
|
-
}, {
|
|
416
|
-
x: w - radius,
|
|
417
|
-
y: 0,
|
|
418
|
-
radius
|
|
419
|
-
}, {
|
|
420
|
-
x: w,
|
|
421
|
-
y: 0
|
|
422
|
-
}], cmds = getRoundedCommands(points);
|
|
423
|
-
t3 = compileCommands(cmds);
|
|
424
|
-
const path = t3, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`;
|
|
425
|
-
let t4;
|
|
426
|
-
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = css._arrow(), $[7] = t4) : t4 = $[7];
|
|
427
|
-
const t5 = `${w}px`;
|
|
428
|
-
let t6;
|
|
429
|
-
$[8] !== t5 ? (t6 = dynamic.assignInlineVars({
|
|
430
|
-
[css.vars.arrow.size]: t5
|
|
431
|
-
}), $[8] = t5, $[9] = t6) : t6 = $[9];
|
|
432
|
-
let t7;
|
|
433
|
-
$[10] !== style || $[11] !== t6 ? (t7 = {
|
|
434
|
-
...style,
|
|
435
|
-
...t6
|
|
436
|
-
}, $[10] = style, $[11] = t6, $[12] = t7) : t7 = $[12];
|
|
437
|
-
let t8;
|
|
438
|
-
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t8 = css._arrowSvg(), $[13] = t8) : t8 = $[13];
|
|
439
|
-
const t9 = `0 0 ${w} ${w}`;
|
|
440
|
-
let t10;
|
|
441
|
-
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t10 = css._arrowStrokeMask(), $[14] = t10) : t10 = $[14];
|
|
442
|
-
let t11;
|
|
443
|
-
$[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];
|
|
444
|
-
let t12;
|
|
445
|
-
$[17] === Symbol.for("react.memo_cache_sentinel") ? (t12 = css._arrowStroke(), $[17] = t12) : t12 = $[17];
|
|
446
|
-
let t13;
|
|
447
|
-
$[18] !== strokePath ? (t13 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t12, d: strokePath, mask: "url(#stroke-mask)" }), $[18] = strokePath, $[19] = t13) : t13 = $[19];
|
|
448
|
-
let t14;
|
|
449
|
-
$[20] === Symbol.for("react.memo_cache_sentinel") ? (t14 = css._arrowShape(), $[20] = t14) : t14 = $[20];
|
|
450
|
-
let t15;
|
|
451
|
-
$[21] !== fillPath ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t14, d: fillPath }), $[21] = fillPath, $[22] = t15) : t15 = $[22];
|
|
452
|
-
let t16;
|
|
453
|
-
$[23] !== t11 || $[24] !== t13 || $[25] !== t15 || $[26] !== t9 || $[27] !== w ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: t8, width: w, height: w, viewBox: t9, children: [
|
|
454
|
-
t11,
|
|
455
|
-
t13,
|
|
456
|
-
t15
|
|
457
|
-
] }), $[23] = t11, $[24] = t13, $[25] = t15, $[26] = t9, $[27] = w, $[28] = t16) : t16 = $[28];
|
|
458
|
-
let t17;
|
|
459
|
-
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;
|
|
460
|
-
}
|
|
461
172
|
const DEFAULT_BOX_ELEMENT = "div";
|
|
462
173
|
function Box(props) {
|
|
463
|
-
const $ =
|
|
174
|
+
const $ = compilerRuntime.c(154), t0 = props;
|
|
464
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;
|
|
465
176
|
$[0] !== t0 ? ({
|
|
466
177
|
alignItems,
|
|
@@ -618,45 +329,70 @@ function Box(props) {
|
|
|
618
329
|
let t10;
|
|
619
330
|
return $[149] !== Element || $[150] !== children || $[151] !== rest || $[152] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(Element, { "data-ui": "Box", ...rest, className: t9, children }), $[149] = Element, $[150] = children, $[151] = rest, $[152] = t9, $[153] = t10) : t10 = $[153], t10;
|
|
620
331
|
}
|
|
621
|
-
const
|
|
622
|
-
function
|
|
623
|
-
const $ =
|
|
624
|
-
let
|
|
332
|
+
const DEFAULT_SELECTABLE_ELEMENT = "button";
|
|
333
|
+
function Selectable(props) {
|
|
334
|
+
const $ = compilerRuntime.c(16), t0 = props;
|
|
335
|
+
let className, radius, rest, selected, t1, tone;
|
|
625
336
|
$[0] !== t0 ? ({
|
|
626
|
-
accent,
|
|
627
|
-
align,
|
|
628
337
|
as: t1,
|
|
629
|
-
children,
|
|
630
338
|
className,
|
|
631
|
-
|
|
339
|
+
radius,
|
|
340
|
+
selected,
|
|
341
|
+
tone,
|
|
342
|
+
...rest
|
|
343
|
+
} = 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]);
|
|
344
|
+
const as = t1 === void 0 ? DEFAULT_SELECTABLE_ELEMENT : t1;
|
|
345
|
+
let t2;
|
|
346
|
+
$[7] !== className || $[8] !== radius || $[9] !== tone ? (t2 = css._selectable({
|
|
347
|
+
className,
|
|
348
|
+
radius,
|
|
349
|
+
tone
|
|
350
|
+
}), $[7] = className, $[8] = radius, $[9] = tone, $[10] = t2) : t2 = $[10];
|
|
351
|
+
const t3 = selected ? "" : void 0;
|
|
352
|
+
let t4;
|
|
353
|
+
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;
|
|
354
|
+
}
|
|
355
|
+
const DEFAULT_TEXT_ELEMENT = "div";
|
|
356
|
+
function Text(props) {
|
|
357
|
+
const $ = compilerRuntime.c(32), t0 = props;
|
|
358
|
+
let accent, align, children, className, flex, muted, rest, t1, t2, t3, t4, textOverflowProp;
|
|
359
|
+
$[0] !== t0 ? ({
|
|
360
|
+
accent,
|
|
361
|
+
align,
|
|
362
|
+
as: t1,
|
|
363
|
+
children,
|
|
364
|
+
className,
|
|
365
|
+
flex,
|
|
366
|
+
maxWidth: t2,
|
|
632
367
|
muted,
|
|
633
|
-
size:
|
|
368
|
+
size: t3,
|
|
634
369
|
textOverflow: textOverflowProp,
|
|
635
|
-
weight:
|
|
370
|
+
weight: t4,
|
|
636
371
|
...rest
|
|
637
|
-
} = 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],
|
|
638
|
-
const Element = t1 === void 0 ? DEFAULT_TEXT_ELEMENT : t1,
|
|
639
|
-
let
|
|
640
|
-
$[
|
|
372
|
+
} = 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]);
|
|
373
|
+
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;
|
|
374
|
+
let t5;
|
|
375
|
+
$[13] !== accent || $[14] !== align || $[15] !== className || $[16] !== flex || $[17] !== maxWidth || $[18] !== muted || $[19] !== size2 || $[20] !== weight ? (t5 = css.text({
|
|
641
376
|
className,
|
|
642
377
|
accent,
|
|
643
378
|
align,
|
|
644
379
|
flex,
|
|
380
|
+
maxWidth,
|
|
645
381
|
muted,
|
|
646
382
|
size: size2,
|
|
647
383
|
weight
|
|
648
|
-
}), $[
|
|
649
|
-
let t5;
|
|
650
|
-
$[20] !== textOverflowProp ? (t5 = css.textOverflow({
|
|
651
|
-
textOverflow: textOverflowProp
|
|
652
|
-
}), $[20] = textOverflowProp, $[21] = t5) : t5 = $[21];
|
|
384
|
+
}), $[13] = accent, $[14] = align, $[15] = className, $[16] = flex, $[17] = maxWidth, $[18] = muted, $[19] = size2, $[20] = weight, $[21] = t5) : t5 = $[21];
|
|
653
385
|
let t6;
|
|
654
|
-
$[22] !==
|
|
386
|
+
$[22] !== textOverflowProp ? (t6 = css.textOverflow({
|
|
387
|
+
textOverflow: textOverflowProp
|
|
388
|
+
}), $[22] = textOverflowProp, $[23] = t6) : t6 = $[23];
|
|
655
389
|
let t7;
|
|
656
|
-
|
|
390
|
+
$[24] !== children || $[25] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t6, children }), $[24] = children, $[25] = t6, $[26] = t7) : t7 = $[26];
|
|
391
|
+
let t8;
|
|
392
|
+
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;
|
|
657
393
|
}
|
|
658
394
|
function AnimatedSpinnerIcon(props) {
|
|
659
|
-
const $ =
|
|
395
|
+
const $ = compilerRuntime.c(5);
|
|
660
396
|
let rest;
|
|
661
397
|
$[0] !== props ? ({
|
|
662
398
|
...rest
|
|
@@ -668,7 +404,7 @@ function AnimatedSpinnerIcon(props) {
|
|
|
668
404
|
}
|
|
669
405
|
const DEFAULT_SPINNER_ELEMENT = "div";
|
|
670
406
|
function Spinner(props) {
|
|
671
|
-
const $ =
|
|
407
|
+
const $ = compilerRuntime.c(11), t0 = props;
|
|
672
408
|
let className, rest, t1;
|
|
673
409
|
$[0] !== t0 ? ({
|
|
674
410
|
as: t1,
|
|
@@ -693,7 +429,6 @@ function Button(props) {
|
|
|
693
429
|
children,
|
|
694
430
|
className,
|
|
695
431
|
disabled,
|
|
696
|
-
display = "inline-flex",
|
|
697
432
|
flex,
|
|
698
433
|
fontSize = 1,
|
|
699
434
|
gap = props.space ?? props.padding ?? 3,
|
|
@@ -733,7 +468,6 @@ function Button(props) {
|
|
|
733
468
|
...rest,
|
|
734
469
|
className: css.button({
|
|
735
470
|
className,
|
|
736
|
-
display,
|
|
737
471
|
flex,
|
|
738
472
|
mode,
|
|
739
473
|
radius,
|
|
@@ -752,7 +486,7 @@ function Button(props) {
|
|
|
752
486
|
react.isValidElement(IconComponent) && IconComponent,
|
|
753
487
|
reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
754
488
|
] }),
|
|
755
|
-
text && /* @__PURE__ */ jsxRuntime.jsx(
|
|
489
|
+
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 }) }),
|
|
756
490
|
IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
|
|
757
491
|
react.isValidElement(IconRightComponent) && IconRightComponent,
|
|
758
492
|
reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
|
|
@@ -763,12 +497,70 @@ function Button(props) {
|
|
|
763
497
|
}
|
|
764
498
|
);
|
|
765
499
|
}
|
|
500
|
+
function useMatchMedia(mediaQueryString, getServerSnapshot2) {
|
|
501
|
+
const $ = compilerRuntime.c(4);
|
|
502
|
+
react.useDebugValue(mediaQueryString);
|
|
503
|
+
let t0;
|
|
504
|
+
$[0] !== mediaQueryString ? (t0 = (onStoreChange) => {
|
|
505
|
+
const media2 = window.matchMedia(mediaQueryString);
|
|
506
|
+
return media2.addEventListener("change", onStoreChange), () => media2.removeEventListener("change", onStoreChange);
|
|
507
|
+
}, $[0] = mediaQueryString, $[1] = t0) : t0 = $[1];
|
|
508
|
+
let t1;
|
|
509
|
+
return $[2] !== mediaQueryString ? (t1 = () => window.matchMedia(mediaQueryString).matches, $[2] = mediaQueryString, $[3] = t1) : t1 = $[3], react.useSyncExternalStore(t0, t1, getServerSnapshot2);
|
|
510
|
+
}
|
|
511
|
+
function usePrefersReducedMotion(t0) {
|
|
512
|
+
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$5 : t0);
|
|
513
|
+
}
|
|
514
|
+
function _temp$5() {
|
|
515
|
+
return !1;
|
|
516
|
+
}
|
|
517
|
+
const origin = {
|
|
518
|
+
name: "@sanity/ui/origin",
|
|
519
|
+
fn({
|
|
520
|
+
middlewareData,
|
|
521
|
+
placement,
|
|
522
|
+
rects
|
|
523
|
+
}) {
|
|
524
|
+
const [side] = placement.split("-"), floatingWidth = rects.floating.width, floatingHeight = rects.floating.height, shiftX = middlewareData.shift?.x || 0, shiftY = middlewareData.shift?.y || 0;
|
|
525
|
+
if (floatingWidth <= 0 || floatingHeight <= 0)
|
|
526
|
+
return {};
|
|
527
|
+
const isVerticalPlacement = ["bottom", "top"].includes(side), {
|
|
528
|
+
originX,
|
|
529
|
+
originY
|
|
530
|
+
} = isVerticalPlacement ? {
|
|
531
|
+
originX: clamp(0.5 - shiftX / floatingWidth, 0, 1),
|
|
532
|
+
originY: side === "bottom" ? 0 : 1
|
|
533
|
+
} : {
|
|
534
|
+
originX: side === "left" ? 1 : 0,
|
|
535
|
+
originY: clamp(0.5 - shiftY / floatingHeight, 0, 1)
|
|
536
|
+
};
|
|
537
|
+
return {
|
|
538
|
+
data: {
|
|
539
|
+
originX,
|
|
540
|
+
originY
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
function clamp(num, min, max) {
|
|
546
|
+
return Math.min(Math.max(num, min), max);
|
|
547
|
+
}
|
|
548
|
+
const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/context/boundaryElement", null), DEFAULT_VALUE = {
|
|
549
|
+
version: 0,
|
|
550
|
+
element: null
|
|
551
|
+
};
|
|
552
|
+
function useBoundaryElement() {
|
|
553
|
+
const value = react.useContext(BoundaryElementContext);
|
|
554
|
+
if (value && (!isRecord(value) || value.version !== 0))
|
|
555
|
+
throw new Error("useBoundaryElement(): the context value is not compatible");
|
|
556
|
+
return value || DEFAULT_VALUE;
|
|
557
|
+
}
|
|
766
558
|
function useCard() {
|
|
767
559
|
return react.useContext(CardContext);
|
|
768
560
|
}
|
|
769
561
|
const DEFAULT_CARD_ELEMENT = "div";
|
|
770
562
|
function Card(props) {
|
|
771
|
-
const $ =
|
|
563
|
+
const $ = compilerRuntime.c(38), t0 = props;
|
|
772
564
|
let className, disabled, pressed, rest, schemeProp, selected, style, t1, t2, t3, t4, t5;
|
|
773
565
|
$[0] !== t0 ? ({
|
|
774
566
|
__unstable_checkered: t1,
|
|
@@ -806,90 +598,73 @@ function Card(props) {
|
|
|
806
598
|
}
|
|
807
599
|
return node;
|
|
808
600
|
}
|
|
809
|
-
const
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
let t4;
|
|
826
|
-
$[8] !== className || $[9] !== size2 || $[10] !== weight ? (t4 = css.code({
|
|
827
|
-
className,
|
|
828
|
-
size: size2,
|
|
829
|
-
weight
|
|
830
|
-
}), $[8] = className, $[9] = size2, $[10] = weight, $[11] = t4) : t4 = $[11];
|
|
831
|
-
let t5;
|
|
832
|
-
$[12] !== children ? (t5 = /* @__PURE__ */ jsxRuntime.jsx("code", { children }), $[12] = children, $[13] = t5) : t5 = $[13];
|
|
833
|
-
let t6;
|
|
834
|
-
$[14] !== children || $[15] !== language ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(LazyRefractor, { language, value: children }), $[14] = children, $[15] = language, $[16] = t6) : t6 = $[16];
|
|
835
|
-
let t7;
|
|
836
|
-
$[17] !== t5 || $[18] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: t5, children: t6 }), $[17] = t5, $[18] = t6, $[19] = t7) : t7 = $[19];
|
|
837
|
-
let t8;
|
|
838
|
-
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;
|
|
839
|
-
}
|
|
840
|
-
const DEFAULT_FLEX_ELEMENT = "div";
|
|
841
|
-
function Flex(props) {
|
|
842
|
-
const $ = reactCompilerRuntime.c(14), t0 = props;
|
|
843
|
-
let align, justify, rest, t1, t2, wrap;
|
|
844
|
-
$[0] !== t0 ? ({
|
|
845
|
-
align,
|
|
846
|
-
as: t1,
|
|
847
|
-
direction: t2,
|
|
848
|
-
justify,
|
|
849
|
-
wrap,
|
|
850
|
-
...rest
|
|
851
|
-
} = 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]);
|
|
852
|
-
const as = t1 === void 0 ? DEFAULT_FLEX_ELEMENT : t1, direction = t2 === void 0 ? "row" : t2;
|
|
853
|
-
let t3;
|
|
854
|
-
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;
|
|
601
|
+
const key = "@sanity/ui/context/portal", elementKey = Symbol.for(`${key}/element`);
|
|
602
|
+
globalScope[elementKey] = null;
|
|
603
|
+
const defaultContextValue = {
|
|
604
|
+
version: 0,
|
|
605
|
+
boundaryElement: null,
|
|
606
|
+
get element() {
|
|
607
|
+
return typeof document > "u" ? null : (globalScope[elementKey] || (globalScope[elementKey] = document.createElement("div"), globalScope[elementKey].setAttribute("data-portal", ""), document.body.appendChild(globalScope[elementKey])), globalScope[elementKey]);
|
|
608
|
+
}
|
|
609
|
+
}, PortalContext = createGlobalScopedContext(key, defaultContextValue);
|
|
610
|
+
function usePortal() {
|
|
611
|
+
const value = react.useContext(PortalContext);
|
|
612
|
+
if (!value)
|
|
613
|
+
throw new Error("usePortal(): missing context value");
|
|
614
|
+
if (!isRecord(value) || value.version !== 0)
|
|
615
|
+
throw new Error("usePortal(): the context value is not compatible");
|
|
616
|
+
return value;
|
|
855
617
|
}
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
const $ = reactCompilerRuntime.c(8), t0 = props;
|
|
859
|
-
let children, rest, t1;
|
|
860
|
-
$[0] !== t0 ? ({
|
|
861
|
-
as: t1,
|
|
618
|
+
function Portal(props) {
|
|
619
|
+
const $ = compilerRuntime.c(6), {
|
|
862
620
|
children,
|
|
863
|
-
|
|
864
|
-
} =
|
|
865
|
-
|
|
621
|
+
__unstable_name: name
|
|
622
|
+
} = props, card = useCard(), portal = usePortal(), portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default;
|
|
623
|
+
if (!portalElement)
|
|
624
|
+
return null;
|
|
625
|
+
const t0 = card?.scheme || "light";
|
|
626
|
+
let t1;
|
|
627
|
+
$[0] !== children || $[1] !== t0 ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { tone: "transparent", scheme: t0, children }), $[0] = children, $[1] = t0, $[2] = t1) : t1 = $[2];
|
|
866
628
|
let t2;
|
|
867
|
-
return $[
|
|
629
|
+
return $[3] !== portalElement || $[4] !== t1 ? (t2 = reactDom.createPortal(t1, portalElement), $[3] = portalElement, $[4] = t1, $[5] = t2) : t2 = $[5], t2;
|
|
868
630
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
let children, className, rest, t1, t2, t3, t4, t5;
|
|
873
|
-
$[0] !== t0 ? ({
|
|
874
|
-
as: t1,
|
|
631
|
+
function PortalProvider(props) {
|
|
632
|
+
const $ = compilerRuntime.c(7), {
|
|
633
|
+
boundaryElement,
|
|
875
634
|
children,
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
let
|
|
890
|
-
$[
|
|
891
|
-
|
|
892
|
-
|
|
635
|
+
element,
|
|
636
|
+
__unstable_elements: elementsProp
|
|
637
|
+
} = props, elements = useUnique(elementsProp), fallbackElement = react.useSyncExternalStore(emptySubscribe, _temp$4, _temp2$2);
|
|
638
|
+
let t0;
|
|
639
|
+
const t1 = boundaryElement || null, t2 = element || fallbackElement;
|
|
640
|
+
let t3;
|
|
641
|
+
$[0] !== elements || $[1] !== t1 || $[2] !== t2 ? (t3 = {
|
|
642
|
+
version: 0,
|
|
643
|
+
boundaryElement: t1,
|
|
644
|
+
element: t2,
|
|
645
|
+
elements
|
|
646
|
+
}, $[0] = elements, $[1] = t1, $[2] = t2, $[3] = t3) : t3 = $[3], t0 = t3;
|
|
647
|
+
const value = t0;
|
|
648
|
+
let t4;
|
|
649
|
+
return $[4] !== children || $[5] !== value ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(PortalContext.Provider, { value, children }), $[4] = children, $[5] = value, $[6] = t4) : t4 = $[6], t4;
|
|
650
|
+
}
|
|
651
|
+
function _temp2$2() {
|
|
652
|
+
return null;
|
|
653
|
+
}
|
|
654
|
+
function _temp$4() {
|
|
655
|
+
return document.body;
|
|
656
|
+
}
|
|
657
|
+
const emptySubscribe = () => () => {
|
|
658
|
+
};
|
|
659
|
+
function useUnique(value) {
|
|
660
|
+
const valueRef = react.useRef(value);
|
|
661
|
+
return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
|
|
662
|
+
}
|
|
663
|
+
function _isEqual(objA, objB) {
|
|
664
|
+
if (!objA || !objB)
|
|
665
|
+
return objA === objB;
|
|
666
|
+
const keysA = Object.keys(objA), keysB = Object.keys(objB);
|
|
667
|
+
return keysA.length !== keysB.length ? !1 : keysA.every((key2) => objA[key2] === objB[key2]);
|
|
893
668
|
}
|
|
894
669
|
function getLayerContext(contextValue) {
|
|
895
670
|
if (!isRecord(contextValue) || contextValue.version !== 0)
|
|
@@ -902,7 +677,7 @@ function getLayerContext(contextValue) {
|
|
|
902
677
|
}
|
|
903
678
|
const LayerContext = createGlobalScopedContext("@sanity/ui/context/layer", null);
|
|
904
679
|
function useLayer() {
|
|
905
|
-
const $ =
|
|
680
|
+
const $ = compilerRuntime.c(2), value = react.useContext(LayerContext);
|
|
906
681
|
if (!value)
|
|
907
682
|
throw new Error("useLayer(): missing context value");
|
|
908
683
|
try {
|
|
@@ -915,7 +690,7 @@ function useLayer() {
|
|
|
915
690
|
}
|
|
916
691
|
const DEFAULT_LAYER_CARD_ELEMENT = "div";
|
|
917
692
|
function LayerCard(props) {
|
|
918
|
-
const $ =
|
|
693
|
+
const $ = compilerRuntime.c(27), t0 = props;
|
|
919
694
|
let children, forwardedRef, onActivate, onFocus, rest, t1, t2, t3;
|
|
920
695
|
$[0] !== t0 ? ({
|
|
921
696
|
as: t1,
|
|
@@ -954,8 +729,64 @@ function LayerCard(props) {
|
|
|
954
729
|
let t10;
|
|
955
730
|
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;
|
|
956
731
|
}
|
|
732
|
+
const media = Object.values(css.BREAKPOINTS);
|
|
733
|
+
function _getMediaQuery(media2, index) {
|
|
734
|
+
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)`;
|
|
735
|
+
}
|
|
736
|
+
function _createMediaStore() {
|
|
737
|
+
const mediaLen = media.length;
|
|
738
|
+
let sizes;
|
|
739
|
+
const getSizes = () => {
|
|
740
|
+
if (!sizes) {
|
|
741
|
+
sizes = [];
|
|
742
|
+
for (let index = mediaLen; index > -1; index -= 1) {
|
|
743
|
+
const mediaQuery = _getMediaQuery(media, index);
|
|
744
|
+
sizes.push({
|
|
745
|
+
index,
|
|
746
|
+
mq: window.matchMedia(mediaQuery)
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
return sizes;
|
|
751
|
+
};
|
|
752
|
+
return {
|
|
753
|
+
getSnapshot: () => {
|
|
754
|
+
for (const {
|
|
755
|
+
index,
|
|
756
|
+
mq
|
|
757
|
+
} of getSizes())
|
|
758
|
+
if (mq.matches) return index;
|
|
759
|
+
return 0;
|
|
760
|
+
},
|
|
761
|
+
subscribe: (onStoreChange) => {
|
|
762
|
+
const disposeFns = [];
|
|
763
|
+
for (const {
|
|
764
|
+
mq
|
|
765
|
+
} of getSizes()) {
|
|
766
|
+
const handleChange = () => {
|
|
767
|
+
mq.matches && onStoreChange();
|
|
768
|
+
};
|
|
769
|
+
mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
|
|
770
|
+
}
|
|
771
|
+
return () => {
|
|
772
|
+
for (const disposeFn of disposeFns)
|
|
773
|
+
disposeFn();
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
function getServerSnapshot() {
|
|
779
|
+
return 0;
|
|
780
|
+
}
|
|
781
|
+
function useMediaIndex() {
|
|
782
|
+
const $ = compilerRuntime.c(1);
|
|
783
|
+
let t0, t1;
|
|
784
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = _createMediaStore(), $[0] = t1) : t1 = $[0], t0 = t1;
|
|
785
|
+
const store = t0;
|
|
786
|
+
return react.useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
|
|
787
|
+
}
|
|
957
788
|
function LayerProvider(props) {
|
|
958
|
-
const $ =
|
|
789
|
+
const $ = compilerRuntime.c(19), {
|
|
959
790
|
children,
|
|
960
791
|
zOffset: t0
|
|
961
792
|
} = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = react.useContext(LayerContext);
|
|
@@ -974,13 +805,13 @@ function LayerProvider(props) {
|
|
|
974
805
|
[childLevel]: prevLen + 1
|
|
975
806
|
};
|
|
976
807
|
return setSize(Object.keys(nextState).length), nextState;
|
|
977
|
-
}) : setSize(_temp$
|
|
808
|
+
}) : setSize(_temp$3), () => {
|
|
978
809
|
childLevel !== void 0 ? setChildLayers((state_0) => {
|
|
979
810
|
const nextState_0 = {
|
|
980
811
|
...state_0
|
|
981
812
|
};
|
|
982
813
|
return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
|
|
983
|
-
}) : setSize(_temp2$
|
|
814
|
+
}) : setSize(_temp2$1), parentDispose?.();
|
|
984
815
|
};
|
|
985
816
|
}, $[3] = parentRegisterChild, $[4] = setChildLayers, $[5] = t3) : t3 = $[5];
|
|
986
817
|
const registerChild = t3;
|
|
@@ -999,15 +830,15 @@ function LayerProvider(props) {
|
|
|
999
830
|
let t8;
|
|
1000
831
|
return $[16] !== children || $[17] !== value ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(LayerContext.Provider, { value, children }), $[16] = children, $[17] = value, $[18] = t8) : t8 = $[18], t8;
|
|
1001
832
|
}
|
|
1002
|
-
function _temp2$
|
|
833
|
+
function _temp2$1(v_0) {
|
|
1003
834
|
return v_0 - 1;
|
|
1004
835
|
}
|
|
1005
|
-
function _temp$
|
|
836
|
+
function _temp$3(v) {
|
|
1006
837
|
return v + 1;
|
|
1007
838
|
}
|
|
1008
839
|
const DEFAULT_LAYER_ELEMENT = "div";
|
|
1009
840
|
function Layer(props) {
|
|
1010
|
-
const $ =
|
|
841
|
+
const $ = compilerRuntime.c(12), t0 = props;
|
|
1011
842
|
let children, rest, t1, t2;
|
|
1012
843
|
$[0] !== t0 ? ({
|
|
1013
844
|
as: t1,
|
|
@@ -1021,163 +852,6 @@ function Layer(props) {
|
|
|
1021
852
|
let t4;
|
|
1022
853
|
return $[9] !== t3 || $[10] !== zOffset ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(LayerProvider, { zOffset, children: t3 }), $[9] = t3, $[10] = zOffset, $[11] = t4) : t4 = $[11], t4;
|
|
1023
854
|
}
|
|
1024
|
-
const origin = {
|
|
1025
|
-
name: "@sanity/ui/origin",
|
|
1026
|
-
fn({
|
|
1027
|
-
middlewareData,
|
|
1028
|
-
placement,
|
|
1029
|
-
rects
|
|
1030
|
-
}) {
|
|
1031
|
-
const [side] = placement.split("-"), floatingWidth = rects.floating.width, floatingHeight = rects.floating.height, shiftX = middlewareData.shift?.x || 0, shiftY = middlewareData.shift?.y || 0;
|
|
1032
|
-
if (floatingWidth <= 0 || floatingHeight <= 0)
|
|
1033
|
-
return {};
|
|
1034
|
-
const isVerticalPlacement = ["bottom", "top"].includes(side), {
|
|
1035
|
-
originX,
|
|
1036
|
-
originY
|
|
1037
|
-
} = isVerticalPlacement ? {
|
|
1038
|
-
originX: clamp(0.5 - shiftX / floatingWidth, 0, 1),
|
|
1039
|
-
originY: side === "bottom" ? 0 : 1
|
|
1040
|
-
} : {
|
|
1041
|
-
originX: side === "left" ? 1 : 0,
|
|
1042
|
-
originY: clamp(0.5 - shiftY / floatingHeight, 0, 1)
|
|
1043
|
-
};
|
|
1044
|
-
return {
|
|
1045
|
-
data: {
|
|
1046
|
-
originX,
|
|
1047
|
-
originY
|
|
1048
|
-
}
|
|
1049
|
-
};
|
|
1050
|
-
}
|
|
1051
|
-
};
|
|
1052
|
-
function clamp(num, min, max) {
|
|
1053
|
-
return Math.min(Math.max(num, min), max);
|
|
1054
|
-
}
|
|
1055
|
-
const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/context/boundaryElement", null), DEFAULT_VALUE = {
|
|
1056
|
-
version: 0,
|
|
1057
|
-
element: null
|
|
1058
|
-
};
|
|
1059
|
-
function useBoundaryElement() {
|
|
1060
|
-
const value = react.useContext(BoundaryElementContext);
|
|
1061
|
-
if (value && (!isRecord(value) || value.version !== 0))
|
|
1062
|
-
throw new Error("useBoundaryElement(): the context value is not compatible");
|
|
1063
|
-
return value || DEFAULT_VALUE;
|
|
1064
|
-
}
|
|
1065
|
-
function findMaxBreakpoints(media2, width) {
|
|
1066
|
-
const ret = [];
|
|
1067
|
-
for (let i = 0; i < media2.length; i += 1)
|
|
1068
|
-
media2[i] > width && ret.push(i);
|
|
1069
|
-
return ret;
|
|
1070
|
-
}
|
|
1071
|
-
function findMinBreakpoints(media2, width) {
|
|
1072
|
-
const ret = [];
|
|
1073
|
-
for (let i = 0; i < media2.length; i += 1)
|
|
1074
|
-
media2[i] <= width && ret.push(i);
|
|
1075
|
-
return ret;
|
|
1076
|
-
}
|
|
1077
|
-
const DEFAULT_ELEMENT_QUERY_ELEMENT = "div", DEFAULT_BREAKPOINTS = Object.values(css.BREAKPOINTS);
|
|
1078
|
-
function ElementQuery(props) {
|
|
1079
|
-
const $ = reactCompilerRuntime.c(21), t0 = props;
|
|
1080
|
-
let children, forwardedRef, mediaProp, rest, t1;
|
|
1081
|
-
$[0] !== t0 ? ({
|
|
1082
|
-
as: t1,
|
|
1083
|
-
children,
|
|
1084
|
-
media: mediaProp,
|
|
1085
|
-
ref: forwardedRef,
|
|
1086
|
-
...rest
|
|
1087
|
-
} = t0, $[0] = t0, $[1] = children, $[2] = forwardedRef, $[3] = mediaProp, $[4] = rest, $[5] = t1) : (children = $[1], forwardedRef = $[2], mediaProp = $[3], rest = $[4], t1 = $[5]);
|
|
1088
|
-
const Element = t1 === void 0 ? DEFAULT_ELEMENT_QUERY_ELEMENT : t1, breakpoints = mediaProp ?? DEFAULT_BREAKPOINTS, [element, setElement] = react.useState(null), elementSize = useElementSize(element);
|
|
1089
|
-
let t2;
|
|
1090
|
-
t2 = elementSize?.border.width ?? window.innerWidth;
|
|
1091
|
-
const width = t2;
|
|
1092
|
-
let t3, t4;
|
|
1093
|
-
if ($[6] !== breakpoints || $[7] !== width) {
|
|
1094
|
-
const eq = findMaxBreakpoints(breakpoints, width);
|
|
1095
|
-
t4 = eq.length ? eq.join(" ") : void 0, $[6] = breakpoints, $[7] = width, $[8] = t4;
|
|
1096
|
-
} else
|
|
1097
|
-
t4 = $[8];
|
|
1098
|
-
t3 = t4;
|
|
1099
|
-
const max = t3;
|
|
1100
|
-
let t5, t6;
|
|
1101
|
-
if ($[9] !== breakpoints || $[10] !== width) {
|
|
1102
|
-
const eq_0 = findMinBreakpoints(breakpoints, width);
|
|
1103
|
-
t6 = eq_0.length ? eq_0.join(" ") : void 0, $[9] = breakpoints, $[10] = width, $[11] = t6;
|
|
1104
|
-
} else
|
|
1105
|
-
t6 = $[11];
|
|
1106
|
-
t5 = t6;
|
|
1107
|
-
const min = t5;
|
|
1108
|
-
let t7, t8;
|
|
1109
|
-
$[12] !== element ? (t7 = () => element, t8 = [element], $[12] = element, $[13] = t7, $[14] = t8) : (t7 = $[13], t8 = $[14]), react.useImperativeHandle(forwardedRef, t7, t8);
|
|
1110
|
-
let t9;
|
|
1111
|
-
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;
|
|
1112
|
-
}
|
|
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
855
|
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
856
|
top: ["bottom", "left", "right"],
|
|
1183
857
|
"top-start": ["bottom-start", "left-start", "right-start"],
|
|
@@ -1233,8 +907,131 @@ function size(options) {
|
|
|
1233
907
|
}
|
|
1234
908
|
};
|
|
1235
909
|
}
|
|
910
|
+
function moveTowardsLength(movingPoint, targetPoint, amount) {
|
|
911
|
+
const width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
|
|
912
|
+
return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
|
|
913
|
+
}
|
|
914
|
+
function moveTowardsFractional(movingPoint, targetPoint, fraction) {
|
|
915
|
+
return {
|
|
916
|
+
x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
|
|
917
|
+
y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
function getRoundedCommands(points) {
|
|
921
|
+
const len = points.length, cmds = [];
|
|
922
|
+
for (let i = 0; i < len; i += 1) {
|
|
923
|
+
const point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
|
|
924
|
+
if (prevPoint && point.radius) {
|
|
925
|
+
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);
|
|
926
|
+
cmds.push({
|
|
927
|
+
type: "point",
|
|
928
|
+
...curveStart
|
|
929
|
+
}), cmds.push({
|
|
930
|
+
type: "curve",
|
|
931
|
+
curveEnd,
|
|
932
|
+
startControl,
|
|
933
|
+
endControl
|
|
934
|
+
});
|
|
935
|
+
} else
|
|
936
|
+
cmds.push({
|
|
937
|
+
type: "point",
|
|
938
|
+
...point
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
return cmds;
|
|
942
|
+
}
|
|
943
|
+
function compileCommands(cmds) {
|
|
944
|
+
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(" ");
|
|
945
|
+
}
|
|
946
|
+
const DEFAULT_ARROW_ELEMENT = "div";
|
|
947
|
+
function Arrow(props) {
|
|
948
|
+
const $ = compilerRuntime.c(34), t0 = props;
|
|
949
|
+
let h, rest, style, t1, t2, w;
|
|
950
|
+
$[0] !== t0 ? ({
|
|
951
|
+
as: t1,
|
|
952
|
+
width: w,
|
|
953
|
+
height: h,
|
|
954
|
+
radius: t2,
|
|
955
|
+
style,
|
|
956
|
+
...rest
|
|
957
|
+
} = 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]);
|
|
958
|
+
const Element = t1 === void 0 ? DEFAULT_ARROW_ELEMENT : t1, radius = t2 === void 0 ? 0 : t2, center = w / 2;
|
|
959
|
+
let t3;
|
|
960
|
+
const points = [{
|
|
961
|
+
x: 0,
|
|
962
|
+
y: 0
|
|
963
|
+
}, {
|
|
964
|
+
x: radius,
|
|
965
|
+
y: 0,
|
|
966
|
+
radius
|
|
967
|
+
}, {
|
|
968
|
+
x: center,
|
|
969
|
+
y: h - 1,
|
|
970
|
+
radius
|
|
971
|
+
}, {
|
|
972
|
+
x: w - radius,
|
|
973
|
+
y: 0,
|
|
974
|
+
radius
|
|
975
|
+
}, {
|
|
976
|
+
x: w,
|
|
977
|
+
y: 0
|
|
978
|
+
}], cmds = getRoundedCommands(points);
|
|
979
|
+
t3 = compileCommands(cmds);
|
|
980
|
+
const path = t3, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`;
|
|
981
|
+
let t4;
|
|
982
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = css._arrow(), $[7] = t4) : t4 = $[7];
|
|
983
|
+
const t5 = `${w}px`;
|
|
984
|
+
let t6;
|
|
985
|
+
$[8] !== t5 ? (t6 = dynamic.assignInlineVars({
|
|
986
|
+
[css.vars.arrow.size]: t5
|
|
987
|
+
}), $[8] = t5, $[9] = t6) : t6 = $[9];
|
|
988
|
+
let t7;
|
|
989
|
+
$[10] !== style || $[11] !== t6 ? (t7 = {
|
|
990
|
+
...style,
|
|
991
|
+
...t6
|
|
992
|
+
}, $[10] = style, $[11] = t6, $[12] = t7) : t7 = $[12];
|
|
993
|
+
let t8;
|
|
994
|
+
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t8 = css._arrowSvg(), $[13] = t8) : t8 = $[13];
|
|
995
|
+
const t9 = `0 0 ${w} ${w}`;
|
|
996
|
+
let t10;
|
|
997
|
+
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t10 = css._arrowStrokeMask(), $[14] = t10) : t10 = $[14];
|
|
998
|
+
let t11;
|
|
999
|
+
$[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];
|
|
1000
|
+
let t12;
|
|
1001
|
+
$[17] === Symbol.for("react.memo_cache_sentinel") ? (t12 = css._arrowStroke(), $[17] = t12) : t12 = $[17];
|
|
1002
|
+
let t13;
|
|
1003
|
+
$[18] !== strokePath ? (t13 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t12, d: strokePath, mask: "url(#stroke-mask)" }), $[18] = strokePath, $[19] = t13) : t13 = $[19];
|
|
1004
|
+
let t14;
|
|
1005
|
+
$[20] === Symbol.for("react.memo_cache_sentinel") ? (t14 = css._arrowShape(), $[20] = t14) : t14 = $[20];
|
|
1006
|
+
let t15;
|
|
1007
|
+
$[21] !== fillPath ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t14, d: fillPath }), $[21] = fillPath, $[22] = t15) : t15 = $[22];
|
|
1008
|
+
let t16;
|
|
1009
|
+
$[23] !== t11 || $[24] !== t13 || $[25] !== t15 || $[26] !== t9 || $[27] !== w ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: t8, width: w, height: w, viewBox: t9, children: [
|
|
1010
|
+
t11,
|
|
1011
|
+
t13,
|
|
1012
|
+
t15
|
|
1013
|
+
] }), $[23] = t11, $[24] = t13, $[25] = t15, $[26] = t9, $[27] = w, $[28] = t16) : t16 = $[28];
|
|
1014
|
+
let t17;
|
|
1015
|
+
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;
|
|
1016
|
+
}
|
|
1017
|
+
const DEFAULT_FLEX_ELEMENT = "div";
|
|
1018
|
+
function Flex(props) {
|
|
1019
|
+
const $ = compilerRuntime.c(14), t0 = props;
|
|
1020
|
+
let align, justify, rest, t1, t2, wrap;
|
|
1021
|
+
$[0] !== t0 ? ({
|
|
1022
|
+
align,
|
|
1023
|
+
as: t1,
|
|
1024
|
+
direction: t2,
|
|
1025
|
+
justify,
|
|
1026
|
+
wrap,
|
|
1027
|
+
...rest
|
|
1028
|
+
} = 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]);
|
|
1029
|
+
const as = t1 === void 0 ? DEFAULT_FLEX_ELEMENT : t1, direction = t2 === void 0 ? "row" : t2;
|
|
1030
|
+
let t3;
|
|
1031
|
+
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;
|
|
1032
|
+
}
|
|
1236
1033
|
function PopoverLayer(props) {
|
|
1237
|
-
const $ =
|
|
1034
|
+
const $ = compilerRuntime.c(65);
|
|
1238
1035
|
let animate, arrow, arrowRef, arrowX, arrowY, children, marginsProp, maxWidth, originX, originY, overflow, padding, placement, radius, referenceWidth, rest, shadow, strategy, style, t0, xProp, yProp;
|
|
1239
1036
|
$[0] !== props ? ({
|
|
1240
1037
|
__unstable_margins: marginsProp,
|
|
@@ -1309,7 +1106,7 @@ function PopoverLayer(props) {
|
|
|
1309
1106
|
}
|
|
1310
1107
|
const DEFAULT_POPOVER_ELEMENT = "div";
|
|
1311
1108
|
function ViewportOverlay() {
|
|
1312
|
-
const $ =
|
|
1109
|
+
const $ = compilerRuntime.c(2), {
|
|
1313
1110
|
zIndex
|
|
1314
1111
|
} = useLayer();
|
|
1315
1112
|
let t0;
|
|
@@ -1439,7 +1236,7 @@ function getElementRef$1(element) {
|
|
|
1439
1236
|
}
|
|
1440
1237
|
const DEFAULT_STACK_ELEMENT = "div";
|
|
1441
1238
|
function Stack(props) {
|
|
1442
|
-
const $ =
|
|
1239
|
+
const $ = compilerRuntime.c(13), t0 = props;
|
|
1443
1240
|
let className, gap, rest, space, t1;
|
|
1444
1241
|
$[0] !== t0 ? ({
|
|
1445
1242
|
as: t1,
|
|
@@ -1457,9 +1254,18 @@ function Stack(props) {
|
|
|
1457
1254
|
let t4;
|
|
1458
1255
|
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
1256
|
}
|
|
1257
|
+
function useCustomValidity(ref, customValidity) {
|
|
1258
|
+
const $ = compilerRuntime.c(6);
|
|
1259
|
+
let t0;
|
|
1260
|
+
$[0] !== customValidity || $[1] !== ref.current ? (t0 = () => {
|
|
1261
|
+
ref.current?.setCustomValidity(customValidity || "");
|
|
1262
|
+
}, $[0] = customValidity, $[1] = ref.current, $[2] = t0) : t0 = $[2];
|
|
1263
|
+
let t1;
|
|
1264
|
+
$[3] !== customValidity || $[4] !== ref ? (t1 = [customValidity, ref], $[3] = customValidity, $[4] = ref, $[5] = t1) : t1 = $[5], react.useEffect(t0, t1);
|
|
1265
|
+
}
|
|
1460
1266
|
const DEFAULT_TEXT_INPUT_ELEMENT = "input";
|
|
1461
1267
|
function TextInput(props) {
|
|
1462
|
-
const $ =
|
|
1268
|
+
const $ = compilerRuntime.c(89), t0 = props;
|
|
1463
1269
|
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
1270
|
if ($[0] !== t0) {
|
|
1465
1271
|
const {
|
|
@@ -1493,7 +1299,7 @@ function TextInput(props) {
|
|
|
1493
1299
|
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
1300
|
let t9;
|
|
1495
1301
|
$[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;
|
|
1302
|
+
const handleClearMouseDown = _temp$2;
|
|
1497
1303
|
let t10;
|
|
1498
1304
|
$[24] !== onClear ? (t10 = (event_0) => {
|
|
1499
1305
|
event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
|
|
@@ -1572,269 +1378,95 @@ function _temp2(t0) {
|
|
|
1572
1378
|
const [key2, value] = t0;
|
|
1573
1379
|
return value === 0 ? [key2, 0] : value === 1 ? [key2, 1] : value === 2 ? [key2, 1] : [key2, typeof value == "number" ? value - 2 : 0];
|
|
1574
1380
|
}
|
|
1575
|
-
function _temp(event) {
|
|
1381
|
+
function _temp$2(event) {
|
|
1576
1382
|
event.preventDefault(), event.stopPropagation();
|
|
1577
1383
|
}
|
|
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;
|
|
1384
|
+
function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
1385
|
+
const $ = compilerRuntime.c(9), elementsArg = t0 === void 0 ? _temp$1 : t0;
|
|
1590
1386
|
let t1;
|
|
1591
|
-
|
|
1387
|
+
$[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
|
|
1388
|
+
if (!listener)
|
|
1389
|
+
return;
|
|
1390
|
+
const target = evt.target;
|
|
1391
|
+
if (!(target instanceof Node))
|
|
1392
|
+
return;
|
|
1393
|
+
const resolvedBoundaryElement = boundaryElement?.();
|
|
1394
|
+
if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target))
|
|
1395
|
+
return;
|
|
1396
|
+
const elements = elementsArg().flat();
|
|
1397
|
+
for (const el of elements)
|
|
1398
|
+
if (el && (target === el || el.contains(target)))
|
|
1399
|
+
return;
|
|
1400
|
+
listener(evt);
|
|
1401
|
+
}, $[0] = boundaryElement, $[1] = elementsArg, $[2] = listener, $[3] = t1) : t1 = $[3];
|
|
1402
|
+
const onEvent = useEffectEvent.useEffectEvent(t1), hasListener = !!listener;
|
|
1403
|
+
let t2;
|
|
1404
|
+
$[4] !== hasListener || $[5] !== onEvent ? (t2 = () => {
|
|
1405
|
+
if (!hasListener)
|
|
1406
|
+
return;
|
|
1407
|
+
const handleEvent = (evt_0) => onEvent(evt_0);
|
|
1408
|
+
return document.addEventListener("mousedown", handleEvent), () => {
|
|
1409
|
+
document.removeEventListener("mousedown", handleEvent);
|
|
1410
|
+
};
|
|
1411
|
+
}, $[4] = hasListener, $[5] = onEvent, $[6] = t2) : t2 = $[6];
|
|
1412
|
+
let t3;
|
|
1413
|
+
$[7] !== hasListener ? (t3 = [hasListener], $[7] = hasListener, $[8] = t3) : t3 = $[8], react.useEffect(t2, t3), react.useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
|
|
1592
1414
|
}
|
|
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);
|
|
1415
|
+
function _temp$1() {
|
|
1416
|
+
return EMPTY_ARRAY;
|
|
1596
1417
|
}
|
|
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);
|
|
1418
|
+
function useGlobalKeyDown(onKeyDown) {
|
|
1419
|
+
const $ = compilerRuntime.c(5);
|
|
1420
|
+
let t0;
|
|
1421
|
+
$[0] !== onKeyDown ? (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0) : t0 = $[1];
|
|
1422
|
+
const handleKeyDown = useEffectEvent.useEffectEvent(t0);
|
|
1423
|
+
let t1;
|
|
1424
|
+
$[2] !== handleKeyDown ? (t1 = () => {
|
|
1425
|
+
const handler = (event_0) => handleKeyDown(event_0);
|
|
1426
|
+
return window.addEventListener("keydown", handler), () => window.removeEventListener("keydown", handler);
|
|
1427
|
+
}, $[2] = handleKeyDown, $[3] = t1) : t1 = $[3];
|
|
1428
|
+
let t2;
|
|
1429
|
+
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[4] = t2) : t2 = $[4], react.useEffect(t1, t2);
|
|
1613
1430
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
arrowRef,
|
|
1621
|
-
arrowX,
|
|
1622
|
-
arrowY,
|
|
1431
|
+
const DEFAULT_KBD_ELEMENT = "kbd";
|
|
1432
|
+
function KBD(props) {
|
|
1433
|
+
const $ = compilerRuntime.c(22), t0 = props;
|
|
1434
|
+
let children, className, rest, t1, t2, t3, t4, t5;
|
|
1435
|
+
$[0] !== t0 ? ({
|
|
1436
|
+
as: t1,
|
|
1623
1437
|
children,
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
radius,
|
|
1629
|
-
scheme,
|
|
1630
|
-
shadow,
|
|
1631
|
-
style,
|
|
1632
|
-
tone: t0,
|
|
1438
|
+
className,
|
|
1439
|
+
display: t2,
|
|
1440
|
+
fontSize: t3,
|
|
1441
|
+
padding: t4,
|
|
1442
|
+
radius: t5,
|
|
1633
1443
|
...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;
|
|
1444
|
+
} = 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]);
|
|
1445
|
+
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
1446
|
let t7;
|
|
1649
|
-
$[
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
}, $[
|
|
1655
|
-
const arrowStyle = t4, t8 = animate ? "" : void 0;
|
|
1447
|
+
$[9] !== className || $[10] !== radius ? (t7 = css.kbd({
|
|
1448
|
+
className,
|
|
1449
|
+
radius
|
|
1450
|
+
}), $[9] = className, $[10] = radius, $[11] = t7) : t7 = $[11];
|
|
1451
|
+
let t8;
|
|
1452
|
+
$[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];
|
|
1656
1453
|
let t9;
|
|
1657
|
-
$[
|
|
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;
|
|
1454
|
+
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;
|
|
1669
1455
|
}
|
|
1670
|
-
const
|
|
1671
|
-
function
|
|
1672
|
-
const
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
as
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
placement: placementProp = "bottom",
|
|
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);
|
|
1823
|
-
}
|
|
1824
|
-
const DEFAULT_HOTKEYS_ELEMENT = "kbd";
|
|
1825
|
-
function Hotkeys(props) {
|
|
1826
|
-
const $ = reactCompilerRuntime.c(27), t0 = props;
|
|
1827
|
-
let fontSize, gap, gapX, gapY, keys, padding, radius, rest, t1, t2;
|
|
1828
|
-
$[0] !== t0 ? ({
|
|
1829
|
-
as: t1,
|
|
1830
|
-
fontSize,
|
|
1831
|
-
gap,
|
|
1832
|
-
gapX,
|
|
1833
|
-
gapY,
|
|
1834
|
-
keys,
|
|
1835
|
-
padding,
|
|
1836
|
-
radius,
|
|
1837
|
-
space: t2,
|
|
1456
|
+
const DEFAULT_HOTKEYS_ELEMENT = "kbd";
|
|
1457
|
+
function Hotkeys(props) {
|
|
1458
|
+
const $ = compilerRuntime.c(27), t0 = props;
|
|
1459
|
+
let fontSize, gap, gapX, gapY, keys, padding, radius, rest, t1, t2;
|
|
1460
|
+
$[0] !== t0 ? ({
|
|
1461
|
+
as: t1,
|
|
1462
|
+
fontSize,
|
|
1463
|
+
gap,
|
|
1464
|
+
gapX,
|
|
1465
|
+
gapY,
|
|
1466
|
+
keys,
|
|
1467
|
+
padding,
|
|
1468
|
+
radius,
|
|
1469
|
+
space: t2,
|
|
1838
1470
|
...rest
|
|
1839
1471
|
} = t0, $[0] = t0, $[1] = fontSize, $[2] = gap, $[3] = gapX, $[4] = gapY, $[5] = keys, $[6] = padding, $[7] = radius, $[8] = rest, $[9] = t1, $[10] = t2) : (fontSize = $[1], gap = $[2], gapX = $[3], gapY = $[4], keys = $[5], padding = $[6], radius = $[7], rest = $[8], t1 = $[9], t2 = $[10]);
|
|
1840
1472
|
const as = t1 === void 0 ? DEFAULT_HOTKEYS_ELEMENT : t1, space = t2 === void 0 ? 1 : t2;
|
|
@@ -1990,7 +1622,7 @@ function useMenuController(props) {
|
|
|
1990
1622
|
}
|
|
1991
1623
|
const DEFAULT_MENU_ELEMENT = "div";
|
|
1992
1624
|
function Menu(props) {
|
|
1993
|
-
const $ =
|
|
1625
|
+
const $ = compilerRuntime.c(58), t0 = props;
|
|
1994
1626
|
let _shouldFocus, children, className, forwardedRef, gap, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, registerElement, rest, t1, t2, t3;
|
|
1995
1627
|
if ($[0] !== t0) {
|
|
1996
1628
|
const {
|
|
@@ -2082,7 +1714,7 @@ function Menu(props) {
|
|
|
2082
1714
|
}
|
|
2083
1715
|
const DEFAULT_MENU_DIVIDER_ELEMENT = "hr";
|
|
2084
1716
|
function MenuDivider(props) {
|
|
2085
|
-
const $ =
|
|
1717
|
+
const $ = compilerRuntime.c(10), t0 = props;
|
|
2086
1718
|
let className, rest, t1;
|
|
2087
1719
|
$[0] !== t0 ? ({
|
|
2088
1720
|
as: t1,
|
|
@@ -2097,27 +1729,6 @@ function MenuDivider(props) {
|
|
|
2097
1729
|
let t3;
|
|
2098
1730
|
return $[6] !== Element || $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Element, { ...rest, className: t2 }), $[6] = Element, $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
|
|
2099
1731
|
}
|
|
2100
|
-
const DEFAULT_SELECTABLE_ELEMENT = "button";
|
|
2101
|
-
function Selectable(props) {
|
|
2102
|
-
const $ = reactCompilerRuntime.c(14), t0 = props;
|
|
2103
|
-
let className, radius, rest, t1, tone;
|
|
2104
|
-
$[0] !== t0 ? ({
|
|
2105
|
-
as: t1,
|
|
2106
|
-
className,
|
|
2107
|
-
radius,
|
|
2108
|
-
tone,
|
|
2109
|
-
...rest
|
|
2110
|
-
} = t0, $[0] = t0, $[1] = className, $[2] = radius, $[3] = rest, $[4] = t1, $[5] = tone) : (className = $[1], radius = $[2], rest = $[3], t1 = $[4], tone = $[5]);
|
|
2111
|
-
const as = t1 === void 0 ? DEFAULT_SELECTABLE_ELEMENT : t1;
|
|
2112
|
-
let t2;
|
|
2113
|
-
$[6] !== className || $[7] !== radius || $[8] !== tone ? (t2 = css._selectable({
|
|
2114
|
-
className,
|
|
2115
|
-
radius,
|
|
2116
|
-
tone
|
|
2117
|
-
}), $[6] = className, $[7] = radius, $[8] = tone, $[9] = t2) : t2 = $[9];
|
|
2118
|
-
let t3;
|
|
2119
|
-
return $[10] !== as || $[11] !== rest || $[12] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Box, { ...rest, as, className: t2 }), $[10] = as, $[11] = rest, $[12] = t2, $[13] = t3) : t3 = $[13], t3;
|
|
2120
|
-
}
|
|
2121
1732
|
function useMenu() {
|
|
2122
1733
|
const value = react.useContext(MenuContext);
|
|
2123
1734
|
if (!value)
|
|
@@ -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;
|