@yamada-ui/menu 1.3.15-next-20241005220055 → 1.3.15
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-ZUOFHOX6.mjs → chunk-EJHOFPF4.mjs} +11 -11
- package/dist/chunk-EJHOFPF4.mjs.map +1 -0
- package/dist/{chunk-ZV73JKM5.mjs → chunk-ELQD4RMJ.mjs} +4 -4
- package/dist/{chunk-ZV73JKM5.mjs.map → chunk-ELQD4RMJ.mjs.map} +1 -1
- package/dist/{chunk-NNSVX2GX.mjs → chunk-I2KIZ6OI.mjs} +28 -28
- package/dist/{chunk-NNSVX2GX.mjs.map → chunk-I2KIZ6OI.mjs.map} +1 -1
- package/dist/{chunk-O5D4LR5P.mjs → chunk-I473RINV.mjs} +8 -8
- package/dist/{chunk-O5D4LR5P.mjs.map → chunk-I473RINV.mjs.map} +1 -1
- package/dist/{chunk-OFCEMPQW.mjs → chunk-KZAACFSL.mjs} +3 -3
- package/dist/{chunk-OFCEMPQW.mjs.map → chunk-KZAACFSL.mjs.map} +1 -1
- package/dist/{chunk-M4PPRRRC.mjs → chunk-NLIGD66J.mjs} +14 -14
- package/dist/chunk-NLIGD66J.mjs.map +1 -0
- package/dist/{chunk-HVOHR2NQ.mjs → chunk-O7MHNHWF.mjs} +4 -4
- package/dist/{chunk-HVOHR2NQ.mjs.map → chunk-O7MHNHWF.mjs.map} +1 -1
- package/dist/{chunk-SI3WI4AI.mjs → chunk-RGVXO7LB.mjs} +8 -8
- package/dist/chunk-RGVXO7LB.mjs.map +1 -0
- package/dist/{chunk-WQ626PSA.mjs → chunk-T4SSYCLG.mjs} +9 -8
- package/dist/chunk-T4SSYCLG.mjs.map +1 -0
- package/dist/{chunk-T7CXLEBW.mjs → chunk-WVPBDFCN.mjs} +36 -36
- package/dist/chunk-WVPBDFCN.mjs.map +1 -0
- package/dist/context-menu-trigger.js +14 -13
- package/dist/context-menu-trigger.js.map +1 -1
- package/dist/context-menu-trigger.mjs +2 -2
- package/dist/context-menu.js +33 -33
- package/dist/context-menu.js.map +1 -1
- package/dist/context-menu.mjs +3 -3
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +277 -274
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/menu-button.d.mts +2 -2
- package/dist/menu-button.d.ts +2 -2
- package/dist/menu-button.js +51 -51
- package/dist/menu-button.js.map +1 -1
- package/dist/menu-button.mjs +3 -3
- package/dist/menu-context.d.mts +116 -116
- package/dist/menu-context.d.ts +116 -116
- package/dist/menu-context.js +8 -8
- package/dist/menu-context.js.map +1 -1
- package/dist/menu-context.mjs +1 -1
- package/dist/menu-divider.js +8 -8
- package/dist/menu-divider.js.map +1 -1
- package/dist/menu-divider.mjs +2 -2
- package/dist/menu-group.js +9 -9
- package/dist/menu-group.js.map +1 -1
- package/dist/menu-group.mjs +2 -2
- package/dist/menu-item.d.mts +21 -21
- package/dist/menu-item.d.ts +21 -21
- package/dist/menu-item.js +41 -41
- package/dist/menu-item.js.map +1 -1
- package/dist/menu-item.mjs +2 -2
- package/dist/menu-list.js +14 -14
- package/dist/menu-list.js.map +1 -1
- package/dist/menu-list.mjs +2 -2
- package/dist/menu-option-group.d.mts +8 -8
- package/dist/menu-option-group.d.ts +8 -8
- package/dist/menu-option-group.js +47 -47
- package/dist/menu-option-group.js.map +1 -1
- package/dist/menu-option-group.mjs +4 -4
- package/dist/menu.js +33 -33
- package/dist/menu.js.map +1 -1
- package/dist/menu.mjs +2 -2
- package/package.json +11 -11
- package/dist/chunk-M4PPRRRC.mjs.map +0 -1
- package/dist/chunk-SI3WI4AI.mjs.map +0 -1
- package/dist/chunk-T7CXLEBW.mjs.map +0 -1
- package/dist/chunk-WQ626PSA.mjs.map +0 -1
- package/dist/chunk-ZUOFHOX6.mjs.map +0 -1
package/dist/menu-button.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/menu-button.tsx","../src/menu-context.ts","../src/menu-item.tsx"],"sourcesContent":["import type { HTMLUIProps, CSSUIObject } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { ChevronIcon } from \"@yamada-ui/icon\"\nimport { PopoverTrigger } from \"@yamada-ui/popover\"\nimport { assignRef, cx, dataAttr, funcAll, handlerAll } from \"@yamada-ui/utils\"\nimport type { KeyboardEvent, ReactNode } from \"react\"\nimport { useCallback, useMemo } from \"react\"\nimport { useMenu, useUpstreamMenuItem } from \"./menu-context\"\nimport type { MenuIconProps } from \"./menu-item\"\nimport { MenuIcon } from \"./menu-item\"\n\nexport interface MenuButtonProps extends HTMLUIProps<\"button\"> {}\n\nexport const MenuButton = forwardRef<MenuButtonProps, \"button\">(\n ({ className, children, as, ...rest }, ref) => {\n const { onKeyDownRef, onUpstreamRestoreFocus } = useUpstreamMenuItem() ?? {}\n const { isOpen, onOpen, onClose, onFocusFirstItem, onFocusLastItem } =\n useMenu()\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent) => {\n const actions: { [key: string]: Function } = {\n Enter: funcAll(onOpen, onFocusFirstItem),\n ArrowDown: funcAll(onOpen, onFocusFirstItem),\n ArrowUp: funcAll(onOpen, onFocusLastItem),\n }\n\n const action = actions[ev.key]\n\n if (!action) return\n\n ev.preventDefault()\n\n action()\n },\n [onFocusFirstItem, onFocusLastItem, onOpen],\n )\n\n const onItemKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLLIElement>) => {\n const actions: { [key: string]: Function | undefined } = {\n ArrowRight: !isOpen ? funcAll(onOpen, onFocusFirstItem) : undefined,\n ArrowLeft: isOpen\n ? funcAll(onUpstreamRestoreFocus, onClose)\n : undefined,\n }\n\n const action = actions[ev.key]\n\n if (!action) return\n\n ev.preventDefault()\n\n action()\n },\n [isOpen, onOpen, onFocusFirstItem, onUpstreamRestoreFocus, onClose],\n )\n\n assignRef(onKeyDownRef, onItemKeyDown)\n\n const Component = useMemo(() => (as ? ui(as) : Button), [as])\n\n return (\n <PopoverTrigger>\n <Component\n ref={ref}\n className={cx(\"ui-menu\", className)}\n aria-haspopup=\"menu\"\n aria-expanded={isOpen}\n {...rest}\n data-active={dataAttr(isOpen)}\n onKeyDown={handlerAll(rest.onKeyDown, onKeyDown)}\n >\n {children}\n </Component>\n </PopoverTrigger>\n )\n },\n)\n\nconst Button = forwardRef<MenuButtonProps, \"button\">((rest, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = {\n display: \"inline-flex\",\n appearance: \"none\",\n alignItems: \"center\",\n outline: 0,\n ...styles.button,\n }\n\n return <ui.button ref={ref} __css={css} {...rest} />\n})\n\nexport interface MenuItemButtonProps extends MenuButtonProps {\n innerProps?: HTMLUIProps<\"span\">\n iconProps?: MenuIconProps\n icon?: ReactNode\n}\n\nexport const MenuItemButton = forwardRef<MenuItemButtonProps, \"button\">(\n ({ className, children, innerProps, icon, iconProps, ...rest }, ref) => {\n return (\n <MenuButton\n ref={ref}\n className={cx(\"ui-menu__item-button\", className)}\n flex=\"1\"\n {...rest}\n >\n <ui.span as=\"span\" flex=\"1\" {...innerProps}>\n {children}\n </ui.span>\n\n <MenuIcon {...iconProps}>\n {icon ?? <ChevronIcon fontSize=\"1.5em\" transform=\"rotate(-90deg)\" />}\n </MenuIcon>\n </MenuButton>\n )\n },\n)\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\nimport type {\n Dispatch,\n KeyboardEventHandler,\n MutableRefObject,\n RefObject,\n SetStateAction,\n} from \"react\"\nimport type { MenuOptions } from \"./menu\"\n\nexport const {\n DescendantsContextProvider,\n useDescendantsContext: useMenuDescendantsContext,\n useDescendants,\n useDescendant: useMenuDescendant,\n} = createDescendant()\n\ninterface MenuContext extends MenuOptions {\n isOpen: boolean\n onOpen: () => void\n onClose: () => void\n onUpstreamClose?: () => void\n onFocusFirstItem: () => void\n onFocusLastItem: () => void\n focusedIndex: number\n setFocusedIndex: Dispatch<SetStateAction<number>>\n menuRef: RefObject<HTMLDivElement>\n requestAnimationFrameId: MutableRefObject<number | null>\n isNested: boolean\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [MenuProvider, useMenu] = createContext<MenuContext>({\n name: \"MenuContext\",\n errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in \"<Menu />\"`,\n})\n\ninterface ContextMenuContext {\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [ContextMenuProvider, useContextMenu] =\n createContext<ContextMenuContext>({\n strict: false,\n name: \"ContextMenuContext\",\n })\n\ninterface UpstreamMenuContext {\n relatedRef: RefObject<HTMLElement>\n onDownstreamCloseMapRef: MutableRefObject<Map<string, () => void>>\n onUpstreamClose: () => void\n}\n\nexport const [UpstreamMenuProvider, useUpstreamMenu] =\n createContext<UpstreamMenuContext>({\n strict: false,\n name: \"UpstreamMenuContext\",\n })\n\ninterface UpstreamMenuItemContext {\n onUpstreamRestoreFocus: () => void\n onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>\n setDownstreamOpen: Dispatch<SetStateAction<boolean>>\n hasDownstreamRef: MutableRefObject<boolean>\n}\n\nexport const [UpstreamMenuItemProvider, useUpstreamMenuItem] =\n createContext<UpstreamMenuItemContext>({\n strict: false,\n name: \"UpstreamMenuItemContext\",\n })\n","import type { HTMLUIProps, CSSUIObject } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { useClickable } from \"@yamada-ui/use-clickable\"\nimport {\n ariaAttr,\n cx,\n funcAll,\n handlerAll,\n isActiveElement,\n isHTMLElement,\n mergeRefs,\n useUpdateEffect,\n} from \"@yamada-ui/utils\"\nimport type {\n FC,\n KeyboardEvent,\n KeyboardEventHandler,\n MouseEvent,\n ReactElement,\n} from \"react\"\nimport { useCallback, useRef, useState } from \"react\"\nimport {\n useMenuDescendant,\n UpstreamMenuItemProvider,\n useMenu,\n useUpstreamMenuItem,\n} from \"./menu-context\"\n\nconst isTargetMenuItem = (target: EventTarget | null) => {\n return (\n isHTMLElement(target) &&\n !!target?.getAttribute(\"role\")?.startsWith(\"menuitem\")\n )\n}\n\ninterface MenuItemOptions {\n /**\n * If `true`, the menu item will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * If `true`, the menu item will be focusable.\n *\n * @default false\n */\n isFocusable?: boolean\n /**\n * If `true`, the list element will be closed when selected.\n *\n * @default false\n */\n closeOnSelect?: boolean\n /**\n * The menu item icon to use.\n */\n icon?: ReactElement\n /**\n * Right-aligned label text content, useful for displaying hotkeys.\n */\n command?: string\n}\n\nexport interface MenuItemProps extends HTMLUIProps<\"li\">, MenuItemOptions {}\n\nexport const MenuItem = forwardRef<MenuItemProps, \"li\">(\n (\n {\n className,\n isDisabled,\n isFocusable,\n closeOnSelect: customCloseOnSelect,\n icon,\n command,\n children,\n ...props\n },\n ref,\n ) => {\n const {\n focusedIndex,\n setFocusedIndex,\n isOpen,\n onClose,\n onUpstreamClose,\n closeOnSelect: generalCloseOnSelect,\n menuRef,\n requestAnimationFrameId,\n isNested,\n styles,\n } = useMenu()\n const { onUpstreamRestoreFocus } = useUpstreamMenuItem() ?? {}\n\n const trulyDisabled = isDisabled && !isFocusable\n\n const itemRef = useRef<HTMLLIElement>(null)\n const hasDownstreamRef = useRef<boolean>(false)\n const onKeyDownRef = useRef<KeyboardEventHandler<HTMLLIElement>>(\n () => void 0,\n )\n const { index, register } = useMenuDescendant({ disabled: trulyDisabled })\n const [isDownstreamOpen, setDownstreamOpen] = useState<boolean>(false)\n\n const isFocused = index === focusedIndex\n\n const onMouseOver = useCallback(() => {\n if (isDisabled) return\n\n setFocusedIndex(index)\n }, [index, isDisabled, setFocusedIndex])\n\n const onMouseLeave = useCallback(() => {\n if (isDisabled) return\n\n setFocusedIndex(-1)\n }, [setFocusedIndex, isDisabled])\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLLIElement>) => {\n if (!isTargetMenuItem(ev.currentTarget)) return\n\n const hasDownstream = hasDownstreamRef.current\n\n if (customCloseOnSelect ?? (!hasDownstream && generalCloseOnSelect)) {\n onClose()\n onUpstreamClose?.()\n }\n },\n [customCloseOnSelect, generalCloseOnSelect, onClose, onUpstreamClose],\n )\n\n const onFocus = useCallback(() => {\n setFocusedIndex(index)\n }, [setFocusedIndex, index])\n\n const onRestoreFocus = useCallback(() => {\n itemRef.current?.focus()\n\n setFocusedIndex(index)\n }, [setFocusedIndex, index])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLLIElement>) => {\n const actions: { [key: string]: Function | undefined } = {\n ArrowLeft: isNested\n ? funcAll(onUpstreamRestoreFocus, onClose)\n : undefined,\n }\n\n const action = actions[ev.key]\n\n if (!action) return\n\n ev.preventDefault()\n ev.stopPropagation()\n\n action()\n },\n [onUpstreamRestoreFocus, onClose, isNested],\n )\n\n const rest = useClickable<HTMLLIElement>({\n focusOnClick: false,\n ...props,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFocus),\n onMouseOver: handlerAll(props.onMouseOver, onMouseOver),\n onMouseLeave: handlerAll(props.onMouseLeave, onMouseLeave),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown, onKeyDownRef.current),\n ref: mergeRefs(register, itemRef, ref),\n isDisabled,\n isFocusable,\n })\n\n useUpdateEffect(() => {\n if (!isOpen) return\n\n const id = requestAnimationFrameId.current\n\n if (isFocused && !trulyDisabled && itemRef.current) {\n if (id) cancelAnimationFrame(id)\n\n requestAnimationFrameId.current = requestAnimationFrame(() => {\n itemRef.current?.focus({ preventScroll: true })\n\n requestAnimationFrameId.current = null\n })\n } else if (menuRef.current && !isActiveElement(menuRef.current)) {\n menuRef.current.focus({ preventScroll: true })\n }\n\n return () => {\n if (id) cancelAnimationFrame(id)\n }\n }, [isFocused, trulyDisabled, menuRef, isOpen])\n\n children =\n icon || command ? (\n <ui.span style={{ flex: 1 }}>{children}</ui.span>\n ) : (\n children\n )\n\n const css: CSSUIObject = {\n textDecoration: \"none\",\n color: \"inherit\",\n userSelect: \"none\",\n display: \"flex\",\n width: \"100%\",\n alignItems: \"center\",\n textAlign: \"start\",\n flex: \"0 0 auto\",\n outline: 0,\n gap: \"0.75rem\",\n ...styles.item,\n }\n\n return (\n <UpstreamMenuItemProvider\n value={{\n onKeyDownRef,\n onUpstreamRestoreFocus: onRestoreFocus,\n setDownstreamOpen,\n hasDownstreamRef,\n }}\n >\n <ui.li\n {...rest}\n {...(isDownstreamOpen ? { \"data-active\": \"\" } : {})}\n role=\"menuitem\"\n tabIndex={isFocused ? 0 : -1}\n className={cx(\"ui-menu__item\", className)}\n __css={css}\n >\n {icon ? <MenuIcon>{icon}</MenuIcon> : null}\n {children}\n {command ? <MenuCommand>{command}</MenuCommand> : null}\n </ui.li>\n </UpstreamMenuItemProvider>\n )\n },\n)\n\ninterface MenuOptionItemOptions {\n /**\n * The menu option item icon to use.\n */\n icon?: ReactElement | null\n /**\n * The value of the menu option item.\n */\n value?: string\n /**\n * If `true`, the checkbox or radio will be checked.\n *\n * @default false\n */\n isChecked?: boolean\n /**\n * The type of the menu option item.\n */\n type?: \"radio\" | \"checkbox\"\n}\n\nexport interface MenuOptionItemProps\n extends Omit<MenuItemProps, \"icon\" | \"command\" | \"value\">,\n MenuOptionItemOptions {}\n\nexport const MenuOptionItem = forwardRef<MenuOptionItemProps, \"button\">(\n (\n { className, icon, isChecked, closeOnSelect = false, children, ...rest },\n ref,\n ) => {\n return (\n <MenuItem\n ref={ref}\n className={cx(\"ui-menu__item--option\", className)}\n aria-checked={ariaAttr(isChecked)}\n closeOnSelect={closeOnSelect}\n {...rest}\n >\n {icon !== null ? (\n <MenuIcon opacity={isChecked ? 1 : 0}>\n {icon || <CheckIcon />}\n </MenuIcon>\n ) : null}\n {children}\n </MenuItem>\n )\n },\n)\n\nexport interface MenuIconProps extends HTMLUIProps<\"span\"> {}\n\nexport const MenuIcon = forwardRef<MenuIconProps, \"span\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = {\n flexShrink: 0,\n display: \"inline-flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n fontSize: \"0.85em\",\n ...styles.icon,\n }\n\n return (\n <ui.span\n ref={ref}\n className={cx(\"ui-menu__item__icon\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport interface MenuCommandProps extends HTMLUIProps<\"span\"> {}\n\nexport const MenuCommand = forwardRef<MenuCommandProps, \"span\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = { ...styles.command }\n\n return (\n <ui.span\n ref={ref}\n className={cx(\"ui-menu__item__command\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nconst CheckIcon: FC = () => (\n <svg viewBox=\"0 0 14 14\" width=\"1em\" height=\"1em\">\n <polygon\n fill=\"currentColor\"\n points=\"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039\"\n />\n </svg>\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA+B;AAC/B,kBAA4B;AAC5B,qBAA+B;AAC/B,IAAAC,gBAA6D;AAE7D,IAAAC,gBAAqC;;;ACLrC,4BAAiC;AACjC,mBAA8B;AAUvB,IAAM;AAAA,EACX;AAAA,EACA,uBAAuB;AAAA,EACvB;AAAA,EACA,eAAe;AACjB,QAAI,wCAAiB;AAiBd,IAAM,CAAC,cAAc,OAAO,QAAI,4BAA2B;AAAA,EAChE,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAMM,IAAM,CAAC,qBAAqB,cAAc,QAC/C,4BAAkC;AAAA,EAChC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;AAQI,IAAM,CAAC,sBAAsB,eAAe,QACjD,4BAAmC;AAAA,EACjC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;AASI,IAAM,CAAC,0BAA0B,mBAAmB,QACzD,4BAAuC;AAAA,EACrC,QAAQ;AAAA,EACR,MA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AAG,WAAW,SAAS;AAAA,QAClC,iBAAc;AAAA,QACd,iBAAe;AAAA,QACd,GAAG;AAAA,QACJ,mBAAa,wBAAS,MAAM;AAAA,QAC5B,eAAW,0BAAW,KAAK,WAAW,SAAS;AAAA,QAE9C;AAAA;AAAA,IACH,GACF;AAAA,EAEJ;AACF;AAEA,IAAM,aAAS,yBAAsC,CAAC,MAAM,QAAQ;AAClE,QAAM,EAAE,OAAO,IAAI,QAAQ;AAE3B,QAAM,MAAmB;AAAA,IACvB,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,GAAG,OAAO;AAAA,EACZ;AAEA,SAAO,6CAAC,gBAAG,QAAH,EAAU,KAAU,OAAO,KAAM,GAAG,MAAM;AACpD,CAAC;AAQM,IAAM,qBAAiB;AAAA,EAC5B,CAAC,EAAE,WAAW,UAAU,YAAY,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ;AACtE,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,wBAAwB,SAAS;AAAA,QAC/C,MAAK;AAAA,QACJ,GAAG;AAAA,QAEJ;AAAA,uDAAC,gBAAG,MAAH,EAAQ,IAAG,QAAO,MAAK,KAAK,GAAG,YAC7B,UACH;AAAA,UAEA,6CAAC,YAAU,GAAG,WACX,gCAAQ,6CAAC,2BAAY,UAAS,SAAQ,WAAU,kBAAiB,GACpE;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;","names":["import_core","import_utils","import_react","import_utils","_a","import_jsx_runtime"]}
|
1
|
+
{"version":3,"sources":["../src/menu-button.tsx","../src/menu-context.ts","../src/menu-item.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport type { KeyboardEvent, ReactNode } from \"react\"\nimport type { MenuIconProps } from \"./menu-item\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { ChevronIcon } from \"@yamada-ui/icon\"\nimport { PopoverTrigger } from \"@yamada-ui/popover\"\nimport { assignRef, cx, dataAttr, funcAll, handlerAll } from \"@yamada-ui/utils\"\nimport { useCallback, useMemo } from \"react\"\nimport { useMenu, useUpstreamMenuItem } from \"./menu-context\"\nimport { MenuIcon } from \"./menu-item\"\n\nexport interface MenuButtonProps extends HTMLUIProps<\"button\"> {}\n\nexport const MenuButton = forwardRef<MenuButtonProps, \"button\">(\n ({ as, className, children, ...rest }, ref) => {\n const { onKeyDownRef, onUpstreamRestoreFocus } = useUpstreamMenuItem() ?? {}\n const { isOpen, onClose, onFocusFirstItem, onFocusLastItem, onOpen } =\n useMenu()\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent) => {\n const actions: { [key: string]: Function } = {\n ArrowDown: funcAll(onOpen, onFocusFirstItem),\n ArrowUp: funcAll(onOpen, onFocusLastItem),\n Enter: funcAll(onOpen, onFocusFirstItem),\n }\n\n const action = actions[ev.key]\n\n if (!action) return\n\n ev.preventDefault()\n\n action()\n },\n [onFocusFirstItem, onFocusLastItem, onOpen],\n )\n\n const onItemKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLLIElement>) => {\n const actions: { [key: string]: Function | undefined } = {\n ArrowLeft: isOpen\n ? funcAll(onUpstreamRestoreFocus, onClose)\n : undefined,\n ArrowRight: !isOpen ? funcAll(onOpen, onFocusFirstItem) : undefined,\n }\n\n const action = actions[ev.key]\n\n if (!action) return\n\n ev.preventDefault()\n\n action()\n },\n [isOpen, onOpen, onFocusFirstItem, onUpstreamRestoreFocus, onClose],\n )\n\n assignRef(onKeyDownRef, onItemKeyDown)\n\n const Component = useMemo(() => (as ? ui(as) : Button), [as])\n\n return (\n <PopoverTrigger>\n <Component\n ref={ref}\n className={cx(\"ui-menu\", className)}\n aria-expanded={isOpen}\n aria-haspopup=\"menu\"\n {...rest}\n data-active={dataAttr(isOpen)}\n onKeyDown={handlerAll(rest.onKeyDown, onKeyDown)}\n >\n {children}\n </Component>\n </PopoverTrigger>\n )\n },\n)\n\nconst Button = forwardRef<MenuButtonProps, \"button\">((rest, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n appearance: \"none\",\n display: \"inline-flex\",\n outline: 0,\n ...styles.button,\n }\n\n return <ui.button ref={ref} __css={css} {...rest} />\n})\n\nexport interface MenuItemButtonProps extends MenuButtonProps {\n icon?: ReactNode\n iconProps?: MenuIconProps\n innerProps?: HTMLUIProps<\"span\">\n}\n\nexport const MenuItemButton = forwardRef<MenuItemButtonProps, \"button\">(\n ({ className, children, icon, iconProps, innerProps, ...rest }, ref) => {\n return (\n <MenuButton\n ref={ref}\n className={cx(\"ui-menu__item-button\", className)}\n flex=\"1\"\n {...rest}\n >\n <ui.span as=\"span\" flex=\"1\" {...innerProps}>\n {children}\n </ui.span>\n\n <MenuIcon {...iconProps}>\n {icon ?? <ChevronIcon fontSize=\"1.5em\" transform=\"rotate(-90deg)\" />}\n </MenuIcon>\n </MenuButton>\n )\n },\n)\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport type {\n Dispatch,\n KeyboardEventHandler,\n MutableRefObject,\n RefObject,\n SetStateAction,\n} from \"react\"\nimport type { MenuOptions } from \"./menu\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\n\nexport const {\n DescendantsContextProvider,\n useDescendant: useMenuDescendant,\n useDescendants,\n useDescendantsContext: useMenuDescendantsContext,\n} = createDescendant()\n\ninterface MenuContext extends MenuOptions {\n focusedIndex: number\n isNested: boolean\n isOpen: boolean\n menuRef: RefObject<HTMLDivElement>\n requestAnimationFrameId: MutableRefObject<null | number>\n setFocusedIndex: Dispatch<SetStateAction<number>>\n styles: { [key: string]: CSSUIObject | undefined }\n onClose: () => void\n onFocusFirstItem: () => void\n onFocusLastItem: () => void\n onOpen: () => void\n onUpstreamClose?: () => void\n}\n\nexport const [MenuProvider, useMenu] = createContext<MenuContext>({\n name: \"MenuContext\",\n errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in \"<Menu />\"`,\n})\n\ninterface ContextMenuContext {\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ContextMenuProvider, useContextMenu] =\n createContext<ContextMenuContext>({\n name: \"ContextMenuContext\",\n strict: false,\n })\n\ninterface UpstreamMenuContext {\n relatedRef: RefObject<HTMLElement>\n onDownstreamCloseMapRef: MutableRefObject<Map<string, () => void>>\n onUpstreamClose: () => void\n}\n\nexport const [UpstreamMenuProvider, useUpstreamMenu] =\n createContext<UpstreamMenuContext>({\n name: \"UpstreamMenuContext\",\n strict: false,\n })\n\ninterface UpstreamMenuItemContext {\n hasDownstreamRef: MutableRefObject<boolean>\n setDownstreamOpen: Dispatch<SetStateAction<boolean>>\n onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>\n onUpstreamRestoreFocus: () => void\n}\n\nexport const [UpstreamMenuItemProvider, useUpstreamMenuItem] =\n createContext<UpstreamMenuItemContext>({\n name: \"UpstreamMenuItemContext\",\n strict: false,\n })\n","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport type {\n FC,\n KeyboardEvent,\n KeyboardEventHandler,\n MouseEvent,\n ReactElement,\n} from \"react\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { useClickable } from \"@yamada-ui/use-clickable\"\nimport {\n ariaAttr,\n cx,\n funcAll,\n handlerAll,\n isActiveElement,\n isHTMLElement,\n mergeRefs,\n useUpdateEffect,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useRef, useState } from \"react\"\nimport {\n UpstreamMenuItemProvider,\n useMenu,\n useMenuDescendant,\n useUpstreamMenuItem,\n} from \"./menu-context\"\n\nconst isTargetMenuItem = (target: EventTarget | null) => {\n return (\n isHTMLElement(target) &&\n !!target.getAttribute(\"role\")?.startsWith(\"menuitem\")\n )\n}\n\ninterface MenuItemOptions {\n /**\n * If `true`, the list element will be closed when selected.\n *\n * @default false\n */\n closeOnSelect?: boolean\n /**\n * Right-aligned label text content, useful for displaying hotkeys.\n */\n command?: string\n /**\n * The menu item icon to use.\n */\n icon?: ReactElement\n /**\n * If `true`, the menu item will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * If `true`, the menu item will be focusable.\n *\n * @default false\n */\n isFocusable?: boolean\n}\n\nexport interface MenuItemProps extends HTMLUIProps<\"li\">, MenuItemOptions {}\n\nexport const MenuItem = forwardRef<MenuItemProps, \"li\">(\n (\n {\n className,\n children,\n closeOnSelect: customCloseOnSelect,\n command,\n icon,\n isDisabled,\n isFocusable,\n ...props\n },\n ref,\n ) => {\n const {\n closeOnSelect,\n focusedIndex,\n isNested,\n isOpen,\n menuRef,\n requestAnimationFrameId,\n setFocusedIndex,\n styles,\n onClose,\n onUpstreamClose,\n } = useMenu()\n const { onUpstreamRestoreFocus } = useUpstreamMenuItem() ?? {}\n\n const trulyDisabled = isDisabled && !isFocusable\n\n const itemRef = useRef<HTMLLIElement>(null)\n const hasDownstreamRef = useRef<boolean>(false)\n const onKeyDownRef = useRef<KeyboardEventHandler<HTMLLIElement>>(\n () => void 0,\n )\n const { index, register } = useMenuDescendant({ disabled: trulyDisabled })\n const [isDownstreamOpen, setDownstreamOpen] = useState<boolean>(false)\n\n const isFocused = index === focusedIndex\n\n const onMouseOver = useCallback(() => {\n if (isDisabled) return\n\n setFocusedIndex(index)\n }, [index, isDisabled, setFocusedIndex])\n\n const onMouseLeave = useCallback(() => {\n if (isDisabled) return\n\n setFocusedIndex(-1)\n }, [setFocusedIndex, isDisabled])\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLLIElement>) => {\n if (!isTargetMenuItem(ev.currentTarget)) return\n\n const hasDownstream = hasDownstreamRef.current\n\n if (customCloseOnSelect ?? (!hasDownstream && closeOnSelect)) {\n onClose()\n onUpstreamClose?.()\n }\n },\n [customCloseOnSelect, closeOnSelect, onClose, onUpstreamClose],\n )\n\n const onFocus = useCallback(() => {\n setFocusedIndex(index)\n }, [setFocusedIndex, index])\n\n const onRestoreFocus = useCallback(() => {\n itemRef.current?.focus()\n\n setFocusedIndex(index)\n }, [setFocusedIndex, index])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLLIElement>) => {\n const actions: { [key: string]: Function | undefined } = {\n ArrowLeft: isNested\n ? funcAll(onUpstreamRestoreFocus, onClose)\n : undefined,\n }\n\n const action = actions[ev.key]\n\n if (!action) return\n\n ev.preventDefault()\n ev.stopPropagation()\n\n action()\n },\n [onUpstreamRestoreFocus, onClose, isNested],\n )\n\n const rest = useClickable<HTMLLIElement>({\n focusOnClick: false,\n ...props,\n ref: mergeRefs(register, itemRef, ref),\n isDisabled,\n isFocusable,\n onClick: handlerAll(props.onClick, onClick),\n onFocus: handlerAll(props.onFocus, onFocus),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown, onKeyDownRef.current),\n onMouseLeave: handlerAll(props.onMouseLeave, onMouseLeave),\n onMouseOver: handlerAll(props.onMouseOver, onMouseOver),\n })\n\n useUpdateEffect(() => {\n if (!isOpen) return\n\n const id = requestAnimationFrameId.current\n\n if (isFocused && !trulyDisabled && itemRef.current) {\n if (id) cancelAnimationFrame(id)\n\n requestAnimationFrameId.current = requestAnimationFrame(() => {\n itemRef.current?.focus({ preventScroll: true })\n\n requestAnimationFrameId.current = null\n })\n } else if (menuRef.current && !isActiveElement(menuRef.current)) {\n menuRef.current.focus({ preventScroll: true })\n }\n\n return () => {\n if (id) cancelAnimationFrame(id)\n }\n }, [isFocused, trulyDisabled, menuRef, isOpen])\n\n children =\n icon || command ? (\n <ui.span style={{ flex: 1 }}>{children}</ui.span>\n ) : (\n children\n )\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n color: \"inherit\",\n display: \"flex\",\n flex: \"0 0 auto\",\n gap: \"0.75rem\",\n outline: 0,\n textAlign: \"start\",\n textDecoration: \"none\",\n userSelect: \"none\",\n width: \"100%\",\n ...styles.item,\n }\n\n return (\n <UpstreamMenuItemProvider\n value={{\n hasDownstreamRef,\n setDownstreamOpen,\n onKeyDownRef,\n onUpstreamRestoreFocus: onRestoreFocus,\n }}\n >\n <ui.li\n {...rest}\n {...(isDownstreamOpen ? { \"data-active\": \"\" } : {})}\n className={cx(\"ui-menu__item\", className)}\n role=\"menuitem\"\n tabIndex={isFocused ? 0 : -1}\n __css={css}\n >\n {icon ? <MenuIcon>{icon}</MenuIcon> : null}\n {children}\n {command ? <MenuCommand>{command}</MenuCommand> : null}\n </ui.li>\n </UpstreamMenuItemProvider>\n )\n },\n)\n\ninterface MenuOptionItemOptions {\n /**\n * The type of the menu option item.\n */\n type?: \"checkbox\" | \"radio\"\n /**\n * The menu option item icon to use.\n */\n icon?: null | ReactElement\n /**\n * If `true`, the checkbox or radio will be checked.\n *\n * @default false\n */\n isChecked?: boolean\n /**\n * The value of the menu option item.\n */\n value?: string\n}\n\nexport interface MenuOptionItemProps\n extends Omit<MenuItemProps, \"command\" | \"icon\" | \"value\">,\n MenuOptionItemOptions {}\n\nexport const MenuOptionItem = forwardRef<MenuOptionItemProps, \"button\">(\n (\n { className, children, closeOnSelect = false, icon, isChecked, ...rest },\n ref,\n ) => {\n return (\n <MenuItem\n ref={ref}\n className={cx(\"ui-menu__item--option\", className)}\n aria-checked={ariaAttr(isChecked)}\n closeOnSelect={closeOnSelect}\n {...rest}\n >\n {icon !== null ? (\n <MenuIcon opacity={isChecked ? 1 : 0}>\n {icon || <CheckIcon />}\n </MenuIcon>\n ) : null}\n {children}\n </MenuItem>\n )\n },\n)\n\nexport interface MenuIconProps extends HTMLUIProps<\"span\"> {}\n\nexport const MenuIcon = forwardRef<MenuIconProps, \"span\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"inline-flex\",\n flexShrink: 0,\n fontSize: \"0.85em\",\n justifyContent: \"center\",\n ...styles.icon,\n }\n\n return (\n <ui.span\n ref={ref}\n className={cx(\"ui-menu__item__icon\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nexport interface MenuCommandProps extends HTMLUIProps<\"span\"> {}\n\nexport const MenuCommand = forwardRef<MenuCommandProps, \"span\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = { ...styles.command }\n\n return (\n <ui.span\n ref={ref}\n className={cx(\"ui-menu__item__command\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nconst CheckIcon: FC = () => (\n <svg height=\"1em\" viewBox=\"0 0 14 14\" width=\"1em\">\n <polygon\n fill=\"currentColor\"\n points=\"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039\"\n />\n </svg>\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,IAAAA,eAA+B;AAC/B,kBAA4B;AAC5B,qBAA+B;AAC/B,IAAAC,gBAA6D;AAC7D,IAAAC,gBAAqC;;;ACErC,4BAAiC;AACjC,mBAA8B;AAEvB,IAAM;AAAA,EACX;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA,uBAAuB;AACzB,QAAI,wCAAiB;AAiBd,IAAM,CAAC,cAAc,OAAO,QAAI,4BAA2B;AAAA,EAChE,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAMM,IAAM,CAAC,qBAAqB,cAAc,QAC/C,4BAAkC;AAAA,EAChC,MAAM;AAAA,EACN,QAAQ;AACV,CAAC;AAQI,IAAM,CAAC,sBAAsB,eAAe,QACjD,4BAAmC;AAAA,EACjC,MAAM;AAAA,EACN,QAAQ;AACV,CAAC;AASI,IAAM,CAAC,0BAA0B,mBAAmB,QACzD,4BAAuC;AAAA,EACrC,MAAM;AAAA,EACN,QAAQ;AACV,CAAC;;;AChEH,kBAA+B;AAC/B,2BAA6B;AAC7B,IAAAC,gBASO;AACP,mBAA8C;AAmLtC;AA3KR,IAAM,mBAAmB,CAAC,WAA+B;AA5BzD;AA6BE,aACE,6BAAc,MAAM,KACpB,CAAC,GAAC,YAAO,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A,EAEJ;AACF;AAEA,IAAM,aAAS,yBAAsC,CAAC,MAAM,QAAQ;AAClE,QAAM,EAAE,OAAO,IAAI,QAAQ;AAE3B,QAAM,MAAmB;AAAA,IACvB,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,SAAS;AAAA,IACT,GAAG,OAAO;AAAA,EACZ;AAEA,SAAO,6CAAC,gBAAG,QAAH,EAAU,KAAU,OAAO,KAAM,GAAG,MAAM;AACpD,CAAC;AAQM,IAAM,qBAAiB;AAAA,EAC5B,CAAC,EAAE,WAAW,UAAU,MAAM,WAAW,YAAY,GAAG,KAAK,GAAG,QAAQ;AACtE,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,wBAAwB,SAAS;AAAA,QAC/C,MAAK;AAAA,QACJ,GAAG;AAAA,QAEJ;AAAA,uDAAC,gBAAG,MAAH,EAAQ,IAAG,QAAO,MAAK,KAAK,GAAG,YAC7B,UACH;AAAA,UAEA,6CAAC,YAAU,GAAG,WACX,gCAAQ,6CAAC,2BAAY,UAAS,SAAQ,WAAU,kBAAiB,GACpE;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;","names":["import_core","import_utils","import_react","import_utils","_a","import_jsx_runtime"]}
|
package/dist/menu-button.mjs
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
import {
|
3
3
|
MenuButton,
|
4
4
|
MenuItemButton
|
5
|
-
} from "./chunk-
|
6
|
-
import "./chunk-
|
7
|
-
import "./chunk-
|
5
|
+
} from "./chunk-NLIGD66J.mjs";
|
6
|
+
import "./chunk-WVPBDFCN.mjs";
|
7
|
+
import "./chunk-EJHOFPF4.mjs";
|
8
8
|
export {
|
9
9
|
MenuButton,
|
10
10
|
MenuItemButton
|
package/dist/menu-context.d.mts
CHANGED
@@ -1,210 +1,210 @@
|
|
1
1
|
import * as react from 'react';
|
2
|
-
import {
|
2
|
+
import { RefObject, MutableRefObject, Dispatch, SetStateAction, KeyboardEventHandler } from 'react';
|
3
3
|
import * as _yamada_ui_use_descendant from '@yamada-ui/use-descendant';
|
4
4
|
import { CSSUIObject } from '@yamada-ui/core';
|
5
5
|
import { MenuOptions } from './menu.mjs';
|
6
6
|
import '@yamada-ui/popover';
|
7
7
|
|
8
8
|
declare const DescendantsContextProvider: react.Provider<{
|
9
|
-
register: (nodeOrOptions: HTMLElement | {
|
10
|
-
disabled?: boolean;
|
11
|
-
id?: string;
|
12
|
-
filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined;
|
13
|
-
} | null) => void | ((node: HTMLElement | null) => void);
|
14
|
-
unregister: (node: HTMLElement) => void;
|
15
|
-
destroy: () => void;
|
16
9
|
count: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
17
|
-
|
18
|
-
value: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
19
|
-
indexOf: (node: HTMLElement | null) => number;
|
20
|
-
firstValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
21
|
-
lastValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
22
|
-
prevValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
23
|
-
nextValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
10
|
+
destroy: () => void;
|
24
11
|
enabledCount: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
25
|
-
enabledValues: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}>[];
|
26
|
-
enabledValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
27
|
-
enabledIndexOf: (node: HTMLElement | null, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
28
12
|
enabledFirstValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
13
|
+
enabledIndexOf: (node?: HTMLElement | null | undefined, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
29
14
|
enabledLastValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
30
|
-
enabledPrevValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
31
15
|
enabledNextValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
32
|
-
}
|
33
|
-
|
34
|
-
|
35
|
-
disabled?: boolean;
|
36
|
-
id?: string;
|
37
|
-
filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined;
|
38
|
-
} | null) => void | ((node: HTMLElement | null) => void);
|
39
|
-
unregister: (node: HTMLElement) => void;
|
40
|
-
destroy: () => void;
|
41
|
-
count: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
42
|
-
values: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}>[];
|
43
|
-
value: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
44
|
-
indexOf: (node: HTMLElement | null) => number;
|
16
|
+
enabledPrevValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
17
|
+
enabledValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
18
|
+
enabledValues: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}>[];
|
45
19
|
firstValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
20
|
+
indexOf: (node?: HTMLElement | null | undefined) => number;
|
46
21
|
lastValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
47
|
-
prevValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
48
22
|
nextValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
49
|
-
|
50
|
-
|
51
|
-
enabledValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
52
|
-
enabledIndexOf: (node: HTMLElement | null, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
53
|
-
enabledFirstValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
54
|
-
enabledLastValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
55
|
-
enabledPrevValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
56
|
-
enabledNextValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
57
|
-
};
|
58
|
-
declare const useDescendants: () => {
|
59
|
-
register: (nodeOrOptions: HTMLElement | {
|
60
|
-
disabled?: boolean;
|
23
|
+
prevValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
24
|
+
register: (nodeOrOptions?: HTMLElement | {
|
61
25
|
id?: string;
|
26
|
+
disabled?: boolean;
|
62
27
|
filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined;
|
63
|
-
} | null) => void | ((node: HTMLElement | null) => void);
|
64
|
-
unregister: (node
|
65
|
-
destroy: () => void;
|
66
|
-
count: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
67
|
-
values: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}>[];
|
28
|
+
} | null | undefined) => void | ((node: HTMLElement | null) => void);
|
29
|
+
unregister: (node?: HTMLElement | undefined) => void;
|
68
30
|
value: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
69
|
-
|
70
|
-
|
71
|
-
lastValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
72
|
-
prevValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
73
|
-
nextValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
74
|
-
enabledCount: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
75
|
-
enabledValues: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}>[];
|
76
|
-
enabledValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
77
|
-
enabledIndexOf: (node: HTMLElement | null, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
78
|
-
enabledFirstValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
79
|
-
enabledLastValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
80
|
-
enabledPrevValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
81
|
-
enabledNextValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
82
|
-
};
|
31
|
+
values: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}>[];
|
32
|
+
}>;
|
83
33
|
declare const useMenuDescendant: (options?: {
|
84
|
-
disabled?: boolean;
|
85
34
|
id?: string;
|
35
|
+
disabled?: boolean;
|
86
36
|
filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined;
|
87
37
|
} | undefined) => {
|
88
38
|
descendants: {
|
89
|
-
register: (nodeOrOptions: HTMLElement | _yamada_ui_use_descendant.DescendantOptions<HTMLElement, {
|
90
|
-
[key: string]: any;
|
91
|
-
}> | null) => void | ((node: HTMLElement | null) => void);
|
92
|
-
unregister: (node: HTMLElement) => void;
|
93
|
-
destroy: () => void;
|
94
39
|
count: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
95
40
|
[key: string]: any;
|
96
41
|
}> | undefined) => number;
|
97
|
-
|
98
|
-
|
99
|
-
}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {
|
42
|
+
destroy: () => void;
|
43
|
+
enabledCount: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
100
44
|
[key: string]: any;
|
101
|
-
}>
|
102
|
-
|
45
|
+
}> | undefined) => number;
|
46
|
+
enabledFirstValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
103
47
|
[key: string]: any;
|
104
48
|
}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {
|
105
49
|
[key: string]: any;
|
106
50
|
}> | undefined;
|
107
|
-
|
108
|
-
firstValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
51
|
+
enabledIndexOf: (node?: HTMLElement | null | undefined, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
109
52
|
[key: string]: any;
|
110
|
-
}> | undefined) =>
|
111
|
-
|
112
|
-
}> | undefined;
|
113
|
-
lastValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
53
|
+
}> | undefined) => number;
|
54
|
+
enabledLastValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
114
55
|
[key: string]: any;
|
115
56
|
}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {
|
116
57
|
[key: string]: any;
|
117
58
|
}> | undefined;
|
118
|
-
|
59
|
+
enabledNextValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
119
60
|
[key: string]: any;
|
120
61
|
}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {
|
121
62
|
[key: string]: any;
|
122
63
|
}> | undefined;
|
123
|
-
|
64
|
+
enabledPrevValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
124
65
|
[key: string]: any;
|
125
66
|
}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {
|
126
67
|
[key: string]: any;
|
127
68
|
}> | undefined;
|
128
|
-
|
69
|
+
enabledValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
129
70
|
[key: string]: any;
|
130
|
-
}> | undefined) =>
|
71
|
+
}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {
|
72
|
+
[key: string]: any;
|
73
|
+
}> | undefined;
|
131
74
|
enabledValues: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
132
75
|
[key: string]: any;
|
133
76
|
}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {
|
134
77
|
[key: string]: any;
|
135
78
|
}>[];
|
136
|
-
|
79
|
+
firstValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
137
80
|
[key: string]: any;
|
138
81
|
}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {
|
139
82
|
[key: string]: any;
|
140
83
|
}> | undefined;
|
141
|
-
|
142
|
-
|
143
|
-
}> | undefined) => number;
|
144
|
-
enabledFirstValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
84
|
+
indexOf: (node?: HTMLElement | null | undefined) => number;
|
85
|
+
lastValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
145
86
|
[key: string]: any;
|
146
87
|
}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {
|
147
88
|
[key: string]: any;
|
148
89
|
}> | undefined;
|
149
|
-
|
90
|
+
nextValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
150
91
|
[key: string]: any;
|
151
|
-
}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {
|
92
|
+
}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {
|
152
93
|
[key: string]: any;
|
153
94
|
}> | undefined;
|
154
|
-
|
95
|
+
prevValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
155
96
|
[key: string]: any;
|
156
97
|
}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {
|
157
98
|
[key: string]: any;
|
158
99
|
}> | undefined;
|
159
|
-
|
100
|
+
register: (nodeOrOptions?: HTMLElement | _yamada_ui_use_descendant.DescendantOptions<HTMLElement, {
|
160
101
|
[key: string]: any;
|
161
|
-
}> |
|
102
|
+
}> | null | undefined) => void | ((node: HTMLElement | null) => void);
|
103
|
+
unregister: (node?: HTMLElement | undefined) => void;
|
104
|
+
value: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
105
|
+
[key: string]: any;
|
106
|
+
}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {
|
162
107
|
[key: string]: any;
|
163
108
|
}> | undefined;
|
109
|
+
values: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {
|
110
|
+
[key: string]: any;
|
111
|
+
}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {
|
112
|
+
[key: string]: any;
|
113
|
+
}>[];
|
164
114
|
};
|
165
|
-
index: number;
|
166
115
|
enabledIndex: number;
|
116
|
+
index: number;
|
167
117
|
register: (node: HTMLElement | null) => void;
|
168
118
|
};
|
119
|
+
declare const useDescendants: () => {
|
120
|
+
count: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
121
|
+
destroy: () => void;
|
122
|
+
enabledCount: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
123
|
+
enabledFirstValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
124
|
+
enabledIndexOf: (node?: HTMLElement | null | undefined, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
125
|
+
enabledLastValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
126
|
+
enabledNextValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
127
|
+
enabledPrevValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
128
|
+
enabledValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
129
|
+
enabledValues: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}>[];
|
130
|
+
firstValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
131
|
+
indexOf: (node?: HTMLElement | null | undefined) => number;
|
132
|
+
lastValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
133
|
+
nextValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
134
|
+
prevValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
135
|
+
register: (nodeOrOptions?: HTMLElement | {
|
136
|
+
id?: string;
|
137
|
+
disabled?: boolean;
|
138
|
+
filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined;
|
139
|
+
} | null | undefined) => void | ((node: HTMLElement | null) => void);
|
140
|
+
unregister: (node?: HTMLElement | undefined) => void;
|
141
|
+
value: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
142
|
+
values: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}>[];
|
143
|
+
};
|
144
|
+
declare const useMenuDescendantsContext: () => {
|
145
|
+
count: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
146
|
+
destroy: () => void;
|
147
|
+
enabledCount: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
148
|
+
enabledFirstValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
149
|
+
enabledIndexOf: (node?: HTMLElement | null | undefined, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => number;
|
150
|
+
enabledLastValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
151
|
+
enabledNextValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
152
|
+
enabledPrevValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
153
|
+
enabledValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
154
|
+
enabledValues: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}>[];
|
155
|
+
firstValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
156
|
+
indexOf: (node?: HTMLElement | null | undefined) => number;
|
157
|
+
lastValue: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
158
|
+
nextValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
159
|
+
prevValue: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined, loop?: boolean) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
160
|
+
register: (nodeOrOptions?: HTMLElement | {
|
161
|
+
id?: string;
|
162
|
+
disabled?: boolean;
|
163
|
+
filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined;
|
164
|
+
} | null | undefined) => void | ((node: HTMLElement | null) => void);
|
165
|
+
unregister: (node?: HTMLElement | undefined) => void;
|
166
|
+
value: (index: number, filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}> | undefined;
|
167
|
+
values: (filter?: _yamada_ui_use_descendant.FilterDescendant<HTMLElement, {}> | undefined) => _yamada_ui_use_descendant.Descendant<HTMLElement, {}>[];
|
168
|
+
};
|
169
169
|
interface MenuContext extends MenuOptions {
|
170
|
-
isOpen: boolean;
|
171
|
-
onOpen: () => void;
|
172
|
-
onClose: () => void;
|
173
|
-
onUpstreamClose?: () => void;
|
174
|
-
onFocusFirstItem: () => void;
|
175
|
-
onFocusLastItem: () => void;
|
176
170
|
focusedIndex: number;
|
177
|
-
setFocusedIndex: Dispatch<SetStateAction<number>>;
|
178
|
-
menuRef: RefObject<HTMLDivElement>;
|
179
|
-
requestAnimationFrameId: MutableRefObject<number | null>;
|
180
171
|
isNested: boolean;
|
172
|
+
isOpen: boolean;
|
173
|
+
menuRef: RefObject<HTMLDivElement>;
|
174
|
+
requestAnimationFrameId: MutableRefObject<null | number>;
|
175
|
+
setFocusedIndex: Dispatch<SetStateAction<number>>;
|
181
176
|
styles: {
|
182
|
-
[key: string]: CSSUIObject;
|
177
|
+
[key: string]: CSSUIObject | undefined;
|
183
178
|
};
|
179
|
+
onClose: () => void;
|
180
|
+
onFocusFirstItem: () => void;
|
181
|
+
onFocusLastItem: () => void;
|
182
|
+
onOpen: () => void;
|
183
|
+
onUpstreamClose?: () => void;
|
184
184
|
}
|
185
185
|
declare const MenuProvider: react.Provider<MenuContext>;
|
186
186
|
declare const useMenu: () => MenuContext;
|
187
187
|
interface ContextMenuContext {
|
188
188
|
styles: {
|
189
|
-
[key: string]: CSSUIObject;
|
189
|
+
[key: string]: CSSUIObject | undefined;
|
190
190
|
};
|
191
191
|
}
|
192
|
-
declare const ContextMenuProvider: react.Provider<ContextMenuContext>;
|
193
|
-
declare const useContextMenu: () => ContextMenuContext;
|
192
|
+
declare const ContextMenuProvider: react.Provider<ContextMenuContext | undefined>;
|
193
|
+
declare const useContextMenu: () => ContextMenuContext | undefined;
|
194
194
|
interface UpstreamMenuContext {
|
195
195
|
relatedRef: RefObject<HTMLElement>;
|
196
196
|
onDownstreamCloseMapRef: MutableRefObject<Map<string, () => void>>;
|
197
197
|
onUpstreamClose: () => void;
|
198
198
|
}
|
199
|
-
declare const UpstreamMenuProvider: react.Provider<UpstreamMenuContext>;
|
200
|
-
declare const useUpstreamMenu: () => UpstreamMenuContext;
|
199
|
+
declare const UpstreamMenuProvider: react.Provider<UpstreamMenuContext | undefined>;
|
200
|
+
declare const useUpstreamMenu: () => UpstreamMenuContext | undefined;
|
201
201
|
interface UpstreamMenuItemContext {
|
202
|
-
onUpstreamRestoreFocus: () => void;
|
203
|
-
onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>;
|
204
|
-
setDownstreamOpen: Dispatch<SetStateAction<boolean>>;
|
205
202
|
hasDownstreamRef: MutableRefObject<boolean>;
|
203
|
+
setDownstreamOpen: Dispatch<SetStateAction<boolean>>;
|
204
|
+
onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>;
|
205
|
+
onUpstreamRestoreFocus: () => void;
|
206
206
|
}
|
207
|
-
declare const UpstreamMenuItemProvider: react.Provider<UpstreamMenuItemContext>;
|
208
|
-
declare const useUpstreamMenuItem: () => UpstreamMenuItemContext;
|
207
|
+
declare const UpstreamMenuItemProvider: react.Provider<UpstreamMenuItemContext | undefined>;
|
208
|
+
declare const useUpstreamMenuItem: () => UpstreamMenuItemContext | undefined;
|
209
209
|
|
210
210
|
export { ContextMenuProvider, DescendantsContextProvider, MenuProvider, UpstreamMenuItemProvider, UpstreamMenuProvider, useContextMenu, useDescendants, useMenu, useMenuDescendant, useMenuDescendantsContext, useUpstreamMenu, useUpstreamMenuItem };
|