@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.
- package/CHANGELOG.json +478 -25
- package/CHANGELOG.md +115 -15
- package/dist/react-popover.d.ts +36 -23
- package/lib/Popover.js.map +1 -1
- package/lib/PopoverSurface.js.map +1 -1
- package/lib/PopoverTrigger.js.map +1 -1
- package/lib/components/Popover/Popover.js +5 -5
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.types.d.ts +7 -4
- package/lib/components/Popover/Popover.types.js.map +1 -1
- package/lib/components/Popover/index.js.map +1 -1
- package/lib/components/Popover/renderPopover.d.ts +1 -1
- package/lib/components/Popover/renderPopover.js +27 -25
- package/lib/components/Popover/renderPopover.js.map +1 -1
- package/lib/components/Popover/usePopover.d.ts +2 -2
- package/lib/components/Popover/usePopover.js +42 -53
- package/lib/components/Popover/usePopover.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.js +7 -7
- package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +2 -2
- package/lib/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
- package/lib/components/PopoverSurface/index.js.map +1 -1
- package/lib/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
- package/lib/components/PopoverSurface/renderPopoverSurface.js +7 -8
- package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurface.d.ts +4 -5
- package/lib/components/PopoverSurface/usePopoverSurface.js +44 -58
- package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +34 -22
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.d.ts +2 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.js +6 -5
- package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.types.d.ts +9 -2
- package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib/components/PopoverTrigger/index.js.map +1 -1
- package/lib/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
- package/lib/components/PopoverTrigger/renderPopoverTrigger.js +1 -1
- package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -2
- package/lib/components/PopoverTrigger/usePopoverTrigger.js +39 -54
- package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/popoverContext.d.ts +1 -1
- package/lib/popoverContext.js +3 -7
- package/lib/popoverContext.js.map +1 -1
- package/lib-commonjs/Popover.js +1 -1
- package/lib-commonjs/Popover.js.map +1 -1
- package/lib-commonjs/PopoverSurface.js +1 -1
- package/lib-commonjs/PopoverSurface.js.map +1 -1
- package/lib-commonjs/PopoverTrigger.js +1 -1
- package/lib-commonjs/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.js +5 -5
- package/lib-commonjs/components/Popover/Popover.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.types.d.ts +7 -4
- package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
- package/lib-commonjs/components/Popover/index.js +1 -1
- package/lib-commonjs/components/Popover/index.js.map +1 -1
- package/lib-commonjs/components/Popover/renderPopover.d.ts +1 -1
- package/lib-commonjs/components/Popover/renderPopover.js +31 -29
- package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
- package/lib-commonjs/components/Popover/usePopover.d.ts +2 -2
- package/lib-commonjs/components/Popover/usePopover.js +50 -62
- package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +8 -8
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +2 -2
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/index.js +1 -1
- package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +12 -15
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.d.ts +4 -5
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +50 -65
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +38 -24
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.d.ts +2 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +6 -5
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.d.ts +9 -2
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/index.js +1 -1
- package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +3 -3
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -2
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +44 -60
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib-commonjs/index.js +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/popoverContext.d.ts +1 -1
- package/lib-commonjs/popoverContext.js +5 -9
- package/lib-commonjs/popoverContext.js.map +1 -1
- package/package.json +14 -15
- package/lib/common/isConformant.d.ts +0 -4
- package/lib/common/isConformant.js +0 -13
- package/lib/common/isConformant.js.map +0 -1
- package/lib/common/mockUsePopoverContext.d.ts +0 -7
- package/lib/common/mockUsePopoverContext.js +0 -38
- package/lib/common/mockUsePopoverContext.js.map +0 -1
- package/lib-commonjs/common/isConformant.d.ts +0 -4
- package/lib-commonjs/common/isConformant.js +0 -24
- package/lib-commonjs/common/isConformant.js.map +0 -1
- package/lib-commonjs/common/mockUsePopoverContext.d.ts +0 -7
- package/lib-commonjs/common/mockUsePopoverContext.js +0 -49
- package/lib-commonjs/common/mockUsePopoverContext.js.map +0 -1
@@ -3,10 +3,15 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.usePopoverSurfaceStyles_unstable = exports.arrowHeights = exports.popoverSurfaceClassName = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const react_1 = /*#__PURE__*/require("@griffel/react");
|
9
9
|
|
10
|
+
const react_positioning_1 = /*#__PURE__*/require("@fluentui/react-positioning");
|
11
|
+
|
12
|
+
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
13
|
+
|
14
|
+
exports.popoverSurfaceClassName = 'fui-PopoverSurface';
|
10
15
|
exports.arrowHeights = {
|
11
16
|
small: 6,
|
12
17
|
medium: 8,
|
@@ -16,11 +21,14 @@ exports.arrowHeights = {
|
|
16
21
|
* Styles for the root slot
|
17
22
|
*/
|
18
23
|
|
19
|
-
|
24
|
+
const useStyles = /*#__PURE__*/react_1.__styles({
|
20
25
|
"root": {
|
21
26
|
"De3pzq": "fxugw4r",
|
22
|
-
"E5pizo":
|
23
|
-
"
|
27
|
+
"E5pizo": "f1hg901r",
|
28
|
+
"Bbmb7ep": ["fff7au0", "f1bjk9e1"],
|
29
|
+
"Beyfa6y": ["f1bjk9e1", "fff7au0"],
|
30
|
+
"B7oj6ja": ["fwsfkhu", "f8wkphi"],
|
31
|
+
"Btl43ni": ["f8wkphi", "fwsfkhu"],
|
24
32
|
"B4j52fo": "f5ogflp",
|
25
33
|
"Bekrc4i": ["f1hqa2wf", "finvdd3"],
|
26
34
|
"Bn0qgzm": "f1f09k3d",
|
@@ -61,50 +69,56 @@ var useStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
|
61
69
|
"uwmqm3": ["fekwl8i", "fat0sn4"]
|
62
70
|
},
|
63
71
|
"smallArrow": {
|
64
|
-
"a9b677": "
|
65
|
-
"Bqenvij": "
|
72
|
+
"a9b677": "f1ekdpwm",
|
73
|
+
"Bqenvij": "f83vc9z"
|
66
74
|
},
|
67
75
|
"mediumLargeArrow": {
|
68
|
-
"a9b677": "
|
69
|
-
"Bqenvij": "
|
76
|
+
"a9b677": "f1kmc0fn",
|
77
|
+
"Bqenvij": "fb6lvc5"
|
70
78
|
},
|
71
79
|
"arrow": {
|
72
80
|
"qhf8xq": "f1euv43f",
|
73
|
-
"
|
81
|
+
"De3pzq": "f1u2r49w",
|
74
82
|
"Bcdw1i0": "fd7fpy0",
|
75
83
|
"Bj3rh1h": "f1bsuimh",
|
76
84
|
"rurcny": "fuzzvh5",
|
77
|
-
"
|
85
|
+
"Bex5imi": "fkk33zh",
|
78
86
|
"xx9plb": "fxf9f1y",
|
87
|
+
"Bmqnesq": "f170vdtw",
|
79
88
|
"Bdn98qo": "f103af6e",
|
80
89
|
"Bbc2r3f": "f15umuo5",
|
81
|
-
"
|
82
|
-
"
|
90
|
+
"B1dvbpk": "f3wpjpt",
|
91
|
+
"D4ky5z": "f1k3tce7",
|
92
|
+
"cqycoz": "f1dkdgqi",
|
93
|
+
"I89eb": "f5ghsz",
|
94
|
+
"k1i1uq": "fyqop9u",
|
95
|
+
"Epwjcz": "f1m5ya7j",
|
96
|
+
"Bp1vogq": "f3sp63x",
|
83
97
|
"px8gyy": ["f5bg3dr", "f1rfdd74"],
|
84
|
-
"h6z6rw":
|
85
|
-
"hl6cv3": "
|
98
|
+
"h6z6rw": "fzd2j21",
|
99
|
+
"hl6cv3": "f1773hnp",
|
86
100
|
"Bh2vraf": "f1n8855c",
|
87
|
-
"yayu3t":
|
101
|
+
"yayu3t": "f1v7783n",
|
88
102
|
"wedwtw": "fsw6im5",
|
89
|
-
"rhl9o9": "
|
103
|
+
"rhl9o9": "fh2hsk5",
|
90
104
|
"Bu8t5uz": "f159pzir",
|
91
|
-
"B6q6orb":
|
105
|
+
"B6q6orb": "f11yvu4",
|
92
106
|
"Bwwlvwl": "fm1ycve"
|
93
107
|
}
|
94
108
|
}, {
|
95
|
-
"d": [".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".f1hg901r{box-shadow:var(--shadow16);}", ".
|
109
|
+
"d": [".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".f1hg901r{box-shadow:var(--shadow16);}", ".fff7au0{border-bottom-right-radius:4px;}", ".f1bjk9e1{border-bottom-left-radius:4px;}", ".fwsfkhu{border-top-right-radius:4px;}", ".f8wkphi{border-top-left-radius:4px;}", ".f5ogflp{border-top-width:1px;}", ".f1hqa2wf{border-right-width:1px;}", ".finvdd3{border-left-width:1px;}", ".f1f09k3d{border-bottom-width:1px;}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".fghlq4f{border-top-color:var(--colorTransparentStroke);}", ".f1gn591s{border-right-color:var(--colorTransparentStroke);}", ".fjscplz{border-left-color:var(--colorTransparentStroke);}", ".fb073pr{border-bottom-color:var(--colorTransparentStroke);}", ".f1c73kur{background-color:var(--colorNeutralForeground1);}", ".fqpbvvt{color:var(--colorNeutralForegroundInverted);}", ".ffp7eso{background-color:var(--colorBrandBackground);}", ".f1kcqot9{padding-top:12px;}", ".f11qrl6u{padding-right:12px;}", ".fjlbh76{padding-left:12px;}", ".fpe6lb7{padding-bottom:12px;}", ".fqag9an{padding-top:16px;}", ".f1gbmcue{padding-right:16px;}", ".f1rh9g5y{padding-left:16px;}", ".fp67ikv{padding-bottom:16px;}", ".fc7z3ec{padding-top:20px;}", ".fat0sn4{padding-right:20px;}", ".fekwl8i{padding-left:20px;}", ".fe2my4m{padding-bottom:20px;}", ".f1ekdpwm{width:8.484px;}", ".f83vc9z{height:8.484px;}", ".f1kmc0fn{width:11.312px;}", ".fb6lvc5{height:11.312px;}", ".f1euv43f{position:absolute;}", ".f1u2r49w{background-color:inherit;}", ".fd7fpy0{visibility:hidden;}", ".f1bsuimh{z-index:-1;}", ".fuzzvh5:before{content:\"\";}", ".fkk33zh:before{visibility:visible;}", ".fxf9f1y:before{position:absolute;}", ".f170vdtw:before{box-sizing:border-box;}", ".f103af6e:before{width:inherit;}", ".f15umuo5:before{height:inherit;}", ".f3wpjpt:before{background-color:inherit;}", ".f1k3tce7:before{border-right-width:1px;}", ".f1dkdgqi:before{border-right-style:solid;}", ".f5ghsz:before{border-right-color:var(--colorTransparentStroke);}", ".fyqop9u:before{border-bottom-width:1px;}", ".f1m5ya7j:before{border-bottom-style:solid;}", ".f3sp63x:before{border-bottom-color:var(--colorTransparentStroke);}", ".f5bg3dr:before{border-bottom-right-radius:var(--borderRadiusSmall);}", ".f1rfdd74:before{border-bottom-left-radius:var(--borderRadiusSmall);}", ".fzd2j21:before{-webkit-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-moz-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-ms-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);}", "[data-popper-placement^=\"top\"] .f1773hnp{bottom:-1px;}", "[data-popper-placement^=\"top\"] .f1n8855c{--angle:0;}", "[data-popper-placement^=\"right\"] .f1v7783n{left:-1px;}", "[data-popper-placement^=\"right\"] .fsw6im5{--angle:90deg;}", "[data-popper-placement^=\"bottom\"] .fh2hsk5{top:-1px;}", "[data-popper-placement^=\"bottom\"] .f159pzir{--angle:180deg;}", "[data-popper-placement^=\"left\"] .f11yvu4{right:-1px;}", "[data-popper-placement^=\"left\"] .fm1ycve{--angle:270deg;}"]
|
96
110
|
});
|
97
111
|
/**
|
98
112
|
* Apply styling to the PopoverSurface slots based on the state
|
99
113
|
*/
|
100
114
|
|
101
115
|
|
102
|
-
|
103
|
-
|
104
|
-
state.root.className =
|
105
|
-
state.arrowClassName =
|
116
|
+
const usePopoverSurfaceStyles_unstable = state => {
|
117
|
+
const styles = useStyles();
|
118
|
+
state.root.className = react_1.mergeClasses(exports.popoverSurfaceClassName, styles.root, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.appearance === 'inverted' && styles.inverted, state.appearance === 'brand' && styles.brand, state.root.className);
|
119
|
+
state.arrowClassName = react_1.mergeClasses(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);
|
106
120
|
return state;
|
107
121
|
};
|
108
122
|
|
109
|
-
exports.
|
123
|
+
exports.usePopoverSurfaceStyles_unstable = usePopoverSurfaceStyles_unstable;
|
110
124
|
//# sourceMappingURL=usePopoverSurfaceStyles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/PopoverSurface/usePopoverSurfaceStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAIa,OAAA,CAAA,uBAAA,GAA0B,oBAA1B;AAEA,OAAA,CAAA,YAAA,GAA4C;AACvD,EAAA,KAAK,EAAE,CADgD;AAEvD,EAAA,MAAM,EAAE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AA,CAAA,YAAA,CACrB,MAAM,CAAC,KADc,EAErB,KAAK,CAAC,IAAN,KAAe,OAAf,GAAyB,MAAM,CAAC,UAAhC,GAA6C,MAAM,CAAC,gBAF/B,CAAvB;AAKA,SAAO,KAAP;AACD,CAnBM;;AAAM,OAAA,CAAA,gCAAA,GAAgC,gCAAhC","sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { createArrowHeightStyles, createArrowStyles } from '@fluentui/react-positioning';\nimport { tokens } from '@fluentui/react-theme';\nimport type { PopoverSize } from '../Popover/Popover.types';\nimport type { PopoverSurfaceState } from './PopoverSurface.types';\n\nexport const popoverSurfaceClassName = 'fui-PopoverSurface';\n\nexport const arrowHeights: Record<PopoverSize, number> = {\n small: 6,\n medium: 8,\n large: 8,\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow16,\n ...shorthands.borderRadius('4px'),\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n },\n\n inverted: {\n // TODO: neutral background inverted missing from superset and theme\n backgroundColor: tokens.colorNeutralForeground1,\n color: tokens.colorNeutralForegroundInverted,\n },\n\n brand: {\n backgroundColor: tokens.colorBrandBackground,\n // TODO: clarify with designers what foreground color should be with brand background,\n color: tokens.colorNeutralForegroundInverted,\n },\n\n smallPadding: {\n ...shorthands.padding('12px'),\n },\n\n mediumPadding: {\n ...shorthands.padding('16px'),\n },\n\n largePadding: {\n ...shorthands.padding('20px'),\n },\n\n smallArrow: createArrowHeightStyles(arrowHeights.small),\n mediumLargeArrow: createArrowHeightStyles(arrowHeights.medium),\n arrow: createArrowStyles({ arrowHeight: undefined }),\n});\n\n/**\n * Apply styling to the PopoverSurface slots based on the state\n */\nexport const usePopoverSurfaceStyles_unstable = (state: PopoverSurfaceState): PopoverSurfaceState => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n popoverSurfaceClassName,\n styles.root,\n state.size === 'small' && styles.smallPadding,\n state.size === 'medium' && styles.mediumPadding,\n state.size === 'large' && styles.largePadding,\n state.appearance === 'inverted' && styles.inverted,\n state.appearance === 'brand' && styles.brand,\n state.root.className,\n );\n\n state.arrowClassName = mergeClasses(\n styles.arrow,\n state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
+
import type { FluentTriggerComponent } from '@fluentui/react-utilities';
|
2
3
|
import type { PopoverTriggerProps } from './PopoverTrigger.types';
|
3
4
|
/**
|
4
5
|
* Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
|
5
6
|
*/
|
6
|
-
export declare const PopoverTrigger: React.FC<PopoverTriggerProps
|
7
|
+
export declare const PopoverTrigger: React.FC<PopoverTriggerProps> & FluentTriggerComponent;
|
@@ -5,19 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.PopoverTrigger = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const usePopoverTrigger_1 = /*#__PURE__*/require("./usePopoverTrigger");
|
9
9
|
|
10
|
-
|
10
|
+
const renderPopoverTrigger_1 = /*#__PURE__*/require("./renderPopoverTrigger");
|
11
11
|
/**
|
12
12
|
* Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
|
13
13
|
*/
|
14
14
|
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
return renderPopoverTrigger_1.
|
16
|
+
const PopoverTrigger = props => {
|
17
|
+
const state = usePopoverTrigger_1.usePopoverTrigger_unstable(props);
|
18
|
+
return renderPopoverTrigger_1.renderPopoverTrigger_unstable(state);
|
19
19
|
};
|
20
20
|
|
21
21
|
exports.PopoverTrigger = PopoverTrigger;
|
22
22
|
exports.PopoverTrigger.displayName = 'PopoverTrigger';
|
23
|
+
exports.PopoverTrigger.isFluentTriggerComponent = true;
|
23
24
|
//# sourceMappingURL=PopoverTrigger.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":";;;;;;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAIA;;AAEG;;;AACI,MAAM,cAAc,GAA2D,KAAK,IAAG;AAC5F,QAAM,KAAK,GAAG,mBAAA,CAAA,0BAAA,CAA2B,KAA3B,CAAd;AAEA,SAAO,sBAAA,CAAA,6BAAA,CAA8B,KAA9B,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd;AAMb,OAAA,CAAA,cAAA,CAAe,WAAf,GAA6B,gBAA7B;AACA,OAAA,CAAA,cAAA,CAAe,wBAAf,GAA0C,IAA1C","sourcesContent":["import * as React from 'react';\nimport { usePopoverTrigger_unstable } from './usePopoverTrigger';\nimport { renderPopoverTrigger_unstable } from './renderPopoverTrigger';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\nimport type { PopoverTriggerProps } from './PopoverTrigger.types';\n\n/**\n * Wraps a trigger element as an only child and adds the necessary event handling to open a popover.\n */\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> & FluentTriggerComponent = props => {\n const state = usePopoverTrigger_unstable(props);\n\n return renderPopoverTrigger_unstable(state);\n};\n\nPopoverTrigger.displayName = 'PopoverTrigger';\nPopoverTrigger.isFluentTriggerComponent = true;\n"],"sourceRoot":"../src/"}
|
@@ -3,9 +3,16 @@ import * as React from 'react';
|
|
3
3
|
* PopoverTrigger Props
|
4
4
|
*/
|
5
5
|
export declare type PopoverTriggerProps = {
|
6
|
-
children: React.ReactElement
|
6
|
+
children: (React.ReactElement & {
|
7
|
+
ref?: React.Ref<unknown>;
|
8
|
+
}) | ((props: PopoverTriggerChildProps) => React.ReactElement | null);
|
7
9
|
};
|
8
10
|
/**
|
9
11
|
* PopoverTrigger State
|
10
12
|
*/
|
11
|
-
export declare type PopoverTriggerState =
|
13
|
+
export declare type PopoverTriggerState = {
|
14
|
+
children: React.ReactElement | null;
|
15
|
+
};
|
16
|
+
export declare type PopoverTriggerChildProps = {
|
17
|
+
ref?: React.Ref<never>;
|
18
|
+
} & Pick<React.HTMLAttributes<HTMLElement>, 'aria-haspopup' | 'onClick' | 'onMouseEnter' | 'onKeyDown' | 'onMouseLeave' | 'onContextMenu'>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/PopoverTrigger/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './PopoverTrigger';\nexport * from './PopoverTrigger.types';\nexport * from './renderPopoverTrigger';\nexport * from './usePopoverTrigger';\n"],"sourceRoot":"../src/"}
|
@@ -2,4 +2,4 @@ import type { PopoverTriggerState } from './PopoverTrigger.types';
|
|
2
2
|
/**
|
3
3
|
* Render the final JSX of PopoverTrigger
|
4
4
|
*/
|
5
|
-
export declare const
|
5
|
+
export declare const renderPopoverTrigger_unstable: (state: PopoverTriggerState) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
@@ -3,14 +3,14 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.renderPopoverTrigger_unstable = void 0;
|
7
7
|
/**
|
8
8
|
* Render the final JSX of PopoverTrigger
|
9
9
|
*/
|
10
10
|
|
11
|
-
|
11
|
+
const renderPopoverTrigger_unstable = state => {
|
12
12
|
return state.children;
|
13
13
|
};
|
14
14
|
|
15
|
-
exports.
|
15
|
+
exports.renderPopoverTrigger_unstable = renderPopoverTrigger_unstable;
|
16
16
|
//# sourceMappingURL=renderPopoverTrigger.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":";;;;;;AAEA;;AAEG;;AACI,MAAM,6BAA6B,GAAI,KAAD,IAA+B;AAC1E,SAAO,KAAK,CAAC,QAAb;AACD,CAFM;;AAAM,OAAA,CAAA,6BAAA,GAA6B,6BAA7B","sourcesContent":["import type { PopoverTriggerState } from './PopoverTrigger.types';\n\n/**\n * Render the final JSX of PopoverTrigger\n */\nexport const renderPopoverTrigger_unstable = (state: PopoverTriggerState) => {\n return state.children;\n};\n"],"sourceRoot":"../src/"}
|
@@ -3,8 +3,8 @@ import type { PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.
|
|
3
3
|
* Create the state required to render PopoverTrigger.
|
4
4
|
*
|
5
5
|
* The returned state can be modified with hooks such as usePopoverTriggerStyles,
|
6
|
-
* before being passed to
|
6
|
+
* before being passed to renderPopoverTrigger_unstable.
|
7
7
|
*
|
8
8
|
* @param props - props from this instance of PopoverTrigger
|
9
9
|
*/
|
10
|
-
export declare const
|
10
|
+
export declare const usePopoverTrigger_unstable: (props: PopoverTriggerProps) => PopoverTriggerState;
|
@@ -3,65 +3,57 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.usePopoverTrigger_unstable = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
9
|
|
10
|
-
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
11
|
|
12
|
-
|
12
|
+
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
var popoverContext_1 = /*#__PURE__*/require("../../popoverContext");
|
14
|
+
const popoverContext_1 = /*#__PURE__*/require("../../popoverContext");
|
17
15
|
/**
|
18
16
|
* Create the state required to render PopoverTrigger.
|
19
17
|
*
|
20
18
|
* The returned state can be modified with hooks such as usePopoverTriggerStyles,
|
21
|
-
* before being passed to
|
19
|
+
* before being passed to renderPopoverTrigger_unstable.
|
22
20
|
*
|
23
21
|
* @param props - props from this instance of PopoverTrigger
|
24
22
|
*/
|
25
23
|
|
26
24
|
|
27
|
-
|
28
|
-
var
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
});
|
43
|
-
|
44
|
-
|
45
|
-
var _a, _b;
|
46
|
-
|
25
|
+
const usePopoverTrigger_unstable = props => {
|
26
|
+
var _a, _b, _c, _d, _e;
|
27
|
+
|
28
|
+
const {
|
29
|
+
children
|
30
|
+
} = props;
|
31
|
+
const child = React.isValidElement(children) ? react_utilities_1.getTriggerChild(children) : undefined;
|
32
|
+
const setOpen = popoverContext_1.usePopoverContext_unstable(context => context.setOpen);
|
33
|
+
const open = popoverContext_1.usePopoverContext_unstable(context => context.open);
|
34
|
+
const triggerRef = popoverContext_1.usePopoverContext_unstable(context => context.triggerRef);
|
35
|
+
const openOnHover = popoverContext_1.usePopoverContext_unstable(context => context.openOnHover);
|
36
|
+
const openOnContext = popoverContext_1.usePopoverContext_unstable(context => context.openOnContext);
|
37
|
+
const trapFocus = popoverContext_1.usePopoverContext_unstable(context => context.trapFocus);
|
38
|
+
const {
|
39
|
+
triggerAttributes
|
40
|
+
} = react_tabster_1.useModalAttributes();
|
41
|
+
|
42
|
+
const onContextMenu = e => {
|
47
43
|
if (openOnContext) {
|
48
44
|
e.preventDefault();
|
49
45
|
setOpen(e, true);
|
50
46
|
}
|
47
|
+
};
|
51
48
|
|
52
|
-
|
53
|
-
});
|
54
|
-
var onClick = react_utilities_1.useEventCallback(function (e) {
|
55
|
-
var _a, _b;
|
56
|
-
|
49
|
+
const onClick = e => {
|
57
50
|
if (!openOnContext) {
|
58
51
|
setOpen(e, !open);
|
59
52
|
}
|
53
|
+
};
|
60
54
|
|
61
|
-
|
62
|
-
|
63
|
-
var onKeyDown = react_utilities_1.useEventCallback(function (e) {
|
64
|
-
var _a, _b, _c;
|
55
|
+
const onKeyDown = e => {
|
56
|
+
var _a;
|
65
57
|
|
66
58
|
if (react_utilities_1.shouldPreventDefaultOnKeyDown(e) && (e.key === ' ' || e.key === 'Enter')) {
|
67
59
|
e.preventDefault();
|
@@ -71,41 +63,33 @@ var usePopoverTrigger = function (props) {
|
|
71
63
|
if (e.key === 'Escape') {
|
72
64
|
setOpen(e, false);
|
73
65
|
}
|
66
|
+
};
|
74
67
|
|
75
|
-
|
76
|
-
});
|
77
|
-
var onMouseEnter = react_utilities_1.useEventCallback(function (e) {
|
78
|
-
var _a, _b;
|
79
|
-
|
68
|
+
const onMouseEnter = react_utilities_1.useEventCallback(e => {
|
80
69
|
if (openOnHover) {
|
81
70
|
setOpen(e, true);
|
82
71
|
}
|
83
|
-
|
84
|
-
(_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
85
72
|
});
|
86
|
-
var onMouseLeave = react_utilities_1.useEventCallback(function (e) {
|
87
|
-
var _a, _b;
|
88
73
|
|
74
|
+
const onMouseLeave = e => {
|
89
75
|
if (openOnHover) {
|
90
76
|
setOpen(e, false);
|
91
77
|
}
|
78
|
+
};
|
92
79
|
|
93
|
-
(_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseLeave) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
94
|
-
});
|
95
|
-
var child = React.Children.only(props.children);
|
96
80
|
return {
|
97
|
-
children:
|
98
|
-
'aria-haspopup': 'true'
|
99
|
-
|
100
|
-
onClick: onClick,
|
101
|
-
onMouseEnter: onMouseEnter,
|
102
|
-
onKeyDown: onKeyDown,
|
103
|
-
onMouseLeave: onMouseLeave,
|
104
|
-
onContextMenu: onContextMenu,
|
105
|
-
ref: react_utilities_1.useMergedRefs(child.ref
|
106
|
-
})
|
81
|
+
children: react_utilities_1.applyTriggerPropsToChildren(props.children, { ...triggerAttributes,
|
82
|
+
'aria-haspopup': trapFocus ? 'dialog' : 'true',
|
83
|
+
...(child === null || child === void 0 ? void 0 : child.props),
|
84
|
+
onClick: react_utilities_1.useMergedEventCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onClick, onClick),
|
85
|
+
onMouseEnter: react_utilities_1.useMergedEventCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onMouseEnter, onMouseEnter),
|
86
|
+
onKeyDown: react_utilities_1.useMergedEventCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onKeyDown, onKeyDown),
|
87
|
+
onMouseLeave: react_utilities_1.useMergedEventCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onMouseLeave, onMouseLeave),
|
88
|
+
onContextMenu: react_utilities_1.useMergedEventCallbacks((_e = child === null || child === void 0 ? void 0 : child.props) === null || _e === void 0 ? void 0 : _e.onContextMenu, onContextMenu),
|
89
|
+
ref: react_utilities_1.useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref)
|
90
|
+
})
|
107
91
|
};
|
108
92
|
};
|
109
93
|
|
110
|
-
exports.
|
94
|
+
exports.usePopoverTrigger_unstable = usePopoverTrigger_unstable;
|
111
95
|
//# sourceMappingURL=us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A,CAAL,GAAA,KAAK,CAAE,KAAP,MAAY,IAAZ,IAAY,EAAA,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAY,EAAA,CAAE,aAAtC,EAAqD,aAArD,CAR+D;AAS9E,MAAA,GAAG,EAAE,iBAAA,CAAA,aAAA,CAAc,UAAd,EAA0B,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,GAAjC;AATyE,KAAtE;AADL,GAAP;AAaD,CA7DM;;AAAM,OAAA,CAAA,0BAAA,GAA0B,0BAA1B","sourcesContent":["import * as React from 'react';\nimport {\n applyTriggerPropsToChildren,\n getTriggerChild,\n shouldPreventDefaultOnKeyDown,\n useMergedRefs,\n useMergedEventCallbacks,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport type { PopoverTriggerChildProps, 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_unstable.\n *\n * @param props - props from this instance of PopoverTrigger\n */\nexport const usePopoverTrigger_unstable = (props: PopoverTriggerProps): PopoverTriggerState => {\n const { children } = props;\n const child = React.isValidElement(children) ? getTriggerChild(children) : undefined;\n\n const setOpen = usePopoverContext_unstable(context => context.setOpen);\n const open = usePopoverContext_unstable(context => context.open);\n const triggerRef = usePopoverContext_unstable(context => context.triggerRef);\n const openOnHover = usePopoverContext_unstable(context => context.openOnHover);\n const openOnContext = usePopoverContext_unstable(context => context.openOnContext);\n const trapFocus = usePopoverContext_unstable(context => context.trapFocus);\n const { triggerAttributes } = useModalAttributes();\n\n const onContextMenu = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnContext) {\n e.preventDefault();\n setOpen(e, true);\n }\n };\n\n const onClick = (e: React.MouseEvent<HTMLElement>) => {\n if (!openOnContext) {\n setOpen(e, !open);\n }\n };\n\n const onKeyDown = (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\n const onMouseEnter = useEventCallback((e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, true);\n }\n });\n\n const onMouseLeave = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, false);\n }\n };\n\n return {\n children: applyTriggerPropsToChildren<PopoverTriggerChildProps>(props.children, {\n ...triggerAttributes,\n 'aria-haspopup': trapFocus ? 'dialog' : 'true',\n ...child?.props,\n onClick: useMergedEventCallbacks(child?.props?.onClick, onClick),\n onMouseEnter: useMergedEventCallbacks(child?.props?.onMouseEnter, onMouseEnter),\n onKeyDown: useMergedEventCallbacks(child?.props?.onKeyDown, onKeyDown),\n onMouseLeave: useMergedEventCallbacks(child?.props?.onMouseLeave, onMouseLeave),\n onContextMenu: useMergedEventCallbacks(child?.props?.onContextMenu, onContextMenu),\n ref: useMergedRefs(triggerRef, child?.ref),\n }),\n };\n};\n"],"sourceRoot":"../src/"}
|
package/lib-commonjs/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,WAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Popover';\nexport * from './PopoverSurface';\nexport * from './popoverContext';\nexport * from './PopoverTrigger';\n"],"sourceRoot":"../src/"}
|
@@ -5,4 +5,4 @@ export declare const PopoverContext: Context<PopoverContextValue>;
|
|
5
5
|
* Context shared between Popover and its children components
|
6
6
|
*/
|
7
7
|
export declare type PopoverContextValue = Pick<PopoverState, 'open' | 'setOpen' | 'triggerRef' | 'contentRef' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'noArrow' | 'arrowRef' | 'size' | 'appearance' | 'trapFocus'>;
|
8
|
-
export declare const
|
8
|
+
export declare const usePopoverContext_unstable: <T>(selector: ContextSelector<PopoverContextValue, T>) => T;
|
@@ -3,15 +3,13 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.usePopoverContext_unstable = exports.PopoverContext = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector");
|
9
9
|
|
10
10
|
exports.PopoverContext = /*#__PURE__*/react_context_selector_1.createContext({
|
11
11
|
open: false,
|
12
|
-
setOpen:
|
13
|
-
return null;
|
14
|
-
},
|
12
|
+
setOpen: () => null,
|
15
13
|
triggerRef: {
|
16
14
|
current: null
|
17
15
|
},
|
@@ -27,9 +25,7 @@ exports.PopoverContext = /*#__PURE__*/react_context_selector_1.createContext({
|
|
27
25
|
trapFocus: false
|
28
26
|
});
|
29
27
|
|
30
|
-
|
31
|
-
return react_context_selector_1.useContextSelector(exports.PopoverContext, selector);
|
32
|
-
};
|
28
|
+
const usePopoverContext_unstable = selector => react_context_selector_1.useContextSelector(exports.PopoverContext, selector);
|
33
29
|
|
34
|
-
exports.
|
30
|
+
exports.usePopoverContext_unstable = usePopoverContext_unstable;
|
35
31
|
//# sourceMappingURL=popoverContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["popoverContext.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AAIa,OAAA,CAAA,cAAA,gBAA+C,wBAAA,CAAA,aAAA,CAAmC;AAC7F,EAAA,IAAI,EAAE,KADuF;AAE7F,EAAA,OAAO,EAAE,MAAM,IAF8E;AAG7F,EAAA,UAAU,EAAE;AAAE,IAAA,OAAO,EAAE;AAAX,GAHiF;AAI7F,EAAA,UAAU,EAAE;AAAE,IAAA,OAAO,EAAE;AAAX,GAJiF;AAK7F,EAAA,QAAQ,EAAE;AAAE,IAAA,OAAO,EAAE;AAAX,GALmF;AAM7F,EAAA,aAAa,EAAE,KAN8E;AAO7F,EAAA,WAAW,EAAE,KAPgF;AAQ7F,EAAA,IAAI,EAAE,QARuF;AAS7F,EAAA,SAAS,EAAE;AATkF,CAAnC,CAA/C;;AA+BN,MAAM,0BAA0B,GAAO,QAAJ,IACxC,wBAAA,CAAA,kBAAA,CAAmB,OAAA,CAAA,cAAnB,EAAmC,QAAnC,CADK;;AAAM,OAAA,CAAA,0BAAA,GAA0B,0BAA1B","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 type PopoverContextValue = Pick<\n PopoverState,\n | 'open'\n | 'setOpen'\n | 'triggerRef'\n | 'contentRef'\n | 'openOnHover'\n | 'openOnContext'\n | 'mountNode'\n | 'noArrow'\n | 'arrowRef'\n | 'size'\n | 'appearance'\n | 'trapFocus'\n>;\n\nexport const usePopoverContext_unstable = <T>(selector: ContextSelector<PopoverContextValue, T>): T =>\n useContextSelector(PopoverContext, selector);\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-popover",
|
3
|
-
"version": "9.0.0-
|
3
|
+
"version": "9.0.0-rc.4",
|
4
4
|
"description": "Popover component for Fluent UI",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -20,17 +20,16 @@
|
|
20
20
|
"lint": "just-scripts lint",
|
21
21
|
"start": "yarn storybook",
|
22
22
|
"e2e": "e2e",
|
23
|
-
"storybook": "
|
24
|
-
"test": "jest",
|
23
|
+
"storybook": "node ../../scripts/storybook/runner",
|
24
|
+
"test": "jest --passWithNoTests",
|
25
25
|
"docs": "api-extractor run --config=config/api-extractor.local.json --local",
|
26
|
-
"build:local": "tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/react-popover/src && yarn docs"
|
26
|
+
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-popover/src && yarn docs",
|
27
|
+
"type-check": "tsc -b tsconfig.json"
|
27
28
|
},
|
28
29
|
"devDependencies": {
|
29
|
-
"@fluentui/babel-make-styles": "9.0.0-nightly.f81b28ceb3.1",
|
30
30
|
"@fluentui/eslint-plugin": "*",
|
31
|
-
"@fluentui/jest-serializer-make-styles": "9.0.0-nightly.f81b28ceb3.1",
|
32
31
|
"@fluentui/react-conformance": "*",
|
33
|
-
"@fluentui/react-conformance-
|
32
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.3",
|
34
33
|
"@fluentui/scripts": "^1.0.0",
|
35
34
|
"@types/enzyme": "3.10.3",
|
36
35
|
"@types/enzyme-adapter-react-16": "1.0.3",
|
@@ -44,13 +43,14 @@
|
|
44
43
|
"react-test-renderer": "^16.3.0"
|
45
44
|
},
|
46
45
|
"dependencies": {
|
47
|
-
"@fluentui/react-context-selector": "9.0.0-
|
48
|
-
"@
|
49
|
-
"@fluentui/react-portal": "9.0.0-
|
50
|
-
"@fluentui/react-positioning": "9.0.0-
|
51
|
-
"@fluentui/react-shared-contexts": "9.0.0-
|
52
|
-
"@fluentui/react-tabster": "9.0.0-
|
53
|
-
"@fluentui/react-
|
46
|
+
"@fluentui/react-context-selector": "9.0.0-rc.4",
|
47
|
+
"@griffel/react": "1.0.0",
|
48
|
+
"@fluentui/react-portal": "9.0.0-rc.4",
|
49
|
+
"@fluentui/react-positioning": "9.0.0-rc.4",
|
50
|
+
"@fluentui/react-shared-contexts": "9.0.0-rc.3",
|
51
|
+
"@fluentui/react-tabster": "9.0.0-rc.4",
|
52
|
+
"@fluentui/react-theme": "9.0.0-rc.3",
|
53
|
+
"@fluentui/react-utilities": "9.0.0-rc.4",
|
54
54
|
"tslib": "^2.1.0"
|
55
55
|
},
|
56
56
|
"peerDependencies": {
|
@@ -60,7 +60,6 @@
|
|
60
60
|
"react-dom": ">=16.8.0 <18.0.0"
|
61
61
|
},
|
62
62
|
"beachball": {
|
63
|
-
"tag": "beta",
|
64
63
|
"disallowedChangeTypes": [
|
65
64
|
"major",
|
66
65
|
"minor",
|