@fluentui/react-menu 0.0.0-nightlyf3ce1fbe1d20211110.1 → 0.0.0-nightlyf6116328d620220124.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +316 -30
- package/CHANGELOG.md +70 -16
- package/Spec.md +21 -16
- package/dist/react-menu.d.ts +54 -12
- package/lib/MenuSplitGroup.d.ts +1 -0
- package/lib/MenuSplitGroup.js +2 -0
- package/lib/MenuSplitGroup.js.map +1 -0
- package/lib/components/Menu/useMenu.js +30 -22
- package/lib/components/Menu/useMenu.js.map +1 -1
- package/lib/components/MenuDivider/renderMenuDivider.js +2 -1
- package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/useMenuDivider.js +3 -0
- package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
- package/lib/components/MenuDivider/useMenuDividerStyles.d.ts +1 -1
- package/lib/components/MenuDivider/useMenuDividerStyles.js +2 -1
- package/lib/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
- package/lib/components/MenuGroup/renderMenuGroup.js +2 -1
- package/lib/components/MenuGroup/renderMenuGroup.js.map +1 -1
- package/lib/components/MenuGroup/useMenuGroup.js +3 -0
- package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js +2 -1
- package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeader.js +3 -0
- package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.d.ts +1 -1
- package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +1 -0
- package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.js +0 -2
- package/lib/components/MenuItem/MenuItem.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.types.d.ts +1 -1
- package/lib/components/MenuItem/renderMenuItem.js +8 -3
- package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
- package/lib/components/MenuItem/useMenuItem.d.ts +1 -5
- package/lib/components/MenuItem/useMenuItem.js +3 -8
- package/lib/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib/components/MenuItem/useMenuItemStyles.js +26 -23
- package/lib/components/MenuItem/useMenuItemStyles.js.map +1 -1
- package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js +7 -3
- package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
- package/lib/components/MenuItemRadio/renderMenuItemRadio.js +7 -3
- package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
- package/lib/components/MenuList/renderMenuList.js +2 -1
- package/lib/components/MenuList/renderMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuList.js +3 -0
- package/lib/components/MenuList/useMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuListStyles.js +4 -3
- package/lib/components/MenuList/useMenuListStyles.js.map +1 -1
- package/lib/components/MenuPopover/renderMenuPopover.js +4 -2
- package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/useMenuPopover.js +3 -0
- package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib/components/MenuPopover/useMenuPopoverStyles.js +8 -4
- package/lib/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
- package/lib/components/MenuSplitGroup/MenuSplitGroup.d.ts +6 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.js +15 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.types.d.ts +13 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js +2 -0
- package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -0
- package/lib/components/MenuSplitGroup/index.d.ts +5 -0
- package/lib/components/MenuSplitGroup/index.js +6 -0
- package/lib/components/MenuSplitGroup/index.js.map +1 -0
- package/lib/components/MenuSplitGroup/renderMenuSplitGroup.d.ts +5 -0
- package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js +15 -0
- package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroup.d.ts +12 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroup.js +67 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.d.ts +6 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js +35 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -0
- package/lib/components/MenuTrigger/MenuTrigger.d.ts +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.js +4 -3
- package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.types.d.ts +5 -2
- package/lib/components/MenuTrigger/useMenuTrigger.d.ts +2 -1
- package/lib/components/MenuTrigger/useMenuTrigger.js +177 -5
- package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib/index.d.ts +11 -10
- package/lib/index.js +11 -10
- package/lib/index.js.map +1 -1
- package/lib/utils/useOnMenuEnter.js.map +1 -1
- package/lib-commonjs/MenuSplitGroup.d.ts +1 -0
- package/lib-commonjs/MenuSplitGroup.js +10 -0
- package/lib-commonjs/MenuSplitGroup.js.map +1 -0
- package/lib-commonjs/components/Menu/useMenu.js +35 -28
- package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/renderMenuDivider.js +2 -1
- package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDivider.js +3 -0
- package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.d.ts +1 -1
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js +2 -0
- package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/renderMenuGroup.js +2 -1
- package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js +3 -0
- package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js +2 -1
- package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js +3 -0
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.d.ts +1 -1
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +2 -0
- package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItem/MenuItem.js +0 -3
- package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/MenuItem.types.d.ts +1 -1
- package/lib-commonjs/components/MenuItem/renderMenuItem.js +8 -4
- package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItem.d.ts +1 -5
- package/lib-commonjs/components/MenuItem/useMenuItem.js +5 -10
- package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.js +27 -22
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.js.map +1 -1
- package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js +7 -4
- package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
- package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js +7 -4
- package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
- package/lib-commonjs/components/MenuList/renderMenuList.js +2 -1
- package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuList.js +3 -0
- package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuListStyles.js +3 -2
- package/lib-commonjs/components/MenuList/useMenuListStyles.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/renderMenuPopover.js +4 -2
- package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js +3 -0
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js +8 -3
- package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.d.ts +6 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js +26 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.d.ts +13 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js +6 -0
- package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/index.d.ts +5 -0
- package/lib-commonjs/components/MenuSplitGroup/index.js +18 -0
- package/lib-commonjs/components/MenuSplitGroup/index.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.d.ts +5 -0
- package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js +26 -0
- package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.d.ts +12 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js +81 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.d.ts +6 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js +47 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -0
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.d.ts +1 -1
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js +5 -5
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.d.ts +5 -2
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.d.ts +2 -1
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js +184 -5
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
- package/lib-commonjs/index.d.ts +11 -10
- package/lib-commonjs/index.js +16 -14
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
- package/package.json +17 -17
- package/lib/common/isConformant.d.ts +0 -4
- package/lib/common/isConformant.js +0 -12
- package/lib/common/isConformant.js.map +0 -1
- package/lib/common/mockUseMenuContext.d.ts +0 -7
- package/lib/common/mockUseMenuContext.js +0 -29
- package/lib/common/mockUseMenuContext.js.map +0 -1
- package/lib/components/MenuTrigger/useTriggerElement.d.ts +0 -5
- package/lib/components/MenuTrigger/useTriggerElement.js +0 -165
- package/lib/components/MenuTrigger/useTriggerElement.js.map +0 -1
- package/lib-commonjs/common/isConformant.d.ts +0 -4
- package/lib-commonjs/common/isConformant.js +0 -23
- package/lib-commonjs/common/isConformant.js.map +0 -1
- package/lib-commonjs/common/mockUseMenuContext.d.ts +0 -7
- package/lib-commonjs/common/mockUseMenuContext.js +0 -39
- package/lib-commonjs/common/mockUseMenuContext.js.map +0 -1
- package/lib-commonjs/components/MenuTrigger/useTriggerElement.d.ts +0 -5
- package/lib-commonjs/components/MenuTrigger/useTriggerElement.js +0 -180
- package/lib-commonjs/components/MenuTrigger/useTriggerElement.js.map +0 -1
@@ -0,0 +1,13 @@
|
|
1
|
+
import type { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';
|
2
|
+
export declare type MenuSplitGroupSlots = {
|
3
|
+
root: IntrinsicShorthandProps<'div'>;
|
4
|
+
};
|
5
|
+
export declare type MenuSplitGroupCommons = {};
|
6
|
+
/**
|
7
|
+
* MenuSplitGroup Props
|
8
|
+
*/
|
9
|
+
export declare type MenuSplitGroupProps = ComponentProps<MenuSplitGroupSlots> & MenuSplitGroupCommons;
|
10
|
+
/**
|
11
|
+
* State used in rendering MenuSplitGroup
|
12
|
+
*/
|
13
|
+
export declare type MenuSplitGroupState = ComponentState<MenuSplitGroupSlots> & MenuSplitGroupCommons;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
|
+
|
9
|
+
tslib_1.__exportStar(require("./MenuSplitGroup"), exports);
|
10
|
+
|
11
|
+
tslib_1.__exportStar(require("./MenuSplitGroup.types"), exports);
|
12
|
+
|
13
|
+
tslib_1.__exportStar(require("./renderMenuSplitGroup"), exports);
|
14
|
+
|
15
|
+
tslib_1.__exportStar(require("./useMenuSplitGroup"), exports);
|
16
|
+
|
17
|
+
tslib_1.__exportStar(require("./useMenuSplitGroupStyles"), exports);
|
18
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuSplitGroup/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourceRoot":""}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.renderMenuSplitGroup = void 0;
|
7
|
+
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
|
+
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
|
+
/**
|
12
|
+
* Render the final JSX of MenuSplitGroup
|
13
|
+
*/
|
14
|
+
|
15
|
+
|
16
|
+
const renderMenuSplitGroup = state => {
|
17
|
+
const {
|
18
|
+
slots,
|
19
|
+
slotProps
|
20
|
+
} = react_utilities_1.getSlots(state);
|
21
|
+
return React.createElement(slots.root, { ...slotProps.root
|
22
|
+
});
|
23
|
+
};
|
24
|
+
|
25
|
+
exports.renderMenuSplitGroup = renderMenuSplitGroup;
|
26
|
+
//# sourceMappingURL=renderMenuSplitGroup.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuSplitGroup/renderMenuSplitGroup.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,oBAAoB,GAAI,KAAD,IAA+B;AACjE,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,iBAAA,CAAA,QAAA,CAA8B,KAA9B,CAA7B;AAEA,SAAO,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourceRoot":""}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import type { MenuSplitGroupProps, MenuSplitGroupState } from './MenuSplitGroup.types';
|
3
|
+
/**
|
4
|
+
* Create the state required to render MenuSplitGroup.
|
5
|
+
*
|
6
|
+
* The returned state can be modified with hooks such as useMenuSplitGroupStyles,
|
7
|
+
* before being passed to renderMenuSplitGroup.
|
8
|
+
*
|
9
|
+
* @param props - props from this instance of MenuSplitGroup
|
10
|
+
* @param ref - reference to root HTMLElement of MenuSplitGroup
|
11
|
+
*/
|
12
|
+
export declare const useMenuSplitGroup: (props: MenuSplitGroupProps, ref: React.Ref<HTMLElement>) => MenuSplitGroupState;
|
@@ -0,0 +1,81 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useMenuSplitGroup = void 0;
|
7
|
+
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
|
+
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
|
+
|
12
|
+
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
13
|
+
|
14
|
+
const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
|
15
|
+
|
16
|
+
const keyboard_keys_1 = /*#__PURE__*/require("@fluentui/keyboard-keys");
|
17
|
+
/**
|
18
|
+
* Create the state required to render MenuSplitGroup.
|
19
|
+
*
|
20
|
+
* The returned state can be modified with hooks such as useMenuSplitGroupStyles,
|
21
|
+
* before being passed to renderMenuSplitGroup.
|
22
|
+
*
|
23
|
+
* @param props - props from this instance of MenuSplitGroup
|
24
|
+
* @param ref - reference to root HTMLElement of MenuSplitGroup
|
25
|
+
*/
|
26
|
+
|
27
|
+
|
28
|
+
const useMenuSplitGroup = (props, ref) => {
|
29
|
+
const innerRef = React.useRef();
|
30
|
+
const {
|
31
|
+
dir,
|
32
|
+
targetDocument
|
33
|
+
} = react_shared_contexts_1.useFluent();
|
34
|
+
const nextArrowKey = react_utilities_1.getRTLSafeKey(keyboard_keys_1.ArrowRight, dir);
|
35
|
+
const prevArrowKey = react_utilities_1.getRTLSafeKey(keyboard_keys_1.ArrowLeft, dir);
|
36
|
+
const {
|
37
|
+
findNextFocusable,
|
38
|
+
findPrevFocusable
|
39
|
+
} = react_tabster_1.useFocusFinders();
|
40
|
+
const onKeyDown = React.useCallback(e => {
|
41
|
+
var _a;
|
42
|
+
|
43
|
+
const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
|
44
|
+
|
45
|
+
if (!activeElement) {
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
|
49
|
+
if (!((_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.contains(activeElement))) {
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
|
53
|
+
if (e.key === nextArrowKey) {
|
54
|
+
const next = findNextFocusable(activeElement, {
|
55
|
+
container: innerRef.current
|
56
|
+
});
|
57
|
+
next === null || next === void 0 ? void 0 : next.focus();
|
58
|
+
}
|
59
|
+
|
60
|
+
if (e.key === prevArrowKey) {
|
61
|
+
const prev = findPrevFocusable(activeElement, {
|
62
|
+
container: innerRef.current
|
63
|
+
});
|
64
|
+
prev === null || prev === void 0 ? void 0 : prev.focus();
|
65
|
+
}
|
66
|
+
}, [findNextFocusable, findPrevFocusable, targetDocument, nextArrowKey, prevArrowKey]);
|
67
|
+
return {
|
68
|
+
components: {
|
69
|
+
root: 'div'
|
70
|
+
},
|
71
|
+
root: react_utilities_1.getNativeElementProps('div', {
|
72
|
+
role: 'group',
|
73
|
+
ref: react_utilities_1.useMergedRefs(ref, innerRef),
|
74
|
+
onKeyDown,
|
75
|
+
...props
|
76
|
+
})
|
77
|
+
};
|
78
|
+
};
|
79
|
+
|
80
|
+
exports.useMenuSplitGroup = useMenuSplitGroup;
|
81
|
+
//# sourceMappingURL=useMenuSplitGroup.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuSplitGroup/useMenuSplitGroup.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AAEA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,iBAAiB,GAAG,CAAC,KAAD,EAA6B,GAA7B,KAAiF;AAChH,QAAM,QAAQ,GAAG,KAAK,CAAC,MAAN,EAAjB;AACA,QAAM;AAAE,IAAA,GAAF;AAAO,IAAA;AAAP,MAA0B,uBAAA,CAAA,SAAA,EAAhC;AAEA,QAAM,YAAY,GAAG,iBAAA,CAAA,aAAA,CAAc,eAAA,CAAA,UAAd,EAA0B,GAA1B,CAArB;AACA,QAAM,YAAY,GAAG,iBAAA,CAAA,aAAA,CAAc,eAAA,CAAA,SAAd,EAAyB,GAAzB,CAArB;AAEA,QAAM;AAAE,IAAA,iBAAF;AAAqB,IAAA;AAArB,MAA2C,eAAA,CAAA,eAAA,EAAjD;AAEA,QAAM,SAAS,GAAG,KAAK,CAAC,WAAN,CACf,CAAD,IAAwC;;;AACtC,UAAM,aAAa,GAAG,cAAc,KAAA,IAAd,IAAA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,aAAtC;;AACA,QAAI,CAAC,aAAL,EAAoB;AAClB;AACD;;AAED,QAAI,EAAC,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAT,MAAgB,IAAh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+
export declare const menuSplitGroupClassName = "fui-MenuSplitGroup";
|
3
|
+
/**
|
4
|
+
* Apply styling to the MenuSplitGroup slots based on the state
|
5
|
+
*/
|
6
|
+
export declare const useMenuSplitGroupStyles: (state: MenuSplitGroupState) => MenuSplitGroupState;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useMenuSplitGroupStyles = exports.menuSplitGroupClassName = void 0;
|
7
|
+
|
8
|
+
const react_make_styles_1 = /*#__PURE__*/require("@fluentui/react-make-styles");
|
9
|
+
|
10
|
+
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
11
|
+
|
12
|
+
const useMenuItemStyles_1 = /*#__PURE__*/require("../MenuItem/useMenuItemStyles");
|
13
|
+
|
14
|
+
exports.menuSplitGroupClassName = 'fui-MenuSplitGroup';
|
15
|
+
/**
|
16
|
+
* Styles for the root slot
|
17
|
+
*/
|
18
|
+
|
19
|
+
const useStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
20
|
+
"root": {
|
21
|
+
"mc9l5x": "f22iagw",
|
22
|
+
"u7v6m2": "f168awwq",
|
23
|
+
"Bo1wru1": ["f1om2jlk", "fcyhg04"],
|
24
|
+
"Bhkyaub": ["fgqgg70", "fqo1hry"],
|
25
|
+
"J9ixe0": ["fh1zedf", "f1auaj6e"],
|
26
|
+
"rj29m3": ["fokbbcd", "f1xlvh9o"],
|
27
|
+
"lispf9": "f1et5qag",
|
28
|
+
"B9hwub1": "f13ngu1f",
|
29
|
+
"dvf9w6": "f1db9j62",
|
30
|
+
"Hjn5ok": "f92z21p"
|
31
|
+
}
|
32
|
+
}, {
|
33
|
+
"d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f168awwq>.fui-MenuItem:nth-child(1){width:100%;}", ".f1om2jlk>.fui-MenuItem:nth-child(2){border-top-left-radius:0;}", ".fcyhg04>.fui-MenuItem:nth-child(2){border-top-right-radius:0;}", ".fgqgg70>.fui-MenuItem:nth-child(2){border-bottom-left-radius:0;}", ".fqo1hry>.fui-MenuItem:nth-child(2){border-bottom-right-radius:0;}", ".fh1zedf>.fui-MenuItem:nth-child(2){padding-left:0;}", ".f1auaj6e>.fui-MenuItem:nth-child(2){padding-right:0;}", ".fokbbcd>.fui-MenuItem:nth-child(2){margin-left:auto;}", ".f1xlvh9o>.fui-MenuItem:nth-child(2){margin-right:auto;}", ".f1et5qag>.fui-MenuItem:nth-child(2):before{content:\"\";}", ".f13ngu1f>.fui-MenuItem:nth-child(2):before{width:var(--strokeWidthThin);}", ".f1db9j62>.fui-MenuItem:nth-child(2):before{height:24px;}", ".f92z21p>.fui-MenuItem:nth-child(2):before{background-color:var(--colorNeutralStroke1);}"]
|
34
|
+
});
|
35
|
+
/**
|
36
|
+
* Apply styling to the MenuSplitGroup slots based on the state
|
37
|
+
*/
|
38
|
+
|
39
|
+
|
40
|
+
const useMenuSplitGroupStyles = state => {
|
41
|
+
const styles = useStyles();
|
42
|
+
state.root.className = react_make_styles_1.mergeClasses(exports.menuSplitGroupClassName, styles.root, state.root.className);
|
43
|
+
return state;
|
44
|
+
};
|
45
|
+
|
46
|
+
exports.useMenuSplitGroupStyles = useMenuSplitGroupStyles;
|
47
|
+
//# sourceMappingURL=useMenuSplitGroupStyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuSplitGroup/useMenuSplitGroupStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,+BAAA,CAAA;;AAGa,OAAA,CAAA,uBAAA,GAA0B,oBAA1B;AAEb;;AAEG;;AACH,MAAM,SAAS,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAqBA;;AAEG;;;AACI,MAAM,uBAAuB,GAAI,KAAD,IAAoD;AACzF,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,mBAAA,CAAA,YAAA,CAAa,OAAA,CAAA,uBAAb,EAAsC,MAAM,CAAC,IAA7C,EAAmD,KAAK,CAAC,IAAN,CAAW,SAA9D,CAAvB;AACA,SAAO,KAAP;AACD,CAJM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB","sourceRoot":""}
|
@@ -4,4 +4,4 @@ import type { MenuTriggerProps } from './MenuTrigger.types';
|
|
4
4
|
* Wraps a trigger element as an only child
|
5
5
|
* and adds the necessary event handling to open a popup menu
|
6
6
|
*/
|
7
|
-
export declare const MenuTrigger: React.
|
7
|
+
export declare const MenuTrigger: React.ForwardRefExoticComponent<MenuTriggerProps & React.RefAttributes<HTMLElement>>;
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.MenuTrigger = void 0;
|
7
7
|
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
|
+
|
8
10
|
const useMenuTrigger_1 = /*#__PURE__*/require("./useMenuTrigger");
|
9
11
|
|
10
12
|
const renderMenuTrigger_1 = /*#__PURE__*/require("./renderMenuTrigger");
|
@@ -14,11 +16,9 @@ const renderMenuTrigger_1 = /*#__PURE__*/require("./renderMenuTrigger");
|
|
14
16
|
*/
|
15
17
|
|
16
18
|
|
17
|
-
|
18
|
-
const state = useMenuTrigger_1.useMenuTrigger(props);
|
19
|
+
exports.MenuTrigger = /*#__PURE__*/React.forwardRef((props, ref) => {
|
20
|
+
const state = useMenuTrigger_1.useMenuTrigger(props, ref);
|
19
21
|
return renderMenuTrigger_1.renderMenuTrigger(state);
|
20
|
-
};
|
21
|
-
|
22
|
-
exports.MenuTrigger = MenuTrigger;
|
22
|
+
});
|
23
23
|
exports.MenuTrigger.displayName = 'MenuTrigger';
|
24
24
|
//# sourceMappingURL=MenuTrigger.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuTrigger/MenuTrigger.tsx"],"names":[],"mappings":";;;;;;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;AAGA;;;AAGG;;;
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuTrigger/MenuTrigger.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;AAGA;;;AAGG;;;AACU,OAAA,CAAA,WAAA,gBAAc,KAAK,CAAC,UAAN,CAAgD,CAAC,KAAD,EAAQ,GAAR,KAAe;AACxF,QAAM,KAAK,GAAG,gBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,GAAtB,CAAd;AAEA,SAAO,mBAAA,CAAA,iBAAA,CAAkB,KAAlB,CAAP;AACD,CAJ0B,CAAd;AAMb,OAAA,CAAA,WAAA,CAAY,WAAZ,GAA0B,aAA1B","sourceRoot":""}
|
@@ -10,7 +10,10 @@ export declare type MenuTriggerProps = {
|
|
10
10
|
/**
|
11
11
|
* Props that are passed to the child of the MenuTrigger when cloned to ensure correct behaviour for the Menu
|
12
12
|
*/
|
13
|
-
export declare type MenuTriggerChildProps = Required<Pick<React.HTMLAttributes<HTMLElement>, 'onClick' | 'onMouseEnter' | 'onMouseLeave' | '
|
13
|
+
export declare type MenuTriggerChildProps = Required<Pick<React.HTMLAttributes<HTMLElement>, 'onClick' | 'onMouseEnter' | 'onMouseLeave' | 'onMouseMove' | 'onContextMenu' | 'onKeyDown' | 'aria-haspopup' | 'id'>> & {
|
14
14
|
ref?: React.Ref<never>;
|
15
|
+
'aria-expanded': boolean | undefined;
|
16
|
+
};
|
17
|
+
export declare type MenuTriggerState = {
|
18
|
+
children: React.ReactNode;
|
15
19
|
};
|
16
|
-
export declare type MenuTriggerState = MenuTriggerProps;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import * as React from 'react';
|
1
2
|
import type { MenuTriggerProps, MenuTriggerState } from './MenuTrigger.types';
|
2
3
|
/**
|
3
4
|
* Create the state required to render MenuTrigger.
|
@@ -5,4 +6,4 @@ import type { MenuTriggerProps, MenuTriggerState } from './MenuTrigger.types';
|
|
5
6
|
*
|
6
7
|
* @param props - props from this instance of MenuTrigger
|
7
8
|
*/
|
8
|
-
export declare const useMenuTrigger: (props: MenuTriggerProps) => MenuTriggerState;
|
9
|
+
export declare const useMenuTrigger: (props: MenuTriggerProps, ref: React.Ref<HTMLElement>) => MenuTriggerState;
|
@@ -5,7 +5,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.useMenuTrigger = void 0;
|
7
7
|
|
8
|
-
const
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
|
+
|
10
|
+
const menuContext_1 = /*#__PURE__*/require("../../contexts/menuContext");
|
11
|
+
|
12
|
+
const useIsSubmenu_1 = /*#__PURE__*/require("../../utils/useIsSubmenu");
|
13
|
+
|
14
|
+
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
15
|
+
|
16
|
+
const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
|
17
|
+
|
18
|
+
const keyboard_keys_1 = /*#__PURE__*/require("@fluentui/keyboard-keys");
|
19
|
+
|
20
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
21
|
+
|
22
|
+
const react_utilities_2 = /*#__PURE__*/require("@fluentui/react-utilities");
|
9
23
|
/**
|
10
24
|
* Create the state required to render MenuTrigger.
|
11
25
|
* Clones the only child component and adds necessary event handling behaviours to open a popup menu
|
@@ -14,12 +28,177 @@ const useTriggerElement_1 = /*#__PURE__*/require("./useTriggerElement");
|
|
14
28
|
*/
|
15
29
|
|
16
30
|
|
17
|
-
const useMenuTrigger = props => {
|
18
|
-
|
19
|
-
|
31
|
+
const useMenuTrigger = (props, ref) => {
|
32
|
+
var _a;
|
33
|
+
|
34
|
+
const {
|
35
|
+
children,
|
36
|
+
...rest
|
37
|
+
} = props;
|
38
|
+
const triggerRef = menuContext_1.useMenuContext(context => context.triggerRef);
|
39
|
+
const menuPopoverRef = menuContext_1.useMenuContext(context => context.menuPopoverRef);
|
40
|
+
const setOpen = menuContext_1.useMenuContext(context => context.setOpen);
|
41
|
+
const open = menuContext_1.useMenuContext(context => context.open);
|
42
|
+
const triggerId = menuContext_1.useMenuContext(context => context.triggerId);
|
43
|
+
const openOnHover = menuContext_1.useMenuContext(context => context.openOnHover);
|
44
|
+
const openOnContext = menuContext_1.useMenuContext(context => context.openOnContext);
|
45
|
+
const isSubmenu = useIsSubmenu_1.useIsSubmenu();
|
46
|
+
const {
|
47
|
+
findFirstFocusable
|
48
|
+
} = react_tabster_1.useFocusFinders();
|
49
|
+
const focusFirst = React.useCallback(() => {
|
50
|
+
const firstFocusable = findFirstFocusable(menuPopoverRef.current);
|
51
|
+
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
52
|
+
}, [findFirstFocusable, menuPopoverRef]);
|
53
|
+
const openedWithKeyboardRef = React.useRef(false);
|
54
|
+
const hasMouseMoved = React.useRef(false);
|
55
|
+
const {
|
56
|
+
dir
|
57
|
+
} = react_shared_contexts_1.useFluent();
|
58
|
+
const OpenArrowKey = dir === 'ltr' ? keyboard_keys_1.ArrowRight : keyboard_keys_1.ArrowLeft;
|
59
|
+
const child = React.isValidElement(children) ? react_utilities_1.onlyChild(children) : undefined;
|
60
|
+
|
61
|
+
const onContextMenu = e => {
|
62
|
+
if (isTargetDisabled(e)) {
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
|
66
|
+
if (openOnContext) {
|
67
|
+
e.preventDefault();
|
68
|
+
setOpen(e, {
|
69
|
+
open: true,
|
70
|
+
keyboard: false
|
71
|
+
});
|
72
|
+
}
|
73
|
+
};
|
74
|
+
|
75
|
+
const onClick = e => {
|
76
|
+
if (isTargetDisabled(e)) {
|
77
|
+
return;
|
78
|
+
}
|
79
|
+
|
80
|
+
if (!openOnContext) {
|
81
|
+
setOpen(e, {
|
82
|
+
open: !open,
|
83
|
+
keyboard: openedWithKeyboardRef.current
|
84
|
+
});
|
85
|
+
openedWithKeyboardRef.current = false;
|
86
|
+
}
|
87
|
+
};
|
88
|
+
|
89
|
+
const onKeyDown = e => {
|
90
|
+
var _a;
|
91
|
+
|
92
|
+
if (isTargetDisabled(e)) {
|
93
|
+
return;
|
94
|
+
}
|
95
|
+
|
96
|
+
if (react_utilities_2.shouldPreventDefaultOnKeyDown(e)) {
|
97
|
+
e.preventDefault();
|
98
|
+
openedWithKeyboardRef.current = true;
|
99
|
+
(_a = e.target) === null || _a === void 0 ? void 0 : _a.click();
|
100
|
+
}
|
101
|
+
|
102
|
+
const key = e.key;
|
103
|
+
|
104
|
+
if (!openOnContext && (isSubmenu && key === OpenArrowKey || !isSubmenu && key === keyboard_keys_1.ArrowDown)) {
|
105
|
+
setOpen(e, {
|
106
|
+
open: true,
|
107
|
+
keyboard: true
|
108
|
+
});
|
109
|
+
}
|
20
110
|
|
21
|
-
|
111
|
+
if (key === keyboard_keys_1.Escape && !isSubmenu) {
|
112
|
+
setOpen(e, {
|
113
|
+
open: false,
|
114
|
+
keyboard: true
|
115
|
+
});
|
116
|
+
} // if menu is already open, can't rely on effects to focus
|
117
|
+
|
118
|
+
|
119
|
+
if (open && key === OpenArrowKey && isSubmenu) {
|
120
|
+
focusFirst();
|
121
|
+
}
|
122
|
+
};
|
123
|
+
|
124
|
+
const onMouseEnter = e => {
|
125
|
+
if (isTargetDisabled(e)) {
|
126
|
+
return;
|
127
|
+
}
|
128
|
+
|
129
|
+
if (openOnHover && hasMouseMoved.current) {
|
130
|
+
setOpen(e, {
|
131
|
+
open: true,
|
132
|
+
keyboard: false
|
133
|
+
});
|
134
|
+
}
|
135
|
+
}; // Opening a menu when a mouse hasn't moved and just entering the trigger is a bad a11y experience
|
136
|
+
// First time open the mouse using mousemove and then continue with mouseenter
|
137
|
+
// Only use once to determine that the user is using the mouse since it is an expensive event to handle
|
138
|
+
|
139
|
+
|
140
|
+
const onMouseMove = e => {
|
141
|
+
if (isTargetDisabled(e)) {
|
142
|
+
return;
|
143
|
+
}
|
144
|
+
|
145
|
+
if (openOnHover && !hasMouseMoved.current) {
|
146
|
+
setOpen(e, {
|
147
|
+
open: true,
|
148
|
+
keyboard: false
|
149
|
+
});
|
150
|
+
hasMouseMoved.current = true;
|
151
|
+
}
|
152
|
+
};
|
153
|
+
|
154
|
+
const onMouseLeave = e => {
|
155
|
+
if (isTargetDisabled(e)) {
|
156
|
+
return;
|
157
|
+
}
|
158
|
+
|
159
|
+
if (openOnHover) {
|
160
|
+
setOpen(e, {
|
161
|
+
open: false,
|
162
|
+
keyboard: false
|
163
|
+
});
|
164
|
+
}
|
165
|
+
};
|
166
|
+
|
167
|
+
const overrideProps = {
|
168
|
+
'aria-haspopup': 'menu',
|
169
|
+
'aria-expanded': open,
|
170
|
+
id: ((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.id) || triggerId,
|
171
|
+
onClick,
|
172
|
+
onMouseEnter,
|
173
|
+
onMouseLeave,
|
174
|
+
onKeyDown,
|
175
|
+
onContextMenu,
|
176
|
+
onMouseMove
|
177
|
+
};
|
178
|
+
|
179
|
+
if (!open && !isSubmenu) {
|
180
|
+
overrideProps['aria-expanded'] = undefined;
|
181
|
+
}
|
182
|
+
|
183
|
+
return {
|
184
|
+
children: react_utilities_1.useTriggerElement({
|
185
|
+
children,
|
186
|
+
ref: react_utilities_1.useMergedRefs(triggerRef, ref),
|
187
|
+
outerProps: rest,
|
188
|
+
overrideProps
|
189
|
+
})
|
190
|
+
};
|
22
191
|
};
|
23
192
|
|
24
193
|
exports.useMenuTrigger = useMenuTrigger;
|
194
|
+
|
195
|
+
const isTargetDisabled = e => {
|
196
|
+
const isDisabled = el => el.hasAttribute('disabled') || el.hasAttribute('aria-disabled') && el.getAttribute('aria-disabled') === 'true';
|
197
|
+
|
198
|
+
if (e.target instanceof HTMLElement && isDisabled(e.target)) {
|
199
|
+
return true;
|
200
|
+
}
|
201
|
+
|
202
|
+
return e.currentTarget instanceof HTMLElement && isDisabled(e.currentTarget);
|
203
|
+
};
|
25
204
|
//# sourceMappingURL=useMenuTrigger.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuTrigger/useMenuTrigger.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuTrigger/useMenuTrigger.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAEA,MAAA,aAAA,gBAAA,OAAA,CAAA,4BAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAEA;;;;;AAKG;;;AACI,MAAM,cAAc,GAAG,CAAC,KAAD,EAA0B,GAA1B,KAA2E;;;AACvG,QAAM;AAAE,IAAA,QAAF;AAAY,OAAG;AAAf,MAAwB,KAA9B;AAEA,QAAM,UAAU,GAAG,aAAA,CAAA,cAAA,CAAe,OAAO,IAAI,OAAO,CAAC,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AED,SAAO,CAAC,CAAC,aAAF,YAA2B,WAA3B,IAA0C,UAAU,CAAC,CAAC,CAAC,aAAH,CAA3D;AACD,CARD","sourceRoot":""}
|
package/lib-commonjs/index.d.ts
CHANGED
@@ -1,15 +1,16 @@
|
|
1
|
-
export * from './MenuItem';
|
2
|
-
export * from './MenuList';
|
3
|
-
export * from './MenuItemCheckbox';
|
4
|
-
export * from './MenuItemRadio';
|
5
|
-
export * from './MenuDivider';
|
6
|
-
export * from './MenuGroupHeader';
|
7
|
-
export * from './MenuGroup';
|
8
|
-
export * from './selectable/index';
|
9
|
-
export * from './MenuTrigger';
|
10
|
-
export * from './Menu';
|
11
1
|
export * from './contexts/menuContext';
|
12
2
|
export * from './contexts/menuTriggerContext';
|
13
3
|
export * from './contexts/menuGroupContext';
|
14
4
|
export * from './contexts/menuListContext';
|
5
|
+
export * from './Menu';
|
6
|
+
export * from './MenuDivider';
|
7
|
+
export * from './MenuGroup';
|
8
|
+
export * from './MenuGroupHeader';
|
9
|
+
export * from './MenuItem';
|
10
|
+
export * from './MenuItemCheckbox';
|
11
|
+
export * from './MenuItemRadio';
|
12
|
+
export * from './MenuList';
|
15
13
|
export * from './MenuPopover';
|
14
|
+
export * from './MenuSplitGroup';
|
15
|
+
export * from './MenuTrigger';
|
16
|
+
export * from './selectable/index';
|
package/lib-commonjs/index.js
CHANGED
@@ -6,33 +6,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
|
7
7
|
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
8
|
|
9
|
-
tslib_1.__exportStar(require("./
|
9
|
+
tslib_1.__exportStar(require("./contexts/menuContext"), exports);
|
10
10
|
|
11
|
-
tslib_1.__exportStar(require("./
|
11
|
+
tslib_1.__exportStar(require("./contexts/menuTriggerContext"), exports);
|
12
12
|
|
13
|
-
tslib_1.__exportStar(require("./
|
13
|
+
tslib_1.__exportStar(require("./contexts/menuGroupContext"), exports);
|
14
14
|
|
15
|
-
tslib_1.__exportStar(require("./
|
15
|
+
tslib_1.__exportStar(require("./contexts/menuListContext"), exports);
|
16
16
|
|
17
|
-
tslib_1.__exportStar(require("./
|
17
|
+
tslib_1.__exportStar(require("./Menu"), exports);
|
18
18
|
|
19
|
-
tslib_1.__exportStar(require("./
|
19
|
+
tslib_1.__exportStar(require("./MenuDivider"), exports);
|
20
20
|
|
21
21
|
tslib_1.__exportStar(require("./MenuGroup"), exports);
|
22
22
|
|
23
|
-
tslib_1.__exportStar(require("./
|
23
|
+
tslib_1.__exportStar(require("./MenuGroupHeader"), exports);
|
24
24
|
|
25
|
-
tslib_1.__exportStar(require("./
|
25
|
+
tslib_1.__exportStar(require("./MenuItem"), exports);
|
26
26
|
|
27
|
-
tslib_1.__exportStar(require("./
|
27
|
+
tslib_1.__exportStar(require("./MenuItemCheckbox"), exports);
|
28
28
|
|
29
|
-
tslib_1.__exportStar(require("./
|
29
|
+
tslib_1.__exportStar(require("./MenuItemRadio"), exports);
|
30
30
|
|
31
|
-
tslib_1.__exportStar(require("./
|
31
|
+
tslib_1.__exportStar(require("./MenuList"), exports);
|
32
32
|
|
33
|
-
tslib_1.__exportStar(require("./
|
33
|
+
tslib_1.__exportStar(require("./MenuPopover"), exports);
|
34
34
|
|
35
|
-
tslib_1.__exportStar(require("./
|
35
|
+
tslib_1.__exportStar(require("./MenuSplitGroup"), exports);
|
36
36
|
|
37
|
-
tslib_1.__exportStar(require("./
|
37
|
+
tslib_1.__exportStar(require("./MenuTrigger"), exports);
|
38
|
+
|
39
|
+
tslib_1.__exportStar(require("./selectable/index"), exports);
|
38
40
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAA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