@fluentui/react-menu 9.7.4 → 9.7.6
Sign up to get free protection for your applications and to get access to all the features.
- package/.swcrc +30 -0
- package/CHANGELOG.json +127 -1
- package/CHANGELOG.md +36 -2
- package/lib/Menu.js.map +1 -1
- package/lib/MenuDivider.js.map +1 -1
- package/lib/MenuGroup.js.map +1 -1
- package/lib/MenuGroupHeader.js.map +1 -1
- package/lib/MenuItem.js.map +1 -1
- package/lib/MenuItemCheckbox.js.map +1 -1
- package/lib/MenuItemRadio.js.map +1 -1
- package/lib/MenuList.js.map +1 -1
- package/lib/MenuPopover.js.map +1 -1
- package/lib/MenuSplitGroup.js.map +1 -1
- package/lib/MenuTrigger.js.map +1 -1
- package/lib/components/Menu/Menu.js +1 -0
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.types.js +1 -1
- package/lib/components/Menu/Menu.types.js.map +1 -1
- package/lib/components/Menu/index.js.map +1 -1
- package/lib/components/Menu/renderMenu.js.map +1 -1
- package/lib/components/Menu/useMenu.js +9 -8
- package/lib/components/Menu/useMenu.js.map +1 -1
- package/lib/components/Menu/useMenuContextValues.js.map +1 -1
- package/lib/components/MenuDivider/MenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/MenuDivider.types.js.map +1 -1
- package/lib/components/MenuDivider/index.js.map +1 -1
- package/lib/components/MenuDivider/renderMenuDivider.js +1 -3
- package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/useMenuDivider.js +1 -0
- package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
- package/lib/components/MenuGroup/MenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/MenuGroup.types.js.map +1 -1
- package/lib/components/MenuGroup/index.js.map +1 -1
- package/lib/components/MenuGroup/renderMenuGroup.js +1 -3
- package/lib/components/MenuGroup/renderMenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroup.js +1 -0
- package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
- package/lib/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
- package/lib/components/MenuGroupHeader/index.js.map +1 -1
- package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js +1 -3
- package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeader.js +1 -0
- package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.types.js.map +1 -1
- package/lib/components/MenuItem/index.js.map +1 -1
- package/lib/components/MenuItem/renderMenuItem.js +1 -13
- package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
- package/lib/components/MenuItem/useCharacterSearch.js +3 -2
- package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
- package/lib/components/MenuItem/useMenuItem.js +7 -7
- package/lib/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib/components/MenuItem/useMenuItemStyles.js +15 -2
- package/lib/components/MenuItem/useMenuItemStyles.js.map +1 -1
- package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
- package/lib/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
- package/lib/components/MenuItemCheckbox/index.js.map +1 -1
- package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js +1 -11
- package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
- package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js +4 -4
- package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
- package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
- package/lib/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
- package/lib/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
- package/lib/components/MenuItemRadio/index.js.map +1 -1
- package/lib/components/MenuItemRadio/renderMenuItemRadio.js +1 -11
- package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
- package/lib/components/MenuItemRadio/useMenuItemRadio.js +4 -4
- package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
- package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
- package/lib/components/MenuList/MenuList.js.map +1 -1
- package/lib/components/MenuList/MenuList.types.js +1 -1
- package/lib/components/MenuList/MenuList.types.js.map +1 -1
- package/lib/components/MenuList/index.js.map +1 -1
- package/lib/components/MenuList/renderMenuList.js +1 -3
- package/lib/components/MenuList/renderMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuList.js +6 -5
- package/lib/components/MenuList/useMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
- package/lib/components/MenuList/useMenuListStyles.js.map +1 -1
- package/lib/components/MenuPopover/MenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/MenuPopover.types.js.map +1 -1
- package/lib/components/MenuPopover/index.js.map +1 -1
- package/lib/components/MenuPopover/renderMenuPopover.js +2 -6
- package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/useMenuPopover.js +4 -4
- package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
- package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
- package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
- package/lib/components/MenuSplitGroup/index.js.map +1 -1
- package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js +1 -3
- package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
- package/lib/components/MenuSplitGroup/useMenuSplitGroup.js +2 -2
- package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
- package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.js +1 -0
- package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.types.js +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
- package/lib/components/MenuTrigger/index.js.map +1 -1
- package/lib/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
- package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib/components/index.js.map +1 -1
- package/lib/contexts/menuContext.js +1 -0
- package/lib/contexts/menuContext.js.map +1 -1
- package/lib/contexts/menuGroupContext.js +2 -4
- package/lib/contexts/menuGroupContext.js.map +1 -1
- package/lib/contexts/menuListContext.js +1 -0
- package/lib/contexts/menuListContext.js.map +1 -1
- package/lib/contexts/menuTriggerContext.js +2 -4
- package/lib/contexts/menuTriggerContext.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/selectable/index.js.map +1 -1
- package/lib/selectable/types.js +1 -1
- package/lib/selectable/types.js.map +1 -1
- package/lib/selectable/useCheckmarkStyles.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/useIsSubmenu.js.map +1 -1
- package/lib/utils/useOnMenuEnter.js +2 -2
- package/lib/utils/useOnMenuEnter.js.map +1 -1
- package/lib-commonjs/Menu.js +5 -4
- package/lib-commonjs/Menu.js.map +1 -1
- package/lib-commonjs/MenuDivider.js +5 -4
- package/lib-commonjs/MenuDivider.js.map +1 -1
- package/lib-commonjs/MenuGroup.js +5 -4
- package/lib-commonjs/MenuGroup.js.map +1 -1
- package/lib-commonjs/MenuGroupHeader.js +5 -4
- package/lib-commonjs/MenuGroupHeader.js.map +1 -1
- package/lib-commonjs/MenuItem.js +5 -4
- package/lib-commonjs/MenuItem.js.map +1 -1
- package/lib-commonjs/MenuItemCheckbox.js +5 -4
- package/lib-commonjs/MenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/MenuItemRadio.js +5 -4
- package/lib-commonjs/MenuItemRadio.js.map +1 -1
- package/lib-commonjs/MenuList.js +5 -4
- package/lib-commonjs/MenuList.js.map +1 -1
- package/lib-commonjs/MenuPopover.js +5 -4
- package/lib-commonjs/MenuPopover.js.map +1 -1
- package/lib-commonjs/MenuSplitGroup.js +5 -4
- package/lib-commonjs/MenuSplitGroup.js.map +1 -1
- package/lib-commonjs/MenuTrigger.js +5 -4
- package/lib-commonjs/MenuTrigger.js.map +1 -1
- package/lib-commonjs/components/Menu/Menu.js +16 -15
- package/lib-commonjs/components/Menu/Menu.js.map +1 -1
- package/lib-commonjs/components/Menu/Menu.types.js +5 -2
- package/lib-commonjs/components/Menu/Menu.types.js.map +1 -1
- package/lib-commonjs/components/Menu/index.js +9 -8
- package/lib-commonjs/components/Menu/index.js.map +1 -1
- package/lib-commonjs/components/Menu/renderMenu.js +14 -14
- package/lib-commonjs/components/Menu/renderMenu.js.map +1 -1
- package/lib-commonjs/components/Menu/useMenu.js +258 -256
- package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
- package/lib-commonjs/components/Menu/useMenuContextValues.js +29 -43
- package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/MenuDivider.js +19 -20
- package/lib-commonjs/components/MenuDivider/MenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/MenuDivider.types.js +3 -2
- package/lib-commonjs/components/MenuDivider/MenuDivider.types.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/index.js +9 -8
- package/lib-commonjs/components/MenuDivider/index.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/renderMenuDivider.js +13 -19
- package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDivider.js +22 -21
- package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js +47 -25
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/MenuGroup.js +21 -22
- package/lib-commonjs/components/MenuGroup/MenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/MenuGroup.types.js +3 -2
- package/lib-commonjs/components/MenuGroup/MenuGroup.types.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/index.js +10 -9
- package/lib-commonjs/components/MenuGroup/index.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/renderMenuGroup.js +16 -22
- package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js +23 -22
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js +18 -15
- package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js +19 -11
- package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js +19 -20
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js +3 -2
- package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/index.js +9 -8
- package/lib-commonjs/components/MenuGroupHeader/index.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js +13 -19
- package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js +22 -23
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +47 -25
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItem/MenuItem.js +19 -20
- package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/MenuItem.types.js +3 -2
- package/lib-commonjs/components/MenuItem/MenuItem.types.js.map +1 -1
- package/lib-commonjs/components/MenuItem/index.js +9 -8
- package/lib-commonjs/components/MenuItem/index.js.map +1 -1
- package/lib-commonjs/components/MenuItem/renderMenuItem.js +13 -28
- package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useCharacterSearch.js +24 -22
- package/lib-commonjs/components/MenuItem/useCharacterSearch.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItem.js +97 -104
- package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.js +318 -137
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js +19 -20
- package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js +3 -2
- package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/index.js +9 -8
- package/lib-commonjs/components/MenuItemCheckbox/index.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js +13 -24
- package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js +44 -45
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +38 -30
- package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js +19 -20
- package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js +3 -2
- package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/index.js +9 -8
- package/lib-commonjs/components/MenuItemRadio/index.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js +13 -27
- package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js +42 -45
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js +38 -30
- package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
- package/lib-commonjs/components/MenuList/MenuList.js +21 -22
- package/lib-commonjs/components/MenuList/MenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/MenuList.types.js +5 -2
- package/lib-commonjs/components/MenuList/MenuList.types.js.map +1 -1
- package/lib-commonjs/components/MenuList/index.js +10 -9
- package/lib-commonjs/components/MenuList/index.js.map +1 -1
- package/lib-commonjs/components/MenuList/renderMenuList.js +16 -21
- package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuList.js +143 -137
- package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuListContextValues.js +20 -25
- package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuListStyles.js +33 -23
- package/lib-commonjs/components/MenuList/useMenuListStyles.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/MenuPopover.js +19 -20
- package/lib-commonjs/components/MenuPopover/MenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/MenuPopover.types.js +3 -2
- package/lib-commonjs/components/MenuPopover/MenuPopover.types.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/index.js +9 -8
- package/lib-commonjs/components/MenuPopover/index.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/renderMenuPopover.js +19 -26
- package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js +102 -110
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js +121 -50
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js +19 -20
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js +3 -2
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/index.js +9 -8
- package/lib-commonjs/components/MenuSplitGroup/index.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js +13 -18
- package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js +58 -64
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js +61 -32
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js +15 -15
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js +5 -2
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/index.js +8 -7
- package/lib-commonjs/components/MenuTrigger/index.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js +14 -16
- package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js +163 -170
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib-commonjs/components/index.js +6 -5
- package/lib-commonjs/components/index.js.map +1 -1
- package/lib-commonjs/contexts/menuContext.js +38 -27
- package/lib-commonjs/contexts/menuContext.js.map +1 -1
- package/lib-commonjs/contexts/menuGroupContext.js +19 -12
- package/lib-commonjs/contexts/menuGroupContext.js.map +1 -1
- package/lib-commonjs/contexts/menuListContext.js +25 -14
- package/lib-commonjs/contexts/menuListContext.js.map +1 -1
- package/lib-commonjs/contexts/menuTriggerContext.js +18 -12
- package/lib-commonjs/contexts/menuTriggerContext.js.map +1 -1
- package/lib-commonjs/index.js +91 -399
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/selectable/index.js +6 -5
- package/lib-commonjs/selectable/index.js.map +1 -1
- package/lib-commonjs/selectable/types.js +5 -2
- package/lib-commonjs/selectable/types.js.map +1 -1
- package/lib-commonjs/selectable/useCheckmarkStyles.js +28 -26
- package/lib-commonjs/selectable/useCheckmarkStyles.js.map +1 -1
- package/lib-commonjs/utils/index.js +5 -4
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/useIsSubmenu.js +13 -19
- package/lib-commonjs/utils/useIsSubmenu.js.map +1 -1
- package/lib-commonjs/utils/useOnMenuEnter.js +57 -68
- package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
- package/package.json +15 -14
- package/lib-amd/Menu.js +0 -6
- package/lib-amd/Menu.js.map +0 -1
- package/lib-amd/MenuDivider.js +0 -6
- package/lib-amd/MenuDivider.js.map +0 -1
- package/lib-amd/MenuGroup.js +0 -6
- package/lib-amd/MenuGroup.js.map +0 -1
- package/lib-amd/MenuGroupHeader.js +0 -6
- package/lib-amd/MenuGroupHeader.js.map +0 -1
- package/lib-amd/MenuItem.js +0 -6
- package/lib-amd/MenuItem.js.map +0 -1
- package/lib-amd/MenuItemCheckbox.js +0 -6
- package/lib-amd/MenuItemCheckbox.js.map +0 -1
- package/lib-amd/MenuItemRadio.js +0 -6
- package/lib-amd/MenuItemRadio.js.map +0 -1
- package/lib-amd/MenuList.js +0 -6
- package/lib-amd/MenuList.js.map +0 -1
- package/lib-amd/MenuPopover.js +0 -6
- package/lib-amd/MenuPopover.js.map +0 -1
- package/lib-amd/MenuSplitGroup.js +0 -6
- package/lib-amd/MenuSplitGroup.js.map +0 -1
- package/lib-amd/MenuTrigger.js +0 -6
- package/lib-amd/MenuTrigger.js.map +0 -1
- package/lib-amd/components/Menu/Menu.js +0 -16
- package/lib-amd/components/Menu/Menu.js.map +0 -1
- package/lib-amd/components/Menu/Menu.types.js +0 -5
- package/lib-amd/components/Menu/Menu.types.js.map +0 -1
- package/lib-amd/components/Menu/index.js +0 -10
- package/lib-amd/components/Menu/index.js.map +0 -1
- package/lib-amd/components/Menu/renderMenu.js +0 -15
- package/lib-amd/components/Menu/renderMenu.js.map +0 -1
- package/lib-amd/components/Menu/useMenu.js +0 -224
- package/lib-amd/components/Menu/useMenu.js.map +0 -1
- package/lib-amd/components/Menu/useMenuContextValues.js +0 -29
- package/lib-amd/components/Menu/useMenuContextValues.js.map +0 -1
- package/lib-amd/components/MenuDivider/MenuDivider.js +0 -17
- package/lib-amd/components/MenuDivider/MenuDivider.js.map +0 -1
- package/lib-amd/components/MenuDivider/MenuDivider.types.js +0 -5
- package/lib-amd/components/MenuDivider/MenuDivider.types.js.map +0 -1
- package/lib-amd/components/MenuDivider/index.js +0 -10
- package/lib-amd/components/MenuDivider/index.js.map +0 -1
- package/lib-amd/components/MenuDivider/renderMenuDivider.js +0 -15
- package/lib-amd/components/MenuDivider/renderMenuDivider.js.map +0 -1
- package/lib-amd/components/MenuDivider/useMenuDivider.js +0 -18
- package/lib-amd/components/MenuDivider/useMenuDivider.js.map +0 -1
- package/lib-amd/components/MenuDivider/useMenuDividerStyles.js +0 -18
- package/lib-amd/components/MenuDivider/useMenuDividerStyles.js.map +0 -1
- package/lib-amd/components/MenuGroup/MenuGroup.js +0 -18
- package/lib-amd/components/MenuGroup/MenuGroup.js.map +0 -1
- package/lib-amd/components/MenuGroup/MenuGroup.types.js +0 -5
- package/lib-amd/components/MenuGroup/MenuGroup.types.js.map +0 -1
- package/lib-amd/components/MenuGroup/index.js +0 -11
- package/lib-amd/components/MenuGroup/index.js.map +0 -1
- package/lib-amd/components/MenuGroup/renderMenuGroup.js +0 -16
- package/lib-amd/components/MenuGroup/renderMenuGroup.js.map +0 -1
- package/lib-amd/components/MenuGroup/useMenuGroup.js +0 -20
- package/lib-amd/components/MenuGroup/useMenuGroup.js.map +0 -1
- package/lib-amd/components/MenuGroup/useMenuGroupContextValues.js +0 -12
- package/lib-amd/components/MenuGroup/useMenuGroupContextValues.js.map +0 -1
- package/lib-amd/components/MenuGroup/useMenuGroupStyles.js +0 -14
- package/lib-amd/components/MenuGroup/useMenuGroupStyles.js.map +0 -1
- package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.js +0 -17
- package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.js.map +0 -1
- package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.types.js +0 -5
- package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.types.js.map +0 -1
- package/lib-amd/components/MenuGroupHeader/index.js +0 -10
- package/lib-amd/components/MenuGroupHeader/index.js.map +0 -1
- package/lib-amd/components/MenuGroupHeader/renderMenuGroupHeader.js +0 -15
- package/lib-amd/components/MenuGroupHeader/renderMenuGroupHeader.js.map +0 -1
- package/lib-amd/components/MenuGroupHeader/useMenuGroupHeader.js +0 -19
- package/lib-amd/components/MenuGroupHeader/useMenuGroupHeader.js.map +0 -1
- package/lib-amd/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +0 -27
- package/lib-amd/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +0 -1
- package/lib-amd/components/MenuItem/MenuItem.js +0 -17
- package/lib-amd/components/MenuItem/MenuItem.js.map +0 -1
- package/lib-amd/components/MenuItem/MenuItem.types.js +0 -5
- package/lib-amd/components/MenuItem/MenuItem.types.js.map +0 -1
- package/lib-amd/components/MenuItem/index.js +0 -10
- package/lib-amd/components/MenuItem/index.js.map +0 -1
- package/lib-amd/components/MenuItem/renderMenuItem.js +0 -19
- package/lib-amd/components/MenuItem/renderMenuItem.js.map +0 -1
- package/lib-amd/components/MenuItem/useCharacterSearch.js +0 -22
- package/lib-amd/components/MenuItem/useCharacterSearch.js.map +0 -1
- package/lib-amd/components/MenuItem/useMenuItem.js +0 -75
- package/lib-amd/components/MenuItem/useMenuItem.js.map +0 -1
- package/lib-amd/components/MenuItem/useMenuItemStyles.js +0 -109
- package/lib-amd/components/MenuItem/useMenuItemStyles.js.map +0 -1
- package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.js +0 -17
- package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.js.map +0 -1
- package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.types.js +0 -5
- package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +0 -1
- package/lib-amd/components/MenuItemCheckbox/index.js +0 -10
- package/lib-amd/components/MenuItemCheckbox/index.js.map +0 -1
- package/lib-amd/components/MenuItemCheckbox/renderMenuItemCheckbox.js +0 -16
- package/lib-amd/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +0 -1
- package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckbox.js +0 -26
- package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +0 -1
- package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +0 -31
- package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +0 -1
- package/lib-amd/components/MenuItemRadio/MenuItemRadio.js +0 -17
- package/lib-amd/components/MenuItemRadio/MenuItemRadio.js.map +0 -1
- package/lib-amd/components/MenuItemRadio/MenuItemRadio.types.js +0 -5
- package/lib-amd/components/MenuItemRadio/MenuItemRadio.types.js.map +0 -1
- package/lib-amd/components/MenuItemRadio/index.js +0 -10
- package/lib-amd/components/MenuItemRadio/index.js.map +0 -1
- package/lib-amd/components/MenuItemRadio/renderMenuItemRadio.js +0 -19
- package/lib-amd/components/MenuItemRadio/renderMenuItemRadio.js.map +0 -1
- package/lib-amd/components/MenuItemRadio/useMenuItemRadio.js +0 -27
- package/lib-amd/components/MenuItemRadio/useMenuItemRadio.js.map +0 -1
- package/lib-amd/components/MenuItemRadio/useMenuItemRadioStyles.js +0 -31
- package/lib-amd/components/MenuItemRadio/useMenuItemRadioStyles.js.map +0 -1
- package/lib-amd/components/MenuList/MenuList.js +0 -18
- package/lib-amd/components/MenuList/MenuList.js.map +0 -1
- package/lib-amd/components/MenuList/MenuList.types.js +0 -5
- package/lib-amd/components/MenuList/MenuList.types.js.map +0 -1
- package/lib-amd/components/MenuList/index.js +0 -11
- package/lib-amd/components/MenuList/index.js.map +0 -1
- package/lib-amd/components/MenuList/renderMenuList.js +0 -15
- package/lib-amd/components/MenuList/renderMenuList.js.map +0 -1
- package/lib-amd/components/MenuList/useMenuList.js +0 -125
- package/lib-amd/components/MenuList/useMenuList.js.map +0 -1
- package/lib-amd/components/MenuList/useMenuListContextValues.js +0 -20
- package/lib-amd/components/MenuList/useMenuListContextValues.js.map +0 -1
- package/lib-amd/components/MenuList/useMenuListStyles.js +0 -21
- package/lib-amd/components/MenuList/useMenuListStyles.js.map +0 -1
- package/lib-amd/components/MenuPopover/MenuPopover.js +0 -17
- package/lib-amd/components/MenuPopover/MenuPopover.js.map +0 -1
- package/lib-amd/components/MenuPopover/MenuPopover.types.js +0 -5
- package/lib-amd/components/MenuPopover/MenuPopover.types.js.map +0 -1
- package/lib-amd/components/MenuPopover/index.js +0 -10
- package/lib-amd/components/MenuPopover/index.js.map +0 -1
- package/lib-amd/components/MenuPopover/renderMenuPopover.js +0 -18
- package/lib-amd/components/MenuPopover/renderMenuPopover.js.map +0 -1
- package/lib-amd/components/MenuPopover/useMenuPopover.js +0 -83
- package/lib-amd/components/MenuPopover/useMenuPopover.js.map +0 -1
- package/lib-amd/components/MenuPopover/useMenuPopoverStyles.js +0 -21
- package/lib-amd/components/MenuPopover/useMenuPopoverStyles.js.map +0 -1
- package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.js +0 -17
- package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.js.map +0 -1
- package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.types.js +0 -5
- package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.types.js.map +0 -1
- package/lib-amd/components/MenuSplitGroup/index.js +0 -10
- package/lib-amd/components/MenuSplitGroup/index.js.map +0 -1
- package/lib-amd/components/MenuSplitGroup/renderMenuSplitGroup.js +0 -14
- package/lib-amd/components/MenuSplitGroup/renderMenuSplitGroup.js.map +0 -1
- package/lib-amd/components/MenuSplitGroup/useMenuSplitGroup.js +0 -47
- package/lib-amd/components/MenuSplitGroup/useMenuSplitGroup.js.map +0 -1
- package/lib-amd/components/MenuSplitGroup/useMenuSplitGroupStyles.js +0 -43
- package/lib-amd/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +0 -1
- package/lib-amd/components/MenuTrigger/MenuTrigger.js +0 -18
- package/lib-amd/components/MenuTrigger/MenuTrigger.js.map +0 -1
- package/lib-amd/components/MenuTrigger/MenuTrigger.types.js +0 -5
- package/lib-amd/components/MenuTrigger/MenuTrigger.types.js.map +0 -1
- package/lib-amd/components/MenuTrigger/index.js +0 -9
- package/lib-amd/components/MenuTrigger/index.js.map +0 -1
- package/lib-amd/components/MenuTrigger/renderMenuTrigger.js +0 -15
- package/lib-amd/components/MenuTrigger/renderMenuTrigger.js.map +0 -1
- package/lib-amd/components/MenuTrigger/useMenuTrigger.js +0 -112
- package/lib-amd/components/MenuTrigger/useMenuTrigger.js.map +0 -1
- package/lib-amd/components/index.js +0 -7
- package/lib-amd/components/index.js.map +0 -1
- package/lib-amd/contexts/menuContext.js +0 -32
- package/lib-amd/contexts/menuContext.js.map +0 -1
- package/lib-amd/contexts/menuGroupContext.js +0 -13
- package/lib-amd/contexts/menuGroupContext.js.map +0 -1
- package/lib-amd/contexts/menuListContext.js +0 -23
- package/lib-amd/contexts/menuListContext.js.map +0 -1
- package/lib-amd/contexts/menuTriggerContext.js +0 -14
- package/lib-amd/contexts/menuTriggerContext.js.map +0 -1
- package/lib-amd/index.js +0 -69
- package/lib-amd/index.js.map +0 -1
- package/lib-amd/selectable/index.js +0 -7
- package/lib-amd/selectable/index.js.map +0 -1
- package/lib-amd/selectable/types.js +0 -5
- package/lib-amd/selectable/types.js.map +0 -1
- package/lib-amd/selectable/useCheckmarkStyles.js +0 -28
- package/lib-amd/selectable/useCheckmarkStyles.js.map +0 -1
- package/lib-amd/utils/index.js +0 -6
- package/lib-amd/utils/index.js.map +0 -1
- package/lib-amd/utils/useIsSubmenu.js +0 -20
- package/lib-amd/utils/useIsSubmenu.js.map +0 -1
- package/lib-amd/utils/useOnMenuEnter.js +0 -59
- package/lib-amd/utils/useOnMenuEnter.js.map +0 -1
@@ -11,8 +11,8 @@ export const useMenuItemCheckbox_unstable = (props, ref) => {
|
|
11
11
|
value
|
12
12
|
} = props;
|
13
13
|
const checked = useMenuListContext_unstable(context => {
|
14
|
-
var
|
15
|
-
const checkedItems = ((
|
14
|
+
var _context_checkedValues;
|
15
|
+
const checkedItems = ((_context_checkedValues = context.checkedValues) === null || _context_checkedValues === void 0 ? void 0 : _context_checkedValues[name]) || [];
|
16
16
|
return checkedItems.indexOf(value) !== -1;
|
17
17
|
});
|
18
18
|
const state = {
|
@@ -28,9 +28,9 @@ export const useMenuItemCheckbox_unstable = (props, ref) => {
|
|
28
28
|
required: true
|
29
29
|
}),
|
30
30
|
onClick: e => {
|
31
|
-
var
|
31
|
+
var _props_onClick;
|
32
32
|
toggleCheckbox === null || toggleCheckbox === void 0 ? void 0 : toggleCheckbox(e, name, value, checked);
|
33
|
-
(
|
33
|
+
(_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);
|
34
34
|
}
|
35
35
|
}, ref),
|
36
36
|
name,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","resolveShorthand","Checkmark16Filled","useMenuListContext_unstable","useMenuItem_unstable","useMenuItemCheckbox_unstable","props","ref","toggleCheckbox","context","name","value","checked","
|
1
|
+
{"version":3,"names":["React","resolveShorthand","Checkmark16Filled","useMenuListContext_unstable","useMenuItem_unstable","useMenuItemCheckbox_unstable","props","ref","toggleCheckbox","context","name","value","checked","_context_checkedValues","checkedItems","checkedValues","indexOf","state","role","persistOnClick","checkmark","defaultProps","children","createElement","required","onClick","e","_props_onClick","call"],"sources":["../../../src/components/MenuItemCheckbox/useMenuItemCheckbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { Checkmark16Filled } from '@fluentui/react-icons';\nimport { useMenuListContext_unstable } from '../../contexts/menuListContext';\nimport { useMenuItem_unstable } from '../MenuItem/useMenuItem';\nimport type { MenuItemCheckboxProps, MenuItemCheckboxState } from './MenuItemCheckbox.types';\nimport type { ARIAButtonElement, ARIAButtonElementIntersection } from '@fluentui/react-aria';\n\n/** Returns the props and state required to render the component */\nexport const useMenuItemCheckbox_unstable = (\n props: MenuItemCheckboxProps,\n ref: React.Ref<ARIAButtonElement<'div'>>,\n): MenuItemCheckboxState => {\n const toggleCheckbox = useMenuListContext_unstable(context => context.toggleCheckbox);\n const { name, value } = props;\n\n const checked = useMenuListContext_unstable(context => {\n const checkedItems = context.checkedValues?.[name] || [];\n return checkedItems.indexOf(value) !== -1;\n });\n\n const state: MenuItemCheckboxState = {\n ...useMenuItem_unstable(\n {\n role: 'menuitemcheckbox',\n persistOnClick: true,\n ...props,\n 'aria-checked': checked,\n checkmark: resolveShorthand(props.checkmark, {\n defaultProps: { children: <Checkmark16Filled /> },\n required: true,\n }),\n onClick: (e: React.MouseEvent<ARIAButtonElementIntersection<'div'>>) => {\n toggleCheckbox?.(e, name, value, checked);\n props.onClick?.(e);\n },\n },\n ref,\n ),\n name,\n value,\n checked,\n };\n\n return state;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,oBAAoB,QAAQ;AAIrC;AACA,OAAO,MAAMC,4BAAA,GAA+BA,CAC1CC,KAAA,EACAC,GAAA,KAC0B;EAC1B,MAAMC,cAAA,GAAiBL,2BAAA,CAA4BM,OAAA,IAAWA,OAAA,CAAQD,cAAc;EACpF,MAAM;IAAEE,IAAA;IAAMC;EAAK,CAAE,GAAGL,KAAA;EAExB,MAAMM,OAAA,GAAUT,2BAAA,CAA4BM,OAAA,IAAW;QAChCI,sBAAA;IAArB,MAAMC,YAAA,GAAe,EAAAD,sBAAA,GAAAJ,OAAA,CAAQM,aAAa,cAArBF,sBAAA,uBAAAA,sBAAuB,CAACH,IAAA,CAAK,KAAI,EAAE;IACxD,OAAOI,YAAA,CAAaE,OAAO,CAACL,KAAA,MAAW,CAAC;EAC1C;EAEA,MAAMM,KAAA,GAA+B;IACnC,GAAGb,oBAAA,CACD;MACEc,IAAA,EAAM;MACNC,cAAA,EAAgB,IAAI;MACpB,GAAGb,KAAK;MACR,gBAAgBM,OAAA;MAChBQ,SAAA,EAAWnB,gBAAA,CAAiBK,KAAA,CAAMc,SAAS,EAAE;QAC3CC,YAAA,EAAc;UAAEC,QAAA,eAAUtB,KAAA,CAAAuB,aAAA,CAACrB,iBAAA;QAAqB;QAChDsB,QAAA,EAAU;MACZ;MACAC,OAAA,EAAUC,CAAA,IAA8D;YAEtEC,cAAA;QADAnB,cAAA,aAAAA,cAAA,uBAAAA,cAAA,CAAiBkB,CAAA,EAAGhB,IAAA,EAAMC,KAAA,EAAOC,OAAA;QACjC,CAAAe,cAAA,GAAArB,KAAA,CAAMmB,OAAO,cAAbE,cAAA,uBAAAA,cAAA,CAAAC,IAAA,CAAAtB,KAAA,EAAgBoB,CAAA;MAClB;IACF,GACAnB,GAAA,CACD;IACDG,IAAA;IACAC,KAAA;IACAC;EACF;EAEA,OAAOK,KAAA;AACT"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["mergeClasses","useCheckmarkStyles_unstable","useMenuItemStyles_unstable","menuItemCheckboxClassNames","root","icon","checkmark","content","secondaryContent","useMenuItemCheckboxStyles_unstable","state","className"],"sources":["
|
1
|
+
{"version":3,"names":["mergeClasses","useCheckmarkStyles_unstable","useMenuItemStyles_unstable","menuItemCheckboxClassNames","root","icon","checkmark","content","secondaryContent","useMenuItemCheckboxStyles_unstable","state","className"],"sources":["../../../src/components/MenuItemCheckbox/useMenuItemCheckboxStyles.ts"],"sourcesContent":["import { mergeClasses } from '@griffel/react';\nimport { useCheckmarkStyles_unstable } from '../../selectable/index';\nimport { useMenuItemStyles_unstable } from '../MenuItem/useMenuItemStyles';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { MenuItemSlots } from '../index';\nimport type { MenuItemCheckboxState } from './MenuItemCheckbox.types';\n\nexport const menuItemCheckboxClassNames: SlotClassNames<Omit<MenuItemSlots, 'submenuIndicator'>> = {\n root: 'fui-MenuItemCheckbox',\n icon: 'fui-MenuItemCheckbox__icon',\n checkmark: 'fui-MenuItemCheckbox__checkmark',\n content: 'fui-MenuItemCheckbox__content',\n secondaryContent: 'fui-MenuItemCheckbox__secondaryContent',\n};\n\nexport const useMenuItemCheckboxStyles_unstable = (state: MenuItemCheckboxState) => {\n state.root.className = mergeClasses(menuItemCheckboxClassNames.root, state.root.className);\n\n if (state.content) {\n state.content.className = mergeClasses(menuItemCheckboxClassNames.content, state.content.className);\n }\n\n if (state.secondaryContent) {\n state.secondaryContent.className = mergeClasses(\n menuItemCheckboxClassNames.secondaryContent,\n state.secondaryContent.className,\n );\n }\n\n if (state.icon) {\n state.icon.className = mergeClasses(menuItemCheckboxClassNames.icon, state.icon.className);\n }\n\n if (state.checkmark) {\n state.checkmark.className = mergeClasses(menuItemCheckboxClassNames.checkmark, state.checkmark.className);\n }\n\n useMenuItemStyles_unstable(state);\n useCheckmarkStyles_unstable(state);\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ;AAC7B,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,0BAA0B,QAAQ;AAK3C,OAAO,MAAMC,0BAAA,GAAsF;EACjGC,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,SAAA,EAAW;EACXC,OAAA,EAAS;EACTC,gBAAA,EAAkB;AACpB;AAEA,OAAO,MAAMC,kCAAA,GAAsCC,KAAA,IAAiC;EAClFA,KAAA,CAAMN,IAAI,CAACO,SAAS,GAAGX,YAAA,CAAaG,0BAAA,CAA2BC,IAAI,EAAEM,KAAA,CAAMN,IAAI,CAACO,SAAS;EAEzF,IAAID,KAAA,CAAMH,OAAO,EAAE;IACjBG,KAAA,CAAMH,OAAO,CAACI,SAAS,GAAGX,YAAA,CAAaG,0BAAA,CAA2BI,OAAO,EAAEG,KAAA,CAAMH,OAAO,CAACI,SAAS;EACpG;EAEA,IAAID,KAAA,CAAMF,gBAAgB,EAAE;IAC1BE,KAAA,CAAMF,gBAAgB,CAACG,SAAS,GAAGX,YAAA,CACjCG,0BAAA,CAA2BK,gBAAgB,EAC3CE,KAAA,CAAMF,gBAAgB,CAACG,SAAS;EAEpC;EAEA,IAAID,KAAA,CAAML,IAAI,EAAE;IACdK,KAAA,CAAML,IAAI,CAACM,SAAS,GAAGX,YAAA,CAAaG,0BAAA,CAA2BE,IAAI,EAAEK,KAAA,CAAML,IAAI,CAACM,SAAS;EAC3F;EAEA,IAAID,KAAA,CAAMJ,SAAS,EAAE;IACnBI,KAAA,CAAMJ,SAAS,CAACK,SAAS,GAAGX,YAAA,CAAaG,0BAAA,CAA2BG,SAAS,EAAEI,KAAA,CAAMJ,SAAS,CAACK,SAAS;EAC1G;EAEAT,0BAAA,CAA2BQ,KAAA;EAC3BT,2BAAA,CAA4BS,KAAA;AAC9B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useMenuItemRadio_unstable","renderMenuItemRadio_unstable","useMenuItemRadioStyles_unstable","useCustomStyleHooks_unstable","MenuItemRadio","forwardRef","props","ref","state","useCustomStyles","displayName"],"sources":["
|
1
|
+
{"version":3,"names":["React","useMenuItemRadio_unstable","renderMenuItemRadio_unstable","useMenuItemRadioStyles_unstable","useCustomStyleHooks_unstable","MenuItemRadio","forwardRef","props","ref","state","useCustomStyles","displayName"],"sources":["../../../src/components/MenuItemRadio/MenuItemRadio.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMenuItemRadio_unstable } from './useMenuItemRadio';\nimport { renderMenuItemRadio_unstable } from './renderMenuItemRadio';\nimport { useMenuItemRadioStyles_unstable } from './useMenuItemRadioStyles';\nimport type { MenuItemRadioProps } from './MenuItemRadio.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Define a styled MenuItemRadio, using the `useMenuItemRadio_unstable` hook.\n */\nexport const MenuItemRadio: ForwardRefComponent<MenuItemRadioProps> = React.forwardRef((props, ref) => {\n const state = useMenuItemRadio_unstable(props, ref);\n\n useMenuItemRadioStyles_unstable(state);\n\n const { useMenuItemRadioStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderMenuItemRadio_unstable(state);\n});\n\nMenuItemRadio.displayName = 'MenuItemRadio';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,4BAA4B,QAAQ;AAC7C,SAASC,+BAA+B,QAAQ;AAGhD,SAASC,4BAA4B,QAAQ;AAE7C;;;AAGA,OAAO,MAAMC,aAAA,gBAAyDL,KAAA,CAAMM,UAAU,CAAC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EACrG,MAAMC,KAAA,GAAQR,yBAAA,CAA0BM,KAAA,EAAOC,GAAA;EAE/CL,+BAAA,CAAgCM,KAAA;EAEhC,MAAM;IAAEN,+BAAA,EAAiCO;EAAe,CAAE,GAAGN,4BAAA;EAC7DM,eAAA,CAAgBD,KAAA;EAEhB,OAAOP,4BAAA,CAA6BO,KAAA;AACtC;AAEAJ,aAAA,CAAcM,WAAW,GAAG"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/MenuItemRadio/MenuItemRadio.types.ts"],"sourcesContent":["import type { MenuItemSelectableProps, MenuItemSelectableState } from '../../selectable/index';\nimport type { MenuItemProps, MenuItemState } from '../MenuItem/MenuItem.types';\n\nexport type MenuItemRadioProps = MenuItemProps & MenuItemSelectableProps;\n\nexport type MenuItemRadioState = MenuItemState & MenuItemSelectableState;\n"],"mappings":"AAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/MenuItemRadio/index.ts"],"sourcesContent":["export * from './MenuItemRadio.types';\nexport * from './MenuItemRadio';\nexport * from './renderMenuItemRadio';\nexport * from './useMenuItemRadio';\nexport * from './useMenuItemRadioStyles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
@@ -9,16 +9,6 @@ export const renderMenuItemRadio_unstable = state => {
|
|
9
9
|
slots,
|
10
10
|
slotProps
|
11
11
|
} = getSlots(state);
|
12
|
-
return /*#__PURE__*/React.createElement(slots.root,
|
13
|
-
...slotProps.root
|
14
|
-
}, slots.checkmark && /*#__PURE__*/React.createElement(slots.checkmark, {
|
15
|
-
...slotProps.checkmark
|
16
|
-
}), slots.icon && /*#__PURE__*/React.createElement(slots.icon, {
|
17
|
-
...slotProps.icon
|
18
|
-
}), slots.content && /*#__PURE__*/React.createElement(slots.content, {
|
19
|
-
...slotProps.content
|
20
|
-
}), slots.secondaryContent && /*#__PURE__*/React.createElement(slots.secondaryContent, {
|
21
|
-
...slotProps.secondaryContent
|
22
|
-
}));
|
12
|
+
return /*#__PURE__*/React.createElement(slots.root, slotProps.root, slots.checkmark && /*#__PURE__*/React.createElement(slots.checkmark, slotProps.checkmark), slots.icon && /*#__PURE__*/React.createElement(slots.icon, slotProps.icon), slots.content && /*#__PURE__*/React.createElement(slots.content, slotProps.content), slots.secondaryContent && /*#__PURE__*/React.createElement(slots.secondaryContent, slotProps.secondaryContent));
|
23
13
|
};
|
24
14
|
//# sourceMappingURL=renderMenuItemRadio.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","getSlots","renderMenuItemRadio_unstable","state","slots","slotProps","createElement","root","checkmark","icon","content","secondaryContent"],"sources":["
|
1
|
+
{"version":3,"names":["React","getSlots","renderMenuItemRadio_unstable","state","slots","slotProps","createElement","root","checkmark","icon","content","secondaryContent"],"sources":["../../../src/components/MenuItemRadio/renderMenuItemRadio.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { MenuItemRadioState } from './MenuItemRadio.types';\nimport type { MenuItemSlots } from '../MenuItem/MenuItem.types';\n\n/**\n * Redefine the render function to add slots. Reuse the menuitemradio structure but add\n * slots to children.\n */\nexport const renderMenuItemRadio_unstable = (state: MenuItemRadioState) => {\n const { slots, slotProps } = getSlots<MenuItemSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.checkmark && <slots.checkmark {...slotProps.checkmark} />}\n {slots.icon && <slots.icon {...slotProps.icon} />}\n {slots.content && <slots.content {...slotProps.content} />}\n {slots.secondaryContent && <slots.secondaryContent {...slotProps.secondaryContent} />}\n </slots.root>\n );\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,QAAQ,QAAQ;AAIzB;;;;AAIA,OAAO,MAAMC,4BAAA,GAAgCC,KAAA,IAA8B;EACzE,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGJ,QAAA,CAAwBE,KAAA;EAErD,oBACEH,KAAA,CAAAM,aAAA,CAACF,KAAA,CAAMG,IAAI,EAAKF,SAAA,CAAUE,IAAI,EAC3BH,KAAA,CAAMI,SAAS,iBAAIR,KAAA,CAAAM,aAAA,CAACF,KAAA,CAAMI,SAAS,EAAKH,SAAA,CAAUG,SAAS,GAC3DJ,KAAA,CAAMK,IAAI,iBAAIT,KAAA,CAAAM,aAAA,CAACF,KAAA,CAAMK,IAAI,EAAKJ,SAAA,CAAUI,IAAI,GAC5CL,KAAA,CAAMM,OAAO,iBAAIV,KAAA,CAAAM,aAAA,CAACF,KAAA,CAAMM,OAAO,EAAKL,SAAA,CAAUK,OAAO,GACrDN,KAAA,CAAMO,gBAAgB,iBAAIX,KAAA,CAAAM,aAAA,CAACF,KAAA,CAAMO,gBAAgB,EAAKN,SAAA,CAAUM,gBAAgB;AAGvF"}
|
@@ -12,8 +12,8 @@ export const useMenuItemRadio_unstable = (props, ref) => {
|
|
12
12
|
value
|
13
13
|
} = props;
|
14
14
|
const checked = useMenuListContext_unstable(context => {
|
15
|
-
var
|
16
|
-
const checkedItems = ((
|
15
|
+
var _context_checkedValues;
|
16
|
+
const checkedItems = ((_context_checkedValues = context.checkedValues) === null || _context_checkedValues === void 0 ? void 0 : _context_checkedValues[name]) || [];
|
17
17
|
return checkedItems.indexOf(value) !== -1;
|
18
18
|
});
|
19
19
|
const selectRadio = useMenuListContext_unstable(context => context.selectRadio);
|
@@ -29,9 +29,9 @@ export const useMenuItemRadio_unstable = (props, ref) => {
|
|
29
29
|
required: true
|
30
30
|
}),
|
31
31
|
onClick: e => {
|
32
|
-
var
|
32
|
+
var _props_onClick;
|
33
33
|
selectRadio === null || selectRadio === void 0 ? void 0 : selectRadio(e, name, value, checked);
|
34
|
-
(
|
34
|
+
(_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);
|
35
35
|
}
|
36
36
|
}, ref),
|
37
37
|
checked,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","resolveShorthand","Checkmark16Filled","useMenuListContext_unstable","useMenuItem_unstable","useMenuItemRadio_unstable","props","ref","name","value","checked","context","
|
1
|
+
{"version":3,"names":["React","resolveShorthand","Checkmark16Filled","useMenuListContext_unstable","useMenuItem_unstable","useMenuItemRadio_unstable","props","ref","name","value","checked","context","_context_checkedValues","checkedItems","checkedValues","indexOf","selectRadio","role","checkmark","defaultProps","children","createElement","required","onClick","e","_props_onClick","call"],"sources":["../../../src/components/MenuItemRadio/useMenuItemRadio.tsx"],"sourcesContent":["import * as React from 'react';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { Checkmark16Filled } from '@fluentui/react-icons';\nimport { useMenuListContext_unstable } from '../../contexts/menuListContext';\nimport { useMenuItem_unstable } from '../MenuItem/useMenuItem';\nimport type { MenuItemRadioProps, MenuItemRadioState } from './MenuItemRadio.types';\nimport type { ARIAButtonElement, ARIAButtonElementIntersection } from '@fluentui/react-aria';\n\n/**\n * Given user props, returns state and render function for a MenuItemRadio.\n */\nexport const useMenuItemRadio_unstable = (\n props: MenuItemRadioProps,\n ref: React.Ref<ARIAButtonElement<'div'>>,\n): MenuItemRadioState => {\n const { name, value } = props;\n\n const checked = useMenuListContext_unstable(context => {\n const checkedItems = context.checkedValues?.[name] || [];\n return checkedItems.indexOf(value) !== -1;\n });\n\n const selectRadio = useMenuListContext_unstable(context => context.selectRadio);\n\n return {\n ...useMenuItem_unstable(\n {\n ...props,\n role: 'menuitemradio',\n 'aria-checked': checked,\n checkmark: resolveShorthand(props.checkmark, {\n defaultProps: { children: <Checkmark16Filled /> },\n required: true,\n }),\n onClick: (e: React.MouseEvent<ARIAButtonElementIntersection<'div'>>) => {\n selectRadio?.(e, name, value, checked);\n props.onClick?.(e);\n },\n },\n ref,\n ),\n checked,\n name,\n value,\n };\n};\n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 @@
|
|
1
|
-
{"version":3,"names":["mergeClasses","useCheckmarkStyles_unstable","useMenuItemStyles_unstable","menuItemRadioClassNames","root","icon","checkmark","content","secondaryContent","useMenuItemRadioStyles_unstable","state","className"],"sources":["
|
1
|
+
{"version":3,"names":["mergeClasses","useCheckmarkStyles_unstable","useMenuItemStyles_unstable","menuItemRadioClassNames","root","icon","checkmark","content","secondaryContent","useMenuItemRadioStyles_unstable","state","className"],"sources":["../../../src/components/MenuItemRadio/useMenuItemRadioStyles.ts"],"sourcesContent":["import { mergeClasses } from '@griffel/react';\nimport { useCheckmarkStyles_unstable } from '../../selectable/index';\nimport { useMenuItemStyles_unstable } from '../MenuItem/useMenuItemStyles';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { MenuItemSlots } from '../index';\nimport type { MenuItemRadioState } from './MenuItemRadio.types';\n\nexport const menuItemRadioClassNames: SlotClassNames<Omit<MenuItemSlots, 'submenuIndicator'>> = {\n root: 'fui-MenuItemRadio',\n icon: 'fui-MenuItemRadio__icon',\n checkmark: 'fui-MenuItemRadio__checkmark',\n content: 'fui-MenuItemRadio__content',\n secondaryContent: 'fui-MenuItemRadio__secondaryContent',\n};\n\nexport const useMenuItemRadioStyles_unstable = (state: MenuItemRadioState) => {\n state.root.className = mergeClasses(menuItemRadioClassNames.root, state.root.className);\n\n if (state.content) {\n state.content.className = mergeClasses(menuItemRadioClassNames.content, state.content.className);\n }\n\n if (state.secondaryContent) {\n state.secondaryContent.className = mergeClasses(\n menuItemRadioClassNames.secondaryContent,\n state.secondaryContent.className,\n );\n }\n\n if (state.icon) {\n state.icon.className = mergeClasses(menuItemRadioClassNames.icon, state.icon.className);\n }\n\n if (state.checkmark) {\n state.checkmark.className = mergeClasses(menuItemRadioClassNames.checkmark, state.checkmark.className);\n }\n\n useMenuItemStyles_unstable(state);\n useCheckmarkStyles_unstable(state);\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ;AAC7B,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,0BAA0B,QAAQ;AAK3C,OAAO,MAAMC,uBAAA,GAAmF;EAC9FC,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,SAAA,EAAW;EACXC,OAAA,EAAS;EACTC,gBAAA,EAAkB;AACpB;AAEA,OAAO,MAAMC,+BAAA,GAAmCC,KAAA,IAA8B;EAC5EA,KAAA,CAAMN,IAAI,CAACO,SAAS,GAAGX,YAAA,CAAaG,uBAAA,CAAwBC,IAAI,EAAEM,KAAA,CAAMN,IAAI,CAACO,SAAS;EAEtF,IAAID,KAAA,CAAMH,OAAO,EAAE;IACjBG,KAAA,CAAMH,OAAO,CAACI,SAAS,GAAGX,YAAA,CAAaG,uBAAA,CAAwBI,OAAO,EAAEG,KAAA,CAAMH,OAAO,CAACI,SAAS;EACjG;EAEA,IAAID,KAAA,CAAMF,gBAAgB,EAAE;IAC1BE,KAAA,CAAMF,gBAAgB,CAACG,SAAS,GAAGX,YAAA,CACjCG,uBAAA,CAAwBK,gBAAgB,EACxCE,KAAA,CAAMF,gBAAgB,CAACG,SAAS;EAEpC;EAEA,IAAID,KAAA,CAAML,IAAI,EAAE;IACdK,KAAA,CAAML,IAAI,CAACM,SAAS,GAAGX,YAAA,CAAaG,uBAAA,CAAwBE,IAAI,EAAEK,KAAA,CAAML,IAAI,CAACM,SAAS;EACxF;EAEA,IAAID,KAAA,CAAMJ,SAAS,EAAE;IACnBI,KAAA,CAAMJ,SAAS,CAACK,SAAS,GAAGX,YAAA,CAAaG,uBAAA,CAAwBG,SAAS,EAAEI,KAAA,CAAMJ,SAAS,CAACK,SAAS;EACvG;EAEAT,0BAAA,CAA2BQ,KAAA;EAC3BT,2BAAA,CAA4BS,KAAA;AAC9B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useMenuList_unstable","renderMenuList_unstable","useMenuListContextValues_unstable","useMenuListStyles_unstable","useCustomStyleHooks_unstable","MenuList","forwardRef","props","ref","state","contextValues","useCustomStyles","displayName"],"sources":["
|
1
|
+
{"version":3,"names":["React","useMenuList_unstable","renderMenuList_unstable","useMenuListContextValues_unstable","useMenuListStyles_unstable","useCustomStyleHooks_unstable","MenuList","forwardRef","props","ref","state","contextValues","useCustomStyles","displayName"],"sources":["../../../src/components/MenuList/MenuList.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMenuList_unstable } from './useMenuList';\nimport { renderMenuList_unstable } from './renderMenuList';\nimport { useMenuListContextValues_unstable } from './useMenuListContextValues';\nimport { useMenuListStyles_unstable } from './useMenuListStyles';\nimport type { MenuListProps } from './MenuList.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Define a styled MenuList, using the `useMenuList_unstable` hook.\n */\nexport const MenuList: ForwardRefComponent<MenuListProps> = React.forwardRef((props, ref) => {\n const state = useMenuList_unstable(props, ref);\n const contextValues = useMenuListContextValues_unstable(state);\n\n useMenuListStyles_unstable(state);\n\n const { useMenuListStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderMenuList_unstable(state, contextValues);\n});\n\nMenuList.displayName = 'MenuList';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,oBAAoB,QAAQ;AACrC,SAASC,uBAAuB,QAAQ;AACxC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,0BAA0B,QAAQ;AAG3C,SAASC,4BAA4B,QAAQ;AAE7C;;;AAGA,OAAO,MAAMC,QAAA,gBAA+CN,KAAA,CAAMO,UAAU,CAAC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EAC3F,MAAMC,KAAA,GAAQT,oBAAA,CAAqBO,KAAA,EAAOC,GAAA;EAC1C,MAAME,aAAA,GAAgBR,iCAAA,CAAkCO,KAAA;EAExDN,0BAAA,CAA2BM,KAAA;EAE3B,MAAM;IAAEN,0BAAA,EAA4BQ;EAAe,CAAE,GAAGP,4BAAA;EACxDO,eAAA,CAAgBF,KAAA;EAEhB,OAAOR,uBAAA,CAAwBQ,KAAA,EAAOC,aAAA;AACxC;AAEAL,QAAA,CAASO,WAAW,GAAG"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
|
1
|
+
import * as React from 'react';
|
2
2
|
//# sourceMappingURL=MenuList.types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["React"],"sources":["../../../src/components/MenuList/MenuList.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { MenuListContextValue } from '../../contexts/menuListContext';\nimport type { SelectableHandler } from '../../selectable/index';\n\nexport type MenuCheckedValueChangeEvent = React.MouseEvent | React.KeyboardEvent;\n\nexport type MenuCheckedValueChangeData = {\n /** The items for this value that are checked */\n checkedItems: string[];\n /** The name of the value */\n name: string;\n};\n\nexport type MenuListSlots = {\n root: Slot<'div'>;\n};\n\nexport type MenuListProps = ComponentProps<MenuListSlots> & {\n /**\n * Map of all checked values\n */\n checkedValues?: Record<string, string[]>;\n\n /**\n * Default values to be checked on mount\n */\n defaultCheckedValues?: Record<string, string[]>;\n\n /**\n * States that menu items can contain selectable items and reserve slots for item alignment\n */\n hasCheckmarks?: boolean;\n\n /**\n * States that menu items can contain icons and reserve slots for item alignment\n */\n hasIcons?: boolean;\n\n /**\n * Callback when checked items change for value with a name\n *\n * @param event - React's original SyntheticEvent\n * @param data - A data object with relevant information\n */\n onCheckedValueChange?: (e: MenuCheckedValueChangeEvent, data: MenuCheckedValueChangeData) => void;\n};\n\nexport type MenuListState = ComponentState<MenuListSlots> &\n Required<Pick<MenuListProps, 'checkedValues' | 'hasCheckmarks' | 'hasIcons'>> &\n Pick<MenuListProps, 'defaultCheckedValues' | 'onCheckedValueChange'> & {\n /**\n * Selects a radio item, will de-select the currently selected ratio item\n */\n selectRadio: SelectableHandler;\n\n /**\n * Callback to set focus on the next menu item by first character\n */\n setFocusByFirstCharacter: NonNullable<MenuListContextValue['setFocusByFirstCharacter']>;\n\n /*\n * Toggles the state of a checkbox item\n */\n toggleCheckbox: SelectableHandler;\n };\n\nexport type MenuListContextValues = {\n menuList: MenuListContextValue;\n};\n\n/**\n * @deprecated this type is not being used internally anymore\n */\nexport type UninitializedMenuListState = Omit<\n MenuListState,\n 'checkedValues' | 'selectRadio' | 'setFocusByFirstCharacter' | 'toggleCheckbox'\n> &\n Partial<Pick<MenuListState, 'checkedValues'>>;\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/MenuList/index.ts"],"sourcesContent":["export * from './MenuList';\nexport * from './MenuList.types';\nexport * from './renderMenuList';\nexport * from './useMenuList';\nexport * from './useMenuListStyles';\nexport * from './useMenuListContextValues';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
@@ -11,8 +11,6 @@ export const renderMenuList_unstable = (state, contextValues) => {
|
|
11
11
|
} = getSlots(state);
|
12
12
|
return /*#__PURE__*/React.createElement(MenuListProvider, {
|
13
13
|
value: contextValues.menuList
|
14
|
-
}, /*#__PURE__*/React.createElement(slots.root,
|
15
|
-
...slotProps.root
|
16
|
-
}));
|
14
|
+
}, /*#__PURE__*/React.createElement(slots.root, slotProps.root));
|
17
15
|
};
|
18
16
|
//# sourceMappingURL=renderMenuList.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","getSlots","MenuListProvider","renderMenuList_unstable","state","contextValues","slots","slotProps","createElement","value","menuList","root"],"sources":["
|
1
|
+
{"version":3,"names":["React","getSlots","MenuListProvider","renderMenuList_unstable","state","contextValues","slots","slotProps","createElement","value","menuList","root"],"sources":["../../../src/components/MenuList/renderMenuList.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { MenuListContextValues, MenuListSlots, MenuListState } from './MenuList.types';\nimport { MenuListProvider } from '../../contexts/menuListContext';\n\n/**\n * Function that renders the final JSX of the component\n */\nexport const renderMenuList_unstable = (state: MenuListState, contextValues: MenuListContextValues) => {\n const { slots, slotProps } = getSlots<MenuListSlots>(state);\n\n return (\n <MenuListProvider value={contextValues.menuList}>\n <slots.root {...slotProps.root} />\n </MenuListProvider>\n );\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,QAAQ,QAAQ;AAEzB,SAASC,gBAAgB,QAAQ;AAEjC;;;AAGA,OAAO,MAAMC,uBAAA,GAA0BA,CAACC,KAAA,EAAsBC,aAAA,KAAyC;EACrG,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGN,QAAA,CAAwBG,KAAA;EAErD,oBACEJ,KAAA,CAAAQ,aAAA,CAACN,gBAAA;IAAiBO,KAAA,EAAOJ,aAAA,CAAcK;kBACrCV,KAAA,CAAAQ,aAAA,CAACF,KAAA,CAAMK,IAAI,EAAKJ,SAAA,CAAUI,IAAI;AAGpC"}
|
@@ -8,7 +8,6 @@ import { MenuContext } from '../../contexts/menuContext';
|
|
8
8
|
* Returns the props and state required to render the component
|
9
9
|
*/
|
10
10
|
export const useMenuList_unstable = (props, ref) => {
|
11
|
-
var _a, _b;
|
12
11
|
const {
|
13
12
|
findAllFocusable
|
14
13
|
} = useFocusFinders();
|
@@ -38,8 +37,8 @@ export const useMenuList_unstable = (props, ref) => {
|
|
38
37
|
startIndex = 0;
|
39
38
|
}
|
40
39
|
const firstChars = menuItems.map(menuItem => {
|
41
|
-
var
|
42
|
-
return (
|
40
|
+
var _menuItem_textContent;
|
41
|
+
return (_menuItem_textContent = menuItem.textContent) === null || _menuItem_textContent === void 0 ? void 0 : _menuItem_textContent.charAt(0).toLowerCase();
|
43
42
|
});
|
44
43
|
const char = e.key.toLowerCase();
|
45
44
|
const getIndexFirstChars = (start, firstChar) => {
|
@@ -61,12 +60,14 @@ export const useMenuList_unstable = (props, ref) => {
|
|
61
60
|
menuItems[index].focus();
|
62
61
|
}
|
63
62
|
}, [findAllFocusable]);
|
63
|
+
var _props_checkedValues;
|
64
64
|
const [checkedValues, setCheckedValues] = useControllableState({
|
65
|
-
state: (
|
65
|
+
state: (_props_checkedValues = props.checkedValues) !== null && _props_checkedValues !== void 0 ? _props_checkedValues : hasMenuContext ? menuContext.checkedValues : undefined,
|
66
66
|
defaultState: props.defaultCheckedValues,
|
67
67
|
initialState: {}
|
68
68
|
});
|
69
|
-
|
69
|
+
var _props_onCheckedValueChange;
|
70
|
+
const handleCheckedValueChange = (_props_onCheckedValueChange = props.onCheckedValueChange) !== null && _props_onCheckedValueChange !== void 0 ? _props_onCheckedValueChange : hasMenuContext ? menuContext.onCheckedValueChange : undefined;
|
70
71
|
const toggleCheckbox = useEventCallback((e, name, value, checked) => {
|
71
72
|
const checkedItems = (checkedValues === null || checkedValues === void 0 ? void 0 : checkedValues[name]) || [];
|
72
73
|
const newCheckedItems = [...checkedItems];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useMergedRefs","useEventCallback","useControllableState","getNativeElementProps","useArrowNavigationGroup","useFocusFinders","useHasParentContext","useMenuContext_unstable","MenuContext","useMenuList_unstable","props","ref","findAllFocusable","menuContext","useMenuContextSelectors","hasMenuContext","focusAttributes","circular","ignoreDefaultKeydown","Tab","usingPropsAndMenuContext","console","warn","innerRef","useRef","setFocusByFirstCharacter","useCallback","e","itemEl","acceptedRoles","current","menuItems","el","hasAttribute","indexOf","getAttribute","startIndex","length","firstChars","map","menuItem","_a","textContent","charAt","toLowerCase","char","key","getIndexFirstChars","start","firstChar","i","index","focus","checkedValues","setCheckedValues","state","undefined","defaultState","defaultCheckedValues","initialState","handleCheckedValueChange","_b","onCheckedValueChange","toggleCheckbox","name","value","checked","checkedItems","newCheckedItems","splice","push","s","selectRadio","components","root","role","triggerId","hasIcons","hasCheckmarks","context","contextValue","isUsingPropsAndContext","val"],"sources":["../src/packages/react-components/react-menu/src/components/MenuList/useMenuList.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n useMergedRefs,\n useEventCallback,\n useControllableState,\n getNativeElementProps,\n} from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MenuContext } from '../../contexts/menuContext';\nimport type { MenuListProps, MenuListState } from './MenuList.types';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useMenuList_unstable = (props: MenuListProps, ref: React.Ref<HTMLElement>): MenuListState => {\n const { findAllFocusable } = useFocusFinders();\n const menuContext = useMenuContextSelectors();\n const hasMenuContext = useHasParentContext(MenuContext);\n const focusAttributes = useArrowNavigationGroup({ circular: true, ignoreDefaultKeydown: { Tab: hasMenuContext } });\n\n if (usingPropsAndMenuContext(props, menuContext, hasMenuContext)) {\n // TODO throw warnings in development safely\n // eslint-disable-next-line no-console\n console.warn('You are using both MenuList and Menu props, we recommend you to use Menu props when available');\n }\n\n const innerRef = React.useRef<HTMLElement>(null);\n\n const setFocusByFirstCharacter = React.useCallback(\n (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => {\n // TODO use some kind of children registration to reduce dependency on DOM roles\n const acceptedRoles = ['menuitem', 'menuitemcheckbox', 'menuitemradio'];\n if (!innerRef.current) {\n return;\n }\n\n const menuItems = findAllFocusable(\n innerRef.current,\n (el: HTMLElement) => el.hasAttribute('role') && acceptedRoles.indexOf(el.getAttribute('role')!) !== -1,\n );\n\n let startIndex = menuItems.indexOf(itemEl) + 1;\n if (startIndex === menuItems.length) {\n startIndex = 0;\n }\n\n const firstChars = menuItems.map(menuItem => menuItem.textContent?.charAt(0).toLowerCase());\n const char = e.key.toLowerCase();\n\n const getIndexFirstChars = (start: number, firstChar: string) => {\n for (let i = start; i < firstChars.length; i++) {\n if (char === firstChars[i]) {\n return i;\n }\n }\n return -1;\n };\n\n // Check remaining slots in the menu\n let index = getIndexFirstChars(startIndex, char);\n\n // If not found in remaining slots, check from beginning\n if (index === -1) {\n index = getIndexFirstChars(0, char);\n }\n\n // If match was found...\n if (index > -1) {\n menuItems[index].focus();\n }\n },\n [findAllFocusable],\n );\n\n const [checkedValues, setCheckedValues] = useControllableState({\n state: props.checkedValues ?? (hasMenuContext ? menuContext.checkedValues : undefined),\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n\n const handleCheckedValueChange =\n props.onCheckedValueChange ?? (hasMenuContext ? menuContext.onCheckedValueChange : undefined);\n\n const toggleCheckbox = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked: boolean) => {\n const checkedItems = checkedValues?.[name] || [];\n const newCheckedItems = [...checkedItems];\n if (checked) {\n newCheckedItems.splice(newCheckedItems.indexOf(value), 1);\n } else {\n newCheckedItems.push(value);\n }\n\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n },\n );\n\n const selectRadio = useEventCallback((e: React.MouseEvent | React.KeyboardEvent, name: string, value: string) => {\n const newCheckedItems = [value];\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n });\n\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, innerRef),\n role: 'menu',\n 'aria-labelledby': menuContext.triggerId,\n ...focusAttributes,\n ...props,\n }),\n hasIcons: menuContext.hasIcons || false,\n hasCheckmarks: menuContext.hasCheckmarks || false,\n checkedValues,\n setFocusByFirstCharacter,\n selectRadio,\n toggleCheckbox,\n };\n};\n\n/**\n * Adds some sugar to fetching multiple context selector values\n */\nconst useMenuContextSelectors = () => {\n const checkedValues = useMenuContext_unstable(context => context.checkedValues);\n const onCheckedValueChange = useMenuContext_unstable(context => context.onCheckedValueChange);\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const hasIcons = useMenuContext_unstable(context => context.hasIcons);\n const hasCheckmarks = useMenuContext_unstable(context => context.hasCheckmarks);\n\n return {\n checkedValues,\n onCheckedValueChange,\n triggerId,\n hasIcons,\n hasCheckmarks,\n };\n};\n\n/**\n * Helper function to detect if props and MenuContext values are both used\n */\nconst usingPropsAndMenuContext = (\n props: MenuListProps,\n contextValue: ReturnType<typeof useMenuContextSelectors>,\n hasMenuContext: boolean,\n) => {\n let isUsingPropsAndContext = false;\n for (const val in contextValue) {\n if (props[val as keyof Omit<typeof contextValue, 'hasMenuContext' | 'onCheckedValueChange' | 'triggerId'>]) {\n isUsingPropsAndContext = true;\n }\n }\n\n return hasMenuContext && isUsingPropsAndContext;\n};\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,aAAa,EACbC,gBAAgB,EAChBC,oBAAoB,EACpBC,qBAAqB,QAChB,2BAA2B;AAClC,SAASC,uBAAuB,EAAEC,eAAe,QAAQ,yBAAyB;AAClF,SAASC,mBAAmB,QAAQ,kCAAkC;AACtE,SAASC,uBAAuB,QAAQ,4BAA4B;AACpE,SAASC,WAAW,QAAQ,4BAA4B;AAGxD;;;AAGA,OAAO,MAAMC,oBAAoB,GAAGA,CAACC,KAAoB,EAAEC,GAA2B,KAAmB;;EACvG,MAAM;IAAEC;EAAgB,CAAE,GAAGP,eAAe,EAAE;EAC9C,MAAMQ,WAAW,GAAGC,uBAAuB,EAAE;EAC7C,MAAMC,cAAc,GAAGT,mBAAmB,CAACE,WAAW,CAAC;EACvD,MAAMQ,eAAe,GAAGZ,uBAAuB,CAAC;IAAEa,QAAQ,EAAE,IAAI;IAAEC,oBAAoB,EAAE;MAAEC,GAAG,EAAEJ;IAAc;EAAE,CAAE,CAAC;EAElH,IAAIK,wBAAwB,CAACV,KAAK,EAAEG,WAAW,EAAEE,cAAc,CAAC,EAAE;IAChE;IACA;IACAM,OAAO,CAACC,IAAI,CAAC,+FAA+F,CAAC;;EAG/G,MAAMC,QAAQ,GAAGxB,KAAK,C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S,GAAGrE,uBAAuB,CAACwE,OAAO,IAAIA,OAAO,CAACH,SAAS,CAAC;EACvE,MAAMC,QAAQ,GAAGtE,uBAAuB,CAACwE,OAAO,IAAIA,OAAO,CAACF,QAAQ,CAAC;EACrE,MAAMC,aAAa,GAAGvE,uBAAuB,CAACwE,OAAO,IAAIA,OAAO,CAACD,aAAa,CAAC;EAE/E,OAAO;IACLzB,aAAa;IACbS,oBAAoB;IACpBc,SAAS;IACTC,QAAQ;IACRC;GACD;AACH,CAAC;AAED;;;AAGA,MAAM1D,wBAAwB,GAAGA,CAC/BV,KAAoB,EACpBsE,YAAwD,EACxDjE,cAAuB,KACrB;EACF,IAAIkE,sBAAsB,GAAG,KAAK;EAClC,KAAK,MAAMC,GAAG,IAAIF,YAAY,EAAE;IAC9B,IAAItE,KAAK,CAACwE,GAA+F,CAAC,EAAE;MAC1GD,sBAAsB,GAAG,IAAI;;;EAIjC,OAAOlE,cAAc,IAAIkE,sBAAsB;AACjD,CAAC"}
|
1
|
+
{"version":3,"names":["React","useMergedRefs","useEventCallback","useControllableState","getNativeElementProps","useArrowNavigationGroup","useFocusFinders","useHasParentContext","useMenuContext_unstable","MenuContext","useMenuList_unstable","props","ref","findAllFocusable","menuContext","useMenuContextSelectors","hasMenuContext","focusAttributes","circular","ignoreDefaultKeydown","Tab","usingPropsAndMenuContext","console","warn","innerRef","useRef","setFocusByFirstCharacter","useCallback","e","itemEl","acceptedRoles","current","menuItems","el","hasAttribute","indexOf","getAttribute","startIndex","length","firstChars","map","menuItem","_menuItem_textContent","textContent","charAt","toLowerCase","char","key","getIndexFirstChars","start","firstChar","i","index","focus","_props_checkedValues","checkedValues","setCheckedValues","state","undefined","defaultState","defaultCheckedValues","initialState","_props_onCheckedValueChange","handleCheckedValueChange","onCheckedValueChange","toggleCheckbox","name","value","checked","checkedItems","newCheckedItems","splice","push","s","selectRadio","components","root","role","triggerId","hasIcons","hasCheckmarks","context","contextValue","isUsingPropsAndContext","val"],"sources":["../../../src/components/MenuList/useMenuList.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n useMergedRefs,\n useEventCallback,\n useControllableState,\n getNativeElementProps,\n} from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MenuContext } from '../../contexts/menuContext';\nimport type { MenuListProps, MenuListState } from './MenuList.types';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useMenuList_unstable = (props: MenuListProps, ref: React.Ref<HTMLElement>): MenuListState => {\n const { findAllFocusable } = useFocusFinders();\n const menuContext = useMenuContextSelectors();\n const hasMenuContext = useHasParentContext(MenuContext);\n const focusAttributes = useArrowNavigationGroup({ circular: true, ignoreDefaultKeydown: { Tab: hasMenuContext } });\n\n if (usingPropsAndMenuContext(props, menuContext, hasMenuContext)) {\n // TODO throw warnings in development safely\n // eslint-disable-next-line no-console\n console.warn('You are using both MenuList and Menu props, we recommend you to use Menu props when available');\n }\n\n const innerRef = React.useRef<HTMLElement>(null);\n\n const setFocusByFirstCharacter = React.useCallback(\n (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => {\n // TODO use some kind of children registration to reduce dependency on DOM roles\n const acceptedRoles = ['menuitem', 'menuitemcheckbox', 'menuitemradio'];\n if (!innerRef.current) {\n return;\n }\n\n const menuItems = findAllFocusable(\n innerRef.current,\n (el: HTMLElement) => el.hasAttribute('role') && acceptedRoles.indexOf(el.getAttribute('role')!) !== -1,\n );\n\n let startIndex = menuItems.indexOf(itemEl) + 1;\n if (startIndex === menuItems.length) {\n startIndex = 0;\n }\n\n const firstChars = menuItems.map(menuItem => menuItem.textContent?.charAt(0).toLowerCase());\n const char = e.key.toLowerCase();\n\n const getIndexFirstChars = (start: number, firstChar: string) => {\n for (let i = start; i < firstChars.length; i++) {\n if (char === firstChars[i]) {\n return i;\n }\n }\n return -1;\n };\n\n // Check remaining slots in the menu\n let index = getIndexFirstChars(startIndex, char);\n\n // If not found in remaining slots, check from beginning\n if (index === -1) {\n index = getIndexFirstChars(0, char);\n }\n\n // If match was found...\n if (index > -1) {\n menuItems[index].focus();\n }\n },\n [findAllFocusable],\n );\n\n const [checkedValues, setCheckedValues] = useControllableState({\n state: props.checkedValues ?? (hasMenuContext ? menuContext.checkedValues : undefined),\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n\n const handleCheckedValueChange =\n props.onCheckedValueChange ?? (hasMenuContext ? menuContext.onCheckedValueChange : undefined);\n\n const toggleCheckbox = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked: boolean) => {\n const checkedItems = checkedValues?.[name] || [];\n const newCheckedItems = [...checkedItems];\n if (checked) {\n newCheckedItems.splice(newCheckedItems.indexOf(value), 1);\n } else {\n newCheckedItems.push(value);\n }\n\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n },\n );\n\n const selectRadio = useEventCallback((e: React.MouseEvent | React.KeyboardEvent, name: string, value: string) => {\n const newCheckedItems = [value];\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n });\n\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, innerRef),\n role: 'menu',\n 'aria-labelledby': menuContext.triggerId,\n ...focusAttributes,\n ...props,\n }),\n hasIcons: menuContext.hasIcons || false,\n hasCheckmarks: menuContext.hasCheckmarks || false,\n checkedValues,\n setFocusByFirstCharacter,\n selectRadio,\n toggleCheckbox,\n };\n};\n\n/**\n * Adds some sugar to fetching multiple context selector values\n */\nconst useMenuContextSelectors = () => {\n const checkedValues = useMenuContext_unstable(context => context.checkedValues);\n const onCheckedValueChange = useMenuContext_unstable(context => context.onCheckedValueChange);\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const hasIcons = useMenuContext_unstable(context => context.hasIcons);\n const hasCheckmarks = useMenuContext_unstable(context => context.hasCheckmarks);\n\n return {\n checkedValues,\n onCheckedValueChange,\n triggerId,\n hasIcons,\n hasCheckmarks,\n };\n};\n\n/**\n * Helper function to detect if props and MenuContext values are both used\n */\nconst usingPropsAndMenuContext = (\n props: MenuListProps,\n contextValue: ReturnType<typeof useMenuContextSelectors>,\n hasMenuContext: boolean,\n) => {\n let isUsingPropsAndContext = false;\n for (const val in contextValue) {\n if (props[val as keyof Omit<typeof contextValue, 'hasMenuContext' | 'onCheckedValueChange' | 'triggerId'>]) {\n isUsingPropsAndContext = true;\n }\n }\n\n return hasMenuContext && isUsingPropsAndContext;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SACEC,aAAa,EACbC,gBAAgB,EAChBC,oBAAoB,EACpBC,qBAAqB,QAChB;AACP,SAASC,uBAAuB,EAAEC,eAAe,QAAQ;AACzD,SAASC,mBAAmB,QAAQ;AACpC,SAASC,uBAAuB,QAAQ;AACxC,SAASC,WAAW,QAAQ;AAG5B;;;AAGA,OAAO,MAAMC,oBAAA,GAAuBA,CAACC,KAAA,EAAsBC,GAAA,KAA+C;EACxG,MAAM;IAAEC;EAAgB,CAAE,GAAGP,eAAA;EAC7B,MAAMQ,WAAA,GAAcC,uBAAA;EACpB,MAAMC,cAAA,GAAiBT,mBAAA,CAAoBE,WAAA;EAC3C,MAAMQ,eAAA,GAAkBZ,uBAAA,CAAwB;IAAEa,QAAA,EAAU,IAAI;IAAEC,oBAAA,EAAsB;MAAEC,GAAA,EAAKJ;IAAe;EAAE;EAEhH,IAAIK,wBAAA,CAAyBV,KAAA,EAAOG,WAAA,EAAaE,cAAA,GAAiB;IAChE;IACA;IACAM,OAAA,CAAQC,IAAI,CAAC;EACf;EAEA,MAAMC,QAAA,GAAWxB,KAAA,CAAMyB,MAAM,CAAc,IAAI;EAE/C,MAAMC,wBAAA,GAA2B1B,KAAA,CAAM2B,WAAW,CAChD,CAACC,CAAA,EA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,YAAA,EACAlE,cAAA,KACG;EACH,IAAImE,sBAAA,GAAyB,KAAK;EAClC,KAAK,MAAMC,GAAA,IAAOF,YAAA,EAAc;IAC9B,IAAIvE,KAAK,CAACyE,GAAA,CAAgG,EAAE;MAC1GD,sBAAA,GAAyB,IAAI;IAC/B;EACF;EAEA,OAAOnE,cAAA,IAAkBmE,sBAAA;AAC3B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useMenuListContextValues_unstable","state","checkedValues","hasCheckmarks","hasIcons","selectRadio","setFocusByFirstCharacter","toggleCheckbox","menuList"],"sources":["
|
1
|
+
{"version":3,"names":["useMenuListContextValues_unstable","state","checkedValues","hasCheckmarks","hasIcons","selectRadio","setFocusByFirstCharacter","toggleCheckbox","menuList"],"sources":["../../../src/components/MenuList/useMenuListContextValues.ts"],"sourcesContent":["import type { MenuListContextValues, MenuListState } from './MenuList.types';\n\nexport function useMenuListContextValues_unstable(state: MenuListState): MenuListContextValues {\n const { checkedValues, hasCheckmarks, hasIcons, selectRadio, setFocusByFirstCharacter, toggleCheckbox } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", these is no sense to memoize it\n const menuList = {\n checkedValues,\n hasCheckmarks,\n hasIcons,\n selectRadio,\n setFocusByFirstCharacter,\n toggleCheckbox,\n };\n\n return { menuList };\n}\n"],"mappings":"AAEA,OAAO,SAASA,kCAAkCC,KAAoB,EAAyB;EAC7F,MAAM;IAAEC,aAAA;IAAeC,aAAA;IAAeC,QAAA;IAAUC,WAAA;IAAaC,wBAAA;IAA0BC;EAAc,CAAE,GAAGN,KAAA;EAE1G;EACA,MAAMO,QAAA,GAAW;IACfN,aAAA;IACAC,aAAA;IACAC,QAAA;IACAC,WAAA;IACAC,wBAAA;IACAC;EACF;EAEA,OAAO;IAAEC;EAAS;AACpB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["mergeClasses","__styles","shorthands","menuListClassNames","root","useStyles","mc9l5x","Beiy3e4","i8kkvl","Belr9w4","d","useMenuListStyles_unstable","state","styles","className"],"sources":["
|
1
|
+
{"version":3,"names":["mergeClasses","__styles","shorthands","menuListClassNames","root","useStyles","mc9l5x","Beiy3e4","i8kkvl","Belr9w4","d","useMenuListStyles_unstable","state","styles","className"],"sources":["../../../src/components/MenuList/useMenuListStyles.ts"],"sourcesContent":["import type { SlotClassNames } from '@fluentui/react-utilities';\nimport { mergeClasses, makeStyles, shorthands } from '@griffel/react';\nimport type { MenuListSlots, MenuListState } from './MenuList.types';\n\nexport const menuListClassNames: SlotClassNames<MenuListSlots> = {\n root: 'fui-MenuList',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n ...shorthands.gap('2px'),\n },\n});\n\n/**\n * Apply styling to the Menu slots based on the state\n */\nexport const useMenuListStyles_unstable = (state: MenuListState): MenuListState => {\n const styles = useStyles();\n state.root.className = mergeClasses(menuListClassNames.root, styles.root, state.root.className);\n return state;\n};\n"],"mappings":"AACA,SAASA,YAAY,EAAAC,QAAA,EAAcC,UAAU,QAAQ;AAGrD,OAAO,MAAMC,kBAAA,GAAoD;EAC/DC,IAAA,EAAM;AACR;AAEA,MAAMC,SAAA,gBAAYJ,QAAA;EAAAG,IAAA;IAAAE,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,EAMlB;AAEA;;;AAGA,OAAO,MAAMC,0BAAA,GAA8BC,KAAA,IAAwC;EACjF,MAAMC,MAAA,GAASR,SAAA;EACfO,KAAA,CAAMR,IAAI,CAACU,SAAS,GAAGd,YAAA,CAAaG,kBAAA,CAAmBC,IAAI,EAAES,MAAA,CAAOT,IAAI,EAAEQ,KAAA,CAAMR,IAAI,CAACU,SAAS;EAC9F,OAAOF,KAAA;AACT"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useMenuPopover_unstable","useMenuPopoverStyles_unstable","renderMenuPopover_unstable","useCustomStyleHooks_unstable","MenuPopover","forwardRef","props","ref","state","useCustomStyles","displayName"],"sources":["
|
1
|
+
{"version":3,"names":["React","useMenuPopover_unstable","useMenuPopoverStyles_unstable","renderMenuPopover_unstable","useCustomStyleHooks_unstable","MenuPopover","forwardRef","props","ref","state","useCustomStyles","displayName"],"sources":["../../../src/components/MenuPopover/MenuPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMenuPopover_unstable } from './useMenuPopover';\nimport { useMenuPopoverStyles_unstable } from './useMenuPopoverStyles';\nimport { renderMenuPopover_unstable } from './renderMenuPopover';\nimport type { MenuPopoverProps } from './MenuPopover.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Popover intended to wrap `MenuList` and adds styling and interaction support specific to menus\n */\nexport const MenuPopover: ForwardRefComponent<MenuPopoverProps> = React.forwardRef((props, ref) => {\n const state = useMenuPopover_unstable(props, ref);\n\n useMenuPopoverStyles_unstable(state);\n\n const { useMenuPopoverStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderMenuPopover_unstable(state);\n});\n\nMenuPopover.displayName = 'MenuPopover';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,uBAAuB,QAAQ;AACxC,SAASC,6BAA6B,QAAQ;AAC9C,SAASC,0BAA0B,QAAQ;AAG3C,SAASC,4BAA4B,QAAQ;AAE7C;;;AAGA,OAAO,MAAMC,WAAA,gBAAqDL,KAAA,CAAMM,UAAU,CAAC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EACjG,MAAMC,KAAA,GAAQR,uBAAA,CAAwBM,KAAA,EAAOC,GAAA;EAE7CN,6BAAA,CAA8BO,KAAA;EAE9B,MAAM;IAAEP,6BAAA,EAA+BQ;EAAe,CAAE,GAAGN,4BAAA;EAC3DM,eAAA,CAAgBD,KAAA;EAEhB,OAAON,0BAAA,CAA2BM,KAAA;AACpC;AAEAJ,WAAA,CAAYM,WAAW,GAAG"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/MenuPopover/MenuPopover.types.ts"],"sourcesContent":["import type { PortalProps } from '@fluentui/react-portal';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type MenuPopoverSlots = {\n root: Slot<'div'>;\n};\n\n/**\n * MenuPopover Props\n */\nexport type MenuPopoverProps = ComponentProps<MenuPopoverSlots>;\n\n/**\n * State used in rendering MenuPopover\n */\nexport type MenuPopoverState = ComponentState<MenuPopoverSlots> &\n Pick<PortalProps, 'mountNode'> & {\n /**\n * Root menus are rendered out of DOM order on `document.body`, use this to render the menu in DOM order\n * This option is disregarded for submenus\n */\n inline: boolean;\n };\n"],"mappings":"AAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/MenuPopover/index.ts"],"sourcesContent":["export * from './MenuPopover';\nexport * from './MenuPopover.types';\nexport * from './renderMenuPopover';\nexport * from './useMenuPopover';\nexport * from './useMenuPopoverStyles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
@@ -10,14 +10,10 @@ export const renderMenuPopover_unstable = state => {
|
|
10
10
|
slotProps
|
11
11
|
} = getSlots(state);
|
12
12
|
if (state.inline) {
|
13
|
-
return /*#__PURE__*/React.createElement(slots.root,
|
14
|
-
...slotProps.root
|
15
|
-
});
|
13
|
+
return /*#__PURE__*/React.createElement(slots.root, slotProps.root);
|
16
14
|
}
|
17
15
|
return /*#__PURE__*/React.createElement(Portal, {
|
18
16
|
mountNode: state.mountNode
|
19
|
-
}, /*#__PURE__*/React.createElement(slots.root,
|
20
|
-
...slotProps.root
|
21
|
-
}));
|
17
|
+
}, /*#__PURE__*/React.createElement(slots.root, slotProps.root));
|
22
18
|
};
|
23
19
|
//# sourceMappingURL=renderMenuPopover.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","getSlots","Portal","renderMenuPopover_unstable","state","slots","slotProps","inline","createElement","root","mountNode"],"sources":["
|
1
|
+
{"version":3,"names":["React","getSlots","Portal","renderMenuPopover_unstable","state","slots","slotProps","inline","createElement","root","mountNode"],"sources":["../../../src/components/MenuPopover/renderMenuPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { MenuPopoverSlots, MenuPopoverState } from './MenuPopover.types';\nimport { Portal } from '@fluentui/react-portal';\n\n/**\n * Render the final JSX of MenuPopover\n */\nexport const renderMenuPopover_unstable = (state: MenuPopoverState) => {\n const { slots, slotProps } = getSlots<MenuPopoverSlots>(state);\n\n if (state.inline) {\n return <slots.root {...slotProps.root} />;\n }\n\n return (\n <Portal mountNode={state.mountNode}>\n <slots.root {...slotProps.root} />\n </Portal>\n );\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,QAAQ,QAAQ;AAEzB,SAASC,MAAM,QAAQ;AAEvB;;;AAGA,OAAO,MAAMC,0BAAA,GAA8BC,KAAA,IAA4B;EACrE,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGL,QAAA,CAA2BG,KAAA;EAExD,IAAIA,KAAA,CAAMG,MAAM,EAAE;IAChB,oBAAOP,KAAA,CAAAQ,aAAA,CAACH,KAAA,CAAMI,IAAI,EAAKH,SAAA,CAAUG,IAAI;EACvC;EAEA,oBACET,KAAA,CAAAQ,aAAA,CAACN,MAAA;IAAOQ,SAAA,EAAWN,KAAA,CAAMM;kBACvBV,KAAA,CAAAQ,aAAA,CAACH,KAAA,CAAMI,IAAI,EAAKH,SAAA,CAAUG,IAAI;AAGpC"}
|
@@ -15,7 +15,6 @@ import { useIsSubmenu } from '../../utils/useIsSubmenu';
|
|
15
15
|
* @param ref - reference to root HTMLElement of MenuPopover
|
16
16
|
*/
|
17
17
|
export const useMenuPopover_unstable = (props, ref) => {
|
18
|
-
var _a;
|
19
18
|
const popoverRef = useMenuContext_unstable(context => context.menuPopoverRef);
|
20
19
|
const setOpen = useMenuContext_unstable(context => context.setOpen);
|
21
20
|
const open = useMenuContext_unstable(context => context.open);
|
@@ -48,7 +47,8 @@ export const useMenuPopover_unstable = (props, ref) => {
|
|
48
47
|
React.useEffect(() => {
|
49
48
|
() => clearTimeout(throttleDispatchTimerRef.current);
|
50
49
|
}, []);
|
51
|
-
|
50
|
+
var _useMenuContext_unstable;
|
51
|
+
const inline = (_useMenuContext_unstable = useMenuContext_unstable(context => context.inline)) !== null && _useMenuContext_unstable !== void 0 ? _useMenuContext_unstable : false;
|
52
52
|
const mountNode = useMenuContext_unstable(context => context.mountNode);
|
53
53
|
const rootProps = getNativeElementProps('div', {
|
54
54
|
role: 'presentation',
|
@@ -71,10 +71,10 @@ export const useMenuPopover_unstable = (props, ref) => {
|
|
71
71
|
onMouseEnterOriginal === null || onMouseEnterOriginal === void 0 ? void 0 : onMouseEnterOriginal(event);
|
72
72
|
});
|
73
73
|
rootProps.onKeyDown = useEventCallback(event => {
|
74
|
-
var _a;
|
75
74
|
const key = event.key;
|
76
75
|
if (key === Escape || isSubmenu && key === CloseArrowKey) {
|
77
|
-
|
76
|
+
var _popoverRef_current;
|
77
|
+
if (open && ((_popoverRef_current = popoverRef.current) === null || _popoverRef_current === void 0 ? void 0 : _popoverRef_current.contains(event.target))) {
|
78
78
|
setOpen(event, {
|
79
79
|
open: false,
|
80
80
|
keyboard: true,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","ArrowLeft","Tab","ArrowRight","Escape","getNativeElementProps","useEventCallback","useMergedRefs","useMenuContext_unstable","dispatchMenuEnterEvent","useFluent_unstable","useFluent","useIsSubmenu","useMenuPopover_unstable","props","ref","popoverRef","context","menuPopoverRef","setOpen","open","openOnHover","isSubmenu","canDispatchCustomEventRef","useRef","throttleDispatchTimerRef","dir","CloseArrowKey","mouseOverListenerCallbackRef","useCallback","node","addEventListener","e","current","setTimeout","useEffect","clearTimeout","
|
1
|
+
{"version":3,"names":["React","ArrowLeft","Tab","ArrowRight","Escape","getNativeElementProps","useEventCallback","useMergedRefs","useMenuContext_unstable","dispatchMenuEnterEvent","useFluent_unstable","useFluent","useIsSubmenu","useMenuPopover_unstable","props","ref","popoverRef","context","menuPopoverRef","setOpen","open","openOnHover","isSubmenu","canDispatchCustomEventRef","useRef","throttleDispatchTimerRef","dir","CloseArrowKey","mouseOverListenerCallbackRef","useCallback","node","addEventListener","e","current","setTimeout","useEffect","clearTimeout","_useMenuContext_unstable","inline","mountNode","rootProps","role","onMouseEnter","onMouseEnterOriginal","onKeyDown","onKeyDownOriginal","event","keyboard","type","key","_popoverRef_current","contains","target","stopPropagation","components","root"],"sources":["../../../src/components/MenuPopover/useMenuPopover.ts"],"sourcesContent":["import * as React from 'react';\nimport { ArrowLeft, Tab, ArrowRight, Escape } from '@fluentui/keyboard-keys';\nimport { getNativeElementProps, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { MenuPopoverProps, MenuPopoverState } from './MenuPopover.types';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { dispatchMenuEnterEvent } from '../../utils/index';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\n\n/**\n * Create the state required to render MenuPopover.\n *\n * The returned state can be modified with hooks such as useMenuPopoverStyles_unstable,\n * before being passed to renderMenuPopover_unstable.\n *\n * @param props - props from this instance of MenuPopover\n * @param ref - reference to root HTMLElement of MenuPopover\n */\nexport const useMenuPopover_unstable = (props: MenuPopoverProps, ref: React.Ref<HTMLElement>): MenuPopoverState => {\n const popoverRef = useMenuContext_unstable(context => context.menuPopoverRef);\n const setOpen = useMenuContext_unstable(context => context.setOpen);\n const open = useMenuContext_unstable(context => context.open);\n const openOnHover = useMenuContext_unstable(context => context.openOnHover);\n const isSubmenu = useIsSubmenu();\n const canDispatchCustomEventRef = React.useRef(true);\n const throttleDispatchTimerRef = React.useRef(0);\n\n const { dir } = useFluent();\n const CloseArrowKey = dir === 'ltr' ? ArrowLeft : ArrowRight;\n\n // use DOM listener since react events propagate up the react tree\n // no need to do `contains` logic as menus are all positioned in different portals\n const mouseOverListenerCallbackRef = React.useCallback(\n (node: HTMLElement) => {\n if (node) {\n // Dispatches the custom menu mouse enter event with throttling\n // Needs to trigger on mouseover to support keyboard + mouse together\n // i.e. keyboard opens submenus while cursor is still on the parent\n node.addEventListener('mouseover', e => {\n if (canDispatchCustomEventRef.current) {\n canDispatchCustomEventRef.current = false;\n dispatchMenuEnterEvent(popoverRef.current as HTMLElement, e);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore #16889 Node setTimeout type leaking\n throttleDispatchTimerRef.current = setTimeout(() => (canDispatchCustomEventRef.current = true), 250);\n }\n });\n }\n },\n [popoverRef, throttleDispatchTimerRef],\n );\n\n React.useEffect(() => {\n () => clearTimeout(throttleDispatchTimerRef.current);\n }, []);\n\n const inline = useMenuContext_unstable(context => context.inline) ?? false;\n const mountNode = useMenuContext_unstable(context => context.mountNode);\n\n const rootProps = getNativeElementProps('div', {\n role: 'presentation',\n ...props,\n ref: useMergedRefs(ref, popoverRef, mouseOverListenerCallbackRef),\n });\n\n const { onMouseEnter: onMouseEnterOriginal, onKeyDown: onKeyDownOriginal } = rootProps;\n\n rootProps.onMouseEnter = useEventCallback((event: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(event, { open: true, keyboard: false, type: 'menuPopoverMouseEnter', event });\n }\n\n onMouseEnterOriginal?.(event);\n });\n\n rootProps.onKeyDown = useEventCallback((event: React.KeyboardEvent<HTMLElement>) => {\n const key = event.key;\n\n if (key === Escape || (isSubmenu && key === CloseArrowKey)) {\n if (open && popoverRef.current?.contains(event.target as HTMLElement)) {\n setOpen(event, { open: false, keyboard: true, type: 'menuPopoverKeyDown', event });\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Popover and Tooltip\n event.stopPropagation();\n }\n }\n\n if (key === Tab) {\n setOpen(event, { open: false, keyboard: true, type: 'menuPopoverKeyDown', event });\n }\n\n onKeyDownOriginal?.(event);\n });\n\n return {\n inline,\n mountNode,\n components: {\n root: 'div',\n },\n root: rootProps,\n };\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,SAAS,EAAEC,GAAG,EAAEC,UAAU,EAAEC,MAAM,QAAQ;AACnD,SAASC,qBAAqB,EAAEC,gBAAgB,EAAEC,aAAa,QAAQ;AAEvE,SAASC,uBAAuB,QAAQ;AACxC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,kBAAA,IAAsBC,SAAS,QAAQ;AAChD,SAASC,YAAY,QAAQ;AAE7B;;;;;;;;;AASA,OAAO,MAAMC,uBAAA,GAA0BA,CAACC,KAAA,EAAyBC,GAAA,KAAkD;EACjH,MAAMC,UAAA,GAAaR,uBAAA,CAAwBS,OAAA,IAAWA,OAAA,CAAQC,cAAc;EAC5E,MAAMC,OAAA,GAAUX,uBAAA,CAAwBS,OAAA,IAAWA,OAAA,CAAQE,OAAO;EAClE,MAAMC,IAAA,GAAOZ,uBAAA,CAAwBS,OAAA,IAAWA,OAAA,CAAQG,IAAI;EAC5D,MAAMC,WAAA,GAAcb,uBAAA,CAAwBS,OAAA,IAAWA,OAAA,CAAQI,WAAW;EAC1E,MAAMC,SAAA,GAAYV,YAAA;EAClB,MAAMW,yBAAA,GAA4BvB,KAAA,CAAMwB,MAAM,CAAC,IAAI;EACnD,MAAMC,wBAAA,GAA2BzB,KAAA,CAAMwB,MAAM,CAAC;EAE9C,MAAM;IAAEE;EAAG,CAAE,GAAGf,SAAA;EAChB,MAAMgB,aAAA,GAAgBD,GAAA,KAAQ,QAAQzB,SAAA,GAAYE,UAAU;EAE5D;EACA;EACA,MAAMyB,4BAAA,GAA+B5B,KAAA,CAAM6B,WAAW,CACnDC,IAAA,IAAsB;IACrB,IAAIA,IAAA,EAAM;MACR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uBG,KAAA;EACzB;EAEAN,SAAA,CAAUI,SAAS,GAAGtC,gBAAA,CAAkBwC,KAAA,IAA4C;IAClF,MAAMG,GAAA,GAAMH,KAAA,CAAMG,GAAG;IAErB,IAAIA,GAAA,KAAQ7C,MAAA,IAAWkB,SAAA,IAAa2B,GAAA,KAAQtB,aAAA,EAAgB;UAC9CuB,mBAAA;MAAZ,IAAI9B,IAAA,KAAQ,CAAA8B,mBAAA,GAAAlC,UAAA,CAAWiB,OAAO,cAAlBiB,mBAAA,uBAAAA,mBAAA,CAAoBC,QAAA,CAASL,KAAA,CAAMM,MAAM,IAAkB;QACrEjC,OAAA,CAAQ2B,KAAA,EAAO;UAAE1B,IAAA,EAAM,KAAK;UAAE2B,QAAA,EAAU,IAAI;UAAEC,IAAA,EAAM;UAAsBF;QAAM;QAChF;QACA;QACAA,KAAA,CAAMO,eAAe;MACvB;IACF;IAEA,IAAIJ,GAAA,KAAQ/C,GAAA,EAAK;MACfiB,OAAA,CAAQ2B,KAAA,EAAO;QAAE1B,IAAA,EAAM,KAAK;QAAE2B,QAAA,EAAU,IAAI;QAAEC,IAAA,EAAM;QAAsBF;MAAM;IAClF;IAEAD,iBAAA,aAAAA,iBAAA,uBAAAA,iBAAA,CAAoBC,KAAA;EACtB;EAEA,OAAO;IACLR,MAAA;IACAC,SAAA;IACAe,UAAA,EAAY;MACVC,IAAA,EAAM;IACR;IACAA,IAAA,EAAMf;EACR;AACF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["shorthands","mergeClasses","__styles","tokens","typographyStyles","menuPopoverClassNames","root","useStyles","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","De3pzq","sj55zd","Bf4jedk","B2u0y6b","a9b677","E5pizo","z8tnut","z189sj","Byoj8tv","uwmqm3","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","d","useMenuPopoverStyles_unstable","state","styles","className"],"sources":["
|
1
|
+
{"version":3,"names":["shorthands","mergeClasses","__styles","tokens","typographyStyles","menuPopoverClassNames","root","useStyles","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","De3pzq","sj55zd","Bf4jedk","B2u0y6b","a9b677","E5pizo","z8tnut","z189sj","Byoj8tv","uwmqm3","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","d","useMenuPopoverStyles_unstable","state","styles","className"],"sources":["../../../src/components/MenuPopover/useMenuPopoverStyles.ts"],"sourcesContent":["import { shorthands, mergeClasses, makeStyles } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { MenuPopoverSlots, MenuPopoverState } from './MenuPopover.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const menuPopoverClassNames: SlotClassNames<MenuPopoverSlots> = {\n root: 'fui-MenuPopover',\n};\n\nconst useStyles = makeStyles({\n root: {\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground1,\n minWidth: '128px',\n maxWidth: '300px',\n width: 'max-content',\n boxShadow: `${tokens.shadow16}`,\n ...shorthands.padding('4px'),\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n ...typographyStyles.body1,\n },\n});\n\n/**\n * Apply styling to the Menu slots based on the state\n */\nexport const useMenuPopoverStyles_unstable = (state: MenuPopoverState): MenuPopoverState => {\n const styles = useStyles();\n state.root.className = mergeClasses(menuPopoverClassNames.root, styles.root, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,YAAY,EAAAC,QAAA,QAAoB;AACrD,SAASC,MAAM,EAAEC,gBAAgB,QAAQ;AAIzC,OAAO,MAAMC,qBAAA,GAA0D;EACrEC,IAAA,EAAM;AACR;AAEA,MAAMC,SAAA,gBAAYL,QAAA;EAAAI,IAAA;IAAAE,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,EAalB;AAEA;;;AAGA,OAAO,MAAMC,6BAAA,GAAiCC,KAAA,IAA8C;EAC1F,MAAMC,MAAA,GAASlC,SAAA;EACfiC,KAAA,CAAMlC,IAAI,CAACoC,SAAS,GAAGzC,YAAA,CAAaI,qBAAA,CAAsBC,IAAI,EAAEmC,MAAA,CAAOnC,IAAI,EAAEkC,KAAA,CAAMlC,IAAI,CAACoC,SAAS;EACjG,OAAOF,KAAA;AACT"}
|