@sanity/ui 2.8.13-canary.1 → 2.9.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +250 -100
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +249 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +250 -100
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +42 -31
- package/src/core/components/tree/treeItem.tsx +13 -13
- package/src/core/hooks/useArrayProp.ts +14 -9
- package/src/core/hooks/useMatchMedia.ts +12 -22
- package/src/core/utils/portal/portalProvider.tsx +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildTheme, createColorTheme as createColorTheme$1, hexToRgb as hexToRgb$1, hslToRgb as hslToRgb$1, multiply as multiply$1, parseColor as parseColor$1, rgbToHex as rgbToHex$1, rgbToHsl as rgbToHsl$1, rgba as rgba$1, screen as screen$1, getTheme_v2, getScopedTheme } from "@sanity/ui/theme";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { c } from "react-compiler-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { useState, useRef, useEffect, useDebugValue, useImperativeHandle, useSyncExternalStore, createContext, useContext, useMemo, forwardRef, useId, Children, isValidElement, cloneElement, useCallback, Component, memo, useLayoutEffect, useReducer, Fragment as Fragment$1, startTransition } from "react";
|
|
5
5
|
import ReactIs, { isValidElementType } from "react-is";
|
|
6
6
|
import { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, styled, keyframes } from "styled-components";
|
|
7
7
|
import { SpinnerIcon, CheckmarkIcon, RemoveIcon, ChevronDownIcon, CloseIcon, ChevronRightIcon, ToggleArrowRightIcon } from "@sanity/icons";
|
|
@@ -154,13 +154,11 @@ function responsiveTextFont(props) {
|
|
|
154
154
|
return responsiveFont("text", props);
|
|
155
155
|
}
|
|
156
156
|
function useArrayProp(val, defaultVal) {
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
[__perf_hash__]
|
|
163
|
-
);
|
|
157
|
+
const $ = c(3);
|
|
158
|
+
let t0;
|
|
159
|
+
$[0] !== val || $[1] !== defaultVal ? (t0 = () => [_getArrayProp(val, defaultVal), JSON.stringify(val ?? defaultVal)], $[0] = val, $[1] = defaultVal, $[2] = t0) : t0 = $[2];
|
|
160
|
+
const [t1, setCache] = useState(t0), [cachedVal, cachedHash] = t1, hash = JSON.stringify(val ?? defaultVal);
|
|
161
|
+
return hash !== cachedHash && setCache([_getArrayProp(val, defaultVal), hash]), cachedVal;
|
|
164
162
|
}
|
|
165
163
|
function _getElements(element, elementsArg) {
|
|
166
164
|
const ret = [element];
|
|
@@ -595,20 +593,19 @@ function useGlobalKeyDown(onKeyDown) {
|
|
|
595
593
|
return $[0] !== onKeyDown ? (t0 = () => (addEventListener("keydown", onKeyDown), () => removeEventListener("keydown", onKeyDown)), t1 = [onKeyDown], $[0] = onKeyDown, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), useEffect(t0, t1);
|
|
596
594
|
}
|
|
597
595
|
function useMatchMedia(mediaQueryString, getServerSnapshot2) {
|
|
596
|
+
const $ = c(4);
|
|
597
|
+
let t0, t1;
|
|
598
|
+
$[0] !== mediaQueryString ? (t1 = typeof window > "u" ? null : window.matchMedia(mediaQueryString), $[0] = mediaQueryString, $[1] = t1) : t1 = $[1], t0 = t1;
|
|
599
|
+
const cachedMatchMedia = t0;
|
|
600
|
+
let t2, t3;
|
|
601
|
+
$[2] !== cachedMatchMedia ? (t3 = {
|
|
602
|
+
subscribe: (onStoreChange) => (cachedMatchMedia.addEventListener("change", onStoreChange), () => cachedMatchMedia.removeEventListener("change", onStoreChange)),
|
|
603
|
+
getSnapshot: () => cachedMatchMedia.matches
|
|
604
|
+
}, $[2] = cachedMatchMedia, $[3] = t3) : t3 = $[3], t2 = t3;
|
|
598
605
|
const {
|
|
599
606
|
subscribe: subscribe2,
|
|
600
607
|
getSnapshot
|
|
601
|
-
} =
|
|
602
|
-
let MEDIA_QUERY_CACHE;
|
|
603
|
-
const getMatchMedia = () => (MEDIA_QUERY_CACHE || (MEDIA_QUERY_CACHE = window.matchMedia(mediaQueryString)), MEDIA_QUERY_CACHE);
|
|
604
|
-
return {
|
|
605
|
-
subscribe: (onStoreChange) => {
|
|
606
|
-
const matchMedia = getMatchMedia();
|
|
607
|
-
return matchMedia.addEventListener("change", onStoreChange), () => matchMedia.removeEventListener("change", onStoreChange);
|
|
608
|
-
},
|
|
609
|
-
getSnapshot: () => getMatchMedia().matches
|
|
610
|
-
};
|
|
611
|
-
}, [mediaQueryString]);
|
|
608
|
+
} = t2;
|
|
612
609
|
return useDebugValue(mediaQueryString), useSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot2);
|
|
613
610
|
}
|
|
614
611
|
function getGlobalScope() {
|
|
@@ -3472,8 +3469,8 @@ PortalProvider.displayName = "PortalProvider";
|
|
|
3472
3469
|
const emptySubscribe = () => () => {
|
|
3473
3470
|
};
|
|
3474
3471
|
function useUnique(value) {
|
|
3475
|
-
const
|
|
3476
|
-
return _isEqual(
|
|
3472
|
+
const [cachedValue, setCachedValue] = useState(value);
|
|
3473
|
+
return _isEqual(cachedValue, value) || setCachedValue(value), cachedValue;
|
|
3477
3474
|
}
|
|
3478
3475
|
function _isEqual(objA, objB) {
|
|
3479
3476
|
if (!objA || !objB)
|
|
@@ -4962,15 +4959,17 @@ function autocompleteReducer(state, msg2) {
|
|
|
4962
4959
|
} : state;
|
|
4963
4960
|
}
|
|
4964
4961
|
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) {
|
|
4965
|
-
const
|
|
4966
|
-
|
|
4962
|
+
const $ = c(187);
|
|
4963
|
+
let t0, t1, t2, t3, t4, t5, t6, valueProp, renderOptionProp, filterOptionProp, id, optionsProp, loading, onBlur, onQueryChange, relatedElements, onSelect, onChange, onFocus, openOnFocus, disabled, openButton, readOnly, suffix, restProps, customValidity, icon, prefix, renderPopover;
|
|
4964
|
+
$[0] !== props ? ({
|
|
4965
|
+
border: t0,
|
|
4967
4966
|
customValidity,
|
|
4968
4967
|
disabled,
|
|
4969
4968
|
filterOption: filterOptionProp,
|
|
4970
|
-
fontSize:
|
|
4969
|
+
fontSize: t1,
|
|
4971
4970
|
icon,
|
|
4972
4971
|
id,
|
|
4973
|
-
listBox
|
|
4972
|
+
listBox: t2,
|
|
4974
4973
|
loading,
|
|
4975
4974
|
onBlur,
|
|
4976
4975
|
onChange,
|
|
@@ -4980,39 +4979,63 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
4980
4979
|
openButton,
|
|
4981
4980
|
openOnFocus,
|
|
4982
4981
|
options: optionsProp,
|
|
4983
|
-
padding:
|
|
4984
|
-
popover
|
|
4982
|
+
padding: t3,
|
|
4983
|
+
popover: t4,
|
|
4985
4984
|
prefix,
|
|
4986
|
-
radius
|
|
4985
|
+
radius: t5,
|
|
4987
4986
|
readOnly,
|
|
4988
4987
|
relatedElements,
|
|
4989
4988
|
renderOption: renderOptionProp,
|
|
4990
4989
|
renderPopover,
|
|
4991
|
-
renderValue
|
|
4990
|
+
renderValue: t6,
|
|
4992
4991
|
suffix,
|
|
4993
4992
|
value: valueProp,
|
|
4994
4993
|
...restProps
|
|
4995
|
-
} = props, [
|
|
4996
|
-
|
|
4994
|
+
} = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = t5, $[7] = t6, $[8] = valueProp, $[9] = renderOptionProp, $[10] = filterOptionProp, $[11] = id, $[12] = optionsProp, $[13] = loading, $[14] = onBlur, $[15] = onQueryChange, $[16] = relatedElements, $[17] = onSelect, $[18] = onChange, $[19] = onFocus, $[20] = openOnFocus, $[21] = disabled, $[22] = openButton, $[23] = readOnly, $[24] = suffix, $[25] = restProps, $[26] = customValidity, $[27] = icon, $[28] = prefix, $[29] = renderPopover) : (t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], t5 = $[6], t6 = $[7], valueProp = $[8], renderOptionProp = $[9], filterOptionProp = $[10], id = $[11], optionsProp = $[12], loading = $[13], onBlur = $[14], onQueryChange = $[15], relatedElements = $[16], onSelect = $[17], onChange = $[18], onFocus = $[19], openOnFocus = $[20], disabled = $[21], openButton = $[22], readOnly = $[23], suffix = $[24], restProps = $[25], customValidity = $[26], icon = $[27], prefix = $[28], renderPopover = $[29]);
|
|
4995
|
+
const border2 = t0 === void 0 ? !0 : t0, fontSize2 = 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;
|
|
4996
|
+
let t9;
|
|
4997
|
+
$[30] !== t7 || $[31] !== t8 ? (t9 = {
|
|
4998
|
+
activeValue: t7,
|
|
4997
4999
|
focused: !1,
|
|
4998
5000
|
listFocused: !1,
|
|
4999
5001
|
query: null,
|
|
5000
|
-
value:
|
|
5001
|
-
}
|
|
5002
|
+
value: t8
|
|
5003
|
+
}, $[30] = t7, $[31] = t8, $[32] = t9) : t9 = $[32];
|
|
5004
|
+
const [state, dispatch] = useReducer(autocompleteReducer, t9), {
|
|
5002
5005
|
activeValue,
|
|
5003
5006
|
focused,
|
|
5004
5007
|
listFocused,
|
|
5005
5008
|
query,
|
|
5006
5009
|
value
|
|
5007
|
-
} = state
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5010
|
+
} = state;
|
|
5011
|
+
let t10;
|
|
5012
|
+
$[33] !== paddingProp || $[34] !== fontSize2 ? (t10 = (t112) => {
|
|
5013
|
+
const {
|
|
5014
|
+
value: value_0
|
|
5015
|
+
} = t112;
|
|
5016
|
+
return /* @__PURE__ */ jsx(Card, { "data-as": "button", padding: paddingProp, radius: 2, tone: "inherit", children: /* @__PURE__ */ jsx(Text, { size: fontSize2, textOverflow: "ellipsis", children: value_0 }) });
|
|
5017
|
+
}, $[33] = paddingProp, $[34] = fontSize2, $[35] = t10) : t10 = $[35];
|
|
5018
|
+
const renderOption = typeof renderOptionProp == "function" ? renderOptionProp : t10, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, [rootElement, setRootElement] = useState(null), [resultsPopoverElement, setResultsPopoverElement] = useState(null), [inputElement, setInputElement] = useState(null), listBoxElementRef = useRef(null), listFocusedRef = useRef(!1), valueRef = useRef(value), valuePropRef = useRef(valueProp), [popoverMouseWithin, setPopoverMouseWithin] = useState(!1);
|
|
5019
|
+
let t11, t12;
|
|
5020
|
+
$[36] !== inputElement ? (t11 = () => inputElement, t12 = [inputElement], $[36] = inputElement, $[37] = t11, $[38] = t12) : (t11 = $[37], t12 = $[38]), useImperativeHandle(forwardedRef, t11, t12);
|
|
5021
|
+
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = useArrayProp(paddingProp);
|
|
5022
|
+
let t13, t14;
|
|
5023
|
+
$[39] !== value || $[40] !== options ? (t14 = value !== null ? options.find((o) => o.value === value) : void 0, $[39] = value, $[40] = options, $[41] = t14) : t14 = $[41], t13 = t14;
|
|
5024
|
+
const currentOption = t13;
|
|
5025
|
+
let t15, t16;
|
|
5026
|
+
if ($[42] !== query || $[43] !== filterOption || $[44] !== options) {
|
|
5027
|
+
let t172;
|
|
5028
|
+
$[46] !== query || $[47] !== filterOption ? (t172 = (option) => query ? filterOption(query, option) : !0, $[46] = query, $[47] = filterOption, $[48] = t172) : t172 = $[48], t16 = options.filter(t172), $[42] = query, $[43] = filterOption, $[44] = options, $[45] = t16;
|
|
5029
|
+
} else
|
|
5030
|
+
t16 = $[45];
|
|
5031
|
+
t15 = t16;
|
|
5032
|
+
const filteredOptions = t15, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null;
|
|
5033
|
+
let t17;
|
|
5034
|
+
$[49] !== popoverMouseWithin || $[50] !== relatedElements || $[51] !== rootElement || $[52] !== resultsPopoverElement || $[53] !== onQueryChange || $[54] !== onBlur ? (t17 = (event) => {
|
|
5012
5035
|
setTimeout(() => {
|
|
5013
|
-
if (
|
|
5036
|
+
if (popoverMouseWithin)
|
|
5014
5037
|
return;
|
|
5015
|
-
const elements = (relatedElements || []).concat(
|
|
5038
|
+
const elements = (relatedElements || []).concat(rootElement ? [rootElement] : [], resultsPopoverElement ? [resultsPopoverElement] : []);
|
|
5016
5039
|
let focusInside = !1;
|
|
5017
5040
|
if (document.activeElement) {
|
|
5018
5041
|
for (const e of elements)
|
|
@@ -5023,22 +5046,32 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
5023
5046
|
}
|
|
5024
5047
|
focusInside === !1 && (dispatch({
|
|
5025
5048
|
type: "root/blur"
|
|
5026
|
-
}),
|
|
5049
|
+
}), setPopoverMouseWithin(!1), onQueryChange && onQueryChange(null), onBlur && onBlur(event));
|
|
5027
5050
|
}, 0);
|
|
5028
|
-
}, [
|
|
5051
|
+
}, $[49] = popoverMouseWithin, $[50] = relatedElements, $[51] = rootElement, $[52] = resultsPopoverElement, $[53] = onQueryChange, $[54] = onBlur, $[55] = t17) : t17 = $[55];
|
|
5052
|
+
const handleRootBlur = t17;
|
|
5053
|
+
let t18;
|
|
5054
|
+
$[56] === Symbol.for("react.memo_cache_sentinel") ? (t18 = (event_0) => {
|
|
5029
5055
|
const listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = listBoxElement?.contains(focusedElement) || !1;
|
|
5030
5056
|
listFocused_0 !== listFocusedRef.current && (listFocusedRef.current = listFocused_0, dispatch({
|
|
5031
5057
|
type: "root/setListFocused",
|
|
5032
5058
|
listFocused: listFocused_0
|
|
5033
5059
|
}));
|
|
5034
|
-
}, []
|
|
5060
|
+
}, $[56] = t18) : t18 = $[56];
|
|
5061
|
+
const handleRootFocus = t18;
|
|
5062
|
+
let t19;
|
|
5063
|
+
$[57] !== onSelect || $[58] !== onChange || $[59] !== onQueryChange || $[60] !== inputElement ? (t19 = (v) => {
|
|
5035
5064
|
dispatch({
|
|
5036
5065
|
type: "value/change",
|
|
5037
5066
|
value: v
|
|
5038
|
-
}),
|
|
5039
|
-
}, [onChange,
|
|
5067
|
+
}), setPopoverMouseWithin(!1), onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), inputElement?.focus();
|
|
5068
|
+
}, $[57] = onSelect, $[58] = onChange, $[59] = onQueryChange, $[60] = inputElement, $[61] = t19) : t19 = $[61];
|
|
5069
|
+
const handleOptionSelect = t19;
|
|
5070
|
+
let t20;
|
|
5071
|
+
$[62] !== filteredOptionsLen || $[63] !== filteredOptions || $[64] !== activeValue || $[65] !== onQueryChange || $[66] !== inputElement ? (t20 = (event_1) => {
|
|
5040
5072
|
if (event_1.key === "ArrowDown") {
|
|
5041
|
-
if (event_1.preventDefault(), !filteredOptionsLen)
|
|
5073
|
+
if (event_1.preventDefault(), !filteredOptionsLen)
|
|
5074
|
+
return;
|
|
5042
5075
|
const activeOption = filteredOptions.find((o_0) => o_0.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
|
|
5043
5076
|
nextActiveOption && dispatch({
|
|
5044
5077
|
type: "root/setActiveValue",
|
|
@@ -5048,7 +5081,8 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
5048
5081
|
return;
|
|
5049
5082
|
}
|
|
5050
5083
|
if (event_1.key === "ArrowUp") {
|
|
5051
|
-
if (event_1.preventDefault(), !filteredOptionsLen)
|
|
5084
|
+
if (event_1.preventDefault(), !filteredOptionsLen)
|
|
5085
|
+
return;
|
|
5052
5086
|
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];
|
|
5053
5087
|
nextActiveOption_0 && dispatch({
|
|
5054
5088
|
type: "root/setActiveValue",
|
|
@@ -5060,43 +5094,66 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
5060
5094
|
if (event_1.key === "Escape") {
|
|
5061
5095
|
dispatch({
|
|
5062
5096
|
type: "root/escape"
|
|
5063
|
-
}),
|
|
5097
|
+
}), setPopoverMouseWithin(!1), onQueryChange && onQueryChange(null), inputElement?.focus();
|
|
5064
5098
|
return;
|
|
5065
5099
|
}
|
|
5066
5100
|
const target = event_1.target, listEl = listBoxElementRef.current;
|
|
5067
5101
|
if ((listEl === target || listEl?.contains(target)) && !AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event_1.key)) {
|
|
5068
|
-
|
|
5102
|
+
inputElement?.focus();
|
|
5069
5103
|
return;
|
|
5070
5104
|
}
|
|
5071
|
-
}, [
|
|
5105
|
+
}, $[62] = filteredOptionsLen, $[63] = filteredOptions, $[64] = activeValue, $[65] = onQueryChange, $[66] = inputElement, $[67] = t20) : t20 = $[67];
|
|
5106
|
+
const handleRootKeyDown = t20;
|
|
5107
|
+
let t21;
|
|
5108
|
+
$[68] !== onQueryChange ? (t21 = (event_2) => {
|
|
5072
5109
|
const nextQuery = event_2.currentTarget.value;
|
|
5073
5110
|
dispatch({
|
|
5074
5111
|
type: "input/change",
|
|
5075
5112
|
query: nextQuery
|
|
5076
5113
|
}), onQueryChange && onQueryChange(nextQuery);
|
|
5077
|
-
}, [onQueryChange
|
|
5114
|
+
}, $[68] = onQueryChange, $[69] = t21) : t21 = $[69];
|
|
5115
|
+
const handleInputChange = t21;
|
|
5116
|
+
let t22;
|
|
5117
|
+
$[70] !== value || $[71] !== renderValue || $[72] !== currentOption ? (t22 = () => {
|
|
5078
5118
|
dispatch({
|
|
5079
5119
|
type: "root/open",
|
|
5080
5120
|
query: value ? renderValue(value, currentOption) : ""
|
|
5081
5121
|
});
|
|
5082
|
-
}, [
|
|
5122
|
+
}, $[70] = value, $[71] = renderValue, $[72] = currentOption, $[73] = t22) : t22 = $[73];
|
|
5123
|
+
const dispatchOpen = t22;
|
|
5124
|
+
let t23;
|
|
5125
|
+
$[74] !== focused || $[75] !== onFocus || $[76] !== openOnFocus || $[77] !== dispatchOpen ? (t23 = (event_3) => {
|
|
5083
5126
|
focused || (dispatch({
|
|
5084
5127
|
type: "input/focus"
|
|
5085
5128
|
}), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
|
|
5086
|
-
}, [focused, onFocus, openOnFocus, dispatchOpen
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5129
|
+
}, $[74] = focused, $[75] = onFocus, $[76] = openOnFocus, $[77] = dispatchOpen, $[78] = t23) : t23 = $[78];
|
|
5130
|
+
const handleInputFocus = t23;
|
|
5131
|
+
let t24;
|
|
5132
|
+
$[79] === Symbol.for("react.memo_cache_sentinel") ? (t24 = () => {
|
|
5133
|
+
setPopoverMouseWithin(!0);
|
|
5134
|
+
}, $[79] = t24) : t24 = $[79];
|
|
5135
|
+
const handlePopoverMouseEnter = t24;
|
|
5136
|
+
let t25;
|
|
5137
|
+
$[80] === Symbol.for("react.memo_cache_sentinel") ? (t25 = () => {
|
|
5138
|
+
setPopoverMouseWithin(!1);
|
|
5139
|
+
}, $[80] = t25) : t25 = $[80];
|
|
5140
|
+
const handlePopoverMouseLeave = t25;
|
|
5141
|
+
let t26;
|
|
5142
|
+
$[81] !== onChange || $[82] !== onQueryChange || $[83] !== inputElement ? (t26 = () => {
|
|
5091
5143
|
dispatch({
|
|
5092
5144
|
type: "root/clear"
|
|
5093
|
-
}), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null),
|
|
5094
|
-
}, [onChange, onQueryChange]
|
|
5145
|
+
}), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null), inputElement?.focus();
|
|
5146
|
+
}, $[81] = onChange, $[82] = onQueryChange, $[83] = inputElement, $[84] = t26) : t26 = $[84];
|
|
5147
|
+
const handleClearButtonClick = t26;
|
|
5148
|
+
let t27;
|
|
5149
|
+
$[85] === Symbol.for("react.memo_cache_sentinel") ? (t27 = () => {
|
|
5095
5150
|
dispatch({
|
|
5096
5151
|
type: "input/focus"
|
|
5097
5152
|
});
|
|
5098
|
-
}, []);
|
|
5099
|
-
|
|
5153
|
+
}, $[85] = t27) : t27 = $[85];
|
|
5154
|
+
const handleClearButtonFocus = t27;
|
|
5155
|
+
let t28, t29;
|
|
5156
|
+
$[86] !== valueProp ? (t28 = () => {
|
|
5100
5157
|
if (valueProp !== valuePropRef.current) {
|
|
5101
5158
|
valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
|
|
5102
5159
|
type: "value/change",
|
|
@@ -5108,14 +5165,19 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
5108
5165
|
type: "value/change",
|
|
5109
5166
|
value: valueProp || null
|
|
5110
5167
|
}));
|
|
5111
|
-
}, [valueProp]), useEffect(
|
|
5168
|
+
}, t29 = [valueProp], $[86] = valueProp, $[87] = t28, $[88] = t29) : (t28 = $[87], t29 = $[88]), useEffect(t28, t29);
|
|
5169
|
+
let t30, t31;
|
|
5170
|
+
$[89] !== focused ? (t30 = () => {
|
|
5112
5171
|
!focused && valueRef.current && dispatch({
|
|
5113
5172
|
type: "root/setActiveValue",
|
|
5114
5173
|
value: valueRef.current
|
|
5115
5174
|
});
|
|
5116
|
-
}, [focused]), useEffect(
|
|
5175
|
+
}, t31 = [focused], $[89] = focused, $[90] = t30, $[91] = t31) : (t30 = $[90], t31 = $[91]), useEffect(t30, t31);
|
|
5176
|
+
let t32, t33;
|
|
5177
|
+
$[92] !== filteredOptions || $[93] !== activeValue ? (t32 = () => {
|
|
5117
5178
|
const listElement = listBoxElementRef.current;
|
|
5118
|
-
if (!listElement)
|
|
5179
|
+
if (!listElement)
|
|
5180
|
+
return;
|
|
5119
5181
|
const activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
|
|
5120
5182
|
if (activeOption_1) {
|
|
5121
5183
|
const activeIndex_1 = filteredOptions.indexOf(activeOption_1), activeItemElement = listElement.childNodes[activeIndex_1];
|
|
@@ -5125,35 +5187,123 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
5125
5187
|
focusFirstDescendant(activeItemElement);
|
|
5126
5188
|
}
|
|
5127
5189
|
}
|
|
5128
|
-
}, [activeValue, filteredOptions]);
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5190
|
+
}, t33 = [activeValue, filteredOptions], $[92] = filteredOptions, $[93] = activeValue, $[94] = t32, $[95] = t33) : (t32 = $[94], t33 = $[95]), useEffect(t32, t33);
|
|
5191
|
+
let t34;
|
|
5192
|
+
bb0: {
|
|
5193
|
+
if (!loading && !disabled && value) {
|
|
5194
|
+
let t352;
|
|
5195
|
+
$[96] === Symbol.for("react.memo_cache_sentinel") ? (t352 = {
|
|
5132
5196
|
"aria-label": "Clear",
|
|
5133
5197
|
onFocus: handleClearButtonFocus
|
|
5134
|
-
};
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
}
|
|
5153
|
-
|
|
5198
|
+
}, $[96] = t352) : t352 = $[96], t34 = t352;
|
|
5199
|
+
break bb0;
|
|
5200
|
+
}
|
|
5201
|
+
t34 = void 0;
|
|
5202
|
+
}
|
|
5203
|
+
const clearButton = t34;
|
|
5204
|
+
let t35, t36;
|
|
5205
|
+
if ($[97] !== padding) {
|
|
5206
|
+
let t372;
|
|
5207
|
+
$[99] === Symbol.for("react.memo_cache_sentinel") ? (t372 = (v_0) => v_0 === 0 ? 0 : v_0 === 1 || v_0 === 2 ? 1 : v_0 - 2, $[99] = t372) : t372 = $[99], t36 = padding.map(t372), $[97] = padding, $[98] = t36;
|
|
5208
|
+
} else
|
|
5209
|
+
t36 = $[98];
|
|
5210
|
+
t35 = t36;
|
|
5211
|
+
const openButtonBoxPadding = t35;
|
|
5212
|
+
let t37, t38;
|
|
5213
|
+
if ($[100] !== padding) {
|
|
5214
|
+
let t392;
|
|
5215
|
+
$[102] === Symbol.for("react.memo_cache_sentinel") ? (t392 = (v_1) => Math.max(v_1 - 1, 0), $[102] = t392) : t392 = $[102], t38 = padding.map(t392), $[100] = padding, $[101] = t38;
|
|
5216
|
+
} else
|
|
5217
|
+
t38 = $[101];
|
|
5218
|
+
t37 = t38;
|
|
5219
|
+
const openButtonPadding = t37;
|
|
5220
|
+
let t39;
|
|
5221
|
+
t39 = typeof openButton == "object" ? openButton : EMPTY_RECORD;
|
|
5222
|
+
const openButtonProps = t39;
|
|
5223
|
+
let t40;
|
|
5224
|
+
$[103] !== dispatchOpen || $[104] !== openButtonProps || $[105] !== inputElement ? (t40 = (event_4) => {
|
|
5225
|
+
dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElement?.focus());
|
|
5226
|
+
}, $[103] = dispatchOpen, $[104] = openButtonProps, $[105] = inputElement, $[106] = t40) : t40 = $[106];
|
|
5227
|
+
const handleOpenClick = t40;
|
|
5228
|
+
let t41, t42;
|
|
5229
|
+
$[107] !== disabled || $[108] !== readOnly || $[109] !== openButton || $[110] !== expanded || $[111] !== fontSize2 || $[112] !== openButtonPadding || $[113] !== openButtonProps || $[114] !== handleOpenClick || $[115] !== openButtonBoxPadding ? (t42 = !disabled && !readOnly && openButton ? /* @__PURE__ */ jsx(Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsx(Button, { "aria-label": "Open", disabled: expanded, fontSize: fontSize2, icon: ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, $[107] = disabled, $[108] = readOnly, $[109] = openButton, $[110] = expanded, $[111] = fontSize2, $[112] = openButtonPadding, $[113] = openButtonProps, $[114] = handleOpenClick, $[115] = openButtonBoxPadding, $[116] = t42) : t42 = $[116], t41 = t42;
|
|
5230
|
+
const openButtonNode = t41;
|
|
5231
|
+
let t43;
|
|
5232
|
+
bb1: {
|
|
5233
|
+
if (query === null) {
|
|
5234
|
+
if (value !== null) {
|
|
5235
|
+
let t442;
|
|
5236
|
+
$[117] !== renderValue || $[118] !== value || $[119] !== currentOption ? (t442 = renderValue(value, currentOption), $[117] = renderValue, $[118] = value, $[119] = currentOption, $[120] = t442) : t442 = $[120], t43 = t442;
|
|
5237
|
+
break bb1;
|
|
5238
|
+
}
|
|
5239
|
+
t43 = "";
|
|
5240
|
+
break bb1;
|
|
5241
|
+
}
|
|
5242
|
+
t43 = query;
|
|
5243
|
+
}
|
|
5244
|
+
const inputValue = t43, t44 = loading && AnimatedSpinnerIcon, t45 = suffix || openButtonNode;
|
|
5245
|
+
let t46;
|
|
5246
|
+
$[121] !== restProps || $[122] !== activeItemId || $[123] !== expanded || $[124] !== listBoxId || $[125] !== border2 || $[126] !== clearButton || $[127] !== customValidity || $[128] !== disabled || $[129] !== fontSize2 || $[130] !== icon || $[131] !== t44 || $[132] !== id || $[133] !== handleInputChange || $[134] !== handleClearButtonClick || $[135] !== handleInputFocus || $[136] !== padding || $[137] !== prefix || $[138] !== radius || $[139] !== readOnly || $[140] !== t45 || $[141] !== inputValue ? (t46 = /* @__PURE__ */ jsx(TextInput, { ...restProps, "aria-activedescendant": activeItemId, "aria-autocomplete": "list", "aria-expanded": expanded, "aria-owns": listBoxId, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", border: border2, clearButton, customValidity, disabled, fontSize: fontSize2, icon, iconRight: t44, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: setInputElement, role: "combobox", spellCheck: !1, suffix: t45, value: inputValue }), $[121] = restProps, $[122] = activeItemId, $[123] = expanded, $[124] = listBoxId, $[125] = border2, $[126] = clearButton, $[127] = customValidity, $[128] = disabled, $[129] = fontSize2, $[130] = icon, $[131] = t44, $[132] = id, $[133] = handleInputChange, $[134] = handleClearButtonClick, $[135] = handleInputFocus, $[136] = padding, $[137] = prefix, $[138] = radius, $[139] = readOnly, $[140] = t45, $[141] = inputValue, $[142] = t46) : t46 = $[142];
|
|
5247
|
+
const input = t46;
|
|
5248
|
+
let t47;
|
|
5249
|
+
$[143] !== listFocused || $[144] !== inputElement ? (t47 = (event_5) => {
|
|
5250
|
+
event_5.key === "Tab" && listFocused && inputElement?.focus();
|
|
5251
|
+
}, $[143] = listFocused, $[144] = inputElement, $[145] = t47) : t47 = $[145];
|
|
5252
|
+
const handleListBoxKeyDown = t47;
|
|
5253
|
+
let t48;
|
|
5254
|
+
bb2: {
|
|
5255
|
+
if (filteredOptions.length === 0) {
|
|
5256
|
+
t48 = null;
|
|
5257
|
+
break bb2;
|
|
5258
|
+
}
|
|
5259
|
+
let t492;
|
|
5260
|
+
if ($[146] !== activeValue || $[147] !== currentOption || $[148] !== id || $[149] !== handleOptionSelect || $[150] !== renderOption || $[151] !== loading || $[152] !== listFocused || $[153] !== filteredOptions) {
|
|
5261
|
+
let t503;
|
|
5262
|
+
$[155] !== activeValue || $[156] !== currentOption || $[157] !== id || $[158] !== handleOptionSelect || $[159] !== renderOption || $[160] !== loading || $[161] !== listFocused ? (t503 = (option_0) => {
|
|
5263
|
+
const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
|
|
5264
|
+
return /* @__PURE__ */ jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: cloneElement(renderOption(option_0), {
|
|
5265
|
+
disabled: loading,
|
|
5266
|
+
selected: active,
|
|
5267
|
+
tabIndex: listFocused && active ? 0 : -1
|
|
5268
|
+
}) }, option_0.value);
|
|
5269
|
+
}, $[155] = activeValue, $[156] = currentOption, $[157] = id, $[158] = handleOptionSelect, $[159] = renderOption, $[160] = loading, $[161] = listFocused, $[162] = t503) : t503 = $[162], t492 = filteredOptions.map(t503), $[146] = activeValue, $[147] = currentOption, $[148] = id, $[149] = handleOptionSelect, $[150] = renderOption, $[151] = loading, $[152] = listFocused, $[153] = filteredOptions, $[154] = t492;
|
|
5270
|
+
} else
|
|
5271
|
+
t492 = $[154];
|
|
5272
|
+
let t502;
|
|
5273
|
+
$[163] !== listBoxId || $[164] !== t492 ? (t502 = /* @__PURE__ */ jsx(Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", id: listBoxId, ref: listBoxElementRef, role: "listbox", space: 1, children: t492 }), $[163] = listBoxId, $[164] = t492, $[165] = t502) : t502 = $[165];
|
|
5274
|
+
let t51;
|
|
5275
|
+
$[166] !== handleListBoxKeyDown || $[167] !== listBox || $[168] !== t502 ? (t51 = /* @__PURE__ */ jsx(ListBox, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: t502 }), $[166] = handleListBoxKeyDown, $[167] = listBox, $[168] = t502, $[169] = t51) : t51 = $[169], t48 = t51;
|
|
5276
|
+
}
|
|
5277
|
+
const content = t48;
|
|
5278
|
+
let t49;
|
|
5279
|
+
bb3: {
|
|
5280
|
+
if (renderPopover) {
|
|
5281
|
+
const t503 = !expanded;
|
|
5282
|
+
let t51;
|
|
5283
|
+
$[170] !== content || $[171] !== t503 || $[172] !== inputElement || $[173] !== resultsPopoverElement || $[174] !== renderPopover ? (t51 = renderPopover({
|
|
5284
|
+
content,
|
|
5285
|
+
hidden: t503,
|
|
5286
|
+
inputElement,
|
|
5287
|
+
onMouseEnter: handlePopoverMouseEnter,
|
|
5288
|
+
onMouseLeave: handlePopoverMouseLeave
|
|
5289
|
+
}, {
|
|
5290
|
+
current: resultsPopoverElement
|
|
5291
|
+
}), $[170] = content, $[171] = t503, $[172] = inputElement, $[173] = resultsPopoverElement, $[174] = renderPopover, $[175] = t51) : t51 = $[175], t49 = t51;
|
|
5292
|
+
break bb3;
|
|
5293
|
+
}
|
|
5294
|
+
if (filteredOptionsLen === 0) {
|
|
5295
|
+
t49 = null;
|
|
5296
|
+
break bb3;
|
|
5297
|
+
}
|
|
5298
|
+
let t502;
|
|
5299
|
+
$[176] !== content || $[177] !== expanded || $[178] !== radius || $[179] !== inputElement || $[180] !== popover ? (t502 = /* @__PURE__ */ jsx(Popover, { arrow: !1, constrainSize: !0, content, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius, ref: setResultsPopoverElement, referenceElement: inputElement, ...popover }), $[176] = content, $[177] = expanded, $[178] = radius, $[179] = inputElement, $[180] = popover, $[181] = t502) : t502 = $[181], t49 = t502;
|
|
5300
|
+
}
|
|
5301
|
+
const results = t49;
|
|
5302
|
+
let t50;
|
|
5303
|
+
return $[182] !== handleRootBlur || $[183] !== handleRootKeyDown || $[184] !== input || $[185] !== results ? (t50 = /* @__PURE__ */ jsxs(Root$9, { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: setRootElement, children: [
|
|
5154
5304
|
input,
|
|
5155
5305
|
results
|
|
5156
|
-
] });
|
|
5306
|
+
] }), $[182] = handleRootBlur, $[183] = handleRootKeyDown, $[184] = input, $[185] = results, $[186] = t50) : t50 = $[186], t50;
|
|
5157
5307
|
});
|
|
5158
5308
|
InnerAutocomplete.displayName = "ForwardRef(Autocomplete)";
|
|
5159
5309
|
const Autocomplete = InnerAutocomplete, Root$8 = styled.ol`
|
|
@@ -6791,26 +6941,26 @@ const TreeGroup = memo(function(props) {
|
|
|
6791
6941
|
text,
|
|
6792
6942
|
weight,
|
|
6793
6943
|
...restProps
|
|
6794
|
-
} = props,
|
|
6944
|
+
} = props, [rootElement, setRootElement] = useState(null), treeitemRef = useRef(null), tree = useTree(), {
|
|
6795
6945
|
path,
|
|
6796
6946
|
registerItem,
|
|
6797
6947
|
setExpanded,
|
|
6798
6948
|
setFocusedElement
|
|
6799
|
-
} = tree, _id = useId(), id = idProp || _id, itemPath = useMemo(() => path.concat([id || ""]), [id, path]), itemKey = itemPath.join("/"), itemState = tree.state[itemKey], focused = tree.focusedElement ===
|
|
6949
|
+
} = tree, _id = useId(), id = idProp || _id, itemPath = useMemo(() => path.concat([id || ""]), [id, path]), itemKey = itemPath.join("/"), 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, contextValue = useMemo(() => ({
|
|
6800
6950
|
...tree,
|
|
6801
6951
|
level: tree.level + 1,
|
|
6802
6952
|
path: itemPath
|
|
6803
6953
|
}), [itemPath, tree]), handleClick = useCallback((event) => {
|
|
6804
6954
|
onClick && onClick(event);
|
|
6805
6955
|
const target = event.target;
|
|
6806
|
-
target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(
|
|
6807
|
-
}, [expanded, itemKey, onClick, setExpanded, setFocusedElement]), handleKeyDown = useCallback((event_0) => {
|
|
6808
|
-
focused && event_0.key === "Enter" && (treeitemRef.current ||
|
|
6809
|
-
}, [focused]);
|
|
6956
|
+
target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootElement));
|
|
6957
|
+
}, [expanded, itemKey, onClick, rootElement, setExpanded, setFocusedElement]), handleKeyDown = useCallback((event_0) => {
|
|
6958
|
+
focused && event_0.key === "Enter" && (treeitemRef.current || rootElement)?.click();
|
|
6959
|
+
}, [focused, rootElement]);
|
|
6810
6960
|
useEffect(() => {
|
|
6811
|
-
if (
|
|
6812
|
-
return registerItem(
|
|
6813
|
-
}, [expanded, itemPath, registerItem, selected]);
|
|
6961
|
+
if (rootElement)
|
|
6962
|
+
return registerItem(rootElement, itemPath.join("/"), expanded, selected);
|
|
6963
|
+
}, [expanded, itemPath, registerItem, rootElement, selected]);
|
|
6814
6964
|
const content = /* @__PURE__ */ jsxs(Flex, { padding, children: [
|
|
6815
6965
|
/* @__PURE__ */ jsxs(Box, { marginRight: space, style: {
|
|
6816
6966
|
visibility: IconComponent || children ? "visible" : "hidden",
|
|
@@ -6823,10 +6973,10 @@ const TreeGroup = memo(function(props) {
|
|
|
6823
6973
|
] }),
|
|
6824
6974
|
/* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, textOverflow: "ellipsis", weight, children: text }) })
|
|
6825
6975
|
] });
|
|
6826
|
-
return href ? /* @__PURE__ */ jsxs(Root, { "data-selected": selected ? "" : void 0, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...restProps, onClick: handleClick, ref:
|
|
6976
|
+
return href ? /* @__PURE__ */ jsxs(Root, { "data-selected": selected ? "" : void 0, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...restProps, onClick: handleClick, ref: setRootElement, role: "none", children: [
|
|
6827
6977
|
/* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, ref: treeitemRef, role: "treeitem", tabIndex, children: content }),
|
|
6828
6978
|
/* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsx(TreeGroup, { hidden: !expanded, children }) })
|
|
6829
|
-
] }) : /* @__PURE__ */ jsxs(Root, { "data-selected": selected ? "" : void 0, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...restProps, "aria-expanded": expanded, onClick: handleClick, onKeyDown: handleKeyDown, ref:
|
|
6979
|
+
] }) : /* @__PURE__ */ jsxs(Root, { "data-selected": selected ? "" : void 0, "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: [
|
|
6830
6980
|
/* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, as: "div", "data-ui": "TreeItem__box", children: content }),
|
|
6831
6981
|
/* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsx(TreeGroup, { expanded, children }) })
|
|
6832
6982
|
] });
|