@fluentui/react-popover 9.0.0-nightly.f81b28ceb3.1 → 9.0.0-rc.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. package/CHANGELOG.json +478 -25
  2. package/CHANGELOG.md +115 -15
  3. package/dist/react-popover.d.ts +36 -23
  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 +5 -5
  8. package/lib/components/Popover/Popover.js.map +1 -1
  9. package/lib/components/Popover/Popover.types.d.ts +7 -4
  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 +27 -25
  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 +42 -53
  17. package/lib/components/Popover/usePopover.js.map +1 -1
  18. package/lib/components/PopoverSurface/PopoverSurface.js +7 -7
  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 +7 -8
  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 +44 -58
  28. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  29. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -1
  30. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +34 -22
  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 +6 -5
  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 +39 -54
  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 +3 -7
  47. package/lib/popoverContext.js.map +1 -1
  48. package/lib-commonjs/Popover.js +1 -1
  49. package/lib-commonjs/Popover.js.map +1 -1
  50. package/lib-commonjs/PopoverSurface.js +1 -1
  51. package/lib-commonjs/PopoverSurface.js.map +1 -1
  52. package/lib-commonjs/PopoverTrigger.js +1 -1
  53. package/lib-commonjs/PopoverTrigger.js.map +1 -1
  54. package/lib-commonjs/components/Popover/Popover.js +5 -5
  55. package/lib-commonjs/components/Popover/Popover.js.map +1 -1
  56. package/lib-commonjs/components/Popover/Popover.types.d.ts +7 -4
  57. package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
  58. package/lib-commonjs/components/Popover/index.js +1 -1
  59. package/lib-commonjs/components/Popover/index.js.map +1 -1
  60. package/lib-commonjs/components/Popover/renderPopover.d.ts +1 -1
  61. package/lib-commonjs/components/Popover/renderPopover.js +31 -29
  62. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  63. package/lib-commonjs/components/Popover/usePopover.d.ts +2 -2
  64. package/lib-commonjs/components/Popover/usePopover.js +50 -62
  65. package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
  66. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +8 -8
  67. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
  68. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +2 -2
  69. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  70. package/lib-commonjs/components/PopoverSurface/index.js +1 -1
  71. package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
  72. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
  73. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +12 -15
  74. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  75. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.d.ts +4 -5
  76. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +50 -65
  77. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  78. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -1
  79. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +38 -24
  80. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  81. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.d.ts +2 -1
  82. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +6 -5
  83. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  84. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.d.ts +9 -2
  85. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  86. package/lib-commonjs/components/PopoverTrigger/index.js +1 -1
  87. package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
  88. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
  89. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +3 -3
  90. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  91. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -2
  92. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +44 -60
  93. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  94. package/lib-commonjs/index.js +1 -1
  95. package/lib-commonjs/index.js.map +1 -1
  96. package/lib-commonjs/popoverContext.d.ts +1 -1
  97. package/lib-commonjs/popoverContext.js +5 -9
  98. package/lib-commonjs/popoverContext.js.map +1 -1
  99. package/package.json +14 -15
  100. package/lib/common/isConformant.d.ts +0 -4
  101. package/lib/common/isConformant.js +0 -13
  102. package/lib/common/isConformant.js.map +0 -1
  103. package/lib/common/mockUsePopoverContext.d.ts +0 -7
  104. package/lib/common/mockUsePopoverContext.js +0 -38
  105. package/lib/common/mockUsePopoverContext.js.map +0 -1
  106. package/lib-commonjs/common/isConformant.d.ts +0 -4
  107. package/lib-commonjs/common/isConformant.js +0 -24
  108. package/lib-commonjs/common/isConformant.js.map +0 -1
  109. package/lib-commonjs/common/mockUsePopoverContext.d.ts +0 -7
  110. package/lib-commonjs/common/mockUsePopoverContext.js +0 -49
  111. package/lib-commonjs/common/mockUsePopoverContext.js.map +0 -1
@@ -1,4 +1,3 @@
1
- import { __assign } from "tslib";
2
1
  import * as React from 'react';
3
2
  import { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside } from '@fluentui/react-utilities';
4
3
  import { useFluent } from '@fluentui/react-shared-contexts';
@@ -9,75 +8,65 @@ import { arrowHeights } from '../PopoverSurface/index';
9
8
  * Create the state required to render Popover.
10
9
  *
11
10
  * The returned state can be modified with hooks such as usePopoverStyles,
12
- * before being passed to renderPopover.
11
+ * before being passed to renderPopover_unstable.
13
12
  *
14
13
  * @param props - props from this instance of Popover
15
14
  */
16
15
 
17
- export var usePopover = function (props) {
18
- var _a = usePopperMouseTarget(),
19
- contextTarget = _a[0],
20
- setContextTarget = _a[1];
21
-
22
- var initialState = __assign({
16
+ export const usePopover_unstable = props => {
17
+ const [contextTarget, setContextTarget] = usePopperMouseTarget();
18
+ const initialState = {
23
19
  size: 'medium',
24
- contextTarget: contextTarget,
25
- setContextTarget: setContextTarget
26
- }, props);
27
-
28
- var _b = useOpenState(initialState),
29
- open = _b[0],
30
- setOpen = _b[1];
31
-
32
- var popperRefs = usePopoverRefs(initialState);
33
- var targetDocument = useFluent().targetDocument;
20
+ contextTarget,
21
+ setContextTarget,
22
+ ...props
23
+ };
24
+ const [open, setOpen] = useOpenState(initialState);
25
+ const popperRefs = usePopoverRefs(initialState);
26
+ const {
27
+ targetDocument
28
+ } = useFluent();
34
29
  useOnClickOutside({
35
30
  contains: elementContains,
36
31
  element: targetDocument,
37
- callback: function (ev) {
38
- return setOpen(ev, false);
39
- },
32
+ callback: ev => setOpen(ev, false),
40
33
  refs: [popperRefs.triggerRef, popperRefs.contentRef],
41
34
  disabled: !open
42
35
  });
43
36
  useOnScrollOutside({
44
37
  contains: elementContains,
45
38
  element: targetDocument,
46
- callback: function (ev) {
47
- return setOpen(ev, false);
48
- },
39
+ callback: ev => setOpen(ev, false),
49
40
  refs: [popperRefs.triggerRef, popperRefs.contentRef],
50
- disabled: !open || !initialState.openOnContext
51
- });
52
- return __assign(__assign(__assign({}, initialState), popperRefs), {
53
- open: open,
54
- setOpen: setOpen,
55
- setContextTarget: setContextTarget,
56
- contextTarget: contextTarget
41
+ disabled: !open || !initialState.openOnContext // only close on scroll for context
42
+
57
43
  });
44
+ return { ...initialState,
45
+ ...popperRefs,
46
+ open,
47
+ setOpen,
48
+ setContextTarget,
49
+ contextTarget
50
+ };
58
51
  };
59
52
  /**
60
53
  * Creates and manages the Popover open state
61
54
  */
62
55
 
63
56
  function useOpenState(state) {
64
- var onOpenChange = useEventCallback(function (e, data) {
57
+ const onOpenChange = useEventCallback((e, data) => {
65
58
  var _a;
66
59
 
67
60
  return (_a = state.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(state, e, data);
68
61
  });
69
-
70
- var _a = useControllableState({
62
+ const [open, setOpenState] = useControllableState({
71
63
  state: state.open,
72
64
  defaultState: state.defaultOpen,
73
65
  initialState: false
74
- }),
75
- open = _a[0],
76
- setOpenState = _a[1];
77
-
66
+ });
78
67
  state.open = open !== undefined ? open : state.open;
79
- var setContextTarget = state.setContextTarget;
80
- var setOpen = React.useCallback(function (e, shouldOpen) {
68
+ const setContextTarget = state.setContextTarget;
69
+ const setOpen = React.useCallback((e, shouldOpen) => {
81
70
  if (shouldOpen && e.type === 'contextmenu') {
82
71
  setContextTarget(e);
83
72
  }
@@ -86,7 +75,7 @@ function useOpenState(state) {
86
75
  setContextTarget(undefined);
87
76
  }
88
77
 
89
- setOpenState(function (prevOpen) {
78
+ setOpenState(prevOpen => {
90
79
  // More than one event (mouse, focus, keyboard) can request the Popover to close
91
80
  // We assume the first event is the correct one
92
81
  if (prevOpen !== shouldOpen) {
@@ -106,12 +95,12 @@ function useOpenState(state) {
106
95
 
107
96
 
108
97
  function usePopoverRefs(state) {
109
- var popperOptions = __assign({
98
+ const popperOptions = {
110
99
  position: 'above',
111
100
  align: 'center',
112
- target: state.openOnContext ? state.contextTarget : undefined
113
- }, resolvePositioningShorthand(state.positioning)); // no reason to render arrow when covering the target
114
-
101
+ target: state.openOnContext ? state.contextTarget : undefined,
102
+ ...resolvePositioningShorthand(state.positioning)
103
+ }; // no reason to render arrow when covering the target
115
104
 
116
105
  if (popperOptions.coverTarget) {
117
106
  state.noArrow = true;
@@ -121,15 +110,15 @@ function usePopoverRefs(state) {
121
110
  popperOptions.offset = mergeArrowOffset(popperOptions.offset, arrowHeights[state.size]);
122
111
  }
123
112
 
124
- var _a = usePopper(popperOptions),
125
- triggerRef = _a.targetRef,
126
- contentRef = _a.containerRef,
127
- arrowRef = _a.arrowRef;
128
-
113
+ const {
114
+ targetRef: triggerRef,
115
+ containerRef: contentRef,
116
+ arrowRef
117
+ } = usePopper(popperOptions);
129
118
  return {
130
- triggerRef: triggerRef,
131
- contentRef: contentRef,
132
- arrowRef: arrowRef
119
+ triggerRef,
120
+ contentRef,
121
+ arrowRef
133
122
  };
134
123
  }
135
124
  //# sourceMappingURL=usePopover.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Popover/usePopover.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SACE,oBADF,EAEE,gBAFF,EAGE,iBAHF,EAIE,kBAJF,QAKO,2BALP;AAMA,SAAS,SAAT,QAA0B,iCAA1B;AACA,SACE,SADF,EAEE,2BAFF,EAGE,gBAHF,EAIE,oBAJF,QAKO,6BALP;AAMA,SAAS,eAAT,QAAgC,wBAAhC;AACA,SAAS,YAAT,QAA6B,yBAA7B;AAGA;;;;;;;AAOG;;AACH,OAAO,IAAM,UAAU,GAAG,UAAC,KAAD,EAAoB;AACtC,MAAA,EAAA,GAAoC,oBAAoB,EAAxD;AAAA,MAAC,aAAa,GAAA,EAAA,CAAA,CAAA,CAAd;AAAA,MAAgB,gBAAgB,GAAA,EAAA,CAAA,CAAA,CAAhC;;AACN,MAAM,YAAY,GAAG,QAAA,CAAA;AACnB,IAAA,IAAI,EAAE,QADa;AAEnB,IAAA,aAAa,EAAA,aAFM;AAGnB,IAAA,gBAAgB,EAAA;AAHG,GAAA,EAIhB,KAJgB,CAArB;;AAOM,MAAA,EAAA,GAAkB,YAAY,CAAC,YAAD,CAA9B;AAAA,MAAC,IAAI,GAAA,EAAA,CAAA,CAAA,CAAL;AAAA,MAAO,OAAO,GAAA,EAAA,CAAA,CAAA,CAAd;;AACN,MAAM,UAAU,GAAG,cAAc,CAAC,YAAD,CAAjC;AAEQ,MAAA,cAAc,GAAK,SAAS,GAAd,cAAd;AACR,EAAA,iBAAiB,CAAC;AAChB,IAAA,QAAQ,EAAE,eADM;AAEhB,IAAA,OAAO,EAAE,cAFO;AAGhB,IAAA,QAAQ,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KAAK,CAAC,aAA5B,GAA4C,SAHhC;AAIpB,OAAG,2BAA2B,CAAC,KAAK,CAAC,WAAP;AAJV,GAAtB,CAFqH,CASrH;;AACA,MAAI,aAAa,CAAC,WAAlB,EAA+B;AAC7B,IAAA,KAAK,CAAC,OAAN,GAAgB,IAAhB;AACD;;AAED,MAAI,CAAC,KAAK,CAAC,OAAX,EAAoB;AAClB,IAAA,aAAa,CAAC,MAAd,GAAuB,gBAAgB,CAAC,aAAa,CAAC,MAAf,EAAuB,YAAY,CAAC,KAAK,CAAC,IAAP,CAAnC,CAAvC;AACD;;AAED,QAAM;AAAE,IAAA,SAAS,EAAE,UAAb;AAAyB,IAAA,YAAY,EAAE,UAAvC;AAAmD,IAAA;AAAnD,MAAgE,SAAS,CAAC,aAAD,CAA/E;AAEA,SAAO;AACL,IAAA,UADK;AAEL,IAAA,UAFK;AAGL,IAAA;AAHK,GAAP;AAKD","sourcesContent":["import * as React from 'react';\nimport {\n useControllableState,\n useEventCallback,\n useOnClickOutside,\n useOnScrollOutside,\n} from '@fluentui/react-utilities';\nimport { useFluent } from '@fluentui/react-shared-contexts';\nimport {\n usePopper,\n resolvePositioningShorthand,\n mergeArrowOffset,\n usePopperMouseTarget,\n} from '@fluentui/react-positioning';\nimport { elementContains } from '@fluentui/react-portal';\nimport { arrowHeights } from '../PopoverSurface/index';\nimport type { OpenPopoverEvents, PopoverProps, PopoverState } from './Popover.types';\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] = usePopperMouseTarget();\n const initialState = {\n size: 'medium',\n contextTarget,\n setContextTarget,\n ...props,\n } as const;\n\n const [open, setOpen] = useOpenState(initialState);\n const popperRefs = usePopoverRefs(initialState);\n\n const { targetDocument } = useFluent();\n useOnClickOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [popperRefs.triggerRef, popperRefs.contentRef],\n disabled: !open,\n });\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [popperRefs.triggerRef, popperRefs.contentRef],\n disabled: !open || !initialState.openOnContext, // only close on scroll for context\n });\n\n return {\n ...initialState,\n ...popperRefs,\n open,\n setOpen,\n setContextTarget,\n contextTarget,\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(prevOpen => {\n // More than one event (mouse, focus, keyboard) can request the Popover to close\n // We assume the first event is the correct one\n if (prevOpen !== shouldOpen) {\n onOpenChange?.(e, { open: shouldOpen });\n }\n\n return shouldOpen;\n });\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'> & Pick<PopoverProps, 'positioning' | 'openOnContext' | 'noArrow'>,\n) {\n const popperOptions = {\n position: 'above' as const,\n align: 'center' as const,\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 (popperOptions.coverTarget) {\n state.noArrow = true;\n }\n\n if (!state.noArrow) {\n popperOptions.offset = mergeArrowOffset(popperOptions.offset, arrowHeights[state.size]);\n }\n\n const { targetRef: triggerRef, containerRef: contentRef, arrowRef } = usePopper(popperOptions);\n\n return {\n triggerRef,\n contentRef,\n arrowRef,\n } as const;\n}\n"],"sourceRoot":"../src/"}
@@ -1,15 +1,15 @@
1
1
  import * as React from 'react';
2
- import { usePopoverSurface } from './usePopoverSurface';
3
- import { renderPopoverSurface } from './renderPopoverSurface';
4
- import { usePopoverSurfaceStyles } from './usePopoverSurfaceStyles';
2
+ import { usePopoverSurface_unstable } from './usePopoverSurface';
3
+ import { renderPopoverSurface_unstable } from './renderPopoverSurface';
4
+ import { usePopoverSurfaceStyles_unstable } from './usePopoverSurfaceStyles';
5
5
  /**
6
6
  * PopoverSurface component renders react children in a positioned box
7
7
  */
8
8
 
9
- export var PopoverSurface = /*#__PURE__*/React.forwardRef(function (props, ref) {
10
- var state = usePopoverSurface(props, ref);
11
- usePopoverSurfaceStyles(state);
12
- return renderPopoverSurface(state);
9
+ export const PopoverSurface = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const state = usePopoverSurface_unstable(props, ref);
11
+ usePopoverSurfaceStyles_unstable(state);
12
+ return renderPopoverSurface_unstable(state);
13
13
  });
14
14
  PopoverSurface.displayName = 'PopoverSurface';
15
15
  //# sourceMappingURL=PopoverSurface.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverSurface/PopoverSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,iBAAT,QAAkC,qBAAlC;AACA,SAAS,oBAAT,QAAqC,wBAArC;AACA,SAAS,uBAAT,QAAwC,2BAAxC;AAIA;;AAEG;;AACH,OAAO,IAAM,cAAc,gBAA6C,KAAK,CAAC,UAAN,CAAiB,UAAC,KAAD,EAAQ,GAAR,EAAW;AAClG,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,CAA/B;AAEA,EAAA,uBAAuB,CAAC,KAAD,CAAvB;AACA,SAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CALuE,CAAjE;AAOP,cAAc,CAAC,WAAf,GAA6B,gBAA7B","sourceRoot":""}
1
+ {"version":3,"sources":["components/PopoverSurface/PopoverSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,0BAAT,QAA2C,qBAA3C;AACA,SAAS,6BAAT,QAA8C,wBAA9C;AACA,SAAS,gCAAT,QAAiD,2BAAjD;AAIA;;AAEG;;AACH,OAAO,MAAM,cAAc,gBAA6C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtG,QAAM,KAAK,GAAG,0BAA0B,CAAC,KAAD,EAAQ,GAAR,CAAxC;AAEA,EAAA,gCAAgC,CAAC,KAAD,CAAhC;AACA,SAAO,6BAA6B,CAAC,KAAD,CAApC;AACD,CALuE,CAAjE;AAOP,cAAc,CAAC,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,"file":"PopoverSurface.types.js","sourceRoot":"","sources":["../../../src/components/PopoverSurface/PopoverSurface.types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"PopoverSurface.types.js","sourceRoot":"../src/","sources":["components/PopoverSurface/PopoverSurface.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { PopoverContextValue } from '../../popoverContext';\n\n/**\n * PopoverSurface Props\n */\nexport type PopoverSurfaceProps = ComponentProps<PopoverSurfaceSlots>;\n\n/**\n * Names of the slots in PopoverSurfaceProps\n */\nexport type PopoverSurfaceSlots = {\n root: Slot<'div'>;\n};\n\n/**\n * PopoverSurface State\n */\nexport type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> &\n Pick<PopoverContextValue, 'open' | 'mountNode' | 'noArrow' | 'size' | 'appearance' | 'arrowRef'> & {\n /**\n * CSS class for the arrow element\n */\n arrowClassName?: string;\n };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/PopoverSurface/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/PopoverSurface/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './PopoverSurface';\nexport * from './PopoverSurface.types';\nexport * from './renderPopoverSurface';\nexport * from './usePopoverSurface';\nexport * from './usePopoverSurfaceStyles';\n"]}
@@ -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;
@@ -1,17 +1,15 @@
1
- import { __assign } from "tslib";
2
1
  import * as React from 'react';
3
2
  import { Portal } from '@fluentui/react-portal';
4
3
  import { getSlots } from '@fluentui/react-utilities';
5
- import { popoverSurfaceSlots } from './usePopoverSurface';
6
4
  /**
7
5
  * Render the final JSX of PopoverSurface
8
6
  */
9
7
 
10
- export var renderPopoverSurface = function (state) {
11
- var _a = getSlots(state, popoverSurfaceSlots),
12
- slots = _a.slots,
13
- slotProps = _a.slotProps; // TODO should hidden Popovers be supported ?
14
-
8
+ export const renderPopoverSurface_unstable = state => {
9
+ const {
10
+ slots,
11
+ slotProps
12
+ } = getSlots(state); // TODO should hidden Popovers be supported ?
15
13
 
16
14
  if (!state.open) {
17
15
  return null;
@@ -19,7 +17,8 @@ export var renderPopoverSurface = function (state) {
19
17
 
20
18
  return /*#__PURE__*/React.createElement(Portal, {
21
19
  mountNode: state.mountNode
22
- }, /*#__PURE__*/React.createElement(slots.root, __assign({}, slotProps.root), !state.noArrow && /*#__PURE__*/React.createElement("div", {
20
+ }, /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
21
+ }, !state.noArrow && /*#__PURE__*/React.createElement("div", {
23
22
  ref: state.arrowRef,
24
23
  className: state.arrowClassName
25
24
  }), slotProps.root.children));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverSurface/renderPopoverSurface.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,MAAT,QAAuB,wBAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAEA,SAAS,mBAAT,QAAoC,qBAApC;AAEA;;AAEG;;AACH,OAAO,IAAM,oBAAoB,GAAG,UAAC,KAAD,EAA2B;AACvD,MAAA,EAAA,GAAuB,QAAQ,CAAsB,KAAtB,EAA6B,mBAA7B,CAA/B;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB,CADuD,CAG7D;;;AACA,MAAI,CAAC,KAAK,CAAC,IAAX,EAAiB;AACf,WAAO,IAAP;AACD;;AAED,sBACE,KAAA,CAAA,aAAA,CAAC,MAAD,EAAO;AAAC,IAAA,SAAS,EAAE,KAAK,CAAC;AAAlB,GAAP,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,CAAC,KAAK,CAAC,OAAP,iBAAkB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,GAAG,EAAE,KAAK,CAAC,QAAhB;AAA0B,IAAA,SAAS,EAAE,KAAK,CAAC;AAA3C,GAAA,CADrB,EAEG,SAAS,CAAC,IAAV,CAAe,QAFlB,CADF,CADF;AAQD,CAhBM","sourceRoot":""}
1
+ {"version":3,"sources":["components/PopoverSurface/renderPopoverSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,MAAT,QAAuB,wBAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,6BAA6B,GAAI,KAAD,IAA+B;AAC1E,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAsB,KAAtB,CAArC,CAD0E,CAG1E;;AACA,MAAI,CAAC,KAAK,CAAC,IAAX,EAAiB;AACf,WAAO,IAAP;AACD;;AAED,sBACE,KAAA,CAAA,aAAA,CAAC,MAAD,EAAO;AAAC,IAAA,SAAS,EAAE,KAAK,CAAC;AAAlB,GAAP,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,CAAC,KAAK,CAAC,OAAP,iBAAkB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,GAAG,EAAE,KAAK,CAAC,QAAhB;AAA0B,IAAA,SAAS,EAAE,KAAK,CAAC;AAA3C,GAAA,CADrB,EAEG,SAAS,CAAC,IAAV,CAAe,QAFlB,CADF,CADF;AAQD,CAhBM","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;
@@ -1,74 +1,58 @@
1
- import { __assign } from "tslib";
2
1
  import * as React from 'react';
3
2
  import { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';
4
3
  import { useFocusFinders, useModalAttributes } from '@fluentui/react-tabster';
5
- import { usePopoverContext } from '../../popoverContext';
6
- export var popoverSurfaceSlots = ['root'];
4
+ import { usePopoverContext_unstable } from '../../popoverContext';
7
5
  /**
8
6
  * Create the state required to render PopoverSurface.
9
7
  *
10
- * The returned state can be modified with hooks such as usePopoverSurfaceStyles,
11
- * before being passed to renderPopoverSurface.
8
+ * The returned state can be modified with hooks such as usePopoverSurfaceStyles_unstable,
9
+ * before being passed to renderPopoverSurface_unstable.
12
10
  *
13
11
  * @param props - props from this instance of PopoverSurface
14
12
  * @param ref - reference to root HTMLDivElement of PopoverSurface
15
13
  */
16
14
 
17
- export var usePopoverSurface = function (props, ref) {
18
- var contentRef = usePopoverContext(function (context) {
19
- return context.contentRef;
15
+ export const usePopoverSurface_unstable = (props, ref) => {
16
+ const contentRef = usePopoverContext_unstable(context => context.contentRef);
17
+ const open = usePopoverContext_unstable(context => context.open);
18
+ const openOnHover = usePopoverContext_unstable(context => context.openOnHover);
19
+ const setOpen = usePopoverContext_unstable(context => context.setOpen);
20
+ const mountNode = usePopoverContext_unstable(context => context.mountNode);
21
+ const arrowRef = usePopoverContext_unstable(context => context.arrowRef);
22
+ const size = usePopoverContext_unstable(context => context.size);
23
+ const noArrow = usePopoverContext_unstable(context => context.noArrow);
24
+ const appearance = usePopoverContext_unstable(context => context.appearance);
25
+ const trapFocus = usePopoverContext_unstable(context => context.trapFocus);
26
+ const {
27
+ modalAttributes
28
+ } = useModalAttributes({
29
+ trapFocus
20
30
  });
21
- var open = usePopoverContext(function (context) {
22
- return context.open;
23
- });
24
- var openOnHover = usePopoverContext(function (context) {
25
- return context.openOnHover;
26
- });
27
- var setOpen = usePopoverContext(function (context) {
28
- return context.setOpen;
29
- });
30
- var mountNode = usePopoverContext(function (context) {
31
- return context.mountNode;
32
- });
33
- var arrowRef = usePopoverContext(function (context) {
34
- return context.arrowRef;
35
- });
36
- var size = usePopoverContext(function (context) {
37
- return context.size;
38
- });
39
- var noArrow = usePopoverContext(function (context) {
40
- return context.noArrow;
41
- });
42
- var appearance = usePopoverContext(function (context) {
43
- return context.appearance;
44
- });
45
- var trapFocus = usePopoverContext(function (context) {
46
- return context.trapFocus;
47
- });
48
- var modalAttributes = useModalAttributes({
49
- trapFocus: trapFocus
50
- }).modalAttributes;
51
- var state = {
52
- appearance: appearance,
53
- noArrow: noArrow,
54
- size: size,
55
- arrowRef: arrowRef,
56
- open: open,
57
- mountNode: mountNode,
31
+ const state = {
32
+ appearance,
33
+ noArrow,
34
+ size,
35
+ arrowRef,
36
+ open,
37
+ mountNode,
58
38
  components: {
59
39
  root: 'div'
60
40
  },
61
- root: getNativeElementProps('div', __assign(__assign({
41
+ root: getNativeElementProps('div', {
62
42
  ref: useMergedRefs(ref, contentRef),
63
- role: 'dialog'
64
- }, modalAttributes), props))
43
+ role: trapFocus ? 'dialog' : 'complementary',
44
+ 'aria-modal': trapFocus ? true : undefined,
45
+ ...modalAttributes,
46
+ ...props
47
+ })
65
48
  };
66
- var _a = state.root,
67
- onMouseEnterOriginal = _a.onMouseEnter,
68
- onMouseLeaveOriginal = _a.onMouseLeave,
69
- onKeyDownOriginal = _a.onKeyDown;
49
+ const {
50
+ onMouseEnter: onMouseEnterOriginal,
51
+ onMouseLeave: onMouseLeaveOriginal,
52
+ onKeyDown: onKeyDownOriginal
53
+ } = state.root;
70
54
 
71
- state.root.onMouseEnter = function (e) {
55
+ state.root.onMouseEnter = e => {
72
56
  if (openOnHover) {
73
57
  setOpen(e, true);
74
58
  }
@@ -76,7 +60,7 @@ export var usePopoverSurface = function (props, ref) {
76
60
  onMouseEnterOriginal === null || onMouseEnterOriginal === void 0 ? void 0 : onMouseEnterOriginal(e);
77
61
  };
78
62
 
79
- state.root.onMouseLeave = function (e) {
63
+ state.root.onMouseLeave = e => {
80
64
  if (openOnHover) {
81
65
  setOpen(e, false);
82
66
  }
@@ -84,7 +68,7 @@ export var usePopoverSurface = function (props, ref) {
84
68
  onMouseLeaveOriginal === null || onMouseLeaveOriginal === void 0 ? void 0 : onMouseLeaveOriginal(e);
85
69
  };
86
70
 
87
- state.root.onKeyDown = function (e) {
71
+ state.root.onKeyDown = e => {
88
72
  var _a; // only close if the event happened inside the current popover
89
73
  // If using a stack of inline popovers, the user should call `stopPropagation` to avoid dismissing the entire stack
90
74
 
@@ -96,10 +80,12 @@ export var usePopoverSurface = function (props, ref) {
96
80
  onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(e);
97
81
  };
98
82
 
99
- var findFirstFocusable = useFocusFinders().findFirstFocusable;
100
- React.useEffect(function () {
83
+ const {
84
+ findFirstFocusable
85
+ } = useFocusFinders();
86
+ React.useEffect(() => {
101
87
  if (state.open && contentRef.current) {
102
- var firstFocusable = findFirstFocusable(contentRef.current);
88
+ const firstFocusable = findFirstFocusable(contentRef.current);
103
89
  firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
104
90
  }
105
91
  }, [contentRef, findFirstFocusable, state.open]);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverSurface/usePopoverSurface.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,qBAAT,EAAgC,aAAhC,QAAqD,2BAArD;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ClF,MAAA,OAAO,CAAC,CAAD,EAAI,KAAJ,CAAP;AACD;;AAED,IAAA,iBAAiB,KAAA,IAAjB,IAAA,iBAAiB,KAAA,KAAA,CAAjB,GAAiB,KAAA,CAAjB,GAAA,iBAAiB,CAAG,CAAH,CAAjB;AACD,GARD;;AAUA,QAAM;AAAE,IAAA;AAAF,MAAyB,eAAe,EAA9C;AAEA,EAAA,KAAK,CAAC,SAAN,CAAgB,MAAK;AACnB,QAAI,KAAK,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","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/"}
@@ -1,7 +1,8 @@
1
1
  import type { PopoverSize } from '../Popover/Popover.types';
2
2
  import type { PopoverSurfaceState } from './PopoverSurface.types';
3
+ export declare const popoverSurfaceClassName = "fui-PopoverSurface";
3
4
  export declare const arrowHeights: Record<PopoverSize, number>;
4
5
  /**
5
6
  * Apply styling to the PopoverSurface slots based on the state
6
7
  */
7
- export declare const usePopoverSurfaceStyles: (state: PopoverSurfaceState) => PopoverSurfaceState;
8
+ export declare const usePopoverSurfaceStyles_unstable: (state: PopoverSurfaceState) => PopoverSurfaceState;
@@ -1,5 +1,8 @@
1
- import { __styles, mergeClasses } from '@fluentui/react-make-styles';
2
- export var arrowHeights = {
1
+ import { shorthands, __styles, mergeClasses } from '@griffel/react';
2
+ import { createArrowHeightStyles, createArrowStyles } from '@fluentui/react-positioning';
3
+ import { tokens } from '@fluentui/react-theme';
4
+ export const popoverSurfaceClassName = 'fui-PopoverSurface';
5
+ export const arrowHeights = {
3
6
  small: 6,
4
7
  medium: 8,
5
8
  large: 8
@@ -8,11 +11,14 @@ export var arrowHeights = {
8
11
  * Styles for the root slot
9
12
  */
10
13
 
11
- var useStyles = /*#__PURE__*/__styles({
14
+ const useStyles = /*#__PURE__*/__styles({
12
15
  "root": {
13
16
  "De3pzq": "fxugw4r",
14
- "E5pizo": ["f1hg901r", "f136t921"],
15
- "Dimara": "ff3glw6",
17
+ "E5pizo": "f1hg901r",
18
+ "Bbmb7ep": ["fff7au0", "f1bjk9e1"],
19
+ "Beyfa6y": ["f1bjk9e1", "fff7au0"],
20
+ "B7oj6ja": ["fwsfkhu", "f8wkphi"],
21
+ "Btl43ni": ["f8wkphi", "fwsfkhu"],
16
22
  "B4j52fo": "f5ogflp",
17
23
  "Bekrc4i": ["f1hqa2wf", "finvdd3"],
18
24
  "Bn0qgzm": "f1f09k3d",
@@ -53,47 +59,53 @@ var useStyles = /*#__PURE__*/__styles({
53
59
  "uwmqm3": ["fekwl8i", "fat0sn4"]
54
60
  },
55
61
  "smallArrow": {
56
- "a9b677": "f1smug5u",
57
- "Bqenvij": "f11ci07v"
62
+ "a9b677": "f1ekdpwm",
63
+ "Bqenvij": "f83vc9z"
58
64
  },
59
65
  "mediumLargeArrow": {
60
- "a9b677": "ftmg478",
61
- "Bqenvij": "f7bsbfx"
66
+ "a9b677": "f1kmc0fn",
67
+ "Bqenvij": "fb6lvc5"
62
68
  },
63
69
  "arrow": {
64
70
  "qhf8xq": "f1euv43f",
65
- "ayd6f0": "f1uo6wrk",
71
+ "De3pzq": "f1u2r49w",
66
72
  "Bcdw1i0": "fd7fpy0",
67
73
  "Bj3rh1h": "f1bsuimh",
68
74
  "rurcny": "fuzzvh5",
69
- "zf3lio": "f1qudtws",
75
+ "Bex5imi": "fkk33zh",
70
76
  "xx9plb": "fxf9f1y",
77
+ "Bmqnesq": "f170vdtw",
71
78
  "Bdn98qo": "f103af6e",
72
79
  "Bbc2r3f": "f15umuo5",
73
- "B4zgs9e": "ffo048g",
74
- "Bex5imi": "fkk33zh",
80
+ "B1dvbpk": "f3wpjpt",
81
+ "D4ky5z": "f1k3tce7",
82
+ "cqycoz": "f1dkdgqi",
83
+ "I89eb": "f5ghsz",
84
+ "k1i1uq": "fyqop9u",
85
+ "Epwjcz": "f1m5ya7j",
86
+ "Bp1vogq": "f3sp63x",
75
87
  "px8gyy": ["f5bg3dr", "f1rfdd74"],
76
- "h6z6rw": ["fzd2j21", "f2549he"],
77
- "hl6cv3": "fotnskf",
88
+ "h6z6rw": "fzd2j21",
89
+ "hl6cv3": "f1773hnp",
78
90
  "Bh2vraf": "f1n8855c",
79
- "yayu3t": ["f1nq055x", "f13ohf3"],
91
+ "yayu3t": "f1v7783n",
80
92
  "wedwtw": "fsw6im5",
81
- "rhl9o9": "ftghsr9",
93
+ "rhl9o9": "fh2hsk5",
82
94
  "Bu8t5uz": "f159pzir",
83
- "B6q6orb": ["f1l8vbt4", "fsxzh25"],
95
+ "B6q6orb": "f11yvu4",
84
96
  "Bwwlvwl": "fm1ycve"
85
97
  }
86
98
  }, {
87
- "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;}"]
99
+ "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;}"]
88
100
  });
89
101
  /**
90
102
  * Apply styling to the PopoverSurface slots based on the state
91
103
  */
92
104
 
93
105
 
94
- export var usePopoverSurfaceStyles = function (state) {
95
- var styles = useStyles();
96
- state.root.className = mergeClasses(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
+ export const usePopoverSurfaceStyles_unstable = state => {
107
+ const styles = useStyles();
108
+ state.root.className = mergeClasses(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);
97
109
  state.arrowClassName = mergeClasses(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);
98
110
  return state;
99
111
  };