@sanity/ui 3.0.15-canary.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks-cjs/_visual-editing.js +1822 -761
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/refractor.js +15 -7
- package/dist/_chunks-cjs/refractor.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +1825 -763
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_chunks-es/refractor.mjs +15 -6
- package/dist/_chunks-es/refractor.mjs.map +1 -1
- package/dist/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +847 -346
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +849 -347
- package/dist/index.mjs.map +1 -1
- package/package.json +40 -26
- package/src/core/hooks/useGlobalKeyDown.ts +11 -4
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { isHTMLElement, isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, _getArrayProp, EMPTY_ARRAY, useElementSize, Code, Box, _isEnterToClickElement, Card, Text,
|
|
1
|
+
import { isHTMLElement, isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, _getArrayProp, EMPTY_ARRAY, useElementSize, Code, Box, _isEnterToClickElement, EMPTY_RECORD, Card, Text, Button, Stack, Popover, TextInput, useClickOutsideEvent, _responsive, createGlobalScopedContext, Container, Flex, usePortal, useBoundaryElement, useLayer, useGlobalKeyDown, useTheme_v2, usePrefersReducedMotion, Portal, containsOrEqualsElement, Layer, responsivePaddingStyle, responsiveRadiusStyle, Grid, LayerProvider, isRecord, _cardColorStyle, rem } from "./_chunks-es/_visual-editing.mjs";
|
|
2
2
|
import { Arrow, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Checkbox, ConditionalWrapper, ElementQuery, Heading, Hotkeys, Inline, KBD, Label, Menu, MenuDivider, MenuGroup, MenuItem, PortalProvider, Radio, Select, Spinner, SrOnly, Switch, Tab, TabList, TextArea, ThemeColorProvider, ThemeProvider, Tooltip, TooltipDelayGroupContext, TooltipDelayGroupProvider, VirtualList, _ResizeObserver, _elementSizeObserver, _fillCSSObject, _getResponsiveSpace, _isScrollable, createColorTheme, hexToRgb, hslToRgb, multiply, parseColor, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, screen, studioTheme, useCustomValidity, useMatchMedia, useMediaIndex, usePrefersDark, useRootTheme, useTheme, useTooltipDelayGroup } from "./_chunks-es/_visual-editing.mjs";
|
|
3
3
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
4
|
+
import { c } from "react-compiler-runtime";
|
|
4
5
|
import { SpinnerIcon, ChevronDownIcon, CloseIcon, ToggleArrowRightIcon } from "@sanity/icons";
|
|
5
|
-
import {
|
|
6
|
+
import { useState, useRef, useEffect, useImperativeHandle, Component, forwardRef, useReducer, cloneElement, Children, isValidElement, Fragment, useContext, useSyncExternalStore, startTransition, useId } from "react";
|
|
6
7
|
import { styled, keyframes, css } from "styled-components";
|
|
7
8
|
import { getTheme_v2 } from "@sanity/ui/theme";
|
|
8
9
|
import { motion, AnimatePresence } from "framer-motion";
|
|
@@ -53,7 +54,9 @@ function focusLastDescendant(element) {
|
|
|
53
54
|
return !1;
|
|
54
55
|
}
|
|
55
56
|
function useArrayProp(val, defaultVal) {
|
|
56
|
-
|
|
57
|
+
const $ = c(3);
|
|
58
|
+
let t0;
|
|
59
|
+
return $[0] !== defaultVal || $[1] !== val ? (t0 = _getArrayProp(val, defaultVal), $[0] = defaultVal, $[1] = val, $[2] = t0) : t0 = $[2], t0;
|
|
57
60
|
}
|
|
58
61
|
function _getElements(element, elementsArg) {
|
|
59
62
|
const ret = [element];
|
|
@@ -61,9 +64,13 @@ function _getElements(element, elementsArg) {
|
|
|
61
64
|
Array.isArray(el) ? ret.push(...el) : ret.push(el);
|
|
62
65
|
return ret.filter(Boolean);
|
|
63
66
|
}
|
|
64
|
-
function useClickOutside(listener,
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
+
function useClickOutside(listener, t0, boundaryElement) {
|
|
68
|
+
const $ = c(12), elementsArg = t0 === void 0 ? EMPTY_ARRAY : t0, [element, setElement] = useState(null);
|
|
69
|
+
let t1;
|
|
70
|
+
$[0] !== element || $[1] !== elementsArg ? (t1 = () => _getElements(element, elementsArg), $[0] = element, $[1] = elementsArg, $[2] = t1) : t1 = $[2];
|
|
71
|
+
const [elements, setElements] = useState(t1), elementsRef = useRef(elements);
|
|
72
|
+
let t2, t3;
|
|
73
|
+
$[3] !== element || $[4] !== elementsArg ? (t2 = () => {
|
|
67
74
|
const prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
|
|
68
75
|
if (prevElements.length !== nextElements.length) {
|
|
69
76
|
setElements(nextElements), elementsRef.current = nextElements;
|
|
@@ -74,18 +81,21 @@ function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
|
|
|
74
81
|
setElements(nextElements), elementsRef.current = nextElements;
|
|
75
82
|
return;
|
|
76
83
|
}
|
|
77
|
-
for (const
|
|
78
|
-
if (!prevElements.includes(
|
|
84
|
+
for (const el_0 of nextElements)
|
|
85
|
+
if (!prevElements.includes(el_0)) {
|
|
79
86
|
setElements(nextElements), elementsRef.current = nextElements;
|
|
80
87
|
return;
|
|
81
88
|
}
|
|
82
|
-
}, [element, elementsArg]), useEffect(
|
|
83
|
-
|
|
89
|
+
}, t3 = [element, elementsArg], $[3] = element, $[4] = elementsArg, $[5] = t2, $[6] = t3) : (t2 = $[5], t3 = $[6]), useEffect(t2, t3);
|
|
90
|
+
let t4, t5;
|
|
91
|
+
return $[7] !== boundaryElement || $[8] !== elements || $[9] !== listener ? (t4 = () => {
|
|
92
|
+
if (!listener)
|
|
93
|
+
return;
|
|
84
94
|
const handleWindowMouseDown = (evt) => {
|
|
85
95
|
const target = evt.target;
|
|
86
96
|
if (target instanceof Node && !(boundaryElement && !boundaryElement.contains(target))) {
|
|
87
|
-
for (const
|
|
88
|
-
if (target ===
|
|
97
|
+
for (const el_1 of elements)
|
|
98
|
+
if (target === el_1 || el_1.contains(target))
|
|
89
99
|
return;
|
|
90
100
|
listener(evt);
|
|
91
101
|
}
|
|
@@ -93,14 +103,15 @@ function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
|
|
|
93
103
|
return window.addEventListener("mousedown", handleWindowMouseDown), () => {
|
|
94
104
|
window.removeEventListener("mousedown", handleWindowMouseDown);
|
|
95
105
|
};
|
|
96
|
-
}, [boundaryElement, listener, elements]), setElement;
|
|
106
|
+
}, t5 = [boundaryElement, listener, elements], $[7] = boundaryElement, $[8] = elements, $[9] = listener, $[10] = t4, $[11] = t5) : (t4 = $[10], t5 = $[11]), useEffect(t4, t5), setElement;
|
|
97
107
|
}
|
|
98
108
|
function useElementRect(element) {
|
|
99
109
|
return useElementSize(element)?._contentRect || null;
|
|
100
110
|
}
|
|
101
111
|
function useForwardedRef(ref) {
|
|
102
|
-
const innerRef = useRef(null);
|
|
103
|
-
|
|
112
|
+
const $ = c(1), innerRef = useRef(null);
|
|
113
|
+
let t0;
|
|
114
|
+
return $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => innerRef.current, $[0] = t0) : t0 = $[0], useImperativeHandle(ref, t0), innerRef;
|
|
104
115
|
}
|
|
105
116
|
class ErrorBoundary extends Component {
|
|
106
117
|
state = {
|
|
@@ -147,20 +158,27 @@ const StyledAutocomplete = styled.div.withConfig({
|
|
|
147
158
|
componentId: "sc-1igauft-2"
|
|
148
159
|
})`animation:${rotate} 500ms linear infinite;`;
|
|
149
160
|
function AutocompleteOption(props) {
|
|
150
|
-
const {
|
|
161
|
+
const $ = c(11), {
|
|
151
162
|
children,
|
|
152
163
|
id,
|
|
153
164
|
onSelect,
|
|
154
165
|
selected,
|
|
155
166
|
value
|
|
156
|
-
} = props
|
|
167
|
+
} = props;
|
|
168
|
+
let t0;
|
|
169
|
+
$[0] !== onSelect || $[1] !== value ? (t0 = () => {
|
|
157
170
|
setTimeout(() => {
|
|
158
171
|
onSelect(value);
|
|
159
172
|
}, 0);
|
|
160
|
-
}, [onSelect, value
|
|
173
|
+
}, $[0] = onSelect, $[1] = value, $[2] = t0) : t0 = $[2];
|
|
174
|
+
const handleClick = t0;
|
|
175
|
+
let t1;
|
|
176
|
+
$[3] !== handleClick ? (t1 = (event) => {
|
|
161
177
|
event.key === "Enter" && !_isEnterToClickElement(event.currentTarget) && handleClick();
|
|
162
|
-
}, [handleClick]);
|
|
163
|
-
|
|
178
|
+
}, $[3] = handleClick, $[4] = t1) : t1 = $[4];
|
|
179
|
+
const handleKeyDown = t1;
|
|
180
|
+
let t2;
|
|
181
|
+
return $[5] !== children || $[6] !== handleClick || $[7] !== handleKeyDown || $[8] !== id || $[9] !== selected ? (t2 = /* @__PURE__ */ jsx("li", { "aria-selected": selected, "data-ui": "AutocompleteOption", id, role: "option", onClick: handleClick, onKeyDown: handleKeyDown, children }), $[5] = children, $[6] = handleClick, $[7] = handleKeyDown, $[8] = id, $[9] = selected, $[10] = t2) : t2 = $[10], t2;
|
|
164
182
|
}
|
|
165
183
|
function autocompleteReducer(state, msg) {
|
|
166
184
|
return msg.type === "input/change" ? {
|
|
@@ -202,15 +220,17 @@ function autocompleteReducer(state, msg) {
|
|
|
202
220
|
} : state;
|
|
203
221
|
}
|
|
204
222
|
const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "Home", "End", "PageUp", "PageDown", "Meta", "Tab", "CapsLock"], AUTOCOMPLETE_POPOVER_PLACEMENT = "bottom-start", AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom-start", "top-start"], DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1, InnerAutocomplete = forwardRef(function(props, forwardedRef) {
|
|
205
|
-
const
|
|
206
|
-
|
|
223
|
+
const $ = c(180);
|
|
224
|
+
let customValidity, disabled, filterOptionProp, icon, id, loading, onBlur, onChange, onFocus, onQueryChange, onSelect, openButton, openOnFocus, optionsProp, prefix, readOnly, relatedElements, renderOptionProp, renderPopover, restProps, suffix, t0, t1, t2, t3, t4, t5, t6, valueProp;
|
|
225
|
+
$[0] !== props ? ({
|
|
226
|
+
border: t0,
|
|
207
227
|
customValidity,
|
|
208
228
|
disabled,
|
|
209
229
|
filterOption: filterOptionProp,
|
|
210
|
-
fontSize
|
|
230
|
+
fontSize: t1,
|
|
211
231
|
icon,
|
|
212
232
|
id,
|
|
213
|
-
listBox
|
|
233
|
+
listBox: t2,
|
|
214
234
|
loading,
|
|
215
235
|
onBlur,
|
|
216
236
|
onChange,
|
|
@@ -220,35 +240,60 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
220
240
|
openButton,
|
|
221
241
|
openOnFocus,
|
|
222
242
|
options: optionsProp,
|
|
223
|
-
padding:
|
|
224
|
-
popover
|
|
243
|
+
padding: t3,
|
|
244
|
+
popover: t4,
|
|
225
245
|
prefix,
|
|
226
|
-
radius
|
|
246
|
+
radius: t5,
|
|
227
247
|
readOnly,
|
|
228
248
|
relatedElements,
|
|
229
249
|
renderOption: renderOptionProp,
|
|
230
250
|
renderPopover,
|
|
231
|
-
renderValue
|
|
251
|
+
renderValue: t6,
|
|
232
252
|
suffix,
|
|
233
253
|
value: valueProp,
|
|
234
254
|
...restProps
|
|
235
|
-
} = props, [
|
|
236
|
-
|
|
255
|
+
} = props, $[0] = props, $[1] = customValidity, $[2] = disabled, $[3] = filterOptionProp, $[4] = icon, $[5] = id, $[6] = loading, $[7] = onBlur, $[8] = onChange, $[9] = onFocus, $[10] = onQueryChange, $[11] = onSelect, $[12] = openButton, $[13] = openOnFocus, $[14] = optionsProp, $[15] = prefix, $[16] = readOnly, $[17] = relatedElements, $[18] = renderOptionProp, $[19] = renderPopover, $[20] = restProps, $[21] = suffix, $[22] = t0, $[23] = t1, $[24] = t2, $[25] = t3, $[26] = t4, $[27] = t5, $[28] = t6, $[29] = valueProp) : (customValidity = $[1], disabled = $[2], filterOptionProp = $[3], icon = $[4], id = $[5], loading = $[6], onBlur = $[7], onChange = $[8], onFocus = $[9], onQueryChange = $[10], onSelect = $[11], openButton = $[12], openOnFocus = $[13], optionsProp = $[14], prefix = $[15], readOnly = $[16], relatedElements = $[17], renderOptionProp = $[18], renderPopover = $[19], restProps = $[20], suffix = $[21], t0 = $[22], t1 = $[23], t2 = $[24], t3 = $[25], t4 = $[26], t5 = $[27], t6 = $[28], valueProp = $[29]);
|
|
256
|
+
const border = t0 === void 0 ? !0 : t0, fontSize = t1 === void 0 ? 2 : t1, listBox = t2 === void 0 ? EMPTY_RECORD : t2, paddingProp = t3 === void 0 ? 3 : t3, popover = t4 === void 0 ? EMPTY_RECORD : t4, radius = t5 === void 0 ? 2 : t5, renderValue = t6 === void 0 ? DEFAULT_RENDER_VALUE : t6, t7 = valueProp || null, t8 = valueProp || null;
|
|
257
|
+
let t9;
|
|
258
|
+
$[30] !== t7 || $[31] !== t8 ? (t9 = {
|
|
259
|
+
activeValue: t7,
|
|
237
260
|
focused: !1,
|
|
238
261
|
listFocused: !1,
|
|
239
262
|
query: null,
|
|
240
|
-
value:
|
|
241
|
-
}
|
|
263
|
+
value: t8
|
|
264
|
+
}, $[30] = t7, $[31] = t8, $[32] = t9) : t9 = $[32];
|
|
265
|
+
const [state, dispatch] = useReducer(autocompleteReducer, t9), {
|
|
242
266
|
activeValue,
|
|
243
267
|
focused,
|
|
244
268
|
listFocused,
|
|
245
269
|
query,
|
|
246
270
|
value
|
|
247
|
-
} = state
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
271
|
+
} = state;
|
|
272
|
+
let t10;
|
|
273
|
+
$[33] !== fontSize || $[34] !== paddingProp ? (t10 = (t112) => {
|
|
274
|
+
const {
|
|
275
|
+
value: value_0
|
|
276
|
+
} = t112;
|
|
277
|
+
return /* @__PURE__ */ jsx(Card, { "data-as": "button", padding: paddingProp, radius: 2, tone: "inherit", children: /* @__PURE__ */ jsx(Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 }) });
|
|
278
|
+
}, $[33] = fontSize, $[34] = paddingProp, $[35] = t10) : t10 = $[35];
|
|
279
|
+
const renderOption = typeof renderOptionProp == "function" ? renderOptionProp : t10, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = useRef(null), resultsPopoverElementRef = useRef(null), inputElementRef = useRef(null), listBoxElementRef = useRef(null), [inputElement, setInputElement] = useState(null), listFocusedRef = useRef(!1), valueRef = useRef(value), valuePropRef = useRef(valueProp), popoverMouseWithinRef = useRef(!1);
|
|
280
|
+
let t11, t12;
|
|
281
|
+
$[36] !== inputElement ? (t11 = () => inputElement, t12 = [inputElement], $[36] = inputElement, $[37] = t11, $[38] = t12) : (t11 = $[37], t12 = $[38]), useImperativeHandle(inputElementRef, t11, t12);
|
|
282
|
+
let t13, t14;
|
|
283
|
+
$[39] !== inputElement ? (t13 = () => inputElement, t14 = [inputElement], $[39] = inputElement, $[40] = t13, $[41] = t14) : (t13 = $[40], t14 = $[41]), useImperativeHandle(forwardedRef, t13, t14);
|
|
284
|
+
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = _getArrayProp(paddingProp);
|
|
285
|
+
let t15;
|
|
286
|
+
$[42] !== options || $[43] !== value ? (t15 = value !== null ? options.find((o) => o.value === value) : void 0, $[42] = options, $[43] = value, $[44] = t15) : t15 = $[44];
|
|
287
|
+
const currentOption = t15;
|
|
288
|
+
let t16;
|
|
289
|
+
if ($[45] !== filterOption || $[46] !== options || $[47] !== query) {
|
|
290
|
+
let t172;
|
|
291
|
+
$[49] !== filterOption || $[50] !== query ? (t172 = (option) => query ? filterOption(query, option) : !0, $[49] = filterOption, $[50] = query, $[51] = t172) : t172 = $[51], t16 = options.filter(t172), $[45] = filterOption, $[46] = options, $[47] = query, $[48] = t16;
|
|
292
|
+
} else
|
|
293
|
+
t16 = $[48];
|
|
294
|
+
const filteredOptions = t16, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null;
|
|
295
|
+
let t17;
|
|
296
|
+
$[52] !== onBlur || $[53] !== onQueryChange || $[54] !== relatedElements ? (t17 = (event) => {
|
|
252
297
|
setTimeout(() => {
|
|
253
298
|
if (popoverMouseWithinRef.current)
|
|
254
299
|
return;
|
|
@@ -265,21 +310,31 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
265
310
|
type: "root/blur"
|
|
266
311
|
}), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
|
|
267
312
|
}, 0);
|
|
268
|
-
}, [onBlur, onQueryChange, relatedElements
|
|
269
|
-
|
|
270
|
-
|
|
313
|
+
}, $[52] = onBlur, $[53] = onQueryChange, $[54] = relatedElements, $[55] = t17) : t17 = $[55];
|
|
314
|
+
const handleRootBlur = t17;
|
|
315
|
+
let t18;
|
|
316
|
+
$[56] === Symbol.for("react.memo_cache_sentinel") ? (t18 = (event_0) => {
|
|
317
|
+
const listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = listBoxElement?.contains(focusedElement) || !1;
|
|
318
|
+
listFocused_0 !== listFocusedRef.current && (listFocusedRef.current = listFocused_0, dispatch({
|
|
271
319
|
type: "root/setListFocused",
|
|
272
|
-
listFocused:
|
|
320
|
+
listFocused: listFocused_0
|
|
273
321
|
}));
|
|
274
|
-
}, []
|
|
322
|
+
}, $[56] = t18) : t18 = $[56];
|
|
323
|
+
const handleRootFocus = t18;
|
|
324
|
+
let t19;
|
|
325
|
+
$[57] !== onChange || $[58] !== onQueryChange || $[59] !== onSelect ? (t19 = (v) => {
|
|
275
326
|
dispatch({
|
|
276
327
|
type: "value/change",
|
|
277
328
|
value: v
|
|
278
329
|
}), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
|
|
279
|
-
}, [onChange,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
330
|
+
}, $[57] = onChange, $[58] = onQueryChange, $[59] = onSelect, $[60] = t19) : t19 = $[60];
|
|
331
|
+
const handleOptionSelect = t19;
|
|
332
|
+
let t20;
|
|
333
|
+
$[61] !== activeValue || $[62] !== filteredOptions || $[63] !== filteredOptionsLen || $[64] !== onQueryChange ? (t20 = (event_1) => {
|
|
334
|
+
if (event_1.key === "ArrowDown") {
|
|
335
|
+
if (event_1.preventDefault(), !filteredOptionsLen)
|
|
336
|
+
return;
|
|
337
|
+
const activeOption = filteredOptions.find((o_0) => o_0.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
|
|
283
338
|
nextActiveOption && dispatch({
|
|
284
339
|
type: "root/setActiveValue",
|
|
285
340
|
value: nextActiveOption.value,
|
|
@@ -287,56 +342,80 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
287
342
|
});
|
|
288
343
|
return;
|
|
289
344
|
}
|
|
290
|
-
if (
|
|
291
|
-
if (
|
|
292
|
-
|
|
293
|
-
|
|
345
|
+
if (event_1.key === "ArrowUp") {
|
|
346
|
+
if (event_1.preventDefault(), !filteredOptionsLen)
|
|
347
|
+
return;
|
|
348
|
+
const activeOption_0 = filteredOptions.find((o_1) => o_1.value === activeValue), activeIndex_0 = activeOption_0 ? filteredOptions.indexOf(activeOption_0) : -1, nextActiveOption_0 = filteredOptions[activeIndex_0 === -1 ? filteredOptionsLen - 1 : (filteredOptionsLen + activeIndex_0 - 1) % filteredOptionsLen];
|
|
349
|
+
nextActiveOption_0 && dispatch({
|
|
294
350
|
type: "root/setActiveValue",
|
|
295
|
-
value:
|
|
351
|
+
value: nextActiveOption_0.value,
|
|
296
352
|
listFocused: !0
|
|
297
353
|
});
|
|
298
354
|
return;
|
|
299
355
|
}
|
|
300
|
-
if (
|
|
356
|
+
if (event_1.key === "Escape") {
|
|
301
357
|
dispatch({
|
|
302
358
|
type: "root/escape"
|
|
303
359
|
}), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
|
|
304
360
|
return;
|
|
305
361
|
}
|
|
306
|
-
const target =
|
|
307
|
-
if ((listEl === target || listEl?.contains(target)) && !AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(
|
|
362
|
+
const target = event_1.target, listEl = listBoxElementRef.current;
|
|
363
|
+
if ((listEl === target || listEl?.contains(target)) && !AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event_1.key)) {
|
|
308
364
|
inputElementRef.current?.focus();
|
|
309
365
|
return;
|
|
310
366
|
}
|
|
311
|
-
}, [activeValue, filteredOptions, filteredOptionsLen, onQueryChange
|
|
312
|
-
|
|
367
|
+
}, $[61] = activeValue, $[62] = filteredOptions, $[63] = filteredOptionsLen, $[64] = onQueryChange, $[65] = t20) : t20 = $[65];
|
|
368
|
+
const handleRootKeyDown = t20;
|
|
369
|
+
let t21;
|
|
370
|
+
$[66] !== onQueryChange ? (t21 = (event_2) => {
|
|
371
|
+
const nextQuery = event_2.currentTarget.value;
|
|
313
372
|
dispatch({
|
|
314
373
|
type: "input/change",
|
|
315
374
|
query: nextQuery
|
|
316
375
|
}), onQueryChange && onQueryChange(nextQuery);
|
|
317
|
-
}, [onQueryChange
|
|
376
|
+
}, $[66] = onQueryChange, $[67] = t21) : t21 = $[67];
|
|
377
|
+
const handleInputChange = t21;
|
|
378
|
+
let t22;
|
|
379
|
+
$[68] !== currentOption || $[69] !== renderValue || $[70] !== value ? (t22 = () => {
|
|
318
380
|
dispatch({
|
|
319
381
|
type: "root/open",
|
|
320
382
|
query: value ? renderValue(value, currentOption) : ""
|
|
321
383
|
});
|
|
322
|
-
}, [currentOption, renderValue, value
|
|
384
|
+
}, $[68] = currentOption, $[69] = renderValue, $[70] = value, $[71] = t22) : t22 = $[71];
|
|
385
|
+
const dispatchOpen = t22;
|
|
386
|
+
let t23;
|
|
387
|
+
$[72] !== dispatchOpen || $[73] !== focused || $[74] !== onFocus || $[75] !== openOnFocus ? (t23 = (event_3) => {
|
|
323
388
|
focused || (dispatch({
|
|
324
389
|
type: "input/focus"
|
|
325
|
-
}), onFocus && onFocus(
|
|
326
|
-
}, [focused, onFocus, openOnFocus,
|
|
390
|
+
}), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
|
|
391
|
+
}, $[72] = dispatchOpen, $[73] = focused, $[74] = onFocus, $[75] = openOnFocus, $[76] = t23) : t23 = $[76];
|
|
392
|
+
const handleInputFocus = t23;
|
|
393
|
+
let t24;
|
|
394
|
+
$[77] === Symbol.for("react.memo_cache_sentinel") ? (t24 = () => {
|
|
327
395
|
popoverMouseWithinRef.current = !0;
|
|
328
|
-
}, []
|
|
396
|
+
}, $[77] = t24) : t24 = $[77];
|
|
397
|
+
const handlePopoverMouseEnter = t24;
|
|
398
|
+
let t25;
|
|
399
|
+
$[78] === Symbol.for("react.memo_cache_sentinel") ? (t25 = () => {
|
|
329
400
|
popoverMouseWithinRef.current = !1;
|
|
330
|
-
}, []
|
|
401
|
+
}, $[78] = t25) : t25 = $[78];
|
|
402
|
+
const handlePopoverMouseLeave = t25;
|
|
403
|
+
let t26;
|
|
404
|
+
$[79] !== onChange || $[80] !== onQueryChange ? (t26 = () => {
|
|
331
405
|
dispatch({
|
|
332
406
|
type: "root/clear"
|
|
333
407
|
}), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
|
|
334
|
-
}, [onChange, onQueryChange
|
|
408
|
+
}, $[79] = onChange, $[80] = onQueryChange, $[81] = t26) : t26 = $[81];
|
|
409
|
+
const handleClearButtonClick = t26;
|
|
410
|
+
let t27;
|
|
411
|
+
$[82] === Symbol.for("react.memo_cache_sentinel") ? (t27 = () => {
|
|
335
412
|
dispatch({
|
|
336
413
|
type: "input/focus"
|
|
337
414
|
});
|
|
338
|
-
}, []);
|
|
339
|
-
|
|
415
|
+
}, $[82] = t27) : t27 = $[82];
|
|
416
|
+
const handleClearButtonFocus = t27;
|
|
417
|
+
let t28, t29;
|
|
418
|
+
$[83] !== valueProp ? (t28 = () => {
|
|
340
419
|
if (valueProp !== valuePropRef.current) {
|
|
341
420
|
valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
|
|
342
421
|
type: "value/change",
|
|
@@ -348,46 +427,117 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
348
427
|
type: "value/change",
|
|
349
428
|
value: valueProp || null
|
|
350
429
|
}));
|
|
351
|
-
}, [valueProp]), useEffect(
|
|
430
|
+
}, t29 = [valueProp], $[83] = valueProp, $[84] = t28, $[85] = t29) : (t28 = $[84], t29 = $[85]), useEffect(t28, t29);
|
|
431
|
+
let t30, t31;
|
|
432
|
+
$[86] !== focused ? (t30 = () => {
|
|
352
433
|
!focused && valueRef.current && dispatch({
|
|
353
434
|
type: "root/setActiveValue",
|
|
354
435
|
value: valueRef.current
|
|
355
436
|
});
|
|
356
|
-
}, [focused]), useEffect(
|
|
437
|
+
}, t31 = [focused], $[86] = focused, $[87] = t30, $[88] = t31) : (t30 = $[87], t31 = $[88]), useEffect(t30, t31);
|
|
438
|
+
let t32, t33;
|
|
439
|
+
$[89] !== activeValue || $[90] !== filteredOptions ? (t32 = () => {
|
|
357
440
|
const listElement = listBoxElementRef.current;
|
|
358
|
-
if (!listElement)
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
441
|
+
if (!listElement)
|
|
442
|
+
return;
|
|
443
|
+
const activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
|
|
444
|
+
if (activeOption_1) {
|
|
445
|
+
const activeIndex_1 = filteredOptions.indexOf(activeOption_1), activeItemElement = listElement.childNodes[activeIndex_1];
|
|
362
446
|
if (activeItemElement) {
|
|
363
447
|
if (_hasFocus(activeItemElement))
|
|
364
448
|
return;
|
|
365
449
|
focusFirstDescendant(activeItemElement);
|
|
366
450
|
}
|
|
367
451
|
}
|
|
368
|
-
}, [activeValue, filteredOptions]);
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
452
|
+
}, t33 = [activeValue, filteredOptions], $[89] = activeValue, $[90] = filteredOptions, $[91] = t32, $[92] = t33) : (t32 = $[91], t33 = $[92]), useEffect(t32, t33);
|
|
453
|
+
let t34;
|
|
454
|
+
bb0: {
|
|
455
|
+
if (!loading && !disabled && value) {
|
|
456
|
+
let t352;
|
|
457
|
+
$[93] === Symbol.for("react.memo_cache_sentinel") ? (t352 = {
|
|
372
458
|
"aria-label": "Clear",
|
|
373
459
|
onFocus: handleClearButtonFocus
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
460
|
+
}, $[93] = t352) : t352 = $[93], t34 = t352;
|
|
461
|
+
break bb0;
|
|
462
|
+
}
|
|
463
|
+
t34 = void 0;
|
|
464
|
+
}
|
|
465
|
+
const clearButton = t34, openButtonBoxPadding = padding.map(_temp$3), openButtonPadding = padding.map(_temp2$1), openButtonProps = typeof openButton == "object" ? openButton : EMPTY_RECORD;
|
|
466
|
+
let t35;
|
|
467
|
+
$[94] !== dispatchOpen || $[95] !== openButtonProps ? (t35 = (event_4) => {
|
|
468
|
+
dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
|
|
469
|
+
}, $[94] = dispatchOpen, $[95] = openButtonProps, $[96] = t35) : t35 = $[96];
|
|
470
|
+
const handleOpenClick = t35;
|
|
471
|
+
let t36;
|
|
472
|
+
$[97] !== disabled || $[98] !== expanded || $[99] !== fontSize || $[100] !== handleOpenClick || $[101] !== openButton || $[102] !== openButtonBoxPadding || $[103] !== openButtonPadding || $[104] !== openButtonProps || $[105] !== readOnly ? (t36 = !disabled && !readOnly && openButton ? /* @__PURE__ */ jsx(Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsx(Button, { "aria-label": "Open", disabled: expanded, fontSize, icon: ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, $[97] = disabled, $[98] = expanded, $[99] = fontSize, $[100] = handleOpenClick, $[101] = openButton, $[102] = openButtonBoxPadding, $[103] = openButtonPadding, $[104] = openButtonProps, $[105] = readOnly, $[106] = t36) : t36 = $[106];
|
|
473
|
+
const openButtonNode = t36;
|
|
474
|
+
let t37;
|
|
475
|
+
bb1: {
|
|
476
|
+
if (query === null) {
|
|
477
|
+
if (value !== null) {
|
|
478
|
+
let t382;
|
|
479
|
+
$[107] !== currentOption || $[108] !== renderValue || $[109] !== value ? (t382 = renderValue(value, currentOption), $[107] = currentOption, $[108] = renderValue, $[109] = value, $[110] = t382) : t382 = $[110], t37 = t382;
|
|
480
|
+
break bb1;
|
|
481
|
+
}
|
|
482
|
+
t37 = "";
|
|
483
|
+
break bb1;
|
|
484
|
+
}
|
|
485
|
+
t37 = query;
|
|
486
|
+
}
|
|
487
|
+
const inputValue = t37;
|
|
488
|
+
let t38;
|
|
489
|
+
$[111] !== listFocused ? (t38 = (event_5) => {
|
|
490
|
+
event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
|
|
491
|
+
}, $[111] = listFocused, $[112] = t38) : t38 = $[112];
|
|
492
|
+
const handleListBoxKeyDown = t38;
|
|
493
|
+
let t39;
|
|
494
|
+
bb2: {
|
|
495
|
+
if (filteredOptions.length === 0) {
|
|
496
|
+
t39 = null;
|
|
497
|
+
break bb2;
|
|
498
|
+
}
|
|
499
|
+
let t402;
|
|
500
|
+
if ($[113] !== activeValue || $[114] !== currentOption || $[115] !== filteredOptions || $[116] !== handleOptionSelect || $[117] !== id || $[118] !== listFocused || $[119] !== loading || $[120] !== renderOption) {
|
|
501
|
+
let t413;
|
|
502
|
+
$[122] !== activeValue || $[123] !== currentOption || $[124] !== handleOptionSelect || $[125] !== id || $[126] !== listFocused || $[127] !== loading || $[128] !== renderOption ? (t413 = (option_0) => {
|
|
503
|
+
const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
|
|
504
|
+
return /* @__PURE__ */ jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: cloneElement(renderOption(option_0), {
|
|
505
|
+
disabled: loading,
|
|
506
|
+
selected: active,
|
|
507
|
+
tabIndex: listFocused && active ? 0 : -1
|
|
508
|
+
}) }, option_0.value);
|
|
509
|
+
}, $[122] = activeValue, $[123] = currentOption, $[124] = handleOptionSelect, $[125] = id, $[126] = listFocused, $[127] = loading, $[128] = renderOption, $[129] = t413) : t413 = $[129], t402 = filteredOptions.map(t413), $[113] = activeValue, $[114] = currentOption, $[115] = filteredOptions, $[116] = handleOptionSelect, $[117] = id, $[118] = listFocused, $[119] = loading, $[120] = renderOption, $[121] = t402;
|
|
510
|
+
} else
|
|
511
|
+
t402 = $[121];
|
|
512
|
+
let t412;
|
|
513
|
+
$[130] !== listBoxId || $[131] !== t402 ? (t412 = /* @__PURE__ */ jsx(Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", id: listBoxId, ref: listBoxElementRef, role: "listbox", space: 1, children: t402 }), $[130] = listBoxId, $[131] = t402, $[132] = t412) : t412 = $[132];
|
|
514
|
+
let t422;
|
|
515
|
+
$[133] !== handleListBoxKeyDown || $[134] !== listBox || $[135] !== t412 ? (t422 = /* @__PURE__ */ jsx(ListBox, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: t412 }), $[133] = handleListBoxKeyDown, $[134] = listBox, $[135] = t412, $[136] = t422) : t422 = $[136], t39 = t422;
|
|
516
|
+
}
|
|
517
|
+
const content2 = t39;
|
|
518
|
+
let t40;
|
|
519
|
+
bb3: {
|
|
520
|
+
if (renderPopover) {
|
|
521
|
+
const t413 = !expanded;
|
|
522
|
+
let t422;
|
|
523
|
+
$[137] !== content2 || $[138] !== handlePopoverMouseEnter || $[139] !== handlePopoverMouseLeave || $[140] !== inputElement || $[141] !== renderPopover || $[142] !== t413 ? (t422 = /* @__PURE__ */ jsx(RenderPopover, { content: content2, hidden: t413, inputElement, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, resultsPopoverElementRef, renderPopover }), $[137] = content2, $[138] = handlePopoverMouseEnter, $[139] = handlePopoverMouseLeave, $[140] = inputElement, $[141] = renderPopover, $[142] = t413, $[143] = t422) : t422 = $[143], t40 = t422;
|
|
524
|
+
break bb3;
|
|
525
|
+
}
|
|
526
|
+
if (filteredOptionsLen === 0) {
|
|
527
|
+
t40 = null;
|
|
528
|
+
break bb3;
|
|
529
|
+
}
|
|
530
|
+
let t412;
|
|
531
|
+
$[144] !== content2 || $[145] !== expanded || $[146] !== handlePopoverMouseEnter || $[147] !== handlePopoverMouseLeave || $[148] !== inputElement || $[149] !== popover || $[150] !== radius ? (t412 = /* @__PURE__ */ jsx(Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius, ref: resultsPopoverElementRef, referenceElement: inputElement, ...popover }), $[144] = content2, $[145] = expanded, $[146] = handlePopoverMouseEnter, $[147] = handlePopoverMouseLeave, $[148] = inputElement, $[149] = popover, $[150] = radius, $[151] = t412) : t412 = $[151], t40 = t412;
|
|
532
|
+
}
|
|
533
|
+
const results = t40, t41 = loading && AnimatedSpinnerIcon, t42 = suffix || openButtonNode;
|
|
534
|
+
let t43;
|
|
535
|
+
$[152] !== activeItemId || $[153] !== border || $[154] !== clearButton || $[155] !== customValidity || $[156] !== disabled || $[157] !== expanded || $[158] !== fontSize || $[159] !== handleClearButtonClick || $[160] !== handleInputChange || $[161] !== handleInputFocus || $[162] !== icon || $[163] !== id || $[164] !== inputValue || $[165] !== listBoxId || $[166] !== padding || $[167] !== prefix || $[168] !== radius || $[169] !== readOnly || $[170] !== restProps || $[171] !== t41 || $[172] !== t42 ? (t43 = /* @__PURE__ */ jsx(TextInput, { ...restProps, "aria-activedescendant": activeItemId, "aria-autocomplete": "list", "aria-expanded": expanded, "aria-owns": listBoxId, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", border, clearButton, customValidity, disabled, fontSize, icon, iconRight: t41, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: setInputElement, role: "combobox", spellCheck: !1, suffix: t42, value: inputValue }), $[152] = activeItemId, $[153] = border, $[154] = clearButton, $[155] = customValidity, $[156] = disabled, $[157] = expanded, $[158] = fontSize, $[159] = handleClearButtonClick, $[160] = handleInputChange, $[161] = handleInputFocus, $[162] = icon, $[163] = id, $[164] = inputValue, $[165] = listBoxId, $[166] = padding, $[167] = prefix, $[168] = radius, $[169] = readOnly, $[170] = restProps, $[171] = t41, $[172] = t42, $[173] = t43) : t43 = $[173];
|
|
536
|
+
let t44;
|
|
537
|
+
return $[174] !== handleRootBlur || $[175] !== handleRootFocus || $[176] !== handleRootKeyDown || $[177] !== results || $[178] !== t43 ? (t44 = /* @__PURE__ */ jsxs(StyledAutocomplete, { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
|
|
538
|
+
t43,
|
|
389
539
|
results
|
|
390
|
-
] });
|
|
540
|
+
] }), $[174] = handleRootBlur, $[175] = handleRootFocus, $[176] = handleRootKeyDown, $[177] = results, $[178] = t43, $[179] = t44) : t44 = $[179], t44;
|
|
391
541
|
});
|
|
392
542
|
function RenderPopover({
|
|
393
543
|
renderPopover,
|
|
@@ -407,22 +557,46 @@ function RenderPopover({
|
|
|
407
557
|
}, resultsPopoverElementRef);
|
|
408
558
|
}
|
|
409
559
|
InnerAutocomplete.displayName = "ForwardRef(Autocomplete)";
|
|
410
|
-
const Autocomplete = InnerAutocomplete
|
|
560
|
+
const Autocomplete = InnerAutocomplete;
|
|
561
|
+
function _temp$3(v_0) {
|
|
562
|
+
return v_0 === 0 ? 0 : v_0 === 1 || v_0 === 2 ? 1 : v_0 - 2;
|
|
563
|
+
}
|
|
564
|
+
function _temp2$1(v_1) {
|
|
565
|
+
return Math.max(v_1 - 1, 0);
|
|
566
|
+
}
|
|
567
|
+
const StyledBreadcrumbs = styled.ol.withConfig({
|
|
411
568
|
displayName: "StyledBreadcrumbs",
|
|
412
569
|
componentId: "sc-1es8h8q-0"
|
|
413
570
|
})`margin:0;padding:0;display:flex;list-style:none;align-items:center;white-space:nowrap;line-height:0;`, ExpandButton = styled(Button).withConfig({
|
|
414
571
|
displayName: "ExpandButton",
|
|
415
572
|
componentId: "sc-1es8h8q-1"
|
|
416
573
|
})`appearance:none;margin:-4px;`, Breadcrumbs = forwardRef(function(props, ref) {
|
|
417
|
-
const
|
|
574
|
+
const $ = c(29);
|
|
575
|
+
let children, maxLength, restProps, separator, t0;
|
|
576
|
+
$[0] !== props ? ({
|
|
418
577
|
children,
|
|
419
578
|
maxLength,
|
|
420
579
|
separator,
|
|
421
|
-
space:
|
|
580
|
+
space: t0,
|
|
422
581
|
...restProps
|
|
423
|
-
} = props,
|
|
424
|
-
|
|
425
|
-
|
|
582
|
+
} = props, $[0] = props, $[1] = children, $[2] = maxLength, $[3] = restProps, $[4] = separator, $[5] = t0) : (children = $[1], maxLength = $[2], restProps = $[3], separator = $[4], t0 = $[5]);
|
|
583
|
+
const spaceRaw = t0 === void 0 ? 2 : t0;
|
|
584
|
+
let t1;
|
|
585
|
+
$[6] !== spaceRaw ? (t1 = _getArrayProp(spaceRaw), $[6] = spaceRaw, $[7] = t1) : t1 = $[7];
|
|
586
|
+
const space = t1, [open, setOpen] = useState(!1), expandElementRef = useRef(null), popoverElementRef = useRef(null);
|
|
587
|
+
let t2;
|
|
588
|
+
$[8] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => setOpen(!1), $[8] = t2) : t2 = $[8];
|
|
589
|
+
const collapse = t2;
|
|
590
|
+
let t3;
|
|
591
|
+
$[9] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => setOpen(!0), $[9] = t3) : t3 = $[9];
|
|
592
|
+
const expand = t3;
|
|
593
|
+
let t4;
|
|
594
|
+
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => [expandElementRef.current, popoverElementRef.current], $[10] = t4) : t4 = $[10], useClickOutsideEvent(collapse, t4);
|
|
595
|
+
let t5;
|
|
596
|
+
$[11] !== children ? (t5 = Children.toArray(children).filter(isValidElement), $[11] = children, $[12] = t5) : t5 = $[12];
|
|
597
|
+
const rawItems = t5;
|
|
598
|
+
let t6;
|
|
599
|
+
$[13] !== maxLength || $[14] !== open || $[15] !== rawItems || $[16] !== space ? (t6 = {
|
|
426
600
|
collapse,
|
|
427
601
|
expand,
|
|
428
602
|
expandElementRef,
|
|
@@ -431,27 +605,49 @@ const Autocomplete = InnerAutocomplete, StyledBreadcrumbs = styled.ol.withConfig
|
|
|
431
605
|
popoverElementRef,
|
|
432
606
|
rawItems,
|
|
433
607
|
space
|
|
434
|
-
});
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
608
|
+
}, $[13] = maxLength, $[14] = open, $[15] = rawItems, $[16] = space, $[17] = t6) : t6 = $[17];
|
|
609
|
+
const items = useItems(t6);
|
|
610
|
+
let t7;
|
|
611
|
+
if ($[18] !== items || $[19] !== separator || $[20] !== space) {
|
|
612
|
+
let t82;
|
|
613
|
+
$[22] !== separator || $[23] !== space ? (t82 = (item, itemIndex) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
614
|
+
itemIndex > 0 && /* @__PURE__ */ jsx(Box, { "aria-hidden": !0, as: "li", paddingX: space, children: separator || /* @__PURE__ */ jsx(Text, { muted: !0, children: "/" }) }),
|
|
615
|
+
/* @__PURE__ */ jsx(Box, { as: "li", children: item })
|
|
616
|
+
] }, itemIndex), $[22] = separator, $[23] = space, $[24] = t82) : t82 = $[24], t7 = items.map(t82), $[18] = items, $[19] = separator, $[20] = space, $[21] = t7;
|
|
617
|
+
} else
|
|
618
|
+
t7 = $[21];
|
|
619
|
+
let t8;
|
|
620
|
+
return $[25] !== ref || $[26] !== restProps || $[27] !== t7 ? (t8 = /* @__PURE__ */ jsx(StyledBreadcrumbs, { "data-ui": "Breadcrumbs", ...restProps, ref, children: t7 }), $[25] = ref, $[26] = restProps, $[27] = t7, $[28] = t8) : t8 = $[28], t8;
|
|
439
621
|
});
|
|
440
622
|
Breadcrumbs.displayName = "ForwardRef(Breadcrumbs)";
|
|
441
|
-
function useItems({
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
623
|
+
function useItems(t0) {
|
|
624
|
+
const $ = c(28), {
|
|
625
|
+
collapse,
|
|
626
|
+
expand,
|
|
627
|
+
expandElementRef,
|
|
628
|
+
maxLength,
|
|
629
|
+
open,
|
|
630
|
+
popoverElementRef,
|
|
631
|
+
rawItems,
|
|
632
|
+
space
|
|
633
|
+
} = t0, len = rawItems.length;
|
|
452
634
|
if (maxLength && len > maxLength) {
|
|
453
635
|
const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
|
|
454
|
-
|
|
636
|
+
let t1;
|
|
637
|
+
if ($[0] !== afterLength || $[1] !== beforeLength || $[2] !== collapse || $[3] !== expand || $[4] !== expandElementRef || $[5] !== len || $[6] !== open || $[7] !== popoverElementRef || $[8] !== rawItems || $[9] !== space) {
|
|
638
|
+
const t2 = rawItems.slice(0, beforeLength - 1);
|
|
639
|
+
let t3;
|
|
640
|
+
$[11] !== afterLength || $[12] !== beforeLength || $[13] !== len || $[14] !== rawItems ? (t3 = rawItems.slice(beforeLength - 1, len - afterLength), $[11] = afterLength, $[12] = beforeLength, $[13] = len, $[14] = rawItems, $[15] = t3) : t3 = $[15];
|
|
641
|
+
let t4;
|
|
642
|
+
$[16] !== space || $[17] !== t3 ? (t4 = /* @__PURE__ */ jsx(Stack, { as: "ol", overflow: "auto", padding: space, space, children: t3 }), $[16] = space, $[17] = t3, $[18] = t4) : t4 = $[18];
|
|
643
|
+
const t5 = open ? collapse : expand;
|
|
644
|
+
let t6;
|
|
645
|
+
$[19] !== expandElementRef || $[20] !== open || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsx(ExpandButton, { fontSize: 1, mode: "bleed", onClick: t5, padding: 1, ref: expandElementRef, selected: open, text: "\u2026" }), $[19] = expandElementRef, $[20] = open, $[21] = t5, $[22] = t6) : t6 = $[22];
|
|
646
|
+
let t7;
|
|
647
|
+
$[23] !== open || $[24] !== popoverElementRef || $[25] !== t4 || $[26] !== t6 ? (t7 = /* @__PURE__ */ jsx(Popover, { constrainSize: !0, content: t4, open, placement: "top", portal: !0, ref: popoverElementRef, children: t6 }, "button"), $[23] = open, $[24] = popoverElementRef, $[25] = t4, $[26] = t6, $[27] = t7) : t7 = $[27], t1 = [...t2, t7, ...rawItems.slice(len - afterLength)], $[0] = afterLength, $[1] = beforeLength, $[2] = collapse, $[3] = expand, $[4] = expandElementRef, $[5] = len, $[6] = open, $[7] = popoverElementRef, $[8] = rawItems, $[9] = space, $[10] = t1;
|
|
648
|
+
} else
|
|
649
|
+
t1 = $[10];
|
|
650
|
+
return t1;
|
|
455
651
|
}
|
|
456
652
|
return rawItems;
|
|
457
653
|
}
|
|
@@ -544,7 +740,7 @@ const StyledDialog = /* @__PURE__ */ styled(Layer).withConfig({
|
|
|
544
740
|
displayName: "DialogFooter",
|
|
545
741
|
componentId: "sc-4n4xb3-6"
|
|
546
742
|
})`position:relative;z-index:3;`, DialogCard = forwardRef(function(props, forwardedRef) {
|
|
547
|
-
const {
|
|
743
|
+
const $ = c(44), {
|
|
548
744
|
__unstable_autoFocus: autoFocus,
|
|
549
745
|
__unstable_hideCloseButton: hideCloseButton,
|
|
550
746
|
children,
|
|
@@ -559,36 +755,71 @@ const StyledDialog = /* @__PURE__ */ styled(Layer).withConfig({
|
|
|
559
755
|
scheme,
|
|
560
756
|
shadow: shadowProp,
|
|
561
757
|
width: widthProp
|
|
562
|
-
} = props, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element
|
|
758
|
+
} = props, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element;
|
|
759
|
+
let t0;
|
|
760
|
+
$[0] !== radiusProp ? (t0 = _getArrayProp(radiusProp), $[0] = radiusProp, $[1] = t0) : t0 = $[1];
|
|
761
|
+
const radius = t0;
|
|
762
|
+
let t1;
|
|
763
|
+
$[2] !== shadowProp ? (t1 = _getArrayProp(shadowProp), $[2] = shadowProp, $[3] = t1) : t1 = $[3];
|
|
764
|
+
const shadow = t1;
|
|
765
|
+
let t2;
|
|
766
|
+
$[4] !== widthProp ? (t2 = _getArrayProp(widthProp), $[4] = widthProp, $[5] = t2) : t2 = $[5];
|
|
767
|
+
const width = t2, ref = useRef(null), contentRef = useRef(null), layer = useLayer(), {
|
|
563
768
|
isTopLayer
|
|
564
769
|
} = layer, labelId = `${id}_label`, showCloseButton = !!onClose && hideCloseButton === !1, showHeader = !!header || showCloseButton;
|
|
565
|
-
|
|
770
|
+
let t3;
|
|
771
|
+
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => ref.current, $[6] = t3) : t3 = $[6], useImperativeHandle(forwardedRef, t3);
|
|
772
|
+
let t4;
|
|
773
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => contentRef.current, $[7] = t4) : t4 = $[7], useImperativeHandle(forwardedContentRef, t4);
|
|
774
|
+
let t5, t6;
|
|
775
|
+
$[8] !== autoFocus ? (t5 = () => {
|
|
566
776
|
autoFocus && ref.current && focusFirstDescendant(ref.current);
|
|
567
|
-
}, [autoFocus, ref]),
|
|
568
|
-
|
|
777
|
+
}, t6 = [autoFocus, ref], $[8] = autoFocus, $[9] = t5, $[10] = t6) : (t5 = $[9], t6 = $[10]), useEffect(t5, t6);
|
|
778
|
+
let t7;
|
|
779
|
+
$[11] !== boundaryElement || $[12] !== isTopLayer || $[13] !== onClose || $[14] !== portalElement ? (t7 = (event) => {
|
|
780
|
+
if (!isTopLayer || !onClose)
|
|
781
|
+
return;
|
|
569
782
|
const target = document.activeElement;
|
|
570
783
|
target && !isTargetWithinScope(boundaryElement, portalElement, target) || event.key === "Escape" && (event.preventDefault(), event.stopPropagation(), onClose());
|
|
571
|
-
}, [boundaryElement, isTopLayer, onClose, portalElement])
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
784
|
+
}, $[11] = boundaryElement, $[12] = isTopLayer, $[13] = onClose, $[14] = portalElement, $[15] = t7) : t7 = $[15], useGlobalKeyDown(t7);
|
|
785
|
+
let t8;
|
|
786
|
+
$[16] !== boundaryElement || $[17] !== isTopLayer || $[18] !== onClickOutside || $[19] !== portalElement ? (t8 = isTopLayer && onClickOutside && ((event_0) => {
|
|
787
|
+
const target_0 = event_0.target;
|
|
788
|
+
target_0 && !isTargetWithinScope(boundaryElement, portalElement, target_0) || onClickOutside();
|
|
789
|
+
}), $[16] = boundaryElement, $[17] = isTopLayer, $[18] = onClickOutside, $[19] = portalElement, $[20] = t8) : t8 = $[20];
|
|
790
|
+
let t9;
|
|
791
|
+
$[21] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => [ref.current], $[21] = t9) : t9 = $[21], useClickOutsideEvent(t8, t9);
|
|
792
|
+
let t10;
|
|
793
|
+
$[22] !== header || $[23] !== labelId || $[24] !== onClose || $[25] !== showCloseButton || $[26] !== showHeader ? (t10 = showHeader && /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsxs(Flex, { align: "flex-start", padding: 3, children: [
|
|
794
|
+
/* @__PURE__ */ jsx(Box, { flex: 1, padding: 2, children: header && /* @__PURE__ */ jsx(Text, { id: labelId, size: 1, weight: "semibold", children: header }) }),
|
|
795
|
+
showCloseButton && /* @__PURE__ */ jsx(Box, { flex: "none", children: /* @__PURE__ */ jsx(Button, { "aria-label": "Close dialog", disabled: !onClose, icon: CloseIcon, mode: "bleed", onClick: onClose, padding: 2 }) })
|
|
796
|
+
] }) }), $[22] = header, $[23] = labelId, $[24] = onClose, $[25] = showCloseButton, $[26] = showHeader, $[27] = t10) : t10 = $[27];
|
|
797
|
+
let t11;
|
|
798
|
+
$[28] !== children ? (t11 = /* @__PURE__ */ jsx(DialogContent, { flex: 1, ref: contentRef, tabIndex: -1, children }), $[28] = children, $[29] = t11) : t11 = $[29];
|
|
799
|
+
let t12;
|
|
800
|
+
$[30] !== footer ? (t12 = footer && /* @__PURE__ */ jsx(DialogFooter, { children: footer }), $[30] = footer, $[31] = t12) : t12 = $[31];
|
|
801
|
+
let t13;
|
|
802
|
+
$[32] !== t10 || $[33] !== t11 || $[34] !== t12 ? (t13 = /* @__PURE__ */ jsxs(DialogLayout, { direction: "column", children: [
|
|
803
|
+
t10,
|
|
804
|
+
t11,
|
|
805
|
+
t12
|
|
806
|
+
] }), $[32] = t10, $[33] = t11, $[34] = t12, $[35] = t13) : t13 = $[35];
|
|
807
|
+
let t14;
|
|
808
|
+
$[36] !== radius || $[37] !== scheme || $[38] !== shadow || $[39] !== t13 ? (t14 = /* @__PURE__ */ jsx(DialogCardRoot, { radius, ref, scheme, shadow, children: t13 }), $[36] = radius, $[37] = scheme, $[38] = shadow, $[39] = t13, $[40] = t14) : t14 = $[40];
|
|
809
|
+
let t15;
|
|
810
|
+
return $[41] !== t14 || $[42] !== width ? (t15 = /* @__PURE__ */ jsx(DialogContainer, { "data-ui": "DialogCard", width, children: t14 }), $[41] = t14, $[42] = width, $[43] = t15) : t15 = $[43], t15;
|
|
582
811
|
});
|
|
583
812
|
DialogCard.displayName = "ForwardRef(DialogCard)";
|
|
584
813
|
const Dialog = forwardRef(function(props, ref) {
|
|
585
|
-
const dialog = useDialog(), {
|
|
814
|
+
const $ = c(70), dialog = useDialog(), {
|
|
586
815
|
layer
|
|
587
|
-
} = useTheme_v2()
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
816
|
+
} = useTheme_v2();
|
|
817
|
+
let _positionProp, _zOffsetProp, children, contentRef, footer, header, id, onActivate, onClickOutside, onClose, onFocus, portalProp, restProps, scheme, t0, t1, t2, t3, t4, t5, t6;
|
|
818
|
+
$[0] !== props ? ({
|
|
819
|
+
__unstable_autoFocus: t0,
|
|
820
|
+
__unstable_hideCloseButton: t1,
|
|
821
|
+
cardRadius: t2,
|
|
822
|
+
cardShadow: t3,
|
|
592
823
|
children,
|
|
593
824
|
contentRef,
|
|
594
825
|
footer,
|
|
@@ -598,15 +829,33 @@ const Dialog = forwardRef(function(props, ref) {
|
|
|
598
829
|
onClickOutside,
|
|
599
830
|
onClose,
|
|
600
831
|
onFocus,
|
|
601
|
-
padding:
|
|
832
|
+
padding: t4,
|
|
602
833
|
portal: portalProp,
|
|
603
834
|
position: _positionProp,
|
|
604
835
|
scheme,
|
|
605
|
-
width:
|
|
836
|
+
width: t5,
|
|
606
837
|
zOffset: _zOffsetProp,
|
|
607
|
-
animate:
|
|
838
|
+
animate: t6,
|
|
608
839
|
...restProps
|
|
609
|
-
} = props,
|
|
840
|
+
} = props, $[0] = props, $[1] = _positionProp, $[2] = _zOffsetProp, $[3] = children, $[4] = contentRef, $[5] = footer, $[6] = header, $[7] = id, $[8] = onActivate, $[9] = onClickOutside, $[10] = onClose, $[11] = onFocus, $[12] = portalProp, $[13] = restProps, $[14] = scheme, $[15] = t0, $[16] = t1, $[17] = t2, $[18] = t3, $[19] = t4, $[20] = t5, $[21] = t6) : (_positionProp = $[1], _zOffsetProp = $[2], children = $[3], contentRef = $[4], footer = $[5], header = $[6], id = $[7], onActivate = $[8], onClickOutside = $[9], onClose = $[10], onFocus = $[11], portalProp = $[12], restProps = $[13], scheme = $[14], t0 = $[15], t1 = $[16], t2 = $[17], t3 = $[18], t4 = $[19], t5 = $[20], t6 = $[21]);
|
|
841
|
+
const autoFocus = t0 === void 0 ? !0 : t0, hideCloseButton = t1 === void 0 ? !1 : t1, cardRadiusProp = t2 === void 0 ? 4 : t2, cardShadow = t3 === void 0 ? 3 : t3, paddingProp = t4 === void 0 ? 3 : t4, widthProp = t5 === void 0 ? 0 : t5, _animate = t6 === void 0 ? !1 : t6, positionProp = _positionProp ?? (dialog.position || "fixed"), zOffsetProp = _zOffsetProp ?? (dialog.zOffset || layer.dialog.zOffset), animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element;
|
|
842
|
+
let t7;
|
|
843
|
+
$[22] !== cardRadiusProp ? (t7 = _getArrayProp(cardRadiusProp), $[22] = cardRadiusProp, $[23] = t7) : t7 = $[23];
|
|
844
|
+
const cardRadius = t7;
|
|
845
|
+
let t8;
|
|
846
|
+
$[24] !== paddingProp ? (t8 = _getArrayProp(paddingProp), $[24] = paddingProp, $[25] = t8) : t8 = $[25];
|
|
847
|
+
const padding = t8;
|
|
848
|
+
let t9;
|
|
849
|
+
$[26] !== positionProp ? (t9 = _getArrayProp(positionProp), $[26] = positionProp, $[27] = t9) : t9 = $[27];
|
|
850
|
+
const position = t9;
|
|
851
|
+
let t10;
|
|
852
|
+
$[28] !== widthProp ? (t10 = _getArrayProp(widthProp), $[28] = widthProp, $[29] = t10) : t10 = $[29];
|
|
853
|
+
const width = t10;
|
|
854
|
+
let t11;
|
|
855
|
+
$[30] !== zOffsetProp ? (t11 = _getArrayProp(zOffsetProp), $[30] = zOffsetProp, $[31] = t11) : t11 = $[31];
|
|
856
|
+
const zOffset = t11, preDivRef = useRef(null), postDivRef = useRef(null), cardRef = useRef(null), focusedElementRef = useRef(null);
|
|
857
|
+
let t12;
|
|
858
|
+
$[32] !== onFocus ? (t12 = (event) => {
|
|
610
859
|
onFocus?.(event);
|
|
611
860
|
const target = event.target, cardElement = cardRef.current;
|
|
612
861
|
if (cardElement && target === preDivRef.current) {
|
|
@@ -618,43 +867,60 @@ const Dialog = forwardRef(function(props, ref) {
|
|
|
618
867
|
return;
|
|
619
868
|
}
|
|
620
869
|
isHTMLElement(event.target) && (focusedElementRef.current = event.target);
|
|
621
|
-
}, [
|
|
870
|
+
}, $[32] = onFocus, $[33] = t12) : t12 = $[33];
|
|
871
|
+
const handleFocus = t12, labelId = `${id}_label`, rootClickTimeoutRef = useRef(void 0);
|
|
872
|
+
let t13;
|
|
873
|
+
$[34] !== boundaryElement || $[35] !== portalElement ? (t13 = () => {
|
|
622
874
|
rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
|
|
623
875
|
const activeElement = document.activeElement;
|
|
624
876
|
if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
|
|
625
|
-
const
|
|
626
|
-
if (!
|
|
627
|
-
const
|
|
628
|
-
|
|
877
|
+
const target_0 = focusedElementRef.current;
|
|
878
|
+
if (!target_0 || !document.body.contains(target_0)) {
|
|
879
|
+
const cardElement_0 = cardRef.current;
|
|
880
|
+
cardElement_0 && focusFirstDescendant(cardElement_0);
|
|
629
881
|
return;
|
|
630
882
|
}
|
|
631
|
-
|
|
883
|
+
target_0.focus();
|
|
632
884
|
}
|
|
633
885
|
}, 0);
|
|
634
|
-
}, [boundaryElement, portalElement]);
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
] })
|
|
886
|
+
}, $[34] = boundaryElement, $[35] = portalElement, $[36] = t13) : t13 = $[36];
|
|
887
|
+
const handleRootClick = t13;
|
|
888
|
+
let t14;
|
|
889
|
+
$[37] === Symbol.for("react.memo_cache_sentinel") ? (t14 = /* @__PURE__ */ jsx("div", { ref: preDivRef, tabIndex: 0 }), $[37] = t14) : t14 = $[37];
|
|
890
|
+
let t15;
|
|
891
|
+
$[38] !== autoFocus || $[39] !== cardRadius || $[40] !== cardShadow || $[41] !== children || $[42] !== contentRef || $[43] !== footer || $[44] !== header || $[45] !== hideCloseButton || $[46] !== id || $[47] !== onClickOutside || $[48] !== onClose || $[49] !== portalProp || $[50] !== scheme || $[51] !== width ? (t15 = /* @__PURE__ */ jsx(DialogCard, { __unstable_autoFocus: autoFocus, __unstable_hideCloseButton: hideCloseButton, contentRef, footer, header, id, onClickOutside, onClose, portal: portalProp, radius: cardRadius, ref: cardRef, scheme, shadow: cardShadow, width, children }), $[38] = autoFocus, $[39] = cardRadius, $[40] = cardShadow, $[41] = children, $[42] = contentRef, $[43] = footer, $[44] = header, $[45] = hideCloseButton, $[46] = id, $[47] = onClickOutside, $[48] = onClose, $[49] = portalProp, $[50] = scheme, $[51] = width, $[52] = t15) : t15 = $[52];
|
|
892
|
+
let t16;
|
|
893
|
+
$[53] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsx("div", { ref: postDivRef, tabIndex: 0 }), $[53] = t16) : t16 = $[53];
|
|
894
|
+
let t17;
|
|
895
|
+
$[54] !== animate || $[55] !== handleFocus || $[56] !== handleRootClick || $[57] !== id || $[58] !== labelId || $[59] !== onActivate || $[60] !== padding || $[61] !== position || $[62] !== ref || $[63] !== restProps || $[64] !== t15 || $[65] !== zOffset ? (t17 = /* @__PURE__ */ jsxs(StyledDialog, { ...restProps, $animate: animate, $padding: padding, $position: position, "aria-labelledby": labelId, "aria-modal": !0, "data-ui": "Dialog", id, onActivate, onClick: handleRootClick, onFocus: handleFocus, ref, role: "dialog", zOffset, children: [
|
|
896
|
+
t14,
|
|
897
|
+
t15,
|
|
898
|
+
t16
|
|
899
|
+
] }), $[54] = animate, $[55] = handleFocus, $[56] = handleRootClick, $[57] = id, $[58] = labelId, $[59] = onActivate, $[60] = padding, $[61] = position, $[62] = ref, $[63] = restProps, $[64] = t15, $[65] = zOffset, $[66] = t17) : t17 = $[66];
|
|
900
|
+
let t18;
|
|
901
|
+
return $[67] !== portalProp || $[68] !== t17 ? (t18 = /* @__PURE__ */ jsx(Portal, { __unstable_name: portalProp, children: t17 }), $[67] = portalProp, $[68] = t17, $[69] = t18) : t18 = $[69], t18;
|
|
640
902
|
});
|
|
641
903
|
Dialog.displayName = "ForwardRef(Dialog)";
|
|
642
904
|
function DialogProvider(props) {
|
|
643
|
-
const {
|
|
905
|
+
const $ = c(6), {
|
|
644
906
|
children,
|
|
645
907
|
position,
|
|
646
908
|
zOffset
|
|
647
|
-
} = props
|
|
909
|
+
} = props;
|
|
910
|
+
let t0;
|
|
911
|
+
$[0] !== position || $[1] !== zOffset ? (t0 = {
|
|
648
912
|
version: 0,
|
|
649
913
|
position,
|
|
650
914
|
zOffset
|
|
651
|
-
}
|
|
652
|
-
|
|
915
|
+
}, $[0] = position, $[1] = zOffset, $[2] = t0) : t0 = $[2];
|
|
916
|
+
const contextValue = t0;
|
|
917
|
+
let t1;
|
|
918
|
+
return $[3] !== children || $[4] !== contextValue ? (t1 = /* @__PURE__ */ jsx(DialogContext.Provider, { value: contextValue, children }), $[3] = children, $[4] = contextValue, $[5] = t1) : t1 = $[5], t1;
|
|
653
919
|
}
|
|
654
920
|
DialogProvider.displayName = "DialogProvider";
|
|
655
921
|
const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
656
|
-
const {
|
|
657
|
-
__unstable_disableRestoreFocusOnClose:
|
|
922
|
+
const $ = c(62), {
|
|
923
|
+
__unstable_disableRestoreFocusOnClose: t0,
|
|
658
924
|
boundaryElement: deprecated_boundaryElement,
|
|
659
925
|
button: buttonProp,
|
|
660
926
|
id,
|
|
@@ -663,52 +929,85 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
663
929
|
onOpen,
|
|
664
930
|
placement: deprecated_placement,
|
|
665
931
|
popoverScheme: deprecated_popoverScheme,
|
|
666
|
-
portal:
|
|
932
|
+
portal: t1,
|
|
667
933
|
popover,
|
|
668
934
|
popoverRadius: deprecated_popoverRadius,
|
|
669
935
|
preventOverflow: deprecated_preventOverflow
|
|
670
|
-
} = props, [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), [buttonElement, setButtonElement] = useState(null)
|
|
671
|
-
|
|
936
|
+
} = props, disableRestoreFocusOnClose = t0 === void 0 ? !1 : t0, deprecated_portal = t1 === void 0 ? !0 : t1, [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), [buttonElement, setButtonElement] = useState(null);
|
|
937
|
+
let t2;
|
|
938
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[0] = t2) : t2 = $[0];
|
|
939
|
+
const [menuElements, setChildMenuElements] = useState(t2), openRef = useRef(open);
|
|
940
|
+
let t3, t4;
|
|
941
|
+
$[1] !== onOpen || $[2] !== open ? (t3 = () => {
|
|
672
942
|
onOpen && open && !openRef.current && onOpen();
|
|
673
|
-
}, [onOpen, open]), useEffect(
|
|
943
|
+
}, t4 = [onOpen, open], $[1] = onOpen, $[2] = open, $[3] = t3, $[4] = t4) : (t3 = $[3], t4 = $[4]), useEffect(t3, t4);
|
|
944
|
+
let t5, t6;
|
|
945
|
+
$[5] !== onClose || $[6] !== open ? (t5 = () => {
|
|
674
946
|
onClose && !open && openRef.current && onClose();
|
|
675
|
-
}, [onClose, open]), useEffect(
|
|
947
|
+
}, t6 = [onClose, open], $[5] = onClose, $[6] = open, $[7] = t5, $[8] = t6) : (t5 = $[7], t6 = $[8]), useEffect(t5, t6);
|
|
948
|
+
let t7, t8;
|
|
949
|
+
$[9] !== open ? (t7 = () => {
|
|
676
950
|
openRef.current = open;
|
|
677
|
-
}, [open]);
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
951
|
+
}, t8 = [open], $[9] = open, $[10] = t7, $[11] = t8) : (t7 = $[10], t8 = $[11]), useEffect(t7, t8);
|
|
952
|
+
let t9;
|
|
953
|
+
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
|
|
954
|
+
setOpen(_temp$2), setShouldFocus(null);
|
|
955
|
+
}, $[12] = t9) : t9 = $[12];
|
|
956
|
+
const handleButtonClick = t9;
|
|
957
|
+
let t10;
|
|
958
|
+
$[13] !== open ? (t10 = (event) => {
|
|
681
959
|
open && event.preventDefault();
|
|
682
|
-
}, [open
|
|
683
|
-
|
|
684
|
-
|
|
960
|
+
}, $[13] = open, $[14] = t10) : t10 = $[14];
|
|
961
|
+
const handleMouseDown = t10;
|
|
962
|
+
let t11;
|
|
963
|
+
$[15] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (event_0) => {
|
|
964
|
+
if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
|
|
965
|
+
event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
|
|
685
966
|
return;
|
|
686
967
|
}
|
|
687
|
-
if (
|
|
688
|
-
|
|
968
|
+
if (event_0.key === "ArrowUp") {
|
|
969
|
+
event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
|
|
689
970
|
return;
|
|
690
971
|
}
|
|
691
|
-
}, []
|
|
692
|
-
|
|
972
|
+
}, $[15] = t11) : t11 = $[15];
|
|
973
|
+
const handleButtonKeyDown = t11;
|
|
974
|
+
let t12;
|
|
975
|
+
$[16] !== buttonElement || $[17] !== menuElements ? (t12 = (event_1) => {
|
|
976
|
+
const target = event_1.target;
|
|
693
977
|
if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
|
|
694
978
|
for (const el of menuElements)
|
|
695
979
|
if (target === el || el.contains(target))
|
|
696
980
|
return;
|
|
697
981
|
setOpen(!1);
|
|
698
982
|
}
|
|
699
|
-
}, [buttonElement, menuElements
|
|
983
|
+
}, $[16] = buttonElement, $[17] = menuElements, $[18] = t12) : t12 = $[18];
|
|
984
|
+
const handleMenuClickOutside = t12;
|
|
985
|
+
let t13;
|
|
986
|
+
$[19] !== buttonElement || $[20] !== disableRestoreFocusOnClose ? (t13 = () => {
|
|
700
987
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
701
|
-
}, [buttonElement, disableRestoreFocusOnClose
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
988
|
+
}, $[19] = buttonElement, $[20] = disableRestoreFocusOnClose, $[21] = t13) : t13 = $[21];
|
|
989
|
+
const handleMenuEscape = t13;
|
|
990
|
+
let t14;
|
|
991
|
+
$[22] !== menuElements ? (t14 = (event_2) => {
|
|
992
|
+
const target_0 = event_2.relatedTarget;
|
|
993
|
+
if (target_0 instanceof Node) {
|
|
994
|
+
for (const el_0 of menuElements)
|
|
995
|
+
if (el_0 === target_0 || el_0.contains(target_0))
|
|
706
996
|
return;
|
|
707
997
|
setOpen(!1);
|
|
708
998
|
}
|
|
709
|
-
}, [menuElements
|
|
999
|
+
}, $[22] = menuElements, $[23] = t14) : t14 = $[23];
|
|
1000
|
+
const handleBlur = t14;
|
|
1001
|
+
let t15;
|
|
1002
|
+
$[24] !== buttonElement || $[25] !== disableRestoreFocusOnClose ? (t15 = () => {
|
|
710
1003
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
711
|
-
}, [buttonElement,
|
|
1004
|
+
}, $[24] = buttonElement, $[25] = disableRestoreFocusOnClose, $[26] = t15) : t15 = $[26];
|
|
1005
|
+
const handleItemClick = t15;
|
|
1006
|
+
let t16;
|
|
1007
|
+
$[27] === Symbol.for("react.memo_cache_sentinel") ? (t16 = (el_1) => (setChildMenuElements((els) => els.concat([el_1])), () => setChildMenuElements((els_0) => els_0.filter((_el) => _el !== el_1))), $[27] = t16) : t16 = $[27];
|
|
1008
|
+
const registerElement = t16;
|
|
1009
|
+
let t17;
|
|
1010
|
+
$[28] !== buttonElement || $[29] !== handleBlur || $[30] !== handleItemClick || $[31] !== handleMenuClickOutside || $[32] !== handleMenuEscape || $[33] !== id || $[34] !== menuProp || $[35] !== shouldFocus ? (t17 = menuProp && cloneElement(menuProp, {
|
|
712
1011
|
"aria-labelledby": id,
|
|
713
1012
|
onBlurCapture: handleBlur,
|
|
714
1013
|
onClickOutside: handleMenuClickOutside,
|
|
@@ -717,7 +1016,10 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
717
1016
|
originElement: buttonElement,
|
|
718
1017
|
registerElement,
|
|
719
1018
|
shouldFocus
|
|
720
|
-
}),
|
|
1019
|
+
}), $[28] = buttonElement, $[29] = handleBlur, $[30] = handleItemClick, $[31] = handleMenuClickOutside, $[32] = handleMenuEscape, $[33] = id, $[34] = menuProp, $[35] = shouldFocus, $[36] = t17) : t17 = $[36];
|
|
1020
|
+
const menu = t17;
|
|
1021
|
+
let t18;
|
|
1022
|
+
$[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open ? (t18 = buttonProp && cloneElement(buttonProp, {
|
|
721
1023
|
"data-ui": "MenuButton",
|
|
722
1024
|
id,
|
|
723
1025
|
onClick: handleButtonClick,
|
|
@@ -727,9 +1029,14 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
727
1029
|
"aria-expanded": open,
|
|
728
1030
|
ref: setButtonElement,
|
|
729
1031
|
selected: buttonProp.props.selected ?? open
|
|
730
|
-
}), [buttonProp,
|
|
731
|
-
|
|
732
|
-
|
|
1032
|
+
}), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] = t18) : t18 = $[41];
|
|
1033
|
+
const button = t18;
|
|
1034
|
+
let t19, t20;
|
|
1035
|
+
$[42] !== buttonElement ? (t19 = () => buttonElement, t20 = [buttonElement], $[42] = buttonElement, $[43] = t19, $[44] = t20) : (t19 = $[43], t20 = $[44]), useImperativeHandle(forwardedRef, t19, t20);
|
|
1036
|
+
let t21;
|
|
1037
|
+
$[45] !== popover ? (t21 = popover || {}, $[45] = popover, $[46] = t21) : t21 = $[46];
|
|
1038
|
+
let t22;
|
|
1039
|
+
$[47] !== deprecated_boundaryElement || $[48] !== deprecated_placement || $[49] !== deprecated_popoverRadius || $[50] !== deprecated_popoverScheme || $[51] !== deprecated_portal || $[52] !== deprecated_preventOverflow || $[53] !== t21 ? (t22 = {
|
|
733
1040
|
boundaryElement: deprecated_boundaryElement,
|
|
734
1041
|
overflow: "auto",
|
|
735
1042
|
placement: deprecated_placement,
|
|
@@ -737,11 +1044,18 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
737
1044
|
preventOverflow: deprecated_preventOverflow,
|
|
738
1045
|
radius: deprecated_popoverRadius,
|
|
739
1046
|
scheme: deprecated_popoverScheme,
|
|
740
|
-
...
|
|
741
|
-
}
|
|
742
|
-
|
|
1047
|
+
...t21
|
|
1048
|
+
}, $[47] = deprecated_boundaryElement, $[48] = deprecated_placement, $[49] = deprecated_popoverRadius, $[50] = deprecated_popoverScheme, $[51] = deprecated_portal, $[52] = deprecated_preventOverflow, $[53] = t21, $[54] = t22) : t22 = $[54];
|
|
1049
|
+
const popoverProps = t22;
|
|
1050
|
+
let t23;
|
|
1051
|
+
$[55] !== button ? (t23 = button || /* @__PURE__ */ jsx(Fragment$1, {}), $[55] = button, $[56] = t23) : t23 = $[56];
|
|
1052
|
+
let t24;
|
|
1053
|
+
return $[57] !== menu || $[58] !== open || $[59] !== popoverProps || $[60] !== t23 ? (t24 = /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t23 }), $[57] = menu, $[58] = open, $[59] = popoverProps, $[60] = t23, $[61] = t24) : t24 = $[61], t24;
|
|
743
1054
|
});
|
|
744
1055
|
MenuButton.displayName = "ForwardRef(MenuButton)";
|
|
1056
|
+
function _temp$2(v) {
|
|
1057
|
+
return !v;
|
|
1058
|
+
}
|
|
745
1059
|
const keyframe = keyframes`
|
|
746
1060
|
0% {
|
|
747
1061
|
background-position: 100%;
|
|
@@ -786,13 +1100,17 @@ const keyframe = keyframes`
|
|
|
786
1100
|
displayName: "StyledSkeleton",
|
|
787
1101
|
componentId: "sc-ebtpni-0"
|
|
788
1102
|
})(responsiveRadiusStyle, skeletonStyle), Skeleton = forwardRef(function(props, ref) {
|
|
789
|
-
const
|
|
790
|
-
|
|
1103
|
+
const $ = c(16);
|
|
1104
|
+
let delay, radius, restProps, t0;
|
|
1105
|
+
$[0] !== props ? ({
|
|
1106
|
+
animated: t0,
|
|
791
1107
|
delay,
|
|
792
1108
|
radius,
|
|
793
1109
|
...restProps
|
|
794
|
-
} = props, [
|
|
795
|
-
|
|
1110
|
+
} = props, $[0] = props, $[1] = delay, $[2] = radius, $[3] = restProps, $[4] = t0) : (delay = $[1], radius = $[2], restProps = $[3], t0 = $[4]);
|
|
1111
|
+
const animated = t0 === void 0 ? !1 : t0, [visible, setVisible] = useState(!delay);
|
|
1112
|
+
let t1, t2;
|
|
1113
|
+
$[5] !== delay ? (t1 = () => {
|
|
796
1114
|
if (!delay)
|
|
797
1115
|
return;
|
|
798
1116
|
const timeout = setTimeout(() => {
|
|
@@ -801,7 +1119,12 @@ const keyframe = keyframes`
|
|
|
801
1119
|
return () => {
|
|
802
1120
|
clearTimeout(timeout);
|
|
803
1121
|
};
|
|
804
|
-
}, [delay]
|
|
1122
|
+
}, t2 = [delay], $[5] = delay, $[6] = t1, $[7] = t2) : (t1 = $[6], t2 = $[7]), useEffect(t1, t2);
|
|
1123
|
+
let t3;
|
|
1124
|
+
$[8] !== radius ? (t3 = _getArrayProp(radius), $[8] = radius, $[9] = t3) : t3 = $[9];
|
|
1125
|
+
const t4 = delay ? visible : !0;
|
|
1126
|
+
let t5;
|
|
1127
|
+
return $[10] !== animated || $[11] !== ref || $[12] !== restProps || $[13] !== t3 || $[14] !== t4 ? (t5 = /* @__PURE__ */ jsx(StyledSkeleton$1, { ...restProps, $animated: animated, $radius: t3, $visible: t4, ref }), $[10] = animated, $[11] = ref, $[12] = restProps, $[13] = t3, $[14] = t4, $[15] = t5) : t5 = $[15], t5;
|
|
805
1128
|
});
|
|
806
1129
|
Skeleton.displayName = "ForwardRef(Skeleton)";
|
|
807
1130
|
const StyledSkeleton = /* @__PURE__ */ styled(Skeleton).withConfig({
|
|
@@ -822,43 +1145,75 @@ const StyledSkeleton = /* @__PURE__ */ styled(Skeleton).withConfig({
|
|
|
822
1145
|
};
|
|
823
1146
|
});
|
|
824
1147
|
}), TextSkeleton = forwardRef(function(props, ref) {
|
|
825
|
-
const
|
|
826
|
-
|
|
1148
|
+
const $ = c(9);
|
|
1149
|
+
let restProps, t0;
|
|
1150
|
+
$[0] !== props ? ({
|
|
1151
|
+
size: t0,
|
|
827
1152
|
...restProps
|
|
828
|
-
} = props, $
|
|
829
|
-
|
|
1153
|
+
} = props, $[0] = props, $[1] = restProps, $[2] = t0) : (restProps = $[1], t0 = $[2]);
|
|
1154
|
+
const size = t0 === void 0 ? 2 : t0;
|
|
1155
|
+
let t1;
|
|
1156
|
+
$[3] !== size ? (t1 = _getArrayProp(size), $[3] = size, $[4] = t1) : t1 = $[4];
|
|
1157
|
+
const $size = t1;
|
|
1158
|
+
let t2;
|
|
1159
|
+
return $[5] !== $size || $[6] !== ref || $[7] !== restProps ? (t2 = /* @__PURE__ */ jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "text" }), $[5] = $size, $[6] = ref, $[7] = restProps, $[8] = t2) : t2 = $[8], t2;
|
|
830
1160
|
});
|
|
831
1161
|
TextSkeleton.displayName = "ForwardRef(TextSkeleton)";
|
|
832
1162
|
const LabelSkeleton = forwardRef(function(props, ref) {
|
|
833
|
-
const
|
|
834
|
-
|
|
1163
|
+
const $ = c(9);
|
|
1164
|
+
let restProps, t0;
|
|
1165
|
+
$[0] !== props ? ({
|
|
1166
|
+
size: t0,
|
|
835
1167
|
...restProps
|
|
836
|
-
} = props, $
|
|
837
|
-
|
|
1168
|
+
} = props, $[0] = props, $[1] = restProps, $[2] = t0) : (restProps = $[1], t0 = $[2]);
|
|
1169
|
+
const size = t0 === void 0 ? 2 : t0;
|
|
1170
|
+
let t1;
|
|
1171
|
+
$[3] !== size ? (t1 = _getArrayProp(size), $[3] = size, $[4] = t1) : t1 = $[4];
|
|
1172
|
+
const $size = t1;
|
|
1173
|
+
let t2;
|
|
1174
|
+
return $[5] !== $size || $[6] !== ref || $[7] !== restProps ? (t2 = /* @__PURE__ */ jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "label" }), $[5] = $size, $[6] = ref, $[7] = restProps, $[8] = t2) : t2 = $[8], t2;
|
|
838
1175
|
});
|
|
839
1176
|
LabelSkeleton.displayName = "ForwardRef(LabelSkeleton)";
|
|
840
1177
|
const HeadingSkeleton = forwardRef(function(props, ref) {
|
|
841
|
-
const
|
|
842
|
-
|
|
1178
|
+
const $ = c(9);
|
|
1179
|
+
let restProps, t0;
|
|
1180
|
+
$[0] !== props ? ({
|
|
1181
|
+
size: t0,
|
|
843
1182
|
...restProps
|
|
844
|
-
} = props, $
|
|
845
|
-
|
|
1183
|
+
} = props, $[0] = props, $[1] = restProps, $[2] = t0) : (restProps = $[1], t0 = $[2]);
|
|
1184
|
+
const size = t0 === void 0 ? 2 : t0;
|
|
1185
|
+
let t1;
|
|
1186
|
+
$[3] !== size ? (t1 = _getArrayProp(size), $[3] = size, $[4] = t1) : t1 = $[4];
|
|
1187
|
+
const $size = t1;
|
|
1188
|
+
let t2;
|
|
1189
|
+
return $[5] !== $size || $[6] !== ref || $[7] !== restProps ? (t2 = /* @__PURE__ */ jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "heading" }), $[5] = $size, $[6] = ref, $[7] = restProps, $[8] = t2) : t2 = $[8], t2;
|
|
846
1190
|
});
|
|
847
1191
|
HeadingSkeleton.displayName = "ForwardRef(HeadingSkeleton)";
|
|
848
1192
|
const CodeSkeleton = forwardRef(function(props, ref) {
|
|
849
|
-
const
|
|
850
|
-
|
|
1193
|
+
const $ = c(9);
|
|
1194
|
+
let restProps, t0;
|
|
1195
|
+
$[0] !== props ? ({
|
|
1196
|
+
size: t0,
|
|
851
1197
|
...restProps
|
|
852
|
-
} = props, $
|
|
853
|
-
|
|
1198
|
+
} = props, $[0] = props, $[1] = restProps, $[2] = t0) : (restProps = $[1], t0 = $[2]);
|
|
1199
|
+
const size = t0 === void 0 ? 2 : t0;
|
|
1200
|
+
let t1;
|
|
1201
|
+
$[3] !== size ? (t1 = _getArrayProp(size), $[3] = size, $[4] = t1) : t1 = $[4];
|
|
1202
|
+
const $size = t1;
|
|
1203
|
+
let t2;
|
|
1204
|
+
return $[5] !== $size || $[6] !== ref || $[7] !== restProps ? (t2 = /* @__PURE__ */ jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "code" }), $[5] = $size, $[6] = ref, $[7] = restProps, $[8] = t2) : t2 = $[8], t2;
|
|
854
1205
|
});
|
|
855
1206
|
CodeSkeleton.displayName = "ForwardRef(CodeSkeleton)";
|
|
856
1207
|
const TabPanel = forwardRef(function(props, ref) {
|
|
857
|
-
const
|
|
1208
|
+
const $ = c(9);
|
|
1209
|
+
let flex, restProps;
|
|
1210
|
+
$[0] !== props ? ({
|
|
858
1211
|
flex,
|
|
859
1212
|
...restProps
|
|
860
|
-
} = props;
|
|
861
|
-
|
|
1213
|
+
} = props, $[0] = props, $[1] = flex, $[2] = restProps) : (flex = $[1], restProps = $[2]);
|
|
1214
|
+
const t0 = props.tabIndex === void 0 ? 0 : props.tabIndex;
|
|
1215
|
+
let t1;
|
|
1216
|
+
return $[3] !== flex || $[4] !== props.children || $[5] !== ref || $[6] !== restProps || $[7] !== t0 ? (t1 = /* @__PURE__ */ jsx(Box, { "data-ui": "TabPanel", ...restProps, flex, ref, role: "tabpanel", tabIndex: t0, children: props.children }), $[3] = flex, $[4] = props.children, $[5] = ref, $[6] = restProps, $[7] = t0, $[8] = t1) : t1 = $[8], t1;
|
|
862
1217
|
});
|
|
863
1218
|
TabPanel.displayName = "ForwardRef(TabPanel)";
|
|
864
1219
|
const LOADING_BAR_HEIGHT = 2, STATUS_CARD_TONE = {
|
|
@@ -898,46 +1253,74 @@ const LOADING_BAR_HEIGHT = 2, STATUS_CARD_TONE = {
|
|
|
898
1253
|
info: "alert"
|
|
899
1254
|
}, LONG_ENOUGH_BUT_NOT_TOO_LONG = 1e3 * 60 * 60 * 24 * 24;
|
|
900
1255
|
function Toast(props) {
|
|
901
|
-
const
|
|
1256
|
+
const $ = c(50);
|
|
1257
|
+
let closable, description, duration, onClose, restProps, status, t0, title, updatedAt;
|
|
1258
|
+
$[0] !== props ? ({
|
|
902
1259
|
closable,
|
|
903
1260
|
description,
|
|
904
1261
|
duration,
|
|
905
1262
|
onClose,
|
|
906
|
-
radius
|
|
1263
|
+
radius: t0,
|
|
907
1264
|
title,
|
|
908
1265
|
status,
|
|
909
1266
|
updatedAt,
|
|
910
1267
|
...restProps
|
|
911
|
-
} = props,
|
|
1268
|
+
} = props, $[0] = props, $[1] = closable, $[2] = description, $[3] = duration, $[4] = onClose, $[5] = restProps, $[6] = status, $[7] = t0, $[8] = title, $[9] = updatedAt) : (closable = $[1], description = $[2], duration = $[3], onClose = $[4], restProps = $[5], status = $[6], t0 = $[7], title = $[8], updatedAt = $[9]);
|
|
1269
|
+
const radius = t0 === void 0 ? 3 : t0, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status", visualDuration = usePrefersReducedMotion() ? 0 : 0.26;
|
|
1270
|
+
let t1;
|
|
1271
|
+
$[10] !== visualDuration ? (t1 = visualDuration ? {
|
|
912
1272
|
type: "spring",
|
|
913
1273
|
visualDuration,
|
|
914
1274
|
bounce: 0.25
|
|
915
1275
|
} : {
|
|
916
1276
|
duration: 0
|
|
917
|
-
},
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
1277
|
+
}, $[10] = visualDuration, $[11] = t1) : t1 = $[11];
|
|
1278
|
+
const transition = t1, hasDuration = duration && isFinite(duration) && duration < LONG_ENOUGH_BUT_NOT_TOO_LONG;
|
|
1279
|
+
let t2;
|
|
1280
|
+
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t2 = ["hidden", "initial"], $[12] = t2) : t2 = $[12];
|
|
1281
|
+
const initial = t2;
|
|
1282
|
+
let t3;
|
|
1283
|
+
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t3 = ["visible", "slideIn"], $[13] = t3) : t3 = $[13];
|
|
1284
|
+
const animate = t3;
|
|
1285
|
+
let t4;
|
|
1286
|
+
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t4 = ["hidden", "slideOut"], $[14] = t4) : t4 = $[14];
|
|
1287
|
+
const exit = t4, t5 = hasDuration ? "" : void 0;
|
|
1288
|
+
let t6;
|
|
1289
|
+
$[15] !== title ? (t6 = title && /* @__PURE__ */ jsx(Text, { size: 1, weight: "medium", children: title }), $[15] = title, $[16] = t6) : t6 = $[16];
|
|
1290
|
+
let t7;
|
|
1291
|
+
$[17] !== description || $[18] !== transition ? (t7 = description && /* @__PURE__ */ jsx(MotionText, { muted: !0, size: 1, variants: content, transition, children: description }), $[17] = description, $[18] = transition, $[19] = t7) : t7 = $[19];
|
|
1292
|
+
let t8;
|
|
1293
|
+
$[20] !== t6 || $[21] !== t7 ? (t8 = /* @__PURE__ */ jsx(TextBox, { flex: 1, padding: 3, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
1294
|
+
t6,
|
|
1295
|
+
t7
|
|
1296
|
+
] }) }), $[20] = t6, $[21] = t7, $[22] = t8) : t8 = $[22];
|
|
1297
|
+
let t9;
|
|
1298
|
+
$[23] !== buttonTone || $[24] !== closable || $[25] !== onClose ? (t9 = closable && /* @__PURE__ */ jsx(Box, { padding: 1, children: /* @__PURE__ */ jsx(Button, { as: "button", icon: CloseIcon, mode: "bleed", padding: 2, tone: buttonTone, onClick: onClose, style: {
|
|
1299
|
+
verticalAlign: "top"
|
|
1300
|
+
} }) }), $[23] = buttonTone, $[24] = closable, $[25] = onClose, $[26] = t9) : t9 = $[26];
|
|
1301
|
+
let t10;
|
|
1302
|
+
$[27] !== t8 || $[28] !== t9 || $[29] !== transition ? (t10 = /* @__PURE__ */ jsxs(MotionFlex, { align: "flex-start", variants: content, transition, children: [
|
|
1303
|
+
t8,
|
|
1304
|
+
t9
|
|
1305
|
+
] }), $[27] = t8, $[28] = t9, $[29] = transition, $[30] = t10) : t10 = $[30];
|
|
1306
|
+
let t11;
|
|
1307
|
+
$[31] !== cardTone || $[32] !== duration || $[33] !== hasDuration || $[34] !== onClose || $[35] !== radius || $[36] !== transition || $[37] !== updatedAt || $[38] !== visualDuration ? (t11 = hasDuration && /* @__PURE__ */ jsxs(MotionLoadingBar, { variants: content, transition, children: [
|
|
1308
|
+
/* @__PURE__ */ jsx(LoadingBarMask, { tone: cardTone, radius }),
|
|
1309
|
+
/* @__PURE__ */ jsx(MotionLoadingBarProgress, { tone: cardTone, initial: {
|
|
1310
|
+
scaleX: 0
|
|
1311
|
+
}, animate: {
|
|
1312
|
+
scaleX: 1
|
|
1313
|
+
}, transition: {
|
|
1314
|
+
delay: visualDuration,
|
|
1315
|
+
duration: duration / 1e3,
|
|
1316
|
+
ease: "linear"
|
|
1317
|
+
}, onAnimationComplete: onClose }, `progress-${updatedAt}`)
|
|
1318
|
+
] }), $[31] = cardTone, $[32] = duration, $[33] = hasDuration, $[34] = onClose, $[35] = radius, $[36] = transition, $[37] = updatedAt, $[38] = visualDuration, $[39] = t11) : t11 = $[39];
|
|
1319
|
+
let t12;
|
|
1320
|
+
return $[40] !== cardTone || $[41] !== radius || $[42] !== restProps || $[43] !== role || $[44] !== t10 || $[45] !== t11 || $[46] !== t5 || $[47] !== transition || $[48] !== visualDuration ? (t12 = /* @__PURE__ */ jsxs(MotionToast, { "data-ui": "Toast", role, ...restProps, "data-has-duration": t5, custom: visualDuration, radius, shadow: 2, tone: cardTone, forwardedAs: "li", layout: "position", variants: container, initial, animate, exit, transition, children: [
|
|
1321
|
+
t10,
|
|
1322
|
+
t11
|
|
1323
|
+
] }), $[40] = cardTone, $[41] = radius, $[42] = restProps, $[43] = role, $[44] = t10, $[45] = t11, $[46] = t5, $[47] = transition, $[48] = visualDuration, $[49] = t12) : t12 = $[49], t12;
|
|
941
1324
|
}
|
|
942
1325
|
Toast.displayName = "Toast";
|
|
943
1326
|
const container = {
|
|
@@ -979,23 +1362,32 @@ const container = {
|
|
|
979
1362
|
}
|
|
980
1363
|
}, MotionToast = motion.create(StyledToast), MotionFlex = motion.create(Flex), MotionText = motion.create(Text), MotionLoadingBar = motion.create(LoadingBar), MotionLoadingBarProgress = motion.create(LoadingBarProgress);
|
|
981
1364
|
function useMounted() {
|
|
982
|
-
return useSyncExternalStore(subscribe,
|
|
1365
|
+
return useSyncExternalStore(subscribe, _temp$1, _temp2);
|
|
1366
|
+
}
|
|
1367
|
+
function _temp2() {
|
|
1368
|
+
return !1;
|
|
1369
|
+
}
|
|
1370
|
+
function _temp$1() {
|
|
1371
|
+
return !0;
|
|
983
1372
|
}
|
|
984
1373
|
const subscribe = () => () => {
|
|
985
1374
|
}, ToastContext = createGlobalScopedContext("@sanity/ui/context/toast", null);
|
|
986
1375
|
function ToastLayer(props) {
|
|
987
|
-
const {
|
|
1376
|
+
const $ = c(9), {
|
|
988
1377
|
children,
|
|
989
|
-
padding
|
|
1378
|
+
padding: t0,
|
|
990
1379
|
paddingX,
|
|
991
1380
|
paddingY,
|
|
992
|
-
gap
|
|
993
|
-
} = props, {
|
|
1381
|
+
gap: t1
|
|
1382
|
+
} = props, padding = t0 === void 0 ? 4 : t0, gap = t1 === void 0 ? 3 : t1, {
|
|
994
1383
|
zIndex
|
|
995
1384
|
} = useLayer();
|
|
996
|
-
|
|
1385
|
+
let t2;
|
|
1386
|
+
$[0] !== zIndex ? (t2 = {
|
|
997
1387
|
zIndex
|
|
998
|
-
},
|
|
1388
|
+
}, $[0] = zIndex, $[1] = t2) : t2 = $[1];
|
|
1389
|
+
let t3;
|
|
1390
|
+
return $[2] !== children || $[3] !== gap || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== t2 ? (t3 = /* @__PURE__ */ jsx(StyledLayer, { forwardedAs: "ul", "data-ui": "ToastProvider", padding, paddingX, paddingY, gap, columns: 1, style: t2, children }), $[2] = children, $[3] = gap, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = t2, $[8] = t3) : t3 = $[8], t3;
|
|
999
1391
|
}
|
|
1000
1392
|
ToastLayer.displayName = "ToastLayer";
|
|
1001
1393
|
const StyledLayer = styled(Grid).withConfig({
|
|
@@ -1007,14 +1399,19 @@ function generateToastId() {
|
|
|
1007
1399
|
return String(toastId++);
|
|
1008
1400
|
}
|
|
1009
1401
|
function ToastProvider(props) {
|
|
1010
|
-
const {
|
|
1402
|
+
const $ = c(13), {
|
|
1011
1403
|
children,
|
|
1012
1404
|
padding,
|
|
1013
1405
|
paddingX,
|
|
1014
1406
|
paddingY,
|
|
1015
1407
|
gap,
|
|
1016
|
-
zOffset
|
|
1017
|
-
} = props,
|
|
1408
|
+
zOffset: t0
|
|
1409
|
+
} = props, zOffset = t0 === void 0 ? 1 : t0;
|
|
1410
|
+
let t1;
|
|
1411
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
|
|
1412
|
+
const [state, setState] = useState(t1), mounted = useMounted();
|
|
1413
|
+
let t2;
|
|
1414
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {
|
|
1018
1415
|
version: 0,
|
|
1019
1416
|
push: (params) => {
|
|
1020
1417
|
const id = params.id || generateToastId(), duration = params.duration || 5e3;
|
|
@@ -1022,8 +1419,8 @@ function ToastProvider(props) {
|
|
|
1022
1419
|
setState((prevState) => {
|
|
1023
1420
|
if (duration === 0.01)
|
|
1024
1421
|
return prevState.filter((toast) => toast.id !== id);
|
|
1025
|
-
const dismiss = () => startTransition(() => setState((currentState) => currentState.filter((
|
|
1026
|
-
return [...prevState.filter((
|
|
1422
|
+
const dismiss = () => startTransition(() => setState((currentState) => currentState.filter((toast_0) => toast_0.id !== id)));
|
|
1423
|
+
return [...prevState.filter((toast_1) => toast_1.id !== id), {
|
|
1027
1424
|
dismiss,
|
|
1028
1425
|
id,
|
|
1029
1426
|
updatedAt: Date.now(),
|
|
@@ -1035,16 +1432,24 @@ function ToastProvider(props) {
|
|
|
1035
1432
|
});
|
|
1036
1433
|
}), id;
|
|
1037
1434
|
}
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1435
|
+
}, $[1] = t2) : t2 = $[1];
|
|
1436
|
+
const value = t2;
|
|
1437
|
+
let t3;
|
|
1438
|
+
$[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t3 = mounted && /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, mode: "popLayout", children: state.map(_temp) }) }) }), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t3) : t3 = $[9];
|
|
1439
|
+
let t4;
|
|
1440
|
+
return $[10] !== children || $[11] !== t3 ? (t4 = /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
|
|
1040
1441
|
children,
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1442
|
+
t3
|
|
1443
|
+
] }), $[10] = children, $[11] = t3, $[12] = t4) : t4 = $[12], t4;
|
|
1444
|
+
}
|
|
1445
|
+
function _temp(t0) {
|
|
1446
|
+
const {
|
|
1447
|
+
dismiss: dismiss_0,
|
|
1448
|
+
id: id_0,
|
|
1449
|
+
params: params_0,
|
|
1450
|
+
updatedAt
|
|
1451
|
+
} = t0;
|
|
1452
|
+
return /* @__PURE__ */ jsx(Toast, { closable: params_0.closable, description: params_0.description, onClose: dismiss_0, status: params_0.status, title: params_0.title, duration: params_0.duration, updatedAt }, id_0);
|
|
1048
1453
|
}
|
|
1049
1454
|
ToastProvider.displayName = "ToastProvider";
|
|
1050
1455
|
function useToast() {
|
|
@@ -1110,44 +1515,68 @@ function _focusItemElement(el) {
|
|
|
1110
1515
|
}
|
|
1111
1516
|
}
|
|
1112
1517
|
const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null), Tree = forwardRef(function(props, forwardedRef) {
|
|
1113
|
-
const
|
|
1518
|
+
const $ = c(37);
|
|
1519
|
+
let children, onFocus, restProps, t0;
|
|
1520
|
+
$[0] !== props ? ({
|
|
1114
1521
|
children,
|
|
1115
|
-
space
|
|
1522
|
+
space: t0,
|
|
1116
1523
|
onFocus,
|
|
1117
1524
|
...restProps
|
|
1118
|
-
} = props,
|
|
1119
|
-
|
|
1525
|
+
} = props, $[0] = props, $[1] = children, $[2] = onFocus, $[3] = restProps, $[4] = t0) : (children = $[1], onFocus = $[2], restProps = $[3], t0 = $[4]);
|
|
1526
|
+
const space = t0 === void 0 ? 1 : t0, ref = useRef(null), [focusedElement, setFocusedElement] = useState(null), focusedElementRef = useRef(focusedElement);
|
|
1527
|
+
let t1;
|
|
1528
|
+
$[5] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[5] = t1) : t1 = $[5];
|
|
1529
|
+
const path = t1;
|
|
1530
|
+
let t2;
|
|
1531
|
+
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[6] = t2) : t2 = $[6];
|
|
1532
|
+
const [itemElements, setItemElements] = useState(t2);
|
|
1533
|
+
let t3;
|
|
1534
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {}, $[7] = t3) : t3 = $[7];
|
|
1535
|
+
const [state, setState] = useState(t3), stateRef = useRef(state);
|
|
1536
|
+
let t4;
|
|
1537
|
+
$[8] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[8] = t4) : t4 = $[8], useImperativeHandle(forwardedRef, t4);
|
|
1538
|
+
let t5, t6;
|
|
1539
|
+
$[9] !== focusedElement ? (t5 = () => {
|
|
1120
1540
|
focusedElementRef.current = focusedElement;
|
|
1121
|
-
}, [focusedElement]), useEffect(
|
|
1541
|
+
}, t6 = [focusedElement], $[9] = focusedElement, $[10] = t5, $[11] = t6) : (t5 = $[10], t6 = $[11]), useEffect(t5, t6);
|
|
1542
|
+
let t7, t8;
|
|
1543
|
+
$[12] !== state ? (t7 = () => {
|
|
1122
1544
|
stateRef.current = state;
|
|
1123
|
-
}, [state]);
|
|
1124
|
-
|
|
1545
|
+
}, t8 = [state], $[12] = state, $[13] = t7, $[14] = t8) : (t7 = $[13], t8 = $[14]), useEffect(t7, t8);
|
|
1546
|
+
let t9;
|
|
1547
|
+
$[15] === Symbol.for("react.memo_cache_sentinel") ? (t9 = (element, path_0, expanded, selected) => (setState((s) => ({
|
|
1125
1548
|
...s,
|
|
1126
|
-
[
|
|
1549
|
+
[path_0]: {
|
|
1127
1550
|
element,
|
|
1128
1551
|
expanded
|
|
1129
1552
|
}
|
|
1130
1553
|
})), selected && setFocusedElement(element), () => {
|
|
1131
|
-
setState((
|
|
1554
|
+
setState((s_0) => {
|
|
1132
1555
|
const newState = {
|
|
1133
|
-
...
|
|
1556
|
+
...s_0
|
|
1134
1557
|
};
|
|
1135
|
-
return delete newState[
|
|
1558
|
+
return delete newState[path_0], newState;
|
|
1136
1559
|
});
|
|
1137
|
-
}), []
|
|
1138
|
-
|
|
1139
|
-
|
|
1560
|
+
}), $[15] = t9) : t9 = $[15];
|
|
1561
|
+
const registerItem = t9;
|
|
1562
|
+
let t10;
|
|
1563
|
+
$[16] === Symbol.for("react.memo_cache_sentinel") ? (t10 = (path_1, expanded_0) => {
|
|
1564
|
+
setState((s_1) => {
|
|
1565
|
+
const itemState = s_1[path_1];
|
|
1140
1566
|
return itemState ? {
|
|
1141
|
-
...
|
|
1142
|
-
[
|
|
1567
|
+
...s_1,
|
|
1568
|
+
[path_1]: {
|
|
1143
1569
|
...itemState,
|
|
1144
|
-
expanded
|
|
1570
|
+
expanded: expanded_0
|
|
1145
1571
|
}
|
|
1146
|
-
} :
|
|
1572
|
+
} : s_1;
|
|
1147
1573
|
});
|
|
1148
|
-
}, []
|
|
1574
|
+
}, $[16] = t10) : t10 = $[16];
|
|
1575
|
+
const setExpanded = t10, t11 = focusedElement || itemElements[0] || null;
|
|
1576
|
+
let t12;
|
|
1577
|
+
$[17] !== space || $[18] !== state || $[19] !== t11 ? (t12 = {
|
|
1149
1578
|
version: 0,
|
|
1150
|
-
focusedElement:
|
|
1579
|
+
focusedElement: t11,
|
|
1151
1580
|
level: 0,
|
|
1152
1581
|
path,
|
|
1153
1582
|
registerItem,
|
|
@@ -1155,7 +1584,10 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
|
|
|
1155
1584
|
setFocusedElement,
|
|
1156
1585
|
space,
|
|
1157
1586
|
state
|
|
1158
|
-
}
|
|
1587
|
+
}, $[17] = space, $[18] = state, $[19] = t11, $[20] = t12) : t12 = $[20];
|
|
1588
|
+
const contextValue = t12;
|
|
1589
|
+
let t13;
|
|
1590
|
+
$[21] !== itemElements ? (t13 = (event) => {
|
|
1159
1591
|
if (focusedElementRef.current) {
|
|
1160
1592
|
if (event.key === "ArrowDown") {
|
|
1161
1593
|
event.preventDefault();
|
|
@@ -1172,19 +1604,21 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
|
|
|
1172
1604
|
if (event.key === "ArrowLeft") {
|
|
1173
1605
|
event.preventDefault();
|
|
1174
1606
|
const itemKey = focusedElementRef.current.getAttribute("data-tree-key");
|
|
1175
|
-
if (!itemKey)
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
if (
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1607
|
+
if (!itemKey)
|
|
1608
|
+
return;
|
|
1609
|
+
const itemState_0 = stateRef.current[itemKey];
|
|
1610
|
+
if (!itemState_0)
|
|
1611
|
+
return;
|
|
1612
|
+
if (itemState_0.expanded)
|
|
1613
|
+
setState((s_2) => {
|
|
1614
|
+
const itemState_1 = s_2[itemKey];
|
|
1615
|
+
return itemState_1 ? {
|
|
1616
|
+
...s_2,
|
|
1183
1617
|
[itemKey]: {
|
|
1184
|
-
...
|
|
1618
|
+
...itemState_1,
|
|
1185
1619
|
expanded: !1
|
|
1186
1620
|
}
|
|
1187
|
-
} :
|
|
1621
|
+
} : s_2;
|
|
1188
1622
|
});
|
|
1189
1623
|
else {
|
|
1190
1624
|
const itemPath = itemKey.split("/");
|
|
@@ -1197,28 +1631,41 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
|
|
|
1197
1631
|
if (event.key === "ArrowRight") {
|
|
1198
1632
|
event.preventDefault();
|
|
1199
1633
|
const focusedKey = focusedElementRef.current.getAttribute("data-tree-key");
|
|
1200
|
-
if (!focusedKey)
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1634
|
+
if (!focusedKey)
|
|
1635
|
+
return;
|
|
1636
|
+
stateRef.current[focusedKey]?.expanded || setState((s_3) => {
|
|
1637
|
+
const itemState_2 = s_3[focusedKey];
|
|
1638
|
+
return itemState_2 ? {
|
|
1639
|
+
...s_3,
|
|
1205
1640
|
[focusedKey]: {
|
|
1206
|
-
...
|
|
1641
|
+
...itemState_2,
|
|
1207
1642
|
expanded: !0
|
|
1208
1643
|
}
|
|
1209
|
-
} :
|
|
1644
|
+
} : s_3;
|
|
1210
1645
|
});
|
|
1211
1646
|
return;
|
|
1212
1647
|
}
|
|
1213
1648
|
}
|
|
1214
|
-
}, [itemElements
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1649
|
+
}, $[21] = itemElements, $[22] = t13) : t13 = $[22];
|
|
1650
|
+
const handleKeyDown = t13;
|
|
1651
|
+
let t14;
|
|
1652
|
+
$[23] !== onFocus ? (t14 = (event_0) => {
|
|
1653
|
+
setFocusedElement(event_0.target), onFocus?.(event_0);
|
|
1654
|
+
}, $[23] = onFocus, $[24] = t14) : t14 = $[24];
|
|
1655
|
+
const handleFocus = t14;
|
|
1656
|
+
let t15;
|
|
1657
|
+
$[25] === Symbol.for("react.memo_cache_sentinel") ? (t15 = () => {
|
|
1658
|
+
if (!ref.current)
|
|
1659
|
+
return;
|
|
1219
1660
|
const _itemElements = Array.from(ref.current.querySelectorAll('[data-ui="TreeItem"]'));
|
|
1220
1661
|
setItemElements(_itemElements);
|
|
1221
|
-
}, [
|
|
1662
|
+
}, $[25] = t15) : t15 = $[25];
|
|
1663
|
+
let t16;
|
|
1664
|
+
$[26] !== children ? (t16 = [children], $[26] = children, $[27] = t16) : t16 = $[27], useEffect(t15, t16);
|
|
1665
|
+
let t17;
|
|
1666
|
+
$[28] !== children || $[29] !== handleFocus || $[30] !== handleKeyDown || $[31] !== restProps || $[32] !== space ? (t17 = /* @__PURE__ */ jsx(Stack, { as: "ul", "data-ui": "Tree", ...restProps, onFocus: handleFocus, onKeyDown: handleKeyDown, ref, role: "tree", space, children }), $[28] = children, $[29] = handleFocus, $[30] = handleKeyDown, $[31] = restProps, $[32] = space, $[33] = t17) : t17 = $[33];
|
|
1667
|
+
let t18;
|
|
1668
|
+
return $[34] !== contextValue || $[35] !== t17 ? (t18 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t17 }), $[34] = contextValue, $[35] = t17, $[36] = t18) : t18 = $[36], t18;
|
|
1222
1669
|
});
|
|
1223
1670
|
Tree.displayName = "ForwardRef(Tree)";
|
|
1224
1671
|
function treeItemRootStyle() {
|
|
@@ -1320,12 +1767,16 @@ function useTree() {
|
|
|
1320
1767
|
return tree;
|
|
1321
1768
|
}
|
|
1322
1769
|
function TreeGroup(props) {
|
|
1323
|
-
const
|
|
1770
|
+
const $ = c(9);
|
|
1771
|
+
let children, restProps, t0;
|
|
1772
|
+
$[0] !== props ? ({
|
|
1324
1773
|
children,
|
|
1325
|
-
expanded
|
|
1774
|
+
expanded: t0,
|
|
1326
1775
|
...restProps
|
|
1327
|
-
} = props,
|
|
1328
|
-
|
|
1776
|
+
} = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0) : (children = $[1], restProps = $[2], t0 = $[3]);
|
|
1777
|
+
const expanded = t0 === void 0 ? !1 : t0, tree = useTree(), t1 = !expanded;
|
|
1778
|
+
let t2;
|
|
1779
|
+
return $[4] !== children || $[5] !== restProps || $[6] !== t1 || $[7] !== tree.space ? (t2 = /* @__PURE__ */ jsx(Stack, { as: "ul", "data-ui": "TreeGroup", ...restProps, hidden: t1, marginTop: tree.space, role: "group", space: tree.space, children }), $[4] = children, $[5] = restProps, $[6] = t1, $[7] = tree.space, $[8] = t2) : t2 = $[8], t2;
|
|
1329
1780
|
}
|
|
1330
1781
|
const StyledTreeItem = /* @__PURE__ */ styled.li.withConfig({
|
|
1331
1782
|
displayName: "StyledTreeItem",
|
|
@@ -1340,64 +1791,115 @@ const StyledTreeItem = /* @__PURE__ */ styled.li.withConfig({
|
|
|
1340
1791
|
componentId: "sc-iiskig-2"
|
|
1341
1792
|
})`& > svg{transition:transform 100ms;}`;
|
|
1342
1793
|
function TreeItem(props) {
|
|
1343
|
-
const
|
|
1794
|
+
const $ = c(112);
|
|
1795
|
+
let IconComponent, children, href, idProp, linkAs, muted, onClick, restProps, t0, t1, t2, t3, t4, text, weight;
|
|
1796
|
+
$[0] !== props ? ({
|
|
1344
1797
|
children,
|
|
1345
|
-
expanded:
|
|
1346
|
-
fontSize
|
|
1798
|
+
expanded: t0,
|
|
1799
|
+
fontSize: t1,
|
|
1347
1800
|
href,
|
|
1348
1801
|
icon: IconComponent,
|
|
1349
1802
|
id: idProp,
|
|
1350
1803
|
linkAs,
|
|
1351
1804
|
muted,
|
|
1352
1805
|
onClick,
|
|
1353
|
-
padding
|
|
1354
|
-
selected
|
|
1355
|
-
space
|
|
1806
|
+
padding: t2,
|
|
1807
|
+
selected: t3,
|
|
1808
|
+
space: t4,
|
|
1356
1809
|
text,
|
|
1357
1810
|
weight,
|
|
1358
1811
|
...restProps
|
|
1359
|
-
} = props, [
|
|
1812
|
+
} = props, $[0] = props, $[1] = IconComponent, $[2] = children, $[3] = href, $[4] = idProp, $[5] = linkAs, $[6] = muted, $[7] = onClick, $[8] = restProps, $[9] = t0, $[10] = t1, $[11] = t2, $[12] = t3, $[13] = t4, $[14] = text, $[15] = weight) : (IconComponent = $[1], children = $[2], href = $[3], idProp = $[4], linkAs = $[5], muted = $[6], onClick = $[7], restProps = $[8], t0 = $[9], t1 = $[10], t2 = $[11], t3 = $[12], t4 = $[13], text = $[14], weight = $[15]);
|
|
1813
|
+
const expandedProp = t0 === void 0 ? !1 : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 2 : t2, selected = t3 === void 0 ? !1 : t3, space = t4 === void 0 ? 2 : t4, [rootElement, setRootElement] = useState(null), treeitemRef = useRef(null), tree = useTree(), {
|
|
1360
1814
|
path,
|
|
1361
1815
|
registerItem,
|
|
1362
1816
|
setExpanded,
|
|
1363
1817
|
setFocusedElement
|
|
1364
|
-
} = tree, _id = useId(), id = idProp || _id
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1818
|
+
} = tree, _id = useId(), id = idProp || _id;
|
|
1819
|
+
let t5, t6;
|
|
1820
|
+
if ($[16] !== id || $[17] !== path) {
|
|
1821
|
+
const itemPath = path.concat([id || ""]);
|
|
1822
|
+
t5 = itemPath, t6 = itemPath.join("/"), $[16] = id, $[17] = path, $[18] = t5, $[19] = t6;
|
|
1823
|
+
} else
|
|
1824
|
+
t5 = $[18], t6 = $[19];
|
|
1825
|
+
let t7;
|
|
1826
|
+
$[20] !== t5 || $[21] !== t6 ? (t7 = [t5, t6], $[20] = t5, $[21] = t6, $[22] = t7) : t7 = $[22];
|
|
1827
|
+
const [itemPath_0, itemKey] = t7, itemState = tree.state[itemKey], focused = tree.focusedElement === rootElement, expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, tabIndex = tree.focusedElement && tree.focusedElement === rootElement ? 0 : -1, t8 = tree.level + 1;
|
|
1828
|
+
let t9;
|
|
1829
|
+
$[23] !== itemPath_0 || $[24] !== t8 || $[25] !== tree ? (t9 = {
|
|
1368
1830
|
...tree,
|
|
1369
|
-
level:
|
|
1370
|
-
path:
|
|
1371
|
-
}
|
|
1831
|
+
level: t8,
|
|
1832
|
+
path: itemPath_0
|
|
1833
|
+
}, $[23] = itemPath_0, $[24] = t8, $[25] = tree, $[26] = t9) : t9 = $[26];
|
|
1834
|
+
const contextValue = t9;
|
|
1835
|
+
let t10;
|
|
1836
|
+
$[27] !== expanded || $[28] !== itemKey || $[29] !== onClick || $[30] !== rootElement || $[31] !== setExpanded || $[32] !== setFocusedElement ? (t10 = (event) => {
|
|
1372
1837
|
onClick && onClick(event);
|
|
1373
1838
|
const target = event.target;
|
|
1374
1839
|
target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootElement));
|
|
1375
|
-
}, [expanded, itemKey, onClick, rootElement, setExpanded, setFocusedElement
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1840
|
+
}, $[27] = expanded, $[28] = itemKey, $[29] = onClick, $[30] = rootElement, $[31] = setExpanded, $[32] = setFocusedElement, $[33] = t10) : t10 = $[33];
|
|
1841
|
+
const handleClick = t10;
|
|
1842
|
+
let t11;
|
|
1843
|
+
$[34] !== focused || $[35] !== rootElement ? (t11 = (event_0) => {
|
|
1844
|
+
focused && event_0.key === "Enter" && (treeitemRef.current || rootElement)?.click();
|
|
1845
|
+
}, $[34] = focused, $[35] = rootElement, $[36] = t11) : t11 = $[36];
|
|
1846
|
+
const handleKeyDown = t11;
|
|
1847
|
+
let t12, t13;
|
|
1848
|
+
$[37] !== expanded || $[38] !== itemKey || $[39] !== registerItem || $[40] !== rootElement || $[41] !== selected ? (t12 = () => {
|
|
1379
1849
|
if (rootElement)
|
|
1380
1850
|
return registerItem(rootElement, itemKey, expanded, selected);
|
|
1381
|
-
}, [expanded, itemKey, registerItem, rootElement, selected]);
|
|
1382
|
-
const
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
] });
|
|
1851
|
+
}, t13 = [expanded, itemKey, registerItem, rootElement, selected], $[37] = expanded, $[38] = itemKey, $[39] = registerItem, $[40] = rootElement, $[41] = selected, $[42] = t12, $[43] = t13) : (t12 = $[42], t13 = $[43]), useEffect(t12, t13);
|
|
1852
|
+
const t14 = IconComponent || children ? "visible" : "hidden";
|
|
1853
|
+
let t15;
|
|
1854
|
+
$[44] !== t14 ? (t15 = {
|
|
1855
|
+
visibility: t14,
|
|
1856
|
+
pointerEvents: "none"
|
|
1857
|
+
}, $[44] = t14, $[45] = t15) : t15 = $[45];
|
|
1858
|
+
let t16;
|
|
1859
|
+
$[46] !== IconComponent || $[47] !== fontSize || $[48] !== muted || $[49] !== weight ? (t16 = IconComponent && /* @__PURE__ */ jsx(Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsx(IconComponent, {}) }), $[46] = IconComponent, $[47] = fontSize, $[48] = muted, $[49] = weight, $[50] = t16) : t16 = $[50];
|
|
1860
|
+
let t17;
|
|
1861
|
+
$[51] !== IconComponent || $[52] !== expanded || $[53] !== fontSize || $[54] !== muted || $[55] !== weight ? (t17 = !IconComponent && /* @__PURE__ */ jsx(ToggleArrowText, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsx(ToggleArrowRightIcon, { style: {
|
|
1862
|
+
transform: expanded ? "rotate(90deg)" : void 0
|
|
1863
|
+
} }) }), $[51] = IconComponent, $[52] = expanded, $[53] = fontSize, $[54] = muted, $[55] = weight, $[56] = t17) : t17 = $[56];
|
|
1864
|
+
let t18;
|
|
1865
|
+
$[57] !== space || $[58] !== t15 || $[59] !== t16 || $[60] !== t17 ? (t18 = /* @__PURE__ */ jsxs(Box, { marginRight: space, style: t15, children: [
|
|
1866
|
+
t16,
|
|
1867
|
+
t17
|
|
1868
|
+
] }), $[57] = space, $[58] = t15, $[59] = t16, $[60] = t17, $[61] = t18) : t18 = $[61];
|
|
1869
|
+
let t19;
|
|
1870
|
+
$[62] !== fontSize || $[63] !== muted || $[64] !== text || $[65] !== weight ? (t19 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text }) }), $[62] = fontSize, $[63] = muted, $[64] = text, $[65] = weight, $[66] = t19) : t19 = $[66];
|
|
1871
|
+
let t20;
|
|
1872
|
+
$[67] !== padding || $[68] !== t18 || $[69] !== t19 ? (t20 = /* @__PURE__ */ jsxs(Flex, { padding, children: [
|
|
1873
|
+
t18,
|
|
1874
|
+
t19
|
|
1875
|
+
] }), $[67] = padding, $[68] = t18, $[69] = t19, $[70] = t20) : t20 = $[70];
|
|
1876
|
+
const content2 = t20;
|
|
1877
|
+
if (href) {
|
|
1878
|
+
const t212 = selected ? "" : void 0;
|
|
1879
|
+
let t222;
|
|
1880
|
+
$[71] !== content2 || $[72] !== expanded || $[73] !== href || $[74] !== linkAs || $[75] !== tabIndex || $[76] !== tree.level ? (t222 = /* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, ref: treeitemRef, role: "treeitem", tabIndex, children: content2 }), $[71] = content2, $[72] = expanded, $[73] = href, $[74] = linkAs, $[75] = tabIndex, $[76] = tree.level, $[77] = t222) : t222 = $[77];
|
|
1881
|
+
let t232;
|
|
1882
|
+
$[78] !== children || $[79] !== expanded ? (t232 = children && /* @__PURE__ */ jsx(TreeGroup, { hidden: !expanded, children }), $[78] = children, $[79] = expanded, $[80] = t232) : t232 = $[80];
|
|
1883
|
+
let t242;
|
|
1884
|
+
$[81] !== contextValue || $[82] !== t232 ? (t242 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t232 }), $[81] = contextValue, $[82] = t232, $[83] = t242) : t242 = $[83];
|
|
1885
|
+
let t252;
|
|
1886
|
+
return $[84] !== handleClick || $[85] !== id || $[86] !== itemKey || $[87] !== restProps || $[88] !== t212 || $[89] !== t222 || $[90] !== t242 ? (t252 = /* @__PURE__ */ jsxs(StyledTreeItem, { "data-selected": t212, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...restProps, onClick: handleClick, ref: setRootElement, role: "none", children: [
|
|
1887
|
+
t222,
|
|
1888
|
+
t242
|
|
1889
|
+
] }), $[84] = handleClick, $[85] = id, $[86] = itemKey, $[87] = restProps, $[88] = t212, $[89] = t222, $[90] = t242, $[91] = t252) : t252 = $[91], t252;
|
|
1890
|
+
}
|
|
1891
|
+
const t21 = selected ? "" : void 0;
|
|
1892
|
+
let t22;
|
|
1893
|
+
$[92] !== content2 || $[93] !== tree.level ? (t22 = /* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, as: "div", "data-ui": "TreeItem__box", children: content2 }), $[92] = content2, $[93] = tree.level, $[94] = t22) : t22 = $[94];
|
|
1894
|
+
let t23;
|
|
1895
|
+
$[95] !== children || $[96] !== expanded ? (t23 = children && /* @__PURE__ */ jsx(TreeGroup, { expanded, children }), $[95] = children, $[96] = expanded, $[97] = t23) : t23 = $[97];
|
|
1896
|
+
let t24;
|
|
1897
|
+
$[98] !== contextValue || $[99] !== t23 ? (t24 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t23 }), $[98] = contextValue, $[99] = t23, $[100] = t24) : t24 = $[100];
|
|
1898
|
+
let t25;
|
|
1899
|
+
return $[101] !== expanded || $[102] !== handleClick || $[103] !== handleKeyDown || $[104] !== id || $[105] !== itemKey || $[106] !== restProps || $[107] !== t21 || $[108] !== t22 || $[109] !== t24 || $[110] !== tabIndex ? (t25 = /* @__PURE__ */ jsxs(StyledTreeItem, { "data-selected": t21, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...restProps, "aria-expanded": expanded, onClick: handleClick, onKeyDown: handleKeyDown, ref: setRootElement, role: "treeitem", tabIndex, children: [
|
|
1900
|
+
t22,
|
|
1901
|
+
t24
|
|
1902
|
+
] }), $[101] = expanded, $[102] = handleClick, $[103] = handleKeyDown, $[104] = id, $[105] = itemKey, $[106] = restProps, $[107] = t21, $[108] = t22, $[109] = t24, $[110] = tabIndex, $[111] = t25) : t25 = $[111], t25;
|
|
1401
1903
|
}
|
|
1402
1904
|
TreeItem.displayName = "TreeItem";
|
|
1403
1905
|
export {
|