@sanity/ui 4.2.0 → 5.0.0-alpha.10
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 +194 -28
- package/bin/sanity-ui.js +14 -0
- package/dist/_chunks-es/LazyRefractor.js +20 -0
- package/dist/_chunks-es/LazyRefractor.js.map +1 -0
- package/dist/cli/checks.js +148 -0
- package/dist/cli/config.js +23 -0
- package/dist/cli/detect.js +181 -0
- package/dist/cli/doctor.js +49 -0
- package/dist/cli/index.js +69 -0
- package/dist/cli/init.js +189 -0
- package/dist/cli/install.js +79 -0
- package/dist/cli/log.js +66 -0
- package/dist/cli/selfPackage.js +11 -0
- package/dist/cli/styles.js +185 -0
- package/dist/cli/test-utils.js +8 -0
- package/dist/cli/tsconfig.js +236 -0
- package/dist/cli/types.js +1 -0
- package/dist/cli/versions.js +45 -0
- package/dist/index.d.ts +1203 -1469
- package/dist/index.js +2123 -1989
- package/dist/index.js.map +1 -1
- package/dist/polyfills.d.ts +1 -0
- package/dist/polyfills.js +5 -0
- package/dist/polyfills.js.map +1 -0
- package/dist/styles.css +1 -547
- package/package.json +57 -58
- package/src/cli/checks.test.ts +38 -0
- package/src/cli/checks.ts +200 -0
- package/src/cli/config.ts +44 -0
- package/src/cli/detect.test.ts +191 -0
- package/src/cli/detect.ts +205 -0
- package/src/cli/doctor.test.ts +52 -0
- package/src/cli/doctor.ts +65 -0
- package/src/cli/index.ts +77 -0
- package/src/cli/init.ts +225 -0
- package/src/cli/install.test.ts +52 -0
- package/src/cli/install.ts +108 -0
- package/src/cli/log.ts +79 -0
- package/src/cli/selfPackage.ts +14 -0
- package/src/cli/styles.test.ts +130 -0
- package/src/cli/styles.ts +205 -0
- package/src/cli/test-utils.ts +10 -0
- package/src/cli/tsconfig.test.ts +174 -0
- package/src/cli/tsconfig.ts +282 -0
- package/src/cli/types.ts +77 -0
- package/src/cli/versions.test.ts +35 -0
- package/src/cli/versions.ts +41 -0
- package/src/components/badge/Badge.tsx +53 -0
- package/src/components/badge/badge.css +6 -0
- package/src/components/badge/badge.props.ts +31 -0
- package/src/components/box/Box.tsx +30 -0
- package/src/components/box/box.css +4 -0
- package/src/components/box/box.props.ts +29 -0
- package/src/components/button/Button.tsx +78 -0
- package/src/components/button/button.css +72 -0
- package/src/components/button/button.props.ts +122 -0
- package/src/components/card/Card.tsx +31 -0
- package/src/components/card/card.css +4 -0
- package/src/components/card/card.props.ts +58 -0
- package/src/components/checkbox/Checkbox.tsx +64 -0
- package/src/components/checkbox/checkbox.css +100 -0
- package/src/components/checkbox/checkbox.props.ts +33 -0
- package/src/components/code/Code.tsx +38 -0
- package/src/components/code/LazyRefractor.tsx +9 -0
- package/src/components/code/code.css +40 -0
- package/src/components/code/code.props.ts +44 -0
- package/src/components/container/Container.tsx +30 -0
- package/src/components/container/container.css +4 -0
- package/src/components/container/container.props.ts +28 -0
- package/src/components/dialog/Dialog.tsx +139 -0
- package/src/components/dialog/dialog.css +49 -0
- package/src/components/dialog/dialog.props.ts +45 -0
- package/src/components/divider/Divider.tsx +23 -0
- package/src/components/divider/divider.props.ts +9 -0
- package/src/components/eyebrow/Eyebrow.tsx +54 -0
- package/src/components/eyebrow/eyebrow.css +11 -0
- package/src/components/eyebrow/eyebrow.props.ts +28 -0
- package/src/components/flex/Flex.tsx +30 -0
- package/src/components/flex/flex.css +4 -0
- package/src/components/flex/flex.props.ts +33 -0
- package/src/components/grid/Grid.tsx +30 -0
- package/src/components/grid/grid.css +4 -0
- package/src/components/grid/grid.props.ts +33 -0
- package/src/components/h-stack/HStack.tsx +34 -0
- package/src/components/h-stack/hStack.props.ts +17 -0
- package/src/components/heading/Heading.tsx +54 -0
- package/src/components/heading/heading.css +9 -0
- package/src/components/heading/heading.props.ts +31 -0
- package/src/components/icon/Icon.tsx +24 -0
- package/src/components/icon/icon.css +17 -0
- package/src/components/icon/icon.props.ts +35 -0
- package/src/components/icon-button/IconButton.tsx +32 -0
- package/src/components/icon-button/iconButton.props.ts +31 -0
- package/src/components/index.css +28 -0
- package/src/components/indicator/Indicator.tsx +42 -0
- package/src/components/indicator/indicator.css +4 -0
- package/src/components/indicator/indicator.props.ts +24 -0
- package/src/components/indicator-stack/IndicatorStack.tsx +31 -0
- package/src/components/indicator-stack/indicator-stack.css +7 -0
- package/src/components/indicator-stack/indicatorStack.props.ts +15 -0
- package/src/components/inline/Inline.tsx +38 -0
- package/src/components/inline/inline.css +4 -0
- package/src/components/inline/inline.props.ts +100 -0
- package/src/components/label/Label.tsx +34 -0
- package/src/components/label/label.css +3 -0
- package/src/components/label/label.props.ts +25 -0
- package/src/components/link/Link.tsx +29 -0
- package/src/components/link/link.css +12 -0
- package/src/components/link/link.props.ts +23 -0
- package/src/components/list/List.tsx +167 -0
- package/src/components/list/list.css +25 -0
- package/src/components/list/list.props.ts +130 -0
- package/src/components/popover/Popover.tsx +85 -0
- package/src/components/popover/popover.css +21 -0
- package/src/components/popover/popover.props.ts +38 -0
- package/src/components/press-area/PressArea.tsx +29 -0
- package/src/components/press-area/press-area.css +22 -0
- package/src/components/press-area/pressArea.props.ts +16 -0
- package/src/components/radio/Radio.tsx +48 -0
- package/src/components/radio/radio.css +97 -0
- package/src/components/radio/radio.props.ts +25 -0
- package/src/components/skip-to-content/SkipToContent.tsx +35 -0
- package/src/components/skip-to-content/skip-to-content.css +9 -0
- package/src/components/skip-to-content/skipToContent.props.ts +25 -0
- package/src/components/spinner/Spinner.tsx +28 -0
- package/src/components/spinner/spinner.css +10 -0
- package/src/components/spinner/spinner.props.ts +19 -0
- package/src/components/switch/Switch.tsx +48 -0
- package/src/components/switch/switch.css +119 -0
- package/src/components/switch/switch.props.ts +25 -0
- package/src/components/text/Text.tsx +53 -0
- package/src/components/text/text.css +9 -0
- package/src/components/text/text.props.ts +28 -0
- package/src/components/tooltip/Tooltip.tsx +97 -0
- package/src/components/tooltip/tooltip.css +31 -0
- package/src/components/tooltip/tooltip.props.ts +36 -0
- package/src/components/tooltip-group/TooltipGroup.tsx +64 -0
- package/src/components/tooltip-group/tooltipGroup.props.ts +15 -0
- package/src/components/v-stack/VStack.tsx +32 -0
- package/src/components/v-stack/vStack.props.ts +17 -0
- package/src/components/visually-hidden/VisuallyHidden.tsx +29 -0
- package/src/components/visually-hidden/visually-hidden.css +9 -0
- package/src/components/visually-hidden/visuallyHidden.props.ts +23 -0
- package/src/css/classes/dynamic/flex-child.css +5 -0
- package/src/css/classes/dynamic/grid-child.css +8 -0
- package/src/css/classes/dynamic/grid-parent.css +6 -0
- package/src/css/classes/dynamic/height.css +5 -0
- package/src/css/classes/dynamic/index.css +7 -0
- package/src/css/classes/dynamic/line-clamp.css +5 -0
- package/src/css/classes/dynamic/readme.md +3 -0
- package/src/css/classes/dynamic/width.css +7 -0
- package/src/css/classes/dynamic/z-index.css +3 -0
- package/src/css/classes/generic/display.css +10 -0
- package/src/css/classes/generic/flex.css +24 -0
- package/src/css/classes/generic/grid.css +7 -0
- package/src/css/classes/generic/index.css +7 -0
- package/src/css/classes/generic/overflow.css +19 -0
- package/src/css/classes/generic/placement.css +202 -0
- package/src/css/classes/generic/position.css +7 -0
- package/src/css/classes/generic/readme.md +3 -0
- package/src/css/classes/generic/text-align.css +5 -0
- package/src/css/classes/index.css +4 -0
- package/src/css/classes/local/animation.css +4 -0
- package/src/css/classes/local/border.css +20 -0
- package/src/css/classes/local/index.css +6 -0
- package/src/css/classes/local/readme.md +3 -0
- package/src/css/classes/local/text-overflow.css +5 -0
- package/src/css/classes/local/text-trim.css +45 -0
- package/src/css/classes/local/tone.css +75 -0
- package/src/css/classes/local/top-anchor.css +4 -0
- package/src/css/classes/system/color.css +223 -0
- package/src/css/classes/system/container.css +8 -0
- package/src/css/classes/system/font-family.css +2 -0
- package/src/css/classes/system/font-weight.css +4 -0
- package/src/css/classes/system/gap.css +37 -0
- package/src/css/classes/system/index.css +10 -0
- package/src/css/classes/system/inset.css +56 -0
- package/src/css/classes/system/margin.css +148 -0
- package/src/css/classes/system/padding.css +78 -0
- package/src/css/classes/system/radius.css +10 -0
- package/src/css/classes/system/readme.md +3 -0
- package/src/css/classes/system/shadow.css +6 -0
- package/src/css/classes/system/typography.css +31 -0
- package/src/css/global/font-face.css +20 -0
- package/src/css/global/index.css +2 -0
- package/src/css/global/reset.css +76 -0
- package/src/css/tokens/index.css +3 -0
- package/src/css/tokens/opacity.css +6 -0
- package/src/css/tokens/semantic.css +25 -0
- package/src/css/tokens/surface.css +27 -0
- package/src/hooks/useIsClient.ts +10 -0
- package/src/index.css +18 -0
- package/src/index.ts +65 -0
- package/src/polyfills.ts +15 -0
- package/src/props/border.ts +51 -0
- package/src/props/flexChild.ts +29 -0
- package/src/props/flexParent.ts +47 -0
- package/src/props/gap.ts +31 -0
- package/src/props/gridChild.ts +50 -0
- package/src/props/gridParent.ts +45 -0
- package/src/props/height.ts +29 -0
- package/src/props/layout.ts +44 -0
- package/src/props/margin.ts +59 -0
- package/src/props/overflow.ts +30 -0
- package/src/props/padding.ts +59 -0
- package/src/props/placement.ts +16 -0
- package/src/props/position.ts +52 -0
- package/src/props/shadow.ts +15 -0
- package/src/props/tone.ts +15 -0
- package/src/props/typography.ts +62 -0
- package/src/props/width.ts +29 -0
- package/src/props/zIndex.ts +15 -0
- package/src/styles.css.d.ts +1 -0
- package/src/styles.css.node.js +2 -0
- package/src/styles.css.test.ts +24 -0
- package/src/types/Button.ts +8 -0
- package/src/types/Code.ts +6 -0
- package/src/types/Container.ts +3 -0
- package/src/types/Density.ts +3 -0
- package/src/types/Display.ts +11 -0
- package/src/types/Eyebrow.ts +3 -0
- package/src/types/Flex.ts +22 -0
- package/src/types/FontWeight.ts +3 -0
- package/src/types/Grid.ts +3 -0
- package/src/types/Heading.ts +6 -0
- package/src/types/Icon.ts +3 -0
- package/src/types/Interactive.ts +8 -0
- package/src/types/List.ts +2 -0
- package/src/types/Overflow.ts +3 -0
- package/src/types/Placement.ts +16 -0
- package/src/types/Position.ts +3 -0
- package/src/types/PropDef.ts +73 -0
- package/src/types/Radius.ts +3 -0
- package/src/types/Responsive.ts +10 -0
- package/src/types/Shadow.ts +3 -0
- package/src/types/Space.ts +15 -0
- package/src/types/Text.ts +3 -0
- package/src/types/TextAlign.ts +3 -0
- package/src/types/Tone.ts +3 -0
- package/src/utils/getProps.test.ts +156 -0
- package/src/utils/getProps.ts +156 -0
- package/src/utils/mergeTriggerProps.ts +66 -0
- package/src/utils/renderPortal.tsx +14 -0
- package/src/utils/suffixClassName.ts +5 -0
- package/src/version.ts +3 -0
- package/LICENSE +0 -21
- package/dist/_system-CTe2lb5l.d.ts +0 -40
- package/dist/_system-CTe2lb5l.d.ts.map +0 -1
- package/dist/arrow-BmX6qbAS.js +0 -170
- package/dist/arrow-BmX6qbAS.js.map +0 -1
- package/dist/autocomplete.d.ts +0 -140
- package/dist/autocomplete.d.ts.map +0 -1
- package/dist/autocomplete.js +0 -470
- package/dist/autocomplete.js.map +0 -1
- package/dist/breadcrumbs.d.ts +0 -18
- package/dist/breadcrumbs.d.ts.map +0 -1
- package/dist/breadcrumbs.js +0 -119
- package/dist/breadcrumbs.js.map +0 -1
- package/dist/button-BNyKSDyA.js +0 -180
- package/dist/button-BNyKSDyA.js.map +0 -1
- package/dist/button-dnqMFkWg.d.ts +0 -76
- package/dist/button-dnqMFkWg.d.ts.map +0 -1
- package/dist/card-C0a0wQTc.d.ts +0 -7
- package/dist/card-C0a0wQTc.d.ts.map +0 -1
- package/dist/code.d.ts +0 -20
- package/dist/code.d.ts.map +0 -1
- package/dist/code.js +0 -90
- package/dist/code.js.map +0 -1
- package/dist/codeFontStyle-84SMhFtI.js +0 -11
- package/dist/codeFontStyle-84SMhFtI.js.map +0 -1
- package/dist/component-DVlwaWB-.d.ts +0 -25
- package/dist/component-DVlwaWB-.d.ts.map +0 -1
- package/dist/element-BYgCE_iK.js +0 -51
- package/dist/element-BYgCE_iK.js.map +0 -1
- package/dist/factory-BzXTX8_Q.js +0 -3056
- package/dist/factory-BzXTX8_Q.js.map +0 -1
- package/dist/flex-DmbDG2ks.js +0 -76
- package/dist/flex-DmbDG2ks.js.map +0 -1
- package/dist/font-EtfxKPUz.d.ts +0 -49
- package/dist/font-EtfxKPUz.d.ts.map +0 -1
- package/dist/getElementRef-Jw7gY0eV.js +0 -102
- package/dist/getElementRef-Jw7gY0eV.js.map +0 -1
- package/dist/getScopedTheme-C-sZsyAz.js +0 -267
- package/dist/getScopedTheme-C-sZsyAz.js.map +0 -1
- package/dist/getTheme_v2-y09KqtEb.js +0 -487
- package/dist/getTheme_v2-y09KqtEb.js.map +0 -1
- package/dist/grid-6JSgMj1O.js +0 -115
- package/dist/grid-6JSgMj1O.js.map +0 -1
- package/dist/helpers-C8xxXAQC.js +0 -63
- package/dist/helpers-C8xxXAQC.js.map +0 -1
- package/dist/hotkeys-CaHsQlsO.js +0 -168
- package/dist/hotkeys-CaHsQlsO.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/layer-Bl5R3uNR.js +0 -61
- package/dist/layer-Bl5R3uNR.js.map +0 -1
- package/dist/layer-ChlP9Ik6.d.ts +0 -242
- package/dist/layer-ChlP9Ik6.d.ts.map +0 -1
- package/dist/menu.d.ts +0 -146
- package/dist/menu.d.ts.map +0 -1
- package/dist/menu.js +0 -626
- package/dist/menu.js.map +0 -1
- package/dist/popover-B7-28L8y.js +0 -408
- package/dist/popover-B7-28L8y.js.map +0 -1
- package/dist/popover-CMlQeKn0.d.ts +0 -96
- package/dist/popover-CMlQeKn0.d.ts.map +0 -1
- package/dist/popover.d.ts +0 -2
- package/dist/popover.js +0 -3
- package/dist/refractor-CC48DwHi.js +0 -20
- package/dist/refractor-CC48DwHi.js.map +0 -1
- package/dist/responsiveFont-CilwaORG.js +0 -55
- package/dist/responsiveFont-CilwaORG.js.map +0 -1
- package/dist/rgba-BSYaEUW6.d.ts +0 -846
- package/dist/rgba-BSYaEUW6.d.ts.map +0 -1
- package/dist/selectable-B0GUIL74.d.ts +0 -7
- package/dist/selectable-B0GUIL74.d.ts.map +0 -1
- package/dist/stack-rsNFPq2-.js +0 -112
- package/dist/stack-rsNFPq2-.js.map +0 -1
- package/dist/styles-css.d.ts +0 -2
- package/dist/styles-css.js +0 -4
- package/dist/textInput-pSfQjkmx.js +0 -313
- package/dist/textInput-pSfQjkmx.js.map +0 -1
- package/dist/theme.d.ts +0 -280
- package/dist/theme.d.ts.map +0 -1
- package/dist/theme.js +0 -55
- package/dist/theme.js.map +0 -1
- package/dist/toast.d.ts +0 -73
- package/dist/toast.d.ts.map +0 -1
- package/dist/toast.js +0 -302
- package/dist/toast.js.map +0 -1
- package/dist/tooltip.d.ts +0 -88
- package/dist/tooltip.d.ts.map +0 -1
- package/dist/tooltip.js +0 -435
- package/dist/tooltip.js.map +0 -1
- package/dist/useClickOutsideEvent-wGLGWBZN.js +0 -36
- package/dist/useClickOutsideEvent-wGLGWBZN.js.map +0 -1
- package/dist/useElementSize-BJvbGHq8.js +0 -51
- package/dist/useElementSize-BJvbGHq8.js.map +0 -1
- package/dist/useLayer-D1usxIE0.js +0 -712
- package/dist/useLayer-D1usxIE0.js.map +0 -1
package/dist/menu.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menu.js","names":["[]","(nextActiveIndex: number) => {\n _setActiveIndex(nextActiveIndex)\n activeIndexRef.current = nextActiveIndex\n setActiveElement(elementsRef.current[nextActiveIndex] || null)\n }","useCallback((nextActiveIndex: number) => {\n _setActiveIndex(nextActiveIndex)\n activeIndexRef.current = nextActiveIndex\n setActiveElement(elementsRef.current[nextActiveIndex] || null)\n }, [])","(element: HTMLElement | null, selected?: boolean): (() => void) => {\n if (!element) return () => undefined\n\n if (elementsRef.current.indexOf(element) === -1) {\n elementsRef.current.push(element)\n _sortElements(rootElementRef.current, elementsRef.current)\n }\n\n if (selected) {\n const selectedIndex = elementsRef.current.indexOf(element)\n\n setActiveIndex(selectedIndex)\n }\n\n return () => {\n const idx = elementsRef.current.indexOf(element)\n\n if (idx > -1) {\n elementsRef.current.splice(idx, 1)\n }\n }\n }","rootElementRef.current","() => undefined","useCallback(\n (element: HTMLElement | null, selected?: boolean): (() => void) => {\n if (!element) return () => undefined\n\n if (elementsRef.current.indexOf(element) === -1) {\n elementsRef.current.push(element)\n _sortElements(rootElementRef.current, elementsRef.current)\n }\n\n if (selected) {\n const selectedIndex = elementsRef.current.indexOf(element)\n\n setActiveIndex(selectedIndex)\n }\n\n return () => {\n const idx = elementsRef.current.indexOf(element)\n\n if (idx > -1) {\n elementsRef.current.splice(idx, 1)\n }\n }\n },\n [rootElementRef, setActiveIndex],\n )","() => {\n return () => setActiveIndex(-1)\n }","[setActiveIndex]","(event: React.KeyboardEvent<HTMLDivElement>) => {\n // Move focus to the element that opened the menu before handling the `Tab` press\n if (event.key === 'Tab') {\n if (originElement) {\n originElement.focus()\n }\n\n return\n }\n\n // Move focus to the first focusable menuitem\n if (event.key === 'Home') {\n event.preventDefault()\n event.stopPropagation()\n\n const focusableElements = _getFocusableElements(elementsRef.current)\n const el = focusableElements[0]\n\n if (!el) return\n\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n\n return\n }\n\n // Move focus to the last focusable menuitem\n if (event.key === 'End') {\n event.preventDefault()\n event.stopPropagation()\n\n const focusableElements = _getFocusableElements(elementsRef.current)\n const el = focusableElements[focusableElements.length - 1]\n\n if (!el) return\n\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n\n return\n }\n\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n event.stopPropagation()\n\n const focusableElements = _getFocusableElements(elementsRef.current)\n const focusableLen = focusableElements.length\n\n if (focusableLen === 0) return\n\n const focusedElement = elementsRef.current[activeIndexRef.current]\n\n let focusedIndex = focusableElements.indexOf(focusedElement)\n\n focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen\n\n const el = focusableElements[focusedIndex]\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n\n return\n }\n\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n event.stopPropagation()\n\n const focusableElements = _getFocusableElements(elementsRef.current)\n const focusableLen = focusableElements.length\n\n if (focusableLen === 0) return\n\n const focusedElement = elementsRef.current[activeIndexRef.current]\n\n let focusedIndex = focusableElements.indexOf(focusedElement)\n\n focusedIndex = (focusedIndex + 1) % focusableLen\n\n const el = focusableElements[focusedIndex]\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n\n return\n }\n\n if (onKeyDown) {\n onKeyDown(event)\n }\n }","focusableElements","el","currentIndex","focusableLen","focusedElement","focusedIndex","useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n // Move focus to the element that opened the menu before handling the `Tab` press\n if (event.key === 'Tab') {\n if (originElement) {\n originElement.focus()\n }\n\n return\n }\n\n // Move focus to the first focusable menuitem\n if (event.key === 'Home') {\n event.preventDefault()\n event.stopPropagation()\n\n const focusableElements = _getFocusableElements(elementsRef.current)\n const el = focusableElements[0]\n\n if (!el) return\n\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n\n return\n }\n\n // Move focus to the last focusable menuitem\n if (event.key === 'End') {\n event.preventDefault()\n event.stopPropagation()\n\n const focusableElements = _getFocusableElements(elementsRef.current)\n const el = focusableElements[focusableElements.length - 1]\n\n if (!el) return\n\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n\n return\n }\n\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n event.stopPropagation()\n\n const focusableElements = _getFocusableElements(elementsRef.current)\n const focusableLen = focusableElements.length\n\n if (focusableLen === 0) return\n\n const focusedElement = elementsRef.current[activeIndexRef.current]\n\n let focusedIndex = focusableElements.indexOf(focusedElement)\n\n focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen\n\n const el = focusableElements[focusedIndex]\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n\n return\n }\n\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n event.stopPropagation()\n\n const focusableElements = _getFocusableElements(elementsRef.current)\n const focusableLen = focusableElements.length\n\n if (focusableLen === 0) return\n\n const focusedElement = elementsRef.current[activeIndexRef.current]\n\n let focusedIndex = focusableElements.indexOf(focusedElement)\n\n focusedIndex = (focusedIndex + 1) % focusableLen\n\n const el = focusableElements[focusedIndex]\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n\n return\n }\n\n if (onKeyDown) {\n onKeyDown(event)\n }\n },\n [onKeyDown, originElement, setActiveIndex],\n )","(event: React.MouseEvent<HTMLElement>) => {\n const element = event.currentTarget\n const currentIndex = elementsRef.current.indexOf(element)\n\n setActiveIndex(currentIndex)\n }","element","event","useCallback(\n (event: React.MouseEvent<HTMLElement>) => {\n const element = event.currentTarget\n const currentIndex = elementsRef.current.indexOf(element)\n\n setActiveIndex(currentIndex)\n },\n [setActiveIndex],\n )","() => {\n // Set the active index to -2 to deactivate all menu items\n // when the user moves the mouse away from the menu item.\n // We avoid using -1 because it would focus the first menu item,\n // which would be incorrect when the user hovers over a gap\n // between two menu items or a menu divider.\n setActiveIndex(-2)\n rootElementRef.current?.focus()\n }","rootElementRef.current?.focus","useCallback(() => {\n // Set the active index to -2 to deactivate all menu items\n // when the user moves the mouse away from the menu item.\n // We avoid using -1 because it would focus the first menu item,\n // which would be incorrect when the user hovers over a gap\n // between two menu items or a menu divider.\n setActiveIndex(-2)\n rootElementRef.current?.focus()\n }, [rootElementRef, setActiveIndex])","() => {\n if (!rootElementRef.current) return\n\n const rafId = requestAnimationFrame(() => {\n if (activeIndex === -1) {\n if (shouldFocus === 'first') {\n const focusableElements = _getFocusableElements(elementsRef.current)\n const el = focusableElements[0]\n\n if (el) {\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n }\n }\n\n if (shouldFocus === 'last') {\n const focusableElements = _getFocusableElements(elementsRef.current)\n const el = focusableElements[focusableElements.length - 1]\n\n if (el) {\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n }\n }\n\n return\n }\n\n const element = elementsRef.current[activeIndex] || null\n\n element?.focus()\n })\n\n // oxlint-disable-next-line consistent-return\n return () => cancelAnimationFrame(rafId)\n }","[activeIndex, rootElementRef, setActiveIndex, shouldFocus]","{\n activeElement,\n activeIndex,\n handleItemMouseEnter,\n handleItemMouseLeave,\n handleKeyDown,\n mount,\n }","padding = 1","shouldFocus = null","gap = 1","() => ref.current","{onKeyDown, originElement, shouldFocus, rootElementRef: ref}","(el: HTMLDivElement | null) => {\n // Run cleanup of previously registered elements\n if (unregisterElementRef.current) {\n // The `registerElement` callback were originally used in a `useEffect`, so it returns a cleanup function that is a bit gnarly to handle in a ref callback.\n // Since we can't change the `registerElement` implementation itself without making breaking change,\n // that is explained in the code comments for createGlobalScopedContext.tsx,\n // we need to handle with a ref that holds on to the cleanup function last returned when the ref callback is called.\n unregisterElementRef.current()\n unregisterElementRef.current = null\n }\n\n ref.current = el\n\n // Register root element (for nested menus)\n if (ref.current && registerElement) {\n unregisterElementRef.current = registerElement(ref.current)\n }\n }","useCallback(\n (el: HTMLDivElement | null) => {\n // Run cleanup of previously registered elements\n if (unregisterElementRef.current) {\n // The `registerElement` callback were originally used in a `useEffect`, so it returns a cleanup function that is a bit gnarly to handle in a ref callback.\n // Since we can't change the `registerElement` implementation itself without making breaking change,\n // that is explained in the code comments for createGlobalScopedContext.tsx,\n // we need to handle with a ref that holds on to the cleanup function last returned when the ref callback is called.\n unregisterElementRef.current()\n unregisterElementRef.current = null\n }\n\n ref.current = el\n\n // Register root element (for nested menus)\n if (ref.current && registerElement) {\n unregisterElementRef.current = registerElement(ref.current)\n }\n },\n [registerElement],\n )","() => {\n if (onItemSelect) onItemSelect(activeIndex)\n }","[activeIndex, onItemSelect]","() => [ref.current]","(event) => {\n if (!isTopLayer) return\n\n if (event.key === 'Escape') {\n event.stopPropagation()\n if (onEscape) onEscape()\n }\n }","useCallback(\n (event) => {\n if (!isTopLayer) return\n\n if (event.key === 'Escape') {\n event.stopPropagation()\n if (onEscape) onEscape()\n }\n },\n [isTopLayer, onEscape],\n )","{\n version: 2,\n activeElement,\n mount,\n onClickOutside,\n onEscape,\n onItemClick,\n onItemMouseEnter: handleItemMouseEnter,\n onItemMouseLeave: handleItemMouseLeave,\n registerElement,\n }","clsx(menu, className)","<Stack gap={gap}>{children}</Stack>","<Box\n className={clsx(menu, className)}\n data-ui=\"Menu\"\n {...restProps}\n onKeyDown={handleKeyDown}\n padding={padding}\n ref={handleRefChange}\n role=\"menu\"\n tabIndex={-1}\n >\n <Stack gap={gap}>{children}</Stack>\n </Box>","<MenuContext.Provider value={value}>\n <Box\n className={clsx(menu, className)}\n data-ui=\"Menu\"\n {...restProps}\n onKeyDown={handleKeyDown}\n padding={padding}\n ref={handleRefChange}\n role=\"menu\"\n tabIndex={-1}\n >\n <Stack gap={gap}>{children}</Stack>\n </Box>\n </MenuContext.Provider>","MenuContext.Provider","disableRestoreFocusOnClose = false","[]","() => {\n if (onOpen && open && !openRef.current) {\n onOpen()\n }\n }","[onOpen, open]","() => {\n if (onClose && !open && openRef.current) {\n onClose()\n }\n }","[onClose, open]","() => {\n openRef.current = open\n }","[open]","() => {\n setOpen((v) => !v)\n setShouldFocus(null)\n }","(v) => !v","useCallback(() => {\n setOpen((v) => !v)\n setShouldFocus(null)\n }, [])","(event: PointerEvent) => {\n if (open) event.preventDefault()\n }","useCallback(\n (event: PointerEvent) => {\n if (open) event.preventDefault()\n },\n [open],\n )","(event: React.KeyboardEvent<HTMLButtonElement>) => {\n // On `ArrowDown`, `Enter` and `Space`\n // - Opens menu and moves focus to first menuitem\n if (event.key === 'ArrowDown' || event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n setOpen(true)\n setShouldFocus('first')\n\n return\n }\n\n // On `ArrowUp`\n // - \tOpens menu and moves focus to last menuitem\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n setOpen(true)\n setShouldFocus('last')\n\n return\n }\n }","event","useCallback((event: React.KeyboardEvent<HTMLButtonElement>) => {\n // On `ArrowDown`, `Enter` and `Space`\n // - Opens menu and moves focus to first menuitem\n if (event.key === 'ArrowDown' || event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n setOpen(true)\n setShouldFocus('first')\n\n return\n }\n\n // On `ArrowUp`\n // - \tOpens menu and moves focus to last menuitem\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n setOpen(true)\n setShouldFocus('last')\n\n return\n }\n }, [])","(event: MouseEvent) => {\n const target = event.target\n\n if (!(target instanceof Node)) {\n return\n }\n\n if (buttonElement && (target === buttonElement || buttonElement.contains(target))) {\n return\n }\n\n for (const el of menuElements) {\n if (target === el || el.contains(target)) {\n return\n }\n }\n\n setOpen(false)\n }","useCallback(\n (event: MouseEvent) => {\n const target = event.target\n\n if (!(target instanceof Node)) {\n return\n }\n\n if (buttonElement && (target === buttonElement || buttonElement.contains(target))) {\n return\n }\n\n for (const el of menuElements) {\n if (target === el || el.contains(target)) {\n return\n }\n }\n\n setOpen(false)\n },\n [buttonElement, menuElements],\n )","() => {\n setOpen(false)\n if (disableRestoreFocusOnClose) return\n if (buttonElement) buttonElement.focus()\n }","useCallback(() => {\n setOpen(false)\n if (disableRestoreFocusOnClose) return\n if (buttonElement) buttonElement.focus()\n }, [buttonElement, disableRestoreFocusOnClose])","(event: FocusEvent) => {\n const target = event.relatedTarget\n\n if (!(target instanceof Node)) {\n return\n }\n\n for (const el of menuElements) {\n if (el === target || el.contains(target)) {\n return\n }\n }\n\n setOpen(false)\n }","target","el","useCallback(\n (event: FocusEvent) => {\n const target = event.relatedTarget\n\n if (!(target instanceof Node)) {\n return\n }\n\n for (const el of menuElements) {\n if (el === target || el.contains(target)) {\n return\n }\n }\n\n setOpen(false)\n },\n [menuElements],\n )","(el: HTMLElement) => {\n setChildMenuElements((els) => els.concat([el]))\n\n return () => setChildMenuElements((els) => els.filter((_el) => _el !== el))\n }","els","useCallback((el: HTMLElement) => {\n setChildMenuElements((els) => els.concat([el]))\n\n return () => setChildMenuElements((els) => els.filter((_el) => _el !== el))\n }, [])","menuProp && cloneElement(menuProp, menuProps)","buttonProp &&\n cloneElement(buttonProp, {\n 'data-ui': 'MenuButton',\n id,\n 'onClick': handleButtonClick,\n 'onKeyDown': handleButtonKeyDown,\n 'onMouseDown': handleMouseDown,\n 'aria-haspopup': true,\n 'aria-expanded': open,\n 'ref': setButtonElement,\n 'selected': buttonProp.props.selected ?? open,\n })","useMemo(\n () =>\n buttonProp &&\n cloneElement(buttonProp, {\n 'data-ui': 'MenuButton',\n id,\n 'onClick': handleButtonClick,\n 'onKeyDown': handleButtonKeyDown,\n 'onMouseDown': handleMouseDown,\n 'aria-haspopup': true,\n 'aria-expanded': open,\n 'ref': setButtonElement,\n 'selected': buttonProp.props.selected ?? open,\n }),\n [buttonProp, handleButtonClick, handleButtonKeyDown, handleMouseDown, id, open],\n )","() => buttonElement","[buttonElement]","popover || {}","{\n overflow: 'auto',\n portal: true,\n // oxlint-disable-next-line no-useless-fallback-in-spread\n ...(popover || {}),\n }","useMemo(\n () => ({\n overflow: 'auto',\n portal: true,\n // oxlint-disable-next-line no-useless-fallback-in-spread\n ...(popover || {}),\n }),\n [popover],\n )","button || <></>","<Popover data-ui=\"MenuButton__popover\" {...popoverProps} content={menu} open={open}>\n {button || <></>}\n </Popover>","as = 'hr'","clsx(menuDivider, className)","<Component\n data-ui=\"MenuDivider\"\n className={clsx(menuDivider, className)}\n ref={ref}\n {...restProps}\n />","as = 'button'","fontSize = 1","padding = 3","radius = 2","gap = 3","tone = 'default'","(event: React.MouseEvent<HTMLElement>) => {\n setWithinMenu(false)\n onItemMouseEnter(event)\n setOpen(true)\n }","useCallback(\n (event: React.MouseEvent<HTMLElement>) => {\n setWithinMenu(false)\n onItemMouseEnter(event)\n setOpen(true)\n },\n [onItemMouseEnter],\n )","(event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft') {\n event.stopPropagation()\n\n setOpen(false)\n\n requestAnimationFrame(() => {\n rootElement?.focus()\n })\n }\n }","rootElement?.focus","event","useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft') {\n event.stopPropagation()\n\n setOpen(false)\n\n requestAnimationFrame(() => {\n rootElement?.focus()\n })\n }\n },\n [rootElement],\n )","(event: React.MouseEvent<HTMLDivElement>) => {\n onClick?.(event)\n\n setShouldFocus('first')\n setOpen(true)\n }","useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n onClick?.(event)\n\n setShouldFocus('first')\n setOpen(true)\n },\n [onClick],\n )","() => {\n setOpen(false)\n onItemClick?.()\n }","useCallback(() => {\n setOpen(false)\n onItemClick?.()\n }, [onItemClick])","() => setWithinMenu(true)","useCallback(() => setWithinMenu(true), [])","() => mount(rootElement)","[mount, rootElement]","() => {\n // oxlint-disable-next-line react/set-state-in-effect\n if (!active) setOpen(false)\n }","[active]","() => {\n // oxlint-disable-next-line react/set-state-in-effect\n if (!open) setWithinMenu(false)\n }","[open]","() => {\n if (!shouldFocus) return\n // The useMenuController effect that handles `shouldFocus` schedules a request animation frame where it's processed.\n // By doing the same here, we ensure that the reset is processed after the focus change.\n const rafId = requestAnimationFrame(() => setShouldFocus(null))\n\n // oxlint-disable-next-line consistent-return\n return () => cancelAnimationFrame(rafId)\n }","[shouldFocus]","<Menu\n {...menuProps}\n onClickOutside={onClickOutside}\n onEscape={onEscape}\n onItemClick={handleChildItemClick}\n onKeyDown={handleMenuKeyDown}\n onMouseEnter={handleMenuMouseEnter}\n registerElement={registerElement}\n shouldFocus={shouldFocus}\n >\n {children}\n </Menu>","(event: React.KeyboardEvent<HTMLDivElement>) => {\n const target = event.currentTarget\n\n if (document.activeElement !== target) {\n return\n }\n\n if (event.key === 'ArrowRight') {\n setShouldFocus('first')\n setOpen(true)\n setWithinMenu(true)\n\n return\n }\n }","useCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n const target = event.currentTarget\n\n if (document.activeElement !== target) {\n return\n }\n\n if (event.key === 'ArrowRight') {\n setShouldFocus('first')\n setOpen(true)\n setWithinMenu(true)\n\n return\n }\n }, [])","_getArrayProp(radius)","IconComponent && (\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n )","<Box flex={1}>\n <Text size={fontSize} textOverflow=\"ellipsis\" weight=\"medium\">\n {text}\n </Text>\n </Box>","<ChevronRightIcon />","<Text size={fontSize}>\n <ChevronRightIcon />\n </Text>","<Flex gap={gap} padding={padding}>\n {IconComponent && (\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n )}\n\n <Box flex={1}>\n <Text size={fontSize} textOverflow=\"ellipsis\" weight=\"medium\">\n {text}\n </Text>\n </Box>\n\n <Text size={fontSize}>\n <ChevronRightIcon />\n </Text>\n </Flex>","<Selectable\n data-as={as}\n data-ui=\"MenuGroup\"\n forwardedAs={as}\n {...restProps}\n aria-pressed={as === 'button' ? withinMenu : undefined}\n data-pressed={as !== 'button' ? withinMenu : undefined}\n data-selected={!withinMenu && active ? '' : undefined}\n $radius={_getArrayProp(radius)}\n $tone={tone}\n $scheme={scheme}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onMouseEnter={handleMouseEnter}\n ref={setRootElement}\n tabIndex={-1}\n type={as === 'button' ? 'button' : undefined}\n >\n <Flex gap={gap} padding={padding}>\n {IconComponent && (\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n )}\n\n <Box flex={1}>\n <Text size={fontSize} textOverflow=\"ellipsis\" weight=\"medium\">\n {text}\n </Text>\n </Box>\n\n <Text size={fontSize}>\n <ChevronRightIcon />\n </Text>\n </Flex>\n </Selectable>","as === 'button' ? withinMenu : undefined","as !== 'button' ? withinMenu : undefined","!withinMenu && active ? '' : undefined","as === 'button' ? 'button' : undefined","<Popover {...popover} content={childMenu} data-ui=\"MenuGroup__popover\" open={open}>\n <Selectable\n data-as={as}\n data-ui=\"MenuGroup\"\n forwardedAs={as}\n {...restProps}\n aria-pressed={as === 'button' ? withinMenu : undefined}\n data-pressed={as !== 'button' ? withinMenu : undefined}\n data-selected={!withinMenu && active ? '' : undefined}\n $radius={_getArrayProp(radius)}\n $tone={tone}\n $scheme={scheme}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onMouseEnter={handleMouseEnter}\n ref={setRootElement}\n tabIndex={-1}\n type={as === 'button' ? 'button' : undefined}\n >\n <Flex gap={gap} padding={padding}>\n {IconComponent && (\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n )}\n\n <Box flex={1}>\n <Text size={fontSize} textOverflow=\"ellipsis\" weight=\"medium\">\n {text}\n </Text>\n </Box>\n\n <Text size={fontSize}>\n <ChevronRightIcon />\n </Text>\n </Flex>\n </Selectable>\n </Popover>","as = 'button'","fontSize = 1","padding = 3","radius = 2","gap = 3","tone = 'default'","() => ref.current","() => mount(rootElement, selectedProp)","[mount, rootElement, selectedProp]","(event: React.MouseEvent<HTMLDivElement>) => {\n if (disabled) return\n if (onClick) onClick(event)\n if (onItemClick) onItemClick()\n }","useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n if (disabled) return\n if (onClick) onClick(event)\n if (onItemClick) onItemClick()\n },\n [disabled, onClick, onItemClick],\n )","{\n padding,\n paddingX,\n paddingY,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n }","useMemo(\n () => ({\n padding,\n paddingX,\n paddingY,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n }),\n [padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft],\n )","_getArrayProp(fontSize).map((s) => s - 1)","(s) => s - 1","(el: HTMLDivElement | null) => {\n ref.current = el\n setRootElement(el)\n }","useCallback((el: HTMLDivElement | null) => {\n ref.current = el\n setRootElement(el)\n }, [])","_getArrayProp(radius)","_getArrayProp(0)","(IconComponent || text || IconRightComponent) && (\n <Flex as=\"span\" gap={gap} align=\"center\" {...paddingProps}>\n {IconComponent && (\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n )}\n\n {text && (\n <Box flex={1}>\n <Text size={fontSize} textOverflow=\"ellipsis\" weight=\"medium\">\n {text}\n </Text>\n </Box>\n )}\n\n {hotkeys && (\n <Hotkeys\n fontSize={hotkeysFontSize}\n keys={hotkeys}\n style={{marginTop: -4, marginBottom: -4}}\n />\n )}\n\n {IconRightComponent && (\n <Text size={fontSize}>\n {isValidElement(IconRightComponent) && IconRightComponent}\n {isValidElementType(IconRightComponent) && <IconRightComponent />}\n </Text>\n )}\n </Flex>\n )","children && (\n <Box as=\"span\" {...paddingProps}>\n {children}\n </Box>\n )","<Selectable\n data-ui=\"MenuItem\"\n role=\"menuitem\"\n {...restProps}\n data-pressed={as !== 'button' && pressed ? '' : undefined}\n data-selected={active ? '' : undefined}\n data-disabled={disabled ? '' : undefined}\n forwardedAs={as}\n $radius={_getArrayProp(radius)}\n $padding={_getArrayProp(0)}\n $tone={disabled ? 'default' : tone}\n $scheme={scheme}\n disabled={disabled}\n onClick={handleClick}\n onMouseEnter={onItemMouseEnter}\n onMouseLeave={onItemMouseLeave}\n ref={setRef}\n tabIndex={-1}\n type={as === 'button' ? 'button' : undefined}\n >\n {(IconComponent || text || IconRightComponent) && (\n <Flex as=\"span\" gap={gap} align=\"center\" {...paddingProps}>\n {IconComponent && (\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n )}\n\n {text && (\n <Box flex={1}>\n <Text size={fontSize} textOverflow=\"ellipsis\" weight=\"medium\">\n {text}\n </Text>\n </Box>\n )}\n\n {hotkeys && (\n <Hotkeys\n fontSize={hotkeysFontSize}\n keys={hotkeys}\n style={{marginTop: -4, marginBottom: -4}}\n />\n )}\n\n {IconRightComponent && (\n <Text size={fontSize}>\n {isValidElement(IconRightComponent) && IconRightComponent}\n {isValidElementType(IconRightComponent) && <IconRightComponent />}\n </Text>\n )}\n </Flex>\n )}\n {children && (\n <Box as=\"span\" {...paddingProps}>\n {children}\n </Box>\n )}\n </Selectable>","as !== 'button' && pressed ? '' : undefined","active ? '' : undefined","disabled ? '' : undefined","disabled ? 'default' : tone","as === 'button' ? 'button' : undefined"],"sources":["../src/core/components/menu/menuContext.ts","../src/core/components/menu/helpers.ts","../src/core/components/menu/useMenuController.ts","../src/core/components/menu/menu.css.ts","../src/core/components/menu/menu.tsx","../src/core/components/menu/menuButton.tsx","../src/core/components/menu/menuDivider.css.ts","../src/core/components/menu/menuDivider.tsx","../src/core/primitives/_selectable/style.ts","../src/core/primitives/_selectable/selectable.tsx","../src/core/components/menu/useMenu.ts","../src/core/components/menu/menuGroup.tsx","../src/core/components/menu/menuItem.tsx"],"sourcesContent":["import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'\n\nexport interface MenuContextValue {\n version: 2\n activeElement: HTMLElement | null\n mount: (element: HTMLElement | null, selected?: boolean) => () => void\n onClickOutside?: (event: MouseEvent) => void\n onEscape?: () => void\n onItemClick?: () => void\n onItemMouseEnter: (event: React.MouseEvent<HTMLElement>) => void\n onItemMouseLeave: (event: React.MouseEvent<HTMLElement>) => void\n registerElement?: (el: HTMLElement) => () => void\n}\n\nexport const MenuContext = createGlobalScopedContext<MenuContextValue | null>(\n '@sanity/ui/context/menu',\n null,\n)\n","import {isHTMLAnchorElement, isHTMLButtonElement} from '../../helpers/element'\n\n/**\n * @internal\n */\nfunction _isFocusable(element: HTMLElement) {\n return (\n (isHTMLAnchorElement(element) && element.getAttribute('data-disabled') !== 'true') ||\n (isHTMLButtonElement(element) && !element.disabled)\n )\n}\n\n/**\n * @internal\n */\nexport function _getFocusableElements(elements: HTMLElement[]): HTMLElement[] {\n return elements.filter(_isFocusable)\n}\n\nfunction _getDOMPath(rootElement: HTMLElement, el: HTMLElement): number[] {\n const path: number[] = []\n\n let e = el\n\n while (e !== rootElement) {\n const parentElement = e.parentElement\n\n if (!parentElement) return path\n\n const children = Array.from(parentElement.childNodes)\n const index = children.indexOf(e)\n\n path.unshift(index)\n\n if (parentElement === rootElement) {\n return path\n }\n\n e = parentElement\n }\n\n return path\n}\n\nconst EMPTY_PATH: number[] = []\n\n/**\n * @internal\n */\nexport function _sortElements(rootElement: HTMLElement | null, elements: HTMLElement[]): void {\n if (!rootElement) return\n\n const map = new WeakMap<HTMLElement, number[]>()\n\n for (const el of elements) {\n map.set(el, _getDOMPath(rootElement, el))\n }\n\n const _sort = (a: HTMLElement, b: HTMLElement) => {\n const _a = map.get(a) || EMPTY_PATH\n const _b = map.get(b) || EMPTY_PATH\n\n const len = Math.max(_a.length, _b.length)\n\n // Loop until there are different indexes\n for (let i = 0; i < len; i += 1) {\n const aIndex = _a[i] || -1\n const bIndex = _b[i] || -1\n\n if (aIndex !== bIndex) {\n return aIndex - bIndex\n }\n }\n\n return 0\n }\n\n elements.sort(_sort)\n}\n","import {useCallback, useEffect, useRef, useState} from 'react'\n\nimport {_getFocusableElements, _sortElements} from './helpers'\n\n/**\n * @internal\n */\nexport interface MenuController {\n activeElement: HTMLElement | null\n activeIndex: number\n handleItemMouseEnter: (event: React.MouseEvent<HTMLElement>) => void\n handleItemMouseLeave: () => void\n handleKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void\n mount: (element: HTMLElement | null, selected?: boolean) => () => void\n}\n\n/**\n * This controller is responsible for controlling UI menu state.\n *\n * @internal\n */\nexport function useMenuController(props: {\n onKeyDown?: React.KeyboardEventHandler\n originElement?: HTMLElement | null\n shouldFocus: 'first' | 'last' | null\n rootElementRef: React.RefObject<HTMLDivElement | null>\n}): MenuController {\n const {onKeyDown, originElement, shouldFocus, rootElementRef} = props\n const elementsRef = useRef<HTMLElement[]>([])\n const [activeIndex, _setActiveIndex] = useState(-1)\n const activeIndexRef = useRef(activeIndex)\n const [activeElement, setActiveElement] = useState<HTMLElement | null>(null)\n\n const setActiveIndex = useCallback((nextActiveIndex: number) => {\n _setActiveIndex(nextActiveIndex)\n activeIndexRef.current = nextActiveIndex\n setActiveElement(elementsRef.current[nextActiveIndex] || null)\n }, [])\n\n const mount = useCallback(\n (element: HTMLElement | null, selected?: boolean): (() => void) => {\n if (!element) return () => undefined\n\n if (elementsRef.current.indexOf(element) === -1) {\n elementsRef.current.push(element)\n _sortElements(rootElementRef.current, elementsRef.current)\n }\n\n if (selected) {\n const selectedIndex = elementsRef.current.indexOf(element)\n\n setActiveIndex(selectedIndex)\n }\n\n return () => {\n const idx = elementsRef.current.indexOf(element)\n\n if (idx > -1) {\n elementsRef.current.splice(idx, 1)\n }\n }\n },\n [rootElementRef, setActiveIndex],\n )\n\n // Reset the active item when the menu unmounts, or is hidden inside an <Activity> boundary\n // (which unmounts effects while preserving state), so that reopening behaves like a fresh\n // mount: `shouldFocus` applies again and `selected` items re-register through `mount`.\n useEffect(() => {\n return () => setActiveIndex(-1)\n }, [setActiveIndex])\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n // Move focus to the element that opened the menu before handling the `Tab` press\n if (event.key === 'Tab') {\n if (originElement) {\n originElement.focus()\n }\n\n return\n }\n\n // Move focus to the first focusable menuitem\n if (event.key === 'Home') {\n event.preventDefault()\n event.stopPropagation()\n\n const focusableElements = _getFocusableElements(elementsRef.current)\n const el = focusableElements[0]\n\n if (!el) return\n\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n\n return\n }\n\n // Move focus to the last focusable menuitem\n if (event.key === 'End') {\n event.preventDefault()\n event.stopPropagation()\n\n const focusableElements = _getFocusableElements(elementsRef.current)\n const el = focusableElements[focusableElements.length - 1]\n\n if (!el) return\n\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n\n return\n }\n\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n event.stopPropagation()\n\n const focusableElements = _getFocusableElements(elementsRef.current)\n const focusableLen = focusableElements.length\n\n if (focusableLen === 0) return\n\n const focusedElement = elementsRef.current[activeIndexRef.current]\n\n let focusedIndex = focusableElements.indexOf(focusedElement)\n\n focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen\n\n const el = focusableElements[focusedIndex]\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n\n return\n }\n\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n event.stopPropagation()\n\n const focusableElements = _getFocusableElements(elementsRef.current)\n const focusableLen = focusableElements.length\n\n if (focusableLen === 0) return\n\n const focusedElement = elementsRef.current[activeIndexRef.current]\n\n let focusedIndex = focusableElements.indexOf(focusedElement)\n\n focusedIndex = (focusedIndex + 1) % focusableLen\n\n const el = focusableElements[focusedIndex]\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n\n return\n }\n\n if (onKeyDown) {\n onKeyDown(event)\n }\n },\n [onKeyDown, originElement, setActiveIndex],\n )\n\n const handleItemMouseEnter = useCallback(\n (event: React.MouseEvent<HTMLElement>) => {\n const element = event.currentTarget\n const currentIndex = elementsRef.current.indexOf(element)\n\n setActiveIndex(currentIndex)\n },\n [setActiveIndex],\n )\n\n const handleItemMouseLeave = useCallback(() => {\n // Set the active index to -2 to deactivate all menu items\n // when the user moves the mouse away from the menu item.\n // We avoid using -1 because it would focus the first menu item,\n // which would be incorrect when the user hovers over a gap\n // between two menu items or a menu divider.\n setActiveIndex(-2)\n rootElementRef.current?.focus()\n }, [rootElementRef, setActiveIndex])\n\n // Set focus on the currently active element\n useEffect(() => {\n if (!rootElementRef.current) return\n\n const rafId = requestAnimationFrame(() => {\n if (activeIndex === -1) {\n if (shouldFocus === 'first') {\n const focusableElements = _getFocusableElements(elementsRef.current)\n const el = focusableElements[0]\n\n if (el) {\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n }\n }\n\n if (shouldFocus === 'last') {\n const focusableElements = _getFocusableElements(elementsRef.current)\n const el = focusableElements[focusableElements.length - 1]\n\n if (el) {\n const currentIndex = elementsRef.current.indexOf(el)\n\n setActiveIndex(currentIndex)\n }\n }\n\n return\n }\n\n const element = elementsRef.current[activeIndex] || null\n\n element?.focus()\n })\n\n // oxlint-disable-next-line consistent-return\n return () => cancelAnimationFrame(rafId)\n }, [activeIndex, rootElementRef, setActiveIndex, shouldFocus])\n\n return {\n activeElement,\n activeIndex,\n handleItemMouseEnter,\n handleItemMouseLeave,\n handleKeyDown,\n mount,\n }\n}\n","import {style} from '@vanilla-extract/css'\n\nexport const menu = style({\n outline: 'none',\n overflow: 'auto',\n})\n","import {clsx} from 'clsx/lite'\nimport {useCallback, useEffect, useImperativeHandle, useMemo, useRef} from 'react'\n\nimport {useClickOutsideEvent} from '../../hooks/useClickOutsideEvent'\nimport {useGlobalKeyDown} from '../../hooks/useGlobalKeyDown'\nimport {Box} from '../../primitives/box/box'\nimport {Stack} from '../../primitives/stack/stack'\nimport {ResponsivePaddingProps} from '../../primitives/types'\nimport {useLayer} from '../../utils/layer/useLayer'\nimport {MenuContext, MenuContextValue} from './menuContext'\nimport {useMenuController} from './useMenuController'\n\nimport {menu} from './menu.css'\n\n/**\n * @public\n */\nexport interface MenuProps extends ResponsivePaddingProps {\n /**\n * @deprecated Use `shouldFocus=\"first\"` instead.\n */\n 'focusFirst'?: never\n /**\n * @deprecated Use `shouldFocus=\"last\"` instead.\n */\n 'focusLast'?: never\n 'onClickOutside'?: (event: MouseEvent) => void\n 'onEscape'?: () => void\n 'onItemClick'?: () => void\n 'onItemSelect'?: (index: number) => void\n 'originElement'?: HTMLElement | null\n 'registerElement'?: (el: HTMLElement) => () => void\n 'shouldFocus'?: 'first' | 'last' | null\n 'gap'?: number | number[]\n /**\n * @deprecated Use `gap` instead.\n */\n 'space'?: never\n 'aria-labelledby'?: string\n 'onBlurCapture'?: (event: FocusEvent) => void\n}\n\n/**\n * The `Menu` component is a building block for application menus.\n *\n * @public\n */\nexport function Menu(\n props: MenuProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'role' | 'tabIndex'>,\n) {\n const {\n children,\n className,\n onClickOutside,\n onEscape,\n onItemClick,\n onItemSelect,\n onKeyDown,\n originElement,\n padding = 1,\n ref: forwardedRef,\n registerElement,\n shouldFocus = null,\n gap = 1,\n ...restProps\n } = props\n\n const ref = useRef<HTMLDivElement | null>(null)\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)\n\n const {isTopLayer} = useLayer()\n\n const {\n activeElement,\n activeIndex,\n handleItemMouseEnter,\n handleItemMouseLeave,\n handleKeyDown,\n mount,\n } = useMenuController({onKeyDown, originElement, shouldFocus, rootElementRef: ref})\n\n const unregisterElementRef = useRef<(() => void) | null>(null)\n const handleRefChange = useCallback(\n (el: HTMLDivElement | null) => {\n // Run cleanup of previously registered elements\n if (unregisterElementRef.current) {\n // The `registerElement` callback were originally used in a `useEffect`, so it returns a cleanup function that is a bit gnarly to handle in a ref callback.\n // Since we can't change the `registerElement` implementation itself without making breaking change,\n // that is explained in the code comments for createGlobalScopedContext.tsx,\n // we need to handle with a ref that holds on to the cleanup function last returned when the ref callback is called.\n unregisterElementRef.current()\n unregisterElementRef.current = null\n }\n\n ref.current = el\n\n // Register root element (for nested menus)\n if (ref.current && registerElement) {\n unregisterElementRef.current = registerElement(ref.current)\n }\n },\n [registerElement],\n )\n\n // Trigger `onItemSelect` when active index changes\n useEffect(() => {\n if (onItemSelect) onItemSelect(activeIndex)\n }, [activeIndex, onItemSelect])\n\n // Close menu when clicking outside\n useClickOutsideEvent(isTopLayer && onClickOutside, () => [ref.current])\n\n // Close menu when pressing Escape\n useGlobalKeyDown(\n useCallback(\n (event) => {\n if (!isTopLayer) return\n\n if (event.key === 'Escape') {\n event.stopPropagation()\n if (onEscape) onEscape()\n }\n },\n [isTopLayer, onEscape],\n ),\n )\n\n const value = useMemo(\n () =>\n ({\n version: 2,\n activeElement,\n mount,\n onClickOutside,\n onEscape,\n onItemClick,\n onItemMouseEnter: handleItemMouseEnter,\n onItemMouseLeave: handleItemMouseLeave,\n registerElement,\n }) satisfies MenuContextValue,\n [\n activeElement,\n mount,\n handleItemMouseEnter,\n handleItemMouseLeave,\n onClickOutside,\n onEscape,\n onItemClick,\n registerElement,\n ],\n )\n\n return (\n <MenuContext.Provider value={value}>\n <Box\n className={clsx(menu, className)}\n data-ui=\"Menu\"\n {...restProps}\n onKeyDown={handleKeyDown}\n padding={padding}\n ref={handleRefChange}\n role=\"menu\"\n tabIndex={-1}\n >\n <Stack gap={gap}>{children}</Stack>\n </Box>\n </MenuContext.Provider>\n )\n}\n","import {\n cloneElement,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react'\n\nimport {Popover, PopoverProps} from '../../primitives/popover/popover'\nimport {MenuProps} from './menu'\n\n/**\n * @public\n */\nexport interface MenuButtonProps {\n /**\n * @beta Do not use in production.\n */\n __unstable_disableRestoreFocusOnClose?: boolean\n /**\n * @deprecated Use `popover={{floatingBoundary: element}}` and/or `popover={{referenceBoundary: element}}` instead.\n */\n boundaryElement?: never\n button: React.JSX.Element\n id: string\n menu?: React.JSX.Element\n onClose?: () => void\n onOpen?: () => void\n /**\n * @deprecated Use `popover={{placement: 'top'}}` instead.\n */\n placement?: never\n popover?: Omit<PopoverProps, 'content' | 'open'>\n /**\n * @deprecated Use `popover={{scheme: 'dark'}}` instead.\n */\n popoverScheme?: never\n /**\n * @deprecated Use `popover={{radius: 2}}` instead.\n */\n popoverRadius?: never\n /**\n * @beta Do not use in production.\n * @deprecated Use `popover={{portal: true}}` instead.\n */\n portal?: never\n /**\n * @deprecated Use `popover={{preventOverflow: true}}` instead.\n */\n preventOverflow?: never\n ref?: React.Ref<HTMLButtonElement | null>\n}\n\n/**\n * The `MenuButton` component follows the WAI-ARIA specification for menu buttons.\n *\n * @public\n */\nexport function MenuButton(props: MenuButtonProps) {\n const {\n __unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = false,\n button: buttonProp,\n id,\n menu: menuProp,\n onClose,\n onOpen,\n popover,\n ref: forwardedRef,\n } = props\n const [open, setOpen] = useState(false)\n const [shouldFocus, setShouldFocus] = useState<'first' | 'last' | null>(null)\n const [buttonElement, setButtonElement] = useState<HTMLButtonElement | null>(null)\n const [menuElements, setChildMenuElements] = useState<HTMLElement[]>([])\n const openRef = useRef<boolean>(open)\n\n // Notify consumers when the menu opens\n useEffect(() => {\n if (onOpen && open && !openRef.current) {\n onOpen()\n }\n }, [onOpen, open])\n\n // Notify consumers when the menu closes\n useEffect(() => {\n if (onClose && !open && openRef.current) {\n onClose()\n }\n }, [onClose, open])\n\n useEffect(() => {\n openRef.current = open\n }, [open])\n\n const handleButtonClick = useCallback(() => {\n setOpen((v) => !v)\n setShouldFocus(null)\n }, [])\n\n // Prevent mouse event propagation when the menu is open.\n // This is to ensure that `handleBlur` isn't triggered when clicking the menu button whilst open,\n // which can lead to `setOpen` being triggered multiple times (once by `handleBlur`, and again by `handleButtonClick`).\n const handleMouseDown = useCallback(\n (event: PointerEvent) => {\n if (open) event.preventDefault()\n },\n [open],\n )\n\n const handleButtonKeyDown = useCallback((event: React.KeyboardEvent<HTMLButtonElement>) => {\n // On `ArrowDown`, `Enter` and `Space`\n // - Opens menu and moves focus to first menuitem\n if (event.key === 'ArrowDown' || event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n setOpen(true)\n setShouldFocus('first')\n\n return\n }\n\n // On `ArrowUp`\n // - \tOpens menu and moves focus to last menuitem\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n setOpen(true)\n setShouldFocus('last')\n\n return\n }\n }, [])\n\n const handleMenuClickOutside = useCallback(\n (event: MouseEvent) => {\n const target = event.target\n\n if (!(target instanceof Node)) {\n return\n }\n\n if (buttonElement && (target === buttonElement || buttonElement.contains(target))) {\n return\n }\n\n for (const el of menuElements) {\n if (target === el || el.contains(target)) {\n return\n }\n }\n\n setOpen(false)\n },\n [buttonElement, menuElements],\n )\n\n const handleMenuEscape = useCallback(() => {\n setOpen(false)\n if (disableRestoreFocusOnClose) return\n if (buttonElement) buttonElement.focus()\n }, [buttonElement, disableRestoreFocusOnClose])\n\n const handleBlur = useCallback(\n (event: FocusEvent) => {\n const target = event.relatedTarget\n\n if (!(target instanceof Node)) {\n return\n }\n\n for (const el of menuElements) {\n if (el === target || el.contains(target)) {\n return\n }\n }\n\n setOpen(false)\n },\n [menuElements],\n )\n\n const handleItemClick = useCallback(() => {\n setOpen(false)\n if (disableRestoreFocusOnClose) return\n if (buttonElement) buttonElement.focus()\n }, [buttonElement, disableRestoreFocusOnClose])\n\n const registerElement = useCallback((el: HTMLElement) => {\n setChildMenuElements((els) => els.concat([el]))\n\n return () => setChildMenuElements((els) => els.filter((_el) => _el !== el))\n }, [])\n\n const menuProps: MenuProps = {\n 'aria-labelledby': id,\n 'onBlurCapture': handleBlur,\n 'onClickOutside': handleMenuClickOutside,\n 'onEscape': handleMenuEscape,\n 'onItemClick': handleItemClick,\n 'originElement': buttonElement,\n registerElement,\n shouldFocus,\n }\n\n const menu = menuProp && cloneElement(menuProp, menuProps)\n\n const button = useMemo(\n () =>\n buttonProp &&\n cloneElement(buttonProp, {\n 'data-ui': 'MenuButton',\n id,\n 'onClick': handleButtonClick,\n 'onKeyDown': handleButtonKeyDown,\n 'onMouseDown': handleMouseDown,\n 'aria-haspopup': true,\n 'aria-expanded': open,\n 'ref': setButtonElement,\n 'selected': buttonProp.props.selected ?? open,\n }),\n [buttonProp, handleButtonClick, handleButtonKeyDown, handleMouseDown, id, open],\n )\n\n // Forward button ref to parent\n useImperativeHandle<HTMLButtonElement | null, HTMLButtonElement | null>(\n forwardedRef,\n () => buttonElement,\n [buttonElement],\n )\n\n const popoverProps: MenuButtonProps['popover'] = useMemo(\n () => ({\n overflow: 'auto',\n portal: true,\n // oxlint-disable-next-line no-useless-fallback-in-spread\n ...(popover || {}),\n }),\n [popover],\n )\n\n return (\n <Popover data-ui=\"MenuButton__popover\" {...popoverProps} content={menu} open={open}>\n {button || <></>}\n </Popover>\n )\n}\n","import {style} from '@vanilla-extract/css'\n\nexport const menuDivider = style({\n height: '1px',\n border: 0,\n background: 'var(--card-hairline-soft-color)',\n margin: 0,\n})\n","import {clsx} from 'clsx/lite'\n\nimport {ElementType, EmptyProps, Props} from '../../types/component'\n\nimport {menuDivider} from './menuDivider.css'\n\n/**\n * @public\n */\nexport type MenuDividerProps<E extends ElementType = 'hr'> = Props<EmptyProps, E>\n\nfunction MenuDividerComponent(\n props: {as?: ElementType} & Omit<React.HTMLProps<HTMLHRElement>, 'as'>,\n) {\n const {as = 'hr', className, ref, ...restProps} = props\n // Rendering the polymorphic `as` needs one concrete element type for JSX to\n // type-check the hr-flavored props (the same widening styled-components'\n // `as` prop performed here before).\n // oxlint-disable-next-line no-unsafe-type-assertion\n const Component = as as 'hr'\n\n return (\n <Component\n data-ui=\"MenuDivider\"\n className={clsx(menuDivider, className)}\n ref={ref}\n {...restProps}\n />\n )\n}\n\n/**\n * @public\n */\n// oxlint-disable-next-line no-unsafe-type-assertion\nexport const MenuDivider = MenuDividerComponent as unknown as <E extends ElementType = 'hr'>(\n props: MenuDividerProps<E>,\n) => React.JSX.Element\n","import {css} from 'styled-components'\n\nimport {getTheme_v2} from '../../../theme/versioning/getTheme_v2'\nimport {_cardColorStyle} from '../../styles/card/_cardColorStyle'\nimport {ThemeProps} from '../../styles/types'\nimport {SelectableTone} from '../../types/selectable'\n\n/**\n * @internal\n */\nexport interface SelectableStyleProps {\n $tone: SelectableTone\n}\n\nexport function selectableBaseStyle(): ReturnType<typeof css> {\n return css`\n background-color: inherit;\n color: inherit;\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: -moz-available;\n width: -webkit-fill-available;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n `\n}\n\nexport function selectableColorStyle(\n props: SelectableStyleProps & ThemeProps,\n): ReturnType<typeof css> {\n const {$tone} = props\n const {color, style} = getTheme_v2(props.theme)\n const tone = color.selectable[$tone]\n\n return css`\n ${_cardColorStyle(color, tone.enabled)}\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n outline: none;\n\n /* &:is(button) */\n &[data-as='button'] {\n &:disabled {\n ${_cardColorStyle(color, tone.disabled)}\n }\n\n &:not(:disabled) {\n &[aria-pressed='true'] {\n ${_cardColorStyle(color, tone.pressed)}\n }\n\n &[data-selected],\n &[aria-selected='true'] > & {\n ${_cardColorStyle(color, tone.selected)}\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ${_cardColorStyle(color, tone.hovered)}\n }\n\n &:active {\n ${_cardColorStyle(color, tone.pressed)}\n }\n }\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n &[data-disabled] {\n ${_cardColorStyle(color, tone.disabled)}\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ${_cardColorStyle(color, tone.pressed)}\n }\n\n &[data-selected] {\n ${_cardColorStyle(color, tone.selected)}\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ${_cardColorStyle(color, tone.hovered)}\n }\n &:active {\n ${_cardColorStyle(color, tone.pressed)}\n }\n }\n }\n }\n }\n\n ${style?.card?.root}\n `\n}\n","import {styled} from 'styled-components'\n\nimport {responsiveRadiusStyle} from '../../styles/radius/radiusStyle'\nimport {ResponsiveRadiusStyleProps} from '../../styles/radius/types'\nimport {Box} from '../box/box'\nimport {selectableBaseStyle, selectableColorStyle, SelectableStyleProps} from './style'\n\n/**\n * @internal\n */\nexport const Selectable = styled(Box)<SelectableStyleProps & ResponsiveRadiusStyleProps>(\n responsiveRadiusStyle,\n selectableBaseStyle,\n selectableColorStyle,\n)\n","import {useContext} from 'react'\n\nimport {isRecord} from '../../lib/isRecord'\nimport {MenuContext, MenuContextValue} from './menuContext'\n\nexport function useMenu(): MenuContextValue {\n const value = useContext(MenuContext)\n\n if (!value) {\n throw new Error('useMenu(): missing context value')\n }\n\n // NOTE: This check is for future-compatiblity\n // - If the value is not an object, it’s not compatible with the current version\n // - If the value is an object, but doesn’t have `version: 2`, it’s not compatible with the current version\n if (!isRecord(value) || value.version !== 2) {\n throw new Error('useMenu(): the context value is not compatible')\n }\n\n return value\n}\n","import {ChevronRightIcon} from '@sanity/icons/ChevronRight'\nimport {isValidElement, useCallback, useEffect, useState} from 'react'\nimport {isValidElementType} from 'react-is'\n\nimport {Selectable} from '../../primitives/_selectable/selectable'\nimport {Box} from '../../primitives/box/box'\nimport {Flex} from '../../primitives/flex/flex'\nimport {Popover, PopoverProps} from '../../primitives/popover/popover'\nimport {Text} from '../../primitives/text/text'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {useRootTheme} from '../../theme/useRootTheme'\nimport {ElementType, Props} from '../../types/component'\nimport {Radius} from '../../types/radius'\nimport {SelectableTone} from '../../types/selectable'\nimport {Menu, MenuProps} from './menu'\nimport {useMenu} from './useMenu'\n\n/**\n * @public\n */\nexport interface MenuGroupOwnProps {\n fontSize?: number | number[]\n // oxlint-disable-next-line no-redundant-type-constituents\n icon?: React.ElementType | React.ReactNode\n menu?: Omit<\n MenuProps,\n | 'onClickOutside'\n | 'onEscape'\n | 'onItemClick'\n | 'onKeyDown'\n | 'onMouseEnter'\n | 'registerElement'\n | 'shouldFocus'\n | 'onBlurCapture'\n >\n padding?: number | number[]\n popover?: Omit<PopoverProps, 'content' | 'open'>\n radius?: Radius | Radius[]\n gap?: number | number[]\n /**\n * @deprecated Use `gap` instead.\n */\n space?: never\n text: React.ReactNode\n tone?: SelectableTone\n}\n\n/**\n * @public\n */\nexport type MenuGroupProps<E extends ElementType = 'button'> = Props<MenuGroupOwnProps, E>\n\nconst MenuGroupComponent = function MenuGroup(\n props: Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'popover' | 'ref' | 'tabIndex'> &\n MenuGroupOwnProps & {as?: ElementType},\n): React.JSX.Element {\n const {\n as = 'button',\n children,\n fontSize = 1,\n icon: IconComponent,\n menu: menuProps,\n onClick,\n padding = 3,\n popover,\n radius = 2,\n gap = 3,\n text,\n tone = 'default',\n ...restProps\n } = props\n const menu = useMenu()\n const {scheme} = useRootTheme()\n const {\n activeElement,\n mount,\n onClickOutside,\n onEscape,\n onItemClick,\n onItemMouseEnter: _onItemMouseEnter,\n registerElement,\n } = menu\n const onItemMouseEnter = _onItemMouseEnter ?? menu.onItemMouseEnter\n const [rootElement, setRootElement] = useState<HTMLButtonElement | HTMLDivElement | null>(null)\n const [open, setOpen] = useState(false)\n const [shouldFocus, setShouldFocus] = useState<'first' | 'last' | null>(null)\n const active = Boolean(activeElement) && activeElement === rootElement\n const [withinMenu, setWithinMenu] = useState(false)\n\n const handleMouseEnter = useCallback(\n (event: React.MouseEvent<HTMLElement>) => {\n setWithinMenu(false)\n onItemMouseEnter(event)\n setOpen(true)\n },\n [onItemMouseEnter],\n )\n\n const handleMenuKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft') {\n event.stopPropagation()\n\n setOpen(false)\n\n requestAnimationFrame(() => {\n rootElement?.focus()\n })\n }\n },\n [rootElement],\n )\n\n const handleClick = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n onClick?.(event)\n\n setShouldFocus('first')\n setOpen(true)\n },\n [onClick],\n )\n\n const handleChildItemClick = useCallback(() => {\n setOpen(false)\n onItemClick?.()\n }, [onItemClick])\n\n const handleMenuMouseEnter = useCallback(() => setWithinMenu(true), [])\n\n // Register the menu item element\n useEffect(() => mount(rootElement), [mount, rootElement])\n\n // Close child menu when a sibling item becomes active\n useEffect(() => {\n // oxlint-disable-next-line react/set-state-in-effect\n if (!active) setOpen(false)\n }, [active])\n\n // Update state when child menu is no longer open\n useEffect(() => {\n // oxlint-disable-next-line react/set-state-in-effect\n if (!open) setWithinMenu(false)\n }, [open])\n\n // Reset the shouldFocus state after it has been used\n useEffect(() => {\n if (!shouldFocus) return\n // The useMenuController effect that handles `shouldFocus` schedules a request animation frame where it's processed.\n // By doing the same here, we ensure that the reset is processed after the focus change.\n const rafId = requestAnimationFrame(() => setShouldFocus(null))\n\n // oxlint-disable-next-line consistent-return\n return () => cancelAnimationFrame(rafId)\n }, [shouldFocus])\n\n const childMenu = (\n <Menu\n {...menuProps}\n onClickOutside={onClickOutside}\n onEscape={onEscape}\n onItemClick={handleChildItemClick}\n onKeyDown={handleMenuKeyDown}\n onMouseEnter={handleMenuMouseEnter}\n registerElement={registerElement}\n shouldFocus={shouldFocus}\n >\n {children}\n </Menu>\n )\n\n const handleKeyDown = useCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n const target = event.currentTarget\n\n if (document.activeElement !== target) {\n return\n }\n\n if (event.key === 'ArrowRight') {\n setShouldFocus('first')\n setOpen(true)\n setWithinMenu(true)\n\n return\n }\n }, [])\n\n return (\n <Popover {...popover} content={childMenu} data-ui=\"MenuGroup__popover\" open={open}>\n <Selectable\n data-as={as}\n data-ui=\"MenuGroup\"\n forwardedAs={as}\n {...restProps}\n aria-pressed={as === 'button' ? withinMenu : undefined}\n data-pressed={as !== 'button' ? withinMenu : undefined}\n data-selected={!withinMenu && active ? '' : undefined}\n $radius={_getArrayProp(radius)}\n $tone={tone}\n $scheme={scheme}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onMouseEnter={handleMouseEnter}\n ref={setRootElement}\n tabIndex={-1}\n type={as === 'button' ? 'button' : undefined}\n >\n <Flex gap={gap} padding={padding}>\n {IconComponent && (\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n )}\n\n <Box flex={1}>\n <Text size={fontSize} textOverflow=\"ellipsis\" weight=\"medium\">\n {text}\n </Text>\n </Box>\n\n <Text size={fontSize}>\n <ChevronRightIcon />\n </Text>\n </Flex>\n </Selectable>\n </Popover>\n )\n}\n\n/**\n * @public\n */\n// oxlint-disable-next-line no-unsafe-type-assertion\nexport const MenuGroup = MenuGroupComponent as unknown as <E extends ElementType = 'button'>(\n props: MenuGroupProps<E>,\n) => React.JSX.Element\n","import {\n isValidElement,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport {isValidElementType} from 'react-is'\n\nimport {Selectable} from '../../primitives/_selectable/selectable'\nimport {Box} from '../../primitives/box/box'\nimport {Flex} from '../../primitives/flex/flex'\nimport {Text} from '../../primitives/text/text'\nimport {ResponsivePaddingProps, ResponsiveRadiusProps} from '../../primitives/types'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {useRootTheme} from '../../theme/useRootTheme'\nimport {ElementType, Props} from '../../types/component'\nimport {SelectableTone} from '../../types/selectable'\nimport {Hotkeys} from '../hotkeys/hotkeys'\nimport {useMenu} from './useMenu'\n\n/**\n * @public\n */\nexport interface MenuItemOwnProps extends ResponsivePaddingProps, ResponsiveRadiusProps {\n fontSize?: number | number[]\n hotkeys?: string[]\n // oxlint-disable-next-line no-redundant-type-constituents\n icon?: React.ElementType | React.ReactNode\n // oxlint-disable-next-line no-redundant-type-constituents\n iconRight?: React.ElementType | React.ReactNode\n pressed?: boolean\n selected?: boolean\n gap?: number | number[]\n /**\n * @deprecated Use `gap` instead.\n */\n space?: never\n text?: React.ReactNode\n tone?: SelectableTone\n}\n\n/**\n * @public\n */\nexport type MenuItemProps<E extends ElementType = 'button'> = Props<MenuItemOwnProps, E>\n\nconst MenuItemComponent = function MenuItem(\n props: MenuItemOwnProps & {as?: ElementType} & Omit<\n React.HTMLProps<HTMLDivElement>,\n 'as' | 'height' | 'selected' | 'tabIndex'\n >,\n) {\n const {\n as = 'button',\n children,\n disabled,\n fontSize = 1,\n hotkeys,\n icon: IconComponent,\n iconRight: IconRightComponent,\n onClick,\n padding = 3,\n paddingX,\n paddingY,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n pressed,\n radius = 2,\n ref: forwardedRef,\n selected: selectedProp,\n gap = 3,\n text,\n tone = 'default',\n ...restProps\n } = props\n const {scheme} = useRootTheme()\n const menu = useMenu()\n const {\n activeElement,\n mount,\n onItemClick,\n onItemMouseEnter: _onItemMouseEnter,\n onItemMouseLeave: _onItemMouseLeave,\n } = menu\n const onItemMouseEnter = _onItemMouseEnter ?? menu.onItemMouseEnter\n const onItemMouseLeave = _onItemMouseLeave ?? menu.onItemMouseLeave\n const [rootElement, setRootElement] = useState<HTMLDivElement | null>(null)\n const active = Boolean(activeElement) && activeElement === rootElement\n const ref = useRef<HTMLDivElement | null>(null)\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)\n\n useEffect(() => mount(rootElement, selectedProp), [mount, rootElement, selectedProp])\n\n const handleClick = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n if (disabled) return\n if (onClick) onClick(event)\n if (onItemClick) onItemClick()\n },\n [disabled, onClick, onItemClick],\n )\n\n const paddingProps = useMemo(\n () => ({\n padding,\n paddingX,\n paddingY,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n }),\n [padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft],\n )\n\n const hotkeysFontSize = _getArrayProp(fontSize).map((s) => s - 1)\n\n const setRef = useCallback((el: HTMLDivElement | null) => {\n ref.current = el\n setRootElement(el)\n }, [])\n\n return (\n <Selectable\n data-ui=\"MenuItem\"\n role=\"menuitem\"\n {...restProps}\n data-pressed={as !== 'button' && pressed ? '' : undefined}\n data-selected={active ? '' : undefined}\n data-disabled={disabled ? '' : undefined}\n forwardedAs={as}\n $radius={_getArrayProp(radius)}\n $padding={_getArrayProp(0)}\n $tone={disabled ? 'default' : tone}\n $scheme={scheme}\n disabled={disabled}\n onClick={handleClick}\n onMouseEnter={onItemMouseEnter}\n onMouseLeave={onItemMouseLeave}\n ref={setRef}\n tabIndex={-1}\n type={as === 'button' ? 'button' : undefined}\n >\n {(IconComponent || text || IconRightComponent) && (\n <Flex as=\"span\" gap={gap} align=\"center\" {...paddingProps}>\n {IconComponent && (\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n )}\n\n {text && (\n <Box flex={1}>\n <Text size={fontSize} textOverflow=\"ellipsis\" weight=\"medium\">\n {text}\n </Text>\n </Box>\n )}\n\n {hotkeys && (\n <Hotkeys\n fontSize={hotkeysFontSize}\n keys={hotkeys}\n style={{marginTop: -4, marginBottom: -4}}\n />\n )}\n\n {IconRightComponent && (\n <Text size={fontSize}>\n {isValidElement(IconRightComponent) && IconRightComponent}\n {isValidElementType(IconRightComponent) && <IconRightComponent />}\n </Text>\n )}\n </Flex>\n )}\n {children && (\n <Box as=\"span\" {...paddingProps}>\n {children}\n </Box>\n )}\n </Selectable>\n )\n}\n\n/**\n * @public\n */\n// oxlint-disable-next-line no-unsafe-type-assertion\nexport const MenuItem = MenuItemComponent as unknown as <E extends ElementType = 'button'>(\n props: MenuItemProps<E>,\n) => React.JSX.Element\n"],"mappings":";;;;;;;;;;;;;;;;;AAcA,MAAa,cAAc,0BACzB,2BACA,IACF;;;;ACZA,SAAS,aAAa,SAAsB;CAC1C,OACG,oBAAoB,OAAO,KAAK,QAAQ,aAAa,eAAe,MAAM,UAC1E,oBAAoB,OAAO,KAAK,CAAC,QAAQ;AAE9C;;;;AAKA,SAAgB,sBAAsB,UAAwC;CAC5E,OAAO,SAAS,OAAO,YAAY;AACrC;AAEA,SAAS,YAAY,aAA0B,IAA2B;CACxE,IAAM,OAAiB,CAAC,GAEpB,IAAI;CAER,OAAO,MAAM,cAAa;EACxB,IAAM,gBAAgB,EAAE;EAExB,IAAI,CAAC,eAAe,OAAO;EAG3B,IAAM,QADW,MAAM,KAAK,cAAc,UAC5B,CAAA,CAAS,QAAQ,CAAC;EAIhC,IAFA,KAAK,QAAQ,KAAK,GAEd,k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,0 @@
|
|
|
1
|
-
import { c as POPOVER_MOTION_PROPS, n as _getArrayProp } from "./helpers-C8xxXAQC.js";
|
|
2
|
-
import { _ as useTheme_v2, i as usePrefersReducedMotion, n as LayerProvider, o as useMediaIndex, s as Card, t as useLayer } from "./useLayer-D1usxIE0.js";
|
|
3
|
-
import { t as Flex } from "./flex-DmbDG2ks.js";
|
|
4
|
-
import { t as useElementSize } from "./useElementSize-BJvbGHq8.js";
|
|
5
|
-
import { i as origin, n as AnimateActivity, r as getTransformOrigin, t as getElementRef } from "./getElementRef-Jw7gY0eV.js";
|
|
6
|
-
import { a as useBoundaryElement, n as Portal, t as Arrow } from "./arrow-BmX6qbAS.js";
|
|
7
|
-
import { c } from "react/compiler-runtime";
|
|
8
|
-
import { Activity, cloneElement, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
9
|
-
import { styled } from "styled-components";
|
|
10
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { arrow, autoPlacement, autoUpdate, detectOverflow, flip, hide, offset, shift, useFloating } from "@floating-ui/react-dom";
|
|
12
|
-
import { motion } from "motion/react";
|
|
13
|
-
const DEFAULT_POPOVER_MARGINS = [
|
|
14
|
-
0,
|
|
15
|
-
0,
|
|
16
|
-
0,
|
|
17
|
-
0
|
|
18
|
-
], DEFAULT_FALLBACK_PLACEMENTS = {
|
|
19
|
-
top: [
|
|
20
|
-
"bottom",
|
|
21
|
-
"left",
|
|
22
|
-
"right"
|
|
23
|
-
],
|
|
24
|
-
"top-start": [
|
|
25
|
-
"bottom-start",
|
|
26
|
-
"left-start",
|
|
27
|
-
"right-start"
|
|
28
|
-
],
|
|
29
|
-
"top-end": [
|
|
30
|
-
"bottom-end",
|
|
31
|
-
"left-end",
|
|
32
|
-
"right-end"
|
|
33
|
-
],
|
|
34
|
-
bottom: [
|
|
35
|
-
"top",
|
|
36
|
-
"left",
|
|
37
|
-
"right"
|
|
38
|
-
],
|
|
39
|
-
"bottom-start": [
|
|
40
|
-
"top-start",
|
|
41
|
-
"left-start",
|
|
42
|
-
"right-start"
|
|
43
|
-
],
|
|
44
|
-
"bottom-end": [
|
|
45
|
-
"top-end",
|
|
46
|
-
"left-end",
|
|
47
|
-
"right-end"
|
|
48
|
-
],
|
|
49
|
-
left: [
|
|
50
|
-
"right",
|
|
51
|
-
"top",
|
|
52
|
-
"bottom"
|
|
53
|
-
],
|
|
54
|
-
"left-start": [
|
|
55
|
-
"right-start",
|
|
56
|
-
"top-start",
|
|
57
|
-
"bottom-start"
|
|
58
|
-
],
|
|
59
|
-
"left-end": [
|
|
60
|
-
"right-end",
|
|
61
|
-
"top-end",
|
|
62
|
-
"bottom-end"
|
|
63
|
-
],
|
|
64
|
-
right: [
|
|
65
|
-
"left",
|
|
66
|
-
"top",
|
|
67
|
-
"bottom"
|
|
68
|
-
],
|
|
69
|
-
"right-start": [
|
|
70
|
-
"left-start",
|
|
71
|
-
"top-start",
|
|
72
|
-
"bottom-start"
|
|
73
|
-
],
|
|
74
|
-
"right-end": [
|
|
75
|
-
"left-end",
|
|
76
|
-
"top-end",
|
|
77
|
-
"bottom-end"
|
|
78
|
-
]
|
|
79
|
-
};
|
|
80
|
-
function size(options) {
|
|
81
|
-
let { constrainSize, margins, matchReferenceWidth, maxWidthRef, padding = 0, referenceWidthRef, setReferenceWidth, widthRef } = options;
|
|
82
|
-
return {
|
|
83
|
-
name: "@sanity/ui/size",
|
|
84
|
-
async fn(args) {
|
|
85
|
-
let { elements, placement, platform, rects } = args, { floating, reference } = rects, overflow = await detectOverflow(args, {
|
|
86
|
-
altBoundary: !0,
|
|
87
|
-
boundary: options.boundaryElement || void 0,
|
|
88
|
-
elementContext: "floating",
|
|
89
|
-
padding,
|
|
90
|
-
rootBoundary: "viewport"
|
|
91
|
-
}), maxWidth = Infinity, maxHeight = Infinity, floatingW = floating.width, floatingH = floating.height;
|
|
92
|
-
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));
|
|
93
|
-
let availableWidth = maxWidth - margins[1] - margins[3], availableHeight = maxHeight - margins[0] - margins[2], referenceWidth = reference.width - margins[1] - margins[3];
|
|
94
|
-
referenceWidthRef.current = referenceWidth, setReferenceWidth(referenceWidth), matchReferenceWidth ? elements.floating.style.width = `${referenceWidth}px` : widthRef.current !== void 0 && (elements.floating.style.width = `${widthRef.current}px`), constrainSize && (elements.floating.style.maxWidth = `${Math.min(availableWidth, maxWidthRef.current ?? Infinity)}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
|
|
95
|
-
let nextDimensions = await platform.getDimensions(elements.floating), targetH = nextDimensions.height;
|
|
96
|
-
return floatingW !== nextDimensions.width || floatingH !== targetH ? { reset: { rects: !0 } } : {};
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
function calcCurrentWidth(params) {
|
|
101
|
-
let { container, mediaIndex, width } = params, w = width[mediaIndex], currentWidth = w === void 0 ? width[width.length - 1] : w;
|
|
102
|
-
return typeof currentWidth == "number" ? container[currentWidth] : void 0;
|
|
103
|
-
}
|
|
104
|
-
function calcMaxWidth(params) {
|
|
105
|
-
let { boundaryWidth, currentWidth } = params;
|
|
106
|
-
if (currentWidth !== void 0 || boundaryWidth !== void 0) return Math.min(currentWidth ?? Infinity, (boundaryWidth || Infinity) - 8);
|
|
107
|
-
}
|
|
108
|
-
const MotionCard = styled(motion.create(Card)).withConfig({
|
|
109
|
-
displayName: "MotionCard",
|
|
110
|
-
componentId: "sc-wieb5w-0"
|
|
111
|
-
})`&:not([hidden]){display:flex;}flex-direction:column;width:max-content;min-width:min-content;will-change:transform;`;
|
|
112
|
-
/**
|
|
113
|
-
* @internal
|
|
114
|
-
*/
|
|
115
|
-
function PopoverCard(props) {
|
|
116
|
-
let $ = c(61), animate, arrow, arrowRef, arrowX, arrowY, children, marginsProp, originX, originY, overflow, padding, placement, radius, ref, restProps, scheme, shadow, strategy, style, tone, width, xProp, yProp;
|
|
117
|
-
$[0] === props ? (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], marginsProp = $[7], originX = $[8], originY = $[9], overflow = $[10], padding = $[11], placement = $[12], radius = $[13], ref = $[14], restProps = $[15], scheme = $[16], shadow = $[17], strategy = $[18], style = $[19], tone = $[20], width = $[21], xProp = $[22], yProp = $[23]) : ({__unstable_margins: marginsProp, animate, arrow, arrowRef, arrowX, arrowY, children, padding, placement, originX, originY, overflow, radius, ref, scheme, shadow, strategy, style, tone, width, x: xProp, y: yProp, ...restProps} = props, $[0] = props, $[1] = animate, $[2] = arrow, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = marginsProp, $[8] = originX, $[9] = originY, $[10] = overflow, $[11] = padding, $[12] = placement, $[13] = radius, $[14] = ref, $[15] = restProps, $[16] = scheme, $[17] = shadow, $[18] = strategy, $[19] = style, $[20] = tone, $[21] = width, $[22] = xProp, $[23] = yProp);
|
|
118
|
-
let { zIndex } = useLayer(), margins = marginsProp || DEFAULT_POPOVER_MARGINS, x = (xProp ?? 0) + margins[3], y = (yProp ?? 0) + margins[0], t0;
|
|
119
|
-
$[24] !== originX || $[25] !== originY ? (t0 = getTransformOrigin(originX, originY), $[24] = originX, $[25] = originY, $[26] = t0) : t0 = $[26];
|
|
120
|
-
let t1 = animate ? "transform" : void 0, t2;
|
|
121
|
-
$[27] !== strategy || $[28] !== style || $[29] !== t0 || $[30] !== t1 || $[31] !== width || $[32] !== x || $[33] !== y || $[34] !== zIndex ? (t2 = {
|
|
122
|
-
left: x,
|
|
123
|
-
position: strategy,
|
|
124
|
-
top: y,
|
|
125
|
-
transformOrigin: t0,
|
|
126
|
-
width,
|
|
127
|
-
zIndex,
|
|
128
|
-
willChange: t1,
|
|
129
|
-
...style
|
|
130
|
-
}, $[27] = strategy, $[28] = style, $[29] = t0, $[30] = t1, $[31] = width, $[32] = x, $[33] = y, $[34] = zIndex, $[35] = t2) : t2 = $[35];
|
|
131
|
-
let rootStyle = t2, t3 = arrowX === null ? void 0 : arrowX, t4 = arrowY === null ? void 0 : arrowY, t5;
|
|
132
|
-
$[36] !== t3 || $[37] !== t4 ? (t5 = {
|
|
133
|
-
left: t3,
|
|
134
|
-
top: t4,
|
|
135
|
-
right: void 0,
|
|
136
|
-
bottom: void 0
|
|
137
|
-
}, $[36] = t3, $[37] = t4, $[38] = t5) : t5 = $[38];
|
|
138
|
-
let arrowStyle = t5, t6 = animate ? POPOVER_MOTION_PROPS : void 0, t7;
|
|
139
|
-
$[39] !== children || $[40] !== padding ? (t7 = /* @__PURE__ */ jsx(Flex, {
|
|
140
|
-
direction: "column",
|
|
141
|
-
flex: 1,
|
|
142
|
-
padding,
|
|
143
|
-
children
|
|
144
|
-
}), $[39] = children, $[40] = padding, $[41] = t7) : t7 = $[41];
|
|
145
|
-
let t8;
|
|
146
|
-
$[42] !== overflow || $[43] !== t7 ? (t8 = /* @__PURE__ */ jsx(Flex, {
|
|
147
|
-
"data-ui": "Popover__wrapper",
|
|
148
|
-
direction: "column",
|
|
149
|
-
flex: 1,
|
|
150
|
-
overflow,
|
|
151
|
-
children: t7
|
|
152
|
-
}), $[42] = overflow, $[43] = t7, $[44] = t8) : t8 = $[44];
|
|
153
|
-
let t9;
|
|
154
|
-
$[45] !== arrow || $[46] !== arrowRef || $[47] !== arrowStyle ? (t9 = arrow && /* @__PURE__ */ jsx(Arrow, {
|
|
155
|
-
ref: arrowRef,
|
|
156
|
-
style: arrowStyle,
|
|
157
|
-
width: 19,
|
|
158
|
-
height: 8,
|
|
159
|
-
radius: 2
|
|
160
|
-
}), $[45] = arrow, $[46] = arrowRef, $[47] = arrowStyle, $[48] = t9) : t9 = $[48];
|
|
161
|
-
let t10;
|
|
162
|
-
return $[49] !== placement || $[50] !== radius || $[51] !== ref || $[52] !== restProps || $[53] !== rootStyle || $[54] !== scheme || $[55] !== shadow || $[56] !== t6 || $[57] !== t8 || $[58] !== t9 || $[59] !== tone ? (t10 = /* @__PURE__ */ jsxs(MotionCard, {
|
|
163
|
-
"data-ui": "Popover",
|
|
164
|
-
...restProps,
|
|
165
|
-
"data-placement": placement,
|
|
166
|
-
radius,
|
|
167
|
-
ref,
|
|
168
|
-
scheme,
|
|
169
|
-
shadow,
|
|
170
|
-
sizing: "border",
|
|
171
|
-
style: rootStyle,
|
|
172
|
-
tone,
|
|
173
|
-
...t6,
|
|
174
|
-
children: [t8, t9]
|
|
175
|
-
}), $[49] = placement, $[50] = radius, $[51] = ref, $[52] = restProps, $[53] = rootStyle, $[54] = scheme, $[55] = shadow, $[56] = t6, $[57] = t8, $[58] = t9, $[59] = tone, $[60] = t10) : t10 = $[60], t10;
|
|
176
|
-
}
|
|
177
|
-
const ViewportOverlay = () => {
|
|
178
|
-
let $ = c(2), { zIndex } = useLayer(), t0;
|
|
179
|
-
return $[0] === zIndex ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx("div", {
|
|
180
|
-
"data-ui": "PopoverOverlay",
|
|
181
|
-
style: {
|
|
182
|
-
height: "100vh",
|
|
183
|
-
inset: 0,
|
|
184
|
-
position: "fixed",
|
|
185
|
-
width: "100vw",
|
|
186
|
-
zIndex
|
|
187
|
-
}
|
|
188
|
-
}), $[0] = zIndex, $[1] = t0), t0;
|
|
189
|
-
};
|
|
190
|
-
/**
|
|
191
|
-
* The `Popover` component is used to display some content on top of another.
|
|
192
|
-
*
|
|
193
|
-
* @public
|
|
194
|
-
*/
|
|
195
|
-
function Popover(props) {
|
|
196
|
-
let $ = c(126), { container, layer } = useTheme_v2(), boundaryElementContext = useBoundaryElement(), _fallbackPlacements, _floatingBoundary, _referenceBoundary, _zOffsetProp, childProp, content, disabled, forwardedRef, matchReferenceWidth, modal, open, paddingProp, portal, referenceElement, restProps, scheme, t0, t1, t10, t11, t2, t3, t4, t5, t6, t7, t8, t9, updateRef;
|
|
197
|
-
if ($[0] !== props) {
|
|
198
|
-
let { __unstable_margins: t12, animate: t13, arrow: t14, children: t15, constrainSize: t16, content: t17, disabled: t18, fallbackPlacements: t19, matchReferenceWidth: t20, floatingBoundary: t21, modal: t22, onActivate, open: t23, overflow: t24, padding: t25, placement: t26, placementStrategy: t27, portal: t28, preventOverflow: t29, radius: t30, ref: t31, referenceBoundary: t32, referenceElement: t33, scheme: t34, shadow: t35, tone: t36, width: t37, zOffset: t38, updateRef: t39, ...t40 } = props;
|
|
199
|
-
t0 = t12, t1 = t13, t2 = t14, childProp = t15, t3 = t16, content = t17, disabled = t18, _fallbackPlacements = t19, matchReferenceWidth = t20, _floatingBoundary = t21, modal = t22, open = t23, t4 = t24, paddingProp = t25, t5 = t26, t6 = t27, portal = t28, t7 = t29, t8 = t30, forwardedRef = t31, _referenceBoundary = t32, referenceElement = t33, scheme = t34, t9 = t35, t10 = t36, t11 = t37, _zOffsetProp = t38, updateRef = t39, restProps = t40, $[0] = props, $[1] = _fallbackPlacements, $[2] = _floatingBoundary, $[3] = _referenceBoundary, $[4] = _zOffsetProp, $[5] = childProp, $[6] = content, $[7] = disabled, $[8] = forwardedRef, $[9] = matchReferenceWidth, $[10] = modal, $[11] = open, $[12] = paddingProp, $[13] = portal, $[14] = referenceElement, $[15] = restProps, $[16] = scheme, $[17] = t0, $[18] = t1, $[19] = t10, $[20] = t11, $[21] = t2, $[22] = t3, $[23] = t4, $[24] = t5, $[25] = t6, $[26] = t7, $[27] = t8, $[28] = t9, $[29] = updateRef;
|
|
200
|
-
} else _fallbackPlacements = $[1], _floatingBoundary = $[2], _referenceBoundary = $[3], _zOffsetProp = $[4], childProp = $[5], content = $[6], disabled = $[7], forwardedRef = $[8], matchReferenceWidth = $[9], modal = $[10], open = $[11], paddingProp = $[12], portal = $[13], referenceElement = $[14], restProps = $[15], scheme = $[16], t0 = $[17], t1 = $[18], t10 = $[19], t11 = $[20], t2 = $[21], t3 = $[22], t4 = $[23], t5 = $[24], t6 = $[25], t7 = $[26], t8 = $[27], t9 = $[28], updateRef = $[29];
|
|
201
|
-
let margins = t0 === void 0 ? DEFAULT_POPOVER_MARGINS : t0, _animate = t1 !== void 0 && t1, arrowProp = t2 !== void 0 && t2, constrainSize = t3 !== void 0 && t3, overflow = t4 === void 0 ? "hidden" : t4, placementProp = t5 === void 0 ? "bottom" : t5, placementStrategy = t6 === void 0 ? "flip" : t6, preventOverflow = t7 === void 0 || t7, radiusProp = t8 === void 0 ? 3 : t8, shadowProp = t9 === void 0 ? 3 : t9, tone = t10 === void 0 ? "inherit" : t10, widthProp = t11 === void 0 ? "auto" : t11, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"], floatingBoundary = _floatingBoundary ?? boundaryElementContext.element, referenceBoundary = _referenceBoundary ?? boundaryElementContext.element, boundaryElement = boundaryElementContext.element ?? floatingBoundary, zOffsetProp = _zOffsetProp ?? layer.popover.zOffset, animate = !usePrefersReducedMotion() && _animate, boundarySize = useElementSize(boundaryElement)?.border, t12;
|
|
202
|
-
$[30] === paddingProp ? t12 = $[31] : (t12 = _getArrayProp(paddingProp), $[30] = paddingProp, $[31] = t12);
|
|
203
|
-
let padding = t12, t13;
|
|
204
|
-
$[32] === radiusProp ? t13 = $[33] : (t13 = _getArrayProp(radiusProp), $[32] = radiusProp, $[33] = t13);
|
|
205
|
-
let radius = t13, t14;
|
|
206
|
-
$[34] === shadowProp ? t14 = $[35] : (t14 = _getArrayProp(shadowProp), $[34] = shadowProp, $[35] = t14);
|
|
207
|
-
let shadow = t14, widthArrayProp = _getArrayProp(widthProp), t15;
|
|
208
|
-
$[36] === zOffsetProp ? t15 = $[37] : (t15 = _getArrayProp(zOffsetProp), $[36] = zOffsetProp, $[37] = t15);
|
|
209
|
-
let zOffset = t15, ref = useRef(null), arrowRef = useRef(null), t16;
|
|
210
|
-
$[38] === Symbol.for("react.memo_cache_sentinel") ? (t16 = () => ref.current, $[38] = t16) : t16 = $[38], useImperativeHandle(forwardedRef, t16);
|
|
211
|
-
let mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0, width = calcCurrentWidth({
|
|
212
|
-
container,
|
|
213
|
-
mediaIndex,
|
|
214
|
-
width: widthArrayProp
|
|
215
|
-
}), widthRef = useRef(width), t17, t18;
|
|
216
|
-
$[39] === width ? (t17 = $[40], t18 = $[41]) : (t17 = () => {
|
|
217
|
-
widthRef.current = width;
|
|
218
|
-
}, t18 = [width], $[39] = width, $[40] = t17, $[41] = t18), useEffect(t17, t18);
|
|
219
|
-
let t19;
|
|
220
|
-
$[42] !== boundaryWidth || $[43] !== width ? (t19 = calcMaxWidth({
|
|
221
|
-
boundaryWidth,
|
|
222
|
-
currentWidth: width
|
|
223
|
-
}), $[42] = boundaryWidth, $[43] = width, $[44] = t19) : t19 = $[44];
|
|
224
|
-
let maxWidth = t19, maxWidthRef = useRef(maxWidth), t20, t21;
|
|
225
|
-
$[45] === maxWidth ? (t20 = $[46], t21 = $[47]) : (t20 = () => {
|
|
226
|
-
maxWidthRef.current = maxWidth;
|
|
227
|
-
}, t21 = [maxWidth], $[45] = maxWidth, $[46] = t20, $[47] = t21), useEffect(t20, t21);
|
|
228
|
-
let referenceWidthRef = useRef(void 0), t22, t23;
|
|
229
|
-
$[48] !== matchReferenceWidth || $[49] !== maxWidth || $[50] !== open || $[51] !== width ? (t22 = () => {
|
|
230
|
-
let floatingElement = ref.current;
|
|
231
|
-
if (!open || !floatingElement) return;
|
|
232
|
-
let referenceWidth = referenceWidthRef.current;
|
|
233
|
-
matchReferenceWidth ? referenceWidth !== void 0 && (floatingElement.style.width = `${referenceWidth}px`) : width !== void 0 && (floatingElement.style.width = `${width}px`), typeof maxWidth == "number" && (floatingElement.style.maxWidth = `${maxWidth}px`);
|
|
234
|
-
}, t23 = [
|
|
235
|
-
width,
|
|
236
|
-
matchReferenceWidth,
|
|
237
|
-
maxWidth,
|
|
238
|
-
open
|
|
239
|
-
], $[48] = matchReferenceWidth, $[49] = maxWidth, $[50] = open, $[51] = width, $[52] = t22, $[53] = t23) : (t22 = $[52], t23 = $[53]), useEffect(t22, t23);
|
|
240
|
-
let [referenceWidth_0, setReferenceWidth] = useState(void 0), t24;
|
|
241
|
-
$[54] !== animate || $[55] !== arrowProp || $[56] !== constrainSize || $[57] !== fallbackPlacements || $[58] !== floatingBoundary || $[59] !== margins || $[60] !== matchReferenceWidth || $[61] !== placementProp || $[62] !== placementStrategy || $[63] !== preventOverflow || $[64] !== referenceBoundary ? (t24 = {
|
|
242
|
-
animate,
|
|
243
|
-
arrowProp,
|
|
244
|
-
arrowRef,
|
|
245
|
-
constrainSize,
|
|
246
|
-
fallbackPlacements,
|
|
247
|
-
floatingBoundary,
|
|
248
|
-
margins,
|
|
249
|
-
matchReferenceWidth,
|
|
250
|
-
maxWidthRef,
|
|
251
|
-
placementProp,
|
|
252
|
-
placementStrategy,
|
|
253
|
-
preventOverflow,
|
|
254
|
-
referenceBoundary,
|
|
255
|
-
referenceWidthRef,
|
|
256
|
-
rootBoundary: "viewport",
|
|
257
|
-
setReferenceWidth,
|
|
258
|
-
widthRef
|
|
259
|
-
}, $[54] = animate, $[55] = arrowProp, $[56] = constrainSize, $[57] = fallbackPlacements, $[58] = floatingBoundary, $[59] = margins, $[60] = matchReferenceWidth, $[61] = placementProp, $[62] = placementStrategy, $[63] = preventOverflow, $[64] = referenceBoundary, $[65] = t24) : t24 = $[65];
|
|
260
|
-
let middleware = useMiddleware(t24), t25;
|
|
261
|
-
$[66] === referenceElement ? t25 = $[67] : (t25 = referenceElement ? { reference: referenceElement } : void 0, $[66] = referenceElement, $[67] = t25);
|
|
262
|
-
let t26;
|
|
263
|
-
$[68] !== middleware || $[69] !== placementProp || $[70] !== t25 ? (t26 = {
|
|
264
|
-
middleware,
|
|
265
|
-
placement: placementProp,
|
|
266
|
-
whileElementsMounted: autoUpdate,
|
|
267
|
-
elements: t25
|
|
268
|
-
}, $[68] = middleware, $[69] = placementProp, $[70] = t25, $[71] = t26) : t26 = $[71];
|
|
269
|
-
let { x, y, middlewareData, placement, refs, strategy, update } = useFloating(t26), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, t27;
|
|
270
|
-
$[72] === Symbol.for("react.memo_cache_sentinel") ? (t27 = (arrowEl) => {
|
|
271
|
-
arrowRef.current = arrowEl;
|
|
272
|
-
}, $[72] = t27) : t27 = $[72];
|
|
273
|
-
let setArrow = t27, t28;
|
|
274
|
-
$[73] === refs ? t28 = $[74] : (t28 = (node) => {
|
|
275
|
-
ref.current = node, refs.setFloating(node);
|
|
276
|
-
}, $[73] = refs, $[74] = t28);
|
|
277
|
-
let setFloating = t28, t29;
|
|
278
|
-
$[75] === childProp ? t29 = $[76] : (t29 = childProp ? getElementRef(childProp) : null, $[75] = childProp, $[76] = t29);
|
|
279
|
-
let t30;
|
|
280
|
-
$[77] === refs.reference.current ? t30 = $[78] : (t30 = () => refs.reference.current, $[77] = refs.reference.current, $[78] = t30), useImperativeHandle(t29, t30);
|
|
281
|
-
let t31;
|
|
282
|
-
bb0: {
|
|
283
|
-
if (referenceElement) {
|
|
284
|
-
t31 = childProp;
|
|
285
|
-
break bb0;
|
|
286
|
-
}
|
|
287
|
-
if (!childProp) {
|
|
288
|
-
t31 = null;
|
|
289
|
-
break bb0;
|
|
290
|
-
}
|
|
291
|
-
let t32;
|
|
292
|
-
$[79] !== childProp || $[80] !== refs.setReference ? (t32 = cloneElement(childProp, { ref: refs.setReference }), $[79] = childProp, $[80] = refs.setReference, $[81] = t32) : t32 = $[81], t31 = t32;
|
|
293
|
-
}
|
|
294
|
-
let child = t31, t32, t33;
|
|
295
|
-
if ($[82] === update ? (t32 = $[83], t33 = $[84]) : (t32 = () => update, t33 = [update], $[82] = update, $[83] = t32, $[84] = t33), useImperativeHandle(updateRef, t32, t33), disabled) {
|
|
296
|
-
let t34;
|
|
297
|
-
return $[85] === childProp ? t34 = $[86] : (t34 = childProp || /* @__PURE__ */ jsx(Fragment$1, {}), $[85] = childProp, $[86] = t34), t34;
|
|
298
|
-
}
|
|
299
|
-
let t34;
|
|
300
|
-
$[87] === modal ? t34 = $[88] : (t34 = modal && /* @__PURE__ */ jsx(ViewportOverlay, {}), $[87] = modal, $[88] = t34);
|
|
301
|
-
let t35 = matchReferenceWidth ? referenceWidth_0 : width, t36;
|
|
302
|
-
$[89] !== animate || $[90] !== arrowProp || $[91] !== arrowX || $[92] !== arrowY || $[93] !== content || $[94] !== margins || $[95] !== originX || $[96] !== originY || $[97] !== overflow || $[98] !== padding || $[99] !== placement || $[100] !== radius || $[101] !== referenceHidden || $[102] !== restProps || $[103] !== scheme || $[104] !== setFloating || $[105] !== shadow || $[106] !== strategy || $[107] !== t35 || $[108] !== tone || $[109] !== x || $[110] !== y ? (t36 = /* @__PURE__ */ jsx(PopoverCard, {
|
|
303
|
-
...restProps,
|
|
304
|
-
__unstable_margins: margins,
|
|
305
|
-
animate,
|
|
306
|
-
arrow: arrowProp,
|
|
307
|
-
arrowRef: setArrow,
|
|
308
|
-
arrowX,
|
|
309
|
-
arrowY,
|
|
310
|
-
hidden: referenceHidden,
|
|
311
|
-
overflow,
|
|
312
|
-
padding,
|
|
313
|
-
placement,
|
|
314
|
-
radius,
|
|
315
|
-
ref: setFloating,
|
|
316
|
-
scheme,
|
|
317
|
-
shadow,
|
|
318
|
-
originX,
|
|
319
|
-
originY,
|
|
320
|
-
strategy,
|
|
321
|
-
tone,
|
|
322
|
-
width: t35,
|
|
323
|
-
x,
|
|
324
|
-
y,
|
|
325
|
-
children: content
|
|
326
|
-
}), $[89] = animate, $[90] = arrowProp, $[91] = arrowX, $[92] = arrowY, $[93] = content, $[94] = margins, $[95] = originX, $[96] = originY, $[97] = overflow, $[98] = padding, $[99] = placement, $[100] = radius, $[101] = referenceHidden, $[102] = restProps, $[103] = scheme, $[104] = setFloating, $[105] = shadow, $[106] = strategy, $[107] = t35, $[108] = tone, $[109] = x, $[110] = y, $[111] = t36) : t36 = $[111];
|
|
327
|
-
let t37;
|
|
328
|
-
$[112] !== t34 || $[113] !== t36 || $[114] !== zOffset ? (t37 = /* @__PURE__ */ jsxs(LayerProvider, {
|
|
329
|
-
zOffset,
|
|
330
|
-
children: [t34, t36]
|
|
331
|
-
}), $[112] = t34, $[113] = t36, $[114] = zOffset, $[115] = t37) : t37 = $[115];
|
|
332
|
-
let popover = t37, t38;
|
|
333
|
-
$[116] !== popover || $[117] !== portal ? (t38 = portal ? /* @__PURE__ */ jsx(Portal, {
|
|
334
|
-
__unstable_name: typeof portal == "string" ? portal : void 0,
|
|
335
|
-
children: popover
|
|
336
|
-
}) : popover, $[116] = popover, $[117] = portal, $[118] = t38) : t38 = $[118];
|
|
337
|
-
let popoverNode = t38, t39;
|
|
338
|
-
$[119] !== animate || $[120] !== open || $[121] !== popoverNode ? (t39 = animate ? /* @__PURE__ */ jsx(AnimateActivity, {
|
|
339
|
-
layoutMode: "default",
|
|
340
|
-
mode: open ? "visible" : "hidden",
|
|
341
|
-
children: popoverNode
|
|
342
|
-
}) : /* @__PURE__ */ jsx(Activity, {
|
|
343
|
-
mode: open ? "visible" : "hidden",
|
|
344
|
-
children: popoverNode
|
|
345
|
-
}), $[119] = animate, $[120] = open, $[121] = popoverNode, $[122] = t39) : t39 = $[122];
|
|
346
|
-
let t40;
|
|
347
|
-
return $[123] !== child || $[124] !== t39 ? (t40 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t39, child] }), $[123] = child, $[124] = t39, $[125] = t40) : t40 = $[125], t40;
|
|
348
|
-
}
|
|
349
|
-
function useMiddleware(t0) {
|
|
350
|
-
let $ = c(42), { animate, arrowProp, arrowRef, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, maxWidthRef, placementProp, placementStrategy, preventOverflow, referenceBoundary, referenceWidthRef, rootBoundary, setReferenceWidth, widthRef } = t0, ret;
|
|
351
|
-
if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== constrainSize || $[4] !== fallbackPlacements || $[5] !== floatingBoundary || $[6] !== margins || $[7] !== matchReferenceWidth || $[8] !== maxWidthRef || $[9] !== placementProp || $[10] !== placementStrategy || $[11] !== preventOverflow || $[12] !== referenceBoundary || $[13] !== referenceWidthRef || $[14] !== rootBoundary || $[15] !== setReferenceWidth || $[16] !== widthRef) {
|
|
352
|
-
if (ret = [], constrainSize || preventOverflow) {
|
|
353
|
-
if (placementStrategy === "autoPlacement") {
|
|
354
|
-
let t1;
|
|
355
|
-
$[18] !== fallbackPlacements || $[19] !== placementProp ? (t1 = autoPlacement({ allowedPlacements: [placementProp].concat(fallbackPlacements) }), $[18] = fallbackPlacements, $[19] = placementProp, $[20] = t1) : t1 = $[20], ret.push(t1);
|
|
356
|
-
} else {
|
|
357
|
-
let t1 = floatingBoundary || void 0, t2;
|
|
358
|
-
$[21] !== fallbackPlacements || $[22] !== rootBoundary || $[23] !== t1 ? (t2 = flip({
|
|
359
|
-
boundary: t1,
|
|
360
|
-
fallbackPlacements,
|
|
361
|
-
padding: 4,
|
|
362
|
-
rootBoundary
|
|
363
|
-
}), $[21] = fallbackPlacements, $[22] = rootBoundary, $[23] = t1, $[24] = t2) : t2 = $[24], ret.push(t2);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
let t1;
|
|
367
|
-
if ($[25] === Symbol.for("react.memo_cache_sentinel") ? (t1 = offset({ mainAxis: 4 }), $[25] = t1) : t1 = $[25], ret.push(t1), constrainSize || matchReferenceWidth) {
|
|
368
|
-
let t2 = floatingBoundary || void 0, t3;
|
|
369
|
-
$[26] !== constrainSize || $[27] !== margins || $[28] !== matchReferenceWidth || $[29] !== maxWidthRef || $[30] !== referenceWidthRef || $[31] !== setReferenceWidth || $[32] !== t2 || $[33] !== widthRef ? (t3 = size({
|
|
370
|
-
boundaryElement: t2,
|
|
371
|
-
constrainSize,
|
|
372
|
-
margins,
|
|
373
|
-
matchReferenceWidth,
|
|
374
|
-
maxWidthRef,
|
|
375
|
-
padding: 4,
|
|
376
|
-
referenceWidthRef,
|
|
377
|
-
setReferenceWidth,
|
|
378
|
-
widthRef
|
|
379
|
-
}), $[26] = constrainSize, $[27] = margins, $[28] = matchReferenceWidth, $[29] = maxWidthRef, $[30] = referenceWidthRef, $[31] = setReferenceWidth, $[32] = t2, $[33] = widthRef, $[34] = t3) : t3 = $[34], ret.push(t3);
|
|
380
|
-
}
|
|
381
|
-
if (preventOverflow) {
|
|
382
|
-
let t2 = floatingBoundary || void 0, t3;
|
|
383
|
-
$[35] !== rootBoundary || $[36] !== t2 ? (t3 = shift({
|
|
384
|
-
boundary: t2,
|
|
385
|
-
rootBoundary,
|
|
386
|
-
padding: 4
|
|
387
|
-
}), $[35] = rootBoundary, $[36] = t2, $[37] = t3) : t3 = $[37], ret.push(t3);
|
|
388
|
-
}
|
|
389
|
-
if (arrowProp) {
|
|
390
|
-
let t2;
|
|
391
|
-
$[38] === arrowRef ? t2 = $[39] : (t2 = arrow({
|
|
392
|
-
element: arrowRef,
|
|
393
|
-
padding: 4
|
|
394
|
-
}), $[38] = arrowRef, $[39] = t2), ret.push(t2);
|
|
395
|
-
}
|
|
396
|
-
animate && ret.push(origin);
|
|
397
|
-
let t2 = referenceBoundary || void 0, t3;
|
|
398
|
-
$[40] === t2 ? t3 = $[41] : (t3 = hide({
|
|
399
|
-
boundary: t2,
|
|
400
|
-
padding: 4,
|
|
401
|
-
strategy: "referenceHidden"
|
|
402
|
-
}), $[40] = t2, $[41] = t3), ret.push(t3), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = constrainSize, $[4] = fallbackPlacements, $[5] = floatingBoundary, $[6] = margins, $[7] = matchReferenceWidth, $[8] = maxWidthRef, $[9] = placementProp, $[10] = placementStrategy, $[11] = preventOverflow, $[12] = referenceBoundary, $[13] = referenceWidthRef, $[14] = rootBoundary, $[15] = setReferenceWidth, $[16] = widthRef, $[17] = ret;
|
|
403
|
-
} else ret = $[17];
|
|
404
|
-
return ret;
|
|
405
|
-
}
|
|
406
|
-
export { Popover as t };
|
|
407
|
-
|
|
408
|
-
//# sourceMappingURL=popover-B7-28L8y.js.map
|