@lumx/react 3.16.1-alpha.0 → 3.16.1-alpha.1

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/package.json CHANGED
@@ -6,8 +6,8 @@
6
6
  "url": "https://github.com/lumapps/design-system/issues"
7
7
  },
8
8
  "dependencies": {
9
- "@lumx/core": "^3.16.1-alpha.0",
10
- "@lumx/icons": "^3.16.1-alpha.0",
9
+ "@lumx/core": "^3.16.1-alpha.1",
10
+ "@lumx/icons": "^3.16.1-alpha.1",
11
11
  "@popperjs/core": "^2.5.4",
12
12
  "body-scroll-lock": "^3.1.5",
13
13
  "classnames": "^2.3.2",
@@ -105,5 +105,5 @@
105
105
  "build:storybook": "storybook build"
106
106
  },
107
107
  "sideEffects": false,
108
- "version": "3.16.1-alpha.0"
108
+ "version": "3.16.1-alpha.1"
109
109
  }
@@ -193,94 +193,94 @@ export const Dialog = forwardRef<DialogProps, HTMLDivElement>((props, ref) => {
193
193
 
194
194
  const shouldPreventCloseOnClickAway = preventAutoClose || preventCloseOnClick;
195
195
 
196
- return isOpen || isVisible
197
- ? <Portal>
198
- <div
199
- ref={mergeRefs(rootRef, ref)}
200
- {...forwardedProps}
201
- className={classNames(
202
- className,
203
- handleBasicClasses({
204
- isHidden: !isOpen,
205
- isLoading,
206
- isShown: isOpen || isVisible,
207
- prefix: CLASSNAME,
208
- size,
209
- }),
210
- )}
211
- style={{ zIndex }}
212
- >
213
- <div className={`${CLASSNAME}__overlay`} />
214
-
215
- <HeadingLevelProvider level={2}>
216
- <ThemeProvider value={undefined}>
217
- <div className={`${CLASSNAME}__container`} role="dialog" aria-modal="true" {...dialogProps}>
218
- <ClickAwayProvider
219
- callback={!shouldPreventCloseOnClickAway && onClose}
220
- childrenRefs={clickAwayRefs}
221
- parentRef={rootRef}
222
- >
223
- <section className={`${CLASSNAME}__wrapper`} ref={wrapperRef}>
224
- {(header || headerChildContent) && (
225
- <header
226
- {...headerChildProps}
227
- className={classNames(
228
- `${CLASSNAME}__header`,
229
- (forceHeaderDivider || hasTopIntersection) &&
230
- `${CLASSNAME}__header--has-divider`,
231
- headerChildProps?.className,
232
- )}
233
- >
234
- {header}
235
- {headerChildContent}
236
- </header>
237
- )}
238
-
239
- <div
240
- ref={mergeRefs(contentRef, localContentRef)}
241
- className={`${CLASSNAME}__content`}
242
- >
243
- <div
244
- className={`${CLASSNAME}__sentinel ${CLASSNAME}__sentinel--top`}
245
- ref={setSentinelTop}
246
- />
247
-
248
- {content}
249
-
250
- <div
251
- className={`${CLASSNAME}__sentinel ${CLASSNAME}__sentinel--bottom`}
252
- ref={setSentinelBottom}
253
- />
254
- </div>
255
-
256
- {(footer || footerChildContent) && (
257
- <footer
258
- {...footerChildProps}
259
- className={classNames(
260
- `${CLASSNAME}__footer`,
261
- (forceFooterDivider || hasBottomIntersection) &&
262
- `${CLASSNAME}__footer--has-divider`,
263
- footerChildProps?.className,
264
- )}
265
- >
266
- {footer}
267
- {footerChildContent}
268
- </footer>
269
- )}
270
-
271
- {isLoading && (
272
- <div className={`${CLASSNAME}__progress-overlay`}>
273
- <Progress variant={ProgressVariant.circular} />
274
- </div>
275
- )}
276
- </section>
277
- </ClickAwayProvider>
278
- </div>
279
- </ThemeProvider>
280
- </HeadingLevelProvider>
281
- </div>
196
+ return isOpen || isVisible ? (
197
+ <Portal>
198
+ <div
199
+ ref={mergeRefs(rootRef, ref)}
200
+ {...forwardedProps}
201
+ className={classNames(
202
+ className,
203
+ handleBasicClasses({
204
+ isHidden: !isOpen,
205
+ isLoading,
206
+ isShown: isOpen || isVisible,
207
+ prefix: CLASSNAME,
208
+ size,
209
+ }),
210
+ )}
211
+ style={{ zIndex }}
212
+ >
213
+ <div className={`${CLASSNAME}__overlay`} />
214
+
215
+ <HeadingLevelProvider level={2}>
216
+ <ThemeProvider value={undefined}>
217
+ <div className={`${CLASSNAME}__container`} role="dialog" aria-modal="true" {...dialogProps}>
218
+ <ClickAwayProvider
219
+ callback={!shouldPreventCloseOnClickAway && onClose}
220
+ childrenRefs={clickAwayRefs}
221
+ parentRef={rootRef}
222
+ >
223
+ <section className={`${CLASSNAME}__wrapper`} ref={wrapperRef}>
224
+ {(header || headerChildContent) && (
225
+ <header
226
+ {...headerChildProps}
227
+ className={classNames(
228
+ `${CLASSNAME}__header`,
229
+ (forceHeaderDivider || hasTopIntersection) &&
230
+ `${CLASSNAME}__header--has-divider`,
231
+ headerChildProps?.className,
232
+ )}
233
+ >
234
+ {header}
235
+ {headerChildContent}
236
+ </header>
237
+ )}
238
+
239
+ <div
240
+ ref={mergeRefs(contentRef, localContentRef)}
241
+ className={`${CLASSNAME}__content`}
242
+ >
243
+ <div
244
+ className={`${CLASSNAME}__sentinel ${CLASSNAME}__sentinel--top`}
245
+ ref={setSentinelTop}
246
+ />
247
+
248
+ {content}
249
+
250
+ <div
251
+ className={`${CLASSNAME}__sentinel ${CLASSNAME}__sentinel--bottom`}
252
+ ref={setSentinelBottom}
253
+ />
254
+ </div>
255
+
256
+ {(footer || footerChildContent) && (
257
+ <footer
258
+ {...footerChildProps}
259
+ className={classNames(
260
+ `${CLASSNAME}__footer`,
261
+ (forceFooterDivider || hasBottomIntersection) &&
262
+ `${CLASSNAME}__footer--has-divider`,
263
+ footerChildProps?.className,
264
+ )}
265
+ >
266
+ {footer}
267
+ {footerChildContent}
268
+ </footer>
269
+ )}
270
+
271
+ {isLoading && (
272
+ <div className={`${CLASSNAME}__progress-overlay`}>
273
+ <Progress variant={ProgressVariant.circular} />
274
+ </div>
275
+ )}
276
+ </section>
277
+ </ClickAwayProvider>
278
+ </div>
279
+ </ThemeProvider>
280
+ </HeadingLevelProvider>
281
+ </div>
282
282
  </Portal>
283
- : null;
283
+ ) : null;
284
284
  });
285
285
  Dialog.displayName = COMPONENT_NAME;
286
286
  Dialog.className = CLASSNAME;
@@ -1,5 +1,4 @@
1
1
  import React, { useRef } from 'react';
2
- import { createPortal } from 'react-dom';
3
2
 
4
3
  import classNames from 'classnames';
5
4
  import isFunction from 'lodash/isFunction';
@@ -99,39 +98,40 @@ export const Notification = forwardRef<NotificationProps, HTMLDivElement>((props
99
98
  return null;
100
99
  }
101
100
 
102
- const notification = (
103
- // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
104
- <div
105
- ref={mergeRefs(ref, rootRef)}
106
- role="alert"
107
- {...forwardedProps}
108
- className={classNames(
109
- className,
110
- handleBasicClasses({
111
- color,
112
- hasAction,
113
- isHidden: !isOpen,
114
- prefix: CLASSNAME,
115
- }),
116
- )}
117
- onClick={onClick}
118
- style={{ ...style, zIndex }}
119
- >
120
- <div className={`${CLASSNAME}__icon`}>
121
- <Icon icon={icon} size={Size.s} />
122
- </div>
123
- <div className={`${CLASSNAME}__content`}>{content}</div>
124
- {hasAction && (
125
- <div className={`${CLASSNAME}__action`}>
126
- <Button emphasis={Emphasis.medium} theme={theme} onClick={handleCallback}>
127
- <span>{actionLabel}</span>
128
- </Button>
101
+ return (
102
+ <Portal enabled={usePortal}>
103
+ {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
104
+ <div
105
+ ref={mergeRefs(ref, rootRef)}
106
+ role="alert"
107
+ {...forwardedProps}
108
+ className={classNames(
109
+ className,
110
+ handleBasicClasses({
111
+ color,
112
+ hasAction,
113
+ isHidden: !isOpen,
114
+ prefix: CLASSNAME,
115
+ }),
116
+ )}
117
+ onClick={onClick}
118
+ style={{ ...style, zIndex }}
119
+ >
120
+ <div className={`${CLASSNAME}__icon`}>
121
+ <Icon icon={icon} size={Size.s} />
129
122
  </div>
130
- )}
131
- </div>
123
+ <div className={`${CLASSNAME}__content`}>{content}</div>
124
+ {hasAction && (
125
+ <div className={`${CLASSNAME}__action`}>
126
+ <Button emphasis={Emphasis.medium} theme={theme} onClick={handleCallback}>
127
+ <span>{actionLabel}</span>
128
+ </Button>
129
+ </div>
130
+ )}
131
+ </div>
132
+ );
133
+ </Portal>
132
134
  );
133
-
134
- return usePortal ? <Portal>{notification}</Portal> : notification;
135
135
  });
136
136
  Notification.displayName = COMPONENT_NAME;
137
137
  Notification.className = CLASSNAME;
@@ -93,11 +93,6 @@ const DEFAULT_PROPS: Partial<PopoverProps> = {
93
93
  zIndex: POPOVER_ZINDEX,
94
94
  };
95
95
 
96
- /** Method to render the popover inside a portal if usePortal is true */
97
- const renderPopover = (children: ReactNode, usePortal?: boolean): any => {
98
- return usePortal ? <Portal>{children}</Portal> : children;
99
- };
100
-
101
96
  // Inner component (must be wrapped before export)
102
97
  const _InnerPopover = forwardRef<PopoverProps, HTMLDivElement>((props, ref) => {
103
98
  const {
@@ -154,39 +149,38 @@ const _InnerPopover = forwardRef<PopoverProps, HTMLDivElement>((props, ref) => {
154
149
  const clickAwayRefs = useRef([popoverRef, anchorRef]);
155
150
  const mergedRefs = useMergeRefs<HTMLDivElement>(setPopperElement, ref, popoverRef);
156
151
 
157
- return isOpen
158
- ? renderPopover(
159
- <Component
160
- {...forwardedProps}
161
- ref={mergedRefs}
162
- className={classNames(
163
- className,
164
- handleBasicClasses({
165
- prefix: CLASSNAME,
166
- theme,
167
- elevation: Math.min(elevation || 0, 5),
168
- position,
169
- isInitializing: !styles.popover?.transform,
170
- }),
171
- )}
172
- style={styles.popover}
173
- {...attributes.popper}
174
- >
175
- {unmountSentinel}
176
- <ClickAwayProvider callback={closeOnClickAway && onClose} childrenRefs={clickAwayRefs}>
177
- {hasArrow && (
178
- <div ref={setArrowElement} className={`${CLASSNAME}__arrow`} style={styles.arrow}>
179
- <svg viewBox="0 0 14 14" aria-hidden>
180
- <path d="M8 3.49C7.62 2.82 6.66 2.82 6.27 3.48L.04 14 14.04 14 8 3.49Z" />
181
- </svg>
182
- </div>
183
- )}
184
- <ThemeProvider value={theme}>{children}</ThemeProvider>
185
- </ClickAwayProvider>
186
- </Component>,
187
- usePortal,
188
- )
189
- : null;
152
+ return isOpen ? (
153
+ <Portal enabled={usePortal}>
154
+ <Component
155
+ {...forwardedProps}
156
+ ref={mergedRefs}
157
+ className={classNames(
158
+ className,
159
+ handleBasicClasses({
160
+ prefix: CLASSNAME,
161
+ theme,
162
+ elevation: Math.min(elevation || 0, 5),
163
+ position,
164
+ isInitializing: !styles.popover?.transform,
165
+ }),
166
+ )}
167
+ style={styles.popover}
168
+ {...attributes.popper}
169
+ >
170
+ {unmountSentinel}
171
+ <ClickAwayProvider callback={closeOnClickAway && onClose} childrenRefs={clickAwayRefs}>
172
+ {hasArrow && (
173
+ <div ref={setArrowElement} className={`${CLASSNAME}__arrow`} style={styles.arrow}>
174
+ <svg viewBox="0 0 14 14" aria-hidden>
175
+ <path d="M8 3.49C7.62 2.82 6.66 2.82 6.27 3.48L.04 14 14.04 14 8 3.49Z" />
176
+ </svg>
177
+ </div>
178
+ )}
179
+ <ThemeProvider value={theme}>{children}</ThemeProvider>
180
+ </ClickAwayProvider>
181
+ </Component>
182
+ </Portal>
183
+ ) : null;
190
184
  });
191
185
  _InnerPopover.displayName = COMPONENT_NAME;
192
186
 
@@ -1,5 +1,4 @@
1
- import { Button, Switch } from '@lumx/react';
2
- import { useBooleanState } from '@lumx/react/hooks/useBooleanState';
1
+ import { Button } from '@lumx/react';
3
2
  import { Portal, PortalProvider } from '@lumx/react/utils';
4
3
  import React from 'react';
5
4
 
@@ -9,17 +8,13 @@ export default {
9
8
  };
10
9
 
11
10
  const initShadowDOMPortal = () => {
12
- let container;
13
- return {
14
- mount() {
15
- container = document.createElement('div');
16
- document.body.appendChild(container);
17
- return container.attachShadow({ mode: 'closed' });
18
- },
19
- unmount() {
20
- container?.remove();
21
- },
22
- };
11
+ const div = document.createElement('div');
12
+ document.body.appendChild(div);
13
+ const container = div.attachShadow({ mode: 'closed' });
14
+ const style = document.createElement('style');
15
+ style.innerText = `button { color: red; }`;
16
+ container.appendChild(style);
17
+ return { container, teardown: () => div.remove() };
23
18
  };
24
19
 
25
20
  /**
@@ -27,14 +22,12 @@ const initShadowDOMPortal = () => {
27
22
  */
28
23
  export const RenderInShadowDOM = {
29
24
  args: { enabled: true },
30
- render({ enabled }) {
31
- return (
32
- <PortalProvider value={initShadowDOMPortal}>
33
- <Portal enabled={enabled}>
34
- <Button>My button in a portal</Button>
35
- </Portal>
36
- </PortalProvider>
37
- );
38
- },
25
+ render: ({ enabled }) => (
26
+ <PortalProvider value={initShadowDOMPortal}>
27
+ <Portal enabled={enabled}>
28
+ <Button>My button {!enabled && 'not'} in a shadow DOM portal</Button>
29
+ </Portal>
30
+ </PortalProvider>
31
+ ),
39
32
  parameters: { chromatic: { disable: true } },
40
33
  };
@@ -2,13 +2,9 @@ import React from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
 
4
4
  type Container = DocumentFragment | Element;
5
- interface PortalContext {
6
- mount(): Container;
7
- unmount?(): void;
8
- }
9
- type PortalInit = () => PortalContext;
5
+ export type PortalInit = () => { container: Container; teardown?: () => void };
10
6
 
11
- const PortalContext = React.createContext<PortalInit>(() => ({ mount: () => document.body }));
7
+ const PortalContext = React.createContext<PortalInit>(() => ({ container: document.body }));
12
8
 
13
9
  /**
14
10
  * Customize where <Portal> wrapped elements render (tooltip, popover, dialog, etc.)
@@ -17,27 +13,24 @@ export const PortalProvider: React.FC<{ children?: React.ReactNode; value: Porta
17
13
 
18
14
  /**
19
15
  * Render children in a portal outside the current DOM position
20
- * (defaults to document.body but can be customized with the PortalContextProvider)
16
+ * (defaults to `document.body` but can be customized with the PortalContextProvider)
21
17
  */
22
18
  export const Portal: React.FC<{ enabled?: boolean; children: React.ReactNode }> = ({ children, enabled = true }) => {
23
19
  const init = React.useContext(PortalContext);
24
- const { context, container } = React.useMemo(
20
+ const context = React.useMemo(
25
21
  () => {
26
- if (!enabled) return {};
27
- const context = init();
28
- const container = context.mount();
29
- return { context, container };
22
+ if (!enabled) return undefined;
23
+ return init();
30
24
  },
31
-
32
25
  // Only update on 'enabled'
33
26
  // eslint-disable-next-line react-hooks/exhaustive-deps
34
27
  [enabled],
35
28
  );
36
29
 
37
30
  React.useLayoutEffect(() => {
38
- return context?.unmount;
39
- }, [context?.unmount, enabled]);
31
+ return context?.teardown;
32
+ }, [context?.teardown, enabled]);
40
33
 
41
34
  if (!enabled) return <>{children}</>;
42
- return createPortal(children, container as Container);
35
+ return createPortal(children, context?.container as Container);
43
36
  };
package/utils/index.d.ts CHANGED
@@ -31,12 +31,10 @@ interface ClickAwayProviderProps extends ClickAwayParameters {
31
31
  declare const ClickAwayProvider: React.FC<ClickAwayProviderProps>;
32
32
 
33
33
  type Container = DocumentFragment | Element;
34
- type PortalInit = () => PortalContext;
35
- interface PortalContext {
36
- mount(): Container;
37
- unmount?(): void;
38
- }
39
- declare const PortalContext: React.Context<PortalInit>;
34
+ type PortalInit = () => {
35
+ container: Container;
36
+ teardown?: () => void;
37
+ };
40
38
  /**
41
39
  * Customize where <Portal> wrapped elements render (tooltip, popover, dialog, etc.)
42
40
  */
@@ -46,11 +44,11 @@ declare const PortalProvider: React.FC<{
46
44
  }>;
47
45
  /**
48
46
  * Render children in a portal outside the current DOM position
49
- * (defaults to document.body but can be customized with the PortalContextProvider)
47
+ * (defaults to `document.body` but can be customized with the PortalContextProvider)
50
48
  */
51
49
  declare const Portal: React.FC<{
52
50
  enabled?: boolean;
53
51
  children: React.ReactNode;
54
52
  }>;
55
53
 
56
- export { ClickAwayProvider, Portal, PortalProvider };
54
+ export { ClickAwayProvider, Portal, type PortalInit, PortalProvider };
package/utils/index.js CHANGED
@@ -93,7 +93,7 @@ const ClickAwayProvider = ({
93
93
  ClickAwayProvider.displayName = 'ClickAwayProvider';
94
94
 
95
95
  const PortalContext = /*#__PURE__*/React__default.createContext(() => ({
96
- mount: () => document.body
96
+ container: document.body
97
97
  }));
98
98
 
99
99
  /**
@@ -103,33 +103,25 @@ const PortalProvider = PortalContext.Provider;
103
103
 
104
104
  /**
105
105
  * Render children in a portal outside the current DOM position
106
- * (defaults to document.body but can be customized with the PortalContextProvider)
106
+ * (defaults to `document.body` but can be customized with the PortalContextProvider)
107
107
  */
108
108
  const Portal = ({
109
109
  children,
110
110
  enabled = true
111
111
  }) => {
112
112
  const init = React__default.useContext(PortalContext);
113
- const {
114
- context,
115
- container
116
- } = React__default.useMemo(() => {
117
- if (!enabled) return {};
118
- const context = init();
119
- const container = context.mount();
120
- return {
121
- context,
122
- container
123
- };
113
+ const context = React__default.useMemo(() => {
114
+ if (!enabled) return undefined;
115
+ return init();
124
116
  },
125
117
  // Only update on 'enabled'
126
118
  // eslint-disable-next-line react-hooks/exhaustive-deps
127
119
  [enabled]);
128
120
  React__default.useLayoutEffect(() => {
129
- return context === null || context === void 0 ? void 0 : context.unmount;
130
- }, [context === null || context === void 0 ? void 0 : context.unmount, enabled]);
121
+ return context === null || context === void 0 ? void 0 : context.teardown;
122
+ }, [context === null || context === void 0 ? void 0 : context.teardown, enabled]);
131
123
  if (!enabled) return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children);
132
- return /*#__PURE__*/createPortal(children, container);
124
+ return /*#__PURE__*/createPortal(children, context === null || context === void 0 ? void 0 : context.container);
133
125
  };
134
126
 
135
127
  export { ClickAwayProvider, Portal, PortalProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/hooks/useClickAway.tsx","../../src/utils/ClickAwayProvider/ClickAwayProvider.tsx","../../src/utils/PortalProvider/index.tsx"],"sourcesContent":["import { RefObject, useEffect } from 'react';\n\nimport { Falsy } from '@lumx/react/utils/type';\n\nimport isEmpty from 'lodash/isEmpty';\n\nconst EVENT_TYPES = ['mousedown', 'touchstart'];\n\nfunction isClickAway(target: HTMLElement, refs: Array<RefObject<HTMLElement>>): boolean {\n // The target element is not contained in any of the listed element references.\n return !refs.some((e) => e?.current?.contains(target));\n}\n\nexport interface ClickAwayParameters {\n /**\n * A callback function to call when the user clicks away from the elements.\n */\n callback: EventListener | Falsy;\n /**\n * Elements considered within the click away context (clicking outside them will trigger the click away callback).\n */\n childrenRefs: RefObject<Array<RefObject<HTMLElement>>>;\n}\n\n/**\n * Listen to clicks away from the given elements and callback the passed in function.\n *\n * Warning: If you need to detect click away on nested React portals, please use the `ClickAwayProvider` component.\n */\nexport function useClickAway({ callback, childrenRefs }: ClickAwayParameters): void {\n useEffect(() => {\n const { current: currentRefs } = childrenRefs;\n if (!callback || !currentRefs || isEmpty(currentRefs)) {\n return undefined;\n }\n const listener: EventListener = (evt) => {\n if (isClickAway(evt.target as HTMLElement, currentRefs)) {\n callback(evt);\n }\n };\n\n EVENT_TYPES.forEach((evtType) => document.addEventListener(evtType, listener));\n return () => {\n EVENT_TYPES.forEach((evtType) => document.removeEventListener(evtType, listener));\n };\n }, [callback, childrenRefs]);\n}\n","import React, { createContext, RefObject, useContext, useEffect, useMemo, useRef } from 'react';\nimport { ClickAwayParameters, useClickAway } from '@lumx/react/hooks/useClickAway';\n\ninterface ContextValue {\n childrenRefs: Array<RefObject<HTMLElement>>;\n addRefs(...newChildrenRefs: Array<RefObject<HTMLElement>>): void;\n}\n\nconst ClickAwayAncestorContext = createContext<ContextValue | null>(null);\n\ninterface ClickAwayProviderProps extends ClickAwayParameters {\n /**\n * (Optional) Element that should be considered as part of the parent\n */\n parentRef?: RefObject<HTMLElement>;\n /**\n * Children\n */\n children?: React.ReactNode;\n}\n\n/**\n * Component combining the `useClickAway` hook with a React context to hook into the React component tree and make sure\n * we take into account both the DOM tree and the React tree to detect click away.\n *\n * @return the react component.\n */\nexport const ClickAwayProvider: React.FC<ClickAwayProviderProps> = ({\n children,\n callback,\n childrenRefs,\n parentRef,\n}) => {\n const parentContext = useContext(ClickAwayAncestorContext);\n const currentContext = useMemo(() => {\n const context: ContextValue = {\n childrenRefs: [],\n /**\n * Add element refs to the current context and propagate to the parent context.\n */\n addRefs(...newChildrenRefs) {\n // Add element refs that should be considered as inside the click away context.\n context.childrenRefs.push(...newChildrenRefs);\n\n if (parentContext) {\n // Also add then to the parent context\n parentContext.addRefs(...newChildrenRefs);\n if (parentRef) {\n // The parent element is also considered as inside the parent click away context but not inside the current context\n parentContext.addRefs(parentRef);\n }\n }\n },\n };\n return context;\n }, [parentContext, parentRef]);\n\n useEffect(() => {\n const { current: currentRefs } = childrenRefs;\n if (!currentRefs) {\n return;\n }\n currentContext.addRefs(...currentRefs);\n }, [currentContext, childrenRefs]);\n\n useClickAway({ callback, childrenRefs: useRef(currentContext.childrenRefs) });\n return <ClickAwayAncestorContext.Provider value={currentContext}>{children}</ClickAwayAncestorContext.Provider>;\n};\nClickAwayProvider.displayName = 'ClickAwayProvider';\n","import React from 'react';\nimport { createPortal } from 'react-dom';\n\ntype Container = DocumentFragment | Element;\ninterface PortalContext {\n mount(): Container;\n unmount?(): void;\n}\ntype PortalInit = () => PortalContext;\n\nconst PortalContext = React.createContext<PortalInit>(() => ({ mount: () => document.body }));\n\n/**\n * Customize where <Portal> wrapped elements render (tooltip, popover, dialog, etc.)\n */\nexport const PortalProvider: React.FC<{ children?: React.ReactNode; value: PortalInit }> = PortalContext.Provider;\n\n/**\n * Render children in a portal outside the current DOM position\n * (defaults to document.body but can be customized with the PortalContextProvider)\n */\nexport const Portal: React.FC<{ enabled?: boolean; children: React.ReactNode }> = ({ children, enabled = true }) => {\n const init = React.useContext(PortalContext);\n const { context, container } = React.useMemo(\n () => {\n if (!enabled) return {};\n const context = init();\n const container = context.mount();\n return { context, container };\n },\n\n // Only update on 'enabled'\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [enabled],\n );\n\n React.useLayoutEffect(() => {\n return context?.unmount;\n }, [context?.unmount, enabled]);\n\n if (!enabled) return <>{children}</>;\n return createPortal(children, container as Container);\n};\n"],"names":["EVENT_TYPES","isClickAway","target","refs","some","e","_e$current","current","contains","useClickAway","callback","childrenRefs","useEffect","currentRefs","isEmpty","undefined","listener","evt","forEach","evtType","document","addEventListener","removeEventListener","ClickAwayAncestorContext","createContext","ClickAwayProvider","children","parentRef","parentContext","useContext","currentContext","useMemo","context","addRefs","newChildrenRefs","push","useRef","React","createElement","Provider","value","displayName","PortalContext","mount","body","PortalProvider","Portal","enabled","init","container","useLayoutEffect","unmount","Fragment","createPortal"],"mappings":";;;;AAMA,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AA,OAAOlB,OAAO,KAAPA,IAAAA,IAAAA,OAAO,KAAPA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,OAAO,CAAEmB,OAAO,CAAA;AAC3B,GAAC,EAAE,CAACnB,OAAO,KAAA,IAAA,IAAPA,OAAO,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAPA,OAAO,CAAEmB,OAAO,EAAEJ,OAAO,CAAC,CAAC,CAAA;AAE/B,EAAA,IAAI,CAACA,OAAO,EAAE,oBAAOV,cAAA,CAAAC,aAAA,CAAAD,cAAA,CAAAe,QAAA,EAAA,IAAA,EAAG1B,QAAW,CAAC,CAAA;AACpC,EAAA,oBAAO2B,YAAY,CAAC3B,QAAQ,EAAEuB,SAAsB,CAAC,CAAA;AACzD;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/hooks/useClickAway.tsx","../../src/utils/ClickAwayProvider/ClickAwayProvider.tsx","../../src/utils/PortalProvider/index.tsx"],"sourcesContent":["import { RefObject, useEffect } from 'react';\n\nimport { Falsy } from '@lumx/react/utils/type';\n\nimport isEmpty from 'lodash/isEmpty';\n\nconst EVENT_TYPES = ['mousedown', 'touchstart'];\n\nfunction isClickAway(target: HTMLElement, refs: Array<RefObject<HTMLElement>>): boolean {\n // The target element is not contained in any of the listed element references.\n return !refs.some((e) => e?.current?.contains(target));\n}\n\nexport interface ClickAwayParameters {\n /**\n * A callback function to call when the user clicks away from the elements.\n */\n callback: EventListener | Falsy;\n /**\n * Elements considered within the click away context (clicking outside them will trigger the click away callback).\n */\n childrenRefs: RefObject<Array<RefObject<HTMLElement>>>;\n}\n\n/**\n * Listen to clicks away from the given elements and callback the passed in function.\n *\n * Warning: If you need to detect click away on nested React portals, please use the `ClickAwayProvider` component.\n */\nexport function useClickAway({ callback, childrenRefs }: ClickAwayParameters): void {\n useEffect(() => {\n const { current: currentRefs } = childrenRefs;\n if (!callback || !currentRefs || isEmpty(currentRefs)) {\n return undefined;\n }\n const listener: EventListener = (evt) => {\n if (isClickAway(evt.target as HTMLElement, currentRefs)) {\n callback(evt);\n }\n };\n\n EVENT_TYPES.forEach((evtType) => document.addEventListener(evtType, listener));\n return () => {\n EVENT_TYPES.forEach((evtType) => document.removeEventListener(evtType, listener));\n };\n }, [callback, childrenRefs]);\n}\n","import React, { createContext, RefObject, useContext, useEffect, useMemo, useRef } from 'react';\nimport { ClickAwayParameters, useClickAway } from '@lumx/react/hooks/useClickAway';\n\ninterface ContextValue {\n childrenRefs: Array<RefObject<HTMLElement>>;\n addRefs(...newChildrenRefs: Array<RefObject<HTMLElement>>): void;\n}\n\nconst ClickAwayAncestorContext = createContext<ContextValue | null>(null);\n\ninterface ClickAwayProviderProps extends ClickAwayParameters {\n /**\n * (Optional) Element that should be considered as part of the parent\n */\n parentRef?: RefObject<HTMLElement>;\n /**\n * Children\n */\n children?: React.ReactNode;\n}\n\n/**\n * Component combining the `useClickAway` hook with a React context to hook into the React component tree and make sure\n * we take into account both the DOM tree and the React tree to detect click away.\n *\n * @return the react component.\n */\nexport const ClickAwayProvider: React.FC<ClickAwayProviderProps> = ({\n children,\n callback,\n childrenRefs,\n parentRef,\n}) => {\n const parentContext = useContext(ClickAwayAncestorContext);\n const currentContext = useMemo(() => {\n const context: ContextValue = {\n childrenRefs: [],\n /**\n * Add element refs to the current context and propagate to the parent context.\n */\n addRefs(...newChildrenRefs) {\n // Add element refs that should be considered as inside the click away context.\n context.childrenRefs.push(...newChildrenRefs);\n\n if (parentContext) {\n // Also add then to the parent context\n parentContext.addRefs(...newChildrenRefs);\n if (parentRef) {\n // The parent element is also considered as inside the parent click away context but not inside the current context\n parentContext.addRefs(parentRef);\n }\n }\n },\n };\n return context;\n }, [parentContext, parentRef]);\n\n useEffect(() => {\n const { current: currentRefs } = childrenRefs;\n if (!currentRefs) {\n return;\n }\n currentContext.addRefs(...currentRefs);\n }, [currentContext, childrenRefs]);\n\n useClickAway({ callback, childrenRefs: useRef(currentContext.childrenRefs) });\n return <ClickAwayAncestorContext.Provider value={currentContext}>{children}</ClickAwayAncestorContext.Provider>;\n};\nClickAwayProvider.displayName = 'ClickAwayProvider';\n","import React from 'react';\nimport { createPortal } from 'react-dom';\n\ntype Container = DocumentFragment | Element;\nexport type PortalInit = () => { container: Container; teardown?: () => void };\n\nconst PortalContext = React.createContext<PortalInit>(() => ({ container: document.body }));\n\n/**\n * Customize where <Portal> wrapped elements render (tooltip, popover, dialog, etc.)\n */\nexport const PortalProvider: React.FC<{ children?: React.ReactNode; value: PortalInit }> = PortalContext.Provider;\n\n/**\n * Render children in a portal outside the current DOM position\n * (defaults to `document.body` but can be customized with the PortalContextProvider)\n */\nexport const Portal: React.FC<{ enabled?: boolean; children: React.ReactNode }> = ({ children, enabled = true }) => {\n const init = React.useContext(PortalContext);\n const context = React.useMemo(\n () => {\n if (!enabled) return undefined;\n return init();\n },\n // Only update on 'enabled'\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [enabled],\n );\n\n React.useLayoutEffect(() => {\n return context?.teardown;\n }, [context?.teardown, enabled]);\n\n if (!enabled) return <>{children}</>;\n return createPortal(children, context?.container as Container);\n};\n"],"names":["EVENT_TYPES","isClickAway","target","refs","some","e","_e$current","current","contains","useClickAway","callback","childrenRefs","useEffect","currentRefs","isEmpty","undefined","listener","evt","forEach","evtType","document","addEventListener","removeEventListener","ClickAwayAncestorContext","createContext","ClickAwayProvider","children","parentRef","parentContext","useContext","currentContext","useMemo","context","addRefs","newChildrenRefs","push","useRef","React","createElement","Provider","value","displayName","PortalContext","container","body","PortalProvider","Portal","enabled","init","useLayoutEffect","teardown","Fragment","createPortal"],"mappings":";;;;AAMA,MAAMA,WAAW,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;AAE/C,SAASC,WAAWA,CAACC,MAAmB,EAAEC,IAAmC,EAAW;AACpF;AACA,EAAA,OAAO,CAACA,IAAI,CAACC,IAAI,CAAEC,CAAC,IAAA;AAAA,IAAA,IAAAC,UAAA,CAAA;AAAA,IAAA,OAAKD,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