@sanity/ui 3.0.0-static.27 → 3.0.0-static.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/README.md +1 -1
  2. package/dist/_chunks-cjs/_visual-editing.cjs +710 -840
  3. package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
  4. package/dist/_chunks-cjs/refractor.cjs +2 -2
  5. package/dist/_chunks-cjs/refractor.cjs.map +1 -1
  6. package/dist/_chunks-es/_visual-editing.js +705 -834
  7. package/dist/_chunks-es/_visual-editing.js.map +1 -1
  8. package/dist/_chunks-es/refractor.js +1 -1
  9. package/dist/css/layers.css +4 -0
  10. package/dist/css/primitives/popover/popover.css +4 -0
  11. package/dist/css.cjs +58 -49
  12. package/dist/css.cjs.map +1 -1
  13. package/dist/css.d.cts +13 -5
  14. package/dist/css.d.ts +13 -5
  15. package/dist/css.js +58 -49
  16. package/dist/css.js.map +1 -1
  17. package/dist/index.cjs +2006 -1824
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.css +1 -0
  20. package/dist/index.d.cts +34 -17
  21. package/dist/index.d.ts +34 -17
  22. package/dist/index.js +2002 -1821
  23. package/dist/index.js.map +1 -1
  24. package/dist/theme.cjs +7 -7
  25. package/dist/theme.cjs.map +1 -1
  26. package/dist/theme.js +7 -7
  27. package/dist/theme.js.map +1 -1
  28. package/exports/_visual-editing.ts +1 -1
  29. package/package.json +10 -15
  30. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
  31. package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
  32. package/src/core/components/autocomplete/autocomplete.tsx +13 -17
  33. package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
  34. package/src/core/components/autocomplete/constants.ts +3 -1
  35. package/src/core/components/autocomplete/types.ts +1 -1
  36. package/src/core/components/breadcrumbs/breadcrumbs.tsx +8 -3
  37. package/src/core/components/dialog/__workshop__/activate.tsx +11 -3
  38. package/src/core/components/dialog/__workshop__/panes.tsx +12 -5
  39. package/src/core/components/dialog/dialog.tsx +12 -6
  40. package/src/core/components/dialog/dialogCard.tsx +89 -54
  41. package/src/core/components/dialog/dialogContext.ts +1 -1
  42. package/src/core/components/dialog/dialogProvider.tsx +1 -1
  43. package/src/core/components/dialog/index.ts +1 -0
  44. package/src/core/components/dialog/isTargetWithinScope.ts +1 -1
  45. package/src/core/components/hotkeys/hotkeys.tsx +3 -2
  46. package/src/core/components/menu/__workshop__/avatarMenu.tsx +12 -6
  47. package/src/core/components/menu/__workshop__/customSelectedState.tsx +1 -5
  48. package/src/core/components/menu/__workshop__/shouldFocus.tsx +1 -2
  49. package/src/core/components/menu/helpers.ts +1 -1
  50. package/src/core/components/menu/menu.tsx +6 -3
  51. package/src/core/components/menu/menuButton.tsx +5 -3
  52. package/src/core/components/menu/menuDivider.tsx +1 -1
  53. package/src/core/components/menu/menuGroup.tsx +8 -4
  54. package/src/core/components/menu/menuItem.tsx +4 -2
  55. package/src/core/components/tab/tab.tsx +2 -2
  56. package/src/core/components/tab/tabList.tsx +2 -2
  57. package/src/core/components/tab/tabPanel.tsx +2 -2
  58. package/src/core/components/toast/toast.tsx +7 -2
  59. package/src/core/components/toast/toastLayer.tsx +3 -2
  60. package/src/core/components/toast/toastProvider.tsx +1 -1
  61. package/src/core/components/tree/tree.tsx +2 -2
  62. package/src/core/components/tree/treeGroup.tsx +2 -2
  63. package/src/core/components/tree/treeItem.tsx +13 -6
  64. package/src/core/components/tree/types.ts +0 -1
  65. package/src/core/components/virtualList/virtualList.tsx +10 -5
  66. package/src/core/helpers/focus.ts +0 -8
  67. package/src/core/hooks/useArrayProp.ts +1 -1
  68. package/src/core/hooks/useElementRect/__workshop__/example.tsx +1 -3
  69. package/src/core/hooks/useElementSize.ts +1 -1
  70. package/src/core/hooks/useResponsiveProp.ts +1 -1
  71. package/src/core/index.ts +83 -7
  72. package/src/core/observers/{elementSizeObserver.ts → elementSize.ts} +1 -1
  73. package/src/core/primitives/_selectable/index.ts +1 -0
  74. package/src/core/primitives/_selectable/selectable.tsx +13 -3
  75. package/src/core/{types/selectable.ts → primitives/_selectable/types.ts} +1 -1
  76. package/src/core/primitives/arrow/arrow.tsx +1 -1
  77. package/src/core/primitives/avatar/avatar.tsx +4 -3
  78. package/src/core/primitives/avatar/avatarCounter.tsx +3 -3
  79. package/src/core/primitives/avatar/avatarStack.tsx +4 -4
  80. package/src/core/primitives/avatar/types.ts +17 -0
  81. package/src/core/primitives/badge/badge.tsx +2 -1
  82. package/src/core/primitives/badge/types.ts +11 -2
  83. package/src/core/primitives/box/__workshop__/responsive.tsx +0 -1
  84. package/src/core/primitives/box/box.tsx +1 -1
  85. package/src/core/primitives/box/index.ts +1 -0
  86. package/src/core/primitives/button/__workshop__/disabled.tsx +37 -51
  87. package/src/core/primitives/button/__workshop__/index.ts +5 -0
  88. package/src/core/primitives/button/__workshop__/textOverflow.tsx +13 -0
  89. package/src/core/primitives/button/button.tsx +15 -14
  90. package/src/core/primitives/button/index.ts +1 -0
  91. package/src/core/primitives/card/__workshop__/listNavigation.tsx +2 -2
  92. package/src/core/primitives/card/card.tsx +1 -1
  93. package/src/core/primitives/card/types.ts +3 -0
  94. package/src/core/primitives/checkbox/__workshop__/tones.tsx +9 -1
  95. package/src/core/primitives/checkbox/checkbox.tsx +3 -4
  96. package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +17 -42
  97. package/src/core/primitives/code/code.tsx +1 -1
  98. package/src/core/primitives/container/container.tsx +1 -1
  99. package/src/core/primitives/flex/flex.tsx +1 -1
  100. package/src/core/primitives/flex/index.ts +1 -0
  101. package/src/core/primitives/grid/grid.tsx +1 -1
  102. package/src/core/primitives/grid/index.ts +1 -0
  103. package/src/core/primitives/heading/heading.tsx +1 -1
  104. package/src/core/primitives/inline/inline.tsx +1 -1
  105. package/src/core/primitives/kbd/kbd.tsx +1 -1
  106. package/src/core/primitives/label/label.tsx +1 -1
  107. package/src/core/primitives/layer/layer.test.tsx +1 -1
  108. package/src/core/primitives/layer/layer.tsx +2 -2
  109. package/src/core/primitives/layer/layerCard.tsx +3 -3
  110. package/src/core/primitives/layer/layerProvider.tsx +2 -1
  111. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +12 -10
  112. package/src/core/primitives/popover/__workshop__/TestStory.tsx +9 -8
  113. package/src/core/primitives/popover/constants.ts +1 -1
  114. package/src/core/primitives/popover/floating-ui/size.ts +1 -1
  115. package/src/core/primitives/popover/popover.tsx +7 -4
  116. package/src/core/primitives/popover/popoverLayer.tsx +2 -1
  117. package/src/core/primitives/popover/types.ts +5 -0
  118. package/src/core/primitives/radio/radio.tsx +2 -2
  119. package/src/core/primitives/select/select.tsx +2 -2
  120. package/src/core/{components → primitives}/skeleton/__workshop__/index.ts +1 -1
  121. package/src/core/{components → primitives}/skeleton/codeSkeleton.tsx +1 -1
  122. package/src/core/{components → primitives}/skeleton/headingSkeleton.tsx +1 -1
  123. package/src/core/{components → primitives}/skeleton/labelSkeleton.tsx +1 -1
  124. package/src/core/{components → primitives}/skeleton/skeleton.tsx +7 -8
  125. package/src/core/{components → primitives}/skeleton/textSkeleton.tsx +1 -1
  126. package/src/core/primitives/spinner/spinner.tsx +1 -1
  127. package/src/core/primitives/srOnly/srOnly.tsx +1 -1
  128. package/src/core/primitives/stack/stack.tsx +1 -1
  129. package/src/core/primitives/switch/switch.tsx +1 -6
  130. package/src/core/primitives/text/__workshop__/colored.tsx +2 -2
  131. package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +17 -42
  132. package/src/core/primitives/text/text.tsx +3 -1
  133. package/src/core/primitives/textArea/__workshop__/plain.tsx +2 -2
  134. package/src/core/primitives/textArea/textArea.tsx +2 -2
  135. package/src/core/primitives/textInput/textInput.tsx +3 -2
  136. package/src/core/primitives/tooltip/constants.ts +1 -1
  137. package/src/core/primitives/tooltip/tooltip.tsx +5 -3
  138. package/src/core/primitives/tooltip/tooltipLayer.tsx +1 -1
  139. package/src/core/primitives/types.ts +8 -10
  140. package/src/core/types/radius.ts +1 -1
  141. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +9 -5
  142. package/src/core/utils/elementQuery/elementQuery.tsx +2 -2
  143. package/src/core/utils/portal/portal.tsx +1 -1
  144. package/src/css/components/dialog/dialog.css.ts +26 -1
  145. package/src/css/components/dialog/dialog.ts +27 -7
  146. package/src/css/components/skeleton/skeleton.ts +3 -1
  147. package/src/css/components/skeleton/types.ts +3 -1
  148. package/src/css/index.ts +75 -5
  149. package/src/css/primitives/_input/input.ts +2 -1
  150. package/src/css/primitives/_input/types.ts +2 -1
  151. package/src/css/primitives/_selectable/_selectable.css.ts +32 -24
  152. package/src/css/primitives/_selectable/selectable.ts +1 -1
  153. package/src/css/primitives/_selectable/types.ts +1 -1
  154. package/src/css/primitives/avatar/avatar.css.ts +8 -4
  155. package/src/css/primitives/avatar/avatar.ts +1 -1
  156. package/src/css/primitives/badge/types.ts +0 -2
  157. package/src/css/primitives/box/box.ts +35 -37
  158. package/src/css/primitives/box/types.ts +34 -36
  159. package/src/css/primitives/button/button.css.ts +4 -0
  160. package/src/css/primitives/button/button.ts +5 -2
  161. package/src/css/primitives/button/types.ts +4 -11
  162. package/src/css/primitives/card/__workshop__/color.tsx +70 -0
  163. package/src/css/primitives/card/__workshop__/index.ts +14 -0
  164. package/src/css/primitives/card/card.css.ts +4 -0
  165. package/src/css/primitives/code/code.ts +3 -1
  166. package/src/css/primitives/code/types.ts +2 -1
  167. package/src/css/primitives/container/container.ts +3 -1
  168. package/src/css/primitives/heading/heading.ts +4 -1
  169. package/src/css/primitives/heading/types.ts +3 -1
  170. package/src/css/primitives/kbd/kbd.ts +1 -1
  171. package/src/css/primitives/kbd/types.ts +1 -1
  172. package/src/css/primitives/label/label.ts +4 -1
  173. package/src/css/primitives/label/types.ts +3 -1
  174. package/src/css/primitives/switch/switch.css.ts +1 -1
  175. package/src/css/primitives/text/text.ts +6 -1
  176. package/src/css/primitives/text/types.ts +5 -2
  177. package/src/theme/v3/defaultFonts.ts +6 -6
  178. package/src/theme/v3/defaultTokens.ts +1 -1
  179. package/bin/sanity-ui.cjs +0 -5
  180. package/dist/ui.css +0 -1
  181. package/src/cli/buildCommand.ts +0 -10
  182. package/src/cli/index.ts +0 -26
  183. package/src/core/components/autocomplete/index.ts +0 -2
  184. package/src/core/components/index.ts +0 -10
  185. package/src/core/helpers/index.ts +0 -5
  186. package/src/core/hooks/index.ts +0 -13
  187. package/src/core/observers/index.ts +0 -2
  188. package/src/core/primitives/index.ts +0 -30
  189. package/src/core/types/avatar.ts +0 -16
  190. package/src/core/types/card.ts +0 -4
  191. package/src/core/types/index.ts +0 -15
  192. package/src/core/types/popover.ts +0 -4
  193. package/src/core/utils/index.ts +0 -4
  194. package/src/css/__theme/index.ts +0 -16
  195. package/src/css/__theme/lib/contract/buildVarContract.ts +0 -78
  196. package/src/css/__theme/lib/contract/index.ts +0 -4
  197. package/src/css/__theme/lib/contract/types.ts +0 -17
  198. package/src/css/__theme/resolveTheme.ts +0 -865
  199. package/src/css/components/index.ts +0 -6
  200. package/src/css/primitives/index.ts +0 -24
  201. package/src/css/props/index.ts +0 -37
  202. package/src/css/utils/srOnly/index.ts +0 -1
  203. /package/src/core/{global.ts → __DEV__.ts} +0 -0
  204. /package/src/core/{types/dialog.ts → components/dialog/types.ts} +0 -0
  205. /package/src/core/observers/{resizeObserver.ts → resize.ts} +0 -0
  206. /package/src/core/{types/badge.ts → primitives/badge/types2.ts} +0 -0
  207. /package/src/core/{types/box.ts → primitives/box/types.ts} +0 -0
  208. /package/src/core/{types/button.ts → primitives/button/types.ts} +0 -0
  209. /package/src/core/{types/flex.ts → primitives/flex/types.ts} +0 -0
  210. /package/src/core/{types/grid.ts → primitives/grid/types.ts} +0 -0
  211. /package/src/core/{components → primitives}/skeleton/__workshop__/delay.tsx +0 -0
  212. /package/src/core/{components → primitives}/skeleton/__workshop__/skeleton.tsx +0 -0
  213. /package/src/core/{components → primitives}/skeleton/index.ts +0 -0
  214. /package/src/core/types/{text.ts → textAlign.ts} +0 -0
  215. /package/src/css/{utils → primitives/srOnly}/index.ts +0 -0
  216. /package/src/css/{utils → primitives}/srOnly/srOnly.css.ts +0 -0
  217. /package/src/css/{utils → primitives}/srOnly/srOnly.ts +0 -0
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: !0 });
3
- var theme = require("@sanity/ui/theme"), _visualEditing = require("./_chunks-cjs/_visual-editing.cjs"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), react = require("react"), reactCompilerRuntime = require("react-compiler-runtime"), css = require("@sanity/ui/css"), framerMotion = require("framer-motion");
3
+ var theme = require("@sanity/ui/theme"), _visualEditing = require("./_chunks-cjs/_visual-editing.cjs"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), react = require("react"), compilerRuntime = require("react/compiler-runtime"), css = require("@sanity/ui/css"), framerMotion = require("framer-motion"), resizeObserver = require("@juggle/resize-observer");
4
4
  const createColorTheme = theme.createColorTheme, hexToRgb = theme.hexToRgb, hslToRgb = theme.hslToRgb, multiply = theme.multiply, parseColor = theme.parseColor, rgbToHex = theme.rgbToHex, rgbToHsl = theme.rgbToHsl, rgba = theme.rgba, screen = theme.screen;
5
5
  function _responsive(media, values, callback) {
6
6
  return (values?.map(callback) || []).map((statement, mediaIndex) => mediaIndex === 0 ? statement : {
@@ -53,2004 +53,2181 @@ function focusLastDescendant(element) {
53
53
  }
54
54
  return !1;
55
55
  }
56
- function _isScrollable(el) {
57
- if (!(el instanceof Element)) return !1;
58
- const style = window.getComputedStyle(el);
59
- return style.overflowX.includes("auto") || style.overflowX.includes("scroll") || style.overflowY.includes("auto") || style.overflowY.includes("scroll");
56
+ function BoundaryElementProvider(props) {
57
+ const $ = compilerRuntime.c(5), {
58
+ children,
59
+ element
60
+ } = props;
61
+ let t0, t1;
62
+ $[0] !== element ? (t1 = {
63
+ version: 0,
64
+ element
65
+ }, $[0] = element, $[1] = t1) : t1 = $[1], t0 = t1;
66
+ const value = t0;
67
+ let t2;
68
+ return $[2] !== children || $[3] !== value ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.BoundaryElementContext.Provider, { value, children }), $[2] = children, $[3] = value, $[4] = t2) : t2 = $[4], t2;
60
69
  }
61
- function useArrayProp(val, defaultVal) {
62
- const $ = reactCompilerRuntime.c(3);
70
+ function AutocompleteOption(props) {
71
+ const $ = compilerRuntime.c(11), {
72
+ children,
73
+ id,
74
+ onSelect,
75
+ selected,
76
+ value
77
+ } = props;
63
78
  let t0;
64
- $[0] !== defaultVal || $[1] !== val ? (t0 = () => [_visualEditing._getArrayProp(val, defaultVal), JSON.stringify(val ?? defaultVal)], $[0] = defaultVal, $[1] = val, $[2] = t0) : t0 = $[2];
65
- const [t1, setCache] = react.useState(t0), [cachedVal, cachedHash] = t1, hash = JSON.stringify(val ?? defaultVal);
66
- return hash !== cachedHash && setCache([_visualEditing._getArrayProp(val, defaultVal), hash]), cachedVal;
79
+ $[0] !== onSelect || $[1] !== value ? (t0 = () => {
80
+ setTimeout(() => {
81
+ onSelect(value);
82
+ }, 0);
83
+ }, $[0] = onSelect, $[1] = value, $[2] = t0) : t0 = $[2];
84
+ const handleClick = t0;
85
+ let t1;
86
+ $[3] !== handleClick ? (t1 = (event) => {
87
+ event.key === "Enter" && !_visualEditing._isEnterToClickElement(event.currentTarget) && handleClick();
88
+ }, $[3] = handleClick, $[4] = t1) : t1 = $[4];
89
+ const handleKeyDown = t1;
90
+ let t2;
91
+ return $[5] !== children || $[6] !== handleClick || $[7] !== handleKeyDown || $[8] !== id || $[9] !== selected ? (t2 = /* @__PURE__ */ jsxRuntime.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;
67
92
  }
68
- function _getElements(element, elementsArg) {
69
- const ret = [element];
70
- for (const el of elementsArg)
71
- Array.isArray(el) ? ret.push(...el) : ret.push(el);
72
- return ret.filter(Boolean);
93
+ function autocompleteReducer(state, msg) {
94
+ return msg.type === "input/change" ? {
95
+ ...state,
96
+ activeValue: null,
97
+ focused: !0,
98
+ query: msg.query
99
+ } : msg.type === "input/focus" ? {
100
+ ...state,
101
+ focused: !0
102
+ } : msg.type === "root/blur" ? {
103
+ ...state,
104
+ focused: !1,
105
+ query: null
106
+ } : msg.type === "root/clear" ? {
107
+ ...state,
108
+ activeValue: null,
109
+ query: null,
110
+ value: null
111
+ } : msg.type === "root/escape" ? {
112
+ ...state,
113
+ focused: !1,
114
+ query: null
115
+ } : msg.type === "root/open" ? {
116
+ ...state,
117
+ query: state.query || msg.query
118
+ } : msg.type === "root/setActiveValue" ? {
119
+ ...state,
120
+ activeValue: msg.value,
121
+ listFocused: msg.listFocused || state.listFocused
122
+ } : msg.type === "root/setListFocused" ? {
123
+ ...state,
124
+ listFocused: msg.listFocused
125
+ } : msg.type === "value/change" ? {
126
+ ...state,
127
+ activeValue: msg.value,
128
+ query: null,
129
+ value: msg.value
130
+ } : state;
73
131
  }
74
- function useClickOutside(listener, t0, boundaryElement) {
75
- const $ = reactCompilerRuntime.c(12), elementsArg = t0 === void 0 ? _visualEditing.EMPTY_ARRAY : t0, [element, setElement] = react.useState(null);
76
- let t1;
77
- $[0] !== element || $[1] !== elementsArg ? (t1 = () => _getElements(element, elementsArg), $[0] = element, $[1] = elementsArg, $[2] = t1) : t1 = $[2];
78
- const [elements, setElements] = react.useState(t1), elementsRef = react.useRef(elements);
79
- let t2, t3;
80
- $[3] !== element || $[4] !== elementsArg ? (t2 = () => {
81
- const prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
82
- if (prevElements.length !== nextElements.length) {
83
- setElements(nextElements), elementsRef.current = nextElements;
84
- return;
85
- }
86
- for (const el of prevElements)
87
- if (!nextElements.includes(el)) {
88
- setElements(nextElements), elementsRef.current = nextElements;
89
- return;
90
- }
91
- for (const el_0 of nextElements)
92
- if (!prevElements.includes(el_0)) {
93
- setElements(nextElements), elementsRef.current = nextElements;
132
+ 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_AUTOCOMPLETE_ELEMENT = "input", DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1;
133
+ function Autocomplete(props) {
134
+ const {
135
+ as = DEFAULT_AUTOCOMPLETE_ELEMENT,
136
+ border = !0,
137
+ customValidity,
138
+ disabled,
139
+ filterOption: filterOptionProp,
140
+ fontSize = 2,
141
+ icon,
142
+ id,
143
+ listBox = _visualEditing.EMPTY_RECORD,
144
+ loading,
145
+ onBlur,
146
+ onChange,
147
+ onFocus,
148
+ onQueryChange,
149
+ onSelect,
150
+ openButton,
151
+ openOnFocus,
152
+ options: optionsProp,
153
+ padding: paddingProp = 3,
154
+ popover = _visualEditing.EMPTY_RECORD,
155
+ prefix,
156
+ radius = 2,
157
+ readOnly,
158
+ ref: forwardedRef,
159
+ relatedElements,
160
+ renderOption: renderOptionProp,
161
+ renderPopover,
162
+ renderValue = DEFAULT_RENDER_VALUE,
163
+ suffix,
164
+ value: valueProp,
165
+ ...rest
166
+ } = props, [state, dispatch] = react.useReducer(autocompleteReducer, {
167
+ activeValue: valueProp || null,
168
+ focused: !1,
169
+ listFocused: !1,
170
+ query: null,
171
+ value: valueProp || null
172
+ }), {
173
+ activeValue,
174
+ focused,
175
+ listFocused,
176
+ query,
177
+ value
178
+ } = state, defaultRenderOption = react.useCallback(({
179
+ value: value_0
180
+ }) => /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Card, { as: "button", padding: paddingProp, radius: 2, tone: "inherit", children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 }) }), [fontSize, paddingProp]), renderOption = typeof renderOptionProp == "function" ? renderOptionProp : defaultRenderOption, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = react.useRef(null), resultsPopoverElementRef = react.useRef(null), inputElementRef = react.useRef(null), listBoxElementRef = react.useRef(null), listFocusedRef = react.useRef(!1), valueRef = react.useRef(value), valuePropRef = react.useRef(valueProp), popoverMouseWithinRef = react.useRef(!1);
181
+ react.useImperativeHandle(forwardedRef, () => inputElementRef.current);
182
+ const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : _visualEditing.EMPTY_ARRAY, padding = _visualEditing.useResponsiveProp(paddingProp), currentOption = react.useMemo(() => value !== null ? options.find((o) => o.value === value) : void 0, [options, value]), filteredOptions = react.useMemo(() => options.filter((option) => query ? filterOption(query, option) : !0), [filterOption, options, query]), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur = react.useCallback((event) => {
183
+ setTimeout(() => {
184
+ if (popoverMouseWithinRef.current)
94
185
  return;
186
+ const elements = (relatedElements || []).concat(rootElementRef.current ? [rootElementRef.current] : [], resultsPopoverElementRef.current ? [resultsPopoverElementRef.current] : []);
187
+ let focusInside = !1;
188
+ if (document.activeElement) {
189
+ for (const e of elements)
190
+ if (e === document.activeElement || e.contains(document.activeElement)) {
191
+ focusInside = !0;
192
+ break;
193
+ }
95
194
  }
96
- }, t3 = [element, elementsArg], $[3] = element, $[4] = elementsArg, $[5] = t2, $[6] = t3) : (t2 = $[5], t3 = $[6]), react.useEffect(t2, t3);
97
- let t4, t5;
98
- return $[7] !== boundaryElement || $[8] !== elements || $[9] !== listener ? (t4 = () => {
99
- if (!listener)
195
+ focusInside === !1 && (dispatch({
196
+ type: "root/blur"
197
+ }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
198
+ }, 0);
199
+ }, [onBlur, onQueryChange, relatedElements]), handleRootFocus = react.useCallback((event_0) => {
200
+ const listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = listBoxElement?.contains(focusedElement) || !1;
201
+ listFocused_0 !== listFocusedRef.current && (listFocusedRef.current = listFocused_0, dispatch({
202
+ type: "root/setListFocused",
203
+ listFocused: listFocused_0
204
+ }));
205
+ }, []), handleOptionSelect = react.useCallback((v) => {
206
+ dispatch({
207
+ type: "value/change",
208
+ value: v
209
+ }), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
210
+ }, [onChange, onSelect, onQueryChange]), handleRootKeyDown = react.useCallback((event_1) => {
211
+ if (event_1.key === "ArrowDown") {
212
+ if (event_1.preventDefault(), !filteredOptionsLen) return;
213
+ const activeOption = filteredOptions.find((o_0) => o_0.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
214
+ nextActiveOption && dispatch({
215
+ type: "root/setActiveValue",
216
+ value: nextActiveOption.value,
217
+ listFocused: !0
218
+ });
100
219
  return;
101
- const handleWindowMouseDown = (evt) => {
102
- const target = evt.target;
103
- if (target instanceof Node && !(boundaryElement && !boundaryElement.contains(target))) {
104
- for (const el_1 of elements)
105
- if (target === el_1 || el_1.contains(target))
106
- return;
107
- listener(evt);
108
- }
109
- };
110
- return window.addEventListener("mousedown", handleWindowMouseDown), () => {
111
- window.removeEventListener("mousedown", handleWindowMouseDown);
112
- };
113
- }, t5 = [boundaryElement, listener, elements], $[7] = boundaryElement, $[8] = elements, $[9] = listener, $[10] = t4, $[11] = t5) : (t4 = $[10], t5 = $[11]), react.useEffect(t4, t5), setElement;
114
- }
115
- function useElementRect(element) {
116
- return _visualEditing.useElementSize(element)?._contentRect || null;
117
- }
118
- function useForwardedRef(ref) {
119
- const $ = reactCompilerRuntime.c(1), innerRef = react.useRef(null);
120
- let t0;
121
- return $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => innerRef.current, $[0] = t0) : t0 = $[0], react.useImperativeHandle(ref, t0), innerRef;
122
- }
123
- const DEFAULT_LABEL_ELEMENT = "div";
124
- function Label(props) {
125
- const $ = reactCompilerRuntime.c(28);
126
- let accent, align, children, className, rest, t0, t1, t2, t3, textOverflowProp;
127
- $[0] !== props ? ({
128
- accent,
129
- align,
130
- as: t0,
131
- children,
132
- className,
133
- muted: t1,
134
- size: t2,
135
- textOverflow: textOverflowProp,
136
- weight: t3,
137
- ...rest
138
- } = props, $[0] = props, $[1] = accent, $[2] = align, $[3] = children, $[4] = className, $[5] = rest, $[6] = t0, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = textOverflowProp) : (accent = $[1], align = $[2], children = $[3], className = $[4], rest = $[5], t0 = $[6], t1 = $[7], t2 = $[8], t3 = $[9], textOverflowProp = $[10]);
139
- const Element2 = t0 === void 0 ? DEFAULT_LABEL_ELEMENT : t0, muted = t1 === void 0 ? !1 : t1, size = t2 === void 0 ? 1 : t2, weight = t3 === void 0 ? "regular" : t3;
140
- let t4;
141
- $[11] !== accent || $[12] !== align || $[13] !== className || $[14] !== muted || $[15] !== size || $[16] !== weight ? (t4 = css.label({
142
- className,
143
- accent,
144
- align,
145
- muted,
146
- size,
147
- weight
148
- }), $[11] = accent, $[12] = align, $[13] = className, $[14] = muted, $[15] = size, $[16] = weight, $[17] = t4) : t4 = $[17];
149
- let t5;
150
- $[18] !== textOverflowProp ? (t5 = css.textOverflow({
151
- textOverflow: textOverflowProp
152
- }), $[18] = textOverflowProp, $[19] = t5) : t5 = $[19];
153
- let t6;
154
- $[20] !== children || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t5, children }), $[20] = children, $[21] = t5, $[22] = t6) : t6 = $[22];
155
- let t7;
156
- return $[23] !== Element2 || $[24] !== rest || $[25] !== t4 || $[26] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "Label", ...rest, className: t4, children: t6 }), $[23] = Element2, $[24] = rest, $[25] = t4, $[26] = t6, $[27] = t7) : t7 = $[27], t7;
157
- }
158
- const DEFAULT_AVATAR_ELEMENT = "span";
159
- function Avatar(props) {
160
- const $ = reactCompilerRuntime.c(51), t0 = props;
161
- let __unstable_hideInnerStroke, animateArrowFrom, arrowPositionProp, className, initials, onImageLoadError, rest, src, t1, t2, t3, t4, title;
162
- $[0] !== t0 ? ({
163
- __unstable_hideInnerStroke,
164
- as: t1,
165
- className,
166
- color: t2,
167
- src,
168
- title,
169
- initials,
170
- onImageLoadError,
171
- arrowPosition: arrowPositionProp,
172
- animateArrowFrom,
173
- status: t3,
174
- size: t4,
175
- ...rest
176
- } = t0, $[0] = t0, $[1] = __unstable_hideInnerStroke, $[2] = animateArrowFrom, $[3] = arrowPositionProp, $[4] = className, $[5] = initials, $[6] = onImageLoadError, $[7] = rest, $[8] = src, $[9] = t1, $[10] = t2, $[11] = t3, $[12] = t4, $[13] = title) : (__unstable_hideInnerStroke = $[1], animateArrowFrom = $[2], arrowPositionProp = $[3], className = $[4], initials = $[5], onImageLoadError = $[6], rest = $[7], src = $[8], t1 = $[9], t2 = $[10], t3 = $[11], t4 = $[12], title = $[13]);
177
- const Element2 = t1 === void 0 ? DEFAULT_AVATAR_ELEMENT : t1, color = t2 === void 0 ? "magenta" : t2, sizeProp = t4 === void 0 ? 1 : t4, size = _visualEditing.useResponsiveProp(sizeProp), [arrowPosition, setArrowPosition] = react.useState(animateArrowFrom || arrowPositionProp || "inside"), [imageError, setImageError] = react.useState(!1);
178
- let t5, t6;
179
- $[14] !== arrowPosition || $[15] !== arrowPositionProp ? (t5 = () => {
180
- if (arrowPosition === arrowPositionProp)
220
+ }
221
+ if (event_1.key === "ArrowUp") {
222
+ if (event_1.preventDefault(), !filteredOptionsLen) return;
223
+ 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];
224
+ nextActiveOption_0 && dispatch({
225
+ type: "root/setActiveValue",
226
+ value: nextActiveOption_0.value,
227
+ listFocused: !0
228
+ });
181
229
  return;
182
- const raf = requestAnimationFrame(() => setArrowPosition(arrowPositionProp));
183
- return () => cancelAnimationFrame(raf);
184
- }, t6 = [arrowPosition, arrowPositionProp], $[14] = arrowPosition, $[15] = arrowPositionProp, $[16] = t5, $[17] = t6) : (t5 = $[16], t6 = $[17]), react.useEffect(t5, t6);
185
- let t7, t8;
186
- $[18] !== src ? (t7 = () => {
187
- src && setImageError(!1);
188
- }, t8 = [src], $[18] = src, $[19] = t7, $[20] = t8) : (t7 = $[19], t8 = $[20]), react.useEffect(t7, t8);
189
- let t9;
190
- $[21] !== onImageLoadError ? (t9 = () => {
191
- setImageError(!0), onImageLoadError && onImageLoadError(new Error("Avatar: the image failed to load"));
192
- }, $[21] = onImageLoadError, $[22] = t9) : t9 = $[22];
193
- const handleImageError = t9;
194
- let t10, t11;
195
- $[23] !== size ? (t11 = Object.values(size).map(_temp$4), $[23] = size, $[24] = t11) : t11 = $[24], t10 = t11;
196
- const initialsSize = t10, t12 = __unstable_hideInnerStroke ? "" : void 0;
197
- let t13;
198
- $[25] !== className || $[26] !== color || $[27] !== sizeProp ? (t13 = css.avatar({
199
- className,
200
- color,
201
- size: sizeProp
202
- }), $[25] = className, $[26] = color, $[27] = sizeProp, $[28] = t13) : t13 = $[28];
203
- const t14 = imageError ? "" : void 0;
204
- let t15;
205
- $[29] === Symbol.for("react.memo_cache_sentinel") ? (t15 = css.avatarArrow(), $[29] = t15) : t15 = $[29];
206
- let t16;
207
- $[30] !== color ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t15, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "11", height: "7", viewBox: "0 0 11 7", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.67948 1.50115L11 7L0 7L4.32052 1.50115C4.92109 0.736796 6.07891 0.736795 6.67948 1.50115Z", fill: color }) }) }), $[30] = color, $[31] = t16) : t16 = $[31];
208
- let t17;
209
- $[32] === Symbol.for("react.memo_cache_sentinel") ? (t17 = css.avatarInitials(), $[32] = t17) : t17 = $[32];
210
- let t18;
211
- $[33] !== initials || $[34] !== initialsSize ? (t18 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { alignItems: "center", as: "span", className: t17, display: "flex", justifyContent: "center", position: "absolute", inset: 0, children: /* @__PURE__ */ jsxRuntime.jsx(Label, { align: "center", as: "span", size: initialsSize, weight: "medium", children: initials }) }), $[33] = initials, $[34] = initialsSize, $[35] = t18) : t18 = $[35];
212
- let t19;
213
- $[36] !== handleImageError || $[37] !== initials || $[38] !== src ? (t19 = src && /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { className: css.avatarImage(), inset: 0, position: "absolute", children: [
214
- /* @__PURE__ */ jsxRuntime.jsx("img", { alt: initials, onError: handleImageError, src }),
215
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: css.avatarImageOutline() })
216
- ] }), $[36] = handleImageError, $[37] = initials, $[38] = src, $[39] = t19) : t19 = $[39];
217
- let t20;
218
- return $[40] !== Element2 || $[41] !== arrowPosition || $[42] !== rest || $[43] !== t12 || $[44] !== t13 || $[45] !== t14 || $[46] !== t16 || $[47] !== t18 || $[48] !== t19 || $[49] !== title ? (t20 = /* @__PURE__ */ jsxRuntime.jsxs(Element2, { "data-hide-inner-stroke": t12, "data-ui": "Avatar", ...rest, "aria-label": title, className: t13, "data-arrow-position": arrowPosition, "data-image-error": t14, title, children: [
219
- t16,
220
- t18,
221
- t19
222
- ] }), $[40] = Element2, $[41] = arrowPosition, $[42] = rest, $[43] = t12, $[44] = t13, $[45] = t14, $[46] = t16, $[47] = t18, $[48] = t19, $[49] = title, $[50] = t20) : t20 = $[50], t20;
230
+ }
231
+ if (event_1.key === "Escape") {
232
+ dispatch({
233
+ type: "root/escape"
234
+ }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
235
+ return;
236
+ }
237
+ const target = event_1.target, listEl = listBoxElementRef.current;
238
+ if ((listEl === target || listEl?.contains(target)) && !AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event_1.key)) {
239
+ inputElementRef.current?.focus();
240
+ return;
241
+ }
242
+ }, [activeValue, filteredOptions, filteredOptionsLen, onQueryChange]), handleInputChange = react.useCallback((event_2) => {
243
+ const nextQuery = event_2.currentTarget.value;
244
+ dispatch({
245
+ type: "input/change",
246
+ query: nextQuery
247
+ }), onQueryChange && onQueryChange(nextQuery);
248
+ }, [onQueryChange]), dispatchOpen = react.useCallback(() => {
249
+ dispatch({
250
+ type: "root/open",
251
+ query: value ? renderValue(value, currentOption) : ""
252
+ });
253
+ }, [currentOption, renderValue, value]), handleInputFocus = react.useCallback((event_3) => {
254
+ focused || (dispatch({
255
+ type: "input/focus"
256
+ }), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
257
+ }, [focused, onFocus, openOnFocus, dispatchOpen]), handlePopoverMouseEnter = react.useCallback(() => {
258
+ popoverMouseWithinRef.current = !0;
259
+ }, []), handlePopoverMouseLeave = react.useCallback(() => {
260
+ popoverMouseWithinRef.current = !1;
261
+ }, []), handleClearButtonClick = react.useCallback(() => {
262
+ dispatch({
263
+ type: "root/clear"
264
+ }), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
265
+ }, [onChange, onQueryChange]), handleClearButtonFocus = react.useCallback(() => {
266
+ dispatch({
267
+ type: "input/focus"
268
+ });
269
+ }, []);
270
+ react.useEffect(() => {
271
+ if (valueProp !== valuePropRef.current) {
272
+ valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
273
+ type: "value/change",
274
+ value: valueProp
275
+ }), valueRef.current = valueProp);
276
+ return;
277
+ }
278
+ valueProp !== valueRef.current && (valueRef.current = valueProp || null, dispatch({
279
+ type: "value/change",
280
+ value: valueProp || null
281
+ }));
282
+ }, [valueProp]), react.useEffect(() => {
283
+ !focused && valueRef.current && dispatch({
284
+ type: "root/setActiveValue",
285
+ value: valueRef.current
286
+ });
287
+ }, [focused]), react.useEffect(() => {
288
+ const listElement = listBoxElementRef.current;
289
+ if (!listElement) return;
290
+ const activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
291
+ if (activeOption_1) {
292
+ const activeIndex_1 = filteredOptions.indexOf(activeOption_1), activeItemElement = listElement.childNodes[activeIndex_1];
293
+ if (activeItemElement) {
294
+ if (_hasFocus(activeItemElement))
295
+ return;
296
+ focusFirstDescendant(activeItemElement);
297
+ }
298
+ }
299
+ }, [activeValue, filteredOptions]);
300
+ const clearButton = react.useMemo(() => {
301
+ if (!loading && !disabled && value)
302
+ return {
303
+ "aria-label": "Clear",
304
+ onFocus: handleClearButtonFocus
305
+ };
306
+ }, [disabled, handleClearButtonFocus, loading, value]), openButtonBoxPadding = react.useMemo(() => Object.fromEntries(Object.entries(padding).map(([key, value_1]) => value_1 === 0 ? [key, 0] : value_1 === 1 ? [key, 1] : value_1 === 2 ? [key, 1] : [key, value_1 - 2])), [padding]), openButtonPadding = react.useMemo(() => Object.values(padding).map((v_0) => Math.max(v_0 - 1, 0)), [padding]), openButtonProps = react.useMemo(() => typeof openButton == "object" ? openButton : _visualEditing.EMPTY_RECORD, [openButton]), handleOpenClick = react.useCallback((event_4) => {
307
+ dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
308
+ }, [openButtonProps, dispatchOpen]), openButtonNode = react.useMemo(() => !disabled && !readOnly && openButton ? /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { "aria-label": "Open", disabled: expanded, display: "block", fontSize, icon: icons.ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, [disabled, expanded, fontSize, handleOpenClick, openButton, openButtonBoxPadding, openButtonPadding, openButtonProps, readOnly]), inputValue = react.useMemo(() => query === null ? value !== null ? renderValue(value, currentOption) : "" : query, [currentOption, query, renderValue, value]), input = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.TextInput, { ...rest, "aria-activedescendant": activeItemId, "aria-autocomplete": "list", "aria-expanded": expanded, "aria-owns": listBoxId, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", as, border, clearButton, customValidity, disabled, fontSize, icon, iconRight: loading && _visualEditing.AnimatedSpinnerIcon, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: inputElementRef, role: "combobox", spellCheck: !1, suffix: suffix || openButtonNode, value: inputValue }), handleListBoxKeyDown = react.useCallback((event_5) => {
309
+ event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
310
+ }, [listFocused]), content2 = react.useMemo(() => filteredOptions.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", gap: 1, id: listBoxId, ref: listBoxElementRef, role: "listbox", children: filteredOptions.map((option_0) => {
311
+ const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
312
+ return /* @__PURE__ */ jsxRuntime.jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: react.cloneElement(renderOption(option_0), {
313
+ disabled: loading,
314
+ selected: active,
315
+ tabIndex: listFocused && active ? 0 : -1
316
+ }) }, option_0.value);
317
+ }) }) }), [activeValue, currentOption, filteredOptions, handleOptionSelect, handleListBoxKeyDown, id, listBox, listBoxId, listFocused, loading, renderOption]), results = react.useMemo(() => renderPopover ? renderPopover({
318
+ content: content2,
319
+ hidden: !expanded,
320
+ inputElement: inputElementRef.current,
321
+ onMouseEnter: handlePopoverMouseEnter,
322
+ onMouseLeave: handlePopoverMouseLeave
323
+ }, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.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: 3, ref: resultsPopoverElementRef, referenceElement: inputElementRef.current, ...popover }), [content2, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, popover, renderPopover]);
324
+ return (
325
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
326
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
327
+ input,
328
+ results
329
+ ] })
330
+ );
223
331
  }
224
- function _temp$4(s) {
225
- return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
332
+ const DEFAULT_BREADCRUMBS_ELEMENT = "nav";
333
+ function Breadcrumbs(props) {
334
+ const {
335
+ as = DEFAULT_BREADCRUMBS_ELEMENT,
336
+ children,
337
+ className,
338
+ expandButton: expandButtonProps,
339
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
340
+ gap: _gapProp,
341
+ gapX = props.gap ?? props.space ?? 2,
342
+ gapY = props.gap ?? props.space ?? 2,
343
+ maxLength,
344
+ separator,
345
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
346
+ space: _spaceProp,
347
+ ...rest
348
+ } = props, [open, setOpen] = react.useState(!1), expandElementRef = react.useRef(null), popoverElementRef = react.useRef(null), collapse = react.useCallback(() => setOpen(!1), []), expand = react.useCallback(() => setOpen(!0), []);
349
+ _visualEditing.useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current]);
350
+ const rawItems = react.useMemo(() => react.Children.toArray(children).filter(react.isValidElement), [children]), items = react.useMemo(() => {
351
+ const len = rawItems.length;
352
+ if (maxLength && len > maxLength) {
353
+ const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
354
+ return [...rawItems.slice(0, beforeLength - 1), /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { constrainSize: !0, content: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ol", gap: gapY, overflow: "auto", children: rawItems.slice(beforeLength - 1, len - afterLength) }), open, padding: 2, placement: "top", portal: !0, ref: popoverElementRef, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { mode: "bleed", padding: 0, text: "\u2026", ...expandButtonProps, onClick: open ? collapse : expand, ref: expandElementRef, selected: open }) }, "button"), ...rawItems.slice(len - afterLength)];
355
+ }
356
+ return rawItems;
357
+ }, [collapse, expand, expandButtonProps, gapY, maxLength, open, rawItems]);
358
+ return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Flex, { as, "data-ui": "Breadcrumbs", ...rest, className: css.breadcrumbs({
359
+ className
360
+ }), gapX, gapY, children: items.map((item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
361
+ itemIndex > 0 && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": !0, as: "li", children: separator || /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted: !0, children: "/" }) }),
362
+ /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { as: "li", children: item })
363
+ ] }, itemIndex)) });
226
364
  }
227
- const DEFAULT_AVATAR_COUNTER_ELEMENT = "div";
228
- function AvatarCounter(props) {
229
- const $ = reactCompilerRuntime.c(19), t0 = props;
230
- let className, count, rest, t1, t2;
365
+ const DEFAULT_CONTAINER_ELEMENT = "div";
366
+ function Container(props) {
367
+ const $ = compilerRuntime.c(12), t0 = props;
368
+ let className, rest, t1, t2;
231
369
  $[0] !== t0 ? ({
232
370
  as: t1,
233
371
  className,
234
- count,
235
- size: t2,
372
+ width: t2,
236
373
  ...rest
237
- } = t0, $[0] = t0, $[1] = className, $[2] = count, $[3] = rest, $[4] = t1, $[5] = t2) : (className = $[1], count = $[2], rest = $[3], t1 = $[4], t2 = $[5]);
238
- const as = t1 === void 0 ? DEFAULT_AVATAR_COUNTER_ELEMENT : t1, size = _visualEditing.useResponsiveProp(t2 === void 0 ? 1 : t2);
239
- let t3, t4;
240
- $[6] !== size ? (t4 = Object.values(size).map(_temp$3), $[6] = size, $[7] = t4) : t4 = $[7], t3 = t4;
241
- const labelSize = t3;
242
- let t5;
243
- $[8] !== className || $[9] !== size ? (t5 = css.avatarCounter({
374
+ } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1, $[4] = t2) : (className = $[1], rest = $[2], t1 = $[3], t2 = $[4]);
375
+ const as = t1 === void 0 ? DEFAULT_CONTAINER_ELEMENT : t1, width = t2 === void 0 ? 2 : t2;
376
+ let t3;
377
+ $[5] !== className || $[6] !== width ? (t3 = css.container({
244
378
  className,
245
- size
246
- }), $[8] = className, $[9] = size, $[10] = t5) : t5 = $[10];
247
- let t6;
248
- $[11] !== count || $[12] !== labelSize ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(Label, { align: "center", as: "span", size: labelSize, weight: "medium", children: count }), $[11] = count, $[12] = labelSize, $[13] = t6) : t6 = $[13];
249
- let t7;
250
- return $[14] !== as || $[15] !== rest || $[16] !== t5 || $[17] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "AvatarCounter", ...rest, alignItems: "center", as, className: t5, display: "flex", flex: "none", justifyContent: "center", paddingX: 2, sizing: "border", children: t6 }), $[14] = as, $[15] = rest, $[16] = t5, $[17] = t6, $[18] = t7) : t7 = $[18], t7;
379
+ width
380
+ }), $[5] = className, $[6] = width, $[7] = t3) : t3 = $[7];
381
+ let t4;
382
+ return $[8] !== as || $[9] !== rest || $[10] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "Container", ...rest, as, className: t3 }), $[8] = as, $[9] = rest, $[10] = t3, $[11] = t4) : t4 = $[11], t4;
251
383
  }
252
- function _temp$3(s) {
253
- return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
384
+ function isTargetWithinScope(boundaryElement, portalElement, target) {
385
+ return !boundaryElement || !portalElement ? !0 : _visualEditing.containsOrEqualsElement(boundaryElement, target) || _visualEditing.containsOrEqualsElement(portalElement, target);
254
386
  }
255
- const DEFAULT_AVATAR_STACK_ELEMENT = "div";
256
- function AvatarStack(props) {
257
- const $ = reactCompilerRuntime.c(20), t0 = props;
258
- let childrenProp, className, rest, t1, t2, t3;
387
+ const DEFAULT_DIALOG_CARD_ELEMENT = "div";
388
+ function DialogCard(props) {
389
+ const $ = compilerRuntime.c(60), t0 = props;
390
+ let autoFocus, children, footer, forwardedContentRef, forwardedRef, header, hideCloseButton, id, onClickOutside, onClose, portalProp, rest, t1;
259
391
  $[0] !== t0 ? ({
392
+ __unstable_autoFocus: autoFocus,
393
+ __unstable_hideCloseButton: hideCloseButton,
260
394
  as: t1,
261
- children: childrenProp,
262
- className,
263
- maxLength: t2,
264
- size: t3,
395
+ children,
396
+ contentRef: forwardedContentRef,
397
+ footer,
398
+ header,
399
+ id,
400
+ onClickOutside,
401
+ onClose,
402
+ portal: portalProp,
403
+ ref: forwardedRef,
265
404
  ...rest
266
- } = t0, $[0] = t0, $[1] = childrenProp, $[2] = className, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = t3) : (childrenProp = $[1], className = $[2], rest = $[3], t1 = $[4], t2 = $[5], t3 = $[6]);
267
- const as = t1 === void 0 ? DEFAULT_AVATAR_STACK_ELEMENT : t1, maxLengthProp = t2 === void 0 ? 4 : t2, sizeProp = t3 === void 0 ? 1 : t3, children = react.Children.toArray(childrenProp).filter(react.isValidElement), maxLength = Math.max(maxLengthProp, 0), size = _visualEditing.useResponsiveProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children, T0 = _visualEditing.Box, t4 = "AvatarStack", t5 = "center";
268
- let t6;
269
- $[7] !== className || $[8] !== size ? (t6 = css.avatarStack({
270
- className,
271
- size
272
- }), $[7] = className, $[8] = size, $[9] = t6) : t6 = $[9];
273
- const t7 = "flex", t8 = "flex-start", t9 = len === 0 && /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: len, size }), t10 = len !== 0 && extraCount > 1 && /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: extraCount, size });
274
- let t11;
275
- $[10] !== size ? (t11 = (child, childIndex) => /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: react.cloneElement(child, {
276
- size
277
- }) }, String(childIndex)), $[10] = size, $[11] = t11) : t11 = $[11];
278
- const t12 = visibleChildren.map(t11);
279
- let t13;
280
- return $[12] !== T0 || $[13] !== as || $[14] !== rest || $[15] !== t10 || $[16] !== t12 || $[17] !== t6 || $[18] !== t9 ? (t13 = /* @__PURE__ */ jsxRuntime.jsxs(T0, { "data-ui": t4, ...rest, alignItems: t5, as, className: t6, display: t7, justifyContent: t8, children: [
281
- t9,
282
- t10,
283
- t12
284
- ] }), $[12] = T0, $[13] = as, $[14] = rest, $[15] = t10, $[16] = t12, $[17] = t6, $[18] = t9, $[19] = t13) : t13 = $[19], t13;
285
- }
286
- const DEFAULT_BADGE_ELEMENT = "span";
287
- function Badge(props) {
288
- const $ = reactCompilerRuntime.c(22), t0 = props;
289
- let children, className, rest, t1, t2, t3, t4, t5;
290
- $[0] !== t0 ? ({
291
- as: t1,
292
- children,
293
- className,
294
- fontSize: t2,
295
- padding: t3,
296
- radius: t4,
297
- tone: t5,
298
- ...rest
299
- } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = t3, $[7] = t4, $[8] = t5) : (children = $[1], className = $[2], rest = $[3], t1 = $[4], t2 = $[5], t3 = $[6], t4 = $[7], t5 = $[8]);
300
- const as = t1 === void 0 ? DEFAULT_BADGE_ELEMENT : t1, fontSize = t2 === void 0 ? 1 : t2, padding = t3 === void 0 ? 1 : t3, radius = t4 === void 0 ? 2 : t4, tone = t5 === void 0 ? "default" : t5;
405
+ } = t0, $[0] = t0, $[1] = autoFocus, $[2] = children, $[3] = footer, $[4] = forwardedContentRef, $[5] = forwardedRef, $[6] = header, $[7] = hideCloseButton, $[8] = id, $[9] = onClickOutside, $[10] = onClose, $[11] = portalProp, $[12] = rest, $[13] = t1) : (autoFocus = $[1], children = $[2], footer = $[3], forwardedContentRef = $[4], forwardedRef = $[5], header = $[6], hideCloseButton = $[7], id = $[8], onClickOutside = $[9], onClose = $[10], portalProp = $[11], rest = $[12], t1 = $[13]);
406
+ const as = t1 === void 0 ? DEFAULT_DIALOG_CARD_ELEMENT : t1, portal = _visualEditing.usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = _visualEditing.useBoundaryElement().element, ref = react.useRef(null), contentRef = react.useRef(null), layer = _visualEditing.useLayer(), {
407
+ isTopLayer
408
+ } = layer, labelId = `${id}_label`, showCloseButton = !!onClose && hideCloseButton === !1, showHeader = !!header || showCloseButton, [scrollTop, setScrollTop] = react.useState(0);
409
+ let t2;
410
+ $[14] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[14] = t2) : t2 = $[14], react.useImperativeHandle(forwardedRef, t2);
411
+ let t3;
412
+ $[15] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => contentRef.current, $[15] = t3) : t3 = $[15], react.useImperativeHandle(forwardedContentRef, t3);
413
+ let t4, t5;
414
+ $[16] !== autoFocus ? (t4 = () => {
415
+ autoFocus && ref.current && focusFirstDescendant(ref.current);
416
+ }, t5 = [autoFocus, ref], $[16] = autoFocus, $[17] = t4, $[18] = t5) : (t4 = $[17], t5 = $[18]), react.useEffect(t4, t5);
301
417
  let t6;
302
- $[9] !== className || $[10] !== tone ? (t6 = css.badge({
303
- className,
304
- tone
305
- }), $[9] = className, $[10] = tone, $[11] = t6) : t6 = $[11];
418
+ $[19] !== boundaryElement || $[20] !== isTopLayer || $[21] !== onClose || $[22] !== portalElement ? (t6 = (event) => {
419
+ if (!isTopLayer || !onClose)
420
+ return;
421
+ const target = document.activeElement;
422
+ target && !isTargetWithinScope(boundaryElement, portalElement, target) || event.key === "Escape" && (event.preventDefault(), event.stopPropagation(), onClose());
423
+ }, $[19] = boundaryElement, $[20] = isTopLayer, $[21] = onClose, $[22] = portalElement, $[23] = t6) : t6 = $[23], _visualEditing.useGlobalKeyDown(t6);
306
424
  let t7;
307
- $[12] !== children || $[13] !== fontSize ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, children }), $[12] = children, $[13] = fontSize, $[14] = t7) : t7 = $[14];
425
+ $[24] !== boundaryElement || $[25] !== isTopLayer || $[26] !== onClickOutside || $[27] !== portalElement ? (t7 = isTopLayer && onClickOutside && ((event_0) => {
426
+ const target_0 = event_0.target;
427
+ target_0 && !isTargetWithinScope(boundaryElement, portalElement, target_0) || onClickOutside();
428
+ }), $[24] = boundaryElement, $[25] = isTopLayer, $[26] = onClickOutside, $[27] = portalElement, $[28] = t7) : t7 = $[28];
308
429
  let t8;
309
- return $[15] !== as || $[16] !== padding || $[17] !== radius || $[18] !== rest || $[19] !== t6 || $[20] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "Badge", ...rest, as, className: t6, display: "flex", maxWidth: "fill", padding, radius, width: "min", children: t7 }), $[15] = as, $[16] = padding, $[17] = radius, $[18] = rest, $[19] = t6, $[20] = t7, $[21] = t8) : t8 = $[21], t8;
310
- }
311
- const DEFAULT_CHECKBOX_ELEMENT = "input";
312
- function Checkbox(props) {
313
- const $ = reactCompilerRuntime.c(30), t0 = props;
314
- let checked, className, customValidity, disabled, forwardedRef, indeterminate, readOnly, rest, style, t1;
315
- $[0] !== t0 ? ({
316
- as: t1,
317
- checked,
318
- className,
319
- disabled,
320
- indeterminate,
321
- customValidity,
322
- readOnly,
323
- ref: forwardedRef,
324
- style,
325
- ...rest
326
- } = t0, $[0] = t0, $[1] = checked, $[2] = className, $[3] = customValidity, $[4] = disabled, $[5] = forwardedRef, $[6] = indeterminate, $[7] = readOnly, $[8] = rest, $[9] = style, $[10] = t1) : (checked = $[1], className = $[2], customValidity = $[3], disabled = $[4], forwardedRef = $[5], indeterminate = $[6], readOnly = $[7], rest = $[8], style = $[9], t1 = $[10]);
327
- const Element2 = t1 === void 0 ? DEFAULT_CHECKBOX_ELEMENT : t1, ref = react.useRef(null);
328
- let t2;
329
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[11] = t2) : t2 = $[11], react.useImperativeHandle(forwardedRef, t2);
330
- let t3, t4;
331
- $[12] !== indeterminate ? (t3 = () => {
332
- ref.current && (ref.current.indeterminate = indeterminate || !1);
333
- }, t4 = [indeterminate], $[12] = indeterminate, $[13] = t3, $[14] = t4) : (t3 = $[13], t4 = $[14]), react.useEffect(t3, t4), _visualEditing.useCustomValidity(ref, customValidity);
334
- let t5;
335
- $[15] !== className ? (t5 = css.checkbox({
336
- className
337
- }), $[15] = className, $[16] = t5) : t5 = $[16];
338
- let t6;
339
- $[17] === Symbol.for("react.memo_cache_sentinel") ? (t6 = css.checkboxInput(), $[17] = t6) : t6 = $[17];
340
- const t7 = customValidity ? "" : void 0, t8 = disabled || readOnly;
341
- let t9;
342
- $[18] !== Element2 || $[19] !== checked || $[20] !== readOnly || $[21] !== rest || $[22] !== t7 || $[23] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, checked, className: t6, "data-invalid": t7, disabled: t8, type: "checkbox", readOnly, ref }), $[18] = Element2, $[19] = checked, $[20] = readOnly, $[21] = rest, $[22] = t7, $[23] = t8, $[24] = t9) : t9 = $[24];
343
- let t10;
344
- $[25] === Symbol.for("react.memo_cache_sentinel") ? (t10 = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: css.checkboxPresentation(), children: [
345
- /* @__PURE__ */ jsxRuntime.jsx(icons.CheckmarkIcon, {}),
346
- /* @__PURE__ */ jsxRuntime.jsx(icons.RemoveIcon, {})
347
- ] }), $[25] = t10) : t10 = $[25];
430
+ $[29] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => [ref.current], $[29] = t8) : t8 = $[29], _visualEditing.useClickOutsideEvent(t7, t8);
431
+ let t10, t9;
432
+ $[30] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
433
+ const el = contentRef.current;
434
+ if (!el)
435
+ return;
436
+ const handleScroll = () => {
437
+ setScrollTop(el.scrollTop);
438
+ };
439
+ return el.addEventListener("scroll", handleScroll, {
440
+ passive: !0
441
+ }), () => {
442
+ el.removeEventListener("scroll", handleScroll);
443
+ };
444
+ }, t10 = [], $[30] = t10, $[31] = t9) : (t10 = $[30], t9 = $[31]), react.useEffect(t9, t10);
348
445
  let t11;
349
- return $[26] !== style || $[27] !== t5 || $[28] !== t9 ? (t11 = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: t5, "data-ui": "Checkbox", style, children: [
350
- t9,
351
- t10
352
- ] }), $[26] = style, $[27] = t5, $[28] = t9, $[29] = t11) : t11 = $[29], t11;
446
+ $[32] === Symbol.for("react.memo_cache_sentinel") ? (t11 = css.dialogCard(), $[32] = t11) : t11 = $[32];
447
+ let t12;
448
+ $[33] !== header || $[34] !== labelId || $[35] !== onClose || $[36] !== showCloseButton || $[37] !== showHeader ? (t12 = showHeader && /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { align: "flex-start", className: css.dialogHeader(), padding: 3, position: "relative", children: [
449
+ /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, padding: 2, children: header && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { id: labelId, size: 1, weight: "semibold", children: header }) }),
450
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: "none", children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { "aria-label": "Close dialog", disabled: !onClose, icon: icons.CloseIcon, mode: "bleed", onClick: onClose, padding: 2 }) })
451
+ ] }), $[33] = header, $[34] = labelId, $[35] = onClose, $[36] = showCloseButton, $[37] = showHeader, $[38] = t12) : t12 = $[38];
452
+ let t13;
453
+ $[39] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css.dialogContent(), $[39] = t13) : t13 = $[39];
454
+ let t14;
455
+ $[40] !== scrollTop || $[41] !== showHeader ? (t14 = showHeader && /* @__PURE__ */ jsxRuntime.jsx("div", { className: css.dialogScrollerShadowTop(), style: {
456
+ opacity: Math.min(scrollTop, 32) / 32
457
+ } }), $[40] = scrollTop, $[41] = showHeader, $[42] = t14) : t14 = $[42];
458
+ let t15;
459
+ $[43] === Symbol.for("react.memo_cache_sentinel") ? (t15 = css.dialogScroller(), $[43] = t15) : t15 = $[43];
460
+ let t16;
461
+ $[44] !== children ? (t16 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { className: t15, overflow: "auto", ref: contentRef, children }), $[44] = children, $[45] = t16) : t16 = $[45];
462
+ let t17;
463
+ $[46] !== footer ? (t17 = footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: css.dialogScrollerShadowBottom() }), $[46] = footer, $[47] = t17) : t17 = $[47];
464
+ let t18;
465
+ $[48] !== t14 || $[49] !== t16 || $[50] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { className: t13, flex: 1, position: "relative", tabIndex: -1, children: [
466
+ t14,
467
+ t16,
468
+ t17
469
+ ] }), $[48] = t14, $[49] = t16, $[50] = t17, $[51] = t18) : t18 = $[51];
470
+ let t19;
471
+ $[52] !== footer ? (t19 = footer && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { className: css.dialogFooter(), position: "relative", children: footer }), $[52] = footer, $[53] = t19) : t19 = $[53];
472
+ let t20;
473
+ return $[54] !== as || $[55] !== rest || $[56] !== t12 || $[57] !== t18 || $[58] !== t19 ? (t20 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Card, { ...rest, as, className: t11, display: "flex", flexDirection: "column", ref, children: [
474
+ t12,
475
+ t18,
476
+ t19
477
+ ] }), $[54] = as, $[55] = rest, $[56] = t12, $[57] = t18, $[58] = t19, $[59] = t20) : t20 = $[59], t20;
353
478
  }
354
- const DEFAULT_CONTAINER_ELEMENT = "div";
355
- function Container(props) {
356
- const $ = reactCompilerRuntime.c(12), t0 = props;
357
- let className, rest, t1, t2;
358
- $[0] !== t0 ? ({
359
- as: t1,
360
- className,
361
- width: t2,
362
- ...rest
363
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1, $[4] = t2) : (className = $[1], rest = $[2], t1 = $[3], t2 = $[4]);
364
- const as = t1 === void 0 ? DEFAULT_CONTAINER_ELEMENT : t1, width = t2 === void 0 ? 2 : t2;
365
- let t3;
366
- $[5] !== className || $[6] !== width ? (t3 = css.container({
367
- className,
368
- width
369
- }), $[5] = className, $[6] = width, $[7] = t3) : t3 = $[7];
370
- let t4;
371
- return $[8] !== as || $[9] !== rest || $[10] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "Container", ...rest, as, className: t3 }), $[8] = as, $[9] = rest, $[10] = t3, $[11] = t4) : t4 = $[11], t4;
479
+ const DialogContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/dialog", {
480
+ version: 0
481
+ });
482
+ function useDialog() {
483
+ return react.useContext(DialogContext);
372
484
  }
373
- const DEFAULT_HEADING_ELEMENT = "div";
374
- function Heading(props) {
375
- const $ = reactCompilerRuntime.c(30), t0 = props;
376
- let align, children, className, flex, rest, t1, t2, t3, t4, t5, textOverflowProp;
485
+ const DEFAULT_DIALOG_ELEMENT = "div";
486
+ function Dialog(props) {
487
+ const $ = compilerRuntime.c(69), context = useDialog(), t0 = props;
488
+ let _positionProp, _zOffsetProp, children, className, contentRef, footer, header, id, onActivate, onClickOutside, onClose, onFocus, portalProp, rest, scheme, t1, t2, t3, t4, t5, t6, t7, tone;
377
489
  $[0] !== t0 ? ({
378
- accent: t1,
379
- align,
380
- as: t2,
490
+ __unstable_autoFocus: t1,
491
+ __unstable_hideCloseButton: t2,
492
+ animate: t3,
493
+ cardRadius: t4,
381
494
  children,
382
495
  className,
383
- flex,
384
- muted: t3,
385
- size: t4,
386
- textOverflow: textOverflowProp,
387
- weight: t5,
496
+ contentRef,
497
+ footer,
498
+ header,
499
+ id,
500
+ onActivate,
501
+ onClickOutside,
502
+ onClose,
503
+ onFocus,
504
+ padding: t5,
505
+ portal: portalProp,
506
+ position: _positionProp,
507
+ scheme,
508
+ shadow: t6,
509
+ width: t7,
510
+ zOffset: _zOffsetProp,
511
+ tone,
388
512
  ...rest
389
- } = t0, $[0] = t0, $[1] = align, $[2] = children, $[3] = className, $[4] = flex, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3, $[9] = t4, $[10] = t5, $[11] = textOverflowProp) : (align = $[1], children = $[2], className = $[3], flex = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8], t4 = $[9], t5 = $[10], textOverflowProp = $[11]);
390
- const accent = t1 === void 0 ? !1 : t1, Element2 = t2 === void 0 ? DEFAULT_HEADING_ELEMENT : t2, muted = t3 === void 0 ? !1 : t3, size = t4 === void 0 ? 2 : t4, weight = t5 === void 0 ? "regular" : t5;
391
- let t6;
392
- $[12] !== accent || $[13] !== align || $[14] !== className || $[15] !== flex || $[16] !== muted || $[17] !== size || $[18] !== weight ? (t6 = css.heading({
393
- className,
394
- accent,
395
- align,
396
- flex,
397
- muted,
398
- size,
399
- weight
400
- }), $[12] = accent, $[13] = align, $[14] = className, $[15] = flex, $[16] = muted, $[17] = size, $[18] = weight, $[19] = t6) : t6 = $[19];
401
- let t7;
402
- $[20] !== textOverflowProp ? (t7 = css.textOverflow({
403
- textOverflow: textOverflowProp
404
- }), $[20] = textOverflowProp, $[21] = t7) : t7 = $[21];
513
+ } = t0, $[0] = t0, $[1] = _positionProp, $[2] = _zOffsetProp, $[3] = children, $[4] = className, $[5] = contentRef, $[6] = footer, $[7] = header, $[8] = id, $[9] = onActivate, $[10] = onClickOutside, $[11] = onClose, $[12] = onFocus, $[13] = portalProp, $[14] = rest, $[15] = scheme, $[16] = t1, $[17] = t2, $[18] = t3, $[19] = t4, $[20] = t5, $[21] = t6, $[22] = t7, $[23] = tone) : (_positionProp = $[1], _zOffsetProp = $[2], children = $[3], className = $[4], contentRef = $[5], footer = $[6], header = $[7], id = $[8], onActivate = $[9], onClickOutside = $[10], onClose = $[11], onFocus = $[12], portalProp = $[13], rest = $[14], scheme = $[15], t1 = $[16], t2 = $[17], t3 = $[18], t4 = $[19], t5 = $[20], t6 = $[21], t7 = $[22], tone = $[23]);
514
+ const autoFocus = t1 === void 0 ? !0 : t1, hideCloseButton = t2 === void 0 ? !1 : t2, _animate = t3 === void 0 ? !1 : t3, cardRadiusProp = t4 === void 0 ? 4 : t4, padding = t5 === void 0 ? 3 : t5, cardShadow = t6 === void 0 ? 4 : t6, width = t7 === void 0 ? 0 : t7, positionProp = _positionProp ?? context.position ?? "fixed", zOffsetProp = _zOffsetProp ?? context.zOffset ?? _visualEditing.Z_OFFSETS.dialog, animate = _visualEditing.usePrefersReducedMotion() ? !1 : _animate, portal = _visualEditing.usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = _visualEditing.useBoundaryElement().element, cardRadius = _visualEditing.useResponsiveProp(cardRadiusProp), position = _visualEditing.useResponsiveProp(positionProp), zOffset = _visualEditing.useResponsiveProp(zOffsetProp), preDivRef = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null);
405
515
  let t8;
406
- $[22] !== children || $[23] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t7, children }), $[22] = children, $[23] = t7, $[24] = t8) : t8 = $[24];
516
+ $[24] !== onFocus ? (t8 = (event) => {
517
+ onFocus?.(event);
518
+ const target = event.target, cardElement = cardRef.current;
519
+ if (cardElement && target === preDivRef.current) {
520
+ focusLastDescendant(cardElement);
521
+ return;
522
+ }
523
+ if (cardElement && target === postDivRef.current) {
524
+ focusFirstDescendant(cardElement);
525
+ return;
526
+ }
527
+ _visualEditing.isHTMLElement(event.target) && (focusedElementRef.current = event.target);
528
+ }, $[24] = onFocus, $[25] = t8) : t8 = $[25];
529
+ const handleFocus = t8, labelId = `${id}_label`, rootClickTimeoutRef = react.useRef(void 0);
407
530
  let t9;
408
- return $[25] !== Element2 || $[26] !== rest || $[27] !== t6 || $[28] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "Heading", ...rest, className: t6, children: t8 }), $[25] = Element2, $[26] = rest, $[27] = t6, $[28] = t8, $[29] = t9) : t9 = $[29], t9;
409
- }
410
- const DEFAULT_INLINE_ELEMENT = "div";
411
- function Inline(props) {
412
- const $ = reactCompilerRuntime.c(11), t0 = props;
413
- let children, gap, rest, space, t1;
414
- $[0] !== t0 ? ({
415
- as: t1,
416
- children,
417
- gap,
418
- space,
419
- ...rest
420
- } = t0, $[0] = t0, $[1] = children, $[2] = gap, $[3] = rest, $[4] = space, $[5] = t1) : (children = $[1], gap = $[2], rest = $[3], space = $[4], t1 = $[5]);
421
- const as = t1 === void 0 ? DEFAULT_INLINE_ELEMENT : t1, t2 = gap ?? space;
422
- let t3;
423
- return $[6] !== as || $[7] !== children || $[8] !== rest || $[9] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "Inline", ...rest, alignItems: "center", as, display: "flex", gap: t2, flexWrap: "wrap", children }), $[6] = as, $[7] = children, $[8] = rest, $[9] = t2, $[10] = t3) : t3 = $[10], t3;
531
+ $[26] !== boundaryElement || $[27] !== portalElement ? (t9 = () => {
532
+ rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
533
+ const activeElement = document.activeElement;
534
+ if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
535
+ const target_0 = focusedElementRef.current;
536
+ if (!target_0 || !document.body.contains(target_0)) {
537
+ const cardElement_0 = cardRef.current;
538
+ cardElement_0 && focusFirstDescendant(cardElement_0);
539
+ return;
540
+ }
541
+ target_0.focus();
542
+ }
543
+ }, 0);
544
+ }, $[26] = boundaryElement, $[27] = portalElement, $[28] = t9) : t9 = $[28];
545
+ const handleRootClick = t9;
546
+ let t10;
547
+ $[29] !== className ? (t10 = css.dialog({
548
+ className
549
+ }), $[29] = className, $[30] = t10) : t10 = $[30];
550
+ const t11 = animate ? "" : void 0;
551
+ let t12;
552
+ $[31] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: preDivRef, tabIndex: 0 }), $[31] = t12) : t12 = $[31];
553
+ let t13;
554
+ $[32] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css.dialogContainer(), $[32] = t13) : t13 = $[32];
555
+ let t14;
556
+ $[33] !== autoFocus || $[34] !== cardRadius || $[35] !== cardShadow || $[36] !== children || $[37] !== contentRef || $[38] !== footer || $[39] !== header || $[40] !== hideCloseButton || $[41] !== id || $[42] !== onClickOutside || $[43] !== onClose || $[44] !== portalProp || $[45] !== scheme || $[46] !== tone || $[47] !== width ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(DialogCard, { __unstable_autoFocus: autoFocus, __unstable_hideCloseButton: hideCloseButton, contentRef, footer, header, id, onClickOutside, onClose, portal: portalProp, radius: cardRadius, ref: cardRef, scheme, shadow: cardShadow, tone, width, children }), $[33] = autoFocus, $[34] = cardRadius, $[35] = cardShadow, $[36] = children, $[37] = contentRef, $[38] = footer, $[39] = header, $[40] = hideCloseButton, $[41] = id, $[42] = onClickOutside, $[43] = onClose, $[44] = portalProp, $[45] = scheme, $[46] = tone, $[47] = width, $[48] = t14) : t14 = $[48];
557
+ let t15;
558
+ $[49] !== t14 || $[50] !== width ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(Container, { alignItems: "center", className: t13, "data-ui": "DialogCard", flexDirection: "column", display: "flex", justifyContent: "center", width, children: t14 }), $[49] = t14, $[50] = width, $[51] = t15) : t15 = $[51];
559
+ let t16;
560
+ $[52] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: postDivRef, tabIndex: 0 }), $[52] = t16) : t16 = $[52];
561
+ let t17;
562
+ $[53] !== handleFocus || $[54] !== handleRootClick || $[55] !== id || $[56] !== labelId || $[57] !== onActivate || $[58] !== padding || $[59] !== position || $[60] !== rest || $[61] !== t10 || $[62] !== t11 || $[63] !== t15 || $[64] !== zOffset ? (t17 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Layer, { ...rest, "aria-labelledby": labelId, "aria-modal": !0, className: t10, "data-animate": t11, "data-ui": "Dialog", display: "flex", id, onActivate, onClick: handleRootClick, onFocus: handleFocus, padding, position, role: "dialog", zOffset, children: [
563
+ t12,
564
+ t15,
565
+ t16
566
+ ] }), $[53] = handleFocus, $[54] = handleRootClick, $[55] = id, $[56] = labelId, $[57] = onActivate, $[58] = padding, $[59] = position, $[60] = rest, $[61] = t10, $[62] = t11, $[63] = t15, $[64] = zOffset, $[65] = t17) : t17 = $[65];
567
+ let t18;
568
+ return $[66] !== portalProp || $[67] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Portal, { __unstable_name: portalProp, children: t17 }), $[66] = portalProp, $[67] = t17, $[68] = t18) : t18 = $[68], t18;
424
569
  }
425
- function BoundaryElementProvider(props) {
426
- const $ = reactCompilerRuntime.c(5), {
570
+ function DialogProvider(props) {
571
+ const $ = compilerRuntime.c(6), {
427
572
  children,
428
- element
573
+ position,
574
+ zOffset
429
575
  } = props;
430
576
  let t0, t1;
431
- $[0] !== element ? (t1 = {
577
+ $[0] !== position || $[1] !== zOffset ? (t1 = {
432
578
  version: 0,
433
- element
434
- }, $[0] = element, $[1] = t1) : t1 = $[1], t0 = t1;
435
- const value = t0;
579
+ position,
580
+ zOffset
581
+ }, $[0] = position, $[1] = zOffset, $[2] = t1) : t1 = $[2], t0 = t1;
582
+ const contextValue = t0;
436
583
  let t2;
437
- return $[2] !== children || $[3] !== value ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.BoundaryElementContext.Provider, { value, children }), $[2] = children, $[3] = value, $[4] = t2) : t2 = $[4], t2;
584
+ return $[3] !== children || $[4] !== contextValue ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: contextValue, children }), $[3] = children, $[4] = contextValue, $[5] = t2) : t2 = $[5], t2;
438
585
  }
439
- class ErrorBoundary extends react.Component {
440
- state = {
441
- error: null
442
- };
443
- static displayName = "ErrorBoundary";
444
- static getDerivedStateFromError(error) {
445
- return {
446
- error
447
- };
448
- }
449
- componentDidCatch(error, info) {
450
- this.props.onCatch({
451
- error,
452
- info
453
- });
454
- }
455
- render() {
456
- const {
457
- error
458
- } = this.state;
459
- if (error) {
460
- const message = typeof error?.message == "string" ? error.message : "Error";
461
- return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Code, { children: message });
462
- }
463
- return this.props.children;
464
- }
465
- }
466
- const DEFAULT_RADIO_ELEMENT = "input";
467
- function Radio(props) {
468
- const $ = reactCompilerRuntime.c(25), t0 = props;
469
- let className, customValidity, disabled, forwardedRef, readOnly, rest, style, t1;
470
- $[0] !== t0 ? ({
471
- as: t1,
472
- className,
473
- disabled,
474
- style,
475
- customValidity,
476
- readOnly,
477
- ref: forwardedRef,
478
- ...rest
479
- } = t0, $[0] = t0, $[1] = className, $[2] = customValidity, $[3] = disabled, $[4] = forwardedRef, $[5] = readOnly, $[6] = rest, $[7] = style, $[8] = t1) : (className = $[1], customValidity = $[2], disabled = $[3], forwardedRef = $[4], readOnly = $[5], rest = $[6], style = $[7], t1 = $[8]);
480
- const Element2 = t1 === void 0 ? DEFAULT_RADIO_ELEMENT : t1, ref = react.useRef(null);
586
+ function MenuButton(props) {
587
+ const $ = compilerRuntime.c(63), {
588
+ __unstable_disableRestoreFocusOnClose: t0,
589
+ boundaryElement: deprecated_boundaryElement,
590
+ button: buttonProp,
591
+ id,
592
+ menu: menuProp,
593
+ onClose,
594
+ onOpen,
595
+ placement: deprecated_placement,
596
+ popoverScheme: deprecated_popoverScheme,
597
+ portal: t1,
598
+ popover,
599
+ popoverRadius: deprecated_popoverRadius,
600
+ preventOverflow: deprecated_preventOverflow,
601
+ ref: forwardedRef
602
+ } = props, disableRestoreFocusOnClose = t0 === void 0 ? !1 : t0, deprecated_portal = t1 === void 0 ? !0 : t1, [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), [buttonElement, setButtonElement] = react.useState(null);
481
603
  let t2;
482
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[9] = t2) : t2 = $[9], react.useImperativeHandle(forwardedRef, t2), _visualEditing.useCustomValidity(ref, customValidity);
483
- let t3;
484
- $[10] !== className ? (t3 = css.radio({
485
- className
486
- }), $[10] = className, $[11] = t3) : t3 = $[11];
487
- let t4;
488
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t4 = css.radioInput(), $[12] = t4) : t4 = $[12];
489
- const t5 = customValidity ? "" : void 0, t6 = !disabled && readOnly ? "" : void 0, t7 = disabled || readOnly;
490
- let t8;
491
- $[13] !== Element2 || $[14] !== readOnly || $[15] !== rest || $[16] !== t5 || $[17] !== t6 || $[18] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t4, "data-invalid": t5, "data-read-only": t6, disabled: t7, readOnly, ref, type: "radio" }), $[13] = Element2, $[14] = readOnly, $[15] = rest, $[16] = t5, $[17] = t6, $[18] = t7, $[19] = t8) : t8 = $[19];
492
- let t9;
493
- $[20] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: css.radioPresentation() }), $[20] = t9) : t9 = $[20];
494
- let t10;
495
- return $[21] !== style || $[22] !== t3 || $[23] !== t8 ? (t10 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t3, "data-ui": "Radio", style, children: [
496
- t8,
497
- t9
498
- ] }), $[21] = style, $[22] = t3, $[23] = t8, $[24] = t10) : t10 = $[24], t10;
499
- }
500
- const DEFAULT_SELECT_ELEMENT = "select";
501
- function Select(props) {
502
- const $ = reactCompilerRuntime.c(38), t0 = props;
503
- let children, customValidity, disabled, forwardedRef, gap, readOnly, rest, t1, t2, t3, t4, t5, t6;
504
- $[0] !== t0 ? ({
505
- as: t1,
506
- border: t2,
507
- children,
508
- customValidity,
509
- disabled,
510
- fontSize: t3,
511
- gap,
512
- padding: t4,
513
- radius: t5,
514
- readOnly,
515
- ref: forwardedRef,
516
- space: t6,
517
- ...rest
518
- } = t0, $[0] = t0, $[1] = children, $[2] = customValidity, $[3] = disabled, $[4] = forwardedRef, $[5] = gap, $[6] = readOnly, $[7] = rest, $[8] = t1, $[9] = t2, $[10] = t3, $[11] = t4, $[12] = t5, $[13] = t6) : (children = $[1], customValidity = $[2], disabled = $[3], forwardedRef = $[4], gap = $[5], readOnly = $[6], rest = $[7], t1 = $[8], t2 = $[9], t3 = $[10], t4 = $[11], t5 = $[12], t6 = $[13]);
519
- const Element2 = t1 === void 0 ? DEFAULT_SELECT_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, fontSize = t3 === void 0 ? 2 : t3, padding = t4 === void 0 ? 3 : t4, radius = t5 === void 0 ? 1 : t5, space = t6 === void 0 ? 2 : t6, ref = react.useRef(null);
520
- let t7;
521
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[14] = t7) : t7 = $[14], react.useImperativeHandle(forwardedRef, t7), _visualEditing.useCustomValidity(ref, customValidity);
522
- const t8 = gap ?? space;
604
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[0] = t2) : t2 = $[0];
605
+ const [menuElements, setChildMenuElements] = react.useState(t2), openRef = react.useRef(open);
606
+ let t3, t4;
607
+ $[1] !== onOpen || $[2] !== open ? (t3 = () => {
608
+ onOpen && open && !openRef.current && onOpen();
609
+ }, t4 = [onOpen, open], $[1] = onOpen, $[2] = open, $[3] = t3, $[4] = t4) : (t3 = $[3], t4 = $[4]), react.useEffect(t3, t4);
610
+ let t5, t6;
611
+ $[5] !== onClose || $[6] !== open ? (t5 = () => {
612
+ onClose && !open && openRef.current && onClose();
613
+ }, t6 = [onClose, open], $[5] = onClose, $[6] = open, $[7] = t5, $[8] = t6) : (t5 = $[7], t6 = $[8]), react.useEffect(t5, t6);
614
+ let t7, t8;
615
+ $[9] !== open ? (t7 = () => {
616
+ openRef.current = open;
617
+ }, t8 = [open], $[9] = open, $[10] = t7, $[11] = t8) : (t7 = $[10], t8 = $[11]), react.useEffect(t7, t8);
523
618
  let t9;
524
- $[15] !== border || $[16] !== fontSize || $[17] !== padding || $[18] !== radius || $[19] !== t8 ? (t9 = css.select({
525
- border,
526
- fontSize,
527
- padding,
528
- radius,
529
- gap: t8
530
- }), $[15] = border, $[16] = fontSize, $[17] = padding, $[18] = radius, $[19] = t8, $[20] = t9) : t9 = $[20];
619
+ $[12] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
620
+ setOpen(_temp$4), setShouldFocus(null);
621
+ }, $[12] = t9) : t9 = $[12];
622
+ const handleButtonClick = t9;
531
623
  let t10;
532
- $[21] === Symbol.for("react.memo_cache_sentinel") ? (t10 = css._inputElement(), $[21] = t10) : t10 = $[21];
533
- const t11 = disabled || readOnly;
624
+ $[13] !== open ? (t10 = (event) => {
625
+ open && event.preventDefault();
626
+ }, $[13] = open, $[14] = t10) : t10 = $[14];
627
+ const handleMouseDown = t10;
628
+ let t11;
629
+ $[15] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (event_0) => {
630
+ if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
631
+ event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
632
+ return;
633
+ }
634
+ if (event_0.key === "ArrowUp") {
635
+ event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
636
+ return;
637
+ }
638
+ }, $[15] = t11) : t11 = $[15];
639
+ const handleButtonKeyDown = t11;
534
640
  let t12;
535
- $[22] !== Element2 || $[23] !== children || $[24] !== rest || $[25] !== t11 ? (t12 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t10, disabled: t11, ref, children }), $[22] = Element2, $[23] = children, $[24] = rest, $[25] = t11, $[26] = t12) : t12 = $[26];
641
+ $[16] !== buttonElement || $[17] !== menuElements ? (t12 = (event_1) => {
642
+ const target = event_1.target;
643
+ if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
644
+ for (const el of menuElements)
645
+ if (target === el || el.contains(target))
646
+ return;
647
+ setOpen(!1);
648
+ }
649
+ }, $[16] = buttonElement, $[17] = menuElements, $[18] = t12) : t12 = $[18];
650
+ const handleMenuClickOutside = t12;
536
651
  let t13;
537
- $[27] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css.selectPresentation(), $[27] = t13) : t13 = $[27];
652
+ $[19] !== buttonElement || $[20] !== disableRestoreFocusOnClose ? (t13 = () => {
653
+ setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
654
+ }, $[19] = buttonElement, $[20] = disableRestoreFocusOnClose, $[21] = t13) : t13 = $[21];
655
+ const handleMenuEscape = t13;
538
656
  let t14;
539
- $[28] === Symbol.for("react.memo_cache_sentinel") ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDownIcon, {}), $[28] = t14) : t14 = $[28];
657
+ $[22] !== menuElements ? (t14 = (event_2) => {
658
+ const target_0 = event_2.relatedTarget;
659
+ if (target_0 instanceof Node) {
660
+ for (const el_0 of menuElements)
661
+ if (el_0 === target_0 || el_0.contains(target_0))
662
+ return;
663
+ setOpen(!1);
664
+ }
665
+ }, $[22] = menuElements, $[23] = t14) : t14 = $[23];
666
+ const handleBlur = t14;
540
667
  let t15;
541
- $[29] !== fontSize ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, children: t14 }), $[29] = fontSize, $[30] = t15) : t15 = $[30];
668
+ $[24] !== buttonElement || $[25] !== disableRestoreFocusOnClose ? (t15 = () => {
669
+ setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
670
+ }, $[24] = buttonElement, $[25] = disableRestoreFocusOnClose, $[26] = t15) : t15 = $[26];
671
+ const handleItemClick = t15;
542
672
  let t16;
543
- $[31] !== padding || $[32] !== t15 ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t13, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { as: "span", display: "inline-block", padding, children: t15 }) }), $[31] = padding, $[32] = t15, $[33] = t16) : t16 = $[33];
673
+ $[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];
674
+ const registerElement = t16;
544
675
  let t17;
545
- return $[34] !== t12 || $[35] !== t16 || $[36] !== t9 ? (t17 = /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-ui": "Select", className: t9, "data-icon-right": "", children: [
546
- t12,
547
- t16
548
- ] }), $[34] = t12, $[35] = t16, $[36] = t9, $[37] = t17) : t17 = $[37], t17;
676
+ $[28] !== buttonElement || $[29] !== handleBlur || $[30] !== handleItemClick || $[31] !== handleMenuClickOutside || $[32] !== handleMenuEscape || $[33] !== id || $[34] !== menuProp || $[35] !== shouldFocus ? (t17 = menuProp && react.cloneElement(menuProp, {
677
+ "aria-labelledby": id,
678
+ onBlurCapture: handleBlur,
679
+ onClickOutside: handleMenuClickOutside,
680
+ onEscape: handleMenuEscape,
681
+ onItemClick: handleItemClick,
682
+ originElement: buttonElement,
683
+ registerElement,
684
+ shouldFocus
685
+ }), $[28] = buttonElement, $[29] = handleBlur, $[30] = handleItemClick, $[31] = handleMenuClickOutside, $[32] = handleMenuEscape, $[33] = id, $[34] = menuProp, $[35] = shouldFocus, $[36] = t17) : t17 = $[36];
686
+ const menu = t17;
687
+ let t18;
688
+ bb0: {
689
+ if (!buttonProp) {
690
+ t18 = null;
691
+ break bb0;
692
+ }
693
+ const t192 = buttonProp.props.selected ?? open;
694
+ let t202;
695
+ $[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open || $[41] !== t192 ? (t202 = react.cloneElement(buttonProp, {
696
+ "data-ui": "MenuButton",
697
+ id,
698
+ onClick: handleButtonClick,
699
+ onKeyDown: handleButtonKeyDown,
700
+ onMouseDown: handleMouseDown,
701
+ "aria-haspopup": !0,
702
+ "aria-expanded": open,
703
+ ref: setButtonElement,
704
+ selected: t192
705
+ }), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] = t192, $[42] = t202) : t202 = $[42], t18 = t202;
706
+ }
707
+ const button = t18;
708
+ let t19, t20;
709
+ $[43] !== buttonElement ? (t19 = () => buttonElement, t20 = [buttonElement], $[43] = buttonElement, $[44] = t19, $[45] = t20) : (t19 = $[44], t20 = $[45]), react.useImperativeHandle(forwardedRef, t19, t20);
710
+ let t21, t22;
711
+ $[46] !== popover ? (t22 = popover || {}, $[46] = popover, $[47] = t22) : t22 = $[47];
712
+ let t23;
713
+ $[48] !== deprecated_boundaryElement || $[49] !== deprecated_placement || $[50] !== deprecated_popoverRadius || $[51] !== deprecated_popoverScheme || $[52] !== deprecated_portal || $[53] !== deprecated_preventOverflow || $[54] !== t22 ? (t23 = {
714
+ boundaryElement: deprecated_boundaryElement,
715
+ overflow: "auto",
716
+ placement: deprecated_placement,
717
+ portal: deprecated_portal,
718
+ preventOverflow: deprecated_preventOverflow,
719
+ radius: deprecated_popoverRadius,
720
+ scheme: deprecated_popoverScheme,
721
+ ...t22
722
+ }, $[48] = deprecated_boundaryElement, $[49] = deprecated_placement, $[50] = deprecated_popoverRadius, $[51] = deprecated_popoverScheme, $[52] = deprecated_portal, $[53] = deprecated_preventOverflow, $[54] = t22, $[55] = t23) : t23 = $[55], t21 = t23;
723
+ const popoverProps = t21;
724
+ let t24;
725
+ $[56] !== button ? (t24 = button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}), $[56] = button, $[57] = t24) : t24 = $[57];
726
+ let t25;
727
+ return $[58] !== menu || $[59] !== open || $[60] !== popoverProps || $[61] !== t24 ? (t25 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t24 }), $[58] = menu, $[59] = open, $[60] = popoverProps, $[61] = t24, $[62] = t25) : t25 = $[62], t25;
549
728
  }
550
- const DEFAULT_SR_ONLY_ELEMENT = "span";
551
- function SrOnly(props) {
552
- const $ = reactCompilerRuntime.c(12), t0 = props;
553
- let children, className, rest, t1;
729
+ function _temp$4(v) {
730
+ return !v;
731
+ }
732
+ const DEFAULT_TAB_PANEL_ELEMENT = "div";
733
+ function TabPanel(props) {
734
+ const $ = compilerRuntime.c(10), t0 = props;
735
+ let children, rest, t1, tabIndex;
554
736
  $[0] !== t0 ? ({
555
737
  as: t1,
556
738
  children,
557
- className,
739
+ tabIndex,
558
740
  ...rest
559
- } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = rest, $[4] = t1) : (children = $[1], className = $[2], rest = $[3], t1 = $[4]);
560
- const Element2 = t1 === void 0 ? DEFAULT_SR_ONLY_ELEMENT : t1;
561
- let t2;
562
- $[5] !== className ? (t2 = css.srOnly({
563
- className
564
- }), $[5] = className, $[6] = t2) : t2 = $[6];
741
+ } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1, $[4] = tabIndex) : (children = $[1], rest = $[2], t1 = $[3], tabIndex = $[4]);
742
+ const as = t1 === void 0 ? DEFAULT_TAB_PANEL_ELEMENT : t1, t2 = tabIndex === void 0 ? 0 : tabIndex;
565
743
  let t3;
566
- return $[7] !== Element2 || $[8] !== children || $[9] !== rest || $[10] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "SrOnly", ...rest, "aria-hidden": !0, className: t2, children }), $[7] = Element2, $[8] = children, $[9] = rest, $[10] = t2, $[11] = t3) : t3 = $[11], t3;
744
+ return $[5] !== as || $[6] !== children || $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "TabPanel", ...rest, as, role: "tabpanel", tabIndex: t2, children }), $[5] = as, $[6] = children, $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
567
745
  }
568
- const DEFAULT_SWITCH_ELEMENT = "input";
569
- function Switch(props) {
570
- const $ = reactCompilerRuntime.c(31), t0 = props;
571
- let checked, className, disabled, forwardedRef, indeterminate, readOnly, rest, style, t1;
572
- $[0] !== t0 ? ({
573
- as: t1,
574
- checked,
575
- className,
576
- disabled,
577
- indeterminate,
578
- readOnly,
579
- ref: forwardedRef,
580
- style,
581
- ...rest
582
- } = t0, $[0] = t0, $[1] = checked, $[2] = className, $[3] = disabled, $[4] = forwardedRef, $[5] = indeterminate, $[6] = readOnly, $[7] = rest, $[8] = style, $[9] = t1) : (checked = $[1], className = $[2], disabled = $[3], forwardedRef = $[4], indeterminate = $[5], readOnly = $[6], rest = $[7], style = $[8], t1 = $[9]);
583
- const Element2 = t1 === void 0 ? DEFAULT_SWITCH_ELEMENT : t1, ref = react.useRef(null);
584
- let t2;
585
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[10] = t2) : t2 = $[10], react.useImperativeHandle(forwardedRef, t2);
586
- let t3, t4;
587
- $[11] !== indeterminate ? (t3 = () => {
588
- ref.current && (ref.current.indeterminate = indeterminate || !1);
589
- }, t4 = [indeterminate], $[11] = indeterminate, $[12] = t3, $[13] = t4) : (t3 = $[12], t4 = $[13]), react.useEffect(t3, t4);
746
+ const DEFAULT_TOAST_ELEMENT = "li", ROLES = {
747
+ error: "alert",
748
+ warning: "alert",
749
+ success: "alert",
750
+ info: "alert"
751
+ }, STATUS_CARD_TONE = {
752
+ error: "critical",
753
+ warning: "caution",
754
+ success: "positive",
755
+ info: "neutral"
756
+ }, BUTTON_TONE = {
757
+ error: "critical",
758
+ warning: "caution",
759
+ success: "positive",
760
+ info: "neutral"
761
+ };
762
+ function Toast(props) {
763
+ const $ = compilerRuntime.c(40), t0 = props;
764
+ let closable, description, onClose, rest, status, t1, t2, title;
765
+ if ($[0] !== t0) {
766
+ const {
767
+ as: t32,
768
+ closable: t42,
769
+ description: t52,
770
+ duration,
771
+ onClose: t62,
772
+ radius: t72,
773
+ title: t82,
774
+ status: t92,
775
+ updatedAt,
776
+ ...t102
777
+ } = t0;
778
+ t1 = t32, closable = t42, description = t52, onClose = t62, t2 = t72, title = t82, status = t92, rest = t102, $[0] = t0, $[1] = closable, $[2] = description, $[3] = onClose, $[4] = rest, $[5] = status, $[6] = t1, $[7] = t2, $[8] = title;
779
+ } else
780
+ closable = $[1], description = $[2], onClose = $[3], rest = $[4], status = $[5], t1 = $[6], t2 = $[7], title = $[8];
781
+ const as = t1 === void 0 ? DEFAULT_TOAST_ELEMENT : t1, radius = t2 === void 0 ? 3 : t2, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status", visualDuration = _visualEditing.usePrefersReducedMotion() ? 0 : 0.26;
782
+ let t3;
783
+ $[9] !== visualDuration ? (t3 = visualDuration ? {
784
+ type: "spring",
785
+ visualDuration,
786
+ bounce: 0.25
787
+ } : {
788
+ duration: 0
789
+ }, $[9] = visualDuration, $[10] = t3) : t3 = $[10];
790
+ const transition = t3;
791
+ let t4;
792
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t4 = ["hidden", "initial"], $[11] = t4) : t4 = $[11];
793
+ const initial = t4;
590
794
  let t5;
591
- $[14] !== className ? (t5 = css._switch({
592
- className
593
- }), $[14] = className, $[15] = t5) : t5 = $[15];
594
- const t6 = checked ? "" : void 0, t7 = indeterminate ? "" : void 0, t8 = indeterminate !== !0 && checked;
595
- let t9;
596
- $[16] === Symbol.for("react.memo_cache_sentinel") ? (t9 = css._switchElement(), $[16] = t9) : t9 = $[16];
597
- const t10 = disabled ? "" : void 0, t11 = !disabled && readOnly ? "" : void 0, t12 = disabled || readOnly;
598
- let t13;
599
- $[17] !== Element2 || $[18] !== rest || $[19] !== t10 || $[20] !== t11 || $[21] !== t12 || $[22] !== t8 ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, checked: t8, className: t9, "data-disabled": t10, "data-read-only": t11, disabled: t12, type: "checkbox", ref }), $[17] = Element2, $[18] = rest, $[19] = t10, $[20] = t11, $[21] = t12, $[22] = t8, $[23] = t13) : t13 = $[23];
600
- let t14;
601
- $[24] === Symbol.for("react.memo_cache_sentinel") ? (t14 = /* @__PURE__ */ jsxRuntime.jsxs("span", { "aria-hidden": !0, className: css._switchPresentation(), children: [
602
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: css._switchTrack() }),
603
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: css._switchThumb() })
604
- ] }), $[24] = t14) : t14 = $[24];
605
- let t15;
606
- return $[25] !== style || $[26] !== t13 || $[27] !== t5 || $[28] !== t6 || $[29] !== t7 ? (t15 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { className: t5, "data-checked": t6, "data-indeterminate": t7, "data-ui": "Switch", display: "block", position: "relative", style, children: [
607
- t13,
608
- t14
609
- ] }), $[25] = style, $[26] = t13, $[27] = t5, $[28] = t6, $[29] = t7, $[30] = t15) : t15 = $[30], t15;
610
- }
611
- const DEFAULT_TEXT_AREA_ELEMENT = "textarea";
612
- function TextArea(props) {
613
- const $ = reactCompilerRuntime.c(34), t0 = props;
614
- let __unstable_disableFocusRing, customValidity, forwardedRef, gap, readOnly, rest, t1, t2, t3, t4, t5, t6, t7;
615
- $[0] !== t0 ? ({
616
- __unstable_disableFocusRing,
617
- as: t1,
618
- border: t2,
619
- customValidity,
620
- disabled: t3,
621
- fontSize: t4,
622
- gap,
623
- padding: t5,
624
- radius: t6,
625
- readOnly,
626
- ref: forwardedRef,
627
- space: t7,
628
- ...rest
629
- } = t0, $[0] = t0, $[1] = __unstable_disableFocusRing, $[2] = customValidity, $[3] = forwardedRef, $[4] = gap, $[5] = readOnly, $[6] = rest, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = t4, $[11] = t5, $[12] = t6, $[13] = t7) : (__unstable_disableFocusRing = $[1], customValidity = $[2], forwardedRef = $[3], gap = $[4], readOnly = $[5], rest = $[6], t1 = $[7], t2 = $[8], t3 = $[9], t4 = $[10], t5 = $[11], t6 = $[12], t7 = $[13]);
630
- const Element2 = t1 === void 0 ? DEFAULT_TEXT_AREA_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, disabled = t3 === void 0 ? !1 : t3, fontSize = t4 === void 0 ? 2 : t4, padding = t5 === void 0 ? 3 : t5, radius = t6 === void 0 ? 2 : t6, space = t7 === void 0 ? 3 : t7, ref = react.useRef(null);
795
+ $[12] === Symbol.for("react.memo_cache_sentinel") ? (t5 = ["visible", "slideIn"], $[12] = t5) : t5 = $[12];
796
+ const animate = t5;
797
+ let t6;
798
+ $[13] === Symbol.for("react.memo_cache_sentinel") ? (t6 = ["hidden", "slideOut"], $[13] = t6) : t6 = $[13];
799
+ const exit = t6;
800
+ let t7;
801
+ $[14] === Symbol.for("react.memo_cache_sentinel") ? (t7 = css.toast(), $[14] = t7) : t7 = $[14];
631
802
  let t8;
632
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => ref.current, $[14] = t8) : t8 = $[14], react.useImperativeHandle(forwardedRef, t8), _visualEditing.useCustomValidity(ref, customValidity);
633
- const t9 = gap ?? space;
803
+ $[15] !== title ? (t8 = title && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: 1, weight: "medium", children: title }), $[15] = title, $[16] = t8) : t8 = $[16];
804
+ let t9;
805
+ $[17] !== description || $[18] !== transition ? (t9 = description && /* @__PURE__ */ jsxRuntime.jsx(MotionText, { muted: !0, size: 1, variants: content, transition, children: description }), $[17] = description, $[18] = transition, $[19] = t9) : t9 = $[19];
634
806
  let t10;
635
- $[15] !== border || $[16] !== fontSize || $[17] !== padding || $[18] !== radius || $[19] !== t9 ? (t10 = css.textArea({
636
- border,
637
- fontSize,
638
- padding,
639
- radius,
640
- gap: t9
641
- }), $[15] = border, $[16] = fontSize, $[17] = padding, $[18] = radius, $[19] = t9, $[20] = t10) : t10 = $[20];
642
- const t11 = customValidity ? "" : void 0, t12 = !disabled && readOnly ? "" : void 0;
807
+ $[20] !== t8 || $[21] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Flex, { flex: 1, overflowX: "auto", padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Stack, { gap: 3, children: [
808
+ t8,
809
+ t9
810
+ ] }) }), $[20] = t8, $[21] = t9, $[22] = t10) : t10 = $[22];
811
+ let t11;
812
+ $[23] !== buttonTone || $[24] !== closable || $[25] !== onClose ? (t11 = closable && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { as: "button", icon: icons.CloseIcon, mode: "bleed", padding: 2, tone: buttonTone, onClick: onClose, style: {
813
+ verticalAlign: "top"
814
+ } }) }), $[23] = buttonTone, $[24] = closable, $[25] = onClose, $[26] = t11) : t11 = $[26];
815
+ let t12;
816
+ $[27] !== t10 || $[28] !== t11 || $[29] !== transition ? (t12 = /* @__PURE__ */ jsxRuntime.jsxs(MotionFlex, { align: "flex-start", variants: content, transition, children: [
817
+ t10,
818
+ t11
819
+ ] }), $[27] = t10, $[28] = t11, $[29] = transition, $[30] = t12) : t12 = $[30];
643
820
  let t13;
644
- $[21] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css._inputElement(), $[21] = t13) : t13 = $[21];
645
- const t14 = __unstable_disableFocusRing ? "" : void 0;
646
- let t15;
647
- $[22] !== Element2 || $[23] !== disabled || $[24] !== readOnly || $[25] !== rest || $[26] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t13, "data-no-focus-ring": t14, disabled, readOnly, ref }), $[22] = Element2, $[23] = disabled, $[24] = readOnly, $[25] = rest, $[26] = t14, $[27] = t15) : t15 = $[27];
648
- let t16;
649
- $[28] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: css._inputPresentation() }), $[28] = t16) : t16 = $[28];
650
- let t17;
651
- return $[29] !== t10 || $[30] !== t11 || $[31] !== t12 || $[32] !== t15 ? (t17 = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: t10, "data-invalid": t11, "data-read-only": t12, "data-ui": "TextArea", children: [
652
- t15,
653
- t16
654
- ] }), $[29] = t10, $[30] = t11, $[31] = t12, $[32] = t15, $[33] = t17) : t17 = $[33], t17;
821
+ return $[31] !== as || $[32] !== cardTone || $[33] !== radius || $[34] !== rest || $[35] !== role || $[36] !== t12 || $[37] !== transition || $[38] !== visualDuration ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(MotionCard, { as, className: t7, "data-ui": "Toast", role, ...rest, custom: visualDuration, radius, shadow: 2, tone: cardTone, layout: "position", variants: container, initial, animate, exit, transition, position: "relative", children: t12 }), $[31] = as, $[32] = cardTone, $[33] = radius, $[34] = rest, $[35] = role, $[36] = t12, $[37] = transition, $[38] = visualDuration, $[39] = t13) : t13 = $[39], t13;
655
822
  }
656
- function TooltipDelayGroupProvider(props) {
657
- const $ = reactCompilerRuntime.c(9), {
823
+ const container = {
824
+ initial: {
825
+ y: 32,
826
+ scale: 0.5,
827
+ zIndex: 1
828
+ },
829
+ hidden: {
830
+ opacity: 0
831
+ },
832
+ visible: (visualDuration) => visualDuration ? {
833
+ opacity: 1,
834
+ transition: {
835
+ when: "beforeChildren",
836
+ staggerChildren: visualDuration / 3,
837
+ duration: visualDuration / 3
838
+ }
839
+ } : {
840
+ opacity: 1
841
+ },
842
+ slideIn: {
843
+ y: 0,
844
+ scale: 1
845
+ },
846
+ slideOut: {
847
+ zIndex: 0,
848
+ scale: 0.75
849
+ }
850
+ }, content = {
851
+ initial: {
852
+ willChange: "transform"
853
+ },
854
+ hidden: {
855
+ opacity: 0
856
+ },
857
+ visible: {
858
+ opacity: 1
859
+ }
860
+ }, MotionCard = framerMotion.motion.create(_visualEditing.Card), MotionFlex = framerMotion.motion.create(_visualEditing.Flex), MotionText = framerMotion.motion.create(_visualEditing.Text);
861
+ function useMounted() {
862
+ return react.useSyncExternalStore(subscribe, _temp$3, _temp2);
863
+ }
864
+ function _temp2() {
865
+ return !1;
866
+ }
867
+ function _temp$3() {
868
+ return !0;
869
+ }
870
+ const subscribe = () => () => {
871
+ }, ToastContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/toast", null), DEFAULT_TOAST_LAYER_ELEMENT = "ul";
872
+ function ToastLayer(props) {
873
+ const $ = compilerRuntime.c(11), {
874
+ as: t0,
658
875
  children,
659
- delay
660
- } = props, [isGroupActive, setIsGroupActive] = _visualEditing.useDelayedState(!1), [openTooltipId, setOpenTooltipId] = _visualEditing.useDelayedState(null), openDelay = typeof delay == "number" ? delay : delay?.open || 0, closeDelay = typeof delay == "number" ? delay : delay?.close || 0;
661
- let t0;
662
- const t1 = isGroupActive ? 1 : openDelay;
663
- let t2;
664
- $[0] !== closeDelay || $[1] !== openTooltipId || $[2] !== setIsGroupActive || $[3] !== setOpenTooltipId || $[4] !== t1 ? (t2 = {
665
- setIsGroupActive,
666
- openTooltipId,
667
- setOpenTooltipId,
668
- openDelay: t1,
669
- closeDelay
670
- }, $[0] = closeDelay, $[1] = openTooltipId, $[2] = setIsGroupActive, $[3] = setOpenTooltipId, $[4] = t1, $[5] = t2) : t2 = $[5], t0 = t2;
671
- const value = t0;
876
+ padding: t1,
877
+ paddingX,
878
+ paddingY,
879
+ gap: t2
880
+ } = props, as = t0 === void 0 ? DEFAULT_TOAST_LAYER_ELEMENT : t0, padding = t1 === void 0 ? 4 : t1, gap = t2 === void 0 ? 3 : t2, {
881
+ zIndex
882
+ } = _visualEditing.useLayer();
672
883
  let t3;
673
- return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.TooltipDelayGroupContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t3) : t3 = $[8], t3;
884
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t3 = css.toastLayer(), $[0] = t3) : t3 = $[0];
885
+ let t4;
886
+ $[1] !== zIndex ? (t4 = {
887
+ zIndex
888
+ }, $[1] = zIndex, $[2] = t4) : t4 = $[2];
889
+ let t5;
890
+ return $[3] !== as || $[4] !== children || $[5] !== gap || $[6] !== padding || $[7] !== paddingX || $[8] !== paddingY || $[9] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Grid, { as, className: t3, "data-ui": "ToastProvider", padding, paddingX, paddingY, gap, columns: 1, style: t4, children }), $[3] = as, $[4] = children, $[5] = gap, $[6] = padding, $[7] = paddingX, $[8] = paddingY, $[9] = t4, $[10] = t5) : t5 = $[10], t5;
674
891
  }
675
- function AutocompleteOption(props) {
676
- const $ = reactCompilerRuntime.c(11), {
892
+ let toastId = 0;
893
+ function generateToastId() {
894
+ return String(toastId++);
895
+ }
896
+ function ToastProvider(props) {
897
+ const $ = compilerRuntime.c(13), {
677
898
  children,
678
- id,
679
- onSelect,
680
- selected,
681
- value
682
- } = props;
683
- let t0;
684
- $[0] !== onSelect || $[1] !== value ? (t0 = () => {
685
- setTimeout(() => {
686
- onSelect(value);
687
- }, 0);
688
- }, $[0] = onSelect, $[1] = value, $[2] = t0) : t0 = $[2];
689
- const handleClick = t0;
899
+ padding,
900
+ paddingX,
901
+ paddingY,
902
+ gap,
903
+ zOffset: t0
904
+ } = props, zOffset = t0 === void 0 ? 1 : t0;
690
905
  let t1;
691
- $[3] !== handleClick ? (t1 = (event) => {
692
- event.key === "Enter" && !_visualEditing._isEnterToClickElement(event.currentTarget) && handleClick();
693
- }, $[3] = handleClick, $[4] = t1) : t1 = $[4];
694
- const handleKeyDown = t1;
695
- let t2;
696
- return $[5] !== children || $[6] !== handleClick || $[7] !== handleKeyDown || $[8] !== id || $[9] !== selected ? (t2 = /* @__PURE__ */ jsxRuntime.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;
697
- }
698
- function autocompleteReducer(state, msg) {
699
- return msg.type === "input/change" ? {
700
- ...state,
701
- activeValue: null,
702
- focused: !0,
703
- query: msg.query
704
- } : msg.type === "input/focus" ? {
705
- ...state,
706
- focused: !0
707
- } : msg.type === "root/blur" ? {
708
- ...state,
709
- focused: !1,
710
- query: null
711
- } : msg.type === "root/clear" ? {
712
- ...state,
713
- activeValue: null,
714
- query: null,
715
- value: null
716
- } : msg.type === "root/escape" ? {
717
- ...state,
718
- focused: !1,
719
- query: null
720
- } : msg.type === "root/open" ? {
721
- ...state,
722
- query: state.query || msg.query
723
- } : msg.type === "root/setActiveValue" ? {
724
- ...state,
725
- activeValue: msg.value,
726
- listFocused: msg.listFocused || state.listFocused
727
- } : msg.type === "root/setListFocused" ? {
728
- ...state,
729
- listFocused: msg.listFocused
730
- } : msg.type === "value/change" ? {
731
- ...state,
732
- activeValue: msg.value,
733
- query: null,
734
- value: msg.value
735
- } : state;
906
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
907
+ const [state, setState] = react.useState(t1), mounted = useMounted();
908
+ let t2, t3;
909
+ $[1] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {
910
+ version: 0,
911
+ push: (params) => {
912
+ const id = params.id || generateToastId(), duration = params.duration || 5e3;
913
+ return react.startTransition(() => {
914
+ setState((prevState) => {
915
+ if (duration === 0.01)
916
+ return prevState.filter((toast) => toast.id !== id);
917
+ const dismiss = () => react.startTransition(() => setState((currentState) => currentState.filter((toast_0) => toast_0.id !== id)));
918
+ return [...prevState.filter((toast_1) => toast_1.id !== id), {
919
+ dismiss,
920
+ id,
921
+ updatedAt: Date.now(),
922
+ params: {
923
+ ...params,
924
+ duration
925
+ }
926
+ }];
927
+ });
928
+ }), id;
929
+ }
930
+ }, $[1] = t3) : t3 = $[1], t2 = t3;
931
+ const value = t2;
932
+ let t4;
933
+ $[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t4 = mounted && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: !1, mode: "popLayout", children: state.map(_temp$2) }) }) }), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t4) : t4 = $[9];
934
+ let t5;
935
+ return $[10] !== children || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
936
+ children,
937
+ t4
938
+ ] }), $[10] = children, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
736
939
  }
737
- 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_AUTOCOMPLETE_ELEMENT = "input", DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1;
738
- function Autocomplete(props) {
940
+ function _temp$2(t0) {
739
941
  const {
740
- as = DEFAULT_AUTOCOMPLETE_ELEMENT,
741
- border = !0,
742
- customValidity,
743
- disabled,
744
- filterOption: filterOptionProp,
745
- fontSize = 2,
746
- icon,
747
- id,
748
- listBox = _visualEditing.EMPTY_RECORD,
749
- loading,
750
- onBlur,
751
- onChange,
752
- onFocus,
753
- onQueryChange,
754
- onSelect,
755
- openButton,
756
- openOnFocus,
757
- options: optionsProp,
758
- padding: paddingProp = 3,
759
- popover = _visualEditing.EMPTY_RECORD,
760
- prefix,
761
- radius = 2,
762
- readOnly,
763
- ref: forwardedRef,
764
- relatedElements,
765
- renderOption: renderOptionProp,
766
- renderPopover,
767
- renderValue = DEFAULT_RENDER_VALUE,
768
- suffix,
769
- value: valueProp,
770
- ...rest
771
- } = props, [state, dispatch] = react.useReducer(autocompleteReducer, {
772
- activeValue: valueProp || null,
773
- focused: !1,
774
- listFocused: !1,
775
- query: null,
776
- value: valueProp || null
777
- }), {
778
- activeValue,
779
- focused,
780
- listFocused,
781
- query,
782
- value
783
- } = state, defaultRenderOption = react.useCallback(({
784
- value: value_0
785
- }) => /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Card, { as: "button", padding: paddingProp, radius: 2, tone: "inherit", children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 }) }), [fontSize, paddingProp]), renderOption = typeof renderOptionProp == "function" ? renderOptionProp : defaultRenderOption, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = react.useRef(null), resultsPopoverElementRef = react.useRef(null), inputElementRef = react.useRef(null), listBoxElementRef = react.useRef(null), listFocusedRef = react.useRef(!1), valueRef = react.useRef(value), valuePropRef = react.useRef(valueProp), popoverMouseWithinRef = react.useRef(!1);
786
- react.useImperativeHandle(forwardedRef, () => inputElementRef.current);
787
- const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : _visualEditing.EMPTY_ARRAY, padding = _visualEditing.useResponsiveProp(paddingProp), currentOption = react.useMemo(() => value !== null ? options.find((o) => o.value === value) : void 0, [options, value]), filteredOptions = react.useMemo(() => options.filter((option) => query ? filterOption(query, option) : !0), [filterOption, options, query]), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur = react.useCallback((event) => {
788
- setTimeout(() => {
789
- if (popoverMouseWithinRef.current)
790
- return;
791
- const elements = (relatedElements || []).concat(rootElementRef.current ? [rootElementRef.current] : [], resultsPopoverElementRef.current ? [resultsPopoverElementRef.current] : []);
792
- let focusInside = !1;
793
- if (document.activeElement) {
794
- for (const e of elements)
795
- if (e === document.activeElement || e.contains(document.activeElement)) {
796
- focusInside = !0;
797
- break;
798
- }
799
- }
800
- focusInside === !1 && (dispatch({
801
- type: "root/blur"
802
- }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
803
- }, 0);
804
- }, [onBlur, onQueryChange, relatedElements]), handleRootFocus = react.useCallback((event_0) => {
805
- const listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = listBoxElement?.contains(focusedElement) || !1;
806
- listFocused_0 !== listFocusedRef.current && (listFocusedRef.current = listFocused_0, dispatch({
807
- type: "root/setListFocused",
808
- listFocused: listFocused_0
809
- }));
810
- }, []), handleOptionSelect = react.useCallback((v) => {
811
- dispatch({
812
- type: "value/change",
813
- value: v
814
- }), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
815
- }, [onChange, onSelect, onQueryChange]), handleRootKeyDown = react.useCallback((event_1) => {
816
- if (event_1.key === "ArrowDown") {
817
- if (event_1.preventDefault(), !filteredOptionsLen) return;
818
- const activeOption = filteredOptions.find((o_0) => o_0.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
819
- nextActiveOption && dispatch({
820
- type: "root/setActiveValue",
821
- value: nextActiveOption.value,
822
- listFocused: !0
823
- });
824
- return;
825
- }
826
- if (event_1.key === "ArrowUp") {
827
- if (event_1.preventDefault(), !filteredOptionsLen) return;
828
- 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];
829
- nextActiveOption_0 && dispatch({
830
- type: "root/setActiveValue",
831
- value: nextActiveOption_0.value,
832
- listFocused: !0
833
- });
834
- return;
835
- }
836
- if (event_1.key === "Escape") {
837
- dispatch({
838
- type: "root/escape"
839
- }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
840
- return;
841
- }
842
- const target = event_1.target, listEl = listBoxElementRef.current;
843
- if ((listEl === target || listEl?.contains(target)) && !AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event_1.key)) {
844
- inputElementRef.current?.focus();
845
- return;
846
- }
847
- }, [activeValue, filteredOptions, filteredOptionsLen, onQueryChange]), handleInputChange = react.useCallback((event_2) => {
848
- const nextQuery = event_2.currentTarget.value;
849
- dispatch({
850
- type: "input/change",
851
- query: nextQuery
852
- }), onQueryChange && onQueryChange(nextQuery);
853
- }, [onQueryChange]), dispatchOpen = react.useCallback(() => {
854
- dispatch({
855
- type: "root/open",
856
- query: value ? renderValue(value, currentOption) : ""
857
- });
858
- }, [currentOption, renderValue, value]), handleInputFocus = react.useCallback((event_3) => {
859
- focused || (dispatch({
860
- type: "input/focus"
861
- }), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
862
- }, [focused, onFocus, openOnFocus, dispatchOpen]), handlePopoverMouseEnter = react.useCallback(() => {
863
- popoverMouseWithinRef.current = !0;
864
- }, []), handlePopoverMouseLeave = react.useCallback(() => {
865
- popoverMouseWithinRef.current = !1;
866
- }, []), handleClearButtonClick = react.useCallback(() => {
867
- dispatch({
868
- type: "root/clear"
869
- }), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
870
- }, [onChange, onQueryChange]), handleClearButtonFocus = react.useCallback(() => {
871
- dispatch({
872
- type: "input/focus"
873
- });
874
- }, []);
875
- react.useEffect(() => {
876
- if (valueProp !== valuePropRef.current) {
877
- valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
878
- type: "value/change",
879
- value: valueProp
880
- }), valueRef.current = valueProp);
881
- return;
882
- }
883
- valueProp !== valueRef.current && (valueRef.current = valueProp || null, dispatch({
884
- type: "value/change",
885
- value: valueProp || null
886
- }));
887
- }, [valueProp]), react.useEffect(() => {
888
- !focused && valueRef.current && dispatch({
889
- type: "root/setActiveValue",
890
- value: valueRef.current
891
- });
892
- }, [focused]), react.useEffect(() => {
893
- const listElement = listBoxElementRef.current;
894
- if (!listElement) return;
895
- const activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
896
- if (activeOption_1) {
897
- const activeIndex_1 = filteredOptions.indexOf(activeOption_1), activeItemElement = listElement.childNodes[activeIndex_1];
898
- if (activeItemElement) {
899
- if (_hasFocus(activeItemElement))
900
- return;
901
- focusFirstDescendant(activeItemElement);
942
+ dismiss: dismiss_0,
943
+ id: id_0,
944
+ params: params_0,
945
+ updatedAt
946
+ } = t0;
947
+ return /* @__PURE__ */ jsxRuntime.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);
948
+ }
949
+ function useToast() {
950
+ const value = react.useContext(ToastContext);
951
+ if (!value)
952
+ throw new Error("useToast(): missing context value");
953
+ if (!_visualEditing.isRecord(value) || value.version !== 0)
954
+ throw new Error("useToast(): the context value is not compatible");
955
+ return value;
956
+ }
957
+ function _findPrevItemElement(state, itemElements, focusedElement) {
958
+ const idx = itemElements.indexOf(focusedElement), els = itemElements.slice(0, idx), len = els.length;
959
+ for (let i = len - 1; i >= 0; i -= 1) {
960
+ const itemKey = els[i].getAttribute("data-tree-key");
961
+ if (!itemKey)
962
+ continue;
963
+ const segments = itemKey.split("/");
964
+ segments.pop();
965
+ const p = [];
966
+ let expanded = !0;
967
+ for (let j = 0; j < segments.length; j += 1) {
968
+ p.push(segments[j]);
969
+ const k = p.join("/");
970
+ if (!state[k]?.expanded) {
971
+ expanded = !1;
972
+ break;
902
973
  }
903
974
  }
904
- }, [activeValue, filteredOptions]);
905
- const clearButton = react.useMemo(() => {
906
- if (!loading && !disabled && value)
907
- return {
908
- "aria-label": "Clear",
909
- onFocus: handleClearButtonFocus
910
- };
911
- }, [disabled, handleClearButtonFocus, loading, value]), openButtonBoxPadding = react.useMemo(() => Object.fromEntries(Object.entries(padding).map(([key, value_1]) => value_1 === 0 ? [key, 0] : value_1 === 1 ? [key, 1] : value_1 === 2 ? [key, 1] : [key, value_1 - 2])), [padding]), openButtonPadding = react.useMemo(() => Object.values(padding).map((v_0) => Math.max(v_0 - 1, 0)), [padding]), openButtonProps = react.useMemo(() => typeof openButton == "object" ? openButton : _visualEditing.EMPTY_RECORD, [openButton]), handleOpenClick = react.useCallback((event_4) => {
912
- dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
913
- }, [openButtonProps, dispatchOpen]), openButtonNode = react.useMemo(() => !disabled && !readOnly && openButton ? /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { "aria-label": "Open", disabled: expanded, display: "block", fontSize, icon: icons.ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, [disabled, expanded, fontSize, handleOpenClick, openButton, openButtonBoxPadding, openButtonPadding, openButtonProps, readOnly]), inputValue = react.useMemo(() => query === null ? value !== null ? renderValue(value, currentOption) : "" : query, [currentOption, query, renderValue, value]), input = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.TextInput, { ...rest, "aria-activedescendant": activeItemId, "aria-autocomplete": "list", "aria-expanded": expanded, "aria-owns": listBoxId, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", as, border, clearButton, customValidity, disabled, fontSize, icon, iconRight: loading && _visualEditing.AnimatedSpinnerIcon, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: inputElementRef, role: "combobox", spellCheck: !1, suffix: suffix || openButtonNode, value: inputValue }), handleListBoxKeyDown = react.useCallback((event_5) => {
914
- event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
915
- }, [listFocused]), content2 = react.useMemo(() => filteredOptions.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", gap: 1, id: listBoxId, ref: listBoxElementRef, role: "listbox", children: filteredOptions.map((option_0) => {
916
- const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
917
- return /* @__PURE__ */ jsxRuntime.jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: react.cloneElement(renderOption(option_0), {
918
- disabled: loading,
919
- selected: active,
920
- tabIndex: listFocused && active ? 0 : -1
921
- }) }, option_0.value);
922
- }) }) }), [activeValue, currentOption, filteredOptions, handleOptionSelect, handleListBoxKeyDown, id, listBox, listBoxId, listFocused, loading, renderOption]), results = react.useMemo(() => renderPopover ? renderPopover({
923
- content: content2,
924
- hidden: !expanded,
925
- inputElement: inputElementRef.current,
926
- onMouseEnter: handlePopoverMouseEnter,
927
- onMouseLeave: handlePopoverMouseLeave
928
- }, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.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: 3, ref: resultsPopoverElementRef, referenceElement: inputElementRef.current, ...popover }), [content2, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, popover, renderPopover]);
929
- return (
930
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
931
- /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
932
- input,
933
- results
934
- ] })
935
- );
975
+ if (expanded)
976
+ return els[i];
977
+ }
978
+ return null;
936
979
  }
937
- const DEFAULT_BREADCRUMBS_ELEMENT = "nav";
938
- function Breadcrumbs(props) {
939
- const {
940
- as = DEFAULT_BREADCRUMBS_ELEMENT,
941
- children,
942
- className,
943
- expandButton: expandButtonProps,
944
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
945
- gap: _gapProp,
946
- gapX = props.gap ?? props.space ?? 2,
947
- gapY = props.gap ?? props.space ?? 2,
948
- maxLength,
949
- separator,
950
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
951
- space: _spaceProp,
952
- ...rest
953
- } = props, [open, setOpen] = react.useState(!1), expandElementRef = react.useRef(null), popoverElementRef = react.useRef(null), collapse = react.useCallback(() => setOpen(!1), []), expand = react.useCallback(() => setOpen(!0), []);
954
- _visualEditing.useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current]);
955
- const rawItems = react.useMemo(() => react.Children.toArray(children).filter(react.isValidElement), [children]), items = react.useMemo(() => {
956
- const len = rawItems.length;
957
- if (maxLength && len > maxLength) {
958
- const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
959
- return [...rawItems.slice(0, beforeLength - 1), /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { constrainSize: !0, content: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ol", gap: gapY, overflow: "auto", children: rawItems.slice(beforeLength - 1, len - afterLength) }), open, padding: 2, placement: "top", portal: !0, ref: popoverElementRef, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { mode: "bleed", padding: 0, text: "\u2026", ...expandButtonProps, onClick: open ? collapse : expand, ref: expandElementRef, selected: open }) }, "button"), ...rawItems.slice(len - afterLength)];
960
- }
961
- return rawItems;
962
- }, [collapse, expand, expandButtonProps, gapY, maxLength, open, rawItems]);
963
- return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Flex, { as, "data-ui": "Breadcrumbs", ...rest, className: css.breadcrumbs({
964
- className
965
- }), gapX, gapY, children: items.map((item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
966
- itemIndex > 0 && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": !0, as: "li", children: separator || /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted: !0, children: "/" }) }),
967
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { as: "li", children: item })
968
- ] }, itemIndex)) });
980
+ function _findNextItemElement(state, itemElements, focusedElement) {
981
+ const idx = itemElements.indexOf(focusedElement), els = itemElements.slice(idx), len = itemElements.length;
982
+ for (let i = 1; i < len; i += 1) {
983
+ if (!els[i])
984
+ continue;
985
+ const itemKey = els[i].getAttribute("data-tree-key");
986
+ if (!itemKey)
987
+ continue;
988
+ const segments = itemKey.split("/");
989
+ segments.pop();
990
+ const p = [];
991
+ let expanded = !0;
992
+ for (let j = 0; j < segments.length; j += 1) {
993
+ p.push(segments[j]);
994
+ const k = p.join("/");
995
+ if (!state[k]?.expanded) {
996
+ expanded = !1;
997
+ break;
998
+ }
999
+ }
1000
+ if (expanded)
1001
+ return els[i];
1002
+ }
1003
+ return null;
969
1004
  }
970
- function isTargetWithinScope(boundaryElement, portalElement, target) {
971
- return !boundaryElement || !portalElement ? !0 : _visualEditing.containsOrEqualsElement(boundaryElement, target) || _visualEditing.containsOrEqualsElement(portalElement, target);
1005
+ function _focusItemElement(el) {
1006
+ if (el.getAttribute("role") === "treeitem" && el.focus(), el.getAttribute("role") === "none") {
1007
+ const firstChild = el.firstChild;
1008
+ firstChild && firstChild instanceof HTMLElement && firstChild.focus();
1009
+ }
972
1010
  }
973
- const DEFAULT_DIALOG_CARD_ELEMENT = "div";
974
- function DialogCard(props) {
975
- const $ = reactCompilerRuntime.c(51), t0 = props;
976
- let autoFocus, children, footer, forwardedContentRef, forwardedRef, header, hideCloseButton, id, onClickOutside, onClose, portalProp, rest, t1;
1011
+ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/tree", null), DEFAULT_TREE_ELEMENT = "div";
1012
+ function Tree(props) {
1013
+ const $ = compilerRuntime.c(39), t0 = props;
1014
+ let children, forwardedRef, gap, onFocus, rest, t1;
977
1015
  $[0] !== t0 ? ({
978
- __unstable_autoFocus: autoFocus,
979
- __unstable_hideCloseButton: hideCloseButton,
980
- as: t1,
981
1016
  children,
982
- contentRef: forwardedContentRef,
983
- footer,
984
- header,
985
- id,
986
- onClickOutside,
987
- onClose,
988
- portal: portalProp,
1017
+ gap,
1018
+ space: t1,
1019
+ onFocus,
989
1020
  ref: forwardedRef,
990
1021
  ...rest
991
- } = t0, $[0] = t0, $[1] = autoFocus, $[2] = children, $[3] = footer, $[4] = forwardedContentRef, $[5] = forwardedRef, $[6] = header, $[7] = hideCloseButton, $[8] = id, $[9] = onClickOutside, $[10] = onClose, $[11] = portalProp, $[12] = rest, $[13] = t1) : (autoFocus = $[1], children = $[2], footer = $[3], forwardedContentRef = $[4], forwardedRef = $[5], header = $[6], hideCloseButton = $[7], id = $[8], onClickOutside = $[9], onClose = $[10], portalProp = $[11], rest = $[12], t1 = $[13]);
992
- const as = t1 === void 0 ? DEFAULT_DIALOG_CARD_ELEMENT : t1, portal = _visualEditing.usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = _visualEditing.useBoundaryElement().element, ref = react.useRef(null), contentRef = react.useRef(null), layer = _visualEditing.useLayer(), {
993
- isTopLayer
994
- } = layer, labelId = `${id}_label`, showCloseButton = !!onClose && hideCloseButton === !1, showHeader = !!header || showCloseButton;
995
- let t2;
996
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[14] = t2) : t2 = $[14], react.useImperativeHandle(forwardedRef, t2);
997
- let t3;
998
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => contentRef.current, $[15] = t3) : t3 = $[15], react.useImperativeHandle(forwardedContentRef, t3);
999
- let t4, t5;
1000
- $[16] !== autoFocus ? (t4 = () => {
1001
- autoFocus && ref.current && focusFirstDescendant(ref.current);
1002
- }, t5 = [autoFocus, ref], $[16] = autoFocus, $[17] = t4, $[18] = t5) : (t4 = $[17], t5 = $[18]), react.useEffect(t4, t5);
1022
+ } = t0, $[0] = t0, $[1] = children, $[2] = forwardedRef, $[3] = gap, $[4] = onFocus, $[5] = rest, $[6] = t1) : (children = $[1], forwardedRef = $[2], gap = $[3], onFocus = $[4], rest = $[5], t1 = $[6]);
1023
+ const space = t1 === void 0 ? 1 : t1, ref = react.useRef(null), [focusedElement, setFocusedElement] = react.useState(null), focusedElementRef = react.useRef(focusedElement);
1024
+ let t2, t3;
1025
+ $[7] === Symbol.for("react.memo_cache_sentinel") ? (t3 = [], $[7] = t3) : t3 = $[7], t2 = t3;
1026
+ const path = t2;
1027
+ let t4;
1028
+ $[8] === Symbol.for("react.memo_cache_sentinel") ? (t4 = [], $[8] = t4) : t4 = $[8];
1029
+ const [itemElements, setItemElements] = react.useState(t4);
1030
+ let t5;
1031
+ $[9] === Symbol.for("react.memo_cache_sentinel") ? (t5 = {}, $[9] = t5) : t5 = $[9];
1032
+ const [state, setState] = react.useState(t5), stateRef = react.useRef(state);
1003
1033
  let t6;
1004
- $[19] !== boundaryElement || $[20] !== isTopLayer || $[21] !== onClose || $[22] !== portalElement ? (t6 = (event) => {
1005
- if (!isTopLayer || !onClose)
1006
- return;
1007
- const target = document.activeElement;
1008
- target && !isTargetWithinScope(boundaryElement, portalElement, target) || event.key === "Escape" && (event.preventDefault(), event.stopPropagation(), onClose());
1009
- }, $[19] = boundaryElement, $[20] = isTopLayer, $[21] = onClose, $[22] = portalElement, $[23] = t6) : t6 = $[23], _visualEditing.useGlobalKeyDown(t6);
1010
- let t7;
1011
- $[24] !== boundaryElement || $[25] !== isTopLayer || $[26] !== onClickOutside || $[27] !== portalElement ? (t7 = isTopLayer && onClickOutside && ((event_0) => {
1012
- const target_0 = event_0.target;
1013
- target_0 && !isTargetWithinScope(boundaryElement, portalElement, target_0) || onClickOutside();
1014
- }), $[24] = boundaryElement, $[25] = isTopLayer, $[26] = onClickOutside, $[27] = portalElement, $[28] = t7) : t7 = $[28];
1015
- let t8;
1016
- $[29] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => [ref.current], $[29] = t8) : t8 = $[29], _visualEditing.useClickOutsideEvent(t7, t8);
1017
- let t9;
1018
- $[30] === Symbol.for("react.memo_cache_sentinel") ? (t9 = css.dialogCard(), $[30] = t9) : t9 = $[30];
1019
- let t10;
1020
- $[31] === Symbol.for("react.memo_cache_sentinel") ? (t10 = css.dialogLayout(), $[31] = t10) : t10 = $[31];
1034
+ $[10] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[10] = t6) : t6 = $[10], react.useImperativeHandle(forwardedRef, t6);
1035
+ let t7, t8;
1036
+ $[11] !== focusedElement ? (t7 = () => {
1037
+ focusedElementRef.current = focusedElement;
1038
+ }, t8 = [focusedElement], $[11] = focusedElement, $[12] = t7, $[13] = t8) : (t7 = $[12], t8 = $[13]), react.useEffect(t7, t8);
1039
+ let t10, t9;
1040
+ $[14] !== state ? (t9 = () => {
1041
+ stateRef.current = state;
1042
+ }, t10 = [state], $[14] = state, $[15] = t10, $[16] = t9) : (t10 = $[15], t9 = $[16]), react.useEffect(t9, t10);
1021
1043
  let t11;
1022
- $[32] !== header || $[33] !== labelId || $[34] !== onClose || $[35] !== showCloseButton || $[36] !== showHeader ? (t11 = showHeader && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { className: css.dialogHeader(), position: "relative", children: /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { align: "flex-start", padding: 3, children: [
1023
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, padding: 2, children: header && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { id: labelId, size: 1, weight: "semibold", children: header }) }),
1024
- showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: "none", children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { "aria-label": "Close dialog", disabled: !onClose, icon: icons.CloseIcon, mode: "bleed", onClick: onClose, padding: 2 }) })
1025
- ] }) }), $[32] = header, $[33] = labelId, $[34] = onClose, $[35] = showCloseButton, $[36] = showHeader, $[37] = t11) : t11 = $[37];
1044
+ $[17] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (element, path_0, expanded, selected) => (setState((s) => ({
1045
+ ...s,
1046
+ [path_0]: {
1047
+ element,
1048
+ expanded
1049
+ }
1050
+ })), selected && setFocusedElement(element), () => {
1051
+ setState((s_0) => {
1052
+ const newState = {
1053
+ ...s_0
1054
+ };
1055
+ return delete newState[path_0], newState;
1056
+ });
1057
+ }), $[17] = t11) : t11 = $[17];
1058
+ const registerItem = t11;
1026
1059
  let t12;
1027
- $[38] === Symbol.for("react.memo_cache_sentinel") ? (t12 = css.dialogContent(), $[38] = t12) : t12 = $[38];
1060
+ $[18] === Symbol.for("react.memo_cache_sentinel") ? (t12 = (path_1, expanded_0) => {
1061
+ setState((s_1) => {
1062
+ const itemState = s_1[path_1];
1063
+ return itemState ? {
1064
+ ...s_1,
1065
+ [path_1]: {
1066
+ ...itemState,
1067
+ expanded: expanded_0
1068
+ }
1069
+ } : s_1;
1070
+ });
1071
+ }, $[18] = t12) : t12 = $[18];
1072
+ const setExpanded = t12;
1028
1073
  let t13;
1029
- $[39] !== children ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { className: t12, flex: 1, overflow: "auto", position: "relative", ref: contentRef, tabIndex: -1, children }), $[39] = children, $[40] = t13) : t13 = $[40];
1030
- let t14;
1031
- $[41] !== footer ? (t14 = footer && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { className: css.dialogFooter(), position: "relative", children: footer }), $[41] = footer, $[42] = t14) : t14 = $[42];
1074
+ const t14 = focusedElement || itemElements[0] || null;
1032
1075
  let t15;
1033
- $[43] !== t11 || $[44] !== t13 || $[45] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { className: t10, direction: "column", flex: 1, children: [
1034
- t11,
1035
- t13,
1036
- t14
1037
- ] }), $[43] = t11, $[44] = t13, $[45] = t14, $[46] = t15) : t15 = $[46];
1076
+ $[19] !== space || $[20] !== state || $[21] !== t14 ? (t15 = {
1077
+ version: 0,
1078
+ focusedElement: t14,
1079
+ level: 0,
1080
+ path,
1081
+ registerItem,
1082
+ setExpanded,
1083
+ setFocusedElement,
1084
+ space,
1085
+ state
1086
+ }, $[19] = space, $[20] = state, $[21] = t14, $[22] = t15) : t15 = $[22], t13 = t15;
1087
+ const contextValue = t13;
1038
1088
  let t16;
1039
- return $[47] !== as || $[48] !== rest || $[49] !== t15 ? (t16 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Card, { ...rest, as, className: t9, display: "flex", ref, children: t15 }), $[47] = as, $[48] = rest, $[49] = t15, $[50] = t16) : t16 = $[50], t16;
1089
+ $[23] !== itemElements ? (t16 = (event) => {
1090
+ if (focusedElementRef.current) {
1091
+ if (event.key === "ArrowDown") {
1092
+ event.preventDefault();
1093
+ const nextEl = _findNextItemElement(stateRef.current, itemElements, focusedElementRef.current);
1094
+ nextEl && (_focusItemElement(nextEl), setFocusedElement(nextEl));
1095
+ return;
1096
+ }
1097
+ if (event.key === "ArrowUp") {
1098
+ event.preventDefault();
1099
+ const prevEl = _findPrevItemElement(stateRef.current, itemElements, focusedElementRef.current);
1100
+ prevEl && (_focusItemElement(prevEl), setFocusedElement(prevEl));
1101
+ return;
1102
+ }
1103
+ if (event.key === "ArrowLeft") {
1104
+ event.preventDefault();
1105
+ const itemKey = focusedElementRef.current.getAttribute("data-tree-key");
1106
+ if (!itemKey)
1107
+ return;
1108
+ const itemState_0 = stateRef.current[itemKey];
1109
+ if (!itemState_0)
1110
+ return;
1111
+ if (itemState_0.expanded)
1112
+ setState((s_2) => {
1113
+ const itemState_1 = s_2[itemKey];
1114
+ return itemState_1 ? {
1115
+ ...s_2,
1116
+ [itemKey]: {
1117
+ ...itemState_1,
1118
+ expanded: !1
1119
+ }
1120
+ } : s_2;
1121
+ });
1122
+ else {
1123
+ const itemPath = itemKey.split("/");
1124
+ itemPath.pop();
1125
+ const parentKey = itemPath.join("/"), parentState = parentKey && stateRef.current[parentKey];
1126
+ parentState && (parentState.element.focus(), setFocusedElement(parentState.element));
1127
+ }
1128
+ return;
1129
+ }
1130
+ if (event.key === "ArrowRight") {
1131
+ event.preventDefault();
1132
+ const focusedKey = focusedElementRef.current.getAttribute("data-tree-key");
1133
+ if (!focusedKey)
1134
+ return;
1135
+ stateRef.current[focusedKey]?.expanded || setState((s_3) => {
1136
+ const itemState_2 = s_3[focusedKey];
1137
+ return itemState_2 ? {
1138
+ ...s_3,
1139
+ [focusedKey]: {
1140
+ ...itemState_2,
1141
+ expanded: !0
1142
+ }
1143
+ } : s_3;
1144
+ });
1145
+ return;
1146
+ }
1147
+ }
1148
+ }, $[23] = itemElements, $[24] = t16) : t16 = $[24];
1149
+ const handleKeyDown = t16;
1150
+ let t17;
1151
+ $[25] !== onFocus ? (t17 = (event_0) => {
1152
+ setFocusedElement(event_0.target), onFocus?.(event_0);
1153
+ }, $[25] = onFocus, $[26] = t17) : t17 = $[26];
1154
+ const handleFocus = t17;
1155
+ let t18;
1156
+ $[27] === Symbol.for("react.memo_cache_sentinel") ? (t18 = () => {
1157
+ if (!ref.current)
1158
+ return;
1159
+ const _itemElements = Array.from(ref.current.querySelectorAll('[data-ui="TreeItem"]'));
1160
+ setItemElements(_itemElements);
1161
+ }, $[27] = t18) : t18 = $[27];
1162
+ let t19;
1163
+ $[28] !== children ? (t19 = [children], $[28] = children, $[29] = t19) : t19 = $[29], react.useEffect(t18, t19);
1164
+ const t20 = gap ?? space;
1165
+ let t21;
1166
+ $[30] !== children || $[31] !== handleFocus || $[32] !== handleKeyDown || $[33] !== rest || $[34] !== t20 ? (t21 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "Tree", ...rest, gap: t20, onFocus: handleFocus, onKeyDown: handleKeyDown, ref, role: "tree", children }), $[30] = children, $[31] = handleFocus, $[32] = handleKeyDown, $[33] = rest, $[34] = t20, $[35] = t21) : t21 = $[35];
1167
+ let t22;
1168
+ return $[36] !== contextValue || $[37] !== t21 ? (t22 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t21 }), $[36] = contextValue, $[37] = t21, $[38] = t22) : t22 = $[38], t22;
1169
+ }
1170
+ function useTree() {
1171
+ const tree = react.useContext(TreeContext);
1172
+ if (!tree)
1173
+ throw new Error("Tree: missing context value");
1174
+ return tree;
1175
+ }
1176
+ const TreeGroup = react.memo(function(props) {
1177
+ const $ = compilerRuntime.c(9), t0 = props;
1178
+ let children, rest, t1;
1179
+ $[0] !== t0 ? ({
1180
+ children,
1181
+ expanded: t1,
1182
+ ...rest
1183
+ } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1) : (children = $[1], rest = $[2], t1 = $[3]);
1184
+ const expanded = t1 === void 0 ? !1 : t1, tree = useTree(), t2 = !expanded;
1185
+ let t3;
1186
+ return $[4] !== children || $[5] !== rest || $[6] !== t2 || $[7] !== tree.space ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "TreeGroup", ...rest, hidden: t2, marginTop: tree.space, role: "group", gap: tree.space, children }), $[4] = children, $[5] = rest, $[6] = t2, $[7] = tree.space, $[8] = t3) : t3 = $[8], t3;
1187
+ }), DEFAULT_TREE_ITEM_ELEMENT = "a";
1188
+ function TreeItem(props) {
1189
+ const {
1190
+ children,
1191
+ className,
1192
+ expanded: expandedProp = !1,
1193
+ fontSize = 1,
1194
+ href,
1195
+ icon: IconComponent,
1196
+ id: idProp,
1197
+ linkAs = "a",
1198
+ muted,
1199
+ onClick,
1200
+ padding = 2,
1201
+ radius = 2,
1202
+ selected = !1,
1203
+ space = 2,
1204
+ text,
1205
+ weight,
1206
+ ...rest
1207
+ } = props, rootRef = react.useRef(null), treeitemRef = react.useRef(null), tree = useTree(), {
1208
+ path,
1209
+ registerItem,
1210
+ setExpanded,
1211
+ setFocusedElement
1212
+ } = tree, _id = react.useId(), id = idProp || _id, itemPath = react.useMemo(() => path.concat([id || ""]), [id, path]), itemKey = itemPath.join("/"), itemState = tree.state[itemKey], expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, focused = tree.focusedElement && tree.focusedElement === rootRef.current, tabIndex = focused ? 0 : -1, contextValue = react.useMemo(() => ({
1213
+ ...tree,
1214
+ level: tree.level + 1,
1215
+ path: itemPath
1216
+ }), [itemPath, tree]), handleClick = react.useCallback((event) => {
1217
+ onClick && onClick(event);
1218
+ const target = event.target;
1219
+ target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootRef.current));
1220
+ }, [expanded, itemKey, onClick, setExpanded, setFocusedElement]), handleKeyDown = react.useCallback((event_0) => {
1221
+ focused && event_0.key === "Enter" && (treeitemRef.current || rootRef.current)?.click();
1222
+ }, [focused]);
1223
+ react.useEffect(() => {
1224
+ if (rootRef.current)
1225
+ return registerItem(rootRef.current, itemPath.join("/"), expanded, selected);
1226
+ }, [expanded, itemPath, registerItem, selected]);
1227
+ const content2 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { gap: space, padding, children: [
1228
+ /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { style: {
1229
+ visibility: IconComponent || children ? "visible" : "hidden",
1230
+ pointerEvents: "none"
1231
+ }, children: [
1232
+ IconComponent && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {}) }),
1233
+ !IconComponent && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ToggleArrowRightIcon, { style: {
1234
+ transform: expanded ? "rotate(90deg)" : void 0
1235
+ } }) })
1236
+ ] }),
1237
+ /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text }) })
1238
+ ] });
1239
+ return href ? /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { "data-selected": selected ? "" : void 0, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...rest, as: "li", className: css.treeItem({
1240
+ className
1241
+ }), onClick: handleClick, ref: rootRef, role: "none", children: [
1242
+ /* @__PURE__ */ jsxRuntime.jsx(
1243
+ _visualEditing.Selectable,
1244
+ {
1245
+ "aria-expanded": expanded,
1246
+ as: linkAs,
1247
+ "data-ui": "TreeItem__box",
1248
+ href,
1249
+ radius,
1250
+ ref: treeitemRef,
1251
+ role: "treeitem",
1252
+ selected,
1253
+ tabIndex,
1254
+ style: {
1255
+ paddingLeft: `calc(${css.vars.space[2]} * ${tree.level})`
1256
+ },
1257
+ children: content2
1258
+ }
1259
+ ),
1260
+ /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { hidden: !expanded, children }) })
1261
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { "data-selected": selected ? "" : void 0, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...rest, "aria-expanded": expanded, className: css.treeItem({
1262
+ className
1263
+ }), onClick: handleClick, onKeyDown: handleKeyDown, ref: rootRef, role: "treeitem", tabIndex, children: [
1264
+ /* @__PURE__ */ jsxRuntime.jsx(
1265
+ _visualEditing.Selectable,
1266
+ {
1267
+ as: "button",
1268
+ "data-focused": focused ? "" : void 0,
1269
+ "data-ui": "TreeItem__box",
1270
+ radius,
1271
+ selected,
1272
+ style: {
1273
+ paddingLeft: `calc(${css.vars.space[2]} * ${tree.level})`
1274
+ },
1275
+ children: content2
1276
+ }
1277
+ ),
1278
+ /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { expanded, children }) })
1279
+ ] });
1040
1280
  }
1041
- const DialogContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/dialog", {
1042
- version: 0
1043
- });
1044
- function useDialog() {
1045
- return react.useContext(DialogContext);
1281
+ function _isScrollable(el) {
1282
+ if (!(el instanceof Element)) return !1;
1283
+ const style = window.getComputedStyle(el);
1284
+ return style.overflowX.includes("auto") || style.overflowX.includes("scroll") || style.overflowY.includes("auto") || style.overflowY.includes("scroll");
1046
1285
  }
1047
- const DEFAULT_DIALOG_ELEMENT = "div";
1048
- function Dialog(props) {
1049
- const $ = reactCompilerRuntime.c(69), context = useDialog(), t0 = props;
1050
- let _positionProp, _zOffsetProp, children, className, contentRef, footer, header, id, onActivate, onClickOutside, onClose, onFocus, portalProp, rest, scheme, t1, t2, t3, t4, t5, t6, t7, tone;
1286
+ const _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : resizeObserver.ResizeObserver, DEFAULT_VIRTUAL_LIST_ELEMENT = "div";
1287
+ function VirtualList(props) {
1288
+ const $ = compilerRuntime.c(61), t0 = props;
1289
+ let forwardedRef, getItemKey, onChange, renderItem, rest, t1, t2, t3;
1051
1290
  $[0] !== t0 ? ({
1052
- __unstable_autoFocus: t1,
1053
- __unstable_hideCloseButton: t2,
1054
- animate: t3,
1055
- cardRadius: t4,
1056
- children,
1057
- className,
1058
- contentRef,
1059
- footer,
1060
- header,
1061
- id,
1062
- onActivate,
1063
- onClickOutside,
1064
- onClose,
1065
- onFocus,
1066
- padding: t5,
1067
- portal: portalProp,
1068
- position: _positionProp,
1069
- scheme,
1070
- shadow: t6,
1071
- width: t7,
1072
- zOffset: _zOffsetProp,
1073
- tone,
1291
+ as: t1,
1292
+ gap: t2,
1293
+ getItemKey,
1294
+ items: t3,
1295
+ onChange,
1296
+ renderItem,
1297
+ ref: forwardedRef,
1074
1298
  ...rest
1075
- } = t0, $[0] = t0, $[1] = _positionProp, $[2] = _zOffsetProp, $[3] = children, $[4] = className, $[5] = contentRef, $[6] = footer, $[7] = header, $[8] = id, $[9] = onActivate, $[10] = onClickOutside, $[11] = onClose, $[12] = onFocus, $[13] = portalProp, $[14] = rest, $[15] = scheme, $[16] = t1, $[17] = t2, $[18] = t3, $[19] = t4, $[20] = t5, $[21] = t6, $[22] = t7, $[23] = tone) : (_positionProp = $[1], _zOffsetProp = $[2], children = $[3], className = $[4], contentRef = $[5], footer = $[6], header = $[7], id = $[8], onActivate = $[9], onClickOutside = $[10], onClose = $[11], onFocus = $[12], portalProp = $[13], rest = $[14], scheme = $[15], t1 = $[16], t2 = $[17], t3 = $[18], t4 = $[19], t5 = $[20], t6 = $[21], t7 = $[22], tone = $[23]);
1076
- const autoFocus = t1 === void 0 ? !0 : t1, hideCloseButton = t2 === void 0 ? !1 : t2, _animate = t3 === void 0 ? !1 : t3, cardRadiusProp = t4 === void 0 ? 4 : t4, padding = t5 === void 0 ? 3 : t5, cardShadow = t6 === void 0 ? 4 : t6, width = t7 === void 0 ? 0 : t7, positionProp = _positionProp ?? context.position ?? "fixed", zOffsetProp = _zOffsetProp ?? context.zOffset ?? _visualEditing.Z_OFFSETS.dialog, animate = _visualEditing.usePrefersReducedMotion() ? !1 : _animate, portal = _visualEditing.usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = _visualEditing.useBoundaryElement().element, cardRadius = _visualEditing.useResponsiveProp(cardRadiusProp), position = _visualEditing.useResponsiveProp(positionProp), zOffset = _visualEditing.useResponsiveProp(zOffsetProp), preDivRef = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null);
1077
- let t8;
1078
- $[24] !== onFocus ? (t8 = (event) => {
1079
- onFocus?.(event);
1080
- const target = event.target, cardElement = cardRef.current;
1081
- if (cardElement && target === preDivRef.current) {
1082
- focusLastDescendant(cardElement);
1083
- return;
1084
- }
1085
- if (cardElement && target === postDivRef.current) {
1086
- focusFirstDescendant(cardElement);
1299
+ } = t0, $[0] = t0, $[1] = forwardedRef, $[2] = getItemKey, $[3] = onChange, $[4] = renderItem, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3) : (forwardedRef = $[1], getItemKey = $[2], onChange = $[3], renderItem = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8]);
1300
+ const as = t1 === void 0 ? DEFAULT_VIRTUAL_LIST_ELEMENT : t1, gap = t2 === void 0 ? 0 : t2;
1301
+ let t4;
1302
+ $[9] !== t3 ? (t4 = t3 === void 0 ? [] : t3, $[9] = t3, $[10] = t4) : t4 = $[10];
1303
+ const items = t4, ref = react.useRef(null), wrapperRef = react.useRef(null), [scrollTop, setScrollTop] = react.useState(0), [scrollHeight, setScrollHeight] = react.useState(0), [itemHeight, setItemHeight] = react.useState(-1), [gapValue, setGapValue] = react.useState(0);
1304
+ let t5;
1305
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[11] = t5) : t5 = $[11], react.useImperativeHandle(forwardedRef, t5);
1306
+ let t6, t7;
1307
+ $[12] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => {
1308
+ if (!ref.current)
1087
1309
  return;
1310
+ const scrollEl = findScrollable(ref.current.parentNode);
1311
+ if (scrollEl) {
1312
+ if (!(scrollEl instanceof HTMLElement))
1313
+ return;
1314
+ const handleScroll = () => {
1315
+ setScrollTop(scrollEl.scrollTop);
1316
+ };
1317
+ scrollEl.addEventListener("scroll", handleScroll, {
1318
+ passive: !0
1319
+ });
1320
+ const ro = new _ResizeObserver((entries) => {
1321
+ setScrollHeight(entries[0].contentRect.height);
1322
+ });
1323
+ return ro.observe(scrollEl), handleScroll(), () => {
1324
+ scrollEl.removeEventListener("scroll", handleScroll), ro.unobserve(scrollEl), ro.disconnect();
1325
+ };
1088
1326
  }
1089
- _visualEditing.isHTMLElement(event.target) && (focusedElementRef.current = event.target);
1090
- }, $[24] = onFocus, $[25] = t8) : t8 = $[25];
1091
- const handleFocus = t8, labelId = `${id}_label`, rootClickTimeoutRef = react.useRef(void 0);
1092
- let t9;
1093
- $[26] !== boundaryElement || $[27] !== portalElement ? (t9 = () => {
1094
- rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
1095
- const activeElement = document.activeElement;
1096
- if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
1097
- const target_0 = focusedElementRef.current;
1098
- if (!target_0 || !document.body.contains(target_0)) {
1099
- const cardElement_0 = cardRef.current;
1100
- cardElement_0 && focusFirstDescendant(cardElement_0);
1101
- return;
1102
- }
1103
- target_0.focus();
1104
- }
1105
- }, 0);
1106
- }, $[26] = boundaryElement, $[27] = portalElement, $[28] = t9) : t9 = $[28];
1107
- const handleRootClick = t9;
1327
+ const handleScroll_0 = () => {
1328
+ setScrollTop(window.scrollY);
1329
+ }, handleResize = () => {
1330
+ setScrollHeight(window.innerHeight);
1331
+ };
1332
+ return window.addEventListener("scroll", handleScroll_0, {
1333
+ passive: !0
1334
+ }), window.addEventListener("resize", handleResize), setScrollHeight(window.innerHeight), handleScroll_0(), () => {
1335
+ window.removeEventListener("scroll", handleScroll_0), window.removeEventListener("resize", handleResize);
1336
+ };
1337
+ }, t7 = [], $[12] = t6, $[13] = t7) : (t6 = $[12], t7 = $[13]), react.useEffect(t6, t7);
1338
+ const len = items.length, height = itemHeight ? len * (itemHeight + gapValue) - gapValue : 0, fromIndex = height ? Math.max(Math.floor(scrollTop / height * len) - 2, 0) : 0, toIndex = height ? Math.ceil((scrollTop + scrollHeight) / height * len) + 1 : 0;
1339
+ let t8, t9;
1340
+ $[14] !== fromIndex || $[15] !== gapValue || $[16] !== itemHeight || $[17] !== onChange || $[18] !== scrollHeight || $[19] !== scrollTop || $[20] !== toIndex ? (t8 = () => {
1341
+ onChange?.({
1342
+ fromIndex,
1343
+ gap: gapValue,
1344
+ itemHeight,
1345
+ scrollHeight,
1346
+ scrollTop,
1347
+ toIndex
1348
+ });
1349
+ }, t9 = [fromIndex, gapValue, itemHeight, onChange, scrollHeight, scrollTop, toIndex], $[14] = fromIndex, $[15] = gapValue, $[16] = itemHeight, $[17] = onChange, $[18] = scrollHeight, $[19] = scrollTop, $[20] = toIndex, $[21] = t8, $[22] = t9) : (t8 = $[21], t9 = $[22]), react.useEffect(t8, t9);
1108
1350
  let t10;
1109
- $[29] !== className ? (t10 = css.dialog({
1110
- className
1111
- }), $[29] = className, $[30] = t10) : t10 = $[30];
1112
- const t11 = animate ? "" : void 0;
1351
+ $[23] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => {
1352
+ setItemHeight(-1);
1353
+ }, $[23] = t10) : t10 = $[23];
1354
+ let t11;
1355
+ $[24] !== renderItem ? (t11 = [renderItem], $[24] = renderItem, $[25] = t11) : t11 = $[25], react.useEffect(t10, t11);
1113
1356
  let t12;
1114
- $[31] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: preDivRef, tabIndex: 0 }), $[31] = t12) : t12 = $[31];
1115
- let t13;
1116
- $[32] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css.dialogContainer(), $[32] = t13) : t13 = $[32];
1117
- let t14;
1118
- $[33] !== autoFocus || $[34] !== cardRadius || $[35] !== cardShadow || $[36] !== children || $[37] !== contentRef || $[38] !== footer || $[39] !== header || $[40] !== hideCloseButton || $[41] !== id || $[42] !== onClickOutside || $[43] !== onClose || $[44] !== portalProp || $[45] !== scheme || $[46] !== tone || $[47] !== width ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(DialogCard, { __unstable_autoFocus: autoFocus, __unstable_hideCloseButton: hideCloseButton, contentRef, footer, header, id, onClickOutside, onClose, portal: portalProp, radius: cardRadius, ref: cardRef, scheme, shadow: cardShadow, tone, width, children }), $[33] = autoFocus, $[34] = cardRadius, $[35] = cardShadow, $[36] = children, $[37] = contentRef, $[38] = footer, $[39] = header, $[40] = hideCloseButton, $[41] = id, $[42] = onClickOutside, $[43] = onClose, $[44] = portalProp, $[45] = scheme, $[46] = tone, $[47] = width, $[48] = t14) : t14 = $[48];
1357
+ bb0: {
1358
+ if (!renderItem || items.length === 0) {
1359
+ t12 = null;
1360
+ break bb0;
1361
+ }
1362
+ if (itemHeight === -1) {
1363
+ let t133;
1364
+ $[26] === Symbol.for("react.memo_cache_sentinel") ? (t133 = (el) => el ? setItemHeight(el.offsetHeight) : void 0, $[26] = t133) : t133 = $[26];
1365
+ let t142;
1366
+ $[27] !== items[0] || $[28] !== renderItem ? (t142 = renderItem(items[0]), $[27] = items[0], $[28] = renderItem, $[29] = t142) : t142 = $[29];
1367
+ let t152;
1368
+ $[30] !== t142 ? (t152 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { ref: t133, insetTop: 0, insetLeft: 0, insetRight: 0, position: "absolute", children: t142 }, 0), $[30] = t142, $[31] = t152) : t152 = $[31];
1369
+ let t162;
1370
+ $[32] === Symbol.for("react.memo_cache_sentinel") ? (t162 = (el_0) => el_0 ? setGapValue(el_0.offsetHeight) : void 0, $[32] = t162) : t162 = $[32];
1371
+ const t17 = css.vars.space[gap];
1372
+ let t18;
1373
+ $[33] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: t162, style: {
1374
+ height: t17
1375
+ } }), $[33] = t17, $[34] = t18) : t18 = $[34];
1376
+ let t19;
1377
+ $[35] !== t152 || $[36] !== t18 ? (t19 = [/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1378
+ t152,
1379
+ t18
1380
+ ] })], $[35] = t152, $[36] = t18, $[37] = t19) : t19 = $[37], t12 = t19;
1381
+ break bb0;
1382
+ }
1383
+ let t132;
1384
+ if ($[38] !== fromIndex || $[39] !== gapValue || $[40] !== getItemKey || $[41] !== itemHeight || $[42] !== items || $[43] !== renderItem || $[44] !== toIndex) {
1385
+ let t142;
1386
+ $[46] !== fromIndex || $[47] !== gapValue || $[48] !== getItemKey || $[49] !== itemHeight || $[50] !== renderItem ? (t142 = (item, _itemIndex) => {
1387
+ const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
1388
+ return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { insetLeft: 0, insetRight: 0, position: "absolute", style: {
1389
+ top: itemIndex * (itemHeight + gapValue)
1390
+ }, children: node }, key);
1391
+ }, $[46] = fromIndex, $[47] = gapValue, $[48] = getItemKey, $[49] = itemHeight, $[50] = renderItem, $[51] = t142) : t142 = $[51], t132 = items.slice(fromIndex, toIndex).map(t142), $[38] = fromIndex, $[39] = gapValue, $[40] = getItemKey, $[41] = itemHeight, $[42] = items, $[43] = renderItem, $[44] = toIndex, $[45] = t132;
1392
+ } else
1393
+ t132 = $[45];
1394
+ t12 = t132;
1395
+ }
1396
+ const children = t12;
1397
+ let t13, t14;
1398
+ $[52] !== height ? (t14 = {
1399
+ height
1400
+ }, $[52] = height, $[53] = t14) : t14 = $[53], t13 = t14;
1401
+ const wrapperStyle = t13;
1119
1402
  let t15;
1120
- $[49] !== t14 || $[50] !== width ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(Container, { alignItems: "center", className: t13, "data-ui": "DialogCard", flexDirection: "column", display: "flex", justifyContent: "center", width, children: t14 }), $[49] = t14, $[50] = width, $[51] = t15) : t15 = $[51];
1403
+ $[54] !== children || $[55] !== wrapperStyle ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: wrapperRef, style: wrapperStyle, children }), $[54] = children, $[55] = wrapperStyle, $[56] = t15) : t15 = $[56];
1121
1404
  let t16;
1122
- $[52] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: postDivRef, tabIndex: 0 }), $[52] = t16) : t16 = $[52];
1123
- let t17;
1124
- $[53] !== handleFocus || $[54] !== handleRootClick || $[55] !== id || $[56] !== labelId || $[57] !== onActivate || $[58] !== padding || $[59] !== position || $[60] !== rest || $[61] !== t10 || $[62] !== t11 || $[63] !== t15 || $[64] !== zOffset ? (t17 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Layer, { ...rest, "aria-labelledby": labelId, "aria-modal": !0, className: t10, "data-animate": t11, "data-ui": "Dialog", display: "flex", id, onActivate, onClick: handleRootClick, onFocus: handleFocus, padding, position, role: "dialog", zOffset, children: [
1125
- t12,
1126
- t15,
1127
- t16
1128
- ] }), $[53] = handleFocus, $[54] = handleRootClick, $[55] = id, $[56] = labelId, $[57] = onActivate, $[58] = padding, $[59] = position, $[60] = rest, $[61] = t10, $[62] = t11, $[63] = t15, $[64] = zOffset, $[65] = t17) : t17 = $[65];
1129
- let t18;
1130
- return $[66] !== portalProp || $[67] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Portal, { __unstable_name: portalProp, children: t17 }), $[66] = portalProp, $[67] = t17, $[68] = t18) : t18 = $[68], t18;
1405
+ return $[57] !== as || $[58] !== rest || $[59] !== t15 ? (t16 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "VirtualList", ...rest, as, position: "relative", ref, children: t15 }), $[57] = as, $[58] = rest, $[59] = t15, $[60] = t16) : t16 = $[60], t16;
1131
1406
  }
1132
- function DialogProvider(props) {
1133
- const $ = reactCompilerRuntime.c(6), {
1134
- children,
1135
- position,
1136
- zOffset
1137
- } = props;
1138
- let t0, t1;
1139
- $[0] !== position || $[1] !== zOffset ? (t1 = {
1140
- version: 0,
1141
- position,
1142
- zOffset
1143
- }, $[0] = position, $[1] = zOffset, $[2] = t1) : t1 = $[2], t0 = t1;
1144
- const contextValue = t0;
1145
- let t2;
1146
- return $[3] !== children || $[4] !== contextValue ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: contextValue, children }), $[3] = children, $[4] = contextValue, $[5] = t2) : t2 = $[5], t2;
1407
+ function findScrollable(parentNode) {
1408
+ let _scrollEl = parentNode;
1409
+ for (; _scrollEl && !_isScrollable(_scrollEl); )
1410
+ _scrollEl = _scrollEl.parentNode;
1411
+ return _scrollEl;
1147
1412
  }
1148
- function MenuButton(props) {
1149
- const $ = reactCompilerRuntime.c(63), {
1150
- __unstable_disableRestoreFocusOnClose: t0,
1151
- boundaryElement: deprecated_boundaryElement,
1152
- button: buttonProp,
1153
- id,
1154
- menu: menuProp,
1155
- onClose,
1156
- onOpen,
1157
- placement: deprecated_placement,
1158
- popoverScheme: deprecated_popoverScheme,
1159
- portal: t1,
1160
- popover,
1161
- popoverRadius: deprecated_popoverRadius,
1162
- preventOverflow: deprecated_preventOverflow,
1163
- ref: forwardedRef
1164
- } = props, disableRestoreFocusOnClose = t0 === void 0 ? !1 : t0, deprecated_portal = t1 === void 0 ? !0 : t1, [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), [buttonElement, setButtonElement] = react.useState(null);
1165
- let t2;
1166
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[0] = t2) : t2 = $[0];
1167
- const [menuElements, setChildMenuElements] = react.useState(t2), openRef = react.useRef(open);
1168
- let t3, t4;
1169
- $[1] !== onOpen || $[2] !== open ? (t3 = () => {
1170
- onOpen && open && !openRef.current && onOpen();
1171
- }, t4 = [onOpen, open], $[1] = onOpen, $[2] = open, $[3] = t3, $[4] = t4) : (t3 = $[3], t4 = $[4]), react.useEffect(t3, t4);
1172
- let t5, t6;
1173
- $[5] !== onClose || $[6] !== open ? (t5 = () => {
1174
- onClose && !open && openRef.current && onClose();
1175
- }, t6 = [onClose, open], $[5] = onClose, $[6] = open, $[7] = t5, $[8] = t6) : (t5 = $[7], t6 = $[8]), react.useEffect(t5, t6);
1176
- let t7, t8;
1177
- $[9] !== open ? (t7 = () => {
1178
- openRef.current = open;
1179
- }, t8 = [open], $[9] = open, $[10] = t7, $[11] = t8) : (t7 = $[10], t8 = $[11]), react.useEffect(t7, t8);
1180
- let t9;
1181
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
1182
- setOpen(_temp$2), setShouldFocus(null);
1183
- }, $[12] = t9) : t9 = $[12];
1184
- const handleButtonClick = t9;
1185
- let t10;
1186
- $[13] !== open ? (t10 = (event) => {
1187
- open && event.preventDefault();
1188
- }, $[13] = open, $[14] = t10) : t10 = $[14];
1189
- const handleMouseDown = t10;
1190
- let t11;
1191
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (event_0) => {
1192
- if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
1193
- event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
1413
+ function useArrayProp(val, defaultVal) {
1414
+ const $ = compilerRuntime.c(3);
1415
+ let t0;
1416
+ $[0] !== defaultVal || $[1] !== val ? (t0 = () => [_visualEditing._getArrayProp(val, defaultVal), JSON.stringify(val ?? defaultVal)], $[0] = defaultVal, $[1] = val, $[2] = t0) : t0 = $[2];
1417
+ const [t1, setCache] = react.useState(t0), [cachedVal, cachedHash] = t1, hash = JSON.stringify(val ?? defaultVal);
1418
+ return hash !== cachedHash && setCache([_visualEditing._getArrayProp(val, defaultVal), hash]), cachedVal;
1419
+ }
1420
+ function _getElements(element, elementsArg) {
1421
+ const ret = [element];
1422
+ for (const el of elementsArg)
1423
+ Array.isArray(el) ? ret.push(...el) : ret.push(el);
1424
+ return ret.filter(Boolean);
1425
+ }
1426
+ function useClickOutside(listener, t0, boundaryElement) {
1427
+ const $ = compilerRuntime.c(12), elementsArg = t0 === void 0 ? _visualEditing.EMPTY_ARRAY : t0, [element, setElement] = react.useState(null);
1428
+ let t1;
1429
+ $[0] !== element || $[1] !== elementsArg ? (t1 = () => _getElements(element, elementsArg), $[0] = element, $[1] = elementsArg, $[2] = t1) : t1 = $[2];
1430
+ const [elements, setElements] = react.useState(t1), elementsRef = react.useRef(elements);
1431
+ let t2, t3;
1432
+ $[3] !== element || $[4] !== elementsArg ? (t2 = () => {
1433
+ const prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
1434
+ if (prevElements.length !== nextElements.length) {
1435
+ setElements(nextElements), elementsRef.current = nextElements;
1194
1436
  return;
1195
1437
  }
1196
- if (event_0.key === "ArrowUp") {
1197
- event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
1438
+ for (const el of prevElements)
1439
+ if (!nextElements.includes(el)) {
1440
+ setElements(nextElements), elementsRef.current = nextElements;
1441
+ return;
1442
+ }
1443
+ for (const el_0 of nextElements)
1444
+ if (!prevElements.includes(el_0)) {
1445
+ setElements(nextElements), elementsRef.current = nextElements;
1446
+ return;
1447
+ }
1448
+ }, t3 = [element, elementsArg], $[3] = element, $[4] = elementsArg, $[5] = t2, $[6] = t3) : (t2 = $[5], t3 = $[6]), react.useEffect(t2, t3);
1449
+ let t4, t5;
1450
+ return $[7] !== boundaryElement || $[8] !== elements || $[9] !== listener ? (t4 = () => {
1451
+ if (!listener)
1198
1452
  return;
1453
+ const handleWindowMouseDown = (evt) => {
1454
+ const target = evt.target;
1455
+ if (target instanceof Node && !(boundaryElement && !boundaryElement.contains(target))) {
1456
+ for (const el_1 of elements)
1457
+ if (target === el_1 || el_1.contains(target))
1458
+ return;
1459
+ listener(evt);
1460
+ }
1461
+ };
1462
+ return window.addEventListener("mousedown", handleWindowMouseDown), () => {
1463
+ window.removeEventListener("mousedown", handleWindowMouseDown);
1464
+ };
1465
+ }, t5 = [boundaryElement, listener, elements], $[7] = boundaryElement, $[8] = elements, $[9] = listener, $[10] = t4, $[11] = t5) : (t4 = $[10], t5 = $[11]), react.useEffect(t4, t5), setElement;
1466
+ }
1467
+ const _elementSizeObserver = _createElementSizeObserver();
1468
+ function _createElementRectValueListener() {
1469
+ return {
1470
+ subscribe(element, subscriber) {
1471
+ const resizeObserver2 = new _ResizeObserver(([entry]) => {
1472
+ subscriber({
1473
+ _contentRect: entry.contentRect,
1474
+ border: {
1475
+ width: entry.borderBoxSize[0].inlineSize,
1476
+ height: entry.borderBoxSize[0].blockSize
1477
+ },
1478
+ content: {
1479
+ width: entry.contentRect.width,
1480
+ height: entry.contentRect.height
1481
+ }
1482
+ });
1483
+ });
1484
+ return resizeObserver2.observe(element), () => {
1485
+ resizeObserver2.unobserve(element), resizeObserver2.disconnect();
1486
+ };
1199
1487
  }
1200
- }, $[15] = t11) : t11 = $[15];
1201
- const handleButtonKeyDown = t11;
1202
- let t12;
1203
- $[16] !== buttonElement || $[17] !== menuElements ? (t12 = (event_1) => {
1204
- const target = event_1.target;
1205
- if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
1206
- for (const el of menuElements)
1207
- if (target === el || el.contains(target))
1208
- return;
1209
- setOpen(!1);
1210
- }
1211
- }, $[16] = buttonElement, $[17] = menuElements, $[18] = t12) : t12 = $[18];
1212
- const handleMenuClickOutside = t12;
1213
- let t13;
1214
- $[19] !== buttonElement || $[20] !== disableRestoreFocusOnClose ? (t13 = () => {
1215
- setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
1216
- }, $[19] = buttonElement, $[20] = disableRestoreFocusOnClose, $[21] = t13) : t13 = $[21];
1217
- const handleMenuEscape = t13;
1218
- let t14;
1219
- $[22] !== menuElements ? (t14 = (event_2) => {
1220
- const target_0 = event_2.relatedTarget;
1221
- if (target_0 instanceof Node) {
1222
- for (const el_0 of menuElements)
1223
- if (el_0 === target_0 || el_0.contains(target_0))
1224
- return;
1225
- setOpen(!1);
1226
- }
1227
- }, $[22] = menuElements, $[23] = t14) : t14 = $[23];
1228
- const handleBlur = t14;
1229
- let t15;
1230
- $[24] !== buttonElement || $[25] !== disableRestoreFocusOnClose ? (t15 = () => {
1231
- setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
1232
- }, $[24] = buttonElement, $[25] = disableRestoreFocusOnClose, $[26] = t15) : t15 = $[26];
1233
- const handleItemClick = t15;
1234
- let t16;
1235
- $[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];
1236
- const registerElement = t16;
1237
- let t17;
1238
- $[28] !== buttonElement || $[29] !== handleBlur || $[30] !== handleItemClick || $[31] !== handleMenuClickOutside || $[32] !== handleMenuEscape || $[33] !== id || $[34] !== menuProp || $[35] !== shouldFocus ? (t17 = menuProp && react.cloneElement(menuProp, {
1239
- "aria-labelledby": id,
1240
- onBlurCapture: handleBlur,
1241
- onClickOutside: handleMenuClickOutside,
1242
- onEscape: handleMenuEscape,
1243
- onItemClick: handleItemClick,
1244
- originElement: buttonElement,
1245
- registerElement,
1246
- shouldFocus
1247
- }), $[28] = buttonElement, $[29] = handleBlur, $[30] = handleItemClick, $[31] = handleMenuClickOutside, $[32] = handleMenuEscape, $[33] = id, $[34] = menuProp, $[35] = shouldFocus, $[36] = t17) : t17 = $[36];
1248
- const menu = t17;
1249
- let t18;
1250
- bb0: {
1251
- if (!buttonProp) {
1252
- t18 = null;
1253
- break bb0;
1488
+ };
1489
+ }
1490
+ function _createElementSizeObserver() {
1491
+ const disposeCache = /* @__PURE__ */ new WeakMap(), subscribersCache = /* @__PURE__ */ new WeakMap();
1492
+ return {
1493
+ subscribe(element, subscriber) {
1494
+ const subscribers = subscribersCache.get(element) || [];
1495
+ let dispose = disposeCache.get(element);
1496
+ return subscribersCache.has(element) || (subscribersCache.set(element, subscribers), dispose = _createElementRectValueListener().subscribe(element, (elementRect) => {
1497
+ for (const sub of subscribers)
1498
+ sub(elementRect);
1499
+ })), subscribers.push(subscriber), () => {
1500
+ const idx = subscribers.indexOf(subscriber);
1501
+ idx > -1 && subscribers.splice(idx, 1), subscribers.length === 0 && dispose && dispose();
1502
+ };
1254
1503
  }
1255
- const t192 = buttonProp.props.selected ?? open;
1256
- let t202;
1257
- $[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open || $[41] !== t192 ? (t202 = react.cloneElement(buttonProp, {
1258
- "data-ui": "MenuButton",
1259
- id,
1260
- onClick: handleButtonClick,
1261
- onKeyDown: handleButtonKeyDown,
1262
- onMouseDown: handleMouseDown,
1263
- "aria-haspopup": !0,
1264
- "aria-expanded": open,
1265
- ref: setButtonElement,
1266
- selected: t192
1267
- }), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] = t192, $[42] = t202) : t202 = $[42], t18 = t202;
1268
- }
1269
- const button = t18;
1270
- let t19, t20;
1271
- $[43] !== buttonElement ? (t19 = () => buttonElement, t20 = [buttonElement], $[43] = buttonElement, $[44] = t19, $[45] = t20) : (t19 = $[44], t20 = $[45]), react.useImperativeHandle(forwardedRef, t19, t20);
1272
- let t21, t22;
1273
- $[46] !== popover ? (t22 = popover || {}, $[46] = popover, $[47] = t22) : t22 = $[47];
1274
- let t23;
1275
- $[48] !== deprecated_boundaryElement || $[49] !== deprecated_placement || $[50] !== deprecated_popoverRadius || $[51] !== deprecated_popoverScheme || $[52] !== deprecated_portal || $[53] !== deprecated_preventOverflow || $[54] !== t22 ? (t23 = {
1276
- boundaryElement: deprecated_boundaryElement,
1277
- overflow: "auto",
1278
- placement: deprecated_placement,
1279
- portal: deprecated_portal,
1280
- preventOverflow: deprecated_preventOverflow,
1281
- radius: deprecated_popoverRadius,
1282
- scheme: deprecated_popoverScheme,
1283
- ...t22
1284
- }, $[48] = deprecated_boundaryElement, $[49] = deprecated_placement, $[50] = deprecated_popoverRadius, $[51] = deprecated_popoverScheme, $[52] = deprecated_portal, $[53] = deprecated_preventOverflow, $[54] = t22, $[55] = t23) : t23 = $[55], t21 = t23;
1285
- const popoverProps = t21;
1286
- let t24;
1287
- $[56] !== button ? (t24 = button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}), $[56] = button, $[57] = t24) : t24 = $[57];
1288
- let t25;
1289
- return $[58] !== menu || $[59] !== open || $[60] !== popoverProps || $[61] !== t24 ? (t25 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t24 }), $[58] = menu, $[59] = open, $[60] = popoverProps, $[61] = t24, $[62] = t25) : t25 = $[62], t25;
1504
+ };
1290
1505
  }
1291
- function _temp$2(v) {
1292
- return !v;
1506
+ function useElementSize(element) {
1507
+ const $ = compilerRuntime.c(3), [size, setSize] = react.useState(null);
1508
+ let t0, t1;
1509
+ return $[0] !== element ? (t0 = () => {
1510
+ if (element)
1511
+ return _elementSizeObserver.subscribe(element, setSize);
1512
+ }, t1 = [element], $[0] = element, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), react.useEffect(t0, t1), size;
1293
1513
  }
1294
- const DEFAULT_SKELETON_ELEMENT = "div";
1295
- function Skeleton(props) {
1296
- const $ = reactCompilerRuntime.c(17), t0 = props;
1297
- let className, delay, radius, rest, t1;
1298
- $[0] !== t0 ? ({
1299
- animated: t1,
1514
+ function useElementRect(element) {
1515
+ return useElementSize(element)?._contentRect || null;
1516
+ }
1517
+ function useForwardedRef(ref) {
1518
+ const $ = compilerRuntime.c(1), innerRef = react.useRef(null);
1519
+ let t0;
1520
+ return $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => innerRef.current, $[0] = t0) : t0 = $[0], react.useImperativeHandle(ref, t0), innerRef;
1521
+ }
1522
+ const DEFAULT_LABEL_ELEMENT = "div";
1523
+ function Label(props) {
1524
+ const $ = compilerRuntime.c(28);
1525
+ let accent, align, children, className, rest, t0, t1, t2, t3, textOverflowProp;
1526
+ $[0] !== props ? ({
1527
+ accent,
1528
+ align,
1529
+ as: t0,
1530
+ children,
1300
1531
  className,
1301
- delay,
1302
- radius,
1532
+ muted: t1,
1533
+ size: t2,
1534
+ textOverflow: textOverflowProp,
1535
+ weight: t3,
1303
1536
  ...rest
1304
- } = t0, $[0] = t0, $[1] = className, $[2] = delay, $[3] = radius, $[4] = rest, $[5] = t1) : (className = $[1], delay = $[2], radius = $[3], rest = $[4], t1 = $[5]);
1305
- const animated = t1 === void 0 ? !1 : t1, [visible, setVisible] = react.useState(!delay);
1306
- let t2, t3;
1307
- $[6] !== delay ? (t2 = () => {
1308
- if (!delay)
1309
- return setVisible(!0);
1310
- const timeout = setTimeout(() => {
1311
- setVisible(!0);
1312
- }, delay);
1313
- return () => {
1314
- clearTimeout(timeout);
1315
- };
1316
- }, t3 = [delay], $[6] = delay, $[7] = t2, $[8] = t3) : (t2 = $[7], t3 = $[8]), react.useEffect(t2, t3);
1537
+ } = props, $[0] = props, $[1] = accent, $[2] = align, $[3] = children, $[4] = className, $[5] = rest, $[6] = t0, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = textOverflowProp) : (accent = $[1], align = $[2], children = $[3], className = $[4], rest = $[5], t0 = $[6], t1 = $[7], t2 = $[8], t3 = $[9], textOverflowProp = $[10]);
1538
+ const Element2 = t0 === void 0 ? DEFAULT_LABEL_ELEMENT : t0, muted = t1 === void 0 ? !1 : t1, size = t2 === void 0 ? 1 : t2, weight = t3 === void 0 ? "regular" : t3;
1317
1539
  let t4;
1318
- $[9] !== className || $[10] !== radius ? (t4 = css.skeleton({
1540
+ $[11] !== accent || $[12] !== align || $[13] !== className || $[14] !== muted || $[15] !== size || $[16] !== weight ? (t4 = css.label({
1319
1541
  className,
1320
- radius
1321
- }), $[9] = className, $[10] = radius, $[11] = t4) : t4 = $[11];
1322
- const t5 = animated ? "" : void 0, t6 = visible ? "" : void 0;
1542
+ accent,
1543
+ align,
1544
+ muted,
1545
+ size,
1546
+ weight
1547
+ }), $[11] = accent, $[12] = align, $[13] = className, $[14] = muted, $[15] = size, $[16] = weight, $[17] = t4) : t4 = $[17];
1548
+ let t5;
1549
+ $[18] !== textOverflowProp ? (t5 = css.textOverflow({
1550
+ textOverflow: textOverflowProp
1551
+ }), $[18] = textOverflowProp, $[19] = t5) : t5 = $[19];
1552
+ let t6;
1553
+ $[20] !== children || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t5, children }), $[20] = children, $[21] = t5, $[22] = t6) : t6 = $[22];
1323
1554
  let t7;
1324
- return $[12] !== rest || $[13] !== t4 || $[14] !== t5 || $[15] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "Skeleton", ...rest, className: t4, "data-animated": t5, "data-visible": t6 }), $[12] = rest, $[13] = t4, $[14] = t5, $[15] = t6, $[16] = t7) : t7 = $[16], t7;
1555
+ return $[23] !== Element2 || $[24] !== rest || $[25] !== t4 || $[26] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "Label", ...rest, className: t4, children: t6 }), $[23] = Element2, $[24] = rest, $[25] = t4, $[26] = t6, $[27] = t7) : t7 = $[27], t7;
1325
1556
  }
1326
- const DEFAULT_CODE_SKELETON_ELEMENT = "div";
1327
- function CodeSkeleton(props) {
1328
- const $ = reactCompilerRuntime.c(10), t0 = props;
1329
- let className, rest, t1;
1557
+ const DEFAULT_AVATAR_ELEMENT = "span";
1558
+ function Avatar(props) {
1559
+ const $ = compilerRuntime.c(51), t0 = props;
1560
+ let __unstable_hideInnerStroke, animateArrowFrom, arrowPositionProp, className, initials, onImageLoadError, rest, src, t1, t2, t3, t4, title;
1330
1561
  $[0] !== t0 ? ({
1562
+ __unstable_hideInnerStroke,
1563
+ as: t1,
1331
1564
  className,
1332
- size: t1,
1565
+ color: t2,
1566
+ src,
1567
+ title,
1568
+ initials,
1569
+ onImageLoadError,
1570
+ arrowPosition: arrowPositionProp,
1571
+ animateArrowFrom,
1572
+ status: t3,
1573
+ size: t4,
1333
1574
  ...rest
1334
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1335
- const size = t1 === void 0 ? 2 : t1;
1336
- let t2;
1337
- $[4] !== className || $[5] !== size ? (t2 = css.codeSkeleton({
1575
+ } = t0, $[0] = t0, $[1] = __unstable_hideInnerStroke, $[2] = animateArrowFrom, $[3] = arrowPositionProp, $[4] = className, $[5] = initials, $[6] = onImageLoadError, $[7] = rest, $[8] = src, $[9] = t1, $[10] = t2, $[11] = t3, $[12] = t4, $[13] = title) : (__unstable_hideInnerStroke = $[1], animateArrowFrom = $[2], arrowPositionProp = $[3], className = $[4], initials = $[5], onImageLoadError = $[6], rest = $[7], src = $[8], t1 = $[9], t2 = $[10], t3 = $[11], t4 = $[12], title = $[13]);
1576
+ const Element2 = t1 === void 0 ? DEFAULT_AVATAR_ELEMENT : t1, color = t2 === void 0 ? "magenta" : t2, sizeProp = t4 === void 0 ? 1 : t4, size = _visualEditing.useResponsiveProp(sizeProp), [arrowPosition, setArrowPosition] = react.useState(animateArrowFrom || arrowPositionProp || "inside"), [imageError, setImageError] = react.useState(!1);
1577
+ let t5, t6;
1578
+ $[14] !== arrowPosition || $[15] !== arrowPositionProp ? (t5 = () => {
1579
+ if (arrowPosition === arrowPositionProp)
1580
+ return;
1581
+ const raf = requestAnimationFrame(() => setArrowPosition(arrowPositionProp));
1582
+ return () => cancelAnimationFrame(raf);
1583
+ }, t6 = [arrowPosition, arrowPositionProp], $[14] = arrowPosition, $[15] = arrowPositionProp, $[16] = t5, $[17] = t6) : (t5 = $[16], t6 = $[17]), react.useEffect(t5, t6);
1584
+ let t7, t8;
1585
+ $[18] !== src ? (t7 = () => {
1586
+ src && setImageError(!1);
1587
+ }, t8 = [src], $[18] = src, $[19] = t7, $[20] = t8) : (t7 = $[19], t8 = $[20]), react.useEffect(t7, t8);
1588
+ let t9;
1589
+ $[21] !== onImageLoadError ? (t9 = () => {
1590
+ setImageError(!0), onImageLoadError && onImageLoadError(new Error("Avatar: the image failed to load"));
1591
+ }, $[21] = onImageLoadError, $[22] = t9) : t9 = $[22];
1592
+ const handleImageError = t9;
1593
+ let t10, t11;
1594
+ $[23] !== size ? (t11 = Object.values(size).map(_temp$1), $[23] = size, $[24] = t11) : t11 = $[24], t10 = t11;
1595
+ const initialsSize = t10, t12 = __unstable_hideInnerStroke ? "" : void 0;
1596
+ let t13;
1597
+ $[25] !== className || $[26] !== color || $[27] !== sizeProp ? (t13 = css.avatar({
1338
1598
  className,
1339
- size
1340
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
1341
- let t3;
1342
- return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1599
+ color,
1600
+ size: sizeProp
1601
+ }), $[25] = className, $[26] = color, $[27] = sizeProp, $[28] = t13) : t13 = $[28];
1602
+ const t14 = imageError ? "" : void 0;
1603
+ let t15;
1604
+ $[29] === Symbol.for("react.memo_cache_sentinel") ? (t15 = css.avatarArrow(), $[29] = t15) : t15 = $[29];
1605
+ let t16;
1606
+ $[30] !== color ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t15, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "11", height: "7", viewBox: "0 0 11 7", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.67948 1.50115L11 7L0 7L4.32052 1.50115C4.92109 0.736796 6.07891 0.736795 6.67948 1.50115Z", fill: color }) }) }), $[30] = color, $[31] = t16) : t16 = $[31];
1607
+ let t17;
1608
+ $[32] === Symbol.for("react.memo_cache_sentinel") ? (t17 = css.avatarInitials(), $[32] = t17) : t17 = $[32];
1609
+ let t18;
1610
+ $[33] !== initials || $[34] !== initialsSize ? (t18 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { alignItems: "center", as: "span", className: t17, display: "flex", justifyContent: "center", position: "absolute", inset: 0, children: /* @__PURE__ */ jsxRuntime.jsx(Label, { align: "center", as: "span", size: initialsSize, weight: "medium", children: initials }) }), $[33] = initials, $[34] = initialsSize, $[35] = t18) : t18 = $[35];
1611
+ let t19;
1612
+ $[36] !== handleImageError || $[37] !== initials || $[38] !== src ? (t19 = src && /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { className: css.avatarImage(), inset: 0, position: "absolute", children: [
1613
+ /* @__PURE__ */ jsxRuntime.jsx("img", { alt: initials, onError: handleImageError, src }),
1614
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: css.avatarImageOutline() })
1615
+ ] }), $[36] = handleImageError, $[37] = initials, $[38] = src, $[39] = t19) : t19 = $[39];
1616
+ let t20;
1617
+ return $[40] !== Element2 || $[41] !== arrowPosition || $[42] !== rest || $[43] !== t12 || $[44] !== t13 || $[45] !== t14 || $[46] !== t16 || $[47] !== t18 || $[48] !== t19 || $[49] !== title ? (t20 = /* @__PURE__ */ jsxRuntime.jsxs(Element2, { "data-hide-inner-stroke": t12, "data-ui": "Avatar", ...rest, "aria-label": title, className: t13, "data-arrow-position": arrowPosition, "data-image-error": t14, title, children: [
1618
+ t16,
1619
+ t18,
1620
+ t19
1621
+ ] }), $[40] = Element2, $[41] = arrowPosition, $[42] = rest, $[43] = t12, $[44] = t13, $[45] = t14, $[46] = t16, $[47] = t18, $[48] = t19, $[49] = title, $[50] = t20) : t20 = $[50], t20;
1343
1622
  }
1344
- const DEFAULT_HEADING_SKELETON_ELEMENT = "div";
1345
- function HeadingSkeleton(props) {
1346
- const $ = reactCompilerRuntime.c(10), t0 = props;
1347
- let className, rest, t1;
1348
- $[0] !== t0 ? ({
1349
- className,
1350
- size: t1,
1351
- ...rest
1352
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1353
- const size = t1 === void 0 ? 2 : t1;
1354
- let t2;
1355
- $[4] !== className || $[5] !== size ? (t2 = css.headingSkeleton({
1356
- className,
1357
- size
1358
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
1359
- let t3;
1360
- return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1623
+ function _temp$1(s) {
1624
+ return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
1361
1625
  }
1362
- const DEFAULT_LABEL_SKELETON_ELEMENT = "div";
1363
- function LabelSkeleton(props) {
1364
- const $ = reactCompilerRuntime.c(10), t0 = props;
1365
- let className, rest, t1;
1626
+ const DEFAULT_AVATAR_COUNTER_ELEMENT = "span";
1627
+ function AvatarCounter(props) {
1628
+ const $ = compilerRuntime.c(19), t0 = props;
1629
+ let className, count, rest, t1, t2;
1366
1630
  $[0] !== t0 ? ({
1631
+ as: t1,
1367
1632
  className,
1368
- size: t1,
1633
+ count,
1634
+ size: t2,
1369
1635
  ...rest
1370
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1371
- const size = t1 === void 0 ? 2 : t1;
1372
- let t2;
1373
- $[4] !== className || $[5] !== size ? (t2 = css.labelSkeleton({
1636
+ } = t0, $[0] = t0, $[1] = className, $[2] = count, $[3] = rest, $[4] = t1, $[5] = t2) : (className = $[1], count = $[2], rest = $[3], t1 = $[4], t2 = $[5]);
1637
+ const as = t1 === void 0 ? DEFAULT_AVATAR_COUNTER_ELEMENT : t1, size = _visualEditing.useResponsiveProp(t2 === void 0 ? 1 : t2);
1638
+ let t3, t4;
1639
+ $[6] !== size ? (t4 = Object.values(size).map(_temp), $[6] = size, $[7] = t4) : t4 = $[7], t3 = t4;
1640
+ const labelSize = t3;
1641
+ let t5;
1642
+ $[8] !== className || $[9] !== size ? (t5 = css.avatarCounter({
1374
1643
  className,
1375
1644
  size
1376
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
1377
- let t3;
1378
- return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1645
+ }), $[8] = className, $[9] = size, $[10] = t5) : t5 = $[10];
1646
+ let t6;
1647
+ $[11] !== count || $[12] !== labelSize ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(Label, { align: "center", as: "span", size: labelSize, weight: "medium", children: count }), $[11] = count, $[12] = labelSize, $[13] = t6) : t6 = $[13];
1648
+ let t7;
1649
+ return $[14] !== as || $[15] !== rest || $[16] !== t5 || $[17] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "AvatarCounter", ...rest, alignItems: "center", as, className: t5, display: "flex", flex: "none", justifyContent: "center", paddingX: 2, sizing: "border", children: t6 }), $[14] = as, $[15] = rest, $[16] = t5, $[17] = t6, $[18] = t7) : t7 = $[18], t7;
1379
1650
  }
1380
- const DEFAULT_TEXT_SKELETON_ELEMENT = "div";
1381
- function TextSkeleton(props) {
1382
- const $ = reactCompilerRuntime.c(10), t0 = props;
1383
- let className, rest, t1;
1651
+ function _temp(s) {
1652
+ return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
1653
+ }
1654
+ const DEFAULT_AVATAR_STACK_ELEMENT = "span";
1655
+ function AvatarStack(props) {
1656
+ const $ = compilerRuntime.c(20), t0 = props;
1657
+ let childrenProp, className, rest, t1, t2, t3;
1384
1658
  $[0] !== t0 ? ({
1659
+ as: t1,
1660
+ children: childrenProp,
1385
1661
  className,
1386
- size: t1,
1662
+ maxLength: t2,
1663
+ size: t3,
1387
1664
  ...rest
1388
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1389
- const size = t1 === void 0 ? 2 : t1;
1390
- let t2;
1391
- $[4] !== className || $[5] !== size ? (t2 = css.textSkeleton({
1665
+ } = t0, $[0] = t0, $[1] = childrenProp, $[2] = className, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = t3) : (childrenProp = $[1], className = $[2], rest = $[3], t1 = $[4], t2 = $[5], t3 = $[6]);
1666
+ const as = t1 === void 0 ? DEFAULT_AVATAR_STACK_ELEMENT : t1, maxLengthProp = t2 === void 0 ? 4 : t2, sizeProp = t3 === void 0 ? 1 : t3, children = react.Children.toArray(childrenProp).filter(react.isValidElement), maxLength = Math.max(maxLengthProp, 0), size = _visualEditing.useResponsiveProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children, T0 = _visualEditing.Box, t4 = "AvatarStack", t5 = "center";
1667
+ let t6;
1668
+ $[7] !== className || $[8] !== size ? (t6 = css.avatarStack({
1392
1669
  className,
1393
1670
  size
1394
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
1395
- let t3;
1396
- return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1671
+ }), $[7] = className, $[8] = size, $[9] = t6) : t6 = $[9];
1672
+ const t7 = "flex", t8 = "flex-start", t9 = len === 0 && /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: len, size }), t10 = len !== 0 && extraCount > 1 && /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: extraCount, size });
1673
+ let t11;
1674
+ $[10] !== size ? (t11 = (child, childIndex) => /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: react.cloneElement(child, {
1675
+ size
1676
+ }) }, String(childIndex)), $[10] = size, $[11] = t11) : t11 = $[11];
1677
+ const t12 = visibleChildren.map(t11);
1678
+ let t13;
1679
+ return $[12] !== T0 || $[13] !== as || $[14] !== rest || $[15] !== t10 || $[16] !== t12 || $[17] !== t6 || $[18] !== t9 ? (t13 = /* @__PURE__ */ jsxRuntime.jsxs(T0, { "data-ui": t4, ...rest, alignItems: t5, as, className: t6, display: t7, justifyContent: t8, children: [
1680
+ t9,
1681
+ t10,
1682
+ t12
1683
+ ] }), $[12] = T0, $[13] = as, $[14] = rest, $[15] = t10, $[16] = t12, $[17] = t6, $[18] = t9, $[19] = t13) : t13 = $[19], t13;
1397
1684
  }
1398
- const DEFAULT_TAB_PANEL_ELEMENT = "div";
1399
- function TabPanel(props) {
1400
- const $ = reactCompilerRuntime.c(10), t0 = props;
1401
- let children, rest, t1, tabIndex;
1685
+ const DEFAULT_BADGE_ELEMENT = "span";
1686
+ function Badge(props) {
1687
+ const $ = compilerRuntime.c(22), t0 = props;
1688
+ let children, className, rest, t1, t2, t3, t4, t5;
1402
1689
  $[0] !== t0 ? ({
1403
1690
  as: t1,
1404
1691
  children,
1405
- tabIndex,
1692
+ className,
1693
+ fontSize: t2,
1694
+ padding: t3,
1695
+ radius: t4,
1696
+ tone: t5,
1406
1697
  ...rest
1407
- } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1, $[4] = tabIndex) : (children = $[1], rest = $[2], t1 = $[3], tabIndex = $[4]);
1408
- const as = t1 === void 0 ? DEFAULT_TAB_PANEL_ELEMENT : t1, t2 = tabIndex === void 0 ? 0 : tabIndex;
1409
- let t3;
1410
- return $[5] !== as || $[6] !== children || $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "TabPanel", ...rest, as, role: "tabpanel", tabIndex: t2, children }), $[5] = as, $[6] = children, $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1411
- }
1412
- const DEFAULT_TOAST_ELEMENT = "li", ROLES = {
1413
- error: "alert",
1414
- warning: "alert",
1415
- success: "alert",
1416
- info: "alert"
1417
- }, STATUS_CARD_TONE = {
1418
- error: "critical",
1419
- warning: "caution",
1420
- success: "positive",
1421
- info: "neutral"
1422
- }, BUTTON_TONE = {
1423
- error: "critical",
1424
- warning: "caution",
1425
- success: "positive",
1426
- info: "neutral"
1427
- };
1428
- function Toast(props) {
1429
- const $ = reactCompilerRuntime.c(40), t0 = props;
1430
- let closable, description, onClose, rest, status, t1, t2, title;
1431
- if ($[0] !== t0) {
1432
- const {
1433
- as: t32,
1434
- closable: t42,
1435
- description: t52,
1436
- duration,
1437
- onClose: t62,
1438
- radius: t72,
1439
- title: t82,
1440
- status: t92,
1441
- updatedAt,
1442
- ...t102
1443
- } = t0;
1444
- t1 = t32, closable = t42, description = t52, onClose = t62, t2 = t72, title = t82, status = t92, rest = t102, $[0] = t0, $[1] = closable, $[2] = description, $[3] = onClose, $[4] = rest, $[5] = status, $[6] = t1, $[7] = t2, $[8] = title;
1445
- } else
1446
- closable = $[1], description = $[2], onClose = $[3], rest = $[4], status = $[5], t1 = $[6], t2 = $[7], title = $[8];
1447
- const as = t1 === void 0 ? DEFAULT_TOAST_ELEMENT : t1, radius = t2 === void 0 ? 3 : t2, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status", visualDuration = _visualEditing.usePrefersReducedMotion() ? 0 : 0.26;
1448
- let t3;
1449
- $[9] !== visualDuration ? (t3 = visualDuration ? {
1450
- type: "spring",
1451
- visualDuration,
1452
- bounce: 0.25
1453
- } : {
1454
- duration: 0
1455
- }, $[9] = visualDuration, $[10] = t3) : t3 = $[10];
1456
- const transition = t3;
1457
- let t4;
1458
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t4 = ["hidden", "initial"], $[11] = t4) : t4 = $[11];
1459
- const initial = t4;
1460
- let t5;
1461
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t5 = ["visible", "slideIn"], $[12] = t5) : t5 = $[12];
1462
- const animate = t5;
1698
+ } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = t3, $[7] = t4, $[8] = t5) : (children = $[1], className = $[2], rest = $[3], t1 = $[4], t2 = $[5], t3 = $[6], t4 = $[7], t5 = $[8]);
1699
+ const as = t1 === void 0 ? DEFAULT_BADGE_ELEMENT : t1, fontSize = t2 === void 0 ? 1 : t2, padding = t3 === void 0 ? 1 : t3, radius = t4 === void 0 ? 2 : t4, tone = t5 === void 0 ? "default" : t5;
1463
1700
  let t6;
1464
- $[13] === Symbol.for("react.memo_cache_sentinel") ? (t6 = ["hidden", "slideOut"], $[13] = t6) : t6 = $[13];
1465
- const exit = t6;
1701
+ $[9] !== className || $[10] !== tone ? (t6 = css.badge({
1702
+ className,
1703
+ tone
1704
+ }), $[9] = className, $[10] = tone, $[11] = t6) : t6 = $[11];
1466
1705
  let t7;
1467
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t7 = css.toast(), $[14] = t7) : t7 = $[14];
1706
+ $[12] !== children || $[13] !== fontSize ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, children }), $[12] = children, $[13] = fontSize, $[14] = t7) : t7 = $[14];
1468
1707
  let t8;
1469
- $[15] !== title ? (t8 = title && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: 1, weight: "medium", children: title }), $[15] = title, $[16] = t8) : t8 = $[16];
1470
- let t9;
1471
- $[17] !== description || $[18] !== transition ? (t9 = description && /* @__PURE__ */ jsxRuntime.jsx(MotionText, { muted: !0, size: 1, variants: content, transition, children: description }), $[17] = description, $[18] = transition, $[19] = t9) : t9 = $[19];
1472
- let t10;
1473
- $[20] !== t8 || $[21] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Flex, { flex: 1, overflowX: "auto", padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Stack, { gap: 3, children: [
1474
- t8,
1475
- t9
1476
- ] }) }), $[20] = t8, $[21] = t9, $[22] = t10) : t10 = $[22];
1477
- let t11;
1478
- $[23] !== buttonTone || $[24] !== closable || $[25] !== onClose ? (t11 = closable && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { as: "button", icon: icons.CloseIcon, mode: "bleed", padding: 2, tone: buttonTone, onClick: onClose, style: {
1479
- verticalAlign: "top"
1480
- } }) }), $[23] = buttonTone, $[24] = closable, $[25] = onClose, $[26] = t11) : t11 = $[26];
1481
- let t12;
1482
- $[27] !== t10 || $[28] !== t11 || $[29] !== transition ? (t12 = /* @__PURE__ */ jsxRuntime.jsxs(MotionFlex, { align: "flex-start", variants: content, transition, children: [
1483
- t10,
1484
- t11
1485
- ] }), $[27] = t10, $[28] = t11, $[29] = transition, $[30] = t12) : t12 = $[30];
1486
- let t13;
1487
- return $[31] !== as || $[32] !== cardTone || $[33] !== radius || $[34] !== rest || $[35] !== role || $[36] !== t12 || $[37] !== transition || $[38] !== visualDuration ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(MotionCard, { as, className: t7, "data-ui": "Toast", role, ...rest, custom: visualDuration, radius, shadow: 2, tone: cardTone, layout: "position", variants: container, initial, animate, exit, transition, position: "relative", children: t12 }), $[31] = as, $[32] = cardTone, $[33] = radius, $[34] = rest, $[35] = role, $[36] = t12, $[37] = transition, $[38] = visualDuration, $[39] = t13) : t13 = $[39], t13;
1488
- }
1489
- const container = {
1490
- initial: {
1491
- y: 32,
1492
- scale: 0.5,
1493
- zIndex: 1
1494
- },
1495
- hidden: {
1496
- opacity: 0
1497
- },
1498
- visible: (visualDuration) => visualDuration ? {
1499
- opacity: 1,
1500
- transition: {
1501
- when: "beforeChildren",
1502
- staggerChildren: visualDuration / 3,
1503
- duration: visualDuration / 3
1504
- }
1505
- } : {
1506
- opacity: 1
1507
- },
1508
- slideIn: {
1509
- y: 0,
1510
- scale: 1
1511
- },
1512
- slideOut: {
1513
- zIndex: 0,
1514
- scale: 0.75
1515
- }
1516
- }, content = {
1517
- initial: {
1518
- willChange: "transform"
1519
- },
1520
- hidden: {
1521
- opacity: 0
1522
- },
1523
- visible: {
1524
- opacity: 1
1525
- }
1526
- }, MotionCard = framerMotion.motion.create(_visualEditing.Card), MotionFlex = framerMotion.motion.create(_visualEditing.Flex), MotionText = framerMotion.motion.create(_visualEditing.Text);
1527
- function useMounted() {
1528
- return react.useSyncExternalStore(subscribe, _temp$1, _temp2);
1529
- }
1530
- function _temp2() {
1531
- return !1;
1532
- }
1533
- function _temp$1() {
1534
- return !0;
1708
+ return $[15] !== as || $[16] !== padding || $[17] !== radius || $[18] !== rest || $[19] !== t6 || $[20] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "Badge", ...rest, as, className: t6, display: "flex", maxWidth: "fill", padding, radius, width: "min", children: t7 }), $[15] = as, $[16] = padding, $[17] = radius, $[18] = rest, $[19] = t6, $[20] = t7, $[21] = t8) : t8 = $[21], t8;
1535
1709
  }
1536
- const subscribe = () => () => {
1537
- }, ToastContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/toast", null), DEFAULT_TOAST_LAYER_ELEMENT = "ul";
1538
- function ToastLayer(props) {
1539
- const $ = reactCompilerRuntime.c(11), {
1540
- as: t0,
1541
- children,
1542
- padding: t1,
1543
- paddingX,
1544
- paddingY,
1545
- gap: t2
1546
- } = props, as = t0 === void 0 ? DEFAULT_TOAST_LAYER_ELEMENT : t0, padding = t1 === void 0 ? 4 : t1, gap = t2 === void 0 ? 3 : t2, {
1547
- zIndex
1548
- } = _visualEditing.useLayer();
1549
- let t3;
1550
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t3 = css.toastLayer(), $[0] = t3) : t3 = $[0];
1551
- let t4;
1552
- $[1] !== zIndex ? (t4 = {
1553
- zIndex
1554
- }, $[1] = zIndex, $[2] = t4) : t4 = $[2];
1710
+ const DEFAULT_CHECKBOX_ELEMENT = "input";
1711
+ function Checkbox(props) {
1712
+ const $ = compilerRuntime.c(29), t0 = props;
1713
+ let className, customValidity, disabled, forwardedRef, indeterminate, readOnly, rest, style, t1;
1714
+ $[0] !== t0 ? ({
1715
+ as: t1,
1716
+ className,
1717
+ disabled,
1718
+ indeterminate,
1719
+ customValidity,
1720
+ readOnly,
1721
+ ref: forwardedRef,
1722
+ style,
1723
+ ...rest
1724
+ } = t0, $[0] = t0, $[1] = className, $[2] = customValidity, $[3] = disabled, $[4] = forwardedRef, $[5] = indeterminate, $[6] = readOnly, $[7] = rest, $[8] = style, $[9] = t1) : (className = $[1], customValidity = $[2], disabled = $[3], forwardedRef = $[4], indeterminate = $[5], readOnly = $[6], rest = $[7], style = $[8], t1 = $[9]);
1725
+ const Element2 = t1 === void 0 ? DEFAULT_CHECKBOX_ELEMENT : t1, ref = react.useRef(null);
1726
+ let t2;
1727
+ $[10] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[10] = t2) : t2 = $[10], react.useImperativeHandle(forwardedRef, t2);
1728
+ let t3, t4;
1729
+ $[11] !== indeterminate ? (t3 = () => {
1730
+ ref.current && (ref.current.indeterminate = indeterminate || !1);
1731
+ }, t4 = [indeterminate], $[11] = indeterminate, $[12] = t3, $[13] = t4) : (t3 = $[12], t4 = $[13]), react.useEffect(t3, t4), _visualEditing.useCustomValidity(ref, customValidity);
1555
1732
  let t5;
1556
- return $[3] !== as || $[4] !== children || $[5] !== gap || $[6] !== padding || $[7] !== paddingX || $[8] !== paddingY || $[9] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Grid, { as, className: t3, "data-ui": "ToastProvider", padding, paddingX, paddingY, gap, columns: 1, style: t4, children }), $[3] = as, $[4] = children, $[5] = gap, $[6] = padding, $[7] = paddingX, $[8] = paddingY, $[9] = t4, $[10] = t5) : t5 = $[10], t5;
1557
- }
1558
- let toastId = 0;
1559
- function generateToastId() {
1560
- return String(toastId++);
1561
- }
1562
- function ToastProvider(props) {
1563
- const $ = reactCompilerRuntime.c(13), {
1733
+ $[14] !== className ? (t5 = css.checkbox({
1734
+ className
1735
+ }), $[14] = className, $[15] = t5) : t5 = $[15];
1736
+ let t6;
1737
+ $[16] === Symbol.for("react.memo_cache_sentinel") ? (t6 = css.checkboxInput(), $[16] = t6) : t6 = $[16];
1738
+ const t7 = customValidity ? "" : void 0, t8 = !disabled && readOnly ? "" : void 0, t9 = disabled || readOnly;
1739
+ let t10;
1740
+ $[17] !== Element2 || $[18] !== readOnly || $[19] !== rest || $[20] !== t7 || $[21] !== t8 || $[22] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t6, "data-invalid": t7, "data-read-only": t8, disabled: t9, type: "checkbox", readOnly, ref }), $[17] = Element2, $[18] = readOnly, $[19] = rest, $[20] = t7, $[21] = t8, $[22] = t9, $[23] = t10) : t10 = $[23];
1741
+ let t11;
1742
+ $[24] === Symbol.for("react.memo_cache_sentinel") ? (t11 = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: css.checkboxPresentation(), children: [
1743
+ /* @__PURE__ */ jsxRuntime.jsx(icons.CheckmarkIcon, {}),
1744
+ /* @__PURE__ */ jsxRuntime.jsx(icons.RemoveIcon, {})
1745
+ ] }), $[24] = t11) : t11 = $[24];
1746
+ let t12;
1747
+ return $[25] !== style || $[26] !== t10 || $[27] !== t5 ? (t12 = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: t5, "data-ui": "Checkbox", style, children: [
1748
+ t10,
1749
+ t11
1750
+ ] }), $[25] = style, $[26] = t10, $[27] = t5, $[28] = t12) : t12 = $[28], t12;
1751
+ }
1752
+ const LazyRefractor = react.lazy(() => Promise.resolve().then(function() {
1753
+ return require("./_chunks-cjs/refractor.cjs");
1754
+ })), DEFAULT_CODE_ELEMENT = "pre";
1755
+ function Code(props) {
1756
+ const $ = compilerRuntime.c(25), t0 = props;
1757
+ let children, className, languageProp, rest, t1, t2, t3;
1758
+ $[0] !== t0 ? ({
1759
+ as: t1,
1564
1760
  children,
1565
- padding,
1566
- paddingX,
1567
- paddingY,
1568
- gap,
1569
- zOffset: t0
1570
- } = props, zOffset = t0 === void 0 ? 1 : t0;
1571
- let t1;
1572
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
1573
- const [state, setState] = react.useState(t1), mounted = useMounted();
1574
- let t2, t3;
1575
- $[1] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {
1576
- version: 0,
1577
- push: (params) => {
1578
- const id = params.id || generateToastId(), duration = params.duration || 5e3;
1579
- return react.startTransition(() => {
1580
- setState((prevState) => {
1581
- if (duration === 0.01)
1582
- return prevState.filter((toast) => toast.id !== id);
1583
- const dismiss = () => react.startTransition(() => setState((currentState) => currentState.filter((toast_0) => toast_0.id !== id)));
1584
- return [...prevState.filter((toast_1) => toast_1.id !== id), {
1585
- dismiss,
1586
- id,
1587
- updatedAt: Date.now(),
1588
- params: {
1589
- ...params,
1590
- duration
1591
- }
1592
- }];
1593
- });
1594
- }), id;
1595
- }
1596
- }, $[1] = t3) : t3 = $[1], t2 = t3;
1597
- const value = t2;
1761
+ className,
1762
+ language: languageProp,
1763
+ size: t2,
1764
+ weight: t3,
1765
+ ...rest
1766
+ } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = languageProp, $[4] = rest, $[5] = t1, $[6] = t2, $[7] = t3) : (children = $[1], className = $[2], languageProp = $[3], rest = $[4], t1 = $[5], t2 = $[6], t3 = $[7]);
1767
+ const Element2 = t1 === void 0 ? DEFAULT_CODE_ELEMENT : t1, size = t2 === void 0 ? 2 : t2, weight = t3 === void 0 ? "regular" : t3, language = typeof languageProp == "string" ? languageProp : void 0;
1598
1768
  let t4;
1599
- $[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t4 = mounted && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: !1, mode: "popLayout", children: state.map(_temp) }) }) }), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t4) : t4 = $[9];
1769
+ $[8] !== className || $[9] !== size || $[10] !== weight ? (t4 = css.code({
1770
+ className,
1771
+ size,
1772
+ weight
1773
+ }), $[8] = className, $[9] = size, $[10] = weight, $[11] = t4) : t4 = $[11];
1600
1774
  let t5;
1601
- return $[10] !== children || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
1602
- children,
1603
- t4
1604
- ] }), $[10] = children, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
1605
- }
1606
- function _temp(t0) {
1607
- const {
1608
- dismiss: dismiss_0,
1609
- id: id_0,
1610
- params: params_0,
1611
- updatedAt
1612
- } = t0;
1613
- return /* @__PURE__ */ jsxRuntime.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);
1614
- }
1615
- function useToast() {
1616
- const value = react.useContext(ToastContext);
1617
- if (!value)
1618
- throw new Error("useToast(): missing context value");
1619
- if (!_visualEditing.isRecord(value) || value.version !== 0)
1620
- throw new Error("useToast(): the context value is not compatible");
1621
- return value;
1622
- }
1623
- function _findPrevItemElement(state, itemElements, focusedElement) {
1624
- const idx = itemElements.indexOf(focusedElement), els = itemElements.slice(0, idx), len = els.length;
1625
- for (let i = len - 1; i >= 0; i -= 1) {
1626
- const itemKey = els[i].getAttribute("data-tree-key");
1627
- if (!itemKey)
1628
- continue;
1629
- const segments = itemKey.split("/");
1630
- segments.pop();
1631
- const p = [];
1632
- let expanded = !0;
1633
- for (let j = 0; j < segments.length; j += 1) {
1634
- p.push(segments[j]);
1635
- const k = p.join("/");
1636
- if (!state[k]?.expanded) {
1637
- expanded = !1;
1638
- break;
1639
- }
1640
- }
1641
- if (expanded)
1642
- return els[i];
1643
- }
1644
- return null;
1645
- }
1646
- function _findNextItemElement(state, itemElements, focusedElement) {
1647
- const idx = itemElements.indexOf(focusedElement), els = itemElements.slice(idx), len = itemElements.length;
1648
- for (let i = 1; i < len; i += 1) {
1649
- if (!els[i])
1650
- continue;
1651
- const itemKey = els[i].getAttribute("data-tree-key");
1652
- if (!itemKey)
1653
- continue;
1654
- const segments = itemKey.split("/");
1655
- segments.pop();
1656
- const p = [];
1657
- let expanded = !0;
1658
- for (let j = 0; j < segments.length; j += 1) {
1659
- p.push(segments[j]);
1660
- const k = p.join("/");
1661
- if (!state[k]?.expanded) {
1662
- expanded = !1;
1663
- break;
1664
- }
1665
- }
1666
- if (expanded)
1667
- return els[i];
1668
- }
1669
- return null;
1775
+ $[12] !== children ? (t5 = /* @__PURE__ */ jsxRuntime.jsx("code", { children }), $[12] = children, $[13] = t5) : t5 = $[13];
1776
+ let t6;
1777
+ $[14] !== children || $[15] !== language ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(LazyRefractor, { language, value: children }), $[14] = children, $[15] = language, $[16] = t6) : t6 = $[16];
1778
+ let t7;
1779
+ $[17] !== t5 || $[18] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: t5, children: t6 }), $[17] = t5, $[18] = t6, $[19] = t7) : t7 = $[19];
1780
+ let t8;
1781
+ return $[20] !== Element2 || $[21] !== rest || $[22] !== t4 || $[23] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "Code", ...rest, className: t4, children: t7 }), $[20] = Element2, $[21] = rest, $[22] = t4, $[23] = t7, $[24] = t8) : t8 = $[24], t8;
1670
1782
  }
1671
- function _focusItemElement(el) {
1672
- if (el.getAttribute("role") === "treeitem" && el.focus(), el.getAttribute("role") === "none") {
1673
- const firstChild = el.firstChild;
1674
- firstChild && firstChild instanceof HTMLElement && firstChild.focus();
1675
- }
1783
+ const DEFAULT_HEADING_ELEMENT = "div";
1784
+ function Heading(props) {
1785
+ const $ = compilerRuntime.c(30), t0 = props;
1786
+ let align, children, className, flex, rest, t1, t2, t3, t4, t5, textOverflowProp;
1787
+ $[0] !== t0 ? ({
1788
+ accent: t1,
1789
+ align,
1790
+ as: t2,
1791
+ children,
1792
+ className,
1793
+ flex,
1794
+ muted: t3,
1795
+ size: t4,
1796
+ textOverflow: textOverflowProp,
1797
+ weight: t5,
1798
+ ...rest
1799
+ } = t0, $[0] = t0, $[1] = align, $[2] = children, $[3] = className, $[4] = flex, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3, $[9] = t4, $[10] = t5, $[11] = textOverflowProp) : (align = $[1], children = $[2], className = $[3], flex = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8], t4 = $[9], t5 = $[10], textOverflowProp = $[11]);
1800
+ const accent = t1 === void 0 ? !1 : t1, Element2 = t2 === void 0 ? DEFAULT_HEADING_ELEMENT : t2, muted = t3 === void 0 ? !1 : t3, size = t4 === void 0 ? 2 : t4, weight = t5 === void 0 ? "regular" : t5;
1801
+ let t6;
1802
+ $[12] !== accent || $[13] !== align || $[14] !== className || $[15] !== flex || $[16] !== muted || $[17] !== size || $[18] !== weight ? (t6 = css.heading({
1803
+ className,
1804
+ accent,
1805
+ align,
1806
+ flex,
1807
+ muted,
1808
+ size,
1809
+ weight
1810
+ }), $[12] = accent, $[13] = align, $[14] = className, $[15] = flex, $[16] = muted, $[17] = size, $[18] = weight, $[19] = t6) : t6 = $[19];
1811
+ let t7;
1812
+ $[20] !== textOverflowProp ? (t7 = css.textOverflow({
1813
+ textOverflow: textOverflowProp
1814
+ }), $[20] = textOverflowProp, $[21] = t7) : t7 = $[21];
1815
+ let t8;
1816
+ $[22] !== children || $[23] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t7, children }), $[22] = children, $[23] = t7, $[24] = t8) : t8 = $[24];
1817
+ let t9;
1818
+ return $[25] !== Element2 || $[26] !== rest || $[27] !== t6 || $[28] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "Heading", ...rest, className: t6, children: t8 }), $[25] = Element2, $[26] = rest, $[27] = t6, $[28] = t8, $[29] = t9) : t9 = $[29], t9;
1676
1819
  }
1677
- const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/tree", null), DEFAULT_TREE_ELEMENT = "div";
1678
- function Tree(props) {
1679
- const $ = reactCompilerRuntime.c(39), t0 = props;
1680
- let children, forwardedRef, gap, onFocus, rest, t1;
1820
+ const DEFAULT_INLINE_ELEMENT = "div";
1821
+ function Inline(props) {
1822
+ const $ = compilerRuntime.c(11), t0 = props;
1823
+ let children, gap, rest, space, t1;
1681
1824
  $[0] !== t0 ? ({
1825
+ as: t1,
1682
1826
  children,
1683
1827
  gap,
1684
- space: t1,
1685
- onFocus,
1828
+ space,
1829
+ ...rest
1830
+ } = t0, $[0] = t0, $[1] = children, $[2] = gap, $[3] = rest, $[4] = space, $[5] = t1) : (children = $[1], gap = $[2], rest = $[3], space = $[4], t1 = $[5]);
1831
+ const as = t1 === void 0 ? DEFAULT_INLINE_ELEMENT : t1, t2 = gap ?? space;
1832
+ let t3;
1833
+ return $[6] !== as || $[7] !== children || $[8] !== rest || $[9] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "Inline", ...rest, alignItems: "center", as, display: "flex", gap: t2, flexWrap: "wrap", children }), $[6] = as, $[7] = children, $[8] = rest, $[9] = t2, $[10] = t3) : t3 = $[10], t3;
1834
+ }
1835
+ const DEFAULT_RADIO_ELEMENT = "input";
1836
+ function Radio(props) {
1837
+ const $ = compilerRuntime.c(25), t0 = props;
1838
+ let className, customValidity, disabled, forwardedRef, readOnly, rest, style, t1;
1839
+ $[0] !== t0 ? ({
1840
+ as: t1,
1841
+ className,
1842
+ disabled,
1843
+ style,
1844
+ customValidity,
1845
+ readOnly,
1686
1846
  ref: forwardedRef,
1687
1847
  ...rest
1688
- } = t0, $[0] = t0, $[1] = children, $[2] = forwardedRef, $[3] = gap, $[4] = onFocus, $[5] = rest, $[6] = t1) : (children = $[1], forwardedRef = $[2], gap = $[3], onFocus = $[4], rest = $[5], t1 = $[6]);
1689
- const space = t1 === void 0 ? 1 : t1, ref = react.useRef(null), [focusedElement, setFocusedElement] = react.useState(null), focusedElementRef = react.useRef(focusedElement);
1690
- let t2, t3;
1691
- $[7] === Symbol.for("react.memo_cache_sentinel") ? (t3 = [], $[7] = t3) : t3 = $[7], t2 = t3;
1692
- const path = t2;
1848
+ } = t0, $[0] = t0, $[1] = className, $[2] = customValidity, $[3] = disabled, $[4] = forwardedRef, $[5] = readOnly, $[6] = rest, $[7] = style, $[8] = t1) : (className = $[1], customValidity = $[2], disabled = $[3], forwardedRef = $[4], readOnly = $[5], rest = $[6], style = $[7], t1 = $[8]);
1849
+ const Element2 = t1 === void 0 ? DEFAULT_RADIO_ELEMENT : t1, ref = react.useRef(null);
1850
+ let t2;
1851
+ $[9] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[9] = t2) : t2 = $[9], react.useImperativeHandle(forwardedRef, t2), _visualEditing.useCustomValidity(ref, customValidity);
1852
+ let t3;
1853
+ $[10] !== className ? (t3 = css.radio({
1854
+ className
1855
+ }), $[10] = className, $[11] = t3) : t3 = $[11];
1693
1856
  let t4;
1694
- $[8] === Symbol.for("react.memo_cache_sentinel") ? (t4 = [], $[8] = t4) : t4 = $[8];
1695
- const [itemElements, setItemElements] = react.useState(t4);
1696
- let t5;
1697
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t5 = {}, $[9] = t5) : t5 = $[9];
1698
- const [state, setState] = react.useState(t5), stateRef = react.useRef(state);
1699
- let t6;
1700
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[10] = t6) : t6 = $[10], react.useImperativeHandle(forwardedRef, t6);
1701
- let t7, t8;
1702
- $[11] !== focusedElement ? (t7 = () => {
1703
- focusedElementRef.current = focusedElement;
1704
- }, t8 = [focusedElement], $[11] = focusedElement, $[12] = t7, $[13] = t8) : (t7 = $[12], t8 = $[13]), react.useEffect(t7, t8);
1705
- let t10, t9;
1706
- $[14] !== state ? (t9 = () => {
1707
- stateRef.current = state;
1708
- }, t10 = [state], $[14] = state, $[15] = t10, $[16] = t9) : (t10 = $[15], t9 = $[16]), react.useEffect(t9, t10);
1709
- let t11;
1710
- $[17] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (element, path_0, expanded, selected) => (setState((s) => ({
1711
- ...s,
1712
- [path_0]: {
1713
- element,
1714
- expanded
1715
- }
1716
- })), selected && setFocusedElement(element), () => {
1717
- setState((s_0) => {
1718
- const newState = {
1719
- ...s_0
1720
- };
1721
- return delete newState[path_0], newState;
1722
- });
1723
- }), $[17] = t11) : t11 = $[17];
1724
- const registerItem = t11;
1857
+ $[12] === Symbol.for("react.memo_cache_sentinel") ? (t4 = css.radioInput(), $[12] = t4) : t4 = $[12];
1858
+ const t5 = customValidity ? "" : void 0, t6 = !disabled && readOnly ? "" : void 0, t7 = disabled || readOnly;
1859
+ let t8;
1860
+ $[13] !== Element2 || $[14] !== readOnly || $[15] !== rest || $[16] !== t5 || $[17] !== t6 || $[18] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t4, "data-invalid": t5, "data-read-only": t6, disabled: t7, readOnly, ref, type: "radio" }), $[13] = Element2, $[14] = readOnly, $[15] = rest, $[16] = t5, $[17] = t6, $[18] = t7, $[19] = t8) : t8 = $[19];
1861
+ let t9;
1862
+ $[20] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: css.radioPresentation() }), $[20] = t9) : t9 = $[20];
1863
+ let t10;
1864
+ return $[21] !== style || $[22] !== t3 || $[23] !== t8 ? (t10 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t3, "data-ui": "Radio", style, children: [
1865
+ t8,
1866
+ t9
1867
+ ] }), $[21] = style, $[22] = t3, $[23] = t8, $[24] = t10) : t10 = $[24], t10;
1868
+ }
1869
+ const DEFAULT_SELECT_ELEMENT = "select";
1870
+ function Select(props) {
1871
+ const $ = compilerRuntime.c(38), t0 = props;
1872
+ let children, customValidity, disabled, forwardedRef, gap, readOnly, rest, t1, t2, t3, t4, t5, t6;
1873
+ $[0] !== t0 ? ({
1874
+ as: t1,
1875
+ border: t2,
1876
+ children,
1877
+ customValidity,
1878
+ disabled,
1879
+ fontSize: t3,
1880
+ gap,
1881
+ padding: t4,
1882
+ radius: t5,
1883
+ readOnly,
1884
+ ref: forwardedRef,
1885
+ space: t6,
1886
+ ...rest
1887
+ } = t0, $[0] = t0, $[1] = children, $[2] = customValidity, $[3] = disabled, $[4] = forwardedRef, $[5] = gap, $[6] = readOnly, $[7] = rest, $[8] = t1, $[9] = t2, $[10] = t3, $[11] = t4, $[12] = t5, $[13] = t6) : (children = $[1], customValidity = $[2], disabled = $[3], forwardedRef = $[4], gap = $[5], readOnly = $[6], rest = $[7], t1 = $[8], t2 = $[9], t3 = $[10], t4 = $[11], t5 = $[12], t6 = $[13]);
1888
+ const Element2 = t1 === void 0 ? DEFAULT_SELECT_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, fontSize = t3 === void 0 ? 2 : t3, padding = t4 === void 0 ? 3 : t4, radius = t5 === void 0 ? 1 : t5, space = t6 === void 0 ? 2 : t6, ref = react.useRef(null);
1889
+ let t7;
1890
+ $[14] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[14] = t7) : t7 = $[14], react.useImperativeHandle(forwardedRef, t7), _visualEditing.useCustomValidity(ref, customValidity);
1891
+ const t8 = gap ?? space;
1892
+ let t9;
1893
+ $[15] !== border || $[16] !== fontSize || $[17] !== padding || $[18] !== radius || $[19] !== t8 ? (t9 = css.select({
1894
+ border,
1895
+ fontSize,
1896
+ padding,
1897
+ radius,
1898
+ gap: t8
1899
+ }), $[15] = border, $[16] = fontSize, $[17] = padding, $[18] = radius, $[19] = t8, $[20] = t9) : t9 = $[20];
1900
+ let t10;
1901
+ $[21] === Symbol.for("react.memo_cache_sentinel") ? (t10 = css._inputElement(), $[21] = t10) : t10 = $[21];
1902
+ const t11 = disabled || readOnly;
1725
1903
  let t12;
1726
- $[18] === Symbol.for("react.memo_cache_sentinel") ? (t12 = (path_1, expanded_0) => {
1727
- setState((s_1) => {
1728
- const itemState = s_1[path_1];
1729
- return itemState ? {
1730
- ...s_1,
1731
- [path_1]: {
1732
- ...itemState,
1733
- expanded: expanded_0
1734
- }
1735
- } : s_1;
1736
- });
1737
- }, $[18] = t12) : t12 = $[18];
1738
- const setExpanded = t12;
1904
+ $[22] !== Element2 || $[23] !== children || $[24] !== rest || $[25] !== t11 ? (t12 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t10, disabled: t11, ref, children }), $[22] = Element2, $[23] = children, $[24] = rest, $[25] = t11, $[26] = t12) : t12 = $[26];
1739
1905
  let t13;
1740
- const t14 = focusedElement || itemElements[0] || null;
1906
+ $[27] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css.selectPresentation(), $[27] = t13) : t13 = $[27];
1907
+ let t14;
1908
+ $[28] === Symbol.for("react.memo_cache_sentinel") ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDownIcon, {}), $[28] = t14) : t14 = $[28];
1741
1909
  let t15;
1742
- $[19] !== space || $[20] !== state || $[21] !== t14 ? (t15 = {
1743
- version: 0,
1744
- focusedElement: t14,
1745
- level: 0,
1746
- path,
1747
- registerItem,
1748
- setExpanded,
1749
- setFocusedElement,
1750
- space,
1751
- state
1752
- }, $[19] = space, $[20] = state, $[21] = t14, $[22] = t15) : t15 = $[22], t13 = t15;
1753
- const contextValue = t13;
1910
+ $[29] !== fontSize ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, children: t14 }), $[29] = fontSize, $[30] = t15) : t15 = $[30];
1754
1911
  let t16;
1755
- $[23] !== itemElements ? (t16 = (event) => {
1756
- if (focusedElementRef.current) {
1757
- if (event.key === "ArrowDown") {
1758
- event.preventDefault();
1759
- const nextEl = _findNextItemElement(stateRef.current, itemElements, focusedElementRef.current);
1760
- nextEl && (_focusItemElement(nextEl), setFocusedElement(nextEl));
1761
- return;
1762
- }
1763
- if (event.key === "ArrowUp") {
1764
- event.preventDefault();
1765
- const prevEl = _findPrevItemElement(stateRef.current, itemElements, focusedElementRef.current);
1766
- prevEl && (_focusItemElement(prevEl), setFocusedElement(prevEl));
1767
- return;
1768
- }
1769
- if (event.key === "ArrowLeft") {
1770
- event.preventDefault();
1771
- const itemKey = focusedElementRef.current.getAttribute("data-tree-key");
1772
- if (!itemKey)
1773
- return;
1774
- const itemState_0 = stateRef.current[itemKey];
1775
- if (!itemState_0)
1776
- return;
1777
- if (itemState_0.expanded)
1778
- setState((s_2) => {
1779
- const itemState_1 = s_2[itemKey];
1780
- return itemState_1 ? {
1781
- ...s_2,
1782
- [itemKey]: {
1783
- ...itemState_1,
1784
- expanded: !1
1785
- }
1786
- } : s_2;
1787
- });
1788
- else {
1789
- const itemPath = itemKey.split("/");
1790
- itemPath.pop();
1791
- const parentKey = itemPath.join("/"), parentState = parentKey && stateRef.current[parentKey];
1792
- parentState && (parentState.element.focus(), setFocusedElement(parentState.element));
1793
- }
1794
- return;
1795
- }
1796
- if (event.key === "ArrowRight") {
1797
- event.preventDefault();
1798
- const focusedKey = focusedElementRef.current.getAttribute("data-tree-key");
1799
- if (!focusedKey)
1800
- return;
1801
- stateRef.current[focusedKey]?.expanded || setState((s_3) => {
1802
- const itemState_2 = s_3[focusedKey];
1803
- return itemState_2 ? {
1804
- ...s_3,
1805
- [focusedKey]: {
1806
- ...itemState_2,
1807
- expanded: !0
1808
- }
1809
- } : s_3;
1810
- });
1811
- return;
1812
- }
1813
- }
1814
- }, $[23] = itemElements, $[24] = t16) : t16 = $[24];
1815
- const handleKeyDown = t16;
1912
+ $[31] !== padding || $[32] !== t15 ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t13, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { as: "span", display: "inline-block", padding, children: t15 }) }), $[31] = padding, $[32] = t15, $[33] = t16) : t16 = $[33];
1816
1913
  let t17;
1817
- $[25] !== onFocus ? (t17 = (event_0) => {
1818
- setFocusedElement(event_0.target), onFocus?.(event_0);
1819
- }, $[25] = onFocus, $[26] = t17) : t17 = $[26];
1820
- const handleFocus = t17;
1821
- let t18;
1822
- $[27] === Symbol.for("react.memo_cache_sentinel") ? (t18 = () => {
1823
- if (!ref.current)
1824
- return;
1825
- const _itemElements = Array.from(ref.current.querySelectorAll('[data-ui="TreeItem"]'));
1826
- setItemElements(_itemElements);
1827
- }, $[27] = t18) : t18 = $[27];
1828
- let t19;
1829
- $[28] !== children ? (t19 = [children], $[28] = children, $[29] = t19) : t19 = $[29], react.useEffect(t18, t19);
1830
- const t20 = gap ?? space;
1831
- let t21;
1832
- $[30] !== children || $[31] !== handleFocus || $[32] !== handleKeyDown || $[33] !== rest || $[34] !== t20 ? (t21 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "Tree", ...rest, gap: t20, onFocus: handleFocus, onKeyDown: handleKeyDown, ref, role: "tree", children }), $[30] = children, $[31] = handleFocus, $[32] = handleKeyDown, $[33] = rest, $[34] = t20, $[35] = t21) : t21 = $[35];
1833
- let t22;
1834
- return $[36] !== contextValue || $[37] !== t21 ? (t22 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t21 }), $[36] = contextValue, $[37] = t21, $[38] = t22) : t22 = $[38], t22;
1914
+ return $[34] !== t12 || $[35] !== t16 || $[36] !== t9 ? (t17 = /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-ui": "Select", className: t9, "data-icon-right": "", children: [
1915
+ t12,
1916
+ t16
1917
+ ] }), $[34] = t12, $[35] = t16, $[36] = t9, $[37] = t17) : t17 = $[37], t17;
1835
1918
  }
1836
- function useTree() {
1837
- const tree = react.useContext(TreeContext);
1838
- if (!tree)
1839
- throw new Error("Tree: missing context value");
1840
- return tree;
1919
+ const DEFAULT_SKELETON_ELEMENT = "div";
1920
+ function Skeleton(props) {
1921
+ const $ = compilerRuntime.c(19), t0 = props;
1922
+ let className, delay, radius, rest, t1, t2;
1923
+ $[0] !== t0 ? ({
1924
+ as: t1,
1925
+ animated: t2,
1926
+ className,
1927
+ delay,
1928
+ radius,
1929
+ ...rest
1930
+ } = t0, $[0] = t0, $[1] = className, $[2] = delay, $[3] = radius, $[4] = rest, $[5] = t1, $[6] = t2) : (className = $[1], delay = $[2], radius = $[3], rest = $[4], t1 = $[5], t2 = $[6]);
1931
+ const As = t1 === void 0 ? DEFAULT_SKELETON_ELEMENT : t1, animated = t2 === void 0 ? !1 : t2, [visible, setVisible] = react.useState(!delay);
1932
+ let t3, t4;
1933
+ $[7] !== delay ? (t3 = () => {
1934
+ if (!delay)
1935
+ return setVisible(!0);
1936
+ const timeout = setTimeout(() => {
1937
+ setVisible(!0);
1938
+ }, delay);
1939
+ return () => {
1940
+ clearTimeout(timeout);
1941
+ };
1942
+ }, t4 = [delay], $[7] = delay, $[8] = t3, $[9] = t4) : (t3 = $[8], t4 = $[9]), react.useEffect(t3, t4);
1943
+ let t5;
1944
+ $[10] !== className || $[11] !== radius ? (t5 = css.skeleton({
1945
+ className,
1946
+ radius
1947
+ }), $[10] = className, $[11] = radius, $[12] = t5) : t5 = $[12];
1948
+ const t6 = animated ? "" : void 0, t7 = visible ? "" : void 0;
1949
+ let t8;
1950
+ return $[13] !== As || $[14] !== rest || $[15] !== t5 || $[16] !== t6 || $[17] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(As, { "data-ui": "Skeleton", ...rest, className: t5, "data-animated": t6, "data-visible": t7 }), $[13] = As, $[14] = rest, $[15] = t5, $[16] = t6, $[17] = t7, $[18] = t8) : t8 = $[18], t8;
1841
1951
  }
1842
- const TreeGroup = react.memo(function(props) {
1843
- const $ = reactCompilerRuntime.c(9), t0 = props;
1844
- let children, rest, t1;
1952
+ const DEFAULT_CODE_SKELETON_ELEMENT = "div";
1953
+ function CodeSkeleton(props) {
1954
+ const $ = compilerRuntime.c(10), t0 = props;
1955
+ let className, rest, t1;
1845
1956
  $[0] !== t0 ? ({
1846
- children,
1847
- expanded: t1,
1957
+ className,
1958
+ size: t1,
1848
1959
  ...rest
1849
- } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1) : (children = $[1], rest = $[2], t1 = $[3]);
1850
- const expanded = t1 === void 0 ? !1 : t1, tree = useTree(), t2 = !expanded;
1960
+ } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1961
+ const size = t1 === void 0 ? 2 : t1;
1962
+ let t2;
1963
+ $[4] !== className || $[5] !== size ? (t2 = css.codeSkeleton({
1964
+ className,
1965
+ size
1966
+ }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
1851
1967
  let t3;
1852
- return $[4] !== children || $[5] !== rest || $[6] !== t2 || $[7] !== tree.space ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "TreeGroup", ...rest, hidden: t2, marginTop: tree.space, role: "group", gap: tree.space, children }), $[4] = children, $[5] = rest, $[6] = t2, $[7] = tree.space, $[8] = t3) : t3 = $[8], t3;
1853
- }), DEFAULT_TREE_ITEM_ELEMENT = "a";
1854
- function TreeItem(props) {
1855
- const {
1968
+ return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1969
+ }
1970
+ const DEFAULT_HEADING_SKELETON_ELEMENT = "div";
1971
+ function HeadingSkeleton(props) {
1972
+ const $ = compilerRuntime.c(10), t0 = props;
1973
+ let className, rest, t1;
1974
+ $[0] !== t0 ? ({
1975
+ className,
1976
+ size: t1,
1977
+ ...rest
1978
+ } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1979
+ const size = t1 === void 0 ? 2 : t1;
1980
+ let t2;
1981
+ $[4] !== className || $[5] !== size ? (t2 = css.headingSkeleton({
1982
+ className,
1983
+ size
1984
+ }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
1985
+ let t3;
1986
+ return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1987
+ }
1988
+ const DEFAULT_LABEL_SKELETON_ELEMENT = "div";
1989
+ function LabelSkeleton(props) {
1990
+ const $ = compilerRuntime.c(10), t0 = props;
1991
+ let className, rest, t1;
1992
+ $[0] !== t0 ? ({
1993
+ className,
1994
+ size: t1,
1995
+ ...rest
1996
+ } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1997
+ const size = t1 === void 0 ? 2 : t1;
1998
+ let t2;
1999
+ $[4] !== className || $[5] !== size ? (t2 = css.labelSkeleton({
2000
+ className,
2001
+ size
2002
+ }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
2003
+ let t3;
2004
+ return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
2005
+ }
2006
+ const DEFAULT_TEXT_SKELETON_ELEMENT = "div";
2007
+ function TextSkeleton(props) {
2008
+ const $ = compilerRuntime.c(10), t0 = props;
2009
+ let className, rest, t1;
2010
+ $[0] !== t0 ? ({
2011
+ className,
2012
+ size: t1,
2013
+ ...rest
2014
+ } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
2015
+ const size = t1 === void 0 ? 2 : t1;
2016
+ let t2;
2017
+ $[4] !== className || $[5] !== size ? (t2 = css.textSkeleton({
2018
+ className,
2019
+ size
2020
+ }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
2021
+ let t3;
2022
+ return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
2023
+ }
2024
+ const DEFAULT_SR_ONLY_ELEMENT = "span";
2025
+ function SrOnly(props) {
2026
+ const $ = compilerRuntime.c(12), t0 = props;
2027
+ let children, className, rest, t1;
2028
+ $[0] !== t0 ? ({
2029
+ as: t1,
1856
2030
  children,
1857
2031
  className,
1858
- expanded: expandedProp = !1,
1859
- fontSize = 1,
1860
- href,
1861
- icon: IconComponent,
1862
- id: idProp,
1863
- linkAs = "a",
1864
- muted,
1865
- onClick,
1866
- padding = 2,
1867
- radius = 2,
1868
- selected = !1,
1869
- space = 2,
1870
- text,
1871
- weight,
1872
2032
  ...rest
1873
- } = props, rootRef = react.useRef(null), treeitemRef = react.useRef(null), tree = useTree(), {
1874
- path,
1875
- registerItem,
1876
- setExpanded,
1877
- setFocusedElement
1878
- } = tree, _id = react.useId(), id = idProp || _id, itemPath = react.useMemo(() => path.concat([id || ""]), [id, path]), itemKey = itemPath.join("/"), itemState = tree.state[itemKey], focused = tree.focusedElement === rootRef.current, expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, tabIndex = tree.focusedElement && tree.focusedElement === rootRef.current ? 0 : -1, contextValue = react.useMemo(() => ({
1879
- ...tree,
1880
- level: tree.level + 1,
1881
- path: itemPath
1882
- }), [itemPath, tree]), handleClick = react.useCallback((event) => {
1883
- onClick && onClick(event);
1884
- const target = event.target;
1885
- target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootRef.current));
1886
- }, [expanded, itemKey, onClick, setExpanded, setFocusedElement]), handleKeyDown = react.useCallback((event_0) => {
1887
- focused && event_0.key === "Enter" && (treeitemRef.current || rootRef.current)?.click();
1888
- }, [focused]);
1889
- react.useEffect(() => {
1890
- if (rootRef.current)
1891
- return registerItem(rootRef.current, itemPath.join("/"), expanded, selected);
1892
- }, [expanded, itemPath, registerItem, selected]);
1893
- const content2 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { gap: space, padding, children: [
1894
- /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { style: {
1895
- visibility: IconComponent || children ? "visible" : "hidden",
1896
- pointerEvents: "none"
1897
- }, children: [
1898
- IconComponent && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {}) }),
1899
- !IconComponent && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ToggleArrowRightIcon, { style: {
1900
- transform: expanded ? "rotate(90deg)" : void 0
1901
- } }) })
1902
- ] }),
1903
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text }) })
1904
- ] });
1905
- return href ? /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { "data-selected": selected ? "" : void 0, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...rest, as: "li", className: css.treeItem({
1906
- className
1907
- }), onClick: handleClick, ref: rootRef, role: "none", children: [
1908
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Selectable, { "aria-expanded": expanded, as: linkAs, "data-pressed": selected ? "" : void 0, "data-ui": "TreeItem__box", href, radius, ref: treeitemRef, role: "treeitem", tabIndex, style: {
1909
- paddingLeft: `calc(${css.vars.space[2]} * ${tree.level})`
1910
- }, children: content2 }),
1911
- /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { hidden: !expanded, children }) })
1912
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { "data-selected": selected ? "" : void 0, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...rest, "aria-expanded": expanded, className: css.treeItem({
2033
+ } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = rest, $[4] = t1) : (children = $[1], className = $[2], rest = $[3], t1 = $[4]);
2034
+ const Element2 = t1 === void 0 ? DEFAULT_SR_ONLY_ELEMENT : t1;
2035
+ let t2;
2036
+ $[5] !== className ? (t2 = css.srOnly({
1913
2037
  className
1914
- }), onClick: handleClick, onKeyDown: handleKeyDown, ref: rootRef, role: "treeitem", tabIndex, children: [
1915
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Selectable, { as: "button", "data-pressed": selected ? "" : void 0, "data-ui": "TreeItem__box", radius, style: {
1916
- paddingLeft: `calc(${css.vars.space[2]} * ${tree.level})`
1917
- }, children: content2 }),
1918
- /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { expanded, children }) })
1919
- ] });
2038
+ }), $[5] = className, $[6] = t2) : t2 = $[6];
2039
+ let t3;
2040
+ return $[7] !== Element2 || $[8] !== children || $[9] !== rest || $[10] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "SrOnly", ...rest, "aria-hidden": !0, className: t2, children }), $[7] = Element2, $[8] = children, $[9] = rest, $[10] = t2, $[11] = t3) : t3 = $[11], t3;
1920
2041
  }
1921
- const DEFAULT_VIRTUAL_LIST_ELEMENT = "div";
1922
- function VirtualList(props) {
1923
- const $ = reactCompilerRuntime.c(58), t0 = props;
1924
- let forwardedRef, getItemKey, onChange, renderItem, rest, t1, t2, t3;
2042
+ const DEFAULT_SWITCH_ELEMENT = "input";
2043
+ function Switch(props) {
2044
+ const $ = compilerRuntime.c(26), t0 = props;
2045
+ let className, disabled, forwardedRef, indeterminate, readOnly, rest, style, t1;
1925
2046
  $[0] !== t0 ? ({
1926
2047
  as: t1,
1927
- gap: t2,
1928
- getItemKey,
1929
- items: t3,
1930
- onChange,
1931
- renderItem,
2048
+ className,
2049
+ disabled,
2050
+ indeterminate,
2051
+ readOnly,
1932
2052
  ref: forwardedRef,
2053
+ style,
1933
2054
  ...rest
1934
- } = t0, $[0] = t0, $[1] = forwardedRef, $[2] = getItemKey, $[3] = onChange, $[4] = renderItem, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3) : (forwardedRef = $[1], getItemKey = $[2], onChange = $[3], renderItem = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8]);
1935
- const as = t1 === void 0 ? DEFAULT_VIRTUAL_LIST_ELEMENT : t1, gap = t2 === void 0 ? 0 : t2;
1936
- let t4;
1937
- $[9] !== t3 ? (t4 = t3 === void 0 ? [] : t3, $[9] = t3, $[10] = t4) : t4 = $[10];
1938
- const items = t4, ref = react.useRef(null), wrapperRef = react.useRef(null), [scrollTop, setScrollTop] = react.useState(0), [scrollHeight, setScrollHeight] = react.useState(0), [itemHeight, setItemHeight] = react.useState(-1), [gapValue, setGapValue] = react.useState(0);
2055
+ } = t0, $[0] = t0, $[1] = className, $[2] = disabled, $[3] = forwardedRef, $[4] = indeterminate, $[5] = readOnly, $[6] = rest, $[7] = style, $[8] = t1) : (className = $[1], disabled = $[2], forwardedRef = $[3], indeterminate = $[4], readOnly = $[5], rest = $[6], style = $[7], t1 = $[8]);
2056
+ const Element2 = t1 === void 0 ? DEFAULT_SWITCH_ELEMENT : t1, ref = react.useRef(null);
2057
+ let t2;
2058
+ $[9] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[9] = t2) : t2 = $[9], react.useImperativeHandle(forwardedRef, t2);
2059
+ let t3, t4;
2060
+ $[10] !== indeterminate ? (t3 = () => {
2061
+ ref.current && (ref.current.indeterminate = indeterminate || !1);
2062
+ }, t4 = [indeterminate], $[10] = indeterminate, $[11] = t3, $[12] = t4) : (t3 = $[11], t4 = $[12]), react.useEffect(t3, t4);
1939
2063
  let t5;
1940
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[11] = t5) : t5 = $[11], react.useImperativeHandle(forwardedRef, t5);
1941
- let t6, t7;
1942
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => {
1943
- if (!ref.current)
1944
- return;
1945
- const scrollEl = findScrollable(ref.current.parentNode);
1946
- if (scrollEl) {
1947
- if (!(scrollEl instanceof HTMLElement))
1948
- return;
1949
- const handleScroll = () => {
1950
- setScrollTop(scrollEl.scrollTop);
1951
- };
1952
- scrollEl.addEventListener("scroll", handleScroll, {
1953
- passive: !0
1954
- });
1955
- const ro = new _visualEditing._ResizeObserver((entries) => {
1956
- setScrollHeight(entries[0].contentRect.height);
1957
- });
1958
- return ro.observe(scrollEl), handleScroll(), () => {
1959
- scrollEl.removeEventListener("scroll", handleScroll), ro.unobserve(scrollEl), ro.disconnect();
1960
- };
1961
- }
1962
- const handleScroll_0 = () => {
1963
- setScrollTop(window.scrollY);
1964
- }, handleResize = () => {
1965
- setScrollHeight(window.innerHeight);
1966
- };
1967
- return window.addEventListener("scroll", handleScroll_0, {
1968
- passive: !0
1969
- }), window.addEventListener("resize", handleResize), setScrollHeight(window.innerHeight), handleScroll_0(), () => {
1970
- window.removeEventListener("scroll", handleScroll_0), window.removeEventListener("resize", handleResize);
2064
+ $[13] !== className ? (t5 = css._switch({
2065
+ className
2066
+ }), $[13] = className, $[14] = t5) : t5 = $[14];
2067
+ let t6;
2068
+ $[15] === Symbol.for("react.memo_cache_sentinel") ? (t6 = css._switchElement(), $[15] = t6) : t6 = $[15];
2069
+ const t7 = !disabled && readOnly ? "" : void 0, t8 = disabled || readOnly;
2070
+ let t9;
2071
+ $[16] !== Element2 || $[17] !== rest || $[18] !== t7 || $[19] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t6, "data-read-only": t7, disabled: t8, type: "checkbox", ref }), $[16] = Element2, $[17] = rest, $[18] = t7, $[19] = t8, $[20] = t9) : t9 = $[20];
2072
+ let t10;
2073
+ $[21] === Symbol.for("react.memo_cache_sentinel") ? (t10 = /* @__PURE__ */ jsxRuntime.jsxs("span", { "aria-hidden": !0, className: css._switchPresentation(), children: [
2074
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: css._switchTrack() }),
2075
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: css._switchThumb() })
2076
+ ] }), $[21] = t10) : t10 = $[21];
2077
+ let t11;
2078
+ return $[22] !== style || $[23] !== t5 || $[24] !== t9 ? (t11 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { className: t5, "data-ui": "Switch", display: "block", position: "relative", style, children: [
2079
+ t9,
2080
+ t10
2081
+ ] }), $[22] = style, $[23] = t5, $[24] = t9, $[25] = t11) : t11 = $[25], t11;
2082
+ }
2083
+ const DEFAULT_TEXT_AREA_ELEMENT = "textarea";
2084
+ function TextArea(props) {
2085
+ const $ = compilerRuntime.c(34), t0 = props;
2086
+ let __unstable_disableFocusRing, customValidity, forwardedRef, gap, readOnly, rest, t1, t2, t3, t4, t5, t6, t7;
2087
+ $[0] !== t0 ? ({
2088
+ __unstable_disableFocusRing,
2089
+ as: t1,
2090
+ border: t2,
2091
+ customValidity,
2092
+ disabled: t3,
2093
+ fontSize: t4,
2094
+ gap,
2095
+ padding: t5,
2096
+ radius: t6,
2097
+ readOnly,
2098
+ ref: forwardedRef,
2099
+ space: t7,
2100
+ ...rest
2101
+ } = t0, $[0] = t0, $[1] = __unstable_disableFocusRing, $[2] = customValidity, $[3] = forwardedRef, $[4] = gap, $[5] = readOnly, $[6] = rest, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = t4, $[11] = t5, $[12] = t6, $[13] = t7) : (__unstable_disableFocusRing = $[1], customValidity = $[2], forwardedRef = $[3], gap = $[4], readOnly = $[5], rest = $[6], t1 = $[7], t2 = $[8], t3 = $[9], t4 = $[10], t5 = $[11], t6 = $[12], t7 = $[13]);
2102
+ const Element2 = t1 === void 0 ? DEFAULT_TEXT_AREA_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, disabled = t3 === void 0 ? !1 : t3, fontSize = t4 === void 0 ? 2 : t4, padding = t5 === void 0 ? 3 : t5, radius = t6 === void 0 ? 2 : t6, space = t7 === void 0 ? 3 : t7, ref = react.useRef(null);
2103
+ let t8;
2104
+ $[14] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => ref.current, $[14] = t8) : t8 = $[14], react.useImperativeHandle(forwardedRef, t8), _visualEditing.useCustomValidity(ref, customValidity);
2105
+ const t9 = gap ?? space;
2106
+ let t10;
2107
+ $[15] !== border || $[16] !== fontSize || $[17] !== padding || $[18] !== radius || $[19] !== t9 ? (t10 = css.textArea({
2108
+ border,
2109
+ fontSize,
2110
+ padding,
2111
+ radius,
2112
+ gap: t9
2113
+ }), $[15] = border, $[16] = fontSize, $[17] = padding, $[18] = radius, $[19] = t9, $[20] = t10) : t10 = $[20];
2114
+ const t11 = customValidity ? "" : void 0, t12 = !disabled && readOnly ? "" : void 0;
2115
+ let t13;
2116
+ $[21] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css._inputElement(), $[21] = t13) : t13 = $[21];
2117
+ const t14 = __unstable_disableFocusRing ? "" : void 0;
2118
+ let t15;
2119
+ $[22] !== Element2 || $[23] !== disabled || $[24] !== readOnly || $[25] !== rest || $[26] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t13, "data-no-focus-ring": t14, disabled, readOnly, ref }), $[22] = Element2, $[23] = disabled, $[24] = readOnly, $[25] = rest, $[26] = t14, $[27] = t15) : t15 = $[27];
2120
+ let t16;
2121
+ $[28] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: css._inputPresentation() }), $[28] = t16) : t16 = $[28];
2122
+ let t17;
2123
+ return $[29] !== t10 || $[30] !== t11 || $[31] !== t12 || $[32] !== t15 ? (t17 = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: t10, "data-invalid": t11, "data-read-only": t12, "data-ui": "TextArea", children: [
2124
+ t15,
2125
+ t16
2126
+ ] }), $[29] = t10, $[30] = t11, $[31] = t12, $[32] = t15, $[33] = t17) : t17 = $[33], t17;
2127
+ }
2128
+ function TooltipDelayGroupProvider(props) {
2129
+ const $ = compilerRuntime.c(9), {
2130
+ children,
2131
+ delay
2132
+ } = props, [isGroupActive, setIsGroupActive] = _visualEditing.useDelayedState(!1), [openTooltipId, setOpenTooltipId] = _visualEditing.useDelayedState(null), openDelay = typeof delay == "number" ? delay : delay?.open || 0, closeDelay = typeof delay == "number" ? delay : delay?.close || 0;
2133
+ let t0;
2134
+ const t1 = isGroupActive ? 1 : openDelay;
2135
+ let t2;
2136
+ $[0] !== closeDelay || $[1] !== openTooltipId || $[2] !== setIsGroupActive || $[3] !== setOpenTooltipId || $[4] !== t1 ? (t2 = {
2137
+ setIsGroupActive,
2138
+ openTooltipId,
2139
+ setOpenTooltipId,
2140
+ openDelay: t1,
2141
+ closeDelay
2142
+ }, $[0] = closeDelay, $[1] = openTooltipId, $[2] = setIsGroupActive, $[3] = setOpenTooltipId, $[4] = t1, $[5] = t2) : t2 = $[5], t0 = t2;
2143
+ const value = t0;
2144
+ let t3;
2145
+ return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.TooltipDelayGroupContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t3) : t3 = $[8], t3;
2146
+ }
2147
+ function findMaxBreakpoints(media, width) {
2148
+ const ret = [];
2149
+ for (let i = 0; i < media.length; i += 1)
2150
+ media[i] > width && ret.push(i);
2151
+ return ret;
2152
+ }
2153
+ function findMinBreakpoints(media, width) {
2154
+ const ret = [];
2155
+ for (let i = 0; i < media.length; i += 1)
2156
+ media[i] <= width && ret.push(i);
2157
+ return ret;
2158
+ }
2159
+ const DEFAULT_ELEMENT_QUERY_ELEMENT = "div", DEFAULT_BREAKPOINTS = Object.values(css.BREAKPOINTS);
2160
+ function ElementQuery(props) {
2161
+ const $ = compilerRuntime.c(21), t0 = props;
2162
+ let children, forwardedRef, mediaProp, rest, t1;
2163
+ $[0] !== t0 ? ({
2164
+ as: t1,
2165
+ children,
2166
+ media: mediaProp,
2167
+ ref: forwardedRef,
2168
+ ...rest
2169
+ } = t0, $[0] = t0, $[1] = children, $[2] = forwardedRef, $[3] = mediaProp, $[4] = rest, $[5] = t1) : (children = $[1], forwardedRef = $[2], mediaProp = $[3], rest = $[4], t1 = $[5]);
2170
+ const Element2 = t1 === void 0 ? DEFAULT_ELEMENT_QUERY_ELEMENT : t1, breakpoints = mediaProp ?? DEFAULT_BREAKPOINTS, [element, setElement] = react.useState(null), elementSize = useElementSize(element);
2171
+ let t2;
2172
+ t2 = elementSize?.border.width ?? window.innerWidth;
2173
+ const width = t2;
2174
+ let t3, t4;
2175
+ if ($[6] !== breakpoints || $[7] !== width) {
2176
+ const eq = findMaxBreakpoints(breakpoints, width);
2177
+ t4 = eq.length ? eq.join(" ") : void 0, $[6] = breakpoints, $[7] = width, $[8] = t4;
2178
+ } else
2179
+ t4 = $[8];
2180
+ t3 = t4;
2181
+ const max = t3;
2182
+ let t5, t6;
2183
+ if ($[9] !== breakpoints || $[10] !== width) {
2184
+ const eq_0 = findMinBreakpoints(breakpoints, width);
2185
+ t6 = eq_0.length ? eq_0.join(" ") : void 0, $[9] = breakpoints, $[10] = width, $[11] = t6;
2186
+ } else
2187
+ t6 = $[11];
2188
+ t5 = t6;
2189
+ const min = t5;
2190
+ let t7, t8;
2191
+ $[12] !== element ? (t7 = () => element, t8 = [element], $[12] = element, $[13] = t7, $[14] = t8) : (t7 = $[13], t8 = $[14]), react.useImperativeHandle(forwardedRef, t7, t8);
2192
+ let t9;
2193
+ return $[15] !== Element2 || $[16] !== children || $[17] !== max || $[18] !== min || $[19] !== rest ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "ElementQuery", ...rest, "data-eq-max": max, "data-eq-min": min, ref: setElement, children }), $[15] = Element2, $[16] = children, $[17] = max, $[18] = min, $[19] = rest, $[20] = t9) : t9 = $[20], t9;
2194
+ }
2195
+ class ErrorBoundary extends react.Component {
2196
+ state = {
2197
+ error: null
2198
+ };
2199
+ static displayName = "ErrorBoundary";
2200
+ static getDerivedStateFromError(error) {
2201
+ return {
2202
+ error
1971
2203
  };
1972
- }, t7 = [], $[12] = t6, $[13] = t7) : (t6 = $[12], t7 = $[13]), react.useEffect(t6, t7);
1973
- const len = items.length, height = itemHeight ? len * (itemHeight + gapValue) - gapValue : 0, fromIndex = height ? Math.max(Math.floor(scrollTop / height * len) - 2, 0) : 0, toIndex = height ? Math.ceil((scrollTop + scrollHeight) / height * len) + 1 : 0;
1974
- let t8, t9;
1975
- $[14] !== fromIndex || $[15] !== gapValue || $[16] !== itemHeight || $[17] !== onChange || $[18] !== scrollHeight || $[19] !== scrollTop || $[20] !== toIndex ? (t8 = () => {
1976
- onChange?.({
1977
- fromIndex,
1978
- gap: gapValue,
1979
- itemHeight,
1980
- scrollHeight,
1981
- scrollTop,
1982
- toIndex
2204
+ }
2205
+ componentDidCatch(error, info) {
2206
+ this.props.onCatch({
2207
+ error,
2208
+ info
1983
2209
  });
1984
- }, t9 = [fromIndex, gapValue, itemHeight, onChange, scrollHeight, scrollTop, toIndex], $[14] = fromIndex, $[15] = gapValue, $[16] = itemHeight, $[17] = onChange, $[18] = scrollHeight, $[19] = scrollTop, $[20] = toIndex, $[21] = t8, $[22] = t9) : (t8 = $[21], t9 = $[22]), react.useEffect(t8, t9);
1985
- let t10;
1986
- bb0: {
1987
- if (!renderItem || items.length === 0) {
1988
- t10 = null;
1989
- break bb0;
1990
- }
1991
- if (itemHeight === -1) {
1992
- let t113;
1993
- $[23] === Symbol.for("react.memo_cache_sentinel") ? (t113 = (el) => el ? setItemHeight(el.offsetHeight) : void 0, $[23] = t113) : t113 = $[23];
1994
- let t122;
1995
- $[24] !== items[0] || $[25] !== renderItem ? (t122 = renderItem(items[0]), $[24] = items[0], $[25] = renderItem, $[26] = t122) : t122 = $[26];
1996
- let t132;
1997
- $[27] !== t122 ? (t132 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { ref: t113, insetTop: 0, insetLeft: 0, insetRight: 0, position: "absolute", children: t122 }, 0), $[27] = t122, $[28] = t132) : t132 = $[28];
1998
- let t142;
1999
- $[29] === Symbol.for("react.memo_cache_sentinel") ? (t142 = (el_0) => el_0 ? setGapValue(el_0.offsetHeight) : void 0, $[29] = t142) : t142 = $[29];
2000
- const t15 = css.vars.space[gap];
2001
- let t16;
2002
- $[30] !== t15 ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: t142, style: {
2003
- height: t15
2004
- } }), $[30] = t15, $[31] = t16) : t16 = $[31];
2005
- let t17;
2006
- $[32] !== t132 || $[33] !== t16 ? (t17 = [/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2007
- t132,
2008
- t16
2009
- ] })], $[32] = t132, $[33] = t16, $[34] = t17) : t17 = $[34], t10 = t17;
2010
- break bb0;
2210
+ }
2211
+ render() {
2212
+ const {
2213
+ error
2214
+ } = this.state;
2215
+ if (error) {
2216
+ const message = typeof error?.message == "string" ? error.message : "Error";
2217
+ return /* @__PURE__ */ jsxRuntime.jsx(Code, { children: message });
2011
2218
  }
2012
- let t112;
2013
- if ($[35] !== fromIndex || $[36] !== gapValue || $[37] !== getItemKey || $[38] !== itemHeight || $[39] !== items || $[40] !== renderItem || $[41] !== toIndex) {
2014
- let t122;
2015
- $[43] !== fromIndex || $[44] !== gapValue || $[45] !== getItemKey || $[46] !== itemHeight || $[47] !== renderItem ? (t122 = (item, _itemIndex) => {
2016
- const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
2017
- return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { insetLeft: 0, insetRight: 0, position: "absolute", style: {
2018
- top: itemIndex * (itemHeight + gapValue) - gapValue
2019
- }, children: node }, key);
2020
- }, $[43] = fromIndex, $[44] = gapValue, $[45] = getItemKey, $[46] = itemHeight, $[47] = renderItem, $[48] = t122) : t122 = $[48], t112 = items.slice(fromIndex, toIndex).map(t122), $[35] = fromIndex, $[36] = gapValue, $[37] = getItemKey, $[38] = itemHeight, $[39] = items, $[40] = renderItem, $[41] = toIndex, $[42] = t112;
2021
- } else
2022
- t112 = $[42];
2023
- t10 = t112;
2219
+ return this.props.children;
2024
2220
  }
2025
- const children = t10;
2026
- let t11, t12;
2027
- $[49] !== height ? (t12 = {
2028
- height
2029
- }, $[49] = height, $[50] = t12) : t12 = $[50], t11 = t12;
2030
- const wrapperStyle = t11;
2031
- let t13;
2032
- $[51] !== children || $[52] !== wrapperStyle ? (t13 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: wrapperRef, style: wrapperStyle, children }), $[51] = children, $[52] = wrapperStyle, $[53] = t13) : t13 = $[53];
2033
- let t14;
2034
- return $[54] !== as || $[55] !== rest || $[56] !== t13 ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "VirtualList", ...rest, as, position: "relative", ref, children: t13 }), $[54] = as, $[55] = rest, $[56] = t13, $[57] = t14) : t14 = $[57], t14;
2035
- }
2036
- function findScrollable(parentNode) {
2037
- let _scrollEl = parentNode;
2038
- for (; _scrollEl && !_isScrollable(_scrollEl); )
2039
- _scrollEl = _scrollEl.parentNode;
2040
- return _scrollEl;
2041
2221
  }
2042
2222
  exports.Arrow = _visualEditing.Arrow;
2043
2223
  exports.Box = _visualEditing.Box;
2044
2224
  exports.Button = _visualEditing.Button;
2045
2225
  exports.Card = _visualEditing.Card;
2046
2226
  exports.CardProvider = _visualEditing.CardProvider;
2047
- exports.Code = _visualEditing.Code;
2048
2227
  exports.DEFAULT_ARROW_ELEMENT = _visualEditing.DEFAULT_ARROW_ELEMENT;
2049
2228
  exports.DEFAULT_BOX_ELEMENT = _visualEditing.DEFAULT_BOX_ELEMENT;
2050
2229
  exports.DEFAULT_BUTTON_ELEMENT = _visualEditing.DEFAULT_BUTTON_ELEMENT;
2051
2230
  exports.DEFAULT_CARD_ELEMENT = _visualEditing.DEFAULT_CARD_ELEMENT;
2052
- exports.DEFAULT_CODE_ELEMENT = _visualEditing.DEFAULT_CODE_ELEMENT;
2053
- exports.DEFAULT_ELEMENT_QUERY_ELEMENT = _visualEditing.DEFAULT_ELEMENT_QUERY_ELEMENT;
2054
2231
  exports.DEFAULT_FLEX_ELEMENT = _visualEditing.DEFAULT_FLEX_ELEMENT;
2055
2232
  exports.DEFAULT_GRID_ELEMENT = _visualEditing.DEFAULT_GRID_ELEMENT;
2056
2233
  exports.DEFAULT_HOTKEYS_ELEMENT = _visualEditing.DEFAULT_HOTKEYS_ELEMENT;
@@ -2061,6 +2238,7 @@ exports.DEFAULT_MENU_ELEMENT = _visualEditing.DEFAULT_MENU_ELEMENT;
2061
2238
  exports.DEFAULT_MENU_GROUP_ELEMENT = _visualEditing.DEFAULT_MENU_GROUP_ELEMENT;
2062
2239
  exports.DEFAULT_MENU_ITEM_ELEMENT = _visualEditing.DEFAULT_MENU_ITEM_ELEMENT;
2063
2240
  exports.DEFAULT_POPOVER_ELEMENT = _visualEditing.DEFAULT_POPOVER_ELEMENT;
2241
+ exports.DEFAULT_SELECTABLE_ELEMENT = _visualEditing.DEFAULT_SELECTABLE_ELEMENT;
2064
2242
  exports.DEFAULT_SPINNER_ELEMENT = _visualEditing.DEFAULT_SPINNER_ELEMENT;
2065
2243
  exports.DEFAULT_STACK_ELEMENT = _visualEditing.DEFAULT_STACK_ELEMENT;
2066
2244
  exports.DEFAULT_TAB_ELEMENT = _visualEditing.DEFAULT_TAB_ELEMENT;
@@ -2068,7 +2246,6 @@ exports.DEFAULT_TAB_LIST_ELEMENT = _visualEditing.DEFAULT_TAB_LIST_ELEMENT;
2068
2246
  exports.DEFAULT_TEXT_ELEMENT = _visualEditing.DEFAULT_TEXT_ELEMENT;
2069
2247
  exports.DEFAULT_TEXT_INPUT_ELEMENT = _visualEditing.DEFAULT_TEXT_INPUT_ELEMENT;
2070
2248
  exports.DEFAULT_TOOLTIP_ELEMENT = _visualEditing.DEFAULT_TOOLTIP_ELEMENT;
2071
- exports.ElementQuery = _visualEditing.ElementQuery;
2072
2249
  exports.Flex = _visualEditing.Flex;
2073
2250
  exports.Grid = _visualEditing.Grid;
2074
2251
  exports.Hotkeys = _visualEditing.Hotkeys;
@@ -2082,6 +2259,7 @@ exports.MenuItem = _visualEditing.MenuItem;
2082
2259
  exports.Popover = _visualEditing.Popover;
2083
2260
  exports.Portal = _visualEditing.Portal;
2084
2261
  exports.PortalProvider = _visualEditing.PortalProvider;
2262
+ exports.Selectable = _visualEditing.Selectable;
2085
2263
  exports.Spinner = _visualEditing.Spinner;
2086
2264
  exports.Stack = _visualEditing.Stack;
2087
2265
  exports.Tab = _visualEditing.Tab;
@@ -2092,8 +2270,6 @@ exports.ThemeColorProvider = _visualEditing.ThemeColorProvider;
2092
2270
  exports.ThemeProvider = _visualEditing.ThemeProvider;
2093
2271
  exports.Tooltip = _visualEditing.Tooltip;
2094
2272
  exports.TooltipDelayGroupContext = _visualEditing.TooltipDelayGroupContext;
2095
- exports._ResizeObserver = _visualEditing._ResizeObserver;
2096
- exports._elementSizeObserver = _visualEditing._elementSizeObserver;
2097
2273
  exports._getArrayProp = _visualEditing._getArrayProp;
2098
2274
  exports._getResponsiveProp = _visualEditing._getResponsiveProp;
2099
2275
  exports._isEnterToClickElement = _visualEditing._isEnterToClickElement;
@@ -2108,7 +2284,6 @@ exports.useBoundaryElement = _visualEditing.useBoundaryElement;
2108
2284
  exports.useCard = _visualEditing.useCard;
2109
2285
  exports.useClickOutsideEvent = _visualEditing.useClickOutsideEvent;
2110
2286
  exports.useCustomValidity = _visualEditing.useCustomValidity;
2111
- exports.useElementSize = _visualEditing.useElementSize;
2112
2287
  exports.useGlobalKeyDown = _visualEditing.useGlobalKeyDown;
2113
2288
  exports.useLayer = _visualEditing.useLayer;
2114
2289
  exports.useMatchMedia = _visualEditing.useMatchMedia;
@@ -2141,6 +2316,7 @@ exports.Badge = Badge;
2141
2316
  exports.BoundaryElementProvider = BoundaryElementProvider;
2142
2317
  exports.Breadcrumbs = Breadcrumbs;
2143
2318
  exports.Checkbox = Checkbox;
2319
+ exports.Code = Code;
2144
2320
  exports.CodeSkeleton = CodeSkeleton;
2145
2321
  exports.Container = Container;
2146
2322
  exports.DEFAULT_AUTOCOMPLETE_ELEMENT = DEFAULT_AUTOCOMPLETE_ELEMENT;
@@ -2150,9 +2326,11 @@ exports.DEFAULT_AVATAR_STACK_ELEMENT = DEFAULT_AVATAR_STACK_ELEMENT;
2150
2326
  exports.DEFAULT_BADGE_ELEMENT = DEFAULT_BADGE_ELEMENT;
2151
2327
  exports.DEFAULT_BREADCRUMBS_ELEMENT = DEFAULT_BREADCRUMBS_ELEMENT;
2152
2328
  exports.DEFAULT_CHECKBOX_ELEMENT = DEFAULT_CHECKBOX_ELEMENT;
2329
+ exports.DEFAULT_CODE_ELEMENT = DEFAULT_CODE_ELEMENT;
2153
2330
  exports.DEFAULT_CODE_SKELETON_ELEMENT = DEFAULT_CODE_SKELETON_ELEMENT;
2154
2331
  exports.DEFAULT_CONTAINER_ELEMENT = DEFAULT_CONTAINER_ELEMENT;
2155
2332
  exports.DEFAULT_DIALOG_ELEMENT = DEFAULT_DIALOG_ELEMENT;
2333
+ exports.DEFAULT_ELEMENT_QUERY_ELEMENT = DEFAULT_ELEMENT_QUERY_ELEMENT;
2156
2334
  exports.DEFAULT_HEADING_ELEMENT = DEFAULT_HEADING_ELEMENT;
2157
2335
  exports.DEFAULT_HEADING_SKELETON_ELEMENT = DEFAULT_HEADING_SKELETON_ELEMENT;
2158
2336
  exports.DEFAULT_INLINE_ELEMENT = DEFAULT_INLINE_ELEMENT;
@@ -2173,6 +2351,7 @@ exports.DEFAULT_VIRTUAL_LIST_ELEMENT = DEFAULT_VIRTUAL_LIST_ELEMENT;
2173
2351
  exports.Dialog = Dialog;
2174
2352
  exports.DialogContext = DialogContext;
2175
2353
  exports.DialogProvider = DialogProvider;
2354
+ exports.ElementQuery = ElementQuery;
2176
2355
  exports.ErrorBoundary = ErrorBoundary;
2177
2356
  exports.Heading = Heading;
2178
2357
  exports.HeadingSkeleton = HeadingSkeleton;
@@ -2194,6 +2373,8 @@ exports.TooltipDelayGroupProvider = TooltipDelayGroupProvider;
2194
2373
  exports.Tree = Tree;
2195
2374
  exports.TreeItem = TreeItem;
2196
2375
  exports.VirtualList = VirtualList;
2376
+ exports._ResizeObserver = _ResizeObserver;
2377
+ exports._elementSizeObserver = _elementSizeObserver;
2197
2378
  exports._hasFocus = _hasFocus;
2198
2379
  exports._isScrollable = _isScrollable;
2199
2380
  exports._raf = _raf;
@@ -2216,6 +2397,7 @@ exports.useArrayProp = useArrayProp;
2216
2397
  exports.useClickOutside = useClickOutside;
2217
2398
  exports.useDialog = useDialog;
2218
2399
  exports.useElementRect = useElementRect;
2400
+ exports.useElementSize = useElementSize;
2219
2401
  exports.useForwardedRef = useForwardedRef;
2220
2402
  exports.useToast = useToast;
2221
2403
  exports.useTree = useTree;