@sanity/ui 4.3.3 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/{arrow-CZ-Lw1QO.js → arrow-A3jQ7LS0.js} +29 -8
  2. package/dist/arrow-A3jQ7LS0.js.map +1 -0
  3. package/dist/autocomplete.d.ts +1 -1
  4. package/dist/autocomplete.js +12 -19
  5. package/dist/autocomplete.js.map +1 -1
  6. package/dist/breadcrumbs.d.ts.map +1 -1
  7. package/dist/breadcrumbs.js +9 -9
  8. package/dist/breadcrumbs.js.map +1 -1
  9. package/dist/{button-Wii-24Xu.js → button-dhq4ViVg.js} +7 -7
  10. package/dist/button-dhq4ViVg.js.map +1 -0
  11. package/dist/code.js +2 -2
  12. package/dist/{codeFontStyle-84SMhFtI.js → codeFontStyle-B-bhR3hF.js} +2 -2
  13. package/dist/{codeFontStyle-84SMhFtI.js.map → codeFontStyle-B-bhR3hF.js.map} +1 -1
  14. package/dist/elementSizeObserver-pevZfdGa.js +45 -0
  15. package/dist/elementSizeObserver-pevZfdGa.js.map +1 -0
  16. package/dist/{flex-CpiAc-4D.js → flex-BqQXaSxS.js} +5 -12
  17. package/dist/flex-BqQXaSxS.js.map +1 -0
  18. package/dist/{grid-BVZEj_Xe.js → grid-Bpb2bIJ6.js} +5 -15
  19. package/dist/grid-Bpb2bIJ6.js.map +1 -0
  20. package/dist/{helpers-C8xxXAQC.js → helpers-XThPpWje.js} +16 -4
  21. package/dist/helpers-XThPpWje.js.map +1 -0
  22. package/dist/{hotkeys-DEMStMQ5.js → hotkeys-sG9yO97K.js} +4 -4
  23. package/dist/{hotkeys-DEMStMQ5.js.map → hotkeys-sG9yO97K.js.map} +1 -1
  24. package/dist/index.d.ts +3 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +141 -140
  27. package/dist/index.js.map +1 -1
  28. package/dist/{layer-B0tlPeLT.js → layer-AWzYcY_j.js} +3 -3
  29. package/dist/{layer-B0tlPeLT.js.map → layer-AWzYcY_j.js.map} +1 -1
  30. package/dist/menu.d.ts +1 -1
  31. package/dist/menu.js +16 -39
  32. package/dist/menu.js.map +1 -1
  33. package/dist/{popover-DR6UQQvq.js → popover-B0kvwaep.js} +125 -51
  34. package/dist/popover-B0kvwaep.js.map +1 -0
  35. package/dist/{popover-CMlQeKn0.d.ts → popover-HDVgZg5e.d.ts} +22 -1
  36. package/dist/popover-HDVgZg5e.d.ts.map +1 -0
  37. package/dist/popover.d.ts +1 -1
  38. package/dist/popover.js +1 -2
  39. package/dist/{responsiveFont-CilwaORG.js → responsiveFont-B08q0jwm.js} +6 -4
  40. package/dist/responsiveFont-B08q0jwm.js.map +1 -0
  41. package/dist/{stack-SbGBZ0x3.js → stack-Cv-WM-7p.js} +4 -4
  42. package/dist/{stack-SbGBZ0x3.js.map → stack-Cv-WM-7p.js.map} +1 -1
  43. package/dist/{textInput-Yp5lnvZK.js → textInput-Ddxi4mkC.js} +5 -5
  44. package/dist/{textInput-Yp5lnvZK.js.map → textInput-Ddxi4mkC.js.map} +1 -1
  45. package/dist/toast.js +5 -5
  46. package/dist/tooltip.d.ts.map +1 -1
  47. package/dist/tooltip.js +161 -140
  48. package/dist/tooltip.js.map +1 -1
  49. package/dist/{useClickOutsideEvent-wGLGWBZN.js → useClickOutsideEvent-CC1zgOmv.js} +2 -2
  50. package/dist/{useClickOutsideEvent-wGLGWBZN.js.map → useClickOutsideEvent-CC1zgOmv.js.map} +1 -1
  51. package/dist/{useLayer-CUKYjJYq.js → useLayer-B0i19TTM.js} +31 -38
  52. package/dist/useLayer-B0i19TTM.js.map +1 -0
  53. package/package.json +9 -9
  54. package/dist/arrow-CZ-Lw1QO.js.map +0 -1
  55. package/dist/button-Wii-24Xu.js.map +0 -1
  56. package/dist/flex-CpiAc-4D.js.map +0 -1
  57. package/dist/grid-BVZEj_Xe.js.map +0 -1
  58. package/dist/helpers-C8xxXAQC.js.map +0 -1
  59. package/dist/popover-CMlQeKn0.d.ts.map +0 -1
  60. package/dist/popover-DR6UQQvq.js.map +0 -1
  61. package/dist/responsiveFont-CilwaORG.js.map +0 -1
  62. package/dist/useElementSize-BJvbGHq8.js +0 -51
  63. package/dist/useElementSize-BJvbGHq8.js.map +0 -1
  64. package/dist/useLayer-CUKYjJYq.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { s as EMPTY_RECORD } from "./helpers-C8xxXAQC.js";
1
+ import { c as EMPTY_RECORD } from "./helpers-XThPpWje.js";
2
2
  import { a as isHTMLElement, n as containsOrEqualsElement } from "./element-BYgCE_iK.js";
3
- import { n as LayerProvider, t as useLayer } from "./useLayer-CUKYjJYq.js";
3
+ import { n as LayerProvider, t as useLayer } from "./useLayer-B0i19TTM.js";
4
4
  import { c } from "react/compiler-runtime";
5
5
  import { clsx } from "clsx/lite";
6
6
  import { useEffect, useImperativeHandle, useRef } from "react";
@@ -58,4 +58,4 @@ function Layer(props) {
58
58
  }
59
59
  export { Layer as t };
60
60
 
61
- //# sourceMappingURL=layer-B0tlPeLT.js.map
61
+ //# sourceMappingURL=layer-AWzYcY_j.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layer-B0tlPeLT.js","names":["as = 'div'","style = EMPTY_RECORD","() => ref.current","() => {\n const becameTopLayer = isTopLayerRef.current !== isTopLayer && isTopLayer\n\n if (becameTopLayer) {\n onActivate?.({activeElement: lastFocusedRef.current})\n }\n\n isTopLayerRef.current = isTopLayer\n }","[isTopLayer, onActivate]","(event: FocusEvent<HTMLDivElement, Element>) => {\n // Call the user-provided onFocus handler if any\n onFocus?.(event)\n\n const rootElement = ref.current\n const target = document.activeElement\n\n if (!isTopLayer || !rootElement || !target) return\n\n if (isHTMLElement(target) && containsOrEqualsElement(rootElement, target)) {\n lastFocusedRef.current = target\n }\n }","useCallback(\n // oxlint-disable-next-line no-unnecessary-type-arguments\n (event: FocusEvent<HTMLDivElement, Element>) => {\n // Call the user-provided onFocus handler if any\n onFocus?.(event)\n\n const rootElement = ref.current\n const target = document.activeElement\n\n if (!isTopLayer || !rootElement || !target) return\n\n if (isHTMLElement(target) && containsOrEqualsElement(rootElement, target)) {\n lastFocusedRef.current = target\n }\n },\n [isTopLayer, onFocus],\n )","clsx(layer, className)","{...style, zIndex}","<Component\n data-ui=\"Layer\"\n {...restProps}\n className={clsx(layer, className)}\n onFocus={handleFocus}\n ref={ref}\n style={{...style, zIndex}}\n >\n {children}\n </Component>","zOffset = 1","<LayerChildren {...restProps}>{children}</LayerChildren>","<LayerProvider zOffset={zOffset}>\n <LayerChildren {...restProps}>{children}</LayerChildren>\n </LayerProvider>","_c"],"sources":["../src/core/utils/layer/layer.css.ts","../src/core/utils/layer/layer.tsx"],"sourcesContent":["import {style} from '@vanilla-extract/css'\n\nexport const layer = style({\n position: 'relative',\n})\n","import {clsx} from 'clsx/lite'\nimport {FocusEvent, useCallback, useEffect, useImperativeHandle, useRef} from 'react'\n\nimport {EMPTY_RECORD} from '../../constants'\nimport {containsOrEqualsElement, isHTMLElement} from '../../helpers/element'\nimport {LayerProvider} from './layerProvider'\nimport {useLayer} from './useLayer'\n\nimport {layer} from './layer.css'\n\n/**\n * @public\n */\nexport interface LayerProps {\n as?: React.ElementType | keyof React.JSX.IntrinsicElements\n /** A callback that fires when the layer becomes the top layer when it was not the top layer before. */\n onActivate?: (props: {activeElement: HTMLElement | null}) => void\n zOffset?: number | number[]\n}\n\ninterface LayerChildrenProps {\n as?: React.ElementType | keyof React.JSX.IntrinsicElements\n onActivate?: LayerProps['onActivate']\n}\n\nfunction LayerChildren(props: LayerChildrenProps & Omit<React.HTMLProps<HTMLDivElement>, 'as'>) {\n const {\n as = 'div',\n children,\n className,\n onActivate,\n onFocus,\n ref: forwardedRef,\n style = EMPTY_RECORD,\n ...restProps\n } = props\n const {zIndex, isTopLayer} = useLayer()\n const lastFocusedRef = useRef<HTMLElement | null>(null)\n const ref = useRef<HTMLDivElement | null>(null)\n const isTopLayerRef = useRef<boolean>(isTopLayer)\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)\n\n // When the layer very first mounts, it will be the top layer, but we don't want to fire\n // the callback in that case. We use a ref to track the previous value of isTopLayer to\n // determine if the layer has become the top layer since the last render.\n useEffect(() => {\n const becameTopLayer = isTopLayerRef.current !== isTopLayer && isTopLayer\n\n if (becameTopLayer) {\n onActivate?.({activeElement: lastFocusedRef.current})\n }\n\n isTopLayerRef.current = isTopLayer\n }, [isTopLayer, onActivate])\n\n const handleFocus = useCallback(\n // oxlint-disable-next-line no-unnecessary-type-arguments\n (event: FocusEvent<HTMLDivElement, Element>) => {\n // Call the user-provided onFocus handler if any\n onFocus?.(event)\n\n const rootElement = ref.current\n const target = document.activeElement\n\n if (!isTopLayer || !rootElement || !target) return\n\n if (isHTMLElement(target) && containsOrEqualsElement(rootElement, target)) {\n lastFocusedRef.current = target\n }\n },\n [isTopLayer, onFocus],\n )\n\n // Rendering the polymorphic `as` needs one concrete element type for JSX to\n // type-check the div-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 'div'\n\n return (\n <Component\n data-ui=\"Layer\"\n {...restProps}\n className={clsx(layer, className)}\n onFocus={handleFocus}\n ref={ref}\n style={{...style, zIndex}}\n >\n {children}\n </Component>\n )\n}\n\n/**\n * @public\n */\nexport function Layer(props: LayerProps & Omit<React.HTMLProps<HTMLDivElement>, 'as'>) {\n const {children, zOffset = 1, ...restProps} = props\n\n return (\n <LayerProvider zOffset={zOffset}>\n <LayerChildren {...restProps}>{children}</LayerChildren>\n </LayerProvider>\n )\n}\n"],"mappings":";;;;;;;;ACyBA,SAAS,cAAc,OAAyE;gBAG5F,UACA,WAGK,cAFL,YACA,SAGG,WAPHA,IAMAC;CAEE,AAAA,EAAA,OAAA,+IATE,CACJ,IAAA,IACA,UACA,WACA,YACA,SACA,KAAK,cACL,OAAA,IACA,GAAA,aACE;CARF,IAAA,KAAA,OAAA,KAAA,IA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C;EAEN;CACQ,CAAA,GATV,EAAA,MAAA,WAQE,EAAA,MAAA,UAJQ,EAAA,MAAA,aAFL,EAAA,MAAA,WACOD,EAAAA,MAAAA,IAGJC,EAAAA,MAAAA,8BANTC;AAWJ;;;;AAKA,SAAgB,MAAM,OAAiE;gBAC9E,UAA0B,WAAhBC;CAA6B,AAAA,EAAA,OAAA,0DAAxC,CAAC,UAAU,SAAA,IAAa,GAAA,aAAgB;CAA7B,IAAA,UAAA,OAAA,KAAA,IAAU,IAAVA,IAIbC;CAA+B,AAAA,EAAA,OAAA,YAAA,EAAA,OAAZ,aAAnB,KAAA,oBAAC,eAAD;EAAe,GAAI;EAAY;CAAwB,CAAA,GAAxB,EAAA,KAAA,UAAZ,EAAA,KAAA;CADrBC,IAAAA;CADF,OAEID,EAAAA,OAAAA,MAAAA,EAAAA,OADsB,WAAxB,KAAA,oBAAC,eAAD;EAAwB;EACtBA,UAAAA;CACa,CAAA,GADbA,EAAAA,KAAAA,IADsB,EAAA,KAAA,iCAAxBC;AAIJ"}
1
+ {"version":3,"file":"layer-AWzYcY_j.js","names":["as = 'div'","style = EMPTY_RECORD","() => ref.current","() => {\n const becameTopLayer = isTopLayerRef.current !== isTopLayer && isTopLayer\n\n if (becameTopLayer) {\n onActivate?.({activeElement: lastFocusedRef.current})\n }\n\n isTopLayerRef.current = isTopLayer\n }","[isTopLayer, onActivate]","(event: FocusEvent<HTMLDivElement, Element>) => {\n // Call the user-provided onFocus handler if any\n onFocus?.(event)\n\n const rootElement = ref.current\n const target = document.activeElement\n\n if (!isTopLayer || !rootElement || !target) return\n\n if (isHTMLElement(target) && containsOrEqualsElement(rootElement, target)) {\n lastFocusedRef.current = target\n }\n }","useCallback(\n // oxlint-disable-next-line no-unnecessary-type-arguments\n (event: FocusEvent<HTMLDivElement, Element>) => {\n // Call the user-provided onFocus handler if any\n onFocus?.(event)\n\n const rootElement = ref.current\n const target = document.activeElement\n\n if (!isTopLayer || !rootElement || !target) return\n\n if (isHTMLElement(target) && containsOrEqualsElement(rootElement, target)) {\n lastFocusedRef.current = target\n }\n },\n [isTopLayer, onFocus],\n )","clsx(layer, className)","{...style, zIndex}","<Component\n data-ui=\"Layer\"\n {...restProps}\n className={clsx(layer, className)}\n onFocus={handleFocus}\n ref={ref}\n style={{...style, zIndex}}\n >\n {children}\n </Component>","zOffset = 1","<LayerChildren {...restProps}>{children}</LayerChildren>","<LayerProvider zOffset={zOffset}>\n <LayerChildren {...restProps}>{children}</LayerChildren>\n </LayerProvider>","_c"],"sources":["../src/core/utils/layer/layer.css.ts","../src/core/utils/layer/layer.tsx"],"sourcesContent":["import {style} from '@vanilla-extract/css'\n\nexport const layer = style({\n position: 'relative',\n})\n","import {clsx} from 'clsx/lite'\nimport {FocusEvent, useCallback, useEffect, useImperativeHandle, useRef} from 'react'\n\nimport {EMPTY_RECORD} from '../../constants'\nimport {containsOrEqualsElement, isHTMLElement} from '../../helpers/element'\nimport {LayerProvider} from './layerProvider'\nimport {useLayer} from './useLayer'\n\nimport {layer} from './layer.css'\n\n/**\n * @public\n */\nexport interface LayerProps {\n as?: React.ElementType | keyof React.JSX.IntrinsicElements\n /** A callback that fires when the layer becomes the top layer when it was not the top layer before. */\n onActivate?: (props: {activeElement: HTMLElement | null}) => void\n zOffset?: number | number[]\n}\n\ninterface LayerChildrenProps {\n as?: React.ElementType | keyof React.JSX.IntrinsicElements\n onActivate?: LayerProps['onActivate']\n}\n\nfunction LayerChildren(props: LayerChildrenProps & Omit<React.HTMLProps<HTMLDivElement>, 'as'>) {\n const {\n as = 'div',\n children,\n className,\n onActivate,\n onFocus,\n ref: forwardedRef,\n style = EMPTY_RECORD,\n ...restProps\n } = props\n const {zIndex, isTopLayer} = useLayer()\n const lastFocusedRef = useRef<HTMLElement | null>(null)\n const ref = useRef<HTMLDivElement | null>(null)\n const isTopLayerRef = useRef<boolean>(isTopLayer)\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)\n\n // When the layer very first mounts, it will be the top layer, but we don't want to fire\n // the callback in that case. We use a ref to track the previous value of isTopLayer to\n // determine if the layer has become the top layer since the last render.\n useEffect(() => {\n const becameTopLayer = isTopLayerRef.current !== isTopLayer && isTopLayer\n\n if (becameTopLayer) {\n onActivate?.({activeElement: lastFocusedRef.current})\n }\n\n isTopLayerRef.current = isTopLayer\n }, [isTopLayer, onActivate])\n\n const handleFocus = useCallback(\n // oxlint-disable-next-line no-unnecessary-type-arguments\n (event: FocusEvent<HTMLDivElement, Element>) => {\n // Call the user-provided onFocus handler if any\n onFocus?.(event)\n\n const rootElement = ref.current\n const target = document.activeElement\n\n if (!isTopLayer || !rootElement || !target) return\n\n if (isHTMLElement(target) && containsOrEqualsElement(rootElement, target)) {\n lastFocusedRef.current = target\n }\n },\n [isTopLayer, onFocus],\n )\n\n // Rendering the polymorphic `as` needs one concrete element type for JSX to\n // type-check the div-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 'div'\n\n return (\n <Component\n data-ui=\"Layer\"\n {...restProps}\n className={clsx(layer, className)}\n onFocus={handleFocus}\n ref={ref}\n style={{...style, zIndex}}\n >\n {children}\n </Component>\n )\n}\n\n/**\n * @public\n */\nexport function Layer(props: LayerProps & Omit<React.HTMLProps<HTMLDivElement>, 'as'>) {\n const {children, zOffset = 1, ...restProps} = props\n\n return (\n <LayerProvider zOffset={zOffset}>\n <LayerChildren {...restProps}>{children}</LayerChildren>\n </LayerProvider>\n )\n}\n"],"mappings":";;;;;;;;ACyBA,SAAS,cAAc,OAAyE;gBAG5F,UACA,WAGK,cAFL,YACA,SAGG,WAPHA,IAMAC;CAEE,AAAA,EAAA,OAAA,+IATE,CACJ,IAAA,IACA,UACA,WACA,YACA,SACA,KAAK,cACL,OAAA,IACA,GAAA,aACE;CARF,IAAA,KAAA,OAAA,KAAA,IAAK,QAALD,IAMA,QAAA,OAAA,KAAA,IAAQ,eAARC,IAGI,EAAC,QAAQ,eA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MAAA,aAFL,EAAA,MAAA,WACOD,EAAAA,MAAAA,IAGJC,EAAAA,MAAAA,8BANTC;AAWJ;;;;AAKA,SAAgB,MAAM,OAAiE;gBAC9E,UAA0B,WAAhBC;CAA6B,AAAA,EAAA,OAAA,0DAAxC,CAAC,UAAU,SAAA,IAAa,GAAA,aAAgB;CAA7B,IAAA,UAAA,OAAA,KAAA,IAAU,IAAVA,IAIbC;CAA+B,AAAA,EAAA,OAAA,YAAA,EAAA,OAAZ,aAAnB,KAAA,oBAAC,eAAD;EAAe,GAAI;EAAY;CAAwB,CAAA,GAAxB,EAAA,KAAA,UAAZ,EAAA,KAAA;CADrBC,IAAAA;CADF,OAEID,EAAAA,OAAAA,MAAAA,EAAAA,OADsB,WAAxB,KAAA,oBAAC,eAAD;EAAwB;EACtBA,UAAAA;CACa,CAAA,GADbA,EAAAA,KAAAA,IADsB,EAAA,KAAA,iCAAxBC;AAIJ"}
package/dist/menu.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as Props, i as EmptyProps, r as ElementType } from "./component-DVlwaWB-.js";
2
2
  import { f as ResponsivePaddingProps, g as Radius, p as ResponsiveRadiusProps } from "./layer-ChlP9Ik6.js";
3
- import { n as PopoverProps } from "./popover-CMlQeKn0.js";
3
+ import { n as PopoverProps } from "./popover-HDVgZg5e.js";
4
4
  import { t as SelectableTone } from "./selectable-B0GUIL74.js";
5
5
  /**
6
6
  * @public
package/dist/menu.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use client";
2
- import { n as _getArrayProp } from "./helpers-C8xxXAQC.js";
2
+ import { n as _getArrayProp } from "./helpers-XThPpWje.js";
3
3
  import { i as isHTMLButtonElement, r as isHTMLAnchorElement } from "./element-BYgCE_iK.js";
4
4
  import { t as getTheme_v2 } from "./getTheme_v2-y09KqtEb.js";
5
- import { d as createGlobalScopedContext, h as _cardColorStyle, l as useRootTheme, r as isRecord, t as useLayer, v as responsiveRadiusStyle, y as Box } from "./useLayer-CUKYjJYq.js";
6
- import { t as Flex } from "./flex-CpiAc-4D.js";
7
- import { n as Text, t as Stack } from "./stack-SbGBZ0x3.js";
8
- import { t as Popover } from "./popover-DR6UQQvq.js";
9
- import { t as useClickOutsideEvent } from "./useClickOutsideEvent-wGLGWBZN.js";
10
- import { i as useGlobalKeyDown, t as Hotkeys } from "./hotkeys-DEMStMQ5.js";
5
+ import { d as createGlobalScopedContext, h as _cardColorStyle, l as useRootTheme, r as isRecord, t as useLayer, v as responsiveRadiusStyle, y as Box } from "./useLayer-B0i19TTM.js";
6
+ import { t as Flex } from "./flex-BqQXaSxS.js";
7
+ import { n as Text, t as Stack } from "./stack-Cv-WM-7p.js";
8
+ import { t as Popover } from "./popover-B0kvwaep.js";
9
+ import { t as useClickOutsideEvent } from "./useClickOutsideEvent-CC1zgOmv.js";
10
+ import { i as useGlobalKeyDown, t as Hotkeys } from "./hotkeys-sG9yO97K.js";
11
11
  import { c } from "react/compiler-runtime";
12
12
  import { clsx } from "clsx/lite";
13
13
  import { cloneElement, isValidElement, useContext, useEffect, useImperativeHandle, useRef, useState } from "react";
@@ -85,27 +85,20 @@ function useMenuController(props) {
85
85
  $[4] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => () => setActiveIndex(-1), t4 = [setActiveIndex], $[4] = t3, $[5] = t4) : (t3 = $[4], t4 = $[5]), useEffect(t3, t4);
86
86
  let t5;
87
87
  $[6] !== onKeyDown || $[7] !== originElement ? (t5 = (event) => {
88
- if (event.key === "Tab") {
89
- originElement && originElement.focus();
90
- return;
91
- }
92
- if (event.key === "Home") {
88
+ if (event.key === "Tab") originElement && originElement.focus();
89
+ else if (event.key === "Home") {
93
90
  event.preventDefault(), event.stopPropagation();
94
91
  let el = _getFocusableElements(elementsRef.current)[0];
95
92
  if (!el) return;
96
93
  let currentIndex = elementsRef.current.indexOf(el);
97
94
  setActiveIndex(currentIndex);
98
- return;
99
- }
100
- if (event.key === "End") {
95
+ } else if (event.key === "End") {
101
96
  event.preventDefault(), event.stopPropagation();
102
97
  let focusableElements_0 = _getFocusableElements(elementsRef.current), el_0 = focusableElements_0[focusableElements_0.length - 1];
103
98
  if (!el_0) return;
104
99
  let currentIndex_0 = elementsRef.current.indexOf(el_0);
105
100
  setActiveIndex(currentIndex_0);
106
- return;
107
- }
108
- if (event.key === "ArrowUp") {
101
+ } else if (event.key === "ArrowUp") {
109
102
  event.preventDefault(), event.stopPropagation();
110
103
  let focusableElements_1 = _getFocusableElements(elementsRef.current), focusableLen = focusableElements_1.length;
111
104
  if (focusableLen === 0) return;
@@ -113,9 +106,7 @@ function useMenuController(props) {
113
106
  focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen;
114
107
  let el_1 = focusableElements_1[focusedIndex], currentIndex_1 = elementsRef.current.indexOf(el_1);
115
108
  setActiveIndex(currentIndex_1);
116
- return;
117
- }
118
- if (event.key === "ArrowDown") {
109
+ } else if (event.key === "ArrowDown") {
119
110
  event.preventDefault(), event.stopPropagation();
120
111
  let focusableElements_2 = _getFocusableElements(elementsRef.current), focusableLen_0 = focusableElements_2.length;
121
112
  if (focusableLen_0 === 0) return;
@@ -123,9 +114,7 @@ function useMenuController(props) {
123
114
  focusedIndex_0 = (focusedIndex_0 + 1) % focusableLen_0;
124
115
  let el_2 = focusableElements_2[focusedIndex_0], currentIndex_2 = elementsRef.current.indexOf(el_2);
125
116
  setActiveIndex(currentIndex_2);
126
- return;
127
- }
128
- onKeyDown && onKeyDown(event);
117
+ } else onKeyDown && onKeyDown(event);
129
118
  }, $[6] = onKeyDown, $[7] = originElement, $[8] = t5) : t5 = $[8];
130
119
  let handleKeyDown = t5, t6;
131
120
  $[9] === Symbol.for("react.memo_cache_sentinel") ? (t6 = (event_0) => {
@@ -155,9 +144,7 @@ function useMenuController(props) {
155
144
  setActiveIndex(currentIndex_5);
156
145
  }
157
146
  }
158
- return;
159
- }
160
- (elementsRef.current[activeIndex] || null)?.focus();
147
+ } else (elementsRef.current[activeIndex] || null)?.focus();
161
148
  });
162
149
  return () => cancelAnimationFrame(rafId);
163
150
  }, t9 = [
@@ -276,14 +263,7 @@ function MenuButton(props) {
276
263
  }, $[13] = open, $[14] = t9);
277
264
  let handleMouseDown = t9, t10;
278
265
  $[15] === Symbol.for("react.memo_cache_sentinel") ? (t10 = (event_0) => {
279
- if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
280
- event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
281
- return;
282
- }
283
- if (event_0.key === "ArrowUp") {
284
- event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
285
- return;
286
- }
266
+ event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " " ? (event_0.preventDefault(), setOpen(!0), setShouldFocus("first")) : event_0.key === "ArrowUp" && (event_0.preventDefault(), setOpen(!0), setShouldFocus("last"));
287
267
  }, $[15] = t10) : t10 = $[15];
288
268
  let handleButtonKeyDown = t10, t11;
289
269
  $[16] !== buttonElement || $[17] !== menuElements ? (t11 = (event_1) => {
@@ -453,10 +433,7 @@ const MenuGroup = function MenuGroup(props) {
453
433
  let childMenu = t19, t20;
454
434
  $[45] === Symbol.for("react.memo_cache_sentinel") ? (t20 = (event_2) => {
455
435
  let target = event_2.currentTarget;
456
- if (document.activeElement === target && event_2.key === "ArrowRight") {
457
- setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
458
- return;
459
- }
436
+ document.activeElement === target && event_2.key === "ArrowRight" && (setShouldFocus("first"), setOpen(!0), setWithinMenu(!0));
460
437
  }, $[45] = t20) : t20 = $[45];
461
438
  let handleKeyDown = t20, t21 = as === "button" ? withinMenu : void 0, t22 = as === "button" ? void 0 : withinMenu, t23 = !withinMenu && active ? "" : void 0, t24;
462
439
  $[46] === radius ? t24 = $[47] : (t24 = _getArrayProp(radius), $[46] = radius, $[47] = t24);