@contentful/f36-popover 4.14.0 → 4.15.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
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.15.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @contentful/f36-utils@4.15.0
9
+ - @contentful/f36-core@4.15.0
10
+
3
11
  ## 4.14.0
4
12
 
5
13
  ### Patch Changes
package/dist/main.js CHANGED
@@ -18,10 +18,10 @@ $parcel$export(module.exports, "PopoverContent", () => $ec6b27dd96eb674c$export$
18
18
 
19
19
 
20
20
 
21
- const $a5e54ab4533eb4d3$var$PopoverContext = ($parcel$interopDefault($36WSQ$react)).createContext(undefined);
21
+ const $a5e54ab4533eb4d3$var$PopoverContext = (0, ($parcel$interopDefault($36WSQ$react))).createContext(undefined);
22
22
  const $a5e54ab4533eb4d3$export$1468d0761b26e6c8 = ()=>{
23
- const context = ($parcel$interopDefault($36WSQ$react)).useContext($a5e54ab4533eb4d3$var$PopoverContext);
24
- if (context === undefined) throw new Error('usePopoverContext must be used within a PopoverContextProvider');
23
+ const context = (0, ($parcel$interopDefault($36WSQ$react))).useContext($a5e54ab4533eb4d3$var$PopoverContext);
24
+ if (context === undefined) throw new Error("usePopoverContext must be used within a PopoverContextProvider");
25
25
  return context;
26
26
  };
27
27
  const $a5e54ab4533eb4d3$export$f5300fbf692a63ec = $a5e54ab4533eb4d3$var$PopoverContext.Provider;
@@ -29,17 +29,17 @@ const $a5e54ab4533eb4d3$export$f5300fbf692a63ec = $a5e54ab4533eb4d3$var$PopoverC
29
29
 
30
30
 
31
31
  function $ed3840333e471e4e$export$5b6b19405a83ff9d(props) {
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 = [
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
35
  ] , renderOnlyWhenOpen: renderOnlyWhenOpen = true } = props;
36
- const [triggerElement, setTriggerElement] = $36WSQ$react.useState(null);
37
- const [popoverElement, setPopoverElement] = $36WSQ$react.useState(null);
38
- const { attributes: popperAttributes , update: update , styles: popperStyles } = $36WSQ$reactpopper.usePopper(triggerElement, popoverElement, {
36
+ const [triggerElement, setTriggerElement] = (0, $36WSQ$react.useState)(null);
37
+ const [popoverElement, setPopoverElement] = (0, $36WSQ$react.useState)(null);
38
+ const { attributes: popperAttributes , update: update , styles: popperStyles } = (0, $36WSQ$reactpopper.usePopper)(triggerElement, popoverElement, {
39
39
  placement: placement,
40
40
  modifiers: [
41
41
  {
42
- name: 'offset',
42
+ name: "offset",
43
43
  options: {
44
44
  offset: offset
45
45
  }
@@ -49,19 +49,19 @@ function $ed3840333e471e4e$export$5b6b19405a83ff9d(props) {
49
49
  enabled: isFullWidth
50
50
  },
51
51
  {
52
- name: 'preventOverflow',
52
+ name: "preventOverflow",
53
53
  enabled: isAutoalignmentEnabled,
54
54
  options: {
55
55
  mainAxis: true
56
56
  }
57
57
  },
58
58
  {
59
- name: 'flip',
59
+ name: "flip",
60
60
  enabled: isAutoalignmentEnabled
61
61
  }
62
62
  ]
63
63
  });
64
- $36WSQ$react.useEffect(()=>{
64
+ (0, $36WSQ$react.useEffect)(()=>{
65
65
  if (isOpen && autoFocus && popoverElement) popoverElement.focus({
66
66
  preventScroll: true
67
67
  });
@@ -70,7 +70,7 @@ function $ed3840333e471e4e$export$5b6b19405a83ff9d(props) {
70
70
  isOpen,
71
71
  popoverElement
72
72
  ]);
73
- $36WSQ$react.useEffect(()=>{
73
+ (0, $36WSQ$react.useEffect)(()=>{
74
74
  const updatePosition = async ()=>{
75
75
  if (isOpen && update) await update();
76
76
  };
@@ -79,9 +79,9 @@ function $ed3840333e471e4e$export$5b6b19405a83ff9d(props) {
79
79
  isOpen,
80
80
  update
81
81
  ]);
82
- const popoverGeneratedId = $36WSQ$contentfulf36core.useId(undefined, 'popover-content');
82
+ const popoverGeneratedId = (0, $36WSQ$contentfulf36core.useId)(undefined, "popover-content");
83
83
  const popoverId = id || popoverGeneratedId;
84
- const closeAndFocusTrigger = $36WSQ$react.useCallback(()=>{
84
+ const closeAndFocusTrigger = (0, $36WSQ$react.useCallback)(()=>{
85
85
  onClose === null || onClose === void 0 ? void 0 : onClose(); // setTimeout trick to make it work with focus-lock
86
86
  setTimeout(()=>{
87
87
  return triggerElement === null || triggerElement === void 0 ? void 0 : triggerElement.focus({
@@ -92,17 +92,16 @@ function $ed3840333e471e4e$export$5b6b19405a83ff9d(props) {
92
92
  onClose,
93
93
  triggerElement
94
94
  ]);
95
- const contextValue = $36WSQ$react.useMemo(()=>{
95
+ const contextValue = (0, $36WSQ$react.useMemo)(()=>{
96
96
  return {
97
97
  isOpen: Boolean(isOpen),
98
98
  usePortal: usePortal,
99
99
  renderOnlyWhenOpen: renderOnlyWhenOpen,
100
100
  getTriggerProps: (_ref = null)=>({
101
- ref: $36WSQ$contentfulf36core.mergeRefs(setTriggerElement, _ref),
102
- ['aria-expanded']: Boolean(isOpen),
103
- ['aria-controls']: popoverId
104
- })
105
- ,
101
+ ref: (0, $36WSQ$contentfulf36core.mergeRefs)(setTriggerElement, _ref),
102
+ ["aria-expanded"]: Boolean(isOpen),
103
+ ["aria-controls"]: popoverId
104
+ }),
106
105
  getPopoverProps: (_props = {}, _ref = null)=>{
107
106
  return {
108
107
  ...popperAttributes.popper,
@@ -110,7 +109,7 @@ function $ed3840333e471e4e$export$5b6b19405a83ff9d(props) {
110
109
  ..._props.style || {},
111
110
  ...popperStyles.popper
112
111
  },
113
- ref: $36WSQ$contentfulf36core.mergeRefs(setPopoverElement, _ref),
112
+ ref: (0, $36WSQ$contentfulf36core.mergeRefs)(setPopoverElement, _ref),
114
113
  id: popoverId,
115
114
  onBlur: (event)=>{
116
115
  if (_props.onBlur) _props.onBlur(event);
@@ -123,7 +122,7 @@ function $ed3840333e471e4e$export$5b6b19405a83ff9d(props) {
123
122
  },
124
123
  onKeyDown: (event)=>{
125
124
  if (_props.onKeyDown) _props.onKeyDown(event);
126
- if (closeOnEsc && event.key === 'Escape') closeAndFocusTrigger();
125
+ if (closeOnEsc && event.key === "Escape") closeAndFocusTrigger();
127
126
  }
128
127
  };
129
128
  }
@@ -142,18 +141,18 @@ function $ed3840333e471e4e$export$5b6b19405a83ff9d(props) {
142
141
  closeAndFocusTrigger,
143
142
  onClose
144
143
  ]);
145
- return /*#__PURE__*/ ($parcel$interopDefault($36WSQ$react)).createElement($a5e54ab4533eb4d3$export$f5300fbf692a63ec, {
144
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($36WSQ$react))).createElement((0, $a5e54ab4533eb4d3$export$f5300fbf692a63ec), {
146
145
  value: contextValue
147
146
  }, children);
148
147
  }
149
148
  /**
150
149
  * Sets the popover width to the size of the trigger element.
151
150
  */ const $ed3840333e471e4e$var$sameWidth = {
152
- name: 'sameWidth',
151
+ name: "sameWidth",
153
152
  enabled: true,
154
- phase: 'beforeWrite',
153
+ phase: "beforeWrite",
155
154
  requires: [
156
- 'computeStyles'
155
+ "computeStyles"
157
156
  ],
158
157
  fn: ({ state: state })=>{
159
158
  state.styles.popper.width = `${state.rects.reference.width}px`;
@@ -172,33 +171,32 @@ function $ed3840333e471e4e$export$5b6b19405a83ff9d(props) {
172
171
 
173
172
 
174
173
  const $ac842fe302ff665f$export$fbd764fe961047f7 = (isOpen)=>({
175
- container: /*#__PURE__*/ $36WSQ$emotion.css({
176
- display: isOpen ? 'initial' : 'none',
177
- background: ($parcel$interopDefault($36WSQ$contentfulf36tokens)).colorWhite,
174
+ container: /*#__PURE__*/ (0, $36WSQ$emotion.css)({
175
+ display: isOpen ? "initial" : "none",
176
+ background: (0, ($parcel$interopDefault($36WSQ$contentfulf36tokens))).colorWhite,
178
177
  border: 0,
179
- borderRadius: ($parcel$interopDefault($36WSQ$contentfulf36tokens)).borderRadiusMedium,
180
- boxShadow: ($parcel$interopDefault($36WSQ$contentfulf36tokens)).boxShadowDefault,
181
- zIndex: ($parcel$interopDefault($36WSQ$contentfulf36tokens)).zIndexDropdown,
182
- '&:focus': {
183
- boxShadow: ($parcel$interopDefault($36WSQ$contentfulf36tokens)).glowPrimary,
184
- outline: 'none'
178
+ borderRadius: (0, ($parcel$interopDefault($36WSQ$contentfulf36tokens))).borderRadiusMedium,
179
+ boxShadow: (0, ($parcel$interopDefault($36WSQ$contentfulf36tokens))).boxShadowDefault,
180
+ zIndex: (0, ($parcel$interopDefault($36WSQ$contentfulf36tokens))).zIndexDropdown,
181
+ "&:focus": {
182
+ boxShadow: (0, ($parcel$interopDefault($36WSQ$contentfulf36tokens))).glowPrimary,
183
+ outline: "none"
185
184
  },
186
- '&:focus:not(:focus-visible)': {
187
- boxShadow: ($parcel$interopDefault($36WSQ$contentfulf36tokens)).boxShadowDefault
185
+ "&:focus:not(:focus-visible)": {
186
+ boxShadow: (0, ($parcel$interopDefault($36WSQ$contentfulf36tokens))).boxShadowDefault
188
187
  }
189
188
  })
190
- })
191
- ;
189
+ });
192
190
 
193
191
 
194
192
  const $ec6b27dd96eb674c$var$_PopoverContent = (props, ref)=>{
195
- const { children: children , className: className , testId: testId = 'cf-ui-popover-content' , role: role = 'dialog' , ...otherProps } = props;
196
- const { isOpen: isOpen , renderOnlyWhenOpen: renderOnlyWhenOpen , getPopoverProps: getPopoverProps , usePortal: usePortal } = $a5e54ab4533eb4d3$export$1468d0761b26e6c8();
197
- const styles = $ac842fe302ff665f$export$fbd764fe961047f7(isOpen);
198
- const content = /*#__PURE__*/ ($parcel$interopDefault($36WSQ$react)).createElement("div", {
193
+ const { children: children , className: className , testId: testId = "cf-ui-popover-content" , role: role = "dialog" , ...otherProps } = props;
194
+ const { isOpen: isOpen , renderOnlyWhenOpen: renderOnlyWhenOpen , getPopoverProps: getPopoverProps , usePortal: usePortal } = (0, $a5e54ab4533eb4d3$export$1468d0761b26e6c8)();
195
+ const styles = (0, $ac842fe302ff665f$export$fbd764fe961047f7)(isOpen);
196
+ const content = /*#__PURE__*/ (0, ($parcel$interopDefault($36WSQ$react))).createElement("div", {
199
197
  ...otherProps,
200
198
  ...getPopoverProps(otherProps, ref),
201
- className: $36WSQ$emotion.cx(styles.container, className),
199
+ className: (0, $36WSQ$emotion.cx)(styles.container, className),
202
200
  "data-test-id": testId,
203
201
  tabIndex: -1,
204
202
  role: role,
@@ -206,27 +204,27 @@ const $ec6b27dd96eb674c$var$_PopoverContent = (props, ref)=>{
206
204
  "data-position-absolute": true
207
205
  }, children);
208
206
  if (renderOnlyWhenOpen && !isOpen) return null;
209
- return usePortal ? /*#__PURE__*/ ($parcel$interopDefault($36WSQ$react)).createElement($36WSQ$contentfulf36utils.Portal, null, content) : content;
207
+ return usePortal ? /*#__PURE__*/ (0, ($parcel$interopDefault($36WSQ$react))).createElement((0, $36WSQ$contentfulf36utils.Portal), null, content) : content;
210
208
  };
211
- const $ec6b27dd96eb674c$export$d7e1f420b25549ff = /*#__PURE__*/ ($parcel$interopDefault($36WSQ$react)).forwardRef($ec6b27dd96eb674c$var$_PopoverContent);
209
+ const $ec6b27dd96eb674c$export$d7e1f420b25549ff = /*#__PURE__*/ (0, ($parcel$interopDefault($36WSQ$react))).forwardRef($ec6b27dd96eb674c$var$_PopoverContent);
212
210
 
213
211
 
214
212
 
215
213
 
216
214
  const $b3e2e9dc1eae953e$export$7dacb05d26466c3 = (props)=>{
217
- const child = ($parcel$interopDefault($36WSQ$react)).Children.only(props.children);
218
- const { getTriggerProps: getTriggerProps } = $a5e54ab4533eb4d3$export$1468d0761b26e6c8();
215
+ const child = (0, ($parcel$interopDefault($36WSQ$react))).Children.only(props.children);
216
+ const { getTriggerProps: getTriggerProps } = (0, $a5e54ab4533eb4d3$export$1468d0761b26e6c8)();
219
217
  var ref;
220
- return /*#__PURE__*/ ($parcel$interopDefault($36WSQ$react)).cloneElement(child, {
218
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($36WSQ$react))).cloneElement(child, {
221
219
  ...getTriggerProps(child.ref),
222
- 'aria-haspopup': (ref = child.props['aria-haspopup']) !== null && ref !== void 0 ? ref : 'dialog'
220
+ "aria-haspopup": (ref = child.props["aria-haspopup"]) !== null && ref !== void 0 ? ref : "dialog"
223
221
  });
224
222
  };
225
223
 
226
224
 
227
- const $dd96ee4ab94ee75f$export$5b6b19405a83ff9d = $ed3840333e471e4e$export$5b6b19405a83ff9d;
228
- $dd96ee4ab94ee75f$export$5b6b19405a83ff9d.Content = $ec6b27dd96eb674c$export$d7e1f420b25549ff;
229
- $dd96ee4ab94ee75f$export$5b6b19405a83ff9d.Trigger = $b3e2e9dc1eae953e$export$7dacb05d26466c3;
225
+ const $dd96ee4ab94ee75f$export$5b6b19405a83ff9d = (0, $ed3840333e471e4e$export$5b6b19405a83ff9d);
226
+ $dd96ee4ab94ee75f$export$5b6b19405a83ff9d.Content = (0, $ec6b27dd96eb674c$export$d7e1f420b25549ff);
227
+ $dd96ee4ab94ee75f$export$5b6b19405a83ff9d.Trigger = (0, $b3e2e9dc1eae953e$export$7dacb05d26466c3);
230
228
 
231
229
 
232
230
 
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;AEAA;;ACAA;AAaA,MAAM+F,oCAAc,GAAGrF,sCAAK,CAACsF,aAAa,CACxCtC,SADqB,CAAvB,AAAA;AAIO,MAAMuC,yCAAiB,GAAG,IAAM;IACrC,MAAMC,OAAO,GAAGxF,sCAAK,CAACyF,UAAN,CAAiBJ,oCAAjB,CAAhB,AAAA;IAEA,IAAIG,O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pB,MAAM,CAACmE,SAAV,EAAqBL,SAArB,CAAD;QACV,cAAA,EAAcC,MAAD;QACb,QAAA,EAAU,EAAD;QACT,IAAA,EAAMC,IAAD;QAEL,qCAAA;QACA,wBATF,EASE,IATF;OAWGvF,QAAD,CAZJ,AAaF;IAGE,IAAIa,kBAAkB,IAAI,CAACV,MAA3B,EACE,OAAO,IAAP,CAAA;IAGF,OAAOI,SAAS,iBAAG,qDAAC,gCAAD,QAASkF,OAAD,CAAX,GAAgCA,OAAhD,CAAA;CArCF,AAsCC;AAEM,MAAM5G,yCAAc,iBAAGM,sCAAK,CAACwG,UAAN,CAAiBP,qCAAjB,CAAvB,AAAP;;;AE5DA;;AAUO,MAAMzG,wCAAc,GAAG,CAACmC,KAAD,GAAgC;IAC5D,MAAM2F,KAAK,GAAGtH,sCAAK,CAACuH,QAAN,CAAeC,IAAf,CAAoB7F,KAAK,CAACd,QAA1B,CAAA,AAAd,AAAA;IACA,MAAM,EAZR,iBAYUyC,eAAAA,CAAAA,EAAF,GAAsBiC,yCAAiB,EAA7C,AAAM;QAIa+B,GAAA;IAFnB,qBAAOtH,sCAAK,CAACyH,YAAN,CAAmBH,KAAnB,EAA0B;QAC/B,GAAGhE,eAAe,CAACgE,KAAK,CAAC9D,GAAP,CADa;QAE/B,eAAA,EAAiB8D,CAAAA,GAAA,GAAAA,KAAK,CAAC3F,KAAN,CAAY,eAAZ,CAAA,cAAA2F,GAAA,cAAAA,GAAA,GAAgC,QAAjD;KAFK,CAAP,CAAiC;CAJ5B,AAQN;;;ALTM,MAAMhI,yCAAO,GAAGM,yCAAhB,AAAP;AACAN,yCAAO,CAACQ,OAAR,GAAkBJ,yCAAlB,CAAAJ;AACAA,yCAAO,CAACS,OAAR,GAAkBP,wCAAlB,CAAAF;;ADXA","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 } from '@contentful/f36-core';\nimport type { ExpandProps } from '@contentful/f36-core';\nimport type { 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 update,\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 const updatePosition = async () => {\n if (isOpen && update) {\n await update();\n }\n };\n updatePosition();\n }, [isOpen, update]);\n\n const popoverGeneratedId = useId(undefined, '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: Boolean(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 type {\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","update","styles","popperStyles","modifiers","name","options","sameWidth","enabled","mainAxis","focus","preventScroll","updatePosition","popoverGeneratedId","undefined","popoverId","closeAndFocusTrigger","setTimeout","contextValue","Boolean","getTriggerProps","_ref","ref","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","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"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;AEAA;;ACAA;AAaA,MAAM+F,oCAAc,GAAGrF,CAAAA,GAAAA,sCAAK,CAAA,CAACsF,aAAa,CACxCtC,SADqB,CAAvB,AAAA;AAIO,MAAMuC,yCAAiB,GAAG,IAAM;IACrC,MAAMC,OAAO,GAAGxF,CAAAA,GAAAA,sCAAK,CAAA,CAACyF,UAAN,CAAiBJ,oCAAjB,CAAhB,AAAA;IAEA,IAAIG,OAAO,KAAKxC,SAAhB,EACE,MAAM,IAAI0C,KAAJ,CACJ,gEADI,CAAN,CAAA;IAKF,OAAOF,OAAP,CAAA;CATK,AAUN;AAEM,MAAM9E,yCAAsB,GAAG2E,oCAAc,CAACM,QAA9C,AAAP;;;;AD+EO,SAASrG,yCAAT,CAAiBqC,KAAjB,EAAmD;IACxD,MAAM,YACJd,QADI,CAAA,UAEJG,MAFI,CAAA,aAGJE,SAAS,GAAG,cAHR,gBAIJH,WAAW,GAAG,KAJV,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CAAlB,CAAA,CAAAF;;ADXA","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 } from '@contentful/f36-core';\nimport type { ExpandProps } from '@contentful/f36-core';\nimport type { 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 update,\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 const updatePosition = async () => {\n if (isOpen && update) {\n await update();\n }\n };\n updatePosition();\n }, [isOpen, update]);\n\n const popoverGeneratedId = useId(undefined, '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: Boolean(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 type {\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","update","styles","popperStyles","modifiers","name","options","sameWidth","enabled","mainAxis","focus","preventScroll","updatePosition","popoverGeneratedId","undefined","popoverId","closeAndFocusTrigger","setTimeout","contextValue","Boolean","getTriggerProps","_ref","ref","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","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
@@ -8,10 +8,10 @@ import $hYGFM$contentfulf36tokens from "@contentful/f36-tokens";
8
8
 
9
9
 
10
10
 
11
- const $8c1b76e1106abdf5$var$PopoverContext = $hYGFM$react.createContext(undefined);
11
+ const $8c1b76e1106abdf5$var$PopoverContext = (0, $hYGFM$react).createContext(undefined);
12
12
  const $8c1b76e1106abdf5$export$1468d0761b26e6c8 = ()=>{
13
- const context = $hYGFM$react.useContext($8c1b76e1106abdf5$var$PopoverContext);
14
- if (context === undefined) throw new Error('usePopoverContext must be used within a PopoverContextProvider');
13
+ const context = (0, $hYGFM$react).useContext($8c1b76e1106abdf5$var$PopoverContext);
14
+ if (context === undefined) throw new Error("usePopoverContext must be used within a PopoverContextProvider");
15
15
  return context;
16
16
  };
17
17
  const $8c1b76e1106abdf5$export$f5300fbf692a63ec = $8c1b76e1106abdf5$var$PopoverContext.Provider;
@@ -19,17 +19,17 @@ const $8c1b76e1106abdf5$export$f5300fbf692a63ec = $8c1b76e1106abdf5$var$PopoverC
19
19
 
20
20
 
21
21
  function $fd548c9231cfa260$export$5b6b19405a83ff9d(props) {
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 = [
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
25
  ] , renderOnlyWhenOpen: renderOnlyWhenOpen = true } = props;
26
- const [triggerElement, setTriggerElement] = $hYGFM$useState(null);
27
- const [popoverElement, setPopoverElement] = $hYGFM$useState(null);
28
- const { attributes: popperAttributes , update: update , styles: popperStyles } = $hYGFM$usePopper(triggerElement, popoverElement, {
26
+ const [triggerElement, setTriggerElement] = (0, $hYGFM$useState)(null);
27
+ const [popoverElement, setPopoverElement] = (0, $hYGFM$useState)(null);
28
+ const { attributes: popperAttributes , update: update , styles: popperStyles } = (0, $hYGFM$usePopper)(triggerElement, popoverElement, {
29
29
  placement: placement,
30
30
  modifiers: [
31
31
  {
32
- name: 'offset',
32
+ name: "offset",
33
33
  options: {
34
34
  offset: offset
35
35
  }
@@ -39,19 +39,19 @@ function $fd548c9231cfa260$export$5b6b19405a83ff9d(props) {
39
39
  enabled: isFullWidth
40
40
  },
41
41
  {
42
- name: 'preventOverflow',
42
+ name: "preventOverflow",
43
43
  enabled: isAutoalignmentEnabled,
44
44
  options: {
45
45
  mainAxis: true
46
46
  }
47
47
  },
48
48
  {
49
- name: 'flip',
49
+ name: "flip",
50
50
  enabled: isAutoalignmentEnabled
51
51
  }
52
52
  ]
53
53
  });
54
- $hYGFM$useEffect(()=>{
54
+ (0, $hYGFM$useEffect)(()=>{
55
55
  if (isOpen && autoFocus && popoverElement) popoverElement.focus({
56
56
  preventScroll: true
57
57
  });
@@ -60,7 +60,7 @@ function $fd548c9231cfa260$export$5b6b19405a83ff9d(props) {
60
60
  isOpen,
61
61
  popoverElement
62
62
  ]);
63
- $hYGFM$useEffect(()=>{
63
+ (0, $hYGFM$useEffect)(()=>{
64
64
  const updatePosition = async ()=>{
65
65
  if (isOpen && update) await update();
66
66
  };
@@ -69,9 +69,9 @@ function $fd548c9231cfa260$export$5b6b19405a83ff9d(props) {
69
69
  isOpen,
70
70
  update
71
71
  ]);
72
- const popoverGeneratedId = $hYGFM$useId(undefined, 'popover-content');
72
+ const popoverGeneratedId = (0, $hYGFM$useId)(undefined, "popover-content");
73
73
  const popoverId = id || popoverGeneratedId;
74
- const closeAndFocusTrigger = $hYGFM$useCallback(()=>{
74
+ const closeAndFocusTrigger = (0, $hYGFM$useCallback)(()=>{
75
75
  onClose === null || onClose === void 0 ? void 0 : onClose(); // setTimeout trick to make it work with focus-lock
76
76
  setTimeout(()=>{
77
77
  return triggerElement === null || triggerElement === void 0 ? void 0 : triggerElement.focus({
@@ -82,17 +82,16 @@ function $fd548c9231cfa260$export$5b6b19405a83ff9d(props) {
82
82
  onClose,
83
83
  triggerElement
84
84
  ]);
85
- const contextValue = $hYGFM$useMemo(()=>{
85
+ const contextValue = (0, $hYGFM$useMemo)(()=>{
86
86
  return {
87
87
  isOpen: Boolean(isOpen),
88
88
  usePortal: usePortal,
89
89
  renderOnlyWhenOpen: renderOnlyWhenOpen,
90
90
  getTriggerProps: (_ref = null)=>({
91
- ref: $hYGFM$mergeRefs(setTriggerElement, _ref),
92
- ['aria-expanded']: Boolean(isOpen),
93
- ['aria-controls']: popoverId
94
- })
95
- ,
91
+ ref: (0, $hYGFM$mergeRefs)(setTriggerElement, _ref),
92
+ ["aria-expanded"]: Boolean(isOpen),
93
+ ["aria-controls"]: popoverId
94
+ }),
96
95
  getPopoverProps: (_props = {}, _ref = null)=>{
97
96
  return {
98
97
  ...popperAttributes.popper,
@@ -100,7 +99,7 @@ function $fd548c9231cfa260$export$5b6b19405a83ff9d(props) {
100
99
  ..._props.style || {},
101
100
  ...popperStyles.popper
102
101
  },
103
- ref: $hYGFM$mergeRefs(setPopoverElement, _ref),
102
+ ref: (0, $hYGFM$mergeRefs)(setPopoverElement, _ref),
104
103
  id: popoverId,
105
104
  onBlur: (event)=>{
106
105
  if (_props.onBlur) _props.onBlur(event);
@@ -113,7 +112,7 @@ function $fd548c9231cfa260$export$5b6b19405a83ff9d(props) {
113
112
  },
114
113
  onKeyDown: (event)=>{
115
114
  if (_props.onKeyDown) _props.onKeyDown(event);
116
- if (closeOnEsc && event.key === 'Escape') closeAndFocusTrigger();
115
+ if (closeOnEsc && event.key === "Escape") closeAndFocusTrigger();
117
116
  }
118
117
  };
119
118
  }
@@ -132,18 +131,18 @@ function $fd548c9231cfa260$export$5b6b19405a83ff9d(props) {
132
131
  closeAndFocusTrigger,
133
132
  onClose
134
133
  ]);
135
- return /*#__PURE__*/ $hYGFM$react.createElement($8c1b76e1106abdf5$export$f5300fbf692a63ec, {
134
+ return /*#__PURE__*/ (0, $hYGFM$react).createElement((0, $8c1b76e1106abdf5$export$f5300fbf692a63ec), {
136
135
  value: contextValue
137
136
  }, children);
138
137
  }
139
138
  /**
140
139
  * Sets the popover width to the size of the trigger element.
141
140
  */ const $fd548c9231cfa260$var$sameWidth = {
142
- name: 'sameWidth',
141
+ name: "sameWidth",
143
142
  enabled: true,
144
- phase: 'beforeWrite',
143
+ phase: "beforeWrite",
145
144
  requires: [
146
- 'computeStyles'
145
+ "computeStyles"
147
146
  ],
148
147
  fn: ({ state: state })=>{
149
148
  state.styles.popper.width = `${state.rects.reference.width}px`;
@@ -162,33 +161,32 @@ function $fd548c9231cfa260$export$5b6b19405a83ff9d(props) {
162
161
 
163
162
 
164
163
  const $8a165eef2449d46a$export$fbd764fe961047f7 = (isOpen)=>({
165
- container: /*#__PURE__*/ $hYGFM$css({
166
- display: isOpen ? 'initial' : 'none',
167
- background: $hYGFM$contentfulf36tokens.colorWhite,
164
+ container: /*#__PURE__*/ (0, $hYGFM$css)({
165
+ display: isOpen ? "initial" : "none",
166
+ background: (0, $hYGFM$contentfulf36tokens).colorWhite,
168
167
  border: 0,
169
- borderRadius: $hYGFM$contentfulf36tokens.borderRadiusMedium,
170
- boxShadow: $hYGFM$contentfulf36tokens.boxShadowDefault,
171
- zIndex: $hYGFM$contentfulf36tokens.zIndexDropdown,
172
- '&:focus': {
173
- boxShadow: $hYGFM$contentfulf36tokens.glowPrimary,
174
- outline: 'none'
168
+ borderRadius: (0, $hYGFM$contentfulf36tokens).borderRadiusMedium,
169
+ boxShadow: (0, $hYGFM$contentfulf36tokens).boxShadowDefault,
170
+ zIndex: (0, $hYGFM$contentfulf36tokens).zIndexDropdown,
171
+ "&:focus": {
172
+ boxShadow: (0, $hYGFM$contentfulf36tokens).glowPrimary,
173
+ outline: "none"
175
174
  },
176
- '&:focus:not(:focus-visible)': {
177
- boxShadow: $hYGFM$contentfulf36tokens.boxShadowDefault
175
+ "&:focus:not(:focus-visible)": {
176
+ boxShadow: (0, $hYGFM$contentfulf36tokens).boxShadowDefault
178
177
  }
179
178
  })
180
- })
181
- ;
179
+ });
182
180
 
183
181
 
184
182
  const $249e5486684b1d2a$var$_PopoverContent = (props, ref)=>{
185
- const { children: children , className: className , testId: testId = 'cf-ui-popover-content' , role: role = 'dialog' , ...otherProps } = props;
186
- const { isOpen: isOpen , renderOnlyWhenOpen: renderOnlyWhenOpen , getPopoverProps: getPopoverProps , usePortal: usePortal } = $8c1b76e1106abdf5$export$1468d0761b26e6c8();
187
- const styles = $8a165eef2449d46a$export$fbd764fe961047f7(isOpen);
188
- const content = /*#__PURE__*/ $hYGFM$react.createElement("div", {
183
+ const { children: children , className: className , testId: testId = "cf-ui-popover-content" , role: role = "dialog" , ...otherProps } = props;
184
+ const { isOpen: isOpen , renderOnlyWhenOpen: renderOnlyWhenOpen , getPopoverProps: getPopoverProps , usePortal: usePortal } = (0, $8c1b76e1106abdf5$export$1468d0761b26e6c8)();
185
+ const styles = (0, $8a165eef2449d46a$export$fbd764fe961047f7)(isOpen);
186
+ const content = /*#__PURE__*/ (0, $hYGFM$react).createElement("div", {
189
187
  ...otherProps,
190
188
  ...getPopoverProps(otherProps, ref),
191
- className: $hYGFM$cx(styles.container, className),
189
+ className: (0, $hYGFM$cx)(styles.container, className),
192
190
  "data-test-id": testId,
193
191
  tabIndex: -1,
194
192
  role: role,
@@ -196,27 +194,27 @@ const $249e5486684b1d2a$var$_PopoverContent = (props, ref)=>{
196
194
  "data-position-absolute": true
197
195
  }, children);
198
196
  if (renderOnlyWhenOpen && !isOpen) return null;
199
- return usePortal ? /*#__PURE__*/ $hYGFM$react.createElement($hYGFM$Portal, null, content) : content;
197
+ return usePortal ? /*#__PURE__*/ (0, $hYGFM$react).createElement((0, $hYGFM$Portal), null, content) : content;
200
198
  };
201
- const $249e5486684b1d2a$export$d7e1f420b25549ff = /*#__PURE__*/ $hYGFM$react.forwardRef($249e5486684b1d2a$var$_PopoverContent);
199
+ const $249e5486684b1d2a$export$d7e1f420b25549ff = /*#__PURE__*/ (0, $hYGFM$react).forwardRef($249e5486684b1d2a$var$_PopoverContent);
202
200
 
203
201
 
204
202
 
205
203
 
206
204
  const $2ab55052da688660$export$7dacb05d26466c3 = (props)=>{
207
- const child = $hYGFM$react.Children.only(props.children);
208
- const { getTriggerProps: getTriggerProps } = $8c1b76e1106abdf5$export$1468d0761b26e6c8();
205
+ const child = (0, $hYGFM$react).Children.only(props.children);
206
+ const { getTriggerProps: getTriggerProps } = (0, $8c1b76e1106abdf5$export$1468d0761b26e6c8)();
209
207
  var ref;
210
- return /*#__PURE__*/ $hYGFM$react.cloneElement(child, {
208
+ return /*#__PURE__*/ (0, $hYGFM$react).cloneElement(child, {
211
209
  ...getTriggerProps(child.ref),
212
- 'aria-haspopup': (ref = child.props['aria-haspopup']) !== null && ref !== void 0 ? ref : 'dialog'
210
+ "aria-haspopup": (ref = child.props["aria-haspopup"]) !== null && ref !== void 0 ? ref : "dialog"
213
211
  });
214
212
  };
215
213
 
216
214
 
217
- const $52a0de85cb27ef74$export$5b6b19405a83ff9d = $fd548c9231cfa260$export$5b6b19405a83ff9d;
218
- $52a0de85cb27ef74$export$5b6b19405a83ff9d.Content = $249e5486684b1d2a$export$d7e1f420b25549ff;
219
- $52a0de85cb27ef74$export$5b6b19405a83ff9d.Trigger = $2ab55052da688660$export$7dacb05d26466c3;
215
+ const $52a0de85cb27ef74$export$5b6b19405a83ff9d = (0, $fd548c9231cfa260$export$5b6b19405a83ff9d);
216
+ $52a0de85cb27ef74$export$5b6b19405a83ff9d.Content = (0, $249e5486684b1d2a$export$d7e1f420b25549ff);
217
+ $52a0de85cb27ef74$export$5b6b19405a83ff9d.Trigger = (0, $2ab55052da688660$export$7dacb05d26466c3);
220
218
 
221
219
 
222
220
 
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AEAA;;ACAA;AAaA,MAAM+F,oCAAc,GAAGrF,YAAK,CAACsF,aAAa,CACxCtC,SADqB,CAAvB,AAAA;AAIO,MAAMuC,yCAAiB,GAAG,IAAM;IACrC,MAAMC,OAAO,GAAGxF,YAAK,CAACyF,UAAN,CAAiBJ,oCAAjB,CAAhB,AAAA;IAEA,IAAIG,OAAO,KAAKxC,SAAhB,EACE,MAAM,IAAI0C,KAAJ,CACJ,gEADI,CAAN,CAAA;IAKF,OAAOF,OAAP,CAAA;CATK,AAUN;AAEM,MAAM9E,yCAAsB,GAAG2E,oCAAc,CAACM,QAA9C,AAAP;;;;AD+EO,SAASrG,yCAAT,CAAiBqC,KAAjB,EA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EACE,OAAO,IAAP,CAAA;IAGF,OAAOI,SAAS,iBAAG,2BAAC,aAAD,QAASkF,OAAD,CAAX,GAAgCA,OAAhD,CAAA;CArCF,AAsCC;AAEM,MAAM5G,yCAAc,iBAAGM,YAAK,CAACwG,UAAN,CAAiBP,qCAAjB,CAAvB,AAAP;;;AE5DA;;AAUO,MAAMzG,wCAAc,GAAG,CAACmC,KAAD,GAAgC;IAC5D,MAAM2F,KAAK,GAAGtH,YAAK,CAACuH,QAAN,CAAeC,IAAf,CAAoB7F,KAAK,CAACd,QAA1B,CAAA,AAAd,AAAA;IACA,MAAM,EAZR,iBAYUyC,eAAAA,CAAAA,EAAF,GAAsBiC,yCAAiB,EAA7C,AAAM;QAIa+B,GAAA;IAFnB,qBAAOtH,YAAK,CAACyH,YAAN,CAAmBH,KAAnB,EAA0B;QAC/B,GAAGhE,eAAe,CAACgE,KAAK,CAAC9D,GAAP,CADa;QAE/B,eAAA,EAAiB8D,CAAAA,GAAA,GAAAA,KAAK,CAAC3F,KAAN,CAAY,eAAZ,CAAA,cAAA2F,GAAA,cAAAA,GAAA,GAAgC,QAAjD;KAFK,CAAP,CAAiC;CAJ5B,AAQN;;;ALTM,MAAMhI,yCAAO,GAAGM,yCAAhB,AAAP;AACAN,yCAAO,CAACQ,OAAR,GAAkBJ,yCAAlB,CAAAJ;AACAA,yCAAO,CAACS,OAAR,GAAkBP,wCAAlB,CAAAF;;ADXA","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 } from '@contentful/f36-core';\nimport type { ExpandProps } from '@contentful/f36-core';\nimport type { 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 update,\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 const updatePosition = async () => {\n if (isOpen && update) {\n await update();\n }\n };\n updatePosition();\n }, [isOpen, update]);\n\n const popoverGeneratedId = useId(undefined, '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: Boolean(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 type {\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","update","styles","popperStyles","modifiers","name","options","sameWidth","enabled","mainAxis","focus","preventScroll","updatePosition","popoverGeneratedId","undefined","popoverId","closeAndFocusTrigger","setTimeout","contextValue","Boolean","getTriggerProps","_ref","ref","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","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"}
1
+ {"mappings":";;;;;;;AEAA;;ACAA;AAaA,MAAM+F,oCAAc,GAAGrF,CAAAA,GAAAA,YAAK,CAAA,CAACsF,aAAa,CACxCtC,SADqB,CAAvB,AAAA;AAIO,MAAMuC,yCAAiB,GAAG,IAAM;IACrC,MAAMC,OAAO,GAAGxF,CAAAA,GAAAA,YAAK,CAAA,CAACyF,UAAN,CAAiBJ,oCAAjB,CAAhB,AAAA;IAEA,IAAIG,OAAO,KAAKxC,SAAhB,EACE,MAAM,IAAI0C,KAAJ,CACJ,gEADI,CAAN,CAAA;IAKF,OAAOF,OAAP,CAAA;CATK,AAUN;AAEM,MAAM9E,yCAAsB,GAAG2E,oCAAc,CAACM,QAA9C,AAAP;;;;AD+EO,SAASrG,yCAAT,CAAiBqC,KAAjB,EAAmD;IACxD,MAAM,YACJd,QADI,CAAA,UAEJG,MAFI,CAAA,aAGJE,SAAS,GAAG,cAHR,gBAIJH,WAAW,GAAG,KAJV,2BAKJI,sBAAsB,GAAG,IALrB,cAMJC,SAAS,GAAG,IANR,gBAOJC,WAAW,GAAG,IAPV,eAQJC,UAAU,GAAG,IART,YASJL,OATI,CAAA,aAUJM,SAAS,GAAG,IAVR,OAWJC,EAXI,CAAA,UAYJC,MAAM,GAAG;AAAC,SAAD;AAAI,SAAJ;KAZL,uBAaJC,kBAAkB,GAAG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I,SAAS,iBAAG,gCAAC,CAAA,GAAA,aAAD,CAAA,QAASkF,OAAD,CAAX,GAAgCA,OAAhD,CAAA;CArCF,AAsCC;AAEM,MAAM5G,yCAAc,iBAAGM,CAAAA,GAAAA,YAAK,CAAA,CAACwG,UAAN,CAAiBP,qCAAjB,CAAvB,AAAP;;;AE5DA;;AAUO,MAAMzG,wCAAc,GAAG,CAACmC,KAAD,GAAgC;IAC5D,MAAM2F,KAAK,GAAGtH,CAAAA,GAAAA,YAAK,CAAA,CAACuH,QAAN,CAAeC,IAAf,CAAoB7F,KAAK,CAACd,QAA1B,CAAA,AAAd,AAAA;IACA,MAAM,mBAAEyC,eAAAA,CAAAA,EAAF,GAAsBiC,CAAAA,GAAAA,yCAAiB,CAAA,EAA7C,AAAM;QAIa+B,GAAA;IAFnB,qBAAOtH,CAAAA,GAAAA,YAAK,CAAA,CAACyH,YAAN,CAAmBH,KAAnB,EAA0B;QAC/B,GAAGhE,eAAe,CAACgE,KAAK,CAAC9D,GAAP,CADa;QAE/B,eAAA,EAAiB8D,CAAAA,GAAA,GAAAA,KAAK,CAAC3F,KAAN,CAAY,eAAZ,CAAA,cAAA2F,GAAA,cAAAA,GAAA,GAAgC,QAAjD;KAFK,CAAP,CAAiC;CAJ5B,AAQN;;;ALTM,MAAMhI,yCAAO,GAAGM,CAAAA,GAAAA,yCAAe,CAAA,AAA/B,AAAP;AACAN,yCAAO,CAACQ,OAAR,GAAkBJ,CAAAA,GAAAA,yCAAlB,CAAA,CAAAJ;AACAA,yCAAO,CAACS,OAAR,GAAkBP,CAAAA,GAAAA,wCAAlB,CAAA,CAAAF;;ADXA","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 } from '@contentful/f36-core';\nimport type { ExpandProps } from '@contentful/f36-core';\nimport type { 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 update,\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 const updatePosition = async () => {\n if (isOpen && update) {\n await update();\n }\n };\n updatePosition();\n }, [isOpen, update]);\n\n const popoverGeneratedId = useId(undefined, '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: Boolean(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 type {\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","update","styles","popperStyles","modifiers","name","options","sameWidth","enabled","mainAxis","focus","preventScroll","updatePosition","popoverGeneratedId","undefined","popoverId","closeAndFocusTrigger","setTimeout","contextValue","Boolean","getTriggerProps","_ref","ref","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","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/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@contentful/f36-popover",
3
- "version": "4.14.0",
3
+ "version": "4.15.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.14.0",
10
+ "@contentful/f36-core": "^4.15.0",
11
11
  "@contentful/f36-tokens": "^4.0.1",
12
- "@contentful/f36-utils": "^4.14.0",
12
+ "@contentful/f36-utils": "^4.15.0",
13
13
  "@popperjs/core": "^2.11.5",
14
14
  "emotion": "^10.0.17",
15
15
  "react-popper": "^2.3.0"