@contentful/f36-popover 4.0.1 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,49 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.2.0](https://github.com/contentful/forma-36/compare/@contentful/f36-popover@4.1.2...@contentful/f36-popover@4.2.0) (2022-02-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * by default render Popover only when it's open ([#1873](https://github.com/contentful/forma-36/issues/1873)) ([48a511b](https://github.com/contentful/forma-36/commit/48a511bc48c17d3e4bf0cbfb8d16da8c3cbc29b2))
12
+
13
+
14
+
15
+
16
+
17
+ ## [4.1.2](https://github.com/contentful/forma-36/compare/@contentful/f36-popover@4.1.1...@contentful/f36-popover@4.1.2) (2022-01-31)
18
+
19
+ **Note:** Version bump only for package @contentful/f36-popover
20
+
21
+
22
+
23
+
24
+
25
+ ## [4.1.1](https://github.com/contentful/forma-36/compare/@contentful/f36-popover@4.1.0...@contentful/f36-popover@4.1.1) (2022-01-31)
26
+
27
+ **Note:** Version bump only for package @contentful/f36-popover
28
+
29
+
30
+
31
+
32
+
33
+ # [4.1.0](https://github.com/contentful/forma-36/compare/@contentful/f36-popover@4.0.1...@contentful/f36-popover@4.1.0) (2022-01-25)
34
+
35
+
36
+ ### Bug Fixes
37
+
38
+ * focus styles for Popover content in safari ([#1816](https://github.com/contentful/forma-36/issues/1816)) ([8739fea](https://github.com/contentful/forma-36/commit/8739fea19759dd026c671fd2e9473a23c498bcc5))
39
+
40
+
41
+ ### Features
42
+
43
+ * implement props list redesign [BAU-535] ([#1756](https://github.com/contentful/forma-36/issues/1756)) ([21c57e7](https://github.com/contentful/forma-36/commit/21c57e72008b75990d03af4e7500edc1c7f3d26d))
44
+
45
+
46
+
47
+
48
+
6
49
  ## [4.0.1](https://github.com/contentful/forma-36/compare/@contentful/f36-popover@4.0.0...@contentful/f36-popover@4.0.1) (2022-01-11)
7
50
 
8
51
  **Note:** Version bump only for package @contentful/f36-popover
package/README.mdx CHANGED
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  title: 'Popover'
3
- type: 'component'
4
- status: 'stable'
5
3
  slug: /components/popover/
6
4
  github: 'https://github.com/contentful/forma-36/tree/master/packages/components/popover'
7
5
  storybook: 'https://v4-f36-storybook.netlify.app/?path=/story/components-popover--basic'
@@ -11,85 +9,46 @@ typescript: ./src/Popover.tsx
11
9
  Popover is used to display some content on top of another, and should be paired with a clickable trigger element.
12
10
  It is a base for other more specific component, like `Menu`, `Autocomplete` and `Multiselect`. Please, consider using these specific componenets to cover your needs.
13
11
 
14
- ## How to use Popover
12
+ ### How to use Popover
15
13
 
16
14
  - Only if `Menu`, `Autocomplete` and `Multiselect` components are not covering your use cases, you should use `Popover`.
17
15
  - Before using this component, double-check your design requirements. We are providing `Menu`, `Autocomplete`, and `Multiselect` for more specific use-cases and they can address your needs.
18
16
  - Keep in mind that you will have to implement everything related to accessibility for the popover content.
19
17
  - Component is controllable, so don't forget to pass `onClose` callback prop. Otherwise `closeOnEsc` and `closeOnBlur` will not work properly.
20
18
 
21
- ## Code examples
19
+ ## Import
20
+
21
+ ```jsx static=true
22
+ import { Popover } from '@contentful/f36-components';
23
+ // or
24
+ import { Popover } from '@contentful/f36-popover';
25
+ ```
26
+
27
+ ## Examples
28
+
29
+ ### Basic
22
30
 
23
31
  - Pass trigger component as a child for `Popover.Trigger`.
24
32
  NOTE: 🚨 Ensure that the component that you pass accepts `ref`. Consider using `forwardRef` for functional components.
25
33
  - Pass popover content as a child for `Popover.Content`
26
34
 
27
- ```tsx
28
- // import { Popover } from '@contentful/f36-popover';
29
-
30
- // import { Button } from '@contentful/f36-button';
31
- // import { Paragraph } from '@contentful/f36-typography';
32
- // import { Box } from '@contentful/f36-core';
33
-
34
- function PopoverExample() {
35
- const [isOpen, setIsOpen] = React.useState(false);
36
- return (
37
- <Popover isOpen={isOpen} onClose={() => setIsOpen(false)}>
38
- <Popover.Trigger>
39
- <Button onClick={() => setIsOpen(!isOpen)}>Toggle</Button>
40
- </Popover.Trigger>
41
- <Popover.Content>
42
- <Box padding="spacingM">
43
- <Paragraph>This is the content.</Paragraph>
44
- <Button>Some action</Button>
45
- </Box>
46
- </Popover.Content>
47
- </Popover>
48
- );
49
- }
35
+ ```jsx file=examples/PopoverBasicExample.tsx
36
+
50
37
  ```
51
38
 
52
- ## Trapping focus within Popover
39
+ ### Trapping focus within Popover
53
40
 
54
41
  If the popover contains interactive elements that user can navigate through with `Tab`,
55
42
  consider using [react-focus-lock](https://github.com/theKashey/react-focus-lock) to trap the focus within Popover
56
43
 
57
- ```tsx static=true
58
- // import { Popover } from '@contentful/f36-popover';
59
-
60
- // import { Button } from '@contentful/f36-button';
61
- // import { Stack } from '@contentful/f36-core';
62
- // import { Switch } from '@contentful/f36-forms';
63
-
64
- // import FocusLock from 'react-focus-lock';
65
-
66
- function PopoverExample() {
67
- const [isOpen, setIsOpen] = React.useState(false);
68
- return (
69
- <Popover isOpen={isOpen} onClose={() => setIsOpen(false)}>
70
- <Popover.Trigger>
71
- <Button onClick={() => setIsOpen(!isOpen)}>Toggle</Button>
72
- </Popover.Trigger>
73
- <Popover.Content>
74
- {/* Just wrap your content with FocusLock component */}
75
- <FocusLock>
76
- <Stack
77
- padding="spacingM"
78
- margin="none"
79
- spacing="spacingS"
80
- flexDirection="column"
81
- >
82
- <Switch>Option 1</Switch>
83
- <Switch>Option 2</Switch>
84
- <Switch>Option 3</Switch>
85
- </Stack>
86
- </FocusLock>
87
- </Popover.Content>
88
- </Popover>
89
- );
90
- }
44
+ ```jsx file=examples/PopoverFocusLockExample.tsx
45
+
91
46
  ```
92
47
 
48
+ ## Props (API reference)
49
+
50
+ <PropsTable of="Popover" />
51
+
93
52
  ## Content guidelines
94
53
 
95
54
  - Use an interactive element such as `button` for `Popover.Trigger`
@@ -101,9 +60,3 @@ function PopoverExample() {
101
60
  - When the popover is open and focus is within the `Popover.Content`, click on `Esc` key will close the popover. If you set `closeOnEsc` to `false`, it will not close.
102
61
  - When the popover is open and focus is within the `Popover.Content`, click outside popover or blurring out will close the it. If you set `closeOnBlur` to `false`, it will not close.
103
62
  - All the necessary a11y attributes for `Popover.Content` and `Popover.Trigger` are provided.
104
-
105
- ## Props
106
-
107
- import { Props } from '@contentful/f36-docs-utils';
108
-
109
- <Props of="Popover" />
package/dist/main.js CHANGED
@@ -32,7 +32,7 @@ function $ed3840333e471e4e$export$5b6b19405a83ff9d(props) {
32
32
  const { children: children , isOpen: isOpen , placement: placement = 'bottom-start' , isFullWidth: isFullWidth = false , isAutoalignmentEnabled: isAutoalignmentEnabled = true , usePortal: usePortal = true , closeOnBlur: closeOnBlur = true , closeOnEsc: closeOnEsc = true , onClose: onClose , autoFocus: autoFocus = true , id: id , offset: offset = [
33
33
  1,
34
34
  4
35
- ] } = props;
35
+ ] , renderOnlyWhenOpen: renderOnlyWhenOpen = true } = props;
36
36
  const [triggerElement, setTriggerElement] = $36WSQ$react.useState(null);
37
37
  const [popoverElement, setPopoverElement] = $36WSQ$react.useState(null);
38
38
  const { attributes: popperAttributes , forceUpdate: forceUpdate , styles: popperStyles } = $36WSQ$reactpopper.usePopper(triggerElement, popoverElement, {
@@ -93,6 +93,7 @@ function $ed3840333e471e4e$export$5b6b19405a83ff9d(props) {
93
93
  return {
94
94
  isOpen: isOpen,
95
95
  usePortal: usePortal,
96
+ renderOnlyWhenOpen: renderOnlyWhenOpen,
96
97
  getTriggerProps: (_ref = null)=>({
97
98
  ref: $36WSQ$contentfulf36core.mergeRefs(setTriggerElement, _ref),
98
99
  ['aria-expanded']: Boolean(isOpen),
@@ -128,6 +129,7 @@ function $ed3840333e471e4e$export$5b6b19405a83ff9d(props) {
128
129
  };
129
130
  }, [
130
131
  isOpen,
132
+ renderOnlyWhenOpen,
131
133
  popperAttributes,
132
134
  popperStyles,
133
135
  usePortal,
@@ -177,10 +179,11 @@ const $ac842fe302ff665f$export$fbd764fe961047f7 = (isOpen)=>({
177
179
  boxShadow: ($parcel$interopDefault($36WSQ$contentfulf36tokens)).boxShadowDefault,
178
180
  zIndex: ($parcel$interopDefault($36WSQ$contentfulf36tokens)).zIndexDropdown,
179
181
  '&:focus': {
182
+ boxShadow: ($parcel$interopDefault($36WSQ$contentfulf36tokens)).glowPrimary,
180
183
  outline: 'none'
181
184
  },
182
- '&:focus-visible': {
183
- boxShadow: ($parcel$interopDefault($36WSQ$contentfulf36tokens)).glowPrimary
185
+ '&:focus:not(:focus-visible)': {
186
+ boxShadow: ($parcel$interopDefault($36WSQ$contentfulf36tokens)).boxShadowDefault
184
187
  }
185
188
  })
186
189
  })
@@ -189,7 +192,7 @@ const $ac842fe302ff665f$export$fbd764fe961047f7 = (isOpen)=>({
189
192
 
190
193
  const $ec6b27dd96eb674c$var$_PopoverContent = (props, ref)=>{
191
194
  const { children: children , className: className , testId: testId = 'cf-ui-popover-content' , role: role = 'dialog' , ...otherProps } = props;
192
- const { isOpen: isOpen , getPopoverProps: getPopoverProps , usePortal: usePortal } = $a5e54ab4533eb4d3$export$1468d0761b26e6c8();
195
+ const { isOpen: isOpen , renderOnlyWhenOpen: renderOnlyWhenOpen , getPopoverProps: getPopoverProps , usePortal: usePortal } = $a5e54ab4533eb4d3$export$1468d0761b26e6c8();
193
196
  const styles = $ac842fe302ff665f$export$fbd764fe961047f7(isOpen);
194
197
  const content = /*#__PURE__*/ ($parcel$interopDefault($36WSQ$react)).createElement("div", {
195
198
  ...otherProps,
@@ -201,6 +204,7 @@ const $ec6b27dd96eb674c$var$_PopoverContent = (props, ref)=>{
201
204
  // for internal contentful apps usage
202
205
  "data-position-absolute": true
203
206
  }, children);
207
+ if (renderOnlyWhenOpen && !isOpen) return null;
204
208
  return usePortal ? /*#__PURE__*/ ($parcel$interopDefault($36WSQ$react)).createElement($36WSQ$contentfulf36utils.Portal, null, content) : content;
205
209
  };
206
210
  const $ec6b27dd96eb674c$export$d7e1f420b25549ff = /*#__PURE__*/ ($parcel$interopDefault($36WSQ$react)).forwardRef($ec6b27dd96eb674c$var$_PopoverContent);
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;AGYA,KAAA,CAAM4F,oCAAc,GAAGlF,sCAAK,CAACmF,aAAa,CACxCC,SADqB;AAIhB,KAAA,CAAMC,yCAAiB,OAAS,CAAvC;IACE,KAAA,CAAMC,OAAO,GAAGtF,sCAAK,CAACuF,UAAN,CAAiBL,oCAAjB;IAEhB,EAAA,EAAII,OAAO,KAAKF,SAAhB,EACE,KAAA,CAAM,GAAA,CAAII,KAAJ,CACJ,CADI;IAKR,MAAA,CAAOF,OAAP;AACD,CAVM;AAYA,KAAA,CAAM5E,yCAAsB,GAAGwE,oCAAc,CAACO,QAA9C;;;;SDuESnG,yCAAT,CAAiBoC,KAAjB,EAAmD,CAA1D;IACE,KAAA,CAAM,CAAN,WACEb,QADI,WAEJG,MAFI,cAGJE,SAAS,GAAG,CAHR,6BAIJH,WAAW,GAAG,KAJV,2BAKJI,sBAAsB,GAAG,IALrB,cAMJC,SAAS,GAAG,IANR,gBAOJC,WAAW,GAAG,IAPV,eAQJC,UAAU,GAAG,IART,YASJL,OATI,cAUJM,SAAS,GAAG,IAVR,OAWJC,EAXI,WAYJC,MAAM,GAAG,CAAC;QAAA,CAAD;QAAI,CAAJ;IAAA,CAATA,EAZI,CAAA,GAaFC,KAbJ;IAeA,KAAA,EAAOC,cAAD,EAAiBC,iBAAjB,IAAsC1B,qBAAQ,CAClD,IADkD;IAGpD,KAAA,EAAO4B,cAAD,EAAiBC,iBAAjB,IAAsC7B,qBAAQ,CAClD,IADkD;IAIpD,KAAA,CAAM,CAAN,CACE8B,UAAU,EAAEC,gBADR,gBAEJC,WAFI,GAGJC,MAAM,EAAEC,YAARD,EAHI,CAAA,GAIFvB,4BAAS,CAACe,cAAD,EAAiBG,cAAjB,EAAiC,CAJxC;mBAK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,MAAD;IAEtC,KAAA,CAAMoF,OAAO,sEACV,CAAD;WACMD,UAAJ;WACI7C,eAAe,CAAC6C,UAAD,EAAa/C,GAAb;QACnB,SAAA,EAAW,iBAAA,CAAGjB,MAAM,CAACkE,SAAV,EAAqBL,SAArB;QACX,CAAA,eAAcC,MAAD;QACb,QAAA,EAAU,EAAD;QACT,IAAA,EAAMC,IAAD;QAEL,EAAA,AAAA,mCAAA;QACA,CATF,yBASE,IATF;OAWGrF,QAAD;IAIJ,MAAA,CAAOO,SAAS,sEAAI,gCAAD,QAASgF,OAAD,IAAqBA,OAAhD;AACD,CA7BD;AA+BO,KAAA,CAAM1G,yCAAc,iBAAGM,sCAAK,CAACsG,UAAN,CAAiBP,qCAAjB;;;;;AEzCvB,KAAA,CAAMvG,wCAAc,IAAIkC,KAAD,GAAgC,CAA9D;IACE,KAAA,CAAM0F,KAAK,GAAGpH,sCAAK,CAACqH,QAAN,CAAeC,IAAf,CAAoB5F,KAAK,CAACb,QAA1B;IACd,KAAA,CAAM,CAAN,kBAAQqC,eAAAA,EAAF,CAAA,GAAsBmC,yCAAiB;QAI1B+B,GAAA;IAFnB,MAAA,eAAOpH,sCAAK,CAACuH,YAAN,CAAmBH,KAAnB,EAA0B,CAAA;WAC5BlE,eAAe,CAACkE,KAAK,CAAChE,GAAP;QAClB,CAAA,iBAAiBgE,GAAA,GAAAA,KAAK,CAAC1F,KAAN,CAAY,CAAZ,6BAAA0F,GAAA,cAAAA,GAAA,GAAgC,CAAjD;IAF+B,CAA1B;AAIR,CARM;;;ALDA,KAAA,CAAM9H,yCAAO,GAAGM,yCAAe;AACtCN,yCAAO,CAACQ,OAAR,GAAkBJ,yCAAlB;AACAJ,yCAAO,CAACS,OAAR,GAAkBP,wCAAlB","sources":["packages/components/popover/src/index.ts","packages/components/popover/src/CompoundPopover.tsx","packages/components/popover/src/Popover.tsx","packages/components/popover/src/PopoverContext.ts","packages/components/popover/src/PopoverContent/PopoverContent.tsx","packages/components/popover/src/PopoverContent/PopoverContent.styles.ts","packages/components/popover/src/PopoverTrigger/PopoverTrigger.tsx"],"sourcesContent":["export { Popover } from './CompoundPopover';\nexport type { PopoverProps } from './Popover';\nexport { PopoverTrigger } from './PopoverTrigger/PopoverTrigger';\nexport type { PopoverTriggerProps } from './PopoverTrigger/PopoverTrigger';\nexport { PopoverContent } from './PopoverContent/PopoverContent';\nexport type { PopoverContentProps } from './PopoverContent/PopoverContent';\n","import { Popover as OriginalPopover } from './Popover';\nimport { PopoverContent } from './PopoverContent/PopoverContent';\nimport { PopoverTrigger } from './PopoverTrigger/PopoverTrigger';\n\ntype CompoundPopover = typeof OriginalPopover & {\n Content: typeof PopoverContent;\n Trigger: typeof PopoverTrigger;\n};\n\nexport const Popover = OriginalPopover as CompoundPopover;\nPopover.Content = PopoverContent;\nPopover.Trigger = PopoverTrigger;\n","import React, { useMemo, useState, useEffect, useCallback } from 'react';\nimport { useId, mergeRefs, ExpandProps } from '@contentful/f36-core';\nimport { Placement, Modifier } from '@popperjs/core';\nimport { PopoverContextProvider, PopoverContextType } from './PopoverContext';\nimport { usePopper } from 'react-popper';\n\nexport interface PopoverProps {\n children: React.ReactNode;\n\n /**\n * Boolean to determine if the Popover should be the same width as\n * the trigger element\n *\n * @default false\n */\n isFullWidth?: boolean;\n\n /**\n * Boolean to control whether or not the Popover is open\n *\n * @default false\n */\n isOpen?: boolean;\n\n /**\n * Callback fired when the popover closes\n */\n onClose?: () => void;\n\n /**\n * Determines the preferred position of the Popover. This position is not\n * guaranteed, as the Popover might be moved to fit the viewport\n *\n * @default bottom-start\n */\n placement?: Placement;\n\n /**\n * Boolean to control if popover is allowed to change its placement automatically\n * based on available space in the viewport.\n *\n * For example:\n * If you set placement prop to bottom, but there isn't enough space to position the popover in that direction,\n * it will change the popper placement to top. As soon as enough space is detected, the placement will be reverted to the defined one.\n *\n * If you want the popover to strictly follow the placement prop you should set this prop to false.\n *\n * @default true\n */\n isAutoalignmentEnabled?: boolean;\n\n /**\n * Boolean to control whether or not to render the Popover in a React Portal.\n * Rendering content inside a Portal allows the Popover to escape the bounds\n * of its parent while still being positioned correctly. Using a Portal is\n * necessary if an ancestor of the Popover hides overflow.\n *\n * @default true\n */\n usePortal?: boolean;\n\n /**\n * If true, the popover will close when you blur out it by clicking outside or tabbing out\n *\n * @default true\n */\n closeOnBlur?: boolean;\n\n /**\n * If true, the popover will close when you hit the Esc key\n *\n * @default true\n */\n closeOnEsc?: boolean;\n\n /**\n * If true, the popover will be focused after opening\n *\n * @default true\n */\n autoFocus?: boolean;\n\n /**\n * Popover id. Will be used as an `id` attribute on popover\n * and as `aria-controls` attribute on trigger\n *\n * @default true\n */\n id?: string;\n\n /**\n * The `X-axis` and `Y-axis` offset to position popper element\n * from its trigger element. `[X, Y]`\n *\n * @default [1, 4]\n */\n offset?: [number, number];\n}\n\nexport function Popover(props: ExpandProps<PopoverProps>) {\n const {\n children,\n isOpen,\n placement = 'bottom-start',\n isFullWidth = false,\n isAutoalignmentEnabled = true,\n usePortal = true,\n closeOnBlur = true,\n closeOnEsc = true,\n onClose,\n autoFocus = true,\n id,\n offset = [1, 4],\n } = props;\n\n const [triggerElement, setTriggerElement] = useState<HTMLElement | null>(\n null,\n );\n const [popoverElement, setPopoverElement] = useState<HTMLElement | null>(\n null,\n );\n\n const {\n attributes: popperAttributes,\n forceUpdate,\n styles: popperStyles,\n } = usePopper(triggerElement, popoverElement, {\n placement,\n modifiers: [\n {\n name: 'offset',\n options: {\n offset,\n },\n },\n {\n ...sameWidth,\n enabled: isFullWidth,\n },\n {\n name: 'preventOverflow',\n enabled: isAutoalignmentEnabled,\n options: {\n mainAxis: true,\n },\n },\n {\n name: 'flip',\n enabled: isAutoalignmentEnabled,\n },\n ],\n });\n\n useEffect(() => {\n if (isOpen && autoFocus && popoverElement) {\n popoverElement.focus({ preventScroll: true });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, popoverElement]);\n\n useEffect(() => {\n if (isOpen && forceUpdate) {\n forceUpdate();\n }\n }, [isOpen, forceUpdate]);\n\n const popoverGeneratedId = useId(null, 'popover-content');\n const popoverId = id || popoverGeneratedId;\n\n const closeAndFocusTrigger = useCallback(() => {\n onClose?.();\n\n // setTimeout trick to make it work with focus-lock\n setTimeout(() => triggerElement?.focus({ preventScroll: true }), 0);\n }, [onClose, triggerElement]);\n\n const contextValue: PopoverContextType = useMemo(\n () => ({\n isOpen,\n usePortal,\n getTriggerProps: (_ref = null) => ({\n ref: mergeRefs(setTriggerElement, _ref),\n ['aria-expanded']: Boolean(isOpen),\n ['aria-controls']: popoverId,\n }),\n getPopoverProps: (_props = {}, _ref = null) => ({\n ...popperAttributes.popper,\n style: {\n ...(_props.style || {}),\n ...popperStyles.popper,\n },\n ref: mergeRefs(setPopoverElement, _ref),\n id: popoverId,\n onBlur: (event: React.FocusEvent<HTMLDivElement>) => {\n if (_props.onBlur) {\n _props.onBlur(event);\n }\n\n if (!closeOnBlur) {\n return;\n }\n\n const relatedTarget = event.relatedTarget as Node;\n\n const targetIsPopover =\n popoverElement === relatedTarget ||\n popoverElement?.contains(relatedTarget);\n const targetIsTrigger =\n triggerElement === relatedTarget ||\n triggerElement?.contains(relatedTarget);\n\n if (targetIsPopover || targetIsTrigger) {\n return;\n }\n\n onClose?.();\n },\n onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (_props.onKeyDown) {\n _props.onKeyDown(event);\n }\n\n if (closeOnEsc && event.key === 'Escape') {\n closeAndFocusTrigger();\n }\n },\n }),\n }),\n [\n isOpen,\n popperAttributes,\n popperStyles,\n usePortal,\n popoverId,\n closeOnEsc,\n closeOnBlur,\n popoverElement,\n triggerElement,\n closeAndFocusTrigger,\n onClose,\n ],\n );\n\n return (\n <PopoverContextProvider value={contextValue}>\n {children}\n </PopoverContextProvider>\n );\n}\n\n/**\n * Sets the popover width to the size of the trigger element.\n */\nconst sameWidth: Modifier<'sameWidth', any> = {\n name: 'sameWidth',\n enabled: true,\n phase: 'beforeWrite',\n requires: ['computeStyles'],\n fn: ({ state }) => {\n state.styles.popper.width = `${state.rects.reference.width}px`;\n },\n effect: ({ state }) => () => {\n const reference = state.elements.reference as HTMLElement;\n state.elements.popper.style.width = `${reference.offsetWidth}px`;\n },\n};\n","import React, { HTMLProps } from 'react';\n\nexport type PopoverContextType = {\n isOpen: boolean;\n usePortal: boolean;\n getPopoverProps: (\n _props: HTMLProps<HTMLDivElement>,\n _ref: React.Ref<HTMLDivElement>,\n ) => HTMLProps<HTMLDivElement>;\n getTriggerProps: (_ref: React.Ref<HTMLElement>) => HTMLProps<HTMLElement>;\n};\n\nconst PopoverContext = React.createContext<PopoverContextType | undefined>(\n undefined,\n);\n\nexport const usePopoverContext = () => {\n const context = React.useContext(PopoverContext);\n\n if (context === undefined) {\n throw new Error(\n 'usePopoverContext must be used within a PopoverContextProvider',\n );\n }\n\n return context;\n};\n\nexport const PopoverContextProvider = PopoverContext.Provider;\n","import React from 'react';\nimport { cx } from 'emotion';\nimport {\n CommonProps,\n PropsWithHTMLElement,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { usePopoverContext } from '../PopoverContext';\nimport { Portal } from '@contentful/f36-utils';\nimport { getPopoverContentStyles } from './PopoverContent.styles';\n\ninterface PopoverContentInternalProps extends CommonProps {\n children?: React.ReactNode;\n}\n\nexport type PopoverContentProps = PropsWithHTMLElement<\n PopoverContentInternalProps,\n 'div'\n>;\n\nconst _PopoverContent = (props: ExpandProps<PopoverContentProps>, ref) => {\n const {\n children,\n className,\n testId = 'cf-ui-popover-content',\n role = 'dialog',\n ...otherProps\n } = props;\n const { isOpen, getPopoverProps, usePortal } = usePopoverContext();\n\n const styles = getPopoverContentStyles(isOpen);\n\n const content = (\n <div\n {...otherProps}\n {...getPopoverProps(otherProps, ref)}\n className={cx(styles.container, className)}\n data-test-id={testId}\n tabIndex={-1}\n role={role}\n // specific attribute to mark that this element is absolute positioned\n // for internal contentful apps usage\n data-position-absolute\n >\n {children}\n </div>\n );\n\n return usePortal ? <Portal>{content}</Portal> : content;\n};\n\nexport const PopoverContent = React.forwardRef(_PopoverContent);\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getPopoverContentStyles = (isOpen: boolean) => ({\n container: css({\n display: isOpen ? 'initial' : 'none',\n background: tokens.colorWhite,\n border: 0,\n borderRadius: tokens.borderRadiusMedium,\n boxShadow: tokens.boxShadowDefault,\n zIndex: tokens.zIndexDropdown,\n '&:focus': {\n outline: 'none',\n },\n '&:focus-visible': {\n boxShadow: tokens.glowPrimary,\n },\n }),\n});\n","import React from 'react';\nimport { usePopoverContext } from '../PopoverContext';\n\nexport interface PopoverTriggerProps {\n children: React.ReactNode;\n}\n\n/**\n * PopoverTrigger opens the popover. It must be an interactive element.\n */\nexport const PopoverTrigger = (props: PopoverTriggerProps) => {\n const child = React.Children.only(props.children) as any;\n const { getTriggerProps } = usePopoverContext();\n\n return React.cloneElement(child, {\n ...getTriggerProps(child.ref),\n 'aria-haspopup': child.props['aria-haspopup'] ?? 'dialog',\n });\n};\n"],"names":["Popover","PopoverProps","PopoverTrigger","PopoverTriggerProps","PopoverContent","PopoverContentProps","OriginalPopover","CompoundPopover","Content","Trigger","React","useMemo","useState","useEffect","useCallback","useId","mergeRefs","ExpandProps","Placement","Modifier","PopoverContextProvider","PopoverContextType","usePopper","children","ReactNode","isFullWidth","isOpen","onClose","placement","isAutoalignmentEnabled","usePortal","closeOnBlur","closeOnEsc","autoFocus","id","offset","props","triggerElement","setTriggerElement","HTMLElement","popoverElement","setPopoverElement","attributes","popperAttributes","forceUpdate","styles","popperStyles","modifiers","name","options","sameWidth","enabled","mainAxis","focus","preventScroll","popoverGeneratedId","popoverId","closeAndFocusTrigger","setTimeout","contextValue","getTriggerProps","_ref","ref","Boolean","getPopoverProps","_props","popper","style","onBlur","event","FocusEvent","HTMLDivElement","relatedTarget","Node","targetIsPopover","contains","targetIsTrigger","onKeyDown","KeyboardEvent","key","phase","requires","fn","state","width","rects","reference","effect","elements","offsetWidth","HTMLProps","Ref","PopoverContext","createContext","undefined","usePopoverContext","context","useContext","Error","Provider","CommonProps","PropsWithHTMLElement","Portal","getPopoverContentStyles","PopoverContentInternalProps","_PopoverContent","className","testId","role","otherProps","content","container","forwardRef","tokens","display","background","colorWhite","border","borderRadius","borderRadiusMedium","boxShadow","boxShadowDefault","zIndex","zIndexDropdown","outline","glowPrimary","child","Children","only","cloneElement"],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;AGaA,KAAA,CAAM6F,oCAAc,GAAGnF,sCAAK,CAACoF,aAAa,CACxCC,SADqB;AAIhB,KAAA,CAAMC,yCAAiB,OAAS,CAAvC;IACE,KAAA,CAAMC,OAAO,GAAGvF,sCAAK,CAACwF,UAAN,CAAiBL,oCAAjB;IAEhB,EAAA,EAAII,OAAO,KAAKF,SAAhB,EACE,KAAA,CAAM,GAAA,CAAII,KAAJ,CACJ,CADI;IAKR,MAAA,CAAOF,OAAP;AACD,CAVM;AAYA,KAAA,CAAM7E,yCAAsB,GAAGyE,oCAAc,CAACO,QAA9C;;;;SD8ESpG,yCAAT,CAAiBqC,KAAjB,EAAmD,CAA1D;IACE,KAAA,CAAM,CAAN,WACEd,QADI,WAEJG,MAFI,cAGJE,SAAS,GAAG,CAHR,6BAIJH,WAAW,GAAG,KAJV,2BAKJI,sBAAsB,GAAG,IALrB,cAMJC,SAAS,GAAG,IANR,gBAOJC,WAAW,GAAG,IAPV,eAQJC,UAAU,GAAG,IART,YASJL,OATI,cAUJM,SAAS,GAAG,IAVR,OAWJC,EAXI,WAYJC,MAAM,GAAG,CAAC;QAAA,CAAD;QAAI,CAAJ;IAAA,CAZL,uBAaJC,kBAAkB,GAAG,IAArBA,EAbI,CAAA,GAcFC,KAdJ;IAgBA,KAAA,EAAOC,cAAD,EAAiBC,iBAAjB,IAAsC3B,qBAAQ,CAClD,IADkD;IAGpD,KAAA,EAAO6B,cAAD,EAAiBC,iBAAjB,IAAsC9B,qBAAQ,CAClD,IADk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AAgC,CAAjD;IAF+B,CAA1B;AAIR,CARM;;;ALDA,KAAA,CAAM/H,yCAAO,GAAGM,yCAAe;AACtCN,yCAAO,CAACQ,OAAR,GAAkBJ,yCAAlB;AACAJ,yCAAO,CAACS,OAAR,GAAkBP,wCAAlB","sources":["packages/components/popover/src/index.ts","packages/components/popover/src/CompoundPopover.tsx","packages/components/popover/src/Popover.tsx","packages/components/popover/src/PopoverContext.ts","packages/components/popover/src/PopoverContent/PopoverContent.tsx","packages/components/popover/src/PopoverContent/PopoverContent.styles.ts","packages/components/popover/src/PopoverTrigger/PopoverTrigger.tsx"],"sourcesContent":["export { Popover } from './CompoundPopover';\nexport type { PopoverProps } from './Popover';\nexport { PopoverTrigger } from './PopoverTrigger/PopoverTrigger';\nexport type { PopoverTriggerProps } from './PopoverTrigger/PopoverTrigger';\nexport { PopoverContent } from './PopoverContent/PopoverContent';\nexport type { PopoverContentProps } from './PopoverContent/PopoverContent';\n","import { Popover as OriginalPopover } from './Popover';\nimport { PopoverContent } from './PopoverContent/PopoverContent';\nimport { PopoverTrigger } from './PopoverTrigger/PopoverTrigger';\n\ntype CompoundPopover = typeof OriginalPopover & {\n Content: typeof PopoverContent;\n Trigger: typeof PopoverTrigger;\n};\n\nexport const Popover = OriginalPopover as CompoundPopover;\nPopover.Content = PopoverContent;\nPopover.Trigger = PopoverTrigger;\n","import React, { useMemo, useState, useEffect, useCallback } from 'react';\nimport { useId, mergeRefs, ExpandProps } from '@contentful/f36-core';\nimport { Placement, Modifier } from '@popperjs/core';\nimport { PopoverContextProvider, PopoverContextType } from './PopoverContext';\nimport { usePopper } from 'react-popper';\n\nexport interface PopoverProps {\n children: React.ReactNode;\n\n /**\n * Boolean to determine if the Popover should be the same width as\n * the trigger element\n *\n * @default false\n */\n isFullWidth?: boolean;\n\n /**\n * Boolean to control whether or not the Popover is open\n *\n * @default false\n */\n isOpen?: boolean;\n\n /**\n * Callback fired when the popover closes\n */\n onClose?: () => void;\n\n /**\n * Determines the preferred position of the Popover. This position is not\n * guaranteed, as the Popover might be moved to fit the viewport\n *\n * @default bottom-start\n */\n placement?: Placement;\n\n /**\n * Boolean to control if popover is allowed to change its placement automatically\n * based on available space in the viewport.\n *\n * For example:\n * If you set placement prop to bottom, but there isn't enough space to position the popover in that direction,\n * it will change the popper placement to top. As soon as enough space is detected, the placement will be reverted to the defined one.\n *\n * If you want the popover to strictly follow the placement prop you should set this prop to false.\n *\n * @default true\n */\n isAutoalignmentEnabled?: boolean;\n\n /**\n * Boolean to control whether or not to render the Popover in a React Portal.\n * Rendering content inside a Portal allows the Popover to escape the bounds\n * of its parent while still being positioned correctly. Using a Portal is\n * necessary if an ancestor of the Popover hides overflow.\n *\n * @default true\n */\n usePortal?: boolean;\n\n /**\n * If true, the popover will close when you blur out it by clicking outside or tabbing out\n *\n * @default true\n */\n closeOnBlur?: boolean;\n\n /**\n * If true, the popover will close when you hit the Esc key\n *\n * @default true\n */\n closeOnEsc?: boolean;\n\n /**\n * If true, the popover will be focused after opening\n *\n * @default true\n */\n autoFocus?: boolean;\n\n /**\n * Popover id. Will be used as an `id` attribute on popover\n * and as `aria-controls` attribute on trigger\n *\n * @default true\n */\n id?: string;\n\n /**\n * The `X-axis` and `Y-axis` offset to position popper element\n * from its trigger element. `[X, Y]`\n *\n * @default [1, 4]\n */\n offset?: [number, number];\n\n /**\n * Defines if popover should be rendered in the DOM only when it's open\n * or all the time (after the component has been mounted)\n *\n * @default true\n */\n renderOnlyWhenOpen?: boolean;\n}\n\nexport function Popover(props: ExpandProps<PopoverProps>) {\n const {\n children,\n isOpen,\n placement = 'bottom-start',\n isFullWidth = false,\n isAutoalignmentEnabled = true,\n usePortal = true,\n closeOnBlur = true,\n closeOnEsc = true,\n onClose,\n autoFocus = true,\n id,\n offset = [1, 4],\n renderOnlyWhenOpen = true,\n } = props;\n\n const [triggerElement, setTriggerElement] = useState<HTMLElement | null>(\n null,\n );\n const [popoverElement, setPopoverElement] = useState<HTMLElement | null>(\n null,\n );\n\n const {\n attributes: popperAttributes,\n forceUpdate,\n styles: popperStyles,\n } = usePopper(triggerElement, popoverElement, {\n placement,\n modifiers: [\n {\n name: 'offset',\n options: {\n offset,\n },\n },\n {\n ...sameWidth,\n enabled: isFullWidth,\n },\n {\n name: 'preventOverflow',\n enabled: isAutoalignmentEnabled,\n options: {\n mainAxis: true,\n },\n },\n {\n name: 'flip',\n enabled: isAutoalignmentEnabled,\n },\n ],\n });\n\n useEffect(() => {\n if (isOpen && autoFocus && popoverElement) {\n popoverElement.focus({ preventScroll: true });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, popoverElement]);\n\n useEffect(() => {\n if (isOpen && forceUpdate) {\n forceUpdate();\n }\n }, [isOpen, forceUpdate]);\n\n const popoverGeneratedId = useId(null, 'popover-content');\n const popoverId = id || popoverGeneratedId;\n\n const closeAndFocusTrigger = useCallback(() => {\n onClose?.();\n\n // setTimeout trick to make it work with focus-lock\n setTimeout(() => triggerElement?.focus({ preventScroll: true }), 0);\n }, [onClose, triggerElement]);\n\n const contextValue: PopoverContextType = useMemo(\n () => ({\n isOpen,\n usePortal,\n renderOnlyWhenOpen,\n getTriggerProps: (_ref = null) => ({\n ref: mergeRefs(setTriggerElement, _ref),\n ['aria-expanded']: Boolean(isOpen),\n ['aria-controls']: popoverId,\n }),\n getPopoverProps: (_props = {}, _ref = null) => ({\n ...popperAttributes.popper,\n style: {\n ...(_props.style || {}),\n ...popperStyles.popper,\n },\n ref: mergeRefs(setPopoverElement, _ref),\n id: popoverId,\n onBlur: (event: React.FocusEvent<HTMLDivElement>) => {\n if (_props.onBlur) {\n _props.onBlur(event);\n }\n\n if (!closeOnBlur) {\n return;\n }\n\n const relatedTarget = event.relatedTarget as Node;\n\n const targetIsPopover =\n popoverElement === relatedTarget ||\n popoverElement?.contains(relatedTarget);\n const targetIsTrigger =\n triggerElement === relatedTarget ||\n triggerElement?.contains(relatedTarget);\n\n if (targetIsPopover || targetIsTrigger) {\n return;\n }\n\n onClose?.();\n },\n onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (_props.onKeyDown) {\n _props.onKeyDown(event);\n }\n\n if (closeOnEsc && event.key === 'Escape') {\n closeAndFocusTrigger();\n }\n },\n }),\n }),\n [\n isOpen,\n renderOnlyWhenOpen,\n popperAttributes,\n popperStyles,\n usePortal,\n popoverId,\n closeOnEsc,\n closeOnBlur,\n popoverElement,\n triggerElement,\n closeAndFocusTrigger,\n onClose,\n ],\n );\n\n return (\n <PopoverContextProvider value={contextValue}>\n {children}\n </PopoverContextProvider>\n );\n}\n\n/**\n * Sets the popover width to the size of the trigger element.\n */\nconst sameWidth: Modifier<'sameWidth', any> = {\n name: 'sameWidth',\n enabled: true,\n phase: 'beforeWrite',\n requires: ['computeStyles'],\n fn: ({ state }) => {\n state.styles.popper.width = `${state.rects.reference.width}px`;\n },\n effect: ({ state }) => () => {\n const reference = state.elements.reference as HTMLElement;\n state.elements.popper.style.width = `${reference.offsetWidth}px`;\n },\n};\n","import React, { HTMLProps } from 'react';\n\nexport type PopoverContextType = {\n isOpen: boolean;\n usePortal: boolean;\n renderOnlyWhenOpen: boolean;\n getPopoverProps: (\n _props: HTMLProps<HTMLDivElement>,\n _ref: React.Ref<HTMLDivElement>,\n ) => HTMLProps<HTMLDivElement>;\n getTriggerProps: (_ref: React.Ref<HTMLElement>) => HTMLProps<HTMLElement>;\n};\n\nconst PopoverContext = React.createContext<PopoverContextType | undefined>(\n undefined,\n);\n\nexport const usePopoverContext = () => {\n const context = React.useContext(PopoverContext);\n\n if (context === undefined) {\n throw new Error(\n 'usePopoverContext must be used within a PopoverContextProvider',\n );\n }\n\n return context;\n};\n\nexport const PopoverContextProvider = PopoverContext.Provider;\n","import React from 'react';\nimport { cx } from 'emotion';\nimport {\n CommonProps,\n PropsWithHTMLElement,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { usePopoverContext } from '../PopoverContext';\nimport { Portal } from '@contentful/f36-utils';\nimport { getPopoverContentStyles } from './PopoverContent.styles';\n\ninterface PopoverContentInternalProps extends CommonProps {\n children?: React.ReactNode;\n}\n\nexport type PopoverContentProps = PropsWithHTMLElement<\n PopoverContentInternalProps,\n 'div'\n>;\n\nconst _PopoverContent = (props: ExpandProps<PopoverContentProps>, ref) => {\n const {\n children,\n className,\n testId = 'cf-ui-popover-content',\n role = 'dialog',\n ...otherProps\n } = props;\n const {\n isOpen,\n renderOnlyWhenOpen,\n getPopoverProps,\n usePortal,\n } = usePopoverContext();\n\n const styles = getPopoverContentStyles(isOpen);\n\n const content = (\n <div\n {...otherProps}\n {...getPopoverProps(otherProps, ref)}\n className={cx(styles.container, className)}\n data-test-id={testId}\n tabIndex={-1}\n role={role}\n // specific attribute to mark that this element is absolute positioned\n // for internal contentful apps usage\n data-position-absolute\n >\n {children}\n </div>\n );\n\n if (renderOnlyWhenOpen && !isOpen) {\n return null;\n }\n\n return usePortal ? <Portal>{content}</Portal> : content;\n};\n\nexport const PopoverContent = React.forwardRef(_PopoverContent);\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getPopoverContentStyles = (isOpen: boolean) => ({\n container: css({\n display: isOpen ? 'initial' : 'none',\n background: tokens.colorWhite,\n border: 0,\n borderRadius: tokens.borderRadiusMedium,\n boxShadow: tokens.boxShadowDefault,\n zIndex: tokens.zIndexDropdown,\n '&:focus': {\n boxShadow: tokens.glowPrimary,\n outline: 'none',\n },\n '&:focus:not(:focus-visible)': {\n boxShadow: tokens.boxShadowDefault,\n },\n }),\n});\n","import React from 'react';\nimport { usePopoverContext } from '../PopoverContext';\n\nexport interface PopoverTriggerProps {\n children: React.ReactNode;\n}\n\n/**\n * PopoverTrigger opens the popover. It must be an interactive element.\n */\nexport const PopoverTrigger = (props: PopoverTriggerProps) => {\n const child = React.Children.only(props.children) as any;\n const { getTriggerProps } = usePopoverContext();\n\n return React.cloneElement(child, {\n ...getTriggerProps(child.ref),\n 'aria-haspopup': child.props['aria-haspopup'] ?? 'dialog',\n });\n};\n"],"names":["Popover","PopoverProps","PopoverTrigger","PopoverTriggerProps","PopoverContent","PopoverContentProps","OriginalPopover","CompoundPopover","Content","Trigger","React","useMemo","useState","useEffect","useCallback","useId","mergeRefs","ExpandProps","Placement","Modifier","PopoverContextProvider","PopoverContextType","usePopper","children","ReactNode","isFullWidth","isOpen","onClose","placement","isAutoalignmentEnabled","usePortal","closeOnBlur","closeOnEsc","autoFocus","id","offset","renderOnlyWhenOpen","props","triggerElement","setTriggerElement","HTMLElement","popoverElement","setPopoverElement","attributes","popperAttributes","forceUpdate","styles","popperStyles","modifiers","name","options","sameWidth","enabled","mainAxis","focus","preventScroll","popoverGeneratedId","popoverId","closeAndFocusTrigger","setTimeout","contextValue","getTriggerProps","_ref","ref","Boolean","getPopoverProps","_props","popper","style","onBlur","event","FocusEvent","HTMLDivElement","relatedTarget","Node","targetIsPopover","contains","targetIsTrigger","onKeyDown","KeyboardEvent","key","phase","requires","fn","state","width","rects","reference","effect","elements","offsetWidth","HTMLProps","Ref","PopoverContext","createContext","undefined","usePopoverContext","context","useContext","Error","Provider","CommonProps","PropsWithHTMLElement","Portal","getPopoverContentStyles","PopoverContentInternalProps","_PopoverContent","className","testId","role","otherProps","content","container","forwardRef","tokens","display","background","colorWhite","border","borderRadius","borderRadiusMedium","boxShadow","boxShadowDefault","zIndex","zIndexDropdown","glowPrimary","outline","child","Children","only","cloneElement"],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -22,7 +22,7 @@ function $fd548c9231cfa260$export$5b6b19405a83ff9d(props) {
22
22
  const { children: children , isOpen: isOpen , placement: placement = 'bottom-start' , isFullWidth: isFullWidth = false , isAutoalignmentEnabled: isAutoalignmentEnabled = true , usePortal: usePortal = true , closeOnBlur: closeOnBlur = true , closeOnEsc: closeOnEsc = true , onClose: onClose , autoFocus: autoFocus = true , id: id , offset: offset = [
23
23
  1,
24
24
  4
25
- ] } = props;
25
+ ] , renderOnlyWhenOpen: renderOnlyWhenOpen = true } = props;
26
26
  const [triggerElement, setTriggerElement] = $hYGFM$useState(null);
27
27
  const [popoverElement, setPopoverElement] = $hYGFM$useState(null);
28
28
  const { attributes: popperAttributes , forceUpdate: forceUpdate , styles: popperStyles } = $hYGFM$usePopper(triggerElement, popoverElement, {
@@ -83,6 +83,7 @@ function $fd548c9231cfa260$export$5b6b19405a83ff9d(props) {
83
83
  return {
84
84
  isOpen: isOpen,
85
85
  usePortal: usePortal,
86
+ renderOnlyWhenOpen: renderOnlyWhenOpen,
86
87
  getTriggerProps: (_ref = null)=>({
87
88
  ref: $hYGFM$mergeRefs(setTriggerElement, _ref),
88
89
  ['aria-expanded']: Boolean(isOpen),
@@ -118,6 +119,7 @@ function $fd548c9231cfa260$export$5b6b19405a83ff9d(props) {
118
119
  };
119
120
  }, [
120
121
  isOpen,
122
+ renderOnlyWhenOpen,
121
123
  popperAttributes,
122
124
  popperStyles,
123
125
  usePortal,
@@ -167,10 +169,11 @@ const $8a165eef2449d46a$export$fbd764fe961047f7 = (isOpen)=>({
167
169
  boxShadow: $hYGFM$contentfulf36tokens.boxShadowDefault,
168
170
  zIndex: $hYGFM$contentfulf36tokens.zIndexDropdown,
169
171
  '&:focus': {
172
+ boxShadow: $hYGFM$contentfulf36tokens.glowPrimary,
170
173
  outline: 'none'
171
174
  },
172
- '&:focus-visible': {
173
- boxShadow: $hYGFM$contentfulf36tokens.glowPrimary
175
+ '&:focus:not(:focus-visible)': {
176
+ boxShadow: $hYGFM$contentfulf36tokens.boxShadowDefault
174
177
  }
175
178
  })
176
179
  })
@@ -179,7 +182,7 @@ const $8a165eef2449d46a$export$fbd764fe961047f7 = (isOpen)=>({
179
182
 
180
183
  const $249e5486684b1d2a$var$_PopoverContent = (props, ref)=>{
181
184
  const { children: children , className: className , testId: testId = 'cf-ui-popover-content' , role: role = 'dialog' , ...otherProps } = props;
182
- const { isOpen: isOpen , getPopoverProps: getPopoverProps , usePortal: usePortal } = $8c1b76e1106abdf5$export$1468d0761b26e6c8();
185
+ const { isOpen: isOpen , renderOnlyWhenOpen: renderOnlyWhenOpen , getPopoverProps: getPopoverProps , usePortal: usePortal } = $8c1b76e1106abdf5$export$1468d0761b26e6c8();
183
186
  const styles = $8a165eef2449d46a$export$fbd764fe961047f7(isOpen);
184
187
  const content = /*#__PURE__*/ $hYGFM$react.createElement("div", {
185
188
  ...otherProps,
@@ -191,6 +194,7 @@ const $249e5486684b1d2a$var$_PopoverContent = (props, ref)=>{
191
194
  // for internal contentful apps usage
192
195
  "data-position-absolute": true
193
196
  }, children);
197
+ if (renderOnlyWhenOpen && !isOpen) return null;
194
198
  return usePortal ? /*#__PURE__*/ $hYGFM$react.createElement($hYGFM$Portal, null, content) : content;
195
199
  };
196
200
  const $249e5486684b1d2a$export$d7e1f420b25549ff = /*#__PURE__*/ $hYGFM$react.forwardRef($249e5486684b1d2a$var$_PopoverContent);
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AGYA,KAAA,CAAM4F,oCAAc,GAAGlF,YAAK,CAACmF,aAAa,CACxCC,SADqB;AAIhB,KAAA,CAAMC,yCAAiB,OAAS,CAAvC;IACE,KAAA,CAAMC,OAAO,GAAGtF,YAAK,CAACuF,UAAN,CAAiBL,oCAAjB;IAEhB,EAAA,EAAII,OAAO,KAAKF,SAAhB,EACE,KAAA,CAAM,GAAA,CAAII,KAAJ,CACJ,CADI;IAKR,MAAA,CAAOF,OAAP;AACD,CAVM;AAYA,KAAA,CAAM5E,yCAAsB,GAAGwE,oCAAc,CAACO,QAA9C;;;;SDuESnG,yCAAT,CAAiBoC,KAAjB,EAAmD,CAA1D;IACE,KAAA,CAAM,CAAN,WACEb,QADI,WAEJG,MAFI,cAGJE,SAAS,GAAG,CAHR,6BAIJH,WAAW,GAAG,KAJV,2BAKJI,sBAAsB,GAAG,IALrB,cAMJC,SAAS,GAAG,IANR,gBAOJC,WAAW,GAAG,IAPV,eAQJC,UAAU,GAAG,IART,YASJL,OATI,cAUJM,SAAS,GAAG,IAVR,OAWJC,EAXI,WAYJC,MA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,KAAK,CAAC1F,KAAN,CAAY,CAAZ,6BAAA0F,GAAA,cAAAA,GAAA,GAAgC,CAAjD;IAF+B,CAA1B;AAIR,CARM;;;ALDA,KAAA,CAAM9H,yCAAO,GAAGM,yCAAe;AACtCN,yCAAO,CAACQ,OAAR,GAAkBJ,yCAAlB;AACAJ,yCAAO,CAACS,OAAR,GAAkBP,wCAAlB","sources":["packages/components/popover/src/index.ts","packages/components/popover/src/CompoundPopover.tsx","packages/components/popover/src/Popover.tsx","packages/components/popover/src/PopoverContext.ts","packages/components/popover/src/PopoverContent/PopoverContent.tsx","packages/components/popover/src/PopoverContent/PopoverContent.styles.ts","packages/components/popover/src/PopoverTrigger/PopoverTrigger.tsx"],"sourcesContent":["export { Popover } from './CompoundPopover';\nexport type { PopoverProps } from './Popover';\nexport { PopoverTrigger } from './PopoverTrigger/PopoverTrigger';\nexport type { PopoverTriggerProps } from './PopoverTrigger/PopoverTrigger';\nexport { PopoverContent } from './PopoverContent/PopoverContent';\nexport type { PopoverContentProps } from './PopoverContent/PopoverContent';\n","import { Popover as OriginalPopover } from './Popover';\nimport { PopoverContent } from './PopoverContent/PopoverContent';\nimport { PopoverTrigger } from './PopoverTrigger/PopoverTrigger';\n\ntype CompoundPopover = typeof OriginalPopover & {\n Content: typeof PopoverContent;\n Trigger: typeof PopoverTrigger;\n};\n\nexport const Popover = OriginalPopover as CompoundPopover;\nPopover.Content = PopoverContent;\nPopover.Trigger = PopoverTrigger;\n","import React, { useMemo, useState, useEffect, useCallback } from 'react';\nimport { useId, mergeRefs, ExpandProps } from '@contentful/f36-core';\nimport { Placement, Modifier } from '@popperjs/core';\nimport { PopoverContextProvider, PopoverContextType } from './PopoverContext';\nimport { usePopper } from 'react-popper';\n\nexport interface PopoverProps {\n children: React.ReactNode;\n\n /**\n * Boolean to determine if the Popover should be the same width as\n * the trigger element\n *\n * @default false\n */\n isFullWidth?: boolean;\n\n /**\n * Boolean to control whether or not the Popover is open\n *\n * @default false\n */\n isOpen?: boolean;\n\n /**\n * Callback fired when the popover closes\n */\n onClose?: () => void;\n\n /**\n * Determines the preferred position of the Popover. This position is not\n * guaranteed, as the Popover might be moved to fit the viewport\n *\n * @default bottom-start\n */\n placement?: Placement;\n\n /**\n * Boolean to control if popover is allowed to change its placement automatically\n * based on available space in the viewport.\n *\n * For example:\n * If you set placement prop to bottom, but there isn't enough space to position the popover in that direction,\n * it will change the popper placement to top. As soon as enough space is detected, the placement will be reverted to the defined one.\n *\n * If you want the popover to strictly follow the placement prop you should set this prop to false.\n *\n * @default true\n */\n isAutoalignmentEnabled?: boolean;\n\n /**\n * Boolean to control whether or not to render the Popover in a React Portal.\n * Rendering content inside a Portal allows the Popover to escape the bounds\n * of its parent while still being positioned correctly. Using a Portal is\n * necessary if an ancestor of the Popover hides overflow.\n *\n * @default true\n */\n usePortal?: boolean;\n\n /**\n * If true, the popover will close when you blur out it by clicking outside or tabbing out\n *\n * @default true\n */\n closeOnBlur?: boolean;\n\n /**\n * If true, the popover will close when you hit the Esc key\n *\n * @default true\n */\n closeOnEsc?: boolean;\n\n /**\n * If true, the popover will be focused after opening\n *\n * @default true\n */\n autoFocus?: boolean;\n\n /**\n * Popover id. Will be used as an `id` attribute on popover\n * and as `aria-controls` attribute on trigger\n *\n * @default true\n */\n id?: string;\n\n /**\n * The `X-axis` and `Y-axis` offset to position popper element\n * from its trigger element. `[X, Y]`\n *\n * @default [1, 4]\n */\n offset?: [number, number];\n}\n\nexport function Popover(props: ExpandProps<PopoverProps>) {\n const {\n children,\n isOpen,\n placement = 'bottom-start',\n isFullWidth = false,\n isAutoalignmentEnabled = true,\n usePortal = true,\n closeOnBlur = true,\n closeOnEsc = true,\n onClose,\n autoFocus = true,\n id,\n offset = [1, 4],\n } = props;\n\n const [triggerElement, setTriggerElement] = useState<HTMLElement | null>(\n null,\n );\n const [popoverElement, setPopoverElement] = useState<HTMLElement | null>(\n null,\n );\n\n const {\n attributes: popperAttributes,\n forceUpdate,\n styles: popperStyles,\n } = usePopper(triggerElement, popoverElement, {\n placement,\n modifiers: [\n {\n name: 'offset',\n options: {\n offset,\n },\n },\n {\n ...sameWidth,\n enabled: isFullWidth,\n },\n {\n name: 'preventOverflow',\n enabled: isAutoalignmentEnabled,\n options: {\n mainAxis: true,\n },\n },\n {\n name: 'flip',\n enabled: isAutoalignmentEnabled,\n },\n ],\n });\n\n useEffect(() => {\n if (isOpen && autoFocus && popoverElement) {\n popoverElement.focus({ preventScroll: true });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, popoverElement]);\n\n useEffect(() => {\n if (isOpen && forceUpdate) {\n forceUpdate();\n }\n }, [isOpen, forceUpdate]);\n\n const popoverGeneratedId = useId(null, 'popover-content');\n const popoverId = id || popoverGeneratedId;\n\n const closeAndFocusTrigger = useCallback(() => {\n onClose?.();\n\n // setTimeout trick to make it work with focus-lock\n setTimeout(() => triggerElement?.focus({ preventScroll: true }), 0);\n }, [onClose, triggerElement]);\n\n const contextValue: PopoverContextType = useMemo(\n () => ({\n isOpen,\n usePortal,\n getTriggerProps: (_ref = null) => ({\n ref: mergeRefs(setTriggerElement, _ref),\n ['aria-expanded']: Boolean(isOpen),\n ['aria-controls']: popoverId,\n }),\n getPopoverProps: (_props = {}, _ref = null) => ({\n ...popperAttributes.popper,\n style: {\n ...(_props.style || {}),\n ...popperStyles.popper,\n },\n ref: mergeRefs(setPopoverElement, _ref),\n id: popoverId,\n onBlur: (event: React.FocusEvent<HTMLDivElement>) => {\n if (_props.onBlur) {\n _props.onBlur(event);\n }\n\n if (!closeOnBlur) {\n return;\n }\n\n const relatedTarget = event.relatedTarget as Node;\n\n const targetIsPopover =\n popoverElement === relatedTarget ||\n popoverElement?.contains(relatedTarget);\n const targetIsTrigger =\n triggerElement === relatedTarget ||\n triggerElement?.contains(relatedTarget);\n\n if (targetIsPopover || targetIsTrigger) {\n return;\n }\n\n onClose?.();\n },\n onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (_props.onKeyDown) {\n _props.onKeyDown(event);\n }\n\n if (closeOnEsc && event.key === 'Escape') {\n closeAndFocusTrigger();\n }\n },\n }),\n }),\n [\n isOpen,\n popperAttributes,\n popperStyles,\n usePortal,\n popoverId,\n closeOnEsc,\n closeOnBlur,\n popoverElement,\n triggerElement,\n closeAndFocusTrigger,\n onClose,\n ],\n );\n\n return (\n <PopoverContextProvider value={contextValue}>\n {children}\n </PopoverContextProvider>\n );\n}\n\n/**\n * Sets the popover width to the size of the trigger element.\n */\nconst sameWidth: Modifier<'sameWidth', any> = {\n name: 'sameWidth',\n enabled: true,\n phase: 'beforeWrite',\n requires: ['computeStyles'],\n fn: ({ state }) => {\n state.styles.popper.width = `${state.rects.reference.width}px`;\n },\n effect: ({ state }) => () => {\n const reference = state.elements.reference as HTMLElement;\n state.elements.popper.style.width = `${reference.offsetWidth}px`;\n },\n};\n","import React, { HTMLProps } from 'react';\n\nexport type PopoverContextType = {\n isOpen: boolean;\n usePortal: boolean;\n getPopoverProps: (\n _props: HTMLProps<HTMLDivElement>,\n _ref: React.Ref<HTMLDivElement>,\n ) => HTMLProps<HTMLDivElement>;\n getTriggerProps: (_ref: React.Ref<HTMLElement>) => HTMLProps<HTMLElement>;\n};\n\nconst PopoverContext = React.createContext<PopoverContextType | undefined>(\n undefined,\n);\n\nexport const usePopoverContext = () => {\n const context = React.useContext(PopoverContext);\n\n if (context === undefined) {\n throw new Error(\n 'usePopoverContext must be used within a PopoverContextProvider',\n );\n }\n\n return context;\n};\n\nexport const PopoverContextProvider = PopoverContext.Provider;\n","import React from 'react';\nimport { cx } from 'emotion';\nimport {\n CommonProps,\n PropsWithHTMLElement,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { usePopoverContext } from '../PopoverContext';\nimport { Portal } from '@contentful/f36-utils';\nimport { getPopoverContentStyles } from './PopoverContent.styles';\n\ninterface PopoverContentInternalProps extends CommonProps {\n children?: React.ReactNode;\n}\n\nexport type PopoverContentProps = PropsWithHTMLElement<\n PopoverContentInternalProps,\n 'div'\n>;\n\nconst _PopoverContent = (props: ExpandProps<PopoverContentProps>, ref) => {\n const {\n children,\n className,\n testId = 'cf-ui-popover-content',\n role = 'dialog',\n ...otherProps\n } = props;\n const { isOpen, getPopoverProps, usePortal } = usePopoverContext();\n\n const styles = getPopoverContentStyles(isOpen);\n\n const content = (\n <div\n {...otherProps}\n {...getPopoverProps(otherProps, ref)}\n className={cx(styles.container, className)}\n data-test-id={testId}\n tabIndex={-1}\n role={role}\n // specific attribute to mark that this element is absolute positioned\n // for internal contentful apps usage\n data-position-absolute\n >\n {children}\n </div>\n );\n\n return usePortal ? <Portal>{content}</Portal> : content;\n};\n\nexport const PopoverContent = React.forwardRef(_PopoverContent);\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getPopoverContentStyles = (isOpen: boolean) => ({\n container: css({\n display: isOpen ? 'initial' : 'none',\n background: tokens.colorWhite,\n border: 0,\n borderRadius: tokens.borderRadiusMedium,\n boxShadow: tokens.boxShadowDefault,\n zIndex: tokens.zIndexDropdown,\n '&:focus': {\n outline: 'none',\n },\n '&:focus-visible': {\n boxShadow: tokens.glowPrimary,\n },\n }),\n});\n","import React from 'react';\nimport { usePopoverContext } from '../PopoverContext';\n\nexport interface PopoverTriggerProps {\n children: React.ReactNode;\n}\n\n/**\n * PopoverTrigger opens the popover. It must be an interactive element.\n */\nexport const PopoverTrigger = (props: PopoverTriggerProps) => {\n const child = React.Children.only(props.children) as any;\n const { getTriggerProps } = usePopoverContext();\n\n return React.cloneElement(child, {\n ...getTriggerProps(child.ref),\n 'aria-haspopup': child.props['aria-haspopup'] ?? 'dialog',\n });\n};\n"],"names":["Popover","PopoverProps","PopoverTrigger","PopoverTriggerProps","PopoverContent","PopoverContentProps","OriginalPopover","CompoundPopover","Content","Trigger","React","useMemo","useState","useEffect","useCallback","useId","mergeRefs","ExpandProps","Placement","Modifier","PopoverContextProvider","PopoverContextType","usePopper","children","ReactNode","isFullWidth","isOpen","onClose","placement","isAutoalignmentEnabled","usePortal","closeOnBlur","closeOnEsc","autoFocus","id","offset","props","triggerElement","setTriggerElement","HTMLElement","popoverElement","setPopoverElement","attributes","popperAttributes","forceUpdate","styles","popperStyles","modifiers","name","options","sameWidth","enabled","mainAxis","focus","preventScroll","popoverGeneratedId","popoverId","closeAndFocusTrigger","setTimeout","contextValue","getTriggerProps","_ref","ref","Boolean","getPopoverProps","_props","popper","style","onBlur","event","FocusEvent","HTMLDivElement","relatedTarget","Node","targetIsPopover","contains","targetIsTrigger","onKeyDown","KeyboardEvent","key","phase","requires","fn","state","width","rects","reference","effect","elements","offsetWidth","HTMLProps","Ref","PopoverContext","createContext","undefined","usePopoverContext","context","useContext","Error","Provider","CommonProps","PropsWithHTMLElement","Portal","getPopoverContentStyles","PopoverContentInternalProps","_PopoverContent","className","testId","role","otherProps","content","container","forwardRef","tokens","display","background","colorWhite","border","borderRadius","borderRadiusMedium","boxShadow","boxShadowDefault","zIndex","zIndexDropdown","outline","glowPrimary","child","Children","only","cloneElement"],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;;;;;AGaA,KAAA,CAAM6F,oCAAc,GAAGnF,YAAK,CAACoF,aAAa,CACxCC,SADqB;AAIhB,KAAA,CAAMC,yCAAiB,OAAS,CAAvC;IACE,KAAA,CAAMC,OAAO,GAAGvF,YAAK,CAACwF,UAAN,CAAiBL,oCAAjB;IAEhB,EAAA,EAAII,OAAO,KAAKF,SAAhB,EACE,KAAA,CAAM,GAAA,CAAII,KAAJ,CACJ,CADI;IAKR,MAAA,CAAOF,OAAP;AACD,CAVM;AAYA,KAAA,CAAM7E,yCAAsB,GAAGyE,oCAAc,CAACO,QAA9C;;;;SD8ESpG,yCAAT,CAAiBqC,KAAjB,EAAmD,CAA1D;IACE,KAAA,CAAM,CAAN,WACEd,QADI,WAEJG,MAFI,cAGJE,SAAS,GAAG,CAHR,6BAIJH,WAAW,GAAG,KAJV,2BAKJI,sBAAsB,GAAG,IALrB,cAMJC,SAAS,GAAG,I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K,CAACsH,QAAN,CAAeC,IAAf,CAAoB5F,KAAK,CAACd,QAA1B;IACd,KAAA,CAAM,CAAN,kBAAQsC,eAAAA,EAAF,CAAA,GAAsBmC,yCAAiB;QAI1B+B,GAAA;IAFnB,MAAA,eAAOrH,YAAK,CAACwH,YAAN,CAAmBH,KAAnB,EAA0B,CAAA;WAC5BlE,eAAe,CAACkE,KAAK,CAAChE,GAAP;QAClB,CAAA,iBAAiBgE,GAAA,GAAAA,KAAK,CAAC1F,KAAN,CAAY,CAAZ,6BAAA0F,GAAA,cAAAA,GAAA,GAAgC,CAAjD;IAF+B,CAA1B;AAIR,CARM;;;ALDA,KAAA,CAAM/H,yCAAO,GAAGM,yCAAe;AACtCN,yCAAO,CAACQ,OAAR,GAAkBJ,yCAAlB;AACAJ,yCAAO,CAACS,OAAR,GAAkBP,wCAAlB","sources":["packages/components/popover/src/index.ts","packages/components/popover/src/CompoundPopover.tsx","packages/components/popover/src/Popover.tsx","packages/components/popover/src/PopoverContext.ts","packages/components/popover/src/PopoverContent/PopoverContent.tsx","packages/components/popover/src/PopoverContent/PopoverContent.styles.ts","packages/components/popover/src/PopoverTrigger/PopoverTrigger.tsx"],"sourcesContent":["export { Popover } from './CompoundPopover';\nexport type { PopoverProps } from './Popover';\nexport { PopoverTrigger } from './PopoverTrigger/PopoverTrigger';\nexport type { PopoverTriggerProps } from './PopoverTrigger/PopoverTrigger';\nexport { PopoverContent } from './PopoverContent/PopoverContent';\nexport type { PopoverContentProps } from './PopoverContent/PopoverContent';\n","import { Popover as OriginalPopover } from './Popover';\nimport { PopoverContent } from './PopoverContent/PopoverContent';\nimport { PopoverTrigger } from './PopoverTrigger/PopoverTrigger';\n\ntype CompoundPopover = typeof OriginalPopover & {\n Content: typeof PopoverContent;\n Trigger: typeof PopoverTrigger;\n};\n\nexport const Popover = OriginalPopover as CompoundPopover;\nPopover.Content = PopoverContent;\nPopover.Trigger = PopoverTrigger;\n","import React, { useMemo, useState, useEffect, useCallback } from 'react';\nimport { useId, mergeRefs, ExpandProps } from '@contentful/f36-core';\nimport { Placement, Modifier } from '@popperjs/core';\nimport { PopoverContextProvider, PopoverContextType } from './PopoverContext';\nimport { usePopper } from 'react-popper';\n\nexport interface PopoverProps {\n children: React.ReactNode;\n\n /**\n * Boolean to determine if the Popover should be the same width as\n * the trigger element\n *\n * @default false\n */\n isFullWidth?: boolean;\n\n /**\n * Boolean to control whether or not the Popover is open\n *\n * @default false\n */\n isOpen?: boolean;\n\n /**\n * Callback fired when the popover closes\n */\n onClose?: () => void;\n\n /**\n * Determines the preferred position of the Popover. This position is not\n * guaranteed, as the Popover might be moved to fit the viewport\n *\n * @default bottom-start\n */\n placement?: Placement;\n\n /**\n * Boolean to control if popover is allowed to change its placement automatically\n * based on available space in the viewport.\n *\n * For example:\n * If you set placement prop to bottom, but there isn't enough space to position the popover in that direction,\n * it will change the popper placement to top. As soon as enough space is detected, the placement will be reverted to the defined one.\n *\n * If you want the popover to strictly follow the placement prop you should set this prop to false.\n *\n * @default true\n */\n isAutoalignmentEnabled?: boolean;\n\n /**\n * Boolean to control whether or not to render the Popover in a React Portal.\n * Rendering content inside a Portal allows the Popover to escape the bounds\n * of its parent while still being positioned correctly. Using a Portal is\n * necessary if an ancestor of the Popover hides overflow.\n *\n * @default true\n */\n usePortal?: boolean;\n\n /**\n * If true, the popover will close when you blur out it by clicking outside or tabbing out\n *\n * @default true\n */\n closeOnBlur?: boolean;\n\n /**\n * If true, the popover will close when you hit the Esc key\n *\n * @default true\n */\n closeOnEsc?: boolean;\n\n /**\n * If true, the popover will be focused after opening\n *\n * @default true\n */\n autoFocus?: boolean;\n\n /**\n * Popover id. Will be used as an `id` attribute on popover\n * and as `aria-controls` attribute on trigger\n *\n * @default true\n */\n id?: string;\n\n /**\n * The `X-axis` and `Y-axis` offset to position popper element\n * from its trigger element. `[X, Y]`\n *\n * @default [1, 4]\n */\n offset?: [number, number];\n\n /**\n * Defines if popover should be rendered in the DOM only when it's open\n * or all the time (after the component has been mounted)\n *\n * @default true\n */\n renderOnlyWhenOpen?: boolean;\n}\n\nexport function Popover(props: ExpandProps<PopoverProps>) {\n const {\n children,\n isOpen,\n placement = 'bottom-start',\n isFullWidth = false,\n isAutoalignmentEnabled = true,\n usePortal = true,\n closeOnBlur = true,\n closeOnEsc = true,\n onClose,\n autoFocus = true,\n id,\n offset = [1, 4],\n renderOnlyWhenOpen = true,\n } = props;\n\n const [triggerElement, setTriggerElement] = useState<HTMLElement | null>(\n null,\n );\n const [popoverElement, setPopoverElement] = useState<HTMLElement | null>(\n null,\n );\n\n const {\n attributes: popperAttributes,\n forceUpdate,\n styles: popperStyles,\n } = usePopper(triggerElement, popoverElement, {\n placement,\n modifiers: [\n {\n name: 'offset',\n options: {\n offset,\n },\n },\n {\n ...sameWidth,\n enabled: isFullWidth,\n },\n {\n name: 'preventOverflow',\n enabled: isAutoalignmentEnabled,\n options: {\n mainAxis: true,\n },\n },\n {\n name: 'flip',\n enabled: isAutoalignmentEnabled,\n },\n ],\n });\n\n useEffect(() => {\n if (isOpen && autoFocus && popoverElement) {\n popoverElement.focus({ preventScroll: true });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, popoverElement]);\n\n useEffect(() => {\n if (isOpen && forceUpdate) {\n forceUpdate();\n }\n }, [isOpen, forceUpdate]);\n\n const popoverGeneratedId = useId(null, 'popover-content');\n const popoverId = id || popoverGeneratedId;\n\n const closeAndFocusTrigger = useCallback(() => {\n onClose?.();\n\n // setTimeout trick to make it work with focus-lock\n setTimeout(() => triggerElement?.focus({ preventScroll: true }), 0);\n }, [onClose, triggerElement]);\n\n const contextValue: PopoverContextType = useMemo(\n () => ({\n isOpen,\n usePortal,\n renderOnlyWhenOpen,\n getTriggerProps: (_ref = null) => ({\n ref: mergeRefs(setTriggerElement, _ref),\n ['aria-expanded']: Boolean(isOpen),\n ['aria-controls']: popoverId,\n }),\n getPopoverProps: (_props = {}, _ref = null) => ({\n ...popperAttributes.popper,\n style: {\n ...(_props.style || {}),\n ...popperStyles.popper,\n },\n ref: mergeRefs(setPopoverElement, _ref),\n id: popoverId,\n onBlur: (event: React.FocusEvent<HTMLDivElement>) => {\n if (_props.onBlur) {\n _props.onBlur(event);\n }\n\n if (!closeOnBlur) {\n return;\n }\n\n const relatedTarget = event.relatedTarget as Node;\n\n const targetIsPopover =\n popoverElement === relatedTarget ||\n popoverElement?.contains(relatedTarget);\n const targetIsTrigger =\n triggerElement === relatedTarget ||\n triggerElement?.contains(relatedTarget);\n\n if (targetIsPopover || targetIsTrigger) {\n return;\n }\n\n onClose?.();\n },\n onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (_props.onKeyDown) {\n _props.onKeyDown(event);\n }\n\n if (closeOnEsc && event.key === 'Escape') {\n closeAndFocusTrigger();\n }\n },\n }),\n }),\n [\n isOpen,\n renderOnlyWhenOpen,\n popperAttributes,\n popperStyles,\n usePortal,\n popoverId,\n closeOnEsc,\n closeOnBlur,\n popoverElement,\n triggerElement,\n closeAndFocusTrigger,\n onClose,\n ],\n );\n\n return (\n <PopoverContextProvider value={contextValue}>\n {children}\n </PopoverContextProvider>\n );\n}\n\n/**\n * Sets the popover width to the size of the trigger element.\n */\nconst sameWidth: Modifier<'sameWidth', any> = {\n name: 'sameWidth',\n enabled: true,\n phase: 'beforeWrite',\n requires: ['computeStyles'],\n fn: ({ state }) => {\n state.styles.popper.width = `${state.rects.reference.width}px`;\n },\n effect: ({ state }) => () => {\n const reference = state.elements.reference as HTMLElement;\n state.elements.popper.style.width = `${reference.offsetWidth}px`;\n },\n};\n","import React, { HTMLProps } from 'react';\n\nexport type PopoverContextType = {\n isOpen: boolean;\n usePortal: boolean;\n renderOnlyWhenOpen: boolean;\n getPopoverProps: (\n _props: HTMLProps<HTMLDivElement>,\n _ref: React.Ref<HTMLDivElement>,\n ) => HTMLProps<HTMLDivElement>;\n getTriggerProps: (_ref: React.Ref<HTMLElement>) => HTMLProps<HTMLElement>;\n};\n\nconst PopoverContext = React.createContext<PopoverContextType | undefined>(\n undefined,\n);\n\nexport const usePopoverContext = () => {\n const context = React.useContext(PopoverContext);\n\n if (context === undefined) {\n throw new Error(\n 'usePopoverContext must be used within a PopoverContextProvider',\n );\n }\n\n return context;\n};\n\nexport const PopoverContextProvider = PopoverContext.Provider;\n","import React from 'react';\nimport { cx } from 'emotion';\nimport {\n CommonProps,\n PropsWithHTMLElement,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { usePopoverContext } from '../PopoverContext';\nimport { Portal } from '@contentful/f36-utils';\nimport { getPopoverContentStyles } from './PopoverContent.styles';\n\ninterface PopoverContentInternalProps extends CommonProps {\n children?: React.ReactNode;\n}\n\nexport type PopoverContentProps = PropsWithHTMLElement<\n PopoverContentInternalProps,\n 'div'\n>;\n\nconst _PopoverContent = (props: ExpandProps<PopoverContentProps>, ref) => {\n const {\n children,\n className,\n testId = 'cf-ui-popover-content',\n role = 'dialog',\n ...otherProps\n } = props;\n const {\n isOpen,\n renderOnlyWhenOpen,\n getPopoverProps,\n usePortal,\n } = usePopoverContext();\n\n const styles = getPopoverContentStyles(isOpen);\n\n const content = (\n <div\n {...otherProps}\n {...getPopoverProps(otherProps, ref)}\n className={cx(styles.container, className)}\n data-test-id={testId}\n tabIndex={-1}\n role={role}\n // specific attribute to mark that this element is absolute positioned\n // for internal contentful apps usage\n data-position-absolute\n >\n {children}\n </div>\n );\n\n if (renderOnlyWhenOpen && !isOpen) {\n return null;\n }\n\n return usePortal ? <Portal>{content}</Portal> : content;\n};\n\nexport const PopoverContent = React.forwardRef(_PopoverContent);\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getPopoverContentStyles = (isOpen: boolean) => ({\n container: css({\n display: isOpen ? 'initial' : 'none',\n background: tokens.colorWhite,\n border: 0,\n borderRadius: tokens.borderRadiusMedium,\n boxShadow: tokens.boxShadowDefault,\n zIndex: tokens.zIndexDropdown,\n '&:focus': {\n boxShadow: tokens.glowPrimary,\n outline: 'none',\n },\n '&:focus:not(:focus-visible)': {\n boxShadow: tokens.boxShadowDefault,\n },\n }),\n});\n","import React from 'react';\nimport { usePopoverContext } from '../PopoverContext';\n\nexport interface PopoverTriggerProps {\n children: React.ReactNode;\n}\n\n/**\n * PopoverTrigger opens the popover. It must be an interactive element.\n */\nexport const PopoverTrigger = (props: PopoverTriggerProps) => {\n const child = React.Children.only(props.children) as any;\n const { getTriggerProps } = usePopoverContext();\n\n return React.cloneElement(child, {\n ...getTriggerProps(child.ref),\n 'aria-haspopup': child.props['aria-haspopup'] ?? 'dialog',\n });\n};\n"],"names":["Popover","PopoverProps","PopoverTrigger","PopoverTriggerProps","PopoverContent","PopoverContentProps","OriginalPopover","CompoundPopover","Content","Trigger","React","useMemo","useState","useEffect","useCallback","useId","mergeRefs","ExpandProps","Placement","Modifier","PopoverContextProvider","PopoverContextType","usePopper","children","ReactNode","isFullWidth","isOpen","onClose","placement","isAutoalignmentEnabled","usePortal","closeOnBlur","closeOnEsc","autoFocus","id","offset","renderOnlyWhenOpen","props","triggerElement","setTriggerElement","HTMLElement","popoverElement","setPopoverElement","attributes","popperAttributes","forceUpdate","styles","popperStyles","modifiers","name","options","sameWidth","enabled","mainAxis","focus","preventScroll","popoverGeneratedId","popoverId","closeAndFocusTrigger","setTimeout","contextValue","getTriggerProps","_ref","ref","Boolean","getPopoverProps","_props","popper","style","onBlur","event","FocusEvent","HTMLDivElement","relatedTarget","Node","targetIsPopover","contains","targetIsTrigger","onKeyDown","KeyboardEvent","key","phase","requires","fn","state","width","rects","reference","effect","elements","offsetWidth","HTMLProps","Ref","PopoverContext","createContext","undefined","usePopoverContext","context","useContext","Error","Provider","CommonProps","PropsWithHTMLElement","Portal","getPopoverContentStyles","PopoverContentInternalProps","_PopoverContent","className","testId","role","otherProps","content","container","forwardRef","tokens","display","background","colorWhite","border","borderRadius","borderRadiusMedium","boxShadow","boxShadowDefault","zIndex","zIndexDropdown","glowPrimary","outline","child","Children","only","cloneElement"],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -81,272 +81,20 @@ export interface PopoverProps {
81
81
  * @default [1, 4]
82
82
  */
83
83
  offset?: [number, number];
84
+ /**
85
+ * Defines if popover should be rendered in the DOM only when it's open
86
+ * or all the time (after the component has been mounted)
87
+ *
88
+ * @default true
89
+ */
90
+ renderOnlyWhenOpen?: boolean;
84
91
  }
85
92
  declare function _Popover1(props: ExpandProps<PopoverProps>): JSX.Element;
86
93
  interface PopoverContentInternalProps extends CommonProps {
87
94
  children?: React.ReactNode;
88
95
  }
89
96
  export type PopoverContentProps = PropsWithHTMLElement<PopoverContentInternalProps, 'div'>;
90
- export const PopoverContent: React.ForwardRefExoticComponent<{
91
- id?: string;
92
- 'aria-expanded'?: boolean | "false" | "true";
93
- 'aria-controls'?: string;
94
- hidden?: boolean;
95
- color?: string;
96
- slot?: string;
97
- title?: string;
98
- translate?: "yes" | "no";
99
- key?: React.Key;
100
- defaultChecked?: boolean;
101
- defaultValue?: string | number | readonly string[];
102
- suppressContentEditableWarning?: boolean;
103
- suppressHydrationWarning?: boolean;
104
- accessKey?: string;
105
- contentEditable?: "inherit" | (boolean | "false" | "true");
106
- contextMenu?: string;
107
- dir?: string;
108
- draggable?: boolean | "false" | "true";
109
- lang?: string;
110
- placeholder?: string;
111
- spellCheck?: boolean | "false" | "true";
112
- tabIndex?: number;
113
- radioGroup?: string;
114
- role?: string;
115
- about?: string;
116
- datatype?: string;
117
- inlist?: any;
118
- prefix?: string;
119
- property?: string;
120
- resource?: string;
121
- typeof?: string;
122
- vocab?: string;
123
- autoCapitalize?: string;
124
- autoCorrect?: string;
125
- autoSave?: string;
126
- itemProp?: string;
127
- itemScope?: boolean;
128
- itemType?: string;
129
- itemID?: string;
130
- itemRef?: string;
131
- results?: number;
132
- security?: string;
133
- unselectable?: "on" | "off";
134
- inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search";
135
- is?: string;
136
- 'aria-activedescendant'?: string;
137
- 'aria-atomic'?: boolean | "false" | "true";
138
- 'aria-autocomplete'?: "both" | "none" | "inline" | "list";
139
- 'aria-busy'?: boolean | "false" | "true";
140
- 'aria-checked'?: boolean | "false" | "true" | "mixed";
141
- 'aria-colcount'?: number;
142
- 'aria-colindex'?: number;
143
- 'aria-colspan'?: number;
144
- 'aria-current'?: boolean | "false" | "true" | "page" | "time" | "step" | "location" | "date";
145
- 'aria-describedby'?: string;
146
- 'aria-details'?: string;
147
- 'aria-disabled'?: boolean | "false" | "true";
148
- 'aria-dropeffect'?: "none" | "copy" | "move" | "link" | "execute" | "popup";
149
- 'aria-errormessage'?: string;
150
- 'aria-flowto'?: string;
151
- 'aria-grabbed'?: boolean | "false" | "true";
152
- 'aria-haspopup'?: boolean | "false" | "true" | "listbox" | "grid" | "menu" | "dialog" | "tree";
153
- 'aria-hidden'?: boolean | "false" | "true";
154
- 'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling";
155
- 'aria-keyshortcuts'?: string;
156
- 'aria-label'?: string;
157
- 'aria-labelledby'?: string;
158
- 'aria-level'?: number;
159
- 'aria-live'?: "off" | "assertive" | "polite";
160
- 'aria-modal'?: boolean | "false" | "true";
161
- 'aria-multiline'?: boolean | "false" | "true";
162
- 'aria-multiselectable'?: boolean | "false" | "true";
163
- 'aria-orientation'?: "horizontal" | "vertical";
164
- 'aria-owns'?: string;
165
- 'aria-placeholder'?: string;
166
- 'aria-posinset'?: number;
167
- 'aria-pressed'?: boolean | "false" | "true" | "mixed";
168
- 'aria-readonly'?: boolean | "false" | "true";
169
- 'aria-relevant'?: "all" | "text" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals";
170
- 'aria-required'?: boolean | "false" | "true";
171
- 'aria-roledescription'?: string;
172
- 'aria-rowcount'?: number;
173
- 'aria-rowindex'?: number;
174
- 'aria-rowspan'?: number;
175
- 'aria-selected'?: boolean | "false" | "true";
176
- 'aria-setsize'?: number;
177
- 'aria-sort'?: "none" | "ascending" | "descending" | "other";
178
- 'aria-valuemax'?: number;
179
- 'aria-valuemin'?: number;
180
- 'aria-valuenow'?: number;
181
- 'aria-valuetext'?: string;
182
- dangerouslySetInnerHTML?: {
183
- __html: string;
184
- };
185
- onCopy?: React.ClipboardEventHandler<HTMLDivElement>;
186
- onCopyCapture?: React.ClipboardEventHandler<HTMLDivElement>;
187
- onCut?: React.ClipboardEventHandler<HTMLDivElement>;
188
- onCutCapture?: React.ClipboardEventHandler<HTMLDivElement>;
189
- onPaste?: React.ClipboardEventHandler<HTMLDivElement>;
190
- onPasteCapture?: React.ClipboardEventHandler<HTMLDivElement>;
191
- onCompositionEnd?: React.CompositionEventHandler<HTMLDivElement>;
192
- onCompositionEndCapture?: React.CompositionEventHandler<HTMLDivElement>;
193
- onCompositionStart?: React.CompositionEventHandler<HTMLDivElement>;
194
- onCompositionStartCapture?: React.CompositionEventHandler<HTMLDivElement>;
195
- onCompositionUpdate?: React.CompositionEventHandler<HTMLDivElement>;
196
- onCompositionUpdateCapture?: React.CompositionEventHandler<HTMLDivElement>;
197
- onFocus?: React.FocusEventHandler<HTMLDivElement>;
198
- onFocusCapture?: React.FocusEventHandler<HTMLDivElement>;
199
- onBlur?: React.FocusEventHandler<HTMLDivElement>;
200
- onBlurCapture?: React.FocusEventHandler<HTMLDivElement>;
201
- onChange?: React.FormEventHandler<HTMLDivElement>;
202
- onChangeCapture?: React.FormEventHandler<HTMLDivElement>;
203
- onBeforeInput?: React.FormEventHandler<HTMLDivElement>;
204
- onBeforeInputCapture?: React.FormEventHandler<HTMLDivElement>;
205
- onInput?: React.FormEventHandler<HTMLDivElement>;
206
- onInputCapture?: React.FormEventHandler<HTMLDivElement>;
207
- onReset?: React.FormEventHandler<HTMLDivElement>;
208
- onResetCapture?: React.FormEventHandler<HTMLDivElement>;
209
- onSubmit?: React.FormEventHandler<HTMLDivElement>;
210
- onSubmitCapture?: React.FormEventHandler<HTMLDivElement>;
211
- onInvalid?: React.FormEventHandler<HTMLDivElement>;
212
- onInvalidCapture?: React.FormEventHandler<HTMLDivElement>;
213
- onLoad?: React.ReactEventHandler<HTMLDivElement>;
214
- onLoadCapture?: React.ReactEventHandler<HTMLDivElement>;
215
- onError?: React.ReactEventHandler<HTMLDivElement>;
216
- onErrorCapture?: React.ReactEventHandler<HTMLDivElement>;
217
- onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
218
- onKeyDownCapture?: React.KeyboardEventHandler<HTMLDivElement>;
219
- onKeyPress?: React.KeyboardEventHandler<HTMLDivElement>;
220
- onKeyPressCapture?: React.KeyboardEventHandler<HTMLDivElement>;
221
- onKeyUp?: React.KeyboardEventHandler<HTMLDivElement>;
222
- onKeyUpCapture?: React.KeyboardEventHandler<HTMLDivElement>;
223
- onAbort?: React.ReactEventHandler<HTMLDivElement>;
224
- onAbortCapture?: React.ReactEventHandler<HTMLDivElement>;
225
- onCanPlay?: React.ReactEventHandler<HTMLDivElement>;
226
- onCanPlayCapture?: React.ReactEventHandler<HTMLDivElement>;
227
- onCanPlayThrough?: React.ReactEventHandler<HTMLDivElement>;
228
- onCanPlayThroughCapture?: React.ReactEventHandler<HTMLDivElement>;
229
- onDurationChange?: React.ReactEventHandler<HTMLDivElement>;
230
- onDurationChangeCapture?: React.ReactEventHandler<HTMLDivElement>;
231
- onEmptied?: React.ReactEventHandler<HTMLDivElement>;
232
- onEmptiedCapture?: React.ReactEventHandler<HTMLDivElement>;
233
- onEncrypted?: React.ReactEventHandler<HTMLDivElement>;
234
- onEncryptedCapture?: React.ReactEventHandler<HTMLDivElement>;
235
- onEnded?: React.ReactEventHandler<HTMLDivElement>;
236
- onEndedCapture?: React.ReactEventHandler<HTMLDivElement>;
237
- onLoadedData?: React.ReactEventHandler<HTMLDivElement>;
238
- onLoadedDataCapture?: React.ReactEventHandler<HTMLDivElement>;
239
- onLoadedMetadata?: React.ReactEventHandler<HTMLDivElement>;
240
- onLoadedMetadataCapture?: React.ReactEventHandler<HTMLDivElement>;
241
- onLoadStart?: React.ReactEventHandler<HTMLDivElement>;
242
- onLoadStartCapture?: React.ReactEventHandler<HTMLDivElement>;
243
- onPause?: React.ReactEventHandler<HTMLDivElement>;
244
- onPauseCapture?: React.ReactEventHandler<HTMLDivElement>;
245
- onPlay?: React.ReactEventHandler<HTMLDivElement>;
246
- onPlayCapture?: React.ReactEventHandler<HTMLDivElement>;
247
- onPlaying?: React.ReactEventHandler<HTMLDivElement>;
248
- onPlayingCapture?: React.ReactEventHandler<HTMLDivElement>;
249
- onProgress?: React.ReactEventHandler<HTMLDivElement>;
250
- onProgressCapture?: React.ReactEventHandler<HTMLDivElement>;
251
- onRateChange?: React.ReactEventHandler<HTMLDivElement>;
252
- onRateChangeCapture?: React.ReactEventHandler<HTMLDivElement>;
253
- onSeeked?: React.ReactEventHandler<HTMLDivElement>;
254
- onSeekedCapture?: React.ReactEventHandler<HTMLDivElement>;
255
- onSeeking?: React.ReactEventHandler<HTMLDivElement>;
256
- onSeekingCapture?: React.ReactEventHandler<HTMLDivElement>;
257
- onStalled?: React.ReactEventHandler<HTMLDivElement>;
258
- onStalledCapture?: React.ReactEventHandler<HTMLDivElement>;
259
- onSuspend?: React.ReactEventHandler<HTMLDivElement>;
260
- onSuspendCapture?: React.ReactEventHandler<HTMLDivElement>;
261
- onTimeUpdate?: React.ReactEventHandler<HTMLDivElement>;
262
- onTimeUpdateCapture?: React.ReactEventHandler<HTMLDivElement>;
263
- onVolumeChange?: React.ReactEventHandler<HTMLDivElement>;
264
- onVolumeChangeCapture?: React.ReactEventHandler<HTMLDivElement>;
265
- onWaiting?: React.ReactEventHandler<HTMLDivElement>;
266
- onWaitingCapture?: React.ReactEventHandler<HTMLDivElement>;
267
- onAuxClick?: React.MouseEventHandler<HTMLDivElement>;
268
- onAuxClickCapture?: React.MouseEventHandler<HTMLDivElement>;
269
- onClick?: React.MouseEventHandler<HTMLDivElement>;
270
- onClickCapture?: React.MouseEventHandler<HTMLDivElement>;
271
- onContextMenu?: React.MouseEventHandler<HTMLDivElement>;
272
- onContextMenuCapture?: React.MouseEventHandler<HTMLDivElement>;
273
- onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
274
- onDoubleClickCapture?: React.MouseEventHandler<HTMLDivElement>;
275
- onDrag?: React.DragEventHandler<HTMLDivElement>;
276
- onDragCapture?: React.DragEventHandler<HTMLDivElement>;
277
- onDragEnd?: React.DragEventHandler<HTMLDivElement>;
278
- onDragEndCapture?: React.DragEventHandler<HTMLDivElement>;
279
- onDragEnter?: React.DragEventHandler<HTMLDivElement>;
280
- onDragEnterCapture?: React.DragEventHandler<HTMLDivElement>;
281
- onDragExit?: React.DragEventHandler<HTMLDivElement>;
282
- onDragExitCapture?: React.DragEventHandler<HTMLDivElement>;
283
- onDragLeave?: React.DragEventHandler<HTMLDivElement>;
284
- onDragLeaveCapture?: React.DragEventHandler<HTMLDivElement>;
285
- onDragOver?: React.DragEventHandler<HTMLDivElement>;
286
- onDragOverCapture?: React.DragEventHandler<HTMLDivElement>;
287
- onDragStart?: React.DragEventHandler<HTMLDivElement>;
288
- onDragStartCapture?: React.DragEventHandler<HTMLDivElement>;
289
- onDrop?: React.DragEventHandler<HTMLDivElement>;
290
- onDropCapture?: React.DragEventHandler<HTMLDivElement>;
291
- onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
292
- onMouseDownCapture?: React.MouseEventHandler<HTMLDivElement>;
293
- onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
294
- onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
295
- onMouseMove?: React.MouseEventHandler<HTMLDivElement>;
296
- onMouseMoveCapture?: React.MouseEventHandler<HTMLDivElement>;
297
- onMouseOut?: React.MouseEventHandler<HTMLDivElement>;
298
- onMouseOutCapture?: React.MouseEventHandler<HTMLDivElement>;
299
- onMouseOver?: React.MouseEventHandler<HTMLDivElement>;
300
- onMouseOverCapture?: React.MouseEventHandler<HTMLDivElement>;
301
- onMouseUp?: React.MouseEventHandler<HTMLDivElement>;
302
- onMouseUpCapture?: React.MouseEventHandler<HTMLDivElement>;
303
- onSelect?: React.ReactEventHandler<HTMLDivElement>;
304
- onSelectCapture?: React.ReactEventHandler<HTMLDivElement>;
305
- onTouchCancel?: React.TouchEventHandler<HTMLDivElement>;
306
- onTouchCancelCapture?: React.TouchEventHandler<HTMLDivElement>;
307
- onTouchEnd?: React.TouchEventHandler<HTMLDivElement>;
308
- onTouchEndCapture?: React.TouchEventHandler<HTMLDivElement>;
309
- onTouchMove?: React.TouchEventHandler<HTMLDivElement>;
310
- onTouchMoveCapture?: React.TouchEventHandler<HTMLDivElement>;
311
- onTouchStart?: React.TouchEventHandler<HTMLDivElement>;
312
- onTouchStartCapture?: React.TouchEventHandler<HTMLDivElement>;
313
- onPointerDown?: React.PointerEventHandler<HTMLDivElement>;
314
- onPointerDownCapture?: React.PointerEventHandler<HTMLDivElement>;
315
- onPointerMove?: React.PointerEventHandler<HTMLDivElement>;
316
- onPointerMoveCapture?: React.PointerEventHandler<HTMLDivElement>;
317
- onPointerUp?: React.PointerEventHandler<HTMLDivElement>;
318
- onPointerUpCapture?: React.PointerEventHandler<HTMLDivElement>;
319
- onPointerCancel?: React.PointerEventHandler<HTMLDivElement>;
320
- onPointerCancelCapture?: React.PointerEventHandler<HTMLDivElement>;
321
- onPointerEnter?: React.PointerEventHandler<HTMLDivElement>;
322
- onPointerEnterCapture?: React.PointerEventHandler<HTMLDivElement>;
323
- onPointerLeave?: React.PointerEventHandler<HTMLDivElement>;
324
- onPointerLeaveCapture?: React.PointerEventHandler<HTMLDivElement>;
325
- onPointerOver?: React.PointerEventHandler<HTMLDivElement>;
326
- onPointerOverCapture?: React.PointerEventHandler<HTMLDivElement>;
327
- onPointerOut?: React.PointerEventHandler<HTMLDivElement>;
328
- onPointerOutCapture?: React.PointerEventHandler<HTMLDivElement>;
329
- onGotPointerCapture?: React.PointerEventHandler<HTMLDivElement>;
330
- onGotPointerCaptureCapture?: React.PointerEventHandler<HTMLDivElement>;
331
- onLostPointerCapture?: React.PointerEventHandler<HTMLDivElement>;
332
- onLostPointerCaptureCapture?: React.PointerEventHandler<HTMLDivElement>;
333
- onScroll?: React.UIEventHandler<HTMLDivElement>;
334
- onScrollCapture?: React.UIEventHandler<HTMLDivElement>;
335
- onWheel?: React.WheelEventHandler<HTMLDivElement>;
336
- onWheelCapture?: React.WheelEventHandler<HTMLDivElement>;
337
- onAnimationStart?: React.AnimationEventHandler<HTMLDivElement>;
338
- onAnimationStartCapture?: React.AnimationEventHandler<HTMLDivElement>;
339
- onAnimationEnd?: React.AnimationEventHandler<HTMLDivElement>;
340
- onAnimationEndCapture?: React.AnimationEventHandler<HTMLDivElement>;
341
- onAnimationIteration?: React.AnimationEventHandler<HTMLDivElement>;
342
- onAnimationIterationCapture?: React.AnimationEventHandler<HTMLDivElement>;
343
- onTransitionEnd?: React.TransitionEventHandler<HTMLDivElement>;
344
- onTransitionEndCapture?: React.TransitionEventHandler<HTMLDivElement>;
345
- children?: React.ReactNode;
346
- className?: string;
347
- testId?: string;
348
- style?: React.CSSProperties;
349
- } & React.RefAttributes<unknown>>;
97
+ export const PopoverContent: React.ForwardRefExoticComponent<Omit<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>>, never>, keyof PopoverContentInternalProps> & PopoverContentInternalProps & React.RefAttributes<unknown>>;
350
98
  export interface PopoverTriggerProps {
351
99
  children: React.ReactNode;
352
100
  }
@@ -481,7 +229,7 @@ export const PopoverTrigger: (props: PopoverTriggerProps) => React.DetailedReact
481
229
  title?: string;
482
230
  translate?: "yes" | "no";
483
231
  radioGroup?: string;
484
- role?: string;
232
+ role?: React.AriaRole;
485
233
  about?: string;
486
234
  datatype?: string;
487
235
  inlist?: any;
@@ -502,7 +250,7 @@ export const PopoverTrigger: (props: PopoverTriggerProps) => React.DetailedReact
502
250
  results?: number;
503
251
  security?: string;
504
252
  unselectable?: "on" | "off";
505
- inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search";
253
+ inputMode?: "none" | "text" | "search" | "tel" | "url" | "email" | "numeric" | "decimal";
506
254
  is?: string;
507
255
  'aria-activedescendant'?: string;
508
256
  'aria-atomic'?: boolean | "false" | "true";
@@ -1 +1 @@
1
- {"mappings":";;;ACMA;IACE,QAAQ,EAAE,MAAM,SAAS,CAAC;IAE1B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;;;;;;;;OAWG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;OAKG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3B;AAED,2BAAwB,KAAK,EAAE,YAAY,YAAY,CAAC,eAqJvD;AE7OD,qCAAsC,SAAQ,WAAW;IACvD,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;CAC5B;AAED,kCAAkC,qBAChC,2BAA2B,EAC3B,KAAK,CACN,CAAC;AAiCF,OAAO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAvCA,MAAM,SAAS;;;;iCAuCmC,CAAC;AChDhE;IACE,QAAQ,EAAE,MAAM,SAAS,CAAC;CAC3B;AAED;;GAEG;AACH,OAAO,MAAM,wBAAyB,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAQxD,CAAC;ACdF,uBAAuB,gBAAsB,GAAG;IAC9C,OAAO,EAAE,qBAAqB,CAAC;IAC/B,OAAO,EAAE,qBAAqB,CAAC;CAChC,CAAC;AAEF,OAAO,MAAM,wBAA4C,CAAC","sources":["packages/components/popover/src/src/PopoverContext.ts","packages/components/popover/src/src/Popover.tsx","packages/components/popover/src/src/PopoverContent/PopoverContent.styles.ts","packages/components/popover/src/src/PopoverContent/PopoverContent.tsx","packages/components/popover/src/src/PopoverTrigger/PopoverTrigger.tsx","packages/components/popover/src/src/CompoundPopover.tsx","packages/components/popover/src/src/index.ts","packages/components/popover/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,"export { Popover } from './CompoundPopover';\nexport type { PopoverProps } from './Popover';\nexport { PopoverTrigger } from './PopoverTrigger/PopoverTrigger';\nexport type { PopoverTriggerProps } from './PopoverTrigger/PopoverTrigger';\nexport { PopoverContent } from './PopoverContent/PopoverContent';\nexport type { PopoverContentProps } from './PopoverContent/PopoverContent';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;ACMA;IACE,QAAQ,EAAE,MAAM,SAAS,CAAC;IAE1B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;;;;;;;;OAWG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;OAKG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1B;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,2BAAwB,KAAK,EAAE,YAAY,YAAY,CAAC,eAwJvD;AExPD,qCAAsC,SAAQ,WAAW;IACvD,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;CAC5B;AAED,kCAAkC,qBAChC,2BAA2B,EAC3B,KAAK,CACN,CAAC;AA0CF,OAAO,MAAM,2SAAkD,CAAC;ACzDhE;IACE,QAAQ,EAAE,MAAM,SAAS,CAAC;CAC3B;AAED;;GAEG;AACH,OAAO,MAAM,wBAAyB,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAQxD,CAAC;ACdF,uBAAuB,gBAAsB,GAAG;IAC9C,OAAO,EAAE,qBAAqB,CAAC;IAC/B,OAAO,EAAE,qBAAqB,CAAC;CAChC,CAAC;AAEF,OAAO,MAAM,wBAA4C,CAAC","sources":["packages/components/popover/src/src/PopoverContext.ts","packages/components/popover/src/src/Popover.tsx","packages/components/popover/src/src/PopoverContent/PopoverContent.styles.ts","packages/components/popover/src/src/PopoverContent/PopoverContent.tsx","packages/components/popover/src/src/PopoverTrigger/PopoverTrigger.tsx","packages/components/popover/src/src/CompoundPopover.tsx","packages/components/popover/src/src/index.ts","packages/components/popover/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,"export { Popover } from './CompoundPopover';\nexport type { PopoverProps } from './Popover';\nexport { PopoverTrigger } from './PopoverTrigger/PopoverTrigger';\nexport type { PopoverTriggerProps } from './PopoverTrigger/PopoverTrigger';\nexport { PopoverContent } from './PopoverContent/PopoverContent';\nexport type { PopoverContentProps } from './PopoverContent/PopoverContent';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@contentful/f36-popover",
3
- "version": "4.0.1",
3
+ "version": "4.2.0",
4
4
  "description": "Forma 36: Popover component",
5
5
  "scripts": {
6
6
  "build": "parcel build"
7
7
  },
8
8
  "dependencies": {
9
9
  "@babel/runtime": "^7.6.2",
10
- "@contentful/f36-core": "^4.0.1",
10
+ "@contentful/f36-core": "^4.1.1",
11
11
  "@contentful/f36-tokens": "^4.0.0",
12
12
  "@contentful/f36-utils": "^4.0.0",
13
13
  "@popperjs/core": "^2.4.4",
@@ -34,5 +34,5 @@
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "gitHead": "cee6bd9ae0b1ca2ce23d42873d9344a20fe740d0"
37
+ "gitHead": "e78e35a74c8126817f25be11f3811d4bc1b55bd9"
38
38
  }