@fluentui/react-popover 9.8.0 → 9.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. package/CHANGELOG.json +133 -1
  2. package/CHANGELOG.md +37 -2
  3. package/lib/components/Popover/Popover.js.map +1 -1
  4. package/lib/components/Popover/renderPopover.js +1 -1
  5. package/lib/components/Popover/renderPopover.js.map +1 -1
  6. package/lib/components/Popover/usePopover.js +9 -7
  7. package/lib/components/Popover/usePopover.js.map +1 -1
  8. package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
  9. package/lib/components/PopoverSurface/renderPopoverSurface.js +14 -8
  10. package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  11. package/lib/components/PopoverSurface/usePopoverSurface.js +8 -6
  12. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  13. package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  14. package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  15. package/lib/components/PopoverTrigger/usePopoverTrigger.js +12 -11
  16. package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  17. package/lib/popoverContext.js.map +1 -1
  18. package/lib-commonjs/Popover.js +2 -2
  19. package/lib-commonjs/Popover.js.map +1 -1
  20. package/lib-commonjs/PopoverSurface.js +2 -2
  21. package/lib-commonjs/PopoverSurface.js.map +1 -1
  22. package/lib-commonjs/PopoverTrigger.js +2 -2
  23. package/lib-commonjs/PopoverTrigger.js.map +1 -1
  24. package/lib-commonjs/components/Popover/Popover.js +5 -3
  25. package/lib-commonjs/components/Popover/Popover.js.map +1 -1
  26. package/lib-commonjs/components/Popover/Popover.types.js +2 -2
  27. package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
  28. package/lib-commonjs/components/Popover/constants.js +3 -1
  29. package/lib-commonjs/components/Popover/constants.js.map +1 -1
  30. package/lib-commonjs/components/Popover/index.js +5 -5
  31. package/lib-commonjs/components/Popover/index.js.map +1 -1
  32. package/lib-commonjs/components/Popover/renderPopover.js +6 -4
  33. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  34. package/lib-commonjs/components/Popover/usePopover.js +29 -25
  35. package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
  36. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +9 -7
  37. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
  38. package/lib-commonjs/components/PopoverSurface/index.js +6 -6
  39. package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
  40. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +21 -13
  41. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  42. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +17 -13
  43. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  44. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.styles.js +10 -4
  45. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.styles.js.map +1 -1
  46. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +5 -3
  47. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  48. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js +2 -2
  49. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  50. package/lib-commonjs/components/PopoverTrigger/index.js +5 -5
  51. package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
  52. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +3 -1
  53. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  54. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +23 -20
  55. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  56. package/lib-commonjs/index.js +45 -17
  57. package/lib-commonjs/index.js.map +1 -1
  58. package/lib-commonjs/popoverContext.js +12 -6
  59. package/lib-commonjs/popoverContext.js.map +1 -1
  60. package/package.json +16 -16
package/CHANGELOG.json CHANGED
@@ -2,7 +2,139 @@
2
2
  "name": "@fluentui/react-popover",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 29 Aug 2023 12:53:34 GMT",
5
+ "date": "Tue, 05 Sep 2023 15:35:07 GMT",
6
+ "tag": "@fluentui/react-popover_v9.8.2",
7
+ "version": "9.8.2",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "beachball",
12
+ "package": "@fluentui/react-popover",
13
+ "comment": "Bump @fluentui/react-aria to v9.3.35",
14
+ "commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@fluentui/react-popover",
19
+ "comment": "Bump @fluentui/react-context-selector to v9.1.33",
20
+ "commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-popover",
25
+ "comment": "Bump @fluentui/react-portal to v9.3.12",
26
+ "commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-popover",
31
+ "comment": "Bump @fluentui/react-positioning to v9.9.10",
32
+ "commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui/react-popover",
37
+ "comment": "Bump @fluentui/react-tabster to v9.12.7",
38
+ "commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui/react-popover",
43
+ "comment": "Bump @fluentui/react-utilities to v9.13.2",
44
+ "commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
45
+ },
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui/react-popover",
49
+ "comment": "Bump @fluentui/react-jsx-runtime to v9.0.5",
50
+ "commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
51
+ }
52
+ ]
53
+ }
54
+ },
55
+ {
56
+ "date": "Tue, 05 Sep 2023 13:28:57 GMT",
57
+ "tag": "@fluentui/react-popover_v9.8.1",
58
+ "version": "9.8.1",
59
+ "comments": {
60
+ "patch": [
61
+ {
62
+ "author": "bernardo.sunderhus@gmail.com",
63
+ "package": "@fluentui/react-popover",
64
+ "commit": "b93c2ac22355b6cb6f33dd509c6cd9c21f4fffc8",
65
+ "comment": "bumps @swc/helpers version to 0.5.1"
66
+ },
67
+ {
68
+ "author": "bernardo.sunderhus@gmail.com",
69
+ "package": "@fluentui/react-popover",
70
+ "commit": "eea6d93a62249ba4fba3347fb291c67ee1a3fb24",
71
+ "comment": "chore: migrate package to use JSX importSource"
72
+ },
73
+ {
74
+ "author": "beachball",
75
+ "package": "@fluentui/react-popover",
76
+ "comment": "Bump @fluentui/keyboard-keys to v9.0.4",
77
+ "commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
78
+ },
79
+ {
80
+ "author": "beachball",
81
+ "package": "@fluentui/react-popover",
82
+ "comment": "Bump @fluentui/react-aria to v9.3.34",
83
+ "commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
84
+ },
85
+ {
86
+ "author": "beachball",
87
+ "package": "@fluentui/react-popover",
88
+ "comment": "Bump @fluentui/react-context-selector to v9.1.32",
89
+ "commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
90
+ },
91
+ {
92
+ "author": "beachball",
93
+ "package": "@fluentui/react-popover",
94
+ "comment": "Bump @fluentui/react-portal to v9.3.11",
95
+ "commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
96
+ },
97
+ {
98
+ "author": "beachball",
99
+ "package": "@fluentui/react-popover",
100
+ "comment": "Bump @fluentui/react-positioning to v9.9.9",
101
+ "commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
102
+ },
103
+ {
104
+ "author": "beachball",
105
+ "package": "@fluentui/react-popover",
106
+ "comment": "Bump @fluentui/react-shared-contexts to v9.7.3",
107
+ "commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
108
+ },
109
+ {
110
+ "author": "beachball",
111
+ "package": "@fluentui/react-popover",
112
+ "comment": "Bump @fluentui/react-tabster to v9.12.6",
113
+ "commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
114
+ },
115
+ {
116
+ "author": "beachball",
117
+ "package": "@fluentui/react-popover",
118
+ "comment": "Bump @fluentui/react-theme to v9.1.12",
119
+ "commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
120
+ },
121
+ {
122
+ "author": "beachball",
123
+ "package": "@fluentui/react-popover",
124
+ "comment": "Bump @fluentui/react-utilities to v9.13.1",
125
+ "commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
126
+ },
127
+ {
128
+ "author": "beachball",
129
+ "package": "@fluentui/react-popover",
130
+ "comment": "Bump @fluentui/react-jsx-runtime to v9.0.4",
131
+ "commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
132
+ }
133
+ ]
134
+ }
135
+ },
136
+ {
137
+ "date": "Tue, 29 Aug 2023 12:57:34 GMT",
6
138
  "tag": "@fluentui/react-popover_v9.8.0",
7
139
  "version": "9.8.0",
8
140
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,47 @@
1
1
  # Change Log - @fluentui/react-popover
2
2
 
3
- This log was last generated on Tue, 29 Aug 2023 12:53:34 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 05 Sep 2023 15:35:07 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.8.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.8.2)
8
+
9
+ Tue, 05 Sep 2023 15:35:07 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.8.1..@fluentui/react-popover_v9.8.2)
11
+
12
+ ### Patches
13
+
14
+ - Bump @fluentui/react-aria to v9.3.35 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
15
+ - Bump @fluentui/react-context-selector to v9.1.33 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
16
+ - Bump @fluentui/react-portal to v9.3.12 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
17
+ - Bump @fluentui/react-positioning to v9.9.10 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
18
+ - Bump @fluentui/react-tabster to v9.12.7 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
19
+ - Bump @fluentui/react-utilities to v9.13.2 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
20
+ - Bump @fluentui/react-jsx-runtime to v9.0.5 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
21
+
22
+ ## [9.8.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.8.1)
23
+
24
+ Tue, 05 Sep 2023 13:28:57 GMT
25
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.8.0..@fluentui/react-popover_v9.8.1)
26
+
27
+ ### Patches
28
+
29
+ - bumps @swc/helpers version to 0.5.1 ([PR #28989](https://github.com/microsoft/fluentui/pull/28989) by bernardo.sunderhus@gmail.com)
30
+ - chore: migrate package to use JSX importSource ([PR #28959](https://github.com/microsoft/fluentui/pull/28959) by bernardo.sunderhus@gmail.com)
31
+ - Bump @fluentui/keyboard-keys to v9.0.4 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
32
+ - Bump @fluentui/react-aria to v9.3.34 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
33
+ - Bump @fluentui/react-context-selector to v9.1.32 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
34
+ - Bump @fluentui/react-portal to v9.3.11 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
35
+ - Bump @fluentui/react-positioning to v9.9.9 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
36
+ - Bump @fluentui/react-shared-contexts to v9.7.3 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
37
+ - Bump @fluentui/react-tabster to v9.12.6 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
38
+ - Bump @fluentui/react-theme to v9.1.12 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
39
+ - Bump @fluentui/react-utilities to v9.13.1 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
40
+ - Bump @fluentui/react-jsx-runtime to v9.0.4 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
41
+
7
42
  ## [9.8.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.8.0)
8
43
 
9
- Tue, 29 Aug 2023 12:53:34 GMT
44
+ Tue, 29 Aug 2023 12:57:34 GMT
10
45
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.7.18..@fluentui/react-popover_v9.8.0)
11
46
 
12
47
  ### Minor changes
@@ -1 +1 @@
1
- {"version":3,"sources":["Popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePopover_unstable } from './usePopover';\nimport { renderPopover_unstable } from './renderPopover';\nimport type { PopoverProps } from './Popover.types';\n\n/**\n * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.\n */\nexport const Popover: React.FC<PopoverProps> = props => {\n const state = usePopover_unstable(props);\n\n return renderPopover_unstable(state);\n};\n\nPopover.displayName = 'Popover';\n"],"names":["React","usePopover_unstable","renderPopover_unstable","Popover","props","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,sBAAsB,QAAQ,kBAAkB;AAGzD;;CAEC,GACD,OAAO,MAAMC,UAAkCC,CAAAA,QAAS;IACtD,MAAMC,QAAQJ,oBAAoBG;IAElC,OAAOF,uBAAuBG;AAChC,EAAE;AAEFF,QAAQG,WAAW,GAAG"}
1
+ {"version":3,"sources":["Popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePopover_unstable } from './usePopover';\nimport { renderPopover_unstable } from './renderPopover';\nimport type { PopoverProps } from './Popover.types';\n\n/**\n * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.\n */\nexport const Popover: React.FC<PopoverProps> = props => {\n const state = usePopover_unstable(props);\n\n return renderPopover_unstable(state);\n};\n\nPopover.displayName = 'Popover';\n"],"names":["React","usePopover_unstable","renderPopover_unstable","Popover","props","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,sBAAsB,QAAQ,kBAAkB;AAGzD;;CAEC,GACD,OAAO,MAAMC,UAAkCC,CAAAA;IAC7C,MAAMC,QAAQJ,oBAAoBG;IAElC,OAAOF,uBAAuBG;AAChC,EAAE;AAEFF,QAAQG,WAAW,GAAG"}
@@ -3,7 +3,7 @@ import { PopoverContext } from '../../popoverContext';
3
3
  /**
4
4
  * Render the final JSX of Popover
5
5
  */ export const renderPopover_unstable = (state)=>{
6
- const { appearance , arrowRef , contentRef , inline , mountNode , open , openOnContext , openOnHover , setOpen , size , toggleOpen , trapFocus , triggerRef , withArrow , inertTrapFocus } = state;
6
+ const { appearance, arrowRef, contentRef, inline, mountNode, open, openOnContext, openOnHover, setOpen, size, toggleOpen, trapFocus, triggerRef, withArrow, inertTrapFocus } = state;
7
7
  return /*#__PURE__*/ React.createElement(PopoverContext.Provider, {
8
8
  value: {
9
9
  appearance,
@@ -1 +1 @@
1
- {"version":3,"sources":["renderPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { PopoverContext } from '../../popoverContext';\nimport type { PopoverState } from './Popover.types';\n\n/**\n * Render the final JSX of Popover\n */\nexport const renderPopover_unstable = (state: PopoverState) => {\n const {\n appearance,\n arrowRef,\n contentRef,\n inline,\n mountNode,\n open,\n openOnContext,\n openOnHover,\n setOpen,\n size,\n toggleOpen,\n trapFocus,\n triggerRef,\n withArrow,\n inertTrapFocus,\n } = state;\n\n return (\n <PopoverContext.Provider\n value={{\n appearance,\n arrowRef,\n contentRef,\n inline,\n mountNode,\n open,\n openOnContext,\n openOnHover,\n setOpen,\n toggleOpen,\n triggerRef,\n size,\n trapFocus,\n inertTrapFocus,\n withArrow,\n }}\n >\n {state.popoverTrigger}\n {state.open && state.popoverSurface}\n </PopoverContext.Provider>\n );\n};\n"],"names":["React","PopoverContext","renderPopover_unstable","state","appearance","arrowRef","contentRef","inline","mountNode","open","openOnContext","openOnHover","setOpen","size","toggleOpen","trapFocus","triggerRef","withArrow","inertTrapFocus","Provider","value","popoverTrigger","popoverSurface"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,cAAc,QAAQ,uBAAuB;AAGtD;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CAACC,QAAwB;IAC7D,MAAM,EACJC,WAAU,EACVC,SAAQ,EACRC,WAAU,EACVC,OAAM,EACNC,UAAS,EACTC,KAAI,EACJC,cAAa,EACbC,YAAW,EACXC,QAAO,EACPC,KAAI,EACJC,WAAU,EACVC,UAAS,EACTC,WAAU,EACVC,UAAS,EACTC,eAAc,EACf,GAAGf;IAEJ,qBACE,oBAACF,eAAekB,QAAQ;QACtBC,OAAO;YACLhB;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAE;YACAE;YACAH;YACAE;YACAG;YACAD;QACF;OAECd,MAAMkB,cAAc,EACpBlB,MAAMM,IAAI,IAAIN,MAAMmB,cAAc;AAGzC,EAAE"}
1
+ {"version":3,"sources":["renderPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { PopoverContext } from '../../popoverContext';\nimport type { PopoverState } from './Popover.types';\n\n/**\n * Render the final JSX of Popover\n */\nexport const renderPopover_unstable = (state: PopoverState) => {\n const {\n appearance,\n arrowRef,\n contentRef,\n inline,\n mountNode,\n open,\n openOnContext,\n openOnHover,\n setOpen,\n size,\n toggleOpen,\n trapFocus,\n triggerRef,\n withArrow,\n inertTrapFocus,\n } = state;\n\n return (\n <PopoverContext.Provider\n value={{\n appearance,\n arrowRef,\n contentRef,\n inline,\n mountNode,\n open,\n openOnContext,\n openOnHover,\n setOpen,\n toggleOpen,\n triggerRef,\n size,\n trapFocus,\n inertTrapFocus,\n withArrow,\n }}\n >\n {state.popoverTrigger}\n {state.open && state.popoverSurface}\n </PopoverContext.Provider>\n );\n};\n"],"names":["React","PopoverContext","renderPopover_unstable","state","appearance","arrowRef","contentRef","inline","mountNode","open","openOnContext","openOnHover","setOpen","size","toggleOpen","trapFocus","triggerRef","withArrow","inertTrapFocus","Provider","value","popoverTrigger","popoverSurface"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,cAAc,QAAQ,uBAAuB;AAGtD;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CAACC;IACrC,MAAM,EACJC,UAAU,EACVC,QAAQ,EACRC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,IAAI,EACJC,aAAa,EACbC,WAAW,EACXC,OAAO,EACPC,IAAI,EACJC,UAAU,EACVC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,cAAc,EACf,GAAGf;IAEJ,qBACE,oBAACF,eAAekB,QAAQ;QACtBC,OAAO;YACLhB;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAE;YACAE;YACAH;YACAE;YACAG;YACAD;QACF;OAECd,MAAMkB,cAAc,EACpBlB,MAAMM,IAAI,IAAIN,MAAMmB,cAAc;AAGzC,EAAE"}
@@ -74,7 +74,7 @@ import { popoverSurfaceBorderRadius } from './constants';
74
74
  open
75
75
  ]);
76
76
  const positioningRefs = usePopoverRefs(initialState);
77
- const { targetDocument } = useFluent();
77
+ const { targetDocument } = useFluent();
78
78
  var _props_closeOnIframeFocus;
79
79
  useOnClickOutside({
80
80
  contains: elementContains,
@@ -99,16 +99,17 @@ import { popoverSurfaceBorderRadius } from './constants';
99
99
  ],
100
100
  disabled: !open || !closeOnScroll
101
101
  });
102
- const { findFirstFocusable } = useFocusFinders();
102
+ const { findFirstFocusable } = useFocusFinders();
103
103
  React.useEffect(()=>{
104
104
  if (props.unstable_disableAutoFocus) {
105
105
  return;
106
106
  }
107
107
  if (open && positioningRefs.contentRef.current) {
108
+ var _firstFocusable;
108
109
  var _positioningRefs_contentRef_current_getAttribute;
109
110
  const containerTabIndex = (_positioningRefs_contentRef_current_getAttribute = positioningRefs.contentRef.current.getAttribute('tabIndex')) !== null && _positioningRefs_contentRef_current_getAttribute !== void 0 ? _positioningRefs_contentRef_current_getAttribute : undefined;
110
111
  const firstFocusable = isNaN(containerTabIndex) ? findFirstFocusable(positioningRefs.contentRef.current) : positioningRefs.contentRef.current;
111
- firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
112
+ (_firstFocusable = firstFocusable) === null || _firstFocusable === void 0 ? void 0 : _firstFocusable.focus();
112
113
  }
113
114
  }, [
114
115
  findFirstFocusable,
@@ -136,8 +137,8 @@ import { popoverSurfaceBorderRadius } from './constants';
136
137
  * Creates and manages the Popover open state
137
138
  */ function useOpenState(state) {
138
139
  const onOpenChange = useEventCallback((e, data)=>{
139
- var _state_onOpenChange;
140
- return (_state_onOpenChange = state.onOpenChange) === null || _state_onOpenChange === void 0 ? void 0 : _state_onOpenChange.call(state, e, data);
140
+ var _state_onOpenChange, _state;
141
+ return (_state_onOpenChange = (_state = state).onOpenChange) === null || _state_onOpenChange === void 0 ? void 0 : _state_onOpenChange.call(_state, e, data);
141
142
  });
142
143
  const [open, setOpenState] = useControllableState({
143
144
  state: state.open,
@@ -147,6 +148,7 @@ import { popoverSurfaceBorderRadius } from './constants';
147
148
  state.open = open !== undefined ? open : state.open;
148
149
  const setContextTarget = state.setContextTarget;
149
150
  const setOpen = React.useCallback((e, shouldOpen)=>{
151
+ var _onOpenChange;
150
152
  if (shouldOpen && e.type === 'contextmenu') {
151
153
  setContextTarget(e);
152
154
  }
@@ -154,7 +156,7 @@ import { popoverSurfaceBorderRadius } from './constants';
154
156
  setContextTarget(undefined);
155
157
  }
156
158
  setOpenState(shouldOpen);
157
- onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(e, {
159
+ (_onOpenChange = onOpenChange) === null || _onOpenChange === void 0 ? void 0 : _onOpenChange(e, {
158
160
  open: shouldOpen
159
161
  });
160
162
  }, [
@@ -184,7 +186,7 @@ import { popoverSurfaceBorderRadius } from './constants';
184
186
  if (state.withArrow) {
185
187
  positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeights[state.size]);
186
188
  }
187
- const { targetRef: triggerRef , containerRef: contentRef , arrowRef } = usePositioning(positioningOptions);
189
+ const { targetRef: triggerRef, containerRef: contentRef, arrowRef } = usePositioning(positioningOptions);
188
190
  return {
189
191
  triggerRef,
190
192
  contentRef,
@@ -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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3C,IAAI;IACnD,MAAMf,mBAAmB0D,MAAM1D,gBAAgB;IAE/C,MAAMoB,UAAUtC,MAAMkD,WAAW,CAC/B,CAACX,GAAsBC,aAAwB;QAC7C,IAAIA,cAAcD,EAAEM,IAAI,KAAK,eAAe;YAC1C3B,iBAAiBqB;QACnB,CAAC;QAED,IAAI,CAACC,YAAY;YACftB,iBAAiBa;QACnB,CAAC;QAEDG,aAAaM;QACbqC,yBAAAA,0BAAAA,KAAAA,IAAAA,aAAetC,GAAG;YAAEN,MAAMO;QAAW;IACvC,GACA;QAACN;QAAc2C;QAAc3D;KAAiB;IAGhD,OAAO;QAACe;QAAMK;KAAQ;AACxB;AAEA;;CAEC,GACD,SAASc,eACPwB,KACmE,EACnE;IACA,MAAMK,qBAAqB;QACzBC,UAAU;QACVC,OAAO;QACPC,cAAc,IAAItE;QAClBuE,QAAQT,MAAMX,aAAa,GAAGW,MAAM3D,aAAa,GAAGc,SAAS;QAC7D,GAAGvB,4BAA4BoE,MAAMU,WAAW,CAAC;IACnD;IAEA,qDAAqD;IACrD,IAAIL,mBAAmBM,WAAW,EAAE;QAClCX,MAAMY,SAAS,GAAG,KAAK;IACzB,CAAC;IAED,IAAIZ,MAAMY,SAAS,EAAE;QACnBP,mBAAmBQ,MAAM,GAAGhF,iBAAiBwE,mBAAmBQ,MAAM,EAAE5E,YAAY,CAAC+D,MAAMxD,IAAI,CAAC;IAClG,CAAC;IAED,MAAM,EAAEsE,WAAW/B,WAAU,EAAEgC,cAAc/B,WAAU,EAAEgC,SAAQ,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} 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","firstFocusable","containerTabIndex","getAttribute","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;QAEA,IAAIR,SAASM,MAAM,GAAG,GAAG;YACvB,sCAAsC;YACtCC,QAAQC,IAAI,CAAC;QACf;IACF;IAEA,IAAIC,iBAAiDC;IACrD,IAAIC,iBAAiDD;IACrD,IAAIV,SAASM,MAAM,KAAK,GAAG;QAC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C;IAClG;IAEA,MAAM,EAAEsE,WAAW/B,UAAU,EAAEgC,cAAc/B,UAAU,EAAEgC,QAAQ,EAAE,GAAGrF,eAAe0E;IAErF,OAAO;QACLtB;QACAC;QACAgC;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["PopoverSurface.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePopoverSurface_unstable } from './usePopoverSurface';\nimport { renderPopoverSurface_unstable } from './renderPopoverSurface';\nimport { usePopoverSurfaceStyles_unstable } from './usePopoverSurfaceStyles.styles';\nimport type { PopoverSurfaceProps } from './PopoverSurface.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * PopoverSurface component renders react children in a positioned box\n */\nexport const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps> = React.forwardRef((props, ref) => {\n const state = usePopoverSurface_unstable(props, ref);\n\n usePopoverSurfaceStyles_unstable(state);\n\n useCustomStyleHook_unstable('usePopoverSurfaceStyles_unstable')(state);\n\n return renderPopoverSurface_unstable(state);\n});\n\nPopoverSurface.displayName = 'PopoverSurface';\n"],"names":["React","usePopoverSurface_unstable","renderPopoverSurface_unstable","usePopoverSurfaceStyles_unstable","useCustomStyleHook_unstable","PopoverSurface","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,gCAAgC,QAAQ,mCAAmC;AAGpF,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,+BAA2DL,MAAMM,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACvG,MAAMC,QAAQR,2BAA2BM,OAAOC;IAEhDL,iCAAiCM;IAEjCL,4BAA4B,oCAAoCK;IAEhE,OAAOP,8BAA8BO;AACvC,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}
1
+ {"version":3,"sources":["PopoverSurface.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePopoverSurface_unstable } from './usePopoverSurface';\nimport { renderPopoverSurface_unstable } from './renderPopoverSurface';\nimport { usePopoverSurfaceStyles_unstable } from './usePopoverSurfaceStyles.styles';\nimport type { PopoverSurfaceProps } from './PopoverSurface.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * PopoverSurface component renders react children in a positioned box\n */\nexport const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps> = React.forwardRef((props, ref) => {\n const state = usePopoverSurface_unstable(props, ref);\n\n usePopoverSurfaceStyles_unstable(state);\n\n useCustomStyleHook_unstable('usePopoverSurfaceStyles_unstable')(state);\n\n return renderPopoverSurface_unstable(state);\n});\n\nPopoverSurface.displayName = 'PopoverSurface';\n"],"names":["React","usePopoverSurface_unstable","renderPopoverSurface_unstable","usePopoverSurfaceStyles_unstable","useCustomStyleHook_unstable","PopoverSurface","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,gCAAgC,QAAQ,mCAAmC;AAGpF,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,+BAA2DL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,QAAQR,2BAA2BM,OAAOC;IAEhDL,iCAAiCM;IAEjCL,4BAA4B,oCAAoCK;IAEhE,OAAOP,8BAA8BO;AACvC,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}
@@ -1,18 +1,24 @@
1
- /** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
1
+ /** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
2
2
  import { assertSlots } from '@fluentui/react-utilities';
3
3
  import { Portal } from '@fluentui/react-portal';
4
4
  /**
5
5
  * Render the final JSX of PopoverSurface
6
6
  */ export const renderPopoverSurface_unstable = (state)=>{
7
7
  assertSlots(state);
8
- const surface = /*#__PURE__*/ createElement(state.root, null, state.withArrow && /*#__PURE__*/ createElement("div", {
9
- ref: state.arrowRef,
10
- className: state.arrowClassName
11
- }), state.root.children);
8
+ const surface = /*#__PURE__*/ _jsxs(state.root, {
9
+ children: [
10
+ state.withArrow && /*#__PURE__*/ _jsx("div", {
11
+ ref: state.arrowRef,
12
+ className: state.arrowClassName
13
+ }),
14
+ state.root.children
15
+ ]
16
+ });
12
17
  if (state.inline) {
13
18
  return surface;
14
19
  }
15
- return /*#__PURE__*/ createElement(Portal, {
16
- mountNode: state.mountNode
17
- }, surface);
20
+ return /*#__PURE__*/ _jsx(Portal, {
21
+ mountNode: state.mountNode,
22
+ children: surface
23
+ });
18
24
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderPopoverSurface.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { Portal } from '@fluentui/react-portal';\nimport type { PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface.types';\n\n/**\n * Render the final JSX of PopoverSurface\n */\nexport const renderPopoverSurface_unstable = (state: PopoverSurfaceState) => {\n assertSlots<PopoverSurfaceSlots>(state);\n\n const surface = (\n <state.root>\n {state.withArrow && <div ref={state.arrowRef} className={state.arrowClassName} />}\n {state.root.children}\n </state.root>\n );\n\n if (state.inline) {\n return surface;\n }\n\n return <Portal mountNode={state.mountNode}>{surface}</Portal>;\n};\n"],"names":["createElement","assertSlots","Portal","renderPopoverSurface_unstable","state","surface","root","withArrow","div","ref","arrowRef","className","arrowClassName","children","inline","mountNode"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,WAAW,QAAQ,4BAA4B;AACxD,SAASC,MAAM,QAAQ,yBAAyB;AAGhD;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAACC,QAA+B;IAC3EH,YAAiCG;IAEjC,MAAMC,wBACJ,AAdJ,cAcKD,MAAME,IAAI,QACRF,MAAMG,SAAS,kBAAI,AAf1B,cAe2BC;QAAIC,KAAKL,MAAMM,QAAQ;QAAEC,WAAWP,MAAMQ,cAAc;QAC5ER,MAAME,IAAI,CAACO,QAAQ;IAIxB,IAAIT,MAAMU,MAAM,EAAE;QAChB,OAAOT;IACT,CAAC;IAED,qBAAO,AAxBT,cAwBUH;QAAOa,WAAWX,MAAMW,SAAS;OAAGV;AAC9C,EAAE"}
1
+ {"version":3,"sources":["renderPopoverSurface.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { Portal } from '@fluentui/react-portal';\nimport type { PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface.types';\n\n/**\n * Render the final JSX of PopoverSurface\n */\nexport const renderPopoverSurface_unstable = (state: PopoverSurfaceState) => {\n assertSlots<PopoverSurfaceSlots>(state);\n\n const surface = (\n <state.root>\n {state.withArrow && <div ref={state.arrowRef} className={state.arrowClassName} />}\n {state.root.children}\n </state.root>\n );\n\n if (state.inline) {\n return surface;\n }\n\n return <Portal mountNode={state.mountNode}>{surface}</Portal>;\n};\n"],"names":["assertSlots","Portal","renderPopoverSurface_unstable","state","surface","root","withArrow","div","ref","arrowRef","className","arrowClassName","children","inline","mountNode"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,MAAM,QAAQ,yBAAyB;AAGhD;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAACC;IAC5CH,YAAiCG;IAEjC,MAAMC,wBACJ,MAACD,MAAME,IAAI;;YACRF,MAAMG,SAAS,kBAAI,KAACC;gBAAIC,KAAKL,MAAMM,QAAQ;gBAAEC,WAAWP,MAAMQ,cAAc;;YAC5ER,MAAME,IAAI,CAACO,QAAQ;;;IAIxB,IAAIT,MAAMU,MAAM,EAAE;QAChB,OAAOT;IACT;IAEA,qBAAO,KAACH;QAAOa,WAAWX,MAAMW,SAAS;kBAAGV;;AAC9C,EAAE"}
@@ -22,7 +22,7 @@ import { usePopoverContext_unstable } from '../../popoverContext';
22
22
  const trapFocus = usePopoverContext_unstable((context)=>context.trapFocus);
23
23
  const inertTrapFocus = usePopoverContext_unstable((context)=>context.inertTrapFocus);
24
24
  const inline = usePopoverContext_unstable((context)=>context.inline);
25
- const { modalAttributes } = useModalAttributes({
25
+ const { modalAttributes } = useModalAttributes({
26
26
  trapFocus,
27
27
  legacyTrapFocus: !inertTrapFocus,
28
28
  alwaysFocusable: !trapFocus
@@ -47,28 +47,30 @@ import { usePopoverContext_unstable } from '../../popoverContext';
47
47
  elementType: 'div'
48
48
  })
49
49
  };
50
- const { onMouseEnter: onMouseEnterOriginal , onMouseLeave: onMouseLeaveOriginal , onKeyDown: onKeyDownOriginal } = state.root;
50
+ const { onMouseEnter: onMouseEnterOriginal, onMouseLeave: onMouseLeaveOriginal, onKeyDown: onKeyDownOriginal } = state.root;
51
51
  state.root.onMouseEnter = (e)=>{
52
+ var _onMouseEnterOriginal;
52
53
  if (openOnHover) {
53
54
  setOpen(e, true);
54
55
  }
55
- onMouseEnterOriginal === null || onMouseEnterOriginal === void 0 ? void 0 : onMouseEnterOriginal(e);
56
+ (_onMouseEnterOriginal = onMouseEnterOriginal) === null || _onMouseEnterOriginal === void 0 ? void 0 : _onMouseEnterOriginal(e);
56
57
  };
57
58
  state.root.onMouseLeave = (e)=>{
59
+ var _onMouseLeaveOriginal;
58
60
  if (openOnHover) {
59
61
  setOpen(e, false);
60
62
  }
61
- onMouseLeaveOriginal === null || onMouseLeaveOriginal === void 0 ? void 0 : onMouseLeaveOriginal(e);
63
+ (_onMouseLeaveOriginal = onMouseLeaveOriginal) === null || _onMouseLeaveOriginal === void 0 ? void 0 : _onMouseLeaveOriginal(e);
62
64
  };
63
65
  state.root.onKeyDown = (e)=>{
64
- var _contentRef_current;
66
+ var _contentRef_current, _onKeyDownOriginal;
65
67
  // only close if the event happened inside the current popover
66
68
  // If using a stack of inline popovers, the user should call `stopPropagation` to avoid dismissing the entire stack
67
69
  if (e.key === 'Escape' && ((_contentRef_current = contentRef.current) === null || _contentRef_current === void 0 ? void 0 : _contentRef_current.contains(e.target))) {
68
70
  e.preventDefault();
69
71
  setOpen(e, false);
70
72
  }
71
- onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(e);
73
+ (_onKeyDownOriginal = onKeyDownOriginal) === null || _onKeyDownOriginal === void 0 ? void 0 : _onKeyDownOriginal(e);
72
74
  };
73
75
  return state;
74
76
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["usePopoverSurface.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport type { PopoverSurfaceProps, PopoverSurfaceState } from './PopoverSurface.types';\n\n/**\n * Create the state required to render PopoverSurface.\n *\n * The returned state can be modified with hooks such as usePopoverSurfaceStyles_unstable,\n * before being passed to renderPopoverSurface_unstable.\n *\n * @param props - props from this instance of PopoverSurface\n * @param ref - reference to root HTMLDivElement of PopoverSurface\n */\nexport const usePopoverSurface_unstable = (\n props: PopoverSurfaceProps,\n ref: React.Ref<HTMLDivElement>,\n): PopoverSurfaceState => {\n const contentRef = usePopoverContext_unstable(context => context.contentRef);\n const openOnHover = usePopoverContext_unstable(context => context.openOnHover);\n const setOpen = usePopoverContext_unstable(context => context.setOpen);\n const mountNode = usePopoverContext_unstable(context => context.mountNode);\n const arrowRef = usePopoverContext_unstable(context => context.arrowRef);\n const size = usePopoverContext_unstable(context => context.size);\n const withArrow = usePopoverContext_unstable(context => context.withArrow);\n const appearance = usePopoverContext_unstable(context => context.appearance);\n const trapFocus = usePopoverContext_unstable(context => context.trapFocus);\n const inertTrapFocus = usePopoverContext_unstable(context => context.inertTrapFocus);\n const inline = usePopoverContext_unstable(context => context.inline);\n const { modalAttributes } = useModalAttributes({\n trapFocus,\n legacyTrapFocus: !inertTrapFocus,\n alwaysFocusable: !trapFocus,\n });\n\n const state: PopoverSurfaceState = {\n inline,\n appearance,\n withArrow,\n size,\n arrowRef,\n mountNode,\n components: {\n root: 'div',\n },\n root: slot.always(\n getNativeElementProps('div', {\n ref: useMergedRefs(ref, contentRef),\n role: trapFocus ? 'dialog' : 'group',\n 'aria-modal': trapFocus ? true : undefined,\n ...(trapFocus ? modalAttributes : {}),\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n\n const {\n onMouseEnter: onMouseEnterOriginal,\n onMouseLeave: onMouseLeaveOriginal,\n onKeyDown: onKeyDownOriginal,\n } = state.root;\n state.root.onMouseEnter = (e: React.MouseEvent<HTMLDivElement>) => {\n if (openOnHover) {\n setOpen(e, true);\n }\n\n onMouseEnterOriginal?.(e);\n };\n\n state.root.onMouseLeave = (e: React.MouseEvent<HTMLDivElement>) => {\n if (openOnHover) {\n setOpen(e, false);\n }\n\n onMouseLeaveOriginal?.(e);\n };\n\n state.root.onKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n // only close if the event happened inside the current popover\n // If using a stack of inline popovers, the user should call `stopPropagation` to avoid dismissing the entire stack\n if (e.key === 'Escape' && contentRef.current?.contains(e.target as HTMLDivElement)) {\n e.preventDefault();\n setOpen(e, false);\n }\n\n onKeyDownOriginal?.(e);\n };\n\n return state;\n};\n"],"names":["React","getNativeElementProps","useMergedRefs","slot","useModalAttributes","usePopoverContext_unstable","usePopoverSurface_unstable","props","ref","contentRef","context","openOnHover","setOpen","mountNode","arrowRef","size","withArrow","appearance","trapFocus","inertTrapFocus","inline","modalAttributes","legacyTrapFocus","alwaysFocusable","state","components","root","always","role","undefined","elementType","onMouseEnter","onMouseEnterOriginal","onMouseLeave","onMouseLeaveOriginal","onKeyDown","onKeyDownOriginal","e","key","current","contains","target","preventDefault"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,IAAI,QAAQ,4BAA4B;AACvF,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,0BAA0B,QAAQ,uBAAuB;AAGlE;;;;;;;;CAQC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC,MACwB;IACxB,MAAMC,aAAaJ,2BAA2BK,CAAAA,UAAWA,QAAQD,UAAU;IAC3E,MAAME,cAAcN,2BAA2BK,CAAAA,UAAWA,QAAQC,WAAW;IAC7E,MAAMC,UAAUP,2BAA2BK,CAAAA,UAAWA,QAAQE,OAAO;IACrE,MAAMC,YAAYR,2BAA2BK,CAAAA,UAAWA,QAAQG,SAAS;IACzE,MAAMC,WAAWT,2BAA2BK,CAAAA,UAAWA,QAAQI,QAAQ;IACvE,MAAMC,OAAOV,2BAA2BK,CAAAA,UAAWA,QAAQK,IAAI;IAC/D,MAAMC,YAAYX,2BAA2BK,CAAAA,UAAWA,QAAQM,SAAS;IACzE,MAAMC,aAAaZ,2BAA2BK,CAAAA,UAAWA,QAAQO,UAAU;IAC3E,MAAMC,YAAYb,2BAA2BK,CAAAA,UAAWA,QAAQQ,SAAS;IACzE,MAAMC,iBAAiBd,2BAA2BK,CAAAA,UAAWA,QAAQS,cAAc;IACnF,MAAMC,SAASf,2BAA2BK,CAAAA,UAAWA,QAAQU,MAAM;IACnE,MAAM,EAAEC,gBAAe,EAAE,GAAGjB,mBAAmB;QAC7Cc;QACAI,iBAAiB,CAACH;QAClBI,iBAAiB,CAACL;IACpB;IAEA,MAAMM,QAA6B;QACjCJ;QACAH;QACAD;QACAD;QACAD;QACAD;QACAY,YAAY;YACVC,MAAM;QACR;QACAA,MAAMvB,KAAKwB,MAAM,CACf1B,sBAAsB,OAAO;YAC3BO,KAAKN,cAAcM,KAAKC;YACxBmB,MAAMV,YAAY,WAAW,OAAO;YACpC,cAAcA,YAAY,IAAI,GAAGW,SAAS;YAC1C,GAAIX,YAAYG,kBAAkB,CAAC,CAAC;YACpC,GAAGd,KAAK;QACV,IACA;YAAEuB,aAAa;QAAM;IAEzB;IAEA,MAAM,EACJC,cAAcC,qBAAoB,EAClCC,cAAcC,qBAAoB,EAClCC,WAAWC,kBAAiB,EAC7B,GAAGZ,MAAME,IAAI;IACdF,MAAME,IAAI,CAACK,YAAY,GAAG,CAACM,IAAwC;QACjE,IAAI1B,aAAa;YACfC,QAAQyB,GAAG,IAAI;QACjB,CAAC;QAEDL,iCAAAA,kCAAAA,KAAAA,IAAAA,qBAAuBK;IACzB;IAEAb,MAAME,IAAI,CAACO,YAAY,GAAG,CAACI,IAAwC;QACjE,IAAI1B,aAAa;YACfC,QAAQyB,GAAG,KAAK;QAClB,CAAC;QAEDH,iCAAAA,kCAAAA,KAAAA,IAAAA,qBAAuBG;IACzB;IAEAb,MAAME,IAAI,CAACS,SAAS,GAAG,CAACE,IAA2C;YAGvC5B;QAF1B,8DAA8D;QAC9D,mHAAmH;QACnH,IAAI4B,EAAEC,GAAG,KAAK,aAAY7B,CAAAA,sBAAAA,WAAW8B,OAAO,cAAlB9B,iCAAAA,KAAAA,IAAAA,oBAAoB+B,SAASH,EAAEI,MAAM,IAAqB;YAClFJ,EAAEK,cAAc;YAChB9B,QAAQyB,GAAG,KAAK;QAClB,CAAC;QAEDD,8BAAAA,+BAAAA,KAAAA,IAAAA,kBAAoBC;IACtB;IAEA,OAAOb;AACT,EAAE"}
1
+ {"version":3,"sources":["usePopoverSurface.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport type { PopoverSurfaceProps, PopoverSurfaceState } from './PopoverSurface.types';\n\n/**\n * Create the state required to render PopoverSurface.\n *\n * The returned state can be modified with hooks such as usePopoverSurfaceStyles_unstable,\n * before being passed to renderPopoverSurface_unstable.\n *\n * @param props - props from this instance of PopoverSurface\n * @param ref - reference to root HTMLDivElement of PopoverSurface\n */\nexport const usePopoverSurface_unstable = (\n props: PopoverSurfaceProps,\n ref: React.Ref<HTMLDivElement>,\n): PopoverSurfaceState => {\n const contentRef = usePopoverContext_unstable(context => context.contentRef);\n const openOnHover = usePopoverContext_unstable(context => context.openOnHover);\n const setOpen = usePopoverContext_unstable(context => context.setOpen);\n const mountNode = usePopoverContext_unstable(context => context.mountNode);\n const arrowRef = usePopoverContext_unstable(context => context.arrowRef);\n const size = usePopoverContext_unstable(context => context.size);\n const withArrow = usePopoverContext_unstable(context => context.withArrow);\n const appearance = usePopoverContext_unstable(context => context.appearance);\n const trapFocus = usePopoverContext_unstable(context => context.trapFocus);\n const inertTrapFocus = usePopoverContext_unstable(context => context.inertTrapFocus);\n const inline = usePopoverContext_unstable(context => context.inline);\n const { modalAttributes } = useModalAttributes({\n trapFocus,\n legacyTrapFocus: !inertTrapFocus,\n alwaysFocusable: !trapFocus,\n });\n\n const state: PopoverSurfaceState = {\n inline,\n appearance,\n withArrow,\n size,\n arrowRef,\n mountNode,\n components: {\n root: 'div',\n },\n root: slot.always(\n getNativeElementProps('div', {\n ref: useMergedRefs(ref, contentRef),\n role: trapFocus ? 'dialog' : 'group',\n 'aria-modal': trapFocus ? true : undefined,\n ...(trapFocus ? modalAttributes : {}),\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n\n const {\n onMouseEnter: onMouseEnterOriginal,\n onMouseLeave: onMouseLeaveOriginal,\n onKeyDown: onKeyDownOriginal,\n } = state.root;\n state.root.onMouseEnter = (e: React.MouseEvent<HTMLDivElement>) => {\n if (openOnHover) {\n setOpen(e, true);\n }\n\n onMouseEnterOriginal?.(e);\n };\n\n state.root.onMouseLeave = (e: React.MouseEvent<HTMLDivElement>) => {\n if (openOnHover) {\n setOpen(e, false);\n }\n\n onMouseLeaveOriginal?.(e);\n };\n\n state.root.onKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n // only close if the event happened inside the current popover\n // If using a stack of inline popovers, the user should call `stopPropagation` to avoid dismissing the entire stack\n if (e.key === 'Escape' && contentRef.current?.contains(e.target as HTMLDivElement)) {\n e.preventDefault();\n setOpen(e, false);\n }\n\n onKeyDownOriginal?.(e);\n };\n\n return state;\n};\n"],"names":["React","getNativeElementProps","useMergedRefs","slot","useModalAttributes","usePopoverContext_unstable","usePopoverSurface_unstable","props","ref","contentRef","context","openOnHover","setOpen","mountNode","arrowRef","size","withArrow","appearance","trapFocus","inertTrapFocus","inline","modalAttributes","legacyTrapFocus","alwaysFocusable","state","components","root","always","role","undefined","elementType","onMouseEnter","onMouseEnterOriginal","onMouseLeave","onMouseLeaveOriginal","onKeyDown","onKeyDownOriginal","e","key","current","contains","target","preventDefault"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,IAAI,QAAQ,4BAA4B;AACvF,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,0BAA0B,QAAQ,uBAAuB;AAGlE;;;;;;;;CAQC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC;IAEA,MAAMC,aAAaJ,2BAA2BK,CAAAA,UAAWA,QAAQD,UAAU;IAC3E,MAAME,cAAcN,2BAA2BK,CAAAA,UAAWA,QAAQC,WAAW;IAC7E,MAAMC,UAAUP,2BAA2BK,CAAAA,UAAWA,QAAQE,OAAO;IACrE,MAAMC,YAAYR,2BAA2BK,CAAAA,UAAWA,QAAQG,SAAS;IACzE,MAAMC,WAAWT,2BAA2BK,CAAAA,UAAWA,QAAQI,QAAQ;IACvE,MAAMC,OAAOV,2BAA2BK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mHAAmH;QACnH,IAAIC,EAAEC,GAAG,KAAK,cAAY7B,sBAAAA,WAAW8B,OAAO,cAAlB9B,0CAAAA,oBAAoB+B,QAAQ,CAACH,EAAEI,MAAM,IAAqB;YAClFJ,EAAEK,cAAc;YAChB9B,QAAQyB,GAAG;QACb;SAEAD,qBAAAA,+BAAAA,yCAAAA,mBAAoBC;IACtB;IAEA,OAAOb;AACT,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["PopoverTrigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePopoverTrigger_unstable } from './usePopoverTrigger';\nimport { renderPopoverTrigger_unstable } from './renderPopoverTrigger';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\nimport type { PopoverTriggerProps } from './PopoverTrigger.types';\n\n/**\n * Wraps a trigger element as an only child and adds the necessary event handling to open a popover.\n */\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> = props => {\n const state = usePopoverTrigger_unstable(props);\n\n return renderPopoverTrigger_unstable(state);\n};\n\nPopoverTrigger.displayName = 'PopoverTrigger';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\n(PopoverTrigger as FluentTriggerComponent).isFluentTriggerComponent = true;\n"],"names":["React","usePopoverTrigger_unstable","renderPopoverTrigger_unstable","PopoverTrigger","props","state","displayName","isFluentTriggerComponent"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,yBAAyB;AAIvE;;CAEC,GACD,OAAO,MAAMC,iBAAgDC,CAAAA,QAAS;IACpE,MAAMC,QAAQJ,2BAA2BG;IAEzC,OAAOF,8BAA8BG;AACvC,EAAE;AAEFF,eAAeG,WAAW,GAAG;AAC7B,6FAA6F;AAC5FH,eAA0CI,wBAAwB,GAAG,IAAI"}
1
+ {"version":3,"sources":["PopoverTrigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePopoverTrigger_unstable } from './usePopoverTrigger';\nimport { renderPopoverTrigger_unstable } from './renderPopoverTrigger';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\nimport type { PopoverTriggerProps } from './PopoverTrigger.types';\n\n/**\n * Wraps a trigger element as an only child and adds the necessary event handling to open a popover.\n */\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> = props => {\n const state = usePopoverTrigger_unstable(props);\n\n return renderPopoverTrigger_unstable(state);\n};\n\nPopoverTrigger.displayName = 'PopoverTrigger';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\n(PopoverTrigger as FluentTriggerComponent).isFluentTriggerComponent = true;\n"],"names":["React","usePopoverTrigger_unstable","renderPopoverTrigger_unstable","PopoverTrigger","props","state","displayName","isFluentTriggerComponent"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,yBAAyB;AAIvE;;CAEC,GACD,OAAO,MAAMC,iBAAgDC,CAAAA;IAC3D,MAAMC,QAAQJ,2BAA2BG;IAEzC,OAAOF,8BAA8BG;AACvC,EAAE;AAEFF,eAAeG,WAAW,GAAG;AAC7B,6FAA6F;AAC5FH,eAA0CI,wBAAwB,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["renderPopoverTrigger.tsx"],"sourcesContent":["import type { PopoverTriggerState } from './PopoverTrigger.types';\n\n/**\n * Render the final JSX of PopoverTrigger\n */\nexport const renderPopoverTrigger_unstable = (state: PopoverTriggerState) => {\n return state.children;\n};\n"],"names":["renderPopoverTrigger_unstable","state","children"],"mappings":"AAEA;;CAEC,GACD,OAAO,MAAMA,gCAAgC,CAACC,QAA+B;IAC3E,OAAOA,MAAMC,QAAQ;AACvB,EAAE"}
1
+ {"version":3,"sources":["renderPopoverTrigger.tsx"],"sourcesContent":["import type { PopoverTriggerState } from './PopoverTrigger.types';\n\n/**\n * Render the final JSX of PopoverTrigger\n */\nexport const renderPopoverTrigger_unstable = (state: PopoverTriggerState) => {\n return state.children;\n};\n"],"names":["renderPopoverTrigger_unstable","state","children"],"mappings":"AAEA;;CAEC,GACD,OAAO,MAAMA,gCAAgC,CAACC;IAC5C,OAAOA,MAAMC,QAAQ;AACvB,EAAE"}
@@ -12,7 +12,8 @@ import { Escape } from '@fluentui/keyboard-keys';
12
12
  *
13
13
  * @param props - props from this instance of PopoverTrigger
14
14
  */ export const usePopoverTrigger_unstable = (props)=>{
15
- const { children , disableButtonEnhancement =false } = props;
15
+ var _child, _child1, _child2, _child3, _child4, _child5, _child6, _child7, _child8, _child9, _child10;
16
+ const { children, disableButtonEnhancement = false } = props;
16
17
  const child = getTriggerChild(children);
17
18
  const open = usePopoverContext_unstable((context)=>context.open);
18
19
  const setOpen = usePopoverContext_unstable((context)=>context.setOpen);
@@ -20,7 +21,7 @@ import { Escape } from '@fluentui/keyboard-keys';
20
21
  const triggerRef = usePopoverContext_unstable((context)=>context.triggerRef);
21
22
  const openOnHover = usePopoverContext_unstable((context)=>context.openOnHover);
22
23
  const openOnContext = usePopoverContext_unstable((context)=>context.openOnContext);
23
- const { triggerAttributes } = useModalAttributes();
24
+ const { triggerAttributes } = useModalAttributes();
24
25
  const onContextMenu = (e)=>{
25
26
  if (openOnContext) {
26
27
  e.preventDefault();
@@ -53,19 +54,19 @@ import { Escape } from '@fluentui/keyboard-keys';
53
54
  const contextMenuProps = {
54
55
  ...triggerAttributes,
55
56
  'aria-expanded': `${open}`,
56
- ...child === null || child === void 0 ? void 0 : child.props,
57
- onMouseEnter: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseEnter, onMouseEnter)),
58
- onMouseLeave: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseLeave, onMouseLeave)),
59
- onContextMenu: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onContextMenu, onContextMenu)),
60
- ref: useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref)
57
+ ...(_child = child) === null || _child === void 0 ? void 0 : _child.props,
58
+ onMouseEnter: useEventCallback(mergeCallbacks((_child1 = child) === null || _child1 === void 0 ? void 0 : _child1.props.onMouseEnter, onMouseEnter)),
59
+ onMouseLeave: useEventCallback(mergeCallbacks((_child2 = child) === null || _child2 === void 0 ? void 0 : _child2.props.onMouseLeave, onMouseLeave)),
60
+ onContextMenu: useEventCallback(mergeCallbacks((_child3 = child) === null || _child3 === void 0 ? void 0 : _child3.props.onContextMenu, onContextMenu)),
61
+ ref: useMergedRefs(triggerRef, (_child4 = child) === null || _child4 === void 0 ? void 0 : _child4.ref)
61
62
  };
62
63
  const triggerChildProps = {
63
64
  ...contextMenuProps,
64
- onClick: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)),
65
- onKeyDown: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown))
65
+ onClick: useEventCallback(mergeCallbacks((_child5 = child) === null || _child5 === void 0 ? void 0 : _child5.props.onClick, onClick)),
66
+ onKeyDown: useEventCallback(mergeCallbacks((_child6 = child) === null || _child6 === void 0 ? void 0 : _child6.props.onKeyDown, onKeyDown))
66
67
  };
67
- 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);
68
+ const ariaButtonTriggerChildProps = useARIAButtonProps(((_child7 = child) === null || _child7 === void 0 ? void 0 : _child7.type) === 'button' || ((_child8 = child) === null || _child8 === void 0 ? void 0 : _child8.type) === 'a' ? child.type : 'div', triggerChildProps);
68
69
  return {
69
- 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))
70
+ children: applyTriggerPropsToChildren(props.children, useARIAButtonProps(((_child9 = child) === null || _child9 === void 0 ? void 0 : _child9.type) === 'button' || ((_child10 = child) === null || _child10 === void 0 ? void 0 : _child10.type) === 'a' ? child.type : 'div', openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps))
70
71
  };
71
72
  };
@@ -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.stopPropagation();\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","stopPropagation","onMouseEnter","onMouseLeave","contextMenuProps","ref","triggerChildProps","ariaButtonTriggerChildProps","type"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,2BAA2B,EAC3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,KAAAA,IAAAA,MAAOsB,IAAI,AAAD,MAAM,MAAMtB,MAAMsB,IAAI,GAAG,KAAK,EACpEf,gBAAgBW,mBAAmBnB,2BAA2BqB,oBAAoBC,2BAA2B;IAGnH;AACF,EAAE"}
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.stopPropagation();\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","child","children","disableButtonEnhancement","open","context","setOpen","toggleOpen","triggerRef","openOnHover","openOnContext","triggerAttributes","onContextMenu","e","preventDefault","onClick","onKeyDown","key","stopPropagation","onMouseEnter","onMouseLeave","contextMenuProps","ref","triggerChildProps","ariaButtonTriggerChildProps","type"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,2BAA2B,EAC3BC,eAAe,EACfC,cAAc,EACdC,aAAa,E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