@fluentui/react-popover 9.5.4 → 9.5.6
Sign up to get free protection for your applications and to get access to all the features.
- package/.swcrc +30 -0
- package/CHANGELOG.json +115 -1
- package/CHANGELOG.md +34 -2
- 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 +1 -0
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.types.js +1 -1
- package/lib/components/Popover/Popover.types.js.map +1 -1
- package/lib/components/Popover/constants.js +1 -2
- package/lib/components/Popover/constants.js.map +1 -1
- package/lib/components/Popover/index.js.map +1 -1
- package/lib/components/Popover/renderPopover.js.map +1 -1
- package/lib/components/Popover/usePopover.js +8 -8
- package/lib/components/Popover/usePopover.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
- 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 +1 -3
- package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurface.js +3 -2
- package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.js +1 -0
- package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.types.js +1 -1
- 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 +1 -2
- package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/usePopoverTrigger.js +1 -0
- package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/popoverContext.js.map +1 -1
- package/lib-commonjs/Popover.js +5 -4
- package/lib-commonjs/Popover.js.map +1 -1
- package/lib-commonjs/PopoverSurface.js +5 -4
- package/lib-commonjs/PopoverSurface.js.map +1 -1
- package/lib-commonjs/PopoverTrigger.js +5 -4
- package/lib-commonjs/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.js +14 -13
- package/lib-commonjs/components/Popover/Popover.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.types.js +5 -2
- package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
- package/lib-commonjs/components/Popover/constants.js +10 -8
- package/lib-commonjs/components/Popover/constants.js.map +1 -1
- package/lib-commonjs/components/Popover/index.js +8 -7
- package/lib-commonjs/components/Popover/index.js.map +1 -1
- package/lib-commonjs/components/Popover/renderPopover.js +31 -47
- package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
- package/lib-commonjs/components/Popover/usePopover.js +179 -173
- package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +19 -20
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js +3 -2
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/index.js +9 -8
- package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +23 -28
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +70 -81
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +243 -113
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +15 -14
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js +5 -2
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/index.js +8 -7
- package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +12 -11
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +71 -80
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib-commonjs/index.js +30 -92
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/popoverContext.js +34 -25
- package/lib-commonjs/popoverContext.js.map +1 -1
- package/package.json +14 -13
- package/lib-amd/Popover.js +0 -6
- package/lib-amd/Popover.js.map +0 -1
- package/lib-amd/PopoverSurface.js +0 -6
- package/lib-amd/PopoverSurface.js.map +0 -1
- package/lib-amd/PopoverTrigger.js +0 -6
- package/lib-amd/PopoverTrigger.js.map +0 -1
- 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.js +0 -5
- package/lib-amd/components/Popover/Popover.types.js.map +0 -1
- package/lib-amd/components/Popover/constants.js +0 -15
- package/lib-amd/components/Popover/constants.js.map +0 -1
- 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.js +0 -32
- package/lib-amd/components/Popover/renderPopover.js.map +0 -1
- package/lib-amd/components/Popover/usePopover.js +0 -147
- package/lib-amd/components/Popover/usePopover.js.map +0 -1
- package/lib-amd/components/PopoverSurface/PopoverSurface.js +0 -17
- package/lib-amd/components/PopoverSurface/PopoverSurface.js.map +0 -1
- 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.js +0 -10
- package/lib-amd/components/PopoverSurface/index.js.map +0 -1
- package/lib-amd/components/PopoverSurface/renderPopoverSurface.js +0 -20
- package/lib-amd/components/PopoverSurface/renderPopoverSurface.js.map +0 -1
- package/lib-amd/components/PopoverSurface/usePopoverSurface.js +0 -69
- package/lib-amd/components/PopoverSurface/usePopoverSurface.js.map +0 -1
- package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js +0 -44
- package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.js +0 -17
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.js.map +0 -1
- 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.js +0 -9
- package/lib-amd/components/PopoverTrigger/index.js.map +0 -1
- 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.js +0 -61
- package/lib-amd/components/PopoverTrigger/usePopoverTrigger.js.map +0 -1
- package/lib-amd/index.js +0 -20
- package/lib-amd/index.js.map +0 -1
- package/lib-amd/popoverContext.js +0 -28
- package/lib-amd/popoverContext.js.map +0 -1
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"usePopoverSurfaceStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-popover/src/components/PopoverSurface/usePopoverSurfaceStyles.ts"],"names":[],"mappings":";;;;IAOa,QAAA,wBAAwB,GAAwC;QAC3E,IAAI,EAAE,oBAAoB;KAC3B,CAAC;IAEW,QAAA,YAAY,GAAgC;QACvD,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;KACT,CAAC;IAEF;;OAEG;IACH,IAAM,SAAS,GAAG,kBAAU,CAAC;QAC3B,IAAI,uDACF,KAAK,EAAE,oBAAM,CAAC,uBAAuB,EACrC,eAAe,EAAE,oBAAM,CAAC,uBAAuB,EAC/C,SAAS,EAAE,oBAAM,CAAC,QAAQ,IACvB,kBAAU,CAAC,YAAY,CAAC,oBAAM,CAAC,kBAAkB,CAAC,GAClD,kBAAU,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,oBAAM,CAAC,sBAAsB,CAAC,GAChE,8BAAgB,CAAC,KAAK,CAC1B;QAED,QAAQ,EAAE;YACR,eAAe,EAAE,oBAAM,CAAC,4BAA4B;YACpD,KAAK,EAAE,oBAAM,CAAC,oCAAoC;SACnD;QAED,KAAK,EAAE;YACL,eAAe,EAAE,oBAAM,CAAC,oBAAoB;YAC5C,KAAK,EAAE,oBAAM,CAAC,6BAA6B;SAC5C;QAED,YAAY,uBACP,kBAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAC9B;QAED,aAAa,uBACR,kBAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAC9B;QAED,YAAY,uBACP,kBAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAC9B;QAED,UAAU,EAAE,2CAAuB,CAAC,oBAAY,CAAC,KAAK,CAAC;QACvD,gBAAgB,EAAE,2CAAuB,CAAC,oBAAY,CAAC,MAAM,CAAC;QAC9D,KAAK,EAAE,qCAAiB,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;KACrD,CAAC,CAAC;IAEH;;OAEG;IACI,IAAM,gCAAgC,GAAG,UAAC,KAA0B;QACzE,IAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,oBAAY,CACjC,gCAAwB,CAAC,IAAI,EAC7B,MAAM,CAAC,IAAI,EACX,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,MAAM,CAAC,YAAY,EAC7C,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,aAAa,EAC/C,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,MAAM,CAAC,YAAY,EAC7C,KAAK,CAAC,UAAU,KAAK,UAAU,IAAI,MAAM,CAAC,QAAQ,EAClD,KAAK,CAAC,UAAU,KAAK,OAAO,IAAI,MAAM,CAAC,KAAK,EAC5C,KAAK,CAAC,IAAI,CAAC,SAAS,CACrB,CAAC;QAEF,KAAK,CAAC,cAAc,GAAG,oBAAY,CACjC,MAAM,CAAC,KAAK,EACZ,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CACrE,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAnBW,QAAA,gCAAgC,oCAmB3C","sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { createArrowHeightStyles, createArrowStyles } from '@fluentui/react-positioning';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { PopoverSize } from '../Popover/Popover.types';\nimport type { PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const popoverSurfaceClassNames: SlotClassNames<PopoverSurfaceSlots> = {\n root: 'fui-PopoverSurface',\n};\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 color: tokens.colorNeutralForeground1,\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow16,\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n ...typographyStyles.body1,\n },\n\n inverted: {\n backgroundColor: tokens.colorNeutralBackgroundStatic,\n color: tokens.colorNeutralForegroundStaticInverted,\n },\n\n brand: {\n backgroundColor: tokens.colorBrandBackground,\n color: tokens.colorNeutralForegroundOnBrand,\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 popoverSurfaceClassNames.root,\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"]}
|
@@ -1,17 +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_unstable(props);
|
10
|
-
return renderPopoverTrigger_1.renderPopoverTrigger_unstable(state);
|
11
|
-
};
|
12
|
-
exports.PopoverTrigger = PopoverTrigger;
|
13
|
-
exports.PopoverTrigger.displayName = 'PopoverTrigger';
|
14
|
-
// type casting here is required to ensure internal type FluentTriggerComponent is not leaked
|
15
|
-
exports.PopoverTrigger.isFluentTriggerComponent = true;
|
16
|
-
});
|
17
|
-
//# sourceMappingURL=PopoverTrigger.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"PopoverTrigger.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-popover/src/components/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":";;;;IAMA;;OAEG;IACI,IAAM,cAAc,GAAkC,UAAA,KAAK;QAChE,IAAM,KAAK,GAAG,8CAA0B,CAAC,KAAK,CAAC,CAAC;QAEhD,OAAO,oDAA6B,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC,CAAC;IAJW,QAAA,cAAc,kBAIzB;IAEF,sBAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC;IAC9C,6FAA6F;IAC5F,sBAAyC,CAAC,wBAAwB,GAAG,IAAI,CAAC","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> = props => {\n const state = usePopoverTrigger_unstable(props);\n\n return renderPopoverTrigger_unstable(state);\n};\n\nPopoverTrigger.displayName = 'PopoverTrigger';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\n(PopoverTrigger as FluentTriggerComponent).isFluentTriggerComponent = true;\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"PopoverTrigger.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-popover/src/components/PopoverTrigger/PopoverTrigger.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ARIAButtonResultProps, ARIAButtonType } from '@fluentui/react-aria';\nimport type { TriggerProps } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\n/**\n * PopoverTrigger Props\n */\nexport type PopoverTriggerProps = TriggerProps<PopoverTriggerChildProps> & {\n /**\n * Disables internal trigger mechanism that ensures a child provided will be a compliant ARIA button.\n * @default false\n */\n disableButtonEnhancement?: boolean;\n};\n\n/**\n * PopoverTrigger State\n */\nexport type PopoverTriggerState = {\n children: React.ReactElement | null;\n};\n\n/**\n * Props that are passed to the child of the DialogTrigger when cloned to ensure correct behaviour for the Dialog\n */\nexport type PopoverTriggerChildProps<Type extends ARIAButtonType = ARIAButtonType, Props = {}> = ARIAButtonResultProps<\n Type,\n Props & {\n 'aria-expanded'?: 'true' | 'false';\n ref: React.Ref<unknown>;\n onMouseEnter: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;\n onMouseLeave: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;\n onContextMenu: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;\n }\n>;\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":"","sources":["../../../../../../../../../packages/react-components/react-popover/src/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_unstable = void 0;
|
5
|
-
/**
|
6
|
-
* Render the final JSX of PopoverTrigger
|
7
|
-
*/
|
8
|
-
var renderPopoverTrigger_unstable = function (state) {
|
9
|
-
return state.children;
|
10
|
-
};
|
11
|
-
exports.renderPopoverTrigger_unstable = renderPopoverTrigger_unstable;
|
12
|
-
});
|
13
|
-
//# sourceMappingURL=renderPopoverTrigger.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"renderPopoverTrigger.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-popover/src/components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":";;;;IAEA;;OAEG;IACI,IAAM,6BAA6B,GAAG,UAAC,KAA0B;QACtE,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC,CAAC;IAFW,QAAA,6BAA6B,iCAExC","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"]}
|
@@ -1,61 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "@fluentui/react-utilities", "@fluentui/react-tabster", "../../popoverContext", "@fluentui/react-aria", "@fluentui/keyboard-keys"], function (require, exports, tslib_1, react_utilities_1, react_tabster_1, popoverContext_1, react_aria_1, keyboard_keys_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.usePopoverTrigger_unstable = 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_unstable.
|
10
|
-
*
|
11
|
-
* @param props - props from this instance of PopoverTrigger
|
12
|
-
*/
|
13
|
-
var usePopoverTrigger_unstable = function (props) {
|
14
|
-
var children = props.children, _a = props.disableButtonEnhancement, disableButtonEnhancement = _a === void 0 ? false : _a;
|
15
|
-
var child = react_utilities_1.getTriggerChild(children);
|
16
|
-
var open = popoverContext_1.usePopoverContext_unstable(function (context) { return context.open; });
|
17
|
-
var setOpen = popoverContext_1.usePopoverContext_unstable(function (context) { return context.setOpen; });
|
18
|
-
var toggleOpen = popoverContext_1.usePopoverContext_unstable(function (context) { return context.toggleOpen; });
|
19
|
-
var triggerRef = popoverContext_1.usePopoverContext_unstable(function (context) { return context.triggerRef; });
|
20
|
-
var openOnHover = popoverContext_1.usePopoverContext_unstable(function (context) { return context.openOnHover; });
|
21
|
-
var openOnContext = popoverContext_1.usePopoverContext_unstable(function (context) { return context.openOnContext; });
|
22
|
-
var triggerAttributes = react_tabster_1.useModalAttributes().triggerAttributes;
|
23
|
-
var onContextMenu = function (e) {
|
24
|
-
if (openOnContext) {
|
25
|
-
e.preventDefault();
|
26
|
-
setOpen(e, true);
|
27
|
-
}
|
28
|
-
};
|
29
|
-
var onClick = function (e) {
|
30
|
-
if (!openOnContext) {
|
31
|
-
toggleOpen(e);
|
32
|
-
}
|
33
|
-
};
|
34
|
-
var onKeyDown = function (e) {
|
35
|
-
if (e.key === keyboard_keys_1.Escape && open) {
|
36
|
-
setOpen(e, false);
|
37
|
-
// stop propagation to avoid conflicting with other elements that listen for `Escape`
|
38
|
-
// e,g: Dialog, Menu
|
39
|
-
e.stopPropagation();
|
40
|
-
}
|
41
|
-
};
|
42
|
-
var onMouseEnter = function (e) {
|
43
|
-
if (openOnHover) {
|
44
|
-
setOpen(e, true);
|
45
|
-
}
|
46
|
-
};
|
47
|
-
var onMouseLeave = function (e) {
|
48
|
-
if (openOnHover) {
|
49
|
-
setOpen(e, false);
|
50
|
-
}
|
51
|
-
};
|
52
|
-
var contextMenuProps = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, triggerAttributes), { 'aria-expanded': "" + open }), child === null || child === void 0 ? void 0 : child.props), { onMouseEnter: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseEnter, onMouseEnter)), onMouseLeave: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseLeave, onMouseLeave)), onContextMenu: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onContextMenu, onContextMenu)), ref: react_utilities_1.useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref) });
|
53
|
-
var triggerChildProps = tslib_1.__assign(tslib_1.__assign({}, contextMenuProps), { onClick: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)), onKeyDown: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown)) });
|
54
|
-
var ariaButtonTriggerChildProps = react_aria_1.useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', triggerChildProps);
|
55
|
-
return {
|
56
|
-
children: react_utilities_1.applyTriggerPropsToChildren(props.children, react_aria_1.useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps)),
|
57
|
-
};
|
58
|
-
};
|
59
|
-
exports.usePopoverTrigger_unstable = usePopoverTrigger_unstable;
|
60
|
-
});
|
61
|
-
//# sourceMappingURL=usePopoverTrigger.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"usePopoverTrigger.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-popover/src/components/PopoverTrigger/usePopoverTrigger.ts"],"names":[],"mappings":"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","sourcesContent":["import * as React from 'react';\nimport {\n applyTriggerPropsToChildren,\n getTriggerChild,\n mergeCallbacks,\n useMergedRefs,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport type { PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.types';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport { Escape } from '@fluentui/keyboard-keys';\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, disableButtonEnhancement = false } = props;\n const child = getTriggerChild(children);\n\n const open = usePopoverContext_unstable(context => context.open);\n const setOpen = usePopoverContext_unstable(context => context.setOpen);\n const toggleOpen = usePopoverContext_unstable(context => context.toggleOpen);\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 { 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 toggleOpen(e);\n }\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === Escape && open) {\n setOpen(e, false);\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Menu\n e.stopPropagation();\n }\n };\n\n const onMouseEnter = (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 const contextMenuProps = {\n ...triggerAttributes,\n 'aria-expanded': `${open}`,\n ...child?.props,\n onMouseEnter: useEventCallback(mergeCallbacks(child?.props.onMouseEnter, onMouseEnter)),\n onMouseLeave: useEventCallback(mergeCallbacks(child?.props.onMouseLeave, onMouseLeave)),\n onContextMenu: useEventCallback(mergeCallbacks(child?.props.onContextMenu, onContextMenu)),\n ref: useMergedRefs(triggerRef, child?.ref),\n } as const;\n\n const triggerChildProps = {\n ...contextMenuProps,\n onClick: useEventCallback(mergeCallbacks(child?.props.onClick, onClick)),\n onKeyDown: useEventCallback(mergeCallbacks(child?.props.onKeyDown, onKeyDown)),\n };\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n triggerChildProps,\n );\n\n return {\n children: applyTriggerPropsToChildren(\n props.children,\n useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n ),\n };\n};\n"]}
|
package/lib-amd/index.js
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
define(["require", "exports", "./Popover", "./PopoverSurface", "./popoverContext", "./PopoverTrigger"], function (require, exports, Popover_1, PopoverSurface_1, popoverContext_1, PopoverTrigger_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.usePopoverTrigger_unstable = exports.renderPopoverTrigger_unstable = exports.PopoverTrigger = exports.usePopoverContext_unstable = exports.PopoverProvider = exports.usePopoverSurface_unstable = exports.usePopoverSurfaceStyles_unstable = exports.renderPopoverSurface_unstable = exports.popoverSurfaceClassNames = exports.arrowHeights = exports.PopoverSurface = exports.usePopover_unstable = exports.renderPopover_unstable = exports.Popover = void 0;
|
5
|
-
Object.defineProperty(exports, "Popover", { enumerable: true, get: function () { return Popover_1.Popover; } });
|
6
|
-
Object.defineProperty(exports, "renderPopover_unstable", { enumerable: true, get: function () { return Popover_1.renderPopover_unstable; } });
|
7
|
-
Object.defineProperty(exports, "usePopover_unstable", { enumerable: true, get: function () { return Popover_1.usePopover_unstable; } });
|
8
|
-
Object.defineProperty(exports, "PopoverSurface", { enumerable: true, get: function () { return PopoverSurface_1.PopoverSurface; } });
|
9
|
-
Object.defineProperty(exports, "arrowHeights", { enumerable: true, get: function () { return PopoverSurface_1.arrowHeights; } });
|
10
|
-
Object.defineProperty(exports, "popoverSurfaceClassNames", { enumerable: true, get: function () { return PopoverSurface_1.popoverSurfaceClassNames; } });
|
11
|
-
Object.defineProperty(exports, "renderPopoverSurface_unstable", { enumerable: true, get: function () { return PopoverSurface_1.renderPopoverSurface_unstable; } });
|
12
|
-
Object.defineProperty(exports, "usePopoverSurfaceStyles_unstable", { enumerable: true, get: function () { return PopoverSurface_1.usePopoverSurfaceStyles_unstable; } });
|
13
|
-
Object.defineProperty(exports, "usePopoverSurface_unstable", { enumerable: true, get: function () { return PopoverSurface_1.usePopoverSurface_unstable; } });
|
14
|
-
Object.defineProperty(exports, "PopoverProvider", { enumerable: true, get: function () { return popoverContext_1.PopoverProvider; } });
|
15
|
-
Object.defineProperty(exports, "usePopoverContext_unstable", { enumerable: true, get: function () { return popoverContext_1.usePopoverContext_unstable; } });
|
16
|
-
Object.defineProperty(exports, "PopoverTrigger", { enumerable: true, get: function () { return PopoverTrigger_1.PopoverTrigger; } });
|
17
|
-
Object.defineProperty(exports, "renderPopoverTrigger_unstable", { enumerable: true, get: function () { return PopoverTrigger_1.renderPopoverTrigger_unstable; } });
|
18
|
-
Object.defineProperty(exports, "usePopoverTrigger_unstable", { enumerable: true, get: function () { return PopoverTrigger_1.usePopoverTrigger_unstable; } });
|
19
|
-
});
|
20
|
-
//# sourceMappingURL=index.js.map
|
package/lib-amd/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-popover/src/index.ts"],"names":[],"mappings":";;;;IAAS,kGAAA,OAAO,OAAA;IAAE,iHAAA,sBAAsB,OAAA;IAAE,8GAAA,mBAAmB,OAAA;IAG3D,gHAAA,cAAc,OAAA;IACd,8GAAA,YAAY,OAAA;IACZ,0HAAA,wBAAwB,OAAA;IACxB,+HAAA,6BAA6B,OAAA;IAC7B,kIAAA,gCAAgC,OAAA;IAChC,4HAAA,0BAA0B,OAAA;IAGnB,iHAAA,eAAe,OAAA;IAAE,4HAAA,0BAA0B,OAAA;IAE3C,gHAAA,cAAc,OAAA;IAAE,+HAAA,6BAA6B,OAAA;IAAE,4HAAA,0BAA0B,OAAA","sourcesContent":["export { Popover, renderPopover_unstable, usePopover_unstable } from './Popover';\nexport type { OnOpenChangeData, OpenPopoverEvents, PopoverProps, PopoverSize, PopoverState } from './Popover';\nexport {\n PopoverSurface,\n arrowHeights,\n popoverSurfaceClassNames,\n renderPopoverSurface_unstable,\n usePopoverSurfaceStyles_unstable,\n usePopoverSurface_unstable,\n} from './PopoverSurface';\nexport type { PopoverSurfaceProps, PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface';\nexport { PopoverProvider, usePopoverContext_unstable } from './popoverContext';\nexport type { PopoverContextValue } from './popoverContext';\nexport { PopoverTrigger, renderPopoverTrigger_unstable, usePopoverTrigger_unstable } from './PopoverTrigger';\nexport type { PopoverTriggerChildProps, PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger';\n"]}
|
@@ -1,28 +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_unstable = exports.PopoverProvider = exports.PopoverContext = void 0;
|
5
|
-
exports.PopoverContext = react_context_selector_1.createContext(undefined);
|
6
|
-
var popoverContextDefaultValue = {
|
7
|
-
open: false,
|
8
|
-
setOpen: function () { return null; },
|
9
|
-
toggleOpen: function () { return null; },
|
10
|
-
triggerRef: { current: null },
|
11
|
-
contentRef: { current: null },
|
12
|
-
arrowRef: { current: null },
|
13
|
-
openOnContext: false,
|
14
|
-
openOnHover: false,
|
15
|
-
size: 'medium',
|
16
|
-
trapFocus: false,
|
17
|
-
inline: false,
|
18
|
-
};
|
19
|
-
exports.PopoverProvider = exports.PopoverContext.Provider;
|
20
|
-
var usePopoverContext_unstable = function (selector) {
|
21
|
-
return react_context_selector_1.useContextSelector(exports.PopoverContext, function (ctx) {
|
22
|
-
if (ctx === void 0) { ctx = popoverContextDefaultValue; }
|
23
|
-
return selector(ctx);
|
24
|
-
});
|
25
|
-
};
|
26
|
-
exports.usePopoverContext_unstable = usePopoverContext_unstable;
|
27
|
-
});
|
28
|
-
//# sourceMappingURL=popoverContext.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"popoverContext.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-popover/src/popoverContext.ts"],"names":[],"mappings":";;;;IAIa,QAAA,cAAc,GAAiC,sCAAa,CACvE,SAAS,CACsB,CAAC;IAClC,IAAM,0BAA0B,GAAwB;QACtD,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;QACnB,UAAU,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;QACtB,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,QAAiB;QACvB,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,KAAK;KACd,CAAC;IAEW,QAAA,eAAe,GAAG,sBAAc,CAAC,QAAQ,CAAC;IAwBhD,IAAM,0BAA0B,GAAG,UAAI,QAAiD;QAC7F,OAAA,2CAAkB,CAAC,sBAAc,EAAE,UAAC,GAAgC;YAAhC,oBAAA,EAAA,gCAAgC;YAAK,OAAA,QAAQ,CAAC,GAAG,CAAC;QAAb,CAAa,CAAC;IAAvF,CAAuF,CAAC;IAD7E,QAAA,0BAA0B,8BACmD","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 | undefined>(\n undefined,\n) as Context<PopoverContextValue>;\nconst popoverContextDefaultValue: PopoverContextValue = {\n open: false,\n setOpen: () => null,\n toggleOpen: () => null,\n triggerRef: { current: null },\n contentRef: { current: null },\n arrowRef: { current: null },\n openOnContext: false,\n openOnHover: false,\n size: 'medium' as const,\n trapFocus: false,\n inline: false,\n};\n\nexport const PopoverProvider = PopoverContext.Provider;\n\n/**\n * Context shared between Popover and its children components\n */\nexport type PopoverContextValue = Pick<\n PopoverState,\n | 'open'\n | 'toggleOpen'\n | 'setOpen'\n | 'triggerRef'\n | 'contentRef'\n | 'openOnHover'\n | 'openOnContext'\n | 'mountNode'\n | 'withArrow'\n | 'arrowRef'\n | 'size'\n | 'appearance'\n | 'trapFocus'\n | 'inertTrapFocus'\n | 'inline'\n>;\n\nexport const usePopoverContext_unstable = <T>(selector: ContextSelector<PopoverContextValue, T>): T =>\n useContextSelector(PopoverContext, (ctx = popoverContextDefaultValue) => selector(ctx));\n"]}
|