@fluentui/react-popover 9.0.0-alpha.45 → 9.0.0-alpha.49

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. package/CHANGELOG.json +267 -3
  2. package/CHANGELOG.md +73 -3
  3. package/Spec.md +6 -6
  4. package/dist/react-popover.d.ts +41 -33
  5. package/lib/Popover.js.map +1 -1
  6. package/lib/PopoverSurface.js.map +1 -1
  7. package/lib/PopoverTrigger.js.map +1 -1
  8. package/lib/common/isConformant.js.map +1 -1
  9. package/lib/common/mockUsePopoverContext.js.map +1 -1
  10. package/lib/components/Popover/Popover.js.map +1 -1
  11. package/lib/components/Popover/Popover.types.d.ts +10 -16
  12. package/lib/components/Popover/Popover.types.js.map +1 -1
  13. package/lib/components/Popover/index.js.map +1 -1
  14. package/lib/components/Popover/renderPopover.js +2 -4
  15. package/lib/components/Popover/renderPopover.js.map +1 -1
  16. package/lib/components/Popover/usePopover.d.ts +1 -2
  17. package/lib/components/Popover/usePopover.js +1 -2
  18. package/lib/components/Popover/usePopover.js.map +1 -1
  19. package/lib/components/PopoverSurface/PopoverSurface.d.ts +19 -2
  20. package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
  21. package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +3 -4
  22. package/lib/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  23. package/lib/components/PopoverSurface/index.js.map +1 -1
  24. package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  25. package/lib/components/PopoverSurface/usePopoverSurface.d.ts +0 -1
  26. package/lib/components/PopoverSurface/usePopoverSurface.js +6 -14
  27. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  28. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +1 -1
  29. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  30. package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  31. package/lib/components/PopoverTrigger/PopoverTrigger.types.d.ts +3 -4
  32. package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  33. package/lib/components/PopoverTrigger/index.js.map +1 -1
  34. package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  35. package/lib/components/PopoverTrigger/usePopoverTrigger.d.ts +1 -2
  36. package/lib/components/PopoverTrigger/usePopoverTrigger.js +5 -5
  37. package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  38. package/lib/index.js.map +1 -1
  39. package/lib/popoverContext.d.ts +2 -3
  40. package/lib/popoverContext.js.map +1 -1
  41. package/lib-commonjs/Popover.js.map +1 -1
  42. package/lib-commonjs/PopoverSurface.js.map +1 -1
  43. package/lib-commonjs/PopoverTrigger.js.map +1 -1
  44. package/lib-commonjs/common/isConformant.js.map +1 -1
  45. package/lib-commonjs/common/mockUsePopoverContext.js.map +1 -1
  46. package/lib-commonjs/components/Popover/Popover.js.map +1 -1
  47. package/lib-commonjs/components/Popover/Popover.types.d.ts +10 -16
  48. package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
  49. package/lib-commonjs/components/Popover/index.js.map +1 -1
  50. package/lib-commonjs/components/Popover/renderPopover.js +2 -4
  51. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  52. package/lib-commonjs/components/Popover/usePopover.d.ts +1 -2
  53. package/lib-commonjs/components/Popover/usePopover.js +1 -2
  54. package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
  55. package/lib-commonjs/components/PopoverSurface/PopoverSurface.d.ts +19 -2
  56. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
  57. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +3 -4
  58. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  59. package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
  60. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  61. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.d.ts +0 -1
  62. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +6 -14
  63. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  64. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +1 -1
  65. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  66. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  67. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.d.ts +3 -4
  68. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  69. package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
  70. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  71. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.d.ts +1 -2
  72. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +5 -5
  73. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  74. package/lib-commonjs/index.js.map +1 -1
  75. package/lib-commonjs/popoverContext.d.ts +2 -3
  76. package/lib-commonjs/popoverContext.js.map +1 -1
  77. package/package.json +11 -11
  78. package/lib-amd/Popover.d.ts +0 -1
  79. package/lib-amd/Popover.js +0 -6
  80. package/lib-amd/Popover.js.map +0 -1
  81. package/lib-amd/PopoverSurface.d.ts +0 -1
  82. package/lib-amd/PopoverSurface.js +0 -6
  83. package/lib-amd/PopoverSurface.js.map +0 -1
  84. package/lib-amd/PopoverTrigger.d.ts +0 -1
  85. package/lib-amd/PopoverTrigger.js +0 -6
  86. package/lib-amd/PopoverTrigger.js.map +0 -1
  87. package/lib-amd/common/isConformant.d.ts +0 -4
  88. package/lib-amd/common/isConformant.js +0 -17
  89. package/lib-amd/common/isConformant.js.map +0 -1
  90. package/lib-amd/common/mockUsePopoverContext.d.ts +0 -7
  91. package/lib-amd/common/mockUsePopoverContext.js +0 -20
  92. package/lib-amd/common/mockUsePopoverContext.js.map +0 -1
  93. package/lib-amd/components/Popover/Popover.d.ts +0 -6
  94. package/lib-amd/components/Popover/Popover.js +0 -15
  95. package/lib-amd/components/Popover/Popover.js.map +0 -1
  96. package/lib-amd/components/Popover/Popover.types.d.ts +0 -106
  97. package/lib-amd/components/Popover/Popover.types.js +0 -5
  98. package/lib-amd/components/Popover/Popover.types.js.map +0 -1
  99. package/lib-amd/components/Popover/index.d.ts +0 -4
  100. package/lib-amd/components/Popover/index.js +0 -9
  101. package/lib-amd/components/Popover/index.js.map +0 -1
  102. package/lib-amd/components/Popover/renderPopover.d.ts +0 -5
  103. package/lib-amd/components/Popover/renderPopover.js +0 -28
  104. package/lib-amd/components/Popover/renderPopover.js.map +0 -1
  105. package/lib-amd/components/Popover/usePopover.d.ts +0 -11
  106. package/lib-amd/components/Popover/usePopover.js +0 -91
  107. package/lib-amd/components/Popover/usePopover.js.map +0 -1
  108. package/lib-amd/components/PopoverSurface/PopoverSurface.d.ts +0 -6
  109. package/lib-amd/components/PopoverSurface/PopoverSurface.js +0 -15
  110. package/lib-amd/components/PopoverSurface/PopoverSurface.js.map +0 -1
  111. package/lib-amd/components/PopoverSurface/PopoverSurface.types.d.ts +0 -22
  112. package/lib-amd/components/PopoverSurface/PopoverSurface.types.js +0 -5
  113. package/lib-amd/components/PopoverSurface/PopoverSurface.types.js.map +0 -1
  114. package/lib-amd/components/PopoverSurface/index.d.ts +0 -5
  115. package/lib-amd/components/PopoverSurface/index.js +0 -10
  116. package/lib-amd/components/PopoverSurface/index.js.map +0 -1
  117. package/lib-amd/components/PopoverSurface/renderPopoverSurface.d.ts +0 -5
  118. package/lib-amd/components/PopoverSurface/renderPopoverSurface.js +0 -21
  119. package/lib-amd/components/PopoverSurface/renderPopoverSurface.js.map +0 -1
  120. package/lib-amd/components/PopoverSurface/usePopoverSurface.d.ts +0 -14
  121. package/lib-amd/components/PopoverSurface/usePopoverSurface.js +0 -71
  122. package/lib-amd/components/PopoverSurface/usePopoverSurface.js.map +0 -1
  123. package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +0 -7
  124. package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js +0 -81
  125. package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js.map +0 -1
  126. package/lib-amd/components/PopoverTrigger/PopoverTrigger.d.ts +0 -6
  127. package/lib-amd/components/PopoverTrigger/PopoverTrigger.js +0 -15
  128. package/lib-amd/components/PopoverTrigger/PopoverTrigger.js.map +0 -1
  129. package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.d.ts +0 -12
  130. package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.js +0 -5
  131. package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.js.map +0 -1
  132. package/lib-amd/components/PopoverTrigger/index.d.ts +0 -4
  133. package/lib-amd/components/PopoverTrigger/index.js +0 -9
  134. package/lib-amd/components/PopoverTrigger/index.js.map +0 -1
  135. package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.d.ts +0 -5
  136. package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.js +0 -13
  137. package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.js.map +0 -1
  138. package/lib-amd/components/PopoverTrigger/usePopoverTrigger.d.ts +0 -11
  139. package/lib-amd/components/PopoverTrigger/usePopoverTrigger.js +0 -72
  140. package/lib-amd/components/PopoverTrigger/usePopoverTrigger.js.map +0 -1
  141. package/lib-amd/index.d.ts +0 -4
  142. package/lib-amd/index.js +0 -9
  143. package/lib-amd/index.js.map +0 -1
  144. package/lib-amd/popoverContext.d.ts +0 -9
  145. package/lib-amd/popoverContext.js +0 -21
  146. package/lib-amd/popoverContext.js.map +0 -1
@@ -1,15 +0,0 @@
1
- define(["require", "exports", "./usePopover", "./renderPopover"], function (require, exports, usePopover_1, renderPopover_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Popover = void 0;
5
- /**
6
- * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.
7
- */
8
- var Popover = function (props) {
9
- var state = usePopover_1.usePopover(props);
10
- return renderPopover_1.renderPopover(state);
11
- };
12
- exports.Popover = Popover;
13
- exports.Popover.displayName = 'Popover';
14
- });
15
- //# sourceMappingURL=Popover.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Popover.js","sourceRoot":"../src/","sources":["components/Popover/Popover.tsx"],"names":[],"mappings":";;;;IAKA;;OAEG;IACI,IAAM,OAAO,GAA2B,UAAA,KAAK;QAClD,IAAM,KAAK,GAAG,uBAAU,CAAC,KAAK,CAAC,CAAC;QAEhC,OAAO,6BAAa,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC,CAAC;IAJW,QAAA,OAAO,WAIlB;IAEF,eAAO,CAAC,WAAW,GAAG,SAAS,CAAC","sourcesContent":["import * as React from 'react';\nimport { usePopover } from './usePopover';\nimport { renderPopover } from './renderPopover';\nimport type { PopoverProps } from './Popover.types';\n\n/**\n * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.\n */\nexport const Popover: React.FC<PopoverProps> = props => {\n const state = usePopover(props);\n\n return renderPopover(state);\n};\n\nPopover.displayName = 'Popover';\n"]}
@@ -1,106 +0,0 @@
1
- import * as React from 'react';
2
- import type { PopperVirtualElement, PositioningShorthand, usePopperMouseTarget } from '@fluentui/react-positioning';
3
- import type { PortalProps } from '@fluentui/react-portal';
4
- /**
5
- * Determines popover padding and arrow size
6
- */
7
- export declare type PopoverSize = 'small' | 'medium' | 'large';
8
- export interface PopoverCommons extends Pick<PortalProps, 'mountNode'> {
9
- /**
10
- * Controls the opening of the Popover
11
- */
12
- open: boolean;
13
- /**
14
- * Used to set the initial open state of the Popover in uncontrolled mode
15
- */
16
- defaultOpen?: boolean;
17
- /**
18
- * Call back when the component requests to change value
19
- * The `open` value is used as a hint when directly controlling the component
20
- */
21
- onOpenChange?: (e: OpenPopoverEvents, data: OnOpenChangeData) => void;
22
- /**
23
- * Flag to open the Popover by hovering the trigger
24
- */
25
- openOnHover?: boolean;
26
- /**
27
- * Flag to open the Popover as a context menu. Disables all other interactions
28
- */
29
- openOnContext?: boolean;
30
- /**
31
- * Do not display the arrow
32
- */
33
- noArrow?: boolean;
34
- /**
35
- * Determines popover padding and arrow size
36
- * @default medium
37
- */
38
- size?: PopoverSize;
39
- /**
40
- * Uses brand colour as background
41
- * Mutually exclusive with `inverted`
42
- */
43
- brand?: boolean;
44
- /**
45
- * Inverts the foreground/background colour of the popover
46
- * Mutually exclusive with `brand`
47
- */
48
- inverted?: boolean;
49
- /**
50
- * Should trap focus
51
- */
52
- trapFocus?: boolean;
53
- /**
54
- * Configures the position of the Popover
55
- */
56
- positioning?: PositioningShorthand;
57
- }
58
- /**
59
- * Popover Props
60
- */
61
- export interface PopoverProps extends Partial<PopoverCommons> {
62
- /**
63
- * Can contain two children including {@link PopoverTrigger} and {@link PopoverPopover}.
64
- * Alternatively can only contain {@link PopoverPopover} if using a custom `target`.
65
- */
66
- children: [JSX.Element, JSX.Element] | JSX.Element;
67
- }
68
- /**
69
- * Popover State
70
- */
71
- export interface PopoverState extends PopoverCommons, Pick<PopoverProps, 'children'> {
72
- /**
73
- * Callback to open/close the Popover
74
- */
75
- setOpen: (e: OpenPopoverEvents, open: boolean) => void;
76
- /**
77
- * Ref of the PopoverTrigger
78
- */
79
- triggerRef: React.MutableRefObject<HTMLElement | null>;
80
- /**
81
- * Ref of the PopoverSurface
82
- */
83
- contentRef: React.MutableRefObject<HTMLElement | null>;
84
- /**
85
- * Ref of the pointing arrow
86
- */
87
- arrowRef: React.MutableRefObject<HTMLDivElement | null>;
88
- /**
89
- * Anchors the popper to the mouse click for context events
90
- */
91
- contextTarget: PopperVirtualElement | undefined;
92
- /**
93
- * A callback to set the target of the popper to the mouse click for context events
94
- */
95
- setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];
96
- size: NonNullable<PopoverProps['size']>;
97
- }
98
- /**
99
- * Data attached to open/close events
100
- */
101
- export interface OnOpenChangeData extends Pick<PopoverState, 'open'> {
102
- }
103
- /**
104
- * The supported events that will trigger open/close of the menu
105
- */
106
- export declare type OpenPopoverEvents = MouseEvent | TouchEvent | React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement> | React.FocusEvent<HTMLElement>;
@@ -1,5 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- });
5
- //# sourceMappingURL=Popover.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Popover.types.js","sourceRoot":"../src/","sources":["components/Popover/Popover.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { PopperVirtualElement, PositioningShorthand, usePopperMouseTarget } from '@fluentui/react-positioning';\nimport type { PortalProps } from '@fluentui/react-portal';\n\n/**\n * Determines popover padding and arrow size\n */\nexport type PopoverSize = 'small' | 'medium' | 'large';\n\nexport interface PopoverCommons extends Pick<PortalProps, 'mountNode'> {\n /**\n * Controls the opening of the Popover\n */\n open: boolean;\n /**\n * Used to set the initial open state of the Popover in uncontrolled mode\n */\n defaultOpen?: boolean;\n /**\n * Call back when the component requests to change value\n * The `open` value is used as a hint when directly controlling the component\n */\n onOpenChange?: (e: OpenPopoverEvents, data: OnOpenChangeData) => void;\n /**\n * Flag to open the Popover by hovering the trigger\n */\n openOnHover?: boolean;\n /**\n * Flag to open the Popover as a context menu. Disables all other interactions\n */\n openOnContext?: boolean;\n /**\n * Do not display the arrow\n */\n noArrow?: boolean;\n /**\n * Determines popover padding and arrow size\n * @default medium\n */\n size?: PopoverSize;\n /**\n * Uses brand colour as background\n * Mutually exclusive with `inverted`\n */\n brand?: boolean;\n /**\n * Inverts the foreground/background colour of the popover\n * Mutually exclusive with `brand`\n */\n inverted?: boolean;\n\n /**\n * Should trap focus\n */\n trapFocus?: boolean;\n\n /**\n * Configures the position of the Popover\n */\n positioning?: PositioningShorthand;\n}\n\n/**\n * Popover Props\n */\nexport interface PopoverProps extends Partial<PopoverCommons> {\n /**\n * Can contain two children including {@link PopoverTrigger} and {@link PopoverPopover}.\n * Alternatively can only contain {@link PopoverPopover} if using a custom `target`.\n */\n children: [JSX.Element, JSX.Element] | JSX.Element;\n}\n\n/**\n * Popover State\n */\nexport interface PopoverState extends PopoverCommons, Pick<PopoverProps, 'children'> {\n /**\n * Callback to open/close the Popover\n */\n setOpen: (e: OpenPopoverEvents, open: boolean) => void;\n /**\n * Ref of the PopoverTrigger\n */\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n /**\n * Ref of the PopoverSurface\n */\n contentRef: React.MutableRefObject<HTMLElement | null>;\n /**\n * Ref of the pointing arrow\n */\n arrowRef: React.MutableRefObject<HTMLDivElement | null>;\n /**\n * Anchors the popper to the mouse click for context events\n */\n contextTarget: PopperVirtualElement | undefined;\n /**\n * A callback to set the target of the popper to the mouse click for context events\n */\n setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];\n\n size: NonNullable<PopoverProps['size']>;\n}\n\n/**\n * Data attached to open/close events\n */\nexport interface OnOpenChangeData extends Pick<PopoverState, 'open'> {}\n\n/**\n * The supported events that will trigger open/close of the menu\n */\nexport type OpenPopoverEvents =\n | MouseEvent\n | TouchEvent\n | React.MouseEvent<HTMLElement>\n | React.KeyboardEvent<HTMLElement>\n | React.FocusEvent<HTMLElement>;\n"]}
@@ -1,4 +0,0 @@
1
- export * from './Popover';
2
- export * from './Popover.types';
3
- export * from './renderPopover';
4
- export * from './usePopover';
@@ -1,9 +0,0 @@
1
- define(["require", "exports", "tslib", "./Popover", "./Popover.types", "./renderPopover", "./usePopover"], function (require, exports, tslib_1, Popover_1, Popover_types_1, renderPopover_1, usePopover_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(Popover_1, exports);
5
- tslib_1.__exportStar(Popover_types_1, exports);
6
- tslib_1.__exportStar(renderPopover_1, exports);
7
- tslib_1.__exportStar(usePopover_1, exports);
8
- });
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Popover/index.ts"],"names":[],"mappings":";;;IAAA,yCAA0B;IAC1B,+CAAgC;IAChC,+CAAgC;IAChC,4CAA6B","sourcesContent":["export * from './Popover';\nexport * from './Popover.types';\nexport * from './renderPopover';\nexport * from './usePopover';\n"]}
@@ -1,5 +0,0 @@
1
- import type { PopoverState } from './Popover.types';
2
- /**
3
- * Render the final JSX of Popover
4
- */
5
- export declare const renderPopover: (state: PopoverState) => JSX.Element;
@@ -1,28 +0,0 @@
1
- define(["require", "exports", "react", "../../popoverContext"], function (require, exports, React, popoverContext_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.renderPopover = void 0;
5
- /**
6
- * Render the final JSX of Popover
7
- */
8
- var renderPopover = function (state) {
9
- var open = state.open, setOpen = state.setOpen, triggerRef = state.triggerRef, contentRef = state.contentRef, openOnContext = state.openOnContext, openOnHover = state.openOnHover, mountNode = state.mountNode, arrowRef = state.arrowRef, size = state.size, noArrow = state.noArrow, brand = state.brand, inverted = state.inverted, trapFocus = state.trapFocus;
10
- return (React.createElement(popoverContext_1.PopoverContext.Provider, { value: {
11
- open: open,
12
- setOpen: setOpen,
13
- triggerRef: triggerRef,
14
- contentRef: contentRef,
15
- openOnHover: openOnHover,
16
- openOnContext: openOnContext,
17
- mountNode: mountNode,
18
- arrowRef: arrowRef,
19
- size: size,
20
- noArrow: noArrow,
21
- brand: brand,
22
- inverted: inverted,
23
- trapFocus: trapFocus,
24
- } }, state.children));
25
- };
26
- exports.renderPopover = renderPopover;
27
- });
28
- //# sourceMappingURL=renderPopover.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderPopover.js","sourceRoot":"../src/","sources":["components/Popover/renderPopover.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,aAAa,GAAG,UAAC,KAAmB;QAE7C,IAAA,IAAI,GAaF,KAAK,KAbH,EACJ,OAAO,GAYL,KAAK,QAZA,EACP,UAAU,GAWR,KAAK,WAXG,EACV,UAAU,GAUR,KAAK,WAVG,EACV,aAAa,GASX,KAAK,cATM,EACb,WAAW,GAQT,KAAK,YARI,EACX,SAAS,GAOP,KAAK,UAPE,EACT,QAAQ,GAMN,KAAK,SANC,EACR,IAAI,GAKF,KAAK,KALH,EACJ,OAAO,GAIL,KAAK,QAJA,EACP,KAAK,GAGH,KAAK,MAHF,EACL,QAAQ,GAEN,KAAK,SAFC,EACR,SAAS,GACP,KAAK,UADE,CACD;QAEV,OAAO,CACL,oBAAC,+BAAc,CAAC,QAAQ,IACtB,KAAK,EAAE;gBACL,IAAI,MAAA;gBACJ,OAAO,SAAA;gBACP,UAAU,YAAA;gBACV,UAAU,YAAA;gBACV,WAAW,aAAA;gBACX,aAAa,eAAA;gBACb,SAAS,WAAA;gBACT,QAAQ,UAAA;gBACR,IAAI,MAAA;gBACJ,OAAO,SAAA;gBACP,KAAK,OAAA;gBACL,QAAQ,UAAA;gBACR,SAAS,WAAA;aACV,IAEA,KAAK,CAAC,QAAQ,CACS,CAC3B,CAAC;IACJ,CAAC,CAAC;IAtCW,QAAA,aAAa,iBAsCxB","sourcesContent":["import * as React from 'react';\nimport { PopoverContext } from '../../popoverContext';\nimport type { PopoverState } from './Popover.types';\n\n/**\n * Render the final JSX of Popover\n */\nexport const renderPopover = (state: PopoverState) => {\n const {\n open,\n setOpen,\n triggerRef,\n contentRef,\n openOnContext,\n openOnHover,\n mountNode,\n arrowRef,\n size,\n noArrow,\n brand,\n inverted,\n trapFocus,\n } = state;\n\n return (\n <PopoverContext.Provider\n value={{\n open,\n setOpen,\n triggerRef,\n contentRef,\n openOnHover,\n openOnContext,\n mountNode,\n arrowRef,\n size,\n noArrow,\n brand,\n inverted,\n trapFocus,\n }}\n >\n {state.children}\n </PopoverContext.Provider>\n );\n};\n"]}
@@ -1,11 +0,0 @@
1
- import type { PopoverProps, PopoverState } from './Popover.types';
2
- /**
3
- * Create the state required to render Popover.
4
- *
5
- * The returned state can be modified with hooks such as usePopoverStyles,
6
- * before being passed to renderPopover.
7
- *
8
- * @param props - props from this instance of Popover
9
- * @param defaultProps - (optional) default prop values provided by the implementing type
10
- */
11
- export declare const usePopover: (props: PopoverProps, defaultProps?: PopoverProps | undefined) => PopoverState;
@@ -1,91 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "@fluentui/react-shared-contexts", "@fluentui/react-positioning", "@fluentui/react-portal", "../PopoverSurface/index"], function (require, exports, tslib_1, React, react_utilities_1, react_shared_contexts_1, react_positioning_1, react_portal_1, index_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.usePopover = void 0;
5
- /**
6
- * Create the state required to render Popover.
7
- *
8
- * The returned state can be modified with hooks such as usePopoverStyles,
9
- * before being passed to renderPopover.
10
- *
11
- * @param props - props from this instance of Popover
12
- * @param defaultProps - (optional) default prop values provided by the implementing type
13
- */
14
- var usePopover = function (props, defaultProps) {
15
- var _a = react_positioning_1.usePopperMouseTarget(), contextTarget = _a[0], setContextTarget = _a[1];
16
- var initialState = tslib_1.__assign({ size: 'medium', contextTarget: contextTarget,
17
- setContextTarget: setContextTarget }, props);
18
- var _b = useOpenState(initialState), open = _b[0], setOpen = _b[1];
19
- var popperRefs = usePopoverRefs(initialState);
20
- var targetDocument = react_shared_contexts_1.useFluent().targetDocument;
21
- react_utilities_1.useOnClickOutside({
22
- contains: react_portal_1.elementContains,
23
- element: targetDocument,
24
- callback: function (ev) { return setOpen(ev, false); },
25
- refs: [popperRefs.triggerRef, popperRefs.contentRef],
26
- disabled: !open,
27
- });
28
- react_utilities_1.useOnScrollOutside({
29
- contains: react_portal_1.elementContains,
30
- element: targetDocument,
31
- callback: function (ev) { return setOpen(ev, false); },
32
- refs: [popperRefs.triggerRef, popperRefs.contentRef],
33
- disabled: !open || !initialState.openOnContext,
34
- });
35
- return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, initialState), popperRefs), { open: open,
36
- setOpen: setOpen,
37
- setContextTarget: setContextTarget,
38
- contextTarget: contextTarget });
39
- };
40
- exports.usePopover = usePopover;
41
- /**
42
- * Creates and manages the Popover open state
43
- */
44
- function useOpenState(state) {
45
- var onOpenChange = react_utilities_1.useEventCallback(function (e, data) { var _a; return (_a = state.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(state, e, data); });
46
- var _a = react_utilities_1.useControllableState({
47
- state: state.open,
48
- defaultState: state.defaultOpen,
49
- initialState: false,
50
- }), open = _a[0], setOpenState = _a[1];
51
- state.open = open !== undefined ? open : state.open;
52
- var setContextTarget = state.setContextTarget;
53
- var setOpen = React.useCallback(function (e, shouldOpen) {
54
- if (shouldOpen && e.type === 'contextmenu') {
55
- setContextTarget(e);
56
- }
57
- if (!shouldOpen) {
58
- setContextTarget(undefined);
59
- }
60
- setOpenState(function (prevOpen) {
61
- // More than one event (mouse, focus, keyboard) can request the Popover to close
62
- // We assume the first event is the correct one
63
- if (prevOpen !== shouldOpen) {
64
- onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(e, { open: shouldOpen });
65
- }
66
- return shouldOpen;
67
- });
68
- }, [setOpenState, onOpenChange, setContextTarget]);
69
- return [open, setOpen];
70
- }
71
- /**
72
- * Creates and sets the necessary trigger, target and content refs used by Popover
73
- */
74
- function usePopoverRefs(state) {
75
- var popperOptions = tslib_1.__assign({ position: 'above', align: 'center', target: state.openOnContext ? state.contextTarget : undefined }, react_positioning_1.resolvePositioningShorthand(state.positioning));
76
- // no reason to render arrow when covering the target
77
- if (popperOptions.coverTarget) {
78
- state.noArrow = true;
79
- }
80
- if (!state.noArrow) {
81
- popperOptions.offset = react_positioning_1.mergeArrowOffset(popperOptions.offset, index_1.arrowHeights[state.size]);
82
- }
83
- var _a = react_positioning_1.usePopper(popperOptions), triggerRef = _a.targetRef, contentRef = _a.containerRef, arrowRef = _a.arrowRef;
84
- return {
85
- triggerRef: triggerRef,
86
- contentRef: contentRef,
87
- arrowRef: arrowRef,
88
- };
89
- }
90
- });
91
- //# sourceMappingURL=usePopover.js.map
@@ -1 +0,0 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,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,SAAS,cAAc,CACrB,KAAqH;QAErH,IAAM,aAAa,sBACjB,QAAQ,EAAE,OAAgB,EAC1B,KAAK,EAAE,QAAiB,EACxB,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,IAC1D,+CAA2B,CAAC,KAAK,CAAC,WAAW,CAAC,CAClD,CAAC;QAEF,qDAAqD;QACrD,IAAI,aAAa,CAAC,WAAW,EAAE;YAC7B,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;SACtB;QAED,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;YAClB,aAAa,CAAC,MAAM,GAAG,oCAAgB,CAAC,aAAa,CAAC,MAAM,EAAE,oBAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;SACzF;QAEK,IAAA,KAAgE,6BAAS,CAAC,aAAa,CAAC,EAA3E,UAAU,eAAA,EAAgB,UAAU,kBAAA,EAAE,QAAQ,cAA6B,CAAC;QAE/F,OAAO;YACL,UAAU,YAAA;YACV,UAAU,YAAA;YACV,QAAQ,UAAA;SACA,CAAC;IACb,CAAC","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.\n *\n * @param props - props from this instance of Popover\n * @param defaultProps - (optional) default prop values provided by the implementing type\n */\nexport const usePopover = (props: PopoverProps, defaultProps?: 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"]}
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- import type { PopoverSurfaceProps } from './PopoverSurface.types';
3
- /**
4
- * PopoverSurface component renders react children in a positioned box
5
- */
6
- export declare const PopoverSurface: React.ForwardRefExoticComponent<PopoverSurfaceProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,15 +0,0 @@
1
- define(["require", "exports", "react", "./usePopoverSurface", "./renderPopoverSurface", "./usePopoverSurfaceStyles"], function (require, exports, React, usePopoverSurface_1, renderPopoverSurface_1, usePopoverSurfaceStyles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.PopoverSurface = void 0;
5
- /**
6
- * PopoverSurface component renders react children in a positioned box
7
- */
8
- exports.PopoverSurface = React.forwardRef(function (props, ref) {
9
- var state = usePopoverSurface_1.usePopoverSurface(props, ref);
10
- usePopoverSurfaceStyles_1.usePopoverSurfaceStyles(state);
11
- return renderPopoverSurface_1.renderPopoverSurface(state);
12
- });
13
- exports.PopoverSurface.displayName = 'PopoverSurface';
14
- });
15
- //# sourceMappingURL=PopoverSurface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PopoverSurface.js","sourceRoot":"../src/","sources":["components/PopoverSurface/PopoverSurface.tsx"],"names":[],"mappings":";;;;IAMA;;OAEG;IACU,QAAA,cAAc,GAAG,KAAK,CAAC,UAAU,CAAsC,UAAC,KAAK,EAAE,GAAG;QAC7F,IAAM,KAAK,GAAG,qCAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAE5C,iDAAuB,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,2CAAoB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,sBAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC","sourcesContent":["import * as React from 'react';\nimport { usePopoverSurface } from './usePopoverSurface';\nimport { renderPopoverSurface } from './renderPopoverSurface';\nimport { usePopoverSurfaceStyles } from './usePopoverSurfaceStyles';\nimport type { PopoverSurfaceProps } from './PopoverSurface.types';\n\n/**\n * PopoverSurface component renders react children in a positioned box\n */\nexport const PopoverSurface = React.forwardRef<HTMLDivElement, PopoverSurfaceProps>((props, ref) => {\n const state = usePopoverSurface(props, ref);\n\n usePopoverSurfaceStyles(state);\n return renderPopoverSurface(state);\n});\n\nPopoverSurface.displayName = 'PopoverSurface';\n"]}
@@ -1,22 +0,0 @@
1
- import type { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';
2
- import type { PopoverContextValue } from '../../popoverContext';
3
- /**
4
- * PopoverSurface Props
5
- */
6
- export interface PopoverSurfaceProps extends ComponentProps<PopoverSurfaceSlots> {
7
- }
8
- /**
9
- * Names of the slots in PopoverSurfaceProps
10
- */
11
- export declare type PopoverSurfaceSlots = {
12
- root: IntrinsicShorthandProps<'div'>;
13
- };
14
- /**
15
- * PopoverSurface State
16
- */
17
- export interface PopoverSurfaceState extends ComponentState<PopoverSurfaceSlots>, Pick<PopoverContextValue, 'open' | 'mountNode' | 'noArrow' | 'size' | 'brand' | 'inverted' | 'arrowRef'> {
18
- /**
19
- * CSS class for the arrow element
20
- */
21
- arrowClassName?: string;
22
- }
@@ -1,5 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- });
5
- //# sourceMappingURL=PopoverSurface.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PopoverSurface.types.js","sourceRoot":"../src/","sources":["components/PopoverSurface/PopoverSurface.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';\nimport type { PopoverContextValue } from '../../popoverContext';\n\n/**\n * PopoverSurface Props\n */\nexport interface PopoverSurfaceProps extends ComponentProps<PopoverSurfaceSlots> {}\n\n/**\n * Names of the slots in PopoverSurfaceProps\n */\nexport type PopoverSurfaceSlots = {\n root: IntrinsicShorthandProps<'div'>;\n};\n\n/**\n * PopoverSurface State\n */\nexport interface PopoverSurfaceState\n extends ComponentState<PopoverSurfaceSlots>,\n Pick<PopoverContextValue, 'open' | 'mountNode' | 'noArrow' | 'size' | 'brand' | 'inverted' | 'arrowRef'> {\n /**\n * CSS class for the arrow element\n */\n arrowClassName?: string;\n}\n"]}
@@ -1,5 +0,0 @@
1
- export * from './PopoverSurface';
2
- export * from './PopoverSurface.types';
3
- export * from './renderPopoverSurface';
4
- export * from './usePopoverSurface';
5
- export * from './usePopoverSurfaceStyles';
@@ -1,10 +0,0 @@
1
- define(["require", "exports", "tslib", "./PopoverSurface", "./PopoverSurface.types", "./renderPopoverSurface", "./usePopoverSurface", "./usePopoverSurfaceStyles"], function (require, exports, tslib_1, PopoverSurface_1, PopoverSurface_types_1, renderPopoverSurface_1, usePopoverSurface_1, usePopoverSurfaceStyles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(PopoverSurface_1, exports);
5
- tslib_1.__exportStar(PopoverSurface_types_1, exports);
6
- tslib_1.__exportStar(renderPopoverSurface_1, exports);
7
- tslib_1.__exportStar(usePopoverSurface_1, exports);
8
- tslib_1.__exportStar(usePopoverSurfaceStyles_1, exports);
9
- });
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/PopoverSurface/index.ts"],"names":[],"mappings":";;;IAAA,gDAAiC;IACjC,sDAAuC;IACvC,sDAAuC;IACvC,mDAAoC;IACpC,yDAA0C","sourcesContent":["export * from './PopoverSurface';\nexport * from './PopoverSurface.types';\nexport * from './renderPopoverSurface';\nexport * from './usePopoverSurface';\nexport * from './usePopoverSurfaceStyles';\n"]}
@@ -1,5 +0,0 @@
1
- import type { PopoverSurfaceState } from './PopoverSurface.types';
2
- /**
3
- * Render the final JSX of PopoverSurface
4
- */
5
- export declare const renderPopoverSurface: (state: PopoverSurfaceState) => JSX.Element | null;
@@ -1,21 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-portal", "@fluentui/react-utilities", "./usePopoverSurface"], function (require, exports, tslib_1, React, react_portal_1, react_utilities_1, usePopoverSurface_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.renderPopoverSurface = void 0;
5
- /**
6
- * Render the final JSX of PopoverSurface
7
- */
8
- var renderPopoverSurface = function (state) {
9
- var _a = react_utilities_1.getSlots(state, usePopoverSurface_1.popoverSurfaceSlots), slots = _a.slots, slotProps = _a.slotProps;
10
- // TODO should hidden Popovers be supported ?
11
- if (!state.open) {
12
- return null;
13
- }
14
- return (React.createElement(react_portal_1.Portal, { mountNode: state.mountNode },
15
- React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
16
- !state.noArrow && React.createElement("div", { ref: state.arrowRef, className: state.arrowClassName }),
17
- slotProps.root.children)));
18
- };
19
- exports.renderPopoverSurface = renderPopoverSurface;
20
- });
21
- //# sourceMappingURL=renderPopoverSurface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderPopoverSurface.js","sourceRoot":"../src/","sources":["components/PopoverSurface/renderPopoverSurface.tsx"],"names":[],"mappings":";;;;IAMA;;OAEG;IACI,IAAM,oBAAoB,GAAG,UAAC,KAA0B;QACvD,IAAA,KAAuB,0BAAQ,CAAsB,KAAK,EAAE,uCAAmB,CAAC,EAA9E,KAAK,WAAA,EAAE,SAAS,eAA8D,CAAC;QAEvF,6CAA6C;QAC7C,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;YACf,OAAO,IAAI,CAAC;SACb;QAED,OAAO,CACL,oBAAC,qBAAM,IAAC,SAAS,EAAE,KAAK,CAAC,SAAS;YAChC,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;gBAC3B,CAAC,KAAK,CAAC,OAAO,IAAI,6BAAK,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,cAAc,GAAI;gBAC/E,SAAS,CAAC,IAAI,CAAC,QAAQ,CACb,CACN,CACV,CAAC;IACJ,CAAC,CAAC;IAhBW,QAAA,oBAAoB,wBAgB/B","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';\nimport { popoverSurfaceSlots } from './usePopoverSurface';\n\n/**\n * Render the final JSX of PopoverSurface\n */\nexport const renderPopoverSurface = (state: PopoverSurfaceState) => {\n const { slots, slotProps } = getSlots<PopoverSurfaceSlots>(state, popoverSurfaceSlots);\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"]}
@@ -1,14 +0,0 @@
1
- import * as React from 'react';
2
- import type { PopoverSurfaceProps, PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface.types';
3
- export declare const popoverSurfaceSlots: Array<keyof PopoverSurfaceSlots>;
4
- /**
5
- * Create the state required to render PopoverSurface.
6
- *
7
- * The returned state can be modified with hooks such as usePopoverSurfaceStyles,
8
- * before being passed to renderPopoverSurface.
9
- *
10
- * @param props - props from this instance of PopoverSurface
11
- * @param ref - reference to root HTMLDivElement of PopoverSurface
12
- * @param defaultProps - (optional) default prop values provided by the implementing type
13
- */
14
- export declare const usePopoverSurface: (props: PopoverSurfaceProps, ref: React.Ref<HTMLDivElement>) => PopoverSurfaceState;
@@ -1,71 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "@fluentui/react-tabster", "../../popoverContext"], function (require, exports, tslib_1, React, react_utilities_1, react_tabster_1, popoverContext_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.usePopoverSurface = exports.popoverSurfaceSlots = void 0;
5
- exports.popoverSurfaceSlots = ['root'];
6
- /**
7
- * Create the state required to render PopoverSurface.
8
- *
9
- * The returned state can be modified with hooks such as usePopoverSurfaceStyles,
10
- * before being passed to renderPopoverSurface.
11
- *
12
- * @param props - props from this instance of PopoverSurface
13
- * @param ref - reference to root HTMLDivElement of PopoverSurface
14
- * @param defaultProps - (optional) default prop values provided by the implementing type
15
- */
16
- var usePopoverSurface = function (props, ref) {
17
- var contentRef = popoverContext_1.usePopoverContext(function (context) { return context.contentRef; });
18
- var open = popoverContext_1.usePopoverContext(function (context) { return context.open; });
19
- var openOnHover = popoverContext_1.usePopoverContext(function (context) { return context.openOnHover; });
20
- var setOpen = popoverContext_1.usePopoverContext(function (context) { return context.setOpen; });
21
- var mountNode = popoverContext_1.usePopoverContext(function (context) { return context.mountNode; });
22
- var arrowRef = popoverContext_1.usePopoverContext(function (context) { return context.arrowRef; });
23
- var size = popoverContext_1.usePopoverContext(function (context) { return context.size; });
24
- var noArrow = popoverContext_1.usePopoverContext(function (context) { return context.noArrow; });
25
- var brand = popoverContext_1.usePopoverContext(function (context) { return context.brand; });
26
- var inverted = popoverContext_1.usePopoverContext(function (context) { return context.inverted; });
27
- var trapFocus = popoverContext_1.usePopoverContext(function (context) { return context.trapFocus; });
28
- var modalAttributes = react_tabster_1.useModalAttributes({ trapFocus: trapFocus }).modalAttributes;
29
- var state = tslib_1.__assign(tslib_1.__assign({ brand: brand,
30
- inverted: inverted,
31
- noArrow: noArrow,
32
- size: size,
33
- arrowRef: arrowRef,
34
- open: open,
35
- mountNode: mountNode }, props), { components: {
36
- root: 'div',
37
- }, root: react_utilities_1.getNativeElementProps('div', tslib_1.__assign(tslib_1.__assign({ ref: react_utilities_1.useMergedRefs(ref, contentRef), role: 'dialog' }, modalAttributes), props)) });
38
- var _a = state.root, onMouseEnterOriginal = _a.onMouseEnter, onMouseLeaveOriginal = _a.onMouseLeave, onKeyDownOriginal = _a.onKeyDown;
39
- state.root.onMouseEnter = function (e) {
40
- if (openOnHover) {
41
- setOpen(e, true);
42
- }
43
- onMouseEnterOriginal === null || onMouseEnterOriginal === void 0 ? void 0 : onMouseEnterOriginal(e);
44
- };
45
- state.root.onMouseLeave = function (e) {
46
- if (openOnHover) {
47
- setOpen(e, false);
48
- }
49
- onMouseLeaveOriginal === null || onMouseLeaveOriginal === void 0 ? void 0 : onMouseLeaveOriginal(e);
50
- };
51
- state.root.onKeyDown = function (e) {
52
- var _a;
53
- // only close if the event happened inside the current popover
54
- // If using a stack of inline popovers, the user should call `stopPropagation` to avoid dismissing the entire stack
55
- if (e.key === 'Escape' && ((_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
56
- setOpen(e, false);
57
- }
58
- onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(e);
59
- };
60
- var findFirstFocusable = react_tabster_1.useFocusFinders().findFirstFocusable;
61
- React.useEffect(function () {
62
- if (state.open && contentRef.current) {
63
- var firstFocusable = findFirstFocusable(contentRef.current);
64
- firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
65
- }
66
- }, [contentRef, findFirstFocusable, state.open]);
67
- return state;
68
- };
69
- exports.usePopoverSurface = usePopoverSurface;
70
- });
71
- //# sourceMappingURL=usePopoverSurface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePopoverSurface.js","sourceRoot":"../src/","sources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I,UAAU,CAAC,OAAO,0CAAE,QAAQ,CAAC,CAAC,CAAC,MAAwB,EAAC,EAAE;gBAClF,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnB;YAED,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAG,CAAC,EAAE;QACzB,CAAC,CAAC;QAEM,IAAA,kBAAkB,GAAK,+BAAe,EAAE,mBAAtB,CAAuB;QAEjD,KAAK,CAAC,SAAS,CAAC;YACd,IAAI,KAAK,CAAC,IAAI,IAAI,UAAU,CAAC,OAAO,EAAE;gBACpC,IAAM,cAAc,GAAG,kBAAkB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAC9D,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,KAAK,GAAG;aACzB;QACH,CAAC,EAAE,CAAC,UAAU,EAAE,kBAAkB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACjD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IA1EW,QAAA,iBAAiB,qBA0E5B","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusFinders, useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext } from '../../popoverContext';\nimport type { PopoverSurfaceProps, PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface.types';\n\nexport const popoverSurfaceSlots: Array<keyof PopoverSurfaceSlots> = ['root'];\n\n/**\n * Create the state required to render PopoverSurface.\n *\n * The returned state can be modified with hooks such as usePopoverSurfaceStyles,\n * before being passed to renderPopoverSurface.\n *\n * @param props - props from this instance of PopoverSurface\n * @param ref - reference to root HTMLDivElement of PopoverSurface\n * @param defaultProps - (optional) default prop values provided by the implementing type\n */\nexport const usePopoverSurface = (props: PopoverSurfaceProps, ref: React.Ref<HTMLDivElement>): PopoverSurfaceState => {\n const contentRef = usePopoverContext(context => context.contentRef);\n const open = usePopoverContext(context => context.open);\n const openOnHover = usePopoverContext(context => context.openOnHover);\n const setOpen = usePopoverContext(context => context.setOpen);\n const mountNode = usePopoverContext(context => context.mountNode);\n const arrowRef = usePopoverContext(context => context.arrowRef);\n const size = usePopoverContext(context => context.size);\n const noArrow = usePopoverContext(context => context.noArrow);\n const brand = usePopoverContext(context => context.brand);\n const inverted = usePopoverContext(context => context.inverted);\n const trapFocus = usePopoverContext(context => context.trapFocus);\n const { modalAttributes } = useModalAttributes({ trapFocus });\n\n const state: PopoverSurfaceState = {\n brand,\n inverted,\n noArrow,\n size,\n arrowRef,\n open,\n mountNode,\n ...props,\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, contentRef),\n role: 'dialog',\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"]}
@@ -1,7 +0,0 @@
1
- import type { PopoverSize } from '../Popover/Popover.types';
2
- import type { PopoverSurfaceState } from './PopoverSurface.types';
3
- export declare const arrowHeights: Record<PopoverSize, number>;
4
- /**
5
- * Apply styling to the PopoverSurface slots based on the state
6
- */
7
- export declare const usePopoverSurfaceStyles: (state: PopoverSurfaceState) => PopoverSurfaceState;