@fluentui/react-popover 0.0.0-nightlyfe9829e48120211112.1 → 0.0.0-nightlyff78d1e27a20220217.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. package/CHANGELOG.json +332 -31
  2. package/CHANGELOG.md +78 -15
  3. package/dist/react-popover.d.ts +29 -20
  4. package/lib/Popover.js.map +1 -1
  5. package/lib/PopoverSurface.js.map +1 -1
  6. package/lib/PopoverTrigger.js.map +1 -1
  7. package/lib/components/Popover/Popover.js +4 -4
  8. package/lib/components/Popover/Popover.js.map +1 -1
  9. package/lib/components/Popover/Popover.types.d.ts +2 -1
  10. package/lib/components/Popover/Popover.types.js.map +1 -1
  11. package/lib/components/Popover/index.js.map +1 -1
  12. package/lib/components/Popover/renderPopover.d.ts +1 -1
  13. package/lib/components/Popover/renderPopover.js +1 -1
  14. package/lib/components/Popover/renderPopover.js.map +1 -1
  15. package/lib/components/Popover/usePopover.d.ts +2 -2
  16. package/lib/components/Popover/usePopover.js +4 -3
  17. package/lib/components/Popover/usePopover.js.map +1 -1
  18. package/lib/components/PopoverSurface/PopoverSurface.js +6 -6
  19. package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
  20. package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +2 -2
  21. package/lib/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  22. package/lib/components/PopoverSurface/index.js.map +1 -1
  23. package/lib/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
  24. package/lib/components/PopoverSurface/renderPopoverSurface.js +4 -4
  25. package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  26. package/lib/components/PopoverSurface/usePopoverSurface.d.ts +4 -5
  27. package/lib/components/PopoverSurface/usePopoverSurface.js +16 -16
  28. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  29. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +1 -1
  30. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +29 -18
  31. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  32. package/lib/components/PopoverTrigger/PopoverTrigger.d.ts +2 -1
  33. package/lib/components/PopoverTrigger/PopoverTrigger.js +5 -4
  34. package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  35. package/lib/components/PopoverTrigger/PopoverTrigger.types.d.ts +9 -2
  36. package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  37. package/lib/components/PopoverTrigger/index.js.map +1 -1
  38. package/lib/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
  39. package/lib/components/PopoverTrigger/renderPopoverTrigger.js +1 -1
  40. package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  41. package/lib/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -2
  42. package/lib/components/PopoverTrigger/usePopoverTrigger.js +33 -40
  43. package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  44. package/lib/index.js.map +1 -1
  45. package/lib/popoverContext.d.ts +1 -1
  46. package/lib/popoverContext.js +1 -1
  47. package/lib/popoverContext.js.map +1 -1
  48. package/lib-commonjs/Popover.js.map +1 -1
  49. package/lib-commonjs/PopoverSurface.js.map +1 -1
  50. package/lib-commonjs/PopoverTrigger.js.map +1 -1
  51. package/lib-commonjs/components/Popover/Popover.js +2 -2
  52. package/lib-commonjs/components/Popover/Popover.js.map +1 -1
  53. package/lib-commonjs/components/Popover/Popover.types.d.ts +2 -1
  54. package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
  55. package/lib-commonjs/components/Popover/index.js.map +1 -1
  56. package/lib-commonjs/components/Popover/renderPopover.d.ts +1 -1
  57. package/lib-commonjs/components/Popover/renderPopover.js +3 -3
  58. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  59. package/lib-commonjs/components/Popover/usePopover.d.ts +2 -2
  60. package/lib-commonjs/components/Popover/usePopover.js +6 -5
  61. package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
  62. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +3 -3
  63. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
  64. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +2 -2
  65. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  66. package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
  67. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
  68. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +6 -7
  69. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  70. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.d.ts +4 -5
  71. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +18 -18
  72. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  73. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +1 -1
  74. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +36 -23
  75. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  76. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.d.ts +2 -1
  77. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +3 -2
  78. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  79. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.d.ts +9 -2
  80. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  81. package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
  82. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
  83. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +3 -3
  84. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  85. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -2
  86. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +33 -40
  87. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  88. package/lib-commonjs/index.js.map +1 -1
  89. package/lib-commonjs/popoverContext.d.ts +1 -1
  90. package/lib-commonjs/popoverContext.js +3 -3
  91. package/lib-commonjs/popoverContext.js.map +1 -1
  92. package/package.json +13 -15
  93. package/lib/common/isConformant.d.ts +0 -4
  94. package/lib/common/isConformant.js +0 -13
  95. package/lib/common/isConformant.js.map +0 -1
  96. package/lib/common/mockUsePopoverContext.d.ts +0 -7
  97. package/lib/common/mockUsePopoverContext.js +0 -31
  98. package/lib/common/mockUsePopoverContext.js.map +0 -1
  99. package/lib-commonjs/common/isConformant.d.ts +0 -4
  100. package/lib-commonjs/common/isConformant.js +0 -24
  101. package/lib-commonjs/common/isConformant.js.map +0 -1
  102. package/lib-commonjs/common/mockUsePopoverContext.d.ts +0 -7
  103. package/lib-commonjs/common/mockUsePopoverContext.js +0 -41
  104. package/lib-commonjs/common/mockUsePopoverContext.js.map +0 -1
@@ -18,9 +18,9 @@ const usePopoverSurfaceStyles_1 = /*#__PURE__*/require("./usePopoverSurfaceStyle
18
18
 
19
19
 
20
20
  exports.PopoverSurface = /*#__PURE__*/React.forwardRef((props, ref) => {
21
- const state = usePopoverSurface_1.usePopoverSurface(props, ref);
22
- usePopoverSurfaceStyles_1.usePopoverSurfaceStyles(state);
23
- return renderPopoverSurface_1.renderPopoverSurface(state);
21
+ const state = usePopoverSurface_1.usePopoverSurface_unstable(props, ref);
22
+ usePopoverSurfaceStyles_1.usePopoverSurfaceStyles_unstable(state);
23
+ return renderPopoverSurface_1.renderPopoverSurface_unstable(state);
24
24
  });
25
25
  exports.PopoverSurface.displayName = 'PopoverSurface';
26
26
  //# sourceMappingURL=PopoverSurface.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverSurface/PopoverSurface.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,yBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,cAAA,gBAA2D,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtG,QAAM,KAAK,GAAG,mBAAA,CAAA,iBAAA,CAAkB,KAAlB,EAAyB,GAAzB,CAAd;AAEA,EAAA,yBAAA,CAAA,uBAAA,CAAwB,KAAxB;AACA,SAAO,sBAAA,CAAA,oBAAA,CAAqB,KAArB,CAAP;AACD,CALuE,CAA3D;AAOb,OAAA,CAAA,cAAA,CAAe,WAAf,GAA6B,gBAA7B","sourceRoot":""}
1
+ {"version":3,"sources":["components/PopoverSurface/PopoverSurface.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,yBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,cAAA,gBAA2D,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtG,QAAM,KAAK,GAAG,mBAAA,CAAA,0BAAA,CAA2B,KAA3B,EAAkC,GAAlC,CAAd;AAEA,EAAA,yBAAA,CAAA,gCAAA,CAAiC,KAAjC;AACA,SAAO,sBAAA,CAAA,6BAAA,CAA8B,KAA9B,CAAP;AACD,CALuE,CAA3D;AAOb,OAAA,CAAA,cAAA,CAAe,WAAf,GAA6B,gBAA7B","sourcesContent":["import * as React from 'react';\nimport { usePopoverSurface_unstable } from './usePopoverSurface';\nimport { renderPopoverSurface_unstable } from './renderPopoverSurface';\nimport { usePopoverSurfaceStyles_unstable } from './usePopoverSurfaceStyles';\nimport type { PopoverSurfaceProps } from './PopoverSurface.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\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 return renderPopoverSurface_unstable(state);\n});\n\nPopoverSurface.displayName = 'PopoverSurface';\n"],"sourceRoot":"../src/"}
@@ -1,4 +1,4 @@
1
- import type { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';
1
+ import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
2
2
  import type { PopoverContextValue } from '../../popoverContext';
3
3
  /**
4
4
  * PopoverSurface Props
@@ -8,7 +8,7 @@ export declare type PopoverSurfaceProps = ComponentProps<PopoverSurfaceSlots>;
8
8
  * Names of the slots in PopoverSurfaceProps
9
9
  */
10
10
  export declare type PopoverSurfaceSlots = {
11
- root: IntrinsicShorthandProps<'div'>;
11
+ root: Slot<'div'>;
12
12
  };
13
13
  /**
14
14
  * PopoverSurface State
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverSurface/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["components/PopoverSurface/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './PopoverSurface';\nexport * from './PopoverSurface.types';\nexport * from './renderPopoverSurface';\nexport * from './usePopoverSurface';\nexport * from './usePopoverSurfaceStyles';\n"],"sourceRoot":"../src/"}
@@ -2,4 +2,4 @@ import type { PopoverSurfaceState } from './PopoverSurface.types';
2
2
  /**
3
3
  * Render the final JSX of PopoverSurface
4
4
  */
5
- export declare const renderPopoverSurface: (state: PopoverSurfaceState) => JSX.Element | null;
5
+ export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element | null;
@@ -3,25 +3,23 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.renderPopoverSurface = void 0;
6
+ exports.renderPopoverSurface_unstable = void 0;
7
7
 
8
8
  const React = /*#__PURE__*/require("react");
9
9
 
10
10
  const react_portal_1 = /*#__PURE__*/require("@fluentui/react-portal");
11
11
 
12
12
  const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
13
-
14
- const usePopoverSurface_1 = /*#__PURE__*/require("./usePopoverSurface");
15
13
  /**
16
14
  * Render the final JSX of PopoverSurface
17
15
  */
18
16
 
19
17
 
20
- const renderPopoverSurface = state => {
18
+ const renderPopoverSurface_unstable = state => {
21
19
  const {
22
20
  slots,
23
21
  slotProps
24
- } = react_utilities_1.getSlots(state, usePopoverSurface_1.popoverSurfaceSlots); // TODO should hidden Popovers be supported ?
22
+ } = react_utilities_1.getSlots(state); // TODO should hidden Popovers be supported ?
25
23
 
26
24
  if (!state.open) {
27
25
  return null;
@@ -29,11 +27,12 @@ const renderPopoverSurface = state => {
29
27
 
30
28
  return React.createElement(react_portal_1.Portal, {
31
29
  mountNode: state.mountNode
32
- }, React.createElement(slots.root, Object.assign({}, slotProps.root), !state.noArrow && React.createElement("div", {
30
+ }, React.createElement(slots.root, { ...slotProps.root
31
+ }, !state.noArrow && React.createElement("div", {
33
32
  ref: state.arrowRef,
34
33
  className: state.arrowClassName
35
34
  }), slotProps.root.children));
36
35
  };
37
36
 
38
- exports.renderPopoverSurface = renderPopoverSurface;
37
+ exports.renderPopoverSurface_unstable = renderPopoverSurface_unstable;
39
38
  //# sourceMappingURL=renderPopoverSurface.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverSurface/renderPopoverSurface.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;AAEA;;AAEG;;;AACI,MAAM,oBAAoB,GAAI,KAAD,IAA+B;AACjE,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,iBAAA,CAAA,QAAA,CAA8B,KAA9B,EAAqC,mBAAA,CAAA,mBAArC,CAA7B,CADiE,CAGjE;;AACA,MAAI,CAAC,KAAK,CAAC,IAAX,EAAiB;AACf,WAAO,IAAP;AACD;;AAED,SACE,KAAA,CAAA,aAAA,CAAC,cAAA,CAAA,MAAD,EAAO;AAAC,IAAA,SAAS,EAAE,KAAK,CAAC;AAAlB,GAAP,EACE,KA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AV,CAAe,QAFlB,CADF,CADF;AAQD,CAhBM;;AAAM,OAAA,CAAA,6BAAA,GAA6B,6BAA7B","sourcesContent":["import * as React from 'react';\nimport { Portal } from '@fluentui/react-portal';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface.types';\n\n/**\n * Render the final JSX of PopoverSurface\n */\nexport const renderPopoverSurface_unstable = (state: PopoverSurfaceState) => {\n const { slots, slotProps } = getSlots<PopoverSurfaceSlots>(state);\n\n // TODO should hidden Popovers be supported ?\n if (!state.open) {\n return null;\n }\n\n return (\n <Portal mountNode={state.mountNode}>\n <slots.root {...slotProps.root}>\n {!state.noArrow && <div ref={state.arrowRef} className={state.arrowClassName} />}\n {slotProps.root.children}\n </slots.root>\n </Portal>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -1,13 +1,12 @@
1
1
  import * as React from 'react';
2
- import type { PopoverSurfaceProps, PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface.types';
3
- export declare const popoverSurfaceSlots: Array<keyof PopoverSurfaceSlots>;
2
+ import type { PopoverSurfaceProps, PopoverSurfaceState } from './PopoverSurface.types';
4
3
  /**
5
4
  * Create the state required to render PopoverSurface.
6
5
  *
7
- * The returned state can be modified with hooks such as usePopoverSurfaceStyles,
8
- * before being passed to renderPopoverSurface.
6
+ * The returned state can be modified with hooks such as usePopoverSurfaceStyles_unstable,
7
+ * before being passed to renderPopoverSurface_unstable.
9
8
  *
10
9
  * @param props - props from this instance of PopoverSurface
11
10
  * @param ref - reference to root HTMLDivElement of PopoverSurface
12
11
  */
13
- export declare const usePopoverSurface: (props: PopoverSurfaceProps, ref: React.Ref<HTMLDivElement>) => PopoverSurfaceState;
12
+ export declare const usePopoverSurface_unstable: (props: PopoverSurfaceProps, ref: React.Ref<HTMLDivElement>) => PopoverSurfaceState;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.usePopoverSurface = exports.popoverSurfaceSlots = void 0;
6
+ exports.usePopoverSurface_unstable = void 0;
7
7
 
8
8
  const React = /*#__PURE__*/require("react");
9
9
 
@@ -12,29 +12,28 @@ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
12
12
  const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
13
13
 
14
14
  const popoverContext_1 = /*#__PURE__*/require("../../popoverContext");
15
-
16
- exports.popoverSurfaceSlots = ['root'];
17
15
  /**
18
16
  * Create the state required to render PopoverSurface.
19
17
  *
20
- * The returned state can be modified with hooks such as usePopoverSurfaceStyles,
21
- * before being passed to renderPopoverSurface.
18
+ * The returned state can be modified with hooks such as usePopoverSurfaceStyles_unstable,
19
+ * before being passed to renderPopoverSurface_unstable.
22
20
  *
23
21
  * @param props - props from this instance of PopoverSurface
24
22
  * @param ref - reference to root HTMLDivElement of PopoverSurface
25
23
  */
26
24
 
27
- const usePopoverSurface = (props, ref) => {
28
- const contentRef = popoverContext_1.usePopoverContext(context => context.contentRef);
29
- const open = popoverContext_1.usePopoverContext(context => context.open);
30
- const openOnHover = popoverContext_1.usePopoverContext(context => context.openOnHover);
31
- const setOpen = popoverContext_1.usePopoverContext(context => context.setOpen);
32
- const mountNode = popoverContext_1.usePopoverContext(context => context.mountNode);
33
- const arrowRef = popoverContext_1.usePopoverContext(context => context.arrowRef);
34
- const size = popoverContext_1.usePopoverContext(context => context.size);
35
- const noArrow = popoverContext_1.usePopoverContext(context => context.noArrow);
36
- const appearance = popoverContext_1.usePopoverContext(context => context.appearance);
37
- const trapFocus = popoverContext_1.usePopoverContext(context => context.trapFocus);
25
+
26
+ const usePopoverSurface_unstable = (props, ref) => {
27
+ const contentRef = popoverContext_1.usePopoverContext_unstable(context => context.contentRef);
28
+ const open = popoverContext_1.usePopoverContext_unstable(context => context.open);
29
+ const openOnHover = popoverContext_1.usePopoverContext_unstable(context => context.openOnHover);
30
+ const setOpen = popoverContext_1.usePopoverContext_unstable(context => context.setOpen);
31
+ const mountNode = popoverContext_1.usePopoverContext_unstable(context => context.mountNode);
32
+ const arrowRef = popoverContext_1.usePopoverContext_unstable(context => context.arrowRef);
33
+ const size = popoverContext_1.usePopoverContext_unstable(context => context.size);
34
+ const noArrow = popoverContext_1.usePopoverContext_unstable(context => context.noArrow);
35
+ const appearance = popoverContext_1.usePopoverContext_unstable(context => context.appearance);
36
+ const trapFocus = popoverContext_1.usePopoverContext_unstable(context => context.trapFocus);
38
37
  const {
39
38
  modalAttributes
40
39
  } = react_tabster_1.useModalAttributes({
@@ -52,7 +51,8 @@ const usePopoverSurface = (props, ref) => {
52
51
  },
53
52
  root: react_utilities_1.getNativeElementProps('div', {
54
53
  ref: react_utilities_1.useMergedRefs(ref, contentRef),
55
- role: 'dialog',
54
+ role: trapFocus ? 'dialog' : 'complementary',
55
+ 'aria-modal': trapFocus ? true : undefined,
56
56
  ...modalAttributes,
57
57
  ...props
58
58
  })
@@ -103,5 +103,5 @@ const usePopoverSurface = (props, ref) => {
103
103
  return state;
104
104
  };
105
105
 
106
- exports.usePopoverSurface = usePopoverSurface;
106
+ exports.usePopoverSurface_unstable = usePopoverSurface_unstable;
107
107
  //# sourceMappingURL=usePopoverSurface.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverSurface/usePopoverSurface.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;;AAGa,OAAA,CAAA,mBAAA,GAAwD,CAAC,MAAD,CAAxD;AAEb;;;;;;;;AAQG;;AACI,MAAM,iBAAiB,GAAG,CAAC,KAAD,EAA6B,GAA7B,KAAoF;AACnH,QAAM,UAAU,GAAG,gBAAA,CAAA,iBAAA,CAAkB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K,CAAC,IAAN,IAAc,UAAU,CAAC,OAA7B,EAAsC;AACpC,YAAM,cAAc,GAAG,kBAAkB,CAAC,UAAU,CAAC,OAAZ,CAAzC;AACA,MAAA,cAAc,KAAA,IAAd,IAAA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,KAAhB,EAAA;AACD;AACF,GALD,EAKG,CAAC,UAAD,EAAa,kBAAb,EAAiC,KAAK,CAAC,IAAvC,CALH;AAMA,SAAO,KAAP;AACD,CA3EM;;AAAM,OAAA,CAAA,0BAAA,GAA0B,0BAA1B","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusFinders, 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 open = usePopoverContext_unstable(context => context.open);\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 noArrow = usePopoverContext_unstable(context => context.noArrow);\n const appearance = usePopoverContext_unstable(context => context.appearance);\n const trapFocus = usePopoverContext_unstable(context => context.trapFocus);\n const { modalAttributes } = useModalAttributes({ trapFocus });\n\n const state: PopoverSurfaceState = {\n appearance,\n noArrow,\n size,\n arrowRef,\n open,\n mountNode,\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, contentRef),\n role: trapFocus ? 'dialog' : 'complementary',\n 'aria-modal': trapFocus ? true : undefined,\n ...modalAttributes,\n ...props,\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 setOpen(e, false);\n }\n\n onKeyDownOriginal?.(e);\n };\n\n const { findFirstFocusable } = useFocusFinders();\n\n React.useEffect(() => {\n if (state.open && contentRef.current) {\n const firstFocusable = findFirstFocusable(contentRef.current);\n firstFocusable?.focus();\n }\n }, [contentRef, findFirstFocusable, state.open]);\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -5,4 +5,4 @@ export declare const arrowHeights: Record<PopoverSize, number>;
5
5
  /**
6
6
  * Apply styling to the PopoverSurface slots based on the state
7
7
  */
8
- export declare const usePopoverSurfaceStyles: (state: PopoverSurfaceState) => PopoverSurfaceState;
8
+ export declare const usePopoverSurfaceStyles_unstable: (state: PopoverSurfaceState) => PopoverSurfaceState;
@@ -3,9 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.usePopoverSurfaceStyles = exports.arrowHeights = exports.popoverSurfaceClassName = void 0;
6
+ exports.usePopoverSurfaceStyles_unstable = exports.arrowHeights = exports.popoverSurfaceClassName = void 0;
7
7
 
8
- const react_make_styles_1 = /*#__PURE__*/require("@fluentui/react-make-styles");
8
+ const react_1 = /*#__PURE__*/require("@griffel/react");
9
+
10
+ const react_positioning_1 = /*#__PURE__*/require("@fluentui/react-positioning");
11
+
12
+ const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
9
13
 
10
14
  exports.popoverSurfaceClassName = 'fui-PopoverSurface';
11
15
  exports.arrowHeights = {
@@ -17,11 +21,14 @@ exports.arrowHeights = {
17
21
  * Styles for the root slot
18
22
  */
19
23
 
20
- const useStyles = /*#__PURE__*/react_make_styles_1.__styles({
24
+ const useStyles = /*#__PURE__*/react_1.__styles({
21
25
  "root": {
22
26
  "De3pzq": "fxugw4r",
23
- "E5pizo": ["f1hg901r", "f136t921"],
24
- "Dimara": "ff3glw6",
27
+ "E5pizo": "f1hg901r",
28
+ "Bbmb7ep": ["fff7au0", "f1bjk9e1"],
29
+ "Beyfa6y": ["f1bjk9e1", "fff7au0"],
30
+ "B7oj6ja": ["fwsfkhu", "f8wkphi"],
31
+ "Btl43ni": ["f8wkphi", "fwsfkhu"],
25
32
  "B4j52fo": "f5ogflp",
26
33
  "Bekrc4i": ["f1hqa2wf", "finvdd3"],
27
34
  "Bn0qgzm": "f1f09k3d",
@@ -62,50 +69,56 @@ const useStyles = /*#__PURE__*/react_make_styles_1.__styles({
62
69
  "uwmqm3": ["fekwl8i", "fat0sn4"]
63
70
  },
64
71
  "smallArrow": {
65
- "a9b677": "f1smug5u",
66
- "Bqenvij": "f11ci07v"
72
+ "a9b677": "f1ekdpwm",
73
+ "Bqenvij": "f83vc9z"
67
74
  },
68
75
  "mediumLargeArrow": {
69
- "a9b677": "ftmg478",
70
- "Bqenvij": "f7bsbfx"
76
+ "a9b677": "f1kmc0fn",
77
+ "Bqenvij": "fb6lvc5"
71
78
  },
72
79
  "arrow": {
73
80
  "qhf8xq": "f1euv43f",
74
- "ayd6f0": "f1uo6wrk",
81
+ "De3pzq": "f1u2r49w",
75
82
  "Bcdw1i0": "fd7fpy0",
76
83
  "Bj3rh1h": "f1bsuimh",
77
84
  "rurcny": "fuzzvh5",
78
- "zf3lio": "f1qudtws",
85
+ "Bex5imi": "fkk33zh",
79
86
  "xx9plb": "fxf9f1y",
87
+ "Bmqnesq": "f170vdtw",
80
88
  "Bdn98qo": "f103af6e",
81
89
  "Bbc2r3f": "f15umuo5",
82
- "B4zgs9e": "ffo048g",
83
- "Bex5imi": "fkk33zh",
90
+ "B1dvbpk": "f3wpjpt",
91
+ "D4ky5z": "f1k3tce7",
92
+ "cqycoz": "f1dkdgqi",
93
+ "I89eb": "f5ghsz",
94
+ "k1i1uq": "fyqop9u",
95
+ "Epwjcz": "f1m5ya7j",
96
+ "Bp1vogq": "f3sp63x",
84
97
  "px8gyy": ["f5bg3dr", "f1rfdd74"],
85
- "h6z6rw": ["fzd2j21", "f2549he"],
86
- "hl6cv3": "fotnskf",
98
+ "h6z6rw": "fzd2j21",
99
+ "hl6cv3": "f1773hnp",
87
100
  "Bh2vraf": "f1n8855c",
88
- "yayu3t": ["f1nq055x", "f13ohf3"],
101
+ "yayu3t": "f1v7783n",
89
102
  "wedwtw": "fsw6im5",
90
- "rhl9o9": "ftghsr9",
103
+ "rhl9o9": "fh2hsk5",
91
104
  "Bu8t5uz": "f159pzir",
92
- "B6q6orb": ["f1l8vbt4", "fsxzh25"],
105
+ "B6q6orb": "f11yvu4",
93
106
  "Bwwlvwl": "fm1ycve"
94
107
  }
95
108
  }, {
96
- "d": [".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".f1hg901r{box-shadow:var(--shadow16);}", ".f136t921{box-shadow:var(--shadow-16);}", ".ff3glw6{border-radius:4px;}", ".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);}", ".f1c73kur{background-color:var(--colorNeutralForeground1);}", ".fqpbvvt{color:var(--colorNeutralForegroundInverted);}", ".ffp7eso{background-color:var(--colorBrandBackground);}", ".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;}", ".f1smug5u{width:8.485281374238571px;}", ".f11ci07v{height:8.485281374238571px;}", ".ftmg478{width:11.313708498984761px;}", ".f7bsbfx{height:11.313708498984761px;}", ".f1euv43f{position:absolute;}", ".f1uo6wrk{background:inherit;}", ".fd7fpy0{visibility:hidden;}", ".f1bsuimh{z-index:-1;}", ".fuzzvh5:before{content:\"\";}", ".f1qudtws:before{border-radius:4px;}", ".fxf9f1y:before{position:absolute;}", ".f103af6e:before{width:inherit;}", ".f15umuo5:before{height:inherit;}", ".ffo048g:before{background:inherit;}", ".fkk33zh:before{visibility:visible;}", ".f5bg3dr:before{border-bottom-right-radius:var(--borderRadiusSmall);}", ".f1rfdd74:before{border-bottom-left-radius:var(--borderRadiusSmall);}", ".fzd2j21:before{-webkit-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-moz-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-ms-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);}", ".f2549he:before{-webkit-transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);-moz-transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);-ms-transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);}", "[data-popper-placement^=\"top\"] .fotnskf{bottom:0;}", "[data-popper-placement^=\"top\"] .f1n8855c{--angle:0;}", "[data-popper-placement^=\"right\"] .f1nq055x{left:0;}", "[data-popper-placement^=\"right\"] .f13ohf3{right:0;}", "[data-popper-placement^=\"right\"] .fsw6im5{--angle:90deg;}", "[data-popper-placement^=\"bottom\"] .ftghsr9{top:0;}", "[data-popper-placement^=\"bottom\"] .f159pzir{--angle:180deg;}", "[data-popper-placement^=\"left\"] .f1l8vbt4{right:0;}", "[data-popper-placement^=\"left\"] .fsxzh25{left:0;}", "[data-popper-placement^=\"left\"] .fm1ycve{--angle:270deg;}"]
109
+ "d": [".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".f1hg901r{box-shadow:var(--shadow16);}", ".fff7au0{border-bottom-right-radius:4px;}", ".f1bjk9e1{border-bottom-left-radius:4px;}", ".fwsfkhu{border-top-right-radius:4px;}", ".f8wkphi{border-top-left-radius:4px;}", ".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);}", ".f1c73kur{background-color:var(--colorNeutralForeground1);}", ".fqpbvvt{color:var(--colorNeutralForegroundInverted);}", ".ffp7eso{background-color:var(--colorBrandBackground);}", ".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;}", ".fuzzvh5:before{content:\"\";}", ".fkk33zh:before{visibility:visible;}", ".fxf9f1y:before{position:absolute;}", ".f170vdtw:before{box-sizing:border-box;}", ".f103af6e:before{width:inherit;}", ".f15umuo5:before{height:inherit;}", ".f3wpjpt:before{background-color:inherit;}", ".f1k3tce7:before{border-right-width:1px;}", ".f1dkdgqi:before{border-right-style:solid;}", ".f5ghsz:before{border-right-color:var(--colorTransparentStroke);}", ".fyqop9u:before{border-bottom-width:1px;}", ".f1m5ya7j:before{border-bottom-style:solid;}", ".f3sp63x:before{border-bottom-color:var(--colorTransparentStroke);}", ".f5bg3dr:before{border-bottom-right-radius:var(--borderRadiusSmall);}", ".f1rfdd74:before{border-bottom-left-radius:var(--borderRadiusSmall);}", ".fzd2j21:before{-webkit-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-moz-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-ms-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);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;}"]
97
110
  });
98
111
  /**
99
112
  * Apply styling to the PopoverSurface slots based on the state
100
113
  */
101
114
 
102
115
 
103
- const usePopoverSurfaceStyles = state => {
116
+ const usePopoverSurfaceStyles_unstable = state => {
104
117
  const styles = useStyles();
105
- state.root.className = react_make_styles_1.mergeClasses(exports.popoverSurfaceClassName, 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);
106
- state.arrowClassName = react_make_styles_1.mergeClasses(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);
118
+ state.root.className = react_1.mergeClasses(exports.popoverSurfaceClassName, 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);
119
+ state.arrowClassName = react_1.mergeClasses(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);
107
120
  return state;
108
121
  };
109
122
 
110
- exports.usePopoverSurfaceStyles = usePopoverSurfaceStyles;
123
+ exports.usePopoverSurfaceStyles_unstable = usePopoverSurfaceStyles_unstable;
111
124
  //# sourceMappingURL=usePopoverSurfaceStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverSurface/usePopoverSurfaceStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAIa,OAAA,CAAA,uBAAA,GAA0B,oBAA1B;AAEA,OAAA,CAAA,YAAA,GAA4C;AACvD,EAAA,KAAK,EAAE,C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ClG,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CACrB,OAAA,CAAA,uBADqB,EAErB,MAAM,CAAC,IAFc,EAGrB,KAAK,CAAC,IAAN,KAAe,OAAf,IAA0B,MAAM,CAAC,YAHZ,EAIrB,KAAK,CAAC,IAAN,KAAe,QAAf,IAA2B,MAAM,CAAC,aAJb,EAKrB,KAAK,CAAC,IAAN,KAAe,OAAf,IAA0B,MAAM,CAAC,YALZ,EAMrB,KAAK,CAAC,UAAN,KAAqB,UAArB,IAAmC,MAAM,CAAC,QANrB,EAOrB,KAAK,CAAC,UAAN,KAAqB,OAArB,IAAgC,MAAM,CAAC,KAPlB,EAQrB,KAAK,CAAC,IAAN,CAAW,SARU,CAAvB;AAWA,EAAA,KAAK,CAAC,cAAN,GAAuB,OAAA,CAAA,YAAA,CACrB,MAAM,CAAC,KADc,EAErB,KAAK,CAAC,IAAN,KAAe,OAAf,GAAyB,MAAM,CAAC,UAAhC,GAA6C,MAAM,CAAC,gBAF/B,CAAvB;AAKA,SAAO,KAAP;AACD,CAnBM;;AAAM,OAAA,CAAA,gCAAA,GAAgC,gCAAhC","sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { createArrowHeightStyles, createArrowStyles } from '@fluentui/react-positioning';\nimport { tokens } from '@fluentui/react-theme';\nimport type { PopoverSize } from '../Popover/Popover.types';\nimport type { PopoverSurfaceState } from './PopoverSurface.types';\n\nexport const popoverSurfaceClassName = 'fui-PopoverSurface';\n\nexport const arrowHeights: Record<PopoverSize, number> = {\n small: 6,\n medium: 8,\n large: 8,\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow16,\n ...shorthands.borderRadius('4px'),\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n },\n\n inverted: {\n // TODO: neutral background inverted missing from superset and theme\n backgroundColor: tokens.colorNeutralForeground1,\n color: tokens.colorNeutralForegroundInverted,\n },\n\n brand: {\n backgroundColor: tokens.colorBrandBackground,\n // TODO: clarify with designers what foreground color should be with brand background,\n color: tokens.colorNeutralForegroundInverted,\n },\n\n smallPadding: {\n ...shorthands.padding('12px'),\n },\n\n mediumPadding: {\n ...shorthands.padding('16px'),\n },\n\n largePadding: {\n ...shorthands.padding('20px'),\n },\n\n smallArrow: createArrowHeightStyles(arrowHeights.small),\n mediumLargeArrow: createArrowHeightStyles(arrowHeights.medium),\n arrow: createArrowStyles({ arrowHeight: undefined }),\n});\n\n/**\n * Apply styling to the PopoverSurface slots based on the state\n */\nexport const usePopoverSurfaceStyles_unstable = (state: PopoverSurfaceState): PopoverSurfaceState => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n popoverSurfaceClassName,\n styles.root,\n state.size === 'small' && styles.smallPadding,\n state.size === 'medium' && styles.mediumPadding,\n state.size === 'large' && styles.largePadding,\n state.appearance === 'inverted' && styles.inverted,\n state.appearance === 'brand' && styles.brand,\n state.root.className,\n );\n\n state.arrowClassName = mergeClasses(\n styles.arrow,\n state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
+ import type { FluentTriggerComponent } from '@fluentui/react-utilities';
2
3
  import type { PopoverTriggerProps } from './PopoverTrigger.types';
3
4
  /**
4
5
  * Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
5
6
  */
6
- export declare const PopoverTrigger: React.FC<PopoverTriggerProps>;
7
+ export declare const PopoverTrigger: React.FC<PopoverTriggerProps> & FluentTriggerComponent;
@@ -14,10 +14,11 @@ const renderPopoverTrigger_1 = /*#__PURE__*/require("./renderPopoverTrigger");
14
14
 
15
15
 
16
16
  const PopoverTrigger = props => {
17
- const state = usePopoverTrigger_1.usePopoverTrigger(props);
18
- return renderPopoverTrigger_1.renderPopoverTrigger(state);
17
+ const state = usePopoverTrigger_1.usePopoverTrigger_unstable(props);
18
+ return renderPopoverTrigger_1.renderPopoverTrigger_unstable(state);
19
19
  };
20
20
 
21
21
  exports.PopoverTrigger = PopoverTrigger;
22
22
  exports.PopoverTrigger.displayName = 'PopoverTrigger';
23
+ exports.PopoverTrigger.isFluentTriggerComponent = true;
23
24
  //# sourceMappingURL=PopoverTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":";;;;;;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,cAAc,GAAkC,KAAK,IAAG;AACnE,QAAM,KAAK,GAAG,mBAAA,CAAA,iBAAA,CAAkB,KAAlB,CAAd;AAEA,SAAO,sBAAA,CAAA,oBAAA,CAAqB,KAArB,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd;AAMb,OAAA,CAAA,cAAA,CAAe,WAAf,GAA6B,gBAA7B","sourceRoot":""}
1
+ {"version":3,"sources":["components/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":";;;;;;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAIA;;AAEG;;;AACI,MAAM,cAAc,GAA2D,KAAK,IAAG;AAC5F,QAAM,KAAK,GAAG,mBAAA,CAAA,0BAAA,CAA2B,KAA3B,CAAd;AAEA,SAAO,sBAAA,CAAA,6BAAA,CAA8B,KAA9B,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd;AAMb,OAAA,CAAA,cAAA,CAAe,WAAf,GAA6B,gBAA7B;AACA,OAAA,CAAA,cAAA,CAAe,wBAAf,GAA0C,IAA1C","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> & FluentTriggerComponent = props => {\n const state = usePopoverTrigger_unstable(props);\n\n return renderPopoverTrigger_unstable(state);\n};\n\nPopoverTrigger.displayName = 'PopoverTrigger';\nPopoverTrigger.isFluentTriggerComponent = true;\n"],"sourceRoot":"../src/"}
@@ -3,9 +3,16 @@ import * as React from 'react';
3
3
  * PopoverTrigger Props
4
4
  */
5
5
  export declare type PopoverTriggerProps = {
6
- children: React.ReactElement;
6
+ children: (React.ReactElement & {
7
+ ref?: React.Ref<unknown>;
8
+ }) | ((props: PopoverTriggerChildProps) => React.ReactElement | null);
7
9
  };
8
10
  /**
9
11
  * PopoverTrigger State
10
12
  */
11
- export declare type PopoverTriggerState = PopoverTriggerProps;
13
+ export declare type PopoverTriggerState = {
14
+ children: React.ReactElement | null;
15
+ };
16
+ export declare type PopoverTriggerChildProps = {
17
+ ref?: React.Ref<never>;
18
+ } & Pick<React.HTMLAttributes<HTMLElement>, 'aria-haspopup' | 'onClick' | 'onMouseEnter' | 'onKeyDown' | 'onMouseLeave' | 'onContextMenu'>;
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["components/PopoverTrigger/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './PopoverTrigger';\nexport * from './PopoverTrigger.types';\nexport * from './renderPopoverTrigger';\nexport * from './usePopoverTrigger';\n"],"sourceRoot":"../src/"}
@@ -2,4 +2,4 @@ import type { PopoverTriggerState } from './PopoverTrigger.types';
2
2
  /**
3
3
  * Render the final JSX of PopoverTrigger
4
4
  */
5
- export declare const renderPopoverTrigger: (state: PopoverTriggerState) => JSX.Element;
5
+ export declare const renderPopoverTrigger_unstable: (state: PopoverTriggerState) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
@@ -3,14 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.renderPopoverTrigger = void 0;
6
+ exports.renderPopoverTrigger_unstable = void 0;
7
7
  /**
8
8
  * Render the final JSX of PopoverTrigger
9
9
  */
10
10
 
11
- const renderPopoverTrigger = state => {
11
+ const renderPopoverTrigger_unstable = state => {
12
12
  return state.children;
13
13
  };
14
14
 
15
- exports.renderPopoverTrigger = renderPopoverTrigger;
15
+ exports.renderPopoverTrigger_unstable = renderPopoverTrigger_unstable;
16
16
  //# sourceMappingURL=renderPopoverTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":";;;;;;AAEA;;AAEG;;AACI,MAAM,oBAAoB,GAAI,KAAD,IAA4C;AAC9E,SAAO,KAAK,CAAC,QAAb;AACD,CAFM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourceRoot":""}
1
+ {"version":3,"sources":["components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":";;;;;;AAEA;;AAEG;;AACI,MAAM,6BAA6B,GAAI,KAAD,IAA+B;AAC1E,SAAO,KAAK,CAAC,QAAb;AACD,CAFM;;AAAM,OAAA,CAAA,6BAAA,GAA6B,6BAA7B","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"],"sourceRoot":"../src/"}
@@ -3,8 +3,8 @@ import type { PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.
3
3
  * Create the state required to render PopoverTrigger.
4
4
  *
5
5
  * The returned state can be modified with hooks such as usePopoverTriggerStyles,
6
- * before being passed to renderPopoverTrigger.
6
+ * before being passed to renderPopoverTrigger_unstable.
7
7
  *
8
8
  * @param props - props from this instance of PopoverTrigger
9
9
  */
10
- export declare const usePopoverTrigger: (props: PopoverTriggerProps) => PopoverTriggerState;
10
+ export declare const usePopoverTrigger_unstable: (props: PopoverTriggerProps) => PopoverTriggerState;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.usePopoverTrigger = void 0;
6
+ exports.usePopoverTrigger_unstable = void 0;
7
7
 
8
8
  const React = /*#__PURE__*/require("react");
9
9
 
@@ -16,43 +16,44 @@ const popoverContext_1 = /*#__PURE__*/require("../../popoverContext");
16
16
  * Create the state required to render PopoverTrigger.
17
17
  *
18
18
  * The returned state can be modified with hooks such as usePopoverTriggerStyles,
19
- * before being passed to renderPopoverTrigger.
19
+ * before being passed to renderPopoverTrigger_unstable.
20
20
  *
21
21
  * @param props - props from this instance of PopoverTrigger
22
22
  */
23
23
 
24
24
 
25
- const usePopoverTrigger = props => {
26
- const setOpen = popoverContext_1.usePopoverContext(context => context.setOpen);
27
- const open = popoverContext_1.usePopoverContext(context => context.open);
28
- const triggerRef = popoverContext_1.usePopoverContext(context => context.triggerRef);
29
- const openOnHover = popoverContext_1.usePopoverContext(context => context.openOnHover);
30
- const openOnContext = popoverContext_1.usePopoverContext(context => context.openOnContext);
31
- const trapFocus = popoverContext_1.usePopoverContext(context => context.trapFocus);
25
+ const usePopoverTrigger_unstable = props => {
26
+ var _a, _b, _c, _d, _e;
27
+
28
+ const {
29
+ children
30
+ } = props;
31
+ const child = React.isValidElement(children) ? react_utilities_1.getTriggerChild(children) : undefined;
32
+ const setOpen = popoverContext_1.usePopoverContext_unstable(context => context.setOpen);
33
+ const open = popoverContext_1.usePopoverContext_unstable(context => context.open);
34
+ const triggerRef = popoverContext_1.usePopoverContext_unstable(context => context.triggerRef);
35
+ const openOnHover = popoverContext_1.usePopoverContext_unstable(context => context.openOnHover);
36
+ const openOnContext = popoverContext_1.usePopoverContext_unstable(context => context.openOnContext);
37
+ const trapFocus = popoverContext_1.usePopoverContext_unstable(context => context.trapFocus);
32
38
  const {
33
39
  triggerAttributes
34
40
  } = react_tabster_1.useModalAttributes();
35
- const onContextMenu = react_utilities_1.useEventCallback(e => {
36
- var _a, _b;
37
41
 
42
+ const onContextMenu = e => {
38
43
  if (openOnContext) {
39
44
  e.preventDefault();
40
45
  setOpen(e, true);
41
46
  }
47
+ };
42
48
 
43
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onContextMenu) === null || _b === void 0 ? void 0 : _b.call(_a, e);
44
- });
45
- const onClick = react_utilities_1.useEventCallback(e => {
46
- var _a, _b;
47
-
49
+ const onClick = e => {
48
50
  if (!openOnContext) {
49
51
  setOpen(e, !open);
50
52
  }
53
+ };
51
54
 
52
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
53
- });
54
- const onKeyDown = react_utilities_1.useEventCallback(e => {
55
- var _a, _b, _c;
55
+ const onKeyDown = e => {
56
+ var _a;
56
57
 
57
58
  if (react_utilities_1.shouldPreventDefaultOnKeyDown(e) && (e.key === ' ' || e.key === 'Enter')) {
58
59
  e.preventDefault();
@@ -62,41 +63,33 @@ const usePopoverTrigger = props => {
62
63
  if (e.key === 'Escape') {
63
64
  setOpen(e, false);
64
65
  }
66
+ };
65
67
 
66
- (_c = (_b = child.props) === null || _b === void 0 ? void 0 : _b.onKeyDown) === null || _c === void 0 ? void 0 : _c.call(_b, e);
67
- });
68
68
  const onMouseEnter = react_utilities_1.useEventCallback(e => {
69
- var _a, _b;
70
-
71
69
  if (openOnHover) {
72
70
  setOpen(e, true);
73
71
  }
74
-
75
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);
76
72
  });
77
- const onMouseLeave = react_utilities_1.useEventCallback(e => {
78
- var _a, _b;
79
73
 
74
+ const onMouseLeave = e => {
80
75
  if (openOnHover) {
81
76
  setOpen(e, false);
82
77
  }
78
+ };
83
79
 
84
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseLeave) === null || _b === void 0 ? void 0 : _b.call(_a, e);
85
- });
86
- const child = React.Children.only(props.children);
87
80
  return {
88
- children: React.cloneElement(child, { ...triggerAttributes,
81
+ children: react_utilities_1.applyTriggerPropsToChildren(props.children, { ...triggerAttributes,
89
82
  'aria-haspopup': trapFocus ? 'dialog' : 'true',
90
- ...child.props,
91
- onClick,
92
- onMouseEnter,
93
- onKeyDown,
94
- onMouseLeave,
95
- onContextMenu,
96
- ref: react_utilities_1.useMergedRefs(child.ref, triggerRef)
83
+ ...(child === null || child === void 0 ? void 0 : child.props),
84
+ onClick: react_utilities_1.useMergedEventCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onClick, onClick),
85
+ onMouseEnter: react_utilities_1.useMergedEventCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onMouseEnter, onMouseEnter),
86
+ onKeyDown: react_utilities_1.useMergedEventCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onKeyDown, onKeyDown),
87
+ onMouseLeave: react_utilities_1.useMergedEventCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onMouseLeave, onMouseLeave),
88
+ onContextMenu: react_utilities_1.useMergedEventCallbacks((_e = child === null || child === void 0 ? void 0 : child.props) === null || _e === void 0 ? void 0 : _e.onContextMenu, onContextMenu),
89
+ ref: react_utilities_1.useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref)
97
90
  })
98
91
  };
99
92
  };
100
93
 
101
- exports.usePopoverTrigger = usePopoverTrigger;
94
+ exports.usePopoverTrigger_unstable = usePopoverTrigger_unstable;
102
95
  //# sourceMappingURL=usePopoverTrigger.js.map