@fluentui/react-popover 9.8.12 → 9.8.14
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +127 -1
- package/CHANGELOG.md +36 -2
- package/lib/components/Popover/usePopover.js +1 -2
- package/lib/components/Popover/usePopover.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.styles.js +5 -2
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.styles.js.map +1 -1
- package/lib/components/PopoverTrigger/usePopoverTrigger.js +3 -3
- package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/Popover/usePopover.js +2 -3
- package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.styles.js +5 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.styles.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +3 -3
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,133 @@
|
|
2
2
|
"name": "@fluentui/react-popover",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Wed, 11 Oct 2023 13:50:05 GMT",
|
6
|
+
"tag": "@fluentui/react-popover_v9.8.14",
|
7
|
+
"version": "9.8.14",
|
8
|
+
"comments": {
|
9
|
+
"patch": [
|
10
|
+
{
|
11
|
+
"author": "lingfan.gao@microsoft.com",
|
12
|
+
"package": "@fluentui/react-popover",
|
13
|
+
"commit": "97c3bc01d08b40f2fd0291fa193d95a621c9bdb8",
|
14
|
+
"comment": "refactor: consume virtual parent utilities from @fluentui/react-utilities"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "bernardo.sunderhus@gmail.com",
|
18
|
+
"package": "@fluentui/react-popover",
|
19
|
+
"commit": "b4466a0b9d3568e8e1ee1d814db5c8449dfd65b8",
|
20
|
+
"comment": "chore: use default prevention instead of stop propagation for Escape handling"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-popover",
|
25
|
+
"comment": "Bump @fluentui/react-aria to v9.3.42",
|
26
|
+
"commit": "b4466a0b9d3568e8e1ee1d814db5c8449dfd65b8"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-popover",
|
31
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.40",
|
32
|
+
"commit": "b4466a0b9d3568e8e1ee1d814db5c8449dfd65b8"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"author": "beachball",
|
36
|
+
"package": "@fluentui/react-popover",
|
37
|
+
"comment": "Bump @fluentui/react-portal to v9.3.23",
|
38
|
+
"commit": "b4466a0b9d3568e8e1ee1d814db5c8449dfd65b8"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"author": "beachball",
|
42
|
+
"package": "@fluentui/react-popover",
|
43
|
+
"comment": "Bump @fluentui/react-positioning to v9.9.20",
|
44
|
+
"commit": "b4466a0b9d3568e8e1ee1d814db5c8449dfd65b8"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"author": "beachball",
|
48
|
+
"package": "@fluentui/react-popover",
|
49
|
+
"comment": "Bump @fluentui/react-tabster to v9.13.6",
|
50
|
+
"commit": "b4466a0b9d3568e8e1ee1d814db5c8449dfd65b8"
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"author": "beachball",
|
54
|
+
"package": "@fluentui/react-popover",
|
55
|
+
"comment": "Bump @fluentui/react-utilities to v9.15.0",
|
56
|
+
"commit": "b4466a0b9d3568e8e1ee1d814db5c8449dfd65b8"
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"author": "beachball",
|
60
|
+
"package": "@fluentui/react-popover",
|
61
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.16",
|
62
|
+
"commit": "b4466a0b9d3568e8e1ee1d814db5c8449dfd65b8"
|
63
|
+
}
|
64
|
+
]
|
65
|
+
}
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"date": "Mon, 09 Oct 2023 20:45:43 GMT",
|
69
|
+
"tag": "@fluentui/react-popover_v9.8.13",
|
70
|
+
"version": "9.8.13",
|
71
|
+
"comments": {
|
72
|
+
"patch": [
|
73
|
+
{
|
74
|
+
"author": "esteban.230@hotmail.com",
|
75
|
+
"package": "@fluentui/react-popover",
|
76
|
+
"commit": "53f8d9c7e4f4c76a81194918a76d537eced78517",
|
77
|
+
"comment": "fix: Add zIndex=1 to PopoverSurface when rendering inline to avoid elements positioned relative to render on top of it."
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"author": "beachball",
|
81
|
+
"package": "@fluentui/react-popover",
|
82
|
+
"comment": "Bump @fluentui/react-aria to v9.3.41",
|
83
|
+
"commit": "d2196ea1ca001fbc22f38fcb258016f1df6c87e4"
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"author": "beachball",
|
87
|
+
"package": "@fluentui/react-popover",
|
88
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.39",
|
89
|
+
"commit": "d2196ea1ca001fbc22f38fcb258016f1df6c87e4"
|
90
|
+
},
|
91
|
+
{
|
92
|
+
"author": "beachball",
|
93
|
+
"package": "@fluentui/react-popover",
|
94
|
+
"comment": "Bump @fluentui/react-portal to v9.3.22",
|
95
|
+
"commit": "d2196ea1ca001fbc22f38fcb258016f1df6c87e4"
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"author": "beachball",
|
99
|
+
"package": "@fluentui/react-popover",
|
100
|
+
"comment": "Bump @fluentui/react-positioning to v9.9.19",
|
101
|
+
"commit": "d2196ea1ca001fbc22f38fcb258016f1df6c87e4"
|
102
|
+
},
|
103
|
+
{
|
104
|
+
"author": "beachball",
|
105
|
+
"package": "@fluentui/react-popover",
|
106
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.10.0",
|
107
|
+
"commit": "d2196ea1ca001fbc22f38fcb258016f1df6c87e4"
|
108
|
+
},
|
109
|
+
{
|
110
|
+
"author": "beachball",
|
111
|
+
"package": "@fluentui/react-popover",
|
112
|
+
"comment": "Bump @fluentui/react-tabster to v9.13.5",
|
113
|
+
"commit": "d2196ea1ca001fbc22f38fcb258016f1df6c87e4"
|
114
|
+
},
|
115
|
+
{
|
116
|
+
"author": "beachball",
|
117
|
+
"package": "@fluentui/react-popover",
|
118
|
+
"comment": "Bump @fluentui/react-utilities to v9.14.2",
|
119
|
+
"commit": "d2196ea1ca001fbc22f38fcb258016f1df6c87e4"
|
120
|
+
},
|
121
|
+
{
|
122
|
+
"author": "beachball",
|
123
|
+
"package": "@fluentui/react-popover",
|
124
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.15",
|
125
|
+
"commit": "d2196ea1ca001fbc22f38fcb258016f1df6c87e4"
|
126
|
+
}
|
127
|
+
]
|
128
|
+
}
|
129
|
+
},
|
130
|
+
{
|
131
|
+
"date": "Thu, 05 Oct 2023 15:25:32 GMT",
|
6
132
|
"tag": "@fluentui/react-popover_v9.8.12",
|
7
133
|
"version": "9.8.12",
|
8
134
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,46 @@
|
|
1
1
|
# Change Log - @fluentui/react-popover
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Wed, 11 Oct 2023 13:50:05 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.8.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.8.14)
|
8
|
+
|
9
|
+
Wed, 11 Oct 2023 13:50:05 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.8.13..@fluentui/react-popover_v9.8.14)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- refactor: consume virtual parent utilities from @fluentui/react-utilities ([PR #29286](https://github.com/microsoft/fluentui/pull/29286) by lingfan.gao@microsoft.com)
|
15
|
+
- chore: use default prevention instead of stop propagation for Escape handling ([PR #29262](https://github.com/microsoft/fluentui/pull/29262) by bernardo.sunderhus@gmail.com)
|
16
|
+
- Bump @fluentui/react-aria to v9.3.42 ([PR #29262](https://github.com/microsoft/fluentui/pull/29262) by beachball)
|
17
|
+
- Bump @fluentui/react-context-selector to v9.1.40 ([PR #29262](https://github.com/microsoft/fluentui/pull/29262) by beachball)
|
18
|
+
- Bump @fluentui/react-portal to v9.3.23 ([PR #29262](https://github.com/microsoft/fluentui/pull/29262) by beachball)
|
19
|
+
- Bump @fluentui/react-positioning to v9.9.20 ([PR #29262](https://github.com/microsoft/fluentui/pull/29262) by beachball)
|
20
|
+
- Bump @fluentui/react-tabster to v9.13.6 ([PR #29262](https://github.com/microsoft/fluentui/pull/29262) by beachball)
|
21
|
+
- Bump @fluentui/react-utilities to v9.15.0 ([PR #29262](https://github.com/microsoft/fluentui/pull/29262) by beachball)
|
22
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.16 ([PR #29262](https://github.com/microsoft/fluentui/pull/29262) by beachball)
|
23
|
+
|
24
|
+
## [9.8.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.8.13)
|
25
|
+
|
26
|
+
Mon, 09 Oct 2023 20:45:43 GMT
|
27
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.8.12..@fluentui/react-popover_v9.8.13)
|
28
|
+
|
29
|
+
### Patches
|
30
|
+
|
31
|
+
- fix: Add zIndex=1 to PopoverSurface when rendering inline to avoid elements positioned relative to render on top of it. ([PR #29425](https://github.com/microsoft/fluentui/pull/29425) by esteban.230@hotmail.com)
|
32
|
+
- Bump @fluentui/react-aria to v9.3.41 ([PR #29364](https://github.com/microsoft/fluentui/pull/29364) by beachball)
|
33
|
+
- Bump @fluentui/react-context-selector to v9.1.39 ([PR #29364](https://github.com/microsoft/fluentui/pull/29364) by beachball)
|
34
|
+
- Bump @fluentui/react-portal to v9.3.22 ([PR #29364](https://github.com/microsoft/fluentui/pull/29364) by beachball)
|
35
|
+
- Bump @fluentui/react-positioning to v9.9.19 ([PR #29364](https://github.com/microsoft/fluentui/pull/29364) by beachball)
|
36
|
+
- Bump @fluentui/react-shared-contexts to v9.10.0 ([PR #29364](https://github.com/microsoft/fluentui/pull/29364) by beachball)
|
37
|
+
- Bump @fluentui/react-tabster to v9.13.5 ([PR #29364](https://github.com/microsoft/fluentui/pull/29364) by beachball)
|
38
|
+
- Bump @fluentui/react-utilities to v9.14.2 ([PR #29364](https://github.com/microsoft/fluentui/pull/29364) by beachball)
|
39
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.15 ([PR #29364](https://github.com/microsoft/fluentui/pull/29364) by beachball)
|
40
|
+
|
7
41
|
## [9.8.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.8.12)
|
8
42
|
|
9
|
-
Thu, 05 Oct 2023 15:
|
43
|
+
Thu, 05 Oct 2023 15:25:32 GMT
|
10
44
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.8.11..@fluentui/react-popover_v9.8.12)
|
11
45
|
|
12
46
|
### Patches
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside } from '@fluentui/react-utilities';
|
2
|
+
import { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside, elementContains } from '@fluentui/react-utilities';
|
3
3
|
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
|
4
4
|
import { usePositioning, resolvePositioningShorthand, mergeArrowOffset, usePositioningMouseTarget } from '@fluentui/react-positioning';
|
5
|
-
import { elementContains } from '@fluentui/react-portal';
|
6
5
|
import { useFocusFinders } from '@fluentui/react-tabster';
|
7
6
|
import { arrowHeights } from '../PopoverSurface/index';
|
8
7
|
import { popoverSurfaceBorderRadius } from './constants';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["usePopover.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n useControllableState,\n useEventCallback,\n useOnClickOutside,\n useOnScrollOutside,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport {\n usePositioning,\n resolvePositioningShorthand,\n mergeArrowOffset,\n usePositioningMouseTarget,\n} from '@fluentui/react-positioning';\nimport { elementContains } from '@fluentui/react-portal';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { arrowHeights } from '../PopoverSurface/index';\nimport type { OpenPopoverEvents, PopoverProps, PopoverState } from './Popover.types';\nimport { popoverSurfaceBorderRadius } from './constants';\n\n/**\n * Create the state required to render Popover.\n *\n * The returned state can be modified with hooks such as usePopoverStyles,\n * before being passed to renderPopover_unstable.\n *\n * @param props - props from this instance of Popover\n */\nexport const usePopover_unstable = (props: PopoverProps): PopoverState => {\n const [contextTarget, setContextTarget] = usePositioningMouseTarget();\n const initialState = {\n size: 'medium',\n contextTarget,\n setContextTarget,\n ...props,\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('Popover must contain at least one child');\n }\n\n if (children.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('Popover must contain at most two children');\n }\n }\n\n let popoverTrigger: React.ReactElement | undefined = undefined;\n let popoverSurface: React.ReactElement | undefined = undefined;\n if (children.length === 2) {\n popoverTrigger = children[0];\n popoverSurface = children[1];\n } else if (children.length === 1) {\n popoverSurface = children[0];\n }\n\n const [open, setOpenState] = useOpenState(initialState);\n\n const setOpenTimeoutRef = React.useRef(0);\n\n const setOpen = useEventCallback((e: OpenPopoverEvents, shouldOpen: boolean) => {\n clearTimeout(setOpenTimeoutRef.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') {\n // FIXME leaking Node timeout type\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n setOpenTimeoutRef.current = setTimeout(() => {\n setOpenState(e, shouldOpen);\n }, props.mouseLeaveDelay ?? 500);\n } else {\n setOpenState(e, shouldOpen);\n }\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(setOpenTimeoutRef.current);\n };\n }, []);\n\n const toggleOpen = React.useCallback<PopoverState['toggleOpen']>(\n e => {\n setOpen(e, !open);\n },\n [setOpen, open],\n );\n\n const positioningRefs = usePopoverRefs(initialState);\n const { targetDocument } = useFluent();\n\n useOnClickOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [positioningRefs.triggerRef, positioningRefs.contentRef],\n disabled: !open,\n disabledFocusOnIframe: !(props.closeOnIframeFocus ?? true),\n });\n\n // only close on scroll for context, or when closeOnScroll is specified\n const closeOnScroll = initialState.openOnContext || initialState.closeOnScroll;\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [positioningRefs.triggerRef, positioningRefs.contentRef],\n disabled: !open || !closeOnScroll,\n });\n\n const { findFirstFocusable } = useFocusFinders();\n\n React.useEffect(() => {\n if (props.unstable_disableAutoFocus) {\n return;\n }\n\n if (open && positioningRefs.contentRef.current) {\n const containerTabIndex = positioningRefs.contentRef.current.getAttribute('tabIndex') ?? undefined;\n const firstFocusable = isNaN(containerTabIndex)\n ? findFirstFocusable(positioningRefs.contentRef.current)\n : positioningRefs.contentRef.current;\n firstFocusable?.focus();\n }\n }, [findFirstFocusable, open, positioningRefs.contentRef, props.unstable_disableAutoFocus]);\n\n return {\n ...initialState,\n ...positioningRefs,\n // eslint-disable-next-line deprecation/deprecation\n inertTrapFocus: props.inertTrapFocus ?? (props.legacyTrapFocus === undefined ? false : !props.legacyTrapFocus),\n popoverTrigger,\n popoverSurface,\n open,\n setOpen,\n toggleOpen,\n setContextTarget,\n contextTarget,\n inline: props.inline ?? false,\n };\n};\n\n/**\n * Creates and manages the Popover open state\n */\nfunction useOpenState(\n state: Pick<PopoverState, 'setContextTarget' | 'onOpenChange'> & Pick<PopoverProps, 'open' | 'defaultOpen'>,\n) {\n const onOpenChange: PopoverState['onOpenChange'] = useEventCallback((e, data) => state.onOpenChange?.(e, data));\n\n const [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false,\n });\n state.open = open !== undefined ? open : state.open;\n const setContextTarget = state.setContextTarget;\n\n const setOpen = React.useCallback(\n (e: OpenPopoverEvents, shouldOpen: boolean) => {\n if (shouldOpen && e.type === 'contextmenu') {\n setContextTarget(e as React.MouseEvent);\n }\n\n if (!shouldOpen) {\n setContextTarget(undefined);\n }\n\n setOpenState(shouldOpen);\n onOpenChange?.(e, { open: shouldOpen });\n },\n [setOpenState, onOpenChange, setContextTarget],\n );\n\n return [open, setOpen] as const;\n}\n\n/**\n * Creates and sets the necessary trigger, target and content refs used by Popover\n */\nfunction usePopoverRefs(\n state: Pick<PopoverState, 'size' | 'contextTarget'> &\n Pick<PopoverProps, 'positioning' | 'openOnContext' | 'withArrow'>,\n) {\n const positioningOptions = {\n position: 'above' as const,\n align: 'center' as const,\n arrowPadding: 2 * popoverSurfaceBorderRadius,\n target: state.openOnContext ? state.contextTarget : undefined,\n ...resolvePositioningShorthand(state.positioning),\n };\n\n // no reason to render arrow when covering the target\n if (positioningOptions.coverTarget) {\n state.withArrow = false;\n }\n\n if (state.withArrow) {\n positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeights[state.size]);\n }\n\n const { targetRef: triggerRef, containerRef: contentRef, arrowRef } = usePositioning(positioningOptions);\n\n return {\n triggerRef,\n contentRef,\n arrowRef,\n } as const;\n}\n"],"names":["React","useControllableState","useEventCallback","useOnClickOutside","useOnScrollOutside","useFluent_unstable","useFluent","usePositioning","resolvePositioningShorthand","mergeArrowOffset","usePositioningMouseTarget","elementContains","useFocusFinders","arrowHeights","popoverSurfaceBorderRadius","usePopover_unstable","props","contextTarget","setContextTarget","initialState","size","children","Children","toArray","process","env","NODE_ENV","length","console","warn","popoverTrigger","undefined","popoverSurface","open","setOpenState","useOpenState","setOpenTimeoutRef","useRef","setOpen","e","shouldOpen","clearTimeout","current","Event","persist","type","setTimeout","mouseLeaveDelay","useEffect","toggleOpen","useCallback","positioningRefs","usePopoverRefs","targetDocument","contains","element","callback","ev","refs","triggerRef","contentRef","disabled","disabledFocusOnIframe","closeOnIframeFocus","closeOnScroll","openOnContext","findFirstFocusable","unstable_disableAutoFocus","containerTabIndex","getAttribute","firstFocusable","isNaN","focus","inertTrapFocus","legacyTrapFocus","inline","state","onOpenChange","data","defaultState","defaultOpen","positioningOptions","position","align","arrowPadding","target","positioning","coverTarget","withArrow","offset","targetRef","containerRef","arrowRef"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,oBAAoB,EACpBC,gBAAgB,EAChBC,iBAAiB,EACjBC,kBAAkB,QACb,4BAA4B;AACnC,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SACEC,cAAc,EACdC,2BAA2B,EAC3BC,gBAAgB,EAChBC,yBAAyB,QACpB,8BAA8B;AACrC,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,YAAY,QAAQ,0BAA0B;AAEvD,SAASC,0BAA0B,QAAQ,cAAc;AAEzD;;;;;;;CAOC,GACD,OAAO,MAAMC,sBAAsB,CAACC;IAClC,MAAM,CAACC,eAAeC,iBAAiB,GAAGR;IAC1C,MAAMS,eAAe;QACnBC,MAAM;QACNH;QACAC;QACA,GAAGF,KAAK;IACV;IAEA,MAAMK,WAAWrB,MAAMsB,QAAQ,CAACC,OAAO,CAACP,MAAMK,QAAQ;IAEtD,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAIL,SAASM,MAAM,KAAK,GAAG;YACzB,sCAAsC;YACtCC,QAAQC,IAAI,CAAC;QACf;Q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EAAE;QACnBP,mBAAmBQ,MAAM,GAAGhF,iBAAiBwE,mBAAmBQ,MAAM,EAAE5E,YAAY,CAAC+D,MAAMxD,IAAI,CAAC;IAClG;IAEA,MAAM,EAAEsE,WAAW/B,UAAU,EAAEgC,cAAc/B,UAAU,EAAEgC,QAAQ,EAAE,GAAGrF,eAAe0E;IAErF,OAAO;QACLtB;QACAC;QACAgC;IACF;AACF"}
|
1
|
+
{"version":3,"sources":["usePopover.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n useControllableState,\n useEventCallback,\n useOnClickOutside,\n useOnScrollOutside,\n elementContains,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport {\n usePositioning,\n resolvePositioningShorthand,\n mergeArrowOffset,\n usePositioningMouseTarget,\n} from '@fluentui/react-positioning';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { arrowHeights } from '../PopoverSurface/index';\nimport type { OpenPopoverEvents, PopoverProps, PopoverState } from './Popover.types';\nimport { popoverSurfaceBorderRadius } from './constants';\n\n/**\n * Create the state required to render Popover.\n *\n * The returned state can be modified with hooks such as usePopoverStyles,\n * before being passed to renderPopover_unstable.\n *\n * @param props - props from this instance of Popover\n */\nexport const usePopover_unstable = (props: PopoverProps): PopoverState => {\n const [contextTarget, setContextTarget] = usePositioningMouseTarget();\n const initialState = {\n size: 'medium',\n contextTarget,\n setContextTarget,\n ...props,\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('Popover must contain at least one child');\n }\n\n if (children.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('Popover must contain at most two children');\n }\n }\n\n let popoverTrigger: React.ReactElement | undefined = undefined;\n let popoverSurface: React.ReactElement | undefined = undefined;\n if (children.length === 2) {\n popoverTrigger = children[0];\n popoverSurface = children[1];\n } else if (children.length === 1) {\n popoverSurface = children[0];\n }\n\n const [open, setOpenState] = useOpenState(initialState);\n\n const setOpenTimeoutRef = React.useRef(0);\n\n const setOpen = useEventCallback((e: OpenPopoverEvents, shouldOpen: boolean) => {\n clearTimeout(setOpenTimeoutRef.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') {\n // FIXME leaking Node timeout type\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n setOpenTimeoutRef.current = setTimeout(() => {\n setOpenState(e, shouldOpen);\n }, props.mouseLeaveDelay ?? 500);\n } else {\n setOpenState(e, shouldOpen);\n }\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(setOpenTimeoutRef.current);\n };\n }, []);\n\n const toggleOpen = React.useCallback<PopoverState['toggleOpen']>(\n e => {\n setOpen(e, !open);\n },\n [setOpen, open],\n );\n\n const positioningRefs = usePopoverRefs(initialState);\n const { targetDocument } = useFluent();\n\n useOnClickOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [positioningRefs.triggerRef, positioningRefs.contentRef],\n disabled: !open,\n disabledFocusOnIframe: !(props.closeOnIframeFocus ?? true),\n });\n\n // only close on scroll for context, or when closeOnScroll is specified\n const closeOnScroll = initialState.openOnContext || initialState.closeOnScroll;\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [positioningRefs.triggerRef, positioningRefs.contentRef],\n disabled: !open || !closeOnScroll,\n });\n\n const { findFirstFocusable } = useFocusFinders();\n\n React.useEffect(() => {\n if (props.unstable_disableAutoFocus) {\n return;\n }\n\n if (open && positioningRefs.contentRef.current) {\n const containerTabIndex = positioningRefs.contentRef.current.getAttribute('tabIndex') ?? undefined;\n const firstFocusable = isNaN(containerTabIndex)\n ? findFirstFocusable(positioningRefs.contentRef.current)\n : positioningRefs.contentRef.current;\n firstFocusable?.focus();\n }\n }, [findFirstFocusable, open, positioningRefs.contentRef, props.unstable_disableAutoFocus]);\n\n return {\n ...initialState,\n ...positioningRefs,\n // eslint-disable-next-line deprecation/deprecation\n inertTrapFocus: props.inertTrapFocus ?? (props.legacyTrapFocus === undefined ? false : !props.legacyTrapFocus),\n popoverTrigger,\n popoverSurface,\n open,\n setOpen,\n toggleOpen,\n setContextTarget,\n contextTarget,\n inline: props.inline ?? false,\n };\n};\n\n/**\n * Creates and manages the Popover open state\n */\nfunction useOpenState(\n state: Pick<PopoverState, 'setContextTarget' | 'onOpenChange'> & Pick<PopoverProps, 'open' | 'defaultOpen'>,\n) {\n const onOpenChange: PopoverState['onOpenChange'] = useEventCallback((e, data) => state.onOpenChange?.(e, data));\n\n const [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false,\n });\n state.open = open !== undefined ? open : state.open;\n const setContextTarget = state.setContextTarget;\n\n const setOpen = React.useCallback(\n (e: OpenPopoverEvents, shouldOpen: boolean) => {\n if (shouldOpen && e.type === 'contextmenu') {\n setContextTarget(e as React.MouseEvent);\n }\n\n if (!shouldOpen) {\n setContextTarget(undefined);\n }\n\n setOpenState(shouldOpen);\n onOpenChange?.(e, { open: shouldOpen });\n },\n [setOpenState, onOpenChange, setContextTarget],\n );\n\n return [open, setOpen] as const;\n}\n\n/**\n * Creates and sets the necessary trigger, target and content refs used by Popover\n */\nfunction usePopoverRefs(\n state: Pick<PopoverState, 'size' | 'contextTarget'> &\n Pick<PopoverProps, 'positioning' | 'openOnContext' | 'withArrow'>,\n) {\n const positioningOptions = {\n position: 'above' as const,\n align: 'center' as const,\n arrowPadding: 2 * popoverSurfaceBorderRadius,\n target: state.openOnContext ? state.contextTarget : undefined,\n ...resolvePositioningShorthand(state.positioning),\n };\n\n // no reason to render arrow when covering the target\n if (positioningOptions.coverTarget) {\n state.withArrow = false;\n }\n\n if (state.withArrow) {\n positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeights[state.size]);\n }\n\n const { targetRef: triggerRef, containerRef: contentRef, arrowRef } = usePositioning(positioningOptions);\n\n return {\n triggerRef,\n contentRef,\n arrowRef,\n } as const;\n}\n"],"names":["React","useControllableState","useEventCallback","useOnClickOutside","useOnScrollOutside","elementContains","useFluent_unstable","useFluent","usePositioning","resolvePositioningShorthand","mergeArrowOffset","usePositioningMouseTarget","useFocusFinders","arrowHeights","popoverSurfaceBorderRadius","usePopover_unstable","props","contextTarget","setContextTarget","initialState","size","children","Children","toArray","process","env","NODE_ENV","length","console","warn","popoverTrigger","undefined","popoverSurface","open","setOpenState","useOpenState","setOpenTimeoutRef","useRef","setOpen","e","shouldOpen","clearTimeout","current","Event","persist","type","setTimeout","mouseLeaveDelay","useEffect","toggleOpen","useCallback","positioningRefs","usePopoverRefs","targetDocument","contains","element","callback","ev","refs","triggerRef","contentRef","disabled","disabledFocusOnIframe","closeOnIframeFocus","closeOnScroll","openOnContext","findFirstFocusable","unstable_disableAutoFocus","containerTabIndex","getAttribute","firstFocusable","isNaN","focus","inertTrapFocus","legacyTrapFocus","inline","state","onOpenChange","data","defaultState","defaultOpen","positioningOptions","position","align","arrowPadding","target","positioning","coverTarget","withArrow","offset","targetRef","containerRef","arrowRef"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,oBAAoB,EACpBC,gBAAgB,EAChBC,iBAAiB,EACjBC,kBAAkB,EAClBC,eAAe,QACV,4BAA4B;AACnC,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SACEC,cAAc,EACdC,2BAA2B,EAC3BC,gBAAgB,EAChBC,yBAAyB,QACpB,8BAA8B;AACrC,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,YAAY,QAAQ,0BAA0B;AAEvD,SAASC,0BAA0B,QAAQ,cAAc;AAEzD;;;;;;;CAOC,GACD,OAAO,MAAMC,sBAAsB,CAACC;IAClC,MAAM,CAACC,eAAeC,iBAAiB,GAAGP;IAC1C,MAAMQ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QACzBC,UAAU;QACVC,OAAO;QACPC,cAAc,IAAItE;QAClBuE,QAAQT,MAAMX,aAAa,GAAGW,MAAM3D,aAAa,GAAGc;QACpD,GAAGtB,4BAA4BmE,MAAMU,WAAW,CAAC;IACnD;IAEA,qDAAqD;IACrD,IAAIL,mBAAmBM,WAAW,EAAE;QAClCX,MAAMY,SAAS,GAAG;IACpB;IAEA,IAAIZ,MAAMY,SAAS,EAAE;QACnBP,mBAAmBQ,MAAM,GAAG/E,iBAAiBuE,mBAAmBQ,MAAM,EAAE5E,YAAY,CAAC+D,MAAMxD,IAAI,CAAC;IAClG;IAEA,MAAM,EAAEsE,WAAW/B,UAAU,EAAEgC,cAAc/B,UAAU,EAAEgC,QAAQ,EAAE,GAAGpF,eAAeyE;IAErF,OAAO;QACLtB;QACAC;QACAgC;IACF;AACF"}
|
@@ -53,6 +53,9 @@ const useStyles = /*#__PURE__*/__styles({
|
|
53
53
|
Bks05zx: "f1mzajhk",
|
54
54
|
Bvtglag: "fjp4h9y"
|
55
55
|
},
|
56
|
+
inline: {
|
57
|
+
Bj3rh1h: "f19g0ac"
|
58
|
+
},
|
56
59
|
inverted: {
|
57
60
|
De3pzq: "fg3r6xk",
|
58
61
|
sj55zd: "fonrgv7"
|
@@ -117,7 +120,7 @@ const useStyles = /*#__PURE__*/__styles({
|
|
117
120
|
Bwwlvwl: "fm1ycve"
|
118
121
|
}
|
119
122
|
}, {
|
120
|
-
d: [".f19n0e5{color:var(--colorNeutralForeground1);}", ".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".f1hg901r{box-shadow:var(--shadow16);}", ".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}", ".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}", ".f5ogflp{border-top-width:1px;}", ".f1hqa2wf{border-right-width:1px;}", ".finvdd3{border-left-width:1px;}", ".f1f09k3d{border-bottom-width:1px;}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".fghlq4f{border-top-color:var(--colorTransparentStroke);}", ".f1gn591s{border-right-color:var(--colorTransparentStroke);}", ".fjscplz{border-left-color:var(--colorTransparentStroke);}", ".fb073pr{border-bottom-color:var(--colorTransparentStroke);}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".f18k4bn6{animation-composition:accumulate;}", ".fo1kyvf{animation-duration:var(--durationSlower);}", ".fetxo7e{animation-timing-function:var(--curveDecelerateMid);}", ".fmm77a6{--slide-distance-x:0px;}", ".f12t24nk{--slide-distance-y:10px;}", ".f1babd7[data-popper-placement^=right]{--slide-distance-x:-10px;}", ".f1jgo889[data-popper-placement^=right]{--slide-distance-y:0px;}", ".f1ij1pew[data-popper-placement^=bottom]{--slide-distance-x:0px;}", ".f1gu8pa9[data-popper-placement^=bottom]{--slide-distance-y:-10px;}", ".fhfnl4n[data-popper-placement^=left]{--slide-distance-x:10px;}", ".fk8tkmz[data-popper-placement^=left]{--slide-distance-y:0px;}", ".f3n0535{animation-name:f5j8bii,fld5wjx;}", ".fg3r6xk{background-color:var(--colorNeutralBackgroundStatic);}", ".fonrgv7{color:var(--colorNeutralForegroundStaticInverted);}", ".ffp7eso{background-color:var(--colorBrandBackground);}", ".f1phragk{color:var(--colorNeutralForegroundOnBrand);}", ".f1kcqot9{padding-top:12px;}", ".f11qrl6u{padding-right:12px;}", ".fjlbh76{padding-left:12px;}", ".fpe6lb7{padding-bottom:12px;}", ".fqag9an{padding-top:16px;}", ".f1gbmcue{padding-right:16px;}", ".f1rh9g5y{padding-left:16px;}", ".fp67ikv{padding-bottom:16px;}", ".fc7z3ec{padding-top:20px;}", ".fat0sn4{padding-right:20px;}", ".fekwl8i{padding-left:20px;}", ".fe2my4m{padding-bottom:20px;}", ".f1ekdpwm{width:8.484px;}", ".f83vc9z{height:8.484px;}", ".f1kmc0fn{width:11.312px;}", ".fb6lvc5{height:11.312px;}", ".f1euv43f{position:absolute;}", ".f1u2r49w{background-color:inherit;}", ".fd7fpy0{visibility:hidden;}", ".f1bsuimh{z-index:-1;}", ".f1wl9k8s::before{content:\"\";}", ".f1wkw4r9::before{visibility:visible;}", ".f1j7ml58::before{position:absolute;}", ".fyl8oag::before{box-sizing:border-box;}", ".frdoeuz::before{width:inherit;}", ".fb81m9q::before{height:inherit;}", ".f1ljr5q2::before{background-color:inherit;}", ".fyfemzf::before{border-right-width:1px;}", ".focyt6c::before{border-right-style:solid;}", ".fnhxbxj::before{border-right-color:var(--colorTransparentStroke);}", ".fdw6hkg::before{border-bottom-width:1px;}", ".f11yjt3y::before{border-bottom-style:solid;}", ".f1172wan::before{border-bottom-color:var(--colorTransparentStroke);}", ".f9e5op9::before{border-bottom-right-radius:var(--borderRadiusSmall);}", ".f112wvtl::before{border-bottom-left-radius:var(--borderRadiusSmall);}", ".ftj5xct::before{transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);}", ".fyavhwi::before{transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);}", "[data-popper-placement^=\"top\"] .f1773hnp{bottom:-1px;}", "[data-popper-placement^=\"top\"] .f1n8855c{--angle:0;}", "[data-popper-placement^=\"right\"] .f1v7783n{left:-1px;}", "[data-popper-placement^=\"right\"] .fsw6im5{--angle:90deg;}", "[data-popper-placement^=\"bottom\"] .fh2hsk5{top:-1px;}", "[data-popper-placement^=\"bottom\"] .f159pzir{--angle:180deg;}", "[data-popper-placement^=\"left\"] .f11yvu4{right:-1px;}", "[data-popper-placement^=\"left\"] .fm1ycve{--angle:270deg;}"],
|
123
|
+
d: [".f19n0e5{color:var(--colorNeutralForeground1);}", ".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".f1hg901r{box-shadow:var(--shadow16);}", ".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}", ".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}", ".f5ogflp{border-top-width:1px;}", ".f1hqa2wf{border-right-width:1px;}", ".finvdd3{border-left-width:1px;}", ".f1f09k3d{border-bottom-width:1px;}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".fghlq4f{border-top-color:var(--colorTransparentStroke);}", ".f1gn591s{border-right-color:var(--colorTransparentStroke);}", ".fjscplz{border-left-color:var(--colorTransparentStroke);}", ".fb073pr{border-bottom-color:var(--colorTransparentStroke);}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".f18k4bn6{animation-composition:accumulate;}", ".fo1kyvf{animation-duration:var(--durationSlower);}", ".fetxo7e{animation-timing-function:var(--curveDecelerateMid);}", ".fmm77a6{--slide-distance-x:0px;}", ".f12t24nk{--slide-distance-y:10px;}", ".f1babd7[data-popper-placement^=right]{--slide-distance-x:-10px;}", ".f1jgo889[data-popper-placement^=right]{--slide-distance-y:0px;}", ".f1ij1pew[data-popper-placement^=bottom]{--slide-distance-x:0px;}", ".f1gu8pa9[data-popper-placement^=bottom]{--slide-distance-y:-10px;}", ".fhfnl4n[data-popper-placement^=left]{--slide-distance-x:10px;}", ".fk8tkmz[data-popper-placement^=left]{--slide-distance-y:0px;}", ".f3n0535{animation-name:f5j8bii,fld5wjx;}", ".f19g0ac{z-index:1;}", ".fg3r6xk{background-color:var(--colorNeutralBackgroundStatic);}", ".fonrgv7{color:var(--colorNeutralForegroundStaticInverted);}", ".ffp7eso{background-color:var(--colorBrandBackground);}", ".f1phragk{color:var(--colorNeutralForegroundOnBrand);}", ".f1kcqot9{padding-top:12px;}", ".f11qrl6u{padding-right:12px;}", ".fjlbh76{padding-left:12px;}", ".fpe6lb7{padding-bottom:12px;}", ".fqag9an{padding-top:16px;}", ".f1gbmcue{padding-right:16px;}", ".f1rh9g5y{padding-left:16px;}", ".fp67ikv{padding-bottom:16px;}", ".fc7z3ec{padding-top:20px;}", ".fat0sn4{padding-right:20px;}", ".fekwl8i{padding-left:20px;}", ".fe2my4m{padding-bottom:20px;}", ".f1ekdpwm{width:8.484px;}", ".f83vc9z{height:8.484px;}", ".f1kmc0fn{width:11.312px;}", ".fb6lvc5{height:11.312px;}", ".f1euv43f{position:absolute;}", ".f1u2r49w{background-color:inherit;}", ".fd7fpy0{visibility:hidden;}", ".f1bsuimh{z-index:-1;}", ".f1wl9k8s::before{content:\"\";}", ".f1wkw4r9::before{visibility:visible;}", ".f1j7ml58::before{position:absolute;}", ".fyl8oag::before{box-sizing:border-box;}", ".frdoeuz::before{width:inherit;}", ".fb81m9q::before{height:inherit;}", ".f1ljr5q2::before{background-color:inherit;}", ".fyfemzf::before{border-right-width:1px;}", ".focyt6c::before{border-right-style:solid;}", ".fnhxbxj::before{border-right-color:var(--colorTransparentStroke);}", ".fdw6hkg::before{border-bottom-width:1px;}", ".f11yjt3y::before{border-bottom-style:solid;}", ".f1172wan::before{border-bottom-color:var(--colorTransparentStroke);}", ".f9e5op9::before{border-bottom-right-radius:var(--borderRadiusSmall);}", ".f112wvtl::before{border-bottom-left-radius:var(--borderRadiusSmall);}", ".ftj5xct::before{transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);}", ".fyavhwi::before{transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);}", "[data-popper-placement^=\"top\"] .f1773hnp{bottom:-1px;}", "[data-popper-placement^=\"top\"] .f1n8855c{--angle:0;}", "[data-popper-placement^=\"right\"] .f1v7783n{left:-1px;}", "[data-popper-placement^=\"right\"] .fsw6im5{--angle:90deg;}", "[data-popper-placement^=\"bottom\"] .fh2hsk5{top:-1px;}", "[data-popper-placement^=\"bottom\"] .f159pzir{--angle:180deg;}", "[data-popper-placement^=\"left\"] .f11yvu4{right:-1px;}", "[data-popper-placement^=\"left\"] .fm1ycve{--angle:270deg;}"],
|
121
124
|
k: ["@keyframes f5j8bii{from{opacity:0;}to{opacity:1;}}", "@keyframes fld5wjx{from{transform:translate(var(--slide-distance-x), var(--slide-distance-y));}}"],
|
122
125
|
m: [["@media (prefers-reduced-motion){.fi19xcv[data-popper-placement]{animation-duration:1ms;}}", {
|
123
126
|
m: "(prefers-reduced-motion)"
|
@@ -131,7 +134,7 @@ const useStyles = /*#__PURE__*/__styles({
|
|
131
134
|
*/
|
132
135
|
export const usePopoverSurfaceStyles_unstable = state => {
|
133
136
|
const styles = useStyles();
|
134
|
-
state.root.className = mergeClasses(popoverSurfaceClassNames.root, styles.root, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.appearance === 'inverted' && styles.inverted, state.appearance === 'brand' && styles.brand, state.root.className);
|
137
|
+
state.root.className = mergeClasses(popoverSurfaceClassNames.root, styles.root, state.inline && styles.inline, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.appearance === 'inverted' && styles.inverted, state.appearance === 'brand' && styles.brand, state.root.className);
|
135
138
|
state.arrowClassName = mergeClasses(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);
|
136
139
|
return state;
|
137
140
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["shorthands","__styles","mergeClasses","createArrowHeightStyles","createArrowStyles","createSlideStyles","tokens","typographyStyles","popoverSurfaceClassNames","root","arrowHeights","small","medium","large","useStyles","sj55zd","De3pzq","E5pizo","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","B93otf3","vin17d","Ezkn3b","ex8oj8","Bksk4gw","Bc5phfd","cbiifc","fyiq5g","Bqc19t1","Eet2gb","Bhl7k63","Bv12yb3","z0t1cu","Bks05zx","Bvtglag","inverted","brand","smallPadding","z8tnut","z189sj","Byoj8tv","uwmqm3","mediumPadding","largePadding","smallArrow","a9b677","Bqenvij","mediumLargeArrow","arrow","qhf8xq","Bcdw1i0","
|
1
|
+
{"version":3,"names":["shorthands","__styles","mergeClasses","createArrowHeightStyles","createArrowStyles","createSlideStyles","tokens","typographyStyles","popoverSurfaceClassNames","root","arrowHeights","small","medium","large","useStyles","sj55zd","De3pzq","E5pizo","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","B93otf3","vin17d","Ezkn3b","ex8oj8","Bksk4gw","Bc5phfd","cbiifc","fyiq5g","Bqc19t1","Eet2gb","Bhl7k63","Bv12yb3","z0t1cu","Bks05zx","Bvtglag","inline","Bj3rh1h","inverted","brand","smallPadding","z8tnut","z189sj","Byoj8tv","uwmqm3","mediumPadding","largePadding","smallArrow","a9b677","Bqenvij","mediumLargeArrow","arrow","qhf8xq","Bcdw1i0","Ftih45","B1puzpu","Brfgrao","Bcvre1j","Ccq8qp","Baz25je","cmx5o7","B4f6apu","m598lv","Bk5zm6e","y0oebl","qa3bma","Bqjgrrk","Budzafs","Hv9wc6","hl6cv3","Bh2vraf","yayu3t","wedwtw","rhl9o9","Bu8t5uz","B6q6orb","Bwwlvwl","d","k","m","t","usePopoverSurfaceStyles_unstable","state","styles","className","size","appearance","arrowClassName"],"sources":["usePopoverSurfaceStyles.styles.js"],"sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { createArrowHeightStyles, createArrowStyles, createSlideStyles } from '@fluentui/react-positioning';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nexport const popoverSurfaceClassNames = {\n root: 'fui-PopoverSurface'\n};\nexport const arrowHeights = {\n small: 6,\n medium: 8,\n large: 8\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForeground1,\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow16,\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n ...typographyStyles.body1,\n ...createSlideStyles(10)\n },\n inline: {\n // When rendering inline, the PopoverSurface will be rendered under relatively positioned elements such as Input.\n // This is due to the surface being positioned as absolute, therefore zIndex: 1 ensures that won't happen.\n zIndex: 1\n },\n inverted: {\n backgroundColor: tokens.colorNeutralBackgroundStatic,\n color: tokens.colorNeutralForegroundStaticInverted\n },\n brand: {\n backgroundColor: tokens.colorBrandBackground,\n color: tokens.colorNeutralForegroundOnBrand\n },\n smallPadding: {\n ...shorthands.padding('12px')\n },\n mediumPadding: {\n ...shorthands.padding('16px')\n },\n largePadding: {\n ...shorthands.padding('20px')\n },\n smallArrow: createArrowHeightStyles(arrowHeights.small),\n mediumLargeArrow: createArrowHeightStyles(arrowHeights.medium),\n arrow: createArrowStyles({\n arrowHeight: undefined\n })\n});\n/**\n * Apply styling to the PopoverSurface slots based on the state\n */ export const usePopoverSurfaceStyles_unstable = (state)=>{\n const styles = useStyles();\n state.root.className = mergeClasses(popoverSurfaceClassNames.root, styles.root, state.inline && styles.inline, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.appearance === 'inverted' && styles.inverted, state.appearance === 'brand' && styles.brand, state.root.className);\n state.arrowClassName = mergeClasses(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);\n return state;\n};\n"],"mappings":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KAAK,EAAE2C,KAAK,CAAC1F,IAAI,CAAC4F,SAAS,CAAC;EACrXF,KAAK,CAACK,cAAc,GAAGtG,YAAY,CAACkG,MAAM,CAAChC,KAAK,EAAE+B,KAAK,CAACG,IAAI,KAAK,OAAO,GAAGF,MAAM,CAACpC,UAAU,GAAGoC,MAAM,CAACjC,gBAAgB,CAAC;EACvH,OAAOgC,KAAK;AAChB,CAAC"}
|
@@ -33,11 +33,11 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
33
33
|
}
|
34
34
|
};
|
35
35
|
const onKeyDown = (e)=>{
|
36
|
-
if (e.key === Escape && open) {
|
36
|
+
if (e.key === Escape && open && !e.isDefaultPrevented()) {
|
37
37
|
setOpen(e, false);
|
38
38
|
// stop propagation to avoid conflicting with other elements that listen for `Escape`
|
39
|
-
// e,g: Dialog, Menu
|
40
|
-
e.
|
39
|
+
// e,g: Dialog, Popover, Menu and Tooltip
|
40
|
+
e.preventDefault();
|
41
41
|
}
|
42
42
|
};
|
43
43
|
const onMouseEnter = (e)=>{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["usePopoverTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n applyTriggerPropsToChildren,\n getTriggerChild,\n mergeCallbacks,\n useMergedRefs,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport type { PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.types';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport { Escape } from '@fluentui/keyboard-keys';\n\n/**\n * Create the state required to render PopoverTrigger.\n *\n * The returned state can be modified with hooks such as usePopoverTriggerStyles,\n * before being passed to renderPopoverTrigger_unstable.\n *\n * @param props - props from this instance of PopoverTrigger\n */\nexport const usePopoverTrigger_unstable = (props: PopoverTriggerProps): PopoverTriggerState => {\n const { children, disableButtonEnhancement = false } = props;\n const child = getTriggerChild(children);\n\n const open = usePopoverContext_unstable(context => context.open);\n const setOpen = usePopoverContext_unstable(context => context.setOpen);\n const toggleOpen = usePopoverContext_unstable(context => context.toggleOpen);\n const triggerRef = usePopoverContext_unstable(context => context.triggerRef);\n const openOnHover = usePopoverContext_unstable(context => context.openOnHover);\n const openOnContext = usePopoverContext_unstable(context => context.openOnContext);\n const { triggerAttributes } = useModalAttributes();\n\n const onContextMenu = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnContext) {\n e.preventDefault();\n setOpen(e, true);\n }\n };\n\n const onClick = (e: React.MouseEvent<HTMLElement>) => {\n if (!openOnContext) {\n toggleOpen(e);\n }\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === Escape && open) {\n setOpen(e, false);\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Menu\n e.
|
1
|
+
{"version":3,"sources":["usePopoverTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n applyTriggerPropsToChildren,\n getTriggerChild,\n mergeCallbacks,\n useMergedRefs,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport type { PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.types';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport { Escape } from '@fluentui/keyboard-keys';\n\n/**\n * Create the state required to render PopoverTrigger.\n *\n * The returned state can be modified with hooks such as usePopoverTriggerStyles,\n * before being passed to renderPopoverTrigger_unstable.\n *\n * @param props - props from this instance of PopoverTrigger\n */\nexport const usePopoverTrigger_unstable = (props: PopoverTriggerProps): PopoverTriggerState => {\n const { children, disableButtonEnhancement = false } = props;\n const child = getTriggerChild(children);\n\n const open = usePopoverContext_unstable(context => context.open);\n const setOpen = usePopoverContext_unstable(context => context.setOpen);\n const toggleOpen = usePopoverContext_unstable(context => context.toggleOpen);\n const triggerRef = usePopoverContext_unstable(context => context.triggerRef);\n const openOnHover = usePopoverContext_unstable(context => context.openOnHover);\n const openOnContext = usePopoverContext_unstable(context => context.openOnContext);\n const { triggerAttributes } = useModalAttributes();\n\n const onContextMenu = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnContext) {\n e.preventDefault();\n setOpen(e, true);\n }\n };\n\n const onClick = (e: React.MouseEvent<HTMLElement>) => {\n if (!openOnContext) {\n toggleOpen(e);\n }\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === Escape && open && !e.isDefaultPrevented()) {\n setOpen(e, false);\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Popover, Menu and Tooltip\n e.preventDefault();\n }\n };\n\n const onMouseEnter = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, true);\n }\n };\n\n const onMouseLeave = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, false);\n }\n };\n\n const contextMenuProps = {\n ...triggerAttributes,\n 'aria-expanded': `${open}`,\n ...child?.props,\n onMouseEnter: useEventCallback(mergeCallbacks(child?.props.onMouseEnter, onMouseEnter)),\n onMouseLeave: useEventCallback(mergeCallbacks(child?.props.onMouseLeave, onMouseLeave)),\n onContextMenu: useEventCallback(mergeCallbacks(child?.props.onContextMenu, onContextMenu)),\n ref: useMergedRefs(triggerRef, child?.ref),\n } as const;\n\n const triggerChildProps = {\n ...contextMenuProps,\n onClick: useEventCallback(mergeCallbacks(child?.props.onClick, onClick)),\n onKeyDown: useEventCallback(mergeCallbacks(child?.props.onKeyDown, onKeyDown)),\n };\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n triggerChildProps,\n );\n\n return {\n children: applyTriggerPropsToChildren(\n props.children,\n useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n ),\n };\n};\n"],"names":["React","applyTriggerPropsToChildren","getTriggerChild","mergeCallbacks","useMergedRefs","useEventCallback","useModalAttributes","usePopoverContext_unstable","useARIAButtonProps","Escape","usePopoverTrigger_unstable","props","children","disableButtonEnhancement","child","open","context","setOpen","toggleOpen","triggerRef","openOnHover","openOnContext","triggerAttributes","onContextMenu","e","preventDefault","onClick","onKeyDown","key","isDefaultPrevented","onMouseEnter","onMouseLeave","contextMenuProps","ref","triggerChildProps","ariaButtonTriggerChildProps","type"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,2BAA2B,EAC3BC,eAAe,EACfC,cAAc,EACdC,aAAa,EACbC,gBAAgB,QACX,4BAA4B;AACnC,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,0BAA0B,QAAQ,uBAAuB;AAElE,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,MAAM,QAAQ,0BAA0B;AAEjD;;;;;;;CAOC,GACD,OAAO,MAAMC,6BAA6B,CAACC;IACzC,MAAM,EAAEC,QAAQ,EAAEC,2BAA2B,KAAK,EAAE,GAAGF;IACvD,MAAMG,QAAQZ,gBAAgBU;IAE9B,MAAMG,OAAOR,2BAA2BS,CAAAA,UAAWA,QAAQD,IAAI;IAC/D,MAAME,UAAUV,2BAA2BS,CAAAA,UAAWA,QAAQC,OAAO;IACrE,MAAMC,aAAaX,2BAA2BS,CAAAA,UAAWA,QAAQE,UAAU;IAC3E,MAAMC,aAAaZ,2BAA2BS,CAAAA,UAAWA,QAAQG,UAAU;IAC3E,MAAMC,cAAcb,2BAA2BS,CAAAA,UAAWA,QAAQI,WAAW;IAC7E,MAAMC,gBAAgBd,2BAA2BS,CAAAA,UAAWA,QAAQK,aAAa;IACjF,MAAM,EAAEC,iBAAiB,EAAE,GAAGhB;IAE9B,MAAMiB,gBAAgB,CAACC;QACrB,IAAIH,eAAe;YACjBG,EAAEC,cAAc;YAChBR,QAAQO,GAAG;QACb;IACF;IAEA,MA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LtB,UAAUX,4BACRU,MAAMC,QAAQ,EACdJ,mBACEM,CAAAA,kBAAAA,4BAAAA,MAAOsB,IAAI,MAAK,YAAYtB,CAAAA,kBAAAA,4BAAAA,MAAOsB,IAAI,MAAK,MAAMtB,MAAMsB,IAAI,GAAG,OAC/Df,gBAAgBW,mBAAmBnB,2BAA2BqB,oBAAoBC;IAGxF;AACF,EAAE"}
|
@@ -13,7 +13,6 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
13
|
const _reactutilities = require("@fluentui/react-utilities");
|
14
14
|
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
15
15
|
const _reactpositioning = require("@fluentui/react-positioning");
|
16
|
-
const _reactportal = require("@fluentui/react-portal");
|
17
16
|
const _reacttabster = require("@fluentui/react-tabster");
|
18
17
|
const _index = require("../PopoverSurface/index");
|
19
18
|
const _constants = require("./constants");
|
@@ -81,7 +80,7 @@ const usePopover_unstable = (props)=>{
|
|
81
80
|
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
82
81
|
var _props_closeOnIframeFocus;
|
83
82
|
(0, _reactutilities.useOnClickOutside)({
|
84
|
-
contains:
|
83
|
+
contains: _reactutilities.elementContains,
|
85
84
|
element: targetDocument,
|
86
85
|
callback: (ev)=>setOpen(ev, false),
|
87
86
|
refs: [
|
@@ -94,7 +93,7 @@ const usePopover_unstable = (props)=>{
|
|
94
93
|
// only close on scroll for context, or when closeOnScroll is specified
|
95
94
|
const closeOnScroll = initialState.openOnContext || initialState.closeOnScroll;
|
96
95
|
(0, _reactutilities.useOnScrollOutside)({
|
97
|
-
contains:
|
96
|
+
contains: _reactutilities.elementContains,
|
98
97
|
element: targetDocument,
|
99
98
|
callback: (ev)=>setOpen(ev, false),
|
100
99
|
refs: [
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["usePopover.js"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { usePositioning, resolvePositioningShorthand, mergeArrowOffset, usePositioningMouseTarget } from '@fluentui/react-positioning';\nimport { elementContains } from '@fluentui/react-portal';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { arrowHeights } from '../PopoverSurface/index';\nimport { popoverSurfaceBorderRadius } from './constants';\n/**\n * Create the state required to render Popover.\n *\n * The returned state can be modified with hooks such as usePopoverStyles,\n * before being passed to renderPopover_unstable.\n *\n * @param props - props from this instance of Popover\n */ export const usePopover_unstable = (props)=>{\n const [contextTarget, setContextTarget] = usePositioningMouseTarget();\n const initialState = {\n size: 'medium',\n contextTarget,\n setContextTarget,\n ...props\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('Popover must contain at least one child');\n }\n if (children.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('Popover must contain at most two children');\n }\n }\n let popoverTrigger = undefined;\n let popoverSurface = undefined;\n if (children.length === 2) {\n popoverTrigger = children[0];\n popoverSurface = children[1];\n } else if (children.length === 1) {\n popoverSurface = children[0];\n }\n const [open, setOpenState] = useOpenState(initialState);\n const setOpenTimeoutRef = React.useRef(0);\n const setOpen = useEventCallback((e, shouldOpen)=>{\n clearTimeout(setOpenTimeoutRef.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') {\n var _props_mouseLeaveDelay;\n // FIXME leaking Node timeout type\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n setOpenTimeoutRef.current = setTimeout(()=>{\n setOpenState(e, shouldOpen);\n }, (_props_mouseLeaveDelay = props.mouseLeaveDelay) !== null && _props_mouseLeaveDelay !== void 0 ? _props_mouseLeaveDelay : 500);\n } else {\n setOpenState(e, shouldOpen);\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(setOpenTimeoutRef.current);\n };\n }, []);\n const toggleOpen = React.useCallback((e)=>{\n setOpen(e, !open);\n }, [\n setOpen,\n open\n ]);\n const positioningRefs = usePopoverRefs(initialState);\n const { targetDocument } = useFluent();\n var _props_closeOnIframeFocus;\n useOnClickOutside({\n contains: elementContains,\n element: targetDocument,\n callback: (ev)=>setOpen(ev, false),\n refs: [\n positioningRefs.triggerRef,\n positioningRefs.contentRef\n ],\n disabled: !open,\n disabledFocusOnIframe: !((_props_closeOnIframeFocus = props.closeOnIframeFocus) !== null && _props_closeOnIframeFocus !== void 0 ? _props_closeOnIframeFocus : true)\n });\n // only close on scroll for context, or when closeOnScroll is specified\n const closeOnScroll = initialState.openOnContext || initialState.closeOnScroll;\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: (ev)=>setOpen(ev, false),\n refs: [\n positioningRefs.triggerRef,\n positioningRefs.contentRef\n ],\n disabled: !open || !closeOnScroll\n });\n const { findFirstFocusable } = useFocusFinders();\n React.useEffect(()=>{\n if (props.unstable_disableAutoFocus) {\n return;\n }\n if (open && positioningRefs.contentRef.current) {\n var _positioningRefs_contentRef_current_getAttribute;\n const containerTabIndex = (_positioningRefs_contentRef_current_getAttribute = positioningRefs.contentRef.current.getAttribute('tabIndex')) !== null && _positioningRefs_contentRef_current_getAttribute !== void 0 ? _positioningRefs_contentRef_current_getAttribute : undefined;\n const firstFocusable = isNaN(containerTabIndex) ? findFirstFocusable(positioningRefs.contentRef.current) : positioningRefs.contentRef.current;\n firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();\n }\n }, [\n findFirstFocusable,\n open,\n positioningRefs.contentRef,\n props.unstable_disableAutoFocus\n ]);\n var _props_inertTrapFocus, _props_inline;\n return {\n ...initialState,\n ...positioningRefs,\n // eslint-disable-next-line deprecation/deprecation\n inertTrapFocus: (_props_inertTrapFocus = props.inertTrapFocus) !== null && _props_inertTrapFocus !== void 0 ? _props_inertTrapFocus : props.legacyTrapFocus === undefined ? false : !props.legacyTrapFocus,\n popoverTrigger,\n popoverSurface,\n open,\n setOpen,\n toggleOpen,\n setContextTarget,\n contextTarget,\n inline: (_props_inline = props.inline) !== null && _props_inline !== void 0 ? _props_inline : false\n };\n};\n/**\n * Creates and manages the Popover open state\n */ function useOpenState(state) {\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 [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false\n });\n state.open = open !== undefined ? open : state.open;\n const setContextTarget = state.setContextTarget;\n const setOpen = React.useCallback((e, shouldOpen)=>{\n if (shouldOpen && e.type === 'contextmenu') {\n setContextTarget(e);\n }\n if (!shouldOpen) {\n setContextTarget(undefined);\n }\n setOpenState(shouldOpen);\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(e, {\n open: shouldOpen\n });\n }, [\n setOpenState,\n onOpenChange,\n setContextTarget\n ]);\n return [\n open,\n setOpen\n ];\n}\n/**\n * Creates and sets the necessary trigger, target and content refs used by Popover\n */ function usePopoverRefs(state) {\n const positioningOptions = {\n position: 'above',\n align: 'center',\n arrowPadding: 2 * popoverSurfaceBorderRadius,\n target: state.openOnContext ? state.contextTarget : undefined,\n ...resolvePositioningShorthand(state.positioning)\n };\n // no reason to render arrow when covering the target\n if (positioningOptions.coverTarget) {\n state.withArrow = false;\n }\n if (state.withArrow) {\n positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeights[state.size]);\n }\n const { targetRef: triggerRef, containerRef: contentRef, arrowRef } = usePositioning(positioningOptions);\n return {\n triggerRef,\n contentRef,\n arrowRef\n };\n}\n"],"names":["usePopover_unstable","props","contextTarget","setContextTarget","usePositioningMouseTarget","initialState","size","children","React","Children","toArray","process","env","NODE_ENV","length","console","warn","popoverTrigger","undefined","popoverSurface","open","setOpenState","useOpenState","setOpenTimeoutRef","useRef","setOpen","useEventCallback","e","shouldOpen","clearTimeout","current","Event","persist","type","_props_mouseLeaveDelay","setTimeout","mouseLeaveDelay","useEffect","toggleOpen","useCallback","positioningRefs","usePopoverRefs","targetDocument","useFluent","_props_closeOnIframeFocus","useOnClickOutside","contains","elementContains","element","callback","ev","refs","triggerRef","contentRef","disabled","disabledFocusOnIframe","closeOnIframeFocus","closeOnScroll","openOnContext","useOnScrollOutside","findFirstFocusable","useFocusFinders","unstable_disableAutoFocus","_positioningRefs_contentRef_current_getAttribute","containerTabIndex","getAttribute","firstFocusable","isNaN","focus","_props_inertTrapFocus","_props_inline","inertTrapFocus","legacyTrapFocus","inline","state","onOpenChange","data","_state_onOpenChange","call","useControllableState","defaultState","defaultOpen","positioningOptions","position","align","arrowPadding","popoverSurfaceBorderRadius","target","resolvePositioningShorthand","positioning","coverTarget","withArrow","offset","mergeArrowOffset","arrowHeights","targetRef","containerRef","arrowRef","usePositioning"],"mappings":";;;;+BAeiBA;;;eAAAA;;;;iEAfM;gCACuE;qCAC9C;kCACyD;6BACzE;8BACA;uBACH;2BACc;AAQhC,MAAMA,sBAAsB,CAACC;IACpC,MAAM,CAACC,eAAeC,iBAAiB,GAAGC,IAAAA,2CAAyB;IACnE,MAAMC,eAAe;QACjBC,MAAM;QACNJ;QACAC;QACA,GAAGF,KAAK;IACZ;IACA,MAAMM,WAAWC,OAAMC,QAAQ,CAACC,OAAO,CAACT,MAAMM,QAAQ;IACtD,IAAII,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACvC,IAAIN,SAASO,MAAM,KAAK,GAAG;YACvB,sCAAsC;YACtCC,QAAQC,IAAI,CAAC;QACjB;QACA,IAAIT,SAASO,MAAM,GAAG,GAAG;YACrB,sCAAsC;YACtCC,QAAQC,IAAI,CAAC;QACjB;IACJ;IACA,IAAIC,iBAAiBC;IACrB,IAAIC,iBAAiBD;IACrB,IAAIX,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AAc,IAAIC,qCAA0B;QAC5CC,QAAQb,MAAMhB,aAAa,GAAGgB,MAAMxE,aAAa,GAAGgB;QACpD,GAAGsE,IAAAA,6CAA2B,EAACd,MAAMe,WAAW,CAAC;IACrD;IACA,qDAAqD;IACrD,IAAIP,mBAAmBQ,WAAW,EAAE;QAChChB,MAAMiB,SAAS,GAAG;IACtB;IACA,IAAIjB,MAAMiB,SAAS,EAAE;QACjBT,mBAAmBU,MAAM,GAAGC,IAAAA,kCAAgB,EAACX,mBAAmBU,MAAM,EAAEE,mBAAY,CAACpB,MAAMpE,IAAI,CAAC;IACpG;IACA,MAAM,EAAEyF,WAAW3C,UAAU,EAAE4C,cAAc3C,UAAU,EAAE4C,QAAQ,EAAE,GAAGC,IAAAA,gCAAc,EAAChB;IACrF,OAAO;QACH9B;QACAC;QACA4C;IACJ;AACJ"}
|
1
|
+
{"version":3,"sources":["usePopover.js"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside, elementContains } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { usePositioning, resolvePositioningShorthand, mergeArrowOffset, usePositioningMouseTarget } from '@fluentui/react-positioning';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { arrowHeights } from '../PopoverSurface/index';\nimport { popoverSurfaceBorderRadius } from './constants';\n/**\n * Create the state required to render Popover.\n *\n * The returned state can be modified with hooks such as usePopoverStyles,\n * before being passed to renderPopover_unstable.\n *\n * @param props - props from this instance of Popover\n */ export const usePopover_unstable = (props)=>{\n const [contextTarget, setContextTarget] = usePositioningMouseTarget();\n const initialState = {\n size: 'medium',\n contextTarget,\n setContextTarget,\n ...props\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('Popover must contain at least one child');\n }\n if (children.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('Popover must contain at most two children');\n }\n }\n let popoverTrigger = undefined;\n let popoverSurface = undefined;\n if (children.length === 2) {\n popoverTrigger = children[0];\n popoverSurface = children[1];\n } else if (children.length === 1) {\n popoverSurface = children[0];\n }\n const [open, setOpenState] = useOpenState(initialState);\n const setOpenTimeoutRef = React.useRef(0);\n const setOpen = useEventCallback((e, shouldOpen)=>{\n clearTimeout(setOpenTimeoutRef.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') {\n var _props_mouseLeaveDelay;\n // FIXME leaking Node timeout type\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n setOpenTimeoutRef.current = setTimeout(()=>{\n setOpenState(e, shouldOpen);\n }, (_props_mouseLeaveDelay = props.mouseLeaveDelay) !== null && _props_mouseLeaveDelay !== void 0 ? _props_mouseLeaveDelay : 500);\n } else {\n setOpenState(e, shouldOpen);\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(setOpenTimeoutRef.current);\n };\n }, []);\n const toggleOpen = React.useCallback((e)=>{\n setOpen(e, !open);\n }, [\n setOpen,\n open\n ]);\n const positioningRefs = usePopoverRefs(initialState);\n const { targetDocument } = useFluent();\n var _props_closeOnIframeFocus;\n useOnClickOutside({\n contains: elementContains,\n element: targetDocument,\n callback: (ev)=>setOpen(ev, false),\n refs: [\n positioningRefs.triggerRef,\n positioningRefs.contentRef\n ],\n disabled: !open,\n disabledFocusOnIframe: !((_props_closeOnIframeFocus = props.closeOnIframeFocus) !== null && _props_closeOnIframeFocus !== void 0 ? _props_closeOnIframeFocus : true)\n });\n // only close on scroll for context, or when closeOnScroll is specified\n const closeOnScroll = initialState.openOnContext || initialState.closeOnScroll;\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: (ev)=>setOpen(ev, false),\n refs: [\n positioningRefs.triggerRef,\n positioningRefs.contentRef\n ],\n disabled: !open || !closeOnScroll\n });\n const { findFirstFocusable } = useFocusFinders();\n React.useEffect(()=>{\n if (props.unstable_disableAutoFocus) {\n return;\n }\n if (open && positioningRefs.contentRef.current) {\n var _positioningRefs_contentRef_current_getAttribute;\n const containerTabIndex = (_positioningRefs_contentRef_current_getAttribute = positioningRefs.contentRef.current.getAttribute('tabIndex')) !== null && _positioningRefs_contentRef_current_getAttribute !== void 0 ? _positioningRefs_contentRef_current_getAttribute : undefined;\n const firstFocusable = isNaN(containerTabIndex) ? findFirstFocusable(positioningRefs.contentRef.current) : positioningRefs.contentRef.current;\n firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();\n }\n }, [\n findFirstFocusable,\n open,\n positioningRefs.contentRef,\n props.unstable_disableAutoFocus\n ]);\n var _props_inertTrapFocus, _props_inline;\n return {\n ...initialState,\n ...positioningRefs,\n // eslint-disable-next-line deprecation/deprecation\n inertTrapFocus: (_props_inertTrapFocus = props.inertTrapFocus) !== null && _props_inertTrapFocus !== void 0 ? _props_inertTrapFocus : props.legacyTrapFocus === undefined ? false : !props.legacyTrapFocus,\n popoverTrigger,\n popoverSurface,\n open,\n setOpen,\n toggleOpen,\n setContextTarget,\n contextTarget,\n inline: (_props_inline = props.inline) !== null && _props_inline !== void 0 ? _props_inline : false\n };\n};\n/**\n * Creates and manages the Popover open state\n */ function useOpenState(state) {\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 [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false\n });\n state.open = open !== undefined ? open : state.open;\n const setContextTarget = state.setContextTarget;\n const setOpen = React.useCallback((e, shouldOpen)=>{\n if (shouldOpen && e.type === 'contextmenu') {\n setContextTarget(e);\n }\n if (!shouldOpen) {\n setContextTarget(undefined);\n }\n setOpenState(shouldOpen);\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(e, {\n open: shouldOpen\n });\n }, [\n setOpenState,\n onOpenChange,\n setContextTarget\n ]);\n return [\n open,\n setOpen\n ];\n}\n/**\n * Creates and sets the necessary trigger, target and content refs used by Popover\n */ function usePopoverRefs(state) {\n const positioningOptions = {\n position: 'above',\n align: 'center',\n arrowPadding: 2 * popoverSurfaceBorderRadius,\n target: state.openOnContext ? state.contextTarget : undefined,\n ...resolvePositioningShorthand(state.positioning)\n };\n // no reason to render arrow when covering the target\n if (positioningOptions.coverTarget) {\n state.withArrow = false;\n }\n if (state.withArrow) {\n positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeights[state.size]);\n }\n const { targetRef: triggerRef, containerRef: contentRef, arrowRef } = usePositioning(positioningOptions);\n return {\n triggerRef,\n contentRef,\n arrowRef\n };\n}\n"],"names":["usePopover_unstable","props","contextTarget","setContextTarget","usePositioningMouseTarget","initialState","size","children","React","Children","toArray","process","env","NODE_ENV","length","console","warn","popoverTrigger","undefined","popoverSurface","open","setOpenState","useOpenState","setOpenTimeoutRef","useRef","setOpen","useEventCallback","e","shouldOpen","clearTimeout","current","Event","persist","type","_props_mouseLeaveDelay","setTimeout","mouseLeaveDelay","useEffect","toggleOpen","useCallback","positioningRefs","usePopoverRefs","targetDocument","useFluent","_props_closeOnIframeFocus","useOnClickOutside","contains","elementContains","element","callback","ev","refs","triggerRef","contentRef","disabled","disabledFocusOnIframe","closeOnIframeFocus","closeOnScroll","openOnContext","useOnScrollOutside","findFirstFocusable","useFocusFinders","unstable_disableAutoFocus","_positioningRefs_contentRef_current_getAttribute","containerTabIndex","getAttribute","firstFocusable","isNaN","focus","_props_inertTrapFocus","_props_inline","inertTrapFocus","legacyTrapFocus","inline","state","onOpenChange","data","_state_onOpenChange","call","useControllableState","defaultState","defaultOpen","positioningOptions","position","align","arrowPadding","popoverSurfaceBorderRadius","target","resolvePositioningShorthand","positioning","coverTarget","withArrow","offset","mergeArrowOffset","arrowHeights","targetRef","contain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
103
103
|
},
|
104
|
+
inline: {
|
105
|
+
Bj3rh1h: "f19g0ac"
|
106
|
+
},
|
104
107
|
inverted: {
|
105
108
|
De3pzq: "fg3r6xk",
|
106
109
|
sj55zd: "fonrgv7"
|
@@ -225,6 +228,7 @@ const arrowHeights = {
|
|
225
228
|
".fhfnl4n[data-popper-placement^=left]{--slide-distance-x:10px;}",
|
226
229
|
".fk8tkmz[data-popper-placement^=left]{--slide-distance-y:0px;}",
|
227
230
|
".f3n0535{animation-name:f5j8bii,fld5wjx;}",
|
231
|
+
".f19g0ac{z-index:1;}",
|
228
232
|
".fg3r6xk{background-color:var(--colorNeutralBackgroundStatic);}",
|
229
233
|
".fonrgv7{color:var(--colorNeutralForegroundStaticInverted);}",
|
230
234
|
".ffp7eso{background-color:var(--colorBrandBackground);}",
|
@@ -299,7 +303,7 @@ const arrowHeights = {
|
|
299
303
|
});
|
300
304
|
const usePopoverSurfaceStyles_unstable = (state)=>{
|
301
305
|
const styles = useStyles();
|
302
|
-
state.root.className = (0, _react.mergeClasses)(popoverSurfaceClassNames.root, styles.root, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.appearance === 'inverted' && styles.inverted, state.appearance === 'brand' && styles.brand, state.root.className);
|
306
|
+
state.root.className = (0, _react.mergeClasses)(popoverSurfaceClassNames.root, styles.root, state.inline && styles.inline, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.appearance === 'inverted' && styles.inverted, state.appearance === 'brand' && styles.brand, state.root.className);
|
303
307
|
state.arrowClassName = (0, _react.mergeClasses)(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);
|
304
308
|
return state;
|
305
309
|
}; //# sourceMappingURL=usePopoverSurfaceStyles.styles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["usePopoverSurfaceStyles.styles.js"],"sourcesContent":["import { shorthands, __styles, mergeClasses } from '@griffel/react';\nimport { createArrowHeightStyles, createArrowStyles, createSlideStyles } from '@fluentui/react-positioning';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nexport const popoverSurfaceClassNames = {\n root: 'fui-PopoverSurface'\n};\nexport const arrowHeights = {\n small: 6,\n medium: 8,\n large: 8\n};\n/**\n * Styles for the root slot\n */\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n sj55zd: \"f19n0e5\",\n De3pzq: \"fxugw4r\",\n E5pizo: \"f1hg901r\",\n Bbmb7ep: [\"f1aa9q02\", \"f16jpd5f\"],\n Beyfa6y: [\"f16jpd5f\", \"f1aa9q02\"],\n B7oj6ja: [\"f1jar5jt\", \"fyu767a\"],\n Btl43ni: [\"fyu767a\", \"f1jar5jt\"],\n B4j52fo: \"f5ogflp\",\n Bekrc4i: [\"f1hqa2wf\", \"finvdd3\"],\n Bn0qgzm: \"f1f09k3d\",\n ibv6hh: [\"finvdd3\", \"f1hqa2wf\"],\n icvyot: \"fzkkow9\",\n vrafjx: [\"fcdblym\", \"fjik90z\"],\n oivjwe: \"fg706s2\",\n wvpqe5: [\"fjik90z\", \"fcdblym\"],\n g2u3we: \"fghlq4f\",\n h3c5rm: [\"f1gn591s\", \"fjscplz\"],\n B9xav0g: \"fb073pr\",\n zhjwy3: [\"fjscplz\", \"f1gn591s\"],\n Bahqtrf: \"fk6fouc\",\n Be2twd7: \"fkhj508\",\n Bhrd7zp: \"figsok6\",\n Bg96gwp: \"f1i3iumi\",\n B93otf3: \"f18k4bn6\",\n vin17d: \"fo1kyvf\",\n Ezkn3b: \"fetxo7e\",\n ex8oj8: \"fmm77a6\",\n Bksk4gw: \"f12t24nk\",\n Bc5phfd: \"f1babd7\",\n cbiifc: \"f1jgo889\",\n fyiq5g: \"f1ij1pew\",\n Bqc19t1: \"f1gu8pa9\",\n Eet2gb: \"fhfnl4n\",\n Bhl7k63: \"fk8tkmz\",\n Bv12yb3: \"f3n0535\",\n z0t1cu: \"fi19xcv\",\n Bks05zx: \"f1mzajhk\",\n Bvtglag: \"fjp4h9y\"\n },\n inverted: {\n De3pzq: \"fg3r6xk\",\n sj55zd: \"fonrgv7\"\n },\n brand: {\n De3pzq: \"ffp7eso\",\n sj55zd: \"f1phragk\"\n },\n smallPadding: {\n z8tnut: \"f1kcqot9\",\n z189sj: [\"f11qrl6u\", \"fjlbh76\"],\n Byoj8tv: \"fpe6lb7\",\n uwmqm3: [\"fjlbh76\", \"f11qrl6u\"]\n },\n mediumPadding: {\n z8tnut: \"fqag9an\",\n z189sj: [\"f1gbmcue\", \"f1rh9g5y\"],\n Byoj8tv: \"fp67ikv\",\n uwmqm3: [\"f1rh9g5y\", \"f1gbmcue\"]\n },\n largePadding: {\n z8tnut: \"fc7z3ec\",\n z189sj: [\"fat0sn4\", \"fekwl8i\"],\n Byoj8tv: \"fe2my4m\",\n uwmqm3: [\"fekwl8i\", \"fat0sn4\"]\n },\n smallArrow: {\n a9b677: \"f1ekdpwm\",\n Bqenvij: \"f83vc9z\"\n },\n mediumLargeArrow: {\n a9b677: \"f1kmc0fn\",\n Bqenvij: \"fb6lvc5\"\n },\n arrow: {\n qhf8xq: \"f1euv43f\",\n De3pzq: \"f1u2r49w\",\n Bcdw1i0: \"fd7fpy0\",\n Bj3rh1h: \"f1bsuimh\",\n Ftih45: \"f1wl9k8s\",\n B1puzpu: \"f1wkw4r9\",\n Brfgrao: \"f1j7ml58\",\n Bcvre1j: \"fyl8oag\",\n Ccq8qp: \"frdoeuz\",\n Baz25je: \"fb81m9q\",\n cmx5o7: \"f1ljr5q2\",\n B4f6apu: \"fyfemzf\",\n m598lv: \"focyt6c\",\n Bk5zm6e: \"fnhxbxj\",\n y0oebl: \"fdw6hkg\",\n qa3bma: \"f11yjt3y\",\n Bqjgrrk: \"f1172wan\",\n Budzafs: [\"f9e5op9\", \"f112wvtl\"],\n Hv9wc6: [\"ftj5xct\", \"fyavhwi\"],\n hl6cv3: \"f1773hnp\",\n Bh2vraf: \"f1n8855c\",\n yayu3t: \"f1v7783n\",\n wedwtw: \"fsw6im5\",\n rhl9o9: \"fh2hsk5\",\n Bu8t5uz: \"f159pzir\",\n B6q6orb: \"f11yvu4\",\n Bwwlvwl: \"fm1ycve\"\n }\n}, {\n d: [\".f19n0e5{color:var(--colorNeutralForeground1);}\", \".fxugw4r{background-color:var(--colorNeutralBackground1);}\", \".f1hg901r{box-shadow:var(--shadow16);}\", \".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}\", \".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}\", \".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}\", \".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}\", \".f5ogflp{border-top-width:1px;}\", \".f1hqa2wf{border-right-width:1px;}\", \".finvdd3{border-left-width:1px;}\", \".f1f09k3d{border-bottom-width:1px;}\", \".fzkkow9{border-top-style:solid;}\", \".fcdblym{border-right-style:solid;}\", \".fjik90z{border-left-style:solid;}\", \".fg706s2{border-bottom-style:solid;}\", \".fghlq4f{border-top-color:var(--colorTransparentStroke);}\", \".f1gn591s{border-right-color:var(--colorTransparentStroke);}\", \".fjscplz{border-left-color:var(--colorTransparentStroke);}\", \".fb073pr{border-bottom-color:var(--colorTransparentStroke);}\", \".fk6fouc{font-family:var(--fontFamilyBase);}\", \".fkhj508{font-size:var(--fontSizeBase300);}\", \".figsok6{font-weight:var(--fontWeightRegular);}\", \".f1i3iumi{line-height:var(--lineHeightBase300);}\", \".f18k4bn6{animation-composition:accumulate;}\", \".fo1kyvf{animation-duration:var(--durationSlower);}\", \".fetxo7e{animation-timing-function:var(--curveDecelerateMid);}\", \".fmm77a6{--slide-distance-x:0px;}\", \".f12t24nk{--slide-distance-y:10px;}\", \".f1babd7[data-popper-placement^=right]{--slide-distance-x:-10px;}\", \".f1jgo889[data-popper-placement^=right]{--slide-distance-y:0px;}\", \".f1ij1pew[data-popper-placement^=bottom]{--slide-distance-x:0px;}\", \".f1gu8pa9[data-popper-placement^=bottom]{--slide-distance-y:-10px;}\", \".fhfnl4n[data-popper-placement^=left]{--slide-distance-x:10px;}\", \".fk8tkmz[data-popper-placement^=left]{--slide-distance-y:0px;}\", \".f3n0535{animation-name:f5j8bii,fld5wjx;}\", \".fg3r6xk{background-color:var(--colorNeutralBackgroundStatic);}\", \".fonrgv7{color:var(--colorNeutralForegroundStaticInverted);}\", \".ffp7eso{background-color:var(--colorBrandBackground);}\", \".f1phragk{color:var(--colorNeutralForegroundOnBrand);}\", \".f1kcqot9{padding-top:12px;}\", \".f11qrl6u{padding-right:12px;}\", \".fjlbh76{padding-left:12px;}\", \".fpe6lb7{padding-bottom:12px;}\", \".fqag9an{padding-top:16px;}\", \".f1gbmcue{padding-right:16px;}\", \".f1rh9g5y{padding-left:16px;}\", \".fp67ikv{padding-bottom:16px;}\", \".fc7z3ec{padding-top:20px;}\", \".fat0sn4{padding-right:20px;}\", \".fekwl8i{padding-left:20px;}\", \".fe2my4m{padding-bottom:20px;}\", \".f1ekdpwm{width:8.484px;}\", \".f83vc9z{height:8.484px;}\", \".f1kmc0fn{width:11.312px;}\", \".fb6lvc5{height:11.312px;}\", \".f1euv43f{position:absolute;}\", \".f1u2r49w{background-color:inherit;}\", \".fd7fpy0{visibility:hidden;}\", \".f1bsuimh{z-index:-1;}\", \".f1wl9k8s::before{content:\\\"\\\";}\", \".f1wkw4r9::before{visibility:visible;}\", \".f1j7ml58::before{position:absolute;}\", \".fyl8oag::before{box-sizing:border-box;}\", \".frdoeuz::before{width:inherit;}\", \".fb81m9q::before{height:inherit;}\", \".f1ljr5q2::before{background-color:inherit;}\", \".fyfemzf::before{border-right-width:1px;}\", \".focyt6c::before{border-right-style:solid;}\", \".fnhxbxj::before{border-right-color:var(--colorTransparentStroke);}\", \".fdw6hkg::before{border-bottom-width:1px;}\", \".f11yjt3y::before{border-bottom-style:solid;}\", \".f1172wan::before{border-bottom-color:var(--colorTransparentStroke);}\", \".f9e5op9::before{border-bottom-right-radius:var(--borderRadiusSmall);}\", \".f112wvtl::before{border-bottom-left-radius:var(--borderRadiusSmall);}\", \".ftj5xct::before{transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);}\", \".fyavhwi::before{transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);}\", \"[data-popper-placement^=\\\"top\\\"] .f1773hnp{bottom:-1px;}\", \"[data-popper-placement^=\\\"top\\\"] .f1n8855c{--angle:0;}\", \"[data-popper-placement^=\\\"right\\\"] .f1v7783n{left:-1px;}\", \"[data-popper-placement^=\\\"right\\\"] .fsw6im5{--angle:90deg;}\", \"[data-popper-placement^=\\\"bottom\\\"] .fh2hsk5{top:-1px;}\", \"[data-popper-placement^=\\\"bottom\\\"] .f159pzir{--angle:180deg;}\", \"[data-popper-placement^=\\\"left\\\"] .f11yvu4{right:-1px;}\", \"[data-popper-placement^=\\\"left\\\"] .fm1ycve{--angle:270deg;}\"],\n k: [\"@keyframes f5j8bii{from{opacity:0;}to{opacity:1;}}\", \"@keyframes fld5wjx{from{transform:translate(var(--slide-distance-x), var(--slide-distance-y));}}\"],\n m: [[\"@media (prefers-reduced-motion){.fi19xcv[data-popper-placement]{animation-duration:1ms;}}\", {\n m: \"(prefers-reduced-motion)\"\n }], [\"@media (prefers-reduced-motion){.f1mzajhk[data-popper-placement]{animation-name:f5j8bii;}}\", {\n m: \"(prefers-reduced-motion)\"\n }]],\n t: [\"@supports not (animation-composition: accumulate){.fjp4h9y[data-popper-placement]{animation-name:f5j8bii;}}\"]\n});\n/**\n * Apply styling to the PopoverSurface slots based on the state\n */\nexport const usePopoverSurfaceStyles_unstable = state => {\n const styles = useStyles();\n state.root.className = mergeClasses(popoverSurfaceClassNames.root, styles.root, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.appearance === 'inverted' && styles.inverted, state.appearance === 'brand' && styles.brand, state.root.className);\n state.arrowClassName = mergeClasses(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);\n return state;\n};\n//# sourceMappingURL=usePopoverSurfaceStyles.styles.js.map"],"names":["popoverSurfaceClassNames","arrowHeights","usePopoverSurfaceStyles_unstable","root","small","medium","large","useStyles","__styles","sj55zd","De3pzq","E5pizo","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","B93otf3","vin17d","Ezkn3b","ex8oj8","Bksk4gw","Bc5phfd","cbiifc","fyiq5g","Bqc19t1","Eet2gb","Bhl7k63","Bv12yb3","z0t1cu","Bks05zx","Bvtglag","inverted","brand","smallPadding","z8tnut","z189sj","Byoj8tv","uwmqm3","mediumPadding","largePadding","smallArrow","a9b677","Bqenvij","mediumLargeArrow","arrow","qhf8xq","Bcdw1i0","Bj3rh1h","Ftih45","B1puzpu","Brfgrao","Bcvre1j","Ccq8qp","Baz25je","cmx5o7","B4f6apu","m598lv","Bk5zm6e","y0oebl","qa3bma","Bqjgrrk","Budzafs","Hv9wc6","hl6cv3","Bh2vraf","yayu3t","wedwtw","rhl9o9","Bu8t5uz","B6q6orb","Bwwlvwl","d","k","m","t","state","styles","className","mergeClasses","size","appearance","arrowClassName"],"mappings":";;;;;;;;;;;IAGaA,wBAAwB;eAAxBA;;IAGAC,YAAY;eAAZA;;IA6HAC,gCAAgC;eAAhCA;;;uBAnIsC;AAG5C,MAAMF,2BAA2B;IACtCG,MAAM;AACR;AACO,MAAMF,eAAe;IAC1BG,OAAO;IACPC,QAAQ;IACRC,OAAO;AACT;AACA;;CAEC,GACD,MAAMC,YAAY,WAAW,GAAEC,IAAAA,eAAQ,EAAC;IACtCL,MAAM;QACJM,QAAQ;QACRC,QAAQ;QACRC,QAAQ;QACRC,SAAS;YAAC;YAAY;SAAW;QACjCC,SAAS;YAAC;YAAY;SAAW;QACjCC,SAAS;YAAC;YAAY;SAAU;QAChCC,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,EAAE0C,MAAMI,IAAI,KAAK,YAAYH,OAAOtC,aAAa,EAAEqC,MAAMI,IAAI,KAAK,WAAWH,OAAOrC,YAAY,EAAEoC,MAAMK,UAAU,KAAK,cAAcJ,OAAO7C,QAAQ,EAAE4C,MAAMK,UAAU,KAAK,WAAWJ,OAAO5C,KAAK,EAAE2C,MAAMxF,IAAI,CAAC0F,SAAS;IACrVF,MAAMM,cAAc,GAAGH,IAAAA,mBAAY,EAACF,OAAOhC,KAAK,EAAE+B,MAAMI,IAAI,KAAK,UAAUH,OAAOpC,UAAU,GAAGoC,OAAOjC,gBAAgB;IACtH,OAAOgC;AACT,GACA,0DAA0D"}
|
1
|
+
{"version":3,"sources":["usePopoverSurfaceStyles.styles.js"],"sourcesContent":["import { shorthands, __styles, mergeClasses } from '@griffel/react';\nimport { createArrowHeightStyles, createArrowStyles, createSlideStyles } from '@fluentui/react-positioning';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nexport const popoverSurfaceClassNames = {\n root: 'fui-PopoverSurface'\n};\nexport const arrowHeights = {\n small: 6,\n medium: 8,\n large: 8\n};\n/**\n * Styles for the root slot\n */\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n sj55zd: \"f19n0e5\",\n De3pzq: \"fxugw4r\",\n E5pizo: \"f1hg901r\",\n Bbmb7ep: [\"f1aa9q02\", \"f16jpd5f\"],\n Beyfa6y: [\"f16jpd5f\", \"f1aa9q02\"],\n B7oj6ja: [\"f1jar5jt\", \"fyu767a\"],\n Btl43ni: [\"fyu767a\", \"f1jar5jt\"],\n B4j52fo: \"f5ogflp\",\n Bekrc4i: [\"f1hqa2wf\", \"finvdd3\"],\n Bn0qgzm: \"f1f09k3d\",\n ibv6hh: [\"finvdd3\", \"f1hqa2wf\"],\n icvyot: \"fzkkow9\",\n vrafjx: [\"fcdblym\", \"fjik90z\"],\n oivjwe: \"fg706s2\",\n wvpqe5: [\"fjik90z\", \"fcdblym\"],\n g2u3we: \"fghlq4f\",\n h3c5rm: [\"f1gn591s\", \"fjscplz\"],\n B9xav0g: \"fb073pr\",\n zhjwy3: [\"fjscplz\", \"f1gn591s\"],\n Bahqtrf: \"fk6fouc\",\n Be2twd7: \"fkhj508\",\n Bhrd7zp: \"figsok6\",\n Bg96gwp: \"f1i3iumi\",\n B93otf3: \"f18k4bn6\",\n vin17d: \"fo1kyvf\",\n Ezkn3b: \"fetxo7e\",\n ex8oj8: \"fmm77a6\",\n Bksk4gw: \"f12t24nk\",\n Bc5phfd: \"f1babd7\",\n cbiifc: \"f1jgo889\",\n fyiq5g: \"f1ij1pew\",\n Bqc19t1: \"f1gu8pa9\",\n Eet2gb: \"fhfnl4n\",\n Bhl7k63: \"fk8tkmz\",\n Bv12yb3: \"f3n0535\",\n z0t1cu: \"fi19xcv\",\n Bks05zx: \"f1mzajhk\",\n Bvtglag: \"fjp4h9y\"\n },\n inline: {\n Bj3rh1h: \"f19g0ac\"\n },\n inverted: {\n De3pzq: \"fg3r6xk\",\n sj55zd: \"fonrgv7\"\n },\n brand: {\n De3pzq: \"ffp7eso\",\n sj55zd: \"f1phragk\"\n },\n smallPadding: {\n z8tnut: \"f1kcqot9\",\n z189sj: [\"f11qrl6u\", \"fjlbh76\"],\n Byoj8tv: \"fpe6lb7\",\n uwmqm3: [\"fjlbh76\", \"f11qrl6u\"]\n },\n mediumPadding: {\n z8tnut: \"fqag9an\",\n z189sj: [\"f1gbmcue\", \"f1rh9g5y\"],\n Byoj8tv: \"fp67ikv\",\n uwmqm3: [\"f1rh9g5y\", \"f1gbmcue\"]\n },\n largePadding: {\n z8tnut: \"fc7z3ec\",\n z189sj: [\"fat0sn4\", \"fekwl8i\"],\n Byoj8tv: \"fe2my4m\",\n uwmqm3: [\"fekwl8i\", \"fat0sn4\"]\n },\n smallArrow: {\n a9b677: \"f1ekdpwm\",\n Bqenvij: \"f83vc9z\"\n },\n mediumLargeArrow: {\n a9b677: \"f1kmc0fn\",\n Bqenvij: \"fb6lvc5\"\n },\n arrow: {\n qhf8xq: \"f1euv43f\",\n De3pzq: \"f1u2r49w\",\n Bcdw1i0: \"fd7fpy0\",\n Bj3rh1h: \"f1bsuimh\",\n Ftih45: \"f1wl9k8s\",\n B1puzpu: \"f1wkw4r9\",\n Brfgrao: \"f1j7ml58\",\n Bcvre1j: \"fyl8oag\",\n Ccq8qp: \"frdoeuz\",\n Baz25je: \"fb81m9q\",\n cmx5o7: \"f1ljr5q2\",\n B4f6apu: \"fyfemzf\",\n m598lv: \"focyt6c\",\n Bk5zm6e: \"fnhxbxj\",\n y0oebl: \"fdw6hkg\",\n qa3bma: \"f11yjt3y\",\n Bqjgrrk: \"f1172wan\",\n Budzafs: [\"f9e5op9\", \"f112wvtl\"],\n Hv9wc6: [\"ftj5xct\", \"fyavhwi\"],\n hl6cv3: \"f1773hnp\",\n Bh2vraf: \"f1n8855c\",\n yayu3t: \"f1v7783n\",\n wedwtw: \"fsw6im5\",\n rhl9o9: \"fh2hsk5\",\n Bu8t5uz: \"f159pzir\",\n B6q6orb: \"f11yvu4\",\n Bwwlvwl: \"fm1ycve\"\n }\n}, {\n d: [\".f19n0e5{color:var(--colorNeutralForeground1);}\", \".fxugw4r{background-color:var(--colorNeutralBackground1);}\", \".f1hg901r{box-shadow:var(--shadow16);}\", \".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}\", \".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}\", \".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}\", \".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}\", \".f5ogflp{border-top-width:1px;}\", \".f1hqa2wf{border-right-width:1px;}\", \".finvdd3{border-left-width:1px;}\", \".f1f09k3d{border-bottom-width:1px;}\", \".fzkkow9{border-top-style:solid;}\", \".fcdblym{border-right-style:solid;}\", \".fjik90z{border-left-style:solid;}\", \".fg706s2{border-bottom-style:solid;}\", \".fghlq4f{border-top-color:var(--colorTransparentStroke);}\", \".f1gn591s{border-right-color:var(--colorTransparentStroke);}\", \".fjscplz{border-left-color:var(--colorTransparentStroke);}\", \".fb073pr{border-bottom-color:var(--colorTransparentStroke);}\", \".fk6fouc{font-family:var(--fontFamilyBase);}\", \".fkhj508{font-size:var(--fontSizeBase300);}\", \".figsok6{font-weight:var(--fontWeightRegular);}\", \".f1i3iumi{line-height:var(--lineHeightBase300);}\", \".f18k4bn6{animation-composition:accumulate;}\", \".fo1kyvf{animation-duration:var(--durationSlower);}\", \".fetxo7e{animation-timing-function:var(--curveDecelerateMid);}\", \".fmm77a6{--slide-distance-x:0px;}\", \".f12t24nk{--slide-distance-y:10px;}\", \".f1babd7[data-popper-placement^=right]{--slide-distance-x:-10px;}\", \".f1jgo889[data-popper-placement^=right]{--slide-distance-y:0px;}\", \".f1ij1pew[data-popper-placement^=bottom]{--slide-distance-x:0px;}\", \".f1gu8pa9[data-popper-placement^=bottom]{--slide-distance-y:-10px;}\", \".fhfnl4n[data-popper-placement^=left]{--slide-distance-x:10px;}\", \".fk8tkmz[data-popper-placement^=left]{--slide-distance-y:0px;}\", \".f3n0535{animation-name:f5j8bii,fld5wjx;}\", \".f19g0ac{z-index:1;}\", \".fg3r6xk{background-color:var(--colorNeutralBackgroundStatic);}\", \".fonrgv7{color:var(--colorNeutralForegroundStaticInverted);}\", \".ffp7eso{background-color:var(--colorBrandBackground);}\", \".f1phragk{color:var(--colorNeutralForegroundOnBrand);}\", \".f1kcqot9{padding-top:12px;}\", \".f11qrl6u{padding-right:12px;}\", \".fjlbh76{padding-left:12px;}\", \".fpe6lb7{padding-bottom:12px;}\", \".fqag9an{padding-top:16px;}\", \".f1gbmcue{padding-right:16px;}\", \".f1rh9g5y{padding-left:16px;}\", \".fp67ikv{padding-bottom:16px;}\", \".fc7z3ec{padding-top:20px;}\", \".fat0sn4{padding-right:20px;}\", \".fekwl8i{padding-left:20px;}\", \".fe2my4m{padding-bottom:20px;}\", \".f1ekdpwm{width:8.484px;}\", \".f83vc9z{height:8.484px;}\", \".f1kmc0fn{width:11.312px;}\", \".fb6lvc5{height:11.312px;}\", \".f1euv43f{position:absolute;}\", \".f1u2r49w{background-color:inherit;}\", \".fd7fpy0{visibility:hidden;}\", \".f1bsuimh{z-index:-1;}\", \".f1wl9k8s::before{content:\\\"\\\";}\", \".f1wkw4r9::before{visibility:visible;}\", \".f1j7ml58::before{position:absolute;}\", \".fyl8oag::before{box-sizing:border-box;}\", \".frdoeuz::before{width:inherit;}\", \".fb81m9q::before{height:inherit;}\", \".f1ljr5q2::before{background-color:inherit;}\", \".fyfemzf::before{border-right-width:1px;}\", \".focyt6c::before{border-right-style:solid;}\", \".fnhxbxj::before{border-right-color:var(--colorTransparentStroke);}\", \".fdw6hkg::before{border-bottom-width:1px;}\", \".f11yjt3y::before{border-bottom-style:solid;}\", \".f1172wan::before{border-bottom-color:var(--colorTransparentStroke);}\", \".f9e5op9::before{border-bottom-right-radius:var(--borderRadiusSmall);}\", \".f112wvtl::before{border-bottom-left-radius:var(--borderRadiusSmall);}\", \".ftj5xct::before{transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);}\", \".fyavhwi::before{transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);}\", \"[data-popper-placement^=\\\"top\\\"] .f1773hnp{bottom:-1px;}\", \"[data-popper-placement^=\\\"top\\\"] .f1n8855c{--angle:0;}\", \"[data-popper-placement^=\\\"right\\\"] .f1v7783n{left:-1px;}\", \"[data-popper-placement^=\\\"right\\\"] .fsw6im5{--angle:90deg;}\", \"[data-popper-placement^=\\\"bottom\\\"] .fh2hsk5{top:-1px;}\", \"[data-popper-placement^=\\\"bottom\\\"] .f159pzir{--angle:180deg;}\", \"[data-popper-placement^=\\\"left\\\"] .f11yvu4{right:-1px;}\", \"[data-popper-placement^=\\\"left\\\"] .fm1ycve{--angle:270deg;}\"],\n k: [\"@keyframes f5j8bii{from{opacity:0;}to{opacity:1;}}\", \"@keyframes fld5wjx{from{transform:translate(var(--slide-distance-x), var(--slide-distance-y));}}\"],\n m: [[\"@media (prefers-reduced-motion){.fi19xcv[data-popper-placement]{animation-duration:1ms;}}\", {\n m: \"(prefers-reduced-motion)\"\n }], [\"@media (prefers-reduced-motion){.f1mzajhk[data-popper-placement]{animation-name:f5j8bii;}}\", {\n m: \"(prefers-reduced-motion)\"\n }]],\n t: [\"@supports not (animation-composition: accumulate){.fjp4h9y[data-popper-placement]{animation-name:f5j8bii;}}\"]\n});\n/**\n * Apply styling to the PopoverSurface slots based on the state\n */\nexport const usePopoverSurfaceStyles_unstable = state => {\n const styles = useStyles();\n state.root.className = mergeClasses(popoverSurfaceClassNames.root, styles.root, state.inline && styles.inline, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.appearance === 'inverted' && styles.inverted, state.appearance === 'brand' && styles.brand, state.root.className);\n state.arrowClassName = mergeClasses(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);\n return state;\n};\n//# sourceMappingURL=usePopoverSurfaceStyles.styles.js.map"],"names":["popoverSurfaceClassNames","arrowHeights","usePopoverSurfaceStyles_unstable","root","small","medium","large","useStyles","__styles","sj55zd","De3pzq","E5pizo","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","B93otf3","vin17d","Ezkn3b","ex8oj8","Bksk4gw","Bc5phfd","cbiifc","fyiq5g","Bqc19t1","Eet2gb","Bhl7k63","Bv12yb3","z0t1cu","Bks05zx","Bvtglag","inline","Bj3rh1h","inverted","brand","smallPadding","z8tnut","z189sj","Byoj8tv","uwmqm3","mediumPadding","largePadding","smallArrow","a9b677","Bqenvij","mediumLargeArrow","arrow","qhf8xq","Bcdw1i0","Ftih45","B1puzpu","Brfgrao","Bcvre1j","Ccq8qp","Baz25je","cmx5o7","B4f6apu","m598lv","Bk5zm6e","y0oebl","qa3bma","Bqjgrrk","Budzafs","Hv9wc6","hl6cv3","Bh2vraf","yayu3t","wedwtw","rhl9o9","Bu8t5uz","B6q6orb","Bwwlvwl","d","k","m","t","state","styles","className","mergeClasses","size","appearance","arrowClassName"],"mappings":";;;;;;;;;;;IAGaA,wBAAwB;eAAxBA;;IAGAC,YAAY;eAAZA;;IAgIAC,gCAAgC;eAAhCA;;;uBAtIsC;AAG5C,MAAMF,2BAA2B;IACtCG,MAAM;AACR;AACO,MAAMF,eAAe;IAC1BG,OAAO;IACPC,QAAQ;IACRC,OAAO;AACT;AACA;;CAEC,GACD,MAAMC,YAAY,WAAW,GAAEC,IAAAA,eAAQ,EAAC;IACtCL,MAAM;QACJM,QAAQ;QACRC,QAAQ;QACRC,QAAQ;QACRC,SAAS;YAAC;YAAY;SAAW;QACjCC,SAAS;YAAC;YAAY;SAAW;QACjCC,SAAS;YAAC;YAAY;SAAU;QAChCC,SAAS;YAAC;YAAW;SAAW;QAChCC,SAAS;QACTC,SAAS;YAAC;YAAY;SAAU;QAChCC,SAAS;QACTC,QAAQ;YAAC;YAAW;SAAW;QAC/BC,QAAQ;QACRC,QAAQ;YAAC;YAAW;SAAU;QAC9BC,QAAQ;QACRC,QAAQ;YAAC;YAAW;SAAU;QAC9BC,QAAQ;QACRC,QAAQ;YAAC;YAAY;SAAU;QAC/BC,SAAS;QACTC,QAAQ;YAAC;YAAW;SAAW;QAC/BC,SAAS;QACTC,SAAS;QACTC,SAAS;QACTC,SAAS;QACTC,SAAS;QACTC,QAAQ;QACRC,QAAQ;QACRC,QAAQ;QACRC,SAAS;QACTC,SAAS;QACTC,QAAQ;QACRC,QAAQ;QACRC,SAAS;QACTC,QAAQ;QACRC,SAAS;QACTC,SAAS;QACTC,QAAQ;QACRC,SAAS;QACTC,SAAS;IACX;IACAC,QAAQ;QACNC,SAAS;IACX;IACAC,UAAU;QACRvC,QAAQ;QACRD,QAAQ;IACV;IACAyC,OAAO;QACLxC,QAAQ;QACRD,QAAQ;IACV;IAC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ape && open && !e.isDefaultPrevented()) {
|
41
41
|
setOpen(e, false);
|
42
42
|
// stop propagation to avoid conflicting with other elements that listen for `Escape`
|
43
|
-
// e,g: Dialog, Menu
|
44
|
-
e.
|
43
|
+
// e,g: Dialog, Popover, Menu and Tooltip
|
44
|
+
e.preventDefault();
|
45
45
|
}
|
46
46
|
};
|
47
47
|
const onMouseEnter = (e)=>{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["usePopoverTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, mergeCallbacks, useMergedRefs, useEventCallback } from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport { Escape } from '@fluentui/keyboard-keys';\n/**\n * Create the state required to render PopoverTrigger.\n *\n * The returned state can be modified with hooks such as usePopoverTriggerStyles,\n * before being passed to renderPopoverTrigger_unstable.\n *\n * @param props - props from this instance of PopoverTrigger\n */ export const usePopoverTrigger_unstable = (props)=>{\n const { children, disableButtonEnhancement = false } = props;\n const child = getTriggerChild(children);\n const open = usePopoverContext_unstable((context)=>context.open);\n const setOpen = usePopoverContext_unstable((context)=>context.setOpen);\n const toggleOpen = usePopoverContext_unstable((context)=>context.toggleOpen);\n const triggerRef = usePopoverContext_unstable((context)=>context.triggerRef);\n const openOnHover = usePopoverContext_unstable((context)=>context.openOnHover);\n const openOnContext = usePopoverContext_unstable((context)=>context.openOnContext);\n const { triggerAttributes } = useModalAttributes();\n const onContextMenu = (e)=>{\n if (openOnContext) {\n e.preventDefault();\n setOpen(e, true);\n }\n };\n const onClick = (e)=>{\n if (!openOnContext) {\n toggleOpen(e);\n }\n };\n const onKeyDown = (e)=>{\n if (e.key === Escape && open) {\n setOpen(e, false);\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Menu\n e.
|
1
|
+
{"version":3,"sources":["usePopoverTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, mergeCallbacks, useMergedRefs, useEventCallback } from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport { Escape } from '@fluentui/keyboard-keys';\n/**\n * Create the state required to render PopoverTrigger.\n *\n * The returned state can be modified with hooks such as usePopoverTriggerStyles,\n * before being passed to renderPopoverTrigger_unstable.\n *\n * @param props - props from this instance of PopoverTrigger\n */ export const usePopoverTrigger_unstable = (props)=>{\n const { children, disableButtonEnhancement = false } = props;\n const child = getTriggerChild(children);\n const open = usePopoverContext_unstable((context)=>context.open);\n const setOpen = usePopoverContext_unstable((context)=>context.setOpen);\n const toggleOpen = usePopoverContext_unstable((context)=>context.toggleOpen);\n const triggerRef = usePopoverContext_unstable((context)=>context.triggerRef);\n const openOnHover = usePopoverContext_unstable((context)=>context.openOnHover);\n const openOnContext = usePopoverContext_unstable((context)=>context.openOnContext);\n const { triggerAttributes } = useModalAttributes();\n const onContextMenu = (e)=>{\n if (openOnContext) {\n e.preventDefault();\n setOpen(e, true);\n }\n };\n const onClick = (e)=>{\n if (!openOnContext) {\n toggleOpen(e);\n }\n };\n const onKeyDown = (e)=>{\n if (e.key === Escape && open && !e.isDefaultPrevented()) {\n setOpen(e, false);\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Popover, Menu and Tooltip\n e.preventDefault();\n }\n };\n const onMouseEnter = (e)=>{\n if (openOnHover) {\n setOpen(e, true);\n }\n };\n const onMouseLeave = (e)=>{\n if (openOnHover) {\n setOpen(e, false);\n }\n };\n const contextMenuProps = {\n ...triggerAttributes,\n 'aria-expanded': `${open}`,\n ...child === null || child === void 0 ? void 0 : child.props,\n onMouseEnter: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseEnter, onMouseEnter)),\n onMouseLeave: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseLeave, onMouseLeave)),\n onContextMenu: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onContextMenu, onContextMenu)),\n ref: useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref)\n };\n const triggerChildProps = {\n ...contextMenuProps,\n onClick: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)),\n onKeyDown: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown))\n };\n const ariaButtonTriggerChildProps = useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', triggerChildProps);\n return {\n children: applyTriggerPropsToChildren(props.children, useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps))\n };\n};\n"],"names":["usePopoverTrigger_unstable","props","children","disableButtonEnhancement","child","getTriggerChild","open","usePopoverContext_unstable","context","setOpen","toggleOpen","triggerRef","openOnHover","openOnContext","triggerAttributes","useModalAttributes","onContextMenu","e","preventDefault","onClick","onKeyDown","key","Escape","isDefaultPrevented","onMouseEnter","onMouseLeave","contextMenuProps","useEventCallback","mergeCallbacks","ref","useMergedRefs","triggerChildProps","ariaButtonTriggerChildProps","useARIAButtonProps","type","applyTriggerPropsToChildren"],"mappings":";;;;+BAaiBA;;;eAAAA;;;;iEAbM;gCACuF;8BAC3E;gCACQ;2BACR;8BACZ;AAQZ,MAAMA,6BAA6B,CAACC;IAC3C,MAAM,EAAEC,QAAQ,EAAEC,2BAA2B,KAAK,EAAE,GAAGF;IACvD,MAAMG,QAAQC,IAAAA,+BAAe,EAACH;IAC9B,MAAMI,OAAOC,IAAAA,0CAA0B,EAAC,CAAC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AAO,MAAM9B,MAAM8B,IAAI,GAAG,OAAOrB,gBAAgBa,mBAAmBvB,2BAA2B4B,oBAAoBC;IACnU;AACJ"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-popover",
|
3
|
-
"version": "9.8.
|
3
|
+
"version": "9.8.14",
|
4
4
|
"description": "Popover component for Fluent UI",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -37,15 +37,15 @@
|
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
39
|
"@fluentui/keyboard-keys": "^9.0.6",
|
40
|
-
"@fluentui/react-aria": "^9.3.
|
41
|
-
"@fluentui/react-context-selector": "^9.1.
|
42
|
-
"@fluentui/react-portal": "^9.3.
|
43
|
-
"@fluentui/react-positioning": "^9.9.
|
44
|
-
"@fluentui/react-shared-contexts": "^9.
|
45
|
-
"@fluentui/react-tabster": "^9.13.
|
40
|
+
"@fluentui/react-aria": "^9.3.42",
|
41
|
+
"@fluentui/react-context-selector": "^9.1.40",
|
42
|
+
"@fluentui/react-portal": "^9.3.23",
|
43
|
+
"@fluentui/react-positioning": "^9.9.20",
|
44
|
+
"@fluentui/react-shared-contexts": "^9.10.0",
|
45
|
+
"@fluentui/react-tabster": "^9.13.6",
|
46
46
|
"@fluentui/react-theme": "^9.1.14",
|
47
|
-
"@fluentui/react-utilities": "^9.
|
48
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
47
|
+
"@fluentui/react-utilities": "^9.15.0",
|
48
|
+
"@fluentui/react-jsx-runtime": "^9.0.16",
|
49
49
|
"@griffel/react": "^1.5.14",
|
50
50
|
"@swc/helpers": "^0.5.1"
|
51
51
|
},
|