@sanity/ui 3.0.0-static.2 → 3.0.0-static.21

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 (829) hide show
  1. package/README.md +7 -6
  2. package/bin/{ui.js → sanity-ui.cjs} +1 -1
  3. package/dist/_chunks-cjs/_visual-editing.cjs +2488 -0
  4. package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -0
  5. package/dist/_chunks-cjs/{refractor.js → refractor.cjs} +1 -2
  6. package/dist/_chunks-cjs/refractor.cjs.map +1 -0
  7. package/dist/_chunks-es/_visual-editing.js +2500 -0
  8. package/dist/_chunks-es/_visual-editing.js.map +1 -0
  9. package/dist/_chunks-es/{refractor.mjs → refractor.js} +1 -2
  10. package/dist/_chunks-es/refractor.js.map +1 -0
  11. package/dist/_visual-editing.cjs +30 -0
  12. package/dist/_visual-editing.cjs.map +1 -0
  13. package/dist/_visual-editing.d.cts +893 -0
  14. package/dist/_visual-editing.d.ts +503 -416
  15. package/dist/_visual-editing.js +29 -30
  16. package/dist/_visual-editing.js.map +1 -1
  17. package/dist/css.cjs +598 -0
  18. package/dist/css.cjs.map +1 -0
  19. package/dist/css.d.cts +14884 -0
  20. package/dist/css.d.ts +14379 -1630
  21. package/dist/css.js +480 -4594
  22. package/dist/css.js.map +1 -1
  23. package/dist/index.cjs +2222 -0
  24. package/dist/index.cjs.map +1 -0
  25. package/dist/{index.d.mts → index.d.cts} +1284 -961
  26. package/dist/index.d.ts +1284 -961
  27. package/dist/index.js +1270 -592
  28. package/dist/index.js.map +1 -1
  29. package/dist/{theme.mjs → theme.cjs} +2843 -2571
  30. package/dist/theme.cjs.map +1 -0
  31. package/dist/{theme.d.mts → theme.d.cts} +331 -311
  32. package/dist/theme.d.ts +331 -311
  33. package/dist/theme.js +2843 -2569
  34. package/dist/theme.js.map +1 -1
  35. package/dist/ui.css +22564 -0
  36. package/exports/_visual-editing.ts +0 -1
  37. package/package.json +84 -79
  38. package/src/cli/buildCommand.ts +3 -41
  39. package/src/cli/index.ts +2 -14
  40. package/src/core/_compat/helpers.ts +72 -0
  41. package/src/core/_compat/index.ts +1 -6
  42. package/src/core/_compat/styles/_responsive.ts +1 -1
  43. package/src/core/_compat/theme/theme.test.tsx +4 -5
  44. package/src/core/_compat/theme/themeColorProvider.tsx +4 -10
  45. package/src/core/_compat/theme/themeContext.ts +5 -5
  46. package/src/core/_compat/theme/themeProvider.tsx +19 -13
  47. package/src/core/_compat/theme/types.ts +2 -4
  48. package/src/core/_compat/theme/useRootTheme.ts +2 -4
  49. package/src/core/_compat/theme/useTheme.ts +3 -7
  50. package/src/core/_compat/types.ts +0 -73
  51. package/src/core/components/autocomplete/__workshop__/async.tsx +6 -6
  52. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +11 -18
  53. package/src/core/components/autocomplete/__workshop__/custom.tsx +21 -20
  54. package/src/core/components/autocomplete/__workshop__/example.tsx +17 -17
  55. package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +5 -5
  56. package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +57 -59
  57. package/src/core/components/autocomplete/autocomplete.tsx +106 -140
  58. package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
  59. package/src/core/components/autocomplete/autocompleteReducer.ts +1 -1
  60. package/src/core/components/autocomplete/constants.ts +1 -1
  61. package/src/core/components/autocomplete/types.ts +4 -9
  62. package/src/core/components/breadcrumbs/__workshop__/example.tsx +2 -3
  63. package/src/core/components/breadcrumbs/breadcrumbs.tsx +32 -28
  64. package/src/core/components/dialog/__workshop__/activate.tsx +4 -4
  65. package/src/core/components/dialog/__workshop__/autoFocus.tsx +2 -2
  66. package/src/core/components/dialog/__workshop__/onScroll.tsx +16 -4
  67. package/src/core/components/dialog/__workshop__/position.tsx +4 -4
  68. package/src/core/components/dialog/__workshop__/props.tsx +7 -7
  69. package/src/core/components/dialog/__workshop__/wrapped.tsx +2 -2
  70. package/src/core/components/dialog/dialog.tsx +104 -304
  71. package/src/core/components/dialog/dialogCard.tsx +190 -0
  72. package/src/core/components/dialog/dialogContext.ts +5 -3
  73. package/src/core/components/dialog/dialogProvider.tsx +6 -7
  74. package/src/core/components/dialog/isTargetWithinScope.ts +14 -0
  75. package/src/core/components/dialog/useDialog.ts +1 -1
  76. package/src/core/components/hotkeys/hotkeys.tsx +41 -27
  77. package/src/core/components/menu/__workshop__/asComponent.tsx +6 -6
  78. package/src/core/components/menu/__workshop__/closableMenuButton.tsx +5 -4
  79. package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +2 -2
  80. package/src/core/components/menu/__workshop__/customMenuItem.tsx +3 -3
  81. package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +1 -1
  82. package/src/core/components/menu/__workshop__/groups.tsx +2 -2
  83. package/src/core/components/menu/__workshop__/menuButton.tsx +4 -4
  84. package/src/core/components/menu/__workshop__/menuGroupRight.tsx +1 -1
  85. package/src/core/components/menu/__workshop__/nestedMenu.tsx +1 -1
  86. package/src/core/components/menu/__workshop__/onCloseMenuButton.tsx +13 -4
  87. package/src/core/components/menu/__workshop__/selectedItem.tsx +2 -2
  88. package/src/core/components/menu/__workshop__/tones.tsx +3 -3
  89. package/src/core/components/menu/__workshop__/withoutArrow.tsx +1 -1
  90. package/src/core/components/menu/menu.test.tsx +6 -7
  91. package/src/core/components/menu/menu.tsx +27 -35
  92. package/src/core/components/menu/menuButton.tsx +18 -24
  93. package/src/core/components/menu/menuContext.ts +1 -1
  94. package/src/core/components/menu/menuDivider.tsx +25 -15
  95. package/src/core/components/menu/menuGroup.tsx +39 -33
  96. package/src/core/components/menu/menuItem.tsx +58 -46
  97. package/src/core/components/menu/useMenu.ts +1 -1
  98. package/src/core/components/menu/useMenuController.ts +4 -4
  99. package/src/core/components/skeleton/__workshop__/delay.tsx +3 -3
  100. package/src/core/components/skeleton/__workshop__/skeleton.tsx +4 -4
  101. package/src/core/components/skeleton/codeSkeleton.tsx +49 -0
  102. package/src/core/components/skeleton/headingSkeleton.tsx +48 -0
  103. package/src/core/components/skeleton/index.ts +3 -0
  104. package/src/core/components/skeleton/labelSkeleton.tsx +47 -0
  105. package/src/core/components/skeleton/skeleton.tsx +37 -18
  106. package/src/core/components/skeleton/textSkeleton.tsx +29 -112
  107. package/src/core/components/tab/__workshop__/example.tsx +2 -2
  108. package/src/core/components/tab/tab.tsx +28 -26
  109. package/src/core/components/tab/tabList.tsx +49 -28
  110. package/src/core/components/tab/tabPanel.tsx +29 -22
  111. package/src/core/components/toast/__workshop__/hook.tsx +1 -1
  112. package/src/core/components/toast/__workshop__/toast.tsx +5 -5
  113. package/src/core/components/toast/toast.test.tsx +5 -5
  114. package/src/core/components/toast/toast.tsx +30 -57
  115. package/src/core/components/toast/toastContext.ts +1 -1
  116. package/src/core/components/toast/toastLayer.tsx +29 -13
  117. package/src/core/components/toast/toastProvider.tsx +5 -10
  118. package/src/core/components/toast/types.ts +3 -7
  119. package/src/core/components/toast/useToast.ts +2 -4
  120. package/src/core/components/tree/__workshop__/basic.perf.ts +1 -1
  121. package/src/core/components/tree/__workshop__/basic.tsx +1 -1
  122. package/src/core/components/tree/__workshop__/tabFromElement.tsx +1 -1
  123. package/src/core/components/tree/helpers.ts +1 -1
  124. package/src/core/components/tree/tree.tsx +196 -191
  125. package/src/core/components/tree/treeContext.ts +1 -1
  126. package/src/core/components/tree/treeGroup.tsx +24 -6
  127. package/src/core/components/tree/treeItem.tsx +44 -34
  128. package/src/core/components/tree/types.ts +2 -2
  129. package/src/core/components/tree/useTree.ts +1 -1
  130. package/src/core/constants.ts +6 -0
  131. package/src/core/helpers/props.ts +18 -0
  132. package/src/core/hooks/index.ts +1 -0
  133. package/src/core/hooks/useArrayProp.ts +1 -4
  134. package/src/core/hooks/useClickOutside.test.tsx +15 -16
  135. package/src/core/hooks/useClickOutside.ts +2 -6
  136. package/src/core/hooks/useClickOutsideEvent.test.tsx +4 -5
  137. package/src/core/hooks/useClickOutsideEvent.ts +3 -9
  138. package/src/core/hooks/useDelayed.test.ts +6 -7
  139. package/src/core/hooks/useDelayedState.ts +1 -1
  140. package/src/core/hooks/useElementRect/__workshop__/example.tsx +1 -1
  141. package/src/core/hooks/useElementSize.ts +1 -1
  142. package/src/core/hooks/useForwardedRef.ts +1 -1
  143. package/src/core/hooks/useMatchMedia.ts +13 -31
  144. package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +1 -1
  145. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +3 -18
  146. package/src/core/hooks/useMediaIndex/useMediaIndex.ts +12 -12
  147. package/src/core/hooks/usePrefersDark.hydration.test.tsx +4 -4
  148. package/src/core/hooks/usePrefersDark.test.tsx +1 -0
  149. package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +4 -4
  150. package/src/core/hooks/usePrefersReducedMotion.test.tsx +1 -0
  151. package/src/core/hooks/useResponsiveProp.ts +28 -0
  152. package/src/core/index.ts +0 -1
  153. package/src/core/lib/isArray.ts +3 -0
  154. package/src/core/middleware/origin.ts +1 -1
  155. package/src/core/primitives/_selectable/selectable.tsx +33 -24
  156. package/src/core/primitives/avatar/__workshop__/asButton.tsx +2 -2
  157. package/src/core/primitives/avatar/__workshop__/stack.tsx +2 -2
  158. package/src/core/primitives/avatar/__workshop__/withinButton.tsx +2 -2
  159. package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +1 -1
  160. package/src/core/primitives/avatar/avatar.tsx +43 -48
  161. package/src/core/primitives/avatar/avatarCounter.tsx +46 -39
  162. package/src/core/primitives/avatar/avatarStack.tsx +44 -45
  163. package/src/core/primitives/avatar/types.ts +3 -3
  164. package/src/core/primitives/badge/__workshop__/props.tsx +6 -17
  165. package/src/core/primitives/badge/__workshop__/tones.tsx +1 -6
  166. package/src/core/primitives/badge/badge.test.tsx +2 -3
  167. package/src/core/primitives/badge/badge.tsx +34 -40
  168. package/src/core/primitives/badge/types.ts +2 -1
  169. package/src/core/primitives/box/__workshop__/props.tsx +2 -2
  170. package/src/core/primitives/box/__workshop__/responsive.tsx +2 -1
  171. package/src/core/primitives/box/box.tsx +153 -88
  172. package/src/core/primitives/button/__workshop__/custom.tsx +19 -42
  173. package/src/core/primitives/button/__workshop__/customIcons.tsx +3 -3
  174. package/src/core/primitives/button/__workshop__/disabled.tsx +9 -9
  175. package/src/core/primitives/button/__workshop__/props.tsx +19 -22
  176. package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +3 -3
  177. package/src/core/primitives/button/__workshop__/stacked.tsx +15 -16
  178. package/src/core/primitives/button/__workshop__/uploadButton.tsx +2 -1
  179. package/src/core/primitives/button/button.test.tsx +3 -18
  180. package/src/core/primitives/button/button.tsx +67 -76
  181. package/src/core/primitives/card/__workshop__/asButton.tsx +14 -14
  182. package/src/core/primitives/card/__workshop__/asComponent.tsx +3 -3
  183. package/src/core/primitives/card/__workshop__/checkered.tsx +1 -1
  184. package/src/core/primitives/card/__workshop__/index.ts +1 -1
  185. package/src/core/primitives/card/__workshop__/interactive.tsx +3 -4
  186. package/src/core/primitives/card/__workshop__/listNavigation.tsx +3 -3
  187. package/src/core/primitives/card/__workshop__/props.tsx +14 -17
  188. package/src/core/primitives/card/__workshop__/selected.tsx +10 -41
  189. package/src/core/primitives/card/__workshop__/{allTones.tsx → tones.tsx} +3 -3
  190. package/src/core/primitives/card/card.tsx +52 -48
  191. package/src/core/primitives/card/cardContext.ts +10 -0
  192. package/src/core/primitives/card/cardProvider.tsx +27 -0
  193. package/src/core/primitives/card/index.ts +2 -0
  194. package/src/core/primitives/card/types.ts +19 -3
  195. package/src/core/primitives/card/useCard.ts +9 -0
  196. package/src/core/primitives/checkbox/__workshop__/props.tsx +6 -4
  197. package/src/core/primitives/checkbox/__workshop__/tones.tsx +11 -20
  198. package/src/core/primitives/checkbox/checkbox.tsx +30 -23
  199. package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +1 -1
  200. package/src/core/primitives/code/__workshop__/props.tsx +4 -7
  201. package/src/core/primitives/code/code.tsx +27 -30
  202. package/src/core/primitives/code/refractor.tsx +0 -2
  203. package/src/core/primitives/container/__workshop__/example.tsx +2 -2
  204. package/src/core/primitives/container/container.tsx +27 -25
  205. package/src/core/primitives/flex/__workshop__/example.tsx +2 -2
  206. package/src/core/primitives/flex/flex.tsx +44 -17
  207. package/src/core/primitives/grid/grid.tsx +20 -17
  208. package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +2 -2
  209. package/src/core/primitives/heading/__workshop__/plain.tsx +12 -15
  210. package/src/core/primitives/heading/heading.tsx +51 -33
  211. package/src/core/primitives/inline/__workshop__/plain.tsx +2 -5
  212. package/src/core/primitives/inline/inline.tsx +46 -27
  213. package/src/core/primitives/inline/types.ts +1 -0
  214. package/src/core/primitives/kbd/kbd.tsx +28 -28
  215. package/src/core/primitives/label/__workshop__/plain.tsx +8 -17
  216. package/src/core/primitives/label/label.tsx +49 -39
  217. package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +6 -6
  218. package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +3 -3
  219. package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +1 -1
  220. package/src/core/primitives/popover/__workshop__/PlainStory.tsx +3 -3
  221. package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +3 -4
  222. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +10 -6
  223. package/src/core/primitives/popover/__workshop__/TestStory.tsx +5 -4
  224. package/src/core/primitives/popover/constants.ts +1 -1
  225. package/src/core/primitives/popover/floating-ui/size.ts +2 -2
  226. package/src/core/primitives/popover/helpers.ts +1 -1
  227. package/src/core/primitives/popover/popover.tsx +299 -335
  228. package/src/core/primitives/popover/popoverLayer.tsx +147 -0
  229. package/src/core/primitives/popover/types.ts +3 -2
  230. package/src/core/primitives/radio/__workshop__/example.tsx +3 -3
  231. package/src/core/primitives/radio/__workshop__/plain.tsx +3 -3
  232. package/src/core/primitives/radio/radio.tsx +34 -19
  233. package/src/core/primitives/select/__workshop__/plain.tsx +15 -6
  234. package/src/core/primitives/select/__workshop__/readOnly.tsx +1 -1
  235. package/src/core/primitives/select/select.tsx +28 -28
  236. package/src/core/primitives/spinner/__workshop__/Props.tsx +4 -5
  237. package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +7 -9
  238. package/src/core/primitives/spinner/spinner.tsx +27 -15
  239. package/src/core/primitives/stack/__workshop__/plain.tsx +2 -2
  240. package/src/core/primitives/stack/stack.tsx +44 -20
  241. package/src/core/primitives/switch/switch.tsx +31 -17
  242. package/src/core/primitives/text/__workshop__/colored.tsx +6 -6
  243. package/src/core/primitives/text/__workshop__/example.tsx +9 -20
  244. package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +1 -1
  245. package/src/core/primitives/text/text.tsx +52 -44
  246. package/src/core/primitives/textArea/__workshop__/plain.tsx +44 -33
  247. package/src/core/primitives/textArea/textArea.tsx +47 -22
  248. package/src/core/primitives/textInput/__workshop__/customValidity.tsx +2 -2
  249. package/src/core/primitives/textInput/__workshop__/plain.tsx +36 -30
  250. package/src/core/primitives/textInput/__workshop__/states.tsx +5 -5
  251. package/src/core/primitives/textInput/__workshop__/tones.tsx +2 -2
  252. package/src/core/primitives/textInput/__workshop__/typed.tsx +2 -2
  253. package/src/core/primitives/textInput/textInput.tsx +80 -106
  254. package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +5 -5
  255. package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +2 -2
  256. package/src/core/primitives/tooltip/__workshop__/props.tsx +9 -8
  257. package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +1 -1
  258. package/src/core/primitives/tooltip/constants.ts +1 -1
  259. package/src/core/primitives/tooltip/tooltip.test.tsx +61 -60
  260. package/src/core/primitives/tooltip/tooltip.tsx +107 -90
  261. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +1 -1
  262. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +3 -5
  263. package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +1 -1
  264. package/src/core/primitives/tooltip/tooltipLayer.tsx +105 -0
  265. package/src/core/primitives/types.ts +19 -30
  266. package/src/core/types/avatar.ts +3 -6
  267. package/src/core/types/badge.ts +2 -4
  268. package/src/core/types/button.ts +2 -4
  269. package/src/core/types/card.ts +2 -4
  270. package/src/core/types/dialog.ts +1 -3
  271. package/src/core/types/flex.ts +3 -3
  272. package/src/core/types/props.ts +20 -10
  273. package/src/core/types/selectable.ts +1 -1
  274. package/src/core/utils/arrow/arrow.tsx +43 -28
  275. package/src/core/utils/boundaryElement/boundaryElement.test.tsx +5 -5
  276. package/src/core/utils/boundaryElement/boundaryElementContext.ts +1 -1
  277. package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +4 -10
  278. package/src/core/utils/boundaryElement/types.ts +1 -3
  279. package/src/core/utils/boundaryElement/useBoundaryElement.ts +2 -4
  280. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +15 -8
  281. package/src/core/utils/elementQuery/elementQuery.tsx +41 -19
  282. package/src/core/utils/errorBoundary.tsx +6 -4
  283. package/src/core/utils/index.ts +0 -1
  284. package/src/core/utils/layer/__workshop__/multipleRoots.tsx +5 -5
  285. package/src/core/utils/layer/__workshop__/nested.tsx +3 -3
  286. package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +9 -5
  287. package/src/core/utils/layer/getLayerContext.test.ts +3 -1
  288. package/src/core/utils/layer/getLayerContext.ts +1 -1
  289. package/src/core/utils/layer/layer.test.tsx +5 -5
  290. package/src/core/utils/layer/layer.tsx +25 -95
  291. package/src/core/utils/layer/layerCard.tsx +90 -0
  292. package/src/core/utils/layer/layerContext.ts +1 -1
  293. package/src/core/utils/layer/layerProvider.tsx +20 -17
  294. package/src/core/utils/layer/useLayer.ts +2 -4
  295. package/src/core/utils/portal/__workshop__/named.tsx +3 -3
  296. package/src/core/utils/portal/portal.test.tsx +5 -5
  297. package/src/core/utils/portal/{portal.ts → portal.tsx} +17 -11
  298. package/src/core/utils/portal/portalContext.ts +1 -1
  299. package/src/core/utils/portal/portalProvider.tsx +4 -10
  300. package/src/core/utils/portal/types.ts +1 -3
  301. package/src/core/utils/portal/usePortal.ts +2 -4
  302. package/src/core/utils/srOnly/srOnly.tsx +25 -27
  303. package/src/core/utils/virtualList/__workshop__/infiniteList.tsx +1 -1
  304. package/src/core/utils/virtualList/virtualList.tsx +71 -55
  305. package/src/css/__theme/index.ts +16 -0
  306. package/src/css/__theme/lib/contract/buildVarContract.ts +78 -0
  307. package/src/css/__theme/lib/contract/index.ts +4 -0
  308. package/src/css/__theme/lib/contract/types.ts +17 -0
  309. package/src/css/__theme/resolveTheme.ts +865 -0
  310. package/src/css/_assign.ts +3 -0
  311. package/src/css/_composeClassNames.ts +12 -0
  312. package/src/css/_fromEntries.ts +3 -0
  313. package/src/css/_getClassNames.ts +9 -0
  314. package/src/css/_responsiveClassName.ts +45 -0
  315. package/src/css/_responsiveStyle.css.ts +34 -0
  316. package/src/css/_style.css.ts +9 -0
  317. package/src/css/components/breadcrumbs/breadcrumbs.css.ts +6 -0
  318. package/src/css/components/breadcrumbs/breadcrumbs.ts +5 -3
  319. package/src/css/components/dialog/dialog.css.ts +81 -0
  320. package/src/css/components/dialog/dialog.ts +20 -11
  321. package/src/css/components/index.ts +6 -0
  322. package/src/css/components/menu/menu.css.ts +14 -0
  323. package/src/css/components/menu/menu.ts +8 -5
  324. package/src/css/components/skeleton/skeleton.css.ts +132 -0
  325. package/src/css/components/skeleton/skeleton.ts +14 -9
  326. package/src/css/components/skeleton/types.ts +13 -5
  327. package/src/css/components/toast/toast.css.ts +16 -0
  328. package/src/css/components/toast/toast.ts +5 -15
  329. package/src/css/components/tree/tree.css.ts +65 -0
  330. package/src/css/components/tree/tree.ts +5 -3
  331. package/src/css/constants.ts +10 -0
  332. package/src/css/defaultTheme.css.ts +468 -0
  333. package/src/css/index.ts +12 -38
  334. package/src/css/layers.css.ts +9 -0
  335. package/src/css/primitives/_arrow/_arrow.css.ts +68 -0
  336. package/src/css/primitives/_arrow/_arrow.ts +18 -6
  337. package/src/css/primitives/_input/_input.css.ts +258 -0
  338. package/src/css/primitives/_input/input.ts +17 -14
  339. package/src/css/primitives/_input/types.ts +3 -3
  340. package/src/css/primitives/_selectable/_selectable.css.ts +121 -0
  341. package/src/css/primitives/_selectable/selectable.ts +5 -5
  342. package/src/css/primitives/_selectable/types.ts +3 -2
  343. package/src/css/primitives/avatar/avatar.css.ts +175 -0
  344. package/src/css/primitives/avatar/avatar.ts +52 -11
  345. package/src/css/primitives/avatar/types.ts +5 -3
  346. package/src/css/primitives/badge/badge.css.ts +26 -0
  347. package/src/css/primitives/badge/badge.ts +4 -4
  348. package/src/css/primitives/badge/types.ts +5 -4
  349. package/src/css/primitives/box/box.css.ts +19 -0
  350. package/src/css/primitives/box/box.ts +52 -16
  351. package/src/css/primitives/box/types.ts +46 -22
  352. package/src/css/primitives/button/button.css.ts +285 -0
  353. package/src/css/primitives/button/button.ts +15 -33
  354. package/src/css/primitives/button/index.ts +1 -0
  355. package/src/css/primitives/button/types.ts +19 -0
  356. package/src/css/primitives/card/card.css.ts +365 -0
  357. package/src/css/primitives/card/card.ts +9 -12
  358. package/src/css/primitives/card/types.ts +4 -6
  359. package/src/css/primitives/checkbox/checkbox.css.ts +193 -0
  360. package/src/css/primitives/checkbox/checkbox.ts +13 -5
  361. package/src/css/primitives/code/code.css.ts +271 -0
  362. package/src/css/primitives/code/code.ts +13 -5
  363. package/src/css/primitives/code/types.ts +4 -3
  364. package/src/css/primitives/container/container.css.ts +4 -0
  365. package/src/css/primitives/container/container.ts +12 -4
  366. package/src/css/primitives/container/types.ts +4 -2
  367. package/src/css/primitives/heading/heading.css.ts +85 -0
  368. package/src/css/primitives/heading/heading.ts +13 -11
  369. package/src/css/primitives/heading/types.ts +6 -3
  370. package/src/css/primitives/index.ts +24 -0
  371. package/src/css/primitives/kbd/kbd.css.ts +16 -0
  372. package/src/css/primitives/kbd/kbd.ts +6 -4
  373. package/src/css/primitives/kbd/types.ts +2 -3
  374. package/src/css/primitives/label/label.css.ts +85 -0
  375. package/src/css/primitives/label/label.ts +13 -10
  376. package/src/css/primitives/label/types.ts +13 -5
  377. package/src/css/primitives/popover/popover.css.ts +6 -0
  378. package/src/css/primitives/popover/popover.ts +10 -3
  379. package/src/css/primitives/radio/radio.css.ts +78 -0
  380. package/src/css/primitives/radio/radio.ts +15 -3
  381. package/src/css/primitives/select/select.css.ts +24 -0
  382. package/src/css/primitives/select/select.ts +7 -4
  383. package/src/css/primitives/select/types.ts +1 -1
  384. package/src/css/primitives/spinner/index.ts +1 -0
  385. package/src/css/primitives/spinner/spinner.css.ts +23 -0
  386. package/src/css/primitives/spinner/spinner.ts +9 -5
  387. package/src/css/primitives/spinner/types.ts +4 -0
  388. package/src/css/primitives/stack/index.ts +1 -0
  389. package/src/css/primitives/stack/stack.css.ts +6 -0
  390. package/src/css/primitives/stack/stack.ts +7 -0
  391. package/src/css/primitives/switch/switch.css.ts +98 -0
  392. package/src/css/primitives/switch/switch.ts +13 -7
  393. package/src/css/primitives/text/text.css.ts +85 -0
  394. package/src/css/primitives/text/text.ts +13 -11
  395. package/src/css/primitives/text/types.ts +9 -3
  396. package/src/css/primitives/textArea/textArea.css.ts +4 -0
  397. package/src/css/primitives/textArea/textArea.ts +5 -3
  398. package/src/css/primitives/textArea/types.ts +5 -3
  399. package/src/css/primitives/textInput/textInput.css.ts +41 -0
  400. package/src/css/primitives/textInput/textInput.ts +20 -4
  401. package/src/css/primitives/textInput/types.ts +3 -7
  402. package/src/css/primitives/tooltip/index.ts +1 -0
  403. package/src/css/primitives/tooltip/tooltip.css.ts +6 -0
  404. package/src/css/primitives/tooltip/tooltip.ts +8 -7
  405. package/src/css/primitives/tooltip/types.ts +4 -0
  406. package/src/css/props/alignItems/alignItems.css.ts +22 -0
  407. package/src/css/props/alignItems/alignItems.ts +8 -0
  408. package/src/css/props/alignItems/index.ts +2 -0
  409. package/src/css/props/alignItems/types.ts +9 -0
  410. package/src/css/props/border/border.css.ts +65 -0
  411. package/src/css/props/border/border.ts +36 -0
  412. package/src/css/props/border/types.ts +13 -0
  413. package/src/css/props/boxSizing/boxSizing.css.ts +11 -0
  414. package/src/css/props/boxSizing/boxSizing.ts +10 -0
  415. package/src/css/props/boxSizing/index.ts +2 -0
  416. package/src/css/props/boxSizing/types.ts +7 -0
  417. package/src/css/props/display/display.css.ts +56 -0
  418. package/src/css/props/display/display.ts +17 -0
  419. package/src/css/{styles → props}/display/types.ts +3 -4
  420. package/src/css/props/flex/flex.css.ts +52 -0
  421. package/src/css/props/flex/flex.ts +8 -0
  422. package/src/css/props/flex/types.ts +9 -0
  423. package/src/css/props/flexDirection/flexDirection.css.ts +19 -0
  424. package/src/css/props/flexDirection/flexDirection.ts +8 -0
  425. package/src/css/props/flexDirection/index.ts +2 -0
  426. package/src/css/props/flexDirection/types.ts +9 -0
  427. package/src/css/props/flexWrap/flexWrap.css.ts +16 -0
  428. package/src/css/props/flexWrap/flexWrap.ts +8 -0
  429. package/src/css/props/flexWrap/index.ts +2 -0
  430. package/src/css/props/flexWrap/types.ts +9 -0
  431. package/src/css/props/font/font.css.ts +93 -0
  432. package/src/css/props/font/font.ts +8 -0
  433. package/src/css/props/font/types.ts +6 -0
  434. package/src/css/props/gap/gap.css.ts +40 -0
  435. package/src/css/props/gap/gap.ts +13 -0
  436. package/src/css/{styles → props}/gap/types.ts +2 -2
  437. package/src/css/props/gridAutoColumns/gridAutoColumns.css.ts +19 -0
  438. package/src/css/props/gridAutoColumns/gridAutoColumns.ts +8 -0
  439. package/src/css/props/gridAutoColumns/index.ts +2 -0
  440. package/src/css/props/gridAutoColumns/types.ts +19 -0
  441. package/src/css/props/gridAutoFlow/gridAutoFlow.css.ts +19 -0
  442. package/src/css/props/gridAutoFlow/gridAutoFlow.ts +8 -0
  443. package/src/css/props/gridAutoFlow/index.ts +2 -0
  444. package/src/css/props/gridAutoFlow/types.ts +13 -0
  445. package/src/css/props/gridAutoRows/gridAutoRows.css.ts +19 -0
  446. package/src/css/props/gridAutoRows/gridAutoRows.ts +8 -0
  447. package/src/css/props/gridAutoRows/index.ts +2 -0
  448. package/src/css/props/gridAutoRows/types.ts +13 -0
  449. package/src/css/props/gridColumn/gridColumn.css.ts +49 -0
  450. package/src/css/props/gridColumn/gridColumn.ts +8 -0
  451. package/src/css/props/gridColumn/index.ts +2 -0
  452. package/src/css/props/gridColumn/types.ts +19 -0
  453. package/src/css/props/gridColumnEnd/gridColumnEnd.css.ts +46 -0
  454. package/src/css/props/gridColumnEnd/gridColumnEnd.ts +8 -0
  455. package/src/css/props/gridColumnEnd/index.ts +2 -0
  456. package/src/css/props/gridColumnEnd/types.ts +19 -0
  457. package/src/css/props/gridColumnStart/gridColumnStart.css.ts +46 -0
  458. package/src/css/props/gridColumnStart/gridColumnStart.ts +11 -0
  459. package/src/css/props/gridColumnStart/index.ts +2 -0
  460. package/src/css/props/gridColumnStart/types.ts +19 -0
  461. package/src/css/props/gridRow/gridRow.css.ts +49 -0
  462. package/src/css/props/gridRow/gridRow.ts +8 -0
  463. package/src/css/props/gridRow/index.ts +2 -0
  464. package/src/css/props/gridRow/types.ts +19 -0
  465. package/src/css/props/gridRowEnd/gridRowEnd.css.ts +46 -0
  466. package/src/css/props/gridRowEnd/gridRowEnd.ts +8 -0
  467. package/src/css/props/gridRowEnd/index.ts +2 -0
  468. package/src/css/props/gridRowEnd/types.ts +19 -0
  469. package/src/css/props/gridRowStart/gridRowStart.css.ts +46 -0
  470. package/src/css/props/gridRowStart/gridRowStart.ts +8 -0
  471. package/src/css/props/gridRowStart/index.ts +2 -0
  472. package/src/css/props/gridRowStart/types.ts +19 -0
  473. package/src/css/props/gridTemplateColumns/gridTemplateColumns.css.ts +43 -0
  474. package/src/css/props/gridTemplateColumns/gridTemplateColumns.ts +8 -0
  475. package/src/css/props/gridTemplateColumns/index.ts +2 -0
  476. package/src/css/props/gridTemplateColumns/types.ts +19 -0
  477. package/src/css/props/gridTemplateRows/gridTemplateRows.css.ts +43 -0
  478. package/src/css/props/gridTemplateRows/gridTemplateRows.ts +8 -0
  479. package/src/css/props/gridTemplateRows/index.ts +2 -0
  480. package/src/css/props/gridTemplateRows/types.ts +19 -0
  481. package/src/css/props/height/height.css.ts +25 -0
  482. package/src/css/props/height/height.ts +8 -0
  483. package/src/css/props/height/index.ts +2 -0
  484. package/src/css/props/height/types.ts +15 -0
  485. package/src/css/props/index.ts +37 -0
  486. package/src/css/props/inset/inset.css.ts +37 -0
  487. package/src/css/props/inset/inset.ts +21 -0
  488. package/src/css/{styles → props}/inset/types.ts +1 -1
  489. package/src/css/props/justifyContent/index.ts +2 -0
  490. package/src/css/props/justifyContent/justifyContent.css.ts +25 -0
  491. package/src/css/props/justifyContent/justifyContent.ts +8 -0
  492. package/src/css/props/justifyContent/types.ts +15 -0
  493. package/src/css/props/margin/margin.css.ts +117 -0
  494. package/src/css/props/margin/margin.ts +25 -0
  495. package/src/css/props/margin/types.ts +17 -0
  496. package/src/css/props/maxWidth/maxWidth.css.ts +32 -0
  497. package/src/css/props/maxWidth/maxWidth.ts +8 -0
  498. package/src/css/props/maxWidth/types.ts +11 -0
  499. package/src/css/props/minHeight/index.ts +2 -0
  500. package/src/css/props/minHeight/minHeight.css.ts +13 -0
  501. package/src/css/props/minHeight/minHeight.ts +8 -0
  502. package/src/css/props/minHeight/types.ts +9 -0
  503. package/src/css/props/minWidth/index.ts +2 -0
  504. package/src/css/props/minWidth/minWidth.css.ts +25 -0
  505. package/src/css/props/minWidth/minWidth.ts +8 -0
  506. package/src/css/props/minWidth/types.ts +9 -0
  507. package/src/css/props/outline/index.ts +2 -0
  508. package/src/css/props/outline/outline.css.ts +10 -0
  509. package/src/css/props/outline/outline.ts +8 -0
  510. package/src/css/props/outline/types.ts +7 -0
  511. package/src/css/props/overflow/overflow.css.ts +16 -0
  512. package/src/css/props/overflow/overflow.ts +8 -0
  513. package/src/css/props/overflow/types.ts +17 -0
  514. package/src/css/props/padding/padding.css.ts +87 -0
  515. package/src/css/props/padding/padding.ts +25 -0
  516. package/src/css/props/padding/types.ts +17 -0
  517. package/src/css/props/pointerEvents/pointerEvents.css.ts +13 -0
  518. package/src/css/props/pointerEvents/pointerEvents.ts +8 -0
  519. package/src/css/props/position/position.css.ts +22 -0
  520. package/src/css/props/position/position.ts +8 -0
  521. package/src/css/{styles → props}/position/types.ts +1 -1
  522. package/src/css/props/radius/radius.css.ts +21 -0
  523. package/src/css/props/radius/radius.ts +8 -0
  524. package/src/css/props/radius/types.ts +8 -0
  525. package/src/css/props/shadow/shadow.css.ts +23 -0
  526. package/src/css/props/shadow/shadow.ts +8 -0
  527. package/src/css/props/shadow/types.ts +8 -0
  528. package/src/css/props/textAlign/index.ts +2 -0
  529. package/src/css/props/textAlign/textAlign.css.ts +22 -0
  530. package/src/css/props/textAlign/textAlign.ts +8 -0
  531. package/src/css/props/textAlign/types.ts +7 -0
  532. package/src/css/props/textOverflow/textOverflow.css.ts +13 -0
  533. package/src/css/props/textOverflow/textOverflow.ts +8 -0
  534. package/src/css/{styles → props}/textOverflow/types.ts +5 -1
  535. package/src/css/props/width/types.ts +11 -0
  536. package/src/css/props/width/width.css.ts +28 -0
  537. package/src/css/props/width/width.ts +8 -0
  538. package/src/css/types.ts +221 -766
  539. package/src/css/util.ts +3 -8
  540. package/src/css/utils/index.ts +1 -0
  541. package/src/css/utils/srOnly/srOnly.css.ts +10 -0
  542. package/src/css/utils/srOnly/srOnly.ts +5 -3
  543. package/src/css/vars.css.ts +676 -0
  544. package/src/theme/getScopedTheme.ts +4 -4
  545. package/src/theme/index.ts +0 -5
  546. package/src/theme/types.ts +6 -10
  547. package/src/theme/v0/color/_generic.ts +1 -1
  548. package/src/theme/v0/color/button.ts +1 -1
  549. package/src/theme/v0/color/card.ts +1 -1
  550. package/src/theme/v0/color/color.ts +11 -11
  551. package/src/theme/v0/color/input.ts +1 -1
  552. package/src/theme/v0/color/muted.ts +1 -1
  553. package/src/theme/v0/color/selectable.ts +1 -1
  554. package/src/theme/v0/color/solid.ts +1 -1
  555. package/src/theme/v0/color/spot.ts +1 -1
  556. package/src/theme/v0/focusRing.ts +1 -3
  557. package/src/theme/v0/font.ts +6 -19
  558. package/src/theme/v0/layer.ts +1 -3
  559. package/src/theme/v0/shadow.ts +2 -6
  560. package/src/theme/v0/styles.ts +1 -1
  561. package/src/theme/v0/theme.ts +7 -7
  562. package/src/theme/v2/avatar.ts +2 -4
  563. package/src/theme/{build → v2/build}/_deprecated/color/_selectable/createSelectableTones.ts +3 -3
  564. package/src/theme/{build → v2/build}/_deprecated/color/_solid/createSolidTones.ts +2 -2
  565. package/src/theme/{build → v2/build}/_deprecated/color/button/createButtonModes.ts +7 -2
  566. package/src/theme/{build → v2/build}/_deprecated/color/button/createButtonTones.ts +4 -4
  567. package/src/theme/{build → v2/build}/_deprecated/color/card/createCardStates.ts +3 -3
  568. package/src/theme/{build → v2/build}/_deprecated/color/color.test.ts +1 -1
  569. package/src/theme/{build → v2/build}/_deprecated/color/defaults.ts +1 -1
  570. package/src/theme/{build → v2/build}/_deprecated/color/factory.ts +3 -3
  571. package/src/theme/{build → v2/build}/_deprecated/color/input/createInputModes.ts +7 -2
  572. package/src/theme/{build → v2/build}/_deprecated/color/muted/createMuted.ts +2 -2
  573. package/src/theme/{build → v2/build}/_deprecated/color/spot/createSpot.ts +2 -2
  574. package/src/theme/{build → v2/build}/buildColorTheme.test.ts +3 -1
  575. package/src/theme/{build → v2/build}/buildColorTheme.ts +24 -24
  576. package/src/theme/{build → v2/build}/buildTheme.test.ts +10 -8
  577. package/src/theme/v2/build/buildTheme.ts +12 -0
  578. package/src/theme/{build → v2/build}/colorToken/colorToken.ts +2 -2
  579. package/src/theme/{build → v2/build}/colorToken/compileColorToken.ts +1 -1
  580. package/src/theme/{build → v2/build}/colorToken/types.ts +2 -2
  581. package/src/theme/{build → v2/build}/lib/color-fns/blend/mix.ts +1 -1
  582. package/src/theme/{build → v2/build}/lib/color-fns/blend/multiply.ts +1 -1
  583. package/src/theme/{build → v2/build}/lib/color-fns/blend/screen.ts +1 -1
  584. package/src/theme/{build → v2/build}/lib/color-fns/color-fns.test.ts +1 -1
  585. package/src/theme/{build → v2/build}/lib/color-fns/contrastRatio.ts +5 -2
  586. package/src/theme/{build → v2/build}/lib/color-fns/convert.ts +1 -1
  587. package/src/theme/{build → v2/build}/lib/color-fns/parse.ts +1 -1
  588. package/src/theme/{build → v2/build}/mixThemeColor.test.ts +2 -0
  589. package/src/theme/{build → v2/build}/mixThemeColor.ts +1 -1
  590. package/src/theme/{build → v2/build}/renderColorTheme.ts +27 -27
  591. package/src/theme/{build → v2/build}/renderColorValue.ts +3 -3
  592. package/src/theme/{build → v2/build}/resolveColorTokens.ts +13 -13
  593. package/src/theme/v2/color/_helpers.ts +2 -2
  594. package/src/theme/v2/color/_system.ts +2 -4
  595. package/src/theme/v2/color/avatar.ts +3 -7
  596. package/src/theme/v2/color/badge.ts +3 -7
  597. package/src/theme/v2/color/button.ts +5 -11
  598. package/src/theme/v2/color/color.ts +10 -16
  599. package/src/theme/v2/color/input.ts +8 -10
  600. package/src/theme/v2/color/kbd.ts +1 -3
  601. package/src/theme/v2/color/selectable.ts +4 -8
  602. package/src/theme/v2/color/state.ts +5 -7
  603. package/src/theme/v2/color/syntax.ts +1 -3
  604. package/src/theme/{config → v2/config}/helpers.ts +6 -13
  605. package/src/theme/{config → v2/config}/system.ts +11 -12
  606. package/src/theme/{config → v2/config}/tokens/color/types.ts +14 -10
  607. package/src/theme/{config → v2/config}/tokens/index.ts +0 -1
  608. package/src/theme/{config → v2/config}/tokens/parseTokenValue.test.ts +2 -0
  609. package/src/theme/{config → v2/config}/tokens/parseTokenValue.ts +2 -2
  610. package/src/theme/{config → v2/config}/tokens/types.ts +3 -3
  611. package/src/theme/{config → v2/config}/types.ts +8 -6
  612. package/src/theme/{defaults → v2/defaults}/colorPalette.ts +1 -1
  613. package/src/theme/{defaults → v2/defaults}/colorTokens.ts +3 -3
  614. package/src/theme/{defaults → v2/defaults}/config.ts +2 -2
  615. package/src/theme/{defaults → v2/defaults}/fonts.ts +5 -6
  616. package/src/theme/v2/index.ts +2 -0
  617. package/src/theme/v2/input.ts +2 -4
  618. package/src/theme/v2/theme.ts +10 -14
  619. package/src/theme/{_constants.ts → v3/_constants.ts} +6 -3
  620. package/src/theme/v3/{color/parseColor.ts → _parseColorToken.ts} +59 -46
  621. package/src/theme/v3/buildTheme_v3.ts +20 -11
  622. package/src/theme/v3/color/_constants.ts +15 -0
  623. package/src/theme/v3/color/avatar.ts +14 -0
  624. package/src/theme/v3/color/card.ts +58 -95
  625. package/src/theme/v3/color/color.ts +75 -71
  626. package/src/theme/v3/color/element.ts +8 -8
  627. package/src/theme/v3/color/index.ts +2 -2
  628. package/src/theme/v3/color/token.ts +19 -4
  629. package/src/theme/v3/color/tokens.ts +2 -2
  630. package/src/theme/v3/defaultFonts.ts +250 -0
  631. package/src/theme/v3/defaultTokens.ts +199 -0
  632. package/src/theme/v3/index.ts +4 -1
  633. package/src/theme/{palette → v3/palette}/constants.ts +3 -3
  634. package/src/theme/v3/palette/types.ts +7 -0
  635. package/src/theme/v3/resolveTokens.ts +70 -65
  636. package/src/theme/v3/tokens.ts +2 -2
  637. package/src/theme/v3/types.ts +97 -12
  638. package/src/theme/versioning/getTheme_v2.ts +3 -3
  639. package/src/theme/versioning/is_v0.ts +2 -2
  640. package/src/theme/versioning/is_v2.ts +2 -2
  641. package/src/theme/versioning/themeColor_v0_v2.ts +2 -2
  642. package/src/theme/versioning/themeColor_v2_v2_9.ts +1 -1
  643. package/src/theme/versioning/themeColor_v3_v2.ts +229 -52
  644. package/src/theme/versioning/v0_v2.ts +3 -3
  645. package/src/theme/versioning/v2_v0.ts +4 -4
  646. package/src/theme/versioning/v3_v2.ts +62 -40
  647. package/dist/_chunks-cjs/_visual-editing.js +0 -3059
  648. package/dist/_chunks-cjs/_visual-editing.js.map +0 -1
  649. package/dist/_chunks-cjs/buildCommand.js +0 -32
  650. package/dist/_chunks-cjs/buildCommand.js.map +0 -1
  651. package/dist/_chunks-cjs/refractor.js.map +0 -1
  652. package/dist/_chunks-cjs/v3_v2.js +0 -251
  653. package/dist/_chunks-cjs/v3_v2.js.map +0 -1
  654. package/dist/_chunks-es/_visual-editing.mjs +0 -3066
  655. package/dist/_chunks-es/_visual-editing.mjs.map +0 -1
  656. package/dist/_chunks-es/refractor.mjs.map +0 -1
  657. package/dist/_chunks-es/v3_v2.mjs +0 -252
  658. package/dist/_chunks-es/v3_v2.mjs.map +0 -1
  659. package/dist/_visual-editing.d.mts +0 -806
  660. package/dist/_visual-editing.mjs +0 -31
  661. package/dist/_visual-editing.mjs.map +0 -1
  662. package/dist/cli.d.ts +0 -1
  663. package/dist/cli.js +0 -357
  664. package/dist/cli.js.map +0 -1
  665. package/dist/css.d.mts +0 -2135
  666. package/dist/css.mjs +0 -4713
  667. package/dist/css.mjs.map +0 -1
  668. package/dist/index.mjs +0 -1542
  669. package/dist/index.mjs.map +0 -1
  670. package/dist/sanity-palette.css +0 -9
  671. package/dist/sanity-theme.css +0 -1
  672. package/dist/system.css +0 -3577
  673. package/dist/theme.mjs.map +0 -1
  674. package/src/core/StyleTags.tsx +0 -24
  675. package/src/core/primitives/popover/popoverCard.tsx +0 -148
  676. package/src/core/primitives/tooltip/tooltipCard.tsx +0 -115
  677. package/src/core/utils/conditionalWrapper/conditionalWrapper.tsx +0 -23
  678. package/src/core/utils/conditionalWrapper/index.ts +0 -1
  679. package/src/css/_resp.ts +0 -31
  680. package/src/css/compile/compilePalette.ts +0 -60
  681. package/src/css/compile/compileRule.ts +0 -90
  682. package/src/css/compile/compileRules.test.ts +0 -35
  683. package/src/css/compile/compileRules.ts +0 -40
  684. package/src/css/compile/compileSystem.ts +0 -7
  685. package/src/css/compile/compileTheme.ts +0 -15
  686. package/src/css/compile/compileTheme_v3.ts +0 -410
  687. package/src/css/compile/types.ts +0 -6
  688. package/src/css/components/breadcrumbs/rules.ts +0 -25
  689. package/src/css/components/dialog/rules.ts +0 -76
  690. package/src/css/components/menu/rules.ts +0 -15
  691. package/src/css/components/skeleton/rules.ts +0 -112
  692. package/src/css/components/toast/rules.ts +0 -17
  693. package/src/css/components/tree/rules.ts +0 -168
  694. package/src/css/composeClassNames.ts +0 -13
  695. package/src/css/primitives/_arrow/rules.ts +0 -71
  696. package/src/css/primitives/_input/rules.ts +0 -163
  697. package/src/css/primitives/_selectable/__style.ts +0 -117
  698. package/src/css/primitives/_selectable/_contants.ts +0 -11
  699. package/src/css/primitives/_selectable/rules.ts +0 -129
  700. package/src/css/primitives/avatar/rules.ts +0 -176
  701. package/src/css/primitives/badge/rules.ts +0 -22
  702. package/src/css/primitives/box/rules.ts +0 -28
  703. package/src/css/primitives/button/_constants.ts +0 -17
  704. package/src/css/primitives/button/rules.ts +0 -293
  705. package/src/css/primitives/card/_constants.ts +0 -13
  706. package/src/css/primitives/card/rules.ts +0 -471
  707. package/src/css/primitives/checkbox/__styles.ts +0 -129
  708. package/src/css/primitives/checkbox/rules.ts +0 -152
  709. package/src/css/primitives/code/rules.ts +0 -96
  710. package/src/css/primitives/container/rules.ts +0 -8
  711. package/src/css/primitives/heading/rules.ts +0 -155
  712. package/src/css/primitives/kbd/rules.ts +0 -20
  713. package/src/css/primitives/label/rules.ts +0 -137
  714. package/src/css/primitives/popover/rules.ts +0 -5
  715. package/src/css/primitives/radio/rules.ts +0 -121
  716. package/src/css/primitives/select/rules.ts +0 -22
  717. package/src/css/primitives/spinner/rules.ts +0 -20
  718. package/src/css/primitives/switch/rules.ts +0 -340
  719. package/src/css/primitives/text/rules.ts +0 -164
  720. package/src/css/primitives/textArea/rules.ts +0 -7
  721. package/src/css/primitives/textInput/rules.ts +0 -224
  722. package/src/css/primitives/token/rules.ts +0 -45
  723. package/src/css/primitives/tooltip/rules.ts +0 -19
  724. package/src/css/responsiveRules.ts +0 -25
  725. package/src/css/rules.ts +0 -113
  726. package/src/css/styles/border/border.ts +0 -22
  727. package/src/css/styles/border/rules.ts +0 -24
  728. package/src/css/styles/border/types.ts +0 -10
  729. package/src/css/styles/display/display.ts +0 -7
  730. package/src/css/styles/display/rules.ts +0 -62
  731. package/src/css/styles/flex/flex.ts +0 -20
  732. package/src/css/styles/flex/rules.ts +0 -28
  733. package/src/css/styles/flex/types.ts +0 -35
  734. package/src/css/styles/flexItem/flexItem.ts +0 -8
  735. package/src/css/styles/flexItem/index.ts +0 -2
  736. package/src/css/styles/flexItem/rules.ts +0 -12
  737. package/src/css/styles/flexItem/types.ts +0 -11
  738. package/src/css/styles/font/font.ts +0 -17
  739. package/src/css/styles/font/rules.ts +0 -148
  740. package/src/css/styles/font/types.ts +0 -12
  741. package/src/css/styles/gap/gap.ts +0 -8
  742. package/src/css/styles/gap/rules.ts +0 -34
  743. package/src/css/styles/grid/grid.ts +0 -13
  744. package/src/css/styles/grid/index.ts +0 -2
  745. package/src/css/styles/grid/rules.ts +0 -146
  746. package/src/css/styles/grid/types.ts +0 -29
  747. package/src/css/styles/gridItem/gridItem.ts +0 -15
  748. package/src/css/styles/gridItem/index.ts +0 -2
  749. package/src/css/styles/gridItem/rules.ts +0 -96
  750. package/src/css/styles/gridItem/types.ts +0 -41
  751. package/src/css/styles/height/rules.ts +0 -7
  752. package/src/css/styles/index.ts +0 -19
  753. package/src/css/styles/inset/inset.ts +0 -13
  754. package/src/css/styles/inset/rules.ts +0 -16
  755. package/src/css/styles/margin/margin.ts +0 -15
  756. package/src/css/styles/margin/rules.ts +0 -64
  757. package/src/css/styles/margin/types.ts +0 -11
  758. package/src/css/styles/maxWidth/maxWidth.ts +0 -6
  759. package/src/css/styles/maxWidth/rules.ts +0 -13
  760. package/src/css/styles/maxWidth/types.ts +0 -7
  761. package/src/css/styles/outline/rules.ts +0 -7
  762. package/src/css/styles/overflow/overflow.ts +0 -11
  763. package/src/css/styles/overflow/rules.ts +0 -9
  764. package/src/css/styles/overflow/types.ts +0 -11
  765. package/src/css/styles/padding/padding.ts +0 -15
  766. package/src/css/styles/padding/rules.ts +0 -62
  767. package/src/css/styles/padding/types.ts +0 -14
  768. package/src/css/styles/pointerEvents/pointerEvents.ts +0 -6
  769. package/src/css/styles/pointerEvents/rules.ts +0 -11
  770. package/src/css/styles/position/position.ts +0 -7
  771. package/src/css/styles/position/rules.ts +0 -24
  772. package/src/css/styles/radius/radius.ts +0 -8
  773. package/src/css/styles/radius/rules.ts +0 -13
  774. package/src/css/styles/radius/types.ts +0 -8
  775. package/src/css/styles/shadow/rules.ts +0 -53
  776. package/src/css/styles/shadow/shadow.ts +0 -7
  777. package/src/css/styles/shadow/types.ts +0 -8
  778. package/src/css/styles/textOverflow/rules.ts +0 -17
  779. package/src/css/styles/textOverflow/textOverflow.ts +0 -6
  780. package/src/css/styles/width/rules.ts +0 -7
  781. package/src/css/styles/width/types.ts +0 -9
  782. package/src/css/styles/width/width.ts +0 -6
  783. package/src/css/utils/srOnly/rules.ts +0 -11
  784. package/src/css/varNames.ts +0 -473
  785. package/src/css/vars.ts +0 -443
  786. package/src/theme/_types.ts +0 -41
  787. package/src/theme/build/buildTheme.ts +0 -12
  788. package/src/theme/build/theme.test.ts +0 -27
  789. package/src/theme/config/tokens/parseTokenKey.test.ts +0 -64
  790. package/src/theme/config/tokens/parseTokenKey.ts +0 -67
  791. package/src/theme/palette/types.ts +0 -16
  792. package/src/theme/v3/buildTheme_v3.test.ts +0 -40
  793. package/src/theme/v3/color/buildColor_v3.ts +0 -193
  794. package/src/theme/v3/color/parseColor.test.ts +0 -79
  795. package/src/theme/v3/color/renderColor.test.ts +0 -19
  796. package/src/theme/v3/color/renderColor.ts +0 -33
  797. package/src/theme/v3/defaults.ts +0 -205
  798. /package/src/core/components/autocomplete/{__mocks__ → __workshop__/mock}/apiStore.ts +0 -0
  799. /package/src/core/components/autocomplete/{__mocks__ → __workshop__/mock}/countries.ts +0 -0
  800. /package/src/css/{styles → props}/border/index.ts +0 -0
  801. /package/src/css/{styles → props}/display/index.ts +0 -0
  802. /package/src/css/{styles → props}/flex/index.ts +0 -0
  803. /package/src/css/{styles → props}/font/index.ts +0 -0
  804. /package/src/css/{styles → props}/gap/index.ts +0 -0
  805. /package/src/css/{styles → props}/inset/index.ts +0 -0
  806. /package/src/css/{styles → props}/margin/index.ts +0 -0
  807. /package/src/css/{styles → props}/maxWidth/index.ts +0 -0
  808. /package/src/css/{styles → props}/overflow/index.ts +0 -0
  809. /package/src/css/{styles → props}/padding/index.ts +0 -0
  810. /package/src/css/{styles → props}/pointerEvents/index.ts +0 -0
  811. /package/src/css/{styles → props}/pointerEvents/types.ts +0 -0
  812. /package/src/css/{styles → props}/position/index.ts +0 -0
  813. /package/src/css/{styles → props}/radius/index.ts +0 -0
  814. /package/src/css/{styles → props}/shadow/index.ts +0 -0
  815. /package/src/css/{styles → props}/textOverflow/index.ts +0 -0
  816. /package/src/css/{styles → props}/width/index.ts +0 -0
  817. /package/src/theme/{build → v2/build}/_deprecated/color/index.ts +0 -0
  818. /package/src/theme/{build → v2/build}/colorToken/index.ts +0 -0
  819. /package/src/theme/{build → v2/build}/index.ts +0 -0
  820. /package/src/theme/{build → v2/build}/lib/color-fns/blend/index.ts +0 -0
  821. /package/src/theme/{build → v2/build}/lib/color-fns/index.ts +0 -0
  822. /package/src/theme/{build → v2/build}/lib/color-fns/rgba.ts +0 -0
  823. /package/src/theme/{build → v2/build}/lib/color-fns/types.ts +0 -0
  824. /package/src/theme/{build → v2/build}/lib/isRecord.ts +0 -0
  825. /package/src/theme/{build → v2/build}/lib/utils.ts +0 -0
  826. /package/src/theme/{build → v2/build}/merge.ts +0 -0
  827. /package/src/theme/{config → v2/config}/index.ts +0 -0
  828. /package/src/theme/{config → v2/config}/tokens/color/index.ts +0 -0
  829. /package/src/theme/{palette → v3/palette}/index.ts +0 -0
@@ -1,3066 +0,0 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { c } from "react-compiler-runtime";
3
- import { getScopedTheme, getTheme_v2, buildTheme, createColorTheme as createColorTheme$1, hexToRgb as hexToRgb$1, hslToRgb as hslToRgb$1, multiply as multiply$1, parseColor as parseColor$1, rgbToHex as rgbToHex$1, rgbToHsl as rgbToHsl$1, rgba as rgba$1, screen as screen$1 } from "@sanity/ui/theme";
4
- import { createContext, useContext, useState, useEffect, useDebugValue, useMemo, useSyncExternalStore, forwardRef, Children, isValidElement, cloneElement, useRef, useImperativeHandle, lazy, Suspense, memo, useCallback, useId, useLayoutEffect } from "react";
5
- import { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1 } from "styled-components";
6
- import { composeClassNames, box, label, textOverflow, avatar, avatarArrow, avatarInitials, avatarImage, avatarCounter, avatarStack, text, badge, animatedSpinnerIcon, spinner, buttonLoadingBox, button, card, checkbox, checkboxInput, code, container, heading, kbd, _arrow, _arrowStroke, _arrowShape, srOnly, radio, select, _inputElement, selectPresentation, _switch, _switchElement, _switchPresentation, _switchTrack, _switchThumb, textArea, _inputPresentation, textInput, tooltipCard, tooltip, menu, menuDivider, _selectable } from "@sanity/ui/css";
7
- import ReactIs, { isValidElementType } from "react-is";
8
- import { SpinnerIcon, CheckmarkIcon, RemoveIcon, ChevronDownIcon, CloseIcon, ChevronRightIcon } from "@sanity/icons";
9
- import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from "@floating-ui/react-dom";
10
- import { motion, AnimatePresence } from "framer-motion";
11
- import { ResizeObserver } from "@juggle/resize-observer";
12
- import { useEffectEvent } from "use-effect-event";
13
- import { createPortal } from "react-dom";
14
- function getGlobalScope() {
15
- if (typeof globalThis < "u") return globalThis;
16
- if (typeof window < "u") return window;
17
- if (typeof self < "u") return self;
18
- if (typeof global < "u") return global;
19
- throw new Error("@sanity/ui: could not locate global scope");
20
- }
21
- const globalScope = getGlobalScope();
22
- function createGlobalScopedContext(key2, defaultValue) {
23
- const symbol = Symbol.for(key2);
24
- return typeof document > "u" ? createContext(defaultValue) : (globalScope[symbol] = globalScope[symbol] || createContext(defaultValue), globalScope[symbol]);
25
- }
26
- const ThemeContext = createGlobalScopedContext("@sanity/ui/context/theme", null);
27
- function ThemeProvider(props) {
28
- const $ = c(15), parentTheme = useContext(ThemeContext), {
29
- children
30
- } = props, scheme = props.scheme ?? (parentTheme?.scheme || "light"), rootTheme = props.theme ?? (parentTheme?.theme || null), tone = props.tone ?? (parentTheme?.tone || "default");
31
- let t0;
32
- bb0: {
33
- if (!rootTheme) {
34
- t0 = null;
35
- break bb0;
36
- }
37
- let t12;
38
- $[0] !== rootTheme || $[1] !== scheme || $[2] !== tone ? (t12 = {
39
- version: 0,
40
- theme: rootTheme,
41
- scheme,
42
- tone
43
- }, $[0] = rootTheme, $[1] = scheme, $[2] = tone, $[3] = t12) : t12 = $[3], t0 = t12;
44
- }
45
- const themeContext = t0;
46
- let t1;
47
- bb1: {
48
- if (!rootTheme) {
49
- t1 = null;
50
- break bb1;
51
- }
52
- let t22;
53
- $[4] !== rootTheme || $[5] !== scheme || $[6] !== tone ? (t22 = getScopedTheme(rootTheme, scheme, tone), $[4] = rootTheme, $[5] = scheme, $[6] = tone, $[7] = t22) : t22 = $[7], t1 = t22;
54
- }
55
- const theme = t1;
56
- if (!theme) {
57
- let t22;
58
- return $[8] === Symbol.for("react.memo_cache_sentinel") ? (t22 = /* @__PURE__ */ jsx("pre", { children: 'ThemeProvider: no "theme" property provided' }), $[8] = t22) : t22 = $[8], t22;
59
- }
60
- let t2;
61
- $[9] !== children || $[10] !== theme ? (t2 = /* @__PURE__ */ jsx(ThemeProvider$1, { theme, children }), $[9] = children, $[10] = theme, $[11] = t2) : t2 = $[11];
62
- let t3;
63
- return $[12] !== t2 || $[13] !== themeContext ? (t3 = /* @__PURE__ */ jsx(ThemeContext.Provider, { value: themeContext, children: t2 }), $[12] = t2, $[13] = themeContext, $[14] = t3) : t3 = $[14], t3;
64
- }
65
- ThemeProvider.displayName = "ThemeProvider";
66
- function useRootTheme() {
67
- const value = useContext(ThemeContext);
68
- if (!value)
69
- throw new Error("useRootTheme(): missing context value");
70
- return value;
71
- }
72
- function ThemeColorProvider(props) {
73
- const $ = c(5), {
74
- children,
75
- scheme,
76
- tone
77
- } = props, root = useRootTheme(), t0 = scheme || root.scheme;
78
- let t1;
79
- return $[0] !== children || $[1] !== root.theme || $[2] !== t0 || $[3] !== tone ? (t1 = /* @__PURE__ */ jsx(ThemeProvider, { scheme: t0, theme: root.theme, tone, children }), $[0] = children, $[1] = root.theme, $[2] = t0, $[3] = tone, $[4] = t1) : t1 = $[4], t1;
80
- }
81
- ThemeColorProvider.displayName = "ThemeColorProvider";
82
- function useTheme() {
83
- return useTheme$1();
84
- }
85
- function useTheme_v2() {
86
- const $ = c(2), t0 = useTheme$1();
87
- let t1;
88
- return $[0] !== t0 ? (t1 = getTheme_v2(t0), $[0] = t0, $[1] = t1) : t1 = $[1], t1;
89
- }
90
- const createColorTheme = createColorTheme$1, hexToRgb = hexToRgb$1, hslToRgb = hslToRgb$1, multiply = multiply$1, parseColor = parseColor$1, rgbToHex = rgbToHex$1, rgbToHsl = rgbToHsl$1, rgba = rgba$1, screen = screen$1, studioTheme = buildTheme(), EMPTY_ARRAY = [], EMPTY_RECORD = {}, POPOVER_MOTION_PROPS = {
91
- card: {
92
- initial: {
93
- scale: 0.97,
94
- willChange: "transform"
95
- },
96
- hidden: {
97
- opacity: 0
98
- },
99
- visible: {
100
- opacity: 1,
101
- transition: {
102
- when: "beforeChildren",
103
- duration: 0.1
104
- }
105
- },
106
- scaleIn: {
107
- scale: 1
108
- },
109
- scaleOut: {
110
- scale: 0.97
111
- }
112
- },
113
- transition: {
114
- type: "spring",
115
- visualDuration: 0.2,
116
- bounce: 0.25
117
- }
118
- };
119
- function _isEnterToClickElement(element) {
120
- return isHTMLAnchorElement(element) || isHTMLButtonElement(element);
121
- }
122
- function isHTMLElement(node) {
123
- return node instanceof Node && node.nodeType === Node.ELEMENT_NODE;
124
- }
125
- function isHTMLAnchorElement(element) {
126
- return isHTMLElement(element) && element.nodeName === "A";
127
- }
128
- function isHTMLInputElement(element) {
129
- return isHTMLElement(element) && element.nodeName === "INPUT";
130
- }
131
- function isHTMLButtonElement(element) {
132
- return isHTMLElement(element) && element.nodeName === "BUTTON";
133
- }
134
- function isHTMLSelectElement(element) {
135
- return isHTMLElement(element) && element.nodeName === "SELECT";
136
- }
137
- function isHTMLTextAreaElement(element) {
138
- return isHTMLElement(element) && element.nodeName === "TEXTAREA";
139
- }
140
- function containsOrEqualsElement(element, node) {
141
- return element.contains(node) || element === node;
142
- }
143
- function _getArrayProp(val, defaultVal) {
144
- return val === void 0 ? defaultVal || EMPTY_ARRAY : Array.isArray(val) ? val : [val];
145
- }
146
- function _isScrollable(el) {
147
- if (!(el instanceof Element)) return !1;
148
- const style = window.getComputedStyle(el);
149
- return style.overflowX.includes("auto") || style.overflowX.includes("scroll") || style.overflowY.includes("auto") || style.overflowY.includes("scroll");
150
- }
151
- function useArrayProp(val, defaultVal) {
152
- const $ = c(3);
153
- let t0;
154
- $[0] !== defaultVal || $[1] !== val ? (t0 = () => [_getArrayProp(val, defaultVal), JSON.stringify(val ?? defaultVal)], $[0] = defaultVal, $[1] = val, $[2] = t0) : t0 = $[2];
155
- const [t1, setCache] = useState(t0), [cachedVal, cachedHash] = t1, hash = JSON.stringify(val ?? defaultVal);
156
- return hash !== cachedHash && setCache([_getArrayProp(val, defaultVal), hash]), cachedVal;
157
- }
158
- function useClickOutsideEvent(listener, t0, boundaryElement) {
159
- const $ = c(9), elementsArg = t0 === void 0 ? _temp$8 : t0;
160
- let t1;
161
- $[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
162
- if (!listener)
163
- return;
164
- const target = evt.target;
165
- if (!(target instanceof Node))
166
- return;
167
- const resolvedBoundaryElement = boundaryElement?.();
168
- if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target))
169
- return;
170
- const elements = elementsArg().flat();
171
- for (const el of elements)
172
- if (el && (target === el || el.contains(target)))
173
- return;
174
- listener(evt);
175
- }, $[0] = boundaryElement, $[1] = elementsArg, $[2] = listener, $[3] = t1) : t1 = $[3];
176
- const onEvent = useEffectEvent(t1), hasListener = !!listener;
177
- let t2;
178
- $[4] !== hasListener || $[5] !== onEvent ? (t2 = () => {
179
- if (!hasListener)
180
- return;
181
- const handleEvent = (evt_0) => onEvent(evt_0);
182
- return document.addEventListener("mousedown", handleEvent), () => {
183
- document.removeEventListener("mousedown", handleEvent);
184
- };
185
- }, $[4] = hasListener, $[5] = onEvent, $[6] = t2) : t2 = $[6];
186
- let t3;
187
- $[7] !== hasListener ? (t3 = [hasListener], $[7] = hasListener, $[8] = t3) : t3 = $[8], useEffect(t2, t3), useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
188
- }
189
- function _temp$8() {
190
- return EMPTY_ARRAY;
191
- }
192
- function useCustomValidity(ref, customValidity) {
193
- const $ = c(6);
194
- let t0;
195
- $[0] !== customValidity || $[1] !== ref.current ? (t0 = () => {
196
- ref.current?.setCustomValidity(customValidity || "");
197
- }, $[0] = customValidity, $[1] = ref.current, $[2] = t0) : t0 = $[2];
198
- let t1;
199
- $[3] !== customValidity || $[4] !== ref ? (t1 = [customValidity, ref], $[3] = customValidity, $[4] = ref, $[5] = t1) : t1 = $[5], useEffect(t0, t1);
200
- }
201
- const _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver, _elementSizeObserver = _createElementSizeObserver();
202
- function _createElementRectValueListener() {
203
- return {
204
- subscribe(element, subscriber) {
205
- const resizeObserver = new _ResizeObserver(([entry]) => {
206
- subscriber({
207
- _contentRect: entry.contentRect,
208
- border: {
209
- width: entry.borderBoxSize[0].inlineSize,
210
- height: entry.borderBoxSize[0].blockSize
211
- },
212
- content: {
213
- width: entry.contentRect.width,
214
- height: entry.contentRect.height
215
- }
216
- });
217
- });
218
- return resizeObserver.observe(element), () => {
219
- resizeObserver.unobserve(element), resizeObserver.disconnect();
220
- };
221
- }
222
- };
223
- }
224
- function _createElementSizeObserver() {
225
- const disposeCache = /* @__PURE__ */ new WeakMap(), subscribersCache = /* @__PURE__ */ new WeakMap();
226
- return {
227
- subscribe(element, subscriber) {
228
- const subscribers = subscribersCache.get(element) || [];
229
- let dispose = disposeCache.get(element);
230
- return subscribersCache.has(element) || (subscribersCache.set(element, subscribers), dispose = _createElementRectValueListener().subscribe(element, (elementRect) => {
231
- for (const sub of subscribers)
232
- sub(elementRect);
233
- })), subscribers.push(subscriber), () => {
234
- const idx = subscribers.indexOf(subscriber);
235
- idx > -1 && subscribers.splice(idx, 1), subscribers.length === 0 && dispose && dispose();
236
- };
237
- }
238
- };
239
- }
240
- function useElementSize(element) {
241
- const $ = c(3), [size2, setSize] = useState(null);
242
- let t0, t1;
243
- return $[0] !== element ? (t0 = () => {
244
- if (element)
245
- return _elementSizeObserver.subscribe(element, setSize);
246
- }, t1 = [element], $[0] = element, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), useEffect(t0, t1), size2;
247
- }
248
- function useGlobalKeyDown(onKeyDown) {
249
- const $ = c(5);
250
- let t0;
251
- $[0] !== onKeyDown ? (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0) : t0 = $[1];
252
- const handleKeyDown = useEffectEvent(t0);
253
- let t1;
254
- $[2] !== handleKeyDown ? (t1 = () => {
255
- const handler = (event_0) => handleKeyDown(event_0);
256
- return window.addEventListener("keydown", handler), () => window.removeEventListener("keydown", handler);
257
- }, $[2] = handleKeyDown, $[3] = t1) : t1 = $[3];
258
- let t2;
259
- $[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[4] = t2) : t2 = $[4], useEffect(t1, t2);
260
- }
261
- function useMatchMedia(mediaQueryString, getServerSnapshot2) {
262
- const {
263
- subscribe,
264
- getSnapshot
265
- } = useMemo(() => {
266
- let MEDIA_QUERY_CACHE;
267
- const getMatchMedia = () => (MEDIA_QUERY_CACHE || (MEDIA_QUERY_CACHE = window.matchMedia(mediaQueryString)), MEDIA_QUERY_CACHE);
268
- return {
269
- subscribe: (onStoreChange) => {
270
- const matchMedia = getMatchMedia();
271
- return matchMedia.addEventListener("change", onStoreChange), () => matchMedia.removeEventListener("change", onStoreChange);
272
- },
273
- getSnapshot: () => getMatchMedia().matches
274
- };
275
- }, [mediaQueryString]);
276
- return useDebugValue(mediaQueryString), useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot2);
277
- }
278
- function _getMediaQuery(media, index) {
279
- return index === 0 ? `screen and (max-width: ${media[index] - 1}px)` : index === media.length ? `screen and (min-width: ${media[index - 1]}px)` : `screen and (min-width: ${media[index - 1]}px) and (max-width: ${media[index] - 1}px)`;
280
- }
281
- function _createMediaStore(media) {
282
- const mediaLen = media.length;
283
- let sizes;
284
- const getSizes = () => {
285
- if (!sizes) {
286
- sizes = [];
287
- for (let index = mediaLen; index > -1; index -= 1) {
288
- const mediaQuery = _getMediaQuery(media, index);
289
- sizes.push({
290
- index,
291
- mq: window.matchMedia(mediaQuery)
292
- });
293
- }
294
- }
295
- return sizes;
296
- };
297
- return {
298
- getSnapshot: () => {
299
- for (const {
300
- index,
301
- mq
302
- } of getSizes())
303
- if (mq.matches) return index;
304
- return 0;
305
- },
306
- subscribe: (onStoreChange) => {
307
- const disposeFns = [];
308
- for (const {
309
- mq
310
- } of getSizes()) {
311
- const handleChange = () => {
312
- mq.matches && onStoreChange();
313
- };
314
- mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
315
- }
316
- return () => {
317
- for (const disposeFn of disposeFns)
318
- disposeFn();
319
- };
320
- }
321
- };
322
- }
323
- function getServerSnapshot() {
324
- return 0;
325
- }
326
- function useMediaIndex() {
327
- const $ = c(2), {
328
- media
329
- } = useTheme_v2();
330
- let t0, t1;
331
- $[0] !== media ? (t1 = _createMediaStore(media), $[0] = media, $[1] = t1) : t1 = $[1], t0 = t1;
332
- const store = t0;
333
- return useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
334
- }
335
- function usePrefersDark(t0) {
336
- return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$7 : t0);
337
- }
338
- function _temp$7() {
339
- return !1;
340
- }
341
- function usePrefersReducedMotion(t0) {
342
- return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$6 : t0);
343
- }
344
- function _temp$6() {
345
- return !1;
346
- }
347
- const Box = forwardRef(function(props, ref) {
348
- const $ = c(112);
349
- let align, border, borderBottom, borderLeft, borderRight, borderTop, className, column, columnEnd, columnStart, columns, direction, flex, gap, gapX, gapY, height, inset, insetBottom, insetLeft, insetRight, insetTop, justify, marginBottom, marginLeft, marginRight, marginTop, marginX, marginY, maxWidth, muted, overflow, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, pointerEvents, position, radius, restProps, row, rowEnd, rowStart, rows, t0, t1, t2, t3, t4, width, wrap;
350
- $[0] !== props ? ({
351
- align,
352
- as: t0,
353
- border,
354
- borderTop,
355
- borderRight,
356
- borderBottom,
357
- borderLeft,
358
- className,
359
- column,
360
- columnStart,
361
- columnEnd,
362
- columns,
363
- direction,
364
- display: t1,
365
- flex,
366
- gap,
367
- gapX,
368
- gapY,
369
- height,
370
- inset,
371
- insetBottom,
372
- insetLeft,
373
- insetRight,
374
- insetTop,
375
- justify,
376
- margin: t2,
377
- marginX,
378
- marginY,
379
- marginTop,
380
- marginRight,
381
- marginBottom,
382
- marginLeft,
383
- maxWidth,
384
- overflow,
385
- padding: t3,
386
- paddingX,
387
- paddingY,
388
- paddingTop,
389
- paddingRight,
390
- paddingBottom,
391
- paddingLeft,
392
- pointerEvents,
393
- position,
394
- muted,
395
- radius,
396
- row,
397
- rows,
398
- rowStart,
399
- rowEnd,
400
- sizing: t4,
401
- width,
402
- wrap,
403
- ...restProps
404
- } = props, $[0] = props, $[1] = align, $[2] = border, $[3] = borderBottom, $[4] = borderLeft, $[5] = borderRight, $[6] = borderTop, $[7] = className, $[8] = column, $[9] = columnEnd, $[10] = columnStart, $[11] = columns, $[12] = direction, $[13] = flex, $[14] = gap, $[15] = gapX, $[16] = gapY, $[17] = height, $[18] = inset, $[19] = insetBottom, $[20] = insetLeft, $[21] = insetRight, $[22] = insetTop, $[23] = justify, $[24] = marginBottom, $[25] = marginLeft, $[26] = marginRight, $[27] = marginTop, $[28] = marginX, $[29] = marginY, $[30] = maxWidth, $[31] = muted, $[32] = overflow, $[33] = paddingBottom, $[34] = paddingLeft, $[35] = paddingRight, $[36] = paddingTop, $[37] = paddingX, $[38] = paddingY, $[39] = pointerEvents, $[40] = position, $[41] = radius, $[42] = restProps, $[43] = row, $[44] = rowEnd, $[45] = rowStart, $[46] = rows, $[47] = t0, $[48] = t1, $[49] = t2, $[50] = t3, $[51] = t4, $[52] = width, $[53] = wrap) : (align = $[1], border = $[2], borderBottom = $[3], borderLeft = $[4], borderRight = $[5], borderTop = $[6], className = $[7], column = $[8], columnEnd = $[9], columnStart = $[10], columns = $[11], direction = $[12], flex = $[13], gap = $[14], gapX = $[15], gapY = $[16], height = $[17], inset = $[18], insetBottom = $[19], insetLeft = $[20], insetRight = $[21], insetTop = $[22], justify = $[23], marginBottom = $[24], marginLeft = $[25], marginRight = $[26], marginTop = $[27], marginX = $[28], marginY = $[29], maxWidth = $[30], muted = $[31], overflow = $[32], paddingBottom = $[33], paddingLeft = $[34], paddingRight = $[35], paddingTop = $[36], paddingX = $[37], paddingY = $[38], pointerEvents = $[39], position = $[40], radius = $[41], restProps = $[42], row = $[43], rowEnd = $[44], rowStart = $[45], rows = $[46], t0 = $[47], t1 = $[48], t2 = $[49], t3 = $[50], t4 = $[51], width = $[52], wrap = $[53]);
405
- const As = t0 === void 0 ? "div" : t0, display = t1 === void 0 ? "block" : t1, margin = t2 === void 0 ? 0 : t2, padding = t3 === void 0 ? 0 : t3, sizing = t4 === void 0 ? "border" : t4;
406
- let t5;
407
- $[54] !== align || $[55] !== border || $[56] !== borderBottom || $[57] !== borderLeft || $[58] !== borderRight || $[59] !== borderTop || $[60] !== className || $[61] !== column || $[62] !== columnEnd || $[63] !== columnStart || $[64] !== columns || $[65] !== direction || $[66] !== display || $[67] !== flex || $[68] !== gap || $[69] !== gapX || $[70] !== gapY || $[71] !== height || $[72] !== inset || $[73] !== insetBottom || $[74] !== insetLeft || $[75] !== insetRight || $[76] !== insetTop || $[77] !== justify || $[78] !== margin || $[79] !== marginBottom || $[80] !== marginLeft || $[81] !== marginRight || $[82] !== marginTop || $[83] !== marginX || $[84] !== marginY || $[85] !== maxWidth || $[86] !== muted || $[87] !== overflow || $[88] !== padding || $[89] !== paddingBottom || $[90] !== paddingLeft || $[91] !== paddingRight || $[92] !== paddingTop || $[93] !== paddingX || $[94] !== paddingY || $[95] !== pointerEvents || $[96] !== position || $[97] !== radius || $[98] !== row || $[99] !== rowEnd || $[100] !== rowStart || $[101] !== rows || $[102] !== sizing || $[103] !== width || $[104] !== wrap ? (t5 = composeClassNames(className, box({
408
- align,
409
- border,
410
- borderTop,
411
- borderRight,
412
- borderBottom,
413
- borderLeft,
414
- column,
415
- columnStart,
416
- columnEnd,
417
- columns,
418
- direction,
419
- display,
420
- flex,
421
- gap,
422
- gapX,
423
- gapY,
424
- height,
425
- inset,
426
- insetBottom,
427
- insetLeft,
428
- insetRight,
429
- insetTop,
430
- justify,
431
- overflow,
432
- margin,
433
- marginX,
434
- marginY,
435
- marginTop,
436
- marginRight,
437
- marginBottom,
438
- marginLeft,
439
- maxWidth,
440
- muted,
441
- padding,
442
- paddingX,
443
- paddingY,
444
- paddingTop,
445
- paddingRight,
446
- paddingBottom,
447
- paddingLeft,
448
- pointerEvents,
449
- position,
450
- radius,
451
- row,
452
- rows,
453
- rowStart,
454
- rowEnd,
455
- sizing,
456
- width,
457
- wrap
458
- })), $[54] = align, $[55] = border, $[56] = borderBottom, $[57] = borderLeft, $[58] = borderRight, $[59] = borderTop, $[60] = className, $[61] = column, $[62] = columnEnd, $[63] = columnStart, $[64] = columns, $[65] = direction, $[66] = display, $[67] = flex, $[68] = gap, $[69] = gapX, $[70] = gapY, $[71] = height, $[72] = inset, $[73] = insetBottom, $[74] = insetLeft, $[75] = insetRight, $[76] = insetTop, $[77] = justify, $[78] = margin, $[79] = marginBottom, $[80] = marginLeft, $[81] = marginRight, $[82] = marginTop, $[83] = marginX, $[84] = marginY, $[85] = maxWidth, $[86] = muted, $[87] = overflow, $[88] = padding, $[89] = paddingBottom, $[90] = paddingLeft, $[91] = paddingRight, $[92] = paddingTop, $[93] = paddingX, $[94] = paddingY, $[95] = pointerEvents, $[96] = position, $[97] = radius, $[98] = row, $[99] = rowEnd, $[100] = rowStart, $[101] = rows, $[102] = sizing, $[103] = width, $[104] = wrap, $[105] = t5) : t5 = $[105];
459
- let t6;
460
- return $[106] !== As || $[107] !== props.children || $[108] !== ref || $[109] !== restProps || $[110] !== t5 ? (t6 = /* @__PURE__ */ jsx(As, { "data-ui": "Box", ...restProps, className: t5, ref, children: props.children }), $[106] = As, $[107] = props.children, $[108] = ref, $[109] = restProps, $[110] = t5, $[111] = t6) : t6 = $[111], t6;
461
- });
462
- Box.displayName = "ForwardRef(Box)";
463
- const Label = forwardRef(function(props, ref) {
464
- const $ = c(29);
465
- let accent, align, children, className, restProps, t0, t1, t2, t3, textOverflowProp;
466
- $[0] !== props ? ({
467
- accent,
468
- align,
469
- as: t0,
470
- children,
471
- className,
472
- muted: t1,
473
- size: t2,
474
- textOverflow: textOverflowProp,
475
- weight: t3,
476
- ...restProps
477
- } = props, $[0] = props, $[1] = accent, $[2] = align, $[3] = children, $[4] = className, $[5] = restProps, $[6] = t0, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = textOverflowProp) : (accent = $[1], align = $[2], children = $[3], className = $[4], restProps = $[5], t0 = $[6], t1 = $[7], t2 = $[8], t3 = $[9], textOverflowProp = $[10]);
478
- const As = t0 === void 0 ? "div" : t0, muted = t1 === void 0 ? !1 : t1, size2 = t2 === void 0 ? 1 : t2, weight = t3 === void 0 ? "medium" : t3;
479
- let t4;
480
- $[11] !== accent || $[12] !== align || $[13] !== className || $[14] !== muted || $[15] !== size2 || $[16] !== weight ? (t4 = composeClassNames(className, label({
481
- accent,
482
- align,
483
- muted,
484
- size: size2,
485
- weight
486
- })), $[11] = accent, $[12] = align, $[13] = className, $[14] = muted, $[15] = size2, $[16] = weight, $[17] = t4) : t4 = $[17];
487
- let t5;
488
- $[18] !== textOverflowProp ? (t5 = textOverflow({
489
- textOverflow: textOverflowProp
490
- }), $[18] = textOverflowProp, $[19] = t5) : t5 = $[19];
491
- let t6;
492
- $[20] !== children || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsx("span", { className: t5, children }), $[20] = children, $[21] = t5, $[22] = t6) : t6 = $[22];
493
- let t7;
494
- return $[23] !== As || $[24] !== ref || $[25] !== restProps || $[26] !== t4 || $[27] !== t6 ? (t7 = /* @__PURE__ */ jsx(As, { "data-ui": "Label", ...restProps, className: t4, ref, children: t6 }), $[23] = As, $[24] = ref, $[25] = restProps, $[26] = t4, $[27] = t6, $[28] = t7) : t7 = $[28], t7;
495
- });
496
- Label.displayName = "ForwardRef(Label)";
497
- const Avatar = forwardRef(function(props, ref) {
498
- const $ = c(54);
499
- let __unstable_hideInnerStroke, animateArrowFrom, arrowPositionProp, asProp, className, initials, onImageLoadError, restProps, src, t0, t1, t2, title;
500
- $[0] !== props ? ({
501
- __unstable_hideInnerStroke,
502
- as: asProp,
503
- className,
504
- color: t0,
505
- src,
506
- title,
507
- initials,
508
- onImageLoadError,
509
- arrowPosition: arrowPositionProp,
510
- animateArrowFrom,
511
- status: t1,
512
- size: t2,
513
- ...restProps
514
- } = props, $[0] = props, $[1] = __unstable_hideInnerStroke, $[2] = animateArrowFrom, $[3] = arrowPositionProp, $[4] = asProp, $[5] = className, $[6] = initials, $[7] = onImageLoadError, $[8] = restProps, $[9] = src, $[10] = t0, $[11] = t1, $[12] = t2, $[13] = title) : (__unstable_hideInnerStroke = $[1], animateArrowFrom = $[2], arrowPositionProp = $[3], asProp = $[4], className = $[5], initials = $[6], onImageLoadError = $[7], restProps = $[8], src = $[9], t0 = $[10], t1 = $[11], t2 = $[12], title = $[13]);
515
- const color = t0 === void 0 ? "gray" : t0, status = t1 === void 0 ? "online" : t1, sizeProp = t2 === void 0 ? 1 : t2, As = ReactIs.isValidElementType(asProp) ? asProp : "div", size2 = useArrayProp(sizeProp), [arrowPosition, setArrowPosition] = useState(animateArrowFrom || arrowPositionProp || "inside"), [imageError, setImageError] = useState(!1);
516
- let t3, t4;
517
- $[14] !== arrowPosition || $[15] !== arrowPositionProp ? (t3 = () => {
518
- if (arrowPosition === arrowPositionProp)
519
- return;
520
- const raf = requestAnimationFrame(() => setArrowPosition(arrowPositionProp));
521
- return () => cancelAnimationFrame(raf);
522
- }, t4 = [arrowPosition, arrowPositionProp], $[14] = arrowPosition, $[15] = arrowPositionProp, $[16] = t3, $[17] = t4) : (t3 = $[16], t4 = $[17]), useEffect(t3, t4);
523
- let t5, t6;
524
- $[18] !== src ? (t5 = () => {
525
- src && setImageError(!1);
526
- }, t6 = [src], $[18] = src, $[19] = t5, $[20] = t6) : (t5 = $[19], t6 = $[20]), useEffect(t5, t6);
527
- let t7;
528
- $[21] !== onImageLoadError ? (t7 = () => {
529
- setImageError(!0), onImageLoadError && onImageLoadError(new Error("Avatar: the image failed to load"));
530
- }, $[21] = onImageLoadError, $[22] = t7) : t7 = $[22];
531
- const handleImageError = t7;
532
- let t8, t9;
533
- $[23] !== size2 ? (t9 = size2.map(_temp$5), $[23] = size2, $[24] = t9) : t9 = $[24], t8 = t9;
534
- const initialsSize = t8, t10 = __unstable_hideInnerStroke ? "" : void 0;
535
- let t11;
536
- $[25] !== className || $[26] !== color || $[27] !== sizeProp ? (t11 = composeClassNames(className, avatar({
537
- color,
538
- size: sizeProp
539
- })), $[25] = className, $[26] = color, $[27] = sizeProp, $[28] = t11) : t11 = $[28];
540
- const t12 = imageError ? "" : void 0;
541
- let t13;
542
- $[29] === Symbol.for("react.memo_cache_sentinel") ? (t13 = avatarArrow(), $[29] = t13) : t13 = $[29];
543
- let t14;
544
- $[30] !== color ? (t14 = /* @__PURE__ */ jsx("span", { className: t13, children: /* @__PURE__ */ jsx("svg", { width: "11", height: "7", viewBox: "0 0 11 7", fill: "none", children: /* @__PURE__ */ 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] = t14) : t14 = $[31];
545
- let t15;
546
- $[32] === Symbol.for("react.memo_cache_sentinel") ? (t15 = avatarInitials(), $[32] = t15) : t15 = $[32];
547
- let t16;
548
- $[33] === Symbol.for("react.memo_cache_sentinel") ? (t16 = {
549
- color: "inherit"
550
- }, $[33] = t16) : t16 = $[33];
551
- let t17;
552
- $[34] !== initials || $[35] !== initialsSize ? (t17 = /* @__PURE__ */ jsx(Box, { align: "center", as: "span", className: t15, display: "flex", justify: "center", position: "absolute", inset: 0, children: /* @__PURE__ */ jsx(Label, { align: "center", as: "span", size: initialsSize, style: t16, weight: "medium", children: initials }) }), $[34] = initials, $[35] = initialsSize, $[36] = t17) : t17 = $[36];
553
- let t18;
554
- $[37] !== handleImageError || $[38] !== initials || $[39] !== src ? (t18 = src && /* @__PURE__ */ jsxs(Box, { className: avatarImage(), inset: 0, position: "absolute", children: [
555
- /* @__PURE__ */ jsx("img", { alt: initials, onError: handleImageError, src }),
556
- /* @__PURE__ */ jsx("span", {})
557
- ] }), $[37] = handleImageError, $[38] = initials, $[39] = src, $[40] = t18) : t18 = $[40];
558
- let t19;
559
- return $[41] !== As || $[42] !== arrowPosition || $[43] !== ref || $[44] !== restProps || $[45] !== status || $[46] !== t10 || $[47] !== t11 || $[48] !== t12 || $[49] !== t14 || $[50] !== t17 || $[51] !== t18 || $[52] !== title ? (t19 = /* @__PURE__ */ jsxs(As, { "data-hide-inner-stroke": t10, "data-ui": "Avatar", ...restProps, "aria-label": title, className: t11, "data-arrow-position": arrowPosition, "data-image-error": t12, "data-status": status, ref, title, children: [
560
- t14,
561
- t17,
562
- t18
563
- ] }), $[41] = As, $[42] = arrowPosition, $[43] = ref, $[44] = restProps, $[45] = status, $[46] = t10, $[47] = t11, $[48] = t12, $[49] = t14, $[50] = t17, $[51] = t18, $[52] = title, $[53] = t19) : t19 = $[53], t19;
564
- });
565
- Avatar.displayName = "ForwardRef(Avatar)";
566
- function _temp$5(s) {
567
- return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
568
- }
569
- const AvatarCounter = forwardRef(function(props, ref) {
570
- const $ = c(18);
571
- let className, count, restProps, t0;
572
- $[0] !== props ? ({
573
- className,
574
- count,
575
- size: t0,
576
- ...restProps
577
- } = props, $[0] = props, $[1] = className, $[2] = count, $[3] = restProps, $[4] = t0) : (className = $[1], count = $[2], restProps = $[3], t0 = $[4]);
578
- const size2 = useArrayProp(t0 === void 0 ? 1 : t0);
579
- let t1, t2;
580
- $[5] !== size2 ? (t2 = size2.map(_temp$4), $[5] = size2, $[6] = t2) : t2 = $[6], t1 = t2;
581
- const fontSize = t1;
582
- let t3;
583
- $[7] !== className || $[8] !== size2 ? (t3 = composeClassNames(className, avatarCounter({
584
- size: size2
585
- })), $[7] = className, $[8] = size2, $[9] = t3) : t3 = $[9];
586
- let t4;
587
- $[10] !== count || $[11] !== fontSize ? (t4 = /* @__PURE__ */ jsx(Label, { align: "center", as: "span", size: fontSize, weight: "medium", children: count }), $[10] = count, $[11] = fontSize, $[12] = t4) : t4 = $[12];
588
- let t5;
589
- return $[13] !== ref || $[14] !== restProps || $[15] !== t3 || $[16] !== t4 ? (t5 = /* @__PURE__ */ jsx(Box, { "data-ui": "AvatarCounter", ...restProps, align: "center", className: t3, display: "flex", justify: "center", paddingX: 2, ref, sizing: "border", children: t4 }), $[13] = ref, $[14] = restProps, $[15] = t3, $[16] = t4, $[17] = t5) : t5 = $[17], t5;
590
- });
591
- AvatarCounter.displayName = "ForwardRef(AvatarCounter)";
592
- function _temp$4(s) {
593
- return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
594
- }
595
- const AvatarStack = forwardRef(function(props, ref) {
596
- const $ = c(19);
597
- let childrenProp, className, restProps, t0, t1;
598
- $[0] !== props ? ({
599
- children: childrenProp,
600
- className,
601
- maxLength: t0,
602
- size: t1,
603
- ...restProps
604
- } = props, $[0] = props, $[1] = childrenProp, $[2] = className, $[3] = restProps, $[4] = t0, $[5] = t1) : (childrenProp = $[1], className = $[2], restProps = $[3], t0 = $[4], t1 = $[5]);
605
- const maxLengthProp = t0 === void 0 ? 4 : t0, sizeProp = t1 === void 0 ? 1 : t1, children = Children.toArray(childrenProp).filter(isValidElement), maxLength = Math.max(maxLengthProp, 0), size2 = useArrayProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children, T0 = Box, t2 = "AvatarStack", t3 = "center";
606
- let t4;
607
- $[6] !== className || $[7] !== size2 ? (t4 = composeClassNames(className, avatarStack({
608
- size: size2
609
- })), $[6] = className, $[7] = size2, $[8] = t4) : t4 = $[8];
610
- const t5 = "flex", t6 = len === 0 && /* @__PURE__ */ jsx(Box, { flex: "none", children: /* @__PURE__ */ jsx(AvatarCounter, { count: len, size: size2 }) }), t7 = len !== 0 && extraCount > 1 && /* @__PURE__ */ jsx(Box, { flex: "none", children: /* @__PURE__ */ jsx(AvatarCounter, { count: extraCount, size: size2 }) });
611
- let t8;
612
- $[9] !== size2 ? (t8 = (child, childIndex) => /* @__PURE__ */ jsx(Box, { flex: "none", children: cloneElement(child, {
613
- size: size2
614
- }) }, String(childIndex)), $[9] = size2, $[10] = t8) : t8 = $[10];
615
- const t9 = visibleChildren.map(t8);
616
- let t10;
617
- return $[11] !== T0 || $[12] !== ref || $[13] !== restProps || $[14] !== t4 || $[15] !== t6 || $[16] !== t7 || $[17] !== t9 ? (t10 = /* @__PURE__ */ jsxs(T0, { "data-ui": t2, ...restProps, align: t3, className: t4, display: t5, ref, children: [
618
- t6,
619
- t7,
620
- t9
621
- ] }), $[11] = T0, $[12] = ref, $[13] = restProps, $[14] = t4, $[15] = t6, $[16] = t7, $[17] = t9, $[18] = t10) : t10 = $[18], t10;
622
- });
623
- AvatarStack.displayName = "ForwardRef(AvatarStack)";
624
- const Text = forwardRef(function(props, ref) {
625
- const $ = c(31);
626
- let align, children, className, flex, restProps, t0, t1, t2, t3, textOverflowProp, weight;
627
- $[0] !== props ? ({
628
- accent: t0,
629
- align,
630
- as: t1,
631
- children,
632
- className,
633
- flex,
634
- muted: t2,
635
- size: t3,
636
- textOverflow: textOverflowProp,
637
- weight,
638
- ...restProps
639
- } = props, $[0] = props, $[1] = align, $[2] = children, $[3] = className, $[4] = flex, $[5] = restProps, $[6] = t0, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = textOverflowProp, $[11] = weight) : (align = $[1], children = $[2], className = $[3], flex = $[4], restProps = $[5], t0 = $[6], t1 = $[7], t2 = $[8], t3 = $[9], textOverflowProp = $[10], weight = $[11]);
640
- const accent = t0 === void 0 ? !1 : t0, As = t1 === void 0 ? "div" : t1, muted = t2 === void 0 ? !1 : t2, size2 = t3 === void 0 ? 1 : t3;
641
- let t4;
642
- $[12] !== accent || $[13] !== align || $[14] !== className || $[15] !== flex || $[16] !== muted || $[17] !== size2 || $[18] !== weight ? (t4 = composeClassNames(className, text({
643
- accent,
644
- align,
645
- flex,
646
- muted,
647
- size: size2,
648
- weight
649
- })), $[12] = accent, $[13] = align, $[14] = className, $[15] = flex, $[16] = muted, $[17] = size2, $[18] = weight, $[19] = t4) : t4 = $[19];
650
- let t5;
651
- $[20] !== textOverflowProp ? (t5 = textOverflow({
652
- textOverflow: textOverflowProp
653
- }), $[20] = textOverflowProp, $[21] = t5) : t5 = $[21];
654
- let t6;
655
- $[22] !== children || $[23] !== t5 ? (t6 = /* @__PURE__ */ jsx("span", { className: t5, children }), $[22] = children, $[23] = t5, $[24] = t6) : t6 = $[24];
656
- let t7;
657
- return $[25] !== As || $[26] !== ref || $[27] !== restProps || $[28] !== t4 || $[29] !== t6 ? (t7 = /* @__PURE__ */ jsx(As, { "data-ui": "Text", ...restProps, ref, className: t4, children: t6 }), $[25] = As, $[26] = ref, $[27] = restProps, $[28] = t4, $[29] = t6, $[30] = t7) : t7 = $[30], t7;
658
- });
659
- Text.displayName = "ForwardRef(Text)";
660
- const Badge = forwardRef(function(props, ref) {
661
- const $ = c(25);
662
- let children, className, restProps, t0, t1, t2, t3, t4, textAlign;
663
- if ($[0] !== props) {
664
- const {
665
- children: t52,
666
- className: t62,
667
- display: t72,
668
- fontSize: t8,
669
- mode: _deprecated_mode,
670
- padding: t9,
671
- radius: t10,
672
- textAlign: t11,
673
- tone: t12,
674
- ...t13
675
- } = props;
676
- children = t52, className = t62, t0 = t72, t1 = t8, t2 = t9, t3 = t10, textAlign = t11, t4 = t12, restProps = t13, $[0] = props, $[1] = children, $[2] = className, $[3] = restProps, $[4] = t0, $[5] = t1, $[6] = t2, $[7] = t3, $[8] = t4, $[9] = textAlign;
677
- } else
678
- children = $[1], className = $[2], restProps = $[3], t0 = $[4], t1 = $[5], t2 = $[6], t3 = $[7], t4 = $[8], textAlign = $[9];
679
- const display = t0 === void 0 ? "inline-block" : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 1 : t2, radius = t3 === void 0 ? 2 : t3, tone = t4 === void 0 ? "default" : t4;
680
- let t5;
681
- $[10] !== className || $[11] !== radius || $[12] !== tone ? (t5 = composeClassNames(className, badge({
682
- radius,
683
- tone
684
- })), $[10] = className, $[11] = radius, $[12] = tone, $[13] = t5) : t5 = $[13];
685
- let t6;
686
- $[14] !== children || $[15] !== fontSize || $[16] !== textAlign ? (t6 = /* @__PURE__ */ jsx(Text, { align: textAlign, size: fontSize, children }), $[14] = children, $[15] = fontSize, $[16] = textAlign, $[17] = t6) : t6 = $[17];
687
- let t7;
688
- return $[18] !== display || $[19] !== padding || $[20] !== ref || $[21] !== restProps || $[22] !== t5 || $[23] !== t6 ? (t7 = /* @__PURE__ */ jsx(Box, { "data-ui": "Badge", ...restProps, className: t5, display, padding, ref, children: t6 }), $[18] = display, $[19] = padding, $[20] = ref, $[21] = restProps, $[22] = t5, $[23] = t6, $[24] = t7) : t7 = $[24], t7;
689
- });
690
- Badge.displayName = "ForwardRef(Badge)";
691
- function AnimatedSpinnerIcon(props) {
692
- const $ = c(8);
693
- let className, restProps;
694
- $[0] !== props ? ({
695
- className,
696
- ...restProps
697
- } = props, $[0] = props, $[1] = className, $[2] = restProps) : (className = $[1], restProps = $[2]);
698
- let t0;
699
- $[3] !== className ? (t0 = composeClassNames(className, animatedSpinnerIcon()), $[3] = className, $[4] = t0) : t0 = $[4];
700
- let t1;
701
- return $[5] !== restProps || $[6] !== t0 ? (t1 = /* @__PURE__ */ jsx(SpinnerIcon, { ...restProps, "data-sanity-icon": "animated-spinner", className: t0 }), $[5] = restProps, $[6] = t0, $[7] = t1) : t1 = $[7], t1;
702
- }
703
- const Spinner = forwardRef(function(props, ref) {
704
- const $ = c(5);
705
- let t0;
706
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = spinner(), $[0] = t0) : t0 = $[0];
707
- let t1;
708
- $[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = /* @__PURE__ */ jsx(AnimatedSpinnerIcon, {}), $[1] = t1) : t1 = $[1];
709
- let t2;
710
- return $[2] !== props || $[3] !== ref ? (t2 = /* @__PURE__ */ jsx(Text, { "data-ui": "Spinner", ...props, className: t0, ref, children: t1 }), $[2] = props, $[3] = ref, $[4] = t2) : t2 = $[4], t2;
711
- });
712
- Spinner.displayName = "ForwardRef(Spinner)";
713
- const Button = forwardRef(function(props, ref) {
714
- const {
715
- align = "center",
716
- as: As = "button",
717
- children,
718
- className,
719
- direction,
720
- disabled,
721
- display = "inline-flex",
722
- flex,
723
- fontSize = 1,
724
- gap = props.space ?? props.padding ?? 3,
725
- gapX,
726
- gapY,
727
- href,
728
- icon: IconComponent,
729
- iconRight: IconRightComponent,
730
- justify = "center",
731
- loading,
732
- mode = "default",
733
- padding = 3,
734
- paddingX,
735
- paddingY,
736
- paddingTop,
737
- paddingBottom,
738
- paddingLeft,
739
- paddingRight,
740
- radius = 2,
741
- selected,
742
- space = props.gap ?? props.space ?? props.padding ?? 3,
743
- // eslint-disable-line @typescript-eslint/no-unused-vars
744
- text: text2,
745
- textAlign,
746
- textOverflow: textOverflow2 = "ellipsis",
747
- textWeight,
748
- tone = "default",
749
- type = "button",
750
- muted = !1,
751
- width,
752
- wrap,
753
- ...restProps
754
- } = props, {
755
- button: buttonTheme
756
- } = useTheme_v2();
757
- return /* @__PURE__ */ jsxs(As, { "data-ui": "Button", ...restProps, className: composeClassNames(className, button({
758
- display,
759
- flex,
760
- mode,
761
- radius,
762
- tone,
763
- width
764
- })), "data-disabled": loading || disabled ? "" : void 0, "data-selected": selected ? "" : void 0, disabled: !!(loading || disabled), href: disabled ? void 0 : href, ref, type, children: [
765
- !!loading && /* @__PURE__ */ jsx(Box, { align, as: "span", className: buttonLoadingBox(), display: "flex", flex: 1, justify, width: "fill", children: /* @__PURE__ */ jsx(Spinner, { size: fontSize }) }),
766
- (IconComponent || text2 || IconRightComponent) && /* @__PURE__ */ jsxs(Box, { as: "span", direction, display: "flex", flex: 1, gap, gapX, gapY, justify, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, width: "fill", wrap, children: [
767
- IconComponent && /* @__PURE__ */ jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
768
- isValidElement(IconComponent) && IconComponent,
769
- isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
770
- ] }),
771
- text2 && /* @__PURE__ */ jsx(Text, { align: textAlign, as: "span", flex: "none", muted, size: fontSize, textOverflow: textOverflow2, weight: textWeight ?? buttonTheme.textWeight, children: text2 }),
772
- IconRightComponent && /* @__PURE__ */ jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
773
- isValidElement(IconRightComponent) && IconRightComponent,
774
- isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
775
- ] })
776
- ] }),
777
- children && /* @__PURE__ */ jsx(Box, { as: "span", direction, display: "flex", flex: 1, gap, gapX, gapY, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, width: "fill", wrap, children })
778
- ] });
779
- });
780
- Button.displayName = "ForwardRef(Button)";
781
- const Card = forwardRef(function(props, ref) {
782
- const $ = c(35);
783
- let asProp, className, pressed, restProps, schemeProp, selectable, selected, shadow, style, t0, t1, t2, toneProp;
784
- $[0] !== props ? ({
785
- __unstable_checkered: t0,
786
- __unstable_focusRing: t1,
787
- as: asProp,
788
- className,
789
- pressed,
790
- radius: t2,
791
- scheme: schemeProp,
792
- selectable,
793
- selected,
794
- shadow,
795
- style,
796
- tone: toneProp,
797
- ...restProps
798
- } = props, $[0] = props, $[1] = asProp, $[2] = className, $[3] = pressed, $[4] = restProps, $[5] = schemeProp, $[6] = selectable, $[7] = selected, $[8] = shadow, $[9] = style, $[10] = t0, $[11] = t1, $[12] = t2, $[13] = toneProp) : (asProp = $[1], className = $[2], pressed = $[3], restProps = $[4], schemeProp = $[5], selectable = $[6], selected = $[7], shadow = $[8], style = $[9], t0 = $[10], t1 = $[11], t2 = $[12], toneProp = $[13]);
799
- const checkered = t0 === void 0 ? !1 : t0, focusRing = t1 === void 0 ? !1 : t1, radius = t2 === void 0 ? 0 : t2, as = isValidElementType(asProp) ? asProp : "div", rootTheme = useRootTheme(), tone = toneProp === "inherit" ? rootTheme.tone : toneProp, scheme = schemeProp === void 0 ? rootTheme.scheme : schemeProp, t3 = scheme === rootTheme.scheme ? void 0 : scheme, t4 = tone === rootTheme.tone ? void 0 : tone;
800
- let t5;
801
- $[14] !== className || $[15] !== shadow || $[16] !== t3 || $[17] !== t4 ? (t5 = composeClassNames(className, card({
802
- scheme: t3,
803
- shadow,
804
- tone: t4
805
- })), $[14] = className, $[15] = shadow, $[16] = t3, $[17] = t4, $[18] = t5) : t5 = $[18];
806
- const t6 = checkered ? "" : void 0, t7 = focusRing ? "" : void 0, t8 = pressed ? "" : void 0, t9 = selectable ? "" : void 0, t10 = selected ? "" : void 0;
807
- let t11;
808
- $[19] !== as || $[20] !== radius || $[21] !== ref || $[22] !== restProps || $[23] !== style || $[24] !== t10 || $[25] !== t5 || $[26] !== t6 || $[27] !== t7 || $[28] !== t8 || $[29] !== t9 ? (t11 = /* @__PURE__ */ jsx(Box, { "data-ui": "Card", ...restProps, as, className: t5, "data-checkered": t6, "data-focus-ring": t7, "data-pressed": t8, "data-selectable": t9, "data-selected": t10, radius, ref, style }), $[19] = as, $[20] = radius, $[21] = ref, $[22] = restProps, $[23] = style, $[24] = t10, $[25] = t5, $[26] = t6, $[27] = t7, $[28] = t8, $[29] = t9, $[30] = t11) : t11 = $[30];
809
- const node = t11;
810
- if (scheme === rootTheme.scheme && tone === rootTheme.tone)
811
- return node;
812
- const t12 = tone ?? rootTheme.tone;
813
- let t13;
814
- return $[31] !== node || $[32] !== scheme || $[33] !== t12 ? (t13 = /* @__PURE__ */ jsx(ThemeColorProvider, { scheme, tone: t12, children: node }), $[31] = node, $[32] = scheme, $[33] = t12, $[34] = t13) : t13 = $[34], t13;
815
- });
816
- Card.displayName = "ForwardRef(Card)";
817
- const Checkbox = forwardRef(function(props, forwardedRef) {
818
- const $ = c(31);
819
- let checked, className, customValidity, disabled, indeterminate, readOnly, restProps, style;
820
- $[0] !== props ? ({
821
- checked,
822
- className,
823
- disabled,
824
- indeterminate,
825
- customValidity,
826
- readOnly,
827
- style,
828
- ...restProps
829
- } = props, $[0] = props, $[1] = checked, $[2] = className, $[3] = customValidity, $[4] = disabled, $[5] = indeterminate, $[6] = readOnly, $[7] = restProps, $[8] = style) : (checked = $[1], className = $[2], customValidity = $[3], disabled = $[4], indeterminate = $[5], readOnly = $[6], restProps = $[7], style = $[8]);
830
- const ref = useRef(null);
831
- let t0;
832
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => ref.current, $[9] = t0) : t0 = $[9], useImperativeHandle(forwardedRef, t0);
833
- let t1, t2;
834
- $[10] !== indeterminate ? (t1 = () => {
835
- ref.current && (ref.current.indeterminate = indeterminate || !1);
836
- }, t2 = [indeterminate], $[10] = indeterminate, $[11] = t1, $[12] = t2) : (t1 = $[11], t2 = $[12]), useEffect(t1, t2), useCustomValidity(ref, customValidity);
837
- let t3;
838
- $[13] !== className ? (t3 = composeClassNames(className, checkbox()), $[13] = className, $[14] = t3) : t3 = $[14];
839
- let t4;
840
- $[15] !== className ? (t4 = composeClassNames(className, checkboxInput()), $[15] = className, $[16] = t4) : t4 = $[16];
841
- const t5 = disabled ? "" : void 0, t6 = !disabled && readOnly ? "" : void 0, t7 = customValidity ? "" : void 0, t8 = disabled || readOnly;
842
- let t9;
843
- $[17] !== checked || $[18] !== readOnly || $[19] !== restProps || $[20] !== t4 || $[21] !== t5 || $[22] !== t6 || $[23] !== t7 || $[24] !== t8 ? (t9 = /* @__PURE__ */ jsx("input", { ...restProps, checked, className: t4, "data-disabled": t5, "data-read-only": t6, "data-error": t7, disabled: t8, type: "checkbox", readOnly, ref }), $[17] = checked, $[18] = readOnly, $[19] = restProps, $[20] = t4, $[21] = t5, $[22] = t6, $[23] = t7, $[24] = t8, $[25] = t9) : t9 = $[25];
844
- let t10;
845
- $[26] === Symbol.for("react.memo_cache_sentinel") ? (t10 = /* @__PURE__ */ jsxs("span", { children: [
846
- /* @__PURE__ */ jsx(CheckmarkIcon, {}),
847
- /* @__PURE__ */ jsx(RemoveIcon, {})
848
- ] }), $[26] = t10) : t10 = $[26];
849
- let t11;
850
- return $[27] !== style || $[28] !== t3 || $[29] !== t9 ? (t11 = /* @__PURE__ */ jsxs("span", { className: t3, "data-ui": "Checkbox", style, children: [
851
- t9,
852
- t10
853
- ] }), $[27] = style, $[28] = t3, $[29] = t9, $[30] = t11) : t11 = $[30], t11;
854
- });
855
- Checkbox.displayName = "ForwardRef(Checkbox)";
856
- const LazyRefractor = lazy(() => import("./refractor.mjs")), Code = forwardRef(function(props, ref) {
857
- const $ = c(26);
858
- let children, className, languageProp, restProps, t0, t1, weight;
859
- $[0] !== props ? ({
860
- as: t0,
861
- children,
862
- className,
863
- language: languageProp,
864
- size: t1,
865
- weight,
866
- ...restProps
867
- } = props, $[0] = props, $[1] = children, $[2] = className, $[3] = languageProp, $[4] = restProps, $[5] = t0, $[6] = t1, $[7] = weight) : (children = $[1], className = $[2], languageProp = $[3], restProps = $[4], t0 = $[5], t1 = $[6], weight = $[7]);
868
- const As = t0 === void 0 ? "pre" : t0, size2 = t1 === void 0 ? 1 : t1, language = typeof languageProp == "string" ? languageProp : void 0;
869
- let t2;
870
- $[8] !== className || $[9] !== size2 || $[10] !== weight ? (t2 = composeClassNames(className, code({
871
- size: size2,
872
- weight
873
- })), $[8] = className, $[9] = size2, $[10] = weight, $[11] = t2) : t2 = $[11];
874
- let t3;
875
- $[12] !== children ? (t3 = /* @__PURE__ */ jsx("code", { children }), $[12] = children, $[13] = t3) : t3 = $[13];
876
- let t4;
877
- $[14] !== children || $[15] !== language ? (t4 = /* @__PURE__ */ jsx(LazyRefractor, { language, value: children }), $[14] = children, $[15] = language, $[16] = t4) : t4 = $[16];
878
- let t5;
879
- $[17] !== t3 || $[18] !== t4 ? (t5 = /* @__PURE__ */ jsx(Suspense, { fallback: t3, children: t4 }), $[17] = t3, $[18] = t4, $[19] = t5) : t5 = $[19];
880
- let t6;
881
- return $[20] !== As || $[21] !== ref || $[22] !== restProps || $[23] !== t2 || $[24] !== t5 ? (t6 = /* @__PURE__ */ jsx(As, { "data-ui": "Code", ...restProps, className: t2, ref, children: t5 }), $[20] = As, $[21] = ref, $[22] = restProps, $[23] = t2, $[24] = t5, $[25] = t6) : t6 = $[25], t6;
882
- });
883
- Code.displayName = "ForwardRef(Code)";
884
- const Container = forwardRef(function(props, ref) {
885
- const $ = c(15);
886
- let as, className, restProps, t0, t1;
887
- $[0] !== props ? ({
888
- as,
889
- className,
890
- sizing: t0,
891
- width: t1,
892
- ...restProps
893
- } = props, $[0] = props, $[1] = as, $[2] = className, $[3] = restProps, $[4] = t0, $[5] = t1) : (as = $[1], className = $[2], restProps = $[3], t0 = $[4], t1 = $[5]);
894
- const sizing = t0 === void 0 ? "border" : t0, width = t1 === void 0 ? 2 : t1;
895
- let t2;
896
- $[6] !== className || $[7] !== width ? (t2 = composeClassNames(className, container({
897
- width
898
- })), $[6] = className, $[7] = width, $[8] = t2) : t2 = $[8];
899
- let t3;
900
- return $[9] !== as || $[10] !== ref || $[11] !== restProps || $[12] !== sizing || $[13] !== t2 ? (t3 = /* @__PURE__ */ jsx(Box, { "data-ui": "Container", ...restProps, as, className: t2, ref, sizing }), $[9] = as, $[10] = ref, $[11] = restProps, $[12] = sizing, $[13] = t2, $[14] = t3) : t3 = $[14], t3;
901
- });
902
- Container.displayName = "ForwardRef(Container)";
903
- const Flex = forwardRef(function(props, ref) {
904
- const $ = c(9);
905
- let as, restProps, t0;
906
- $[0] !== props ? ({
907
- as,
908
- direction: t0,
909
- ...restProps
910
- } = props, $[0] = props, $[1] = as, $[2] = restProps, $[3] = t0) : (as = $[1], restProps = $[2], t0 = $[3]);
911
- const direction = t0 === void 0 ? "row" : t0;
912
- let t1;
913
- return $[4] !== as || $[5] !== direction || $[6] !== ref || $[7] !== restProps ? (t1 = /* @__PURE__ */ jsx(Box, { "data-ui": "Flex", ...restProps, as, direction, display: "flex", ref }), $[4] = as, $[5] = direction, $[6] = ref, $[7] = restProps, $[8] = t1) : t1 = $[8], t1;
914
- });
915
- Flex.displayName = "ForwardRef(Flex)";
916
- const Grid = forwardRef(function(props, ref) {
917
- const $ = c(9);
918
- let as, children, restProps;
919
- $[0] !== props ? ({
920
- as,
921
- children,
922
- ...restProps
923
- } = props, $[0] = props, $[1] = as, $[2] = children, $[3] = restProps) : (as = $[1], children = $[2], restProps = $[3]);
924
- let t0;
925
- return $[4] !== as || $[5] !== children || $[6] !== ref || $[7] !== restProps ? (t0 = /* @__PURE__ */ jsx(Box, { "data-ui": "Grid", ...restProps, as, display: "grid", ref, children }), $[4] = as, $[5] = children, $[6] = ref, $[7] = restProps, $[8] = t0) : t0 = $[8], t0;
926
- });
927
- Grid.displayName = "ForwardRef(Grid)";
928
- const Heading = forwardRef(function(props, ref) {
929
- const $ = c(31);
930
- let align, children, className, flex, restProps, t0, t1, t2, t3, textOverflowProp, weight;
931
- $[0] !== props ? ({
932
- accent: t0,
933
- align,
934
- as: t1,
935
- children,
936
- className,
937
- flex,
938
- muted: t2,
939
- size: t3,
940
- textOverflow: textOverflowProp,
941
- weight,
942
- ...restProps
943
- } = props, $[0] = props, $[1] = align, $[2] = children, $[3] = className, $[4] = flex, $[5] = restProps, $[6] = t0, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = textOverflowProp, $[11] = weight) : (align = $[1], children = $[2], className = $[3], flex = $[4], restProps = $[5], t0 = $[6], t1 = $[7], t2 = $[8], t3 = $[9], textOverflowProp = $[10], weight = $[11]);
944
- const accent = t0 === void 0 ? !1 : t0, As = t1 === void 0 ? "div" : t1, muted = t2 === void 0 ? !1 : t2, size2 = t3 === void 0 ? 1 : t3;
945
- let t4;
946
- $[12] !== accent || $[13] !== align || $[14] !== className || $[15] !== flex || $[16] !== muted || $[17] !== size2 || $[18] !== weight ? (t4 = composeClassNames(className, heading({
947
- accent,
948
- align,
949
- flex,
950
- muted,
951
- size: size2,
952
- weight
953
- })), $[12] = accent, $[13] = align, $[14] = className, $[15] = flex, $[16] = muted, $[17] = size2, $[18] = weight, $[19] = t4) : t4 = $[19];
954
- let t5;
955
- $[20] !== textOverflowProp ? (t5 = textOverflow({
956
- textOverflow: textOverflowProp
957
- }), $[20] = textOverflowProp, $[21] = t5) : t5 = $[21];
958
- let t6;
959
- $[22] !== children || $[23] !== t5 ? (t6 = /* @__PURE__ */ jsx("span", { className: t5, children }), $[22] = children, $[23] = t5, $[24] = t6) : t6 = $[24];
960
- let t7;
961
- return $[25] !== As || $[26] !== ref || $[27] !== restProps || $[28] !== t4 || $[29] !== t6 ? (t7 = /* @__PURE__ */ jsx(As, { "data-ui": "Heading", ...restProps, className: t4, ref, children: t6 }), $[25] = As, $[26] = ref, $[27] = restProps, $[28] = t4, $[29] = t6, $[30] = t7) : t7 = $[30], t7;
962
- });
963
- Heading.displayName = "ForwardRef(Heading)";
964
- const Inline = forwardRef(function(props, ref) {
965
- const $ = c(18);
966
- let as, childrenProp, gap, gapX, gapY, restProps, space;
967
- $[0] !== props ? ({
968
- as,
969
- children: childrenProp,
970
- gap,
971
- gapX,
972
- gapY,
973
- space,
974
- ...restProps
975
- } = props, $[0] = props, $[1] = as, $[2] = childrenProp, $[3] = gap, $[4] = gapX, $[5] = gapY, $[6] = restProps, $[7] = space) : (as = $[1], childrenProp = $[2], gap = $[3], gapX = $[4], gapY = $[5], restProps = $[6], space = $[7]);
976
- let t0, t1;
977
- $[8] !== childrenProp ? (t1 = Children.map(childrenProp, _temp$3), $[8] = childrenProp, $[9] = t1) : t1 = $[9], t0 = t1;
978
- const children = t0, t2 = gap ?? space;
979
- let t3;
980
- return $[10] !== as || $[11] !== children || $[12] !== gapX || $[13] !== gapY || $[14] !== ref || $[15] !== restProps || $[16] !== t2 ? (t3 = /* @__PURE__ */ jsx(Box, { "data-ui": "Inline", ...restProps, align: "center", as, display: "flex", gap: t2, gapX, gapY, ref, wrap: "wrap", children }), $[10] = as, $[11] = children, $[12] = gapX, $[13] = gapY, $[14] = ref, $[15] = restProps, $[16] = t2, $[17] = t3) : t3 = $[17], t3;
981
- });
982
- Inline.displayName = "ForwardRef(Inline)";
983
- function _temp$3(child) {
984
- return child && /* @__PURE__ */ jsx(Box, { maxWidth: "fill", children: child });
985
- }
986
- const KBD = forwardRef(function(props, ref) {
987
- const $ = c(23);
988
- let children, className, restProps, t0, t1, t2, t3, t4;
989
- $[0] !== props ? ({
990
- as: t0,
991
- children,
992
- className,
993
- display: t1,
994
- fontSize: t2,
995
- padding: t3,
996
- radius: t4,
997
- ...restProps
998
- } = props, $[0] = props, $[1] = children, $[2] = className, $[3] = restProps, $[4] = t0, $[5] = t1, $[6] = t2, $[7] = t3, $[8] = t4) : (children = $[1], className = $[2], restProps = $[3], t0 = $[4], t1 = $[5], t2 = $[6], t3 = $[7], t4 = $[8]);
999
- const as = t0 === void 0 ? "kbd" : t0, display = t1 === void 0 ? "inline-block" : t1, fontSize = t2 === void 0 ? 1 : t2, padding = t3 === void 0 ? 1 : t3, radius = t4 === void 0 ? 2 : t4;
1000
- let t5;
1001
- $[9] !== className || $[10] !== radius ? (t5 = composeClassNames(className, kbd({
1002
- radius
1003
- })), $[9] = className, $[10] = radius, $[11] = t5) : t5 = $[11];
1004
- let t6;
1005
- $[12] !== children || $[13] !== fontSize ? (t6 = /* @__PURE__ */ jsx(Text, { as: "span", muted: !0, size: fontSize, children }), $[12] = children, $[13] = fontSize, $[14] = t6) : t6 = $[14];
1006
- let t7;
1007
- return $[15] !== as || $[16] !== display || $[17] !== padding || $[18] !== ref || $[19] !== restProps || $[20] !== t5 || $[21] !== t6 ? (t7 = /* @__PURE__ */ jsx(Box, { "data-ui": "KBD", ...restProps, as, className: t5, display, muted: !0, padding, ref, children: t6 }), $[15] = as, $[16] = display, $[17] = padding, $[18] = ref, $[19] = restProps, $[20] = t5, $[21] = t6, $[22] = t7) : t7 = $[22], t7;
1008
- });
1009
- KBD.displayName = "ForwardRef(KBD)";
1010
- const origin = {
1011
- name: "@sanity/ui/origin",
1012
- fn({
1013
- middlewareData,
1014
- placement,
1015
- rects
1016
- }) {
1017
- const [side] = placement.split("-"), floatingWidth = rects.floating.width, floatingHeight = rects.floating.height, shiftX = middlewareData.shift?.x || 0, shiftY = middlewareData.shift?.y || 0;
1018
- if (floatingWidth <= 0 || floatingHeight <= 0)
1019
- return {};
1020
- const isVerticalPlacement = ["bottom", "top"].includes(side), {
1021
- originX,
1022
- originY
1023
- } = isVerticalPlacement ? {
1024
- originX: clamp(0.5 - shiftX / floatingWidth, 0, 1),
1025
- originY: side === "bottom" ? 0 : 1
1026
- } : {
1027
- originX: side === "left" ? 1 : 0,
1028
- originY: clamp(0.5 - shiftY / floatingHeight, 0, 1)
1029
- };
1030
- return {
1031
- data: {
1032
- originX,
1033
- originY
1034
- }
1035
- };
1036
- }
1037
- };
1038
- function clamp(num, min, max) {
1039
- return Math.min(Math.max(num, min), max);
1040
- }
1041
- function moveTowardsLength(movingPoint, targetPoint, amount) {
1042
- const width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
1043
- return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
1044
- }
1045
- function moveTowardsFractional(movingPoint, targetPoint, fraction) {
1046
- return {
1047
- x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
1048
- y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
1049
- };
1050
- }
1051
- function getRoundedCommands(points) {
1052
- const len = points.length, cmds = [];
1053
- for (let i = 0; i < len; i += 1) {
1054
- const point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
1055
- if (prevPoint && point.radius) {
1056
- const curveStart = moveTowardsLength(point, prevPoint, point.radius), curveEnd = moveTowardsLength(point, nextPoint, point.radius), startControl = moveTowardsFractional(curveStart, point, 0.5), endControl = moveTowardsFractional(point, curveEnd, 0.5);
1057
- cmds.push({
1058
- type: "point",
1059
- ...curveStart
1060
- }), cmds.push({
1061
- type: "curve",
1062
- curveEnd,
1063
- startControl,
1064
- endControl
1065
- });
1066
- } else
1067
- cmds.push({
1068
- type: "point",
1069
- ...point
1070
- });
1071
- }
1072
- return cmds;
1073
- }
1074
- function compileCommands(cmds) {
1075
- return cmds.map((n, idx) => n.type === "point" ? `${idx === 0 ? "M" : "L"} ${n.x} ${n.y}` : n.type === "curve" ? `C ${n.startControl.x} ${n.startControl.y} ${n.endControl.x} ${n.endControl.y} ${n.curveEnd.x} ${n.curveEnd.y}` : "").join(" ");
1076
- }
1077
- const Arrow = forwardRef(function(props, ref) {
1078
- const $ = c(31);
1079
- let h, restProps, style, t0, w;
1080
- $[0] !== props ? ({
1081
- width: w,
1082
- height: h,
1083
- radius: t0,
1084
- style,
1085
- ...restProps
1086
- } = props, $[0] = props, $[1] = h, $[2] = restProps, $[3] = style, $[4] = t0, $[5] = w) : (h = $[1], restProps = $[2], style = $[3], t0 = $[4], w = $[5]);
1087
- const radius = t0 === void 0 ? 0 : t0, {
1088
- card: card2
1089
- } = useTheme_v2(), strokeWidth = card2.shadow.outline, center = w / 2;
1090
- let t1;
1091
- const points = [{
1092
- x: 0,
1093
- y: 0
1094
- }, {
1095
- x: radius,
1096
- y: 0,
1097
- radius
1098
- }, {
1099
- x: center,
1100
- y: h - 1,
1101
- radius
1102
- }, {
1103
- x: w - radius,
1104
- y: 0,
1105
- radius
1106
- }, {
1107
- x: w,
1108
- y: 0
1109
- }], cmds = getRoundedCommands(points);
1110
- t1 = compileCommands(cmds);
1111
- const path = t1, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`;
1112
- let t2;
1113
- $[6] === Symbol.for("react.memo_cache_sentinel") ? (t2 = _arrow(), $[6] = t2) : t2 = $[6];
1114
- const t3 = `${w}px`;
1115
- let t4;
1116
- $[7] !== style || $[8] !== t3 ? (t4 = {
1117
- ...style,
1118
- "--arrow-size": t3
1119
- }, $[7] = style, $[8] = t3, $[9] = t4) : t4 = $[9];
1120
- const t5 = t4, t6 = `0 0 ${w} ${w}`;
1121
- let t7;
1122
- $[10] !== strokeWidth || $[11] !== w ? (t7 = /* @__PURE__ */ jsx("mask", { id: "stroke-mask", children: /* @__PURE__ */ jsx("rect", { x: 0, y: strokeWidth, width: w, height: w, fill: "white" }) }), $[10] = strokeWidth, $[11] = w, $[12] = t7) : t7 = $[12];
1123
- let t8;
1124
- $[13] === Symbol.for("react.memo_cache_sentinel") ? (t8 = _arrowStroke(), $[13] = t8) : t8 = $[13];
1125
- const t9 = strokeWidth * 2;
1126
- let t10;
1127
- $[14] !== strokePath || $[15] !== t9 ? (t10 = /* @__PURE__ */ jsx("path", { className: t8, d: strokePath, mask: "url(#stroke-mask)", strokeWidth: t9 }), $[14] = strokePath, $[15] = t9, $[16] = t10) : t10 = $[16];
1128
- let t11;
1129
- $[17] === Symbol.for("react.memo_cache_sentinel") ? (t11 = _arrowShape(), $[17] = t11) : t11 = $[17];
1130
- let t12;
1131
- $[18] !== fillPath ? (t12 = /* @__PURE__ */ jsx("path", { className: t11, d: fillPath }), $[18] = fillPath, $[19] = t12) : t12 = $[19];
1132
- let t13;
1133
- $[20] !== t10 || $[21] !== t12 || $[22] !== t6 || $[23] !== t7 || $[24] !== w ? (t13 = /* @__PURE__ */ jsxs("svg", { width: w, height: w, viewBox: t6, children: [
1134
- t7,
1135
- t10,
1136
- t12
1137
- ] }), $[20] = t10, $[21] = t12, $[22] = t6, $[23] = t7, $[24] = w, $[25] = t13) : t13 = $[25];
1138
- let t14;
1139
- return $[26] !== ref || $[27] !== restProps || $[28] !== t13 || $[29] !== t5 ? (t14 = /* @__PURE__ */ jsx("div", { ...restProps, className: t2, ref, style: t5, children: t13 }), $[26] = ref, $[27] = restProps, $[28] = t13, $[29] = t5, $[30] = t14) : t14 = $[30], t14;
1140
- });
1141
- Arrow.displayName = "ForwardRef(Arrow)";
1142
- const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/context/boundaryElement", null);
1143
- function BoundaryElementProvider(props) {
1144
- const $ = c(5), {
1145
- children,
1146
- element
1147
- } = props;
1148
- let t0, t1;
1149
- $[0] !== element ? (t1 = {
1150
- version: 0,
1151
- element
1152
- }, $[0] = element, $[1] = t1) : t1 = $[1], t0 = t1;
1153
- const value = t0;
1154
- let t2;
1155
- return $[2] !== children || $[3] !== value ? (t2 = /* @__PURE__ */ jsx(BoundaryElementContext.Provider, { value, children }), $[2] = children, $[3] = value, $[4] = t2) : t2 = $[4], t2;
1156
- }
1157
- BoundaryElementProvider.displayName = "BoundaryElementProvider";
1158
- function isRecord(value) {
1159
- return !!(value && typeof value == "object" && !Array.isArray(value));
1160
- }
1161
- const DEFAULT_VALUE = {
1162
- version: 0,
1163
- element: null
1164
- };
1165
- function useBoundaryElement() {
1166
- const value = useContext(BoundaryElementContext);
1167
- if (value && (!isRecord(value) || value.version !== 0))
1168
- throw new Error("useBoundaryElement(): the context value is not compatible");
1169
- return value || DEFAULT_VALUE;
1170
- }
1171
- function ConditionalWrapper({
1172
- children,
1173
- condition,
1174
- wrapper
1175
- }) {
1176
- return condition ? wrapper(children) : children;
1177
- }
1178
- ConditionalWrapper.displayName = "ConditionalWrapper";
1179
- function findMaxBreakpoints(media, width) {
1180
- const ret = [];
1181
- for (let i = 0; i < media.length; i += 1)
1182
- media[i] > width && ret.push(i);
1183
- return ret;
1184
- }
1185
- function findMinBreakpoints(media, width) {
1186
- const ret = [];
1187
- for (let i = 0; i < media.length; i += 1)
1188
- media[i] <= width && ret.push(i);
1189
- return ret;
1190
- }
1191
- const ElementQuery = forwardRef(function(props, forwardedRef) {
1192
- const $ = c(18), theme = useTheme_v2();
1193
- let _media, children, restProps;
1194
- $[0] !== props ? ({
1195
- children,
1196
- media: _media,
1197
- ...restProps
1198
- } = props, $[0] = props, $[1] = _media, $[2] = children, $[3] = restProps) : (_media = $[1], children = $[2], restProps = $[3]);
1199
- const media = _media ?? theme.media, [element, setElement] = useState(null), elementSize = useElementSize(element);
1200
- let t0;
1201
- t0 = elementSize?.border.width ?? window.innerWidth;
1202
- const width = t0;
1203
- let t1, t2;
1204
- if ($[4] !== media || $[5] !== width) {
1205
- const eq = findMaxBreakpoints(media, width);
1206
- t2 = eq.length ? eq.join(" ") : void 0, $[4] = media, $[5] = width, $[6] = t2;
1207
- } else
1208
- t2 = $[6];
1209
- t1 = t2;
1210
- const max = t1;
1211
- let t3, t4;
1212
- if ($[7] !== media || $[8] !== width) {
1213
- const eq_0 = findMinBreakpoints(media, width);
1214
- t4 = eq_0.length ? eq_0.join(" ") : void 0, $[7] = media, $[8] = width, $[9] = t4;
1215
- } else
1216
- t4 = $[9];
1217
- t3 = t4;
1218
- const min = t3;
1219
- let t5, t6;
1220
- $[10] !== element ? (t5 = () => element, t6 = [element], $[10] = element, $[11] = t5, $[12] = t6) : (t5 = $[11], t6 = $[12]), useImperativeHandle(forwardedRef, t5, t6);
1221
- let t7;
1222
- return $[13] !== children || $[14] !== max || $[15] !== min || $[16] !== restProps ? (t7 = /* @__PURE__ */ jsx("div", { "data-ui": "ElementQuery", ...restProps, "data-eq-max": max, "data-eq-min": min, ref: setElement, children }), $[13] = children, $[14] = max, $[15] = min, $[16] = restProps, $[17] = t7) : t7 = $[17], t7;
1223
- });
1224
- ElementQuery.displayName = "ForwardRef(ElementQuery)";
1225
- function getLayerContext(contextValue) {
1226
- if (!isRecord(contextValue) || contextValue.version !== 0)
1227
- throw new Error("the context value is not compatible");
1228
- if (!contextValue)
1229
- throw new Error("components using `useLayer()` should be wrapped in a <LayerProvider>.");
1230
- if (contextValue.version === 0)
1231
- return contextValue;
1232
- throw new Error("could not get layer context");
1233
- }
1234
- const LayerContext = createGlobalScopedContext("@sanity/ui/context/layer", null);
1235
- function LayerProvider(props) {
1236
- const $ = c(19), {
1237
- children,
1238
- zOffset: t0
1239
- } = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = useContext(LayerContext);
1240
- let t1;
1241
- $[0] !== parentContextValue ? (t1 = parentContextValue && getLayerContext(parentContextValue), $[0] = parentContextValue, $[1] = t1) : t1 = $[1];
1242
- const parent = t1, parentRegisterChild = parent?.registerChild, level = (parent?.level ?? 0) + 1, zOffset = useArrayProp(zOffsetProp), maxMediaIndex = zOffset.length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex];
1243
- let t2;
1244
- $[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {}, $[2] = t2) : t2 = $[2];
1245
- const [, setChildLayers] = useState(t2), [size2, setSize] = useState(0), isTopLayer = size2 === 0;
1246
- let t3;
1247
- $[3] !== parentRegisterChild || $[4] !== setChildLayers ? (t3 = (childLevel) => {
1248
- const parentDispose = parentRegisterChild?.(childLevel);
1249
- return childLevel !== void 0 ? setChildLayers((state) => {
1250
- const prevLen = state[childLevel] ?? 0, nextState = {
1251
- ...state,
1252
- [childLevel]: prevLen + 1
1253
- };
1254
- return setSize(Object.keys(nextState).length), nextState;
1255
- }) : setSize(_temp$2), () => {
1256
- childLevel !== void 0 ? setChildLayers((state_0) => {
1257
- const nextState_0 = {
1258
- ...state_0
1259
- };
1260
- return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
1261
- }) : setSize(_temp2$2), parentDispose?.();
1262
- };
1263
- }, $[3] = parentRegisterChild, $[4] = setChildLayers, $[5] = t3) : t3 = $[5];
1264
- const registerChild = t3;
1265
- let t4, t5;
1266
- $[6] !== level || $[7] !== parentRegisterChild ? (t4 = () => parentRegisterChild?.(level), t5 = [level, parentRegisterChild], $[6] = level, $[7] = parentRegisterChild, $[8] = t4, $[9] = t5) : (t4 = $[8], t5 = $[9]), useEffect(t4, t5);
1267
- let t6, t7;
1268
- $[10] !== isTopLayer || $[11] !== level || $[12] !== registerChild || $[13] !== size2 || $[14] !== zIndex ? (t7 = {
1269
- version: 0,
1270
- isTopLayer,
1271
- level,
1272
- registerChild,
1273
- size: size2,
1274
- zIndex
1275
- }, $[10] = isTopLayer, $[11] = level, $[12] = registerChild, $[13] = size2, $[14] = zIndex, $[15] = t7) : t7 = $[15], t6 = t7;
1276
- const value = t6;
1277
- let t8;
1278
- return $[16] !== children || $[17] !== value ? (t8 = /* @__PURE__ */ jsx(LayerContext.Provider, { value, children }), $[16] = children, $[17] = value, $[18] = t8) : t8 = $[18], t8;
1279
- }
1280
- function _temp2$2(v_0) {
1281
- return v_0 - 1;
1282
- }
1283
- function _temp$2(v) {
1284
- return v + 1;
1285
- }
1286
- LayerProvider.displayName = "LayerProvider";
1287
- function useLayer() {
1288
- const $ = c(2), value = useContext(LayerContext);
1289
- if (!value)
1290
- throw new Error("useLayer(): missing context value");
1291
- try {
1292
- let t1;
1293
- return $[0] !== value ? (t1 = getLayerContext(value), $[0] = value, $[1] = t1) : t1 = $[1], t1;
1294
- } catch (t0) {
1295
- const err = t0;
1296
- throw err instanceof Error ? new Error(`useLayer(): ${err.message}`) : new Error(`useLayer(): ${err}`);
1297
- }
1298
- }
1299
- const LayerChildren = forwardRef(function(props, forwardedRef) {
1300
- const $ = c(24);
1301
- let children, onActivate, onFocus, restProps, t0, t1;
1302
- $[0] !== props ? ({
1303
- children,
1304
- onActivate,
1305
- onFocus,
1306
- position: t0,
1307
- style: t1,
1308
- ...restProps
1309
- } = props, $[0] = props, $[1] = children, $[2] = onActivate, $[3] = onFocus, $[4] = restProps, $[5] = t0, $[6] = t1) : (children = $[1], onActivate = $[2], onFocus = $[3], restProps = $[4], t0 = $[5], t1 = $[6]);
1310
- const position = t0 === void 0 ? "relative" : t0, style = t1 === void 0 ? EMPTY_RECORD : t1, {
1311
- zIndex,
1312
- isTopLayer
1313
- } = useLayer(), lastFocusedRef = useRef(null), ref = useRef(null), isTopLayerRef = useRef(isTopLayer);
1314
- let t2;
1315
- $[7] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[7] = t2) : t2 = $[7], useImperativeHandle(forwardedRef, t2);
1316
- let t3, t4;
1317
- $[8] !== isTopLayer || $[9] !== onActivate ? (t3 = () => {
1318
- isTopLayerRef.current !== isTopLayer && isTopLayer && onActivate?.({
1319
- activeElement: lastFocusedRef.current
1320
- }), isTopLayerRef.current = isTopLayer;
1321
- }, t4 = [isTopLayer, onActivate], $[8] = isTopLayer, $[9] = onActivate, $[10] = t3, $[11] = t4) : (t3 = $[10], t4 = $[11]), useEffect(t3, t4);
1322
- let t5;
1323
- $[12] !== isTopLayer || $[13] !== onFocus ? (t5 = (event) => {
1324
- onFocus?.(event);
1325
- const rootElement = ref.current, target = document.activeElement;
1326
- !isTopLayer || !rootElement || !target || isHTMLElement(target) && containsOrEqualsElement(rootElement, target) && (lastFocusedRef.current = target);
1327
- }, $[12] = isTopLayer, $[13] = onFocus, $[14] = t5) : t5 = $[14];
1328
- const handleFocus = t5;
1329
- let t6;
1330
- $[15] !== style || $[16] !== zIndex ? (t6 = {
1331
- ...style,
1332
- zIndex
1333
- }, $[15] = style, $[16] = zIndex, $[17] = t6) : t6 = $[17];
1334
- let t7;
1335
- return $[18] !== children || $[19] !== handleFocus || $[20] !== position || $[21] !== restProps || $[22] !== t6 ? (t7 = /* @__PURE__ */ jsx(Box, { "data-ui": "Layer", ...restProps, onFocus: handleFocus, position, ref, style: t6, children }), $[18] = children, $[19] = handleFocus, $[20] = position, $[21] = restProps, $[22] = t6, $[23] = t7) : t7 = $[23], t7;
1336
- }), Layer = forwardRef(function(props, ref) {
1337
- const $ = c(11);
1338
- let children, restProps, t0;
1339
- $[0] !== props ? ({
1340
- children,
1341
- zOffset: t0,
1342
- ...restProps
1343
- } = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0) : (children = $[1], restProps = $[2], t0 = $[3]);
1344
- const zOffset = t0 === void 0 ? 1 : t0;
1345
- let t1;
1346
- $[4] !== children || $[5] !== ref || $[6] !== restProps ? (t1 = /* @__PURE__ */ jsx(LayerChildren, { ...restProps, ref, children }), $[4] = children, $[5] = ref, $[6] = restProps, $[7] = t1) : t1 = $[7];
1347
- let t2;
1348
- return $[8] !== t1 || $[9] !== zOffset ? (t2 = /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: t1 }), $[8] = t1, $[9] = zOffset, $[10] = t2) : t2 = $[10], t2;
1349
- });
1350
- Layer.displayName = "ForwardRef(Layer)";
1351
- const key = "@sanity/ui/context/portal", elementKey = Symbol.for(`${key}/element`);
1352
- globalScope[elementKey] = null;
1353
- const defaultContextValue = {
1354
- version: 0,
1355
- boundaryElement: null,
1356
- get element() {
1357
- return typeof document > "u" ? null : (globalScope[elementKey] || (globalScope[elementKey] = document.createElement("div"), globalScope[elementKey].setAttribute("data-portal", ""), document.body.appendChild(globalScope[elementKey])), globalScope[elementKey]);
1358
- }
1359
- }, PortalContext = createGlobalScopedContext(key, defaultContextValue);
1360
- function usePortal() {
1361
- const value = useContext(PortalContext);
1362
- if (!value)
1363
- throw new Error("usePortal(): missing context value");
1364
- if (!isRecord(value) || value.version !== 0)
1365
- throw new Error("usePortal(): the context value is not compatible");
1366
- return value;
1367
- }
1368
- function Portal(props) {
1369
- const $ = c(3), {
1370
- children,
1371
- __unstable_name: name
1372
- } = props, portal = usePortal(), portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default;
1373
- if (!portalElement)
1374
- return null;
1375
- let t0;
1376
- return $[0] !== children || $[1] !== portalElement ? (t0 = createPortal(children, portalElement), $[0] = children, $[1] = portalElement, $[2] = t0) : t0 = $[2], t0;
1377
- }
1378
- Portal.displayName = "Portal";
1379
- function PortalProvider(props) {
1380
- const $ = c(7), {
1381
- boundaryElement,
1382
- children,
1383
- element,
1384
- __unstable_elements: elementsProp
1385
- } = props, elements = useUnique(elementsProp), fallbackElement = useSyncExternalStore(emptySubscribe, _temp$1, _temp2$1);
1386
- let t0;
1387
- const t1 = boundaryElement || null, t2 = element || fallbackElement;
1388
- let t3;
1389
- $[0] !== elements || $[1] !== t1 || $[2] !== t2 ? (t3 = {
1390
- version: 0,
1391
- boundaryElement: t1,
1392
- element: t2,
1393
- elements
1394
- }, $[0] = elements, $[1] = t1, $[2] = t2, $[3] = t3) : t3 = $[3], t0 = t3;
1395
- const value = t0;
1396
- let t4;
1397
- return $[4] !== children || $[5] !== value ? (t4 = /* @__PURE__ */ jsx(PortalContext.Provider, { value, children }), $[4] = children, $[5] = value, $[6] = t4) : t4 = $[6], t4;
1398
- }
1399
- function _temp2$1() {
1400
- return null;
1401
- }
1402
- function _temp$1() {
1403
- return document.body;
1404
- }
1405
- PortalProvider.displayName = "PortalProvider";
1406
- const emptySubscribe = () => () => {
1407
- };
1408
- function useUnique(value) {
1409
- const valueRef = useRef(value);
1410
- return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
1411
- }
1412
- function _isEqual(objA, objB) {
1413
- if (!objA || !objB)
1414
- return objA === objB;
1415
- const keysA = Object.keys(objA), keysB = Object.keys(objB);
1416
- return keysA.length !== keysB.length ? !1 : keysA.every((key2) => objA[key2] === objB[key2]);
1417
- }
1418
- const SrOnly = forwardRef(function(props, ref) {
1419
- const $ = c(13);
1420
- let children, className, rest, t0;
1421
- $[0] !== props ? ({
1422
- as: t0,
1423
- children,
1424
- className,
1425
- ...rest
1426
- } = props, $[0] = props, $[1] = children, $[2] = className, $[3] = rest, $[4] = t0) : (children = $[1], className = $[2], rest = $[3], t0 = $[4]);
1427
- const As = t0 === void 0 ? "div" : t0;
1428
- let t1;
1429
- $[5] !== className ? (t1 = composeClassNames(className, srOnly()), $[5] = className, $[6] = t1) : t1 = $[6];
1430
- let t2;
1431
- return $[7] !== As || $[8] !== children || $[9] !== ref || $[10] !== rest || $[11] !== t1 ? (t2 = /* @__PURE__ */ jsx(As, { "data-ui": "SrOnly", ...rest, "aria-hidden": !0, className: t1, ref, children }), $[7] = As, $[8] = children, $[9] = ref, $[10] = rest, $[11] = t1, $[12] = t2) : t2 = $[12], t2;
1432
- });
1433
- SrOnly.displayName = "ForwardRef(SrOnly)";
1434
- const VirtualList = forwardRef(function(props, forwardedRef) {
1435
- const $ = c(56);
1436
- let getItemKey, onChange, renderItem, restProps, t0, t1, t2;
1437
- $[0] !== props ? ({
1438
- as: t0,
1439
- gap: t1,
1440
- getItemKey,
1441
- items: t2,
1442
- onChange,
1443
- renderItem,
1444
- ...restProps
1445
- } = props, $[0] = props, $[1] = getItemKey, $[2] = onChange, $[3] = renderItem, $[4] = restProps, $[5] = t0, $[6] = t1, $[7] = t2) : (getItemKey = $[1], onChange = $[2], renderItem = $[3], restProps = $[4], t0 = $[5], t1 = $[6], t2 = $[7]);
1446
- const as = t0 === void 0 ? "div" : t0, gap = t1 === void 0 ? 0 : t1;
1447
- let t3;
1448
- $[8] !== t2 ? (t3 = t2 === void 0 ? [] : t2, $[8] = t2, $[9] = t3) : t3 = $[9];
1449
- const items = t3, {
1450
- space
1451
- } = useTheme_v2(), ref = useRef(null), wrapperRef = useRef(null), [scrollTop, setScrollTop] = useState(0), [scrollHeight, setScrollHeight] = useState(0), [itemHeight, setItemHeight] = useState(-1);
1452
- let t4;
1453
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[10] = t4) : t4 = $[10], useImperativeHandle(forwardedRef, t4);
1454
- let t5;
1455
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => {
1456
- if (!wrapperRef.current)
1457
- return;
1458
- const firstElement = wrapperRef.current.firstChild;
1459
- firstElement instanceof HTMLElement && setItemHeight(firstElement.offsetHeight);
1460
- }, $[11] = t5) : t5 = $[11];
1461
- let t6;
1462
- $[12] !== renderItem ? (t6 = [renderItem], $[12] = renderItem, $[13] = t6) : t6 = $[13], useEffect(t5, t6);
1463
- let t7, t8;
1464
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => {
1465
- if (!ref.current)
1466
- return;
1467
- const scrollEl = findScrollable(ref.current.parentNode);
1468
- if (scrollEl) {
1469
- if (!(scrollEl instanceof HTMLElement))
1470
- return;
1471
- const handleScroll = () => {
1472
- setScrollTop(scrollEl.scrollTop);
1473
- };
1474
- scrollEl.addEventListener("scroll", handleScroll, {
1475
- passive: !0
1476
- });
1477
- const ro = new _ResizeObserver((entries) => {
1478
- setScrollHeight(entries[0].contentRect.height);
1479
- });
1480
- return ro.observe(scrollEl), handleScroll(), () => {
1481
- scrollEl.removeEventListener("scroll", handleScroll), ro.unobserve(scrollEl), ro.disconnect();
1482
- };
1483
- }
1484
- const handleScroll_0 = () => {
1485
- setScrollTop(window.scrollY);
1486
- }, handleResize = () => {
1487
- setScrollHeight(window.innerHeight);
1488
- };
1489
- return window.addEventListener("scroll", handleScroll_0, {
1490
- passive: !0
1491
- }), window.addEventListener("resize", handleResize), setScrollHeight(window.innerHeight), handleScroll_0(), () => {
1492
- window.removeEventListener("scroll", handleScroll_0), window.removeEventListener("resize", handleResize);
1493
- };
1494
- }, t8 = [], $[14] = t7, $[15] = t8) : (t7 = $[14], t8 = $[15]), useEffect(t7, t8);
1495
- const len = items.length, height = itemHeight ? len * (itemHeight + space[gap]) - space[gap] : 0, fromIndex = height ? Math.max(Math.floor(scrollTop / height * len) - 2, 0) : 0, toIndex = height ? Math.ceil((scrollTop + scrollHeight) / height * len) + 1 : 0;
1496
- let t10, t9;
1497
- $[16] !== fromIndex || $[17] !== gap || $[18] !== itemHeight || $[19] !== onChange || $[20] !== scrollHeight || $[21] !== scrollTop || $[22] !== space || $[23] !== toIndex ? (t9 = () => {
1498
- onChange && onChange({
1499
- fromIndex,
1500
- gap: space[gap],
1501
- itemHeight,
1502
- scrollHeight,
1503
- scrollTop,
1504
- toIndex
1505
- });
1506
- }, t10 = [fromIndex, gap, itemHeight, onChange, scrollHeight, scrollTop, space, toIndex], $[16] = fromIndex, $[17] = gap, $[18] = itemHeight, $[19] = onChange, $[20] = scrollHeight, $[21] = scrollTop, $[22] = space, $[23] = toIndex, $[24] = t10, $[25] = t9) : (t10 = $[24], t9 = $[25]), useEffect(t9, t10);
1507
- let t11;
1508
- bb0: {
1509
- if (!renderItem || items.length === 0) {
1510
- t11 = null;
1511
- break bb0;
1512
- }
1513
- if (itemHeight === -1) {
1514
- let t123;
1515
- $[26] !== items[0] || $[27] !== renderItem ? (t123 = renderItem(items[0]), $[26] = items[0], $[27] = renderItem, $[28] = t123) : t123 = $[28];
1516
- let t132;
1517
- $[29] !== t123 ? (t132 = [/* @__PURE__ */ jsx(Box, { insetTop: 0, insetLeft: 0, position: "absolute", children: t123 }, 0)], $[29] = t123, $[30] = t132) : t132 = $[30], t11 = t132;
1518
- break bb0;
1519
- }
1520
- let t122;
1521
- if ($[31] !== fromIndex || $[32] !== gap || $[33] !== getItemKey || $[34] !== itemHeight || $[35] !== items || $[36] !== renderItem || $[37] !== space || $[38] !== toIndex) {
1522
- let t132;
1523
- $[40] !== fromIndex || $[41] !== gap || $[42] !== getItemKey || $[43] !== itemHeight || $[44] !== renderItem || $[45] !== space ? (t132 = (item, _itemIndex) => {
1524
- const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key2 = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
1525
- return /* @__PURE__ */ jsx(Box, { insetLeft: 0, position: "absolute", style: {
1526
- top: itemIndex * (itemHeight + space[gap])
1527
- }, children: node }, key2);
1528
- }, $[40] = fromIndex, $[41] = gap, $[42] = getItemKey, $[43] = itemHeight, $[44] = renderItem, $[45] = space, $[46] = t132) : t132 = $[46], t122 = items.slice(fromIndex, toIndex).map(t132), $[31] = fromIndex, $[32] = gap, $[33] = getItemKey, $[34] = itemHeight, $[35] = items, $[36] = renderItem, $[37] = space, $[38] = toIndex, $[39] = t122;
1529
- } else
1530
- t122 = $[39];
1531
- t11 = t122;
1532
- }
1533
- const children = t11;
1534
- let t12, t13;
1535
- $[47] !== height ? (t13 = {
1536
- height
1537
- }, $[47] = height, $[48] = t13) : t13 = $[48], t12 = t13;
1538
- const wrapperStyle = t12;
1539
- let t14;
1540
- $[49] !== children || $[50] !== wrapperStyle ? (t14 = /* @__PURE__ */ jsx("div", { ref: wrapperRef, style: wrapperStyle, children }), $[49] = children, $[50] = wrapperStyle, $[51] = t14) : t14 = $[51];
1541
- let t15;
1542
- return $[52] !== as || $[53] !== restProps || $[54] !== t14 ? (t15 = /* @__PURE__ */ jsx(Box, { as, "data-ui": "VirtualList", ...restProps, position: "relative", ref, children: t14 }), $[52] = as, $[53] = restProps, $[54] = t14, $[55] = t15) : t15 = $[55], t15;
1543
- });
1544
- VirtualList.displayName = "ForwardRef(VirtualList)";
1545
- function findScrollable(parentNode) {
1546
- let _scrollEl = parentNode;
1547
- for (; _scrollEl && !_isScrollable(_scrollEl); )
1548
- _scrollEl = _scrollEl.parentNode;
1549
- return _scrollEl;
1550
- }
1551
- const DEFAULT_POPOVER_DISTANCE = 4, DEFAULT_POPOVER_PADDING = 4, DEFAULT_POPOVER_ARROW_WIDTH = 19, DEFAULT_POPOVER_ARROW_HEIGHT = 8, DEFAULT_POPOVER_ARROW_RADIUS = 2, DEFAULT_POPOVER_MARGINS = [0, 0, 0, 0], DEFAULT_FALLBACK_PLACEMENTS$1 = {
1552
- top: ["bottom", "left", "right"],
1553
- "top-start": ["bottom-start", "left-start", "right-start"],
1554
- "top-end": ["bottom-end", "left-end", "right-end"],
1555
- bottom: ["top", "left", "right"],
1556
- "bottom-start": ["top-start", "left-start", "right-start"],
1557
- "bottom-end": ["top-end", "left-end", "right-end"],
1558
- left: ["right", "top", "bottom"],
1559
- "left-start": ["right-start", "top-start", "bottom-start"],
1560
- "left-end": ["right-end", "top-end", "bottom-end"],
1561
- right: ["left", "top", "bottom"],
1562
- "right-start": ["left-start", "top-start", "bottom-start"],
1563
- "right-end": ["left-end", "top-end", "bottom-end"]
1564
- };
1565
- function size(options) {
1566
- const {
1567
- apply,
1568
- margins,
1569
- padding = 0
1570
- } = options;
1571
- return {
1572
- name: "@sanity/ui/size",
1573
- async fn(args) {
1574
- const {
1575
- elements,
1576
- placement,
1577
- platform,
1578
- rects
1579
- } = args, {
1580
- floating,
1581
- reference
1582
- } = rects, overflow = await detectOverflow(args, {
1583
- altBoundary: !0,
1584
- boundary: options.boundaryElement || void 0,
1585
- elementContext: "floating",
1586
- padding,
1587
- rootBoundary: "viewport"
1588
- });
1589
- let maxWidth = 1 / 0, maxHeight = 1 / 0;
1590
- const floatingW = floating.width, floatingH = floating.height;
1591
- placement.includes("top") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.top), placement.includes("right") && (maxWidth = floatingW - overflow.right, maxHeight = floatingH - (overflow.top + overflow.bottom)), placement.includes("bottom") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.bottom), placement.includes("left") && (maxWidth = floatingW - overflow.left, maxHeight = floatingH - (overflow.top + overflow.bottom)), apply({
1592
- availableWidth: maxWidth - margins[1] - margins[3],
1593
- availableHeight: maxHeight - margins[0] - margins[2],
1594
- elements,
1595
- referenceWidth: reference.width - margins[1] - margins[3]
1596
- });
1597
- const nextDimensions = await platform.getDimensions(elements.floating), targetH = nextDimensions.height, targetW = nextDimensions.width;
1598
- return floatingW !== targetW || floatingH !== targetH ? {
1599
- reset: {
1600
- rects: !0
1601
- }
1602
- } : {};
1603
- }
1604
- };
1605
- }
1606
- function calcCurrentWidth(params) {
1607
- const {
1608
- container: container2,
1609
- mediaIndex,
1610
- width
1611
- } = params, w = width[mediaIndex], currentWidth = w === void 0 ? width[width.length - 1] : w;
1612
- return typeof currentWidth == "number" ? container2[currentWidth] : void 0;
1613
- }
1614
- function calcMaxWidth(params) {
1615
- const {
1616
- boundaryWidth,
1617
- currentWidth
1618
- } = params;
1619
- if (!(currentWidth === void 0 && boundaryWidth === void 0))
1620
- return Math.min(currentWidth ?? 1 / 0, (boundaryWidth || 1 / 0) - DEFAULT_POPOVER_PADDING * 2);
1621
- }
1622
- const MotionCard$1 = motion.create(Card), PopoverCard = memo(forwardRef(function(props, ref) {
1623
- const $ = c(66);
1624
- let animate, arrow2, arrowRef, arrowX, arrowY, children, marginsProp, originX, originY, overflow, padding, placement, radius, referenceWidth, restProps, scheme, shadow, strategy, style, tone, xProp, yProp;
1625
- $[0] !== props ? ({
1626
- __unstable_margins: marginsProp,
1627
- animate,
1628
- arrow: arrow2,
1629
- arrowRef,
1630
- arrowX,
1631
- arrowY,
1632
- children,
1633
- padding,
1634
- placement,
1635
- originX,
1636
- originY,
1637
- overflow,
1638
- radius,
1639
- referenceWidth,
1640
- scheme,
1641
- shadow,
1642
- strategy,
1643
- style,
1644
- tone,
1645
- x: xProp,
1646
- y: yProp,
1647
- ...restProps
1648
- } = props, $[0] = props, $[1] = animate, $[2] = arrow2, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = marginsProp, $[8] = originX, $[9] = originY, $[10] = overflow, $[11] = padding, $[12] = placement, $[13] = radius, $[14] = referenceWidth, $[15] = restProps, $[16] = scheme, $[17] = shadow, $[18] = strategy, $[19] = style, $[20] = tone, $[21] = xProp, $[22] = yProp) : (animate = $[1], arrow2 = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], marginsProp = $[7], originX = $[8], originY = $[9], overflow = $[10], padding = $[11], placement = $[12], radius = $[13], referenceWidth = $[14], restProps = $[15], scheme = $[16], shadow = $[17], strategy = $[18], style = $[19], tone = $[20], xProp = $[21], yProp = $[22]);
1649
- const {
1650
- zIndex
1651
- } = useLayer();
1652
- let t0;
1653
- t0 = marginsProp || DEFAULT_POPOVER_MARGINS;
1654
- const margins = t0, x = (xProp ?? 0) + margins[3], y = (yProp ?? 0) + margins[0];
1655
- let t1;
1656
- const t2 = animate ? "transform" : void 0;
1657
- let t3;
1658
- $[23] !== originX || $[24] !== originY || $[25] !== referenceWidth || $[26] !== strategy || $[27] !== style || $[28] !== t2 || $[29] !== x || $[30] !== y || $[31] !== zIndex ? (t3 = {
1659
- left: x,
1660
- originX,
1661
- originY,
1662
- position: strategy,
1663
- top: y,
1664
- width: referenceWidth,
1665
- zIndex,
1666
- willChange: t2,
1667
- ...style
1668
- }, $[23] = originX, $[24] = originY, $[25] = referenceWidth, $[26] = strategy, $[27] = style, $[28] = t2, $[29] = x, $[30] = y, $[31] = zIndex, $[32] = t3) : t3 = $[32], t1 = t3;
1669
- const rootStyle = t1;
1670
- let t4;
1671
- const t5 = arrowX !== null ? arrowX : void 0, t6 = arrowY !== null ? arrowY : void 0;
1672
- let t7;
1673
- $[33] !== t5 || $[34] !== t6 ? (t7 = {
1674
- left: t5,
1675
- top: t6,
1676
- right: void 0,
1677
- bottom: void 0
1678
- }, $[33] = t5, $[34] = t6, $[35] = t7) : t7 = $[35], t4 = t7;
1679
- const arrowStyle = t4, t8 = restProps;
1680
- let t9;
1681
- $[36] !== animate ? (t9 = animate ? ["hidden", "initial"] : void 0, $[36] = animate, $[37] = t9) : t9 = $[37];
1682
- let t10;
1683
- $[38] !== animate ? (t10 = animate ? ["visible", "scaleIn"] : void 0, $[38] = animate, $[39] = t10) : t10 = $[39];
1684
- let t11;
1685
- $[40] !== animate ? (t11 = animate ? ["hidden", "scaleOut"] : void 0, $[40] = animate, $[41] = t11) : t11 = $[41];
1686
- let t12;
1687
- $[42] !== children || $[43] !== padding ? (t12 = /* @__PURE__ */ jsx(Flex, { direction: "column", flex: 1, padding, children }), $[42] = children, $[43] = padding, $[44] = t12) : t12 = $[44];
1688
- let t13;
1689
- $[45] !== overflow || $[46] !== t12 ? (t13 = /* @__PURE__ */ jsx(Flex, { "data-ui": "Popover__wrapper", direction: "column", flex: 1, overflow, children: t12 }), $[45] = overflow, $[46] = t12, $[47] = t13) : t13 = $[47];
1690
- let t14;
1691
- $[48] !== arrow2 || $[49] !== arrowRef || $[50] !== arrowStyle ? (t14 = arrow2 && /* @__PURE__ */ jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_POPOVER_ARROW_WIDTH, height: DEFAULT_POPOVER_ARROW_HEIGHT, radius: DEFAULT_POPOVER_ARROW_RADIUS }), $[48] = arrow2, $[49] = arrowRef, $[50] = arrowStyle, $[51] = t14) : t14 = $[51];
1692
- let t15;
1693
- return $[52] !== placement || $[53] !== radius || $[54] !== ref || $[55] !== rootStyle || $[56] !== scheme || $[57] !== shadow || $[58] !== t10 || $[59] !== t11 || $[60] !== t13 || $[61] !== t14 || $[62] !== t8 || $[63] !== t9 || $[64] !== tone ? (t15 = /* @__PURE__ */ jsxs(MotionCard$1, { className: "popover-card", "data-ui": "Popover", ...t8, "data-placement": placement, direction: "column", display: "flex", radius, ref, scheme, shadow, sizing: "border", style: rootStyle, tone, variants: POPOVER_MOTION_PROPS.card, transition: POPOVER_MOTION_PROPS.transition, initial: t9, animate: t10, exit: t11, children: [
1694
- t13,
1695
- t14
1696
- ] }), $[52] = placement, $[53] = radius, $[54] = ref, $[55] = rootStyle, $[56] = scheme, $[57] = shadow, $[58] = t10, $[59] = t11, $[60] = t13, $[61] = t14, $[62] = t8, $[63] = t9, $[64] = tone, $[65] = t15) : t15 = $[65], t15;
1697
- }));
1698
- PopoverCard.displayName = "Memo(ForwardRef(PopoverCard))";
1699
- const ViewportOverlay = () => {
1700
- const $ = c(2), {
1701
- zIndex
1702
- } = useLayer();
1703
- let t0;
1704
- return $[0] !== zIndex ? (t0 = /* @__PURE__ */ jsx("div", { style: {
1705
- height: "100vh",
1706
- inset: 0,
1707
- position: "fixed",
1708
- width: "100vw",
1709
- zIndex
1710
- } }), $[0] = zIndex, $[1] = t0) : t0 = $[1], t0;
1711
- }, Popover = memo(forwardRef(function(props, forwardedRef) {
1712
- const {
1713
- container: container2,
1714
- layer
1715
- } = useTheme_v2(), boundaryElementContext = useBoundaryElement(), {
1716
- __unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
1717
- animate: _animate = !1,
1718
- arrow: arrowProp = !1,
1719
- boundaryElement = boundaryElementContext.element,
1720
- children: childProp,
1721
- constrainSize = !1,
1722
- content,
1723
- disabled,
1724
- fallbackPlacements = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"],
1725
- matchReferenceWidth,
1726
- floatingBoundary = props.boundaryElement ?? boundaryElementContext.element,
1727
- modal,
1728
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1729
- onActivate,
1730
- open,
1731
- overflow = "hidden",
1732
- padding,
1733
- placement: placementProp = "bottom",
1734
- portal,
1735
- preventOverflow = !0,
1736
- radius = 3,
1737
- referenceBoundary = props.boundaryElement ?? boundaryElementContext.element,
1738
- referenceElement,
1739
- scheme,
1740
- shadow = 3,
1741
- tone = "inherit",
1742
- width: widthProp = "auto",
1743
- zOffset: zOffsetProp = layer.popover.zOffset,
1744
- updateRef,
1745
- ...restProps
1746
- } = props, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = useElementSize(boundaryElement)?.border, widthArrayProp = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), ref = useRef(null), arrowRef = useRef(null), rootBoundary = "viewport";
1747
- useImperativeHandle(forwardedRef, () => ref.current);
1748
- const mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0, width = calcCurrentWidth({
1749
- container: container2,
1750
- mediaIndex,
1751
- width: widthArrayProp
1752
- }), widthRef = useRef(width);
1753
- useEffect(() => {
1754
- widthRef.current = width;
1755
- }, [width]);
1756
- const maxWidth = calcMaxWidth({
1757
- boundaryWidth,
1758
- currentWidth: width
1759
- }), maxWidthRef = useRef(maxWidth);
1760
- useEffect(() => {
1761
- maxWidthRef.current = maxWidth;
1762
- }, [maxWidth]);
1763
- const referenceWidthRef = useRef(void 0);
1764
- useEffect(() => {
1765
- const floatingElement = ref.current;
1766
- if (!open || !floatingElement) return;
1767
- const referenceWidth = referenceWidthRef.current;
1768
- matchReferenceWidth ? referenceWidth !== void 0 && (floatingElement.style.width = `${referenceWidth}px`) : width !== void 0 && (floatingElement.style.width = `${width}px`), typeof maxWidth == "number" && (floatingElement.style.maxWidth = `${maxWidth}px`);
1769
- }, [width, matchReferenceWidth, maxWidth, open]);
1770
- const middleware = useMemo(() => {
1771
- const ret = [];
1772
- return (constrainSize || preventOverflow) && ret.push(flip({
1773
- boundary: floatingBoundary || void 0,
1774
- fallbackPlacements,
1775
- padding: DEFAULT_POPOVER_PADDING,
1776
- rootBoundary
1777
- })), ret.push(offset({
1778
- mainAxis: DEFAULT_POPOVER_DISTANCE
1779
- })), (constrainSize || matchReferenceWidth) && ret.push(size({
1780
- apply({
1781
- availableWidth,
1782
- availableHeight,
1783
- elements,
1784
- referenceWidth: referenceWidth_0
1785
- }) {
1786
- referenceWidthRef.current = referenceWidth_0;
1787
- const _currentWidth = widthRef.current, _maxWidth = maxWidthRef.current;
1788
- matchReferenceWidth ? elements.floating.style.width = `${referenceWidth_0}px` : _currentWidth !== void 0 && (elements.floating.style.width = `${_currentWidth}px`), constrainSize && (elements.floating.style.maxWidth = `${Math.min(availableWidth, _maxWidth ?? 1 / 0)}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
1789
- },
1790
- boundaryElement: floatingBoundary || void 0,
1791
- margins,
1792
- padding: DEFAULT_POPOVER_PADDING
1793
- })), preventOverflow && ret.push(shift({
1794
- boundary: floatingBoundary || void 0,
1795
- rootBoundary,
1796
- padding: DEFAULT_POPOVER_PADDING
1797
- })), arrowProp && ret.push(arrow({
1798
- element: arrowRef,
1799
- padding: DEFAULT_POPOVER_PADDING
1800
- })), animate && ret.push(origin), ret.push(hide({
1801
- boundary: referenceBoundary || void 0,
1802
- padding: DEFAULT_POPOVER_PADDING,
1803
- strategy: "referenceHidden"
1804
- })), ret;
1805
- }, [animate, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
1806
- x,
1807
- y,
1808
- middlewareData,
1809
- placement,
1810
- refs,
1811
- strategy,
1812
- update
1813
- } = useFloating({
1814
- middleware,
1815
- placement: placementProp,
1816
- whileElementsMounted: autoUpdate,
1817
- elements: referenceElement ? {
1818
- reference: referenceElement
1819
- } : void 0
1820
- }), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, setArrow = useCallback((arrowEl) => {
1821
- arrowRef.current = arrowEl;
1822
- }, []), setFloating = useCallback((node) => {
1823
- ref.current = node, refs.setFloating(node);
1824
- }, [refs]), setReference = useCallback((node_0) => {
1825
- refs.setReference(node_0);
1826
- const childRef = getElementRef$1(childProp);
1827
- typeof childRef == "function" ? childRef(node_0) : childRef && (childRef.current = node_0);
1828
- }, [childProp, refs]), child = useMemo(() => referenceElement ? childProp : childProp ? cloneElement(childProp, {
1829
- ref: setReference
1830
- }) : null, [childProp, referenceElement, setReference]);
1831
- if (useEffect(() => {
1832
- updateRef && (typeof updateRef == "function" ? updateRef(update) : updateRef && (updateRef.current = update));
1833
- }, [update, updateRef]), disabled)
1834
- return childProp || /* @__PURE__ */ jsx(Fragment, {});
1835
- const popover = /* @__PURE__ */ jsxs(LayerProvider, { zOffset, children: [
1836
- modal && /* @__PURE__ */ jsx(ViewportOverlay, {}),
1837
- /* @__PURE__ */ jsx(PopoverCard, { ...restProps, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, hidden: referenceHidden, overflow, padding, placement, radius, ref: setFloating, referenceWidth: matchReferenceWidth ? referenceWidthRef.current : width, scheme, shadow, originX, originY, strategy, tone, x, y, children: content })
1838
- ] }), children = open && (portal ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: popover }) : popover);
1839
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1840
- animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
1841
- child
1842
- ] });
1843
- }));
1844
- Popover.displayName = "Memo(ForwardRef(Popover))";
1845
- function getElementRef$1(element) {
1846
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1847
- return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
1848
- }
1849
- const Radio = forwardRef(function(props, forwardedRef) {
1850
- const $ = c(21);
1851
- let className, customValidity, disabled, readOnly, restProps, style;
1852
- $[0] !== props ? ({
1853
- className,
1854
- disabled,
1855
- style,
1856
- customValidity,
1857
- readOnly,
1858
- ...restProps
1859
- } = props, $[0] = props, $[1] = className, $[2] = customValidity, $[3] = disabled, $[4] = readOnly, $[5] = restProps, $[6] = style) : (className = $[1], customValidity = $[2], disabled = $[3], readOnly = $[4], restProps = $[5], style = $[6]);
1860
- const ref = useRef(null);
1861
- let t0;
1862
- $[7] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => ref.current, $[7] = t0) : t0 = $[7], useImperativeHandle(forwardedRef, t0), useCustomValidity(ref, customValidity);
1863
- let t1;
1864
- $[8] !== className ? (t1 = composeClassNames(className, radio()), $[8] = className, $[9] = t1) : t1 = $[9];
1865
- const t2 = !disabled && readOnly ? "" : void 0, t3 = customValidity ? "" : void 0, t4 = disabled || readOnly;
1866
- let t5;
1867
- $[10] !== readOnly || $[11] !== restProps || $[12] !== t2 || $[13] !== t3 || $[14] !== t4 ? (t5 = /* @__PURE__ */ jsx("input", { "data-read-only": t2, "data-error": t3, ...restProps, disabled: t4, readOnly, ref, type: "radio" }), $[10] = readOnly, $[11] = restProps, $[12] = t2, $[13] = t3, $[14] = t4, $[15] = t5) : t5 = $[15];
1868
- let t6;
1869
- $[16] === Symbol.for("react.memo_cache_sentinel") ? (t6 = /* @__PURE__ */ jsx("span", {}), $[16] = t6) : t6 = $[16];
1870
- let t7;
1871
- return $[17] !== style || $[18] !== t1 || $[19] !== t5 ? (t7 = /* @__PURE__ */ jsxs("div", { className: t1, "data-ui": "Radio", style, children: [
1872
- t5,
1873
- t6
1874
- ] }), $[17] = style, $[18] = t1, $[19] = t5, $[20] = t7) : t7 = $[20], t7;
1875
- });
1876
- Radio.displayName = "ForwardRef(Radio)";
1877
- const Select = forwardRef(function(props, forwardedRef) {
1878
- const $ = c(36);
1879
- let children, customValidity, disabled, gap, readOnly, restProps, t0, t1, t2, t3, t4;
1880
- $[0] !== props ? ({
1881
- border: t0,
1882
- children,
1883
- customValidity,
1884
- disabled,
1885
- fontSize: t1,
1886
- gap,
1887
- padding: t2,
1888
- radius: t3,
1889
- readOnly,
1890
- space: t4,
1891
- ...restProps
1892
- } = props, $[0] = props, $[1] = children, $[2] = customValidity, $[3] = disabled, $[4] = gap, $[5] = readOnly, $[6] = restProps, $[7] = t0, $[8] = t1, $[9] = t2, $[10] = t3, $[11] = t4) : (children = $[1], customValidity = $[2], disabled = $[3], gap = $[4], readOnly = $[5], restProps = $[6], t0 = $[7], t1 = $[8], t2 = $[9], t3 = $[10], t4 = $[11]);
1893
- const border = t0 === void 0 ? !0 : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 2 : t2, radius = t3 === void 0 ? 2 : t3, space = t4 === void 0 ? 2 : t4, ref = useRef(null);
1894
- let t5;
1895
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[12] = t5) : t5 = $[12], useImperativeHandle(forwardedRef, t5), useCustomValidity(ref, customValidity);
1896
- const t6 = gap ?? space;
1897
- let t7;
1898
- $[13] !== border || $[14] !== fontSize || $[15] !== padding || $[16] !== radius || $[17] !== t6 ? (t7 = select({
1899
- border,
1900
- fontSize,
1901
- padding,
1902
- radius,
1903
- gap: t6
1904
- }), $[13] = border, $[14] = fontSize, $[15] = padding, $[16] = radius, $[17] = t6, $[18] = t7) : t7 = $[18];
1905
- const t8 = !disabled && readOnly ? "" : void 0;
1906
- let t9;
1907
- $[19] === Symbol.for("react.memo_cache_sentinel") ? (t9 = _inputElement(), $[19] = t9) : t9 = $[19];
1908
- const t10 = disabled || readOnly;
1909
- let t11;
1910
- $[20] !== children || $[21] !== restProps || $[22] !== t10 || $[23] !== t8 ? (t11 = /* @__PURE__ */ jsx("select", { "data-read-only": t8, ...restProps, className: t9, disabled: t10, ref, children }), $[20] = children, $[21] = restProps, $[22] = t10, $[23] = t8, $[24] = t11) : t11 = $[24];
1911
- let t12;
1912
- $[25] === Symbol.for("react.memo_cache_sentinel") ? (t12 = selectPresentation(), $[25] = t12) : t12 = $[25];
1913
- let t13;
1914
- $[26] === Symbol.for("react.memo_cache_sentinel") ? (t13 = /* @__PURE__ */ jsx(ChevronDownIcon, {}), $[26] = t13) : t13 = $[26];
1915
- let t14;
1916
- $[27] !== fontSize ? (t14 = /* @__PURE__ */ jsx(Text, { size: fontSize, children: t13 }), $[27] = fontSize, $[28] = t14) : t14 = $[28];
1917
- let t15;
1918
- $[29] !== padding || $[30] !== t14 ? (t15 = /* @__PURE__ */ jsx("span", { className: t12, children: /* @__PURE__ */ jsx(Box, { as: "span", display: "inline-block", padding, children: t14 }) }), $[29] = padding, $[30] = t14, $[31] = t15) : t15 = $[31];
1919
- let t16;
1920
- return $[32] !== t11 || $[33] !== t15 || $[34] !== t7 ? (t16 = /* @__PURE__ */ jsxs("div", { "data-ui": "Select", className: t7, "data-icon-right": "", children: [
1921
- t11,
1922
- t15
1923
- ] }), $[32] = t11, $[33] = t15, $[34] = t7, $[35] = t16) : t16 = $[35], t16;
1924
- });
1925
- Select.displayName = "ForwardRef(Select)";
1926
- const Stack = forwardRef(function(props, ref) {
1927
- const $ = c(10);
1928
- let as, gap, restProps, space;
1929
- $[0] !== props ? ({
1930
- as,
1931
- gap,
1932
- space,
1933
- ...restProps
1934
- } = props, $[0] = props, $[1] = as, $[2] = gap, $[3] = restProps, $[4] = space) : (as = $[1], gap = $[2], restProps = $[3], space = $[4]);
1935
- const t0 = gap ?? space;
1936
- let t1;
1937
- return $[5] !== as || $[6] !== ref || $[7] !== restProps || $[8] !== t0 ? (t1 = /* @__PURE__ */ jsx(Box, { "data-ui": "Stack", ...restProps, as, direction: "column", display: "flex", gap: t0, ref }), $[5] = as, $[6] = ref, $[7] = restProps, $[8] = t0, $[9] = t1) : t1 = $[9], t1;
1938
- });
1939
- Stack.displayName = "ForwardRef(Stack)";
1940
- const Switch = forwardRef(function(props, forwardedRef) {
1941
- const $ = c(28);
1942
- let checked, className, disabled, indeterminate, readOnly, restProps, style;
1943
- $[0] !== props ? ({
1944
- checked,
1945
- className,
1946
- disabled,
1947
- indeterminate,
1948
- readOnly,
1949
- style,
1950
- ...restProps
1951
- } = props, $[0] = props, $[1] = checked, $[2] = className, $[3] = disabled, $[4] = indeterminate, $[5] = readOnly, $[6] = restProps, $[7] = style) : (checked = $[1], className = $[2], disabled = $[3], indeterminate = $[4], readOnly = $[5], restProps = $[6], style = $[7]);
1952
- const ref = useRef(null);
1953
- let t0;
1954
- $[8] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => ref.current, $[8] = t0) : t0 = $[8], useImperativeHandle(forwardedRef, t0);
1955
- let t1, t2;
1956
- $[9] !== indeterminate ? (t1 = () => {
1957
- ref.current && (ref.current.indeterminate = indeterminate || !1);
1958
- }, t2 = [indeterminate], $[9] = indeterminate, $[10] = t1, $[11] = t2) : (t1 = $[10], t2 = $[11]), useEffect(t1, t2);
1959
- let t3;
1960
- $[12] !== className ? (t3 = composeClassNames(className, _switch()), $[12] = className, $[13] = t3) : t3 = $[13];
1961
- const t4 = checked ? "" : void 0, t5 = indeterminate ? "" : void 0, t6 = indeterminate !== !0 && checked;
1962
- let t7;
1963
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t7 = _switchElement(), $[14] = t7) : t7 = $[14];
1964
- const t8 = disabled ? "" : void 0, t9 = !disabled && readOnly ? "" : void 0, t10 = disabled || readOnly;
1965
- let t11;
1966
- $[15] !== restProps || $[16] !== t10 || $[17] !== t6 || $[18] !== t8 || $[19] !== t9 ? (t11 = /* @__PURE__ */ jsx("input", { ...restProps, checked: t6, className: t7, "data-disabled": t8, "data-read-only": t9, disabled: t10, type: "checkbox", ref }), $[15] = restProps, $[16] = t10, $[17] = t6, $[18] = t8, $[19] = t9, $[20] = t11) : t11 = $[20];
1967
- let t12;
1968
- $[21] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsxs("span", { "aria-hidden": !0, className: _switchPresentation(), children: [
1969
- /* @__PURE__ */ jsx("span", { className: _switchTrack() }),
1970
- /* @__PURE__ */ jsx("span", { className: _switchThumb() })
1971
- ] }), $[21] = t12) : t12 = $[21];
1972
- let t13;
1973
- return $[22] !== style || $[23] !== t11 || $[24] !== t3 || $[25] !== t4 || $[26] !== t5 ? (t13 = /* @__PURE__ */ jsxs(Box, { className: t3, "data-checked": t4, "data-indeterminate": t5, "data-ui": "Switch", display: "inline-block", position: "relative", style, children: [
1974
- t11,
1975
- t12
1976
- ] }), $[22] = style, $[23] = t11, $[24] = t3, $[25] = t4, $[26] = t5, $[27] = t13) : t13 = $[27], t13;
1977
- });
1978
- Switch.displayName = "ForwardRef(Switch)";
1979
- const TextArea = forwardRef(function(props, forwardedRef) {
1980
- const $ = c(25);
1981
- let customValidity, gap, restProps, t0, t1, t2, t3, t4, t5;
1982
- $[0] !== props ? ({
1983
- border: t0,
1984
- customValidity,
1985
- disabled: t1,
1986
- fontSize: t2,
1987
- gap,
1988
- padding: t3,
1989
- radius: t4,
1990
- space: t5,
1991
- ...restProps
1992
- } = props, $[0] = props, $[1] = customValidity, $[2] = gap, $[3] = restProps, $[4] = t0, $[5] = t1, $[6] = t2, $[7] = t3, $[8] = t4, $[9] = t5) : (customValidity = $[1], gap = $[2], restProps = $[3], t0 = $[4], t1 = $[5], t2 = $[6], t3 = $[7], t4 = $[8], t5 = $[9]);
1993
- const border = t0 === void 0 ? !0 : t0, disabled = t1 === void 0 ? !1 : t1, fontSize = t2 === void 0 ? 2 : t2, padding = t3 === void 0 ? 3 : t3, radius = t4 === void 0 ? 2 : t4, space = t5 === void 0 ? 3 : t5, ref = useRef(null);
1994
- let t6;
1995
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[10] = t6) : t6 = $[10], useImperativeHandle(forwardedRef, t6), useCustomValidity(ref, customValidity);
1996
- const t7 = gap ?? space;
1997
- let t8;
1998
- $[11] !== border || $[12] !== fontSize || $[13] !== padding || $[14] !== radius || $[15] !== t7 ? (t8 = textArea({
1999
- border,
2000
- fontSize,
2001
- padding,
2002
- radius,
2003
- gap: t7
2004
- }), $[11] = border, $[12] = fontSize, $[13] = padding, $[14] = radius, $[15] = t7, $[16] = t8) : t8 = $[16];
2005
- let t9;
2006
- $[17] === Symbol.for("react.memo_cache_sentinel") ? (t9 = _inputElement(), $[17] = t9) : t9 = $[17];
2007
- let t10;
2008
- $[18] !== disabled || $[19] !== restProps ? (t10 = /* @__PURE__ */ jsx("textarea", { ...restProps, className: t9, disabled, ref }), $[18] = disabled, $[19] = restProps, $[20] = t10) : t10 = $[20];
2009
- let t11;
2010
- $[21] === Symbol.for("react.memo_cache_sentinel") ? (t11 = /* @__PURE__ */ jsx("span", { className: _inputPresentation() }), $[21] = t11) : t11 = $[21];
2011
- let t12;
2012
- return $[22] !== t10 || $[23] !== t8 ? (t12 = /* @__PURE__ */ jsxs("span", { className: t8, "data-ui": "TextArea", children: [
2013
- t10,
2014
- t11
2015
- ] }), $[22] = t10, $[23] = t8, $[24] = t12) : t12 = $[24], t12;
2016
- });
2017
- TextArea.displayName = "ForwardRef(TextArea)";
2018
- const CLEAR_BUTTON_BOX_STYLE = {
2019
- backgroundColor: "transparent",
2020
- top: 0,
2021
- right: 0,
2022
- zIndex: 2
2023
- }, TextInput = forwardRef(function(props, forwardedRef) {
2024
- const $ = c(83);
2025
- let IconComponent, IconRightComponent, __unstable_disableFocusRing, className, clearButton, customValidity, gap, onClear, prefix, readOnly, restProps, suffix, t0, t1, t2, t3, t4, t5, t6, width;
2026
- if ($[0] !== props) {
2027
- const {
2028
- __unstable_disableFocusRing: t72,
2029
- border: t82,
2030
- className: t92,
2031
- clearButton: t102,
2032
- disabled: t112,
2033
- fontSize: t122,
2034
- gap: t132,
2035
- icon: t142,
2036
- iconRight: t152,
2037
- onClear: t162,
2038
- padding: t172,
2039
- prefix: t182,
2040
- radius: t192,
2041
- readOnly: t202,
2042
- space: t212,
2043
- suffix: t222,
2044
- customValidity: t232,
2045
- type: t242,
2046
- weight: _width,
2047
- width: t252,
2048
- ...t262
2049
- } = props;
2050
- __unstable_disableFocusRing = t72, t0 = t82, className = t92, clearButton = t102, t1 = t112, t2 = t122, gap = t132, IconComponent = t142, IconRightComponent = t152, onClear = t162, t3 = t172, prefix = t182, t4 = t192, readOnly = t202, t5 = t212, suffix = t222, customValidity = t232, t6 = t242, width = t252, restProps = t262, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = __unstable_disableFocusRing, $[4] = className, $[5] = clearButton, $[6] = customValidity, $[7] = gap, $[8] = onClear, $[9] = prefix, $[10] = readOnly, $[11] = restProps, $[12] = suffix, $[13] = t0, $[14] = t1, $[15] = t2, $[16] = t3, $[17] = t4, $[18] = t5, $[19] = t6, $[20] = width;
2051
- } else
2052
- IconComponent = $[1], IconRightComponent = $[2], __unstable_disableFocusRing = $[3], className = $[4], clearButton = $[5], customValidity = $[6], gap = $[7], onClear = $[8], prefix = $[9], readOnly = $[10], restProps = $[11], suffix = $[12], t0 = $[13], t1 = $[14], t2 = $[15], t3 = $[16], t4 = $[17], t5 = $[18], t6 = $[19], width = $[20];
2053
- const border = t0 === void 0 ? !0 : t0, disabled = t1 === void 0 ? !1 : t1, fontSize = t2 === void 0 ? 1 : t2, padding = t3 === void 0 ? 3 : t3, radius = t4 === void 0 ? 2 : t4, space = t5 === void 0 ? 3 : t5, type = t6 === void 0 ? "text" : t6, ref = useRef(null), paddingArray = useArrayProp(padding), withClearButton = !!clearButton;
2054
- let t7;
2055
- $[21] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[21] = t7) : t7 = $[21], useImperativeHandle(forwardedRef, t7), useCustomValidity(ref, customValidity);
2056
- const handleClearMouseDown = _temp;
2057
- let t8;
2058
- $[22] !== onClear ? (t8 = (event_0) => {
2059
- event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
2060
- }, $[22] = onClear, $[23] = t8) : t8 = $[23];
2061
- const handleClearClick = t8;
2062
- let t9, t10;
2063
- $[24] !== paddingArray ? (t10 = paddingArray.map(_temp2), $[24] = paddingArray, $[25] = t10) : t10 = $[25], t9 = t10;
2064
- const clearButtonBoxPadding = t9;
2065
- let t11, t12;
2066
- $[26] !== paddingArray ? (t12 = paddingArray.map(_temp3), $[26] = paddingArray, $[27] = t12) : t12 = $[27], t11 = t12;
2067
- const clearButtonPadding = t11;
2068
- let t13;
2069
- t13 = isRecord(clearButton) ? clearButton : EMPTY_RECORD;
2070
- const clearButtonProps = t13, t14 = gap ?? space;
2071
- let t15;
2072
- $[28] !== border || $[29] !== className || $[30] !== fontSize || $[31] !== padding || $[32] !== radius || $[33] !== t14 || $[34] !== width ? (t15 = composeClassNames(className, textInput({
2073
- border,
2074
- fontSize,
2075
- padding,
2076
- radius,
2077
- gap: t14,
2078
- width
2079
- })), $[28] = border, $[29] = className, $[30] = fontSize, $[31] = padding, $[32] = radius, $[33] = t14, $[34] = width, $[35] = t15) : t15 = $[35];
2080
- const t16 = IconComponent ? "" : void 0, t17 = IconRightComponent ? "" : void 0, t18 = prefix ? "" : void 0, t19 = suffix ? "" : void 0;
2081
- let t20;
2082
- $[36] !== prefix ? (t20 = prefix && /* @__PURE__ */ jsx(Box, { as: "span", className: "text-input-prefix", sizing: "border", children: /* @__PURE__ */ jsx("span", { children: prefix }) }), $[36] = prefix, $[37] = t20) : t20 = $[37];
2083
- let t21;
2084
- $[38] === Symbol.for("react.memo_cache_sentinel") ? (t21 = _inputElement(), $[38] = t21) : t21 = $[38];
2085
- let t22;
2086
- $[39] !== disabled || $[40] !== readOnly || $[41] !== restProps || $[42] !== type ? (t22 = /* @__PURE__ */ jsx("input", { ...restProps, className: t21, disabled, readOnly, ref, type }), $[39] = disabled, $[40] = readOnly, $[41] = restProps, $[42] = type, $[43] = t22) : t22 = $[43];
2087
- let t23;
2088
- $[44] === Symbol.for("react.memo_cache_sentinel") ? (t23 = _inputPresentation(), $[44] = t23) : t23 = $[44];
2089
- const t24 = __unstable_disableFocusRing ? "" : void 0;
2090
- let t25;
2091
- $[45] !== IconComponent || $[46] !== fontSize || $[47] !== padding ? (t25 = IconComponent && /* @__PURE__ */ jsx(Box, { as: "span", padding, position: "absolute", style: {
2092
- top: 0,
2093
- left: 0
2094
- }, children: /* @__PURE__ */ jsxs(Text, { size: fontSize, children: [
2095
- isValidElement(IconComponent) && IconComponent,
2096
- isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
2097
- ] }) }), $[45] = IconComponent, $[46] = fontSize, $[47] = padding, $[48] = t25) : t25 = $[48];
2098
- let t26;
2099
- $[49] !== IconRightComponent || $[50] !== fontSize || $[51] !== padding || $[52] !== withClearButton ? (t26 = !withClearButton && IconRightComponent && /* @__PURE__ */ jsx(Box, { as: "span", padding, position: "absolute", style: {
2100
- top: 0,
2101
- right: 0
2102
- }, children: /* @__PURE__ */ jsxs(Text, { size: fontSize, children: [
2103
- isValidElement(IconRightComponent) && IconRightComponent,
2104
- isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
2105
- ] }) }), $[49] = IconRightComponent, $[50] = fontSize, $[51] = padding, $[52] = withClearButton, $[53] = t26) : t26 = $[53];
2106
- let t27;
2107
- $[54] !== t24 || $[55] !== t25 || $[56] !== t26 ? (t27 = /* @__PURE__ */ jsxs(Box, { as: "span", className: t23, "data-disable-focus-ring": t24, position: "absolute", children: [
2108
- t25,
2109
- t26
2110
- ] }), $[54] = t24, $[55] = t25, $[56] = t26, $[57] = t27) : t27 = $[57];
2111
- let t28;
2112
- $[58] !== clearButton || $[59] !== clearButtonBoxPadding || $[60] !== clearButtonPadding || $[61] !== clearButtonProps || $[62] !== disabled || $[63] !== fontSize || $[64] !== handleClearClick || $[65] !== radius || $[66] !== readOnly ? (t28 = !disabled && !readOnly && clearButton && /* @__PURE__ */ jsx(Box, { as: "span", padding: clearButtonBoxPadding, position: "absolute", style: CLEAR_BUTTON_BOX_STYLE, children: /* @__PURE__ */ jsx(Button, { "aria-label": "Clear", "data-qa": "clear-button", display: "block", fontSize, icon: CloseIcon, mode: "bleed", padding: clearButtonPadding, radius, ...clearButtonProps, onClick: handleClearClick, onMouseDown: handleClearMouseDown }) }), $[58] = clearButton, $[59] = clearButtonBoxPadding, $[60] = clearButtonPadding, $[61] = clearButtonProps, $[62] = disabled, $[63] = fontSize, $[64] = handleClearClick, $[65] = radius, $[66] = readOnly, $[67] = t28) : t28 = $[67];
2113
- let t29;
2114
- $[68] !== t22 || $[69] !== t27 || $[70] !== t28 ? (t29 = /* @__PURE__ */ jsxs(Box, { as: "span", flex: 1, position: "relative", children: [
2115
- t22,
2116
- t27,
2117
- t28
2118
- ] }), $[68] = t22, $[69] = t27, $[70] = t28, $[71] = t29) : t29 = $[71];
2119
- let t30;
2120
- $[72] !== suffix ? (t30 = suffix && /* @__PURE__ */ jsx(Box, { as: "span", className: "text-input-suffix", sizing: "border", children: /* @__PURE__ */ jsx("span", { children: suffix }) }), $[72] = suffix, $[73] = t30) : t30 = $[73];
2121
- let t31;
2122
- return $[74] !== t15 || $[75] !== t16 || $[76] !== t17 || $[77] !== t18 || $[78] !== t19 || $[79] !== t20 || $[80] !== t29 || $[81] !== t30 ? (t31 = /* @__PURE__ */ jsxs(Box, { align: "center", as: "span", className: t15, "data-icon-left": t16, "data-icon-right": t17, "data-prefix": t18, "data-suffix": t19, "data-ui": "TextInput", display: "flex", children: [
2123
- t20,
2124
- t29,
2125
- t30
2126
- ] }), $[74] = t15, $[75] = t16, $[76] = t17, $[77] = t18, $[78] = t19, $[79] = t20, $[80] = t29, $[81] = t30, $[82] = t31) : t31 = $[82], t31;
2127
- });
2128
- TextInput.displayName = "ForwardRef(TextInput)";
2129
- function _temp(event) {
2130
- event.preventDefault(), event.stopPropagation();
2131
- }
2132
- function _temp2(v) {
2133
- return v === 0 ? 0 : v === 1 || v === 2 ? 1 : typeof v == "number" ? v - 2 : 0;
2134
- }
2135
- function _temp3(v_0) {
2136
- return v_0 === 0 || v_0 === 1 ? 0 : v_0 === 2 ? 1 : typeof v_0 == "number" ? v_0 - 1 : 0;
2137
- }
2138
- function useDelayedState(initialState) {
2139
- const $ = c(3), [state, setState] = useState(initialState), delayedAction = useRef(void 0);
2140
- let t0;
2141
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (nextState, delay) => {
2142
- const action = () => {
2143
- setState(nextState);
2144
- };
2145
- if (delayedAction.current && (clearTimeout(delayedAction.current), delayedAction.current = void 0), !delay)
2146
- return action();
2147
- delayedAction.current = setTimeout(action, delay);
2148
- }, $[0] = t0) : t0 = $[0];
2149
- const onStateChange = t0;
2150
- let t1;
2151
- return $[1] !== state ? (t1 = [state, onStateChange], $[1] = state, $[2] = t1) : t1 = $[2], t1;
2152
- }
2153
- function getElementRef(element) {
2154
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
2155
- return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
2156
- }
2157
- const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAULT_TOOLTIP_ARROW_RADIUS = 2, DEFAULT_TOOLTIP_DISTANCE = 4, DEFAULT_TOOLTIP_PADDING = 4, DEFAULT_FALLBACK_PLACEMENTS = {
2158
- top: ["top-end", "top-start", "bottom", "left", "right"],
2159
- "top-start": ["top", "top-end", "bottom-start", "left-start", "right-start"],
2160
- "top-end": ["top", "top-start", "bottom-end", "left-end", "right-end"],
2161
- bottom: ["bottom-end", "bottom-start", "top", "left", "right"],
2162
- "bottom-start": ["bottom", "bottom-end", "top-start", "left-start", "right-start"],
2163
- "bottom-end": ["bottom", "bottom-start", "top-end", "left-end", "right-end"],
2164
- left: ["left-end", "left-start", "right", "top", "bottom"],
2165
- "left-start": ["left", "left-end", "right-start", "top-start", "bottom-start"],
2166
- "left-end": ["left", "left-start", "right-end", "top-end", "bottom-end"],
2167
- right: ["right-end", "right-start", "left", "top", "bottom"],
2168
- "right-start": ["right", "right-end", "left-start", "top-start", "bottom-start"],
2169
- "right-end": ["right", "right-start", "left-end", "top-end", "bottom-end"]
2170
- }, MotionCard = motion.create(Card), TooltipCard = memo(forwardRef(function(props, ref) {
2171
- const $ = c(52);
2172
- let animate, arrow2, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, restProps, scheme, shadow, style, tone;
2173
- $[0] !== props ? ({
2174
- animate,
2175
- arrow: arrow2,
2176
- arrowRef,
2177
- arrowX,
2178
- arrowY,
2179
- children,
2180
- originX,
2181
- originY,
2182
- padding,
2183
- placement,
2184
- radius,
2185
- scheme,
2186
- shadow,
2187
- style,
2188
- tone,
2189
- ...restProps
2190
- } = props, $[0] = props, $[1] = animate, $[2] = arrow2, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = originX, $[8] = originY, $[9] = padding, $[10] = placement, $[11] = radius, $[12] = restProps, $[13] = scheme, $[14] = shadow, $[15] = style, $[16] = tone) : (animate = $[1], arrow2 = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], originX = $[7], originY = $[8], padding = $[9], placement = $[10], radius = $[11], restProps = $[12], scheme = $[13], shadow = $[14], style = $[15], tone = $[16]);
2191
- let t0;
2192
- const t1 = animate ? "transform" : void 0;
2193
- let t2;
2194
- $[17] !== originX || $[18] !== originY || $[19] !== style || $[20] !== t1 ? (t2 = {
2195
- originX,
2196
- originY,
2197
- willChange: t1,
2198
- ...style
2199
- }, $[17] = originX, $[18] = originY, $[19] = style, $[20] = t1, $[21] = t2) : t2 = $[21], t0 = t2;
2200
- const rootStyle = t0;
2201
- let t3;
2202
- const t4 = arrowX !== null ? arrowX : void 0, t5 = arrowY !== null ? arrowY : void 0;
2203
- let t6;
2204
- $[22] !== t4 || $[23] !== t5 ? (t6 = {
2205
- left: t4,
2206
- top: t5,
2207
- right: void 0,
2208
- bottom: void 0
2209
- }, $[22] = t4, $[23] = t5, $[24] = t6) : t6 = $[24], t3 = t6;
2210
- const arrowStyle = t3, t7 = animate ? "" : void 0;
2211
- let t8;
2212
- $[25] === Symbol.for("react.memo_cache_sentinel") ? (t8 = tooltipCard(), $[25] = t8) : t8 = $[25];
2213
- let t9;
2214
- $[26] !== animate ? (t9 = animate ? ["hidden", "initial"] : void 0, $[26] = animate, $[27] = t9) : t9 = $[27];
2215
- let t10;
2216
- $[28] !== animate ? (t10 = animate ? ["visible", "scaleIn"] : void 0, $[28] = animate, $[29] = t10) : t10 = $[29];
2217
- let t11;
2218
- $[30] !== animate ? (t11 = animate ? ["hidden", "scaleOut"] : void 0, $[30] = animate, $[31] = t11) : t11 = $[31];
2219
- let t12;
2220
- $[32] !== arrow2 || $[33] !== arrowRef || $[34] !== arrowStyle ? (t12 = arrow2 && /* @__PURE__ */ jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_TOOLTIP_ARROW_WIDTH, height: DEFAULT_TOOLTIP_ARROW_HEIGHT, radius: DEFAULT_TOOLTIP_ARROW_RADIUS }), $[32] = arrow2, $[33] = arrowRef, $[34] = arrowStyle, $[35] = t12) : t12 = $[35];
2221
- let t13;
2222
- return $[36] !== children || $[37] !== padding || $[38] !== placement || $[39] !== radius || $[40] !== ref || $[41] !== restProps || $[42] !== rootStyle || $[43] !== scheme || $[44] !== shadow || $[45] !== t10 || $[46] !== t11 || $[47] !== t12 || $[48] !== t7 || $[49] !== t9 || $[50] !== tone ? (t13 = /* @__PURE__ */ jsxs(MotionCard, { "data-ui": "Tooltip__card", ...restProps, "data-animate": t7, className: t8, "data-placement": placement, padding, radius, ref, scheme, shadow, style: rootStyle, variants: POPOVER_MOTION_PROPS.card, transition: POPOVER_MOTION_PROPS.transition, initial: t9, animate: t10, exit: t11, tone, children: [
2223
- children,
2224
- t12
2225
- ] }), $[36] = children, $[37] = padding, $[38] = placement, $[39] = radius, $[40] = ref, $[41] = restProps, $[42] = rootStyle, $[43] = scheme, $[44] = shadow, $[45] = t10, $[46] = t11, $[47] = t12, $[48] = t7, $[49] = t9, $[50] = tone, $[51] = t13) : t13 = $[51], t13;
2226
- }));
2227
- TooltipCard.displayName = "Memo(ForwardRef(TooltipCard))";
2228
- const TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/context/tooltipDelayGroup", null);
2229
- function TooltipDelayGroupProvider(props) {
2230
- const $ = c(9), {
2231
- children,
2232
- delay
2233
- } = props, [isGroupActive, setIsGroupActive] = useDelayedState(!1), [openTooltipId, setOpenTooltipId] = useDelayedState(null), openDelay = typeof delay == "number" ? delay : delay?.open || 0, closeDelay = typeof delay == "number" ? delay : delay?.close || 0;
2234
- let t0;
2235
- const t1 = isGroupActive ? 1 : openDelay;
2236
- let t2;
2237
- $[0] !== closeDelay || $[1] !== openTooltipId || $[2] !== setIsGroupActive || $[3] !== setOpenTooltipId || $[4] !== t1 ? (t2 = {
2238
- setIsGroupActive,
2239
- openTooltipId,
2240
- setOpenTooltipId,
2241
- openDelay: t1,
2242
- closeDelay
2243
- }, $[0] = closeDelay, $[1] = openTooltipId, $[2] = setIsGroupActive, $[3] = setOpenTooltipId, $[4] = t1, $[5] = t2) : t2 = $[5], t0 = t2;
2244
- const value = t0;
2245
- let t3;
2246
- return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsx(TooltipDelayGroupContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t3) : t3 = $[8], t3;
2247
- }
2248
- TooltipDelayGroupProvider.displayName = "TooltipDelayGroupProvider";
2249
- function useTooltipDelayGroup() {
2250
- return useContext(TooltipDelayGroupContext);
2251
- }
2252
- const Tooltip = forwardRef(function(props, forwardedRef) {
2253
- const boundaryElementContext = useBoundaryElement(), {
2254
- layer
2255
- } = useTheme_v2(), {
2256
- animate: _animate = !1,
2257
- arrow: arrowProp = !1,
2258
- boundaryElement = boundaryElementContext?.element,
2259
- children: childProp,
2260
- className,
2261
- content,
2262
- delay,
2263
- disabled,
2264
- fallbackPlacements: fallbackPlacementsProp = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"],
2265
- padding = 2,
2266
- placement: placementProp = "bottom",
2267
- portal: portalProp,
2268
- radius = 3,
2269
- scheme,
2270
- shadow = 2,
2271
- zOffset = layer.tooltip.zOffset,
2272
- tone,
2273
- ...restProps
2274
- } = props, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = useArrayProp(fallbackPlacementsProp), ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = useState(0);
2275
- useImperativeHandle(forwardedRef, () => ref.current);
2276
- const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = useMemo(() => {
2277
- const ret = [];
2278
- return ret.push(flip({
2279
- boundary: boundaryElement || void 0,
2280
- fallbackPlacements,
2281
- padding: DEFAULT_TOOLTIP_PADDING,
2282
- rootBoundary
2283
- })), ret.push(offset({
2284
- mainAxis: DEFAULT_TOOLTIP_DISTANCE
2285
- })), ret.push(shift({
2286
- boundary: boundaryElement || void 0,
2287
- rootBoundary,
2288
- padding: DEFAULT_TOOLTIP_PADDING
2289
- })), arrowProp && ret.push(arrow({
2290
- element: arrowRef,
2291
- padding: DEFAULT_TOOLTIP_PADDING
2292
- })), animate && ret.push(origin), ret;
2293
- }, [animate, arrowProp, boundaryElement, fallbackPlacements]), {
2294
- floatingStyles,
2295
- placement,
2296
- middlewareData,
2297
- refs,
2298
- update
2299
- } = useFloating({
2300
- middleware,
2301
- placement: placementProp,
2302
- whileElementsMounted: autoUpdate,
2303
- elements: {
2304
- reference: referenceElement
2305
- }
2306
- }), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), {
2307
- setIsGroupActive,
2308
- setOpenTooltipId
2309
- } = delayGroupContext || {}, showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : delay?.open || 0, closeDelayProp = typeof delay == "number" ? delay : delay?.close || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp, handleIsOpenChange = useCallback((open, immediate) => {
2310
- if (isInsideGroup)
2311
- if (open) {
2312
- const groupedOpenDelay = immediate ? 0 : openDelay;
2313
- setIsGroupActive?.(open, groupedOpenDelay), setOpenTooltipId?.(tooltipId, groupedOpenDelay);
2314
- } else {
2315
- const groupDeactivateDelay = closeDelay > 200 ? closeDelay : 200;
2316
- setIsGroupActive?.(open, groupDeactivateDelay), setOpenTooltipId?.(null, immediate ? 0 : closeDelay);
2317
- }
2318
- else
2319
- setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
2320
- }, [isInsideGroup, openDelay, setIsGroupActive, setOpenTooltipId, tooltipId, closeDelay, setIsOpen]), handleBlur = useCallback((e) => {
2321
- handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
2322
- }, [childProp?.props, handleIsOpenChange]), handleClick = useCallback((e_0) => {
2323
- handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
2324
- }, [childProp?.props, handleIsOpenChange]), handleContextMenu = useCallback((e_1) => {
2325
- handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
2326
- }, [childProp?.props, handleIsOpenChange]), handleFocus = useCallback((e_2) => {
2327
- handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
2328
- }, [childProp?.props, handleIsOpenChange]), handleMouseEnter = useCallback((e_3) => {
2329
- handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
2330
- }, [childProp?.props, handleIsOpenChange]), handleMouseLeave = useCallback((e_4) => {
2331
- handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
2332
- }, [childProp?.props, handleIsOpenChange]);
2333
- useCloseOnMouseLeave({
2334
- handleIsOpenChange,
2335
- referenceElement,
2336
- showTooltip,
2337
- isInsideGroup
2338
- }), useEffect(() => {
2339
- disabled && showTooltip && handleIsOpenChange(!1);
2340
- }, [disabled, handleIsOpenChange, showTooltip]), useEffect(() => {
2341
- !content && showTooltip && handleIsOpenChange(!1);
2342
- }, [content, handleIsOpenChange, showTooltip]), useEffect(() => {
2343
- if (!showTooltip) return;
2344
- function handleWindowKeyDown(event) {
2345
- event.key === "Escape" && handleIsOpenChange(!1, !0);
2346
- }
2347
- return window.addEventListener("keydown", handleWindowKeyDown), () => {
2348
- window.removeEventListener("keydown", handleWindowKeyDown);
2349
- };
2350
- }, [handleIsOpenChange, showTooltip]), useLayoutEffect(() => {
2351
- const availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
2352
- setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2);
2353
- }, [boundaryElement, portalElement]);
2354
- const setArrow = useCallback((arrowEl) => {
2355
- arrowRef.current = arrowEl, update();
2356
- }, [update]), setFloating = useCallback((node) => {
2357
- ref.current = node, refs.setFloating(node);
2358
- }, [refs]), child = useMemo(() => childProp ? cloneElement(childProp, {
2359
- onBlur: handleBlur,
2360
- onFocus: handleFocus,
2361
- onMouseEnter: handleMouseEnter,
2362
- onMouseLeave: handleMouseLeave,
2363
- onClick: handleClick,
2364
- onContextMenu: handleContextMenu,
2365
- ref: setReferenceElement
2366
- }) : null, [childProp, handleBlur, handleClick, handleContextMenu, handleFocus, handleMouseEnter, handleMouseLeave]);
2367
- if (useImperativeHandle(childProp ? getElementRef(childProp) : null, () => referenceElement, [referenceElement]), !child) return /* @__PURE__ */ jsx(Fragment, {});
2368
- if (disabled) return child;
2369
- const node_0 = /* @__PURE__ */ jsx(
2370
- Layer,
2371
- {
2372
- "data-ui": "Tooltip",
2373
- className: composeClassNames(className, tooltip()),
2374
- ref: setFloating,
2375
- style: {
2376
- ...floatingStyles,
2377
- maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0
2378
- },
2379
- zOffset,
2380
- children: /* @__PURE__ */ jsx(TooltipCard, { ...restProps, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, tone, children: content })
2381
- }
2382
- ), children = showTooltip && (portalProp ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: node_0 }) : node_0);
2383
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2384
- animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
2385
- child
2386
- ] });
2387
- });
2388
- Tooltip.displayName = "ForwardRef(Tooltip)";
2389
- function useCloseOnMouseLeave(t0) {
2390
- const $ = c(10), {
2391
- handleIsOpenChange,
2392
- referenceElement,
2393
- showTooltip,
2394
- isInsideGroup
2395
- } = t0;
2396
- let t1;
2397
- $[0] !== handleIsOpenChange || $[1] !== referenceElement ? (t1 = (target, teardown) => {
2398
- referenceElement && (referenceElement === target || target instanceof Node && referenceElement.contains(target) || (handleIsOpenChange(!1), teardown()));
2399
- }, $[0] = handleIsOpenChange, $[1] = referenceElement, $[2] = t1) : t1 = $[2];
2400
- const onMouseMove = useEffectEvent(t1);
2401
- let t2;
2402
- $[3] !== isInsideGroup || $[4] !== onMouseMove || $[5] !== showTooltip ? (t2 = () => {
2403
- if (!showTooltip || isInsideGroup)
2404
- return;
2405
- const handleMouseMove = (event) => {
2406
- onMouseMove(event.target, () => window.removeEventListener("mousemove", handleMouseMove));
2407
- };
2408
- return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
2409
- }, $[3] = isInsideGroup, $[4] = onMouseMove, $[5] = showTooltip, $[6] = t2) : t2 = $[6];
2410
- let t3;
2411
- $[7] !== isInsideGroup || $[8] !== showTooltip ? (t3 = [isInsideGroup, showTooltip], $[7] = isInsideGroup, $[8] = showTooltip, $[9] = t3) : t3 = $[9], useEffect(t2, t3);
2412
- }
2413
- const Hotkeys = forwardRef(function(props, ref) {
2414
- const $ = c(30);
2415
- let fontSize, gap, gapX, gapY, keys, padding, radius, restProps, t0;
2416
- $[0] !== props ? ({
2417
- fontSize,
2418
- gap,
2419
- gapX,
2420
- gapY,
2421
- keys,
2422
- padding,
2423
- radius,
2424
- space: t0,
2425
- ...restProps
2426
- } = props, $[0] = props, $[1] = fontSize, $[2] = gap, $[3] = gapX, $[4] = gapY, $[5] = keys, $[6] = padding, $[7] = radius, $[8] = restProps, $[9] = t0) : (fontSize = $[1], gap = $[2], gapX = $[3], gapY = $[4], keys = $[5], padding = $[6], radius = $[7], restProps = $[8], t0 = $[9]);
2427
- const space = t0 === void 0 ? 1 : t0;
2428
- if (!keys || keys.length === 0) {
2429
- let t12;
2430
- return $[10] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsx(Fragment, {}), $[10] = t12) : t12 = $[10], t12;
2431
- }
2432
- const t1 = gap ?? space;
2433
- let t2;
2434
- if ($[11] !== fontSize || $[12] !== keys || $[13] !== padding || $[14] !== radius) {
2435
- let t32;
2436
- $[16] !== fontSize || $[17] !== padding || $[18] !== radius ? (t32 = (key2, i) => /* @__PURE__ */ jsx(KBD, { display: "block", fontSize, padding, radius, children: key2 }, i), $[16] = fontSize, $[17] = padding, $[18] = radius, $[19] = t32) : t32 = $[19], t2 = keys.map(t32), $[11] = fontSize, $[12] = keys, $[13] = padding, $[14] = radius, $[15] = t2;
2437
- } else
2438
- t2 = $[15];
2439
- let t3;
2440
- $[20] !== gap || $[21] !== t2 ? (t3 = /* @__PURE__ */ jsx(Inline, { as: "span", gap, children: t2 }), $[20] = gap, $[21] = t2, $[22] = t3) : t3 = $[22];
2441
- let t4;
2442
- return $[23] !== gapX || $[24] !== gapY || $[25] !== ref || $[26] !== restProps || $[27] !== t1 || $[28] !== t3 ? (t4 = /* @__PURE__ */ jsx(Box, { as: "kbd", "data-ui": "Hotkeys", ...restProps, display: "flex", gap: t1, gapX, gapY, ref, children: t3 }), $[23] = gapX, $[24] = gapY, $[25] = ref, $[26] = restProps, $[27] = t1, $[28] = t3, $[29] = t4) : t4 = $[29], t4;
2443
- });
2444
- Hotkeys.displayName = "ForwardRef(Hotkeys)";
2445
- const MenuContext = createGlobalScopedContext("@sanity/ui/context/menu", null);
2446
- function _isFocusable(element) {
2447
- return isHTMLAnchorElement(element) && element.getAttribute("data-disabled") !== "true" || isHTMLButtonElement(element) && !element.disabled;
2448
- }
2449
- function _getFocusableElements(elements) {
2450
- return elements.filter(_isFocusable);
2451
- }
2452
- function _getDOMPath(rootElement, el) {
2453
- const path = [];
2454
- let e = el;
2455
- for (; e !== rootElement; ) {
2456
- const parentElement = e.parentElement;
2457
- if (!parentElement) return path;
2458
- const index = Array.from(parentElement.childNodes).indexOf(e);
2459
- if (path.unshift(index), parentElement === rootElement)
2460
- return path;
2461
- e = parentElement;
2462
- }
2463
- return path;
2464
- }
2465
- const EMPTY_PATH = [];
2466
- function _sortElements(rootElement, elements) {
2467
- if (!rootElement) return;
2468
- const map = /* @__PURE__ */ new WeakMap();
2469
- for (const el of elements)
2470
- map.set(el, _getDOMPath(rootElement, el));
2471
- const _sort = (a, b) => {
2472
- const _a = map.get(a) || EMPTY_PATH, _b = map.get(b) || EMPTY_PATH, len = Math.max(_a.length, _b.length);
2473
- for (let i = 0; i < len; i += 1) {
2474
- const aIndex = _a[i] || -1, bIndex = _b[i] || -1;
2475
- if (aIndex !== bIndex)
2476
- return aIndex - bIndex;
2477
- }
2478
- return 0;
2479
- };
2480
- elements.sort(_sort);
2481
- }
2482
- function useMenuController(props) {
2483
- const {
2484
- onKeyDown,
2485
- originElement,
2486
- shouldFocus,
2487
- rootElementRef
2488
- } = props, elementsRef = useRef([]), [activeIndex, _setActiveIndex] = useState(-1), activeIndexRef = useRef(activeIndex), activeElement = useMemo(() => elementsRef.current[activeIndex] || null, [activeIndex]), mounted = !!rootElementRef.current, setActiveIndex = useCallback((nextActiveIndex) => {
2489
- _setActiveIndex(nextActiveIndex), activeIndexRef.current = nextActiveIndex;
2490
- }, []), mount = useCallback((element, selected) => {
2491
- if (!element) return () => {
2492
- };
2493
- if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(rootElementRef.current, elementsRef.current)), selected) {
2494
- const selectedIndex = elementsRef.current.indexOf(element);
2495
- setActiveIndex(selectedIndex);
2496
- }
2497
- return () => {
2498
- const idx = elementsRef.current.indexOf(element);
2499
- idx > -1 && elementsRef.current.splice(idx, 1);
2500
- };
2501
- }, [rootElementRef, setActiveIndex]), handleKeyDown = useCallback((event) => {
2502
- if (event.key === "Tab") {
2503
- originElement && originElement.focus();
2504
- return;
2505
- }
2506
- if (event.key === "Home") {
2507
- event.preventDefault(), event.stopPropagation();
2508
- const el = _getFocusableElements(elementsRef.current)[0];
2509
- if (!el) return;
2510
- const currentIndex = elementsRef.current.indexOf(el);
2511
- setActiveIndex(currentIndex);
2512
- return;
2513
- }
2514
- if (event.key === "End") {
2515
- event.preventDefault(), event.stopPropagation();
2516
- const focusableElements_0 = _getFocusableElements(elementsRef.current), el_0 = focusableElements_0[focusableElements_0.length - 1];
2517
- if (!el_0) return;
2518
- const currentIndex_0 = elementsRef.current.indexOf(el_0);
2519
- setActiveIndex(currentIndex_0);
2520
- return;
2521
- }
2522
- if (event.key === "ArrowUp") {
2523
- event.preventDefault(), event.stopPropagation();
2524
- const focusableElements_1 = _getFocusableElements(elementsRef.current), focusableLen = focusableElements_1.length;
2525
- if (focusableLen === 0) return;
2526
- const focusedElement = elementsRef.current[activeIndexRef.current];
2527
- let focusedIndex = focusableElements_1.indexOf(focusedElement);
2528
- focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen;
2529
- const el_1 = focusableElements_1[focusedIndex], currentIndex_1 = elementsRef.current.indexOf(el_1);
2530
- setActiveIndex(currentIndex_1);
2531
- return;
2532
- }
2533
- if (event.key === "ArrowDown") {
2534
- event.preventDefault(), event.stopPropagation();
2535
- const focusableElements_2 = _getFocusableElements(elementsRef.current), focusableLen_0 = focusableElements_2.length;
2536
- if (focusableLen_0 === 0) return;
2537
- const focusedElement_0 = elementsRef.current[activeIndexRef.current];
2538
- let focusedIndex_0 = focusableElements_2.indexOf(focusedElement_0);
2539
- focusedIndex_0 = (focusedIndex_0 + 1) % focusableLen_0;
2540
- const el_2 = focusableElements_2[focusedIndex_0], currentIndex_2 = elementsRef.current.indexOf(el_2);
2541
- setActiveIndex(currentIndex_2);
2542
- return;
2543
- }
2544
- onKeyDown && onKeyDown(event);
2545
- }, [onKeyDown, originElement, setActiveIndex]), handleItemMouseEnter = useCallback((event_0) => {
2546
- const element_0 = event_0.currentTarget, currentIndex_3 = elementsRef.current.indexOf(element_0);
2547
- setActiveIndex(currentIndex_3);
2548
- }, [setActiveIndex]), handleItemMouseLeave = useCallback(() => {
2549
- setActiveIndex(-2), rootElementRef.current?.focus();
2550
- }, [rootElementRef, setActiveIndex]);
2551
- return useEffect(() => {
2552
- if (!mounted) return;
2553
- const rafId = requestAnimationFrame(() => {
2554
- if (activeIndex === -1) {
2555
- if (shouldFocus === "first") {
2556
- const el_3 = _getFocusableElements(elementsRef.current)[0];
2557
- if (el_3) {
2558
- const currentIndex_4 = elementsRef.current.indexOf(el_3);
2559
- setActiveIndex(currentIndex_4);
2560
- }
2561
- }
2562
- if (shouldFocus === "last") {
2563
- const focusableElements_4 = _getFocusableElements(elementsRef.current), el_4 = focusableElements_4[focusableElements_4.length - 1];
2564
- if (el_4) {
2565
- const currentIndex_5 = elementsRef.current.indexOf(el_4);
2566
- setActiveIndex(currentIndex_5);
2567
- }
2568
- }
2569
- return;
2570
- }
2571
- (elementsRef.current[activeIndex] || null)?.focus();
2572
- });
2573
- return () => cancelAnimationFrame(rafId);
2574
- }, [activeIndex, mounted, setActiveIndex, shouldFocus]), {
2575
- activeElement,
2576
- activeIndex,
2577
- handleItemMouseEnter,
2578
- handleItemMouseLeave,
2579
- handleKeyDown,
2580
- mount
2581
- };
2582
- }
2583
- const Menu = forwardRef(function(props, forwardedRef) {
2584
- const $ = c(55);
2585
- let _shouldFocus, children, className, gap, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, registerElement, restProps, t0, t1;
2586
- if ($[0] !== props) {
2587
- const {
2588
- children: t22,
2589
- className: t32,
2590
- focusFirst,
2591
- focusLast,
2592
- gap: t42,
2593
- onClickOutside: t52,
2594
- onEscape: t62,
2595
- onItemClick: t72,
2596
- onItemSelect: t82,
2597
- onKeyDown: t92,
2598
- originElement: t102,
2599
- padding: t112,
2600
- registerElement: t122,
2601
- shouldFocus: t132,
2602
- space: t142,
2603
- ...t152
2604
- } = props;
2605
- children = t22, className = t32, gap = t42, onClickOutside = t52, onEscape = t62, onItemClick = t72, onItemSelect = t82, onKeyDown = t92, originElement = t102, t0 = t112, registerElement = t122, _shouldFocus = t132, t1 = t142, restProps = t152, $[0] = props, $[1] = _shouldFocus, $[2] = children, $[3] = className, $[4] = gap, $[5] = onClickOutside, $[6] = onEscape, $[7] = onItemClick, $[8] = onItemSelect, $[9] = onKeyDown, $[10] = originElement, $[11] = registerElement, $[12] = restProps, $[13] = t0, $[14] = t1;
2606
- } else
2607
- _shouldFocus = $[1], children = $[2], className = $[3], gap = $[4], onClickOutside = $[5], onEscape = $[6], onItemClick = $[7], onItemSelect = $[8], onKeyDown = $[9], originElement = $[10], registerElement = $[11], restProps = $[12], t0 = $[13], t1 = $[14];
2608
- const padding = t0 === void 0 ? 1 : t0, space = t1 === void 0 ? 1 : t1, shouldFocus = _shouldFocus ?? (props.focusFirst && "first" || props.focusLast && "last" || null), ref = useRef(null);
2609
- let t2;
2610
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[15] = t2) : t2 = $[15], useImperativeHandle(forwardedRef, t2);
2611
- const {
2612
- isTopLayer
2613
- } = useLayer();
2614
- let t3;
2615
- $[16] !== onKeyDown || $[17] !== originElement || $[18] !== shouldFocus ? (t3 = {
2616
- onKeyDown,
2617
- originElement,
2618
- shouldFocus,
2619
- rootElementRef: ref
2620
- }, $[16] = onKeyDown, $[17] = originElement, $[18] = shouldFocus, $[19] = t3) : t3 = $[19];
2621
- const {
2622
- activeElement,
2623
- activeIndex,
2624
- handleItemMouseEnter,
2625
- handleItemMouseLeave,
2626
- handleKeyDown,
2627
- mount
2628
- } = useMenuController(t3), unregisterElementRef = useRef(null);
2629
- let t4;
2630
- $[20] !== registerElement ? (t4 = (el) => {
2631
- unregisterElementRef.current && (unregisterElementRef.current(), unregisterElementRef.current = null), ref.current = el, ref.current && registerElement && (unregisterElementRef.current = registerElement(ref.current));
2632
- }, $[20] = registerElement, $[21] = t4) : t4 = $[21];
2633
- const handleRefChange = t4;
2634
- let t5, t6;
2635
- $[22] !== activeIndex || $[23] !== onItemSelect ? (t5 = () => {
2636
- onItemSelect && onItemSelect(activeIndex);
2637
- }, t6 = [activeIndex, onItemSelect], $[22] = activeIndex, $[23] = onItemSelect, $[24] = t5, $[25] = t6) : (t5 = $[24], t6 = $[25]), useEffect(t5, t6);
2638
- let t7;
2639
- $[26] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => [ref.current], $[26] = t7) : t7 = $[26], useClickOutsideEvent(isTopLayer && onClickOutside, t7);
2640
- let t8;
2641
- $[27] !== isTopLayer || $[28] !== onEscape ? (t8 = (event) => {
2642
- isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
2643
- }, $[27] = isTopLayer, $[28] = onEscape, $[29] = t8) : t8 = $[29], useGlobalKeyDown(t8);
2644
- let t9, t10;
2645
- $[30] !== activeElement || $[31] !== activeIndex || $[32] !== handleItemMouseEnter || $[33] !== handleItemMouseLeave || $[34] !== mount || $[35] !== onClickOutside || $[36] !== onEscape || $[37] !== onItemClick || $[38] !== registerElement ? (t10 = {
2646
- version: 0,
2647
- activeElement,
2648
- activeIndex,
2649
- mount,
2650
- onClickOutside,
2651
- onEscape,
2652
- onItemClick,
2653
- onItemMouseEnter: handleItemMouseEnter,
2654
- onItemMouseLeave: handleItemMouseLeave,
2655
- registerElement,
2656
- onMouseEnter: handleItemMouseEnter,
2657
- onMouseLeave: handleItemMouseLeave
2658
- }, $[30] = activeElement, $[31] = activeIndex, $[32] = handleItemMouseEnter, $[33] = handleItemMouseLeave, $[34] = mount, $[35] = onClickOutside, $[36] = onEscape, $[37] = onItemClick, $[38] = registerElement, $[39] = t10) : t10 = $[39], t9 = t10;
2659
- const value = t9;
2660
- let t11;
2661
- $[40] !== className ? (t11 = composeClassNames(className, menu()), $[40] = className, $[41] = t11) : t11 = $[41];
2662
- const t12 = gap ?? space;
2663
- let t13;
2664
- $[42] !== children || $[43] !== t12 ? (t13 = /* @__PURE__ */ jsx(Stack, { gap: t12, children }), $[42] = children, $[43] = t12, $[44] = t13) : t13 = $[44];
2665
- let t14;
2666
- $[45] !== handleKeyDown || $[46] !== handleRefChange || $[47] !== padding || $[48] !== restProps || $[49] !== t11 || $[50] !== t13 ? (t14 = /* @__PURE__ */ jsx(Box, { "data-ui": "Menu", ...restProps, className: t11, onKeyDown: handleKeyDown, overflow: "auto", outline: "none", padding, ref: handleRefChange, role: "menu", tabIndex: -1, children: t13 }), $[45] = handleKeyDown, $[46] = handleRefChange, $[47] = padding, $[48] = restProps, $[49] = t11, $[50] = t13, $[51] = t14) : t14 = $[51];
2667
- let t15;
2668
- return $[52] !== t14 || $[53] !== value ? (t15 = /* @__PURE__ */ jsx(MenuContext.Provider, { value, children: t14 }), $[52] = t14, $[53] = value, $[54] = t15) : t15 = $[54], t15;
2669
- });
2670
- Menu.displayName = "ForwardRef(Menu)";
2671
- const MenuDivider = forwardRef(function(props, ref) {
2672
- const $ = c(9);
2673
- let className, restProps;
2674
- $[0] !== props ? ({
2675
- className,
2676
- ...restProps
2677
- } = props, $[0] = props, $[1] = className, $[2] = restProps) : (className = $[1], restProps = $[2]);
2678
- let t0;
2679
- $[3] !== className ? (t0 = composeClassNames(className, menuDivider()), $[3] = className, $[4] = t0) : t0 = $[4];
2680
- let t1;
2681
- return $[5] !== ref || $[6] !== restProps || $[7] !== t0 ? (t1 = /* @__PURE__ */ jsx("hr", { ...restProps, className: t0, ref }), $[5] = ref, $[6] = restProps, $[7] = t0, $[8] = t1) : t1 = $[8], t1;
2682
- });
2683
- MenuDivider.displayName = "MenuDivider";
2684
- const Selectable = forwardRef(function(props, ref) {
2685
- const $ = c(13);
2686
- let className, radius, restProps, tone;
2687
- $[0] !== props ? ({
2688
- className,
2689
- radius,
2690
- tone,
2691
- ...restProps
2692
- } = props, $[0] = props, $[1] = className, $[2] = radius, $[3] = restProps, $[4] = tone) : (className = $[1], radius = $[2], restProps = $[3], tone = $[4]);
2693
- let t0;
2694
- $[5] !== className || $[6] !== radius || $[7] !== tone ? (t0 = composeClassNames(className, _selectable({
2695
- radius,
2696
- tone
2697
- })), $[5] = className, $[6] = radius, $[7] = tone, $[8] = t0) : t0 = $[8];
2698
- let t1;
2699
- return $[9] !== ref || $[10] !== restProps || $[11] !== t0 ? (t1 = /* @__PURE__ */ jsx(Box, { ...restProps, className: t0, ref }), $[9] = ref, $[10] = restProps, $[11] = t0, $[12] = t1) : t1 = $[12], t1;
2700
- });
2701
- Selectable.displayName = "ForwardRef(Selectable)";
2702
- function useMenu() {
2703
- const value = useContext(MenuContext);
2704
- if (!value)
2705
- throw new Error("useMenu(): missing context value");
2706
- if (!isRecord(value) || value.version !== 0)
2707
- throw new Error("useMenu(): the context value is not compatible");
2708
- return value;
2709
- }
2710
- function MenuGroup(props) {
2711
- const $ = c(83);
2712
- let IconComponent, children, gap, gapX, gapY, menuProps, onClick, popover, restProps, t0, t1, t2, t3, t4, t5, text2;
2713
- $[0] !== props ? ({
2714
- as: t0,
2715
- children,
2716
- fontSize: t1,
2717
- gap,
2718
- gapX,
2719
- gapY,
2720
- icon: IconComponent,
2721
- menu: menuProps,
2722
- onClick,
2723
- padding: t2,
2724
- popover,
2725
- radius: t3,
2726
- space: t4,
2727
- text: text2,
2728
- tone: t5,
2729
- ...restProps
2730
- } = props, $[0] = props, $[1] = IconComponent, $[2] = children, $[3] = gap, $[4] = gapX, $[5] = gapY, $[6] = menuProps, $[7] = onClick, $[8] = popover, $[9] = restProps, $[10] = t0, $[11] = t1, $[12] = t2, $[13] = t3, $[14] = t4, $[15] = t5, $[16] = text2) : (IconComponent = $[1], children = $[2], gap = $[3], gapX = $[4], gapY = $[5], menuProps = $[6], onClick = $[7], popover = $[8], restProps = $[9], t0 = $[10], t1 = $[11], t2 = $[12], t3 = $[13], t4 = $[14], t5 = $[15], text2 = $[16]);
2731
- const as = t0 === void 0 ? "button" : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 3 : t2, radius = t3 === void 0 ? 2 : t3, space = t4 === void 0 ? 3 : t4, tone = t5 === void 0 ? "default" : t5, menu2 = useMenu(), {
2732
- activeElement,
2733
- mount,
2734
- onClickOutside,
2735
- onEscape,
2736
- onItemClick,
2737
- onItemMouseEnter: _onItemMouseEnter,
2738
- registerElement
2739
- } = menu2, onItemMouseEnter = _onItemMouseEnter ?? menu2.onMouseEnter, [rootElement, setRootElement] = useState(null), [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = useState(!1);
2740
- let t6;
2741
- $[17] !== onItemMouseEnter ? (t6 = (event) => {
2742
- setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
2743
- }, $[17] = onItemMouseEnter, $[18] = t6) : t6 = $[18];
2744
- const handleMouseEnter = t6;
2745
- let t7;
2746
- $[19] !== rootElement ? (t7 = (event_0) => {
2747
- event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
2748
- rootElement?.focus();
2749
- }));
2750
- }, $[19] = rootElement, $[20] = t7) : t7 = $[20];
2751
- const handleMenuKeyDown = t7;
2752
- let t8;
2753
- $[21] !== onClick ? (t8 = (event_1) => {
2754
- onClick?.(event_1), setShouldFocus("first"), setOpen(!0);
2755
- }, $[21] = onClick, $[22] = t8) : t8 = $[22];
2756
- const handleClick = t8;
2757
- let t9;
2758
- $[23] !== onItemClick ? (t9 = () => {
2759
- setOpen(!1), onItemClick?.();
2760
- }, $[23] = onItemClick, $[24] = t9) : t9 = $[24];
2761
- const handleChildItemClick = t9;
2762
- let t10;
2763
- $[25] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => setWithinMenu(!0), $[25] = t10) : t10 = $[25];
2764
- const handleMenuMouseEnter = t10;
2765
- let t11, t12;
2766
- $[26] !== mount || $[27] !== rootElement ? (t11 = () => mount(rootElement), t12 = [mount, rootElement], $[26] = mount, $[27] = rootElement, $[28] = t11, $[29] = t12) : (t11 = $[28], t12 = $[29]), useEffect(t11, t12);
2767
- let t13, t14;
2768
- $[30] !== active ? (t13 = () => {
2769
- active || setOpen(!1);
2770
- }, t14 = [active], $[30] = active, $[31] = t13, $[32] = t14) : (t13 = $[31], t14 = $[32]), useEffect(t13, t14);
2771
- let t15, t16;
2772
- $[33] !== open ? (t15 = () => {
2773
- open || setWithinMenu(!1);
2774
- }, t16 = [open], $[33] = open, $[34] = t15, $[35] = t16) : (t15 = $[34], t16 = $[35]), useEffect(t15, t16);
2775
- let t17, t18;
2776
- $[36] !== shouldFocus ? (t17 = () => {
2777
- if (!shouldFocus)
2778
- return;
2779
- const rafId = requestAnimationFrame(() => setShouldFocus(null));
2780
- return () => cancelAnimationFrame(rafId);
2781
- }, t18 = [shouldFocus], $[36] = shouldFocus, $[37] = t17, $[38] = t18) : (t17 = $[37], t18 = $[38]), useEffect(t17, t18);
2782
- let t19;
2783
- $[39] !== children || $[40] !== handleChildItemClick || $[41] !== handleMenuKeyDown || $[42] !== menuProps || $[43] !== onClickOutside || $[44] !== onEscape || $[45] !== registerElement || $[46] !== shouldFocus ? (t19 = /* @__PURE__ */ jsx(Menu, { ...menuProps, onClickOutside, onEscape, onItemClick: handleChildItemClick, onKeyDown: handleMenuKeyDown, onMouseEnter: handleMenuMouseEnter, registerElement, shouldFocus, children }), $[39] = children, $[40] = handleChildItemClick, $[41] = handleMenuKeyDown, $[42] = menuProps, $[43] = onClickOutside, $[44] = onEscape, $[45] = registerElement, $[46] = shouldFocus, $[47] = t19) : t19 = $[47];
2784
- const childMenu = t19;
2785
- let t20;
2786
- $[48] === Symbol.for("react.memo_cache_sentinel") ? (t20 = (event_2) => {
2787
- const target = event_2.currentTarget;
2788
- if (document.activeElement === target && event_2.key === "ArrowRight") {
2789
- setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
2790
- return;
2791
- }
2792
- }, $[48] = t20) : t20 = $[48];
2793
- const handleKeyDown = t20, t21 = as === "button" ? withinMenu : void 0, t22 = as !== "button" ? withinMenu : void 0, t23 = !withinMenu && active ? "" : void 0, t24 = as === "button" ? "button" : void 0, t25 = gap ?? space;
2794
- let t26;
2795
- $[49] !== IconComponent || $[50] !== fontSize ? (t26 = IconComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize, children: [
2796
- isValidElement(IconComponent) && IconComponent,
2797
- isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
2798
- ] }), $[49] = IconComponent, $[50] = fontSize, $[51] = t26) : t26 = $[51];
2799
- let t27;
2800
- $[52] !== fontSize || $[53] !== text2 ? (t27 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize, textOverflow: "ellipsis", weight: "medium", children: text2 }) }), $[52] = fontSize, $[53] = text2, $[54] = t27) : t27 = $[54];
2801
- let t28;
2802
- $[55] === Symbol.for("react.memo_cache_sentinel") ? (t28 = /* @__PURE__ */ jsx(ChevronRightIcon, {}), $[55] = t28) : t28 = $[55];
2803
- let t29;
2804
- $[56] !== fontSize ? (t29 = /* @__PURE__ */ jsx(Text, { size: fontSize, children: t28 }), $[56] = fontSize, $[57] = t29) : t29 = $[57];
2805
- let t30;
2806
- $[58] !== gapX || $[59] !== gapY || $[60] !== padding || $[61] !== t25 || $[62] !== t26 || $[63] !== t27 || $[64] !== t29 ? (t30 = /* @__PURE__ */ jsxs(Flex, { gap: t25, gapX, gapY, padding, children: [
2807
- t26,
2808
- t27,
2809
- t29
2810
- ] }), $[58] = gapX, $[59] = gapY, $[60] = padding, $[61] = t25, $[62] = t26, $[63] = t27, $[64] = t29, $[65] = t30) : t30 = $[65];
2811
- let t31;
2812
- $[66] !== as || $[67] !== handleClick || $[68] !== handleMouseEnter || $[69] !== radius || $[70] !== restProps || $[71] !== t21 || $[72] !== t22 || $[73] !== t23 || $[74] !== t24 || $[75] !== t30 || $[76] !== tone ? (t31 = /* @__PURE__ */ jsx(Selectable, { "data-ui": "MenuGroup", ...restProps, "aria-pressed": t21, as, "data-pressed": t22, "data-selected": t23, onClick: handleClick, onKeyDown: handleKeyDown, onMouseEnter: handleMouseEnter, radius, ref: setRootElement, tabIndex: -1, tone, type: t24, children: t30 }), $[66] = as, $[67] = handleClick, $[68] = handleMouseEnter, $[69] = radius, $[70] = restProps, $[71] = t21, $[72] = t22, $[73] = t23, $[74] = t24, $[75] = t30, $[76] = tone, $[77] = t31) : t31 = $[77];
2813
- let t32;
2814
- return $[78] !== childMenu || $[79] !== open || $[80] !== popover || $[81] !== t31 ? (t32 = /* @__PURE__ */ jsx(Popover, { ...popover, content: childMenu, "data-ui": "MenuGroup__popover", open, children: t31 }), $[78] = childMenu, $[79] = open, $[80] = popover, $[81] = t31, $[82] = t32) : t32 = $[82], t32;
2815
- }
2816
- MenuGroup.displayName = "MenuGroup";
2817
- const MenuItem = forwardRef(function(props, forwardedRef) {
2818
- const $ = c(74);
2819
- let IconComponent, IconRightComponent, children, disabled, gap, gapX, gapY, hotkeys, onClick, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, pressed, restProps, selectedProp, t0, t1, t2, t3, t4, t5, text2;
2820
- $[0] !== props ? ({
2821
- as: t0,
2822
- children,
2823
- disabled,
2824
- fontSize: t1,
2825
- gap,
2826
- gapX,
2827
- gapY,
2828
- hotkeys,
2829
- icon: IconComponent,
2830
- iconRight: IconRightComponent,
2831
- onClick,
2832
- padding: t2,
2833
- paddingX,
2834
- paddingY,
2835
- paddingTop,
2836
- paddingRight,
2837
- paddingBottom,
2838
- paddingLeft,
2839
- pressed,
2840
- radius: t3,
2841
- selected: selectedProp,
2842
- space: t4,
2843
- text: text2,
2844
- tone: t5,
2845
- ...restProps
2846
- } = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = children, $[4] = disabled, $[5] = gap, $[6] = gapX, $[7] = gapY, $[8] = hotkeys, $[9] = onClick, $[10] = paddingBottom, $[11] = paddingLeft, $[12] = paddingRight, $[13] = paddingTop, $[14] = paddingX, $[15] = paddingY, $[16] = pressed, $[17] = restProps, $[18] = selectedProp, $[19] = t0, $[20] = t1, $[21] = t2, $[22] = t3, $[23] = t4, $[24] = t5, $[25] = text2) : (IconComponent = $[1], IconRightComponent = $[2], children = $[3], disabled = $[4], gap = $[5], gapX = $[6], gapY = $[7], hotkeys = $[8], onClick = $[9], paddingBottom = $[10], paddingLeft = $[11], paddingRight = $[12], paddingTop = $[13], paddingX = $[14], paddingY = $[15], pressed = $[16], restProps = $[17], selectedProp = $[18], t0 = $[19], t1 = $[20], t2 = $[21], t3 = $[22], t4 = $[23], t5 = $[24], text2 = $[25]);
2847
- const as = t0 === void 0 ? "button" : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 3 : t2, radius = t3 === void 0 ? 2 : t3, space = t4 === void 0 ? 3 : t4, tone = t5 === void 0 ? "default" : t5, menu2 = useMenu(), {
2848
- activeElement,
2849
- mount,
2850
- onItemClick,
2851
- onItemMouseEnter: _onItemMouseEnter,
2852
- onItemMouseLeave: _onItemMouseLeave
2853
- } = menu2, onItemMouseEnter = _onItemMouseEnter ?? menu2.onMouseEnter, onItemMouseLeave = _onItemMouseLeave ?? menu2.onMouseLeave, [rootElement, setRootElement] = useState(null), active = !!activeElement && activeElement === rootElement, ref = useRef(null);
2854
- let t6;
2855
- $[26] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[26] = t6) : t6 = $[26], useImperativeHandle(forwardedRef, t6);
2856
- let t7, t8;
2857
- $[27] !== mount || $[28] !== rootElement || $[29] !== selectedProp ? (t7 = () => mount(rootElement, selectedProp), t8 = [mount, rootElement, selectedProp], $[27] = mount, $[28] = rootElement, $[29] = selectedProp, $[30] = t7, $[31] = t8) : (t7 = $[30], t8 = $[31]), useEffect(t7, t8);
2858
- let t9;
2859
- $[32] !== disabled || $[33] !== onClick || $[34] !== onItemClick ? (t9 = (event) => {
2860
- disabled || (onClick && onClick(event), onItemClick && onItemClick());
2861
- }, $[32] = disabled, $[33] = onClick, $[34] = onItemClick, $[35] = t9) : t9 = $[35];
2862
- const handleClick = t9;
2863
- let t10, t11;
2864
- $[36] !== padding || $[37] !== paddingBottom || $[38] !== paddingLeft || $[39] !== paddingRight || $[40] !== paddingTop || $[41] !== paddingX || $[42] !== paddingY ? (t11 = {
2865
- padding,
2866
- paddingX,
2867
- paddingY,
2868
- paddingTop,
2869
- paddingRight,
2870
- paddingBottom,
2871
- paddingLeft
2872
- }, $[36] = padding, $[37] = paddingBottom, $[38] = paddingLeft, $[39] = paddingRight, $[40] = paddingTop, $[41] = paddingX, $[42] = paddingY, $[43] = t11) : t11 = $[43], t10 = t11;
2873
- const paddingProps = t10;
2874
- let t12;
2875
- $[44] === Symbol.for("react.memo_cache_sentinel") ? (t12 = (el) => {
2876
- ref.current = el, setRootElement(el);
2877
- }, $[44] = t12) : t12 = $[44];
2878
- const setRef = t12, t13 = pressed ? "" : void 0, t14 = active ? "" : void 0, t15 = disabled ? "" : void 0, t16 = as === "button" ? "button" : void 0;
2879
- let t17;
2880
- $[45] !== IconComponent || $[46] !== IconRightComponent || $[47] !== fontSize || $[48] !== gap || $[49] !== gapX || $[50] !== gapY || $[51] !== hotkeys || $[52] !== paddingProps || $[53] !== space || $[54] !== text2 ? (t17 = (IconComponent || text2 || IconRightComponent) && /* @__PURE__ */ jsxs(Flex, { as: "span", gap: gap ?? space, gapX, gapY, align: "center", ...paddingProps, children: [
2881
- IconComponent && /* @__PURE__ */ jsxs(Text, { muted: !0, size: fontSize, children: [
2882
- isValidElement(IconComponent) && IconComponent,
2883
- isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
2884
- ] }),
2885
- text2 && /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize, textOverflow: "ellipsis", weight: "medium", children: text2 }) }),
2886
- hotkeys && /* @__PURE__ */ jsx(Hotkeys, { gap: 0.5, keys: hotkeys, style: {
2887
- marginTop: -4,
2888
- marginBottom: -4
2889
- } }),
2890
- IconRightComponent && /* @__PURE__ */ jsxs(Text, { muted: !0, size: fontSize, children: [
2891
- isValidElement(IconRightComponent) && IconRightComponent,
2892
- isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
2893
- ] })
2894
- ] }), $[45] = IconComponent, $[46] = IconRightComponent, $[47] = fontSize, $[48] = gap, $[49] = gapX, $[50] = gapY, $[51] = hotkeys, $[52] = paddingProps, $[53] = space, $[54] = text2, $[55] = t17) : t17 = $[55];
2895
- let t18;
2896
- $[56] !== children || $[57] !== paddingProps ? (t18 = children && /* @__PURE__ */ jsx(Box, { as: "span", ...paddingProps, children }), $[56] = children, $[57] = paddingProps, $[58] = t18) : t18 = $[58];
2897
- let t19;
2898
- return $[59] !== as || $[60] !== disabled || $[61] !== handleClick || $[62] !== onItemMouseEnter || $[63] !== onItemMouseLeave || $[64] !== radius || $[65] !== restProps || $[66] !== t13 || $[67] !== t14 || $[68] !== t15 || $[69] !== t16 || $[70] !== t17 || $[71] !== t18 || $[72] !== tone ? (t19 = /* @__PURE__ */ jsxs(Selectable, { "data-ui": "MenuItem", role: "menuitem", ...restProps, as, "data-pressed": t13, "data-selected": t14, "data-disabled": t15, radius, disabled, onClick: handleClick, onMouseEnter: onItemMouseEnter, onMouseLeave: onItemMouseLeave, ref: setRef, tabIndex: -1, tone, type: t16, children: [
2899
- t17,
2900
- t18
2901
- ] }), $[59] = as, $[60] = disabled, $[61] = handleClick, $[62] = onItemMouseEnter, $[63] = onItemMouseLeave, $[64] = radius, $[65] = restProps, $[66] = t13, $[67] = t14, $[68] = t15, $[69] = t16, $[70] = t17, $[71] = t18, $[72] = tone, $[73] = t19) : t19 = $[73], t19;
2902
- });
2903
- MenuItem.displayName = "ForwardRef(MenuItem)";
2904
- const Tab = forwardRef(function(props, forwardedRef) {
2905
- const $ = c(30);
2906
- let focused, icon, id, label2, onClick, onFocus, restProps, selected, t0, t1;
2907
- $[0] !== props ? ({
2908
- icon,
2909
- id,
2910
- focused,
2911
- fontSize: t0,
2912
- label: label2,
2913
- onClick,
2914
- onFocus,
2915
- padding: t1,
2916
- selected,
2917
- ...restProps
2918
- } = props, $[0] = props, $[1] = focused, $[2] = icon, $[3] = id, $[4] = label2, $[5] = onClick, $[6] = onFocus, $[7] = restProps, $[8] = selected, $[9] = t0, $[10] = t1) : (focused = $[1], icon = $[2], id = $[3], label2 = $[4], onClick = $[5], onFocus = $[6], restProps = $[7], selected = $[8], t0 = $[9], t1 = $[10]);
2919
- const fontSize = t0 === void 0 ? 1 : t0, padding = t1 === void 0 ? 2 : t1, ref = useRef(null), focusedRef = useRef(!1);
2920
- let t2;
2921
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[11] = t2) : t2 = $[11], useImperativeHandle(forwardedRef, t2);
2922
- let t3;
2923
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => {
2924
- focusedRef.current = !1;
2925
- }, $[12] = t3) : t3 = $[12];
2926
- const handleBlur = t3;
2927
- let t4;
2928
- $[13] !== onFocus ? (t4 = (event) => {
2929
- focusedRef.current = !0, onFocus && onFocus(event);
2930
- }, $[13] = onFocus, $[14] = t4) : t4 = $[14];
2931
- const handleFocus = t4;
2932
- let t5, t6;
2933
- $[15] !== focused ? (t5 = () => {
2934
- focused && !focusedRef.current && (ref.current && ref.current.focus(), focusedRef.current = !0);
2935
- }, t6 = [focused], $[15] = focused, $[16] = t5, $[17] = t6) : (t5 = $[16], t6 = $[17]), useEffect(t5, t6);
2936
- const t7 = selected ? "true" : "false", t8 = selected ? 0 : -1;
2937
- let t9;
2938
- return $[18] !== fontSize || $[19] !== handleFocus || $[20] !== icon || $[21] !== id || $[22] !== label2 || $[23] !== onClick || $[24] !== padding || $[25] !== restProps || $[26] !== selected || $[27] !== t7 || $[28] !== t8 ? (t9 = /* @__PURE__ */ jsx(Button, { "data-ui": "Tab", ...restProps, "aria-selected": t7, fontSize, icon, id, mode: "bleed", onClick, onBlur: handleBlur, onFocus: handleFocus, padding, ref, role: "tab", selected, tabIndex: t8, text: label2, type: "button" }), $[18] = fontSize, $[19] = handleFocus, $[20] = icon, $[21] = id, $[22] = label2, $[23] = onClick, $[24] = padding, $[25] = restProps, $[26] = selected, $[27] = t7, $[28] = t8, $[29] = t9) : t9 = $[29], t9;
2939
- });
2940
- Tab.displayName = "ForwardRef(Tab)";
2941
- function _isReactElement(node) {
2942
- return !!node;
2943
- }
2944
- const TabList = forwardRef(function(props, ref) {
2945
- const $ = c(15);
2946
- let childrenProp, restProps;
2947
- $[0] !== props ? ({
2948
- children: childrenProp,
2949
- ...restProps
2950
- } = props, $[0] = props, $[1] = childrenProp, $[2] = restProps) : (childrenProp = $[1], restProps = $[2]);
2951
- const [focusedIndex, setFocusedIndex] = useState(-1);
2952
- let t0;
2953
- if ($[3] !== childrenProp || $[4] !== focusedIndex) {
2954
- const children = Children.toArray(childrenProp).filter(_isReactElement);
2955
- let t12;
2956
- $[6] !== focusedIndex ? (t12 = (child, childIndex) => cloneElement(child, {
2957
- focused: focusedIndex === childIndex,
2958
- key: childIndex,
2959
- onFocus: () => setFocusedIndex(childIndex)
2960
- }), $[6] = focusedIndex, $[7] = t12) : t12 = $[7], t0 = children.map(t12), $[3] = childrenProp, $[4] = focusedIndex, $[5] = t0;
2961
- } else
2962
- t0 = $[5];
2963
- const tabs = t0, numTabs = tabs.length;
2964
- let t1;
2965
- $[8] !== numTabs ? (t1 = (event) => {
2966
- event.key === "ArrowLeft" && setFocusedIndex((prevIndex) => (prevIndex + numTabs - 1) % numTabs), event.key === "ArrowRight" && setFocusedIndex((prevIndex_0) => (prevIndex_0 + 1) % numTabs);
2967
- }, $[8] = numTabs, $[9] = t1) : t1 = $[9];
2968
- const handleKeyDown = t1;
2969
- let t2;
2970
- return $[10] !== handleKeyDown || $[11] !== ref || $[12] !== restProps || $[13] !== tabs ? (t2 = /* @__PURE__ */ jsx(Inline, { "data-ui": "TabList", ...restProps, onKeyDown: handleKeyDown, ref, role: "tablist", children: tabs }), $[10] = handleKeyDown, $[11] = ref, $[12] = restProps, $[13] = tabs, $[14] = t2) : t2 = $[14], t2;
2971
- });
2972
- TabList.displayName = "ForwardRef(TabList)";
2973
- export {
2974
- AnimatedSpinnerIcon,
2975
- Arrow,
2976
- Avatar,
2977
- AvatarCounter,
2978
- AvatarStack,
2979
- Badge,
2980
- BoundaryElementProvider,
2981
- Box,
2982
- Button,
2983
- Card,
2984
- Checkbox,
2985
- Code,
2986
- ConditionalWrapper,
2987
- Container,
2988
- EMPTY_ARRAY,
2989
- EMPTY_RECORD,
2990
- ElementQuery,
2991
- Flex,
2992
- Grid,
2993
- Heading,
2994
- Hotkeys,
2995
- Inline,
2996
- KBD,
2997
- Label,
2998
- Layer,
2999
- LayerProvider,
3000
- Menu,
3001
- MenuDivider,
3002
- MenuGroup,
3003
- MenuItem,
3004
- Popover,
3005
- Portal,
3006
- PortalProvider,
3007
- Radio,
3008
- Select,
3009
- Selectable,
3010
- Spinner,
3011
- SrOnly,
3012
- Stack,
3013
- Switch,
3014
- Tab,
3015
- TabList,
3016
- Text,
3017
- TextArea,
3018
- TextInput,
3019
- ThemeColorProvider,
3020
- ThemeProvider,
3021
- Tooltip,
3022
- TooltipDelayGroupContext,
3023
- TooltipDelayGroupProvider,
3024
- VirtualList,
3025
- _ResizeObserver,
3026
- _elementSizeObserver,
3027
- _getArrayProp,
3028
- _isEnterToClickElement,
3029
- _isScrollable,
3030
- containsOrEqualsElement,
3031
- createColorTheme,
3032
- createGlobalScopedContext,
3033
- hexToRgb,
3034
- hslToRgb,
3035
- isHTMLAnchorElement,
3036
- isHTMLButtonElement,
3037
- isHTMLElement,
3038
- isHTMLInputElement,
3039
- isHTMLSelectElement,
3040
- isHTMLTextAreaElement,
3041
- isRecord,
3042
- multiply,
3043
- parseColor,
3044
- rgbToHex,
3045
- rgbToHsl,
3046
- rgba,
3047
- screen,
3048
- studioTheme,
3049
- useArrayProp,
3050
- useBoundaryElement,
3051
- useClickOutsideEvent,
3052
- useCustomValidity,
3053
- useElementSize,
3054
- useGlobalKeyDown,
3055
- useLayer,
3056
- useMatchMedia,
3057
- useMediaIndex,
3058
- usePortal,
3059
- usePrefersDark,
3060
- usePrefersReducedMotion,
3061
- useRootTheme,
3062
- useTheme,
3063
- useTheme_v2,
3064
- useTooltipDelayGroup
3065
- };
3066
- //# sourceMappingURL=_visual-editing.mjs.map