@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.
- package/CHANGELOG.json +267 -3
- package/CHANGELOG.md +73 -3
- package/Spec.md +6 -6
- package/dist/react-popover.d.ts +41 -33
- package/lib/Popover.js.map +1 -1
- package/lib/PopoverSurface.js.map +1 -1
- package/lib/PopoverTrigger.js.map +1 -1
- package/lib/common/isConformant.js.map +1 -1
- package/lib/common/mockUsePopoverContext.js.map +1 -1
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.types.d.ts +10 -16
- package/lib/components/Popover/Popover.types.js.map +1 -1
- package/lib/components/Popover/index.js.map +1 -1
- package/lib/components/Popover/renderPopover.js +2 -4
- package/lib/components/Popover/renderPopover.js.map +1 -1
- package/lib/components/Popover/usePopover.d.ts +1 -2
- package/lib/components/Popover/usePopover.js +1 -2
- package/lib/components/Popover/usePopover.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.d.ts +19 -2
- package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +3 -4
- package/lib/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
- package/lib/components/PopoverSurface/index.js.map +1 -1
- package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurface.d.ts +0 -1
- package/lib/components/PopoverSurface/usePopoverSurface.js +6 -14
- package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +1 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.types.d.ts +3 -4
- package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib/components/PopoverTrigger/index.js.map +1 -1
- package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/usePopoverTrigger.d.ts +1 -2
- package/lib/components/PopoverTrigger/usePopoverTrigger.js +5 -5
- package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/popoverContext.d.ts +2 -3
- package/lib/popoverContext.js.map +1 -1
- package/lib-commonjs/Popover.js.map +1 -1
- package/lib-commonjs/PopoverSurface.js.map +1 -1
- package/lib-commonjs/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/common/isConformant.js.map +1 -1
- package/lib-commonjs/common/mockUsePopoverContext.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.types.d.ts +10 -16
- package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
- package/lib-commonjs/components/Popover/index.js.map +1 -1
- package/lib-commonjs/components/Popover/renderPopover.js +2 -4
- package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
- package/lib-commonjs/components/Popover/usePopover.d.ts +1 -2
- package/lib-commonjs/components/Popover/usePopover.js +1 -2
- package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.d.ts +19 -2
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +3 -4
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.d.ts +0 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +6 -14
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.d.ts +3 -4
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.d.ts +1 -2
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +5 -5
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/popoverContext.d.ts +2 -3
- package/lib-commonjs/popoverContext.js.map +1 -1
- package/package.json +11 -11
- package/lib-amd/Popover.d.ts +0 -1
- package/lib-amd/Popover.js +0 -6
- package/lib-amd/Popover.js.map +0 -1
- package/lib-amd/PopoverSurface.d.ts +0 -1
- package/lib-amd/PopoverSurface.js +0 -6
- package/lib-amd/PopoverSurface.js.map +0 -1
- package/lib-amd/PopoverTrigger.d.ts +0 -1
- package/lib-amd/PopoverTrigger.js +0 -6
- package/lib-amd/PopoverTrigger.js.map +0 -1
- package/lib-amd/common/isConformant.d.ts +0 -4
- package/lib-amd/common/isConformant.js +0 -17
- package/lib-amd/common/isConformant.js.map +0 -1
- package/lib-amd/common/mockUsePopoverContext.d.ts +0 -7
- package/lib-amd/common/mockUsePopoverContext.js +0 -20
- package/lib-amd/common/mockUsePopoverContext.js.map +0 -1
- package/lib-amd/components/Popover/Popover.d.ts +0 -6
- package/lib-amd/components/Popover/Popover.js +0 -15
- package/lib-amd/components/Popover/Popover.js.map +0 -1
- package/lib-amd/components/Popover/Popover.types.d.ts +0 -106
- package/lib-amd/components/Popover/Popover.types.js +0 -5
- package/lib-amd/components/Popover/Popover.types.js.map +0 -1
- package/lib-amd/components/Popover/index.d.ts +0 -4
- package/lib-amd/components/Popover/index.js +0 -9
- package/lib-amd/components/Popover/index.js.map +0 -1
- package/lib-amd/components/Popover/renderPopover.d.ts +0 -5
- package/lib-amd/components/Popover/renderPopover.js +0 -28
- package/lib-amd/components/Popover/renderPopover.js.map +0 -1
- package/lib-amd/components/Popover/usePopover.d.ts +0 -11
- package/lib-amd/components/Popover/usePopover.js +0 -91
- package/lib-amd/components/Popover/usePopover.js.map +0 -1
- package/lib-amd/components/PopoverSurface/PopoverSurface.d.ts +0 -6
- package/lib-amd/components/PopoverSurface/PopoverSurface.js +0 -15
- package/lib-amd/components/PopoverSurface/PopoverSurface.js.map +0 -1
- package/lib-amd/components/PopoverSurface/PopoverSurface.types.d.ts +0 -22
- package/lib-amd/components/PopoverSurface/PopoverSurface.types.js +0 -5
- package/lib-amd/components/PopoverSurface/PopoverSurface.types.js.map +0 -1
- package/lib-amd/components/PopoverSurface/index.d.ts +0 -5
- package/lib-amd/components/PopoverSurface/index.js +0 -10
- package/lib-amd/components/PopoverSurface/index.js.map +0 -1
- package/lib-amd/components/PopoverSurface/renderPopoverSurface.d.ts +0 -5
- package/lib-amd/components/PopoverSurface/renderPopoverSurface.js +0 -21
- package/lib-amd/components/PopoverSurface/renderPopoverSurface.js.map +0 -1
- package/lib-amd/components/PopoverSurface/usePopoverSurface.d.ts +0 -14
- package/lib-amd/components/PopoverSurface/usePopoverSurface.js +0 -71
- package/lib-amd/components/PopoverSurface/usePopoverSurface.js.map +0 -1
- package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +0 -7
- package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js +0 -81
- package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.d.ts +0 -6
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.js +0 -15
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.d.ts +0 -12
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.js +0 -5
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/index.d.ts +0 -4
- package/lib-amd/components/PopoverTrigger/index.js +0 -9
- package/lib-amd/components/PopoverTrigger/index.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.d.ts +0 -5
- package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.js +0 -13
- package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/usePopoverTrigger.d.ts +0 -11
- package/lib-amd/components/PopoverTrigger/usePopoverTrigger.js +0 -72
- package/lib-amd/components/PopoverTrigger/usePopoverTrigger.js.map +0 -1
- package/lib-amd/index.d.ts +0 -4
- package/lib-amd/index.js +0 -9
- package/lib-amd/index.js.map +0 -1
- package/lib-amd/popoverContext.d.ts +0 -9
- package/lib-amd/popoverContext.js +0 -21
- package/lib-amd/popoverContext.js.map +0 -1
@@ -1,81 +0,0 @@
|
|
1
|
-
define(["require", "exports", "@fluentui/react-make-styles"], function (require, exports, react_make_styles_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.usePopoverSurfaceStyles = exports.arrowHeights = void 0;
|
5
|
-
exports.arrowHeights = {
|
6
|
-
small: 6,
|
7
|
-
medium: 8,
|
8
|
-
large: 8,
|
9
|
-
};
|
10
|
-
/**
|
11
|
-
* Styles for the root slot
|
12
|
-
*/
|
13
|
-
var useStyles = react_make_styles_1.makeStyles({
|
14
|
-
root: function (theme) { return ({
|
15
|
-
backgroundColor: theme.alias.color.neutral.neutralBackground1,
|
16
|
-
boxShadow: theme.alias.shadow.shadow16,
|
17
|
-
borderRadius: '4px',
|
18
|
-
}); },
|
19
|
-
inverted: function (theme) { return ({
|
20
|
-
// TODO: neutral background inverted missing from superset and theme
|
21
|
-
backgroundColor: theme.global.palette.grey[16],
|
22
|
-
color: theme.alias.color.neutral.neutralForegroundInverted,
|
23
|
-
}); },
|
24
|
-
brand: function (theme) { return ({
|
25
|
-
backgroundColor: theme.alias.color.neutral.brandBackground,
|
26
|
-
// TODO: clarify with designers what foreground color should be with brand background,
|
27
|
-
color: theme.alias.color.neutral.neutralForegroundInverted,
|
28
|
-
}); },
|
29
|
-
smallPadding: function () { return ({
|
30
|
-
padding: '12px',
|
31
|
-
}); },
|
32
|
-
mediumPadding: function () { return ({
|
33
|
-
padding: '16px',
|
34
|
-
}); },
|
35
|
-
largePadding: function () { return ({
|
36
|
-
padding: '20px',
|
37
|
-
}); },
|
38
|
-
smallArrow: function () { return ({
|
39
|
-
width: Math.SQRT2 * exports.arrowHeights.small + "px",
|
40
|
-
height: Math.SQRT2 * exports.arrowHeights.small + "px",
|
41
|
-
}); },
|
42
|
-
mediumLargeArrow: function () { return ({
|
43
|
-
width: Math.SQRT2 * exports.arrowHeights.medium + "px",
|
44
|
-
height: Math.SQRT2 * exports.arrowHeights.medium + "px",
|
45
|
-
}); },
|
46
|
-
// TODO dedupe these styles with tooltip
|
47
|
-
arrow: function (theme) { return ({
|
48
|
-
position: 'absolute',
|
49
|
-
background: 'inherit',
|
50
|
-
visibility: 'hidden',
|
51
|
-
zIndex: -1,
|
52
|
-
':before': {
|
53
|
-
content: '""',
|
54
|
-
borderRadius: '4px',
|
55
|
-
position: 'absolute',
|
56
|
-
width: 'inherit',
|
57
|
-
height: 'inherit',
|
58
|
-
background: 'inherit',
|
59
|
-
visibility: 'visible',
|
60
|
-
borderBottomRightRadius: theme.global.borderRadius.small,
|
61
|
-
transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',
|
62
|
-
},
|
63
|
-
// Popper sets data-popper-placement on the root element, which is used to align the arrow
|
64
|
-
':global([data-popper-placement^="top"])': { bottom: 0, '--angle': '0' },
|
65
|
-
':global([data-popper-placement^="right"])': { left: 0, '--angle': '90deg' },
|
66
|
-
':global([data-popper-placement^="bottom"])': { top: 0, '--angle': '180deg' },
|
67
|
-
':global([data-popper-placement^="left"])': { right: 0, '--angle': '270deg' },
|
68
|
-
}); },
|
69
|
-
});
|
70
|
-
/**
|
71
|
-
* Apply styling to the PopoverSurface slots based on the state
|
72
|
-
*/
|
73
|
-
var usePopoverSurfaceStyles = function (state) {
|
74
|
-
var styles = useStyles();
|
75
|
-
state.root.className = react_make_styles_1.mergeClasses(styles.root, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.inverted && styles.inverted, state.brand && styles.brand, state.root.className);
|
76
|
-
state.arrowClassName = react_make_styles_1.mergeClasses(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);
|
77
|
-
return state;
|
78
|
-
};
|
79
|
-
exports.usePopoverSurfaceStyles = usePopoverSurfaceStyles;
|
80
|
-
});
|
81
|
-
//# sourceMappingURL=usePopoverSurfaceStyles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"usePopoverSurfaceStyles.js","sourceRoot":"../src/","sources":["components/PopoverSurface/usePopoverSurfaceStyles.ts"],"names":[],"mappings":";;;;IAIa,QAAA,YAAY,GAAgC;QACvD,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;KACT,CAAC;IAEF;;OAEG;IACH,IAAM,SAAS,GAAG,8BAAU,CAAC;QAC3B,IAAI,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YACd,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB;YAC7D,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ;YACtC,YAAY,EAAE,KAAK;SACpB,CAAC,EAJa,CAIb;QAEF,QAAQ,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YAClB,oEAAoE;YACpE,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;Y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,MAAM,CAAC,gBAAgB,CACrE,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAlBW,QAAA,uBAAuB,2BAkBlC","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport type { PopoverSize } from '../Popover/Popover.types';\nimport type { PopoverSurfaceState } from './PopoverSurface.types';\n\nexport const arrowHeights: Record<PopoverSize, number> = {\n small: 6,\n medium: 8,\n large: 8,\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: theme => ({\n backgroundColor: theme.alias.color.neutral.neutralBackground1,\n boxShadow: theme.alias.shadow.shadow16,\n borderRadius: '4px',\n }),\n\n inverted: theme => ({\n // TODO: neutral background inverted missing from superset and theme\n backgroundColor: theme.global.palette.grey[16],\n color: theme.alias.color.neutral.neutralForegroundInverted,\n }),\n\n brand: theme => ({\n backgroundColor: theme.alias.color.neutral.brandBackground,\n // TODO: clarify with designers what foreground color should be with brand background,\n color: theme.alias.color.neutral.neutralForegroundInverted,\n }),\n\n smallPadding: () => ({\n padding: '12px',\n }),\n\n mediumPadding: () => ({\n padding: '16px',\n }),\n\n largePadding: () => ({\n padding: '20px',\n }),\n\n smallArrow: () => ({\n width: `${Math.SQRT2 * arrowHeights.small}px`,\n height: `${Math.SQRT2 * arrowHeights.small}px`,\n }),\n\n mediumLargeArrow: () => ({\n width: `${Math.SQRT2 * arrowHeights.medium}px`,\n height: `${Math.SQRT2 * arrowHeights.medium}px`,\n }),\n\n // TODO dedupe these styles with tooltip\n arrow: theme => ({\n position: 'absolute',\n background: 'inherit',\n visibility: 'hidden',\n zIndex: -1,\n\n ':before': {\n content: '\"\"',\n borderRadius: '4px',\n position: 'absolute',\n width: 'inherit',\n height: 'inherit',\n background: 'inherit',\n visibility: 'visible',\n borderBottomRightRadius: theme.global.borderRadius.small,\n transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',\n },\n\n // Popper sets data-popper-placement on the root element, which is used to align the arrow\n ':global([data-popper-placement^=\"top\"])': { bottom: 0, '--angle': '0' },\n ':global([data-popper-placement^=\"right\"])': { left: 0, '--angle': '90deg' },\n ':global([data-popper-placement^=\"bottom\"])': { top: 0, '--angle': '180deg' },\n ':global([data-popper-placement^=\"left\"])': { right: 0, '--angle': '270deg' },\n }),\n});\n\n/**\n * Apply styling to the PopoverSurface slots based on the state\n */\nexport const usePopoverSurfaceStyles = (state: PopoverSurfaceState): PopoverSurfaceState => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n styles.root,\n state.size === 'small' && styles.smallPadding,\n state.size === 'medium' && styles.mediumPadding,\n state.size === 'large' && styles.largePadding,\n state.inverted && styles.inverted,\n state.brand && styles.brand,\n state.root.className,\n );\n\n state.arrowClassName = mergeClasses(\n styles.arrow,\n state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow,\n );\n\n return state;\n};\n"]}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import type { PopoverTriggerProps } from './PopoverTrigger.types';
|
3
|
-
/**
|
4
|
-
* Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
|
5
|
-
*/
|
6
|
-
export declare const PopoverTrigger: React.FC<PopoverTriggerProps>;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
define(["require", "exports", "./usePopoverTrigger", "./renderPopoverTrigger"], function (require, exports, usePopoverTrigger_1, renderPopoverTrigger_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.PopoverTrigger = void 0;
|
5
|
-
/**
|
6
|
-
* Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
|
7
|
-
*/
|
8
|
-
var PopoverTrigger = function (props) {
|
9
|
-
var state = usePopoverTrigger_1.usePopoverTrigger(props);
|
10
|
-
return renderPopoverTrigger_1.renderPopoverTrigger(state);
|
11
|
-
};
|
12
|
-
exports.PopoverTrigger = PopoverTrigger;
|
13
|
-
exports.PopoverTrigger.displayName = 'PopoverTrigger';
|
14
|
-
});
|
15
|
-
//# sourceMappingURL=PopoverTrigger.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"PopoverTrigger.js","sourceRoot":"../src/","sources":["components/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":";;;;IAKA;;OAEG;IACI,IAAM,cAAc,GAAkC,UAAA,KAAK;QAChE,IAAM,KAAK,GAAG,qCAAiB,CAAC,KAAK,CAAC,CAAC;QAEvC,OAAO,2CAAoB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC,CAAC;IAJW,QAAA,cAAc,kBAIzB;IAEF,sBAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC","sourcesContent":["import * as React from 'react';\nimport { usePopoverTrigger } from './usePopoverTrigger';\nimport { renderPopoverTrigger } from './renderPopoverTrigger';\nimport type { PopoverTriggerProps } from './PopoverTrigger.types';\n\n/**\n * Wraps a trigger element as an only child and adds the necessary event handling to open a popover.\n */\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> = props => {\n const state = usePopoverTrigger(props);\n\n return renderPopoverTrigger(state);\n};\n\nPopoverTrigger.displayName = 'PopoverTrigger';\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"PopoverTrigger.types.js","sourceRoot":"../src/","sources":["components/PopoverTrigger/PopoverTrigger.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\n/**\n * PopoverTrigger Props\n */\nexport interface PopoverTriggerProps {\n children: React.ReactElement;\n}\n\n/**\n * PopoverTrigger State\n */\nexport interface PopoverTriggerState extends PopoverTriggerProps {}\n"]}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "./PopoverTrigger", "./PopoverTrigger.types", "./renderPopoverTrigger", "./usePopoverTrigger"], function (require, exports, tslib_1, PopoverTrigger_1, PopoverTrigger_types_1, renderPopoverTrigger_1, usePopoverTrigger_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
tslib_1.__exportStar(PopoverTrigger_1, exports);
|
5
|
-
tslib_1.__exportStar(PopoverTrigger_types_1, exports);
|
6
|
-
tslib_1.__exportStar(renderPopoverTrigger_1, exports);
|
7
|
-
tslib_1.__exportStar(usePopoverTrigger_1, exports);
|
8
|
-
});
|
9
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/PopoverTrigger/index.ts"],"names":[],"mappings":";;;IAAA,gDAAiC;IACjC,sDAAuC;IACvC,sDAAuC;IACvC,mDAAoC","sourcesContent":["export * from './PopoverTrigger';\nexport * from './PopoverTrigger.types';\nexport * from './renderPopoverTrigger';\nexport * from './usePopoverTrigger';\n"]}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
define(["require", "exports"], function (require, exports) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.renderPopoverTrigger = void 0;
|
5
|
-
/**
|
6
|
-
* Render the final JSX of PopoverTrigger
|
7
|
-
*/
|
8
|
-
var renderPopoverTrigger = function (state) {
|
9
|
-
return state.children;
|
10
|
-
};
|
11
|
-
exports.renderPopoverTrigger = renderPopoverTrigger;
|
12
|
-
});
|
13
|
-
//# sourceMappingURL=renderPopoverTrigger.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"renderPopoverTrigger.js","sourceRoot":"../src/","sources":["components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":";;;;IAEA;;OAEG;IACI,IAAM,oBAAoB,GAAG,UAAC,KAA0B;QAC7D,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC,CAAC;IAFW,QAAA,oBAAoB,wBAE/B","sourcesContent":["import type { PopoverTriggerState } from './PopoverTrigger.types';\n\n/**\n * Render the final JSX of PopoverTrigger\n */\nexport const renderPopoverTrigger = (state: PopoverTriggerState): JSX.Element => {\n return state.children;\n};\n"]}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.types';
|
2
|
-
/**
|
3
|
-
* Create the state required to render PopoverTrigger.
|
4
|
-
*
|
5
|
-
* The returned state can be modified with hooks such as usePopoverTriggerStyles,
|
6
|
-
* before being passed to renderPopoverTrigger.
|
7
|
-
*
|
8
|
-
* @param props - props from this instance of PopoverTrigger
|
9
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
10
|
-
*/
|
11
|
-
export declare const usePopoverTrigger: (props: PopoverTriggerProps, defaultProps?: PopoverTriggerProps | undefined) => PopoverTriggerState;
|
@@ -1,72 +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.usePopoverTrigger = void 0;
|
5
|
-
/**
|
6
|
-
* Create the state required to render PopoverTrigger.
|
7
|
-
*
|
8
|
-
* The returned state can be modified with hooks such as usePopoverTriggerStyles,
|
9
|
-
* before being passed to renderPopoverTrigger.
|
10
|
-
*
|
11
|
-
* @param props - props from this instance of PopoverTrigger
|
12
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
13
|
-
*/
|
14
|
-
var usePopoverTrigger = function (props, defaultProps) {
|
15
|
-
var setOpen = popoverContext_1.usePopoverContext(function (context) { return context.setOpen; });
|
16
|
-
var open = popoverContext_1.usePopoverContext(function (context) { return context.open; });
|
17
|
-
var triggerRef = popoverContext_1.usePopoverContext(function (context) { return context.triggerRef; });
|
18
|
-
var openOnHover = popoverContext_1.usePopoverContext(function (context) { return context.openOnHover; });
|
19
|
-
var openOnContext = popoverContext_1.usePopoverContext(function (context) { return context.openOnContext; });
|
20
|
-
var triggerAttributes = react_tabster_1.useModalAttributes().triggerAttributes;
|
21
|
-
var onContextMenu = react_utilities_1.useEventCallback(function (e) {
|
22
|
-
var _a, _b;
|
23
|
-
if (openOnContext) {
|
24
|
-
e.preventDefault();
|
25
|
-
setOpen(e, true);
|
26
|
-
}
|
27
|
-
(_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onContextMenu) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
28
|
-
});
|
29
|
-
var onClick = react_utilities_1.useEventCallback(function (e) {
|
30
|
-
var _a, _b;
|
31
|
-
if (!openOnContext) {
|
32
|
-
setOpen(e, !open);
|
33
|
-
}
|
34
|
-
(_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
35
|
-
});
|
36
|
-
var onKeyDown = react_utilities_1.useEventCallback(function (e) {
|
37
|
-
var _a, _b, _c;
|
38
|
-
if (react_utilities_1.shouldPreventDefaultOnKeyDown(e) && (e.key === ' ' || e.key === 'Enter')) {
|
39
|
-
e.preventDefault();
|
40
|
-
(_a = e.target) === null || _a === void 0 ? void 0 : _a.click();
|
41
|
-
}
|
42
|
-
if (e.key === 'Escape') {
|
43
|
-
setOpen(e, false);
|
44
|
-
}
|
45
|
-
(_c = (_b = child.props) === null || _b === void 0 ? void 0 : _b.onKeyDown) === null || _c === void 0 ? void 0 : _c.call(_b, e);
|
46
|
-
});
|
47
|
-
var onMouseEnter = react_utilities_1.useEventCallback(function (e) {
|
48
|
-
var _a, _b;
|
49
|
-
if (openOnHover) {
|
50
|
-
setOpen(e, true);
|
51
|
-
}
|
52
|
-
(_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
53
|
-
});
|
54
|
-
var onMouseLeave = react_utilities_1.useEventCallback(function (e) {
|
55
|
-
var _a, _b;
|
56
|
-
if (openOnHover) {
|
57
|
-
setOpen(e, false);
|
58
|
-
}
|
59
|
-
(_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseLeave) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
60
|
-
});
|
61
|
-
var child = React.Children.only(props.children);
|
62
|
-
return {
|
63
|
-
children: React.cloneElement(child, tslib_1.__assign({ 'aria-haspopup': 'true', onClick: onClick,
|
64
|
-
onMouseEnter: onMouseEnter,
|
65
|
-
onKeyDown: onKeyDown,
|
66
|
-
onMouseLeave: onMouseLeave,
|
67
|
-
onContextMenu: onContextMenu, ref: react_utilities_1.useMergedRefs(child.ref, triggerRef) }, triggerAttributes)),
|
68
|
-
};
|
69
|
-
};
|
70
|
-
exports.usePopoverTrigger = usePopoverTrigger;
|
71
|
-
});
|
72
|
-
//# sourceMappingURL=usePopoverTrigger.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"usePopoverTrigger.js","sourceRoot":"../src/","sources":["components/PopoverTrigger/usePopoverTrigger.ts"],"names":[],"mappings":";;;;IAMA;;;;;;;;OAQG;IACI,IAAM,iBAAiB,GAAG,UAC/B,KAA0B,EAC1B,YAAkC;QAElC,IAAM,OAAO,GAAG,kCAAiB,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,OAAO,EAAf,CAAe,CAAC,CAAC;QAC9D,IAAM,IAAI,GAAG,kCAAiB,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,IAAI,EAAZ,CAAY,CAAC,CAAC;QACxD,IAAM,UAAU,GAAG,kCAAiB,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,UAAU,EAAlB,CAAkB,CAAC,CAAC;QACpE,IAAM,WAAW,GAAG,kCAAiB,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,WAAW,EAAnB,CAAmB,CAAC,CAAC;QACtE,IAAM,aAAa,GAAG,kCAAiB,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,aAAa,EAArB,CAAqB,CAAC,CAAC;QAClE,IAAA,iBAAiB,GAAK,kCAAkB,EAAE,kBAAzB,CAA0B;QAEnD,IAA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EAAE;gBACf,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aACnB;YACD,YAAA,KAAK,CAAC,KAAK,0CAAE,YAAY,mDAAG,CAAC,EAAE;QACjC,CAAC,CAAC,CAAC;QAEH,IAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClD,OAAO;YACL,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,KAAK,qBAChC,eAAe,EAAE,MAAM,EACvB,OAAO,SAAA;gBACP,YAAY,cAAA;gBACZ,SAAS,WAAA;gBACT,YAAY,cAAA;gBACZ,aAAa,eAAA,EACb,GAAG,EAAE,+BAAa,CAAG,KAAuE,CAAC,GAAG,EAAE,UAAU,CAAC,IAC1G,iBAAiB,EACpB;SACH,CAAC;IACJ,CAAC,CAAC;IAnEW,QAAA,iBAAiB,qBAmE5B","sourcesContent":["import * as React from 'react';\nimport { useMergedRefs, useEventCallback, shouldPreventDefaultOnKeyDown } from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext } from '../../popoverContext';\nimport type { PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.types';\n\n/**\n * Create the state required to render PopoverTrigger.\n *\n * The returned state can be modified with hooks such as usePopoverTriggerStyles,\n * before being passed to renderPopoverTrigger.\n *\n * @param props - props from this instance of PopoverTrigger\n * @param defaultProps - (optional) default prop values provided by the implementing type\n */\nexport const usePopoverTrigger = (\n props: PopoverTriggerProps,\n defaultProps?: PopoverTriggerProps,\n): PopoverTriggerState => {\n const setOpen = usePopoverContext(context => context.setOpen);\n const open = usePopoverContext(context => context.open);\n const triggerRef = usePopoverContext(context => context.triggerRef);\n const openOnHover = usePopoverContext(context => context.openOnHover);\n const openOnContext = usePopoverContext(context => context.openOnContext);\n const { triggerAttributes } = useModalAttributes();\n\n const onContextMenu = useEventCallback((e: React.MouseEvent<HTMLElement>) => {\n if (openOnContext) {\n e.preventDefault();\n setOpen(e, true);\n }\n\n child.props?.onContextMenu?.(e);\n });\n\n const onClick = useEventCallback((e: React.MouseEvent<HTMLElement>) => {\n if (!openOnContext) {\n setOpen(e, !open);\n }\n child.props?.onClick?.(e);\n });\n\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLElement>) => {\n if (shouldPreventDefaultOnKeyDown(e) && (e.key === ' ' || e.key === 'Enter')) {\n e.preventDefault();\n (e.target as HTMLElement)?.click();\n }\n\n if (e.key === 'Escape') {\n setOpen(e, false);\n }\n\n child.props?.onKeyDown?.(e);\n });\n\n const onMouseEnter = useEventCallback((e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, true);\n }\n child.props?.onMouseEnter?.(e);\n });\n\n const onMouseLeave = useEventCallback((e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, false);\n }\n child.props?.onMouseLeave?.(e);\n });\n\n const child = React.Children.only(props.children);\n return {\n children: React.cloneElement(child, {\n 'aria-haspopup': 'true',\n onClick,\n onMouseEnter,\n onKeyDown,\n onMouseLeave,\n onContextMenu,\n ref: useMergedRefs(((child as unknown) as React.ReactElement & React.RefAttributes<unknown>).ref, triggerRef),\n ...triggerAttributes,\n }),\n };\n};\n"]}
|
package/lib-amd/index.d.ts
DELETED
package/lib-amd/index.js
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "./Popover", "./PopoverSurface", "./popoverContext", "./PopoverTrigger"], function (require, exports, tslib_1, Popover_1, PopoverSurface_1, popoverContext_1, PopoverTrigger_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
tslib_1.__exportStar(Popover_1, exports);
|
5
|
-
tslib_1.__exportStar(PopoverSurface_1, exports);
|
6
|
-
tslib_1.__exportStar(popoverContext_1, exports);
|
7
|
-
tslib_1.__exportStar(PopoverTrigger_1, exports);
|
8
|
-
});
|
9
|
-
//# sourceMappingURL=index.js.map
|
package/lib-amd/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":";;;IAAA,yCAA0B;IAC1B,gDAAiC;IACjC,gDAAiC;IACjC,gDAAiC","sourcesContent":["export * from './Popover';\nexport * from './PopoverSurface';\nexport * from './popoverContext';\nexport * from './PopoverTrigger';\n"]}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import type { ContextSelector, Context } from '@fluentui/react-context-selector';
|
2
|
-
import type { PopoverState } from './components/Popover/index';
|
3
|
-
export declare const PopoverContext: Context<PopoverContextValue>;
|
4
|
-
/**
|
5
|
-
* Context shared between Popover and its children components
|
6
|
-
*/
|
7
|
-
export interface PopoverContextValue extends Pick<PopoverState, 'open' | 'setOpen' | 'triggerRef' | 'contentRef' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'noArrow' | 'arrowRef' | 'size' | 'brand' | 'inverted' | 'trapFocus'> {
|
8
|
-
}
|
9
|
-
export declare const usePopoverContext: <T>(selector: ContextSelector<PopoverContextValue, T>) => T;
|
@@ -1,21 +0,0 @@
|
|
1
|
-
define(["require", "exports", "@fluentui/react-context-selector"], function (require, exports, react_context_selector_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.usePopoverContext = exports.PopoverContext = void 0;
|
5
|
-
exports.PopoverContext = react_context_selector_1.createContext({
|
6
|
-
open: false,
|
7
|
-
setOpen: function () { return null; },
|
8
|
-
triggerRef: { current: null },
|
9
|
-
contentRef: { current: null },
|
10
|
-
arrowRef: { current: null },
|
11
|
-
openOnContext: false,
|
12
|
-
openOnHover: false,
|
13
|
-
size: 'medium',
|
14
|
-
trapFocus: false,
|
15
|
-
});
|
16
|
-
var usePopoverContext = function (selector) {
|
17
|
-
return react_context_selector_1.useContextSelector(exports.PopoverContext, selector);
|
18
|
-
};
|
19
|
-
exports.usePopoverContext = usePopoverContext;
|
20
|
-
});
|
21
|
-
//# sourceMappingURL=popoverContext.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"popoverContext.js","sourceRoot":"../src/","sources":["popoverContext.ts"],"names":[],"mappings":";;;;IAIa,QAAA,cAAc,GAAiC,sCAAa,CAAsB;QAC7F,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;QACnB,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC7B,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC7B,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC3B,aAAa,EAAE,KAAK;QACpB,WAAW,EAAE,KAAK;QAClB,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,KAAK;KACjB,CAAC,CAAC;IAuBI,IAAM,iBAAiB,GAAG,UAAI,QAAiD;QACpF,OAAA,2CAAkB,CAAC,sBAAc,EAAE,QAAQ,CAAC;IAA5C,CAA4C,CAAC;IADlC,QAAA,iBAAiB,qBACiB","sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector, Context } from '@fluentui/react-context-selector';\nimport type { PopoverState } from './components/Popover/index';\n\nexport const PopoverContext: Context<PopoverContextValue> = createContext<PopoverContextValue>({\n open: false,\n setOpen: () => null,\n triggerRef: { current: null },\n contentRef: { current: null },\n arrowRef: { current: null },\n openOnContext: false,\n openOnHover: false,\n size: 'medium',\n trapFocus: false,\n});\n\n/**\n * Context shared between Popover and its children components\n */\nexport interface PopoverContextValue\n extends Pick<\n PopoverState,\n | 'open'\n | 'setOpen'\n | 'triggerRef'\n | 'contentRef'\n | 'openOnHover'\n | 'openOnContext'\n | 'mountNode'\n | 'noArrow'\n | 'arrowRef'\n | 'size'\n | 'brand'\n | 'inverted'\n | 'trapFocus'\n > {}\n\nexport const usePopoverContext = <T>(selector: ContextSelector<PopoverContextValue, T>): T =>\n useContextSelector(PopoverContext, selector);\n"]}
|