@sanity/ui 4.4.1 → 4.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{arrow-A3jQ7LS0.js → arrow-MMVAW3Ew.js} +2 -2
- package/dist/{arrow-A3jQ7LS0.js.map → arrow-MMVAW3Ew.js.map} +1 -1
- package/dist/autocomplete.d.ts +5 -1
- package/dist/autocomplete.d.ts.map +1 -1
- package/dist/autocomplete.js +96 -99
- package/dist/autocomplete.js.map +1 -1
- package/dist/breadcrumbs.js +4 -4
- package/dist/{button-dhq4ViVg.js → button-Btcy6IOp.js} +48 -46
- package/dist/button-Btcy6IOp.js.map +1 -0
- package/dist/button-dnqMFkWg.d.ts.map +1 -1
- package/dist/code.d.ts.map +1 -1
- package/dist/code.js +12 -6
- package/dist/code.js.map +1 -1
- package/dist/{flex-BqQXaSxS.js → flex-ohP2jG9d.js} +2 -2
- package/dist/{flex-BqQXaSxS.js.map → flex-ohP2jG9d.js.map} +1 -1
- package/dist/{getElementRef-Jw7gY0eV.js → getElementRef-BLVMlHTn.js} +78 -3
- package/dist/getElementRef-BLVMlHTn.js.map +1 -0
- package/dist/{grid-Bpb2bIJ6.js → grid-D-gOpN8z.js} +2 -2
- package/dist/{grid-Bpb2bIJ6.js.map → grid-D-gOpN8z.js.map} +1 -1
- package/dist/{hotkeys-sG9yO97K.js → hotkeys-BPJuQ-gO.js} +10 -11
- package/dist/{hotkeys-sG9yO97K.js.map → hotkeys-BPJuQ-gO.js.map} +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +133 -81
- package/dist/index.js.map +1 -1
- package/dist/{layer-AWzYcY_j.js → layer-DP8gT1ex.js} +2 -2
- package/dist/{layer-AWzYcY_j.js.map → layer-DP8gT1ex.js.map} +1 -1
- package/dist/menu.d.ts +5 -0
- package/dist/menu.d.ts.map +1 -1
- package/dist/menu.js +184 -153
- package/dist/menu.js.map +1 -1
- package/dist/{popover-B0kvwaep.js → popover-BVbv1K3z.js} +143 -146
- package/dist/popover-BVbv1K3z.js.map +1 -0
- package/dist/popover-HDVgZg5e.d.ts.map +1 -1
- package/dist/popover.js +1 -1
- package/dist/responsiveFont-Cyvxxz-G.js +81 -0
- package/dist/responsiveFont-Cyvxxz-G.js.map +1 -0
- package/dist/{stack-Cv-WM-7p.js → stack-CPdFknrG.js} +22 -16
- package/dist/stack-CPdFknrG.js.map +1 -0
- package/dist/{textInput-Ddxi4mkC.js → textInput-nVtAHeX8.js} +38 -17
- package/dist/textInput-nVtAHeX8.js.map +1 -0
- package/dist/toast.js +5 -5
- package/dist/tooltip.js +72 -84
- package/dist/tooltip.js.map +1 -1
- package/dist/{useLayer-B0i19TTM.js → useLayer-D_TnC6On.js} +43 -28
- package/dist/useLayer-D_TnC6On.js.map +1 -0
- package/package.json +1 -1
- package/dist/button-dhq4ViVg.js.map +0 -1
- package/dist/codeFontStyle-B-bhR3hF.js +0 -11
- package/dist/codeFontStyle-B-bhR3hF.js.map +0 -1
- package/dist/getElementRef-Jw7gY0eV.js.map +0 -1
- package/dist/popover-B0kvwaep.js.map +0 -1
- package/dist/responsiveFont-B08q0jwm.js +0 -57
- package/dist/responsiveFont-B08q0jwm.js.map +0 -1
- package/dist/stack-Cv-WM-7p.js.map +0 -1
- package/dist/textInput-Ddxi4mkC.js.map +0 -1
- package/dist/useLayer-B0i19TTM.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { l as POPOVER_MOTION_PROPS, n as _getArrayProp } from "./helpers-XThPpWje.js";
|
|
2
|
-
import { _ as useTheme_v2, i as usePrefersReducedMotion, n as LayerProvider, o as useMediaIndex, s as Card, t as useLayer } from "./useLayer-
|
|
3
|
-
import { t as Flex } from "./flex-
|
|
4
|
-
import { i as origin, n as AnimateActivity, r as getTransformOrigin, t as getElementRef } from "./getElementRef-
|
|
2
|
+
import { _ as useTheme_v2, i as usePrefersReducedMotion, n as LayerProvider, o as useMediaIndex, s as Card, t as useLayer } from "./useLayer-D_TnC6On.js";
|
|
3
|
+
import { t as Flex } from "./flex-ohP2jG9d.js";
|
|
4
|
+
import { a as useReferenceElement, i as origin, n as AnimateActivity, r as getTransformOrigin, s as useLatestRef, t as getElementRef } from "./getElementRef-BLVMlHTn.js";
|
|
5
5
|
import { t as _elementSizeObserver } from "./elementSizeObserver-pevZfdGa.js";
|
|
6
|
-
import { n as Portal, o as useBoundaryElement, t as Arrow } from "./arrow-
|
|
6
|
+
import { n as Portal, o as useBoundaryElement, t as Arrow } from "./arrow-MMVAW3Ew.js";
|
|
7
7
|
import { c } from "react/compiler-runtime";
|
|
8
8
|
import { Activity, cloneElement, startTransition, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
9
9
|
import { styled } from "styled-components";
|
|
@@ -78,9 +78,10 @@ const DEFAULT_POPOVER_MARGINS = [
|
|
|
78
78
|
]
|
|
79
79
|
};
|
|
80
80
|
function size$1(options) {
|
|
81
|
-
let { constrainSize, margins, matchReferenceWidth,
|
|
81
|
+
let { constrainSize, margins, matchReferenceWidth, padding = 0 } = options;
|
|
82
82
|
return {
|
|
83
83
|
name: "@sanity/ui/size",
|
|
84
|
+
options,
|
|
84
85
|
async fn(args) {
|
|
85
86
|
let { elements, placement, platform, rects } = args, { floating, reference } = rects, overflow = await detectOverflow(args, {
|
|
86
87
|
altBoundary: !0,
|
|
@@ -90,8 +91,8 @@ function size$1(options) {
|
|
|
90
91
|
rootBoundary: "viewport"
|
|
91
92
|
}), maxWidth = Infinity, maxHeight = Infinity, floatingW = floating.width, floatingH = floating.height;
|
|
92
93
|
placement.includes("top") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.top), placement.includes("right") && (maxWidth = floatingW - overflow.right, maxHeight = floatingH - (overflow.top + overflow.bottom)), placement.includes("bottom") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.bottom), placement.includes("left") && (maxWidth = floatingW - overflow.left, maxHeight = floatingH - (overflow.top + overflow.bottom));
|
|
93
|
-
let availableWidth = maxWidth - margins[1] - margins[3], availableHeight = maxHeight - margins[0] - margins[2], referenceWidth = reference.width - margins[1] - margins[3];
|
|
94
|
-
|
|
94
|
+
let availableWidth = Math.max(0, maxWidth - margins[1] - margins[3]), availableHeight = Math.max(0, maxHeight - margins[0] - margins[2]), referenceWidth = Math.max(0, reference.width - margins[1] - margins[3]);
|
|
95
|
+
matchReferenceWidth && (elements.floating.style.width = `${referenceWidth}px`), constrainSize && (elements.floating.style.maxWidth = `${Math.min(availableWidth, options.maxWidth ?? Infinity)}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
|
|
95
96
|
let nextDimensions = await platform.getDimensions(elements.floating), targetH = nextDimensions.height;
|
|
96
97
|
return floatingW !== nextDimensions.width || floatingH !== targetH ? { reset: { rects: !0 } } : {};
|
|
97
98
|
}
|
|
@@ -102,64 +103,66 @@ function calcCurrentWidth(params) {
|
|
|
102
103
|
return typeof currentWidth == "number" ? container[currentWidth] : void 0;
|
|
103
104
|
}
|
|
104
105
|
function calcMaxWidth(params) {
|
|
105
|
-
let { boundaryWidth, currentWidth } = params;
|
|
106
|
-
|
|
106
|
+
let { boundaryWidth, currentWidth } = params, maxWidth = Math.min(currentWidth ?? Infinity, (boundaryWidth || Infinity) - 8);
|
|
107
|
+
return Number.isFinite(maxWidth) ? Math.max(0, maxWidth) : void 0;
|
|
107
108
|
}
|
|
108
109
|
const MotionCard = styled(motion.create(Card)).withConfig({
|
|
109
110
|
displayName: "MotionCard",
|
|
110
|
-
componentId: "sc-
|
|
111
|
+
componentId: "sc-jp9vvl-0"
|
|
111
112
|
})`&:not([hidden]){display:flex;}flex-direction:column;width:max-content;min-width:min-content;will-change:transform;`;
|
|
112
113
|
/**
|
|
113
114
|
* @internal
|
|
114
115
|
*/
|
|
115
116
|
function PopoverCard(props) {
|
|
116
|
-
let $ = c(
|
|
117
|
-
$[0] === props ? (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6],
|
|
117
|
+
let $ = c(66), animate, arrow, arrowRef, arrowX, arrowY, children, constrainSize, marginsProp, matchReferenceWidth, maxWidth, originX, originY, overflow, padding, placement, radius, ref, restProps, scheme, shadow, strategy, style, tone, width, xProp, yProp;
|
|
118
|
+
$[0] === props ? (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], constrainSize = $[7], marginsProp = $[8], matchReferenceWidth = $[9], maxWidth = $[10], originX = $[11], originY = $[12], overflow = $[13], padding = $[14], placement = $[15], radius = $[16], ref = $[17], restProps = $[18], scheme = $[19], shadow = $[20], strategy = $[21], style = $[22], tone = $[23], width = $[24], xProp = $[25], yProp = $[26]) : ({__unstable_margins: marginsProp, animate, arrow, arrowRef, arrowX, arrowY, children, constrainSize, matchReferenceWidth, maxWidth, padding, placement, originX, originY, overflow, radius, ref, scheme, shadow, strategy, style, tone, width, x: xProp, y: yProp, ...restProps} = props, $[0] = props, $[1] = animate, $[2] = arrow, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = constrainSize, $[8] = marginsProp, $[9] = matchReferenceWidth, $[10] = maxWidth, $[11] = originX, $[12] = originY, $[13] = overflow, $[14] = padding, $[15] = placement, $[16] = radius, $[17] = ref, $[18] = restProps, $[19] = scheme, $[20] = shadow, $[21] = strategy, $[22] = style, $[23] = tone, $[24] = width, $[25] = xProp, $[26] = yProp);
|
|
118
119
|
let { zIndex } = useLayer(), margins = marginsProp || DEFAULT_POPOVER_MARGINS, x = (xProp ?? 0) + margins[3], y = (yProp ?? 0) + margins[0], t0;
|
|
119
|
-
$[
|
|
120
|
-
let t1 = animate ? "transform" : void 0, t2;
|
|
121
|
-
$[
|
|
120
|
+
$[27] !== originX || $[28] !== originY ? (t0 = getTransformOrigin(originX, originY), $[27] = originX, $[28] = originY, $[29] = t0) : t0 = $[29];
|
|
121
|
+
let t1 = animate ? "transform" : void 0, t2 = constrainSize ? void 0 : style?.maxHeight ?? "", t3 = constrainSize ? void 0 : maxWidth ?? style?.maxWidth ?? "", t4 = matchReferenceWidth ? void 0 : width ?? style?.width ?? "", t5;
|
|
122
|
+
$[30] !== strategy || $[31] !== style || $[32] !== t0 || $[33] !== t1 || $[34] !== t2 || $[35] !== t3 || $[36] !== t4 || $[37] !== x || $[38] !== y || $[39] !== zIndex ? (t5 = {
|
|
122
123
|
left: x,
|
|
123
124
|
position: strategy,
|
|
124
125
|
top: y,
|
|
125
126
|
transformOrigin: t0,
|
|
126
|
-
width,
|
|
127
127
|
zIndex,
|
|
128
128
|
willChange: t1,
|
|
129
|
-
...style
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
...style,
|
|
130
|
+
maxHeight: t2,
|
|
131
|
+
maxWidth: t3,
|
|
132
|
+
width: t4
|
|
133
|
+
}, $[30] = strategy, $[31] = style, $[32] = t0, $[33] = t1, $[34] = t2, $[35] = t3, $[36] = t4, $[37] = x, $[38] = y, $[39] = zIndex, $[40] = t5) : t5 = $[40];
|
|
134
|
+
let rootStyle = t5, t6 = arrowX === null ? void 0 : arrowX, t7 = arrowY === null ? void 0 : arrowY, t8;
|
|
135
|
+
$[41] !== t6 || $[42] !== t7 ? (t8 = {
|
|
136
|
+
left: t6,
|
|
137
|
+
top: t7,
|
|
135
138
|
right: void 0,
|
|
136
139
|
bottom: void 0
|
|
137
|
-
}, $[
|
|
138
|
-
let arrowStyle =
|
|
139
|
-
$[
|
|
140
|
+
}, $[41] = t6, $[42] = t7, $[43] = t8) : t8 = $[43];
|
|
141
|
+
let arrowStyle = t8, t9 = animate ? POPOVER_MOTION_PROPS : void 0, t10;
|
|
142
|
+
$[44] !== children || $[45] !== padding ? (t10 = /* @__PURE__ */ jsx(Flex, {
|
|
140
143
|
direction: "column",
|
|
141
144
|
flex: 1,
|
|
142
145
|
padding,
|
|
143
146
|
children
|
|
144
|
-
}), $[
|
|
145
|
-
let
|
|
146
|
-
$[
|
|
147
|
+
}), $[44] = children, $[45] = padding, $[46] = t10) : t10 = $[46];
|
|
148
|
+
let t11;
|
|
149
|
+
$[47] !== overflow || $[48] !== t10 ? (t11 = /* @__PURE__ */ jsx(Flex, {
|
|
147
150
|
"data-ui": "Popover__wrapper",
|
|
148
151
|
direction: "column",
|
|
149
152
|
flex: 1,
|
|
150
153
|
overflow,
|
|
151
|
-
children:
|
|
152
|
-
}), $[
|
|
153
|
-
let
|
|
154
|
-
$[
|
|
154
|
+
children: t10
|
|
155
|
+
}), $[47] = overflow, $[48] = t10, $[49] = t11) : t11 = $[49];
|
|
156
|
+
let t12;
|
|
157
|
+
$[50] !== arrow || $[51] !== arrowRef || $[52] !== arrowStyle ? (t12 = arrow && /* @__PURE__ */ jsx(Arrow, {
|
|
155
158
|
ref: arrowRef,
|
|
156
159
|
style: arrowStyle,
|
|
157
160
|
width: 19,
|
|
158
161
|
height: 8,
|
|
159
162
|
radius: 2
|
|
160
|
-
}), $[
|
|
161
|
-
let
|
|
162
|
-
return $[
|
|
163
|
+
}), $[50] = arrow, $[51] = arrowRef, $[52] = arrowStyle, $[53] = t12) : t12 = $[53];
|
|
164
|
+
let t13;
|
|
165
|
+
return $[54] !== placement || $[55] !== radius || $[56] !== ref || $[57] !== restProps || $[58] !== rootStyle || $[59] !== scheme || $[60] !== shadow || $[61] !== t11 || $[62] !== t12 || $[63] !== t9 || $[64] !== tone ? (t13 = /* @__PURE__ */ jsxs(MotionCard, {
|
|
163
166
|
"data-ui": "Popover",
|
|
164
167
|
...restProps,
|
|
165
168
|
"data-placement": placement,
|
|
@@ -170,9 +173,9 @@ function PopoverCard(props) {
|
|
|
170
173
|
sizing: "border",
|
|
171
174
|
style: rootStyle,
|
|
172
175
|
tone,
|
|
173
|
-
...
|
|
174
|
-
children: [
|
|
175
|
-
}), $[
|
|
176
|
+
...t9,
|
|
177
|
+
children: [t11, t12]
|
|
178
|
+
}), $[54] = placement, $[55] = radius, $[56] = ref, $[57] = restProps, $[58] = rootStyle, $[59] = scheme, $[60] = shadow, $[61] = t11, $[62] = t12, $[63] = t9, $[64] = tone, $[65] = t13) : t13 = $[65], t13;
|
|
176
179
|
}
|
|
177
180
|
/**
|
|
178
181
|
* The events on the reference element that count as intent to open the popover. Each precedes the
|
|
@@ -183,7 +186,30 @@ const INTENT_EVENT_TYPES = [
|
|
|
183
186
|
"focusin",
|
|
184
187
|
"pointerenter",
|
|
185
188
|
"pointerdown"
|
|
186
|
-
]
|
|
189
|
+
];
|
|
190
|
+
/** Calls `handleIntent` on intent to open the popover, until the returned function is called */
|
|
191
|
+
function listenForIntent(element, handleIntent) {
|
|
192
|
+
let controller = new AbortController(), { signal } = controller;
|
|
193
|
+
for (let type of INTENT_EVENT_TYPES) element.addEventListener(type, handleIntent, { signal });
|
|
194
|
+
let { activeElement } = element.ownerDocument;
|
|
195
|
+
return activeElement && element.contains(activeElement) && handleIntent(), () => controller.abort();
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Listens for intent on the cloned child's element from the moment it attaches, until it detaches
|
|
199
|
+
* or the popover has rendered. Returns the callback for `useReferenceElement` to attach with.
|
|
200
|
+
*/
|
|
201
|
+
function useChildIntent(shouldRender, handleIntent) {
|
|
202
|
+
let $ = c(6), shouldRenderRef = useLatestRef(shouldRender), stopRef = useRef(null), t0, t1;
|
|
203
|
+
$[0] === shouldRender ? (t0 = $[1], t1 = $[2]) : (t0 = () => {
|
|
204
|
+
shouldRender && stopListening(stopRef);
|
|
205
|
+
}, t1 = [shouldRender], $[0] = shouldRender, $[1] = t0, $[2] = t1), useEffect(t0, t1);
|
|
206
|
+
let t2;
|
|
207
|
+
return $[3] !== handleIntent || $[4] !== shouldRenderRef ? (t2 = (node) => (shouldRenderRef.current || (stopRef.current = listenForIntent(node, handleIntent)), () => stopListening(stopRef)), $[3] = handleIntent, $[4] = shouldRenderRef, $[5] = t2) : t2 = $[5], t2;
|
|
208
|
+
}
|
|
209
|
+
function stopListening(stopRef) {
|
|
210
|
+
stopRef.current?.(), stopRef.current = null;
|
|
211
|
+
}
|
|
212
|
+
const ViewportOverlay = () => {
|
|
187
213
|
let $ = c(2), { zIndex } = useLayer(), t0;
|
|
188
214
|
return $[0] === zIndex ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx("div", {
|
|
189
215
|
"data-ui": "PopoverOverlay",
|
|
@@ -202,7 +228,7 @@ const INTENT_EVENT_TYPES = [
|
|
|
202
228
|
* @public
|
|
203
229
|
*/
|
|
204
230
|
function Popover(props) {
|
|
205
|
-
let $ = c(
|
|
231
|
+
let $ = c(120), { container, layer } = useTheme_v2(), boundaryElementContext = useBoundaryElement(), _fallbackPlacements, _floatingBoundary, _referenceBoundary, _zOffsetProp, childProp, content, disabled, forwardedRef, matchReferenceWidth, modal, open, paddingProp, portal, referenceElement, restProps, scheme, t0, t1, t10, t11, t2, t3, t4, t5, t6, t7, t8, t9, updateRef;
|
|
206
232
|
if ($[0] !== props) {
|
|
207
233
|
let { __unstable_margins: t12, animate: t13, arrow: t14, children: t15, constrainSize: t16, content: t17, disabled: t18, fallbackPlacements: t19, matchReferenceWidth: t20, floatingBoundary: t21, modal: t22, onActivate, open: t23, overflow: t24, padding: t25, placement: t26, placementStrategy: t27, portal: t28, preventOverflow: t29, radius: t30, ref: t31, referenceBoundary: t32, referenceElement: t33, scheme: t34, shadow: t35, tone: t36, width: t37, zOffset: t38, updateRef: t39, ...t40 } = props;
|
|
208
234
|
t0 = t12, t1 = t13, t2 = t14, childProp = t15, t3 = t16, content = t17, disabled = t18, _fallbackPlacements = t19, matchReferenceWidth = t20, _floatingBoundary = t21, modal = t22, open = t23, t4 = t24, paddingProp = t25, t5 = t26, t6 = t27, portal = t28, t7 = t29, t8 = t30, forwardedRef = t31, _referenceBoundary = t32, referenceElement = t33, scheme = t34, t9 = t35, t10 = t36, t11 = t37, _zOffsetProp = t38, updateRef = t39, restProps = t40, $[0] = props, $[1] = _fallbackPlacements, $[2] = _floatingBoundary, $[3] = _referenceBoundary, $[4] = _zOffsetProp, $[5] = childProp, $[6] = content, $[7] = disabled, $[8] = forwardedRef, $[9] = matchReferenceWidth, $[10] = modal, $[11] = open, $[12] = paddingProp, $[13] = portal, $[14] = referenceElement, $[15] = restProps, $[16] = scheme, $[17] = t0, $[18] = t1, $[19] = t10, $[20] = t11, $[21] = t2, $[22] = t3, $[23] = t4, $[24] = t5, $[25] = t6, $[26] = t7, $[27] = t8, $[28] = t9, $[29] = updateRef;
|
|
@@ -221,33 +247,11 @@ function Popover(props) {
|
|
|
221
247
|
container,
|
|
222
248
|
mediaIndex,
|
|
223
249
|
width: widthArrayProp
|
|
224
|
-
}),
|
|
225
|
-
$[39] === width ? (t17 = $[40], t18 = $[41]) : (t17 = () => {
|
|
226
|
-
widthRef.current = width;
|
|
227
|
-
}, t18 = [width], $[39] = width, $[40] = t17, $[41] = t18), useEffect(t17, t18);
|
|
228
|
-
let t19;
|
|
229
|
-
$[42] !== boundaryWidth || $[43] !== width ? (t19 = calcMaxWidth({
|
|
250
|
+
}), maxWidth = calcMaxWidth({
|
|
230
251
|
boundaryWidth,
|
|
231
252
|
currentWidth: width
|
|
232
|
-
}),
|
|
233
|
-
|
|
234
|
-
$[45] === maxWidth ? (t20 = $[46], t21 = $[47]) : (t20 = () => {
|
|
235
|
-
maxWidthRef.current = maxWidth;
|
|
236
|
-
}, t21 = [maxWidth], $[45] = maxWidth, $[46] = t20, $[47] = t21), useEffect(t20, t21);
|
|
237
|
-
let referenceWidthRef = useRef(void 0), t22, t23;
|
|
238
|
-
$[48] !== matchReferenceWidth || $[49] !== maxWidth || $[50] !== open || $[51] !== width ? (t22 = () => {
|
|
239
|
-
let floatingElement = ref.current;
|
|
240
|
-
if (!open || !floatingElement) return;
|
|
241
|
-
let referenceWidth = referenceWidthRef.current;
|
|
242
|
-
matchReferenceWidth ? referenceWidth !== void 0 && (floatingElement.style.width = `${referenceWidth}px`) : width !== void 0 && (floatingElement.style.width = `${width}px`), typeof maxWidth == "number" && (floatingElement.style.maxWidth = `${maxWidth}px`);
|
|
243
|
-
}, t23 = [
|
|
244
|
-
width,
|
|
245
|
-
matchReferenceWidth,
|
|
246
|
-
maxWidth,
|
|
247
|
-
open
|
|
248
|
-
], $[48] = matchReferenceWidth, $[49] = maxWidth, $[50] = open, $[51] = width, $[52] = t22, $[53] = t23) : (t22 = $[52], t23 = $[53]), useEffect(t22, t23);
|
|
249
|
-
let [referenceWidth_0, setReferenceWidth] = useState(void 0), t24;
|
|
250
|
-
$[54] !== animate || $[55] !== arrowProp || $[56] !== constrainSize || $[57] !== fallbackPlacements || $[58] !== floatingBoundary || $[59] !== margins || $[60] !== matchReferenceWidth || $[61] !== placementProp || $[62] !== placementStrategy || $[63] !== preventOverflow || $[64] !== referenceBoundary ? (t24 = {
|
|
253
|
+
}), t17;
|
|
254
|
+
$[39] !== animate || $[40] !== arrowProp || $[41] !== constrainSize || $[42] !== fallbackPlacements || $[43] !== floatingBoundary || $[44] !== margins || $[45] !== matchReferenceWidth || $[46] !== maxWidth || $[47] !== placementProp || $[48] !== placementStrategy || $[49] !== preventOverflow || $[50] !== referenceBoundary ? (t17 = {
|
|
251
255
|
animate,
|
|
252
256
|
arrowProp,
|
|
253
257
|
arrowRef,
|
|
@@ -256,69 +260,62 @@ function Popover(props) {
|
|
|
256
260
|
floatingBoundary,
|
|
257
261
|
margins,
|
|
258
262
|
matchReferenceWidth,
|
|
259
|
-
|
|
263
|
+
maxWidth,
|
|
260
264
|
placementProp,
|
|
261
265
|
placementStrategy,
|
|
262
266
|
preventOverflow,
|
|
263
267
|
referenceBoundary,
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
$[66] === referenceElement ? t25 = $[67] : (t25 = referenceElement ? { reference: referenceElement } : void 0, $[66] = referenceElement, $[67] = t25);
|
|
271
|
-
let t26;
|
|
272
|
-
$[68] !== middleware || $[69] !== placementProp || $[70] !== t25 ? (t26 = {
|
|
268
|
+
rootBoundary: "viewport"
|
|
269
|
+
}, $[39] = animate, $[40] = arrowProp, $[41] = constrainSize, $[42] = fallbackPlacements, $[43] = floatingBoundary, $[44] = margins, $[45] = matchReferenceWidth, $[46] = maxWidth, $[47] = placementProp, $[48] = placementStrategy, $[49] = preventOverflow, $[50] = referenceBoundary, $[51] = t17) : t17 = $[51];
|
|
270
|
+
let middleware = useMiddleware(t17), t18;
|
|
271
|
+
$[52] === referenceElement ? t18 = $[53] : (t18 = referenceElement ? { reference: referenceElement } : void 0, $[52] = referenceElement, $[53] = t18);
|
|
272
|
+
let t19;
|
|
273
|
+
$[54] !== middleware || $[55] !== placementProp || $[56] !== t18 ? (t19 = {
|
|
273
274
|
middleware,
|
|
274
275
|
placement: placementProp,
|
|
275
276
|
whileElementsMounted: autoUpdate,
|
|
276
|
-
elements:
|
|
277
|
-
}, $[
|
|
278
|
-
let { x, y,
|
|
277
|
+
elements: t18
|
|
278
|
+
}, $[54] = middleware, $[55] = placementProp, $[56] = t18, $[57] = t19) : t19 = $[57];
|
|
279
|
+
let { x, y, middlewareData, placement, refs, strategy, update } = useFloating(t19), [hasRendered, setHasRendered] = useState(!1);
|
|
279
280
|
isOpen && !hasRendered && setHasRendered(!0);
|
|
280
|
-
let shouldRender = isOpen || hasRendered, intentReference = shouldRender || disabled ? null :
|
|
281
|
-
$[
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
let referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, t29;
|
|
289
|
-
$[75] === Symbol.for("react.memo_cache_sentinel") ? (t29 = (arrowEl) => {
|
|
281
|
+
let shouldRender = isOpen || hasRendered, intentReference = shouldRender || disabled ? null : referenceElement, t20;
|
|
282
|
+
$[58] === Symbol.for("react.memo_cache_sentinel") ? (t20 = () => startTransition(() => setHasRendered(!0)), $[58] = t20) : t20 = $[58];
|
|
283
|
+
let handleIntent = t20, t21, t22;
|
|
284
|
+
$[59] === intentReference ? (t21 = $[60], t22 = $[61]) : (t21 = () => {
|
|
285
|
+
if (intentReference) return listenForIntent(intentReference, handleIntent);
|
|
286
|
+
}, t22 = [handleIntent, intentReference], $[59] = intentReference, $[60] = t21, $[61] = t22), useEffect(t21, t22);
|
|
287
|
+
let listenForChildIntent = useChildIntent(shouldRender, handleIntent), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, t23;
|
|
288
|
+
$[62] === Symbol.for("react.memo_cache_sentinel") ? (t23 = (arrowEl) => {
|
|
290
289
|
arrowRef.current = arrowEl;
|
|
291
|
-
}, $[
|
|
292
|
-
let setArrow =
|
|
293
|
-
$[
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
$[
|
|
298
|
-
let
|
|
299
|
-
$[80] === refs.reference.current ? t32 = $[81] : (t32 = () => refs.reference.current, $[80] = refs.reference.current, $[81] = t32), useImperativeHandle(t31, t32);
|
|
300
|
-
let t33;
|
|
290
|
+
}, $[62] = t23) : t23 = $[62];
|
|
291
|
+
let setArrow = t23, t24;
|
|
292
|
+
$[63] !== childProp || $[64] !== referenceElement ? (t24 = childProp && !referenceElement ? getElementRef(childProp) : void 0, $[63] = childProp, $[64] = referenceElement, $[65] = t24) : t24 = $[65];
|
|
293
|
+
let { handOverReference, setReference } = useReferenceElement(refs, t24, listenForChildIntent), t25;
|
|
294
|
+
$[66] !== handOverReference || $[67] !== refs ? (t25 = (node) => {
|
|
295
|
+
ref.current = node, node && handOverReference(), refs.setFloating(node);
|
|
296
|
+
}, $[66] = handOverReference, $[67] = refs, $[68] = t25) : t25 = $[68];
|
|
297
|
+
let setFloating = t25, t26;
|
|
301
298
|
bb0: {
|
|
302
299
|
if (referenceElement) {
|
|
303
|
-
|
|
300
|
+
t26 = childProp;
|
|
304
301
|
break bb0;
|
|
305
302
|
}
|
|
306
303
|
if (!childProp) {
|
|
307
|
-
|
|
304
|
+
t26 = null;
|
|
308
305
|
break bb0;
|
|
309
306
|
}
|
|
310
|
-
let
|
|
311
|
-
$[
|
|
307
|
+
let t27;
|
|
308
|
+
$[69] !== childProp || $[70] !== setReference ? (t27 = cloneElement(childProp, { ref: setReference }), $[69] = childProp, $[70] = setReference, $[71] = t27) : t27 = $[71], t26 = t27;
|
|
312
309
|
}
|
|
313
|
-
let child =
|
|
314
|
-
if ($[
|
|
315
|
-
let
|
|
316
|
-
return $[
|
|
310
|
+
let child = t26, t27, t28;
|
|
311
|
+
if ($[72] === update ? (t27 = $[73], t28 = $[74]) : (t27 = () => update, t28 = [update], $[72] = update, $[73] = t27, $[74] = t28), useImperativeHandle(updateRef, t27, t28), disabled) {
|
|
312
|
+
let t29;
|
|
313
|
+
return $[75] === childProp ? t29 = $[76] : (t29 = childProp || /* @__PURE__ */ jsx(Fragment$1, {}), $[75] = childProp, $[76] = t29), t29;
|
|
317
314
|
}
|
|
318
|
-
let
|
|
319
|
-
$[
|
|
320
|
-
let
|
|
321
|
-
$[
|
|
315
|
+
let t29;
|
|
316
|
+
$[77] === modal ? t29 = $[78] : (t29 = modal && /* @__PURE__ */ jsx(ViewportOverlay, {}), $[77] = modal, $[78] = t29);
|
|
317
|
+
let t30;
|
|
318
|
+
$[79] !== animate || $[80] !== arrowProp || $[81] !== arrowX || $[82] !== arrowY || $[83] !== constrainSize || $[84] !== content || $[85] !== margins || $[86] !== matchReferenceWidth || $[87] !== maxWidth || $[88] !== originX || $[89] !== originY || $[90] !== overflow || $[91] !== padding || $[92] !== placement || $[93] !== radius || $[94] !== referenceHidden || $[95] !== restProps || $[96] !== scheme || $[97] !== setFloating || $[98] !== shadow || $[99] !== strategy || $[100] !== tone || $[101] !== width || $[102] !== x || $[103] !== y ? (t30 = /* @__PURE__ */ jsx(PopoverCard, {
|
|
322
319
|
...restProps,
|
|
323
320
|
__unstable_margins: margins,
|
|
324
321
|
animate,
|
|
@@ -326,7 +323,10 @@ function Popover(props) {
|
|
|
326
323
|
arrowRef: setArrow,
|
|
327
324
|
arrowX,
|
|
328
325
|
arrowY,
|
|
326
|
+
constrainSize,
|
|
329
327
|
hidden: referenceHidden,
|
|
328
|
+
matchReferenceWidth,
|
|
329
|
+
maxWidth,
|
|
330
330
|
overflow,
|
|
331
331
|
padding,
|
|
332
332
|
placement,
|
|
@@ -338,32 +338,32 @@ function Popover(props) {
|
|
|
338
338
|
originY,
|
|
339
339
|
strategy,
|
|
340
340
|
tone,
|
|
341
|
-
width
|
|
341
|
+
width,
|
|
342
342
|
x,
|
|
343
343
|
y,
|
|
344
344
|
children: content
|
|
345
|
-
}), $[
|
|
346
|
-
let
|
|
347
|
-
$[
|
|
345
|
+
}), $[79] = animate, $[80] = arrowProp, $[81] = arrowX, $[82] = arrowY, $[83] = constrainSize, $[84] = content, $[85] = margins, $[86] = matchReferenceWidth, $[87] = maxWidth, $[88] = originX, $[89] = originY, $[90] = overflow, $[91] = padding, $[92] = placement, $[93] = radius, $[94] = referenceHidden, $[95] = restProps, $[96] = scheme, $[97] = setFloating, $[98] = shadow, $[99] = strategy, $[100] = tone, $[101] = width, $[102] = x, $[103] = y, $[104] = t30) : t30 = $[104];
|
|
346
|
+
let t31;
|
|
347
|
+
$[105] !== t29 || $[106] !== t30 || $[107] !== zOffset ? (t31 = /* @__PURE__ */ jsxs(LayerProvider, {
|
|
348
348
|
zOffset,
|
|
349
|
-
children: [
|
|
350
|
-
}), $[
|
|
351
|
-
let popover =
|
|
352
|
-
$[
|
|
349
|
+
children: [t29, t30]
|
|
350
|
+
}), $[105] = t29, $[106] = t30, $[107] = zOffset, $[108] = t31) : t31 = $[108];
|
|
351
|
+
let popover = t31, t32;
|
|
352
|
+
$[109] !== popover || $[110] !== portal ? (t32 = portal ? /* @__PURE__ */ jsx(Portal, {
|
|
353
353
|
__unstable_name: typeof portal == "string" ? portal : void 0,
|
|
354
354
|
children: popover
|
|
355
|
-
}) : popover, $[
|
|
356
|
-
let popoverNode =
|
|
357
|
-
$[
|
|
355
|
+
}) : popover, $[109] = popover, $[110] = portal, $[111] = t32) : t32 = $[111];
|
|
356
|
+
let popoverNode = t32, t33;
|
|
357
|
+
$[112] !== animate || $[113] !== open || $[114] !== popoverNode || $[115] !== shouldRender ? (t33 = animate ? /* @__PURE__ */ jsx(AnimateActivity, {
|
|
358
358
|
layoutMode: "default",
|
|
359
359
|
mode: open ? "visible" : "hidden",
|
|
360
360
|
children: shouldRender ? popoverNode : null
|
|
361
361
|
}) : /* @__PURE__ */ jsx(Activity, {
|
|
362
362
|
mode: open ? "visible" : "hidden",
|
|
363
363
|
children: shouldRender ? popoverNode : null
|
|
364
|
-
}), $[
|
|
365
|
-
let
|
|
366
|
-
return $[
|
|
364
|
+
}), $[112] = animate, $[113] = open, $[114] = popoverNode, $[115] = shouldRender, $[116] = t33) : t33 = $[116];
|
|
365
|
+
let t34;
|
|
366
|
+
return $[117] !== child || $[118] !== t33 ? (t34 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t33, child] }), $[117] = child, $[118] = t33, $[119] = t34) : t34 = $[119], t34;
|
|
367
367
|
}
|
|
368
368
|
/**
|
|
369
369
|
* The border-box size of the boundary element in whole pixels, tracked only while the popover is
|
|
@@ -421,62 +421,59 @@ function sameSize(prev, next) {
|
|
|
421
421
|
return prev && prev.width === next.width && prev.height === next.height ? prev : next;
|
|
422
422
|
}
|
|
423
423
|
function useMiddleware(t0) {
|
|
424
|
-
let $ = c(
|
|
425
|
-
if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== constrainSize || $[4] !== fallbackPlacements || $[5] !== floatingBoundary || $[6] !== margins || $[7] !== matchReferenceWidth || $[8] !==
|
|
424
|
+
let $ = c(36), { animate, arrowProp, arrowRef, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, maxWidth, placementProp, placementStrategy, preventOverflow, referenceBoundary, rootBoundary } = t0, ret;
|
|
425
|
+
if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== constrainSize || $[4] !== fallbackPlacements || $[5] !== floatingBoundary || $[6] !== margins || $[7] !== matchReferenceWidth || $[8] !== maxWidth || $[9] !== placementProp || $[10] !== placementStrategy || $[11] !== preventOverflow || $[12] !== referenceBoundary || $[13] !== rootBoundary) {
|
|
426
426
|
if (ret = [], constrainSize || preventOverflow) {
|
|
427
427
|
if (placementStrategy === "autoPlacement") {
|
|
428
428
|
let t1;
|
|
429
|
-
$[
|
|
429
|
+
$[15] !== fallbackPlacements || $[16] !== placementProp ? (t1 = autoPlacement({ allowedPlacements: [placementProp].concat(fallbackPlacements) }), $[15] = fallbackPlacements, $[16] = placementProp, $[17] = t1) : t1 = $[17], ret.push(t1);
|
|
430
430
|
} else {
|
|
431
431
|
let t1 = floatingBoundary || void 0, t2;
|
|
432
|
-
$[
|
|
432
|
+
$[18] !== fallbackPlacements || $[19] !== rootBoundary || $[20] !== t1 ? (t2 = flip({
|
|
433
433
|
boundary: t1,
|
|
434
434
|
fallbackPlacements,
|
|
435
435
|
padding: 4,
|
|
436
436
|
rootBoundary
|
|
437
|
-
}), $[
|
|
437
|
+
}), $[18] = fallbackPlacements, $[19] = rootBoundary, $[20] = t1, $[21] = t2) : t2 = $[21], ret.push(t2);
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
let t1;
|
|
441
|
-
if ($[
|
|
442
|
-
let t2 = floatingBoundary || void 0, t3;
|
|
443
|
-
$[
|
|
441
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel") ? (t1 = offset({ mainAxis: 4 }), $[22] = t1) : t1 = $[22], ret.push(t1), constrainSize || matchReferenceWidth) {
|
|
442
|
+
let t2 = floatingBoundary || void 0, t3 = constrainSize ? maxWidth : void 0, t4;
|
|
443
|
+
$[23] !== constrainSize || $[24] !== margins || $[25] !== matchReferenceWidth || $[26] !== t2 || $[27] !== t3 ? (t4 = size$1({
|
|
444
444
|
boundaryElement: t2,
|
|
445
445
|
constrainSize,
|
|
446
446
|
margins,
|
|
447
447
|
matchReferenceWidth,
|
|
448
|
-
|
|
449
|
-
padding: 4
|
|
450
|
-
|
|
451
|
-
setReferenceWidth,
|
|
452
|
-
widthRef
|
|
453
|
-
}), $[26] = constrainSize, $[27] = margins, $[28] = matchReferenceWidth, $[29] = maxWidthRef, $[30] = referenceWidthRef, $[31] = setReferenceWidth, $[32] = t2, $[33] = widthRef, $[34] = t3) : t3 = $[34], ret.push(t3);
|
|
448
|
+
maxWidth: t3,
|
|
449
|
+
padding: 4
|
|
450
|
+
}), $[23] = constrainSize, $[24] = margins, $[25] = matchReferenceWidth, $[26] = t2, $[27] = t3, $[28] = t4) : t4 = $[28], ret.push(t4);
|
|
454
451
|
}
|
|
455
452
|
if (preventOverflow) {
|
|
456
453
|
let t2 = floatingBoundary || void 0, t3;
|
|
457
|
-
$[
|
|
454
|
+
$[29] !== rootBoundary || $[30] !== t2 ? (t3 = shift({
|
|
458
455
|
boundary: t2,
|
|
459
456
|
rootBoundary,
|
|
460
457
|
padding: 4
|
|
461
|
-
}), $[
|
|
458
|
+
}), $[29] = rootBoundary, $[30] = t2, $[31] = t3) : t3 = $[31], ret.push(t3);
|
|
462
459
|
}
|
|
463
460
|
if (arrowProp) {
|
|
464
461
|
let t2;
|
|
465
|
-
$[
|
|
462
|
+
$[32] === arrowRef ? t2 = $[33] : (t2 = arrow({
|
|
466
463
|
element: arrowRef,
|
|
467
464
|
padding: 4
|
|
468
|
-
}), $[
|
|
465
|
+
}), $[32] = arrowRef, $[33] = t2), ret.push(t2);
|
|
469
466
|
}
|
|
470
467
|
animate && ret.push(origin);
|
|
471
468
|
let t2 = referenceBoundary || void 0, t3;
|
|
472
|
-
$[
|
|
469
|
+
$[34] === t2 ? t3 = $[35] : (t3 = hide({
|
|
473
470
|
boundary: t2,
|
|
474
471
|
padding: 4,
|
|
475
472
|
strategy: "referenceHidden"
|
|
476
|
-
}), $[
|
|
477
|
-
} else ret = $[
|
|
473
|
+
}), $[34] = t2, $[35] = t3), ret.push(t3), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = constrainSize, $[4] = fallbackPlacements, $[5] = floatingBoundary, $[6] = margins, $[7] = matchReferenceWidth, $[8] = maxWidth, $[9] = placementProp, $[10] = placementStrategy, $[11] = preventOverflow, $[12] = referenceBoundary, $[13] = rootBoundary, $[14] = ret;
|
|
474
|
+
} else ret = $[14];
|
|
478
475
|
return ret;
|
|
479
476
|
}
|
|
480
477
|
export { Popover as t };
|
|
481
478
|
|
|
482
|
-
//# sourceMappingURL=popover-
|
|
479
|
+
//# sourceMappingURL=popover-BVbv1K3z.js.map
|