@fluentui/react-menu 9.13.7 → 9.14.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +33 -2
- package/dist/index.d.ts +39 -0
- package/lib/MenuItemSwitch.js +1 -0
- package/lib/MenuItemSwitch.js.map +1 -0
- package/lib/components/Menu/useMenu.js +4 -14
- package/lib/components/Menu/useMenu.js.map +1 -1
- package/lib/components/MenuItemSwitch/MenuItemSwitch.js +12 -0
- package/lib/components/MenuItemSwitch/MenuItemSwitch.js.map +1 -0
- package/lib/components/MenuItemSwitch/MenuItemSwitch.types.js +1 -0
- package/lib/components/MenuItemSwitch/MenuItemSwitch.types.js.map +1 -0
- package/lib/components/MenuItemSwitch/index.js +5 -0
- package/lib/components/MenuItemSwitch/index.js.map +1 -0
- package/lib/components/MenuItemSwitch/renderMenuItemSwitch.js +15 -0
- package/lib/components/MenuItemSwitch/renderMenuItemSwitch.js.map +1 -0
- package/lib/components/MenuItemSwitch/useMenuItemSwitch.js +32 -0
- package/lib/components/MenuItemSwitch/useMenuItemSwitch.js.map +1 -0
- package/lib/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.js +83 -0
- package/lib/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.js.map +1 -0
- package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js +2 -2
- package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib-commonjs/MenuItemSwitch.js +6 -0
- package/lib-commonjs/MenuItemSwitch.js.map +1 -0
- package/lib-commonjs/components/Menu/useMenu.js +3 -13
- package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
- package/lib-commonjs/components/MenuItemSwitch/MenuItemSwitch.js +23 -0
- package/lib-commonjs/components/MenuItemSwitch/MenuItemSwitch.js.map +1 -0
- package/lib-commonjs/components/MenuItemSwitch/MenuItemSwitch.types.js +4 -0
- package/lib-commonjs/components/MenuItemSwitch/MenuItemSwitch.types.js.map +1 -0
- package/lib-commonjs/components/MenuItemSwitch/index.js +10 -0
- package/lib-commonjs/components/MenuItemSwitch/index.js.map +1 -0
- package/lib-commonjs/components/MenuItemSwitch/renderMenuItemSwitch.js +23 -0
- package/lib-commonjs/components/MenuItemSwitch/renderMenuItemSwitch.js.map +1 -0
- package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitch.js +35 -0
- package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitch.js.map +1 -0
- package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.js +154 -0
- package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.js.map +1 -0
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js +2 -2
- package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js.map +1 -1
- package/lib-commonjs/index.js +16 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,43 @@
|
|
1
1
|
# Change Log - @fluentui/react-menu
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Thu, 02 May 2024 11:31:27 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.14.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-menu_v9.14.1)
|
8
|
+
|
9
|
+
Thu, 02 May 2024 11:31:27 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-menu_v9.14.0..@fluentui/react-menu_v9.14.1)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- chore: upgrade @fluentui/react-icons to 2.0.237. ([PR #31139](https://github.com/microsoft/fluentui/pull/31139) by ololubek@microsoft.com)
|
15
|
+
- daniharo:fix-menu-split ([PR #30959](https://github.com/microsoft/fluentui/pull/30959) by lingfangao@hotmail.com)
|
16
|
+
- refactor: use timeout and animation frame utilities ([PR #31168](https://github.com/microsoft/fluentui/pull/31168) by lingfangao@hotmail.com)
|
17
|
+
- Bump @fluentui/react-aria to v9.11.0 ([PR #31231](https://github.com/microsoft/fluentui/pull/31231) by beachball)
|
18
|
+
- Bump @fluentui/react-portal to v9.4.22 ([PR #31231](https://github.com/microsoft/fluentui/pull/31231) by beachball)
|
19
|
+
- Bump @fluentui/react-tabster to v9.21.0 ([PR #31231](https://github.com/microsoft/fluentui/pull/31231) by beachball)
|
20
|
+
|
21
|
+
## [9.14.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-menu_v9.14.0)
|
22
|
+
|
23
|
+
Tue, 23 Apr 2024 08:17:47 GMT
|
24
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-menu_v9.13.7..@fluentui/react-menu_v9.14.0)
|
25
|
+
|
26
|
+
### Minor changes
|
27
|
+
|
28
|
+
- feat: Implement MenuItemSwitch component ([PR #31099](https://github.com/microsoft/fluentui/pull/31099) by lingfangao@hotmail.com)
|
29
|
+
- Bump @fluentui/react-aria to v9.10.5 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
30
|
+
- Bump @fluentui/react-context-selector to v9.1.58 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
31
|
+
- Bump @fluentui/react-portal to v9.4.21 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
32
|
+
- Bump @fluentui/react-positioning to v9.14.4 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
33
|
+
- Bump @fluentui/react-shared-contexts to v9.17.0 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
34
|
+
- Bump @fluentui/react-tabster to v9.20.1 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
35
|
+
- Bump @fluentui/react-utilities to v9.18.7 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
36
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.36 ([PR #31113](https://github.com/microsoft/fluentui/pull/31113) by beachball)
|
37
|
+
|
7
38
|
## [9.13.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-menu_v9.13.7)
|
8
39
|
|
9
|
-
Wed, 17 Apr 2024 21:
|
40
|
+
Wed, 17 Apr 2024 21:53:54 GMT
|
10
41
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-menu_v9.13.6..@fluentui/react-menu_v9.13.7)
|
11
42
|
|
12
43
|
### Patches
|
package/dist/index.d.ts
CHANGED
@@ -257,6 +257,24 @@ export declare type MenuItemSlots = {
|
|
257
257
|
|
258
258
|
export declare type MenuItemState = ComponentState<MenuItemSlots> & Required<Pick<MenuItemProps, 'disabled' | 'hasSubmenu' | 'persistOnClick'>>;
|
259
259
|
|
260
|
+
export declare const MenuItemSwitch: ForwardRefComponent<MenuItemSwitchProps>;
|
261
|
+
|
262
|
+
export declare const menuItemSwitchClassNames: SlotClassNames<MenuItemSwitchSlots>;
|
263
|
+
|
264
|
+
/**
|
265
|
+
* MenuItemSwitch Props
|
266
|
+
*/
|
267
|
+
export declare type MenuItemSwitchProps = ComponentProps<MenuItemSwitchSlots> & Pick<MenuItemCheckboxProps, 'disabled' | 'persistOnClick' | 'name' | 'value'>;
|
268
|
+
|
269
|
+
export declare type MenuItemSwitchSlots = Pick<MenuItemSlots, 'root' | 'content' | 'secondaryContent' | 'icon'> & {
|
270
|
+
switchIndicator?: Slot<'span'>;
|
271
|
+
};
|
272
|
+
|
273
|
+
/**
|
274
|
+
* State used in rendering MenuItemSwitch
|
275
|
+
*/
|
276
|
+
export declare type MenuItemSwitchState = ComponentState<MenuItemSwitchSlots> & MenuItemSelectableState & Required<Pick<MenuItemSwitchProps, 'disabled'>>;
|
277
|
+
|
260
278
|
/**
|
261
279
|
* Define a styled MenuList, using the `useMenuList_unstable` hook.
|
262
280
|
*/
|
@@ -646,6 +664,11 @@ export declare const renderMenuItemLink_unstable: (state: MenuItemLinkState) =>
|
|
646
664
|
*/
|
647
665
|
export declare const renderMenuItemRadio_unstable: (state: MenuItemRadioState) => JSX.Element;
|
648
666
|
|
667
|
+
/**
|
668
|
+
* Function that renders the final JSX of the component
|
669
|
+
*/
|
670
|
+
export declare const renderMenuItemSwitch_unstable: (state: MenuItemSwitchState) => JSX.Element;
|
671
|
+
|
649
672
|
/**
|
650
673
|
* Function that renders the final JSX of the component
|
651
674
|
*/
|
@@ -757,6 +780,22 @@ export declare const useMenuItemRadioStyles_unstable: (state: MenuItemRadioState
|
|
757
780
|
/** Applies style classnames to slots */
|
758
781
|
export declare const useMenuItemStyles_unstable: (state: MenuItemState) => MenuItemState;
|
759
782
|
|
783
|
+
/**
|
784
|
+
* Create the state required to render MenuItemSwitch.
|
785
|
+
*
|
786
|
+
* The returned state can be modified with hooks such as useMenuItemSwitchStyles_unstable,
|
787
|
+
* before being passed to renderMenuItemSwitch_unstable.
|
788
|
+
*
|
789
|
+
* @param props - props from this instance of MenuItemSwitch
|
790
|
+
* @param ref - reference to root HTMLDivElement of MenuItemSwitch
|
791
|
+
*/
|
792
|
+
export declare const useMenuItemSwitch_unstable: (props: MenuItemSwitchProps, ref: React_2.Ref<HTMLDivElement>) => MenuItemSwitchState;
|
793
|
+
|
794
|
+
/**
|
795
|
+
* Apply styling to the MenuItemSwitch slots based on the state
|
796
|
+
*/
|
797
|
+
export declare const useMenuItemSwitchStyles_unstable: (state: MenuItemSwitchState) => MenuItemSwitchState;
|
798
|
+
|
760
799
|
/**
|
761
800
|
* Returns the props and state required to render the component
|
762
801
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './components/MenuItemSwitch/index';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["MenuItemSwitch.ts"],"sourcesContent":["export * from './components/MenuItemSwitch/index';\n"],"names":[],"mappings":"AAAA,cAAc,oCAAoC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { usePositioningMouseTarget, usePositioning, resolvePositioningShorthand } from '@fluentui/react-positioning';
|
3
|
-
import { useControllableState, useId, useOnClickOutside, useEventCallback, useOnScrollOutside, elementContains } from '@fluentui/react-utilities';
|
3
|
+
import { useControllableState, useId, useOnClickOutside, useEventCallback, useOnScrollOutside, elementContains, useTimeout } from '@fluentui/react-utilities';
|
4
4
|
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
|
5
5
|
import { useFocusFinders } from '@fluentui/react-tabster';
|
6
6
|
import { useMenuContext_unstable } from '../../contexts/menuContext';
|
@@ -130,7 +130,6 @@ const useMenuOpenState = (state)=>{
|
|
130
130
|
var _state_onOpenChange;
|
131
131
|
return (_state_onOpenChange = state.onOpenChange) === null || _state_onOpenChange === void 0 ? void 0 : _state_onOpenChange.call(state, e, data);
|
132
132
|
});
|
133
|
-
const setOpenTimeout = React.useRef(0);
|
134
133
|
const enteringTriggerRef = React.useRef(false);
|
135
134
|
const [open, setOpenState] = useControllableState({
|
136
135
|
state: state.open,
|
@@ -155,8 +154,9 @@ const useMenuOpenState = (state)=>{
|
|
155
154
|
}
|
156
155
|
setOpenState(data.open);
|
157
156
|
});
|
157
|
+
const [setOpenTimeout, clearOpenTimeout] = useTimeout();
|
158
158
|
const setOpen = useEventCallback((e, data)=>{
|
159
|
-
|
159
|
+
clearOpenTimeout();
|
160
160
|
if (!(e instanceof Event) && e.persist) {
|
161
161
|
// < React 17 still uses pooled synthetic events
|
162
162
|
e.persist();
|
@@ -166,10 +166,7 @@ const useMenuOpenState = (state)=>{
|
|
166
166
|
if ((_state_triggerRef_current = state.triggerRef.current) === null || _state_triggerRef_current === void 0 ? void 0 : _state_triggerRef_current.contains(e.target)) {
|
167
167
|
enteringTriggerRef.current = e.type === 'mouseenter' || e.type === 'mousemove';
|
168
168
|
}
|
169
|
-
|
170
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
171
|
-
// @ts-ignore
|
172
|
-
setOpenTimeout.current = setTimeout(()=>trySetOpen(e, data), state.hoverDelay);
|
169
|
+
setOpenTimeout(()=>trySetOpen(e, data), state.hoverDelay);
|
173
170
|
} else {
|
174
171
|
trySetOpen(e, data);
|
175
172
|
}
|
@@ -222,13 +219,6 @@ const useMenuOpenState = (state)=>{
|
|
222
219
|
state.menuPopoverRef
|
223
220
|
]
|
224
221
|
});
|
225
|
-
// Clear timeout on unmount
|
226
|
-
// Setting state after a component unmounts can cause memory leaks
|
227
|
-
React.useEffect(()=>{
|
228
|
-
return ()=>{
|
229
|
-
clearTimeout(setOpenTimeout.current);
|
230
|
-
};
|
231
|
-
}, []);
|
232
222
|
// Manage focus for open state
|
233
223
|
const { findFirstFocusable } = useFocusFinders();
|
234
224
|
const focusFirst = React.useCallback(()=>{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n usePositioningMouseTarget,\n usePositioning,\n resolvePositioningShorthand,\n PositioningShorthandValue,\n} from '@fluentui/react-positioning';\nimport {\n useControllableState,\n useId,\n useOnClickOutside,\n useEventCallback,\n useOnScrollOutside,\n elementContains,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MENU_ENTER_EVENT, useOnMenuMouseEnter } from '../../utils/index';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\nimport type { MenuOpenChangeData, MenuOpenEvent, MenuProps, MenuState } from './Menu.types';\n\n// If it's not possible to position the submenu in smaller viewports, try\n// and fallback to this order of positions\nconst submenuFallbackPositions: PositioningShorthandValue[] = [\n 'after',\n 'after-bottom',\n 'before-top',\n 'before',\n 'before-bottom',\n 'above',\n];\n\n/**\n * Create the state required to render Menu.\n *\n * The returned state can be modified with hooks such as useMenuStyles,\n * before being passed to renderMenu_unstable.\n *\n * @param props - props from this instance of Menu\n */\nexport const useMenu_unstable = (props: MenuProps): MenuState => {\n const isSubmenu = useIsSubmenu();\n const {\n hoverDelay = 500,\n inline = false,\n hasCheckmarks = false,\n hasIcons = false,\n closeOnScroll = false,\n openOnContext = false,\n persistOnItemClick = false,\n openOnHover = isSubmenu,\n defaultCheckedValues,\n mountNode = null,\n } = props;\n const triggerId = useId('menu');\n const [contextTarget, setContextTarget] = usePositioningMouseTarget();\n\n const positioningState = {\n position: isSubmenu ? 'after' : 'below',\n align: isSubmenu ? 'top' : 'start',\n target: props.openOnContext ? contextTarget : undefined,\n fallbackPositions: isSubmenu ? submenuFallbackPositions : undefined,\n ...resolvePositioningShorthand(props.positioning),\n } as const;\n\n const children = React.Children.toArray(props.children) as React.ReactElement[];\n\n if (process.env.NODE_ENV !== 'production') {\n if (children.length === 0) {\n // eslint-disable-next-line no-console\n console.warn('Menu must contain at least one child');\n }\n\n if (children.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('Menu must contain at most two children');\n }\n }\n\n let menuTrigger: React.ReactElement | undefined = undefined;\n let menuPopover: React.ReactElement | undefined = undefined;\n if (children.length === 2) {\n menuTrigger = children[0];\n menuPopover = children[1];\n } else if (children.length === 1) {\n menuPopover = children[0];\n }\n\n const { targetRef: triggerRef, containerRef: menuPopoverRef } = usePositioning(positioningState);\n\n // TODO Better way to narrow types ?\n const [open, setOpen] = useMenuOpenState({\n hoverDelay,\n isSubmenu,\n setContextTarget,\n closeOnScroll,\n menuPopoverRef,\n triggerRef,\n open: props.open,\n defaultOpen: props.defaultOpen,\n onOpenChange: props.onOpenChange,\n openOnContext,\n });\n\n const [checkedValues, onCheckedValueChange] = useMenuSelectableState({\n checkedValues: props.checkedValues,\n defaultCheckedValues,\n onCheckedValueChange: props.onCheckedValueChange,\n });\n\n return {\n inline,\n hoverDelay,\n triggerId,\n isSubmenu,\n openOnHover,\n contextTarget,\n setContextTarget,\n hasCheckmarks,\n hasIcons,\n closeOnScroll,\n menuTrigger,\n menuPopover,\n mountNode,\n triggerRef,\n menuPopoverRef,\n components: {},\n openOnContext,\n open,\n setOpen,\n checkedValues,\n onCheckedValueChange,\n persistOnItemClick,\n };\n};\n\n/**\n * Adds appropriate state values and handlers for selectable items\n * i.e checkboxes and radios\n */\nconst useMenuSelectableState = (\n props: Pick<MenuProps, 'checkedValues' | 'defaultCheckedValues' | 'onCheckedValueChange'>,\n) => {\n const [checkedValues, setCheckedValues] = useControllableState({\n state: props.checkedValues,\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n const onCheckedValueChange: MenuState['onCheckedValueChange'] = useEventCallback((e, { name, checkedItems }) => {\n props.onCheckedValueChange?.(e, { name, checkedItems });\n\n setCheckedValues(currentValue => ({\n ...currentValue,\n [name]: checkedItems,\n }));\n });\n\n return [checkedValues, onCheckedValueChange] as const;\n};\n\nconst useMenuOpenState = (\n state: Pick<\n MenuState,\n | 'isSubmenu'\n | 'menuPopoverRef'\n | 'setContextTarget'\n | 'triggerRef'\n | 'openOnContext'\n | 'closeOnScroll'\n | 'hoverDelay'\n > &\n Pick<MenuProps, 'open' | 'defaultOpen' | 'onOpenChange'>,\n) => {\n const { targetDocument } = useFluent();\n const parentSetOpen = useMenuContext_unstable(context => context.setOpen);\n const onOpenChange: MenuProps['onOpenChange'] = useEventCallback((e, data) => state.onOpenChange?.(e, data));\n\n const setOpenTimeout = React.useRef(0);\n const enteringTriggerRef = React.useRef(false);\n\n const [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false,\n });\n\n const trySetOpen = useEventCallback((e: MenuOpenEvent, data: MenuOpenChangeData) => {\n const event = e instanceof CustomEvent && e.type === MENU_ENTER_EVENT ? e.detail.nativeEvent : e;\n onOpenChange?.(event, { ...data });\n if (data.open && e.type === 'contextmenu') {\n state.setContextTarget(e as React.MouseEvent);\n }\n\n if (!data.open) {\n state.setContextTarget(undefined);\n }\n\n if (data.bubble) {\n parentSetOpen(e, { ...data });\n }\n\n setOpenState(data.open);\n });\n\n const setOpen = useEventCallback((e: MenuOpenEvent, data: MenuOpenChangeData) => {\n clearTimeout(setOpenTimeout.current);\n if (!(e instanceof Event) && e.persist) {\n // < React 17 still uses pooled synthetic events\n e.persist();\n }\n\n if (e.type === 'mouseleave' || e.type === 'mouseenter' || e.type === 'mousemove' || e.type === MENU_ENTER_EVENT) {\n if (state.triggerRef.current?.contains(e.target as HTMLElement)) {\n enteringTriggerRef.current = e.type === 'mouseenter' || e.type === 'mousemove';\n }\n\n // FIXME leaking Node timeout type\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n setOpenTimeout.current = setTimeout(() => trySetOpen(e, data), state.hoverDelay);\n } else {\n trySetOpen(e, data);\n }\n });\n\n useOnClickOutside({\n contains: elementContains,\n disabled: !open,\n element: targetDocument,\n refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(\n Boolean,\n ) as React.MutableRefObject<HTMLElement>[],\n callback: event => setOpen(event, { open: false, type: 'clickOutside', event }),\n });\n\n // only close on scroll for context, or when closeOnScroll is specified\n const closeOnScroll = state.openOnContext || state.closeOnScroll;\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: event => setOpen(event, { open: false, type: 'scrollOutside', event }),\n refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(\n Boolean,\n ) as React.MutableRefObject<HTMLElement>[],\n disabled: !open || !closeOnScroll,\n });\n\n useOnMenuMouseEnter({\n element: targetDocument,\n callback: event => {\n // When moving from a menu directly back to its trigger, this handler can close the menu\n // Explicitly check a flag to see if this situation happens\n if (!enteringTriggerRef.current) {\n setOpen(event, { open: false, type: 'menuMouseEnter', event });\n }\n },\n disabled: !open,\n refs: [state.menuPopoverRef],\n });\n\n // Clear timeout on unmount\n // Setting state after a component unmounts can cause memory leaks\n React.useEffect(() => {\n return () => {\n clearTimeout(setOpenTimeout.current);\n };\n }, []);\n\n // Manage focus for open state\n const { findFirstFocusable } = useFocusFinders();\n const focusFirst = React.useCallback(() => {\n const firstFocusable = findFirstFocusable(state.menuPopoverRef.current);\n firstFocusable?.focus();\n }, [findFirstFocusable, state.menuPopoverRef]);\n\n React.useEffect(() => {\n if (open) {\n focusFirst();\n }\n }, [open, focusFirst]);\n\n return [open, setOpen] as const;\n};\n"],"names":["React","usePositioningMouseTarget","usePositioning","resolvePositioningShorthand","useControllableState","useId","useOnClickOutside","useEventCallback","useOnScrollOutside","elementContains","useFluent_unstable","useFluent","useFocusFinders","useMenuContext_unstable","MENU_ENTER_EVENT","useOnMenuMouseEnter","useIsSubmenu","submenuFallbackPositions","useMenu_unstable","props","isSubmenu","hoverDelay","inline","hasCheckmarks","hasIcons","closeOnScroll","openOnContext","persistOnItemClick","openOnHover","defaultCheckedValues","mountNode","triggerId","contextTarget","setContextTarget","positioningState","position","align","target","undefined","fallbackPositions","positioning","children","Children","toArray","process","env","NODE_ENV","length","console","warn","menuTrigger","menuPopover","targetRef","triggerRef","containerRef","menuPopoverRef","open","setOpen","useMenuOpenState","defaultOpen","onOpenChange","checkedValues","onCheckedValueChange","useMenuSelectableState","components","setCheckedValues","state","defaultState","initialState","e","name","checkedItems","currentValue","targetDocument","parentSetOpen","context","data","setOpenTimeout","useRef","enteringTriggerRef","setOpenState","trySetOpen","event","CustomEvent","type","detail","nativeEvent","bubble","clearTimeout","current","Event","persist","contains","setTimeout","disabled","element","refs","filter","Boolean","callback","useEffect","findFirstFocusable","focusFirst","useCallback","firstFocusable","focus"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,yBAAyB,EACzBC,cAAc,EACdC,2BAA2B,QAEtB,8BAA8B;AACrC,SACEC,oBAAoB,EACpBC,KAAK,EACLC,iBAAiB,EACjBC,gBAAgB,EAChBC,kBAAkB,EAClBC,eAAe,QACV,4BAA4B;AACnC,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,uBAAuB,QAAQ,6BAA6B;AACrE,SAASC,gBAAgB,EAAEC,mBAAmB,QAAQ,oBAAoB;AAC1E,SAASC,YAAY,QAAQ,2BAA2B;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IAC3B,kEAAkE;IAClEvD,MAAMoG,SAAS,CAAC;QACd,OAAO;YACLZ,aAAaX,eAAeY,OAAO;QACrC;IACF,GAAG,EAAE;IAEL,8BAA8B;IAC9B,MAAM,EAAEY,kBAAkB,EAAE,GAAGzF;IAC/B,MAAM0F,aAAatG,MAAMuG,WAAW,CAAC;QACnC,MAAMC,iBAAiBH,mBAAmBnC,MAAMX,cAAc,CAACkC,OAAO;QACtEe,2BAAAA,qCAAAA,eAAgBC,KAAK;IACvB,GAAG;QAACJ;QAAoBnC,MAAMX,cAAc;KAAC;IAE7CvD,MAAMoG,SAAS,CAAC;QACd,IAAI5C,MAAM;YACR8C;QACF;IACF,GAAG;QAAC9C;QAAM8C;KAAW;IAErB,OAAO;QAAC9C;QAAMC;KAAQ;AACxB"}
|
1
|
+
{"version":3,"sources":["useMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n usePositioningMouseTarget,\n usePositioning,\n resolvePositioningShorthand,\n PositioningShorthandValue,\n} from '@fluentui/react-positioning';\nimport {\n useControllableState,\n useId,\n useOnClickOutside,\n useEventCallback,\n useOnScrollOutside,\n elementContains,\n useTimeout,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MENU_ENTER_EVENT, useOnMenuMouseEnter } from '../../utils/index';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\nimport type { MenuOpenChangeData, MenuOpenEvent, MenuProps, MenuState } from './Menu.types';\n\n// If it's not possible to position the submenu in smaller viewports, try\n// and fallback to this order of positions\nconst submenuFallbackPositions: PositioningShorthandValue[] = [\n 'after',\n 'after-bottom',\n 'before-top',\n 'before',\n 'before-bottom',\n 'above',\n];\n\n/**\n * Create the state required to render Menu.\n *\n * The returned state can be modified with hooks such as useMenuStyles,\n * before being passed to renderMenu_unstable.\n *\n * @param props - props from this instance of Menu\n */\nexport const useMenu_unstable = (props: MenuProps): MenuState => {\n const isSubmenu = useIsSubmenu();\n const {\n hoverDelay = 500,\n inline = false,\n hasCheckmarks = false,\n hasIcons = false,\n closeOnScroll = false,\n openOnContext = false,\n persistOnItemClick = false,\n openOnHover = isSubmenu,\n defaultCheckedValues,\n mountNode = null,\n } = props;\n const triggerId = useId('menu');\n const [contextTarget, setContextTarget] = usePositioningMouseTarget();\n\n const positioningState = {\n position: isSubmenu ? 'after' : 'below',\n align: isSubmenu ? 'top' : 'start',\n target: props.openOnContext ? contextTarget : undefined,\n fallbackPositions: isSubmenu ? submenuFallbackPositions : undefined,\n ...resolvePositioningShorthand(props.positioning),\n } as const;\n\n const children = React.Children.toArray(props.children) as React.ReactElement[];\n\n if (process.env.NODE_ENV !== 'production') {\n if (children.length === 0) {\n // eslint-disable-next-line no-console\n console.warn('Menu must contain at least one child');\n }\n\n if (children.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('Menu must contain at most two children');\n }\n }\n\n let menuTrigger: React.ReactElement | undefined = undefined;\n let menuPopover: React.ReactElement | undefined = undefined;\n if (children.length === 2) {\n menuTrigger = children[0];\n menuPopover = children[1];\n } else if (children.length === 1) {\n menuPopover = children[0];\n }\n\n const { targetRef: triggerRef, containerRef: menuPopoverRef } = usePositioning(positioningState);\n\n // TODO Better way to narrow types ?\n const [open, setOpen] = useMenuOpenState({\n hoverDelay,\n isSubmenu,\n setContextTarget,\n closeOnScroll,\n menuPopoverRef,\n triggerRef,\n open: props.open,\n defaultOpen: props.defaultOpen,\n onOpenChange: props.onOpenChange,\n openOnContext,\n });\n\n const [checkedValues, onCheckedValueChange] = useMenuSelectableState({\n checkedValues: props.checkedValues,\n defaultCheckedValues,\n onCheckedValueChange: props.onCheckedValueChange,\n });\n\n return {\n inline,\n hoverDelay,\n triggerId,\n isSubmenu,\n openOnHover,\n contextTarget,\n setContextTarget,\n hasCheckmarks,\n hasIcons,\n closeOnScroll,\n menuTrigger,\n menuPopover,\n mountNode,\n triggerRef,\n menuPopoverRef,\n components: {},\n openOnContext,\n open,\n setOpen,\n checkedValues,\n onCheckedValueChange,\n persistOnItemClick,\n };\n};\n\n/**\n * Adds appropriate state values and handlers for selectable items\n * i.e checkboxes and radios\n */\nconst useMenuSelectableState = (\n props: Pick<MenuProps, 'checkedValues' | 'defaultCheckedValues' | 'onCheckedValueChange'>,\n) => {\n const [checkedValues, setCheckedValues] = useControllableState({\n state: props.checkedValues,\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n const onCheckedValueChange: MenuState['onCheckedValueChange'] = useEventCallback((e, { name, checkedItems }) => {\n props.onCheckedValueChange?.(e, { name, checkedItems });\n\n setCheckedValues(currentValue => ({\n ...currentValue,\n [name]: checkedItems,\n }));\n });\n\n return [checkedValues, onCheckedValueChange] as const;\n};\n\nconst useMenuOpenState = (\n state: Pick<\n MenuState,\n | 'isSubmenu'\n | 'menuPopoverRef'\n | 'setContextTarget'\n | 'triggerRef'\n | 'openOnContext'\n | 'closeOnScroll'\n | 'hoverDelay'\n > &\n Pick<MenuProps, 'open' | 'defaultOpen' | 'onOpenChange'>,\n) => {\n const { targetDocument } = useFluent();\n const parentSetOpen = useMenuContext_unstable(context => context.setOpen);\n const onOpenChange: MenuProps['onOpenChange'] = useEventCallback((e, data) => state.onOpenChange?.(e, data));\n\n const enteringTriggerRef = React.useRef(false);\n\n const [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false,\n });\n\n const trySetOpen = useEventCallback((e: MenuOpenEvent, data: MenuOpenChangeData) => {\n const event = e instanceof CustomEvent && e.type === MENU_ENTER_EVENT ? e.detail.nativeEvent : e;\n onOpenChange?.(event, { ...data });\n if (data.open && e.type === 'contextmenu') {\n state.setContextTarget(e as React.MouseEvent);\n }\n\n if (!data.open) {\n state.setContextTarget(undefined);\n }\n\n if (data.bubble) {\n parentSetOpen(e, { ...data });\n }\n\n setOpenState(data.open);\n });\n\n const [setOpenTimeout, clearOpenTimeout] = useTimeout();\n\n const setOpen = useEventCallback((e: MenuOpenEvent, data: MenuOpenChangeData) => {\n clearOpenTimeout();\n if (!(e instanceof Event) && e.persist) {\n // < React 17 still uses pooled synthetic events\n e.persist();\n }\n\n if (e.type === 'mouseleave' || e.type === 'mouseenter' || e.type === 'mousemove' || e.type === MENU_ENTER_EVENT) {\n if (state.triggerRef.current?.contains(e.target as HTMLElement)) {\n enteringTriggerRef.current = e.type === 'mouseenter' || e.type === 'mousemove';\n }\n\n setOpenTimeout(() => trySetOpen(e, data), state.hoverDelay);\n } else {\n trySetOpen(e, data);\n }\n });\n\n useOnClickOutside({\n contains: elementContains,\n disabled: !open,\n element: targetDocument,\n refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(\n Boolean,\n ) as React.MutableRefObject<HTMLElement>[],\n callback: event => setOpen(event, { open: false, type: 'clickOutside', event }),\n });\n\n // only close on scroll for context, or when closeOnScroll is specified\n const closeOnScroll = state.openOnContext || state.closeOnScroll;\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: event => setOpen(event, { open: false, type: 'scrollOutside', event }),\n refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(\n Boolean,\n ) as React.MutableRefObject<HTMLElement>[],\n disabled: !open || !closeOnScroll,\n });\n\n useOnMenuMouseEnter({\n element: targetDocument,\n callback: event => {\n // When moving from a menu directly back to its trigger, this handler can close the menu\n // Explicitly check a flag to see if this situation happens\n if (!enteringTriggerRef.current) {\n setOpen(event, { open: false, type: 'menuMouseEnter', event });\n }\n },\n disabled: !open,\n refs: [state.menuPopoverRef],\n });\n\n // Manage focus for open state\n const { findFirstFocusable } = useFocusFinders();\n const focusFirst = React.useCallback(() => {\n const firstFocusable = findFirstFocusable(state.menuPopoverRef.current);\n firstFocusable?.focus();\n }, [findFirstFocusable, state.menuPopoverRef]);\n\n React.useEffect(() => {\n if (open) {\n focusFirst();\n }\n }, [open, focusFirst]);\n\n return [open, setOpen] as const;\n};\n"],"names":["React","usePositioningMouseTarget","usePositioning","resolvePositioningShorthand","useControllableState","useId","useOnClickOutside","useEventCallback","useOnScrollOutside","elementContains","useTimeout","useFluent_unstable","useFluent","useFocusFinders","useMenuContext_unstable","MENU_ENTER_EVENT","useOnMenuMouseEnter","useIsSubmenu","submenuFallbackPositions","useMenu_unstable","props","isSubmenu","hoverDelay","inline","hasCheckmarks","hasIcons","closeOnScroll","openOnContext","persistOnItemClick","openOnHover","defaultCheckedValues","mountNode","triggerId","contextTarget","setContextTarget","positioningState","position","align","target","undefined","fallbackPositions","positioning","children","Children","toArray","process","env","NODE_ENV","length","console","warn","menuTrigger","menuPopover","targetRef","triggerRef","containerRef","menuPopoverRef","open","setOpen","useMenuOpenState","defaultOpen","onOpenChange","checkedValues","onCheckedValueChange","useMenuSelectableState","components","setCheckedValues","state","defaultState","initialState","e","name","checkedItems","currentValue","targetDocument","parentSetOpen","context","data","enteringTriggerRef","useRef","setOpenState","trySetOpen","event","CustomEvent","type","detail","nativeEvent","bubble","setOpenTimeout","clearOpenTimeout","Event","persist","current","contains","disabled","element","refs","filter","Boolean","callback","findFirstFocusable","focusFirst","useCallback","firstFocusable","focus","useEffect"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,yBAAyB,EACzBC,cAAc,EACdC,2BAA2B,QAEtB,8BAA8B;AACrC,SACEC,oBAAoB,EACpBC,KAAK,EACLC,iBAAiB,EACjBC,gBAAgB,EAChBC,kBAAkB,EAClBC,eAAe,EACfC,UAAU,QACL,4BAA4B;AACnC,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,uBAAuB,QAAQ,6BAA6B;AACrE,SAASC,gBAAgB,EAAEC,mBAAmB,QAAQ,oBAAoB;AAC1E,SAASC,YAAY,QAAQ,2BAA2B;AAGxD,yEAAyE;AACzE,0CAA0C;AAC1C,MAAMC,2BAAwD;IAC5D;IACA;IACA;IACA;IACA;IACA;CACD;AAED;;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AA,eAAgBC,KAAK;IACvB,GAAG;QAACJ;QAAoBjC,MAAMX,cAAc;KAAC;IAE7CxD,MAAMyG,SAAS,CAAC;QACd,IAAIhD,MAAM;YACR4C;QACF;IACF,GAAG;QAAC5C;QAAM4C;KAAW;IAErB,OAAO;QAAC5C;QAAMC;KAAQ;AACxB"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
|
3
|
+
import { useMenuItemSwitch_unstable } from './useMenuItemSwitch';
|
4
|
+
import { renderMenuItemSwitch_unstable } from './renderMenuItemSwitch';
|
5
|
+
import { useMenuItemSwitchStyles_unstable } from './useMenuItemSwitchStyles.styles';
|
6
|
+
export const MenuItemSwitch = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
7
|
+
const state = useMenuItemSwitch_unstable(props, ref);
|
8
|
+
useMenuItemSwitchStyles_unstable(state);
|
9
|
+
useCustomStyleHook_unstable('useMenuItemSwitchStyles_unstable')(state);
|
10
|
+
return renderMenuItemSwitch_unstable(state);
|
11
|
+
});
|
12
|
+
MenuItemSwitch.displayName = 'MenuItemSwitch';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["MenuItemSwitch.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { useMenuItemSwitch_unstable } from './useMenuItemSwitch';\nimport { renderMenuItemSwitch_unstable } from './renderMenuItemSwitch';\nimport { useMenuItemSwitchStyles_unstable } from './useMenuItemSwitchStyles.styles';\nimport type { MenuItemSwitchProps } from './MenuItemSwitch.types';\n\nexport const MenuItemSwitch: ForwardRefComponent<MenuItemSwitchProps> = React.forwardRef((props, ref) => {\n const state = useMenuItemSwitch_unstable(props, ref);\n\n useMenuItemSwitchStyles_unstable(state);\n useCustomStyleHook_unstable('useMenuItemSwitchStyles_unstable')(state);\n return renderMenuItemSwitch_unstable(state);\n});\n\nMenuItemSwitch.displayName = 'MenuItemSwitch';\n"],"names":["React","useCustomStyleHook_unstable","useMenuItemSwitch_unstable","renderMenuItemSwitch_unstable","useMenuItemSwitchStyles_unstable","MenuItemSwitch","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,gCAAgC,QAAQ,mCAAmC;AAGpF,OAAO,MAAMC,+BAA2DL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,QAAQP,2BAA2BK,OAAOC;IAEhDJ,iCAAiCK;IACjCR,4BAA4B,oCAAoCQ;IAChE,OAAON,8BAA8BM;AACvC,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["MenuItemSwitch.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { MenuItemSlots } from '../MenuItem/MenuItem.types';\nimport { MenuItemSelectableState } from '../../selectable/types';\nimport { MenuItemCheckboxProps } from '../MenuItemCheckbox/MenuItemCheckbox.types';\n\nexport type MenuItemSwitchSlots = Pick<MenuItemSlots, 'root' | 'content' | 'secondaryContent' | 'icon'> & {\n switchIndicator?: Slot<'span'>;\n};\n\n/**\n * MenuItemSwitch Props\n */\nexport type MenuItemSwitchProps = ComponentProps<MenuItemSwitchSlots> &\n Pick<MenuItemCheckboxProps, 'disabled' | 'persistOnClick' | 'name' | 'value'>;\n\n/**\n * State used in rendering MenuItemSwitch\n */\nexport type MenuItemSwitchState = ComponentState<MenuItemSwitchSlots> &\n MenuItemSelectableState &\n Required<Pick<MenuItemSwitchProps, 'disabled'>>;\n"],"names":[],"mappings":"AAAA,WAoBkD"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './MenuItemSwitch';\nexport * from './MenuItemSwitch.types';\nexport * from './renderMenuItemSwitch';\nexport * from './useMenuItemSwitch';\nexport * from './useMenuItemSwitchStyles.styles';\n"],"names":[],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,yBAAyB;AACvC,cAAc,yBAAyB;AACvC,cAAc,sBAAsB;AACpC,cAAc,mCAAmC"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
2
|
+
import { assertSlots } from '@fluentui/react-utilities';
|
3
|
+
/**
|
4
|
+
* Function that renders the final JSX of the component
|
5
|
+
*/ export const renderMenuItemSwitch_unstable = (state)=>{
|
6
|
+
assertSlots(state);
|
7
|
+
return /*#__PURE__*/ _jsxs(state.root, {
|
8
|
+
children: [
|
9
|
+
state.icon && /*#__PURE__*/ _jsx(state.icon, {}),
|
10
|
+
state.content && /*#__PURE__*/ _jsx(state.content, {}),
|
11
|
+
state.secondaryContent && /*#__PURE__*/ _jsx(state.secondaryContent, {}),
|
12
|
+
state.switchIndicator && /*#__PURE__*/ _jsx(state.switchIndicator, {})
|
13
|
+
]
|
14
|
+
});
|
15
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["renderMenuItemSwitch.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { MenuItemSwitchSlots, MenuItemSwitchState } from './MenuItemSwitch.types';\n\n/**\n * Function that renders the final JSX of the component\n */\nexport const renderMenuItemSwitch_unstable = (state: MenuItemSwitchState) => {\n assertSlots<MenuItemSwitchSlots>(state);\n\n return (\n <state.root>\n {state.icon && <state.icon />}\n {state.content && <state.content />}\n {state.secondaryContent && <state.secondaryContent />}\n {state.switchIndicator && <state.switchIndicator />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderMenuItemSwitch_unstable","state","root","icon","content","secondaryContent","switchIndicator"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAACC;IAC5CF,YAAiCE;IAEjC,qBACE,MAACA,MAAMC,IAAI;;YACRD,MAAME,IAAI,kBAAI,KAACF,MAAME,IAAI;YACzBF,MAAMG,OAAO,kBAAI,KAACH,MAAMG,OAAO;YAC/BH,MAAMI,gBAAgB,kBAAI,KAACJ,MAAMI,gBAAgB;YACjDJ,MAAMK,eAAe,kBAAI,KAACL,MAAMK,eAAe;;;AAGtD,EAAE"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { slot } from '@fluentui/react-utilities';
|
3
|
+
import { useMenuItemCheckbox_unstable } from '../MenuItemCheckbox/useMenuItemCheckbox';
|
4
|
+
import { CircleFilled } from '@fluentui/react-icons';
|
5
|
+
import { circleFilledClassName } from './useMenuItemSwitchStyles.styles';
|
6
|
+
/**
|
7
|
+
* Create the state required to render MenuItemSwitch.
|
8
|
+
*
|
9
|
+
* The returned state can be modified with hooks such as useMenuItemSwitchStyles_unstable,
|
10
|
+
* before being passed to renderMenuItemSwitch_unstable.
|
11
|
+
*
|
12
|
+
* @param props - props from this instance of MenuItemSwitch
|
13
|
+
* @param ref - reference to root HTMLDivElement of MenuItemSwitch
|
14
|
+
*/ export const useMenuItemSwitch_unstable = (props, ref)=>{
|
15
|
+
const baseState = useMenuItemCheckbox_unstable(props, ref);
|
16
|
+
return {
|
17
|
+
...baseState,
|
18
|
+
switchIndicator: slot.optional(props.switchIndicator, {
|
19
|
+
renderByDefault: true,
|
20
|
+
elementType: 'span',
|
21
|
+
defaultProps: {
|
22
|
+
children: /*#__PURE__*/ React.createElement(CircleFilled, {
|
23
|
+
className: circleFilledClassName
|
24
|
+
})
|
25
|
+
}
|
26
|
+
}),
|
27
|
+
components: {
|
28
|
+
...baseState.components,
|
29
|
+
switchIndicator: 'span'
|
30
|
+
}
|
31
|
+
};
|
32
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["useMenuItemSwitch.tsx"],"sourcesContent":["import * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\nimport type { MenuItemSwitchProps, MenuItemSwitchState } from './MenuItemSwitch.types';\nimport { useMenuItemCheckbox_unstable } from '../MenuItemCheckbox/useMenuItemCheckbox';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { circleFilledClassName } from './useMenuItemSwitchStyles.styles';\n\n/**\n * Create the state required to render MenuItemSwitch.\n *\n * The returned state can be modified with hooks such as useMenuItemSwitchStyles_unstable,\n * before being passed to renderMenuItemSwitch_unstable.\n *\n * @param props - props from this instance of MenuItemSwitch\n * @param ref - reference to root HTMLDivElement of MenuItemSwitch\n */\nexport const useMenuItemSwitch_unstable = (\n props: MenuItemSwitchProps,\n ref: React.Ref<HTMLDivElement>,\n): MenuItemSwitchState => {\n const baseState = useMenuItemCheckbox_unstable(props, ref);\n return {\n ...baseState,\n switchIndicator: slot.optional(props.switchIndicator, {\n renderByDefault: true,\n elementType: 'span',\n defaultProps: {\n children: <CircleFilled className={circleFilledClassName} />,\n },\n }),\n components: {\n ...baseState.components,\n switchIndicator: 'span',\n },\n };\n};\n"],"names":["React","slot","useMenuItemCheckbox_unstable","CircleFilled","circleFilledClassName","useMenuItemSwitch_unstable","props","ref","baseState","switchIndicator","optional","renderByDefault","elementType","defaultProps","children","className","components"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,QAAQ,4BAA4B;AAEjD,SAASC,4BAA4B,QAAQ,0CAA0C;AACvF,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,qBAAqB,QAAQ,mCAAmC;AAEzE;;;;;;;;CAQC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC;IAEA,MAAMC,YAAYN,6BAA6BI,OAAOC;IACtD,OAAO;QACL,GAAGC,SAAS;QACZC,iBAAiBR,KAAKS,QAAQ,CAACJ,MAAMG,eAAe,EAAE;YACpDE,iBAAiB;YACjBC,aAAa;YACbC,cAAc;gBACZC,wBAAU,oBAACX;oBAAaY,WAAWX;;YACrC;QACF;QACAY,YAAY;YACV,GAAGR,UAAUQ,UAAU;YACvBP,iBAAiB;QACnB;IACF;AACF,EAAE"}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import { __styles, __resetStyles, mergeClasses, shorthands } from '@griffel/react';
|
2
|
+
import { tokens } from '@fluentui/react-theme';
|
3
|
+
import { useMenuItemStyles_unstable } from '../MenuItem/useMenuItemStyles.styles';
|
4
|
+
export const menuItemSwitchClassNames = {
|
5
|
+
root: 'fui-MenuItemSwitch',
|
6
|
+
icon: 'fui-MenuItemSwitch__icon',
|
7
|
+
content: 'fui-MenuItemSwitch__content',
|
8
|
+
secondaryContent: 'fui-MenuItemSwitch__secondaryContent',
|
9
|
+
switchIndicator: 'fui-MenuItemSwitch__switchIndicator'
|
10
|
+
};
|
11
|
+
export const circleFilledClassName = 'fui-MenuItemSwitch__switchIndicator__circleFilled';
|
12
|
+
// Thumb and track sizes used by the component.
|
13
|
+
const spaceBetweenThumbAndTrack = 2;
|
14
|
+
const trackHeight = 20;
|
15
|
+
const trackWidth = 40;
|
16
|
+
const thumbSize = trackHeight - spaceBetweenThumbAndTrack;
|
17
|
+
const useSwitchIndicatorBaseClassName = /*#__PURE__*/__resetStyles("r1x31n8g", "rsmcm5v", {
|
18
|
+
r: [".r1x31n8g{border-radius:var(--borderRadiusCircular);border:var(--strokeWidthThin) solid var(--colorNeutralStrokeAccessible);line-height:0;box-sizing:border-box;fill:currentColor;flex-shrink:0;font-size:18px;height:20px;transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:background,border,color;width:40px;margin-right:var(--spacingHorizontalXS);color:var(--colorNeutralStrokeAccessible);}", ".r1x31n8g:hover{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}", ".r1x31n8g:hover:active{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}", ".r1x31n8g .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}", ".rsmcm5v{border-radius:var(--borderRadiusCircular);border:var(--strokeWidthThin) solid var(--colorNeutralStrokeAccessible);line-height:0;box-sizing:border-box;fill:currentColor;flex-shrink:0;font-size:18px;height:20px;transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:background,border,color;width:40px;margin-left:var(--spacingHorizontalXS);color:var(--colorNeutralStrokeAccessible);}", ".rsmcm5v:hover{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}", ".rsmcm5v:hover:active{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}", ".rsmcm5v .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}"],
|
19
|
+
s: ["@media screen and (prefers-reduced-motion: reduce){.r1x31n8g{transition-duration:0.01ms;}}", "@media screen and (prefers-reduced-motion: reduce){.r1x31n8g .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:0.01ms;}}", "@media screen and (prefers-reduced-motion: reduce){.rsmcm5v{transition-duration:0.01ms;}}", "@media screen and (prefers-reduced-motion: reduce){.rsmcm5v .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:0.01ms;}}"]
|
20
|
+
});
|
21
|
+
const useSwitchIndicatorStyles = /*#__PURE__*/__styles({
|
22
|
+
checked: {
|
23
|
+
G4r02d: ["fdca5i2", "fk0rr1z"],
|
24
|
+
De3pzq: "ftywsgz",
|
25
|
+
sj55zd: "fqpbvvt",
|
26
|
+
g2u3we: "fghlq4f",
|
27
|
+
h3c5rm: ["f1gn591s", "fjscplz"],
|
28
|
+
B9xav0g: "fb073pr",
|
29
|
+
zhjwy3: ["fjscplz", "f1gn591s"],
|
30
|
+
Bi91k9c: "fz46y8r",
|
31
|
+
Jwef8y: "f1kjrvvj",
|
32
|
+
Bgoe8wy: "fpa59ij",
|
33
|
+
Bwzppfd: ["f1rhln42", "f1l1ogpg"],
|
34
|
+
oetu4i: "fz67qlh",
|
35
|
+
gg5e9n: ["f1l1ogpg", "f1rhln42"],
|
36
|
+
B2d53fq: "frlnr8d",
|
37
|
+
iro3zm: "fle2s0s",
|
38
|
+
b661bw: "f1j8ziw4",
|
39
|
+
Bk6r4ia: ["f1xzu9i0", "f1jlpvxk"],
|
40
|
+
B9zn80p: "f1i1ccxp",
|
41
|
+
Bpld233: ["f1jlpvxk", "f1xzu9i0"]
|
42
|
+
}
|
43
|
+
}, {
|
44
|
+
d: [".fdca5i2 .fui-MenuItemSwitch__switchIndicator__circleFilled{transform:translateX(20px);}", ".fk0rr1z .fui-MenuItemSwitch__switchIndicator__circleFilled{transform:translateX(-20px);}", ".ftywsgz{background-color:var(--colorCompoundBrandBackground);}", ".fqpbvvt{color:var(--colorNeutralForegroundInverted);}", ".fghlq4f{border-top-color:var(--colorTransparentStroke);}", ".f1gn591s{border-right-color:var(--colorTransparentStroke);}", ".fjscplz{border-left-color:var(--colorTransparentStroke);}", ".fb073pr{border-bottom-color:var(--colorTransparentStroke);}"],
|
45
|
+
h: [".fz46y8r:hover{color:var(--colorNeutralForegroundInverted);}", ".f1kjrvvj:hover{background-color:var(--colorCompoundBrandBackgroundHover);}", ".fpa59ij:hover{border-top-color:var(--colorTransparentStrokeInteractive);}", ".f1rhln42:hover{border-right-color:var(--colorTransparentStrokeInteractive);}", ".f1l1ogpg:hover{border-left-color:var(--colorTransparentStrokeInteractive);}", ".fz67qlh:hover{border-bottom-color:var(--colorTransparentStrokeInteractive);}", ".frlnr8d:hover:active{color:var(--colorNeutralForegroundInverted);}", ".fle2s0s:hover:active{background-color:var(--colorCompoundBrandBackgroundPressed);}", ".f1j8ziw4:hover:active{border-top-color:var(--colorTransparentStrokeInteractive);}", ".f1xzu9i0:hover:active{border-right-color:var(--colorTransparentStrokeInteractive);}", ".f1jlpvxk:hover:active{border-left-color:var(--colorTransparentStrokeInteractive);}", ".f1i1ccxp:hover:active{border-bottom-color:var(--colorTransparentStrokeInteractive);}"]
|
46
|
+
});
|
47
|
+
/**
|
48
|
+
* Apply styling to the MenuItemSwitch slots based on the state
|
49
|
+
*/
|
50
|
+
export const useMenuItemSwitchStyles_unstable = state => {
|
51
|
+
const {
|
52
|
+
checked
|
53
|
+
} = state;
|
54
|
+
const switchIndicatorStyles = useSwitchIndicatorStyles();
|
55
|
+
const switchIndicatorBaseStyles = useSwitchIndicatorBaseClassName();
|
56
|
+
state.root.className = mergeClasses(menuItemSwitchClassNames.root, state.root.className);
|
57
|
+
if (state.content) {
|
58
|
+
state.content.className = mergeClasses(menuItemSwitchClassNames.content, state.content.className);
|
59
|
+
}
|
60
|
+
if (state.secondaryContent) {
|
61
|
+
state.secondaryContent.className = mergeClasses(menuItemSwitchClassNames.secondaryContent, state.secondaryContent.className);
|
62
|
+
}
|
63
|
+
if (state.icon) {
|
64
|
+
state.icon.className = mergeClasses(menuItemSwitchClassNames.icon, state.icon.className);
|
65
|
+
}
|
66
|
+
if (state.switchIndicator) {
|
67
|
+
state.switchIndicator.className = mergeClasses(menuItemSwitchClassNames.switchIndicator, switchIndicatorBaseStyles, checked && switchIndicatorStyles.checked, state.switchIndicator.className);
|
68
|
+
}
|
69
|
+
useMenuItemStyles_unstable({
|
70
|
+
...state,
|
71
|
+
components: {
|
72
|
+
...state.components,
|
73
|
+
checkmark: 'span',
|
74
|
+
submenuIndicator: 'span'
|
75
|
+
},
|
76
|
+
checkmark: undefined,
|
77
|
+
submenuIndicator: undefined,
|
78
|
+
hasSubmenu: false,
|
79
|
+
persistOnClick: true
|
80
|
+
});
|
81
|
+
return state;
|
82
|
+
};
|
83
|
+
//# sourceMappingURL=useMenuItemSwitchStyles.styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["__styles","__resetStyles","mergeClasses","shorthands","tokens","useMenuItemStyles_unstable","menuItemSwitchClassNames","root","icon","content","secondaryContent","switchIndicator","circleFilledClassName","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useSwitchIndicatorBaseClassName","r","s","useSwitchIndicatorStyles","checked","G4r02d","De3pzq","sj55zd","g2u3we","h3c5rm","B9xav0g","zhjwy3","Bi91k9c","Jwef8y","Bgoe8wy","Bwzppfd","oetu4i","gg5e9n","B2d53fq","iro3zm","b661bw","Bk6r4ia","B9zn80p","Bpld233","d","h","useMenuItemSwitchStyles_unstable","state","switchIndicatorStyles","switchIndicatorBaseStyles","className","components","checkmark","submenuIndicator","undefined","hasSubmenu","persistOnClick"],"sources":["useMenuItemSwitchStyles.styles.js"],"sourcesContent":["import { makeStyles, makeResetStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { useMenuItemStyles_unstable } from '../MenuItem/useMenuItemStyles.styles';\nexport const menuItemSwitchClassNames = {\n root: 'fui-MenuItemSwitch',\n icon: 'fui-MenuItemSwitch__icon',\n content: 'fui-MenuItemSwitch__content',\n secondaryContent: 'fui-MenuItemSwitch__secondaryContent',\n switchIndicator: 'fui-MenuItemSwitch__switchIndicator'\n};\nexport const circleFilledClassName = 'fui-MenuItemSwitch__switchIndicator__circleFilled';\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\nconst useSwitchIndicatorBaseClassName = makeResetStyles({\n borderRadius: tokens.borderRadiusCircular,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStrokeAccessible}`,\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n marginRight: tokens.spacingHorizontalXS,\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms'\n },\n color: tokens.colorNeutralStrokeAccessible,\n ':hover': {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover\n },\n ':hover:active': {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed\n },\n [`& .${circleFilledClassName}`]: {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms'\n }\n }\n});\nconst useSwitchIndicatorStyles = makeStyles({\n checked: {\n [`& .${circleFilledClassName}`]: {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`\n },\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n ':hover': {\n color: tokens.colorNeutralForegroundInverted,\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive)\n },\n ':hover:active': {\n color: tokens.colorNeutralForegroundInverted,\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive)\n }\n }\n});\n/**\n * Apply styling to the MenuItemSwitch slots based on the state\n */ export const useMenuItemSwitchStyles_unstable = (state)=>{\n const { checked } = state;\n const switchIndicatorStyles = useSwitchIndicatorStyles();\n const switchIndicatorBaseStyles = useSwitchIndicatorBaseClassName();\n state.root.className = mergeClasses(menuItemSwitchClassNames.root, state.root.className);\n if (state.content) {\n state.content.className = mergeClasses(menuItemSwitchClassNames.content, state.content.className);\n }\n if (state.secondaryContent) {\n state.secondaryContent.className = mergeClasses(menuItemSwitchClassNames.secondaryContent, state.secondaryContent.className);\n }\n if (state.icon) {\n state.icon.className = mergeClasses(menuItemSwitchClassNames.icon, state.icon.className);\n }\n if (state.switchIndicator) {\n state.switchIndicator.className = mergeClasses(menuItemSwitchClassNames.switchIndicator, switchIndicatorBaseStyles, checked && switchIndicatorStyles.checked, state.switchIndicator.className);\n }\n useMenuItemStyles_unstable({\n ...state,\n components: {\n ...state.components,\n checkmark: 'span',\n submenuIndicator: 'span'\n },\n checkmark: undefined,\n submenuIndicator: undefined,\n hasSubmenu: false,\n persistOnClick: true\n });\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAAC,aAAA,EAAsCC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACtF,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,0BAA0B,QAAQ,sCAAsC;AACjF,OAAO,MAAMC,wBAAwB,GAAG;EACpCC,IAAI,EAAE,oBAAoB;EAC1BC,IAAI,EAAE,0BAA0B;EAChCC,OAAO,EAAE,6BAA6B;EACtCC,gBAAgB,EAAE,sCAAsC;EACxDC,eAAe,EAAE;AACrB,CAAC;AACD,OAAO,MAAMC,qBAAqB,GAAG,mDAAmD;AACxF;AACA,MAAMC,yBAAyB,GAAG,CAAC;AACnC,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,UAAU,GAAG,EAAE;AACrB,MAAMC,SAAS,GAAGF,WAAW,GAAGD,yBAAyB;AACzD,MAAMI,+BAA+B,gBAAGhB,aAAA;EAAAiB,CAAA;EAAAC,CAAA;AAAA,CAkCvC,CAAC;AACF,MAAMC,wBAAwB,gBAAGpB,QAAA;EAAAqB,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC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EAAEuB,KAAK,CAACjC,eAAe,CAACoC,SAAS,CAAC;EAClM;EACA1C,0BAA0B,CAAC;IACvB,GAAGuC,KAAK;IACRI,UAAU,EAAE;MACR,GAAGJ,KAAK,CAACI,UAAU;MACnBC,SAAS,EAAE,MAAM;MACjBC,gBAAgB,EAAE;IACtB,CAAC;IACDD,SAAS,EAAEE,SAAS;IACpBD,gBAAgB,EAAEC,SAAS;IAC3BC,UAAU,EAAE,KAAK;IACjBC,cAAc,EAAE;EACpB,CAAC,CAAC;EACF,OAAOT,KAAK;AAChB,CAAC"}
|
@@ -16,11 +16,11 @@ const useStyles = /*#__PURE__*/__styles({
|
|
16
16
|
nep80a: ["fog3xzc", "f146oqes"],
|
17
17
|
Btx6110: "f5673lx",
|
18
18
|
B1zw9a1: "f23uflp",
|
19
|
-
B857g0j: "
|
19
|
+
B857g0j: "f6dghp8",
|
20
20
|
Bx4l464: "f1k81338"
|
21
21
|
}
|
22
22
|
}, {
|
23
|
-
d: [".f22iagw{display:flex;}", ".flhoj8d>.fui-MenuItem:nth-of-type(1){flex-grow:1;}", ".fj7wzln>.fui-MenuItem:nth-of-type(2){border-top-left-radius:0;}", ".fagfnhl>.fui-MenuItem:nth-of-type(2){border-top-right-radius:0;}", ".fghv8el>.fui-MenuItem:nth-of-type(2){border-bottom-left-radius:0;}", ".f1r95qti>.fui-MenuItem:nth-of-type(2){border-bottom-right-radius:0;}", ".fog3xzc>.fui-MenuItem:nth-of-type(2){padding-left:0;}", ".f146oqes>.fui-MenuItem:nth-of-type(2){padding-right:0;}", ".f5673lx>.fui-MenuItem:nth-of-type(2)::before{content:\"\";}", ".f23uflp>.fui-MenuItem:nth-of-type(2)::before{width:var(--strokeWidthThin);}", ".
|
23
|
+
d: [".f22iagw{display:flex;}", ".flhoj8d>.fui-MenuItem:nth-of-type(1){flex-grow:1;}", ".fj7wzln>.fui-MenuItem:nth-of-type(2){border-top-left-radius:0;}", ".fagfnhl>.fui-MenuItem:nth-of-type(2){border-top-right-radius:0;}", ".fghv8el>.fui-MenuItem:nth-of-type(2){border-bottom-left-radius:0;}", ".f1r95qti>.fui-MenuItem:nth-of-type(2){border-bottom-right-radius:0;}", ".fog3xzc>.fui-MenuItem:nth-of-type(2){padding-left:0;}", ".f146oqes>.fui-MenuItem:nth-of-type(2){padding-right:0;}", ".f5673lx>.fui-MenuItem:nth-of-type(2)::before{content:\"\";}", ".f23uflp>.fui-MenuItem:nth-of-type(2)::before{width:var(--strokeWidthThin);}", ".f6dghp8>.fui-MenuItem:nth-of-type(2)::before{height:20px;}", ".f1k81338>.fui-MenuItem:nth-of-type(2)::before{background-color:var(--colorNeutralStroke1);}"]
|
24
24
|
});
|
25
25
|
/**
|
26
26
|
* Apply styling to the MenuSplitGroup slots based on the state
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["__styles","mergeClasses","tokens","menuItemClassNames","menuSplitGroupClassNames","root","useStyles","mc9l5x","ni5quz","Irip7g","pgpdld","nep80a","Btx6110","B1zw9a1","B857g0j","Bx4l464","d","useMenuSplitGroupStyles_unstable","state","styles","className"],"sources":["useMenuSplitGroupStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { menuItemClassNames } from '../MenuItem/useMenuItemStyles.styles';\nexport const menuSplitGroupClassNames = {\n root: 'fui-MenuSplitGroup'\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n root: {\n display: 'flex',\n [`& > .${menuItemClassNames.root}:nth-of-type(1)`]: {\n flexGrow: 1\n },\n [`& > .${menuItemClassNames.root}:nth-of-type(2)`]: {\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n paddingLeft: 0,\n '::before': {\n content: '\"\"',\n width: tokens.strokeWidthThin,\n height: '
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","tokens","menuItemClassNames","menuSplitGroupClassNames","root","useStyles","mc9l5x","ni5quz","Irip7g","pgpdld","nep80a","Btx6110","B1zw9a1","B857g0j","Bx4l464","d","useMenuSplitGroupStyles_unstable","state","styles","className"],"sources":["useMenuSplitGroupStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { menuItemClassNames } from '../MenuItem/useMenuItemStyles.styles';\nexport const menuSplitGroupClassNames = {\n root: 'fui-MenuSplitGroup'\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n root: {\n display: 'flex',\n [`& > .${menuItemClassNames.root}:nth-of-type(1)`]: {\n flexGrow: 1\n },\n [`& > .${menuItemClassNames.root}:nth-of-type(2)`]: {\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n paddingLeft: 0,\n '::before': {\n content: '\"\"',\n width: tokens.strokeWidthThin,\n height: '20px',\n backgroundColor: tokens.colorNeutralStroke1\n }\n }\n }\n});\n/**\n * Apply styling to the MenuSplitGroup slots based on the state\n */ export const useMenuSplitGroupStyles_unstable = (state)=>{\n const styles = useStyles();\n state.root.className = mergeClasses(menuSplitGroupClassNames.root, styles.root, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,kBAAkB,QAAQ,sCAAsC;AACzE,OAAO,MAAMC,wBAAwB,GAAG;EACpCC,IAAI,EAAE;AACV,CAAC;AACD;AACA;AACA;AAAI,MAAMC,SAAS,gBAAGN,QAAA;EAAAK,IAAA;IAAAE,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAkBrB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,gCAAgC,GAAIC,KAAK,IAAG;EACzD,MAAMC,MAAM,GAAGb,SAAS,CAAC,CAAC;EAC1BY,KAAK,CAACb,IAAI,CAACe,SAAS,GAAGnB,YAAY,CAACG,wBAAwB,CAACC,IAAI,EAAEc,MAAM,CAACd,IAAI,EAAEa,KAAK,CAACb,IAAI,CAACe,SAAS,CAAC;EACrG,OAAOF,KAAK;AAChB,CAAC"}
|
package/lib/index.js
CHANGED
@@ -16,3 +16,4 @@ export { MenuTrigger, renderMenuTrigger_unstable, useMenuTrigger_unstable } from
|
|
16
16
|
export { useCheckmarkStyles_unstable } from './selectable/index';
|
17
17
|
export { MenuItemLink, menuItemLinkClassNames, renderMenuItemLink_unstable, useMenuItemLinkStyles_unstable, useMenuItemLink_unstable } from './MenuItemLink';
|
18
18
|
export { MENU_ENTER_EVENT, dispatchMenuEnterEvent, useOnMenuMouseEnter } from './utils';
|
19
|
+
export { MenuItemSwitch, useMenuItemSwitch_unstable, useMenuItemSwitchStyles_unstable, renderMenuItemSwitch_unstable, menuItemSwitchClassNames } from './MenuItemSwitch';
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export { MenuProvider, useMenuContext_unstable } from './contexts/menuContext';\nexport type { MenuContextValue } from './contexts/menuContext';\nexport { MenuTriggerContextProvider, useMenuTriggerContext_unstable } from './contexts/menuTriggerContext';\nexport { MenuGroupContextProvider, useMenuGroupContext_unstable } from './contexts/menuGroupContext';\nexport type { MenuGroupContextValue } from './contexts/menuGroupContext';\nexport { MenuListProvider, useMenuListContext_unstable } from './contexts/menuListContext';\nexport type { MenuListContextValue } from './contexts/menuListContext';\n\nexport { Menu, renderMenu_unstable, useMenuContextValues_unstable, useMenu_unstable } from './Menu';\nexport type {\n MenuContextValues,\n MenuOpenChangeData,\n MenuOpenEvent,\n // MenuOpenEvents is deprecated but removing it would be a breaking change\n // eslint-disable-next-line deprecation/deprecation\n MenuOpenEvents,\n MenuProps,\n MenuSlots,\n MenuState,\n} from './Menu';\nexport {\n MenuDivider,\n menuDividerClassNames,\n renderMenuDivider_unstable,\n useMenuDividerStyles_unstable,\n useMenuDivider_unstable,\n} from './MenuDivider';\nexport type { MenuDividerProps, MenuDividerSlots, MenuDividerState } from './MenuDivider';\nexport {\n MenuGroup,\n menuGroupClassNames,\n renderMenuGroup_unstable,\n useMenuGroupContextValues_unstable,\n useMenuGroupStyles_unstable,\n useMenuGroup_unstable,\n} from './MenuGroup';\nexport type { MenuGroupContextValues, MenuGroupProps, MenuGroupSlots, MenuGroupState } from './MenuGroup';\nexport {\n MenuGroupHeader,\n menuGroupHeaderClassNames,\n renderMenuGroupHeader_unstable,\n useMenuGroupHeaderStyles_unstable,\n useMenuGroupHeader_unstable,\n} from './MenuGroupHeader';\nexport type { MenuGroupHeaderProps, MenuGroupHeaderSlots, MenuGroupHeaderState } from './MenuGroupHeader';\nexport {\n MenuItem,\n menuItemClassNames,\n renderMenuItem_unstable,\n useMenuItemStyles_unstable,\n useMenuItem_unstable,\n} from './MenuItem';\nexport type { MenuItemProps, MenuItemSlots, MenuItemState } from './MenuItem';\nexport {\n MenuItemCheckbox,\n menuItemCheckboxClassNames,\n renderMenuItemCheckbox_unstable,\n useMenuItemCheckboxStyles_unstable,\n useMenuItemCheckbox_unstable,\n} from './MenuItemCheckbox';\nexport type { MenuItemCheckboxProps, MenuItemCheckboxState } from './MenuItemCheckbox';\nexport {\n MenuItemRadio,\n menuItemRadioClassNames,\n renderMenuItemRadio_unstable,\n useMenuItemRadioStyles_unstable,\n useMenuItemRadio_unstable,\n} from './MenuItemRadio';\nexport type { MenuItemRadioProps, MenuItemRadioState } from './MenuItemRadio';\nexport {\n MenuList,\n menuListClassNames,\n renderMenuList_unstable,\n useMenuListContextValues_unstable,\n useMenuListStyles_unstable,\n useMenuList_unstable,\n} from './MenuList';\nexport type {\n MenuCheckedValueChangeData,\n MenuCheckedValueChangeEvent,\n MenuListContextValues,\n MenuListProps,\n MenuListSlots,\n MenuListState,\n // UninitializedMenuListState is deprecated but removing it would be a breaking change\n // eslint-disable-next-line deprecation/deprecation\n UninitializedMenuListState,\n} from './MenuList';\nexport {\n MenuPopover,\n menuPopoverClassNames,\n renderMenuPopover_unstable,\n useMenuPopoverStyles_unstable,\n useMenuPopover_unstable,\n} from './MenuPopover';\nexport type { MenuPopoverProps, MenuPopoverSlots, MenuPopoverState } from './MenuPopover';\nexport {\n MenuSplitGroup,\n menuSplitGroupClassNames,\n renderMenuSplitGroup_unstable,\n useMenuSplitGroupStyles_unstable,\n useMenuSplitGroup_unstable,\n} from './MenuSplitGroup';\nexport type { MenuSplitGroupProps, MenuSplitGroupSlots, MenuSplitGroupState } from './MenuSplitGroup';\nexport { MenuTrigger, renderMenuTrigger_unstable, useMenuTrigger_unstable } from './MenuTrigger';\nexport type { MenuTriggerChildProps, MenuTriggerProps, MenuTriggerState } from './MenuTrigger';\n\nexport { useCheckmarkStyles_unstable } from './selectable/index';\nexport type { MenuItemSelectableProps, MenuItemSelectableState, SelectableHandler } from './selectable/index';\n\nexport {\n MenuItemLink,\n menuItemLinkClassNames,\n renderMenuItemLink_unstable,\n useMenuItemLinkStyles_unstable,\n useMenuItemLink_unstable,\n} from './MenuItemLink';\nexport type { MenuItemLinkProps, MenuItemLinkSlots, MenuItemLinkState } from './MenuItemLink';\n\nexport { MENU_ENTER_EVENT, dispatchMenuEnterEvent, useOnMenuMouseEnter } from './utils';\n"],"names":["MenuProvider","useMenuContext_unstable","MenuTriggerContextProvider","useMenuTriggerContext_unstable","MenuGroupContextProvider","useMenuGroupContext_unstable","MenuListProvider","useMenuListContext_unstable","Menu","renderMenu_unstable","useMenuContextValues_unstable","useMenu_unstable","MenuDivider","menuDividerClassNames","renderMenuDivider_unstable","useMenuDividerStyles_unstable","useMenuDivider_unstable","MenuGroup","menuGroupClassNames","renderMenuGroup_unstable","useMenuGroupContextValues_unstable","useMenuGroupStyles_unstable","useMenuGroup_unstable","MenuGroupHeader","menuGroupHeaderClassNames","renderMenuGroupHeader_unstable","useMenuGroupHeaderStyles_unstable","useMenuGroupHeader_unstable","MenuItem","menuItemClassNames","renderMenuItem_unstable","useMenuItemStyles_unstable","useMenuItem_unstable","MenuItemCheckbox","menuItemCheckboxClassNames","renderMenuItemCheckbox_unstable","useMenuItemCheckboxStyles_unstable","useMenuItemCheckbox_unstable","MenuItemRadio","menuItemRadioClassNames","renderMenuItemRadio_unstable","useMenuItemRadioStyles_unstable","useMenuItemRadio_unstable","MenuList","menuListClassNames","renderMenuList_unstable","useMenuListContextValues_unstable","useMenuListStyles_unstable","useMenuList_unstable","MenuPopover","menuPopoverClassNames","renderMenuPopover_unstable","useMenuPopoverStyles_unstable","useMenuPopover_unstable","MenuSplitGroup","menuSplitGroupClassNames","renderMenuSplitGroup_unstable","useMenuSplitGroupStyles_unstable","useMenuSplitGroup_unstable","MenuTrigger","renderMenuTrigger_unstable","useMenuTrigger_unstable","useCheckmarkStyles_unstable","MenuItemLink","menuItemLinkClassNames","renderMenuItemLink_unstable","useMenuItemLinkStyles_unstable","useMenuItemLink_unstable","MENU_ENTER_EVENT","dispatchMenuEnterEvent","useOnMenuMouseEnter"],"mappings":"AAAA,SAASA,YAAY,EAAEC,uBAAuB,QAAQ,yBAAyB;AAE/E,SAASC,0BAA0B,EAAEC,8BAA8B,QAAQ,gCAAgC;AAC3G,SAASC,wBAAwB,EAAEC,4BAA4B,QAAQ,8BAA8B;AAErG,SAASC,gBAAgB,EAAEC,2BAA2B,QAAQ,6BAA6B;AAG3F,SAASC,IAAI,EAAEC,mBAAmB,EAAEC,6BAA6B,EAAEC,gBAAgB,QAAQ,SAAS;AAYpG,SACEC,WAAW,EACXC,qBAAqB,EACrBC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,uBAAuB,QAClB,gBAAgB;AAEvB,SACEC,SAAS,EACTC,mBAAmB,EACnBC,wBAAwB,EACxBC,kCAAkC,EAClCC,2BAA2B,EAC3BC,qBAAqB,QAChB,cAAc;AAErB,SACEC,eAAe,EACfC,yBAAyB,EACzBC,8BAA8B,EAC9BC,iCAAiC,EACjCC,2BAA2B,QACtB,oBAAoB;AAE3B,SACEC,QAAQ,EACRC,kBAAkB,EAClBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,oBAAoB,QACf,aAAa;AAEpB,SACEC,gBAAgB,EAChBC,0BAA0B,EAC1BC,+BAA+B,EAC/BC,kCAAkC,EAClCC,4BAA4B,QACvB,qBAAqB;AAE5B,SACEC,aAAa,EACbC,uBAAuB,EACvBC,4BAA4B,EAC5BC,+BAA+B,EAC/BC,yBAAyB,QACpB,kBAAkB;AAEzB,SACEC,QAAQ,EACRC,kBAAkB,EAClBC,uBAAuB,EACvBC,iCAAiC,EACjCC,0BAA0B,EAC1BC,oBAAoB,QACf,aAAa;AAYpB,SACEC,WAAW,EACXC,qBAAqB,EACrBC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,uBAAuB,QAClB,gBAAgB;AAEvB,SACEC,cAAc,EACdC,wBAAwB,EACxBC,6BAA6B,EAC7BC,gCAAgC,EAChCC,0BAA0B,QACrB,mBAAmB;AAE1B,SAASC,WAAW,EAAEC,0BAA0B,EAAEC,uBAAuB,QAAQ,gBAAgB;AAGjG,SAASC,2BAA2B,QAAQ,qBAAqB;AAGjE,SACEC,YAAY,EACZC,sBAAsB,EACtBC,2BAA2B,EAC3BC,8BAA8B,EAC9BC,wBAAwB,QACnB,iBAAiB;AAGxB,SAASC,gBAAgB,EAAEC,sBAAsB,EAAEC,mBAAmB,QAAQ,UAAU"}
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { MenuProvider, useMenuContext_unstable } from './contexts/menuContext';\nexport type { MenuContextValue } from './contexts/menuContext';\nexport { MenuTriggerContextProvider, useMenuTriggerContext_unstable } from './contexts/menuTriggerContext';\nexport { MenuGroupContextProvider, useMenuGroupContext_unstable } from './contexts/menuGroupContext';\nexport type { MenuGroupContextValue } from './contexts/menuGroupContext';\nexport { MenuListProvider, useMenuListContext_unstable } from './contexts/menuListContext';\nexport type { MenuListContextValue } from './contexts/menuListContext';\n\nexport { Menu, renderMenu_unstable, useMenuContextValues_unstable, useMenu_unstable } from './Menu';\nexport type {\n MenuContextValues,\n MenuOpenChangeData,\n MenuOpenEvent,\n // MenuOpenEvents is deprecated but removing it would be a breaking change\n // eslint-disable-next-line deprecation/deprecation\n MenuOpenEvents,\n MenuProps,\n MenuSlots,\n MenuState,\n} from './Menu';\nexport {\n MenuDivider,\n menuDividerClassNames,\n renderMenuDivider_unstable,\n useMenuDividerStyles_unstable,\n useMenuDivider_unstable,\n} from './MenuDivider';\nexport type { MenuDividerProps, MenuDividerSlots, MenuDividerState } from './MenuDivider';\nexport {\n MenuGroup,\n menuGroupClassNames,\n renderMenuGroup_unstable,\n useMenuGroupContextValues_unstable,\n useMenuGroupStyles_unstable,\n useMenuGroup_unstable,\n} from './MenuGroup';\nexport type { MenuGroupContextValues, MenuGroupProps, MenuGroupSlots, MenuGroupState } from './MenuGroup';\nexport {\n MenuGroupHeader,\n menuGroupHeaderClassNames,\n renderMenuGroupHeader_unstable,\n useMenuGroupHeaderStyles_unstable,\n useMenuGroupHeader_unstable,\n} from './MenuGroupHeader';\nexport type { MenuGroupHeaderProps, MenuGroupHeaderSlots, MenuGroupHeaderState } from './MenuGroupHeader';\nexport {\n MenuItem,\n menuItemClassNames,\n renderMenuItem_unstable,\n useMenuItemStyles_unstable,\n useMenuItem_unstable,\n} from './MenuItem';\nexport type { MenuItemProps, MenuItemSlots, MenuItemState } from './MenuItem';\nexport {\n MenuItemCheckbox,\n menuItemCheckboxClassNames,\n renderMenuItemCheckbox_unstable,\n useMenuItemCheckboxStyles_unstable,\n useMenuItemCheckbox_unstable,\n} from './MenuItemCheckbox';\nexport type { MenuItemCheckboxProps, MenuItemCheckboxState } from './MenuItemCheckbox';\nexport {\n MenuItemRadio,\n menuItemRadioClassNames,\n renderMenuItemRadio_unstable,\n useMenuItemRadioStyles_unstable,\n useMenuItemRadio_unstable,\n} from './MenuItemRadio';\nexport type { MenuItemRadioProps, MenuItemRadioState } from './MenuItemRadio';\nexport {\n MenuList,\n menuListClassNames,\n renderMenuList_unstable,\n useMenuListContextValues_unstable,\n useMenuListStyles_unstable,\n useMenuList_unstable,\n} from './MenuList';\nexport type {\n MenuCheckedValueChangeData,\n MenuCheckedValueChangeEvent,\n MenuListContextValues,\n MenuListProps,\n MenuListSlots,\n MenuListState,\n // UninitializedMenuListState is deprecated but removing it would be a breaking change\n // eslint-disable-next-line deprecation/deprecation\n UninitializedMenuListState,\n} from './MenuList';\nexport {\n MenuPopover,\n menuPopoverClassNames,\n renderMenuPopover_unstable,\n useMenuPopoverStyles_unstable,\n useMenuPopover_unstable,\n} from './MenuPopover';\nexport type { MenuPopoverProps, MenuPopoverSlots, MenuPopoverState } from './MenuPopover';\nexport {\n MenuSplitGroup,\n menuSplitGroupClassNames,\n renderMenuSplitGroup_unstable,\n useMenuSplitGroupStyles_unstable,\n useMenuSplitGroup_unstable,\n} from './MenuSplitGroup';\nexport type { MenuSplitGroupProps, MenuSplitGroupSlots, MenuSplitGroupState } from './MenuSplitGroup';\nexport { MenuTrigger, renderMenuTrigger_unstable, useMenuTrigger_unstable } from './MenuTrigger';\nexport type { MenuTriggerChildProps, MenuTriggerProps, MenuTriggerState } from './MenuTrigger';\n\nexport { useCheckmarkStyles_unstable } from './selectable/index';\nexport type { MenuItemSelectableProps, MenuItemSelectableState, SelectableHandler } from './selectable/index';\n\nexport {\n MenuItemLink,\n menuItemLinkClassNames,\n renderMenuItemLink_unstable,\n useMenuItemLinkStyles_unstable,\n useMenuItemLink_unstable,\n} from './MenuItemLink';\nexport type { MenuItemLinkProps, MenuItemLinkSlots, MenuItemLinkState } from './MenuItemLink';\n\nexport { MENU_ENTER_EVENT, dispatchMenuEnterEvent, useOnMenuMouseEnter } from './utils';\nexport {\n MenuItemSwitch,\n useMenuItemSwitch_unstable,\n useMenuItemSwitchStyles_unstable,\n renderMenuItemSwitch_unstable,\n menuItemSwitchClassNames,\n} from './MenuItemSwitch';\n\nexport type { MenuItemSwitchProps, MenuItemSwitchState, MenuItemSwitchSlots } from './MenuItemSwitch';\n"],"names":["MenuProvider","useMenuContext_unstable","MenuTriggerContextProvider","useMenuTriggerContext_unstable","MenuGroupContextProvider","useMenuGroupContext_unstable","MenuListProvider","useMenuListContext_unstable","Menu","renderMenu_unstable","useMenuContextValues_unstable","useMenu_unstable","MenuDivider","menuDividerClassNames","renderMenuDivider_unstable","useMenuDividerStyles_unstable","useMenuDivider_unstable","MenuGroup","menuGroupClassNames","renderMenuGroup_unstable","useMenuGroupContextValues_unstable","useMenuGroupStyles_unstable","useMenuGroup_unstable","MenuGroupHeader","menuGroupHeaderClassNames","renderMenuGroupHeader_unstable","useMenuGroupHeaderStyles_unstable","useMenuGroupHeader_unstable","MenuItem","menuItemClassNames","renderMenuItem_unstable","useMenuItemStyles_unstable","useMenuItem_unstable","MenuItemCheckbox","menuItemCheckboxClassNames","renderMenuItemCheckbox_unstable","useMenuItemCheckboxStyles_unstable","useMenuItemCheckbox_unstable","MenuItemRadio","menuItemRadioClassNames","renderMenuItemRadio_unstable","useMenuItemRadioStyles_unstable","useMenuItemRadio_unstable","MenuList","menuListClassNames","renderMenuList_unstable","useMenuListContextValues_unstable","useMenuListStyles_unstable","useMenuList_unstable","MenuPopover","menuPopoverClassNames","renderMenuPopover_unstable","useMenuPopoverStyles_unstable","useMenuPopover_unstable","MenuSplitGroup","menuSplitGroupClassNames","renderMenuSplitGroup_unstable","useMenuSplitGroupStyles_unstable","useMenuSplitGroup_unstable","MenuTrigger","renderMenuTrigger_unstable","useMenuTrigger_unstable","useCheckmarkStyles_unstable","MenuItemLink","menuItemLinkClassNames","renderMenuItemLink_unstable","useMenuItemLinkStyles_unstable","useMenuItemLink_unstable","MENU_ENTER_EVENT","dispatchMenuEnterEvent","useOnMenuMouseEnter","MenuItemSwitch","useMenuItemSwitch_unstable","useMenuItemSwitchStyles_unstable","renderMenuItemSwitch_unstable","menuItemSwitchClassNames"],"mappings":"AAAA,SAASA,YAAY,EAAEC,uBAAuB,QAAQ,yBAAyB;AAE/E,SAASC,0BAA0B,E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Y,EACZC,sBAAsB,EACtBC,2BAA2B,EAC3BC,8BAA8B,EAC9BC,wBAAwB,QACnB,iBAAiB;AAGxB,SAASC,gBAAgB,EAAEC,sBAAsB,EAAEC,mBAAmB,QAAQ,UAAU;AACxF,SACEC,cAAc,EACdC,0BAA0B,EAC1BC,gCAAgC,EAChCC,6BAA6B,EAC7BC,wBAAwB,QACnB,mBAAmB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["MenuItemSwitch.js"],"sourcesContent":["export * from './components/MenuItemSwitch/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
|
@@ -134,7 +134,6 @@ const useMenuOpenState = (state)=>{
|
|
134
134
|
var _state_onOpenChange;
|
135
135
|
return (_state_onOpenChange = state.onOpenChange) === null || _state_onOpenChange === void 0 ? void 0 : _state_onOpenChange.call(state, e, data);
|
136
136
|
});
|
137
|
-
const setOpenTimeout = _react.useRef(0);
|
138
137
|
const enteringTriggerRef = _react.useRef(false);
|
139
138
|
const [open, setOpenState] = (0, _reactutilities.useControllableState)({
|
140
139
|
state: state.open,
|
@@ -159,8 +158,9 @@ const useMenuOpenState = (state)=>{
|
|
159
158
|
}
|
160
159
|
setOpenState(data.open);
|
161
160
|
});
|
161
|
+
const [setOpenTimeout, clearOpenTimeout] = (0, _reactutilities.useTimeout)();
|
162
162
|
const setOpen = (0, _reactutilities.useEventCallback)((e, data)=>{
|
163
|
-
|
163
|
+
clearOpenTimeout();
|
164
164
|
if (!(e instanceof Event) && e.persist) {
|
165
165
|
// < React 17 still uses pooled synthetic events
|
166
166
|
e.persist();
|
@@ -170,10 +170,7 @@ const useMenuOpenState = (state)=>{
|
|
170
170
|
if ((_state_triggerRef_current = state.triggerRef.current) === null || _state_triggerRef_current === void 0 ? void 0 : _state_triggerRef_current.contains(e.target)) {
|
171
171
|
enteringTriggerRef.current = e.type === 'mouseenter' || e.type === 'mousemove';
|
172
172
|
}
|
173
|
-
|
174
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
175
|
-
// @ts-ignore
|
176
|
-
setOpenTimeout.current = setTimeout(()=>trySetOpen(e, data), state.hoverDelay);
|
173
|
+
setOpenTimeout(()=>trySetOpen(e, data), state.hoverDelay);
|
177
174
|
} else {
|
178
175
|
trySetOpen(e, data);
|
179
176
|
}
|
@@ -226,13 +223,6 @@ const useMenuOpenState = (state)=>{
|
|
226
223
|
state.menuPopoverRef
|
227
224
|
]
|
228
225
|
});
|
229
|
-
// Clear timeout on unmount
|
230
|
-
// Setting state after a component unmounts can cause memory leaks
|
231
|
-
_react.useEffect(()=>{
|
232
|
-
return ()=>{
|
233
|
-
clearTimeout(setOpenTimeout.current);
|
234
|
-
};
|
235
|
-
}, []);
|
236
226
|
// Manage focus for open state
|
237
227
|
const { findFirstFocusable } = (0, _reacttabster.useFocusFinders)();
|
238
228
|
const focusFirst = _react.useCallback(()=>{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useMenu.js"],"sourcesContent":["import * as React from 'react';\nimport { usePositioningMouseTarget, usePositioning, resolvePositioningShorthand } from '@fluentui/react-positioning';\nimport { useControllableState, useId, useOnClickOutside, useEventCallback, useOnScrollOutside, elementContains } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MENU_ENTER_EVENT, useOnMenuMouseEnter } from '../../utils/index';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\n// If it's not possible to position the submenu in smaller viewports, try\n// and fallback to this order of positions\nconst submenuFallbackPositions = [\n 'after',\n 'after-bottom',\n 'before-top',\n 'before',\n 'before-bottom',\n 'above'\n];\n/**\n * Create the state required to render Menu.\n *\n * The returned state can be modified with hooks such as useMenuStyles,\n * before being passed to renderMenu_unstable.\n *\n * @param props - props from this instance of Menu\n */ export const useMenu_unstable = (props)=>{\n const isSubmenu = useIsSubmenu();\n const { hoverDelay = 500, inline = false, hasCheckmarks = false, hasIcons = false, closeOnScroll = false, openOnContext = false, persistOnItemClick = false, openOnHover = isSubmenu, defaultCheckedValues, mountNode = null } = props;\n const triggerId = useId('menu');\n const [contextTarget, setContextTarget] = usePositioningMouseTarget();\n const positioningState = {\n position: isSubmenu ? 'after' : 'below',\n align: isSubmenu ? 'top' : 'start',\n target: props.openOnContext ? contextTarget : undefined,\n fallbackPositions: isSubmenu ? submenuFallbackPositions : undefined,\n ...resolvePositioningShorthand(props.positioning)\n };\n const children = React.Children.toArray(props.children);\n if (process.env.NODE_ENV !== 'production') {\n if (children.length === 0) {\n // eslint-disable-next-line no-console\n console.warn('Menu must contain at least one child');\n }\n if (children.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('Menu must contain at most two children');\n }\n }\n let menuTrigger = undefined;\n let menuPopover = undefined;\n if (children.length === 2) {\n menuTrigger = children[0];\n menuPopover = children[1];\n } else if (children.length === 1) {\n menuPopover = children[0];\n }\n const { targetRef: triggerRef, containerRef: menuPopoverRef } = usePositioning(positioningState);\n // TODO Better way to narrow types ?\n const [open, setOpen] = useMenuOpenState({\n hoverDelay,\n isSubmenu,\n setContextTarget,\n closeOnScroll,\n menuPopoverRef,\n triggerRef,\n open: props.open,\n defaultOpen: props.defaultOpen,\n onOpenChange: props.onOpenChange,\n openOnContext\n });\n const [checkedValues, onCheckedValueChange] = useMenuSelectableState({\n checkedValues: props.checkedValues,\n defaultCheckedValues,\n onCheckedValueChange: props.onCheckedValueChange\n });\n return {\n inline,\n hoverDelay,\n triggerId,\n isSubmenu,\n openOnHover,\n contextTarget,\n setContextTarget,\n hasCheckmarks,\n hasIcons,\n closeOnScroll,\n menuTrigger,\n menuPopover,\n mountNode,\n triggerRef,\n menuPopoverRef,\n components: {},\n openOnContext,\n open,\n setOpen,\n checkedValues,\n onCheckedValueChange,\n persistOnItemClick\n };\n};\n/**\n * Adds appropriate state values and handlers for selectable items\n * i.e checkboxes and radios\n */ const useMenuSelectableState = (props)=>{\n const [checkedValues, setCheckedValues] = useControllableState({\n state: props.checkedValues,\n defaultState: props.defaultCheckedValues,\n initialState: {}\n });\n const onCheckedValueChange = useEventCallback((e, { name, checkedItems })=>{\n var _props_onCheckedValueChange;\n (_props_onCheckedValueChange = props.onCheckedValueChange) === null || _props_onCheckedValueChange === void 0 ? void 0 : _props_onCheckedValueChange.call(props, e, {\n name,\n checkedItems\n });\n setCheckedValues((currentValue)=>({\n ...currentValue,\n [name]: checkedItems\n }));\n });\n return [\n checkedValues,\n onCheckedValueChange\n ];\n};\nconst useMenuOpenState = (state)=>{\n const { targetDocument } = useFluent();\n const parentSetOpen = useMenuContext_unstable((context)=>context.setOpen);\n const onOpenChange = useEventCallback((e, data)=>{\n var _state_onOpenChange;\n return (_state_onOpenChange = state.onOpenChange) === null || _state_onOpenChange === void 0 ? void 0 : _state_onOpenChange.call(state, e, data);\n });\n const setOpenTimeout = React.useRef(0);\n const enteringTriggerRef = React.useRef(false);\n const [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false\n });\n const trySetOpen = useEventCallback((e, data)=>{\n const event = e instanceof CustomEvent && e.type === MENU_ENTER_EVENT ? e.detail.nativeEvent : e;\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(event, {\n ...data\n });\n if (data.open && e.type === 'contextmenu') {\n state.setContextTarget(e);\n }\n if (!data.open) {\n state.setContextTarget(undefined);\n }\n if (data.bubble) {\n parentSetOpen(e, {\n ...data\n });\n }\n setOpenState(data.open);\n });\n const setOpen = useEventCallback((e, data)=>{\n clearTimeout(setOpenTimeout.current);\n if (!(e instanceof Event) && e.persist) {\n // < React 17 still uses pooled synthetic events\n e.persist();\n }\n if (e.type === 'mouseleave' || e.type === 'mouseenter' || e.type === 'mousemove' || e.type === MENU_ENTER_EVENT) {\n var _state_triggerRef_current;\n if ((_state_triggerRef_current = state.triggerRef.current) === null || _state_triggerRef_current === void 0 ? void 0 : _state_triggerRef_current.contains(e.target)) {\n enteringTriggerRef.current = e.type === 'mouseenter' || e.type === 'mousemove';\n }\n // FIXME leaking Node timeout type\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n setOpenTimeout.current = setTimeout(()=>trySetOpen(e, data), state.hoverDelay);\n } else {\n trySetOpen(e, data);\n }\n });\n useOnClickOutside({\n contains: elementContains,\n disabled: !open,\n element: targetDocument,\n refs: [\n state.menuPopoverRef,\n !state.openOnContext && state.triggerRef\n ].filter(Boolean),\n callback: (event)=>setOpen(event, {\n open: false,\n type: 'clickOutside',\n event\n })\n });\n // only close on scroll for context, or when closeOnScroll is specified\n const closeOnScroll = state.openOnContext || state.closeOnScroll;\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: (event)=>setOpen(event, {\n open: false,\n type: 'scrollOutside',\n event\n }),\n refs: [\n state.menuPopoverRef,\n !state.openOnContext && state.triggerRef\n ].filter(Boolean),\n disabled: !open || !closeOnScroll\n });\n useOnMenuMouseEnter({\n element: targetDocument,\n callback: (event)=>{\n // When moving from a menu directly back to its trigger, this handler can close the menu\n // Explicitly check a flag to see if this situation happens\n if (!enteringTriggerRef.current) {\n setOpen(event, {\n open: false,\n type: 'menuMouseEnter',\n event\n });\n }\n },\n disabled: !open,\n refs: [\n state.menuPopoverRef\n ]\n });\n // Clear timeout on unmount\n // Setting state after a component unmounts can cause memory leaks\n React.useEffect(()=>{\n return ()=>{\n clearTimeout(setOpenTimeout.current);\n };\n }, []);\n // Manage focus for open state\n const { findFirstFocusable } = useFocusFinders();\n const focusFirst = React.useCallback(()=>{\n const firstFocusable = findFirstFocusable(state.menuPopoverRef.current);\n firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();\n }, [\n findFirstFocusable,\n state.menuPopoverRef\n ]);\n React.useEffect(()=>{\n if (open) {\n focusFirst();\n }\n }, [\n open,\n focusFirst\n ]);\n return [\n open,\n setOpen\n ];\n};\n"],"names":["useMenu_unstable","submenuFallbackPositions","props","isSubmenu","useIsSubmenu","hoverDelay","inline","hasCheckmarks","hasIcons","closeOnScroll","openOnContext","persistOnItemClick","openOnHover","defaultCheckedValues","mountNode","triggerId","useId","contextTarget","setContextTarget","usePositioningMouseTarget","positioningState","position","align","target","undefined","fallbackPositions","resolvePositioningShorthand","positioning","children","React","Children","toArray","process","env","NODE_ENV","length","console","warn","menuTrigger","menuPopover","targetRef","triggerRef","containerRef","menuPopoverRef","usePositioning","open","setOpen","useMenuOpenState","defaultOpen","onOpenChange","checkedValues","onCheckedValueChange","useMenuSelectableState","components","setCheckedValues","useControllableState","state","defaultState","initialState","useEventCallback","e","name","checkedItems","_props_onCheckedValueChange","call","currentValue","targetDocument","useFluent","parentSetOpen","useMenuContext_unstable","context","data","_state_onOpenChange","setOpenTimeout","useRef","enteringTriggerRef","setOpenState","trySetOpen","event","CustomEvent","type","MENU_ENTER_EVENT","detail","nativeEvent","bubble","clearTimeout","current","Event","persist","_state_triggerRef_current","contains","setTimeout","useOnClickOutside","elementContains","disabled","element","refs","filter","Boolean","callback","useOnScrollOutside","useOnMenuMouseEnter","useEffect","findFirstFocusable","useFocusFinders","focusFirst","useCallback","firstFocusable","focus"],"mappings":";;;;+BAyBiBA;;;eAAAA;;;;iEAzBM;kCACgE;gCAC+B;qCACtE;8BAChB;6BACQ;uBACc;8BACzB;AAC7B,yEAAyE;AACzE,0CAA0C;AAC1C,MAAMC,2BAA2B;IAC7B;IACA;IACA;IACA;IACA;IACA;CACH;AAQU,MAAMD,mBAAmB,CAACE;IACjC,MAAMC,YAAYC,IAAAA,0BAAY;IAC9B,MAAM,EAAEC,aAAa,GAAG,EAAEC,SAAS,KAAK,EAAEC,gBAAgB,KAAK,EAAEC,WAAW,KAAK,EAAEC,gBAAgB,KAAK,EAAEC,gBAAgB,KAAK,EAAEC,qBAAqB,KAAK,EAAEC,cAAcT,SAAS,EAAEU,oBAAoB,EAAEC,YAAY,IAAI,EAAE,GAAGZ;IACjO,MAAMa,YAAYC,IAAAA,qBAAK,EAAC;IACx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AaZ,eAAea,OAAO;QACvC;IACJ,GAAG,EAAE;IACL,8BAA8B;IAC9B,MAAM,EAAEiB,kBAAkB,EAAE,GAAGC,IAAAA,6BAAe;IAC9C,MAAMC,aAAa5E,OAAM6E,WAAW,CAAC;QACjC,MAAMC,iBAAiBJ,mBAAmB/C,MAAMb,cAAc,CAAC2C,OAAO;QACtEqB,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeC,KAAK;IACxF,GAAG;QACCL;QACA/C,MAAMb,cAAc;KACvB;IACDd,OAAMyE,SAAS,CAAC;QACZ,IAAIzD,MAAM;YACN4D;QACJ;IACJ,GAAG;QACC5D;QACA4D;KACH;IACD,OAAO;QACH5D;QACAC;KACH;AACL"}
|
1
|
+
{"version":3,"sources":["useMenu.js"],"sourcesContent":["import * as React from 'react';\nimport { usePositioningMouseTarget, usePositioning, resolvePositioningShorthand } from '@fluentui/react-positioning';\nimport { useControllableState, useId, useOnClickOutside, useEventCallback, useOnScrollOutside, elementContains, useTimeout } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MENU_ENTER_EVENT, useOnMenuMouseEnter } from '../../utils/index';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\n// If it's not possible to position the submenu in smaller viewports, try\n// and fallback to this order of positions\nconst submenuFallbackPositions = [\n 'after',\n 'after-bottom',\n 'before-top',\n 'before',\n 'before-bottom',\n 'above'\n];\n/**\n * Create the state required to render Menu.\n *\n * The returned state can be modified with hooks such as useMenuStyles,\n * before being passed to renderMenu_unstable.\n *\n * @param props - props from this instance of Menu\n */ export const useMenu_unstable = (props)=>{\n const isSubmenu = useIsSubmenu();\n const { hoverDelay = 500, inline = false, hasCheckmarks = false, hasIcons = false, closeOnScroll = false, openOnContext = false, persistOnItemClick = false, openOnHover = isSubmenu, defaultCheckedValues, mountNode = null } = props;\n const triggerId = useId('menu');\n const [contextTarget, setContextTarget] = usePositioningMouseTarget();\n const positioningState = {\n position: isSubmenu ? 'after' : 'below',\n align: isSubmenu ? 'top' : 'start',\n target: props.openOnContext ? contextTarget : undefined,\n fallbackPositions: isSubmenu ? submenuFallbackPositions : undefined,\n ...resolvePositioningShorthand(props.positioning)\n };\n const children = React.Children.toArray(props.children);\n if (process.env.NODE_ENV !== 'production') {\n if (children.length === 0) {\n // eslint-disable-next-line no-console\n console.warn('Menu must contain at least one child');\n }\n if (children.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('Menu must contain at most two children');\n }\n }\n let menuTrigger = undefined;\n let menuPopover = undefined;\n if (children.length === 2) {\n menuTrigger = children[0];\n menuPopover = children[1];\n } else if (children.length === 1) {\n menuPopover = children[0];\n }\n const { targetRef: triggerRef, containerRef: menuPopoverRef } = usePositioning(positioningState);\n // TODO Better way to narrow types ?\n const [open, setOpen] = useMenuOpenState({\n hoverDelay,\n isSubmenu,\n setContextTarget,\n closeOnScroll,\n menuPopoverRef,\n triggerRef,\n open: props.open,\n defaultOpen: props.defaultOpen,\n onOpenChange: props.onOpenChange,\n openOnContext\n });\n const [checkedValues, onCheckedValueChange] = useMenuSelectableState({\n checkedValues: props.checkedValues,\n defaultCheckedValues,\n onCheckedValueChange: props.onCheckedValueChange\n });\n return {\n inline,\n hoverDelay,\n triggerId,\n isSubmenu,\n openOnHover,\n contextTarget,\n setContextTarget,\n hasCheckmarks,\n hasIcons,\n closeOnScroll,\n menuTrigger,\n menuPopover,\n mountNode,\n triggerRef,\n menuPopoverRef,\n components: {},\n openOnContext,\n open,\n setOpen,\n checkedValues,\n onCheckedValueChange,\n persistOnItemClick\n };\n};\n/**\n * Adds appropriate state values and handlers for selectable items\n * i.e checkboxes and radios\n */ const useMenuSelectableState = (props)=>{\n const [checkedValues, setCheckedValues] = useControllableState({\n state: props.checkedValues,\n defaultState: props.defaultCheckedValues,\n initialState: {}\n });\n const onCheckedValueChange = useEventCallback((e, { name, checkedItems })=>{\n var _props_onCheckedValueChange;\n (_props_onCheckedValueChange = props.onCheckedValueChange) === null || _props_onCheckedValueChange === void 0 ? void 0 : _props_onCheckedValueChange.call(props, e, {\n name,\n checkedItems\n });\n setCheckedValues((currentValue)=>({\n ...currentValue,\n [name]: checkedItems\n }));\n });\n return [\n checkedValues,\n onCheckedValueChange\n ];\n};\nconst useMenuOpenState = (state)=>{\n const { targetDocument } = useFluent();\n const parentSetOpen = useMenuContext_unstable((context)=>context.setOpen);\n const onOpenChange = useEventCallback((e, data)=>{\n var _state_onOpenChange;\n return (_state_onOpenChange = state.onOpenChange) === null || _state_onOpenChange === void 0 ? void 0 : _state_onOpenChange.call(state, e, data);\n });\n const enteringTriggerRef = React.useRef(false);\n const [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false\n });\n const trySetOpen = useEventCallback((e, data)=>{\n const event = e instanceof CustomEvent && e.type === MENU_ENTER_EVENT ? e.detail.nativeEvent : e;\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(event, {\n ...data\n });\n if (data.open && e.type === 'contextmenu') {\n state.setContextTarget(e);\n }\n if (!data.open) {\n state.setContextTarget(undefined);\n }\n if (data.bubble) {\n parentSetOpen(e, {\n ...data\n });\n }\n setOpenState(data.open);\n });\n const [setOpenTimeout, clearOpenTimeout] = useTimeout();\n const setOpen = useEventCallback((e, data)=>{\n clearOpenTimeout();\n if (!(e instanceof Event) && e.persist) {\n // < React 17 still uses pooled synthetic events\n e.persist();\n }\n if (e.type === 'mouseleave' || e.type === 'mouseenter' || e.type === 'mousemove' || e.type === MENU_ENTER_EVENT) {\n var _state_triggerRef_current;\n if ((_state_triggerRef_current = state.triggerRef.current) === null || _state_triggerRef_current === void 0 ? void 0 : _state_triggerRef_current.contains(e.target)) {\n enteringTriggerRef.current = e.type === 'mouseenter' || e.type === 'mousemove';\n }\n setOpenTimeout(()=>trySetOpen(e, data), state.hoverDelay);\n } else {\n trySetOpen(e, data);\n }\n });\n useOnClickOutside({\n contains: elementContains,\n disabled: !open,\n element: targetDocument,\n refs: [\n state.menuPopoverRef,\n !state.openOnContext && state.triggerRef\n ].filter(Boolean),\n callback: (event)=>setOpen(event, {\n open: false,\n type: 'clickOutside',\n event\n })\n });\n // only close on scroll for context, or when closeOnScroll is specified\n const closeOnScroll = state.openOnContext || state.closeOnScroll;\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: (event)=>setOpen(event, {\n open: false,\n type: 'scrollOutside',\n event\n }),\n refs: [\n state.menuPopoverRef,\n !state.openOnContext && state.triggerRef\n ].filter(Boolean),\n disabled: !open || !closeOnScroll\n });\n useOnMenuMouseEnter({\n element: targetDocument,\n callback: (event)=>{\n // When moving from a menu directly back to its trigger, this handler can close the menu\n // Explicitly check a flag to see if this situation happens\n if (!enteringTriggerRef.current) {\n setOpen(event, {\n open: false,\n type: 'menuMouseEnter',\n event\n });\n }\n },\n disabled: !open,\n refs: [\n state.menuPopoverRef\n ]\n });\n // Manage focus for open state\n const { findFirstFocusable } = useFocusFinders();\n const focusFirst = React.useCallback(()=>{\n const firstFocusable = findFirstFocusable(state.menuPopoverRef.current);\n firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();\n }, [\n findFirstFocusable,\n state.menuPopoverRef\n ]);\n React.useEffect(()=>{\n if (open) {\n focusFirst();\n }\n }, [\n open,\n focusFirst\n ]);\n return [\n open,\n setOpen\n ];\n};\n"],"names":["useMenu_unstable","submenuFallbackPositions","props","isSubmenu","useIsSubmenu","hoverDelay","inline","hasCheckmarks","hasIcons","closeOnScroll","openOnContext","persistOnItemClick","openOnHover","defaultCheckedValues","mountNode","triggerId","useId","contextTarget","setContextTarget","usePositioningMouseTarget","positioningState","position","align","target","undefined","fallbackPositions","resolvePositioningShorthand","positioning","children","React","Children","toArray","process","env","NODE_ENV","length","console","warn","menuTrigger","menuPopover","targetRef","triggerRef","containerRef","menuPopoverRef","usePositioning","open","setOpen","useMenuOpenState","defaultOpen","onOpenChange","checkedValues","onCheckedValueChange","useMenuSelectableState","components","setCheckedValues","useControllableState","state","defaultState","initialState","useEventCallback","e","name","checkedItems","_props_onCheckedValueChange","call","currentValue","targetDocument","useFluent","parentSetOpen","useMenuContext_unstable","context","data","_state_onOpenChange","enteringTriggerRef","useRef","setOpenState","trySetOpen","event","CustomEvent","type","MENU_ENTER_EVENT","detail","nativeEvent","bubble","setOpenTimeout","clearOpenTimeout","useTimeout","Event","persist","_state_triggerRef_current","current","contains","useOnClickOutside","elementContains","disabled","element","refs","filter","Boolean","callback","useOnScrollOutside","useOnMenuMouseEnter","findFirstFocusable","useFocusFinders","focusFirst","useCallback","firstFocusable","focus","useEffect"],"mappings":";;;;+BAyBiBA;;;eAAAA;;;;iEAzBM;kCACgE;gCAC2C;qCAClF;8BAChB;6BACQ;uBACc;8BACzB;AAC7B,yEAAyE;AACzE,0CAA0C;AAC1C,MAAMC,2BAA2B;IAC7B;IACA;IACA;IACA;IACA;IACA;CACH;AAQU,MAAMD,mBAAmB,CAACE;IACjC,MAAMC,YAAYC,IAAAA,0BAAY;IAC9B,MAAM,EAAEC,aAAa,GAAG,EAAEC,SAAS,KAAK,EAAEC,gBAAgB,KAAK,EAAEC,WAAW,KAAK,EAAEC,gBAAgB,KAAK,EAAEC,gBAAgB,KAAK,EAAEC,qBAAqB,KAAK,EAAEC,cAAcT,SAAS,EAAEU,oBAAoB,EAAEC,YAAY,IAAI,EAAE,GAAGZ;IACjO,MAAMa,YAAYC,IAAAA,qBAAK,EAAC;IACxB,MAAM,CAACC,eAAeC,iBAAiB,GAAGC,IAAAA,2CAAyB;IACnE,MAAMC,mBAAmB;QACrBC,UAAUlB,YAAY,UAAU;QAChCmB,OAAOnB,YAAY,QAAQ;QAC3BoB,QAAQrB,MAAMQ,aAAa,GAAGO,gBAAgBO;QAC9CC,mBAAmBtB,YAAYF,2BAA2BuB;QAC1D,GAAGE,IAAAA,6CAA2B,EAACxB,MAAMyB,WA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QACAC;KACH;AACL"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "MenuItemSwitch", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return MenuItemSwitch;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
13
|
+
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
14
|
+
const _useMenuItemSwitch = require("./useMenuItemSwitch");
|
15
|
+
const _renderMenuItemSwitch = require("./renderMenuItemSwitch");
|
16
|
+
const _useMenuItemSwitchStylesstyles = require("./useMenuItemSwitchStyles.styles");
|
17
|
+
const MenuItemSwitch = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
18
|
+
const state = (0, _useMenuItemSwitch.useMenuItemSwitch_unstable)(props, ref);
|
19
|
+
(0, _useMenuItemSwitchStylesstyles.useMenuItemSwitchStyles_unstable)(state);
|
20
|
+
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('useMenuItemSwitchStyles_unstable')(state);
|
21
|
+
return (0, _renderMenuItemSwitch.renderMenuItemSwitch_unstable)(state);
|
22
|
+
});
|
23
|
+
MenuItemSwitch.displayName = 'MenuItemSwitch';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["MenuItemSwitch.js"],"sourcesContent":["import * as React from 'react';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { useMenuItemSwitch_unstable } from './useMenuItemSwitch';\nimport { renderMenuItemSwitch_unstable } from './renderMenuItemSwitch';\nimport { useMenuItemSwitchStyles_unstable } from './useMenuItemSwitchStyles.styles';\nexport const MenuItemSwitch = /*#__PURE__*/ React.forwardRef((props, ref)=>{\n const state = useMenuItemSwitch_unstable(props, ref);\n useMenuItemSwitchStyles_unstable(state);\n useCustomStyleHook_unstable('useMenuItemSwitchStyles_unstable')(state);\n return renderMenuItemSwitch_unstable(state);\n});\nMenuItemSwitch.displayName = 'MenuItemSwitch';\n"],"names":["MenuItemSwitch","React","forwardRef","props","ref","state","useMenuItemSwitch_unstable","useMenuItemSwitchStyles_unstable","useCustomStyleHook_unstable","renderMenuItemSwitch_unstable","displayName"],"mappings":";;;;+BAKaA;;;eAAAA;;;;iEALU;qCACqB;mCACD;sCACG;+CACG;AAC1C,MAAMA,iBAAiB,WAAW,GAAGC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACjE,MAAMC,QAAQC,IAAAA,6CAA0B,EAACH,OAAOC;IAChDG,IAAAA,+DAAgC,EAACF;IACjCG,IAAAA,gDAA2B,EAAC,oCAAoCH;IAChE,OAAOI,IAAAA,mDAA6B,EAACJ;AACzC;AACAL,eAAeU,WAAW,GAAG"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
+
_export_star._(require("./MenuItemSwitch"), exports);
|
7
|
+
_export_star._(require("./MenuItemSwitch.types"), exports);
|
8
|
+
_export_star._(require("./renderMenuItemSwitch"), exports);
|
9
|
+
_export_star._(require("./useMenuItemSwitch"), exports);
|
10
|
+
_export_star._(require("./useMenuItemSwitchStyles.styles"), exports);
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './MenuItemSwitch';\nexport * from './MenuItemSwitch.types';\nexport * from './renderMenuItemSwitch';\nexport * from './useMenuItemSwitch';\nexport * from './useMenuItemSwitchStyles.styles';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "renderMenuItemSwitch_unstable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return renderMenuItemSwitch_unstable;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
12
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
13
|
+
const renderMenuItemSwitch_unstable = (state)=>{
|
14
|
+
(0, _reactutilities.assertSlots)(state);
|
15
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
|
16
|
+
children: [
|
17
|
+
state.icon && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.icon, {}),
|
18
|
+
state.content && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.content, {}),
|
19
|
+
state.secondaryContent && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.secondaryContent, {}),
|
20
|
+
state.switchIndicator && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.switchIndicator, {})
|
21
|
+
]
|
22
|
+
});
|
23
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["renderMenuItemSwitch.js"],"sourcesContent":[" import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { assertSlots } from '@fluentui/react-utilities';\n/**\n * Function that renders the final JSX of the component\n */ export const renderMenuItemSwitch_unstable = (state)=>{\n assertSlots(state);\n return /*#__PURE__*/ _jsxs(state.root, {\n children: [\n state.icon && /*#__PURE__*/ _jsx(state.icon, {}),\n state.content && /*#__PURE__*/ _jsx(state.content, {}),\n state.secondaryContent && /*#__PURE__*/ _jsx(state.secondaryContent, {}),\n state.switchIndicator && /*#__PURE__*/ _jsx(state.switchIndicator, {})\n ]\n });\n};\n"],"names":["renderMenuItemSwitch_unstable","state","assertSlots","_jsxs","root","children","icon","_jsx","content","secondaryContent","switchIndicator"],"mappings":";;;;+BAIiBA;;;eAAAA;;;4BAJ4B;gCACjB;AAGjB,MAAMA,gCAAgC,CAACC;IAC9CC,IAAAA,2BAAW,EAACD;IACZ,OAAO,WAAW,GAAGE,IAAAA,gBAAK,EAACF,MAAMG,IAAI,EAAE;QACnCC,UAAU;YACNJ,MAAMK,IAAI,IAAI,WAAW,GAAGC,IAAAA,eAAI,EAACN,MAAMK,IAAI,EAAE,CAAC;YAC9CL,MAAMO,OAAO,IAAI,WAAW,GAAGD,IAAAA,eAAI,EAACN,MAAMO,OAAO,EAAE,CAAC;YACpDP,MAAMQ,gBAAgB,IAAI,WAAW,GAAGF,IAAAA,eAAI,EAACN,MAAMQ,gBAAgB,EAAE,CAAC;YACtER,MAAMS,eAAe,IAAI,WAAW,GAAGH,IAAAA,eAAI,EAACN,MAAMS,eAAe,EAAE,CAAC;SACvE;IACL;AACJ"}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "useMenuItemSwitch_unstable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return useMenuItemSwitch_unstable;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
13
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
14
|
+
const _useMenuItemCheckbox = require("../MenuItemCheckbox/useMenuItemCheckbox");
|
15
|
+
const _reacticons = require("@fluentui/react-icons");
|
16
|
+
const _useMenuItemSwitchStylesstyles = require("./useMenuItemSwitchStyles.styles");
|
17
|
+
const useMenuItemSwitch_unstable = (props, ref)=>{
|
18
|
+
const baseState = (0, _useMenuItemCheckbox.useMenuItemCheckbox_unstable)(props, ref);
|
19
|
+
return {
|
20
|
+
...baseState,
|
21
|
+
switchIndicator: _reactutilities.slot.optional(props.switchIndicator, {
|
22
|
+
renderByDefault: true,
|
23
|
+
elementType: 'span',
|
24
|
+
defaultProps: {
|
25
|
+
children: /*#__PURE__*/ _react.createElement(_reacticons.CircleFilled, {
|
26
|
+
className: _useMenuItemSwitchStylesstyles.circleFilledClassName
|
27
|
+
})
|
28
|
+
}
|
29
|
+
}),
|
30
|
+
components: {
|
31
|
+
...baseState.components,
|
32
|
+
switchIndicator: 'span'
|
33
|
+
}
|
34
|
+
};
|
35
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["useMenuItemSwitch.js"],"sourcesContent":["import * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\nimport { useMenuItemCheckbox_unstable } from '../MenuItemCheckbox/useMenuItemCheckbox';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { circleFilledClassName } from './useMenuItemSwitchStyles.styles';\n/**\n * Create the state required to render MenuItemSwitch.\n *\n * The returned state can be modified with hooks such as useMenuItemSwitchStyles_unstable,\n * before being passed to renderMenuItemSwitch_unstable.\n *\n * @param props - props from this instance of MenuItemSwitch\n * @param ref - reference to root HTMLDivElement of MenuItemSwitch\n */ export const useMenuItemSwitch_unstable = (props, ref)=>{\n const baseState = useMenuItemCheckbox_unstable(props, ref);\n return {\n ...baseState,\n switchIndicator: slot.optional(props.switchIndicator, {\n renderByDefault: true,\n elementType: 'span',\n defaultProps: {\n children: /*#__PURE__*/ React.createElement(CircleFilled, {\n className: circleFilledClassName\n })\n }\n }),\n components: {\n ...baseState.components,\n switchIndicator: 'span'\n }\n };\n};\n"],"names":["useMenuItemSwitch_unstable","props","ref","baseState","useMenuItemCheckbox_unstable","switchIndicator","slot","optional","renderByDefault","elementType","defaultProps","children","React","createElement","CircleFilled","className","circleFilledClassName","components"],"mappings":";;;;+BAaiBA;;;eAAAA;;;;iEAbM;gCACF;qCACwB;4BAChB;+CACS;AAS3B,MAAMA,6BAA6B,CAACC,OAAOC;IAClD,MAAMC,YAAYC,IAAAA,iDAA4B,EAACH,OAAOC;IACtD,OAAO;QACH,GAAGC,SAAS;QACZE,iBAAiBC,oBAAI,CAACC,QAAQ,CAACN,MAAMI,eAAe,EAAE;YAClDG,iBAAiB;YACjBC,aAAa;YACbC,cAAc;gBACVC,UAAU,WAAW,GAAGC,OAAMC,aAAa,CAACC,wBAAY,EAAE;oBACtDC,WAAWC,oDAAqB;gBACpC;YACJ;QACJ;QACAC,YAAY;YACR,GAAGd,UAAUc,UAAU;YACvBZ,iBAAiB;QACrB;IACJ;AACJ"}
|
@@ -0,0 +1,154 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
menuItemSwitchClassNames: function() {
|
13
|
+
return menuItemSwitchClassNames;
|
14
|
+
},
|
15
|
+
circleFilledClassName: function() {
|
16
|
+
return circleFilledClassName;
|
17
|
+
},
|
18
|
+
useMenuItemSwitchStyles_unstable: function() {
|
19
|
+
return useMenuItemSwitchStyles_unstable;
|
20
|
+
}
|
21
|
+
});
|
22
|
+
const _react = require("@griffel/react");
|
23
|
+
const _useMenuItemStylesstyles = require("../MenuItem/useMenuItemStyles.styles");
|
24
|
+
const menuItemSwitchClassNames = {
|
25
|
+
root: 'fui-MenuItemSwitch',
|
26
|
+
icon: 'fui-MenuItemSwitch__icon',
|
27
|
+
content: 'fui-MenuItemSwitch__content',
|
28
|
+
secondaryContent: 'fui-MenuItemSwitch__secondaryContent',
|
29
|
+
switchIndicator: 'fui-MenuItemSwitch__switchIndicator'
|
30
|
+
};
|
31
|
+
const circleFilledClassName = 'fui-MenuItemSwitch__switchIndicator__circleFilled';
|
32
|
+
// Thumb and track sizes used by the component.
|
33
|
+
const spaceBetweenThumbAndTrack = 2;
|
34
|
+
const trackHeight = 20;
|
35
|
+
const trackWidth = 40;
|
36
|
+
const thumbSize = trackHeight - spaceBetweenThumbAndTrack;
|
37
|
+
const useSwitchIndicatorBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("r1x31n8g", "rsmcm5v", {
|
38
|
+
r: [
|
39
|
+
".r1x31n8g{border-radius:var(--borderRadiusCircular);border:var(--strokeWidthThin) solid var(--colorNeutralStrokeAccessible);line-height:0;box-sizing:border-box;fill:currentColor;flex-shrink:0;font-size:18px;height:20px;transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:background,border,color;width:40px;margin-right:var(--spacingHorizontalXS);color:var(--colorNeutralStrokeAccessible);}",
|
40
|
+
".r1x31n8g:hover{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}",
|
41
|
+
".r1x31n8g:hover:active{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}",
|
42
|
+
".r1x31n8g .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}",
|
43
|
+
".rsmcm5v{border-radius:var(--borderRadiusCircular);border:var(--strokeWidthThin) solid var(--colorNeutralStrokeAccessible);line-height:0;box-sizing:border-box;fill:currentColor;flex-shrink:0;font-size:18px;height:20px;transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:background,border,color;width:40px;margin-left:var(--spacingHorizontalXS);color:var(--colorNeutralStrokeAccessible);}",
|
44
|
+
".rsmcm5v:hover{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}",
|
45
|
+
".rsmcm5v:hover:active{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}",
|
46
|
+
".rsmcm5v .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}"
|
47
|
+
],
|
48
|
+
s: [
|
49
|
+
"@media screen and (prefers-reduced-motion: reduce){.r1x31n8g{transition-duration:0.01ms;}}",
|
50
|
+
"@media screen and (prefers-reduced-motion: reduce){.r1x31n8g .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:0.01ms;}}",
|
51
|
+
"@media screen and (prefers-reduced-motion: reduce){.rsmcm5v{transition-duration:0.01ms;}}",
|
52
|
+
"@media screen and (prefers-reduced-motion: reduce){.rsmcm5v .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:0.01ms;}}"
|
53
|
+
]
|
54
|
+
});
|
55
|
+
const useSwitchIndicatorStyles = /*#__PURE__*/ (0, _react.__styles)({
|
56
|
+
checked: {
|
57
|
+
G4r02d: [
|
58
|
+
"fdca5i2",
|
59
|
+
"fk0rr1z"
|
60
|
+
],
|
61
|
+
De3pzq: "ftywsgz",
|
62
|
+
sj55zd: "fqpbvvt",
|
63
|
+
g2u3we: "fghlq4f",
|
64
|
+
h3c5rm: [
|
65
|
+
"f1gn591s",
|
66
|
+
"fjscplz"
|
67
|
+
],
|
68
|
+
B9xav0g: "fb073pr",
|
69
|
+
zhjwy3: [
|
70
|
+
"fjscplz",
|
71
|
+
"f1gn591s"
|
72
|
+
],
|
73
|
+
Bi91k9c: "fz46y8r",
|
74
|
+
Jwef8y: "f1kjrvvj",
|
75
|
+
Bgoe8wy: "fpa59ij",
|
76
|
+
Bwzppfd: [
|
77
|
+
"f1rhln42",
|
78
|
+
"f1l1ogpg"
|
79
|
+
],
|
80
|
+
oetu4i: "fz67qlh",
|
81
|
+
gg5e9n: [
|
82
|
+
"f1l1ogpg",
|
83
|
+
"f1rhln42"
|
84
|
+
],
|
85
|
+
B2d53fq: "frlnr8d",
|
86
|
+
iro3zm: "fle2s0s",
|
87
|
+
b661bw: "f1j8ziw4",
|
88
|
+
Bk6r4ia: [
|
89
|
+
"f1xzu9i0",
|
90
|
+
"f1jlpvxk"
|
91
|
+
],
|
92
|
+
B9zn80p: "f1i1ccxp",
|
93
|
+
Bpld233: [
|
94
|
+
"f1jlpvxk",
|
95
|
+
"f1xzu9i0"
|
96
|
+
]
|
97
|
+
}
|
98
|
+
}, {
|
99
|
+
d: [
|
100
|
+
".fdca5i2 .fui-MenuItemSwitch__switchIndicator__circleFilled{transform:translateX(20px);}",
|
101
|
+
".fk0rr1z .fui-MenuItemSwitch__switchIndicator__circleFilled{transform:translateX(-20px);}",
|
102
|
+
".ftywsgz{background-color:var(--colorCompoundBrandBackground);}",
|
103
|
+
".fqpbvvt{color:var(--colorNeutralForegroundInverted);}",
|
104
|
+
".fghlq4f{border-top-color:var(--colorTransparentStroke);}",
|
105
|
+
".f1gn591s{border-right-color:var(--colorTransparentStroke);}",
|
106
|
+
".fjscplz{border-left-color:var(--colorTransparentStroke);}",
|
107
|
+
".fb073pr{border-bottom-color:var(--colorTransparentStroke);}"
|
108
|
+
],
|
109
|
+
h: [
|
110
|
+
".fz46y8r:hover{color:var(--colorNeutralForegroundInverted);}",
|
111
|
+
".f1kjrvvj:hover{background-color:var(--colorCompoundBrandBackgroundHover);}",
|
112
|
+
".fpa59ij:hover{border-top-color:var(--colorTransparentStrokeInteractive);}",
|
113
|
+
".f1rhln42:hover{border-right-color:var(--colorTransparentStrokeInteractive);}",
|
114
|
+
".f1l1ogpg:hover{border-left-color:var(--colorTransparentStrokeInteractive);}",
|
115
|
+
".fz67qlh:hover{border-bottom-color:var(--colorTransparentStrokeInteractive);}",
|
116
|
+
".frlnr8d:hover:active{color:var(--colorNeutralForegroundInverted);}",
|
117
|
+
".fle2s0s:hover:active{background-color:var(--colorCompoundBrandBackgroundPressed);}",
|
118
|
+
".f1j8ziw4:hover:active{border-top-color:var(--colorTransparentStrokeInteractive);}",
|
119
|
+
".f1xzu9i0:hover:active{border-right-color:var(--colorTransparentStrokeInteractive);}",
|
120
|
+
".f1jlpvxk:hover:active{border-left-color:var(--colorTransparentStrokeInteractive);}",
|
121
|
+
".f1i1ccxp:hover:active{border-bottom-color:var(--colorTransparentStrokeInteractive);}"
|
122
|
+
]
|
123
|
+
});
|
124
|
+
const useMenuItemSwitchStyles_unstable = (state)=>{
|
125
|
+
const { checked } = state;
|
126
|
+
const switchIndicatorStyles = useSwitchIndicatorStyles();
|
127
|
+
const switchIndicatorBaseStyles = useSwitchIndicatorBaseClassName();
|
128
|
+
state.root.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.root, state.root.className);
|
129
|
+
if (state.content) {
|
130
|
+
state.content.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.content, state.content.className);
|
131
|
+
}
|
132
|
+
if (state.secondaryContent) {
|
133
|
+
state.secondaryContent.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.secondaryContent, state.secondaryContent.className);
|
134
|
+
}
|
135
|
+
if (state.icon) {
|
136
|
+
state.icon.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.icon, state.icon.className);
|
137
|
+
}
|
138
|
+
if (state.switchIndicator) {
|
139
|
+
state.switchIndicator.className = (0, _react.mergeClasses)(menuItemSwitchClassNames.switchIndicator, switchIndicatorBaseStyles, checked && switchIndicatorStyles.checked, state.switchIndicator.className);
|
140
|
+
}
|
141
|
+
(0, _useMenuItemStylesstyles.useMenuItemStyles_unstable)({
|
142
|
+
...state,
|
143
|
+
components: {
|
144
|
+
...state.components,
|
145
|
+
checkmark: 'span',
|
146
|
+
submenuIndicator: 'span'
|
147
|
+
},
|
148
|
+
checkmark: undefined,
|
149
|
+
submenuIndicator: undefined,
|
150
|
+
hasSubmenu: false,
|
151
|
+
persistOnClick: true
|
152
|
+
});
|
153
|
+
return state;
|
154
|
+
}; //# sourceMappingURL=useMenuItemSwitchStyles.styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["useMenuItemSwitchStyles.styles.js"],"sourcesContent":["import { __styles, __resetStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { useMenuItemStyles_unstable } from '../MenuItem/useMenuItemStyles.styles';\nexport const menuItemSwitchClassNames = {\n root: 'fui-MenuItemSwitch',\n icon: 'fui-MenuItemSwitch__icon',\n content: 'fui-MenuItemSwitch__content',\n secondaryContent: 'fui-MenuItemSwitch__secondaryContent',\n switchIndicator: 'fui-MenuItemSwitch__switchIndicator'\n};\nexport const circleFilledClassName = 'fui-MenuItemSwitch__switchIndicator__circleFilled';\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\nconst useSwitchIndicatorBaseClassName = /*#__PURE__*/__resetStyles(\"r1x31n8g\", \"rsmcm5v\", {\n r: [\".r1x31n8g{border-radius:var(--borderRadiusCircular);border:var(--strokeWidthThin) solid var(--colorNeutralStrokeAccessible);line-height:0;box-sizing:border-box;fill:currentColor;flex-shrink:0;font-size:18px;height:20px;transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:background,border,color;width:40px;margin-right:var(--spacingHorizontalXS);color:var(--colorNeutralStrokeAccessible);}\", \".r1x31n8g:hover{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}\", \".r1x31n8g:hover:active{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}\", \".r1x31n8g .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}\", \".rsmcm5v{border-radius:var(--borderRadiusCircular);border:var(--strokeWidthThin) solid var(--colorNeutralStrokeAccessible);line-height:0;box-sizing:border-box;fill:currentColor;flex-shrink:0;font-size:18px;height:20px;transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:background,border,color;width:40px;margin-left:var(--spacingHorizontalXS);color:var(--colorNeutralStrokeAccessible);}\", \".rsmcm5v:hover{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}\", \".rsmcm5v:hover:active{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}\", \".rsmcm5v .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}\"],\n s: [\"@media screen and (prefers-reduced-motion: reduce){.r1x31n8g{transition-duration:0.01ms;}}\", \"@media screen and (prefers-reduced-motion: reduce){.r1x31n8g .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:0.01ms;}}\", \"@media screen and (prefers-reduced-motion: reduce){.rsmcm5v{transition-duration:0.01ms;}}\", \"@media screen and (prefers-reduced-motion: reduce){.rsmcm5v .fui-MenuItemSwitch__switchIndicator__circleFilled{transition-duration:0.01ms;}}\"]\n});\nconst useSwitchIndicatorStyles = /*#__PURE__*/__styles({\n checked: {\n G4r02d: [\"fdca5i2\", \"fk0rr1z\"],\n De3pzq: \"ftywsgz\",\n sj55zd: \"fqpbvvt\",\n g2u3we: \"fghlq4f\",\n h3c5rm: [\"f1gn591s\", \"fjscplz\"],\n B9xav0g: \"fb073pr\",\n zhjwy3: [\"fjscplz\", \"f1gn591s\"],\n Bi91k9c: \"fz46y8r\",\n Jwef8y: \"f1kjrvvj\",\n Bgoe8wy: \"fpa59ij\",\n Bwzppfd: [\"f1rhln42\", \"f1l1ogpg\"],\n oetu4i: \"fz67qlh\",\n gg5e9n: [\"f1l1ogpg\", \"f1rhln42\"],\n B2d53fq: \"frlnr8d\",\n iro3zm: \"fle2s0s\",\n b661bw: \"f1j8ziw4\",\n Bk6r4ia: [\"f1xzu9i0\", \"f1jlpvxk\"],\n B9zn80p: \"f1i1ccxp\",\n Bpld233: [\"f1jlpvxk\", \"f1xzu9i0\"]\n }\n}, {\n d: [\".fdca5i2 .fui-MenuItemSwitch__switchIndicator__circleFilled{transform:translateX(20px);}\", \".fk0rr1z .fui-MenuItemSwitch__switchIndicator__circleFilled{transform:translateX(-20px);}\", \".ftywsgz{background-color:var(--colorCompoundBrandBackground);}\", \".fqpbvvt{color:var(--colorNeutralForegroundInverted);}\", \".fghlq4f{border-top-color:var(--colorTransparentStroke);}\", \".f1gn591s{border-right-color:var(--colorTransparentStroke);}\", \".fjscplz{border-left-color:var(--colorTransparentStroke);}\", \".fb073pr{border-bottom-color:var(--colorTransparentStroke);}\"],\n h: [\".fz46y8r:hover{color:var(--colorNeutralForegroundInverted);}\", \".f1kjrvvj:hover{background-color:var(--colorCompoundBrandBackgroundHover);}\", \".fpa59ij:hover{border-top-color:var(--colorTransparentStrokeInteractive);}\", \".f1rhln42:hover{border-right-color:var(--colorTransparentStrokeInteractive);}\", \".f1l1ogpg:hover{border-left-color:var(--colorTransparentStrokeInteractive);}\", \".fz67qlh:hover{border-bottom-color:var(--colorTransparentStrokeInteractive);}\", \".frlnr8d:hover:active{color:var(--colorNeutralForegroundInverted);}\", \".fle2s0s:hover:active{background-color:var(--colorCompoundBrandBackgroundPressed);}\", \".f1j8ziw4:hover:active{border-top-color:var(--colorTransparentStrokeInteractive);}\", \".f1xzu9i0:hover:active{border-right-color:var(--colorTransparentStrokeInteractive);}\", \".f1jlpvxk:hover:active{border-left-color:var(--colorTransparentStrokeInteractive);}\", \".f1i1ccxp:hover:active{border-bottom-color:var(--colorTransparentStrokeInteractive);}\"]\n});\n/**\n * Apply styling to the MenuItemSwitch slots based on the state\n */\nexport const useMenuItemSwitchStyles_unstable = state => {\n const {\n checked\n } = state;\n const switchIndicatorStyles = useSwitchIndicatorStyles();\n const switchIndicatorBaseStyles = useSwitchIndicatorBaseClassName();\n state.root.className = mergeClasses(menuItemSwitchClassNames.root, state.root.className);\n if (state.content) {\n state.content.className = mergeClasses(menuItemSwitchClassNames.content, state.content.className);\n }\n if (state.secondaryContent) {\n state.secondaryContent.className = mergeClasses(menuItemSwitchClassNames.secondaryContent, state.secondaryContent.className);\n }\n if (state.icon) {\n state.icon.className = mergeClasses(menuItemSwitchClassNames.icon, state.icon.className);\n }\n if (state.switchIndicator) {\n state.switchIndicator.className = mergeClasses(menuItemSwitchClassNames.switchIndicator, switchIndicatorBaseStyles, checked && switchIndicatorStyles.checked, state.switchIndicator.className);\n }\n useMenuItemStyles_unstable({\n ...state,\n components: {\n ...state.components,\n checkmark: 'span',\n submenuIndicator: 'span'\n },\n checkmark: undefined,\n submenuIndicator: undefined,\n hasSubmenu: false,\n persistOnClick: true\n });\n return state;\n};\n//# sourceMappingURL=useMenuItemSwitchStyles.styles.js.map"],"names":["menuItemSwitchClassNames","circleFilledClassName","useMenuItemSwitchStyles_unstable","root","icon","content","secondaryContent","switchIndicator","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useSwitchIndicatorBaseClassName","__resetStyles","r","s","useSwitchIndicatorStyles","__styles","checked","G4r02d","De3pzq","sj55zd","g2u3we","h3c5rm","B9xav0g","zhjwy3","Bi91k9c","Jwef8y","Bgoe8wy","Bwzppfd","oetu4i","gg5e9n","B2d53fq","iro3zm","b661bw","Bk6r4ia","B9zn80p","Bpld233","d","h","state","switchIndicatorStyles","switchIndicatorBaseStyles","className","mergeClasses","useMenuItemStyles_unstable","components","checkmark","submenuIndicator","undefined","hasSubmenu","persistOnClick"],"mappings":";;;;;;;;;;;IAGaA,wBAAwB;eAAxBA;;IAOAC,qBAAqB;eAArBA;;IAuCAC,gCAAgC;eAAhCA;;;uBAjDqD;yCAEvB;AACpC,MAAMF,2BAA2B;IACtCG,MAAM;IACNC,MAAM;IACNC,SAAS;IACTC,kBAAkB;IAClBC,iBAAiB;AACnB;AACO,MAAMN,wBAAwB;AACrC,+CAA+C;AAC/C,MAAMO,4BAA4B;AAClC,MAAMC,cAAc;AACpB,MAAMC,aAAa;AACnB,MAAMC,YAAYF,cAAcD;AAChC,MAAMI,kCAAkC,WAAW,GAAEC,IAAAA,oBAAa,EAAC,YAAY,WAAW;IACxFC,GAAG;QAAC;QAAmc;QAA0H;QA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AA,mBAAY,EAAC5C,yBAAyBM,gBAAgB,EAAEkC,MAAMlC,gBAAgB,CAACqC,SAAS;IAC7H;IACA,IAAIH,MAAMpC,IAAI,EAAE;QACdoC,MAAMpC,IAAI,CAACuC,SAAS,GAAGC,IAAAA,mBAAY,EAAC5C,yBAAyBI,IAAI,EAAEoC,MAAMpC,IAAI,CAACuC,SAAS;IACzF;IACA,IAAIH,MAAMjC,eAAe,EAAE;QACzBiC,MAAMjC,eAAe,CAACoC,SAAS,GAAGC,IAAAA,mBAAY,EAAC5C,yBAAyBO,eAAe,EAAEmC,2BAA2BxB,WAAWuB,sBAAsBvB,OAAO,EAAEsB,MAAMjC,eAAe,CAACoC,SAAS;IAC/L;IACAE,IAAAA,mDAA0B,EAAC;QACzB,GAAGL,KAAK;QACRM,YAAY;YACV,GAAGN,MAAMM,UAAU;YACnBC,WAAW;YACXC,kBAAkB;QACpB;QACAD,WAAWE;QACXD,kBAAkBC;QAClBC,YAAY;QACZC,gBAAgB;IAClB;IACA,OAAOX;AACT,GACA,0DAA0D"}
|
@@ -40,7 +40,7 @@ const menuSplitGroupClassNames = {
|
|
40
40
|
],
|
41
41
|
Btx6110: "f5673lx",
|
42
42
|
B1zw9a1: "f23uflp",
|
43
|
-
B857g0j: "
|
43
|
+
B857g0j: "f6dghp8",
|
44
44
|
Bx4l464: "f1k81338"
|
45
45
|
}
|
46
46
|
}, {
|
@@ -55,7 +55,7 @@ const menuSplitGroupClassNames = {
|
|
55
55
|
".f146oqes>.fui-MenuItem:nth-of-type(2){padding-right:0;}",
|
56
56
|
".f5673lx>.fui-MenuItem:nth-of-type(2)::before{content:\"\";}",
|
57
57
|
".f23uflp>.fui-MenuItem:nth-of-type(2)::before{width:var(--strokeWidthThin);}",
|
58
|
-
".
|
58
|
+
".f6dghp8>.fui-MenuItem:nth-of-type(2)::before{height:20px;}",
|
59
59
|
".f1k81338>.fui-MenuItem:nth-of-type(2)::before{background-color:var(--colorNeutralStroke1);}"
|
60
60
|
]
|
61
61
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useMenuSplitGroupStyles.styles.js"],"sourcesContent":["import { __styles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { menuItemClassNames } from '../MenuItem/useMenuItemStyles.styles';\nexport const menuSplitGroupClassNames = {\n root: 'fui-MenuSplitGroup'\n};\n/**\n * Styles for the root slot\n */\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n mc9l5x: \"f22iagw\",\n ni5quz: \"flhoj8d\",\n Irip7g: [\"fj7wzln\", \"fagfnhl\"],\n pgpdld: [\"fghv8el\", \"f1r95qti\"],\n nep80a: [\"fog3xzc\", \"f146oqes\"],\n Btx6110: \"f5673lx\",\n B1zw9a1: \"f23uflp\",\n B857g0j: \"
|
1
|
+
{"version":3,"sources":["useMenuSplitGroupStyles.styles.js"],"sourcesContent":["import { __styles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { menuItemClassNames } from '../MenuItem/useMenuItemStyles.styles';\nexport const menuSplitGroupClassNames = {\n root: 'fui-MenuSplitGroup'\n};\n/**\n * Styles for the root slot\n */\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n mc9l5x: \"f22iagw\",\n ni5quz: \"flhoj8d\",\n Irip7g: [\"fj7wzln\", \"fagfnhl\"],\n pgpdld: [\"fghv8el\", \"f1r95qti\"],\n nep80a: [\"fog3xzc\", \"f146oqes\"],\n Btx6110: \"f5673lx\",\n B1zw9a1: \"f23uflp\",\n B857g0j: \"f6dghp8\",\n Bx4l464: \"f1k81338\"\n }\n}, {\n d: [\".f22iagw{display:flex;}\", \".flhoj8d>.fui-MenuItem:nth-of-type(1){flex-grow:1;}\", \".fj7wzln>.fui-MenuItem:nth-of-type(2){border-top-left-radius:0;}\", \".fagfnhl>.fui-MenuItem:nth-of-type(2){border-top-right-radius:0;}\", \".fghv8el>.fui-MenuItem:nth-of-type(2){border-bottom-left-radius:0;}\", \".f1r95qti>.fui-MenuItem:nth-of-type(2){border-bottom-right-radius:0;}\", \".fog3xzc>.fui-MenuItem:nth-of-type(2){padding-left:0;}\", \".f146oqes>.fui-MenuItem:nth-of-type(2){padding-right:0;}\", \".f5673lx>.fui-MenuItem:nth-of-type(2)::before{content:\\\"\\\";}\", \".f23uflp>.fui-MenuItem:nth-of-type(2)::before{width:var(--strokeWidthThin);}\", \".f6dghp8>.fui-MenuItem:nth-of-type(2)::before{height:20px;}\", \".f1k81338>.fui-MenuItem:nth-of-type(2)::before{background-color:var(--colorNeutralStroke1);}\"]\n});\n/**\n * Apply styling to the MenuSplitGroup slots based on the state\n */\nexport const useMenuSplitGroupStyles_unstable = state => {\n const styles = useStyles();\n state.root.className = mergeClasses(menuSplitGroupClassNames.root, styles.root, state.root.className);\n return state;\n};\n//# sourceMappingURL=useMenuSplitGroupStyles.styles.js.map"],"names":["menuSplitGroupClassNames","useMenuSplitGroupStyles_unstable","root","useStyles","__styles","mc9l5x","ni5quz","Irip7g","pgpdld","nep80a","Btx6110","B1zw9a1","B857g0j","Bx4l464","d","state","styles","className","mergeClasses"],"mappings":";;;;;;;;;;;IAGaA,wBAAwB;eAAxBA;;IAwBAC,gCAAgC;eAAhCA;;;uBA3B0B;AAGhC,MAAMD,2BAA2B;IACtCE,MAAM;AACR;AACA;;CAEC,GACD,MAAMC,YAAY,WAAW,GAAEC,IAAAA,eAAQ,EAAC;IACtCF,MAAM;QACJG,QAAQ;QACRC,QAAQ;QACRC,QAAQ;YAAC;YAAW;SAAU;QAC9BC,QAAQ;YAAC;YAAW;SAAW;QAC/BC,QAAQ;YAAC;YAAW;SAAW;QAC/BC,SAAS;QACTC,SAAS;QACTC,SAAS;QACTC,SAAS;IACX;AACF,GAAG;IACDC,GAAG;QAAC;QAA2B;QAAuD;QAAoE;QAAqE;QAAuE;QAAyE;QAA0D;QAA4D;QAAgE;QAAgF;QAA+D;KAA+F;AACrxB;AAIO,MAAMb,mCAAmCc,CAAAA;IAC9C,MAAMC,SAASb;IACfY,MAAMb,IAAI,CAACe,SAAS,GAAGC,IAAAA,mBAAY,EAAClB,yBAAyBE,IAAI,EAAEc,OAAOd,IAAI,EAAEa,MAAMb,IAAI,CAACe,SAAS;IACpG,OAAOF;AACT,GACA,0DAA0D"}
|
package/lib-commonjs/index.js
CHANGED
@@ -221,6 +221,21 @@ _export(exports, {
|
|
221
221
|
},
|
222
222
|
useOnMenuMouseEnter: function() {
|
223
223
|
return _utils.useOnMenuMouseEnter;
|
224
|
+
},
|
225
|
+
MenuItemSwitch: function() {
|
226
|
+
return _MenuItemSwitch.MenuItemSwitch;
|
227
|
+
},
|
228
|
+
useMenuItemSwitch_unstable: function() {
|
229
|
+
return _MenuItemSwitch.useMenuItemSwitch_unstable;
|
230
|
+
},
|
231
|
+
useMenuItemSwitchStyles_unstable: function() {
|
232
|
+
return _MenuItemSwitch.useMenuItemSwitchStyles_unstable;
|
233
|
+
},
|
234
|
+
renderMenuItemSwitch_unstable: function() {
|
235
|
+
return _MenuItemSwitch.renderMenuItemSwitch_unstable;
|
236
|
+
},
|
237
|
+
menuItemSwitchClassNames: function() {
|
238
|
+
return _MenuItemSwitch.menuItemSwitchClassNames;
|
224
239
|
}
|
225
240
|
});
|
226
241
|
const _menuContext = require("./contexts/menuContext");
|
@@ -241,3 +256,4 @@ const _MenuTrigger = require("./MenuTrigger");
|
|
241
256
|
const _index = require("./selectable/index");
|
242
257
|
const _MenuItemLink = require("./MenuItemLink");
|
243
258
|
const _utils = require("./utils");
|
259
|
+
const _MenuItemSwitch = require("./MenuItemSwitch");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export { MenuProvider, useMenuContext_unstable } from './contexts/menuContext';\nexport { MenuTriggerContextProvider, useMenuTriggerContext_unstable } from './contexts/menuTriggerContext';\nexport { MenuGroupContextProvider, useMenuGroupContext_unstable } from './contexts/menuGroupContext';\nexport { MenuListProvider, useMenuListContext_unstable } from './contexts/menuListContext';\nexport { Menu, renderMenu_unstable, useMenuContextValues_unstable, useMenu_unstable } from './Menu';\nexport { MenuDivider, menuDividerClassNames, renderMenuDivider_unstable, useMenuDividerStyles_unstable, useMenuDivider_unstable } from './MenuDivider';\nexport { MenuGroup, menuGroupClassNames, renderMenuGroup_unstable, useMenuGroupContextValues_unstable, useMenuGroupStyles_unstable, useMenuGroup_unstable } from './MenuGroup';\nexport { MenuGroupHeader, menuGroupHeaderClassNames, renderMenuGroupHeader_unstable, useMenuGroupHeaderStyles_unstable, useMenuGroupHeader_unstable } from './MenuGroupHeader';\nexport { MenuItem, menuItemClassNames, renderMenuItem_unstable, useMenuItemStyles_unstable, useMenuItem_unstable } from './MenuItem';\nexport { MenuItemCheckbox, menuItemCheckboxClassNames, renderMenuItemCheckbox_unstable, useMenuItemCheckboxStyles_unstable, useMenuItemCheckbox_unstable } from './MenuItemCheckbox';\nexport { MenuItemRadio, menuItemRadioClassNames, renderMenuItemRadio_unstable, useMenuItemRadioStyles_unstable, useMenuItemRadio_unstable } from './MenuItemRadio';\nexport { MenuList, menuListClassNames, renderMenuList_unstable, useMenuListContextValues_unstable, useMenuListStyles_unstable, useMenuList_unstable } from './MenuList';\nexport { MenuPopover, menuPopoverClassNames, renderMenuPopover_unstable, useMenuPopoverStyles_unstable, useMenuPopover_unstable } from './MenuPopover';\nexport { MenuSplitGroup, menuSplitGroupClassNames, renderMenuSplitGroup_unstable, useMenuSplitGroupStyles_unstable, useMenuSplitGroup_unstable } from './MenuSplitGroup';\nexport { MenuTrigger, renderMenuTrigger_unstable, useMenuTrigger_unstable } from './MenuTrigger';\nexport { useCheckmarkStyles_unstable } from './selectable/index';\nexport { MenuItemLink, menuItemLinkClassNames, renderMenuItemLink_unstable, useMenuItemLinkStyles_unstable, useMenuItemLink_unstable } from './MenuItemLink';\nexport { MENU_ENTER_EVENT, dispatchMenuEnterEvent, useOnMenuMouseEnter } from './utils';\n"],"names":["MenuProvider","useMenuContext_unstable","MenuTriggerContextProvider","useMenuTriggerContext_unstable","MenuGroupContextProvider","useMenuGroupContext_unstable","MenuListProvider","useMenuListContext_unstable","Menu","renderMenu_unstable","useMenuContextValues_unstable","useMenu_unstable","MenuDivider","menuDividerClassNames","renderMenuDivider_unstable","useMenuDividerStyles_unstable","useMenuDivider_unstable","MenuGroup","menuGroupClassNames","renderMenuGroup_unstable","useMenuGroupContextValues_unstable","useMenuGroupStyles_unstable","useMenuGroup_unstable","MenuGroupHeader","menuGroupHeaderClassNames","renderMenuGroupHeader_unstable","useMenuGroupHeaderStyles_unstable","useMenuGroupHeader_unstable","MenuItem","menuItemClassNames","renderMenuItem_unstable","useMenuItemStyles_unstable","useMenuItem_unstable","MenuItemCheckbox","menuItemCheckboxClassNames","renderMenuItemCheckbox_unstable","useMenuItemCheckboxStyles_unstable","useMenuItemCheckbox_unstable","MenuItemRadio","menuItemRadioClassNames","renderMenuItemRadio_unstable","useMenuItemRadioStyles_unstable","useMenuItemRadio_unstable","MenuList","menuListClassNames","renderMenuList_unstable","useMenuListContextValues_unstable","useMenuListStyles_unstable","useMenuList_unstable","MenuPopover","menuPopoverClassNames","renderMenuPopover_unstable","useMenuPopoverStyles_unstable","useMenuPopover_unstable","MenuSplitGroup","menuSplitGroupClassNames","renderMenuSplitGroup_unstable","useMenuSplitGroupStyles_unstable","useMenuSplitGroup_unstable","MenuTrigger","renderMenuTrigger_unstable","useMenuTrigger_unstable","useCheckmarkStyles_unstable","MenuItemLink","menuItemLinkClassNames","renderMenuItemLink_unstable","useMenuItemLinkStyles_unstable","useMenuItemLink_unstable","MENU_ENTER_EVENT","dispatchMenuEnterEvent","useOnMenuMouseEnter"],"mappings":";;;;;;;;;;;IAASA,YAAY;eAAZA,yBAAY;;IAAEC,uBAAuB;eAAvBA,oCAAuB;;IACrCC,0BAA0B;eAA1BA,8CAA0B;;IAAEC,8BAA8B;eAA9BA,kDAA8B;;IAC1DC,wBAAwB;eAAxBA,0CAAwB;;IAAEC,4BAA4B;eAA5BA,8CAA4B;;IACtDC,gBAAgB;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IAAEC,kBAAkB;eAAlBA,4BAAkB;;IAAEC,uBAAuB;eAAvBA,iCAAuB;;IAAEC,iCAAiC;eAAjCA,2CAAiC;;IAAEC,0BAA0B;eAA1BA,oCAA0B;;IAAEC,oBAAoB;eAApBA,8BAAoB;;IAC1IC,WAAW;eAAXA,wBAAW;;IAAEC,qBAAqB;eAArBA,kCAAqB;;IAAEC,0BAA0B;eAA1BA,uCAA0B;;IAAEC,6BAA6B;eAA7BA,0CAA6B;;IAAEC,uBAAuB;eAAvBA,oCAAuB;;IACtHC,cAAc;eAAdA,8BAAc;;IAAEC,wBAAwB;eAAxBA,wCAAwB;;IAAEC,6BAA6B;eAA7BA,6CAA6B;;IAAEC,gCAAgC;eAAhCA,gDAAgC;;IAAEC,0BAA0B;eAA1BA,0CAA0B;;IACrIC,WAAW;eAAXA,wBAAW;;IAAEC,0BAA0B;eAA1BA,uCAA0B;;IAAEC,uBAAuB;eAAvBA,oCAAuB;;IAChEC,2BAA2B;eAA3BA,kCAA2B;;IAC3BC,YAAY;eAAZA,0BAAY;;IAAEC,sBAAsB;eAAtBA,oCAAsB;;IAAEC,2BAA2B;eAA3BA,yCAA2B;;IAAEC,8BAA8B;eAA9BA,4CAA8B;;IAAEC,wBAAwB;eAAxBA,sCAAwB;;IAC3HC,gBAAgB;eAAhBA,uBAAgB;;IAAEC,sBAAsB;eAAtBA,6BAAsB;;IAAEC,mBAAmB;eAAnBA,0BAAmB;;;
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export { MenuProvider, useMenuContext_unstable } from './contexts/menuContext';\nexport { MenuTriggerContextProvider, useMenuTriggerContext_unstable } from './contexts/menuTriggerContext';\nexport { MenuGroupContextProvider, useMenuGroupContext_unstable } from './contexts/menuGroupContext';\nexport { MenuListProvider, useMenuListContext_unstable } from './contexts/menuListContext';\nexport { Menu, renderMenu_unstable, useMenuContextValues_unstable, useMenu_unstable } from './Menu';\nexport { MenuDivider, menuDividerClassNames, renderMenuDivider_unstable, useMenuDividerStyles_unstable, useMenuDivider_unstable } from './MenuDivider';\nexport { MenuGroup, menuGroupClassNames, renderMenuGroup_unstable, useMenuGroupContextValues_unstable, useMenuGroupStyles_unstable, useMenuGroup_unstable } from './MenuGroup';\nexport { MenuGroupHeader, menuGroupHeaderClassNames, renderMenuGroupHeader_unstable, useMenuGroupHeaderStyles_unstable, useMenuGroupHeader_unstable } from './MenuGroupHeader';\nexport { MenuItem, menuItemClassNames, renderMenuItem_unstable, useMenuItemStyles_unstable, useMenuItem_unstable } from './MenuItem';\nexport { MenuItemCheckbox, menuItemCheckboxClassNames, renderMenuItemCheckbox_unstable, useMenuItemCheckboxStyles_unstable, useMenuItemCheckbox_unstable } from './MenuItemCheckbox';\nexport { MenuItemRadio, menuItemRadioClassNames, renderMenuItemRadio_unstable, useMenuItemRadioStyles_unstable, useMenuItemRadio_unstable } from './MenuItemRadio';\nexport { MenuList, menuListClassNames, renderMenuList_unstable, useMenuListContextValues_unstable, useMenuListStyles_unstable, useMenuList_unstable } from './MenuList';\nexport { MenuPopover, menuPopoverClassNames, renderMenuPopover_unstable, useMenuPopoverStyles_unstable, useMenuPopover_unstable } from './MenuPopover';\nexport { MenuSplitGroup, menuSplitGroupClassNames, renderMenuSplitGroup_unstable, useMenuSplitGroupStyles_unstable, useMenuSplitGroup_unstable } from './MenuSplitGroup';\nexport { MenuTrigger, renderMenuTrigger_unstable, useMenuTrigger_unstable } from './MenuTrigger';\nexport { useCheckmarkStyles_unstable } from './selectable/index';\nexport { MenuItemLink, menuItemLinkClassNames, renderMenuItemLink_unstable, useMenuItemLinkStyles_unstable, useMenuItemLink_unstable } from './MenuItemLink';\nexport { MENU_ENTER_EVENT, dispatchMenuEnterEvent, useOnMenuMouseEnter } from './utils';\nexport { MenuItemSwitch, useMenuItemSwitch_unstable, useMenuItemSwitchStyles_unstable, renderMenuItemSwitch_unstable, menuItemSwitchClassNames } from './MenuItemSwitch';\n"],"names":["MenuProvider","useMenuContext_unstable","MenuTriggerContextProvider","useMenuTriggerContext_unstable","MenuGroupContextProvider","useMenuGroupContext_unstable","MenuListProvider","useMenuListContext_unstable","Menu","renderMenu_unstable","useMenuContextValues_unstable","useMenu_unstable","MenuDivider","menuDividerClassNames","renderMenuDivider_unstable","useMenuDividerStyles_unstable","useMenuDivider_unstable","MenuGroup","menuGroupClassNames","renderMenuGroup_unstable","useMenuGroupContextValues_unstable","useMenuGroupStyles_unstable","useMenuGroup_unstable","MenuGroupHeader","menuGroupHeaderClassNames","renderMenuGroupHeader_unstable","useMenuGroupHeaderStyles_unstable","useMenuGroupHeader_unstable","MenuItem","menuItemClassNames","renderMenuItem_unstable","useMenuItemStyles_unstable","useMenuItem_unstable","MenuItemCheckbox","menuItemCheckboxClassNames","renderMenuItemCheckbox_unstable","useMenuItemCheckboxStyles_unstable","useMenuItemCheckbox_unstable","MenuItemRadio","menuItemRadioClassNames","renderMenuItemRadio_unstable","useMenuItemRadioStyles_unstable","useMenuItemRadio_unstable","MenuList","menuListClassNames","renderMenuList_unstable","useMenuListContextValues_unstable","useMenuListStyles_unstable","useMenuList_unstable","MenuPopover","menuPopoverClassNames","renderMenuPopover_unstable","useMenuPopoverStyles_unstable","useMenuPopover_unstable","MenuSplitGroup","menuSplitGroupClassNames","renderMenuSplitGroup_unstable","useMenuSplitGroupStyles_unstable","useMenuSplitGroup_unstable","MenuTrigger","renderMenuTrigger_unstable","useMenuTrigger_unstable","useCheckmarkStyles_unstable","MenuItemLink","menuItemLinkClassNames","renderMenuItemLink_unstable","useMenuItemLinkStyles_unstable","useMenuItemLink_unstable","MENU_ENTER_EVENT","dispatchMenuEnterEvent","useOnMenuMouseEnter","MenuItemSwitch","useMenuItemSwitch_unstable","useMenuItemSwitchStyles_unstable","renderMenuItemSwitch_unstable","menuItemSwitchClassNames"],"mappings":";;;;;;;;;;;IAASA,YAAY;eAAZA,yBAAY;;IAAEC,uBAAuB;eAAvBA,oCAAuB;;IACrCC,0BAA0B;eAA1BA,8CAA0B;;IAAEC,8BAA8B;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wC;+BACf;0BACU;6BACpB;gCACe;6BACrE;uBACrC;8BACgG;uBAC9D;gCACwE"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-menu",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.14.1",
|
4
4
|
"description": "Fluent UI menu component",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -37,16 +37,16 @@
|
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
39
|
"@fluentui/keyboard-keys": "^9.0.7",
|
40
|
-
"@fluentui/react-aria": "^9.
|
41
|
-
"@fluentui/react-context-selector": "^9.1.
|
42
|
-
"@fluentui/react-icons": "^2.0.
|
43
|
-
"@fluentui/react-portal": "^9.4.
|
44
|
-
"@fluentui/react-positioning": "^9.14.
|
45
|
-
"@fluentui/react-shared-contexts": "^9.
|
46
|
-
"@fluentui/react-tabster": "^9.
|
40
|
+
"@fluentui/react-aria": "^9.11.0",
|
41
|
+
"@fluentui/react-context-selector": "^9.1.58",
|
42
|
+
"@fluentui/react-icons": "^2.0.237",
|
43
|
+
"@fluentui/react-portal": "^9.4.22",
|
44
|
+
"@fluentui/react-positioning": "^9.14.4",
|
45
|
+
"@fluentui/react-shared-contexts": "^9.17.0",
|
46
|
+
"@fluentui/react-tabster": "^9.21.0",
|
47
47
|
"@fluentui/react-theme": "^9.1.19",
|
48
|
-
"@fluentui/react-utilities": "^9.18.
|
49
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
48
|
+
"@fluentui/react-utilities": "^9.18.7",
|
49
|
+
"@fluentui/react-jsx-runtime": "^9.0.36",
|
50
50
|
"@griffel/react": "^1.5.14",
|
51
51
|
"@swc/helpers": "^0.5.1"
|
52
52
|
},
|