@sanity/ui 3.0.0-static.4 → 3.0.0-static.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -9
- package/dist/_chunks-cjs/_visual-editing.cjs +2250 -0
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -0
- package/dist/_chunks-cjs/refractor.cjs +26 -0
- package/dist/_chunks-cjs/refractor.cjs.map +1 -0
- package/dist/_chunks-es/_visual-editing.js +2261 -0
- package/dist/_chunks-es/_visual-editing.js.map +1 -0
- package/dist/_chunks-es/refractor.js +25 -0
- package/dist/_chunks-es/refractor.js.map +1 -0
- package/dist/_visual-editing.cjs +28 -0
- package/dist/_visual-editing.cjs.map +1 -0
- package/dist/_visual-editing.d.cts +853 -0
- package/dist/_visual-editing.d.ts +503 -458
- package/dist/_visual-editing.js +27 -30
- package/dist/_visual-editing.js.map +1 -1
- package/dist/css/index.cjs +957 -0
- package/dist/css/index.cjs.map +1 -0
- package/dist/css/index.css +1 -0
- package/dist/css/index.d.cts +1352 -0
- package/dist/css/index.d.ts +1352 -0
- package/dist/css/index.js +959 -0
- package/dist/css/index.js.map +1 -0
- package/dist/index.cjs +2348 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2512 -0
- package/dist/index.d.ts +1320 -1677
- package/dist/index.js +1576 -766
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +870 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +499 -0
- package/dist/theme.d.ts +301 -1643
- package/dist/theme.js +487 -2555
- package/dist/theme.js.map +1 -1
- package/exports/_visual-editing.ts +24 -27
- package/exports/index.ts +1 -1
- package/package.json +79 -92
- package/src/core/Root.tsx +88 -0
- package/src/core/RootProvider.tsx +40 -0
- package/src/core/__workshop__/boundary.tsx +28 -0
- package/src/core/__workshop__/index.ts +16 -0
- package/src/core/components/autocomplete/__workshop__/async.tsx +156 -0
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +131 -0
- package/src/core/components/autocomplete/__workshop__/custom.tsx +91 -0
- package/src/core/components/autocomplete/__workshop__/example.tsx +80 -0
- package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +36 -0
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +292 -0
- package/src/core/components/autocomplete/__workshop__/index.ts +41 -0
- package/src/core/components/autocomplete/__workshop__/mock/apiStore.ts +49 -0
- package/src/core/components/autocomplete/__workshop__/mock/countries.ts +245 -0
- package/src/core/components/autocomplete/autocomplete.tsx +690 -0
- package/src/core/components/autocomplete/autocompleteOption.tsx +45 -0
- package/src/core/components/autocomplete/autocompleteReducer.ts +47 -0
- package/src/core/components/autocomplete/constants.ts +28 -0
- package/src/core/components/autocomplete/types.ts +103 -0
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +61 -0
- package/src/core/components/breadcrumbs/__workshop__/index.ts +16 -0
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +131 -0
- package/src/core/components/dialog/__workshop__/activate.tsx +141 -0
- package/src/core/components/dialog/__workshop__/autoFocus.tsx +29 -0
- package/src/core/components/dialog/__workshop__/index.ts +21 -0
- package/src/core/components/dialog/__workshop__/layering.tsx +41 -0
- package/src/core/components/dialog/__workshop__/nested.tsx +71 -0
- package/src/core/components/dialog/__workshop__/onScroll.tsx +51 -0
- package/src/core/components/dialog/__workshop__/panes.tsx +89 -0
- package/src/core/components/dialog/__workshop__/position.tsx +30 -0
- package/src/core/components/dialog/__workshop__/props.tsx +77 -0
- package/src/core/components/dialog/__workshop__/provider.tsx +11 -0
- package/src/core/components/dialog/__workshop__/wrapped.tsx +76 -0
- package/src/core/components/dialog/dialog.tsx +232 -0
- package/src/core/components/dialog/dialogCard.tsx +233 -0
- package/src/core/components/dialog/dialogContext.ts +21 -0
- package/src/core/components/dialog/dialogProvider.tsx +34 -0
- package/src/core/components/dialog/isTargetWithinScope.ts +14 -0
- package/src/core/components/dialog/types.ts +2 -0
- package/src/core/components/dialog/useDialog.ts +11 -0
- package/src/core/components/hotkeys/__workshop__/index.ts +16 -0
- package/src/core/components/hotkeys/__workshop__/plain.tsx +9 -0
- package/src/core/components/hotkeys/hotkeys.tsx +60 -0
- package/src/core/components/menu/__workshop__/asComponent.tsx +45 -0
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +57 -0
- package/src/core/components/menu/__workshop__/closableMenuButton.tsx +47 -0
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +133 -0
- package/src/core/components/menu/__workshop__/customMenuItem.tsx +45 -0
- package/src/core/components/menu/__workshop__/customSelectedState.tsx +35 -0
- package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +40 -0
- package/src/core/components/menu/__workshop__/groups.tsx +156 -0
- package/src/core/components/menu/__workshop__/index.ts +91 -0
- package/src/core/components/menu/__workshop__/menuButton.tsx +80 -0
- package/src/core/components/menu/__workshop__/menuGroupRight.tsx +65 -0
- package/src/core/components/menu/__workshop__/nestedMenu.tsx +22 -0
- package/src/core/components/menu/__workshop__/onCloseMenuButton.tsx +50 -0
- package/src/core/components/menu/__workshop__/selectedItem.tsx +69 -0
- package/src/core/components/menu/__workshop__/shouldFocus.tsx +42 -0
- package/src/core/components/menu/__workshop__/tones.tsx +25 -0
- package/src/core/components/menu/__workshop__/withoutArrow.tsx +32 -0
- package/src/core/components/menu/helpers.ts +82 -0
- package/src/core/components/menu/menu.test.tsx +129 -0
- package/src/core/components/menu/menu.tsx +179 -0
- package/src/core/components/menu/menuButton.tsx +225 -0
- package/src/core/components/menu/menuContext.ts +19 -0
- package/src/core/components/menu/menuDivider.tsx +32 -0
- package/src/core/components/menu/menuGroup.tsx +233 -0
- package/src/core/components/menu/menuItem.tsx +183 -0
- package/src/core/components/menu/useMenu.ts +21 -0
- package/src/core/components/menu/useMenuController.ts +241 -0
- package/src/core/components/tab/__workshop__/example.tsx +79 -0
- package/src/core/components/tab/__workshop__/index.ts +16 -0
- package/src/core/components/tab/tab.tsx +109 -0
- package/src/core/components/tab/tabList.tsx +90 -0
- package/src/core/components/tab/tabPanel.tsx +47 -0
- package/src/core/components/toast/__workshop__/hook.tsx +71 -0
- package/src/core/components/toast/__workshop__/index.ts +21 -0
- package/src/core/components/toast/__workshop__/toast.tsx +26 -0
- package/src/core/components/toast/toast.test.tsx +103 -0
- package/src/core/components/toast/toast.tsx +189 -0
- package/src/core/components/toast/toastContext.ts +7 -0
- package/src/core/components/toast/toastLayer.tsx +54 -0
- package/src/core/components/toast/toastProvider.tsx +112 -0
- package/src/core/components/toast/types.ts +24 -0
- package/src/core/components/toast/useToast.ts +23 -0
- package/src/core/components/tree/__workshop__/basic.perf.ts +19 -0
- package/src/core/components/tree/__workshop__/basic.tsx +105 -0
- package/src/core/components/tree/__workshop__/index.ts +23 -0
- package/src/core/components/tree/__workshop__/tabFromElement.tsx +84 -0
- package/src/core/components/tree/helpers.ts +105 -0
- package/src/core/components/tree/tree.tsx +248 -0
- package/src/core/components/tree/treeContext.ts +10 -0
- package/src/core/components/tree/treeGroup.tsx +46 -0
- package/src/core/components/tree/treeItem.tsx +237 -0
- package/src/core/components/tree/types.ts +24 -0
- package/src/core/components/tree/useTree.ts +17 -0
- package/src/core/components/virtualList/__workshop__/changingProps.tsx +36 -0
- package/src/core/components/virtualList/__workshop__/elementScroll.tsx +24 -0
- package/src/core/components/virtualList/__workshop__/index.ts +31 -0
- package/src/core/components/virtualList/__workshop__/infiniteList.tsx +48 -0
- package/src/core/components/virtualList/__workshop__/windowScrolll.tsx +22 -0
- package/src/core/components/virtualList/virtualList.tsx +209 -0
- package/src/core/constants.ts +67 -0
- package/src/core/helpers/focus.ts +92 -0
- package/src/core/helpers/props.ts +28 -0
- package/src/core/hooks/useClickOutsideEvent.test.tsx +114 -0
- package/src/core/hooks/useClickOutsideEvent.ts +67 -0
- package/src/core/hooks/useDelayed.test.ts +67 -0
- package/src/core/hooks/useDelayedState.ts +28 -0
- package/src/core/hooks/useElementSize.ts +19 -0
- package/src/core/hooks/useMediaIndex/__workshop__/index.ts +16 -0
- package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +14 -0
- package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +21 -0
- package/src/core/hooks/useMediaIndex/useMediaIndex.ts +107 -0
- package/src/core/hooks/usePrefersDark.hydration.test.tsx +56 -0
- package/src/core/hooks/usePrefersDark.test.tsx +20 -0
- package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +56 -0
- package/src/core/hooks/usePrefersReducedMotion.test.tsx +20 -0
- package/src/core/hooks/useResponsiveProp.ts +28 -0
- package/src/core/index.ts +115 -0
- package/src/core/lib/createGlobalScopedContext.ts +37 -0
- package/src/core/lib/globalScope.ts +19 -0
- package/src/core/lib/isArray.ts +3 -0
- package/src/core/middleware/origin.ts +47 -0
- package/src/core/observers/elementSize.ts +116 -0
- package/src/core/primitives/arrow/arrow.tsx +74 -0
- package/src/core/primitives/avatar/__workshop__/asButton.tsx +14 -0
- package/src/core/primitives/avatar/__workshop__/index.ts +31 -0
- package/src/core/primitives/avatar/__workshop__/stack.tsx +25 -0
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +55 -0
- package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +72 -0
- package/src/core/primitives/avatar/avatar.tsx +147 -0
- package/src/core/primitives/avatar/avatarCounter.tsx +69 -0
- package/src/core/primitives/avatar/avatarStack.tsx +79 -0
- package/src/core/primitives/avatar/types.ts +2 -0
- package/src/core/primitives/badge/__workshop__/index.ts +21 -0
- package/src/core/primitives/badge/__workshop__/props.tsx +19 -0
- package/src/core/primitives/badge/__workshop__/tones.tsx +16 -0
- package/src/core/primitives/badge/badge.test.tsx +16 -0
- package/src/core/primitives/badge/badge.tsx +61 -0
- package/src/core/primitives/box/__workshop__/index.ts +21 -0
- package/src/core/primitives/box/__workshop__/props.tsx +20 -0
- package/src/core/primitives/box/__workshop__/responsive.tsx +20 -0
- package/src/core/primitives/box/box.tsx +215 -0
- package/src/core/primitives/button/__workshop__/custom.tsx +27 -0
- package/src/core/primitives/button/__workshop__/customIcons.tsx +30 -0
- package/src/core/primitives/button/__workshop__/disabled.tsx +54 -0
- package/src/core/primitives/button/__workshop__/index.ts +66 -0
- package/src/core/primitives/button/__workshop__/mixedChildren.tsx +12 -0
- package/src/core/primitives/button/__workshop__/props.tsx +55 -0
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +36 -0
- package/src/core/primitives/button/__workshop__/stacked.tsx +58 -0
- package/src/core/primitives/button/__workshop__/styled1.tsx +17 -0
- package/src/core/primitives/button/__workshop__/styled2.tsx +19 -0
- package/src/core/primitives/button/__workshop__/textOverflow.tsx +13 -0
- package/src/core/primitives/button/__workshop__/uploadButton.tsx +29 -0
- package/src/core/primitives/button/button.test.tsx +30 -0
- package/src/core/primitives/button/button.tsx +193 -0
- package/src/core/primitives/button/types.ts +2 -0
- package/src/core/primitives/card/__workshop__/asButton.tsx +107 -0
- package/src/core/primitives/card/__workshop__/asComponent.tsx +27 -0
- package/src/core/primitives/card/__workshop__/checkered.tsx +26 -0
- package/src/core/primitives/card/__workshop__/index.ts +20 -0
- package/src/core/primitives/card/__workshop__/interactive.tsx +29 -0
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +78 -0
- package/src/core/primitives/card/__workshop__/props.tsx +52 -0
- package/src/core/primitives/card/__workshop__/selected.tsx +62 -0
- package/src/core/primitives/card/__workshop__/styled.tsx +14 -0
- package/src/core/primitives/card/__workshop__/tones.tsx +27 -0
- package/src/core/primitives/card/card.tsx +109 -0
- package/src/core/primitives/card/cardContext.ts +10 -0
- package/src/core/primitives/card/cardProvider.tsx +27 -0
- package/src/core/primitives/card/types.ts +17 -0
- package/src/core/primitives/card/useCard.ts +15 -0
- package/src/core/primitives/checkbox/__workshop__/example.tsx +25 -0
- package/src/core/primitives/checkbox/__workshop__/index.ts +15 -0
- package/src/core/primitives/checkbox/__workshop__/props.tsx +35 -0
- package/src/core/primitives/checkbox/__workshop__/readOnly.tsx +16 -0
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +27 -0
- package/src/core/primitives/checkbox/checkbox.tsx +80 -0
- package/src/core/primitives/code/__workshop__/index.ts +21 -0
- package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +23 -0
- package/src/core/primitives/code/__workshop__/props.tsx +18 -0
- package/src/core/primitives/code/code.tsx +48 -0
- package/src/core/primitives/code/refractor.tsx +18 -0
- package/src/core/primitives/container/__workshop__/example.tsx +20 -0
- package/src/core/primitives/container/__workshop__/index.ts +10 -0
- package/src/core/primitives/container/container.tsx +37 -0
- package/src/core/primitives/flex/__workshop__/example.tsx +34 -0
- package/src/core/primitives/flex/__workshop__/gap.tsx +25 -0
- package/src/core/primitives/flex/__workshop__/index.ts +13 -0
- package/src/core/primitives/flex/flex.tsx +58 -0
- package/src/core/primitives/grid/__workshop__/index.ts +12 -0
- package/src/core/primitives/grid/__workshop__/responsive.tsx +54 -0
- package/src/core/primitives/grid/grid.tsx +35 -0
- package/src/core/primitives/heading/__workshop__/index.ts +21 -0
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +54 -0
- package/src/core/primitives/heading/__workshop__/plain.tsx +29 -0
- package/src/core/primitives/heading/heading.tsx +78 -0
- package/src/core/primitives/inline/__workshop__/index.ts +10 -0
- package/src/core/primitives/inline/__workshop__/plain.tsx +24 -0
- package/src/core/primitives/inline/inline.tsx +62 -0
- package/src/core/primitives/kbd/__workshop__/index.ts +10 -0
- package/src/core/primitives/kbd/__workshop__/plain.tsx +9 -0
- package/src/core/primitives/kbd/kbd.tsx +57 -0
- package/src/core/primitives/label/__workshop__/index.ts +21 -0
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +54 -0
- package/src/core/primitives/label/__workshop__/plain.tsx +28 -0
- package/src/core/primitives/label/label.tsx +75 -0
- package/src/core/primitives/layer/__workshop__/_debug.tsx +17 -0
- package/src/core/primitives/layer/__workshop__/index.ts +26 -0
- package/src/core/primitives/layer/__workshop__/multipleRoots.tsx +49 -0
- package/src/core/primitives/layer/__workshop__/nested.tsx +98 -0
- package/src/core/primitives/layer/__workshop__/responsiveZOffset.tsx +17 -0
- package/src/core/primitives/layer/getLayerContext.test.ts +32 -0
- package/src/core/primitives/layer/getLayerContext.ts +21 -0
- package/src/core/primitives/layer/layer.test.tsx +110 -0
- package/src/core/primitives/layer/layer.tsx +42 -0
- package/src/core/primitives/layer/layerCard.tsx +90 -0
- package/src/core/primitives/layer/layerContext.ts +7 -0
- package/src/core/primitives/layer/layerProvider.tsx +106 -0
- package/src/core/primitives/layer/useLayer.ts +24 -0
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +77 -0
- package/src/core/primitives/popover/__workshop__/MarginsStory.tsx +31 -0
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +32 -0
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +11 -0
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +71 -0
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +69 -0
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +96 -0
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +100 -0
- package/src/core/primitives/popover/__workshop__/index.ts +51 -0
- package/src/core/primitives/popover/constants.ts +22 -0
- package/src/core/primitives/popover/floating-ui/size.ts +83 -0
- package/src/core/primitives/popover/helpers.ts +32 -0
- package/src/core/primitives/popover/popover.tsx +442 -0
- package/src/core/primitives/popover/popoverLayer.tsx +149 -0
- package/src/core/primitives/popover/types.ts +12 -0
- package/src/core/primitives/radio/__workshop__/example.tsx +63 -0
- package/src/core/primitives/radio/__workshop__/index.ts +13 -0
- package/src/core/primitives/radio/__workshop__/plain.tsx +28 -0
- package/src/core/primitives/radio/radio.tsx +64 -0
- package/src/core/primitives/select/__workshop__/index.ts +13 -0
- package/src/core/primitives/select/__workshop__/plain.tsx +39 -0
- package/src/core/primitives/select/__workshop__/readOnly.tsx +23 -0
- package/src/core/primitives/select/select.tsx +75 -0
- package/src/core/primitives/selectable/selectable.tsx +50 -0
- package/src/core/primitives/skeleton/__workshop__/delay.tsx +70 -0
- package/src/core/primitives/skeleton/__workshop__/index.ts +13 -0
- package/src/core/primitives/skeleton/__workshop__/skeleton.tsx +64 -0
- package/src/core/primitives/skeleton/codeSkeleton.tsx +49 -0
- package/src/core/primitives/skeleton/headingSkeleton.tsx +48 -0
- package/src/core/primitives/skeleton/labelSkeleton.tsx +47 -0
- package/src/core/primitives/skeleton/skeleton.tsx +71 -0
- package/src/core/primitives/skeleton/textSkeleton.tsx +49 -0
- package/src/core/primitives/spinner/__workshop__/Props.tsx +15 -0
- package/src/core/primitives/spinner/__workshop__/index.ts +16 -0
- package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +14 -0
- package/src/core/primitives/spinner/spinner.tsx +45 -0
- package/src/core/primitives/srOnly/srOnly.tsx +33 -0
- package/src/core/primitives/stack/__workshop__/index.ts +16 -0
- package/src/core/primitives/stack/__workshop__/plain.tsx +32 -0
- package/src/core/primitives/stack/stack.tsx +60 -0
- package/src/core/primitives/switch/__workshop__/example.tsx +23 -0
- package/src/core/primitives/switch/__workshop__/index.ts +13 -0
- package/src/core/primitives/switch/__workshop__/props.tsx +21 -0
- package/src/core/primitives/switch/switch.tsx +84 -0
- package/src/core/primitives/text/__workshop__/colored.tsx +23 -0
- package/src/core/primitives/text/__workshop__/example.tsx +28 -0
- package/src/core/primitives/text/__workshop__/index.ts +26 -0
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +23 -0
- package/src/core/primitives/text/text.tsx +74 -0
- package/src/core/primitives/textArea/__workshop__/index.ts +16 -0
- package/src/core/primitives/textArea/__workshop__/plain.tsx +61 -0
- package/src/core/primitives/textArea/textArea.tsx +84 -0
- package/src/core/primitives/textInput/__workshop__/clearButton.tsx +30 -0
- package/src/core/primitives/textInput/__workshop__/customValidity.tsx +17 -0
- package/src/core/primitives/textInput/__workshop__/index.ts +46 -0
- package/src/core/primitives/textInput/__workshop__/plain.tsx +110 -0
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +9 -0
- package/src/core/primitives/textInput/__workshop__/states.tsx +53 -0
- package/src/core/primitives/textInput/__workshop__/tones.tsx +277 -0
- package/src/core/primitives/textInput/__workshop__/typed.tsx +23 -0
- package/src/core/primitives/textInput/textInput.tsx +258 -0
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +102 -0
- package/src/core/primitives/tooltip/__workshop__/index.ts +31 -0
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +74 -0
- package/src/core/primitives/tooltip/__workshop__/props.tsx +112 -0
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +86 -0
- package/src/core/primitives/tooltip/constants.ts +23 -0
- package/src/core/primitives/tooltip/tooltip.test.tsx +452 -0
- package/src/core/primitives/tooltip/tooltip.tsx +482 -0
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +13 -0
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +55 -0
- package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +13 -0
- package/src/core/primitives/tooltip/tooltipLayer.tsx +106 -0
- package/src/core/types.ts +56 -0
- package/src/core/utils/boundaryElement/__workshop__/index.ts +16 -0
- package/src/core/utils/boundaryElement/__workshop__/plain.tsx +19 -0
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +102 -0
- package/src/core/utils/boundaryElement/boundaryElementContext.ts +10 -0
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +18 -0
- package/src/core/utils/boundaryElement/types.ts +5 -0
- package/src/core/utils/boundaryElement/useBoundaryElement.ts +24 -0
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +41 -0
- package/src/core/utils/elementQuery/__workshop__/index.ts +16 -0
- package/src/core/utils/elementQuery/elementQuery.tsx +75 -0
- package/src/core/utils/errorBoundary.tsx +50 -0
- package/src/core/utils/getElementRef.ts +29 -0
- package/src/core/utils/portal/__workshop__/index.ts +16 -0
- package/src/core/utils/portal/__workshop__/named.tsx +63 -0
- package/src/core/utils/portal/portal.test.tsx +105 -0
- package/src/core/utils/portal/portal.tsx +36 -0
- package/src/core/utils/portal/portalContext.ts +37 -0
- package/src/core/utils/portal/portalProvider.tsx +69 -0
- package/src/core/utils/portal/types.ts +7 -0
- package/src/core/utils/portal/usePortal.ts +23 -0
- package/src/css/_assign.ts +3 -0
- package/src/css/_composeClassNames.ts +12 -0
- package/src/css/_fromEntries.ts +3 -0
- package/src/css/_getClassNames.ts +9 -0
- package/src/css/_responsiveClassName.ts +45 -0
- package/src/css/_responsiveStyle.css.ts +34 -0
- package/src/css/_style.css.ts +9 -0
- package/src/css/components/breadcrumbs/breadcrumbs.css.ts +6 -0
- package/src/css/components/breadcrumbs/breadcrumbs.ts +5 -3
- package/src/css/components/dialog/dialog.css.ts +98 -0
- package/src/css/components/dialog/dialog.ts +42 -14
- package/src/css/components/menu/menu.css.ts +14 -0
- package/src/css/components/menu/menu.ts +8 -5
- package/src/css/components/skeleton/skeleton.css.ts +128 -0
- package/src/css/components/skeleton/skeleton.ts +16 -9
- package/src/css/components/skeleton/types.ts +16 -6
- package/src/css/components/toast/toast.css.ts +17 -0
- package/src/css/components/toast/toast.ts +7 -17
- package/src/css/components/tree/tree.css.ts +65 -0
- package/src/css/components/tree/tree.ts +5 -3
- package/src/css/constants.ts +10 -1
- package/src/css/index.ts +142 -40
- package/src/css/layers.css.ts +12 -0
- package/src/css/primitives/_arrow/_arrow.css.ts +68 -0
- package/src/css/primitives/_arrow/_arrow.ts +16 -4
- package/src/css/primitives/_input/_input.css.ts +261 -0
- package/src/css/primitives/_input/input.ts +16 -12
- package/src/css/primitives/_input/types.ts +4 -3
- package/src/css/primitives/avatar/avatar.css.ts +198 -0
- package/src/css/primitives/avatar/avatar.ts +52 -11
- package/src/css/primitives/avatar/types.ts +5 -3
- package/src/css/primitives/badge/badge.css.ts +27 -0
- package/src/css/primitives/badge/badge.ts +4 -4
- package/src/css/primitives/badge/types.ts +9 -4
- package/src/css/primitives/box/box.css.ts +19 -0
- package/src/css/primitives/box/box.ts +63 -34
- package/src/css/primitives/box/types.ts +56 -30
- package/src/css/primitives/button/button.css.ts +287 -0
- package/src/css/primitives/button/button.ts +18 -33
- package/src/css/primitives/button/types.ts +12 -0
- package/src/css/primitives/card/__workshop__/color.tsx +75 -0
- package/src/css/primitives/card/__workshop__/index.ts +16 -0
- package/src/css/primitives/card/card.css.ts +387 -0
- package/src/css/primitives/card/card.ts +9 -10
- package/src/css/primitives/card/types.ts +6 -8
- package/src/css/primitives/checkbox/checkbox.css.ts +193 -0
- package/src/css/primitives/checkbox/checkbox.ts +13 -5
- package/src/css/primitives/code/code.css.ts +272 -0
- package/src/css/primitives/code/code.ts +15 -5
- package/src/css/primitives/code/types.ts +7 -6
- package/src/css/primitives/container/container.css.ts +4 -0
- package/src/css/primitives/container/container.ts +14 -4
- package/src/css/primitives/container/types.ts +4 -2
- package/src/css/primitives/heading/heading.css.ts +86 -0
- package/src/css/primitives/heading/heading.ts +16 -11
- package/src/css/primitives/heading/types.ts +9 -7
- package/src/css/primitives/kbd/kbd.css.ts +16 -0
- package/src/css/primitives/kbd/kbd.ts +6 -4
- package/src/css/primitives/kbd/types.ts +2 -3
- package/src/css/primitives/label/label.css.ts +87 -0
- package/src/css/primitives/label/label.ts +16 -10
- package/src/css/primitives/label/types.ts +9 -7
- package/src/css/primitives/popover/popover.css.ts +6 -0
- package/src/css/primitives/popover/popover.ts +10 -3
- package/src/css/primitives/radio/radio.css.ts +78 -0
- package/src/css/primitives/radio/radio.ts +15 -3
- package/src/css/primitives/root/root.css.ts +19 -0
- package/src/css/primitives/root/root.ts +17 -0
- package/src/css/primitives/root/types.ts +10 -0
- package/src/css/primitives/select/select.css.ts +24 -0
- package/src/css/primitives/select/select.ts +8 -6
- package/src/css/primitives/select/types.ts +1 -1
- package/src/css/primitives/selectable/selectable.css.ts +131 -0
- package/src/css/primitives/selectable/selectable.ts +9 -0
- package/src/css/primitives/selectable/types.ts +9 -0
- package/src/css/primitives/spinner/spinner.css.ts +19 -0
- package/src/css/primitives/spinner/spinner.ts +9 -5
- package/src/css/primitives/spinner/types.ts +4 -0
- package/src/css/primitives/srOnly/srOnly.css.ts +10 -0
- package/src/css/primitives/srOnly/srOnly.ts +7 -0
- package/src/css/primitives/stack/stack.css.ts +6 -0
- package/src/css/primitives/stack/stack.ts +7 -0
- package/src/css/primitives/switch/switch.css.ts +98 -0
- package/src/css/primitives/switch/switch.ts +13 -7
- package/src/css/primitives/text/text.css.ts +86 -0
- package/src/css/primitives/text/text.ts +18 -11
- package/src/css/primitives/text/types.ts +12 -5
- package/src/css/primitives/textArea/textArea.css.ts +4 -0
- package/src/css/primitives/textArea/textArea.ts +6 -5
- package/src/css/primitives/textArea/types.ts +5 -3
- package/src/css/primitives/textInput/textInput.css.ts +41 -0
- package/src/css/primitives/textInput/textInput.ts +21 -5
- package/src/css/primitives/textInput/types.ts +3 -7
- package/src/css/primitives/tooltip/tooltip.css.ts +4 -0
- package/src/css/primitives/tooltip/tooltip.ts +6 -7
- package/src/css/primitives/tooltip/types.ts +4 -0
- package/src/css/props/alignItems/alignItems.css.ts +22 -0
- package/src/css/props/alignItems/alignItems.ts +8 -0
- package/src/css/props/alignItems/types.ts +9 -0
- package/src/css/props/border/border.css.ts +65 -0
- package/src/css/props/border/border.ts +21 -0
- package/src/css/props/border/types.ts +13 -0
- package/src/css/props/boxSizing/boxSizing.css.ts +12 -0
- package/src/css/props/boxSizing/boxSizing.ts +7 -0
- package/src/css/props/boxSizing/types.ts +7 -0
- package/src/css/props/display/display.css.ts +56 -0
- package/src/css/props/display/display.ts +8 -0
- package/src/css/props/display/types.ts +16 -0
- package/src/css/props/flex/flex.css.ts +52 -0
- package/src/css/props/flex/flex.ts +8 -0
- package/src/css/props/flex/types.ts +9 -0
- package/src/css/props/flexDirection/flexDirection.css.ts +19 -0
- package/src/css/props/flexDirection/flexDirection.ts +8 -0
- package/src/css/props/flexDirection/types.ts +9 -0
- package/src/css/props/flexWrap/flexWrap.css.ts +16 -0
- package/src/css/props/flexWrap/flexWrap.ts +8 -0
- package/src/css/props/flexWrap/types.ts +9 -0
- package/src/css/props/font/font.css.ts +94 -0
- package/src/css/props/font/font.ts +8 -0
- package/src/css/props/font/types.ts +6 -0
- package/src/css/props/gap/gap.css.ts +40 -0
- package/src/css/props/gap/gap.ts +13 -0
- package/src/css/props/gap/types.ts +10 -0
- package/src/css/props/gridAutoColumns/gridAutoColumns.css.ts +19 -0
- package/src/css/props/gridAutoColumns/gridAutoColumns.ts +8 -0
- package/src/css/props/gridAutoColumns/types.ts +9 -0
- package/src/css/props/gridAutoFlow/gridAutoFlow.css.ts +19 -0
- package/src/css/props/gridAutoFlow/gridAutoFlow.ts +8 -0
- package/src/css/props/gridAutoFlow/types.ts +9 -0
- package/src/css/props/gridAutoRows/gridAutoRows.css.ts +19 -0
- package/src/css/props/gridAutoRows/gridAutoRows.ts +8 -0
- package/src/css/props/gridAutoRows/types.ts +9 -0
- package/src/css/props/gridColumn/gridColumn.css.ts +49 -0
- package/src/css/props/gridColumn/gridColumn.ts +8 -0
- package/src/css/props/gridColumn/types.ts +9 -0
- package/src/css/props/gridColumnEnd/gridColumnEnd.css.ts +46 -0
- package/src/css/props/gridColumnEnd/gridColumnEnd.ts +8 -0
- package/src/css/props/gridColumnEnd/types.ts +9 -0
- package/src/css/props/gridColumnStart/gridColumnStart.css.ts +46 -0
- package/src/css/props/gridColumnStart/gridColumnStart.ts +8 -0
- package/src/css/props/gridColumnStart/types.ts +9 -0
- package/src/css/props/gridRow/gridRow.css.ts +49 -0
- package/src/css/props/gridRow/gridRow.ts +8 -0
- package/src/css/props/gridRow/types.ts +9 -0
- package/src/css/props/gridRowEnd/gridRowEnd.css.ts +46 -0
- package/src/css/props/gridRowEnd/gridRowEnd.ts +8 -0
- package/src/css/props/gridRowEnd/types.ts +9 -0
- package/src/css/props/gridRowStart/gridRowStart.css.ts +46 -0
- package/src/css/props/gridRowStart/gridRowStart.ts +8 -0
- package/src/css/props/gridRowStart/types.ts +9 -0
- package/src/css/props/gridTemplateColumns/gridTemplateColumns.css.ts +43 -0
- package/src/css/props/gridTemplateColumns/gridTemplateColumns.ts +8 -0
- package/src/css/props/gridTemplateColumns/types.ts +9 -0
- package/src/css/props/gridTemplateRows/gridTemplateRows.css.ts +43 -0
- package/src/css/props/gridTemplateRows/gridTemplateRows.ts +8 -0
- package/src/css/props/gridTemplateRows/types.ts +9 -0
- package/src/css/props/height/height.css.ts +25 -0
- package/src/css/props/height/height.ts +8 -0
- package/src/css/props/height/types.ts +9 -0
- package/src/css/props/inset/inset.css.ts +37 -0
- package/src/css/props/inset/inset.ts +21 -0
- package/src/css/props/inset/types.ts +13 -0
- package/src/css/props/justifyContent/justifyContent.css.ts +25 -0
- package/src/css/props/justifyContent/justifyContent.ts +8 -0
- package/src/css/props/justifyContent/types.ts +15 -0
- package/src/css/props/margin/margin.css.ts +117 -0
- package/src/css/props/margin/margin.ts +25 -0
- package/src/css/props/margin/types.ts +17 -0
- package/src/css/props/maxWidth/maxWidth.css.ts +32 -0
- package/src/css/props/maxWidth/maxWidth.ts +8 -0
- package/src/css/props/maxWidth/types.ts +11 -0
- package/src/css/props/minHeight/minHeight.css.ts +13 -0
- package/src/css/props/minHeight/minHeight.ts +8 -0
- package/src/css/props/minHeight/types.ts +9 -0
- package/src/css/props/minWidth/minWidth.css.ts +25 -0
- package/src/css/props/minWidth/minWidth.ts +8 -0
- package/src/css/props/minWidth/types.ts +9 -0
- package/src/css/props/outline/outline.css.ts +10 -0
- package/src/css/props/outline/outline.ts +8 -0
- package/src/css/props/outline/types.ts +7 -0
- package/src/css/props/overflow/overflow.css.ts +16 -0
- package/src/css/props/overflow/overflow.ts +8 -0
- package/src/css/props/overflow/types.ts +11 -0
- package/src/css/props/padding/padding.css.ts +87 -0
- package/src/css/props/padding/padding.ts +25 -0
- package/src/css/props/padding/types.ts +17 -0
- package/src/css/props/pointerEvents/pointerEvents.css.ts +13 -0
- package/src/css/props/pointerEvents/pointerEvents.ts +8 -0
- package/src/css/props/position/position.css.ts +22 -0
- package/src/css/props/position/position.ts +8 -0
- package/src/css/props/position/types.ts +9 -0
- package/src/css/props/radius/radius.css.ts +21 -0
- package/src/css/props/radius/radius.ts +8 -0
- package/src/css/props/radius/types.ts +8 -0
- package/src/css/props/shadow/shadow.css.ts +23 -0
- package/src/css/props/shadow/shadow.ts +8 -0
- package/src/css/props/shadow/types.ts +8 -0
- package/src/css/props/textAlign/textAlign.css.ts +22 -0
- package/src/css/props/textAlign/textAlign.ts +8 -0
- package/src/css/props/textAlign/types.ts +7 -0
- package/src/css/props/textOverflow/textOverflow.css.ts +19 -0
- package/src/css/props/textOverflow/textOverflow.ts +8 -0
- package/src/css/props/textOverflow/types.ts +12 -0
- package/src/css/props/width/types.ts +11 -0
- package/src/css/props/width/width.css.ts +31 -0
- package/src/css/props/width/width.ts +8 -0
- package/src/css/theme/buildCSSTheme.ts +485 -0
- package/src/css/theme/defaultTheme.css.ts +64 -0
- package/src/css/types.ts +349 -766
- package/src/css/vars.css.ts +673 -0
- package/src/theme/_parseColorToken.ts +180 -0
- package/src/theme/buildTheme.ts +32 -0
- package/src/theme/constants.ts +90 -0
- package/src/theme/defaults/color.ts +197 -0
- package/src/theme/defaults/common.ts +71 -0
- package/src/theme/defaults/fonts.ts +38 -16
- package/src/theme/index.ts +4 -10
- package/src/theme/merge.ts +24 -0
- package/src/theme/resolveTokens.ts +204 -0
- package/src/theme/types.ts +355 -21
- package/bin/ui.js +0 -5
- package/dist/_chunks-cjs/_visual-editing.js +0 -3088
- package/dist/_chunks-cjs/_visual-editing.js.map +0 -1
- package/dist/_chunks-cjs/buildCommand.js +0 -32
- package/dist/_chunks-cjs/buildCommand.js.map +0 -1
- package/dist/_chunks-cjs/refractor.js +0 -27
- package/dist/_chunks-cjs/refractor.js.map +0 -1
- package/dist/_chunks-cjs/v3_v2.js +0 -251
- package/dist/_chunks-cjs/v3_v2.js.map +0 -1
- package/dist/_chunks-es/_visual-editing.mjs +0 -3095
- package/dist/_chunks-es/_visual-editing.mjs.map +0 -1
- package/dist/_chunks-es/refractor.mjs +0 -26
- package/dist/_chunks-es/refractor.mjs.map +0 -1
- package/dist/_chunks-es/v3_v2.mjs +0 -252
- package/dist/_chunks-es/v3_v2.mjs.map +0 -1
- package/dist/_visual-editing.d.mts +0 -808
- package/dist/_visual-editing.mjs +0 -31
- package/dist/_visual-editing.mjs.map +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -357
- package/dist/cli.js.map +0 -1
- package/dist/css.d.mts +0 -2157
- package/dist/css.d.ts +0 -2157
- package/dist/css.js +0 -4746
- package/dist/css.js.map +0 -1
- package/dist/css.mjs +0 -4748
- package/dist/css.mjs.map +0 -1
- package/dist/index.d.mts +0 -2869
- package/dist/index.mjs +0 -1543
- package/dist/index.mjs.map +0 -1
- package/dist/sanity-palette.css +0 -1
- package/dist/sanity-theme.css +0 -1
- package/dist/system.css +0 -22813
- package/dist/theme.d.mts +0 -1841
- package/dist/theme.mjs +0 -2940
- package/dist/theme.mjs.map +0 -1
- package/src/cli/buildCommand.ts +0 -48
- package/src/cli/index.ts +0 -38
- package/src/css/_comp.test.ts +0 -7
- package/src/css/_comp.ts +0 -11
- package/src/css/_mergeStyles.ts +0 -31
- package/src/css/_resp.ts +0 -38
- package/src/css/_responsiveRule.ts +0 -38
- package/src/css/aspects/border/border.style.ts +0 -13
- package/src/css/aspects/border/border.ts +0 -14
- package/src/css/aspects/border/index.ts +0 -2
- package/src/css/aspects/border/types.ts +0 -10
- package/src/css/aspects/display/display.style.ts +0 -34
- package/src/css/aspects/display/display.ts +0 -7
- package/src/css/aspects/display/index.ts +0 -2
- package/src/css/aspects/display/types.ts +0 -17
- package/src/css/aspects/flex/flex.style.ts +0 -30
- package/src/css/aspects/flex/flex.ts +0 -13
- package/src/css/aspects/flex/flexAlign.style.ts +0 -12
- package/src/css/aspects/flex/flexDirection.style.ts +0 -11
- package/src/css/aspects/flex/flexJustify.style.ts +0 -13
- package/src/css/aspects/flex/flexWrap.style.ts +0 -10
- package/src/css/aspects/flex/index.ts +0 -2
- package/src/css/aspects/flex/types.ts +0 -35
- package/src/css/aspects/flexItem/flex.style.ts +0 -22
- package/src/css/aspects/flexItem/flexItem.ts +0 -8
- package/src/css/aspects/flexItem/index.ts +0 -2
- package/src/css/aspects/flexItem/types.ts +0 -27
- package/src/css/aspects/font/font.style.ts +0 -151
- package/src/css/aspects/font/font.ts +0 -12
- package/src/css/aspects/font/index.ts +0 -2
- package/src/css/aspects/font/types.ts +0 -12
- package/src/css/aspects/gap/gap.style.ts +0 -21
- package/src/css/aspects/gap/gap.ts +0 -8
- package/src/css/aspects/gap/index.ts +0 -2
- package/src/css/aspects/gap/types.ts +0 -10
- package/src/css/aspects/grid/grid.ts +0 -13
- package/src/css/aspects/grid/gridAutoColumns.style.ts +0 -11
- package/src/css/aspects/grid/gridAutoFlow.style.ts +0 -11
- package/src/css/aspects/grid/gridAutoRows.style.ts +0 -11
- package/src/css/aspects/grid/gridColumns.style.ts +0 -18
- package/src/css/aspects/grid/gridRows.style.ts +0 -18
- package/src/css/aspects/grid/index.ts +0 -2
- package/src/css/aspects/grid/types.ts +0 -29
- package/src/css/aspects/gridItem/gridColumn.style.ts +0 -20
- package/src/css/aspects/gridItem/gridColumnEnd.style.ts +0 -20
- package/src/css/aspects/gridItem/gridColumnStart.style.ts +0 -20
- package/src/css/aspects/gridItem/gridItem.ts +0 -15
- package/src/css/aspects/gridItem/gridRow.style.ts +0 -20
- package/src/css/aspects/gridItem/gridRowEnd.style.ts +0 -20
- package/src/css/aspects/gridItem/gridRowStart.style.ts +0 -20
- package/src/css/aspects/gridItem/index.ts +0 -2
- package/src/css/aspects/gridItem/types.ts +0 -41
- package/src/css/aspects/height/height.style.ts +0 -9
- package/src/css/aspects/height/height.ts +0 -17
- package/src/css/aspects/height/index.ts +0 -1
- package/src/css/aspects/height/rules.ts +0 -7
- package/src/css/aspects/index.ts +0 -20
- package/src/css/aspects/inset/index.ts +0 -2
- package/src/css/aspects/inset/inset.style.ts +0 -12
- package/src/css/aspects/inset/inset.ts +0 -13
- package/src/css/aspects/inset/types.ts +0 -13
- package/src/css/aspects/margin/index.ts +0 -2
- package/src/css/aspects/margin/margin.style.ts +0 -46
- package/src/css/aspects/margin/margin.ts +0 -15
- package/src/css/aspects/margin/types.ts +0 -11
- package/src/css/aspects/maxWidth/index.ts +0 -2
- package/src/css/aspects/maxWidth/maxWidth.style.ts +0 -16
- package/src/css/aspects/maxWidth/maxWidth.ts +0 -6
- package/src/css/aspects/maxWidth/types.ts +0 -7
- package/src/css/aspects/outline/outline.style.ts +0 -9
- package/src/css/aspects/overflow/index.ts +0 -2
- package/src/css/aspects/overflow/overflow.style.ts +0 -11
- package/src/css/aspects/overflow/overflow.ts +0 -11
- package/src/css/aspects/overflow/types.ts +0 -11
- package/src/css/aspects/padding/index.ts +0 -2
- package/src/css/aspects/padding/padding.style.ts +0 -46
- package/src/css/aspects/padding/padding.ts +0 -15
- package/src/css/aspects/padding/types.ts +0 -14
- package/src/css/aspects/pointerEvents/index.ts +0 -2
- package/src/css/aspects/pointerEvents/pointerEvents.style.ts +0 -13
- package/src/css/aspects/pointerEvents/pointerEvents.ts +0 -6
- package/src/css/aspects/position/index.ts +0 -2
- package/src/css/aspects/position/position.style.ts +0 -12
- package/src/css/aspects/position/position.ts +0 -7
- package/src/css/aspects/position/types.ts +0 -9
- package/src/css/aspects/radius/index.ts +0 -2
- package/src/css/aspects/radius/radius.style.ts +0 -16
- package/src/css/aspects/radius/radius.ts +0 -8
- package/src/css/aspects/radius/types.ts +0 -8
- package/src/css/aspects/shadow/index.ts +0 -2
- package/src/css/aspects/shadow/shadow.style.ts +0 -49
- package/src/css/aspects/shadow/shadow.ts +0 -7
- package/src/css/aspects/shadow/types.ts +0 -8
- package/src/css/aspects/textOverflow/index.ts +0 -2
- package/src/css/aspects/textOverflow/textOverflow.style.ts +0 -21
- package/src/css/aspects/textOverflow/textOverflow.ts +0 -6
- package/src/css/aspects/textOverflow/types.ts +0 -8
- package/src/css/aspects/width/index.ts +0 -2
- package/src/css/aspects/width/rules.ts +0 -8
- package/src/css/aspects/width/types.ts +0 -9
- package/src/css/aspects/width/width.style.ts +0 -11
- package/src/css/aspects/width/width.ts +0 -6
- package/src/css/compile/compilePalette.ts +0 -27
- package/src/css/compile/compileRule.ts +0 -96
- package/src/css/compile/compileRules.test.ts +0 -36
- package/src/css/compile/compileRules.ts +0 -43
- package/src/css/compile/compileStyle.ts +0 -148
- package/src/css/compile/compileSystem.ts +0 -10
- package/src/css/compile/compileTheme.ts +0 -15
- package/src/css/compile/compileTheme_v3.ts +0 -392
- package/src/css/compile/types.ts +0 -6
- package/src/css/components/breadcrumbs/breadcrumbs.style.ts +0 -9
- package/src/css/components/breadcrumbs/index.ts +0 -1
- package/src/css/components/breadcrumbs/rules.ts +0 -25
- package/src/css/components/dialog/dialog.style.ts +0 -79
- package/src/css/components/dialog/index.ts +0 -1
- package/src/css/components/dialog/rules.ts +0 -78
- package/src/css/components/menu/index.ts +0 -1
- package/src/css/components/menu/menu.style.ts +0 -17
- package/src/css/components/menu/rules.ts +0 -15
- package/src/css/components/skeleton/index.ts +0 -2
- package/src/css/components/skeleton/rules.ts +0 -113
- package/src/css/components/skeleton/skeleton.style.ts +0 -96
- package/src/css/components/toast/index.ts +0 -1
- package/src/css/components/toast/rules.ts +0 -18
- package/src/css/components/toast/toast.style.ts +0 -20
- package/src/css/components/tree/index.ts +0 -1
- package/src/css/components/tree/rules.ts +0 -168
- package/src/css/components/tree/tree.style.ts +0 -55
- package/src/css/composeClassNames.ts +0 -17
- package/src/css/primitives/_arrow/_arrow.style.ts +0 -73
- package/src/css/primitives/_arrow/index.ts +0 -1
- package/src/css/primitives/_input/__workshop__/customInput.tsx +0 -16
- package/src/css/primitives/_input/__workshop__/index.ts +0 -14
- package/src/css/primitives/_input/_input.style.ts +0 -162
- package/src/css/primitives/_input/index.ts +0 -2
- package/src/css/primitives/_selectable/__style.ts +0 -117
- package/src/css/primitives/_selectable/_contants.ts +0 -11
- package/src/css/primitives/_selectable/_selectable.style.ts +0 -132
- package/src/css/primitives/_selectable/index.ts +0 -2
- package/src/css/primitives/_selectable/selectable.ts +0 -9
- package/src/css/primitives/_selectable/types.ts +0 -8
- package/src/css/primitives/avatar/avatar.style.ts +0 -175
- package/src/css/primitives/avatar/index.ts +0 -2
- package/src/css/primitives/avatar/rules.ts +0 -176
- package/src/css/primitives/badge/badge.style.ts +0 -22
- package/src/css/primitives/badge/index.ts +0 -2
- package/src/css/primitives/box/box.style.ts +0 -31
- package/src/css/primitives/box/index.ts +0 -2
- package/src/css/primitives/button/_constants.ts +0 -17
- package/src/css/primitives/button/button.style.ts +0 -179
- package/src/css/primitives/button/index.ts +0 -1
- package/src/css/primitives/button/rules.ts +0 -302
- package/src/css/primitives/card/_constants.ts +0 -13
- package/src/css/primitives/card/card.style.ts +0 -198
- package/src/css/primitives/card/index.ts +0 -2
- package/src/css/primitives/card/rules.ts +0 -473
- package/src/css/primitives/checkbox/__styles.ts +0 -129
- package/src/css/primitives/checkbox/checkbox.style.ts +0 -154
- package/src/css/primitives/checkbox/index.ts +0 -1
- package/src/css/primitives/checkbox/rules.ts +0 -152
- package/src/css/primitives/code/code.style.ts +0 -62
- package/src/css/primitives/code/index.ts +0 -2
- package/src/css/primitives/code/rules.ts +0 -96
- package/src/css/primitives/container/container.style.ts +0 -10
- package/src/css/primitives/container/index.ts +0 -2
- package/src/css/primitives/container/rules.ts +0 -8
- package/src/css/primitives/heading/heading.style.ts +0 -47
- package/src/css/primitives/heading/index.ts +0 -2
- package/src/css/primitives/heading/rules.ts +0 -155
- package/src/css/primitives/kbd/index.ts +0 -2
- package/src/css/primitives/kbd/kbd.style.ts +0 -22
- package/src/css/primitives/kbd/rules.ts +0 -20
- package/src/css/primitives/label/index.ts +0 -2
- package/src/css/primitives/label/label.style.ts +0 -48
- package/src/css/primitives/label/rules.ts +0 -137
- package/src/css/primitives/popover/index.ts +0 -1
- package/src/css/primitives/popover/popover.style.ts +0 -5
- package/src/css/primitives/popover/rules.ts +0 -5
- package/src/css/primitives/radio/index.ts +0 -1
- package/src/css/primitives/radio/radio.style.ts +0 -123
- package/src/css/primitives/radio/rules.ts +0 -121
- package/src/css/primitives/select/index.ts +0 -2
- package/src/css/primitives/select/rules.ts +0 -22
- package/src/css/primitives/select/select.style.ts +0 -24
- package/src/css/primitives/spinner/index.ts +0 -1
- package/src/css/primitives/spinner/rules.ts +0 -21
- package/src/css/primitives/spinner/spinner.style.ts +0 -22
- package/src/css/primitives/switch/index.ts +0 -1
- package/src/css/primitives/switch/rules.ts +0 -340
- package/src/css/primitives/switch/switch.style.ts +0 -169
- package/src/css/primitives/text/index.ts +0 -2
- package/src/css/primitives/text/rules.ts +0 -164
- package/src/css/primitives/text/text.style.ts +0 -56
- package/src/css/primitives/textArea/index.ts +0 -2
- package/src/css/primitives/textArea/rules.ts +0 -7
- package/src/css/primitives/textArea/textArea.style.ts +0 -9
- package/src/css/primitives/textInput/index.ts +0 -2
- package/src/css/primitives/textInput/rules.ts +0 -224
- package/src/css/primitives/textInput/textInput.style.ts +0 -167
- package/src/css/primitives/token/rules.ts +0 -45
- package/src/css/primitives/token/token.style.ts +0 -49
- package/src/css/primitives/tooltip/index.ts +0 -1
- package/src/css/primitives/tooltip/rules.ts +0 -19
- package/src/css/primitives/tooltip/tooltip.style.ts +0 -21
- package/src/css/responsiveRules.ts +0 -25
- package/src/css/scopeClassName.ts +0 -6
- package/src/css/system.style.ts +0 -154
- package/src/css/util.ts +0 -27
- package/src/css/utils/srOnly/index.ts +0 -1
- package/src/css/utils/srOnly/srOnly.style.ts +0 -14
- package/src/css/utils/srOnly/srOnly.ts +0 -5
- package/src/css/varNames.ts +0 -486
- package/src/css/vars.ts +0 -456
- package/src/theme/_constants.ts +0 -26
- package/src/theme/_types.ts +0 -41
- package/src/theme/build/_deprecated/color/_selectable/createSelectableTones.ts +0 -76
- package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +0 -54
- package/src/theme/build/_deprecated/color/button/createButtonModes.ts +0 -17
- package/src/theme/build/_deprecated/color/button/createButtonTones.ts +0 -55
- package/src/theme/build/_deprecated/color/card/createCardStates.ts +0 -60
- package/src/theme/build/_deprecated/color/color.test.ts +0 -63
- package/src/theme/build/_deprecated/color/defaults.ts +0 -390
- package/src/theme/build/_deprecated/color/factory.ts +0 -141
- package/src/theme/build/_deprecated/color/index.ts +0 -1
- package/src/theme/build/_deprecated/color/input/createInputModes.ts +0 -81
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +0 -54
- package/src/theme/build/_deprecated/color/spot/createSpot.ts +0 -20
- package/src/theme/build/buildColorTheme.test.ts +0 -183
- package/src/theme/build/buildColorTheme.ts +0 -494
- package/src/theme/build/buildTheme.test.ts +0 -87
- package/src/theme/build/buildTheme.ts +0 -12
- package/src/theme/build/colorToken/colorToken.ts +0 -19
- package/src/theme/build/colorToken/compileColorToken.ts +0 -21
- package/src/theme/build/colorToken/index.ts +0 -2
- package/src/theme/build/colorToken/types.ts +0 -6
- package/src/theme/build/index.ts +0 -3
- package/src/theme/build/lib/color-fns/blend/index.ts +0 -3
- package/src/theme/build/lib/color-fns/blend/mix.ts +0 -21
- package/src/theme/build/lib/color-fns/blend/multiply.ts +0 -18
- package/src/theme/build/lib/color-fns/blend/screen.ts +0 -18
- package/src/theme/build/lib/color-fns/color-fns.test.ts +0 -68
- package/src/theme/build/lib/color-fns/contrastRatio.ts +0 -31
- package/src/theme/build/lib/color-fns/convert.ts +0 -150
- package/src/theme/build/lib/color-fns/index.ts +0 -6
- package/src/theme/build/lib/color-fns/parse.ts +0 -60
- package/src/theme/build/lib/color-fns/rgba.ts +0 -14
- package/src/theme/build/lib/color-fns/types.ts +0 -28
- package/src/theme/build/lib/utils.ts +0 -19
- package/src/theme/build/merge.ts +0 -26
- package/src/theme/build/mixThemeColor.test.ts +0 -21
- package/src/theme/build/mixThemeColor.ts +0 -53
- package/src/theme/build/renderColorTheme.ts +0 -532
- package/src/theme/build/renderColorValue.ts +0 -85
- package/src/theme/build/resolveColorTokens.ts +0 -268
- package/src/theme/build/theme.test.ts +0 -27
- package/src/theme/config/helpers.ts +0 -55
- package/src/theme/config/index.ts +0 -4
- package/src/theme/config/system.ts +0 -115
- package/src/theme/config/tokens/color/index.ts +0 -1
- package/src/theme/config/tokens/color/types.ts +0 -133
- package/src/theme/config/tokens/index.ts +0 -4
- package/src/theme/config/tokens/parseTokenKey.test.ts +0 -64
- package/src/theme/config/tokens/parseTokenKey.ts +0 -67
- package/src/theme/config/tokens/parseTokenValue.test.ts +0 -42
- package/src/theme/config/tokens/parseTokenValue.ts +0 -133
- package/src/theme/config/tokens/types.ts +0 -53
- package/src/theme/config/types.ts +0 -45
- package/src/theme/defaults/colorPalette.ts +0 -5
- package/src/theme/defaults/colorTokens.ts +0 -648
- package/src/theme/defaults/config.ts +0 -84
- package/src/theme/getScopedTheme.ts +0 -88
- package/src/theme/palette/constants.ts +0 -13
- package/src/theme/palette/index.ts +0 -2
- package/src/theme/palette/types.ts +0 -4
- package/src/theme/v0/avatar.ts +0 -10
- package/src/theme/v0/color/_generic.ts +0 -35
- package/src/theme/v0/color/_system.ts +0 -17
- package/src/theme/v0/color/base.ts +0 -21
- package/src/theme/v0/color/button.ts +0 -42
- package/src/theme/v0/color/card.ts +0 -19
- package/src/theme/v0/color/color.ts +0 -40
- package/src/theme/v0/color/index.ts +0 -11
- package/src/theme/v0/color/input.ts +0 -34
- package/src/theme/v0/color/muted.ts +0 -26
- package/src/theme/v0/color/selectable.ts +0 -31
- package/src/theme/v0/color/solid.ts +0 -26
- package/src/theme/v0/color/spot.ts +0 -13
- package/src/theme/v0/css.ts +0 -8
- package/src/theme/v0/focusRing.ts +0 -7
- package/src/theme/v0/font.ts +0 -53
- package/src/theme/v0/index.ts +0 -10
- package/src/theme/v0/input.ts +0 -23
- package/src/theme/v0/layer.ts +0 -8
- package/src/theme/v0/shadow.ts +0 -19
- package/src/theme/v0/styles.ts +0 -13
- package/src/theme/v0/theme.ts +0 -72
- package/src/theme/v2/avatar.ts +0 -14
- package/src/theme/v2/color/_constants.ts +0 -45
- package/src/theme/v2/color/_helpers.ts +0 -24
- package/src/theme/v2/color/_system.ts +0 -40
- package/src/theme/v2/color/avatar.ts +0 -15
- package/src/theme/v2/color/badge.ts +0 -16
- package/src/theme/v2/color/button.ts +0 -17
- package/src/theme/v2/color/color.ts +0 -34
- package/src/theme/v2/color/index.ts +0 -13
- package/src/theme/v2/color/input.ts +0 -25
- package/src/theme/v2/color/kbd.ts +0 -8
- package/src/theme/v2/color/selectable.ts +0 -12
- package/src/theme/v2/color/shadow.ts +0 -7
- package/src/theme/v2/color/state.ts +0 -43
- package/src/theme/v2/color/syntax.ts +0 -41
- package/src/theme/v2/index.ts +0 -4
- package/src/theme/v2/input.ts +0 -33
- package/src/theme/v2/theme.ts +0 -49
- package/src/theme/v3/buildTheme_v3.test.ts +0 -40
- package/src/theme/v3/buildTheme_v3.ts +0 -29
- package/src/theme/v3/color/buildColor_v3.ts +0 -193
- package/src/theme/v3/color/card.ts +0 -116
- package/src/theme/v3/color/color.ts +0 -94
- package/src/theme/v3/color/element.ts +0 -19
- package/src/theme/v3/color/index.ts +0 -7
- package/src/theme/v3/color/parseColor.test.ts +0 -79
- package/src/theme/v3/color/parseColor.ts +0 -167
- package/src/theme/v3/color/renderColor.test.ts +0 -19
- package/src/theme/v3/color/renderColor.ts +0 -33
- package/src/theme/v3/color/token.ts +0 -17
- package/src/theme/v3/color/tokens.ts +0 -5
- package/src/theme/v3/defaults.ts +0 -186
- package/src/theme/v3/index.ts +0 -6
- package/src/theme/v3/merge.ts +0 -22
- package/src/theme/v3/resolveTokens.ts +0 -199
- package/src/theme/v3/tokens.ts +0 -16
- package/src/theme/v3/types.ts +0 -45
- package/src/theme/versioning/getTheme_v2.ts +0 -58
- package/src/theme/versioning/index.ts +0 -1
- package/src/theme/versioning/is_v0.ts +0 -7
- package/src/theme/versioning/is_v2.ts +0 -7
- package/src/theme/versioning/themeColor_v0_v2.ts +0 -245
- package/src/theme/versioning/themeColor_v2_v2_9.ts +0 -49
- package/src/theme/versioning/themeColor_v3_v2.ts +0 -206
- package/src/theme/versioning/v0_v2.ts +0 -95
- package/src/theme/versioning/v2_v0.ts +0 -127
- package/src/theme/versioning/v3_v2.ts +0 -108
- package/src/ui/StyleTags.tsx +0 -24
- package/src/ui/_compat/index.ts +0 -9
- package/src/ui/_compat/styles/_responsive.ts +0 -19
- package/src/ui/_compat/styles/index.ts +0 -1
- package/src/ui/_compat/theme/index.ts +0 -5
- package/src/ui/_compat/theme/theme.test.tsx +0 -73
- package/src/ui/_compat/theme/themeColorProvider.tsx +0 -30
- package/src/ui/_compat/theme/themeContext.ts +0 -10
- package/src/ui/_compat/theme/themeProvider.tsx +0 -74
- package/src/ui/_compat/theme/types.ts +0 -12
- package/src/ui/_compat/theme/useRootTheme.ts +0 -17
- package/src/ui/_compat/theme/useTheme.ts +0 -16
- package/src/ui/_compat/types.ts +0 -274
- package/src/ui/components/autocomplete/__mocks__/apiStore.ts +0 -49
- package/src/ui/components/autocomplete/__mocks__/countries.ts +0 -245
- package/src/ui/components/autocomplete/__workshop__/async.tsx +0 -157
- package/src/ui/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -131
- package/src/ui/components/autocomplete/__workshop__/custom.tsx +0 -90
- package/src/ui/components/autocomplete/__workshop__/example.tsx +0 -80
- package/src/ui/components/autocomplete/__workshop__/focusAndBlur.tsx +0 -36
- package/src/ui/components/autocomplete/__workshop__/fullscreen.tsx +0 -293
- package/src/ui/components/autocomplete/__workshop__/index.ts +0 -39
- package/src/ui/components/autocomplete/autocomplete.tsx +0 -731
- package/src/ui/components/autocomplete/autocompleteOption.tsx +0 -45
- package/src/ui/components/autocomplete/autocompleteReducer.ts +0 -47
- package/src/ui/components/autocomplete/constants.ts +0 -28
- package/src/ui/components/autocomplete/index.ts +0 -2
- package/src/ui/components/autocomplete/types.ts +0 -108
- package/src/ui/components/breadcrumbs/__workshop__/example.tsx +0 -62
- package/src/ui/components/breadcrumbs/__workshop__/index.ts +0 -14
- package/src/ui/components/breadcrumbs/breadcrumbs.tsx +0 -127
- package/src/ui/components/breadcrumbs/index.ts +0 -1
- package/src/ui/components/dialog/__workshop__/activate.tsx +0 -134
- package/src/ui/components/dialog/__workshop__/autoFocus.tsx +0 -29
- package/src/ui/components/dialog/__workshop__/index.ts +0 -19
- package/src/ui/components/dialog/__workshop__/layering.tsx +0 -41
- package/src/ui/components/dialog/__workshop__/nested.tsx +0 -72
- package/src/ui/components/dialog/__workshop__/onScroll.tsx +0 -39
- package/src/ui/components/dialog/__workshop__/panes.tsx +0 -82
- package/src/ui/components/dialog/__workshop__/position.tsx +0 -30
- package/src/ui/components/dialog/__workshop__/props.tsx +0 -77
- package/src/ui/components/dialog/__workshop__/provider.tsx +0 -11
- package/src/ui/components/dialog/__workshop__/wrapped.tsx +0 -76
- package/src/ui/components/dialog/dialog.tsx +0 -433
- package/src/ui/components/dialog/dialogContext.ts +0 -20
- package/src/ui/components/dialog/dialogProvider.tsx +0 -35
- package/src/ui/components/dialog/index.ts +0 -4
- package/src/ui/components/dialog/useDialog.ts +0 -11
- package/src/ui/components/hotkeys/__workshop__/index.ts +0 -14
- package/src/ui/components/hotkeys/__workshop__/plain.tsx +0 -9
- package/src/ui/components/hotkeys/hotkeys.tsx +0 -54
- package/src/ui/components/hotkeys/index.ts +0 -1
- package/src/ui/components/index.ts +0 -9
- package/src/ui/components/menu/__workshop__/asComponent.tsx +0 -45
- package/src/ui/components/menu/__workshop__/avatarMenu.tsx +0 -51
- package/src/ui/components/menu/__workshop__/closableMenuButton.tsx +0 -46
- package/src/ui/components/menu/__workshop__/constrainedInBoundary.tsx +0 -134
- package/src/ui/components/menu/__workshop__/customMenuItem.tsx +0 -45
- package/src/ui/components/menu/__workshop__/customSelectedState.tsx +0 -39
- package/src/ui/components/menu/__workshop__/disableFocusOnClose.tsx +0 -40
- package/src/ui/components/menu/__workshop__/groups.tsx +0 -156
- package/src/ui/components/menu/__workshop__/index.ts +0 -89
- package/src/ui/components/menu/__workshop__/menuButton.tsx +0 -80
- package/src/ui/components/menu/__workshop__/menuGroupRight.tsx +0 -65
- package/src/ui/components/menu/__workshop__/nestedMenu.tsx +0 -22
- package/src/ui/components/menu/__workshop__/onCloseMenuButton.tsx +0 -41
- package/src/ui/components/menu/__workshop__/selectedItem.tsx +0 -69
- package/src/ui/components/menu/__workshop__/shouldFocus.tsx +0 -47
- package/src/ui/components/menu/__workshop__/tones.tsx +0 -25
- package/src/ui/components/menu/__workshop__/withoutArrow.tsx +0 -32
- package/src/ui/components/menu/helpers.ts +0 -82
- package/src/ui/components/menu/index.ts +0 -5
- package/src/ui/components/menu/menu.test.tsx +0 -128
- package/src/ui/components/menu/menu.tsx +0 -200
- package/src/ui/components/menu/menuButton.tsx +0 -275
- package/src/ui/components/menu/menuContext.ts +0 -31
- package/src/ui/components/menu/menuDivider.tsx +0 -22
- package/src/ui/components/menu/menuGroup.tsx +0 -228
- package/src/ui/components/menu/menuItem.tsx +0 -180
- package/src/ui/components/menu/useMenu.ts +0 -21
- package/src/ui/components/menu/useMenuController.ts +0 -241
- package/src/ui/components/skeleton/__workshop__/delay.tsx +0 -70
- package/src/ui/components/skeleton/__workshop__/index.ts +0 -11
- package/src/ui/components/skeleton/__workshop__/skeleton.tsx +0 -64
- package/src/ui/components/skeleton/index.ts +0 -2
- package/src/ui/components/skeleton/skeleton.tsx +0 -53
- package/src/ui/components/skeleton/textSkeleton.tsx +0 -132
- package/src/ui/components/tab/__workshop__/example.tsx +0 -79
- package/src/ui/components/tab/__workshop__/index.ts +0 -14
- package/src/ui/components/tab/index.ts +0 -3
- package/src/ui/components/tab/tab.tsx +0 -105
- package/src/ui/components/tab/tabList.tsx +0 -74
- package/src/ui/components/tab/tabPanel.tsx +0 -40
- package/src/ui/components/toast/__workshop__/hook.tsx +0 -71
- package/src/ui/components/toast/__workshop__/index.ts +0 -19
- package/src/ui/components/toast/__workshop__/toast.tsx +0 -26
- package/src/ui/components/toast/index.ts +0 -4
- package/src/ui/components/toast/toast.test.tsx +0 -101
- package/src/ui/components/toast/toast.tsx +0 -211
- package/src/ui/components/toast/toastContext.ts +0 -7
- package/src/ui/components/toast/toastLayer.tsx +0 -38
- package/src/ui/components/toast/toastProvider.tsx +0 -113
- package/src/ui/components/toast/types.ts +0 -28
- package/src/ui/components/toast/useToast.ts +0 -25
- package/src/ui/components/tree/__workshop__/basic.perf.ts +0 -19
- package/src/ui/components/tree/__workshop__/basic.tsx +0 -105
- package/src/ui/components/tree/__workshop__/index.ts +0 -21
- package/src/ui/components/tree/__workshop__/tabFromElement.tsx +0 -84
- package/src/ui/components/tree/helpers.ts +0 -105
- package/src/ui/components/tree/index.ts +0 -4
- package/src/ui/components/tree/tree.tsx +0 -244
- package/src/ui/components/tree/treeContext.ts +0 -10
- package/src/ui/components/tree/treeGroup.tsx +0 -30
- package/src/ui/components/tree/treeItem.tsx +0 -220
- package/src/ui/components/tree/types.ts +0 -25
- package/src/ui/components/tree/useTree.ts +0 -17
- package/src/ui/constants.ts +0 -79
- package/src/ui/global.ts +0 -6
- package/src/ui/helpers/focus.ts +0 -100
- package/src/ui/helpers/index.ts +0 -5
- package/src/ui/helpers/props.ts +0 -10
- package/src/ui/hooks/index.ts +0 -12
- package/src/ui/hooks/useArrayProp.ts +0 -29
- package/src/ui/hooks/useClickOutside.test.tsx +0 -482
- package/src/ui/hooks/useClickOutside.ts +0 -117
- package/src/ui/hooks/useClickOutsideEvent.test.tsx +0 -115
- package/src/ui/hooks/useClickOutsideEvent.ts +0 -73
- package/src/ui/hooks/useDelayed.test.ts +0 -68
- package/src/ui/hooks/useDelayedState.ts +0 -28
- package/src/ui/hooks/useElementRect/__workshop__/example.tsx +0 -32
- package/src/ui/hooks/useElementRect/__workshop__/index.ts +0 -14
- package/src/ui/hooks/useElementRect/index.ts +0 -1
- package/src/ui/hooks/useElementRect/useElementRect.ts +0 -13
- package/src/ui/hooks/useElementSize.ts +0 -19
- package/src/ui/hooks/useForwardedRef.ts +0 -19
- package/src/ui/hooks/useIsomorphicEffect.ts +0 -7
- package/src/ui/hooks/useMediaIndex/__workshop__/index.ts +0 -14
- package/src/ui/hooks/useMediaIndex/__workshop__/test.tsx +0 -14
- package/src/ui/hooks/useMediaIndex/index.ts +0 -1
- package/src/ui/hooks/useMediaIndex/useMediaIndex.test.tsx +0 -36
- package/src/ui/hooks/useMediaIndex/useMediaIndex.ts +0 -104
- package/src/ui/hooks/usePrefersDark.hydration.test.tsx +0 -56
- package/src/ui/hooks/usePrefersDark.test.tsx +0 -19
- package/src/ui/hooks/usePrefersReducedMotion.hydration.test.tsx +0 -56
- package/src/ui/hooks/usePrefersReducedMotion.test.tsx +0 -19
- package/src/ui/index.ts +0 -9
- package/src/ui/lib/createGlobalScopedContext.ts +0 -34
- package/src/ui/lib/globalScope.ts +0 -19
- package/src/ui/lib/isRecord.ts +0 -3
- package/src/ui/middleware/origin.ts +0 -47
- package/src/ui/observers/elementSizeObserver.ts +0 -116
- package/src/ui/observers/index.ts +0 -2
- package/src/ui/primitives/_selectable/index.ts +0 -1
- package/src/ui/primitives/_selectable/selectable.tsx +0 -31
- package/src/ui/primitives/avatar/__workshop__/asButton.tsx +0 -14
- package/src/ui/primitives/avatar/__workshop__/index.ts +0 -29
- package/src/ui/primitives/avatar/__workshop__/stack.tsx +0 -25
- package/src/ui/primitives/avatar/__workshop__/withinButton.tsx +0 -63
- package/src/ui/primitives/avatar/__workshop__/withinMenuItem.tsx +0 -72
- package/src/ui/primitives/avatar/avatar.tsx +0 -158
- package/src/ui/primitives/avatar/avatarCounter.tsx +0 -62
- package/src/ui/primitives/avatar/avatarStack.tsx +0 -82
- package/src/ui/primitives/avatar/index.ts +0 -4
- package/src/ui/primitives/avatar/types.ts +0 -17
- package/src/ui/primitives/badge/__workshop__/index.ts +0 -19
- package/src/ui/primitives/badge/__workshop__/props.tsx +0 -30
- package/src/ui/primitives/badge/__workshop__/tones.tsx +0 -21
- package/src/ui/primitives/badge/badge.test.tsx +0 -16
- package/src/ui/primitives/badge/badge.tsx +0 -64
- package/src/ui/primitives/badge/index.ts +0 -1
- package/src/ui/primitives/badge/types.ts +0 -8
- package/src/ui/primitives/box/__workshop__/index.ts +0 -19
- package/src/ui/primitives/box/__workshop__/props.tsx +0 -20
- package/src/ui/primitives/box/__workshop__/responsive.tsx +0 -20
- package/src/ui/primitives/box/box.tsx +0 -155
- package/src/ui/primitives/box/index.ts +0 -1
- package/src/ui/primitives/button/__workshop__/custom.tsx +0 -50
- package/src/ui/primitives/button/__workshop__/customIcons.tsx +0 -30
- package/src/ui/primitives/button/__workshop__/disabled.tsx +0 -74
- package/src/ui/primitives/button/__workshop__/index.ts +0 -59
- package/src/ui/primitives/button/__workshop__/mixedChildren.tsx +0 -12
- package/src/ui/primitives/button/__workshop__/props.tsx +0 -58
- package/src/ui/primitives/button/__workshop__/sanityUploadButton.tsx +0 -36
- package/src/ui/primitives/button/__workshop__/stacked.tsx +0 -59
- package/src/ui/primitives/button/__workshop__/styled1.tsx +0 -17
- package/src/ui/primitives/button/__workshop__/styled2.tsx +0 -19
- package/src/ui/primitives/button/__workshop__/uploadButton.tsx +0 -28
- package/src/ui/primitives/button/button.test.tsx +0 -44
- package/src/ui/primitives/button/button.tsx +0 -206
- package/src/ui/primitives/button/index.ts +0 -1
- package/src/ui/primitives/card/__workshop__/allTones.tsx +0 -27
- package/src/ui/primitives/card/__workshop__/asButton.tsx +0 -107
- package/src/ui/primitives/card/__workshop__/asComponent.tsx +0 -27
- package/src/ui/primitives/card/__workshop__/checkered.tsx +0 -26
- package/src/ui/primitives/card/__workshop__/index.ts +0 -18
- package/src/ui/primitives/card/__workshop__/interactive.tsx +0 -30
- package/src/ui/primitives/card/__workshop__/listNavigation.tsx +0 -80
- package/src/ui/primitives/card/__workshop__/props.tsx +0 -55
- package/src/ui/primitives/card/__workshop__/selected.tsx +0 -93
- package/src/ui/primitives/card/__workshop__/styled.tsx +0 -14
- package/src/ui/primitives/card/card.tsx +0 -122
- package/src/ui/primitives/card/cardContext.ts +0 -10
- package/src/ui/primitives/card/cardProvider.tsx +0 -19
- package/src/ui/primitives/card/index.ts +0 -4
- package/src/ui/primitives/card/types.ts +0 -27
- package/src/ui/primitives/card/useCard.ts +0 -7
- package/src/ui/primitives/checkbox/__workshop__/example.tsx +0 -25
- package/src/ui/primitives/checkbox/__workshop__/index.ts +0 -13
- package/src/ui/primitives/checkbox/__workshop__/props.tsx +0 -33
- package/src/ui/primitives/checkbox/__workshop__/readOnly.tsx +0 -16
- package/src/ui/primitives/checkbox/__workshop__/tones.tsx +0 -28
- package/src/ui/primitives/checkbox/checkbox.tsx +0 -74
- package/src/ui/primitives/checkbox/index.ts +0 -1
- package/src/ui/primitives/code/__workshop__/index.ts +0 -19
- package/src/ui/primitives/code/__workshop__/opticalAlignment.tsx +0 -48
- package/src/ui/primitives/code/__workshop__/props.tsx +0 -21
- package/src/ui/primitives/code/code.tsx +0 -49
- package/src/ui/primitives/code/index.ts +0 -1
- package/src/ui/primitives/code/refractor.tsx +0 -20
- package/src/ui/primitives/container/__workshop__/example.tsx +0 -20
- package/src/ui/primitives/container/__workshop__/index.ts +0 -8
- package/src/ui/primitives/container/container.tsx +0 -35
- package/src/ui/primitives/container/index.ts +0 -2
- package/src/ui/primitives/flex/__workshop__/example.tsx +0 -34
- package/src/ui/primitives/flex/__workshop__/gap.tsx +0 -25
- package/src/ui/primitives/flex/__workshop__/index.ts +0 -11
- package/src/ui/primitives/flex/flex.tsx +0 -29
- package/src/ui/primitives/flex/index.ts +0 -1
- package/src/ui/primitives/grid/__workshop__/index.ts +0 -10
- package/src/ui/primitives/grid/__workshop__/responsive.tsx +0 -54
- package/src/ui/primitives/grid/grid.tsx +0 -30
- package/src/ui/primitives/grid/index.ts +0 -1
- package/src/ui/primitives/heading/__workshop__/index.ts +0 -19
- package/src/ui/primitives/heading/__workshop__/opticalAlignment.tsx +0 -54
- package/src/ui/primitives/heading/__workshop__/plain.tsx +0 -32
- package/src/ui/primitives/heading/heading.tsx +0 -62
- package/src/ui/primitives/heading/index.ts +0 -1
- package/src/ui/primitives/index.ts +0 -27
- package/src/ui/primitives/inline/__workshop__/index.ts +0 -8
- package/src/ui/primitives/inline/__workshop__/plain.tsx +0 -27
- package/src/ui/primitives/inline/index.ts +0 -1
- package/src/ui/primitives/inline/inline.tsx +0 -50
- package/src/ui/primitives/inline/types.ts +0 -6
- package/src/ui/primitives/kbd/__workshop__/index.ts +0 -8
- package/src/ui/primitives/kbd/__workshop__/plain.tsx +0 -9
- package/src/ui/primitives/kbd/index.ts +0 -1
- package/src/ui/primitives/kbd/kbd.tsx +0 -55
- package/src/ui/primitives/label/__workshop__/index.ts +0 -19
- package/src/ui/primitives/label/__workshop__/opticalAlignment.tsx +0 -54
- package/src/ui/primitives/label/__workshop__/plain.tsx +0 -37
- package/src/ui/primitives/label/index.ts +0 -1
- package/src/ui/primitives/label/label.tsx +0 -67
- package/src/ui/primitives/popover/__workshop__/AlignedStory.tsx +0 -77
- package/src/ui/primitives/popover/__workshop__/MarginsStory.tsx +0 -31
- package/src/ui/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -32
- package/src/ui/primitives/popover/__workshop__/OpenOnMountStory.tsx +0 -11
- package/src/ui/primitives/popover/__workshop__/PlainStory.tsx +0 -71
- package/src/ui/primitives/popover/__workshop__/RecursiveStory.tsx +0 -70
- package/src/ui/primitives/popover/__workshop__/SidePanelStory.tsx +0 -93
- package/src/ui/primitives/popover/__workshop__/TestStory.tsx +0 -98
- package/src/ui/primitives/popover/__workshop__/index.ts +0 -49
- package/src/ui/primitives/popover/constants.ts +0 -22
- package/src/ui/primitives/popover/floating-ui/size.ts +0 -83
- package/src/ui/primitives/popover/helpers.ts +0 -32
- package/src/ui/primitives/popover/index.ts +0 -2
- package/src/ui/primitives/popover/popover.tsx +0 -492
- package/src/ui/primitives/popover/popoverCard.tsx +0 -155
- package/src/ui/primitives/popover/types.ts +0 -6
- package/src/ui/primitives/radio/__workshop__/example.tsx +0 -63
- package/src/ui/primitives/radio/__workshop__/index.ts +0 -11
- package/src/ui/primitives/radio/__workshop__/plain.tsx +0 -28
- package/src/ui/primitives/radio/index.ts +0 -1
- package/src/ui/primitives/radio/radio.tsx +0 -49
- package/src/ui/primitives/select/__workshop__/index.ts +0 -11
- package/src/ui/primitives/select/__workshop__/plain.tsx +0 -30
- package/src/ui/primitives/select/__workshop__/readOnly.tsx +0 -23
- package/src/ui/primitives/select/index.ts +0 -1
- package/src/ui/primitives/select/select.tsx +0 -85
- package/src/ui/primitives/spinner/__workshop__/Props.tsx +0 -16
- package/src/ui/primitives/spinner/__workshop__/index.ts +0 -14
- package/src/ui/primitives/spinner/animatedSpinnerIcon.tsx +0 -16
- package/src/ui/primitives/spinner/index.ts +0 -1
- package/src/ui/primitives/spinner/spinner.tsx +0 -33
- package/src/ui/primitives/stack/__workshop__/index.ts +0 -14
- package/src/ui/primitives/stack/__workshop__/plain.tsx +0 -32
- package/src/ui/primitives/stack/index.ts +0 -1
- package/src/ui/primitives/stack/stack.tsx +0 -40
- package/src/ui/primitives/switch/__workshop__/example.tsx +0 -23
- package/src/ui/primitives/switch/__workshop__/index.ts +0 -11
- package/src/ui/primitives/switch/__workshop__/props.tsx +0 -21
- package/src/ui/primitives/switch/index.ts +0 -1
- package/src/ui/primitives/switch/switch.tsx +0 -75
- package/src/ui/primitives/text/__workshop__/colored.tsx +0 -23
- package/src/ui/primitives/text/__workshop__/example.tsx +0 -39
- package/src/ui/primitives/text/__workshop__/index.ts +0 -24
- package/src/ui/primitives/text/__workshop__/opticalAlignment.tsx +0 -48
- package/src/ui/primitives/text/index.ts +0 -1
- package/src/ui/primitives/text/text.tsx +0 -64
- package/src/ui/primitives/textArea/__workshop__/index.ts +0 -14
- package/src/ui/primitives/textArea/__workshop__/plain.tsx +0 -50
- package/src/ui/primitives/textArea/index.ts +0 -1
- package/src/ui/primitives/textArea/textArea.tsx +0 -71
- package/src/ui/primitives/textInput/__workshop__/clearButton.tsx +0 -30
- package/src/ui/primitives/textInput/__workshop__/customValidity.tsx +0 -17
- package/src/ui/primitives/textInput/__workshop__/index.ts +0 -44
- package/src/ui/primitives/textInput/__workshop__/plain.tsx +0 -104
- package/src/ui/primitives/textInput/__workshop__/readOnly.tsx +0 -9
- package/src/ui/primitives/textInput/__workshop__/states.tsx +0 -53
- package/src/ui/primitives/textInput/__workshop__/tones.tsx +0 -277
- package/src/ui/primitives/textInput/__workshop__/typed.tsx +0 -23
- package/src/ui/primitives/textInput/index.ts +0 -1
- package/src/ui/primitives/textInput/textInput.tsx +0 -286
- package/src/ui/primitives/tooltip/__workshop__/customPortal.tsx +0 -102
- package/src/ui/primitives/tooltip/__workshop__/index.ts +0 -29
- package/src/ui/primitives/tooltip/__workshop__/overflowingBoundary.tsx +0 -74
- package/src/ui/primitives/tooltip/__workshop__/props.tsx +0 -111
- package/src/ui/primitives/tooltip/__workshop__/resizableBoundary.tsx +0 -86
- package/src/ui/primitives/tooltip/constants.ts +0 -23
- package/src/ui/primitives/tooltip/index.ts +0 -2
- package/src/ui/primitives/tooltip/tooltip.test.tsx +0 -453
- package/src/ui/primitives/tooltip/tooltip.tsx +0 -467
- package/src/ui/primitives/tooltip/tooltipCard.tsx +0 -115
- package/src/ui/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +0 -11
- package/src/ui/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +0 -55
- package/src/ui/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +0 -13
- package/src/ui/primitives/types.ts +0 -166
- package/src/ui/types/avatar.ts +0 -19
- package/src/ui/types/badge.ts +0 -12
- package/src/ui/types/box.ts +0 -22
- package/src/ui/types/button.ts +0 -24
- package/src/ui/types/card.ts +0 -6
- package/src/ui/types/dialog.ts +0 -4
- package/src/ui/types/flex.ts +0 -27
- package/src/ui/types/grid.ts +0 -17
- package/src/ui/types/gridItem.ts +0 -32
- package/src/ui/types/index.ts +0 -15
- package/src/ui/types/placement.ts +0 -18
- package/src/ui/types/popover.ts +0 -4
- package/src/ui/types/props.ts +0 -18
- package/src/ui/types/radius.ts +0 -7
- package/src/ui/types/selectable.ts +0 -7
- package/src/ui/types/text.ts +0 -7
- package/src/ui/utils/arrow/arrow.tsx +0 -59
- package/src/ui/utils/arrow/index.ts +0 -1
- package/src/ui/utils/boundaryElement/__workshop__/index.ts +0 -14
- package/src/ui/utils/boundaryElement/__workshop__/plain.tsx +0 -19
- package/src/ui/utils/boundaryElement/boundaryElement.test.tsx +0 -100
- package/src/ui/utils/boundaryElement/boundaryElementContext.ts +0 -7
- package/src/ui/utils/boundaryElement/boundaryElementProvider.tsx +0 -24
- package/src/ui/utils/boundaryElement/index.ts +0 -3
- package/src/ui/utils/boundaryElement/types.ts +0 -7
- package/src/ui/utils/boundaryElement/useBoundaryElement.ts +0 -26
- package/src/ui/utils/conditionalWrapper/conditionalWrapper.tsx +0 -23
- package/src/ui/utils/conditionalWrapper/index.ts +0 -1
- package/src/ui/utils/elementQuery/__workshop__/customMedia.tsx +0 -30
- package/src/ui/utils/elementQuery/__workshop__/index.ts +0 -14
- package/src/ui/utils/elementQuery/elementQuery.tsx +0 -53
- package/src/ui/utils/elementQuery/index.ts +0 -1
- package/src/ui/utils/errorBoundary.tsx +0 -48
- package/src/ui/utils/getElementRef.ts +0 -26
- package/src/ui/utils/index.ts +0 -9
- package/src/ui/utils/layer/__workshop__/_debug.tsx +0 -17
- package/src/ui/utils/layer/__workshop__/index.ts +0 -24
- package/src/ui/utils/layer/__workshop__/multipleRoots.tsx +0 -49
- package/src/ui/utils/layer/__workshop__/nested.tsx +0 -98
- package/src/ui/utils/layer/__workshop__/responsiveZOffset.tsx +0 -13
- package/src/ui/utils/layer/getLayerContext.test.ts +0 -30
- package/src/ui/utils/layer/getLayerContext.ts +0 -21
- package/src/ui/utils/layer/index.ts +0 -4
- package/src/ui/utils/layer/layer.test.tsx +0 -108
- package/src/ui/utils/layer/layer.tsx +0 -112
- package/src/ui/utils/layer/layerContext.ts +0 -7
- package/src/ui/utils/layer/layerProvider.tsx +0 -110
- package/src/ui/utils/layer/useLayer.ts +0 -26
- package/src/ui/utils/portal/__workshop__/index.ts +0 -14
- package/src/ui/utils/portal/__workshop__/named.tsx +0 -63
- package/src/ui/utils/portal/index.ts +0 -4
- package/src/ui/utils/portal/portal.test.tsx +0 -103
- package/src/ui/utils/portal/portal.ts +0 -46
- package/src/ui/utils/portal/portalContext.ts +0 -31
- package/src/ui/utils/portal/portalProvider.tsx +0 -79
- package/src/ui/utils/portal/types.ts +0 -9
- package/src/ui/utils/portal/usePortal.ts +0 -25
- package/src/ui/utils/spanWithTextOverflow.tsx +0 -10
- package/src/ui/utils/srOnly/index.ts +0 -1
- package/src/ui/utils/srOnly/srOnly.tsx +0 -35
- package/src/ui/utils/virtualList/__workshop__/changingProps.tsx +0 -36
- package/src/ui/utils/virtualList/__workshop__/elementScroll.tsx +0 -24
- package/src/ui/utils/virtualList/__workshop__/index.ts +0 -29
- package/src/ui/utils/virtualList/__workshop__/infiniteList.tsx +0 -48
- package/src/ui/utils/virtualList/__workshop__/windowScrolll.tsx +0 -22
- package/src/ui/utils/virtualList/index.ts +0 -1
- package/src/ui/utils/virtualList/virtualList.tsx +0 -189
- /package/src/{ui → core}/components/autocomplete/__workshop__/types.ts +0 -0
- /package/src/{ui → core}/components/toast/toastState.ts +0 -0
- /package/src/{ui → core}/helpers/animation.ts +0 -0
- /package/src/{ui → core}/helpers/element.ts +0 -0
- /package/src/{ui → core}/helpers/scroll.ts +0 -0
- /package/src/{ui → core}/hooks/useCustomValidity.ts +0 -0
- /package/src/{ui → core}/hooks/useGlobalKeyDown.ts +0 -0
- /package/src/{ui → core}/hooks/useMatchMedia.ts +0 -0
- /package/src/{ui → core}/hooks/useMounted.ts +0 -0
- /package/src/{ui → core}/hooks/usePrefersDark.ts +0 -0
- /package/src/{ui → core}/hooks/usePrefersReducedMotion.ts +0 -0
- /package/src/{theme/build → core}/lib/isRecord.ts +0 -0
- /package/src/{ui/observers/resizeObserver.ts → core/observers/resize.ts} +0 -0
- /package/src/{ui/utils → core/primitives}/arrow/cmds.ts +0 -0
- /package/src/{ui → core}/primitives/container/types.ts +0 -0
- /package/src/{ui/utils → core/primitives}/layer/types.ts +0 -0
- /package/src/{ui → core}/primitives/tooltip/tooltipDelayGroup/index.ts +0 -0
- /package/src/{ui → core}/primitives/tooltip/tooltipDelayGroup/types.ts +0 -0
- /package/src/{ui → core}/utils/elementQuery/helpers.ts +0 -0
- /package/src/css/{aspects → props}/pointerEvents/types.ts +0 -0
|
@@ -0,0 +1,2250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var jsxRuntime = require("react/jsx-runtime"), compilerRuntime = require("react/compiler-runtime"), css = require("@sanity/ui/css"), react = require("react"), useEffectEvent = require("use-effect-event"), icons = require("@sanity/icons"), reactIs = require("react-is"), reactDom$1 = require("@floating-ui/react-dom"), framerMotion = require("framer-motion"), reactDom = require("react-dom"), dynamic = require("@vanilla-extract/dynamic");
|
|
3
|
+
const EMPTY_ARRAY = [], EMPTY_RECORD = {}, POPOVER_MOTION_PROPS = {
|
|
4
|
+
card: {
|
|
5
|
+
initial: {
|
|
6
|
+
scale: 0.97,
|
|
7
|
+
willChange: "transform"
|
|
8
|
+
},
|
|
9
|
+
hidden: {
|
|
10
|
+
opacity: 0
|
|
11
|
+
},
|
|
12
|
+
visible: {
|
|
13
|
+
opacity: 1,
|
|
14
|
+
transition: {
|
|
15
|
+
when: "beforeChildren",
|
|
16
|
+
duration: 0.1
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
scaleIn: {
|
|
20
|
+
scale: 1
|
|
21
|
+
},
|
|
22
|
+
scaleOut: {
|
|
23
|
+
scale: 0.97
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
transition: {
|
|
27
|
+
type: "spring",
|
|
28
|
+
visualDuration: 0.2,
|
|
29
|
+
bounce: 0.25
|
|
30
|
+
}
|
|
31
|
+
}, Z_OFFSETS = {
|
|
32
|
+
dialog: 600,
|
|
33
|
+
popover: 400,
|
|
34
|
+
tooltip: 200
|
|
35
|
+
};
|
|
36
|
+
function _isEnterToClickElement(element) {
|
|
37
|
+
return isHTMLAnchorElement(element) || isHTMLButtonElement(element);
|
|
38
|
+
}
|
|
39
|
+
function isHTMLElement(node) {
|
|
40
|
+
return node instanceof Node && node.nodeType === Node.ELEMENT_NODE;
|
|
41
|
+
}
|
|
42
|
+
function isHTMLAnchorElement(element) {
|
|
43
|
+
return isHTMLElement(element) && element.nodeName === "A";
|
|
44
|
+
}
|
|
45
|
+
function isHTMLInputElement(element) {
|
|
46
|
+
return isHTMLElement(element) && element.nodeName === "INPUT";
|
|
47
|
+
}
|
|
48
|
+
function isHTMLButtonElement(element) {
|
|
49
|
+
return isHTMLElement(element) && element.nodeName === "BUTTON";
|
|
50
|
+
}
|
|
51
|
+
function isHTMLSelectElement(element) {
|
|
52
|
+
return isHTMLElement(element) && element.nodeName === "SELECT";
|
|
53
|
+
}
|
|
54
|
+
function isHTMLTextAreaElement(element) {
|
|
55
|
+
return isHTMLElement(element) && element.nodeName === "TEXTAREA";
|
|
56
|
+
}
|
|
57
|
+
function containsOrEqualsElement(element, node) {
|
|
58
|
+
return element.contains(node) || element === node;
|
|
59
|
+
}
|
|
60
|
+
function isArray(val) {
|
|
61
|
+
return Array.isArray(val);
|
|
62
|
+
}
|
|
63
|
+
function isRecord(value) {
|
|
64
|
+
return !!(value && typeof value == "object" && !Array.isArray(value));
|
|
65
|
+
}
|
|
66
|
+
function _getArrayProp(val, defaultVal) {
|
|
67
|
+
return val === void 0 ? defaultVal || EMPTY_ARRAY : Array.isArray(val) ? val : [val];
|
|
68
|
+
}
|
|
69
|
+
function _getResponsiveProp(val, defaultVal) {
|
|
70
|
+
return val === void 0 ? defaultVal || EMPTY_ARRAY : isArray(val) || isRecord(val) ? val : [val];
|
|
71
|
+
}
|
|
72
|
+
function useResponsiveProp(val, defaultVal) {
|
|
73
|
+
const $ = compilerRuntime.c(3);
|
|
74
|
+
let t0;
|
|
75
|
+
$[0] !== defaultVal || $[1] !== val ? (t0 = () => [_getResponsiveProp(val, defaultVal), JSON.stringify(val ?? defaultVal)], $[0] = defaultVal, $[1] = val, $[2] = t0) : t0 = $[2];
|
|
76
|
+
const [t1, setCache] = react.useState(t0), [cachedVal, cachedHash] = t1, hash = JSON.stringify(val ?? defaultVal);
|
|
77
|
+
return hash !== cachedHash && setCache([_getResponsiveProp(val, defaultVal), hash]), cachedVal;
|
|
78
|
+
}
|
|
79
|
+
const DEFAULT_BOX_ELEMENT = "div";
|
|
80
|
+
function Box(props) {
|
|
81
|
+
const $ = compilerRuntime.c(132), t0 = props;
|
|
82
|
+
let alignItems, borderBottom, borderLeft, borderRight, borderTop, children, className, flex, flexDirection, flexWrap, gap, gapX, gapY, gridAutoColumns, gridAutoFlow, gridAutoRows, gridColumn, gridColumnEnd, gridColumnStart, gridRow, gridRowEnd, gridRowStart, gridTemplateColumns, gridTemplateRows, height, inset, insetBottom, insetLeft, insetRight, insetTop, justifyContent, marginBottom, marginLeft, marginRight, marginTop, marginX, marginY, maxWidth, muted, outline, overflow, overflowX, overflowY, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, pointerEvents, position, radius, rest, shadow, t1, t2, t3, t4, t5, t6, t7, t8, textAlign, width;
|
|
83
|
+
$[0] !== t0 ? ({
|
|
84
|
+
alignItems,
|
|
85
|
+
as: t1,
|
|
86
|
+
border: t2,
|
|
87
|
+
borderTop,
|
|
88
|
+
borderRight,
|
|
89
|
+
borderBottom,
|
|
90
|
+
borderLeft,
|
|
91
|
+
className,
|
|
92
|
+
children,
|
|
93
|
+
display: t3,
|
|
94
|
+
flex,
|
|
95
|
+
flexDirection,
|
|
96
|
+
flexWrap,
|
|
97
|
+
gap,
|
|
98
|
+
gapX,
|
|
99
|
+
gapY,
|
|
100
|
+
gridAutoColumns,
|
|
101
|
+
gridAutoFlow,
|
|
102
|
+
gridAutoRows,
|
|
103
|
+
gridColumn,
|
|
104
|
+
gridColumnEnd,
|
|
105
|
+
gridColumnStart,
|
|
106
|
+
gridRow,
|
|
107
|
+
gridRowEnd,
|
|
108
|
+
gridRowStart,
|
|
109
|
+
gridTemplateColumns,
|
|
110
|
+
gridTemplateRows,
|
|
111
|
+
height,
|
|
112
|
+
inset,
|
|
113
|
+
insetBottom,
|
|
114
|
+
insetLeft,
|
|
115
|
+
insetRight,
|
|
116
|
+
insetTop,
|
|
117
|
+
justifyContent,
|
|
118
|
+
margin: t4,
|
|
119
|
+
marginX,
|
|
120
|
+
marginY,
|
|
121
|
+
marginTop,
|
|
122
|
+
marginRight,
|
|
123
|
+
marginBottom,
|
|
124
|
+
marginLeft,
|
|
125
|
+
maxWidth,
|
|
126
|
+
minHeight: t5,
|
|
127
|
+
minWidth: t6,
|
|
128
|
+
muted,
|
|
129
|
+
outline,
|
|
130
|
+
overflow,
|
|
131
|
+
overflowX,
|
|
132
|
+
overflowY,
|
|
133
|
+
padding: t7,
|
|
134
|
+
paddingX,
|
|
135
|
+
paddingY,
|
|
136
|
+
paddingTop,
|
|
137
|
+
paddingRight,
|
|
138
|
+
paddingBottom,
|
|
139
|
+
paddingLeft,
|
|
140
|
+
pointerEvents,
|
|
141
|
+
position,
|
|
142
|
+
radius,
|
|
143
|
+
shadow,
|
|
144
|
+
sizing: t8,
|
|
145
|
+
textAlign,
|
|
146
|
+
width,
|
|
147
|
+
...rest
|
|
148
|
+
} = t0, $[0] = t0, $[1] = alignItems, $[2] = borderBottom, $[3] = borderLeft, $[4] = borderRight, $[5] = borderTop, $[6] = children, $[7] = className, $[8] = flex, $[9] = flexDirection, $[10] = flexWrap, $[11] = gap, $[12] = gapX, $[13] = gapY, $[14] = gridAutoColumns, $[15] = gridAutoFlow, $[16] = gridAutoRows, $[17] = gridColumn, $[18] = gridColumnEnd, $[19] = gridColumnStart, $[20] = gridRow, $[21] = gridRowEnd, $[22] = gridRowStart, $[23] = gridTemplateColumns, $[24] = gridTemplateRows, $[25] = height, $[26] = inset, $[27] = insetBottom, $[28] = insetLeft, $[29] = insetRight, $[30] = insetTop, $[31] = justifyContent, $[32] = marginBottom, $[33] = marginLeft, $[34] = marginRight, $[35] = marginTop, $[36] = marginX, $[37] = marginY, $[38] = maxWidth, $[39] = muted, $[40] = outline, $[41] = overflow, $[42] = overflowX, $[43] = overflowY, $[44] = paddingBottom, $[45] = paddingLeft, $[46] = paddingRight, $[47] = paddingTop, $[48] = paddingX, $[49] = paddingY, $[50] = pointerEvents, $[51] = position, $[52] = radius, $[53] = rest, $[54] = shadow, $[55] = t1, $[56] = t2, $[57] = t3, $[58] = t4, $[59] = t5, $[60] = t6, $[61] = t7, $[62] = t8, $[63] = textAlign, $[64] = width) : (alignItems = $[1], borderBottom = $[2], borderLeft = $[3], borderRight = $[4], borderTop = $[5], children = $[6], className = $[7], flex = $[8], flexDirection = $[9], flexWrap = $[10], gap = $[11], gapX = $[12], gapY = $[13], gridAutoColumns = $[14], gridAutoFlow = $[15], gridAutoRows = $[16], gridColumn = $[17], gridColumnEnd = $[18], gridColumnStart = $[19], gridRow = $[20], gridRowEnd = $[21], gridRowStart = $[22], gridTemplateColumns = $[23], gridTemplateRows = $[24], height = $[25], inset = $[26], insetBottom = $[27], insetLeft = $[28], insetRight = $[29], insetTop = $[30], justifyContent = $[31], marginBottom = $[32], marginLeft = $[33], marginRight = $[34], marginTop = $[35], marginX = $[36], marginY = $[37], maxWidth = $[38], muted = $[39], outline = $[40], overflow = $[41], overflowX = $[42], overflowY = $[43], paddingBottom = $[44], paddingLeft = $[45], paddingRight = $[46], paddingTop = $[47], paddingX = $[48], paddingY = $[49], pointerEvents = $[50], position = $[51], radius = $[52], rest = $[53], shadow = $[54], t1 = $[55], t2 = $[56], t3 = $[57], t4 = $[58], t5 = $[59], t6 = $[60], t7 = $[61], t8 = $[62], textAlign = $[63], width = $[64]);
|
|
149
|
+
const Element = t1 === void 0 ? DEFAULT_BOX_ELEMENT : t1, border = t2 === void 0 ? !1 : t2, display = t3 === void 0 ? "block" : t3, margin = t4 === void 0 ? 0 : t4, minHeight = t5 === void 0 ? 0 : t5, minWidth = t6 === void 0 ? 0 : t6, padding = t7 === void 0 ? 0 : t7, sizing = t8 === void 0 ? "border" : t8;
|
|
150
|
+
let t9;
|
|
151
|
+
$[65] !== alignItems || $[66] !== border || $[67] !== borderBottom || $[68] !== borderLeft || $[69] !== borderRight || $[70] !== borderTop || $[71] !== className || $[72] !== display || $[73] !== flex || $[74] !== flexDirection || $[75] !== flexWrap || $[76] !== gap || $[77] !== gapX || $[78] !== gapY || $[79] !== gridAutoColumns || $[80] !== gridAutoFlow || $[81] !== gridAutoRows || $[82] !== gridColumn || $[83] !== gridColumnEnd || $[84] !== gridColumnStart || $[85] !== gridRow || $[86] !== gridRowEnd || $[87] !== gridRowStart || $[88] !== gridTemplateColumns || $[89] !== gridTemplateRows || $[90] !== height || $[91] !== inset || $[92] !== insetBottom || $[93] !== insetLeft || $[94] !== insetRight || $[95] !== insetTop || $[96] !== justifyContent || $[97] !== margin || $[98] !== marginBottom || $[99] !== marginLeft || $[100] !== marginRight || $[101] !== marginTop || $[102] !== marginX || $[103] !== marginY || $[104] !== maxWidth || $[105] !== minHeight || $[106] !== minWidth || $[107] !== muted || $[108] !== outline || $[109] !== overflow || $[110] !== overflowX || $[111] !== overflowY || $[112] !== padding || $[113] !== paddingBottom || $[114] !== paddingLeft || $[115] !== paddingRight || $[116] !== paddingTop || $[117] !== paddingX || $[118] !== paddingY || $[119] !== pointerEvents || $[120] !== position || $[121] !== radius || $[122] !== shadow || $[123] !== sizing || $[124] !== textAlign || $[125] !== width ? (t9 = css.box({
|
|
152
|
+
className,
|
|
153
|
+
alignItems,
|
|
154
|
+
border,
|
|
155
|
+
borderTop,
|
|
156
|
+
borderRight,
|
|
157
|
+
borderBottom,
|
|
158
|
+
borderLeft,
|
|
159
|
+
display,
|
|
160
|
+
flex,
|
|
161
|
+
flexDirection,
|
|
162
|
+
flexWrap,
|
|
163
|
+
gap,
|
|
164
|
+
gapX,
|
|
165
|
+
gapY,
|
|
166
|
+
gridAutoColumns,
|
|
167
|
+
gridAutoFlow,
|
|
168
|
+
gridAutoRows,
|
|
169
|
+
gridColumn,
|
|
170
|
+
gridColumnEnd,
|
|
171
|
+
gridColumnStart,
|
|
172
|
+
gridRow,
|
|
173
|
+
gridRowEnd,
|
|
174
|
+
gridRowStart,
|
|
175
|
+
gridTemplateColumns,
|
|
176
|
+
gridTemplateRows,
|
|
177
|
+
height,
|
|
178
|
+
inset,
|
|
179
|
+
insetBottom,
|
|
180
|
+
insetLeft,
|
|
181
|
+
insetRight,
|
|
182
|
+
insetTop,
|
|
183
|
+
justifyContent,
|
|
184
|
+
margin,
|
|
185
|
+
marginX,
|
|
186
|
+
marginY,
|
|
187
|
+
marginTop,
|
|
188
|
+
marginRight,
|
|
189
|
+
marginBottom,
|
|
190
|
+
marginLeft,
|
|
191
|
+
maxWidth,
|
|
192
|
+
minHeight,
|
|
193
|
+
minWidth,
|
|
194
|
+
muted,
|
|
195
|
+
outline,
|
|
196
|
+
overflow,
|
|
197
|
+
overflowX,
|
|
198
|
+
overflowY,
|
|
199
|
+
padding,
|
|
200
|
+
paddingX,
|
|
201
|
+
paddingY,
|
|
202
|
+
paddingTop,
|
|
203
|
+
paddingRight,
|
|
204
|
+
paddingBottom,
|
|
205
|
+
paddingLeft,
|
|
206
|
+
pointerEvents,
|
|
207
|
+
position,
|
|
208
|
+
radius,
|
|
209
|
+
shadow,
|
|
210
|
+
sizing,
|
|
211
|
+
textAlign,
|
|
212
|
+
width
|
|
213
|
+
}), $[65] = alignItems, $[66] = border, $[67] = borderBottom, $[68] = borderLeft, $[69] = borderRight, $[70] = borderTop, $[71] = className, $[72] = display, $[73] = flex, $[74] = flexDirection, $[75] = flexWrap, $[76] = gap, $[77] = gapX, $[78] = gapY, $[79] = gridAutoColumns, $[80] = gridAutoFlow, $[81] = gridAutoRows, $[82] = gridColumn, $[83] = gridColumnEnd, $[84] = gridColumnStart, $[85] = gridRow, $[86] = gridRowEnd, $[87] = gridRowStart, $[88] = gridTemplateColumns, $[89] = gridTemplateRows, $[90] = height, $[91] = inset, $[92] = insetBottom, $[93] = insetLeft, $[94] = insetRight, $[95] = insetTop, $[96] = justifyContent, $[97] = margin, $[98] = marginBottom, $[99] = marginLeft, $[100] = marginRight, $[101] = marginTop, $[102] = marginX, $[103] = marginY, $[104] = maxWidth, $[105] = minHeight, $[106] = minWidth, $[107] = muted, $[108] = outline, $[109] = overflow, $[110] = overflowX, $[111] = overflowY, $[112] = padding, $[113] = paddingBottom, $[114] = paddingLeft, $[115] = paddingRight, $[116] = paddingTop, $[117] = paddingX, $[118] = paddingY, $[119] = pointerEvents, $[120] = position, $[121] = radius, $[122] = shadow, $[123] = sizing, $[124] = textAlign, $[125] = width, $[126] = t9) : t9 = $[126];
|
|
214
|
+
let t10;
|
|
215
|
+
return $[127] !== Element || $[128] !== children || $[129] !== rest || $[130] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(Element, { "data-ui": "Box", ...rest, className: t9, children }), $[127] = Element, $[128] = children, $[129] = rest, $[130] = t9, $[131] = t10) : t10 = $[131], t10;
|
|
216
|
+
}
|
|
217
|
+
const DEFAULT_TEXT_ELEMENT = "div";
|
|
218
|
+
function Text(props) {
|
|
219
|
+
const $ = compilerRuntime.c(30), t0 = props;
|
|
220
|
+
let align, children, className, flex, muted, rest, t1, t2, t3, t4, textOverflowProp;
|
|
221
|
+
$[0] !== t0 ? ({
|
|
222
|
+
align,
|
|
223
|
+
as: t1,
|
|
224
|
+
children,
|
|
225
|
+
className,
|
|
226
|
+
flex,
|
|
227
|
+
maxWidth: t2,
|
|
228
|
+
muted,
|
|
229
|
+
size: t3,
|
|
230
|
+
textOverflow: textOverflowProp,
|
|
231
|
+
weight: t4,
|
|
232
|
+
...rest
|
|
233
|
+
} = t0, $[0] = t0, $[1] = align, $[2] = children, $[3] = className, $[4] = flex, $[5] = muted, $[6] = rest, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = t4, $[11] = textOverflowProp) : (align = $[1], children = $[2], className = $[3], flex = $[4], muted = $[5], rest = $[6], t1 = $[7], t2 = $[8], t3 = $[9], t4 = $[10], textOverflowProp = $[11]);
|
|
234
|
+
const Element = t1 === void 0 ? DEFAULT_TEXT_ELEMENT : t1, maxWidth = t2 === void 0 ? "fill" : t2, size2 = t3 === void 0 ? 2 : t3, weight = t4 === void 0 ? "regular" : t4;
|
|
235
|
+
let t5;
|
|
236
|
+
$[12] !== align || $[13] !== className || $[14] !== flex || $[15] !== maxWidth || $[16] !== muted || $[17] !== size2 || $[18] !== weight ? (t5 = css.text({
|
|
237
|
+
className,
|
|
238
|
+
align,
|
|
239
|
+
flex,
|
|
240
|
+
maxWidth,
|
|
241
|
+
muted,
|
|
242
|
+
size: size2,
|
|
243
|
+
weight
|
|
244
|
+
}), $[12] = align, $[13] = className, $[14] = flex, $[15] = maxWidth, $[16] = muted, $[17] = size2, $[18] = weight, $[19] = t5) : t5 = $[19];
|
|
245
|
+
let t6;
|
|
246
|
+
$[20] !== textOverflowProp ? (t6 = css.textOverflow({
|
|
247
|
+
textOverflow: textOverflowProp
|
|
248
|
+
}), $[20] = textOverflowProp, $[21] = t6) : t6 = $[21];
|
|
249
|
+
let t7;
|
|
250
|
+
$[22] !== children || $[23] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t6, children }), $[22] = children, $[23] = t6, $[24] = t7) : t7 = $[24];
|
|
251
|
+
let t8;
|
|
252
|
+
return $[25] !== Element || $[26] !== rest || $[27] !== t5 || $[28] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Element, { "data-ui": "Text", ...rest, className: t5, children: t7 }), $[25] = Element, $[26] = rest, $[27] = t5, $[28] = t7, $[29] = t8) : t8 = $[29], t8;
|
|
253
|
+
}
|
|
254
|
+
function AnimatedSpinnerIcon(props) {
|
|
255
|
+
const $ = compilerRuntime.c(5);
|
|
256
|
+
let rest;
|
|
257
|
+
$[0] !== props ? ({
|
|
258
|
+
...rest
|
|
259
|
+
} = props, $[0] = props, $[1] = rest) : rest = $[1];
|
|
260
|
+
let t0;
|
|
261
|
+
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t0 = css.animatedSpinnerIcon(), $[2] = t0) : t0 = $[2];
|
|
262
|
+
let t1;
|
|
263
|
+
return $[3] !== rest ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(icons.SpinnerIcon, { "data-sanity-icon": "animated-spinner", ...rest, className: t0 }), $[3] = rest, $[4] = t1) : t1 = $[4], t1;
|
|
264
|
+
}
|
|
265
|
+
const DEFAULT_SPINNER_ELEMENT = "div";
|
|
266
|
+
function Spinner(props) {
|
|
267
|
+
const $ = compilerRuntime.c(11), t0 = props;
|
|
268
|
+
let className, rest, t1;
|
|
269
|
+
$[0] !== t0 ? ({
|
|
270
|
+
as: t1,
|
|
271
|
+
className,
|
|
272
|
+
...rest
|
|
273
|
+
} = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
|
|
274
|
+
const as = t1 === void 0 ? DEFAULT_SPINNER_ELEMENT : t1;
|
|
275
|
+
let t2;
|
|
276
|
+
$[4] !== className ? (t2 = css.spinner({
|
|
277
|
+
className
|
|
278
|
+
}), $[4] = className, $[5] = t2) : t2 = $[5];
|
|
279
|
+
let t3;
|
|
280
|
+
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(AnimatedSpinnerIcon, {}), $[6] = t3) : t3 = $[6];
|
|
281
|
+
let t4;
|
|
282
|
+
return $[7] !== as || $[8] !== rest || $[9] !== t2 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(Text, { as, "data-ui": "Spinner", ...rest, className: t2, children: t3 }), $[7] = as, $[8] = rest, $[9] = t2, $[10] = t4) : t4 = $[10], t4;
|
|
283
|
+
}
|
|
284
|
+
const DEFAULT_BUTTON_ELEMENT = "button";
|
|
285
|
+
function Button(props) {
|
|
286
|
+
const {
|
|
287
|
+
align = "center",
|
|
288
|
+
as: Element = DEFAULT_BUTTON_ELEMENT,
|
|
289
|
+
children,
|
|
290
|
+
className,
|
|
291
|
+
disabled,
|
|
292
|
+
flex,
|
|
293
|
+
fontSize = 1,
|
|
294
|
+
gap = props.padding ?? 3,
|
|
295
|
+
gapX,
|
|
296
|
+
gapY,
|
|
297
|
+
icon: IconComponent,
|
|
298
|
+
iconRight: IconRightComponent,
|
|
299
|
+
justify = "center",
|
|
300
|
+
loading,
|
|
301
|
+
mode = "default",
|
|
302
|
+
padding = 3,
|
|
303
|
+
paddingX,
|
|
304
|
+
paddingY,
|
|
305
|
+
paddingTop,
|
|
306
|
+
paddingBottom,
|
|
307
|
+
paddingLeft,
|
|
308
|
+
paddingRight,
|
|
309
|
+
radius = 2,
|
|
310
|
+
selected,
|
|
311
|
+
text,
|
|
312
|
+
textAlign,
|
|
313
|
+
textOverflow = "ellipsis",
|
|
314
|
+
textWeight = "medium",
|
|
315
|
+
tone = "default",
|
|
316
|
+
type = "button",
|
|
317
|
+
muted = !1,
|
|
318
|
+
width,
|
|
319
|
+
...rest
|
|
320
|
+
} = props;
|
|
321
|
+
let href;
|
|
322
|
+
return "href" in rest && (href = typeof rest.href == "string" ? rest.href : href, delete rest.href), /* @__PURE__ */ jsxRuntime.jsxs(
|
|
323
|
+
Element,
|
|
324
|
+
{
|
|
325
|
+
"data-ui": "Button",
|
|
326
|
+
...rest,
|
|
327
|
+
className: css.button({
|
|
328
|
+
className,
|
|
329
|
+
flex,
|
|
330
|
+
mode,
|
|
331
|
+
radius,
|
|
332
|
+
tone,
|
|
333
|
+
width
|
|
334
|
+
}),
|
|
335
|
+
"data-disabled": loading || disabled ? "" : void 0,
|
|
336
|
+
"data-selected": selected ? "" : void 0,
|
|
337
|
+
disabled: !!(loading || disabled),
|
|
338
|
+
href: disabled ? void 0 : href,
|
|
339
|
+
type,
|
|
340
|
+
children: [
|
|
341
|
+
!!loading && /* @__PURE__ */ jsxRuntime.jsx(Box, { alignItems: "center", as: "span", className: css.buttonLoadingBox(), display: "flex", flex: 1, justifyContent: "center", width: "fill", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: fontSize }) }),
|
|
342
|
+
(IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsxs(Box, { alignItems: align, as: "span", display: "flex", flex: 1, gap, gapX, gapY, justifyContent: justify, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children: [
|
|
343
|
+
IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
|
|
344
|
+
react.isValidElement(IconComponent) && IconComponent,
|
|
345
|
+
reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
346
|
+
] }),
|
|
347
|
+
text && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", maxWidth: "auto", children: /* @__PURE__ */ jsxRuntime.jsx(Text, { align: textAlign, as: "span", muted, size: fontSize, textOverflow, weight: textWeight, children: text }) }),
|
|
348
|
+
IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
|
|
349
|
+
react.isValidElement(IconRightComponent) && IconRightComponent,
|
|
350
|
+
reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
|
|
351
|
+
] })
|
|
352
|
+
] }),
|
|
353
|
+
children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", flex: 1, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children })
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
function useMatchMedia(mediaQueryString, getServerSnapshot2) {
|
|
359
|
+
const $ = compilerRuntime.c(4);
|
|
360
|
+
react.useDebugValue(mediaQueryString);
|
|
361
|
+
let t0;
|
|
362
|
+
$[0] !== mediaQueryString ? (t0 = (onStoreChange) => {
|
|
363
|
+
const media2 = window.matchMedia(mediaQueryString);
|
|
364
|
+
return media2.addEventListener("change", onStoreChange), () => media2.removeEventListener("change", onStoreChange);
|
|
365
|
+
}, $[0] = mediaQueryString, $[1] = t0) : t0 = $[1];
|
|
366
|
+
let t1;
|
|
367
|
+
return $[2] !== mediaQueryString ? (t1 = () => window.matchMedia(mediaQueryString).matches, $[2] = mediaQueryString, $[3] = t1) : t1 = $[3], react.useSyncExternalStore(t0, t1, getServerSnapshot2);
|
|
368
|
+
}
|
|
369
|
+
function usePrefersReducedMotion(t0) {
|
|
370
|
+
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$5 : t0);
|
|
371
|
+
}
|
|
372
|
+
function _temp$5() {
|
|
373
|
+
return !1;
|
|
374
|
+
}
|
|
375
|
+
const origin = {
|
|
376
|
+
name: "@sanity/ui/origin",
|
|
377
|
+
fn({
|
|
378
|
+
middlewareData,
|
|
379
|
+
placement,
|
|
380
|
+
rects
|
|
381
|
+
}) {
|
|
382
|
+
const [side] = placement.split("-"), floatingWidth = rects.floating.width, floatingHeight = rects.floating.height, shiftX = middlewareData.shift?.x || 0, shiftY = middlewareData.shift?.y || 0;
|
|
383
|
+
if (floatingWidth <= 0 || floatingHeight <= 0)
|
|
384
|
+
return {};
|
|
385
|
+
const isVerticalPlacement = ["bottom", "top"].includes(side), {
|
|
386
|
+
originX,
|
|
387
|
+
originY
|
|
388
|
+
} = isVerticalPlacement ? {
|
|
389
|
+
originX: clamp(0.5 - shiftX / floatingWidth, 0, 1),
|
|
390
|
+
originY: side === "bottom" ? 0 : 1
|
|
391
|
+
} : {
|
|
392
|
+
originX: side === "left" ? 1 : 0,
|
|
393
|
+
originY: clamp(0.5 - shiftY / floatingHeight, 0, 1)
|
|
394
|
+
};
|
|
395
|
+
return {
|
|
396
|
+
data: {
|
|
397
|
+
originX,
|
|
398
|
+
originY
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
function clamp(num, min, max) {
|
|
404
|
+
return Math.min(Math.max(num, min), max);
|
|
405
|
+
}
|
|
406
|
+
function getGlobalScope() {
|
|
407
|
+
if (typeof globalThis < "u") return globalThis;
|
|
408
|
+
if (typeof window < "u") return window;
|
|
409
|
+
if (typeof self < "u") return self;
|
|
410
|
+
if (typeof global < "u") return global;
|
|
411
|
+
throw new Error("@sanity/ui: could not locate global scope");
|
|
412
|
+
}
|
|
413
|
+
const globalScope = getGlobalScope();
|
|
414
|
+
function createGlobalScopedContext(key2, defaultValue) {
|
|
415
|
+
const symbol = Symbol.for(key2);
|
|
416
|
+
if (typeof document > "u")
|
|
417
|
+
return react.createContext(defaultValue);
|
|
418
|
+
const symbolMap = globalScope;
|
|
419
|
+
return symbolMap[symbol] = symbolMap[symbol] || react.createContext(defaultValue), symbolMap[symbol];
|
|
420
|
+
}
|
|
421
|
+
const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/v3/boundaryElement", null), DEFAULT_VALUE = {
|
|
422
|
+
version: 0,
|
|
423
|
+
element: null
|
|
424
|
+
};
|
|
425
|
+
function useBoundaryElement() {
|
|
426
|
+
const value = react.useContext(BoundaryElementContext);
|
|
427
|
+
if (value && (!isRecord(value) || value.version !== 0))
|
|
428
|
+
throw new Error("useBoundaryElement(): the context value is not compatible");
|
|
429
|
+
return value || DEFAULT_VALUE;
|
|
430
|
+
}
|
|
431
|
+
function getElementRef(element) {
|
|
432
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
433
|
+
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);
|
|
434
|
+
}
|
|
435
|
+
const CardContext = createGlobalScopedContext("@sanity/ui/v3/card", null);
|
|
436
|
+
function CardProvider(props) {
|
|
437
|
+
const $ = compilerRuntime.c(7), {
|
|
438
|
+
children,
|
|
439
|
+
tone,
|
|
440
|
+
scheme,
|
|
441
|
+
unstable_CompatProvider
|
|
442
|
+
} = props;
|
|
443
|
+
let t0, t1;
|
|
444
|
+
$[0] !== scheme || $[1] !== tone || $[2] !== unstable_CompatProvider ? (t1 = {
|
|
445
|
+
tone,
|
|
446
|
+
scheme,
|
|
447
|
+
unstable_CompatProvider
|
|
448
|
+
}, $[0] = scheme, $[1] = tone, $[2] = unstable_CompatProvider, $[3] = t1) : t1 = $[3], t0 = t1;
|
|
449
|
+
let t2;
|
|
450
|
+
return $[4] !== children || $[5] !== t0 ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(CardContext.Provider, { value: t0, children }), $[4] = children, $[5] = t0, $[6] = t2) : t2 = $[6], t2;
|
|
451
|
+
}
|
|
452
|
+
function useCard() {
|
|
453
|
+
const card = react.useContext(CardContext);
|
|
454
|
+
if (!card)
|
|
455
|
+
throw new Error("useCard(): missing context value");
|
|
456
|
+
return card;
|
|
457
|
+
}
|
|
458
|
+
const key = "@sanity/ui/v3/portal", elementKey = Symbol.for(`${key}/element`), elementMap = globalScope;
|
|
459
|
+
elementMap[elementKey] = null;
|
|
460
|
+
const defaultContextValue = {
|
|
461
|
+
version: 0,
|
|
462
|
+
boundaryElement: null,
|
|
463
|
+
get element() {
|
|
464
|
+
return typeof document > "u" ? null : (elementMap[elementKey] || (elementMap[elementKey] = document.createElement("div"), elementMap[elementKey].setAttribute("data-portal", ""), document.body.appendChild(elementMap[elementKey])), elementMap[elementKey]);
|
|
465
|
+
}
|
|
466
|
+
}, PortalContext = createGlobalScopedContext(key, defaultContextValue);
|
|
467
|
+
function usePortal() {
|
|
468
|
+
const value = react.useContext(PortalContext);
|
|
469
|
+
if (!value)
|
|
470
|
+
throw new Error("usePortal(): missing context value");
|
|
471
|
+
if (!isRecord(value) || value.version !== 0)
|
|
472
|
+
throw new Error("usePortal(): the context value is not compatible");
|
|
473
|
+
return value;
|
|
474
|
+
}
|
|
475
|
+
function Portal(props) {
|
|
476
|
+
const $ = compilerRuntime.c(6), {
|
|
477
|
+
children,
|
|
478
|
+
__unstable_name: name
|
|
479
|
+
} = props, card = useCard(), portal = usePortal(), portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default;
|
|
480
|
+
if (!portalElement)
|
|
481
|
+
return null;
|
|
482
|
+
let t0;
|
|
483
|
+
$[0] !== card.scheme || $[1] !== children ? (t0 = /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { tone: "transparent", scheme: card.scheme, children }), $[0] = card.scheme, $[1] = children, $[2] = t0) : t0 = $[2];
|
|
484
|
+
let t1;
|
|
485
|
+
return $[3] !== portalElement || $[4] !== t0 ? (t1 = reactDom.createPortal(t0, portalElement), $[3] = portalElement, $[4] = t0, $[5] = t1) : t1 = $[5], t1;
|
|
486
|
+
}
|
|
487
|
+
function getLayerContext(contextValue) {
|
|
488
|
+
if (!isRecord(contextValue) || contextValue.version !== 0)
|
|
489
|
+
throw new Error("the context value is not compatible");
|
|
490
|
+
if (!contextValue)
|
|
491
|
+
throw new Error("components using `useLayer()` should be wrapped in a <LayerProvider>.");
|
|
492
|
+
if (contextValue.version === 0)
|
|
493
|
+
return contextValue;
|
|
494
|
+
throw new Error("could not get layer context");
|
|
495
|
+
}
|
|
496
|
+
const LayerContext = createGlobalScopedContext("@sanity/ui/v3/layer", null);
|
|
497
|
+
function useLayer() {
|
|
498
|
+
const $ = compilerRuntime.c(2), value = react.useContext(LayerContext);
|
|
499
|
+
if (!value)
|
|
500
|
+
throw new Error("useLayer(): missing context value");
|
|
501
|
+
try {
|
|
502
|
+
let t1;
|
|
503
|
+
return $[0] !== value ? (t1 = getLayerContext(value), $[0] = value, $[1] = t1) : t1 = $[1], t1;
|
|
504
|
+
} catch (t0) {
|
|
505
|
+
const err = t0;
|
|
506
|
+
throw err instanceof Error ? new Error(`useLayer(): ${err.message}`) : new Error(`useLayer(): ${err}`);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
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 = {
|
|
510
|
+
top: ["bottom", "left", "right"],
|
|
511
|
+
"top-start": ["bottom-start", "left-start", "right-start"],
|
|
512
|
+
"top-end": ["bottom-end", "left-end", "right-end"],
|
|
513
|
+
bottom: ["top", "left", "right"],
|
|
514
|
+
"bottom-start": ["top-start", "left-start", "right-start"],
|
|
515
|
+
"bottom-end": ["top-end", "left-end", "right-end"],
|
|
516
|
+
left: ["right", "top", "bottom"],
|
|
517
|
+
"left-start": ["right-start", "top-start", "bottom-start"],
|
|
518
|
+
"left-end": ["right-end", "top-end", "bottom-end"],
|
|
519
|
+
right: ["left", "top", "bottom"],
|
|
520
|
+
"right-start": ["left-start", "top-start", "bottom-start"],
|
|
521
|
+
"right-end": ["left-end", "top-end", "bottom-end"]
|
|
522
|
+
};
|
|
523
|
+
function size(options) {
|
|
524
|
+
const {
|
|
525
|
+
apply,
|
|
526
|
+
margins,
|
|
527
|
+
padding = 0
|
|
528
|
+
} = options;
|
|
529
|
+
return {
|
|
530
|
+
name: "@sanity/ui/size",
|
|
531
|
+
async fn(args) {
|
|
532
|
+
const {
|
|
533
|
+
elements,
|
|
534
|
+
placement,
|
|
535
|
+
platform,
|
|
536
|
+
rects
|
|
537
|
+
} = args, {
|
|
538
|
+
floating,
|
|
539
|
+
reference
|
|
540
|
+
} = rects, overflow = await reactDom$1.detectOverflow(args, {
|
|
541
|
+
altBoundary: !0,
|
|
542
|
+
boundary: options.boundaryElement || void 0,
|
|
543
|
+
elementContext: "floating",
|
|
544
|
+
padding,
|
|
545
|
+
rootBoundary: "viewport"
|
|
546
|
+
});
|
|
547
|
+
let maxWidth = 1 / 0, maxHeight = 1 / 0;
|
|
548
|
+
const floatingW = floating.width, floatingH = floating.height;
|
|
549
|
+
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({
|
|
550
|
+
availableWidth: maxWidth - margins[1] - margins[3],
|
|
551
|
+
availableHeight: maxHeight - margins[0] - margins[2],
|
|
552
|
+
elements,
|
|
553
|
+
referenceWidth: reference.width - margins[1] - margins[3]
|
|
554
|
+
});
|
|
555
|
+
const nextDimensions = await platform.getDimensions(elements.floating), targetH = nextDimensions.height, targetW = nextDimensions.width;
|
|
556
|
+
return floatingW !== targetW || floatingH !== targetH ? {
|
|
557
|
+
reset: {
|
|
558
|
+
rects: !0
|
|
559
|
+
}
|
|
560
|
+
} : {};
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
function moveTowardsLength(movingPoint, targetPoint, amount) {
|
|
565
|
+
const width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
|
|
566
|
+
return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
|
|
567
|
+
}
|
|
568
|
+
function moveTowardsFractional(movingPoint, targetPoint, fraction) {
|
|
569
|
+
return {
|
|
570
|
+
x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
|
|
571
|
+
y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
function getRoundedCommands(points) {
|
|
575
|
+
const len = points.length, cmds = [];
|
|
576
|
+
for (let i = 0; i < len; i += 1) {
|
|
577
|
+
const point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
|
|
578
|
+
if (prevPoint && point.radius) {
|
|
579
|
+
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);
|
|
580
|
+
cmds.push({
|
|
581
|
+
type: "point",
|
|
582
|
+
...curveStart
|
|
583
|
+
}), cmds.push({
|
|
584
|
+
type: "curve",
|
|
585
|
+
curveEnd,
|
|
586
|
+
startControl,
|
|
587
|
+
endControl
|
|
588
|
+
});
|
|
589
|
+
} else
|
|
590
|
+
cmds.push({
|
|
591
|
+
type: "point",
|
|
592
|
+
...point
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
return cmds;
|
|
596
|
+
}
|
|
597
|
+
function compileCommands(cmds) {
|
|
598
|
+
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(" ");
|
|
599
|
+
}
|
|
600
|
+
const DEFAULT_ARROW_ELEMENT = "div";
|
|
601
|
+
function Arrow(props) {
|
|
602
|
+
const $ = compilerRuntime.c(34), t0 = props;
|
|
603
|
+
let h, rest, style, t1, t2, w;
|
|
604
|
+
$[0] !== t0 ? ({
|
|
605
|
+
as: t1,
|
|
606
|
+
width: w,
|
|
607
|
+
height: h,
|
|
608
|
+
radius: t2,
|
|
609
|
+
style,
|
|
610
|
+
...rest
|
|
611
|
+
} = t0, $[0] = t0, $[1] = h, $[2] = rest, $[3] = style, $[4] = t1, $[5] = t2, $[6] = w) : (h = $[1], rest = $[2], style = $[3], t1 = $[4], t2 = $[5], w = $[6]);
|
|
612
|
+
const Element = t1 === void 0 ? DEFAULT_ARROW_ELEMENT : t1, radius = t2 === void 0 ? 0 : t2, center = w / 2;
|
|
613
|
+
let t3;
|
|
614
|
+
const points = [{
|
|
615
|
+
x: 0,
|
|
616
|
+
y: 0
|
|
617
|
+
}, {
|
|
618
|
+
x: radius,
|
|
619
|
+
y: 0,
|
|
620
|
+
radius
|
|
621
|
+
}, {
|
|
622
|
+
x: center,
|
|
623
|
+
y: h - 1,
|
|
624
|
+
radius
|
|
625
|
+
}, {
|
|
626
|
+
x: w - radius,
|
|
627
|
+
y: 0,
|
|
628
|
+
radius
|
|
629
|
+
}, {
|
|
630
|
+
x: w,
|
|
631
|
+
y: 0
|
|
632
|
+
}], cmds = getRoundedCommands(points);
|
|
633
|
+
t3 = compileCommands(cmds);
|
|
634
|
+
const path = t3, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`;
|
|
635
|
+
let t4;
|
|
636
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = css._arrow(), $[7] = t4) : t4 = $[7];
|
|
637
|
+
const t5 = `${w}px`;
|
|
638
|
+
let t6;
|
|
639
|
+
$[8] !== t5 ? (t6 = dynamic.assignInlineVars({
|
|
640
|
+
[css.vars.arrow.size]: t5
|
|
641
|
+
}), $[8] = t5, $[9] = t6) : t6 = $[9];
|
|
642
|
+
let t7;
|
|
643
|
+
$[10] !== style || $[11] !== t6 ? (t7 = {
|
|
644
|
+
...style,
|
|
645
|
+
...t6
|
|
646
|
+
}, $[10] = style, $[11] = t6, $[12] = t7) : t7 = $[12];
|
|
647
|
+
let t8;
|
|
648
|
+
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t8 = css._arrowSvg(), $[13] = t8) : t8 = $[13];
|
|
649
|
+
const t9 = `0 0 ${w} ${w}`;
|
|
650
|
+
let t10;
|
|
651
|
+
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t10 = css._arrowStrokeMask(), $[14] = t10) : t10 = $[14];
|
|
652
|
+
let t11;
|
|
653
|
+
$[15] !== w ? (t11 = /* @__PURE__ */ jsxRuntime.jsx("mask", { id: "stroke-mask", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { className: t10, x: 0, width: w, height: w, fill: "white" }) }), $[15] = w, $[16] = t11) : t11 = $[16];
|
|
654
|
+
let t12;
|
|
655
|
+
$[17] === Symbol.for("react.memo_cache_sentinel") ? (t12 = css._arrowStroke(), $[17] = t12) : t12 = $[17];
|
|
656
|
+
let t13;
|
|
657
|
+
$[18] !== strokePath ? (t13 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t12, d: strokePath, mask: "url(#stroke-mask)" }), $[18] = strokePath, $[19] = t13) : t13 = $[19];
|
|
658
|
+
let t14;
|
|
659
|
+
$[20] === Symbol.for("react.memo_cache_sentinel") ? (t14 = css._arrowShape(), $[20] = t14) : t14 = $[20];
|
|
660
|
+
let t15;
|
|
661
|
+
$[21] !== fillPath ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t14, d: fillPath }), $[21] = fillPath, $[22] = t15) : t15 = $[22];
|
|
662
|
+
let t16;
|
|
663
|
+
$[23] !== t11 || $[24] !== t13 || $[25] !== t15 || $[26] !== t9 || $[27] !== w ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: t8, width: w, height: w, viewBox: t9, children: [
|
|
664
|
+
t11,
|
|
665
|
+
t13,
|
|
666
|
+
t15
|
|
667
|
+
] }), $[23] = t11, $[24] = t13, $[25] = t15, $[26] = t9, $[27] = w, $[28] = t16) : t16 = $[28];
|
|
668
|
+
let t17;
|
|
669
|
+
return $[29] !== Element || $[30] !== rest || $[31] !== t16 || $[32] !== t7 ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(Element, { ...rest, className: t4, style: t7, children: t16 }), $[29] = Element, $[30] = rest, $[31] = t16, $[32] = t7, $[33] = t17) : t17 = $[33], t17;
|
|
670
|
+
}
|
|
671
|
+
const DEFAULT_FLEX_ELEMENT = "div";
|
|
672
|
+
function Flex(props) {
|
|
673
|
+
const $ = compilerRuntime.c(14), t0 = props;
|
|
674
|
+
let align, justify, rest, t1, t2, wrap;
|
|
675
|
+
$[0] !== t0 ? ({
|
|
676
|
+
align,
|
|
677
|
+
as: t1,
|
|
678
|
+
direction: t2,
|
|
679
|
+
justify,
|
|
680
|
+
wrap,
|
|
681
|
+
...rest
|
|
682
|
+
} = t0, $[0] = t0, $[1] = align, $[2] = justify, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = wrap) : (align = $[1], justify = $[2], rest = $[3], t1 = $[4], t2 = $[5], wrap = $[6]);
|
|
683
|
+
const as = t1 === void 0 ? DEFAULT_FLEX_ELEMENT : t1, direction = t2 === void 0 ? "row" : t2;
|
|
684
|
+
let t3;
|
|
685
|
+
return $[7] !== align || $[8] !== as || $[9] !== direction || $[10] !== justify || $[11] !== rest || $[12] !== wrap ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Flex", ...rest, alignItems: align, as, display: "flex", flexDirection: direction, flexWrap: wrap, justifyContent: justify }), $[7] = align, $[8] = as, $[9] = direction, $[10] = justify, $[11] = rest, $[12] = wrap, $[13] = t3) : t3 = $[13], t3;
|
|
686
|
+
}
|
|
687
|
+
const DEFAULT_CARD_ELEMENT = "div";
|
|
688
|
+
function Card(props) {
|
|
689
|
+
const $ = compilerRuntime.c(38), t0 = props;
|
|
690
|
+
let className, disabled, pressed, rest, schemeProp, selected, style, t1, t2, t3, t4, t5;
|
|
691
|
+
$[0] !== t0 ? ({
|
|
692
|
+
__unstable_checkered: t1,
|
|
693
|
+
__unstable_focusRing: t2,
|
|
694
|
+
as: t3,
|
|
695
|
+
className,
|
|
696
|
+
disabled,
|
|
697
|
+
pressed,
|
|
698
|
+
radius: t4,
|
|
699
|
+
scheme: schemeProp,
|
|
700
|
+
selected,
|
|
701
|
+
style,
|
|
702
|
+
tone: t5,
|
|
703
|
+
...rest
|
|
704
|
+
} = t0, $[0] = t0, $[1] = className, $[2] = disabled, $[3] = pressed, $[4] = rest, $[5] = schemeProp, $[6] = selected, $[7] = style, $[8] = t1, $[9] = t2, $[10] = t3, $[11] = t4, $[12] = t5) : (className = $[1], disabled = $[2], pressed = $[3], rest = $[4], schemeProp = $[5], selected = $[6], style = $[7], t1 = $[8], t2 = $[9], t3 = $[10], t4 = $[11], t5 = $[12]);
|
|
705
|
+
const checkered = t1 === void 0 ? !1 : t1, focusRing = t2 === void 0 ? !1 : t2, as = t3 === void 0 ? DEFAULT_CARD_ELEMENT : t3, radius = t4 === void 0 ? 0 : t4, toneProp = t5 === void 0 ? "default" : t5, parent = react.useContext(CardContext), tone = toneProp === "inherit" ? parent?.tone : toneProp, scheme = schemeProp === void 0 ? parent?.scheme : schemeProp, t6 = scheme === parent?.scheme ? void 0 : scheme;
|
|
706
|
+
let t7;
|
|
707
|
+
$[13] !== className || $[14] !== t6 || $[15] !== tone ? (t7 = css.card({
|
|
708
|
+
className,
|
|
709
|
+
scheme: t6,
|
|
710
|
+
tone
|
|
711
|
+
}), $[13] = className, $[14] = t6, $[15] = tone, $[16] = t7) : t7 = $[16];
|
|
712
|
+
const t8 = checkered ? "" : void 0, t9 = disabled ? "" : void 0, t10 = focusRing ? "" : void 0, t11 = pressed ? "" : void 0, t12 = selected ? "" : void 0;
|
|
713
|
+
let t13;
|
|
714
|
+
$[17] !== as || $[18] !== radius || $[19] !== rest || $[20] !== style || $[21] !== t10 || $[22] !== t11 || $[23] !== t12 || $[24] !== t7 || $[25] !== t8 || $[26] !== t9 ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Card", ...rest, as, className: t7, "data-checkered": t8, "data-disabled": t9, "data-focus-ring": t10, "data-pressed": t11, "data-selected": t12, radius, style }), $[17] = as, $[18] = radius, $[19] = rest, $[20] = style, $[21] = t10, $[22] = t11, $[23] = t12, $[24] = t7, $[25] = t8, $[26] = t9, $[27] = t13) : t13 = $[27];
|
|
715
|
+
let node = t13;
|
|
716
|
+
if (scheme === parent?.scheme && tone === parent?.tone)
|
|
717
|
+
return node;
|
|
718
|
+
const t14 = scheme ?? "light", t15 = tone ?? "default", t16 = parent?.unstable_CompatProvider;
|
|
719
|
+
let t17;
|
|
720
|
+
if ($[28] !== node || $[29] !== t14 || $[30] !== t15 || $[31] !== t16 ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { scheme: t14, tone: t15, unstable_CompatProvider: t16, children: node }), $[28] = node, $[29] = t14, $[30] = t15, $[31] = t16, $[32] = t17) : t17 = $[32], node = t17, parent?.unstable_CompatProvider) {
|
|
721
|
+
const CompatProvider = parent.unstable_CompatProvider, t18 = scheme ?? "light", t19 = tone ?? parent.tone;
|
|
722
|
+
let t20;
|
|
723
|
+
return $[33] !== CompatProvider || $[34] !== node || $[35] !== t18 || $[36] !== t19 ? (t20 = /* @__PURE__ */ jsxRuntime.jsx(CompatProvider, { scheme: t18, tone: t19, children: node }), $[33] = CompatProvider, $[34] = node, $[35] = t18, $[36] = t19, $[37] = t20) : t20 = $[37], t20;
|
|
724
|
+
}
|
|
725
|
+
return node;
|
|
726
|
+
}
|
|
727
|
+
const DEFAULT_LAYER_CARD_ELEMENT = "div";
|
|
728
|
+
function LayerCard(props) {
|
|
729
|
+
const $ = compilerRuntime.c(27), t0 = props;
|
|
730
|
+
let children, forwardedRef, onActivate, onFocus, rest, t1, t2, t3;
|
|
731
|
+
$[0] !== t0 ? ({
|
|
732
|
+
as: t1,
|
|
733
|
+
children,
|
|
734
|
+
onActivate,
|
|
735
|
+
onFocus,
|
|
736
|
+
position: t2,
|
|
737
|
+
ref: forwardedRef,
|
|
738
|
+
style: t3,
|
|
739
|
+
...rest
|
|
740
|
+
} = t0, $[0] = t0, $[1] = children, $[2] = forwardedRef, $[3] = onActivate, $[4] = onFocus, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3) : (children = $[1], forwardedRef = $[2], onActivate = $[3], onFocus = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8]);
|
|
741
|
+
const as = t1 === void 0 ? DEFAULT_LAYER_CARD_ELEMENT : t1, position = t2 === void 0 ? "relative" : t2, style = t3 === void 0 ? EMPTY_RECORD : t3, {
|
|
742
|
+
zIndex,
|
|
743
|
+
isTopLayer
|
|
744
|
+
} = useLayer(), lastFocusedRef = react.useRef(null), ref = react.useRef(null), isTopLayerRef = react.useRef(isTopLayer);
|
|
745
|
+
let t4;
|
|
746
|
+
$[9] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[9] = t4) : t4 = $[9], react.useImperativeHandle(forwardedRef, t4);
|
|
747
|
+
let t5, t6;
|
|
748
|
+
$[10] !== isTopLayer || $[11] !== onActivate ? (t5 = () => {
|
|
749
|
+
isTopLayerRef.current !== isTopLayer && isTopLayer && onActivate?.({
|
|
750
|
+
activeElement: lastFocusedRef.current
|
|
751
|
+
}), isTopLayerRef.current = isTopLayer;
|
|
752
|
+
}, t6 = [isTopLayer, onActivate], $[10] = isTopLayer, $[11] = onActivate, $[12] = t5, $[13] = t6) : (t5 = $[12], t6 = $[13]), react.useEffect(t5, t6);
|
|
753
|
+
let t7;
|
|
754
|
+
$[14] !== isTopLayer || $[15] !== onFocus ? (t7 = (event) => {
|
|
755
|
+
onFocus?.(event);
|
|
756
|
+
const rootElement = ref.current, target = document.activeElement;
|
|
757
|
+
!isTopLayer || !rootElement || !target || isHTMLElement(target) && containsOrEqualsElement(rootElement, target) && (lastFocusedRef.current = target);
|
|
758
|
+
}, $[14] = isTopLayer, $[15] = onFocus, $[16] = t7) : t7 = $[16];
|
|
759
|
+
const handleFocus = t7, t8 = as;
|
|
760
|
+
let t9;
|
|
761
|
+
$[17] !== style || $[18] !== zIndex ? (t9 = {
|
|
762
|
+
...style,
|
|
763
|
+
zIndex
|
|
764
|
+
}, $[17] = style, $[18] = zIndex, $[19] = t9) : t9 = $[19];
|
|
765
|
+
let t10;
|
|
766
|
+
return $[20] !== children || $[21] !== handleFocus || $[22] !== position || $[23] !== rest || $[24] !== t8 || $[25] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(Card, { "data-ui": "Layer", ...rest, as: t8, onFocus: handleFocus, position, ref, style: t9, children }), $[20] = children, $[21] = handleFocus, $[22] = position, $[23] = rest, $[24] = t8, $[25] = t9, $[26] = t10) : t10 = $[26], t10;
|
|
767
|
+
}
|
|
768
|
+
const media = Object.values(css.BREAKPOINTS);
|
|
769
|
+
function _getMediaQuery(media2, index) {
|
|
770
|
+
return index === 0 ? `screen and (max-width: ${media2[index + 1] - 1}px)` : index === media2.length - 1 ? `screen and (min-width: ${media2[index]}px)` : `screen and (min-width: ${media2[index]}px) and (max-width: ${media2[index + 1] - 1}px)`;
|
|
771
|
+
}
|
|
772
|
+
function _createMediaStore() {
|
|
773
|
+
const mediaLen = media.length;
|
|
774
|
+
let sizes;
|
|
775
|
+
const getSizes = () => {
|
|
776
|
+
if (typeof window > "u")
|
|
777
|
+
return sizes;
|
|
778
|
+
if (!sizes) {
|
|
779
|
+
sizes = [];
|
|
780
|
+
for (let index = mediaLen; index > -1; index -= 1) {
|
|
781
|
+
const mediaQuery = _getMediaQuery(media, index);
|
|
782
|
+
sizes.push({
|
|
783
|
+
index,
|
|
784
|
+
mq: window.matchMedia(mediaQuery)
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return sizes;
|
|
789
|
+
};
|
|
790
|
+
return {
|
|
791
|
+
getSnapshot: () => {
|
|
792
|
+
for (const {
|
|
793
|
+
index,
|
|
794
|
+
mq
|
|
795
|
+
} of getSizes() ?? [])
|
|
796
|
+
if (mq.matches) return index;
|
|
797
|
+
return 0;
|
|
798
|
+
},
|
|
799
|
+
subscribe: (onStoreChange) => {
|
|
800
|
+
const disposeFns = [];
|
|
801
|
+
for (const {
|
|
802
|
+
mq
|
|
803
|
+
} of getSizes() ?? []) {
|
|
804
|
+
const handleChange = () => {
|
|
805
|
+
mq.matches && onStoreChange();
|
|
806
|
+
};
|
|
807
|
+
mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
|
|
808
|
+
}
|
|
809
|
+
return () => {
|
|
810
|
+
for (const disposeFn of disposeFns)
|
|
811
|
+
disposeFn();
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
function getServerSnapshot() {
|
|
817
|
+
return 0;
|
|
818
|
+
}
|
|
819
|
+
function useMediaIndex() {
|
|
820
|
+
const $ = compilerRuntime.c(1);
|
|
821
|
+
let t0, t1;
|
|
822
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = _createMediaStore(), $[0] = t1) : t1 = $[0], t0 = t1;
|
|
823
|
+
const store = t0;
|
|
824
|
+
return react.useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
|
|
825
|
+
}
|
|
826
|
+
function LayerProvider(props) {
|
|
827
|
+
const $ = compilerRuntime.c(19), {
|
|
828
|
+
children,
|
|
829
|
+
zOffset: t0
|
|
830
|
+
} = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = react.useContext(LayerContext);
|
|
831
|
+
let t1;
|
|
832
|
+
$[0] !== parentContextValue ? (t1 = parentContextValue && getLayerContext(parentContextValue), $[0] = parentContextValue, $[1] = t1) : t1 = $[1];
|
|
833
|
+
const parent = t1, parentRegisterChild = parent?.registerChild, level = (parent?.level ?? 0) + 1, zOffset = useResponsiveProp(zOffsetProp), maxMediaIndex = Object.values(zOffset).length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + (zOffset[mediaIndex] ?? 0) : zOffset[mediaIndex] ?? 0;
|
|
834
|
+
let t2;
|
|
835
|
+
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {}, $[2] = t2) : t2 = $[2];
|
|
836
|
+
const [, setChildLayers] = react.useState(t2), [size2, setSize] = react.useState(0), isTopLayer = size2 === 0;
|
|
837
|
+
let t3;
|
|
838
|
+
$[3] !== parentRegisterChild || $[4] !== setChildLayers ? (t3 = (childLevel) => {
|
|
839
|
+
const parentDispose = parentRegisterChild?.(childLevel);
|
|
840
|
+
return childLevel !== void 0 ? setChildLayers((state) => {
|
|
841
|
+
const prevLen = state[childLevel] ?? 0, nextState = {
|
|
842
|
+
...state,
|
|
843
|
+
[childLevel]: prevLen + 1
|
|
844
|
+
};
|
|
845
|
+
return setSize(Object.keys(nextState).length), nextState;
|
|
846
|
+
}) : setSize(_temp$4), () => {
|
|
847
|
+
childLevel !== void 0 ? setChildLayers((state_0) => {
|
|
848
|
+
const nextState_0 = {
|
|
849
|
+
...state_0
|
|
850
|
+
};
|
|
851
|
+
return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
|
|
852
|
+
}) : setSize(_temp2$2), parentDispose?.();
|
|
853
|
+
};
|
|
854
|
+
}, $[3] = parentRegisterChild, $[4] = setChildLayers, $[5] = t3) : t3 = $[5];
|
|
855
|
+
const registerChild = t3;
|
|
856
|
+
let t4, t5;
|
|
857
|
+
$[6] !== level || $[7] !== parentRegisterChild ? (t4 = () => parentRegisterChild?.(level), t5 = [level, parentRegisterChild], $[6] = level, $[7] = parentRegisterChild, $[8] = t4, $[9] = t5) : (t4 = $[8], t5 = $[9]), react.useEffect(t4, t5);
|
|
858
|
+
let t6, t7;
|
|
859
|
+
$[10] !== isTopLayer || $[11] !== level || $[12] !== registerChild || $[13] !== size2 || $[14] !== zIndex ? (t7 = {
|
|
860
|
+
version: 0,
|
|
861
|
+
isTopLayer,
|
|
862
|
+
level,
|
|
863
|
+
registerChild,
|
|
864
|
+
size: size2,
|
|
865
|
+
zIndex
|
|
866
|
+
}, $[10] = isTopLayer, $[11] = level, $[12] = registerChild, $[13] = size2, $[14] = zIndex, $[15] = t7) : t7 = $[15], t6 = t7;
|
|
867
|
+
const value = t6;
|
|
868
|
+
let t8;
|
|
869
|
+
return $[16] !== children || $[17] !== value ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(LayerContext.Provider, { value, children }), $[16] = children, $[17] = value, $[18] = t8) : t8 = $[18], t8;
|
|
870
|
+
}
|
|
871
|
+
function _temp2$2(v_0) {
|
|
872
|
+
return v_0 - 1;
|
|
873
|
+
}
|
|
874
|
+
function _temp$4(v) {
|
|
875
|
+
return v + 1;
|
|
876
|
+
}
|
|
877
|
+
const DEFAULT_LAYER_ELEMENT = "div";
|
|
878
|
+
function Layer(props) {
|
|
879
|
+
const $ = compilerRuntime.c(12), t0 = props;
|
|
880
|
+
let children, rest, t1, t2;
|
|
881
|
+
$[0] !== t0 ? ({
|
|
882
|
+
as: t1,
|
|
883
|
+
children,
|
|
884
|
+
zOffset: t2,
|
|
885
|
+
...rest
|
|
886
|
+
} = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1, $[4] = t2) : (children = $[1], rest = $[2], t1 = $[3], t2 = $[4]);
|
|
887
|
+
const as = t1 === void 0 ? DEFAULT_LAYER_ELEMENT : t1, zOffset = t2 === void 0 ? 1 : t2;
|
|
888
|
+
let t3;
|
|
889
|
+
$[5] !== as || $[6] !== children || $[7] !== rest ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(LayerCard, { ...rest, as, children }), $[5] = as, $[6] = children, $[7] = rest, $[8] = t3) : t3 = $[8];
|
|
890
|
+
let t4;
|
|
891
|
+
return $[9] !== t3 || $[10] !== zOffset ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(LayerProvider, { zOffset, children: t3 }), $[9] = t3, $[10] = zOffset, $[11] = t4) : t4 = $[11], t4;
|
|
892
|
+
}
|
|
893
|
+
function PopoverLayer(props) {
|
|
894
|
+
const $ = compilerRuntime.c(65);
|
|
895
|
+
let animate, arrow, arrowRef, arrowX, arrowY, children, marginsProp, maxWidth, originX, originY, overflow, padding, placement, radius, referenceWidth, rest, shadow, strategy, style, t0, xProp, yProp;
|
|
896
|
+
$[0] !== props ? ({
|
|
897
|
+
__unstable_margins: marginsProp,
|
|
898
|
+
animate,
|
|
899
|
+
arrow,
|
|
900
|
+
arrowRef,
|
|
901
|
+
arrowX,
|
|
902
|
+
arrowY,
|
|
903
|
+
children,
|
|
904
|
+
maxWidth,
|
|
905
|
+
padding,
|
|
906
|
+
placement,
|
|
907
|
+
originX,
|
|
908
|
+
originY,
|
|
909
|
+
overflow,
|
|
910
|
+
radius,
|
|
911
|
+
referenceWidth,
|
|
912
|
+
shadow,
|
|
913
|
+
strategy,
|
|
914
|
+
style,
|
|
915
|
+
tone: t0,
|
|
916
|
+
x: xProp,
|
|
917
|
+
y: yProp,
|
|
918
|
+
...rest
|
|
919
|
+
} = props, $[0] = props, $[1] = animate, $[2] = arrow, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = marginsProp, $[8] = maxWidth, $[9] = originX, $[10] = originY, $[11] = overflow, $[12] = padding, $[13] = placement, $[14] = radius, $[15] = referenceWidth, $[16] = rest, $[17] = shadow, $[18] = strategy, $[19] = style, $[20] = t0, $[21] = xProp, $[22] = yProp) : (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], marginsProp = $[7], maxWidth = $[8], originX = $[9], originY = $[10], overflow = $[11], padding = $[12], placement = $[13], radius = $[14], referenceWidth = $[15], rest = $[16], shadow = $[17], strategy = $[18], style = $[19], t0 = $[20], xProp = $[21], yProp = $[22]);
|
|
920
|
+
const tone = t0 === void 0 ? "inherit" : t0;
|
|
921
|
+
let t1;
|
|
922
|
+
t1 = marginsProp || DEFAULT_POPOVER_MARGINS;
|
|
923
|
+
const margins = t1, x = (xProp ?? 0) + margins[3], y = (yProp ?? 0) + margins[0];
|
|
924
|
+
let t2;
|
|
925
|
+
const t3 = animate ? "transform" : void 0;
|
|
926
|
+
let t4;
|
|
927
|
+
$[23] !== originX || $[24] !== originY || $[25] !== referenceWidth || $[26] !== style || $[27] !== t3 || $[28] !== x || $[29] !== y ? (t4 = {
|
|
928
|
+
left: x,
|
|
929
|
+
originX,
|
|
930
|
+
originY,
|
|
931
|
+
top: y,
|
|
932
|
+
width: referenceWidth,
|
|
933
|
+
willChange: t3,
|
|
934
|
+
...style
|
|
935
|
+
}, $[23] = originX, $[24] = originY, $[25] = referenceWidth, $[26] = style, $[27] = t3, $[28] = x, $[29] = y, $[30] = t4) : t4 = $[30], t2 = t4;
|
|
936
|
+
const rootStyle = t2;
|
|
937
|
+
let t5;
|
|
938
|
+
const t6 = arrowX !== null ? arrowX : void 0, t7 = arrowY !== null ? arrowY : void 0;
|
|
939
|
+
let t8;
|
|
940
|
+
$[31] !== t6 || $[32] !== t7 ? (t8 = {
|
|
941
|
+
left: t6,
|
|
942
|
+
top: t7,
|
|
943
|
+
right: void 0,
|
|
944
|
+
bottom: void 0
|
|
945
|
+
}, $[31] = t6, $[32] = t7, $[33] = t8) : t8 = $[33], t5 = t8;
|
|
946
|
+
const arrowStyle = t5;
|
|
947
|
+
let t9;
|
|
948
|
+
$[34] === Symbol.for("react.memo_cache_sentinel") ? (t9 = css.popoverCard(), $[34] = t9) : t9 = $[34];
|
|
949
|
+
let t10;
|
|
950
|
+
$[35] !== animate ? (t10 = animate ? ["hidden", "initial"] : void 0, $[35] = animate, $[36] = t10) : t10 = $[36];
|
|
951
|
+
let t11;
|
|
952
|
+
$[37] !== animate ? (t11 = animate ? ["visible", "scaleIn"] : void 0, $[37] = animate, $[38] = t11) : t11 = $[38];
|
|
953
|
+
let t12;
|
|
954
|
+
$[39] !== animate ? (t12 = animate ? ["hidden", "scaleOut"] : void 0, $[39] = animate, $[40] = t12) : t12 = $[40];
|
|
955
|
+
let t13;
|
|
956
|
+
$[41] !== children || $[42] !== padding ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(Flex, { direction: "column", flex: 1, padding, children }), $[41] = children, $[42] = padding, $[43] = t13) : t13 = $[43];
|
|
957
|
+
let t14;
|
|
958
|
+
$[44] !== maxWidth || $[45] !== overflow || $[46] !== t13 ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(Flex, { "data-ui": "Popover__wrapper", direction: "column", flex: 1, maxWidth, overflow, children: t13 }), $[44] = maxWidth, $[45] = overflow, $[46] = t13, $[47] = t14) : t14 = $[47];
|
|
959
|
+
let t15;
|
|
960
|
+
$[48] !== arrow || $[49] !== arrowRef || $[50] !== arrowStyle ? (t15 = arrow && /* @__PURE__ */ jsxRuntime.jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_POPOVER_ARROW_WIDTH, height: DEFAULT_POPOVER_ARROW_HEIGHT, radius: DEFAULT_POPOVER_ARROW_RADIUS }), $[48] = arrow, $[49] = arrowRef, $[50] = arrowStyle, $[51] = t15) : t15 = $[51];
|
|
961
|
+
let t16;
|
|
962
|
+
return $[52] !== placement || $[53] !== radius || $[54] !== rest || $[55] !== rootStyle || $[56] !== shadow || $[57] !== strategy || $[58] !== t10 || $[59] !== t11 || $[60] !== t12 || $[61] !== t14 || $[62] !== t15 || $[63] !== tone ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs(Layer, { className: t9, "data-ui": "Popover", ...rest, as: framerMotion.motion.div, "data-context-tone": tone, "data-placement": placement, flexDirection: "column", display: "flex", position: strategy, radius, shadow, sizing: "border", style: rootStyle, tone, variants: POPOVER_MOTION_PROPS.card, transition: POPOVER_MOTION_PROPS.transition, initial: t10, animate: t11, exit: t12, children: [
|
|
963
|
+
t14,
|
|
964
|
+
t15
|
|
965
|
+
] }), $[52] = placement, $[53] = radius, $[54] = rest, $[55] = rootStyle, $[56] = shadow, $[57] = strategy, $[58] = t10, $[59] = t11, $[60] = t12, $[61] = t14, $[62] = t15, $[63] = tone, $[64] = t16) : t16 = $[64], t16;
|
|
966
|
+
}
|
|
967
|
+
const DEFAULT_POPOVER_ELEMENT = "div";
|
|
968
|
+
function ViewportOverlay() {
|
|
969
|
+
const $ = compilerRuntime.c(2), {
|
|
970
|
+
zIndex
|
|
971
|
+
} = useLayer();
|
|
972
|
+
let t0;
|
|
973
|
+
return $[0] !== zIndex ? (t0 = /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
|
|
974
|
+
position: "fixed",
|
|
975
|
+
inset: 0,
|
|
976
|
+
width: "100vw",
|
|
977
|
+
height: "100vh",
|
|
978
|
+
zIndex
|
|
979
|
+
} }), $[0] = zIndex, $[1] = t0) : t0 = $[1], t0;
|
|
980
|
+
}
|
|
981
|
+
function Popover(props) {
|
|
982
|
+
const boundaryElementContext = useBoundaryElement(), {
|
|
983
|
+
__unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
|
|
984
|
+
animate: _animate = !1,
|
|
985
|
+
arrow: arrowProp = !1,
|
|
986
|
+
as = DEFAULT_POPOVER_ELEMENT,
|
|
987
|
+
children: childProp,
|
|
988
|
+
className,
|
|
989
|
+
constrainSize = !1,
|
|
990
|
+
content,
|
|
991
|
+
disabled,
|
|
992
|
+
fallbackPlacements = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"],
|
|
993
|
+
matchReferenceWidth,
|
|
994
|
+
floatingBoundary = boundaryElementContext.element,
|
|
995
|
+
modal,
|
|
996
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
997
|
+
onActivate,
|
|
998
|
+
open,
|
|
999
|
+
overflow = "hidden",
|
|
1000
|
+
padding,
|
|
1001
|
+
placement: placementProp = "bottom",
|
|
1002
|
+
placementStrategy = "flip",
|
|
1003
|
+
portal,
|
|
1004
|
+
preventOverflow = !0,
|
|
1005
|
+
radius = 3,
|
|
1006
|
+
ref: forwardedRef,
|
|
1007
|
+
referenceBoundary = boundaryElementContext.element,
|
|
1008
|
+
referenceElement,
|
|
1009
|
+
scheme,
|
|
1010
|
+
shadow = 3,
|
|
1011
|
+
tone = "inherit",
|
|
1012
|
+
width: widthProp = "auto",
|
|
1013
|
+
zOffset: zOffsetProp = Z_OFFSETS.popover,
|
|
1014
|
+
updateRef,
|
|
1015
|
+
...rest
|
|
1016
|
+
} = props, card = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, zOffset = useResponsiveProp(zOffsetProp), ref = react.useRef(null), arrowRef = react.useRef(null), rootBoundary = "viewport";
|
|
1017
|
+
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
1018
|
+
const referenceWidthRef = react.useRef(void 0), middleware = react.useMemo(() => {
|
|
1019
|
+
const ret = [];
|
|
1020
|
+
return (constrainSize || preventOverflow) && (placementStrategy === "autoPlacement" ? ret.push(reactDom$1.autoPlacement({
|
|
1021
|
+
allowedPlacements: [placementProp].concat(fallbackPlacements)
|
|
1022
|
+
})) : ret.push(reactDom$1.flip({
|
|
1023
|
+
boundary: floatingBoundary || void 0,
|
|
1024
|
+
fallbackPlacements,
|
|
1025
|
+
padding: DEFAULT_POPOVER_PADDING,
|
|
1026
|
+
rootBoundary
|
|
1027
|
+
}))), ret.push(reactDom$1.offset({
|
|
1028
|
+
mainAxis: DEFAULT_POPOVER_DISTANCE
|
|
1029
|
+
})), (constrainSize || matchReferenceWidth) && ret.push(size({
|
|
1030
|
+
apply({
|
|
1031
|
+
availableWidth,
|
|
1032
|
+
availableHeight,
|
|
1033
|
+
elements,
|
|
1034
|
+
referenceWidth
|
|
1035
|
+
}) {
|
|
1036
|
+
referenceWidthRef.current = referenceWidth, matchReferenceWidth && (elements.floating.style.width = `${referenceWidth}px`), constrainSize && (elements.floating.style.maxWidth = `${availableWidth}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
|
|
1037
|
+
},
|
|
1038
|
+
boundaryElement: floatingBoundary || void 0,
|
|
1039
|
+
margins,
|
|
1040
|
+
padding: DEFAULT_POPOVER_PADDING
|
|
1041
|
+
})), preventOverflow && ret.push(reactDom$1.shift({
|
|
1042
|
+
boundary: floatingBoundary || void 0,
|
|
1043
|
+
rootBoundary,
|
|
1044
|
+
padding: DEFAULT_POPOVER_PADDING
|
|
1045
|
+
})), arrowProp && ret.push(reactDom$1.arrow({
|
|
1046
|
+
element: arrowRef,
|
|
1047
|
+
padding: DEFAULT_POPOVER_PADDING
|
|
1048
|
+
})), animate && ret.push(origin), ret.push(reactDom$1.hide({
|
|
1049
|
+
boundary: referenceBoundary || void 0,
|
|
1050
|
+
padding: DEFAULT_POPOVER_PADDING,
|
|
1051
|
+
strategy: "referenceHidden"
|
|
1052
|
+
})), ret;
|
|
1053
|
+
}, [animate, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, placementProp, placementStrategy, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
|
|
1054
|
+
x,
|
|
1055
|
+
y,
|
|
1056
|
+
middlewareData,
|
|
1057
|
+
placement,
|
|
1058
|
+
refs,
|
|
1059
|
+
strategy,
|
|
1060
|
+
update
|
|
1061
|
+
} = reactDom$1.useFloating({
|
|
1062
|
+
middleware,
|
|
1063
|
+
placement: placementProp,
|
|
1064
|
+
whileElementsMounted: reactDom$1.autoUpdate,
|
|
1065
|
+
elements: referenceElement ? {
|
|
1066
|
+
reference: referenceElement
|
|
1067
|
+
} : void 0
|
|
1068
|
+
}), 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 = react.useCallback((arrowEl) => {
|
|
1069
|
+
arrowRef.current = arrowEl;
|
|
1070
|
+
}, []), setFloating = react.useCallback((node) => {
|
|
1071
|
+
ref.current = node, refs.setFloating(node);
|
|
1072
|
+
}, [refs]), setReference = react.useCallback((node_0) => {
|
|
1073
|
+
if (refs.setReference(node_0), !childProp) return;
|
|
1074
|
+
const childRef = getElementRef(childProp);
|
|
1075
|
+
typeof childRef == "function" ? childRef(node_0) : childRef && (childRef.current = node_0);
|
|
1076
|
+
}, [childProp, refs]), child = react.useMemo(() => referenceElement ? childProp : childProp ? react.cloneElement(childProp, {
|
|
1077
|
+
ref: setReference
|
|
1078
|
+
}) : null, [childProp, referenceElement, setReference]);
|
|
1079
|
+
if (react.useEffect(() => {
|
|
1080
|
+
updateRef && (typeof updateRef == "function" ? updateRef(update) : updateRef && (updateRef.current = update));
|
|
1081
|
+
}, [update, updateRef]), disabled)
|
|
1082
|
+
return childProp || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
1083
|
+
const node_1 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1084
|
+
modal && /* @__PURE__ */ jsxRuntime.jsx(ViewportOverlay, {}),
|
|
1085
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverLayer, { ...rest, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: css.popover({
|
|
1086
|
+
className
|
|
1087
|
+
}), hidden: referenceHidden, maxWidth: widthProp, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, strategy, x, y, zOffset, children: content })
|
|
1088
|
+
] }), children = open && (portal ? /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { tone: tone === "inherit" ? card.tone : tone, scheme: scheme ?? "light", children: node_1 }) }) : node_1);
|
|
1089
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1090
|
+
animate ? /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children }) : children,
|
|
1091
|
+
child
|
|
1092
|
+
] });
|
|
1093
|
+
}
|
|
1094
|
+
const DEFAULT_SELECTABLE_ELEMENT = "button";
|
|
1095
|
+
function Selectable(props) {
|
|
1096
|
+
const $ = compilerRuntime.c(16), t0 = props;
|
|
1097
|
+
let className, radius, rest, selected, t1, tone;
|
|
1098
|
+
$[0] !== t0 ? ({
|
|
1099
|
+
as: t1,
|
|
1100
|
+
className,
|
|
1101
|
+
radius,
|
|
1102
|
+
selected,
|
|
1103
|
+
tone,
|
|
1104
|
+
...rest
|
|
1105
|
+
} = t0, $[0] = t0, $[1] = className, $[2] = radius, $[3] = rest, $[4] = selected, $[5] = t1, $[6] = tone) : (className = $[1], radius = $[2], rest = $[3], selected = $[4], t1 = $[5], tone = $[6]);
|
|
1106
|
+
const as = t1 === void 0 ? DEFAULT_SELECTABLE_ELEMENT : t1;
|
|
1107
|
+
let t2;
|
|
1108
|
+
$[7] !== className || $[8] !== radius || $[9] !== tone ? (t2 = css._selectable({
|
|
1109
|
+
className,
|
|
1110
|
+
radius,
|
|
1111
|
+
tone
|
|
1112
|
+
}), $[7] = className, $[8] = radius, $[9] = tone, $[10] = t2) : t2 = $[10];
|
|
1113
|
+
const t3 = selected ? "" : void 0;
|
|
1114
|
+
let t4;
|
|
1115
|
+
return $[11] !== as || $[12] !== rest || $[13] !== t2 || $[14] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(Box, { ...rest, as, className: t2, "data-selected": t3 }), $[11] = as, $[12] = rest, $[13] = t2, $[14] = t3, $[15] = t4) : t4 = $[15], t4;
|
|
1116
|
+
}
|
|
1117
|
+
const DEFAULT_STACK_ELEMENT = "div";
|
|
1118
|
+
function Stack(props) {
|
|
1119
|
+
const $ = compilerRuntime.c(12), t0 = props;
|
|
1120
|
+
let className, gap, rest, t1;
|
|
1121
|
+
$[0] !== t0 ? ({
|
|
1122
|
+
as: t1,
|
|
1123
|
+
className,
|
|
1124
|
+
gap,
|
|
1125
|
+
...rest
|
|
1126
|
+
} = t0, $[0] = t0, $[1] = className, $[2] = gap, $[3] = rest, $[4] = t1) : (className = $[1], gap = $[2], rest = $[3], t1 = $[4]);
|
|
1127
|
+
const as = t1 === void 0 ? DEFAULT_STACK_ELEMENT : t1;
|
|
1128
|
+
let t2;
|
|
1129
|
+
$[5] !== className ? (t2 = css.stack({
|
|
1130
|
+
className
|
|
1131
|
+
}), $[5] = className, $[6] = t2) : t2 = $[6];
|
|
1132
|
+
let t3;
|
|
1133
|
+
return $[7] !== as || $[8] !== gap || $[9] !== rest || $[10] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Stack", ...rest, as, gridAutoRows: "min", className: t2, display: "grid", gap }), $[7] = as, $[8] = gap, $[9] = rest, $[10] = t2, $[11] = t3) : t3 = $[11], t3;
|
|
1134
|
+
}
|
|
1135
|
+
function useCustomValidity(ref, customValidity) {
|
|
1136
|
+
const $ = compilerRuntime.c(6);
|
|
1137
|
+
let t0;
|
|
1138
|
+
$[0] !== customValidity || $[1] !== ref.current ? (t0 = () => {
|
|
1139
|
+
ref.current?.setCustomValidity(customValidity || "");
|
|
1140
|
+
}, $[0] = customValidity, $[1] = ref.current, $[2] = t0) : t0 = $[2];
|
|
1141
|
+
let t1;
|
|
1142
|
+
$[3] !== customValidity || $[4] !== ref ? (t1 = [customValidity, ref], $[3] = customValidity, $[4] = ref, $[5] = t1) : t1 = $[5], react.useEffect(t0, t1);
|
|
1143
|
+
}
|
|
1144
|
+
const DEFAULT_TEXT_INPUT_ELEMENT = "input";
|
|
1145
|
+
function TextInput(props) {
|
|
1146
|
+
const $ = compilerRuntime.c(88), t0 = props;
|
|
1147
|
+
let IconComponent, IconRightComponent, __unstable_disableFocusRing, className, clearButton, customValidity, forwardedRef, onClear, prefix, readOnly, rest, suffix, t1, t2, t3, t4, t5, t6, t7, t8, width;
|
|
1148
|
+
if ($[0] !== t0) {
|
|
1149
|
+
const {
|
|
1150
|
+
__unstable_disableFocusRing: t92,
|
|
1151
|
+
as: t102,
|
|
1152
|
+
border: t112,
|
|
1153
|
+
className: t122,
|
|
1154
|
+
clearButton: t132,
|
|
1155
|
+
disabled: t142,
|
|
1156
|
+
fontSize: t152,
|
|
1157
|
+
gap: t162,
|
|
1158
|
+
icon: t172,
|
|
1159
|
+
iconRight: t182,
|
|
1160
|
+
onClear: t192,
|
|
1161
|
+
padding: t202,
|
|
1162
|
+
prefix: t212,
|
|
1163
|
+
radius: t222,
|
|
1164
|
+
readOnly: t232,
|
|
1165
|
+
ref: t242,
|
|
1166
|
+
suffix: t252,
|
|
1167
|
+
customValidity: t262,
|
|
1168
|
+
type: t272,
|
|
1169
|
+
weight: _width,
|
|
1170
|
+
width: t282,
|
|
1171
|
+
...t292
|
|
1172
|
+
} = t0;
|
|
1173
|
+
__unstable_disableFocusRing = t92, t1 = t102, t2 = t112, className = t122, clearButton = t132, t3 = t142, t4 = t152, t5 = t162, IconComponent = t172, IconRightComponent = t182, onClear = t192, t6 = t202, prefix = t212, t7 = t222, readOnly = t232, forwardedRef = t242, suffix = t252, customValidity = t262, t8 = t272, width = t282, rest = t292, $[0] = t0, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = __unstable_disableFocusRing, $[4] = className, $[5] = clearButton, $[6] = customValidity, $[7] = forwardedRef, $[8] = onClear, $[9] = prefix, $[10] = readOnly, $[11] = rest, $[12] = suffix, $[13] = t1, $[14] = t2, $[15] = t3, $[16] = t4, $[17] = t5, $[18] = t6, $[19] = t7, $[20] = t8, $[21] = width;
|
|
1174
|
+
} else
|
|
1175
|
+
IconComponent = $[1], IconRightComponent = $[2], __unstable_disableFocusRing = $[3], className = $[4], clearButton = $[5], customValidity = $[6], forwardedRef = $[7], onClear = $[8], prefix = $[9], readOnly = $[10], rest = $[11], suffix = $[12], t1 = $[13], t2 = $[14], t3 = $[15], t4 = $[16], t5 = $[17], t6 = $[18], t7 = $[19], t8 = $[20], width = $[21];
|
|
1176
|
+
const Element = t1 === void 0 ? DEFAULT_TEXT_INPUT_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, disabled = t3 === void 0 ? !1 : t3, fontSize = t4 === void 0 ? 2 : t4, gap = t5 === void 0 ? 3 : t5, padding = t6 === void 0 ? 3 : t6, radius = t7 === void 0 ? 2 : t7, type = t8 === void 0 ? "text" : t8, ref = react.useRef(null), responsivePadding = useResponsiveProp(padding), withClearButton = !!clearButton;
|
|
1177
|
+
let t9;
|
|
1178
|
+
$[22] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => ref.current, $[22] = t9) : t9 = $[22], react.useImperativeHandle(forwardedRef, t9), useCustomValidity(ref, customValidity);
|
|
1179
|
+
const handleClearMouseDown = _temp$3;
|
|
1180
|
+
let t10;
|
|
1181
|
+
$[23] !== onClear ? (t10 = (event_0) => {
|
|
1182
|
+
event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
|
|
1183
|
+
}, $[23] = onClear, $[24] = t10) : t10 = $[24];
|
|
1184
|
+
const handleClearClick = t10;
|
|
1185
|
+
let t11, t12;
|
|
1186
|
+
$[25] !== responsivePadding ? (t12 = Object.fromEntries(Object.entries(responsivePadding).map(_temp2$1)), $[25] = responsivePadding, $[26] = t12) : t12 = $[26], t11 = t12;
|
|
1187
|
+
const clearButtonBoxPadding = t11;
|
|
1188
|
+
let t13, t14;
|
|
1189
|
+
$[27] !== responsivePadding ? (t14 = Object.fromEntries(Object.entries(responsivePadding).map(_temp3)), $[27] = responsivePadding, $[28] = t14) : t14 = $[28], t13 = t14;
|
|
1190
|
+
const clearButtonPadding = t13;
|
|
1191
|
+
let t15;
|
|
1192
|
+
t15 = isRecord(clearButton) ? clearButton : EMPTY_RECORD;
|
|
1193
|
+
const clearButtonProps = t15;
|
|
1194
|
+
let t16;
|
|
1195
|
+
$[29] !== border || $[30] !== className || $[31] !== fontSize || $[32] !== gap || $[33] !== padding || $[34] !== radius || $[35] !== width ? (t16 = css.textInput({
|
|
1196
|
+
className,
|
|
1197
|
+
border,
|
|
1198
|
+
fontSize,
|
|
1199
|
+
padding,
|
|
1200
|
+
radius,
|
|
1201
|
+
gap,
|
|
1202
|
+
width
|
|
1203
|
+
}), $[29] = border, $[30] = className, $[31] = fontSize, $[32] = gap, $[33] = padding, $[34] = radius, $[35] = width, $[36] = t16) : t16 = $[36];
|
|
1204
|
+
const t17 = IconComponent ? "" : void 0, t18 = IconRightComponent ? "" : void 0, t19 = customValidity ? "" : void 0, t20 = prefix ? "" : void 0, t21 = !disabled && readOnly ? "" : void 0, t22 = suffix ? "" : void 0;
|
|
1205
|
+
let t23;
|
|
1206
|
+
$[37] !== prefix ? (t23 = prefix && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: css.textInputPrefix(), sizing: "border", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: prefix }) }), $[37] = prefix, $[38] = t23) : t23 = $[38];
|
|
1207
|
+
let t24;
|
|
1208
|
+
$[39] === Symbol.for("react.memo_cache_sentinel") ? (t24 = css.textInputElement(), $[39] = t24) : t24 = $[39];
|
|
1209
|
+
let t25;
|
|
1210
|
+
$[40] === Symbol.for("react.memo_cache_sentinel") ? (t25 = css._inputElement(), $[40] = t25) : t25 = $[40];
|
|
1211
|
+
const t26 = __unstable_disableFocusRing ? "" : void 0;
|
|
1212
|
+
let t27;
|
|
1213
|
+
$[41] !== Element || $[42] !== disabled || $[43] !== readOnly || $[44] !== rest || $[45] !== t26 || $[46] !== type ? (t27 = /* @__PURE__ */ jsxRuntime.jsx(Element, { ...rest, className: t25, "data-no-focus-ring": t26, disabled, readOnly, ref, type }), $[41] = Element, $[42] = disabled, $[43] = readOnly, $[44] = rest, $[45] = t26, $[46] = type, $[47] = t27) : t27 = $[47];
|
|
1214
|
+
let t28;
|
|
1215
|
+
$[48] === Symbol.for("react.memo_cache_sentinel") ? (t28 = css._inputPresentation(), $[48] = t28) : t28 = $[48];
|
|
1216
|
+
let t29;
|
|
1217
|
+
$[49] !== IconComponent || $[50] !== fontSize || $[51] !== padding ? (t29 = IconComponent && /* @__PURE__ */ jsxRuntime.jsx(Box, { padding, position: "absolute", insetTop: 0, insetLeft: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize, children: [
|
|
1218
|
+
react.isValidElement(IconComponent) && IconComponent,
|
|
1219
|
+
reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
1220
|
+
] }) }), $[49] = IconComponent, $[50] = fontSize, $[51] = padding, $[52] = t29) : t29 = $[52];
|
|
1221
|
+
let t30;
|
|
1222
|
+
$[53] !== IconRightComponent || $[54] !== fontSize || $[55] !== padding || $[56] !== withClearButton ? (t30 = !withClearButton && IconRightComponent && /* @__PURE__ */ jsxRuntime.jsx(Box, { padding, position: "absolute", insetTop: 0, insetRight: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize, children: [
|
|
1223
|
+
react.isValidElement(IconRightComponent) && IconRightComponent,
|
|
1224
|
+
reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
|
|
1225
|
+
] }) }), $[53] = IconRightComponent, $[54] = fontSize, $[55] = padding, $[56] = withClearButton, $[57] = t30) : t30 = $[57];
|
|
1226
|
+
let t31;
|
|
1227
|
+
$[58] !== t29 || $[59] !== t30 ? (t31 = /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: t28, position: "absolute", children: [
|
|
1228
|
+
t29,
|
|
1229
|
+
t30
|
|
1230
|
+
] }), $[58] = t29, $[59] = t30, $[60] = t31) : t31 = $[60];
|
|
1231
|
+
let t32;
|
|
1232
|
+
$[61] !== clearButton || $[62] !== clearButtonBoxPadding || $[63] !== clearButtonPadding || $[64] !== clearButtonProps || $[65] !== disabled || $[66] !== fontSize || $[67] !== handleClearClick || $[68] !== radius || $[69] !== readOnly ? (t32 = !disabled && !readOnly && clearButton && /* @__PURE__ */ jsxRuntime.jsx(Box, { insetTop: 0, insetRight: 0, padding: clearButtonBoxPadding, position: "absolute", style: {
|
|
1233
|
+
zIndex: 2
|
|
1234
|
+
}, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { "aria-label": "Clear", "data-qa": "clear-button", display: "block", fontSize, icon: icons.CloseIcon, mode: "bleed", padding: clearButtonPadding, radius, ...clearButtonProps, onClick: handleClearClick, onMouseDown: handleClearMouseDown }) }), $[61] = clearButton, $[62] = clearButtonBoxPadding, $[63] = clearButtonPadding, $[64] = clearButtonProps, $[65] = disabled, $[66] = fontSize, $[67] = handleClearClick, $[68] = radius, $[69] = readOnly, $[70] = t32) : t32 = $[70];
|
|
1235
|
+
let t33;
|
|
1236
|
+
$[71] !== t27 || $[72] !== t31 || $[73] !== t32 ? (t33 = /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: t24, flex: 1, position: "relative", children: [
|
|
1237
|
+
t27,
|
|
1238
|
+
t31,
|
|
1239
|
+
t32
|
|
1240
|
+
] }), $[71] = t27, $[72] = t31, $[73] = t32, $[74] = t33) : t33 = $[74];
|
|
1241
|
+
let t34;
|
|
1242
|
+
$[75] !== suffix ? (t34 = suffix && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: css.textInputSuffix(), sizing: "border", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: suffix }) }), $[75] = suffix, $[76] = t34) : t34 = $[76];
|
|
1243
|
+
let t35;
|
|
1244
|
+
return $[77] !== t16 || $[78] !== t17 || $[79] !== t18 || $[80] !== t19 || $[81] !== t20 || $[82] !== t21 || $[83] !== t22 || $[84] !== t23 || $[85] !== t33 || $[86] !== t34 ? (t35 = /* @__PURE__ */ jsxRuntime.jsxs(Box, { alignItems: "center", className: t16, "data-icon-left": t17, "data-icon-right": t18, "data-invalid": t19, "data-prefix": t20, "data-read-only": t21, "data-suffix": t22, "data-ui": "TextInput", display: "flex", children: [
|
|
1245
|
+
t23,
|
|
1246
|
+
t33,
|
|
1247
|
+
t34
|
|
1248
|
+
] }), $[77] = t16, $[78] = t17, $[79] = t18, $[80] = t19, $[81] = t20, $[82] = t21, $[83] = t22, $[84] = t23, $[85] = t33, $[86] = t34, $[87] = t35) : t35 = $[87], t35;
|
|
1249
|
+
}
|
|
1250
|
+
function _temp3(t0) {
|
|
1251
|
+
const [key_0, value_0] = t0;
|
|
1252
|
+
return value_0 === 0 ? [key_0, 0] : value_0 === 1 ? [key_0, 0] : value_0 === 2 ? [key_0, 1] : [key_0, typeof value_0 == "number" ? value_0 - 1 : 0];
|
|
1253
|
+
}
|
|
1254
|
+
function _temp2$1(t0) {
|
|
1255
|
+
const [key2, value] = t0;
|
|
1256
|
+
return value === 0 ? [key2, 0] : value === 1 ? [key2, 1] : value === 2 ? [key2, 1] : [key2, typeof value == "number" ? value - 2 : 0];
|
|
1257
|
+
}
|
|
1258
|
+
function _temp$3(event) {
|
|
1259
|
+
event.preventDefault(), event.stopPropagation();
|
|
1260
|
+
}
|
|
1261
|
+
function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
1262
|
+
const $ = compilerRuntime.c(9), elementsArg = t0 === void 0 ? _temp$2 : t0;
|
|
1263
|
+
let t1;
|
|
1264
|
+
$[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
|
|
1265
|
+
if (!listener)
|
|
1266
|
+
return;
|
|
1267
|
+
const target = evt.target;
|
|
1268
|
+
if (!(target instanceof Node))
|
|
1269
|
+
return;
|
|
1270
|
+
const resolvedBoundaryElement = boundaryElement?.();
|
|
1271
|
+
if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target))
|
|
1272
|
+
return;
|
|
1273
|
+
const elements = elementsArg().flat();
|
|
1274
|
+
for (const el of elements)
|
|
1275
|
+
if (el && (target === el || el.contains(target)))
|
|
1276
|
+
return;
|
|
1277
|
+
listener(evt);
|
|
1278
|
+
}, $[0] = boundaryElement, $[1] = elementsArg, $[2] = listener, $[3] = t1) : t1 = $[3];
|
|
1279
|
+
const onEvent = useEffectEvent.useEffectEvent(t1), hasListener = !!listener;
|
|
1280
|
+
let t2;
|
|
1281
|
+
$[4] !== hasListener || $[5] !== onEvent ? (t2 = () => {
|
|
1282
|
+
if (!hasListener)
|
|
1283
|
+
return;
|
|
1284
|
+
const handleEvent = (evt_0) => onEvent(evt_0);
|
|
1285
|
+
return document.addEventListener("mousedown", handleEvent), () => {
|
|
1286
|
+
document.removeEventListener("mousedown", handleEvent);
|
|
1287
|
+
};
|
|
1288
|
+
}, $[4] = hasListener, $[5] = onEvent, $[6] = t2) : t2 = $[6];
|
|
1289
|
+
let t3;
|
|
1290
|
+
$[7] !== hasListener ? (t3 = [hasListener], $[7] = hasListener, $[8] = t3) : t3 = $[8], react.useEffect(t2, t3), react.useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
|
|
1291
|
+
}
|
|
1292
|
+
function _temp$2() {
|
|
1293
|
+
return EMPTY_ARRAY;
|
|
1294
|
+
}
|
|
1295
|
+
function useGlobalKeyDown(onKeyDown) {
|
|
1296
|
+
const $ = compilerRuntime.c(5);
|
|
1297
|
+
let t0;
|
|
1298
|
+
$[0] !== onKeyDown ? (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0) : t0 = $[1];
|
|
1299
|
+
const handleKeyDown = useEffectEvent.useEffectEvent(t0);
|
|
1300
|
+
let t1;
|
|
1301
|
+
$[2] !== handleKeyDown ? (t1 = () => {
|
|
1302
|
+
const handler = (event_0) => handleKeyDown(event_0);
|
|
1303
|
+
return window.addEventListener("keydown", handler), () => window.removeEventListener("keydown", handler);
|
|
1304
|
+
}, $[2] = handleKeyDown, $[3] = t1) : t1 = $[3];
|
|
1305
|
+
let t2;
|
|
1306
|
+
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[4] = t2) : t2 = $[4], react.useEffect(t1, t2);
|
|
1307
|
+
}
|
|
1308
|
+
const DEFAULT_KBD_ELEMENT = "kbd";
|
|
1309
|
+
function KBD(props) {
|
|
1310
|
+
const $ = compilerRuntime.c(22), t0 = props;
|
|
1311
|
+
let children, className, rest, t1, t2, t3, t4, t5;
|
|
1312
|
+
$[0] !== t0 ? ({
|
|
1313
|
+
as: t1,
|
|
1314
|
+
children,
|
|
1315
|
+
className,
|
|
1316
|
+
display: t2,
|
|
1317
|
+
fontSize: t3,
|
|
1318
|
+
padding: t4,
|
|
1319
|
+
radius: t5,
|
|
1320
|
+
...rest
|
|
1321
|
+
} = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = t3, $[7] = t4, $[8] = t5) : (children = $[1], className = $[2], rest = $[3], t1 = $[4], t2 = $[5], t3 = $[6], t4 = $[7], t5 = $[8]);
|
|
1322
|
+
const as = t1 === void 0 ? DEFAULT_KBD_ELEMENT : t1, display = t2 === void 0 ? "inline-block" : t2, fontSize = t3 === void 0 ? 1 : t3, padding = t4 === void 0 ? 1 : t4, radius = t5 === void 0 ? 2 : t5, t6 = as;
|
|
1323
|
+
let t7;
|
|
1324
|
+
$[9] !== className || $[10] !== radius ? (t7 = css.kbd({
|
|
1325
|
+
className,
|
|
1326
|
+
radius
|
|
1327
|
+
}), $[9] = className, $[10] = radius, $[11] = t7) : t7 = $[11];
|
|
1328
|
+
let t8;
|
|
1329
|
+
$[12] !== children || $[13] !== fontSize ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Text, { as: "span", muted: !0, size: fontSize, weight: "medium", children }), $[12] = children, $[13] = fontSize, $[14] = t8) : t8 = $[14];
|
|
1330
|
+
let t9;
|
|
1331
|
+
return $[15] !== display || $[16] !== padding || $[17] !== rest || $[18] !== t6 || $[19] !== t7 || $[20] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "KBD", ...rest, as: t6, className: t7, display, muted: !0, padding, children: t8 }), $[15] = display, $[16] = padding, $[17] = rest, $[18] = t6, $[19] = t7, $[20] = t8, $[21] = t9) : t9 = $[21], t9;
|
|
1332
|
+
}
|
|
1333
|
+
const DEFAULT_HOTKEYS_ELEMENT = "kbd";
|
|
1334
|
+
function Hotkeys(props) {
|
|
1335
|
+
const $ = compilerRuntime.c(26), t0 = props;
|
|
1336
|
+
let fontSize, gapX, gapY, keys, padding, radius, rest, t1, t2;
|
|
1337
|
+
$[0] !== t0 ? ({
|
|
1338
|
+
as: t1,
|
|
1339
|
+
fontSize,
|
|
1340
|
+
gap: t2,
|
|
1341
|
+
gapX,
|
|
1342
|
+
gapY,
|
|
1343
|
+
keys,
|
|
1344
|
+
padding,
|
|
1345
|
+
radius,
|
|
1346
|
+
...rest
|
|
1347
|
+
} = t0, $[0] = t0, $[1] = fontSize, $[2] = gapX, $[3] = gapY, $[4] = keys, $[5] = padding, $[6] = radius, $[7] = rest, $[8] = t1, $[9] = t2) : (fontSize = $[1], gapX = $[2], gapY = $[3], keys = $[4], padding = $[5], radius = $[6], rest = $[7], t1 = $[8], t2 = $[9]);
|
|
1348
|
+
const as = t1 === void 0 ? DEFAULT_HOTKEYS_ELEMENT : t1, gap = t2 === void 0 ? 1 : t2;
|
|
1349
|
+
if (!keys || keys.length === 0)
|
|
1350
|
+
return;
|
|
1351
|
+
let t3;
|
|
1352
|
+
if ($[10] !== fontSize || $[11] !== keys || $[12] !== padding || $[13] !== radius) {
|
|
1353
|
+
let t42;
|
|
1354
|
+
$[15] !== fontSize || $[16] !== padding || $[17] !== radius ? (t42 = (key2, i) => /* @__PURE__ */ jsxRuntime.jsx(KBD, { fontSize, padding, radius, children: key2 }, i), $[15] = fontSize, $[16] = padding, $[17] = radius, $[18] = t42) : t42 = $[18], t3 = keys.map(t42), $[10] = fontSize, $[11] = keys, $[12] = padding, $[13] = radius, $[14] = t3;
|
|
1355
|
+
} else
|
|
1356
|
+
t3 = $[14];
|
|
1357
|
+
let t4;
|
|
1358
|
+
return $[19] !== as || $[20] !== gap || $[21] !== gapX || $[22] !== gapY || $[23] !== rest || $[24] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(Box, { as, "data-ui": "Hotkeys", ...rest, display: "flex", gap, gapX, gapY, children: t3 }), $[19] = as, $[20] = gap, $[21] = gapX, $[22] = gapY, $[23] = rest, $[24] = t3, $[25] = t4) : t4 = $[25], t4;
|
|
1359
|
+
}
|
|
1360
|
+
const MenuContext = createGlobalScopedContext("@sanity/ui/v3/menu", null);
|
|
1361
|
+
function _isFocusable(element) {
|
|
1362
|
+
return isHTMLAnchorElement(element) && element.getAttribute("data-disabled") !== "true" || isHTMLButtonElement(element) && !element.disabled;
|
|
1363
|
+
}
|
|
1364
|
+
function _getFocusableElements(elements) {
|
|
1365
|
+
return elements.filter(_isFocusable);
|
|
1366
|
+
}
|
|
1367
|
+
function _getDOMPath(rootElement, el) {
|
|
1368
|
+
const path = [];
|
|
1369
|
+
let e = el;
|
|
1370
|
+
for (; e !== rootElement; ) {
|
|
1371
|
+
const parentElement = e.parentElement;
|
|
1372
|
+
if (!parentElement) return path;
|
|
1373
|
+
const index = Array.from(parentElement.childNodes).indexOf(e);
|
|
1374
|
+
if (path.unshift(index), parentElement === rootElement)
|
|
1375
|
+
return path;
|
|
1376
|
+
e = parentElement;
|
|
1377
|
+
}
|
|
1378
|
+
return path;
|
|
1379
|
+
}
|
|
1380
|
+
const EMPTY_PATH = [];
|
|
1381
|
+
function _sortElements(rootElement, elements) {
|
|
1382
|
+
if (!rootElement) return;
|
|
1383
|
+
const map = /* @__PURE__ */ new WeakMap();
|
|
1384
|
+
for (const el of elements)
|
|
1385
|
+
map.set(el, _getDOMPath(rootElement, el));
|
|
1386
|
+
const _sort = (a, b) => {
|
|
1387
|
+
const _a = map.get(a) || EMPTY_PATH, _b = map.get(b) || EMPTY_PATH, len = Math.max(_a.length, _b.length);
|
|
1388
|
+
for (let i = 0; i < len; i += 1) {
|
|
1389
|
+
const aIndex = _a[i] || -1, bIndex = _b[i] || -1;
|
|
1390
|
+
if (aIndex !== bIndex)
|
|
1391
|
+
return aIndex - bIndex;
|
|
1392
|
+
}
|
|
1393
|
+
return 0;
|
|
1394
|
+
};
|
|
1395
|
+
elements.sort(_sort);
|
|
1396
|
+
}
|
|
1397
|
+
function useMenuController(props) {
|
|
1398
|
+
const {
|
|
1399
|
+
onKeyDown,
|
|
1400
|
+
originElement,
|
|
1401
|
+
shouldFocus,
|
|
1402
|
+
rootElementRef
|
|
1403
|
+
} = props, elementsRef = react.useRef([]), [activeIndex, _setActiveIndex] = react.useState(-1), activeIndexRef = react.useRef(activeIndex), activeElement = react.useMemo(() => elementsRef.current[activeIndex] || null, [activeIndex]), mounted = !!rootElementRef.current, setActiveIndex = react.useCallback((nextActiveIndex) => {
|
|
1404
|
+
_setActiveIndex(nextActiveIndex), activeIndexRef.current = nextActiveIndex;
|
|
1405
|
+
}, []), mount = react.useCallback((element, selected) => {
|
|
1406
|
+
if (!element) return () => {
|
|
1407
|
+
};
|
|
1408
|
+
if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(rootElementRef.current, elementsRef.current)), selected) {
|
|
1409
|
+
const selectedIndex = elementsRef.current.indexOf(element);
|
|
1410
|
+
setActiveIndex(selectedIndex);
|
|
1411
|
+
}
|
|
1412
|
+
return () => {
|
|
1413
|
+
const idx = elementsRef.current.indexOf(element);
|
|
1414
|
+
idx > -1 && elementsRef.current.splice(idx, 1);
|
|
1415
|
+
};
|
|
1416
|
+
}, [rootElementRef, setActiveIndex]), handleKeyDown = react.useCallback((event) => {
|
|
1417
|
+
if (event.key === "Tab") {
|
|
1418
|
+
originElement && originElement.focus();
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
if (event.key === "Home") {
|
|
1422
|
+
event.preventDefault(), event.stopPropagation();
|
|
1423
|
+
const el = _getFocusableElements(elementsRef.current)[0];
|
|
1424
|
+
if (!el) return;
|
|
1425
|
+
const currentIndex = elementsRef.current.indexOf(el);
|
|
1426
|
+
setActiveIndex(currentIndex);
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1429
|
+
if (event.key === "End") {
|
|
1430
|
+
event.preventDefault(), event.stopPropagation();
|
|
1431
|
+
const focusableElements_0 = _getFocusableElements(elementsRef.current), el_0 = focusableElements_0[focusableElements_0.length - 1];
|
|
1432
|
+
if (!el_0) return;
|
|
1433
|
+
const currentIndex_0 = elementsRef.current.indexOf(el_0);
|
|
1434
|
+
setActiveIndex(currentIndex_0);
|
|
1435
|
+
return;
|
|
1436
|
+
}
|
|
1437
|
+
if (event.key === "ArrowUp") {
|
|
1438
|
+
event.preventDefault(), event.stopPropagation();
|
|
1439
|
+
const focusableElements_1 = _getFocusableElements(elementsRef.current), focusableLen = focusableElements_1.length;
|
|
1440
|
+
if (focusableLen === 0) return;
|
|
1441
|
+
const focusedElement = elementsRef.current[activeIndexRef.current];
|
|
1442
|
+
let focusedIndex = focusableElements_1.indexOf(focusedElement);
|
|
1443
|
+
focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen;
|
|
1444
|
+
const el_1 = focusableElements_1[focusedIndex], currentIndex_1 = elementsRef.current.indexOf(el_1);
|
|
1445
|
+
setActiveIndex(currentIndex_1);
|
|
1446
|
+
return;
|
|
1447
|
+
}
|
|
1448
|
+
if (event.key === "ArrowDown") {
|
|
1449
|
+
event.preventDefault(), event.stopPropagation();
|
|
1450
|
+
const focusableElements_2 = _getFocusableElements(elementsRef.current), focusableLen_0 = focusableElements_2.length;
|
|
1451
|
+
if (focusableLen_0 === 0) return;
|
|
1452
|
+
const focusedElement_0 = elementsRef.current[activeIndexRef.current];
|
|
1453
|
+
let focusedIndex_0 = focusableElements_2.indexOf(focusedElement_0);
|
|
1454
|
+
focusedIndex_0 = (focusedIndex_0 + 1) % focusableLen_0;
|
|
1455
|
+
const el_2 = focusableElements_2[focusedIndex_0], currentIndex_2 = elementsRef.current.indexOf(el_2);
|
|
1456
|
+
setActiveIndex(currentIndex_2);
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
onKeyDown && onKeyDown(event);
|
|
1460
|
+
}, [onKeyDown, originElement, setActiveIndex]), handleItemMouseEnter = react.useCallback((event_0) => {
|
|
1461
|
+
const element_0 = event_0.currentTarget, currentIndex_3 = elementsRef.current.indexOf(element_0);
|
|
1462
|
+
setActiveIndex(currentIndex_3);
|
|
1463
|
+
}, [setActiveIndex]), handleItemMouseLeave = react.useCallback(() => {
|
|
1464
|
+
setActiveIndex(-2), rootElementRef.current?.focus();
|
|
1465
|
+
}, [rootElementRef, setActiveIndex]);
|
|
1466
|
+
return react.useEffect(() => {
|
|
1467
|
+
if (!mounted) return;
|
|
1468
|
+
const rafId = requestAnimationFrame(() => {
|
|
1469
|
+
if (activeIndex === -1) {
|
|
1470
|
+
if (shouldFocus === "first") {
|
|
1471
|
+
const el_3 = _getFocusableElements(elementsRef.current)[0];
|
|
1472
|
+
if (el_3) {
|
|
1473
|
+
const currentIndex_4 = elementsRef.current.indexOf(el_3);
|
|
1474
|
+
setActiveIndex(currentIndex_4);
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
if (shouldFocus === "last") {
|
|
1478
|
+
const focusableElements_4 = _getFocusableElements(elementsRef.current), el_4 = focusableElements_4[focusableElements_4.length - 1];
|
|
1479
|
+
if (el_4) {
|
|
1480
|
+
const currentIndex_5 = elementsRef.current.indexOf(el_4);
|
|
1481
|
+
setActiveIndex(currentIndex_5);
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
return;
|
|
1485
|
+
}
|
|
1486
|
+
(elementsRef.current[activeIndex] || null)?.focus();
|
|
1487
|
+
});
|
|
1488
|
+
return () => cancelAnimationFrame(rafId);
|
|
1489
|
+
}, [activeIndex, mounted, setActiveIndex, shouldFocus]), {
|
|
1490
|
+
activeElement,
|
|
1491
|
+
activeIndex,
|
|
1492
|
+
handleItemMouseEnter,
|
|
1493
|
+
handleItemMouseLeave,
|
|
1494
|
+
handleKeyDown,
|
|
1495
|
+
mount
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1498
|
+
const DEFAULT_MENU_ELEMENT = "div";
|
|
1499
|
+
function Menu(props) {
|
|
1500
|
+
const $ = compilerRuntime.c(57), t0 = props;
|
|
1501
|
+
let _shouldFocus, children, className, forwardedRef, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, registerElement, rest, t1, t2, t3;
|
|
1502
|
+
$[0] !== t0 ? ({
|
|
1503
|
+
as: t1,
|
|
1504
|
+
children,
|
|
1505
|
+
className,
|
|
1506
|
+
gap: t2,
|
|
1507
|
+
onClickOutside,
|
|
1508
|
+
onEscape,
|
|
1509
|
+
onItemClick,
|
|
1510
|
+
onItemSelect,
|
|
1511
|
+
onKeyDown,
|
|
1512
|
+
originElement,
|
|
1513
|
+
padding: t3,
|
|
1514
|
+
ref: forwardedRef,
|
|
1515
|
+
registerElement,
|
|
1516
|
+
shouldFocus: _shouldFocus,
|
|
1517
|
+
...rest
|
|
1518
|
+
} = t0, $[0] = t0, $[1] = _shouldFocus, $[2] = children, $[3] = className, $[4] = forwardedRef, $[5] = onClickOutside, $[6] = onEscape, $[7] = onItemClick, $[8] = onItemSelect, $[9] = onKeyDown, $[10] = originElement, $[11] = registerElement, $[12] = rest, $[13] = t1, $[14] = t2, $[15] = t3) : (_shouldFocus = $[1], children = $[2], className = $[3], forwardedRef = $[4], onClickOutside = $[5], onEscape = $[6], onItemClick = $[7], onItemSelect = $[8], onKeyDown = $[9], originElement = $[10], registerElement = $[11], rest = $[12], t1 = $[13], t2 = $[14], t3 = $[15]);
|
|
1519
|
+
const as = t1 === void 0 ? DEFAULT_MENU_ELEMENT : t1, gap = t2 === void 0 ? 1 : t2, padding = t3 === void 0 ? 1 : t3, shouldFocus = _shouldFocus ?? null, ref = react.useRef(null);
|
|
1520
|
+
let t4;
|
|
1521
|
+
$[16] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[16] = t4) : t4 = $[16], react.useImperativeHandle(forwardedRef, t4);
|
|
1522
|
+
const {
|
|
1523
|
+
isTopLayer
|
|
1524
|
+
} = useLayer();
|
|
1525
|
+
let t5;
|
|
1526
|
+
$[17] !== onKeyDown || $[18] !== originElement || $[19] !== shouldFocus ? (t5 = {
|
|
1527
|
+
onKeyDown,
|
|
1528
|
+
originElement,
|
|
1529
|
+
shouldFocus,
|
|
1530
|
+
rootElementRef: ref
|
|
1531
|
+
}, $[17] = onKeyDown, $[18] = originElement, $[19] = shouldFocus, $[20] = t5) : t5 = $[20];
|
|
1532
|
+
const {
|
|
1533
|
+
activeElement,
|
|
1534
|
+
activeIndex,
|
|
1535
|
+
handleItemMouseEnter,
|
|
1536
|
+
handleItemMouseLeave,
|
|
1537
|
+
handleKeyDown,
|
|
1538
|
+
mount
|
|
1539
|
+
} = useMenuController(t5), unregisterElementRef = react.useRef(null);
|
|
1540
|
+
let t6;
|
|
1541
|
+
$[21] !== registerElement ? (t6 = (el) => {
|
|
1542
|
+
unregisterElementRef.current && (unregisterElementRef.current(), unregisterElementRef.current = null), ref.current = el, ref.current && registerElement && (unregisterElementRef.current = registerElement(ref.current));
|
|
1543
|
+
}, $[21] = registerElement, $[22] = t6) : t6 = $[22];
|
|
1544
|
+
const handleRefChange = t6;
|
|
1545
|
+
let t7, t8;
|
|
1546
|
+
$[23] !== activeIndex || $[24] !== onItemSelect ? (t7 = () => {
|
|
1547
|
+
onItemSelect && onItemSelect(activeIndex);
|
|
1548
|
+
}, t8 = [activeIndex, onItemSelect], $[23] = activeIndex, $[24] = onItemSelect, $[25] = t7, $[26] = t8) : (t7 = $[25], t8 = $[26]), react.useEffect(t7, t8);
|
|
1549
|
+
let t9;
|
|
1550
|
+
$[27] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => [ref.current], $[27] = t9) : t9 = $[27], useClickOutsideEvent(isTopLayer && onClickOutside, t9);
|
|
1551
|
+
let t10;
|
|
1552
|
+
$[28] !== isTopLayer || $[29] !== onEscape ? (t10 = (event) => {
|
|
1553
|
+
isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
|
|
1554
|
+
}, $[28] = isTopLayer, $[29] = onEscape, $[30] = t10) : t10 = $[30], useGlobalKeyDown(t10);
|
|
1555
|
+
let t11, t12;
|
|
1556
|
+
$[31] !== activeElement || $[32] !== activeIndex || $[33] !== handleItemMouseEnter || $[34] !== handleItemMouseLeave || $[35] !== mount || $[36] !== onClickOutside || $[37] !== onEscape || $[38] !== onItemClick || $[39] !== registerElement ? (t12 = {
|
|
1557
|
+
version: 0,
|
|
1558
|
+
activeElement,
|
|
1559
|
+
activeIndex,
|
|
1560
|
+
mount,
|
|
1561
|
+
onClickOutside,
|
|
1562
|
+
onEscape,
|
|
1563
|
+
onItemClick,
|
|
1564
|
+
onItemMouseEnter: handleItemMouseEnter,
|
|
1565
|
+
onItemMouseLeave: handleItemMouseLeave,
|
|
1566
|
+
registerElement,
|
|
1567
|
+
onMouseEnter: handleItemMouseEnter,
|
|
1568
|
+
onMouseLeave: handleItemMouseLeave
|
|
1569
|
+
}, $[31] = activeElement, $[32] = activeIndex, $[33] = handleItemMouseEnter, $[34] = handleItemMouseLeave, $[35] = mount, $[36] = onClickOutside, $[37] = onEscape, $[38] = onItemClick, $[39] = registerElement, $[40] = t12) : t12 = $[40], t11 = t12;
|
|
1570
|
+
const value = t11;
|
|
1571
|
+
let t13;
|
|
1572
|
+
$[41] !== className ? (t13 = css.menu({
|
|
1573
|
+
className
|
|
1574
|
+
}), $[41] = className, $[42] = t13) : t13 = $[42];
|
|
1575
|
+
let t14;
|
|
1576
|
+
$[43] !== children || $[44] !== gap ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap, children }), $[43] = children, $[44] = gap, $[45] = t14) : t14 = $[45];
|
|
1577
|
+
let t15;
|
|
1578
|
+
$[46] !== as || $[47] !== handleKeyDown || $[48] !== handleRefChange || $[49] !== padding || $[50] !== rest || $[51] !== t13 || $[52] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Menu", ...rest, as, className: t13, onKeyDown: handleKeyDown, overflow: "auto", outline: "none", padding, ref: handleRefChange, role: "menu", tabIndex: -1, children: t14 }), $[46] = as, $[47] = handleKeyDown, $[48] = handleRefChange, $[49] = padding, $[50] = rest, $[51] = t13, $[52] = t14, $[53] = t15) : t15 = $[53];
|
|
1579
|
+
let t16;
|
|
1580
|
+
return $[54] !== t15 || $[55] !== value ? (t16 = /* @__PURE__ */ jsxRuntime.jsx(MenuContext.Provider, { value, children: t15 }), $[54] = t15, $[55] = value, $[56] = t16) : t16 = $[56], t16;
|
|
1581
|
+
}
|
|
1582
|
+
const DEFAULT_MENU_DIVIDER_ELEMENT = "hr";
|
|
1583
|
+
function MenuDivider(props) {
|
|
1584
|
+
const $ = compilerRuntime.c(10), t0 = props;
|
|
1585
|
+
let className, rest, t1;
|
|
1586
|
+
$[0] !== t0 ? ({
|
|
1587
|
+
as: t1,
|
|
1588
|
+
className,
|
|
1589
|
+
...rest
|
|
1590
|
+
} = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
|
|
1591
|
+
const Element = t1 === void 0 ? DEFAULT_MENU_DIVIDER_ELEMENT : t1;
|
|
1592
|
+
let t2;
|
|
1593
|
+
$[4] !== className ? (t2 = css.menuDivider({
|
|
1594
|
+
className
|
|
1595
|
+
}), $[4] = className, $[5] = t2) : t2 = $[5];
|
|
1596
|
+
let t3;
|
|
1597
|
+
return $[6] !== Element || $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Element, { ...rest, className: t2 }), $[6] = Element, $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
|
|
1598
|
+
}
|
|
1599
|
+
function useMenu() {
|
|
1600
|
+
const value = react.useContext(MenuContext);
|
|
1601
|
+
if (!value)
|
|
1602
|
+
throw new Error("useMenu(): missing context value");
|
|
1603
|
+
if (!isRecord(value) || value.version !== 0)
|
|
1604
|
+
throw new Error("useMenu(): the context value is not compatible");
|
|
1605
|
+
return value;
|
|
1606
|
+
}
|
|
1607
|
+
const DEFAULT_MENU_GROUP_ELEMENT = "button";
|
|
1608
|
+
function MenuGroup(props) {
|
|
1609
|
+
const $ = compilerRuntime.c(77), t0 = props;
|
|
1610
|
+
let IconComponent, children, menuProps, onClick, popover, rest, t1, t2, t3, t4, t5, t6, text;
|
|
1611
|
+
$[0] !== t0 ? ({
|
|
1612
|
+
as: t1,
|
|
1613
|
+
children,
|
|
1614
|
+
fontSize: t2,
|
|
1615
|
+
gap: t3,
|
|
1616
|
+
icon: IconComponent,
|
|
1617
|
+
menu: menuProps,
|
|
1618
|
+
onClick,
|
|
1619
|
+
padding: t4,
|
|
1620
|
+
popover,
|
|
1621
|
+
radius: t5,
|
|
1622
|
+
text,
|
|
1623
|
+
tone: t6,
|
|
1624
|
+
...rest
|
|
1625
|
+
} = t0, $[0] = t0, $[1] = IconComponent, $[2] = children, $[3] = menuProps, $[4] = onClick, $[5] = popover, $[6] = rest, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = t4, $[11] = t5, $[12] = t6, $[13] = text) : (IconComponent = $[1], children = $[2], menuProps = $[3], onClick = $[4], popover = $[5], rest = $[6], t1 = $[7], t2 = $[8], t3 = $[9], t4 = $[10], t5 = $[11], t6 = $[12], text = $[13]);
|
|
1626
|
+
const as = t1 === void 0 ? DEFAULT_MENU_GROUP_ELEMENT : t1, fontSize = t2 === void 0 ? 1 : t2, gap = t3 === void 0 ? 3 : t3, padding = t4 === void 0 ? 3 : t4, radius = t5 === void 0 ? 2 : t5, tone = t6 === void 0 ? "default" : t6, {
|
|
1627
|
+
activeElement,
|
|
1628
|
+
mount,
|
|
1629
|
+
onClickOutside,
|
|
1630
|
+
onEscape,
|
|
1631
|
+
onItemClick,
|
|
1632
|
+
onItemMouseEnter,
|
|
1633
|
+
registerElement
|
|
1634
|
+
} = useMenu(), [rootElement, setRootElement] = react.useState(null), [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = react.useState(!1);
|
|
1635
|
+
let t7;
|
|
1636
|
+
$[14] !== onItemMouseEnter ? (t7 = (event) => {
|
|
1637
|
+
setWithinMenu(!1), onItemMouseEnter?.(event), setOpen(!0);
|
|
1638
|
+
}, $[14] = onItemMouseEnter, $[15] = t7) : t7 = $[15];
|
|
1639
|
+
const handleMouseEnter = t7;
|
|
1640
|
+
let t8;
|
|
1641
|
+
$[16] !== rootElement ? (t8 = (event_0) => {
|
|
1642
|
+
event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
|
|
1643
|
+
rootElement?.focus();
|
|
1644
|
+
}));
|
|
1645
|
+
}, $[16] = rootElement, $[17] = t8) : t8 = $[17];
|
|
1646
|
+
const handleMenuKeyDown = t8;
|
|
1647
|
+
let t9;
|
|
1648
|
+
$[18] !== onClick ? (t9 = (event_1) => {
|
|
1649
|
+
onClick?.(event_1), setShouldFocus("first"), setOpen(!0);
|
|
1650
|
+
}, $[18] = onClick, $[19] = t9) : t9 = $[19];
|
|
1651
|
+
const handleClick = t9;
|
|
1652
|
+
let t10;
|
|
1653
|
+
$[20] !== onItemClick ? (t10 = () => {
|
|
1654
|
+
setOpen(!1), onItemClick?.();
|
|
1655
|
+
}, $[20] = onItemClick, $[21] = t10) : t10 = $[21];
|
|
1656
|
+
const handleChildItemClick = t10;
|
|
1657
|
+
let t11;
|
|
1658
|
+
$[22] === Symbol.for("react.memo_cache_sentinel") ? (t11 = () => setWithinMenu(!0), $[22] = t11) : t11 = $[22];
|
|
1659
|
+
const handleMenuMouseEnter = t11;
|
|
1660
|
+
let t12, t13;
|
|
1661
|
+
$[23] !== mount || $[24] !== rootElement ? (t12 = () => mount(rootElement), t13 = [mount, rootElement], $[23] = mount, $[24] = rootElement, $[25] = t12, $[26] = t13) : (t12 = $[25], t13 = $[26]), react.useEffect(t12, t13);
|
|
1662
|
+
let t14, t15;
|
|
1663
|
+
$[27] !== active ? (t14 = () => {
|
|
1664
|
+
active || setOpen(!1);
|
|
1665
|
+
}, t15 = [active], $[27] = active, $[28] = t14, $[29] = t15) : (t14 = $[28], t15 = $[29]), react.useEffect(t14, t15);
|
|
1666
|
+
let t16, t17;
|
|
1667
|
+
$[30] !== open ? (t16 = () => {
|
|
1668
|
+
open || setWithinMenu(!1);
|
|
1669
|
+
}, t17 = [open], $[30] = open, $[31] = t16, $[32] = t17) : (t16 = $[31], t17 = $[32]), react.useEffect(t16, t17);
|
|
1670
|
+
let t18, t19;
|
|
1671
|
+
$[33] !== shouldFocus ? (t18 = () => {
|
|
1672
|
+
if (!shouldFocus)
|
|
1673
|
+
return;
|
|
1674
|
+
const rafId = requestAnimationFrame(() => setShouldFocus(null));
|
|
1675
|
+
return () => cancelAnimationFrame(rafId);
|
|
1676
|
+
}, t19 = [shouldFocus], $[33] = shouldFocus, $[34] = t18, $[35] = t19) : (t18 = $[34], t19 = $[35]), react.useEffect(t18, t19);
|
|
1677
|
+
let t20;
|
|
1678
|
+
$[36] !== children || $[37] !== handleChildItemClick || $[38] !== handleMenuKeyDown || $[39] !== menuProps || $[40] !== onClickOutside || $[41] !== onEscape || $[42] !== registerElement || $[43] !== shouldFocus ? (t20 = /* @__PURE__ */ jsxRuntime.jsx(Menu, { ...menuProps, onClickOutside, onEscape, onItemClick: handleChildItemClick, onKeyDown: handleMenuKeyDown, onMouseEnter: handleMenuMouseEnter, registerElement, shouldFocus, children }), $[36] = children, $[37] = handleChildItemClick, $[38] = handleMenuKeyDown, $[39] = menuProps, $[40] = onClickOutside, $[41] = onEscape, $[42] = registerElement, $[43] = shouldFocus, $[44] = t20) : t20 = $[44];
|
|
1679
|
+
const childMenu = t20;
|
|
1680
|
+
let t21;
|
|
1681
|
+
$[45] === Symbol.for("react.memo_cache_sentinel") ? (t21 = (event_2) => {
|
|
1682
|
+
const target = event_2.currentTarget;
|
|
1683
|
+
if (document.activeElement === target && event_2.key === "ArrowRight") {
|
|
1684
|
+
setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
|
|
1685
|
+
return;
|
|
1686
|
+
}
|
|
1687
|
+
}, $[45] = t21) : t21 = $[45];
|
|
1688
|
+
const handleKeyDown = t21, t22 = as === "button" ? withinMenu : void 0, t23 = as === "button" ? "button" : void 0;
|
|
1689
|
+
let t24;
|
|
1690
|
+
$[46] !== IconComponent || $[47] !== fontSize ? (t24 = IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize, children: [
|
|
1691
|
+
react.isValidElement(IconComponent) && IconComponent,
|
|
1692
|
+
reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
1693
|
+
] }), $[46] = IconComponent, $[47] = fontSize, $[48] = t24) : t24 = $[48];
|
|
1694
|
+
let t25;
|
|
1695
|
+
$[49] !== fontSize || $[50] !== text ? (t25 = /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, textOverflow: "ellipsis", weight: "medium", children: text }) }), $[49] = fontSize, $[50] = text, $[51] = t25) : t25 = $[51];
|
|
1696
|
+
let t26;
|
|
1697
|
+
$[52] === Symbol.for("react.memo_cache_sentinel") ? (t26 = /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRightIcon, {}), $[52] = t26) : t26 = $[52];
|
|
1698
|
+
let t27;
|
|
1699
|
+
$[53] !== fontSize ? (t27 = /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, children: t26 }), $[53] = fontSize, $[54] = t27) : t27 = $[54];
|
|
1700
|
+
let t28;
|
|
1701
|
+
$[55] !== gap || $[56] !== padding || $[57] !== t24 || $[58] !== t25 || $[59] !== t27 ? (t28 = /* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap, padding, children: [
|
|
1702
|
+
t24,
|
|
1703
|
+
t25,
|
|
1704
|
+
t27
|
|
1705
|
+
] }), $[55] = gap, $[56] = padding, $[57] = t24, $[58] = t25, $[59] = t27, $[60] = t28) : t28 = $[60];
|
|
1706
|
+
let t29;
|
|
1707
|
+
$[61] !== as || $[62] !== handleClick || $[63] !== handleMouseEnter || $[64] !== radius || $[65] !== rest || $[66] !== t22 || $[67] !== t23 || $[68] !== t28 || $[69] !== tone || $[70] !== withinMenu ? (t29 = /* @__PURE__ */ jsxRuntime.jsx(Selectable, { "data-ui": "MenuGroup", ...rest, "aria-pressed": t22, as, onClick: handleClick, onKeyDown: handleKeyDown, onMouseEnter: handleMouseEnter, radius, ref: setRootElement, selected: withinMenu, tabIndex: -1, tone, type: t23, children: t28 }), $[61] = as, $[62] = handleClick, $[63] = handleMouseEnter, $[64] = radius, $[65] = rest, $[66] = t22, $[67] = t23, $[68] = t28, $[69] = tone, $[70] = withinMenu, $[71] = t29) : t29 = $[71];
|
|
1708
|
+
let t30;
|
|
1709
|
+
return $[72] !== childMenu || $[73] !== open || $[74] !== popover || $[75] !== t29 ? (t30 = /* @__PURE__ */ jsxRuntime.jsx(Popover, { ...popover, content: childMenu, "data-ui": "MenuGroup__popover", open, children: t29 }), $[72] = childMenu, $[73] = open, $[74] = popover, $[75] = t29, $[76] = t30) : t30 = $[76], t30;
|
|
1710
|
+
}
|
|
1711
|
+
const DEFAULT_MENU_ITEM_ELEMENT = "button";
|
|
1712
|
+
function MenuItem(props) {
|
|
1713
|
+
const $ = compilerRuntime.c(73), t0 = props;
|
|
1714
|
+
let IconComponent, IconRightComponent, children, disabled, forwardedRef, gapX, gapY, hotkeys, onClick, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, pressed, rest, selectedProp, t1, t2, t3, t4, t5, t6, text;
|
|
1715
|
+
$[0] !== t0 ? ({
|
|
1716
|
+
as: t1,
|
|
1717
|
+
children,
|
|
1718
|
+
disabled,
|
|
1719
|
+
fontSize: t2,
|
|
1720
|
+
gap: t3,
|
|
1721
|
+
gapX,
|
|
1722
|
+
gapY,
|
|
1723
|
+
hotkeys,
|
|
1724
|
+
icon: IconComponent,
|
|
1725
|
+
iconRight: IconRightComponent,
|
|
1726
|
+
onClick,
|
|
1727
|
+
padding: t4,
|
|
1728
|
+
paddingX,
|
|
1729
|
+
paddingY,
|
|
1730
|
+
paddingTop,
|
|
1731
|
+
paddingRight,
|
|
1732
|
+
paddingBottom,
|
|
1733
|
+
paddingLeft,
|
|
1734
|
+
pressed,
|
|
1735
|
+
radius: t5,
|
|
1736
|
+
ref: forwardedRef,
|
|
1737
|
+
selected: selectedProp,
|
|
1738
|
+
text,
|
|
1739
|
+
tone: t6,
|
|
1740
|
+
...rest
|
|
1741
|
+
} = t0, $[0] = t0, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = children, $[4] = disabled, $[5] = forwardedRef, $[6] = gapX, $[7] = gapY, $[8] = hotkeys, $[9] = onClick, $[10] = paddingBottom, $[11] = paddingLeft, $[12] = paddingRight, $[13] = paddingTop, $[14] = paddingX, $[15] = paddingY, $[16] = pressed, $[17] = rest, $[18] = selectedProp, $[19] = t1, $[20] = t2, $[21] = t3, $[22] = t4, $[23] = t5, $[24] = t6, $[25] = text) : (IconComponent = $[1], IconRightComponent = $[2], children = $[3], disabled = $[4], forwardedRef = $[5], gapX = $[6], gapY = $[7], hotkeys = $[8], onClick = $[9], paddingBottom = $[10], paddingLeft = $[11], paddingRight = $[12], paddingTop = $[13], paddingX = $[14], paddingY = $[15], pressed = $[16], rest = $[17], selectedProp = $[18], t1 = $[19], t2 = $[20], t3 = $[21], t4 = $[22], t5 = $[23], t6 = $[24], text = $[25]);
|
|
1742
|
+
const as = t1 === void 0 ? DEFAULT_MENU_ITEM_ELEMENT : t1, fontSize = t2 === void 0 ? 1 : t2, gap = t3 === void 0 ? 3 : t3, padding = t4 === void 0 ? 3 : t4, radius = t5 === void 0 ? 2 : t5, tone = t6 === void 0 ? "default" : t6, menu = useMenu(), {
|
|
1743
|
+
activeElement,
|
|
1744
|
+
mount,
|
|
1745
|
+
onItemClick,
|
|
1746
|
+
onItemMouseEnter,
|
|
1747
|
+
onItemMouseLeave
|
|
1748
|
+
} = menu, [rootElement, setRootElement] = react.useState(null), active = !!activeElement && activeElement === rootElement, ref = react.useRef(null);
|
|
1749
|
+
let t7;
|
|
1750
|
+
$[26] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[26] = t7) : t7 = $[26], react.useImperativeHandle(forwardedRef, t7);
|
|
1751
|
+
let t8, t9;
|
|
1752
|
+
$[27] !== mount || $[28] !== rootElement || $[29] !== selectedProp ? (t8 = () => mount(rootElement, selectedProp), t9 = [mount, rootElement, selectedProp], $[27] = mount, $[28] = rootElement, $[29] = selectedProp, $[30] = t8, $[31] = t9) : (t8 = $[30], t9 = $[31]), react.useEffect(t8, t9);
|
|
1753
|
+
let t10;
|
|
1754
|
+
$[32] !== disabled || $[33] !== onClick || $[34] !== onItemClick ? (t10 = (event) => {
|
|
1755
|
+
disabled || (onClick && onClick(event), onItemClick && onItemClick());
|
|
1756
|
+
}, $[32] = disabled, $[33] = onClick, $[34] = onItemClick, $[35] = t10) : t10 = $[35];
|
|
1757
|
+
const handleClick = t10;
|
|
1758
|
+
let t11, t12;
|
|
1759
|
+
$[36] !== padding || $[37] !== paddingBottom || $[38] !== paddingLeft || $[39] !== paddingRight || $[40] !== paddingTop || $[41] !== paddingX || $[42] !== paddingY ? (t12 = {
|
|
1760
|
+
padding,
|
|
1761
|
+
paddingX,
|
|
1762
|
+
paddingY,
|
|
1763
|
+
paddingTop,
|
|
1764
|
+
paddingRight,
|
|
1765
|
+
paddingBottom,
|
|
1766
|
+
paddingLeft
|
|
1767
|
+
}, $[36] = padding, $[37] = paddingBottom, $[38] = paddingLeft, $[39] = paddingRight, $[40] = paddingTop, $[41] = paddingX, $[42] = paddingY, $[43] = t12) : t12 = $[43], t11 = t12;
|
|
1768
|
+
const paddingProps = t11;
|
|
1769
|
+
let t13;
|
|
1770
|
+
$[44] === Symbol.for("react.memo_cache_sentinel") ? (t13 = (el) => {
|
|
1771
|
+
ref.current = el, setRootElement(el);
|
|
1772
|
+
}, $[44] = t13) : t13 = $[44];
|
|
1773
|
+
const setRef = t13, t14 = pressed ? "" : void 0, t15 = active ? "" : void 0, t16 = disabled ? "" : void 0, t17 = as === "button" ? "button" : void 0;
|
|
1774
|
+
let t18;
|
|
1775
|
+
$[45] !== IconComponent || $[46] !== IconRightComponent || $[47] !== fontSize || $[48] !== gap || $[49] !== gapX || $[50] !== gapY || $[51] !== hotkeys || $[52] !== paddingProps || $[53] !== text ? (t18 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", gap, gapX, gapY, align: "center", ...paddingProps, children: [
|
|
1776
|
+
IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { muted: !0, size: fontSize, children: [
|
|
1777
|
+
react.isValidElement(IconComponent) && IconComponent,
|
|
1778
|
+
reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
1779
|
+
] }),
|
|
1780
|
+
text && /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, textOverflow: "ellipsis", weight: "medium", children: text }) }),
|
|
1781
|
+
hotkeys && /* @__PURE__ */ jsxRuntime.jsx(Hotkeys, { keys: hotkeys, style: {
|
|
1782
|
+
marginTop: -4,
|
|
1783
|
+
marginBottom: -4
|
|
1784
|
+
} }),
|
|
1785
|
+
IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { muted: !0, size: fontSize, children: [
|
|
1786
|
+
react.isValidElement(IconRightComponent) && IconRightComponent,
|
|
1787
|
+
reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
|
|
1788
|
+
] })
|
|
1789
|
+
] }), $[45] = IconComponent, $[46] = IconRightComponent, $[47] = fontSize, $[48] = gap, $[49] = gapX, $[50] = gapY, $[51] = hotkeys, $[52] = paddingProps, $[53] = text, $[54] = t18) : t18 = $[54];
|
|
1790
|
+
let t19;
|
|
1791
|
+
$[55] !== children || $[56] !== paddingProps ? (t19 = children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...paddingProps, children }), $[55] = children, $[56] = paddingProps, $[57] = t19) : t19 = $[57];
|
|
1792
|
+
let t20;
|
|
1793
|
+
return $[58] !== as || $[59] !== disabled || $[60] !== handleClick || $[61] !== onItemMouseEnter || $[62] !== onItemMouseLeave || $[63] !== radius || $[64] !== rest || $[65] !== t14 || $[66] !== t15 || $[67] !== t16 || $[68] !== t17 || $[69] !== t18 || $[70] !== t19 || $[71] !== tone ? (t20 = /* @__PURE__ */ jsxRuntime.jsxs(Selectable, { "data-ui": "MenuItem", ...rest, as, "data-pressed": t14, "data-selected": t15, "data-disabled": t16, radius, disabled, onClick: handleClick, onMouseEnter: onItemMouseEnter, onMouseLeave: onItemMouseLeave, ref: setRef, role: "menuitem", tabIndex: -1, tone, type: t17, children: [
|
|
1794
|
+
t18,
|
|
1795
|
+
t19
|
|
1796
|
+
] }), $[58] = as, $[59] = disabled, $[60] = handleClick, $[61] = onItemMouseEnter, $[62] = onItemMouseLeave, $[63] = radius, $[64] = rest, $[65] = t14, $[66] = t15, $[67] = t16, $[68] = t17, $[69] = t18, $[70] = t19, $[71] = tone, $[72] = t20) : t20 = $[72], t20;
|
|
1797
|
+
}
|
|
1798
|
+
const DEFAULT_TAB_ELEMENT = "button";
|
|
1799
|
+
function Tab(props) {
|
|
1800
|
+
const $ = compilerRuntime.c(33), t0 = props;
|
|
1801
|
+
let focused, forwardedRef, icon, id, label, onClick, onFocus, rest, selected, t1, t2, t3;
|
|
1802
|
+
$[0] !== t0 ? ({
|
|
1803
|
+
as: t1,
|
|
1804
|
+
icon,
|
|
1805
|
+
id,
|
|
1806
|
+
focused,
|
|
1807
|
+
fontSize: t2,
|
|
1808
|
+
label,
|
|
1809
|
+
onClick,
|
|
1810
|
+
onFocus,
|
|
1811
|
+
padding: t3,
|
|
1812
|
+
ref: forwardedRef,
|
|
1813
|
+
selected,
|
|
1814
|
+
...rest
|
|
1815
|
+
} = t0, $[0] = t0, $[1] = focused, $[2] = forwardedRef, $[3] = icon, $[4] = id, $[5] = label, $[6] = onClick, $[7] = onFocus, $[8] = rest, $[9] = selected, $[10] = t1, $[11] = t2, $[12] = t3) : (focused = $[1], forwardedRef = $[2], icon = $[3], id = $[4], label = $[5], onClick = $[6], onFocus = $[7], rest = $[8], selected = $[9], t1 = $[10], t2 = $[11], t3 = $[12]);
|
|
1816
|
+
const as = t1 === void 0 ? DEFAULT_TAB_ELEMENT : t1, fontSize = t2 === void 0 ? 1 : t2, padding = t3 === void 0 ? 2 : t3, ref = react.useRef(null), focusedRef = react.useRef(!1);
|
|
1817
|
+
let t4;
|
|
1818
|
+
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[13] = t4) : t4 = $[13], react.useImperativeHandle(forwardedRef, t4);
|
|
1819
|
+
let t5;
|
|
1820
|
+
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => {
|
|
1821
|
+
focusedRef.current = !1;
|
|
1822
|
+
}, $[14] = t5) : t5 = $[14];
|
|
1823
|
+
const handleBlur = t5;
|
|
1824
|
+
let t6;
|
|
1825
|
+
$[15] !== onFocus ? (t6 = (event) => {
|
|
1826
|
+
focusedRef.current = !0, onFocus && onFocus(event);
|
|
1827
|
+
}, $[15] = onFocus, $[16] = t6) : t6 = $[16];
|
|
1828
|
+
const handleFocus = t6;
|
|
1829
|
+
let t7, t8;
|
|
1830
|
+
$[17] !== focused ? (t7 = () => {
|
|
1831
|
+
focused && !focusedRef.current && (ref.current && ref.current.focus(), focusedRef.current = !0);
|
|
1832
|
+
}, t8 = [focused], $[17] = focused, $[18] = t7, $[19] = t8) : (t7 = $[18], t8 = $[19]), react.useEffect(t7, t8);
|
|
1833
|
+
const t9 = selected ? "true" : "false", t10 = selected ? 0 : -1;
|
|
1834
|
+
let t11;
|
|
1835
|
+
return $[20] !== as || $[21] !== fontSize || $[22] !== handleFocus || $[23] !== icon || $[24] !== id || $[25] !== label || $[26] !== onClick || $[27] !== padding || $[28] !== rest || $[29] !== selected || $[30] !== t10 || $[31] !== t9 ? (t11 = /* @__PURE__ */ jsxRuntime.jsx(Button, { "data-ui": "Tab", ...rest, "aria-selected": t9, as, fontSize, icon, id, mode: "bleed", onClick, onBlur: handleBlur, onFocus: handleFocus, padding, ref, role: "tab", selected, tabIndex: t10, text: label, type: "button" }), $[20] = as, $[21] = fontSize, $[22] = handleFocus, $[23] = icon, $[24] = id, $[25] = label, $[26] = onClick, $[27] = padding, $[28] = rest, $[29] = selected, $[30] = t10, $[31] = t9, $[32] = t11) : t11 = $[32], t11;
|
|
1836
|
+
}
|
|
1837
|
+
const DEFAULT_TAB_LIST_ELEMENT = "div";
|
|
1838
|
+
function TabList(props) {
|
|
1839
|
+
const $ = compilerRuntime.c(20), t0 = props;
|
|
1840
|
+
let childrenProp, rest, t1, t2, t3;
|
|
1841
|
+
$[0] !== t0 ? ({
|
|
1842
|
+
as: t1,
|
|
1843
|
+
children: childrenProp,
|
|
1844
|
+
gap: t2,
|
|
1845
|
+
wrap: t3,
|
|
1846
|
+
...rest
|
|
1847
|
+
} = t0, $[0] = t0, $[1] = childrenProp, $[2] = rest, $[3] = t1, $[4] = t2, $[5] = t3) : (childrenProp = $[1], rest = $[2], t1 = $[3], t2 = $[4], t3 = $[5]);
|
|
1848
|
+
const as = t1 === void 0 ? DEFAULT_TAB_LIST_ELEMENT : t1, gap = t2 === void 0 ? 1 : t2, wrap = t3 === void 0 ? "nowrap" : t3, [focusedIndex, setFocusedIndex] = react.useState(-1);
|
|
1849
|
+
let t4;
|
|
1850
|
+
if ($[6] !== childrenProp || $[7] !== focusedIndex) {
|
|
1851
|
+
const children = react.Children.toArray(childrenProp).filter(_isReactElement);
|
|
1852
|
+
let t52;
|
|
1853
|
+
$[9] !== focusedIndex ? (t52 = (child, childIndex) => react.cloneElement(child, {
|
|
1854
|
+
focused: focusedIndex === childIndex,
|
|
1855
|
+
key: childIndex,
|
|
1856
|
+
onFocus: () => setFocusedIndex(childIndex)
|
|
1857
|
+
}), $[9] = focusedIndex, $[10] = t52) : t52 = $[10], t4 = children.map(t52), $[6] = childrenProp, $[7] = focusedIndex, $[8] = t4;
|
|
1858
|
+
} else
|
|
1859
|
+
t4 = $[8];
|
|
1860
|
+
const tabs = t4, numTabs = tabs.length;
|
|
1861
|
+
let t5;
|
|
1862
|
+
$[11] !== numTabs ? (t5 = (event) => {
|
|
1863
|
+
event.key === "ArrowLeft" && setFocusedIndex((prevIndex) => (prevIndex + numTabs - 1) % numTabs), event.key === "ArrowRight" && setFocusedIndex((prevIndex_0) => (prevIndex_0 + 1) % numTabs);
|
|
1864
|
+
}, $[11] = numTabs, $[12] = t5) : t5 = $[12];
|
|
1865
|
+
const handleKeyDown = t5;
|
|
1866
|
+
let t6;
|
|
1867
|
+
return $[13] !== as || $[14] !== gap || $[15] !== handleKeyDown || $[16] !== rest || $[17] !== tabs || $[18] !== wrap ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(Flex, { "data-ui": "TabList", ...rest, as, gap, onKeyDown: handleKeyDown, role: "tablist", wrap, children: tabs }), $[13] = as, $[14] = gap, $[15] = handleKeyDown, $[16] = rest, $[17] = tabs, $[18] = wrap, $[19] = t6) : t6 = $[19], t6;
|
|
1868
|
+
}
|
|
1869
|
+
function _isReactElement(node) {
|
|
1870
|
+
return !!node;
|
|
1871
|
+
}
|
|
1872
|
+
const DEFAULT_GRID_ELEMENT = "div";
|
|
1873
|
+
function Grid(props) {
|
|
1874
|
+
const $ = compilerRuntime.c(8), t0 = props;
|
|
1875
|
+
let children, rest, t1;
|
|
1876
|
+
$[0] !== t0 ? ({
|
|
1877
|
+
as: t1,
|
|
1878
|
+
children,
|
|
1879
|
+
...rest
|
|
1880
|
+
} = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1) : (children = $[1], rest = $[2], t1 = $[3]);
|
|
1881
|
+
const as = t1 === void 0 ? DEFAULT_GRID_ELEMENT : t1;
|
|
1882
|
+
let t2;
|
|
1883
|
+
return $[4] !== as || $[5] !== children || $[6] !== rest ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Grid", ...rest, as, display: "grid", children }), $[4] = as, $[5] = children, $[6] = rest, $[7] = t2) : t2 = $[7], t2;
|
|
1884
|
+
}
|
|
1885
|
+
function usePrefersDark(t0) {
|
|
1886
|
+
return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$1 : t0);
|
|
1887
|
+
}
|
|
1888
|
+
function _temp$1() {
|
|
1889
|
+
return !1;
|
|
1890
|
+
}
|
|
1891
|
+
function useDelayedState(initialState) {
|
|
1892
|
+
const $ = compilerRuntime.c(3), [state, setState] = react.useState(initialState), delayedAction = react.useRef(void 0);
|
|
1893
|
+
let t0;
|
|
1894
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (nextState, delay) => {
|
|
1895
|
+
const action = () => {
|
|
1896
|
+
setState(nextState);
|
|
1897
|
+
};
|
|
1898
|
+
if (delayedAction.current && (clearTimeout(delayedAction.current), delayedAction.current = void 0), !delay)
|
|
1899
|
+
return action();
|
|
1900
|
+
delayedAction.current = setTimeout(action, delay);
|
|
1901
|
+
}, $[0] = t0) : t0 = $[0];
|
|
1902
|
+
const onStateChange = t0;
|
|
1903
|
+
let t1;
|
|
1904
|
+
return $[1] !== state ? (t1 = [state, onStateChange], $[1] = state, $[2] = t1) : t1 = $[2], t1;
|
|
1905
|
+
}
|
|
1906
|
+
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 = {
|
|
1907
|
+
top: ["top-end", "top-start", "bottom", "left", "right"],
|
|
1908
|
+
"top-start": ["top", "top-end", "bottom-start", "left-start", "right-start"],
|
|
1909
|
+
"top-end": ["top", "top-start", "bottom-end", "left-end", "right-end"],
|
|
1910
|
+
bottom: ["bottom-end", "bottom-start", "top", "left", "right"],
|
|
1911
|
+
"bottom-start": ["bottom", "bottom-end", "top-start", "left-start", "right-start"],
|
|
1912
|
+
"bottom-end": ["bottom", "bottom-start", "top-end", "left-end", "right-end"],
|
|
1913
|
+
left: ["left-end", "left-start", "right", "top", "bottom"],
|
|
1914
|
+
"left-start": ["left", "left-end", "right-start", "top-start", "bottom-start"],
|
|
1915
|
+
"left-end": ["left", "left-start", "right-end", "top-end", "bottom-end"],
|
|
1916
|
+
right: ["right-end", "right-start", "left", "top", "bottom"],
|
|
1917
|
+
"right-start": ["right", "right-end", "left-start", "top-start", "bottom-start"],
|
|
1918
|
+
"right-end": ["right", "right-start", "left-end", "top-end", "bottom-end"]
|
|
1919
|
+
}, TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/v3/tooltipDelayGroup", null);
|
|
1920
|
+
function useTooltipDelayGroup() {
|
|
1921
|
+
return react.useContext(TooltipDelayGroupContext);
|
|
1922
|
+
}
|
|
1923
|
+
function TooltipLayer(props) {
|
|
1924
|
+
const $ = compilerRuntime.c(50);
|
|
1925
|
+
let animate, arrow, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, rest, scheme, shadow, style, t0;
|
|
1926
|
+
$[0] !== props ? ({
|
|
1927
|
+
animate,
|
|
1928
|
+
arrow,
|
|
1929
|
+
arrowRef,
|
|
1930
|
+
arrowX,
|
|
1931
|
+
arrowY,
|
|
1932
|
+
children,
|
|
1933
|
+
originX,
|
|
1934
|
+
originY,
|
|
1935
|
+
padding,
|
|
1936
|
+
placement,
|
|
1937
|
+
radius,
|
|
1938
|
+
scheme,
|
|
1939
|
+
shadow,
|
|
1940
|
+
style,
|
|
1941
|
+
tone: t0,
|
|
1942
|
+
...rest
|
|
1943
|
+
} = props, $[0] = props, $[1] = animate, $[2] = arrow, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = originX, $[8] = originY, $[9] = padding, $[10] = placement, $[11] = radius, $[12] = rest, $[13] = scheme, $[14] = shadow, $[15] = style, $[16] = t0) : (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], originX = $[7], originY = $[8], padding = $[9], placement = $[10], radius = $[11], rest = $[12], scheme = $[13], shadow = $[14], style = $[15], t0 = $[16]);
|
|
1944
|
+
const tone = t0 === void 0 ? "inherit" : t0;
|
|
1945
|
+
let t1;
|
|
1946
|
+
const t2 = animate ? "transform" : void 0;
|
|
1947
|
+
let t3;
|
|
1948
|
+
$[17] !== originX || $[18] !== originY || $[19] !== style || $[20] !== t2 ? (t3 = {
|
|
1949
|
+
originX,
|
|
1950
|
+
originY,
|
|
1951
|
+
willChange: t2,
|
|
1952
|
+
...style
|
|
1953
|
+
}, $[17] = originX, $[18] = originY, $[19] = style, $[20] = t2, $[21] = t3) : t3 = $[21], t1 = t3;
|
|
1954
|
+
const rootStyle = t1;
|
|
1955
|
+
let t4;
|
|
1956
|
+
const t5 = arrowX !== null ? arrowX : void 0, t6 = arrowY !== null ? arrowY : void 0;
|
|
1957
|
+
let t7;
|
|
1958
|
+
$[22] !== t5 || $[23] !== t6 ? (t7 = {
|
|
1959
|
+
left: t5,
|
|
1960
|
+
top: t6,
|
|
1961
|
+
right: void 0,
|
|
1962
|
+
bottom: void 0
|
|
1963
|
+
}, $[22] = t5, $[23] = t6, $[24] = t7) : t7 = $[24], t4 = t7;
|
|
1964
|
+
const arrowStyle = t4, t8 = animate ? "" : void 0;
|
|
1965
|
+
let t9;
|
|
1966
|
+
$[25] !== animate ? (t9 = animate ? ["hidden", "initial"] : void 0, $[25] = animate, $[26] = t9) : t9 = $[26];
|
|
1967
|
+
let t10;
|
|
1968
|
+
$[27] !== animate ? (t10 = animate ? ["visible", "scaleIn"] : void 0, $[27] = animate, $[28] = t10) : t10 = $[28];
|
|
1969
|
+
let t11;
|
|
1970
|
+
$[29] !== animate ? (t11 = animate ? ["hidden", "scaleOut"] : void 0, $[29] = animate, $[30] = t11) : t11 = $[30];
|
|
1971
|
+
let t12;
|
|
1972
|
+
$[31] !== arrow || $[32] !== arrowRef || $[33] !== arrowStyle ? (t12 = arrow && /* @__PURE__ */ jsxRuntime.jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_TOOLTIP_ARROW_WIDTH, height: DEFAULT_TOOLTIP_ARROW_HEIGHT, radius: DEFAULT_TOOLTIP_ARROW_RADIUS }), $[31] = arrow, $[32] = arrowRef, $[33] = arrowStyle, $[34] = t12) : t12 = $[34];
|
|
1973
|
+
let t13;
|
|
1974
|
+
return $[35] !== children || $[36] !== padding || $[37] !== placement || $[38] !== radius || $[39] !== rest || $[40] !== rootStyle || $[41] !== scheme || $[42] !== shadow || $[43] !== t10 || $[44] !== t11 || $[45] !== t12 || $[46] !== t8 || $[47] !== t9 || $[48] !== tone ? (t13 = /* @__PURE__ */ jsxRuntime.jsxs(Layer, { "data-ui": "Tooltip__layer", ...rest, as: framerMotion.motion.div, "data-animate": t8, "data-placement": placement, padding, radius, scheme, shadow, style: rootStyle, variants: POPOVER_MOTION_PROPS.card, transition: POPOVER_MOTION_PROPS.transition, initial: t9, animate: t10, exit: t11, tone, children: [
|
|
1975
|
+
children,
|
|
1976
|
+
t12
|
|
1977
|
+
] }), $[35] = children, $[36] = padding, $[37] = placement, $[38] = radius, $[39] = rest, $[40] = rootStyle, $[41] = scheme, $[42] = shadow, $[43] = t10, $[44] = t11, $[45] = t12, $[46] = t8, $[47] = t9, $[48] = tone, $[49] = t13) : t13 = $[49], t13;
|
|
1978
|
+
}
|
|
1979
|
+
const DEFAULT_TOOLTIP_ELEMENT = "div";
|
|
1980
|
+
function Tooltip(props) {
|
|
1981
|
+
const boundaryElementContext = useBoundaryElement(), {
|
|
1982
|
+
animate: _animate = !1,
|
|
1983
|
+
arrow: arrowProp = !1,
|
|
1984
|
+
as = DEFAULT_TOOLTIP_ELEMENT,
|
|
1985
|
+
boundaryElement = boundaryElementContext?.element,
|
|
1986
|
+
children: childProp,
|
|
1987
|
+
className,
|
|
1988
|
+
content,
|
|
1989
|
+
delay,
|
|
1990
|
+
disabled,
|
|
1991
|
+
fallbackPlacements = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"],
|
|
1992
|
+
padding = 2,
|
|
1993
|
+
placement: placementProp = "bottom",
|
|
1994
|
+
portal: portalProp,
|
|
1995
|
+
radius = 3,
|
|
1996
|
+
ref: forwardedRef,
|
|
1997
|
+
scheme,
|
|
1998
|
+
shadow = 2,
|
|
1999
|
+
zOffset = Z_OFFSETS.tooltip,
|
|
2000
|
+
tone = "inherit",
|
|
2001
|
+
...rest
|
|
2002
|
+
} = props, card = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, ref = react.useRef(null), [referenceElement, setReferenceElement] = react.useState(null), arrowRef = react.useRef(null), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = react.useState(0);
|
|
2003
|
+
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
2004
|
+
const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = react.useMemo(() => {
|
|
2005
|
+
const ret = [];
|
|
2006
|
+
return ret.push(reactDom$1.flip({
|
|
2007
|
+
boundary: boundaryElement || void 0,
|
|
2008
|
+
fallbackPlacements,
|
|
2009
|
+
padding: DEFAULT_TOOLTIP_PADDING,
|
|
2010
|
+
rootBoundary
|
|
2011
|
+
})), ret.push(reactDom$1.offset({
|
|
2012
|
+
mainAxis: DEFAULT_TOOLTIP_DISTANCE
|
|
2013
|
+
})), ret.push(reactDom$1.shift({
|
|
2014
|
+
boundary: boundaryElement || void 0,
|
|
2015
|
+
rootBoundary,
|
|
2016
|
+
padding: DEFAULT_TOOLTIP_PADDING
|
|
2017
|
+
})), arrowProp && ret.push(reactDom$1.arrow({
|
|
2018
|
+
element: arrowRef,
|
|
2019
|
+
padding: DEFAULT_TOOLTIP_PADDING
|
|
2020
|
+
})), animate && ret.push(origin), ret;
|
|
2021
|
+
}, [animate, arrowProp, boundaryElement, fallbackPlacements]), {
|
|
2022
|
+
floatingStyles,
|
|
2023
|
+
placement,
|
|
2024
|
+
middlewareData,
|
|
2025
|
+
refs,
|
|
2026
|
+
update
|
|
2027
|
+
} = reactDom$1.useFloating({
|
|
2028
|
+
middleware,
|
|
2029
|
+
placement: placementProp,
|
|
2030
|
+
whileElementsMounted: reactDom$1.autoUpdate,
|
|
2031
|
+
elements: {
|
|
2032
|
+
reference: referenceElement
|
|
2033
|
+
},
|
|
2034
|
+
transform: !1
|
|
2035
|
+
}), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = react.useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), {
|
|
2036
|
+
setIsGroupActive,
|
|
2037
|
+
setOpenTooltipId
|
|
2038
|
+
} = 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 = react.useCallback((open, immediate) => {
|
|
2039
|
+
if (isInsideGroup)
|
|
2040
|
+
if (open) {
|
|
2041
|
+
const groupedOpenDelay = immediate ? 0 : openDelay;
|
|
2042
|
+
setIsGroupActive?.(open, groupedOpenDelay), setOpenTooltipId?.(tooltipId, groupedOpenDelay);
|
|
2043
|
+
} else {
|
|
2044
|
+
const groupDeactivateDelay = closeDelay > 200 ? closeDelay : 200;
|
|
2045
|
+
setIsGroupActive?.(open, groupDeactivateDelay), setOpenTooltipId?.(null, immediate ? 0 : closeDelay);
|
|
2046
|
+
}
|
|
2047
|
+
else
|
|
2048
|
+
setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
|
|
2049
|
+
}, [isInsideGroup, openDelay, setIsGroupActive, setOpenTooltipId, tooltipId, closeDelay, setIsOpen]), handleBlur = react.useCallback((e) => {
|
|
2050
|
+
handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
|
|
2051
|
+
}, [childProp?.props, handleIsOpenChange]), handleClick = react.useCallback((e_0) => {
|
|
2052
|
+
handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
|
|
2053
|
+
}, [childProp?.props, handleIsOpenChange]), handleContextMenu = react.useCallback((e_1) => {
|
|
2054
|
+
handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
|
|
2055
|
+
}, [childProp?.props, handleIsOpenChange]), handleFocus = react.useCallback((e_2) => {
|
|
2056
|
+
handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
|
|
2057
|
+
}, [childProp?.props, handleIsOpenChange]), handleMouseEnter = react.useCallback((e_3) => {
|
|
2058
|
+
handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
|
|
2059
|
+
}, [childProp?.props, handleIsOpenChange]), handleMouseLeave = react.useCallback((e_4) => {
|
|
2060
|
+
handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
|
|
2061
|
+
}, [childProp?.props, handleIsOpenChange]);
|
|
2062
|
+
useCloseOnMouseLeave({
|
|
2063
|
+
handleIsOpenChange,
|
|
2064
|
+
referenceElement,
|
|
2065
|
+
showTooltip,
|
|
2066
|
+
isInsideGroup
|
|
2067
|
+
}), react.useEffect(() => {
|
|
2068
|
+
disabled && showTooltip && handleIsOpenChange(!1);
|
|
2069
|
+
}, [disabled, handleIsOpenChange, showTooltip]), react.useEffect(() => {
|
|
2070
|
+
!content && showTooltip && handleIsOpenChange(!1);
|
|
2071
|
+
}, [content, handleIsOpenChange, showTooltip]), react.useEffect(() => {
|
|
2072
|
+
if (!showTooltip) return;
|
|
2073
|
+
function handleWindowKeyDown(event) {
|
|
2074
|
+
event.key === "Escape" && handleIsOpenChange(!1, !0);
|
|
2075
|
+
}
|
|
2076
|
+
return window.addEventListener("keydown", handleWindowKeyDown), () => {
|
|
2077
|
+
window.removeEventListener("keydown", handleWindowKeyDown);
|
|
2078
|
+
};
|
|
2079
|
+
}, [handleIsOpenChange, showTooltip]), react.useLayoutEffect(() => {
|
|
2080
|
+
const availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
|
|
2081
|
+
setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2);
|
|
2082
|
+
}, [boundaryElement, portalElement]);
|
|
2083
|
+
const setArrow = react.useCallback((arrowEl) => {
|
|
2084
|
+
arrowRef.current = arrowEl, update();
|
|
2085
|
+
}, [update]), setFloating = react.useCallback((node) => {
|
|
2086
|
+
ref.current = node, refs.setFloating(node);
|
|
2087
|
+
}, [refs]), child = react.useMemo(() => childProp ? react.cloneElement(childProp, {
|
|
2088
|
+
onBlur: handleBlur,
|
|
2089
|
+
onFocus: handleFocus,
|
|
2090
|
+
onMouseEnter: handleMouseEnter,
|
|
2091
|
+
onMouseLeave: handleMouseLeave,
|
|
2092
|
+
onClick: handleClick,
|
|
2093
|
+
onContextMenu: handleContextMenu,
|
|
2094
|
+
ref: setReferenceElement
|
|
2095
|
+
}) : null, [childProp, handleBlur, handleClick, handleContextMenu, handleFocus, handleMouseEnter, handleMouseLeave]);
|
|
2096
|
+
if (react.useImperativeHandle(childProp ? getElementRef(childProp) : null, () => referenceElement, [referenceElement]), !child) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
2097
|
+
if (disabled) return child;
|
|
2098
|
+
const node_0 = /* @__PURE__ */ jsxRuntime.jsx(TooltipLayer, { "data-ui": "Tooltip", ...rest, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: css.tooltip({
|
|
2099
|
+
className
|
|
2100
|
+
}), originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, style: {
|
|
2101
|
+
...floatingStyles,
|
|
2102
|
+
maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0
|
|
2103
|
+
}, tone, zOffset, children: content }), children = showTooltip && (portalProp ? /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { tone: tone === "inherit" ? card.tone : tone, scheme: scheme ?? "light", children: node_0 }) }) : node_0);
|
|
2104
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2105
|
+
animate ? /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children }) : children,
|
|
2106
|
+
child
|
|
2107
|
+
] });
|
|
2108
|
+
}
|
|
2109
|
+
function useCloseOnMouseLeave(t0) {
|
|
2110
|
+
const $ = compilerRuntime.c(10), {
|
|
2111
|
+
handleIsOpenChange,
|
|
2112
|
+
referenceElement,
|
|
2113
|
+
showTooltip,
|
|
2114
|
+
isInsideGroup
|
|
2115
|
+
} = t0;
|
|
2116
|
+
let t1;
|
|
2117
|
+
$[0] !== handleIsOpenChange || $[1] !== referenceElement ? (t1 = (target, teardown) => {
|
|
2118
|
+
referenceElement && (referenceElement === target || target instanceof Node && referenceElement.contains(target) || (handleIsOpenChange(!1), teardown()));
|
|
2119
|
+
}, $[0] = handleIsOpenChange, $[1] = referenceElement, $[2] = t1) : t1 = $[2];
|
|
2120
|
+
const onMouseMove = useEffectEvent.useEffectEvent(t1);
|
|
2121
|
+
let t2;
|
|
2122
|
+
$[3] !== isInsideGroup || $[4] !== onMouseMove || $[5] !== showTooltip ? (t2 = () => {
|
|
2123
|
+
if (!showTooltip || isInsideGroup)
|
|
2124
|
+
return;
|
|
2125
|
+
const handleMouseMove = (event) => {
|
|
2126
|
+
onMouseMove(event.target, () => window.removeEventListener("mousemove", handleMouseMove));
|
|
2127
|
+
};
|
|
2128
|
+
return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
|
|
2129
|
+
}, $[3] = isInsideGroup, $[4] = onMouseMove, $[5] = showTooltip, $[6] = t2) : t2 = $[6];
|
|
2130
|
+
let t3;
|
|
2131
|
+
$[7] !== isInsideGroup || $[8] !== showTooltip ? (t3 = [isInsideGroup, showTooltip], $[7] = isInsideGroup, $[8] = showTooltip, $[9] = t3) : t3 = $[9], react.useEffect(t2, t3);
|
|
2132
|
+
}
|
|
2133
|
+
function PortalProvider(props) {
|
|
2134
|
+
const $ = compilerRuntime.c(6), {
|
|
2135
|
+
children,
|
|
2136
|
+
element,
|
|
2137
|
+
__unstable_elements: elementsProp
|
|
2138
|
+
} = props, elements = useUnique(elementsProp), fallbackElement = react.useSyncExternalStore(emptySubscribe, _temp, _temp2);
|
|
2139
|
+
let t0;
|
|
2140
|
+
const t1 = element || fallbackElement;
|
|
2141
|
+
let t2;
|
|
2142
|
+
$[0] !== elements || $[1] !== t1 ? (t2 = {
|
|
2143
|
+
version: 0,
|
|
2144
|
+
boundaryElement: null,
|
|
2145
|
+
element: t1,
|
|
2146
|
+
elements
|
|
2147
|
+
}, $[0] = elements, $[1] = t1, $[2] = t2) : t2 = $[2], t0 = t2;
|
|
2148
|
+
const value = t0;
|
|
2149
|
+
let t3;
|
|
2150
|
+
return $[3] !== children || $[4] !== value ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(PortalContext.Provider, { value, children }), $[3] = children, $[4] = value, $[5] = t3) : t3 = $[5], t3;
|
|
2151
|
+
}
|
|
2152
|
+
function _temp2() {
|
|
2153
|
+
return null;
|
|
2154
|
+
}
|
|
2155
|
+
function _temp() {
|
|
2156
|
+
return document.body;
|
|
2157
|
+
}
|
|
2158
|
+
const emptySubscribe = () => () => {
|
|
2159
|
+
};
|
|
2160
|
+
function useUnique(value) {
|
|
2161
|
+
const valueRef = react.useRef(value);
|
|
2162
|
+
return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
|
|
2163
|
+
}
|
|
2164
|
+
function _isEqual(objA, objB) {
|
|
2165
|
+
if (!objA || !objB)
|
|
2166
|
+
return objA === objB;
|
|
2167
|
+
const keysA = Object.keys(objA), keysB = Object.keys(objB);
|
|
2168
|
+
return keysA.length !== keysB.length ? !1 : keysA.every((key2) => objA[key2] === objB[key2]);
|
|
2169
|
+
}
|
|
2170
|
+
exports.AnimatedSpinnerIcon = AnimatedSpinnerIcon;
|
|
2171
|
+
exports.Arrow = Arrow;
|
|
2172
|
+
exports.BoundaryElementContext = BoundaryElementContext;
|
|
2173
|
+
exports.Box = Box;
|
|
2174
|
+
exports.Button = Button;
|
|
2175
|
+
exports.Card = Card;
|
|
2176
|
+
exports.CardProvider = CardProvider;
|
|
2177
|
+
exports.DEFAULT_ARROW_ELEMENT = DEFAULT_ARROW_ELEMENT;
|
|
2178
|
+
exports.DEFAULT_BOX_ELEMENT = DEFAULT_BOX_ELEMENT;
|
|
2179
|
+
exports.DEFAULT_BUTTON_ELEMENT = DEFAULT_BUTTON_ELEMENT;
|
|
2180
|
+
exports.DEFAULT_CARD_ELEMENT = DEFAULT_CARD_ELEMENT;
|
|
2181
|
+
exports.DEFAULT_FLEX_ELEMENT = DEFAULT_FLEX_ELEMENT;
|
|
2182
|
+
exports.DEFAULT_GRID_ELEMENT = DEFAULT_GRID_ELEMENT;
|
|
2183
|
+
exports.DEFAULT_HOTKEYS_ELEMENT = DEFAULT_HOTKEYS_ELEMENT;
|
|
2184
|
+
exports.DEFAULT_KBD_ELEMENT = DEFAULT_KBD_ELEMENT;
|
|
2185
|
+
exports.DEFAULT_LAYER_ELEMENT = DEFAULT_LAYER_ELEMENT;
|
|
2186
|
+
exports.DEFAULT_MENU_DIVIDER_ELEMENT = DEFAULT_MENU_DIVIDER_ELEMENT;
|
|
2187
|
+
exports.DEFAULT_MENU_ELEMENT = DEFAULT_MENU_ELEMENT;
|
|
2188
|
+
exports.DEFAULT_MENU_GROUP_ELEMENT = DEFAULT_MENU_GROUP_ELEMENT;
|
|
2189
|
+
exports.DEFAULT_MENU_ITEM_ELEMENT = DEFAULT_MENU_ITEM_ELEMENT;
|
|
2190
|
+
exports.DEFAULT_POPOVER_ELEMENT = DEFAULT_POPOVER_ELEMENT;
|
|
2191
|
+
exports.DEFAULT_SELECTABLE_ELEMENT = DEFAULT_SELECTABLE_ELEMENT;
|
|
2192
|
+
exports.DEFAULT_SPINNER_ELEMENT = DEFAULT_SPINNER_ELEMENT;
|
|
2193
|
+
exports.DEFAULT_STACK_ELEMENT = DEFAULT_STACK_ELEMENT;
|
|
2194
|
+
exports.DEFAULT_TAB_ELEMENT = DEFAULT_TAB_ELEMENT;
|
|
2195
|
+
exports.DEFAULT_TAB_LIST_ELEMENT = DEFAULT_TAB_LIST_ELEMENT;
|
|
2196
|
+
exports.DEFAULT_TEXT_ELEMENT = DEFAULT_TEXT_ELEMENT;
|
|
2197
|
+
exports.DEFAULT_TEXT_INPUT_ELEMENT = DEFAULT_TEXT_INPUT_ELEMENT;
|
|
2198
|
+
exports.DEFAULT_TOOLTIP_ELEMENT = DEFAULT_TOOLTIP_ELEMENT;
|
|
2199
|
+
exports.EMPTY_ARRAY = EMPTY_ARRAY;
|
|
2200
|
+
exports.EMPTY_RECORD = EMPTY_RECORD;
|
|
2201
|
+
exports.Flex = Flex;
|
|
2202
|
+
exports.Grid = Grid;
|
|
2203
|
+
exports.Hotkeys = Hotkeys;
|
|
2204
|
+
exports.KBD = KBD;
|
|
2205
|
+
exports.Layer = Layer;
|
|
2206
|
+
exports.LayerProvider = LayerProvider;
|
|
2207
|
+
exports.Menu = Menu;
|
|
2208
|
+
exports.MenuDivider = MenuDivider;
|
|
2209
|
+
exports.MenuGroup = MenuGroup;
|
|
2210
|
+
exports.MenuItem = MenuItem;
|
|
2211
|
+
exports.Popover = Popover;
|
|
2212
|
+
exports.Portal = Portal;
|
|
2213
|
+
exports.PortalProvider = PortalProvider;
|
|
2214
|
+
exports.Selectable = Selectable;
|
|
2215
|
+
exports.Spinner = Spinner;
|
|
2216
|
+
exports.Stack = Stack;
|
|
2217
|
+
exports.Tab = Tab;
|
|
2218
|
+
exports.TabList = TabList;
|
|
2219
|
+
exports.Text = Text;
|
|
2220
|
+
exports.TextInput = TextInput;
|
|
2221
|
+
exports.Tooltip = Tooltip;
|
|
2222
|
+
exports.TooltipDelayGroupContext = TooltipDelayGroupContext;
|
|
2223
|
+
exports.Z_OFFSETS = Z_OFFSETS;
|
|
2224
|
+
exports._getArrayProp = _getArrayProp;
|
|
2225
|
+
exports._getResponsiveProp = _getResponsiveProp;
|
|
2226
|
+
exports._isEnterToClickElement = _isEnterToClickElement;
|
|
2227
|
+
exports.containsOrEqualsElement = containsOrEqualsElement;
|
|
2228
|
+
exports.createGlobalScopedContext = createGlobalScopedContext;
|
|
2229
|
+
exports.isHTMLAnchorElement = isHTMLAnchorElement;
|
|
2230
|
+
exports.isHTMLButtonElement = isHTMLButtonElement;
|
|
2231
|
+
exports.isHTMLElement = isHTMLElement;
|
|
2232
|
+
exports.isHTMLInputElement = isHTMLInputElement;
|
|
2233
|
+
exports.isHTMLSelectElement = isHTMLSelectElement;
|
|
2234
|
+
exports.isHTMLTextAreaElement = isHTMLTextAreaElement;
|
|
2235
|
+
exports.isRecord = isRecord;
|
|
2236
|
+
exports.useBoundaryElement = useBoundaryElement;
|
|
2237
|
+
exports.useCard = useCard;
|
|
2238
|
+
exports.useClickOutsideEvent = useClickOutsideEvent;
|
|
2239
|
+
exports.useCustomValidity = useCustomValidity;
|
|
2240
|
+
exports.useDelayedState = useDelayedState;
|
|
2241
|
+
exports.useGlobalKeyDown = useGlobalKeyDown;
|
|
2242
|
+
exports.useLayer = useLayer;
|
|
2243
|
+
exports.useMatchMedia = useMatchMedia;
|
|
2244
|
+
exports.useMediaIndex = useMediaIndex;
|
|
2245
|
+
exports.usePortal = usePortal;
|
|
2246
|
+
exports.usePrefersDark = usePrefersDark;
|
|
2247
|
+
exports.usePrefersReducedMotion = usePrefersReducedMotion;
|
|
2248
|
+
exports.useResponsiveProp = useResponsiveProp;
|
|
2249
|
+
exports.useTooltipDelayGroup = useTooltipDelayGroup;
|
|
2250
|
+
//# sourceMappingURL=_visual-editing.cjs.map
|