@sanity/ui 3.0.0-static.26 → 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 (248) hide show
  1. package/README.md +1 -1
  2. package/dist/_chunks-cjs/_visual-editing.cjs +674 -804
  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 +652 -781
  7. package/dist/_chunks-es/_visual-editing.js.map +1 -1
  8. package/dist/_chunks-es/refractor.js +1 -1
  9. package/dist/_visual-editing.d.cts +1 -0
  10. package/dist/_visual-editing.d.ts +1 -0
  11. package/dist/css/layers.css +4 -0
  12. package/dist/css/primitives/popover/popover.css +4 -0
  13. package/dist/css.cjs +59 -50
  14. package/dist/css.cjs.map +1 -1
  15. package/dist/css.d.cts +14 -6
  16. package/dist/css.d.ts +14 -6
  17. package/dist/css.js +59 -50
  18. package/dist/css.js.map +1 -1
  19. package/dist/index.cjs +1995 -1813
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.css +1 -0
  22. package/dist/index.d.cts +35 -17
  23. package/dist/index.d.ts +35 -17
  24. package/dist/index.js +2013 -1832
  25. package/dist/index.js.map +1 -1
  26. package/dist/theme.cjs +2605 -1075
  27. package/dist/theme.cjs.map +1 -1
  28. package/dist/theme.d.cts +1 -1
  29. package/dist/theme.d.ts +1 -1
  30. package/dist/theme.js +2689 -1159
  31. package/dist/theme.js.map +1 -1
  32. package/exports/_visual-editing.ts +2 -2
  33. package/package.json +20 -38
  34. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
  35. package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
  36. package/src/core/components/autocomplete/autocomplete.tsx +13 -17
  37. package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
  38. package/src/core/components/autocomplete/constants.ts +3 -1
  39. package/src/core/components/autocomplete/types.ts +1 -1
  40. package/src/core/components/breadcrumbs/breadcrumbs.tsx +8 -3
  41. package/src/core/components/dialog/__workshop__/activate.tsx +11 -3
  42. package/src/core/components/dialog/__workshop__/panes.tsx +12 -5
  43. package/src/core/components/dialog/dialog.tsx +12 -13
  44. package/src/core/components/dialog/dialogCard.tsx +89 -53
  45. package/src/core/components/dialog/dialogContext.ts +1 -1
  46. package/src/core/components/dialog/dialogProvider.tsx +1 -1
  47. package/src/core/components/dialog/index.ts +1 -0
  48. package/src/core/components/dialog/isTargetWithinScope.ts +1 -1
  49. package/src/core/components/hotkeys/hotkeys.tsx +3 -2
  50. package/src/core/components/menu/__workshop__/avatarMenu.tsx +12 -6
  51. package/src/core/components/menu/__workshop__/customSelectedState.tsx +1 -5
  52. package/src/core/components/menu/__workshop__/shouldFocus.tsx +1 -2
  53. package/src/core/components/menu/helpers.ts +1 -1
  54. package/src/core/components/menu/menu.tsx +6 -4
  55. package/src/core/components/menu/menuButton.tsx +5 -3
  56. package/src/core/components/menu/menuDivider.tsx +1 -1
  57. package/src/core/components/menu/menuGroup.tsx +8 -4
  58. package/src/core/components/menu/menuItem.tsx +4 -2
  59. package/src/core/components/tab/tab.tsx +2 -2
  60. package/src/core/components/tab/tabList.tsx +2 -2
  61. package/src/core/components/tab/tabPanel.tsx +2 -2
  62. package/src/core/components/toast/toast.tsx +7 -2
  63. package/src/core/components/toast/toastLayer.tsx +2 -2
  64. package/src/core/components/toast/toastProvider.tsx +1 -1
  65. package/src/core/components/tree/tree.tsx +2 -2
  66. package/src/core/components/tree/treeGroup.tsx +2 -2
  67. package/src/core/components/tree/treeItem.tsx +13 -6
  68. package/src/core/components/tree/types.ts +0 -1
  69. package/src/core/{utils → components}/virtualList/__workshop__/index.ts +1 -1
  70. package/src/core/{utils → components}/virtualList/virtualList.tsx +10 -5
  71. package/src/core/helpers/focus.ts +0 -8
  72. package/src/core/hooks/useArrayProp.ts +1 -1
  73. package/src/core/hooks/useElementRect/__workshop__/example.tsx +1 -3
  74. package/src/core/hooks/useElementSize.ts +1 -1
  75. package/src/core/hooks/useResponsiveProp.ts +1 -1
  76. package/src/core/index.ts +83 -7
  77. package/src/core/observers/{elementSizeObserver.ts → elementSize.ts} +1 -1
  78. package/src/core/primitives/_selectable/index.ts +1 -0
  79. package/src/core/primitives/_selectable/selectable.tsx +13 -3
  80. package/src/core/{types/selectable.ts → primitives/_selectable/types.ts} +1 -1
  81. package/src/core/{utils → primitives}/arrow/arrow.tsx +1 -1
  82. package/src/core/primitives/avatar/avatar.tsx +4 -3
  83. package/src/core/primitives/avatar/avatarCounter.tsx +3 -3
  84. package/src/core/primitives/avatar/avatarStack.tsx +4 -4
  85. package/src/core/primitives/avatar/types.ts +17 -0
  86. package/src/core/primitives/badge/badge.tsx +4 -2
  87. package/src/core/primitives/badge/types.ts +11 -2
  88. package/src/core/primitives/box/__workshop__/responsive.tsx +0 -1
  89. package/src/core/primitives/box/box.tsx +1 -1
  90. package/src/core/primitives/box/index.ts +1 -0
  91. package/src/core/primitives/button/__workshop__/disabled.tsx +37 -51
  92. package/src/core/primitives/button/__workshop__/index.ts +5 -0
  93. package/src/core/primitives/button/__workshop__/textOverflow.tsx +13 -0
  94. package/src/core/primitives/button/button.tsx +15 -14
  95. package/src/core/primitives/button/index.ts +1 -0
  96. package/src/core/primitives/card/__workshop__/listNavigation.tsx +2 -2
  97. package/src/core/primitives/card/card.tsx +1 -1
  98. package/src/core/primitives/card/types.ts +3 -0
  99. package/src/core/primitives/checkbox/__workshop__/tones.tsx +9 -1
  100. package/src/core/primitives/checkbox/checkbox.tsx +3 -4
  101. package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +17 -42
  102. package/src/core/primitives/code/code.tsx +1 -1
  103. package/src/core/primitives/container/container.tsx +1 -1
  104. package/src/core/primitives/flex/flex.tsx +1 -1
  105. package/src/core/primitives/flex/index.ts +1 -0
  106. package/src/core/primitives/grid/grid.tsx +1 -1
  107. package/src/core/primitives/grid/index.ts +1 -0
  108. package/src/core/primitives/heading/heading.tsx +1 -1
  109. package/src/core/primitives/inline/inline.tsx +1 -1
  110. package/src/core/primitives/kbd/kbd.tsx +1 -1
  111. package/src/core/primitives/label/label.tsx +1 -1
  112. package/src/core/{utils → primitives}/layer/__workshop__/index.ts +1 -1
  113. package/src/core/{utils → primitives}/layer/layer.test.tsx +1 -1
  114. package/src/core/{utils → primitives}/layer/layer.tsx +2 -2
  115. package/src/core/{utils → primitives}/layer/layerCard.tsx +3 -3
  116. package/src/core/{utils → primitives}/layer/layerProvider.tsx +2 -1
  117. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +12 -9
  118. package/src/core/primitives/popover/__workshop__/TestStory.tsx +9 -8
  119. package/src/core/primitives/popover/constants.ts +1 -1
  120. package/src/core/primitives/popover/floating-ui/size.ts +1 -1
  121. package/src/core/primitives/popover/popover.tsx +8 -4
  122. package/src/core/primitives/popover/popoverLayer.tsx +4 -2
  123. package/src/core/primitives/popover/types.ts +5 -0
  124. package/src/core/primitives/radio/radio.tsx +2 -2
  125. package/src/core/primitives/select/select.tsx +2 -2
  126. package/src/core/{components → primitives}/skeleton/__workshop__/index.ts +1 -1
  127. package/src/core/{components → primitives}/skeleton/codeSkeleton.tsx +1 -1
  128. package/src/core/{components → primitives}/skeleton/headingSkeleton.tsx +1 -1
  129. package/src/core/{components → primitives}/skeleton/labelSkeleton.tsx +1 -1
  130. package/src/core/{components → primitives}/skeleton/skeleton.tsx +7 -8
  131. package/src/core/{components → primitives}/skeleton/textSkeleton.tsx +1 -1
  132. package/src/core/primitives/spinner/spinner.tsx +1 -1
  133. package/src/core/{utils → primitives}/srOnly/srOnly.tsx +1 -1
  134. package/src/core/primitives/stack/stack.tsx +2 -1
  135. package/src/core/primitives/switch/switch.tsx +2 -7
  136. package/src/core/primitives/text/__workshop__/colored.tsx +2 -2
  137. package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +17 -42
  138. package/src/core/primitives/text/text.tsx +3 -1
  139. package/src/core/primitives/textArea/__workshop__/plain.tsx +2 -2
  140. package/src/core/primitives/textArea/textArea.tsx +2 -2
  141. package/src/core/primitives/textInput/textInput.tsx +3 -2
  142. package/src/core/primitives/tooltip/constants.ts +1 -1
  143. package/src/core/primitives/tooltip/tooltip.tsx +6 -3
  144. package/src/core/primitives/tooltip/tooltipLayer.tsx +3 -2
  145. package/src/core/primitives/types.ts +8 -10
  146. package/src/core/types/radius.ts +1 -1
  147. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +9 -5
  148. package/src/core/utils/elementQuery/elementQuery.tsx +2 -2
  149. package/src/core/utils/getElementRef.ts +1 -0
  150. package/src/core/utils/portal/portal.tsx +1 -1
  151. package/src/css/components/dialog/dialog.css.ts +26 -1
  152. package/src/css/components/dialog/dialog.ts +27 -7
  153. package/src/css/components/skeleton/skeleton.ts +3 -1
  154. package/src/css/components/skeleton/types.ts +3 -1
  155. package/src/css/index.ts +75 -5
  156. package/src/css/primitives/_input/input.ts +2 -1
  157. package/src/css/primitives/_input/types.ts +2 -1
  158. package/src/css/primitives/_selectable/_selectable.css.ts +32 -24
  159. package/src/css/primitives/_selectable/selectable.ts +1 -1
  160. package/src/css/primitives/_selectable/types.ts +1 -1
  161. package/src/css/primitives/avatar/avatar.css.ts +11 -2
  162. package/src/css/primitives/avatar/avatar.ts +1 -1
  163. package/src/css/primitives/badge/badge.css.ts +2 -1
  164. package/src/css/primitives/badge/types.ts +0 -2
  165. package/src/css/primitives/box/box.ts +35 -37
  166. package/src/css/primitives/box/types.ts +34 -36
  167. package/src/css/primitives/button/button.css.ts +4 -0
  168. package/src/css/primitives/button/button.ts +5 -2
  169. package/src/css/primitives/button/types.ts +4 -11
  170. package/src/css/primitives/card/__workshop__/color.tsx +70 -0
  171. package/src/css/primitives/card/__workshop__/index.ts +14 -0
  172. package/src/css/primitives/card/card.css.ts +4 -0
  173. package/src/css/primitives/code/code.ts +3 -1
  174. package/src/css/primitives/code/types.ts +2 -1
  175. package/src/css/primitives/container/container.ts +3 -1
  176. package/src/css/primitives/heading/heading.ts +4 -1
  177. package/src/css/primitives/heading/types.ts +3 -1
  178. package/src/css/primitives/kbd/kbd.ts +1 -1
  179. package/src/css/primitives/kbd/types.ts +1 -1
  180. package/src/css/primitives/label/label.css.ts +1 -0
  181. package/src/css/primitives/label/label.ts +4 -1
  182. package/src/css/primitives/label/types.ts +3 -1
  183. package/src/css/primitives/switch/switch.css.ts +1 -1
  184. package/src/css/primitives/text/text.ts +6 -1
  185. package/src/css/primitives/text/types.ts +5 -2
  186. package/src/css/props/width/types.ts +1 -1
  187. package/src/css/props/width/width.css.ts +3 -0
  188. package/src/theme/v2/build/buildTheme.test.ts +8 -8
  189. package/src/theme/v2/build/buildTheme.ts +32 -7
  190. package/src/theme/v3/defaultFonts.ts +6 -6
  191. package/src/theme/v3/defaultTokens.ts +1 -1
  192. package/bin/sanity-ui.cjs +0 -5
  193. package/dist/ui.css +0 -1
  194. package/src/cli/buildCommand.ts +0 -10
  195. package/src/cli/index.ts +0 -26
  196. package/src/core/components/autocomplete/index.ts +0 -2
  197. package/src/core/components/index.ts +0 -9
  198. package/src/core/helpers/index.ts +0 -5
  199. package/src/core/hooks/index.ts +0 -13
  200. package/src/core/observers/index.ts +0 -2
  201. package/src/core/primitives/index.ts +0 -27
  202. package/src/core/types/avatar.ts +0 -16
  203. package/src/core/types/card.ts +0 -4
  204. package/src/core/types/index.ts +0 -15
  205. package/src/core/types/popover.ts +0 -4
  206. package/src/core/utils/index.ts +0 -8
  207. package/src/css/__theme/index.ts +0 -16
  208. package/src/css/__theme/lib/contract/buildVarContract.ts +0 -78
  209. package/src/css/__theme/lib/contract/index.ts +0 -4
  210. package/src/css/__theme/lib/contract/types.ts +0 -17
  211. package/src/css/__theme/resolveTheme.ts +0 -865
  212. package/src/css/components/index.ts +0 -6
  213. package/src/css/primitives/index.ts +0 -24
  214. package/src/css/props/index.ts +0 -37
  215. package/src/css/utils/srOnly/index.ts +0 -1
  216. /package/src/core/{global.ts → __DEV__.ts} +0 -0
  217. /package/src/core/{types/dialog.ts → components/dialog/types.ts} +0 -0
  218. /package/src/core/{utils → components}/virtualList/__workshop__/changingProps.tsx +0 -0
  219. /package/src/core/{utils → components}/virtualList/__workshop__/elementScroll.tsx +0 -0
  220. /package/src/core/{utils → components}/virtualList/__workshop__/infiniteList.tsx +0 -0
  221. /package/src/core/{utils → components}/virtualList/__workshop__/windowScrolll.tsx +0 -0
  222. /package/src/core/{utils → components}/virtualList/index.ts +0 -0
  223. /package/src/core/observers/{resizeObserver.ts → resize.ts} +0 -0
  224. /package/src/core/{utils → primitives}/arrow/cmds.ts +0 -0
  225. /package/src/core/{utils → primitives}/arrow/index.ts +0 -0
  226. /package/src/core/{types/badge.ts → primitives/badge/types2.ts} +0 -0
  227. /package/src/core/{types/box.ts → primitives/box/types.ts} +0 -0
  228. /package/src/core/{types/button.ts → primitives/button/types.ts} +0 -0
  229. /package/src/core/{types/flex.ts → primitives/flex/types.ts} +0 -0
  230. /package/src/core/{types/grid.ts → primitives/grid/types.ts} +0 -0
  231. /package/src/core/{utils → primitives}/layer/__workshop__/_debug.tsx +0 -0
  232. /package/src/core/{utils → primitives}/layer/__workshop__/multipleRoots.tsx +0 -0
  233. /package/src/core/{utils → primitives}/layer/__workshop__/nested.tsx +0 -0
  234. /package/src/core/{utils → primitives}/layer/__workshop__/responsiveZOffset.tsx +0 -0
  235. /package/src/core/{utils → primitives}/layer/getLayerContext.test.ts +0 -0
  236. /package/src/core/{utils → primitives}/layer/getLayerContext.ts +0 -0
  237. /package/src/core/{utils → primitives}/layer/index.ts +0 -0
  238. /package/src/core/{utils → primitives}/layer/layerContext.ts +0 -0
  239. /package/src/core/{utils → primitives}/layer/types.ts +0 -0
  240. /package/src/core/{utils → primitives}/layer/useLayer.ts +0 -0
  241. /package/src/core/{components → primitives}/skeleton/__workshop__/delay.tsx +0 -0
  242. /package/src/core/{components → primitives}/skeleton/__workshop__/skeleton.tsx +0 -0
  243. /package/src/core/{components → primitives}/skeleton/index.ts +0 -0
  244. /package/src/core/{utils → primitives}/srOnly/index.ts +0 -0
  245. /package/src/core/types/{text.ts → textAlign.ts} +0 -0
  246. /package/src/css/{utils → primitives/srOnly}/index.ts +0 -0
  247. /package/src/css/{utils → primitives}/srOnly/srOnly.css.ts +0 -0
  248. /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,307 +53,318 @@ 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
+ });
229
+ return;
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);
181
276
  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;
223
- }
224
- function _temp$4(s) {
225
- return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
226
- }
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;
231
- $[0] !== t0 ? ({
232
- as: t1,
233
- className,
234
- count,
235
- size: t2,
236
- ...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({
244
- 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;
251
- }
252
- function _temp$3(s) {
253
- return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
254
- }
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;
259
- $[0] !== t0 ? ({
260
- as: t1,
261
- children: childrenProp,
262
- className,
263
- maxLength: t2,
264
- size: t3,
265
- ...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;
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
+ );
285
331
  }
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,
332
+ const DEFAULT_BREADCRUMBS_ELEMENT = "nav";
333
+ function Breadcrumbs(props) {
334
+ const {
335
+ as = DEFAULT_BREADCRUMBS_ELEMENT,
292
336
  children,
293
337
  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;
301
- let t6;
302
- $[9] !== className || $[10] !== tone ? (t6 = css.badge({
303
- className,
304
- tone
305
- }), $[9] = className, $[10] = tone, $[11] = t6) : t6 = $[11];
306
- let t7;
307
- $[12] !== children || $[13] !== fontSize ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, children }), $[12] = children, $[13] = fontSize, $[14] = t7) : t7 = $[14];
308
- 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: "inline-flex", maxWidth: "fill", padding, radius, 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,
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,
325
347
  ...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({
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({
336
359
  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];
348
- 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;
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)) });
353
364
  }
354
365
  const DEFAULT_CONTAINER_ELEMENT = "div";
355
366
  function Container(props) {
356
- const $ = reactCompilerRuntime.c(12), t0 = props;
367
+ const $ = compilerRuntime.c(12), t0 = props;
357
368
  let className, rest, t1, t2;
358
369
  $[0] !== t0 ? ({
359
370
  as: t1,
@@ -370,1687 +381,1853 @@ function Container(props) {
370
381
  let t4;
371
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;
372
383
  }
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;
384
+ function isTargetWithinScope(boundaryElement, portalElement, target) {
385
+ return !boundaryElement || !portalElement ? !0 : _visualEditing.containsOrEqualsElement(boundaryElement, target) || _visualEditing.containsOrEqualsElement(portalElement, target);
386
+ }
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;
377
391
  $[0] !== t0 ? ({
378
- accent: t1,
379
- align,
380
- as: t2,
392
+ __unstable_autoFocus: autoFocus,
393
+ __unstable_hideCloseButton: hideCloseButton,
394
+ as: t1,
381
395
  children,
382
- className,
383
- flex,
384
- muted: t3,
385
- size: t4,
386
- textOverflow: textOverflowProp,
387
- weight: t5,
396
+ contentRef: forwardedContentRef,
397
+ footer,
398
+ header,
399
+ id,
400
+ onClickOutside,
401
+ onClose,
402
+ portal: portalProp,
403
+ ref: forwardedRef,
388
404
  ...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;
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);
391
417
  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];
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);
401
424
  let t7;
402
- $[20] !== textOverflowProp ? (t7 = css.textOverflow({
403
- textOverflow: textOverflowProp
404
- }), $[20] = textOverflowProp, $[21] = t7) : t7 = $[21];
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];
405
429
  let t8;
406
- $[22] !== children || $[23] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t7, children }), $[22] = children, $[23] = t7, $[24] = t8) : t8 = $[24];
407
- 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;
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);
445
+ let 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;
409
478
  }
410
- const DEFAULT_INLINE_ELEMENT = "div";
411
- function Inline(props) {
412
- const $ = reactCompilerRuntime.c(11), t0 = props;
413
- let children, gap, rest, space, t1;
479
+ const DialogContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/dialog", {
480
+ version: 0
481
+ });
482
+ function useDialog() {
483
+ return react.useContext(DialogContext);
484
+ }
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;
414
489
  $[0] !== t0 ? ({
415
- as: t1,
490
+ __unstable_autoFocus: t1,
491
+ __unstable_hideCloseButton: t2,
492
+ animate: t3,
493
+ cardRadius: t4,
416
494
  children,
417
- gap,
418
- space,
495
+ className,
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,
419
512
  ...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;
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);
515
+ let t8;
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);
530
+ let t9;
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;
436
- 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;
438
- }
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_SR_ONLY_ELEMENT = "span";
467
- function SrOnly(props) {
468
- const $ = reactCompilerRuntime.c(12), t0 = props;
469
- let children, className, rest, t1;
470
- $[0] !== t0 ? ({
471
- as: t1,
472
- children,
473
- className,
474
- ...rest
475
- } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = rest, $[4] = t1) : (children = $[1], className = $[2], rest = $[3], t1 = $[4]);
476
- const Element2 = t1 === void 0 ? DEFAULT_SR_ONLY_ELEMENT : t1;
579
+ position,
580
+ zOffset
581
+ }, $[0] = position, $[1] = zOffset, $[2] = t1) : t1 = $[2], t0 = t1;
582
+ const contextValue = t0;
477
583
  let t2;
478
- $[5] !== className ? (t2 = css.srOnly({
479
- className
480
- }), $[5] = className, $[6] = t2) : t2 = $[6];
481
- let t3;
482
- 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;
584
+ return $[3] !== children || $[4] !== contextValue ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: contextValue, children }), $[3] = children, $[4] = contextValue, $[5] = t2) : t2 = $[5], t2;
483
585
  }
484
- const DEFAULT_VIRTUAL_LIST_ELEMENT = "div";
485
- function VirtualList(props) {
486
- const $ = reactCompilerRuntime.c(58), t0 = props;
487
- let forwardedRef, getItemKey, onChange, renderItem, rest, t1, t2, t3;
488
- $[0] !== t0 ? ({
489
- as: t1,
490
- gap: t2,
491
- getItemKey,
492
- items: t3,
493
- onChange,
494
- renderItem,
495
- ref: forwardedRef,
496
- ...rest
497
- } = 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]);
498
- const as = t1 === void 0 ? DEFAULT_VIRTUAL_LIST_ELEMENT : t1, gap = t2 === void 0 ? 0 : t2;
499
- let t4;
500
- $[9] !== t3 ? (t4 = t3 === void 0 ? [] : t3, $[9] = t3, $[10] = t4) : t4 = $[10];
501
- 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);
502
- let t5;
503
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[11] = t5) : t5 = $[11], react.useImperativeHandle(forwardedRef, t5);
504
- let t6, t7;
505
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => {
506
- if (!ref.current)
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);
603
+ let t2;
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);
618
+ let t9;
619
+ $[12] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
620
+ setOpen(_temp$4), setShouldFocus(null);
621
+ }, $[12] = t9) : t9 = $[12];
622
+ const handleButtonClick = t9;
623
+ let t10;
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");
507
632
  return;
508
- const scrollEl = findScrollable(ref.current.parentNode);
509
- if (scrollEl) {
510
- if (!(scrollEl instanceof HTMLElement))
511
- return;
512
- const handleScroll = () => {
513
- setScrollTop(scrollEl.scrollTop);
514
- };
515
- scrollEl.addEventListener("scroll", handleScroll, {
516
- passive: !0
517
- });
518
- const ro = new _visualEditing._ResizeObserver((entries) => {
519
- setScrollHeight(entries[0].contentRect.height);
520
- });
521
- return ro.observe(scrollEl), handleScroll(), () => {
522
- scrollEl.removeEventListener("scroll", handleScroll), ro.unobserve(scrollEl), ro.disconnect();
523
- };
524
633
  }
525
- const handleScroll_0 = () => {
526
- setScrollTop(window.scrollY);
527
- }, handleResize = () => {
528
- setScrollHeight(window.innerHeight);
529
- };
530
- return window.addEventListener("scroll", handleScroll_0, {
531
- passive: !0
532
- }), window.addEventListener("resize", handleResize), setScrollHeight(window.innerHeight), handleScroll_0(), () => {
533
- window.removeEventListener("scroll", handleScroll_0), window.removeEventListener("resize", handleResize);
534
- };
535
- }, t7 = [], $[12] = t6, $[13] = t7) : (t6 = $[12], t7 = $[13]), react.useEffect(t6, t7);
536
- 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;
537
- let t8, t9;
538
- $[14] !== fromIndex || $[15] !== gapValue || $[16] !== itemHeight || $[17] !== onChange || $[18] !== scrollHeight || $[19] !== scrollTop || $[20] !== toIndex ? (t8 = () => {
539
- onChange?.({
540
- fromIndex,
541
- gap: gapValue,
542
- itemHeight,
543
- scrollHeight,
544
- scrollTop,
545
- toIndex
546
- });
547
- }, 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);
548
- let t10;
549
- bb0: {
550
- if (!renderItem || items.length === 0) {
551
- t10 = null;
552
- break bb0;
634
+ if (event_0.key === "ArrowUp") {
635
+ event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
636
+ return;
553
637
  }
554
- if (itemHeight === -1) {
555
- let t113;
556
- $[23] === Symbol.for("react.memo_cache_sentinel") ? (t113 = (el) => el ? setItemHeight(el.offsetHeight) : void 0, $[23] = t113) : t113 = $[23];
557
- let t122;
558
- $[24] !== items[0] || $[25] !== renderItem ? (t122 = renderItem(items[0]), $[24] = items[0], $[25] = renderItem, $[26] = t122) : t122 = $[26];
559
- let t132;
560
- $[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];
561
- let t142;
562
- $[29] === Symbol.for("react.memo_cache_sentinel") ? (t142 = (el_0) => el_0 ? setGapValue(el_0.offsetHeight) : void 0, $[29] = t142) : t142 = $[29];
563
- const t15 = css.vars.space[gap];
564
- let t16;
565
- $[30] !== t15 ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: t142, style: {
566
- height: t15
567
- } }), $[30] = t15, $[31] = t16) : t16 = $[31];
568
- let t17;
569
- $[32] !== t132 || $[33] !== t16 ? (t17 = [/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
570
- t132,
571
- t16
572
- ] })], $[32] = t132, $[33] = t16, $[34] = t17) : t17 = $[34], t10 = t17;
573
- break bb0;
638
+ }, $[15] = t11) : t11 = $[15];
639
+ const handleButtonKeyDown = t11;
640
+ let t12;
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);
574
648
  }
575
- let t112;
576
- if ($[35] !== fromIndex || $[36] !== gapValue || $[37] !== getItemKey || $[38] !== itemHeight || $[39] !== items || $[40] !== renderItem || $[41] !== toIndex) {
577
- let t122;
578
- $[43] !== fromIndex || $[44] !== gapValue || $[45] !== getItemKey || $[46] !== itemHeight || $[47] !== renderItem ? (t122 = (item, _itemIndex) => {
579
- const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
580
- return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { insetLeft: 0, insetRight: 0, position: "absolute", style: {
581
- top: itemIndex * (itemHeight + gapValue) - gapValue
582
- }, children: node }, key);
583
- }, $[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;
584
- } else
585
- t112 = $[42];
586
- t10 = t112;
587
- }
588
- const children = t10;
589
- let t11, t12;
590
- $[49] !== height ? (t12 = {
591
- height
592
- }, $[49] = height, $[50] = t12) : t12 = $[50], t11 = t12;
593
- const wrapperStyle = t11;
649
+ }, $[16] = buttonElement, $[17] = menuElements, $[18] = t12) : t12 = $[18];
650
+ const handleMenuClickOutside = t12;
594
651
  let t13;
595
- $[51] !== children || $[52] !== wrapperStyle ? (t13 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: wrapperRef, style: wrapperStyle, children }), $[51] = children, $[52] = wrapperStyle, $[53] = t13) : t13 = $[53];
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;
596
656
  let t14;
597
- 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;
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;
667
+ let t15;
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;
672
+ let t16;
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;
675
+ let 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;
598
728
  }
599
- function findScrollable(parentNode) {
600
- let _scrollEl = parentNode;
601
- for (; _scrollEl && !_isScrollable(_scrollEl); )
602
- _scrollEl = _scrollEl.parentNode;
603
- return _scrollEl;
729
+ function _temp$4(v) {
730
+ return !v;
604
731
  }
605
- const DEFAULT_RADIO_ELEMENT = "input";
606
- function Radio(props) {
607
- const $ = reactCompilerRuntime.c(25), t0 = props;
608
- let className, customValidity, disabled, forwardedRef, readOnly, rest, style, t1;
732
+ const DEFAULT_TAB_PANEL_ELEMENT = "div";
733
+ function TabPanel(props) {
734
+ const $ = compilerRuntime.c(10), t0 = props;
735
+ let children, rest, t1, tabIndex;
609
736
  $[0] !== t0 ? ({
610
737
  as: t1,
611
- className,
612
- disabled,
613
- style,
614
- customValidity,
615
- readOnly,
616
- ref: forwardedRef,
738
+ children,
739
+ tabIndex,
617
740
  ...rest
618
- } = 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]);
619
- const Element2 = t1 === void 0 ? DEFAULT_RADIO_ELEMENT : t1, ref = react.useRef(null);
620
- let t2;
621
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[9] = t2) : t2 = $[9], react.useImperativeHandle(forwardedRef, t2), _visualEditing.useCustomValidity(ref, customValidity);
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;
622
743
  let t3;
623
- $[10] !== className ? (t3 = css.radio({
624
- className
625
- }), $[10] = className, $[11] = t3) : t3 = $[11];
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;
745
+ }
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;
626
791
  let t4;
627
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t4 = css.radioInput(), $[12] = t4) : t4 = $[12];
628
- const t5 = customValidity ? "" : void 0, t6 = !disabled && readOnly ? "" : void 0, t7 = disabled || readOnly;
792
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t4 = ["hidden", "initial"], $[11] = t4) : t4 = $[11];
793
+ const initial = t4;
794
+ let t5;
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];
629
802
  let t8;
630
- $[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];
803
+ $[15] !== title ? (t8 = title && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: 1, weight: "medium", children: title }), $[15] = title, $[16] = t8) : t8 = $[16];
631
804
  let t9;
632
- $[20] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: css.radioPresentation() }), $[20] = t9) : t9 = $[20];
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];
633
806
  let t10;
634
- return $[21] !== style || $[22] !== t3 || $[23] !== t8 ? (t10 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t3, "data-ui": "Radio", style, children: [
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: [
635
808
  t8,
636
809
  t9
637
- ] }), $[21] = style, $[22] = t3, $[23] = t8, $[24] = t10) : t10 = $[24], t10;
638
- }
639
- const DEFAULT_SELECT_ELEMENT = "select";
640
- function Select(props) {
641
- const $ = reactCompilerRuntime.c(38), t0 = props;
642
- let children, customValidity, disabled, forwardedRef, gap, readOnly, rest, t1, t2, t3, t4, t5, t6;
643
- $[0] !== t0 ? ({
644
- as: t1,
645
- border: t2,
646
- children,
647
- customValidity,
648
- disabled,
649
- fontSize: t3,
650
- gap,
651
- padding: t4,
652
- radius: t5,
653
- readOnly,
654
- ref: forwardedRef,
655
- space: t6,
656
- ...rest
657
- } = 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]);
658
- 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);
659
- let t7;
660
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[14] = t7) : t7 = $[14], react.useImperativeHandle(forwardedRef, t7), _visualEditing.useCustomValidity(ref, customValidity);
661
- const t8 = gap ?? space;
662
- let t9;
663
- $[15] !== border || $[16] !== fontSize || $[17] !== padding || $[18] !== radius || $[19] !== t8 ? (t9 = css.select({
664
- border,
665
- fontSize,
666
- padding,
667
- radius,
668
- gap: t8
669
- }), $[15] = border, $[16] = fontSize, $[17] = padding, $[18] = radius, $[19] = t8, $[20] = t9) : t9 = $[20];
670
- let t10;
671
- $[21] === Symbol.for("react.memo_cache_sentinel") ? (t10 = css._inputElement(), $[21] = t10) : t10 = $[21];
672
- const t11 = disabled || readOnly;
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];
673
815
  let t12;
674
- $[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];
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];
675
820
  let t13;
676
- $[27] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css.selectPresentation(), $[27] = t13) : t13 = $[27];
677
- let t14;
678
- $[28] === Symbol.for("react.memo_cache_sentinel") ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDownIcon, {}), $[28] = t14) : t14 = $[28];
679
- let t15;
680
- $[29] !== fontSize ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, children: t14 }), $[29] = fontSize, $[30] = t15) : t15 = $[30];
681
- let t16;
682
- $[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];
683
- let t17;
684
- return $[34] !== t12 || $[35] !== t16 || $[36] !== t9 ? (t17 = /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-ui": "Select", className: t9, "data-icon-right": "", children: [
685
- t12,
686
- t16
687
- ] }), $[34] = t12, $[35] = t16, $[36] = t9, $[37] = t17) : t17 = $[37], 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;
688
822
  }
689
- const DEFAULT_SWITCH_ELEMENT = "input";
690
- function Switch(props) {
691
- const $ = reactCompilerRuntime.c(31), t0 = props;
692
- let checked, className, disabled, forwardedRef, indeterminate, readOnly, rest, style, t1;
693
- $[0] !== t0 ? ({
694
- as: t1,
695
- checked,
696
- className,
697
- disabled,
698
- indeterminate,
699
- readOnly,
700
- ref: forwardedRef,
701
- style,
702
- ...rest
703
- } = 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]);
704
- const Element2 = t1 === void 0 ? DEFAULT_SWITCH_ELEMENT : t1, ref = react.useRef(null);
705
- let t2;
706
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[10] = t2) : t2 = $[10], react.useImperativeHandle(forwardedRef, t2);
707
- let t3, t4;
708
- $[11] !== indeterminate ? (t3 = () => {
709
- ref.current && (ref.current.indeterminate = indeterminate || !1);
710
- }, t4 = [indeterminate], $[11] = indeterminate, $[12] = t3, $[13] = t4) : (t3 = $[12], t4 = $[13]), react.useEffect(t3, t4);
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,
875
+ children,
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();
883
+ let 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];
711
889
  let t5;
712
- $[14] !== className ? (t5 = css._switch({
713
- className
714
- }), $[14] = className, $[15] = t5) : t5 = $[15];
715
- const t6 = checked ? "" : void 0, t7 = indeterminate ? "" : void 0, t8 = indeterminate !== !0 && checked;
716
- let t9;
717
- $[16] === Symbol.for("react.memo_cache_sentinel") ? (t9 = css._switchElement(), $[16] = t9) : t9 = $[16];
718
- const t10 = disabled ? "" : void 0, t11 = !disabled && readOnly ? "" : void 0, t12 = disabled || readOnly;
719
- let t13;
720
- $[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];
721
- let t14;
722
- $[24] === Symbol.for("react.memo_cache_sentinel") ? (t14 = /* @__PURE__ */ jsxRuntime.jsxs("span", { "aria-hidden": !0, className: css._switchPresentation(), children: [
723
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: css._switchTrack() }),
724
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: css._switchThumb() })
725
- ] }), $[24] = t14) : t14 = $[24];
726
- let t15;
727
- 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: "inline-block", position: "relative", style, children: [
728
- t13,
729
- t14
730
- ] }), $[25] = style, $[26] = t13, $[27] = t5, $[28] = t6, $[29] = t7, $[30] = t15) : t15 = $[30], t15;
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;
731
891
  }
732
- const DEFAULT_TEXT_AREA_ELEMENT = "textarea";
733
- function TextArea(props) {
734
- const $ = reactCompilerRuntime.c(34), t0 = props;
735
- let __unstable_disableFocusRing, customValidity, forwardedRef, gap, readOnly, rest, t1, t2, t3, t4, t5, t6, t7;
736
- $[0] !== t0 ? ({
737
- __unstable_disableFocusRing,
738
- as: t1,
739
- border: t2,
740
- customValidity,
741
- disabled: t3,
742
- fontSize: t4,
743
- gap,
744
- padding: t5,
745
- radius: t6,
746
- readOnly,
747
- ref: forwardedRef,
748
- space: t7,
749
- ...rest
750
- } = 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]);
751
- 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);
752
- let t8;
753
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => ref.current, $[14] = t8) : t8 = $[14], react.useImperativeHandle(forwardedRef, t8), _visualEditing.useCustomValidity(ref, customValidity);
754
- const t9 = gap ?? space;
755
- let t10;
756
- $[15] !== border || $[16] !== fontSize || $[17] !== padding || $[18] !== radius || $[19] !== t9 ? (t10 = css.textArea({
757
- border,
758
- fontSize,
892
+ let toastId = 0;
893
+ function generateToastId() {
894
+ return String(toastId++);
895
+ }
896
+ function ToastProvider(props) {
897
+ const $ = compilerRuntime.c(13), {
898
+ children,
759
899
  padding,
760
- radius,
761
- gap: t9
762
- }), $[15] = border, $[16] = fontSize, $[17] = padding, $[18] = radius, $[19] = t9, $[20] = t10) : t10 = $[20];
763
- const t11 = customValidity ? "" : void 0, t12 = !disabled && readOnly ? "" : void 0;
764
- let t13;
765
- $[21] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css._inputElement(), $[21] = t13) : t13 = $[21];
766
- const t14 = __unstable_disableFocusRing ? "" : void 0;
767
- let t15;
768
- $[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];
769
- let t16;
770
- $[28] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: css._inputPresentation() }), $[28] = t16) : t16 = $[28];
771
- let t17;
772
- 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: [
773
- t15,
774
- t16
775
- ] }), $[29] = t10, $[30] = t11, $[31] = t12, $[32] = t15, $[33] = t17) : t17 = $[33], t17;
900
+ paddingX,
901
+ paddingY,
902
+ gap,
903
+ zOffset: t0
904
+ } = props, zOffset = t0 === void 0 ? 1 : t0;
905
+ let t1;
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;
939
+ }
940
+ function _temp$2(t0) {
941
+ const {
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);
776
948
  }
777
- function TooltipDelayGroupProvider(props) {
778
- const $ = reactCompilerRuntime.c(9), {
779
- children,
780
- delay
781
- } = 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;
782
- let t0;
783
- const t1 = isGroupActive ? 1 : openDelay;
784
- let t2;
785
- $[0] !== closeDelay || $[1] !== openTooltipId || $[2] !== setIsGroupActive || $[3] !== setOpenTooltipId || $[4] !== t1 ? (t2 = {
786
- setIsGroupActive,
787
- openTooltipId,
788
- setOpenTooltipId,
789
- openDelay: t1,
790
- closeDelay
791
- }, $[0] = closeDelay, $[1] = openTooltipId, $[2] = setIsGroupActive, $[3] = setOpenTooltipId, $[4] = t1, $[5] = t2) : t2 = $[5], t0 = t2;
792
- const value = t0;
793
- let t3;
794
- return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.TooltipDelayGroupContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t3) : t3 = $[8], t3;
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;
795
956
  }
796
- function AutocompleteOption(props) {
797
- const $ = reactCompilerRuntime.c(11), {
798
- children,
799
- id,
800
- onSelect,
801
- selected,
802
- value
803
- } = props;
804
- let t0;
805
- $[0] !== onSelect || $[1] !== value ? (t0 = () => {
806
- setTimeout(() => {
807
- onSelect(value);
808
- }, 0);
809
- }, $[0] = onSelect, $[1] = value, $[2] = t0) : t0 = $[2];
810
- const handleClick = t0;
811
- let t1;
812
- $[3] !== handleClick ? (t1 = (event) => {
813
- event.key === "Enter" && !_visualEditing._isEnterToClickElement(event.currentTarget) && handleClick();
814
- }, $[3] = handleClick, $[4] = t1) : t1 = $[4];
815
- const handleKeyDown = t1;
816
- let t2;
817
- 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;
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;
973
+ }
974
+ }
975
+ if (expanded)
976
+ return els[i];
977
+ }
978
+ return null;
818
979
  }
819
- function autocompleteReducer(state, msg) {
820
- return msg.type === "input/change" ? {
821
- ...state,
822
- activeValue: null,
823
- focused: !0,
824
- query: msg.query
825
- } : msg.type === "input/focus" ? {
826
- ...state,
827
- focused: !0
828
- } : msg.type === "root/blur" ? {
829
- ...state,
830
- focused: !1,
831
- query: null
832
- } : msg.type === "root/clear" ? {
833
- ...state,
834
- activeValue: null,
835
- query: null,
836
- value: null
837
- } : msg.type === "root/escape" ? {
838
- ...state,
839
- focused: !1,
840
- query: null
841
- } : msg.type === "root/open" ? {
842
- ...state,
843
- query: state.query || msg.query
844
- } : msg.type === "root/setActiveValue" ? {
845
- ...state,
846
- activeValue: msg.value,
847
- listFocused: msg.listFocused || state.listFocused
848
- } : msg.type === "root/setListFocused" ? {
849
- ...state,
850
- listFocused: msg.listFocused
851
- } : msg.type === "value/change" ? {
852
- ...state,
853
- activeValue: msg.value,
854
- query: null,
855
- value: msg.value
856
- } : state;
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;
857
1004
  }
858
- 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;
859
- function Autocomplete(props) {
860
- const {
861
- as = DEFAULT_AUTOCOMPLETE_ELEMENT,
862
- border = !0,
863
- customValidity,
864
- disabled,
865
- filterOption: filterOptionProp,
866
- fontSize = 2,
867
- icon,
868
- id,
869
- listBox = _visualEditing.EMPTY_RECORD,
870
- loading,
871
- onBlur,
872
- onChange,
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
+ }
1010
+ }
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;
1015
+ $[0] !== t0 ? ({
1016
+ children,
1017
+ gap,
1018
+ space: t1,
873
1019
  onFocus,
874
- onQueryChange,
875
- onSelect,
876
- openButton,
877
- openOnFocus,
878
- options: optionsProp,
879
- padding: paddingProp = 3,
880
- popover = _visualEditing.EMPTY_RECORD,
881
- prefix,
882
- radius = 2,
883
- readOnly,
884
1020
  ref: forwardedRef,
885
- relatedElements,
886
- renderOption: renderOptionProp,
887
- renderPopover,
888
- renderValue = DEFAULT_RENDER_VALUE,
889
- suffix,
890
- value: valueProp,
891
1021
  ...rest
892
- } = props, [state, dispatch] = react.useReducer(autocompleteReducer, {
893
- activeValue: valueProp || null,
894
- focused: !1,
895
- listFocused: !1,
896
- query: null,
897
- value: valueProp || null
898
- }), {
899
- activeValue,
900
- focused,
901
- listFocused,
902
- query,
903
- value
904
- } = state, defaultRenderOption = react.useCallback(({
905
- value: value_0
906
- }) => /* @__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);
907
- react.useImperativeHandle(forwardedRef, () => inputElementRef.current);
908
- 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) => {
909
- setTimeout(() => {
910
- if (popoverMouseWithinRef.current)
911
- return;
912
- const elements = (relatedElements || []).concat(rootElementRef.current ? [rootElementRef.current] : [], resultsPopoverElementRef.current ? [resultsPopoverElementRef.current] : []);
913
- let focusInside = !1;
914
- if (document.activeElement) {
915
- for (const e of elements)
916
- if (e === document.activeElement || e.contains(document.activeElement)) {
917
- focusInside = !0;
918
- break;
919
- }
920
- }
921
- focusInside === !1 && (dispatch({
922
- type: "root/blur"
923
- }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
924
- }, 0);
925
- }, [onBlur, onQueryChange, relatedElements]), handleRootFocus = react.useCallback((event_0) => {
926
- const listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = listBoxElement?.contains(focusedElement) || !1;
927
- listFocused_0 !== listFocusedRef.current && (listFocusedRef.current = listFocused_0, dispatch({
928
- type: "root/setListFocused",
929
- listFocused: listFocused_0
930
- }));
931
- }, []), handleOptionSelect = react.useCallback((v) => {
932
- dispatch({
933
- type: "value/change",
934
- value: v
935
- }), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
936
- }, [onChange, onSelect, onQueryChange]), handleRootKeyDown = react.useCallback((event_1) => {
937
- if (event_1.key === "ArrowDown") {
938
- if (event_1.preventDefault(), !filteredOptionsLen) return;
939
- const activeOption = filteredOptions.find((o_0) => o_0.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
940
- nextActiveOption && dispatch({
941
- type: "root/setActiveValue",
942
- value: nextActiveOption.value,
943
- listFocused: !0
944
- });
945
- return;
946
- }
947
- if (event_1.key === "ArrowUp") {
948
- if (event_1.preventDefault(), !filteredOptionsLen) return;
949
- 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];
950
- nextActiveOption_0 && dispatch({
951
- type: "root/setActiveValue",
952
- value: nextActiveOption_0.value,
953
- listFocused: !0
954
- });
955
- return;
956
- }
957
- if (event_1.key === "Escape") {
958
- dispatch({
959
- type: "root/escape"
960
- }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
961
- return;
962
- }
963
- const target = event_1.target, listEl = listBoxElementRef.current;
964
- if ((listEl === target || listEl?.contains(target)) && !AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event_1.key)) {
965
- inputElementRef.current?.focus();
966
- return;
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);
1033
+ let t6;
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);
1043
+ let t11;
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
967
1049
  }
968
- }, [activeValue, filteredOptions, filteredOptionsLen, onQueryChange]), handleInputChange = react.useCallback((event_2) => {
969
- const nextQuery = event_2.currentTarget.value;
970
- dispatch({
971
- type: "input/change",
972
- query: nextQuery
973
- }), onQueryChange && onQueryChange(nextQuery);
974
- }, [onQueryChange]), dispatchOpen = react.useCallback(() => {
975
- dispatch({
976
- type: "root/open",
977
- query: value ? renderValue(value, currentOption) : ""
978
- });
979
- }, [currentOption, renderValue, value]), handleInputFocus = react.useCallback((event_3) => {
980
- focused || (dispatch({
981
- type: "input/focus"
982
- }), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
983
- }, [focused, onFocus, openOnFocus, dispatchOpen]), handlePopoverMouseEnter = react.useCallback(() => {
984
- popoverMouseWithinRef.current = !0;
985
- }, []), handlePopoverMouseLeave = react.useCallback(() => {
986
- popoverMouseWithinRef.current = !1;
987
- }, []), handleClearButtonClick = react.useCallback(() => {
988
- dispatch({
989
- type: "root/clear"
990
- }), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
991
- }, [onChange, onQueryChange]), handleClearButtonFocus = react.useCallback(() => {
992
- dispatch({
993
- type: "input/focus"
1050
+ })), selected && setFocusedElement(element), () => {
1051
+ setState((s_0) => {
1052
+ const newState = {
1053
+ ...s_0
1054
+ };
1055
+ return delete newState[path_0], newState;
994
1056
  });
995
- }, []);
996
- react.useEffect(() => {
997
- if (valueProp !== valuePropRef.current) {
998
- valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
999
- type: "value/change",
1000
- value: valueProp
1001
- }), valueRef.current = valueProp);
1002
- return;
1003
- }
1004
- valueProp !== valueRef.current && (valueRef.current = valueProp || null, dispatch({
1005
- type: "value/change",
1006
- value: valueProp || null
1007
- }));
1008
- }, [valueProp]), react.useEffect(() => {
1009
- !focused && valueRef.current && dispatch({
1010
- type: "root/setActiveValue",
1011
- value: valueRef.current
1057
+ }), $[17] = t11) : t11 = $[17];
1058
+ const registerItem = t11;
1059
+ let t12;
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;
1012
1070
  });
1013
- }, [focused]), react.useEffect(() => {
1014
- const listElement = listBoxElementRef.current;
1015
- if (!listElement) return;
1016
- const activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
1017
- if (activeOption_1) {
1018
- const activeIndex_1 = filteredOptions.indexOf(activeOption_1), activeItemElement = listElement.childNodes[activeIndex_1];
1019
- if (activeItemElement) {
1020
- if (_hasFocus(activeItemElement))
1071
+ }, $[18] = t12) : t12 = $[18];
1072
+ const setExpanded = t12;
1073
+ let t13;
1074
+ const t14 = focusedElement || itemElements[0] || null;
1075
+ let t15;
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;
1088
+ let 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)
1021
1107
  return;
1022
- focusFirstDescendant(activeItemElement);
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;
1023
1146
  }
1024
1147
  }
1025
- }, [activeValue, filteredOptions]);
1026
- const clearButton = react.useMemo(() => {
1027
- if (!loading && !disabled && value)
1028
- return {
1029
- "aria-label": "Clear",
1030
- onFocus: handleClearButtonFocus
1031
- };
1032
- }, [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) => {
1033
- dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
1034
- }, [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) => {
1035
- event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
1036
- }, [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) => {
1037
- const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
1038
- 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), {
1039
- disabled: loading,
1040
- selected: active,
1041
- tabIndex: listFocused && active ? 0 : -1
1042
- }) }, option_0.value);
1043
- }) }) }), [activeValue, currentOption, filteredOptions, handleOptionSelect, handleListBoxKeyDown, id, listBox, listBoxId, listFocused, loading, renderOption]), results = react.useMemo(() => renderPopover ? renderPopover({
1044
- content: content2,
1045
- hidden: !expanded,
1046
- inputElement: inputElementRef.current,
1047
- onMouseEnter: handlePopoverMouseEnter,
1048
- onMouseLeave: handlePopoverMouseLeave
1049
- }, 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]);
1050
- return (
1051
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
1052
- /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
1053
- input,
1054
- results
1055
- ] })
1056
- );
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;
1057
1169
  }
1058
- const DEFAULT_BREADCRUMBS_ELEMENT = "nav";
1059
- function Breadcrumbs(props) {
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) {
1060
1189
  const {
1061
- as = DEFAULT_BREADCRUMBS_ELEMENT,
1062
1190
  children,
1063
1191
  className,
1064
- expandButton: expandButtonProps,
1065
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1066
- gap: _gapProp,
1067
- gapX = props.gap ?? props.space ?? 2,
1068
- gapY = props.gap ?? props.space ?? 2,
1069
- maxLength,
1070
- separator,
1071
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1072
- space: _spaceProp,
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,
1073
1206
  ...rest
1074
- } = props, [open, setOpen] = react.useState(!1), expandElementRef = react.useRef(null), popoverElementRef = react.useRef(null), collapse = react.useCallback(() => setOpen(!1), []), expand = react.useCallback(() => setOpen(!0), []);
1075
- _visualEditing.useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current]);
1076
- const rawItems = react.useMemo(() => react.Children.toArray(children).filter(react.isValidElement), [children]), items = react.useMemo(() => {
1077
- const len = rawItems.length;
1078
- if (maxLength && len > maxLength) {
1079
- const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
1080
- 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)];
1081
- }
1082
- return rawItems;
1083
- }, [collapse, expand, expandButtonProps, gapY, maxLength, open, rawItems]);
1084
- return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Flex, { as, "data-ui": "Breadcrumbs", ...rest, className: css.breadcrumbs({
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({
1085
1240
  className
1086
- }), gapX, gapY, children: items.map((item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
1087
- itemIndex > 0 && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": !0, as: "li", children: separator || /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted: !0, children: "/" }) }),
1088
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { as: "li", children: item })
1089
- ] }, itemIndex)) });
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
+ ] });
1090
1280
  }
1091
- function isTargetWithinScope(boundaryElement, portalElement, target) {
1092
- return !boundaryElement || !portalElement ? !0 : _visualEditing.containsOrEqualsElement(boundaryElement, target) || _visualEditing.containsOrEqualsElement(portalElement, target);
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");
1093
1285
  }
1094
- const DEFAULT_DIALOG_CARD_ELEMENT = "div";
1095
- function DialogCard(props) {
1096
- const $ = reactCompilerRuntime.c(51), t0 = props;
1097
- let autoFocus, children, footer, forwardedContentRef, forwardedRef, header, hideCloseButton, id, onClickOutside, onClose, portalProp, rest, t1;
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;
1098
1290
  $[0] !== t0 ? ({
1099
- __unstable_autoFocus: autoFocus,
1100
- __unstable_hideCloseButton: hideCloseButton,
1101
1291
  as: t1,
1102
- children,
1103
- contentRef: forwardedContentRef,
1104
- footer,
1105
- header,
1106
- id,
1107
- onClickOutside,
1108
- onClose,
1109
- portal: portalProp,
1292
+ gap: t2,
1293
+ getItemKey,
1294
+ items: t3,
1295
+ onChange,
1296
+ renderItem,
1110
1297
  ref: forwardedRef,
1111
1298
  ...rest
1112
- } = 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]);
1113
- 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(), {
1114
- isTopLayer
1115
- } = layer, labelId = `${id}_label`, showCloseButton = !!onClose && hideCloseButton === !1, showHeader = !!header || showCloseButton;
1116
- let t2;
1117
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[14] = t2) : t2 = $[14], react.useImperativeHandle(forwardedRef, t2);
1118
- let t3;
1119
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => contentRef.current, $[15] = t3) : t3 = $[15], react.useImperativeHandle(forwardedContentRef, t3);
1120
- let t4, t5;
1121
- $[16] !== autoFocus ? (t4 = () => {
1122
- autoFocus && ref.current && focusFirstDescendant(ref.current);
1123
- }, t5 = [autoFocus, ref], $[16] = autoFocus, $[17] = t4, $[18] = t5) : (t4 = $[17], t5 = $[18]), react.useEffect(t4, t5);
1124
- let t6;
1125
- $[19] !== boundaryElement || $[20] !== isTopLayer || $[21] !== onClose || $[22] !== portalElement ? (t6 = (event) => {
1126
- if (!isTopLayer || !onClose)
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)
1127
1309
  return;
1128
- const target = document.activeElement;
1129
- target && !isTargetWithinScope(boundaryElement, portalElement, target) || event.key === "Escape" && (event.preventDefault(), event.stopPropagation(), onClose());
1130
- }, $[19] = boundaryElement, $[20] = isTopLayer, $[21] = onClose, $[22] = portalElement, $[23] = t6) : t6 = $[23], _visualEditing.useGlobalKeyDown(t6);
1131
- let t7;
1132
- $[24] !== boundaryElement || $[25] !== isTopLayer || $[26] !== onClickOutside || $[27] !== portalElement ? (t7 = isTopLayer && onClickOutside && ((event_0) => {
1133
- const target_0 = event_0.target;
1134
- target_0 && !isTargetWithinScope(boundaryElement, portalElement, target_0) || onClickOutside();
1135
- }), $[24] = boundaryElement, $[25] = isTopLayer, $[26] = onClickOutside, $[27] = portalElement, $[28] = t7) : t7 = $[28];
1136
- let t8;
1137
- $[29] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => [ref.current], $[29] = t8) : t8 = $[29], _visualEditing.useClickOutsideEvent(t7, t8);
1138
- let t9;
1139
- $[30] === Symbol.for("react.memo_cache_sentinel") ? (t9 = css.dialogCard(), $[30] = t9) : t9 = $[30];
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
+ };
1326
+ }
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);
1140
1350
  let t10;
1141
- $[31] === Symbol.for("react.memo_cache_sentinel") ? (t10 = css.dialogLayout(), $[31] = t10) : t10 = $[31];
1351
+ $[23] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => {
1352
+ setItemHeight(-1);
1353
+ }, $[23] = t10) : t10 = $[23];
1142
1354
  let t11;
1143
- $[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: [
1144
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, padding: 2, children: header && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { id: labelId, size: 1, weight: "semibold", children: header }) }),
1145
- 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 }) })
1146
- ] }) }), $[32] = header, $[33] = labelId, $[34] = onClose, $[35] = showCloseButton, $[36] = showHeader, $[37] = t11) : t11 = $[37];
1355
+ $[24] !== renderItem ? (t11 = [renderItem], $[24] = renderItem, $[25] = t11) : t11 = $[25], react.useEffect(t10, t11);
1147
1356
  let t12;
1148
- $[38] === Symbol.for("react.memo_cache_sentinel") ? (t12 = css.dialogContent(), $[38] = t12) : t12 = $[38];
1149
- let t13;
1150
- $[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];
1151
- let t14;
1152
- $[41] !== footer ? (t14 = footer && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { className: css.dialogFooter(), position: "relative", children: footer }), $[41] = footer, $[42] = t14) : t14 = $[42];
1153
- let t15;
1154
- $[43] !== t11 || $[44] !== t13 || $[45] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { className: t10, direction: "column", flex: 1, children: [
1155
- t11,
1156
- t13,
1157
- t14
1158
- ] }), $[43] = t11, $[44] = t13, $[45] = t14, $[46] = t15) : t15 = $[46];
1159
- let t16;
1160
- 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;
1161
- }
1162
- const DialogContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/dialog", {
1163
- version: 0
1164
- });
1165
- function useDialog() {
1166
- return react.useContext(DialogContext);
1167
- }
1168
- const DEFAULT_DIALOG_ELEMENT = "div";
1169
- function Dialog(props) {
1170
- const $ = reactCompilerRuntime.c(69), context = useDialog(), t0 = props;
1171
- let _positionProp, _zOffsetProp, children, className, contentRef, footer, header, id, onActivate, onClickOutside, onClose, onFocus, portalProp, rest, scheme, t1, t2, t3, t4, t5, t6, t7, tone;
1172
- $[0] !== t0 ? ({
1173
- __unstable_autoFocus: t1,
1174
- __unstable_hideCloseButton: t2,
1175
- animate: t3,
1176
- cardRadius: t4,
1177
- children,
1178
- className,
1179
- contentRef,
1180
- footer,
1181
- header,
1182
- id,
1183
- onActivate,
1184
- onClickOutside,
1185
- onClose,
1186
- onFocus,
1187
- padding: t5,
1188
- portal: portalProp,
1189
- position: _positionProp,
1190
- scheme,
1191
- shadow: t6,
1192
- width: t7,
1193
- zOffset: _zOffsetProp,
1194
- tone,
1195
- ...rest
1196
- } = 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]);
1197
- 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);
1198
- let t8;
1199
- $[24] !== onFocus ? (t8 = (event) => {
1200
- onFocus?.(event);
1201
- const target = event.target, cardElement = cardRef.current;
1202
- if (cardElement && target === preDivRef.current) {
1203
- focusLastDescendant(cardElement);
1204
- return;
1357
+ bb0: {
1358
+ if (!renderItem || items.length === 0) {
1359
+ t12 = null;
1360
+ break bb0;
1205
1361
  }
1206
- if (cardElement && target === postDivRef.current) {
1207
- focusFirstDescendant(cardElement);
1208
- return;
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;
1209
1382
  }
1210
- _visualEditing.isHTMLElement(event.target) && (focusedElementRef.current = event.target);
1211
- }, $[24] = onFocus, $[25] = t8) : t8 = $[25];
1212
- const handleFocus = t8, labelId = `${id}_label`, rootClickTimeoutRef = react.useRef(void 0);
1213
- let t9;
1214
- $[26] !== boundaryElement || $[27] !== portalElement ? (t9 = () => {
1215
- rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
1216
- const activeElement = document.activeElement;
1217
- if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
1218
- const target_0 = focusedElementRef.current;
1219
- if (!target_0 || !document.body.contains(target_0)) {
1220
- const cardElement_0 = cardRef.current;
1221
- cardElement_0 && focusFirstDescendant(cardElement_0);
1222
- return;
1223
- }
1224
- target_0.focus();
1225
- }
1226
- }, 0);
1227
- }, $[26] = boundaryElement, $[27] = portalElement, $[28] = t9) : t9 = $[28];
1228
- const handleRootClick = t9;
1229
- let t10;
1230
- $[29] !== className ? (t10 = css.dialog({
1231
- className
1232
- }), $[29] = className, $[30] = t10) : t10 = $[30];
1233
- const t11 = animate ? "" : void 0;
1234
- let t12;
1235
- $[31] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: preDivRef, tabIndex: 0 }), $[31] = t12) : t12 = $[31];
1236
- let t13;
1237
- $[32] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css.dialogContainer(), $[32] = t13) : t13 = $[32];
1238
- let t14;
1239
- $[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];
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;
1240
1402
  let t15;
1241
- $[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];
1242
1404
  let t16;
1243
- $[52] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: postDivRef, tabIndex: 0 }), $[52] = t16) : t16 = $[52];
1244
- let t17;
1245
- $[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: [
1246
- t12,
1247
- t15,
1248
- t16
1249
- ] }), $[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];
1250
- let t18;
1251
- 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;
1252
1406
  }
1253
- function DialogProvider(props) {
1254
- const $ = reactCompilerRuntime.c(6), {
1255
- children,
1256
- position,
1257
- zOffset
1258
- } = props;
1259
- let t0, t1;
1260
- $[0] !== position || $[1] !== zOffset ? (t1 = {
1261
- version: 0,
1262
- position,
1263
- zOffset
1264
- }, $[0] = position, $[1] = zOffset, $[2] = t1) : t1 = $[2], t0 = t1;
1265
- const contextValue = t0;
1266
- let t2;
1267
- 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;
1268
1412
  }
1269
- function MenuButton(props) {
1270
- const $ = reactCompilerRuntime.c(63), {
1271
- __unstable_disableRestoreFocusOnClose: t0,
1272
- boundaryElement: deprecated_boundaryElement,
1273
- button: buttonProp,
1274
- id,
1275
- menu: menuProp,
1276
- onClose,
1277
- onOpen,
1278
- placement: deprecated_placement,
1279
- popoverScheme: deprecated_popoverScheme,
1280
- portal: t1,
1281
- popover,
1282
- popoverRadius: deprecated_popoverRadius,
1283
- preventOverflow: deprecated_preventOverflow,
1284
- ref: forwardedRef
1285
- } = 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);
1286
- let t2;
1287
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[0] = t2) : t2 = $[0];
1288
- const [menuElements, setChildMenuElements] = react.useState(t2), openRef = react.useRef(open);
1289
- let t3, t4;
1290
- $[1] !== onOpen || $[2] !== open ? (t3 = () => {
1291
- onOpen && open && !openRef.current && onOpen();
1292
- }, t4 = [onOpen, open], $[1] = onOpen, $[2] = open, $[3] = t3, $[4] = t4) : (t3 = $[3], t4 = $[4]), react.useEffect(t3, t4);
1293
- let t5, t6;
1294
- $[5] !== onClose || $[6] !== open ? (t5 = () => {
1295
- onClose && !open && openRef.current && onClose();
1296
- }, t6 = [onClose, open], $[5] = onClose, $[6] = open, $[7] = t5, $[8] = t6) : (t5 = $[7], t6 = $[8]), react.useEffect(t5, t6);
1297
- let t7, t8;
1298
- $[9] !== open ? (t7 = () => {
1299
- openRef.current = open;
1300
- }, t8 = [open], $[9] = open, $[10] = t7, $[11] = t8) : (t7 = $[10], t8 = $[11]), react.useEffect(t7, t8);
1301
- let t9;
1302
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
1303
- setOpen(_temp$2), setShouldFocus(null);
1304
- }, $[12] = t9) : t9 = $[12];
1305
- const handleButtonClick = t9;
1306
- let t10;
1307
- $[13] !== open ? (t10 = (event) => {
1308
- open && event.preventDefault();
1309
- }, $[13] = open, $[14] = t10) : t10 = $[14];
1310
- const handleMouseDown = t10;
1311
- let t11;
1312
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (event_0) => {
1313
- if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
1314
- 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;
1315
1436
  return;
1316
1437
  }
1317
- if (event_0.key === "ArrowUp") {
1318
- 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)
1319
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
+ };
1320
1487
  }
1321
- }, $[15] = t11) : t11 = $[15];
1322
- const handleButtonKeyDown = t11;
1323
- let t12;
1324
- $[16] !== buttonElement || $[17] !== menuElements ? (t12 = (event_1) => {
1325
- const target = event_1.target;
1326
- if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
1327
- for (const el of menuElements)
1328
- if (target === el || el.contains(target))
1329
- return;
1330
- setOpen(!1);
1331
- }
1332
- }, $[16] = buttonElement, $[17] = menuElements, $[18] = t12) : t12 = $[18];
1333
- const handleMenuClickOutside = t12;
1334
- let t13;
1335
- $[19] !== buttonElement || $[20] !== disableRestoreFocusOnClose ? (t13 = () => {
1336
- setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
1337
- }, $[19] = buttonElement, $[20] = disableRestoreFocusOnClose, $[21] = t13) : t13 = $[21];
1338
- const handleMenuEscape = t13;
1339
- let t14;
1340
- $[22] !== menuElements ? (t14 = (event_2) => {
1341
- const target_0 = event_2.relatedTarget;
1342
- if (target_0 instanceof Node) {
1343
- for (const el_0 of menuElements)
1344
- if (el_0 === target_0 || el_0.contains(target_0))
1345
- return;
1346
- setOpen(!1);
1347
- }
1348
- }, $[22] = menuElements, $[23] = t14) : t14 = $[23];
1349
- const handleBlur = t14;
1350
- let t15;
1351
- $[24] !== buttonElement || $[25] !== disableRestoreFocusOnClose ? (t15 = () => {
1352
- setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
1353
- }, $[24] = buttonElement, $[25] = disableRestoreFocusOnClose, $[26] = t15) : t15 = $[26];
1354
- const handleItemClick = t15;
1355
- let t16;
1356
- $[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];
1357
- const registerElement = t16;
1358
- let t17;
1359
- $[28] !== buttonElement || $[29] !== handleBlur || $[30] !== handleItemClick || $[31] !== handleMenuClickOutside || $[32] !== handleMenuEscape || $[33] !== id || $[34] !== menuProp || $[35] !== shouldFocus ? (t17 = menuProp && react.cloneElement(menuProp, {
1360
- "aria-labelledby": id,
1361
- onBlurCapture: handleBlur,
1362
- onClickOutside: handleMenuClickOutside,
1363
- onEscape: handleMenuEscape,
1364
- onItemClick: handleItemClick,
1365
- originElement: buttonElement,
1366
- registerElement,
1367
- shouldFocus
1368
- }), $[28] = buttonElement, $[29] = handleBlur, $[30] = handleItemClick, $[31] = handleMenuClickOutside, $[32] = handleMenuEscape, $[33] = id, $[34] = menuProp, $[35] = shouldFocus, $[36] = t17) : t17 = $[36];
1369
- const menu = t17;
1370
- let t18;
1371
- bb0: {
1372
- if (!buttonProp) {
1373
- t18 = null;
1374
- 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
+ };
1375
1503
  }
1376
- const t192 = buttonProp.props.selected ?? open;
1377
- let t202;
1378
- $[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open || $[41] !== t192 ? (t202 = react.cloneElement(buttonProp, {
1379
- "data-ui": "MenuButton",
1380
- id,
1381
- onClick: handleButtonClick,
1382
- onKeyDown: handleButtonKeyDown,
1383
- onMouseDown: handleMouseDown,
1384
- "aria-haspopup": !0,
1385
- "aria-expanded": open,
1386
- ref: setButtonElement,
1387
- selected: t192
1388
- }), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] = t192, $[42] = t202) : t202 = $[42], t18 = t202;
1389
- }
1390
- const button = t18;
1391
- let t19, t20;
1392
- $[43] !== buttonElement ? (t19 = () => buttonElement, t20 = [buttonElement], $[43] = buttonElement, $[44] = t19, $[45] = t20) : (t19 = $[44], t20 = $[45]), react.useImperativeHandle(forwardedRef, t19, t20);
1393
- let t21, t22;
1394
- $[46] !== popover ? (t22 = popover || {}, $[46] = popover, $[47] = t22) : t22 = $[47];
1395
- let t23;
1396
- $[48] !== deprecated_boundaryElement || $[49] !== deprecated_placement || $[50] !== deprecated_popoverRadius || $[51] !== deprecated_popoverScheme || $[52] !== deprecated_portal || $[53] !== deprecated_preventOverflow || $[54] !== t22 ? (t23 = {
1397
- boundaryElement: deprecated_boundaryElement,
1398
- overflow: "auto",
1399
- placement: deprecated_placement,
1400
- portal: deprecated_portal,
1401
- preventOverflow: deprecated_preventOverflow,
1402
- radius: deprecated_popoverRadius,
1403
- scheme: deprecated_popoverScheme,
1404
- ...t22
1405
- }, $[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;
1406
- const popoverProps = t21;
1407
- let t24;
1408
- $[56] !== button ? (t24 = button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}), $[56] = button, $[57] = t24) : t24 = $[57];
1409
- let t25;
1410
- 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
+ };
1411
1505
  }
1412
- function _temp$2(v) {
1413
- 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;
1414
1513
  }
1415
- const DEFAULT_SKELETON_ELEMENT = "div";
1416
- function Skeleton(props) {
1417
- const $ = reactCompilerRuntime.c(17), t0 = props;
1418
- let className, delay, radius, rest, t1;
1419
- $[0] !== t0 ? ({
1420
- 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,
1421
1531
  className,
1422
- delay,
1423
- radius,
1424
- ...rest
1425
- } = t0, $[0] = t0, $[1] = className, $[2] = delay, $[3] = radius, $[4] = rest, $[5] = t1) : (className = $[1], delay = $[2], radius = $[3], rest = $[4], t1 = $[5]);
1426
- const animated = t1 === void 0 ? !1 : t1, [visible, setVisible] = react.useState(!delay);
1427
- let t2, t3;
1428
- $[6] !== delay ? (t2 = () => {
1429
- if (!delay)
1430
- return setVisible(!0);
1431
- const timeout = setTimeout(() => {
1432
- setVisible(!0);
1433
- }, delay);
1434
- return () => {
1435
- clearTimeout(timeout);
1436
- };
1437
- }, t3 = [delay], $[6] = delay, $[7] = t2, $[8] = t3) : (t2 = $[7], t3 = $[8]), react.useEffect(t2, t3);
1532
+ muted: t1,
1533
+ size: t2,
1534
+ textOverflow: textOverflowProp,
1535
+ weight: t3,
1536
+ ...rest
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;
1438
1539
  let t4;
1439
- $[9] !== className || $[10] !== radius ? (t4 = css.skeleton({
1540
+ $[11] !== accent || $[12] !== align || $[13] !== className || $[14] !== muted || $[15] !== size || $[16] !== weight ? (t4 = css.label({
1440
1541
  className,
1441
- radius
1442
- }), $[9] = className, $[10] = radius, $[11] = t4) : t4 = $[11];
1443
- 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];
1444
1554
  let t7;
1445
- 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;
1446
1556
  }
1447
- const DEFAULT_CODE_SKELETON_ELEMENT = "div";
1448
- function CodeSkeleton(props) {
1449
- const $ = reactCompilerRuntime.c(10), t0 = props;
1450
- 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;
1451
1561
  $[0] !== t0 ? ({
1562
+ __unstable_hideInnerStroke,
1563
+ as: t1,
1452
1564
  className,
1453
- size: t1,
1565
+ color: t2,
1566
+ src,
1567
+ title,
1568
+ initials,
1569
+ onImageLoadError,
1570
+ arrowPosition: arrowPositionProp,
1571
+ animateArrowFrom,
1572
+ status: t3,
1573
+ size: t4,
1454
1574
  ...rest
1455
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1456
- const size = t1 === void 0 ? 2 : t1;
1457
- let t2;
1458
- $[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({
1459
1598
  className,
1460
- size
1461
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
1462
- let t3;
1463
- 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;
1464
1622
  }
1465
- const DEFAULT_HEADING_SKELETON_ELEMENT = "div";
1466
- function HeadingSkeleton(props) {
1467
- const $ = reactCompilerRuntime.c(10), t0 = props;
1468
- let className, rest, t1;
1623
+ function _temp$1(s) {
1624
+ return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
1625
+ }
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;
1469
1630
  $[0] !== t0 ? ({
1631
+ as: t1,
1470
1632
  className,
1471
- size: t1,
1633
+ count,
1634
+ size: t2,
1472
1635
  ...rest
1473
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1474
- const size = t1 === void 0 ? 2 : t1;
1475
- let t2;
1476
- $[4] !== className || $[5] !== size ? (t2 = css.headingSkeleton({
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({
1477
1643
  className,
1478
1644
  size
1479
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
1480
- let t3;
1481
- 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;
1482
1650
  }
1483
- const DEFAULT_LABEL_SKELETON_ELEMENT = "div";
1484
- function LabelSkeleton(props) {
1485
- const $ = reactCompilerRuntime.c(10), t0 = props;
1486
- 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;
1487
1658
  $[0] !== t0 ? ({
1659
+ as: t1,
1660
+ children: childrenProp,
1488
1661
  className,
1489
- size: t1,
1662
+ maxLength: t2,
1663
+ size: t3,
1490
1664
  ...rest
1491
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1492
- const size = t1 === void 0 ? 2 : t1;
1493
- let t2;
1494
- $[4] !== className || $[5] !== size ? (t2 = css.labelSkeleton({
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({
1495
1669
  className,
1496
1670
  size
1497
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
1498
- let t3;
1499
- 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;
1500
1684
  }
1501
- const DEFAULT_TEXT_SKELETON_ELEMENT = "div";
1502
- function TextSkeleton(props) {
1503
- const $ = reactCompilerRuntime.c(10), t0 = props;
1504
- let className, rest, t1;
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;
1505
1689
  $[0] !== t0 ? ({
1690
+ as: t1,
1691
+ children,
1506
1692
  className,
1507
- size: t1,
1693
+ fontSize: t2,
1694
+ padding: t3,
1695
+ radius: t4,
1696
+ tone: t5,
1508
1697
  ...rest
1509
- } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1510
- const size = t1 === void 0 ? 2 : t1;
1511
- let t2;
1512
- $[4] !== className || $[5] !== size ? (t2 = css.textSkeleton({
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;
1700
+ let t6;
1701
+ $[9] !== className || $[10] !== tone ? (t6 = css.badge({
1513
1702
  className,
1514
- size
1515
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
1516
- let t3;
1517
- return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1703
+ tone
1704
+ }), $[9] = className, $[10] = tone, $[11] = t6) : t6 = $[11];
1705
+ let t7;
1706
+ $[12] !== children || $[13] !== fontSize ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, children }), $[12] = children, $[13] = fontSize, $[14] = t7) : t7 = $[14];
1707
+ let t8;
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;
1518
1709
  }
1519
- const DEFAULT_TAB_PANEL_ELEMENT = "div";
1520
- function TabPanel(props) {
1521
- const $ = reactCompilerRuntime.c(10), t0 = props;
1522
- let children, rest, t1, tabIndex;
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;
1523
1714
  $[0] !== t0 ? ({
1524
1715
  as: t1,
1525
- children,
1526
- tabIndex,
1716
+ className,
1717
+ disabled,
1718
+ indeterminate,
1719
+ customValidity,
1720
+ readOnly,
1721
+ ref: forwardedRef,
1722
+ style,
1527
1723
  ...rest
1528
- } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1, $[4] = tabIndex) : (children = $[1], rest = $[2], t1 = $[3], tabIndex = $[4]);
1529
- const as = t1 === void 0 ? DEFAULT_TAB_PANEL_ELEMENT : t1, t2 = tabIndex === void 0 ? 0 : tabIndex;
1530
- let t3;
1531
- 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;
1532
- }
1533
- const DEFAULT_TOAST_ELEMENT = "li", ROLES = {
1534
- error: "alert",
1535
- warning: "alert",
1536
- success: "alert",
1537
- info: "alert"
1538
- }, STATUS_CARD_TONE = {
1539
- error: "critical",
1540
- warning: "caution",
1541
- success: "positive",
1542
- info: "neutral"
1543
- }, BUTTON_TONE = {
1544
- error: "critical",
1545
- warning: "caution",
1546
- success: "positive",
1547
- info: "neutral"
1548
- };
1549
- function Toast(props) {
1550
- const $ = reactCompilerRuntime.c(40), t0 = props;
1551
- let closable, description, onClose, rest, status, t1, t2, title;
1552
- if ($[0] !== t0) {
1553
- const {
1554
- as: t32,
1555
- closable: t42,
1556
- description: t52,
1557
- duration,
1558
- onClose: t62,
1559
- radius: t72,
1560
- title: t82,
1561
- status: t92,
1562
- updatedAt,
1563
- ...t102
1564
- } = t0;
1565
- 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;
1566
- } else
1567
- closable = $[1], description = $[2], onClose = $[3], rest = $[4], status = $[5], t1 = $[6], t2 = $[7], title = $[8];
1568
- 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;
1569
- let t3;
1570
- $[9] !== visualDuration ? (t3 = visualDuration ? {
1571
- type: "spring",
1572
- visualDuration,
1573
- bounce: 0.25
1574
- } : {
1575
- duration: 0
1576
- }, $[9] = visualDuration, $[10] = t3) : t3 = $[10];
1577
- const transition = t3;
1578
- let t4;
1579
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t4 = ["hidden", "initial"], $[11] = t4) : t4 = $[11];
1580
- const initial = t4;
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);
1581
1732
  let t5;
1582
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t5 = ["visible", "slideIn"], $[12] = t5) : t5 = $[12];
1583
- const animate = t5;
1733
+ $[14] !== className ? (t5 = css.checkbox({
1734
+ className
1735
+ }), $[14] = className, $[15] = t5) : t5 = $[15];
1584
1736
  let t6;
1585
- $[13] === Symbol.for("react.memo_cache_sentinel") ? (t6 = ["hidden", "slideOut"], $[13] = t6) : t6 = $[13];
1586
- const exit = t6;
1587
- let t7;
1588
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t7 = css.toast(), $[14] = t7) : t7 = $[14];
1589
- let t8;
1590
- $[15] !== title ? (t8 = title && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: 1, weight: "medium", children: title }), $[15] = title, $[16] = t8) : t8 = $[16];
1591
- let t9;
1592
- $[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];
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;
1593
1739
  let t10;
1594
- $[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: [
1595
- t8,
1596
- t9
1597
- ] }) }), $[20] = t8, $[21] = t9, $[22] = t10) : t10 = $[22];
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];
1598
1741
  let t11;
1599
- $[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: {
1600
- verticalAlign: "top"
1601
- } }) }), $[23] = buttonTone, $[24] = closable, $[25] = onClose, $[26] = t11) : t11 = $[26];
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];
1602
1746
  let t12;
1603
- $[27] !== t10 || $[28] !== t11 || $[29] !== transition ? (t12 = /* @__PURE__ */ jsxRuntime.jsxs(MotionFlex, { align: "flex-start", variants: content, transition, children: [
1747
+ return $[25] !== style || $[26] !== t10 || $[27] !== t5 ? (t12 = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: t5, "data-ui": "Checkbox", style, children: [
1604
1748
  t10,
1605
1749
  t11
1606
- ] }), $[27] = t10, $[28] = t11, $[29] = transition, $[30] = t12) : t12 = $[30];
1607
- let t13;
1608
- 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;
1609
- }
1610
- const container = {
1611
- initial: {
1612
- y: 32,
1613
- scale: 0.5,
1614
- zIndex: 1
1615
- },
1616
- hidden: {
1617
- opacity: 0
1618
- },
1619
- visible: (visualDuration) => visualDuration ? {
1620
- opacity: 1,
1621
- transition: {
1622
- when: "beforeChildren",
1623
- staggerChildren: visualDuration / 3,
1624
- duration: visualDuration / 3
1625
- }
1626
- } : {
1627
- opacity: 1
1628
- },
1629
- slideIn: {
1630
- y: 0,
1631
- scale: 1
1632
- },
1633
- slideOut: {
1634
- zIndex: 0,
1635
- scale: 0.75
1636
- }
1637
- }, content = {
1638
- initial: {
1639
- willChange: "transform"
1640
- },
1641
- hidden: {
1642
- opacity: 0
1643
- },
1644
- visible: {
1645
- opacity: 1
1646
- }
1647
- }, MotionCard = framerMotion.motion.create(_visualEditing.Card), MotionFlex = framerMotion.motion.create(_visualEditing.Flex), MotionText = framerMotion.motion.create(_visualEditing.Text);
1648
- function useMounted() {
1649
- return react.useSyncExternalStore(subscribe, _temp$1, _temp2);
1650
- }
1651
- function _temp2() {
1652
- return !1;
1653
- }
1654
- function _temp$1() {
1655
- return !0;
1656
- }
1657
- const subscribe = () => () => {
1658
- }, ToastContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/toast", null), DEFAULT_TOAST_LAYER_ELEMENT = "ul";
1659
- function ToastLayer(props) {
1660
- const $ = reactCompilerRuntime.c(11), {
1661
- as: t0,
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,
1662
1760
  children,
1663
- padding: t1,
1664
- paddingX,
1665
- paddingY,
1666
- gap: t2
1667
- } = props, as = t0 === void 0 ? DEFAULT_TOAST_LAYER_ELEMENT : t0, padding = t1 === void 0 ? 4 : t1, gap = t2 === void 0 ? 3 : t2, {
1668
- zIndex
1669
- } = _visualEditing.useLayer();
1670
- let t3;
1671
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t3 = css.toastLayer(), $[0] = t3) : t3 = $[0];
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;
1672
1768
  let t4;
1673
- $[1] !== zIndex ? (t4 = {
1674
- zIndex
1675
- }, $[1] = zIndex, $[2] = t4) : t4 = $[2];
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];
1676
1774
  let t5;
1677
- 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;
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;
1678
1782
  }
1679
- let toastId = 0;
1680
- function generateToastId() {
1681
- return String(toastId++);
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;
1682
1819
  }
1683
- function ToastProvider(props) {
1684
- const $ = reactCompilerRuntime.c(13), {
1820
+ const DEFAULT_INLINE_ELEMENT = "div";
1821
+ function Inline(props) {
1822
+ const $ = compilerRuntime.c(11), t0 = props;
1823
+ let children, gap, rest, space, t1;
1824
+ $[0] !== t0 ? ({
1825
+ as: t1,
1685
1826
  children,
1686
- padding,
1687
- paddingX,
1688
- paddingY,
1689
1827
  gap,
1690
- zOffset: t0
1691
- } = props, zOffset = t0 === void 0 ? 1 : t0;
1692
- let t1;
1693
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
1694
- const [state, setState] = react.useState(t1), mounted = useMounted();
1695
- let t2, t3;
1696
- $[1] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {
1697
- version: 0,
1698
- push: (params) => {
1699
- const id = params.id || generateToastId(), duration = params.duration || 5e3;
1700
- return react.startTransition(() => {
1701
- setState((prevState) => {
1702
- if (duration === 0.01)
1703
- return prevState.filter((toast) => toast.id !== id);
1704
- const dismiss = () => react.startTransition(() => setState((currentState) => currentState.filter((toast_0) => toast_0.id !== id)));
1705
- return [...prevState.filter((toast_1) => toast_1.id !== id), {
1706
- dismiss,
1707
- id,
1708
- updatedAt: Date.now(),
1709
- params: {
1710
- ...params,
1711
- duration
1712
- }
1713
- }];
1714
- });
1715
- }), id;
1716
- }
1717
- }, $[1] = t3) : t3 = $[1], t2 = t3;
1718
- const value = t2;
1719
- let t4;
1720
- $[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];
1721
- let t5;
1722
- return $[10] !== children || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
1723
- children,
1724
- t4
1725
- ] }), $[10] = children, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
1726
- }
1727
- function _temp(t0) {
1728
- const {
1729
- dismiss: dismiss_0,
1730
- id: id_0,
1731
- params: params_0,
1732
- updatedAt
1733
- } = t0;
1734
- 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);
1735
- }
1736
- function useToast() {
1737
- const value = react.useContext(ToastContext);
1738
- if (!value)
1739
- throw new Error("useToast(): missing context value");
1740
- if (!_visualEditing.isRecord(value) || value.version !== 0)
1741
- throw new Error("useToast(): the context value is not compatible");
1742
- return value;
1743
- }
1744
- function _findPrevItemElement(state, itemElements, focusedElement) {
1745
- const idx = itemElements.indexOf(focusedElement), els = itemElements.slice(0, idx), len = els.length;
1746
- for (let i = len - 1; i >= 0; i -= 1) {
1747
- const itemKey = els[i].getAttribute("data-tree-key");
1748
- if (!itemKey)
1749
- continue;
1750
- const segments = itemKey.split("/");
1751
- segments.pop();
1752
- const p = [];
1753
- let expanded = !0;
1754
- for (let j = 0; j < segments.length; j += 1) {
1755
- p.push(segments[j]);
1756
- const k = p.join("/");
1757
- if (!state[k]?.expanded) {
1758
- expanded = !1;
1759
- break;
1760
- }
1761
- }
1762
- if (expanded)
1763
- return els[i];
1764
- }
1765
- return null;
1766
- }
1767
- function _findNextItemElement(state, itemElements, focusedElement) {
1768
- const idx = itemElements.indexOf(focusedElement), els = itemElements.slice(idx), len = itemElements.length;
1769
- for (let i = 1; i < len; i += 1) {
1770
- if (!els[i])
1771
- continue;
1772
- const itemKey = els[i].getAttribute("data-tree-key");
1773
- if (!itemKey)
1774
- continue;
1775
- const segments = itemKey.split("/");
1776
- segments.pop();
1777
- const p = [];
1778
- let expanded = !0;
1779
- for (let j = 0; j < segments.length; j += 1) {
1780
- p.push(segments[j]);
1781
- const k = p.join("/");
1782
- if (!state[k]?.expanded) {
1783
- expanded = !1;
1784
- break;
1785
- }
1786
- }
1787
- if (expanded)
1788
- return els[i];
1789
- }
1790
- return null;
1791
- }
1792
- function _focusItemElement(el) {
1793
- if (el.getAttribute("role") === "treeitem" && el.focus(), el.getAttribute("role") === "none") {
1794
- const firstChild = el.firstChild;
1795
- firstChild && firstChild instanceof HTMLElement && firstChild.focus();
1796
- }
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;
1797
1834
  }
1798
- const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/tree", null), DEFAULT_TREE_ELEMENT = "div";
1799
- function Tree(props) {
1800
- const $ = reactCompilerRuntime.c(39), t0 = props;
1801
- let children, forwardedRef, gap, onFocus, rest, t1;
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,
1846
+ ref: forwardedRef,
1847
+ ...rest
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];
1856
+ let t4;
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;
1802
1873
  $[0] !== t0 ? ({
1874
+ as: t1,
1875
+ border: t2,
1803
1876
  children,
1877
+ customValidity,
1878
+ disabled,
1879
+ fontSize: t3,
1804
1880
  gap,
1805
- space: t1,
1806
- onFocus,
1881
+ padding: t4,
1882
+ radius: t5,
1883
+ readOnly,
1807
1884
  ref: forwardedRef,
1885
+ space: t6,
1808
1886
  ...rest
1809
- } = 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]);
1810
- const space = t1 === void 0 ? 1 : t1, ref = react.useRef(null), [focusedElement, setFocusedElement] = react.useState(null), focusedElementRef = react.useRef(focusedElement);
1811
- let t2, t3;
1812
- $[7] === Symbol.for("react.memo_cache_sentinel") ? (t3 = [], $[7] = t3) : t3 = $[7], t2 = t3;
1813
- const path = t2;
1814
- let t4;
1815
- $[8] === Symbol.for("react.memo_cache_sentinel") ? (t4 = [], $[8] = t4) : t4 = $[8];
1816
- const [itemElements, setItemElements] = react.useState(t4);
1817
- let t5;
1818
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t5 = {}, $[9] = t5) : t5 = $[9];
1819
- const [state, setState] = react.useState(t5), stateRef = react.useRef(state);
1820
- let t6;
1821
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[10] = t6) : t6 = $[10], react.useImperativeHandle(forwardedRef, t6);
1822
- let t7, t8;
1823
- $[11] !== focusedElement ? (t7 = () => {
1824
- focusedElementRef.current = focusedElement;
1825
- }, t8 = [focusedElement], $[11] = focusedElement, $[12] = t7, $[13] = t8) : (t7 = $[12], t8 = $[13]), react.useEffect(t7, t8);
1826
- let t10, t9;
1827
- $[14] !== state ? (t9 = () => {
1828
- stateRef.current = state;
1829
- }, t10 = [state], $[14] = state, $[15] = t10, $[16] = t9) : (t10 = $[15], t9 = $[16]), react.useEffect(t9, t10);
1830
- let t11;
1831
- $[17] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (element, path_0, expanded, selected) => (setState((s) => ({
1832
- ...s,
1833
- [path_0]: {
1834
- element,
1835
- expanded
1836
- }
1837
- })), selected && setFocusedElement(element), () => {
1838
- setState((s_0) => {
1839
- const newState = {
1840
- ...s_0
1841
- };
1842
- return delete newState[path_0], newState;
1843
- });
1844
- }), $[17] = t11) : t11 = $[17];
1845
- const registerItem = t11;
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;
1846
1903
  let t12;
1847
- $[18] === Symbol.for("react.memo_cache_sentinel") ? (t12 = (path_1, expanded_0) => {
1848
- setState((s_1) => {
1849
- const itemState = s_1[path_1];
1850
- return itemState ? {
1851
- ...s_1,
1852
- [path_1]: {
1853
- ...itemState,
1854
- expanded: expanded_0
1855
- }
1856
- } : s_1;
1857
- });
1858
- }, $[18] = t12) : t12 = $[18];
1859
- 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];
1860
1905
  let t13;
1861
- 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];
1862
1909
  let t15;
1863
- $[19] !== space || $[20] !== state || $[21] !== t14 ? (t15 = {
1864
- version: 0,
1865
- focusedElement: t14,
1866
- level: 0,
1867
- path,
1868
- registerItem,
1869
- setExpanded,
1870
- setFocusedElement,
1871
- space,
1872
- state
1873
- }, $[19] = space, $[20] = state, $[21] = t14, $[22] = t15) : t15 = $[22], t13 = t15;
1874
- const contextValue = t13;
1910
+ $[29] !== fontSize ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, children: t14 }), $[29] = fontSize, $[30] = t15) : t15 = $[30];
1875
1911
  let t16;
1876
- $[23] !== itemElements ? (t16 = (event) => {
1877
- if (focusedElementRef.current) {
1878
- if (event.key === "ArrowDown") {
1879
- event.preventDefault();
1880
- const nextEl = _findNextItemElement(stateRef.current, itemElements, focusedElementRef.current);
1881
- nextEl && (_focusItemElement(nextEl), setFocusedElement(nextEl));
1882
- return;
1883
- }
1884
- if (event.key === "ArrowUp") {
1885
- event.preventDefault();
1886
- const prevEl = _findPrevItemElement(stateRef.current, itemElements, focusedElementRef.current);
1887
- prevEl && (_focusItemElement(prevEl), setFocusedElement(prevEl));
1888
- return;
1889
- }
1890
- if (event.key === "ArrowLeft") {
1891
- event.preventDefault();
1892
- const itemKey = focusedElementRef.current.getAttribute("data-tree-key");
1893
- if (!itemKey)
1894
- return;
1895
- const itemState_0 = stateRef.current[itemKey];
1896
- if (!itemState_0)
1897
- return;
1898
- if (itemState_0.expanded)
1899
- setState((s_2) => {
1900
- const itemState_1 = s_2[itemKey];
1901
- return itemState_1 ? {
1902
- ...s_2,
1903
- [itemKey]: {
1904
- ...itemState_1,
1905
- expanded: !1
1906
- }
1907
- } : s_2;
1908
- });
1909
- else {
1910
- const itemPath = itemKey.split("/");
1911
- itemPath.pop();
1912
- const parentKey = itemPath.join("/"), parentState = parentKey && stateRef.current[parentKey];
1913
- parentState && (parentState.element.focus(), setFocusedElement(parentState.element));
1914
- }
1915
- return;
1916
- }
1917
- if (event.key === "ArrowRight") {
1918
- event.preventDefault();
1919
- const focusedKey = focusedElementRef.current.getAttribute("data-tree-key");
1920
- if (!focusedKey)
1921
- return;
1922
- stateRef.current[focusedKey]?.expanded || setState((s_3) => {
1923
- const itemState_2 = s_3[focusedKey];
1924
- return itemState_2 ? {
1925
- ...s_3,
1926
- [focusedKey]: {
1927
- ...itemState_2,
1928
- expanded: !0
1929
- }
1930
- } : s_3;
1931
- });
1932
- return;
1933
- }
1934
- }
1935
- }, $[23] = itemElements, $[24] = t16) : t16 = $[24];
1936
- 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];
1937
1913
  let t17;
1938
- $[25] !== onFocus ? (t17 = (event_0) => {
1939
- setFocusedElement(event_0.target), onFocus?.(event_0);
1940
- }, $[25] = onFocus, $[26] = t17) : t17 = $[26];
1941
- const handleFocus = t17;
1942
- let t18;
1943
- $[27] === Symbol.for("react.memo_cache_sentinel") ? (t18 = () => {
1944
- if (!ref.current)
1945
- return;
1946
- const _itemElements = Array.from(ref.current.querySelectorAll('[data-ui="TreeItem"]'));
1947
- setItemElements(_itemElements);
1948
- }, $[27] = t18) : t18 = $[27];
1949
- let t19;
1950
- $[28] !== children ? (t19 = [children], $[28] = children, $[29] = t19) : t19 = $[29], react.useEffect(t18, t19);
1951
- const t20 = gap ?? space;
1952
- let t21;
1953
- $[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];
1954
- let t22;
1955
- 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;
1918
+ }
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;
1951
+ }
1952
+ const DEFAULT_CODE_SKELETON_ELEMENT = "div";
1953
+ function CodeSkeleton(props) {
1954
+ const $ = compilerRuntime.c(10), t0 = props;
1955
+ let className, rest, t1;
1956
+ $[0] !== t0 ? ({
1957
+ className,
1958
+ size: t1,
1959
+ ...rest
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];
1967
+ let t3;
1968
+ return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1956
1969
  }
1957
- function useTree() {
1958
- const tree = react.useContext(TreeContext);
1959
- if (!tree)
1960
- throw new Error("Tree: missing context value");
1961
- return tree;
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;
1962
1987
  }
1963
- const TreeGroup = react.memo(function(props) {
1964
- const $ = reactCompilerRuntime.c(9), t0 = props;
1965
- let children, rest, t1;
1988
+ const DEFAULT_LABEL_SKELETON_ELEMENT = "div";
1989
+ function LabelSkeleton(props) {
1990
+ const $ = compilerRuntime.c(10), t0 = props;
1991
+ let className, rest, t1;
1966
1992
  $[0] !== t0 ? ({
1967
- children,
1968
- expanded: t1,
1993
+ className,
1994
+ size: t1,
1969
1995
  ...rest
1970
- } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1) : (children = $[1], rest = $[2], t1 = $[3]);
1971
- const expanded = t1 === void 0 ? !1 : t1, tree = useTree(), t2 = !expanded;
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];
1972
2003
  let t3;
1973
- 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;
1974
- }), DEFAULT_TREE_ITEM_ELEMENT = "a";
1975
- function TreeItem(props) {
1976
- const {
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,
1977
2030
  children,
1978
2031
  className,
1979
- expanded: expandedProp = !1,
1980
- fontSize = 1,
1981
- href,
1982
- icon: IconComponent,
1983
- id: idProp,
1984
- linkAs = "a",
1985
- muted,
1986
- onClick,
1987
- padding = 2,
1988
- radius = 2,
1989
- selected = !1,
1990
- space = 2,
1991
- text,
1992
- weight,
1993
2032
  ...rest
1994
- } = props, rootRef = react.useRef(null), treeitemRef = react.useRef(null), tree = useTree(), {
1995
- path,
1996
- registerItem,
1997
- setExpanded,
1998
- setFocusedElement
1999
- } = 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(() => ({
2000
- ...tree,
2001
- level: tree.level + 1,
2002
- path: itemPath
2003
- }), [itemPath, tree]), handleClick = react.useCallback((event) => {
2004
- onClick && onClick(event);
2005
- const target = event.target;
2006
- target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootRef.current));
2007
- }, [expanded, itemKey, onClick, setExpanded, setFocusedElement]), handleKeyDown = react.useCallback((event_0) => {
2008
- focused && event_0.key === "Enter" && (treeitemRef.current || rootRef.current)?.click();
2009
- }, [focused]);
2010
- react.useEffect(() => {
2011
- if (rootRef.current)
2012
- return registerItem(rootRef.current, itemPath.join("/"), expanded, selected);
2013
- }, [expanded, itemPath, registerItem, selected]);
2014
- const content2 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { gap: space, padding, children: [
2015
- /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { style: {
2016
- visibility: IconComponent || children ? "visible" : "hidden",
2017
- pointerEvents: "none"
2018
- }, children: [
2019
- IconComponent && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {}) }),
2020
- !IconComponent && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ToggleArrowRightIcon, { style: {
2021
- transform: expanded ? "rotate(90deg)" : void 0
2022
- } }) })
2023
- ] }),
2024
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text }) })
2025
- ] });
2026
- 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({
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({
2027
2037
  className
2028
- }), onClick: handleClick, ref: rootRef, role: "none", children: [
2029
- /* @__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: {
2030
- paddingLeft: `calc(${css.vars.space[2]} * ${tree.level})`
2031
- }, children: content2 }),
2032
- /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { hidden: !expanded, children }) })
2033
- ] }) : /* @__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({
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;
2041
+ }
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;
2046
+ $[0] !== t0 ? ({
2047
+ as: t1,
2048
+ className,
2049
+ disabled,
2050
+ indeterminate,
2051
+ readOnly,
2052
+ ref: forwardedRef,
2053
+ style,
2054
+ ...rest
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);
2063
+ let t5;
2064
+ $[13] !== className ? (t5 = css._switch({
2034
2065
  className
2035
- }), onClick: handleClick, onKeyDown: handleKeyDown, ref: rootRef, role: "treeitem", tabIndex, children: [
2036
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Selectable, { as: "button", "data-pressed": selected ? "" : void 0, "data-ui": "TreeItem__box", radius, style: {
2037
- paddingLeft: `calc(${css.vars.space[2]} * ${tree.level})`
2038
- }, children: content2 }),
2039
- /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { expanded, children }) })
2040
- ] });
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
2203
+ };
2204
+ }
2205
+ componentDidCatch(error, info) {
2206
+ this.props.onCatch({
2207
+ error,
2208
+ info
2209
+ });
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 });
2218
+ }
2219
+ return this.props.children;
2220
+ }
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;