@chayns-components/core 5.0.46 → 5.0.47
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/lib/cjs/components/popup/Popup.js +59 -22
- package/lib/cjs/components/popup/Popup.js.map +1 -1
- package/lib/cjs/components/popup/Popup.types.js +6 -0
- package/lib/cjs/components/popup/Popup.types.js.map +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/components/popup/Popup.js +59 -22
- package/lib/esm/components/popup/Popup.js.map +1 -1
- package/lib/esm/components/popup/Popup.types.js +2 -0
- package/lib/esm/components/popup/Popup.types.js.map +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/types/components/popup/Popup.d.ts +4 -56
- package/lib/types/components/popup/Popup.types.d.ts +151 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -22,6 +22,7 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
22
22
|
container,
|
|
23
23
|
onHide,
|
|
24
24
|
children,
|
|
25
|
+
isOpen,
|
|
25
26
|
shouldHideOnChildrenLeave,
|
|
26
27
|
shouldShowOnHover = false,
|
|
27
28
|
shouldUseChildrenWidth = true,
|
|
@@ -36,13 +37,16 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
36
37
|
});
|
|
37
38
|
const [internalAlignment, setInternalAlignment] = (0, _react2.useState)(_popup.PopupAlignment.TopLeft);
|
|
38
39
|
const [offset, setOffset] = (0, _react2.useState)(0);
|
|
39
|
-
const [
|
|
40
|
+
const [isInternallyOpen, setIsInternallyOpen] = (0, _react2.useState)(shouldBeOpen);
|
|
40
41
|
const [portal, setPortal] = (0, _react2.useState)();
|
|
41
42
|
const [pseudoSize, setPseudoSize] = (0, _react2.useState)();
|
|
42
43
|
const [newContainer, setNewContainer] = (0, _react2.useState)(container ?? null);
|
|
43
44
|
const [contentMaxHeight, setContentMaxHeight] = (0, _react2.useState)(undefined);
|
|
44
45
|
const timeout = (0, _react2.useRef)();
|
|
46
|
+
const previousIsVisibleRef = (0, _react2.useRef)(false);
|
|
45
47
|
const uuid = (0, _uuid.useUuid)();
|
|
48
|
+
const isControlled = typeof isOpen === 'boolean';
|
|
49
|
+
const isPopupOpen = isControlled ? isOpen : isInternallyOpen;
|
|
46
50
|
const {
|
|
47
51
|
height,
|
|
48
52
|
width,
|
|
@@ -71,7 +75,7 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
71
75
|
width
|
|
72
76
|
});
|
|
73
77
|
}, [height, width]);
|
|
74
|
-
const
|
|
78
|
+
const updatePopupPosition = (0, _react2.useCallback)(() => {
|
|
75
79
|
if (popupRef.current && pseudoSize) {
|
|
76
80
|
if (!newContainer) {
|
|
77
81
|
return;
|
|
@@ -137,21 +141,33 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
137
141
|
y
|
|
138
142
|
});
|
|
139
143
|
}
|
|
140
|
-
setIsOpen(true);
|
|
141
144
|
}
|
|
142
145
|
}, [alignment, newContainer, pseudoSize, shouldScrollWithContent, yOffset]);
|
|
146
|
+
const handleShow = (0, _react2.useCallback)(() => {
|
|
147
|
+
updatePopupPosition();
|
|
148
|
+
if (isControlled) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
setIsInternallyOpen(true);
|
|
152
|
+
}, [isControlled, updatePopupPosition]);
|
|
143
153
|
(0, _react2.useEffect)(() => {
|
|
154
|
+
if (isControlled) {
|
|
155
|
+
if (isOpen) {
|
|
156
|
+
updatePopupPosition();
|
|
157
|
+
}
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
144
160
|
if (shouldBeOpen) {
|
|
145
161
|
handleShow();
|
|
146
162
|
}
|
|
147
|
-
}, [handleShow, shouldBeOpen]);
|
|
163
|
+
}, [handleShow, isControlled, isOpen, shouldBeOpen, updatePopupPosition]);
|
|
148
164
|
const handleReposition = (0, _react2.useCallback)(() => {
|
|
149
|
-
if (
|
|
150
|
-
|
|
165
|
+
if (isPopupOpen) {
|
|
166
|
+
updatePopupPosition();
|
|
151
167
|
}
|
|
152
|
-
}, [
|
|
168
|
+
}, [isPopupOpen, updatePopupPosition]);
|
|
153
169
|
(0, _react2.useEffect)(() => {
|
|
154
|
-
if (!
|
|
170
|
+
if (!isPopupOpen) {
|
|
155
171
|
return;
|
|
156
172
|
}
|
|
157
173
|
window.addEventListener('resize', handleReposition);
|
|
@@ -160,7 +176,7 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
160
176
|
window.removeEventListener('resize', handleReposition);
|
|
161
177
|
window.removeEventListener('scroll', handleReposition, true);
|
|
162
178
|
};
|
|
163
|
-
}, [handleReposition,
|
|
179
|
+
}, [handleReposition, isPopupOpen]);
|
|
164
180
|
(0, _react2.useEffect)(() => {
|
|
165
181
|
if (!newContainer || !popupRef.current) return;
|
|
166
182
|
const viewHeight = newContainer.clientHeight;
|
|
@@ -172,18 +188,30 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
172
188
|
}
|
|
173
189
|
}, [coordinates.y, internalAlignment, newContainer]);
|
|
174
190
|
const handleChildrenClick = () => {
|
|
191
|
+
if (isControlled) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
175
194
|
handleShow();
|
|
176
195
|
};
|
|
177
196
|
const handleHide = (0, _react2.useCallback)(() => {
|
|
178
|
-
|
|
179
|
-
|
|
197
|
+
if (isControlled) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
setIsInternallyOpen(false);
|
|
201
|
+
}, [isControlled]);
|
|
180
202
|
const handleMouseEnter = (0, _react2.useCallback)(() => {
|
|
203
|
+
if (isControlled) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
181
206
|
if (shouldShowOnHover) {
|
|
182
207
|
window.clearTimeout(timeout.current);
|
|
183
208
|
handleShow();
|
|
184
209
|
}
|
|
185
|
-
}, [handleShow, shouldShowOnHover]);
|
|
210
|
+
}, [handleShow, isControlled, shouldShowOnHover]);
|
|
186
211
|
const handleMouseLeave = (0, _react2.useCallback)(() => {
|
|
212
|
+
if (isControlled) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
187
215
|
if (!shouldShowOnHover) {
|
|
188
216
|
return;
|
|
189
217
|
}
|
|
@@ -194,7 +222,7 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
194
222
|
timeout.current = window.setTimeout(() => {
|
|
195
223
|
handleHide();
|
|
196
224
|
}, 500);
|
|
197
|
-
}, [handleHide, shouldHideOnChildrenLeave, shouldShowOnHover]);
|
|
225
|
+
}, [handleHide, isControlled, shouldHideOnChildrenLeave, shouldShowOnHover]);
|
|
198
226
|
const handleDocumentClick = (0, _react2.useCallback)(event => {
|
|
199
227
|
var _popupContentRef$curr;
|
|
200
228
|
if (!((_popupContentRef$curr = popupContentRef.current) !== null && _popupContentRef$curr !== void 0 && _popupContentRef$curr.contains(event.target))) {
|
|
@@ -206,27 +234,36 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
206
234
|
show: handleShow
|
|
207
235
|
}), [handleHide, handleShow]);
|
|
208
236
|
(0, _react2.useEffect)(() => {
|
|
209
|
-
if (
|
|
237
|
+
if (!isPopupOpen) {
|
|
238
|
+
return undefined;
|
|
239
|
+
}
|
|
240
|
+
if (!isControlled && !shouldBeOpen) {
|
|
210
241
|
document.addEventListener('click', handleDocumentClick, true);
|
|
211
242
|
window.addEventListener('blur', handleHide);
|
|
212
|
-
if (typeof onShow === 'function') {
|
|
213
|
-
onShow();
|
|
214
|
-
}
|
|
215
|
-
} else if (typeof onHide === 'function') {
|
|
216
|
-
onHide();
|
|
217
243
|
}
|
|
218
244
|
return () => {
|
|
219
245
|
document.removeEventListener('click', handleDocumentClick, true);
|
|
220
246
|
window.removeEventListener('blur', handleHide);
|
|
221
247
|
};
|
|
222
|
-
}, [handleDocumentClick, handleHide,
|
|
248
|
+
}, [handleDocumentClick, handleHide, isControlled, isPopupOpen, shouldBeOpen]);
|
|
249
|
+
(0, _react2.useEffect)(() => {
|
|
250
|
+
if (previousIsVisibleRef.current === isPopupOpen) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
previousIsVisibleRef.current = isPopupOpen;
|
|
254
|
+
if (isPopupOpen) {
|
|
255
|
+
onShow === null || onShow === void 0 || onShow();
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
onHide === null || onHide === void 0 || onHide();
|
|
259
|
+
}, [isPopupOpen, onHide, onShow]);
|
|
223
260
|
(0, _react2.useEffect)(() => {
|
|
224
261
|
if (!newContainer) {
|
|
225
262
|
return;
|
|
226
263
|
}
|
|
227
264
|
setPortal(() => /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react2.default.createElement(_react.AnimatePresence, {
|
|
228
265
|
initial: false
|
|
229
|
-
},
|
|
266
|
+
}, isPopupOpen && /*#__PURE__*/_react2.default.createElement(_PopupContentWrapper.default, {
|
|
230
267
|
width: (pseudoSize === null || pseudoSize === void 0 ? void 0 : pseudoSize.width) ?? 0,
|
|
231
268
|
offset: offset,
|
|
232
269
|
shouldScrollWithContent: shouldScrollWithContent,
|
|
@@ -240,7 +277,7 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
240
277
|
}, /*#__PURE__*/_react2.default.createElement(_AreaContextProvider.default, {
|
|
241
278
|
shouldChangeColor: true
|
|
242
279
|
}, content))), newContainer));
|
|
243
|
-
}, [contentMaxHeight, internalAlignment, newContainer, content, coordinates, handleMouseEnter, handleMouseLeave,
|
|
280
|
+
}, [contentMaxHeight, internalAlignment, newContainer, content, coordinates, handleMouseEnter, handleMouseLeave, isPopupOpen, offset, pseudoSize === null || pseudoSize === void 0 ? void 0 : pseudoSize.width, uuid, shouldScrollWithContent]);
|
|
244
281
|
return /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, measuredElement, /*#__PURE__*/_react2.default.createElement(_Popup.StyledPopup, {
|
|
245
282
|
className: "beta-chayns-popup",
|
|
246
283
|
ref: popupRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.js","names":["_react","require","_react2","_interopRequireWildcard","_reactDom","_uuid","_popup","_AreaContextProvider","_interopRequireDefault","_PopupContentWrapper","_Popup","_element","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Popup","forwardRef","alignment","content","onShow","container","onHide","children","shouldHideOnChildrenLeave","shouldShowOnHover","shouldUseChildrenWidth","shouldScrollWithContent","shouldUseFullWidth","yOffset","shouldBeOpen","ref","coordinates","setCoordinates","useState","x","y","internalAlignment","setInternalAlignment","PopupAlignment","TopLeft","offset","setOffset","isOpen","setIsOpen","portal","setPortal","pseudoSize","setPseudoSize","newContainer","setNewContainer","contentMaxHeight","setContentMaxHeight","undefined","timeout","useRef","uuid","useUuid","height","width","measuredElement","useMeasuredClone","shouldPreventTextWrapping","popupContentRef","popupRef","useEffect","current","el","element","closest","Element","handleShow","useCallback","HORIZONTAL_PADDING","pseudoHeight","pseudoWidth","childrenHeight","left","childrenLeft","top","childrenTop","childrenWidth","getBoundingClientRect","document","body","containerHeight","containerWidth","zoomX","offsetWidth","zoomY","offsetHeight","childrenCenterX","scrollLeft","scrollTop","boundaryLeft","boundaryWidth","relativeX","shouldShowBottom","BottomLeft","BottomRight","BottomCenter","shouldForceRight","TopRight","shouldUseCenterAlignment","TopCenter","hasEnoughSpaceForCenter","isRight","newOffset","right","newX","handleReposition","window","addEventListener","removeEventListener","viewHeight","clientHeight","includes","handleChildrenClick","handleHide","handleMouseEnter","clearTimeout","handleMouseLeave","setTimeout","handleDocumentClick","event","_popupContentRef$curr","contains","target","useImperativeHandle","hide","show","createPortal","createElement","AnimatePresence","initial","key","maxHeight","onMouseLeave","onMouseEnter","shouldChangeColor","Fragment","StyledPopup","className","onClick","$shouldUseChildrenWidth","$shouldUseFullWidth","displayName","_default","exports"],"sources":["../../../../src/components/popup/Popup.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n forwardRef,\n ReactNode,\n ReactPortal,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { useUuid } from '../../hooks/uuid';\nimport { PopupAlignment, PopupCoordinates, PopupRef } from '../../types/popup';\nimport AreaContextProvider from '../area-provider/AreaContextProvider';\nimport PopupContentWrapper from './popup-content-wrapper/PopupContentWrapper';\nimport { StyledPopup } from './Popup.styles';\nimport { useMeasuredClone } from '../../hooks/element';\n\nexport type PopupProps = {\n /**\n * The alignment of the popup. By default, the popup will calculate the best alignment.\n */\n alignment?: PopupAlignment;\n /**\n * The element over which the content of the `ContextMenu` should be displayed.\n */\n children?: ReactNode;\n /**\n * The element where the content of the `Popup` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * The content that should be displayed inside the popup.\n */\n content: ReactNode;\n /**\n * Function to be executed when the content of the Context menu has been hidden.\n */\n onHide?: VoidFunction;\n /**\n * Function to be executed when the content of the Context menu has been shown.\n */\n onShow?: VoidFunction;\n /**\n * Whether the tooltip should be hidden after the children is not hovered.\n */\n shouldHideOnChildrenLeave?: boolean;\n /**\n * Whether the popup should scroll with the content.\n */\n shouldScrollWithContent?: boolean;\n /**\n * Whether the popup should be opened on hover. If not, the popup will be opened on click.\n */\n shouldShowOnHover?: boolean;\n /**\n * Whether the width of the children should be used.\n */\n shouldUseChildrenWidth?: boolean;\n /**\n * Whether the popup children should use the full width.\n */\n shouldUseFullWidth?: boolean;\n /**\n * The Y offset of the popup to the children.\n */\n yOffset?: number;\n /**\n * Whether the popup should be open. This can be used to control the popup from outside.\n */\n shouldBeOpen?: boolean;\n};\n\nconst Popup = forwardRef<PopupRef, PopupProps>(\n (\n {\n alignment,\n content,\n onShow,\n container,\n onHide,\n children,\n shouldHideOnChildrenLeave,\n shouldShowOnHover = false,\n shouldUseChildrenWidth = true,\n shouldScrollWithContent = true,\n shouldUseFullWidth = false,\n yOffset = 0,\n shouldBeOpen = false,\n },\n ref,\n ) => {\n const [coordinates, setCoordinates] = useState<PopupCoordinates>({\n x: 0,\n y: 0,\n });\n\n const [internalAlignment, setInternalAlignment] = useState<PopupAlignment>(\n PopupAlignment.TopLeft,\n );\n const [offset, setOffset] = useState<number>(0);\n const [isOpen, setIsOpen] = useState(shouldBeOpen);\n const [portal, setPortal] = useState<ReactPortal>();\n const [pseudoSize, setPseudoSize] = useState<{ height: number; width: number }>();\n const [newContainer, setNewContainer] = useState<Element | null>(container ?? null);\n const [contentMaxHeight, setContentMaxHeight] = useState<number | undefined>(undefined);\n\n const timeout = useRef<number>();\n\n const uuid = useUuid();\n\n const { height, width, measuredElement } = useMeasuredClone({\n content,\n shouldPreventTextWrapping: !shouldUseChildrenWidth,\n });\n\n const popupContentRef = useRef<HTMLDivElement>(null);\n const popupRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (popupRef.current && !container) {\n const el = popupRef.current as HTMLElement;\n\n const element = el.closest('.dialog-inner, .page-provider, .tapp, body');\n\n setNewContainer(element);\n }\n }, [container]);\n\n useEffect(() => {\n if (container instanceof Element) {\n setNewContainer(container);\n }\n }, [container]);\n\n useEffect(() => {\n setPseudoSize({ height, width });\n }, [height, width]);\n\n const handleShow = useCallback(() => {\n if (popupRef.current && pseudoSize) {\n if (!newContainer) {\n return;\n }\n\n const HORIZONTAL_PADDING = 23;\n\n const { height: pseudoHeight, width: pseudoWidth } = pseudoSize;\n\n const {\n height: childrenHeight,\n left: childrenLeft,\n top: childrenTop,\n width: childrenWidth,\n } = popupRef.current.getBoundingClientRect();\n\n const element = shouldScrollWithContent ? newContainer : document.body;\n\n const {\n height: containerHeight,\n width: containerWidth,\n top,\n left,\n } = element.getBoundingClientRect();\n\n const zoomX = containerWidth / (element as HTMLElement).offsetWidth;\n const zoomY = containerHeight / (element as HTMLElement).offsetHeight;\n\n const childrenCenterX = childrenLeft + childrenWidth / 2;\n const x = (childrenCenterX - left) / zoomX + element.scrollLeft;\n const y =\n (childrenTop + childrenHeight / 2 - top) / zoomY + element.scrollTop - yOffset;\n\n // Use one coordinate space for all horizontal bounds checks.\n const boundaryLeft = element.scrollLeft;\n const boundaryWidth = containerWidth / zoomX;\n const relativeX = x - boundaryLeft;\n\n const shouldShowBottom =\n pseudoHeight > childrenTop - 25 ||\n alignment === PopupAlignment.BottomLeft ||\n alignment === PopupAlignment.BottomRight ||\n alignment === PopupAlignment.BottomCenter;\n\n const shouldForceRight = shouldShowBottom\n ? alignment === PopupAlignment.BottomRight\n : alignment === PopupAlignment.TopRight;\n\n const shouldUseCenterAlignment = shouldShowBottom\n ? alignment === PopupAlignment.BottomCenter\n : alignment === PopupAlignment.TopCenter;\n\n const hasEnoughSpaceForCenter =\n pseudoWidth / 2 <= relativeX - HORIZONTAL_PADDING &&\n pseudoWidth / 2 <= boundaryWidth - relativeX - HORIZONTAL_PADDING;\n\n if (shouldUseCenterAlignment && hasEnoughSpaceForCenter) {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomCenter : PopupAlignment.TopCenter,\n );\n setOffset(0);\n setCoordinates({\n x,\n y,\n });\n } else {\n let isRight = false;\n\n if (pseudoWidth > relativeX - HORIZONTAL_PADDING || shouldForceRight) {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomRight : PopupAlignment.TopRight,\n );\n isRight = true;\n } else {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomLeft : PopupAlignment.TopLeft,\n );\n }\n\n let newOffset;\n\n if (isRight) {\n newOffset =\n relativeX + pseudoWidth >= boundaryWidth - HORIZONTAL_PADDING\n ? relativeX + pseudoWidth - (boundaryWidth - HORIZONTAL_PADDING)\n : 0;\n } else {\n const right = boundaryWidth - relativeX;\n\n newOffset =\n right + pseudoWidth >= boundaryWidth + HORIZONTAL_PADDING\n ? right + pseudoWidth - (boundaryWidth + HORIZONTAL_PADDING)\n : 0;\n }\n\n setOffset(newOffset);\n\n const newX = x - newOffset;\n\n setCoordinates({\n x: newX,\n y,\n });\n }\n\n setIsOpen(true);\n }\n }, [alignment, newContainer, pseudoSize, shouldScrollWithContent, yOffset]);\n\n useEffect(() => {\n if (shouldBeOpen) {\n handleShow();\n }\n }, [handleShow, shouldBeOpen]);\n\n const handleReposition = useCallback(() => {\n if (isOpen) {\n handleShow();\n }\n }, [handleShow, isOpen]);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n\n window.addEventListener('resize', handleReposition);\n window.addEventListener('scroll', handleReposition, true);\n\n return () => {\n window.removeEventListener('resize', handleReposition);\n window.removeEventListener('scroll', handleReposition, true);\n };\n }, [handleReposition, isOpen]);\n\n useEffect(() => {\n if (!newContainer || !popupRef.current) return;\n\n const viewHeight = newContainer.clientHeight;\n const childrenHeight = popupRef.current.getBoundingClientRect().height;\n\n if (\n [\n PopupAlignment.TopLeft,\n PopupAlignment.TopRight,\n PopupAlignment.TopCenter,\n ].includes(internalAlignment)\n ) {\n setContentMaxHeight(coordinates.y - 20);\n } else {\n setContentMaxHeight(viewHeight - childrenHeight - coordinates.y - 20);\n }\n }, [coordinates.y, internalAlignment, newContainer]);\n\n const handleChildrenClick = () => {\n handleShow();\n };\n\n const handleHide = useCallback(() => {\n setIsOpen(false);\n }, []);\n\n const handleMouseEnter = useCallback(() => {\n if (shouldShowOnHover) {\n window.clearTimeout(timeout.current);\n handleShow();\n }\n }, [handleShow, shouldShowOnHover]);\n\n const handleMouseLeave = useCallback(() => {\n if (!shouldShowOnHover) {\n return;\n }\n\n if (shouldHideOnChildrenLeave) {\n handleHide();\n\n return;\n }\n\n timeout.current = window.setTimeout(() => {\n handleHide();\n }, 500);\n }, [handleHide, shouldHideOnChildrenLeave, shouldShowOnHover]);\n\n const handleDocumentClick = useCallback<EventListener>(\n (event) => {\n if (!popupContentRef.current?.contains(event.target as Node)) {\n handleHide();\n }\n },\n [handleHide],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleHide,\n show: handleShow,\n }),\n [handleHide, handleShow],\n );\n\n useEffect(() => {\n if (isOpen && !shouldBeOpen) {\n document.addEventListener('click', handleDocumentClick, true);\n window.addEventListener('blur', handleHide);\n\n if (typeof onShow === 'function') {\n onShow();\n }\n } else if (typeof onHide === 'function') {\n onHide();\n }\n\n return () => {\n document.removeEventListener('click', handleDocumentClick, true);\n window.removeEventListener('blur', handleHide);\n };\n }, [handleDocumentClick, handleHide, isOpen, onHide, onShow, shouldBeOpen]);\n\n useEffect(() => {\n if (!newContainer) {\n return;\n }\n\n setPortal(() =>\n createPortal(\n <AnimatePresence initial={false}>\n {isOpen && (\n <PopupContentWrapper\n width={pseudoSize?.width ?? 0}\n offset={offset}\n shouldScrollWithContent={shouldScrollWithContent}\n coordinates={coordinates}\n key={`tooltip_${uuid}`}\n maxHeight={contentMaxHeight}\n alignment={internalAlignment}\n ref={popupContentRef}\n onMouseLeave={handleMouseLeave}\n onMouseEnter={handleMouseEnter}\n >\n <AreaContextProvider shouldChangeColor>\n {content}\n </AreaContextProvider>\n </PopupContentWrapper>\n )}\n </AnimatePresence>,\n newContainer,\n ),\n );\n }, [\n contentMaxHeight,\n internalAlignment,\n newContainer,\n content,\n coordinates,\n handleMouseEnter,\n handleMouseLeave,\n isOpen,\n offset,\n pseudoSize?.width,\n uuid,\n shouldScrollWithContent,\n ]);\n\n return (\n <>\n {measuredElement}\n <StyledPopup\n className=\"beta-chayns-popup\"\n ref={popupRef}\n onClick={handleChildrenClick}\n onMouseLeave={handleMouseLeave}\n onMouseEnter={handleMouseEnter}\n $shouldUseChildrenWidth={shouldUseChildrenWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n {children}\n </StyledPopup>\n {portal}\n </>\n );\n },\n);\n\nPopup.displayName = 'Popup';\n\nexport default Popup;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AAUA,IAAAG,SAAA,GAAAH,OAAA;AACA,IA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AE1B,mBAAoB;IAC7BoB,YAAY,EAAEhB,gBAAiB;IAC/BiB,YAAY,EAAEnB,gBAAiB;IAC/ByB,uBAAuB,EAAEtH,sBAAuB;IAChDuH,mBAAmB,EAAErH;EAAmB,GAEvCL,QACQ,CAAC,EACbsB,MACH,CAAC;AAEX,CACJ,CAAC;AAED7B,KAAK,CAACkI,WAAW,GAAG,OAAO;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArJ,OAAA,GAEbiB,KAAK","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Popup.js","names":["_react","require","_react2","_interopRequireWildcard","_reactDom","_uuid","_popup","_AreaContextProvider","_interopRequireDefault","_PopupContentWrapper","_Popup","_element","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Popup","forwardRef","alignment","content","onShow","container","onHide","children","isOpen","shouldHideOnChildrenLeave","shouldShowOnHover","shouldUseChildrenWidth","shouldScrollWithContent","shouldUseFullWidth","yOffset","shouldBeOpen","ref","coordinates","setCoordinates","useState","x","y","internalAlignment","setInternalAlignment","PopupAlignment","TopLeft","offset","setOffset","isInternallyOpen","setIsInternallyOpen","portal","setPortal","pseudoSize","setPseudoSize","newContainer","setNewContainer","contentMaxHeight","setContentMaxHeight","undefined","timeout","useRef","previousIsVisibleRef","uuid","useUuid","isControlled","isPopupOpen","height","width","measuredElement","useMeasuredClone","shouldPreventTextWrapping","popupContentRef","popupRef","useEffect","current","el","element","closest","Element","updatePopupPosition","useCallback","HORIZONTAL_PADDING","pseudoHeight","pseudoWidth","childrenHeight","left","childrenLeft","top","childrenTop","childrenWidth","getBoundingClientRect","document","body","containerHeight","containerWidth","zoomX","offsetWidth","zoomY","offsetHeight","childrenCenterX","scrollLeft","scrollTop","boundaryLeft","boundaryWidth","relativeX","shouldShowBottom","BottomLeft","BottomRight","BottomCenter","shouldForceRight","TopRight","shouldUseCenterAlignment","TopCenter","hasEnoughSpaceForCenter","isRight","newOffset","right","newX","handleShow","handleReposition","window","addEventListener","removeEventListener","viewHeight","clientHeight","includes","handleChildrenClick","handleHide","handleMouseEnter","clearTimeout","handleMouseLeave","setTimeout","handleDocumentClick","event","_popupContentRef$curr","contains","target","useImperativeHandle","hide","show","createPortal","createElement","AnimatePresence","initial","key","maxHeight","onMouseLeave","onMouseEnter","shouldChangeColor","Fragment","StyledPopup","className","onClick","$shouldUseChildrenWidth","$shouldUseFullWidth","displayName","_default","exports"],"sources":["../../../../src/components/popup/Popup.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n forwardRef,\n ReactPortal,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { useUuid } from '../../hooks/uuid';\nimport { PopupAlignment, PopupCoordinates, PopupRef } from '../../types/popup';\nimport AreaContextProvider from '../area-provider/AreaContextProvider';\nimport PopupContentWrapper from './popup-content-wrapper/PopupContentWrapper';\nimport { StyledPopup } from './Popup.styles';\nimport { useMeasuredClone } from '../../hooks/element';\nimport type { PopupProps } from './Popup.types';\n\nexport type { PopupProps } from './Popup.types';\n\nconst Popup = forwardRef<PopupRef, PopupProps>(\n (\n {\n alignment,\n content,\n onShow,\n container,\n onHide,\n children,\n isOpen,\n shouldHideOnChildrenLeave,\n shouldShowOnHover = false,\n shouldUseChildrenWidth = true,\n shouldScrollWithContent = true,\n shouldUseFullWidth = false,\n yOffset = 0,\n shouldBeOpen = false,\n },\n ref,\n ) => {\n const [coordinates, setCoordinates] = useState<PopupCoordinates>({\n x: 0,\n y: 0,\n });\n\n const [internalAlignment, setInternalAlignment] = useState<PopupAlignment>(\n PopupAlignment.TopLeft,\n );\n const [offset, setOffset] = useState<number>(0);\n const [isInternallyOpen, setIsInternallyOpen] = useState(shouldBeOpen);\n const [portal, setPortal] = useState<ReactPortal>();\n const [pseudoSize, setPseudoSize] = useState<{ height: number; width: number }>();\n const [newContainer, setNewContainer] = useState<Element | null>(container ?? null);\n const [contentMaxHeight, setContentMaxHeight] = useState<number | undefined>(undefined);\n\n const timeout = useRef<number>();\n const previousIsVisibleRef = useRef(false);\n\n const uuid = useUuid();\n const isControlled = typeof isOpen === 'boolean';\n const isPopupOpen = isControlled ? isOpen : isInternallyOpen;\n\n const { height, width, measuredElement } = useMeasuredClone({\n content,\n shouldPreventTextWrapping: !shouldUseChildrenWidth,\n });\n\n const popupContentRef = useRef<HTMLDivElement>(null);\n const popupRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (popupRef.current && !container) {\n const el = popupRef.current as HTMLElement;\n\n const element = el.closest('.dialog-inner, .page-provider, .tapp, body');\n\n setNewContainer(element);\n }\n }, [container]);\n\n useEffect(() => {\n if (container instanceof Element) {\n setNewContainer(container);\n }\n }, [container]);\n\n useEffect(() => {\n setPseudoSize({ height, width });\n }, [height, width]);\n\n const updatePopupPosition = useCallback(() => {\n if (popupRef.current && pseudoSize) {\n if (!newContainer) {\n return;\n }\n\n const HORIZONTAL_PADDING = 23;\n\n const { height: pseudoHeight, width: pseudoWidth } = pseudoSize;\n\n const {\n height: childrenHeight,\n left: childrenLeft,\n top: childrenTop,\n width: childrenWidth,\n } = popupRef.current.getBoundingClientRect();\n\n const element = shouldScrollWithContent ? newContainer : document.body;\n\n const {\n height: containerHeight,\n width: containerWidth,\n top,\n left,\n } = element.getBoundingClientRect();\n\n const zoomX = containerWidth / (element as HTMLElement).offsetWidth;\n const zoomY = containerHeight / (element as HTMLElement).offsetHeight;\n\n const childrenCenterX = childrenLeft + childrenWidth / 2;\n const x = (childrenCenterX - left) / zoomX + element.scrollLeft;\n const y =\n (childrenTop + childrenHeight / 2 - top) / zoomY + element.scrollTop - yOffset;\n\n // Use one coordinate space for all horizontal bounds checks.\n const boundaryLeft = element.scrollLeft;\n const boundaryWidth = containerWidth / zoomX;\n const relativeX = x - boundaryLeft;\n\n const shouldShowBottom =\n pseudoHeight > childrenTop - 25 ||\n alignment === PopupAlignment.BottomLeft ||\n alignment === PopupAlignment.BottomRight ||\n alignment === PopupAlignment.BottomCenter;\n\n const shouldForceRight = shouldShowBottom\n ? alignment === PopupAlignment.BottomRight\n : alignment === PopupAlignment.TopRight;\n\n const shouldUseCenterAlignment = shouldShowBottom\n ? alignment === PopupAlignment.BottomCenter\n : alignment === PopupAlignment.TopCenter;\n\n const hasEnoughSpaceForCenter =\n pseudoWidth / 2 <= relativeX - HORIZONTAL_PADDING &&\n pseudoWidth / 2 <= boundaryWidth - relativeX - HORIZONTAL_PADDING;\n\n if (shouldUseCenterAlignment && hasEnoughSpaceForCenter) {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomCenter : PopupAlignment.TopCenter,\n );\n setOffset(0);\n setCoordinates({\n x,\n y,\n });\n } else {\n let isRight = false;\n\n if (pseudoWidth > relativeX - HORIZONTAL_PADDING || shouldForceRight) {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomRight : PopupAlignment.TopRight,\n );\n isRight = true;\n } else {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomLeft : PopupAlignment.TopLeft,\n );\n }\n\n let newOffset;\n\n if (isRight) {\n newOffset =\n relativeX + pseudoWidth >= boundaryWidth - HORIZONTAL_PADDING\n ? relativeX + pseudoWidth - (boundaryWidth - HORIZONTAL_PADDING)\n : 0;\n } else {\n const right = boundaryWidth - relativeX;\n\n newOffset =\n right + pseudoWidth >= boundaryWidth + HORIZONTAL_PADDING\n ? right + pseudoWidth - (boundaryWidth + HORIZONTAL_PADDING)\n : 0;\n }\n\n setOffset(newOffset);\n\n const newX = x - newOffset;\n\n setCoordinates({\n x: newX,\n y,\n });\n }\n }\n }, [alignment, newContainer, pseudoSize, shouldScrollWithContent, yOffset]);\n\n const handleShow = useCallback(() => {\n updatePopupPosition();\n\n if (isControlled) {\n return;\n }\n\n setIsInternallyOpen(true);\n }, [isControlled, updatePopupPosition]);\n\n useEffect(() => {\n if (isControlled) {\n if (isOpen) {\n updatePopupPosition();\n }\n\n return;\n }\n\n if (shouldBeOpen) {\n handleShow();\n }\n }, [handleShow, isControlled, isOpen, shouldBeOpen, updatePopupPosition]);\n\n const handleReposition = useCallback(() => {\n if (isPopupOpen) {\n updatePopupPosition();\n }\n }, [isPopupOpen, updatePopupPosition]);\n\n useEffect(() => {\n if (!isPopupOpen) {\n return;\n }\n\n window.addEventListener('resize', handleReposition);\n window.addEventListener('scroll', handleReposition, true);\n\n return () => {\n window.removeEventListener('resize', handleReposition);\n window.removeEventListener('scroll', handleReposition, true);\n };\n }, [handleReposition, isPopupOpen]);\n\n useEffect(() => {\n if (!newContainer || !popupRef.current) return;\n\n const viewHeight = newContainer.clientHeight;\n const childrenHeight = popupRef.current.getBoundingClientRect().height;\n\n if (\n [\n PopupAlignment.TopLeft,\n PopupAlignment.TopRight,\n PopupAlignment.TopCenter,\n ].includes(internalAlignment)\n ) {\n setContentMaxHeight(coordinates.y - 20);\n } else {\n setContentMaxHeight(viewHeight - childrenHeight - coordinates.y - 20);\n }\n }, [coordinates.y, internalAlignment, newContainer]);\n\n const handleChildrenClick = () => {\n if (isControlled) {\n return;\n }\n\n handleShow();\n };\n\n const handleHide = useCallback(() => {\n if (isControlled) {\n return;\n }\n\n setIsInternallyOpen(false);\n }, [isControlled]);\n\n const handleMouseEnter = useCallback(() => {\n if (isControlled) {\n return;\n }\n\n if (shouldShowOnHover) {\n window.clearTimeout(timeout.current);\n handleShow();\n }\n }, [handleShow, isControlled, shouldShowOnHover]);\n\n const handleMouseLeave = useCallback(() => {\n if (isControlled) {\n return;\n }\n\n if (!shouldShowOnHover) {\n return;\n }\n\n if (shouldHideOnChildrenLeave) {\n handleHide();\n\n return;\n }\n\n timeout.current = window.setTimeout(() => {\n handleHide();\n }, 500);\n }, [handleHide, isControlled, shouldHideOnChildrenLeave, shouldShowOnHover]);\n\n const handleDocumentClick = useCallback<EventListener>(\n (event) => {\n if (!popupContentRef.current?.contains(event.target as Node)) {\n handleHide();\n }\n },\n [handleHide],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleHide,\n show: handleShow,\n }),\n [handleHide, handleShow],\n );\n\n useEffect(() => {\n if (!isPopupOpen) {\n return undefined;\n }\n\n if (!isControlled && !shouldBeOpen) {\n document.addEventListener('click', handleDocumentClick, true);\n window.addEventListener('blur', handleHide);\n }\n\n return () => {\n document.removeEventListener('click', handleDocumentClick, true);\n window.removeEventListener('blur', handleHide);\n };\n }, [handleDocumentClick, handleHide, isControlled, isPopupOpen, shouldBeOpen]);\n\n useEffect(() => {\n if (previousIsVisibleRef.current === isPopupOpen) {\n return;\n }\n\n previousIsVisibleRef.current = isPopupOpen;\n\n if (isPopupOpen) {\n onShow?.();\n\n return;\n }\n\n onHide?.();\n }, [isPopupOpen, onHide, onShow]);\n\n useEffect(() => {\n if (!newContainer) {\n return;\n }\n\n setPortal(() =>\n createPortal(\n <AnimatePresence initial={false}>\n {isPopupOpen && (\n <PopupContentWrapper\n width={pseudoSize?.width ?? 0}\n offset={offset}\n shouldScrollWithContent={shouldScrollWithContent}\n coordinates={coordinates}\n key={`tooltip_${uuid}`}\n maxHeight={contentMaxHeight}\n alignment={internalAlignment}\n ref={popupContentRef}\n onMouseLeave={handleMouseLeave}\n onMouseEnter={handleMouseEnter}\n >\n <AreaContextProvider shouldChangeColor>\n {content}\n </AreaContextProvider>\n </PopupContentWrapper>\n )}\n </AnimatePresence>,\n newContainer,\n ),\n );\n }, [\n contentMaxHeight,\n internalAlignment,\n newContainer,\n content,\n coordinates,\n handleMouseEnter,\n handleMouseLeave,\n isPopupOpen,\n offset,\n pseudoSize?.width,\n uuid,\n shouldScrollWithContent,\n ]);\n\n return (\n <>\n {measuredElement}\n <StyledPopup\n className=\"beta-chayns-popup\"\n ref={popupRef}\n onClick={handleChildrenClick}\n onMouseLeave={handleMouseLeave}\n onMouseEnter={handleMouseEnter}\n $shouldUseChildrenWidth={shouldUseChildrenWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n {children}\n </StyledPopup>\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H,sBAAuB;IAChD2H,mBAAmB,EAAEzH;EAAmB,GAEvCN,QACQ,CAAC,EACbuB,MACH,CAAC;AAEX,CACJ,CAAC;AAED9B,KAAK,CAACuI,WAAW,GAAG,OAAO;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA1J,OAAA,GAEbiB,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popup.types.js","names":[],"sources":["../../../../src/components/popup/Popup.types.ts"],"sourcesContent":["import { ReactNode } from 'react';\nimport { PopupAlignment } from '../../types/popup';\n\nexport type PopupProps = {\n /**\n * The preferred alignment of the popup relative to its trigger element.\n * @description\n * Use this prop to influence where the popup should appear around its trigger. If no alignment is provided,\n * the component automatically chooses a suitable position based on the available space.\n * @example\n * <Popup alignment={PopupAlignment.BottomRight} content=\"Details\">Open</Popup>\n * @optional\n */\n alignment?: PopupAlignment;\n /**\n * The trigger element that the popup is attached to.\n * @description\n * This content is rendered in place and acts as the interactive anchor for the popup.\n * Depending on the configured behavior, clicking or hovering this element can show or hide the popup.\n * @example\n * <Popup content=\"Details\"><button type=\"button\">Open</button></Popup>\n * @optional\n */\n children?: ReactNode;\n /**\n * The DOM element that should receive the popup portal.\n * @description\n * By default, the popup resolves a suitable container automatically. Use this prop when the popup should be rendered\n * into a specific element instead, for example to keep it inside a dialog or another scrollable area.\n * @example\n * <Popup container={document.body} content=\"Details\">Open</Popup>\n * @optional\n */\n container?: Element;\n /**\n * The content rendered inside the popup.\n * @description\n * This can be any React node, such as text, markup, or a fully custom component tree.\n * @example\n * <Popup content={<div>Additional information</div>}>Open</Popup>\n */\n content: ReactNode;\n /**\n * Fully controls whether the popup is visible.\n * @description\n * When this prop receives a boolean value, the popup becomes fully controlled from the outside.\n * Internal triggers such as click, hover, outside click, blur handling, or imperative `show` and `hide`\n * calls no longer change the visibility state. The popup is then shown only when `isOpen` is `true`\n * and hidden only when `isOpen` is `false`.\n * @example\n * <Popup isOpen={isPopupOpen} content=\"Details\">Open</Popup>\n * @optional\n */\n isOpen?: boolean;\n /**\n * Callback that is called after the popup becomes hidden.\n * @description\n * Use this callback to react to the popup closing, for example to synchronize external UI state.\n * It is called when the effective popup visibility changes from open to closed.\n * @example\n * <Popup onHide={() => console.log('Popup hidden')} content=\"Details\">Open</Popup>\n * @optional\n */\n onHide?: VoidFunction;\n /**\n * Callback that is called after the popup becomes visible.\n * @description\n * Use this callback to react to the popup opening, for example to start related UI behavior or analytics.\n * It is called when the effective popup visibility changes from closed to open.\n * @example\n * <Popup onShow={() => console.log('Popup shown')} content=\"Details\">Open</Popup>\n * @optional\n */\n onShow?: VoidFunction;\n /**\n * Hides the popup when the pointer leaves the trigger element.\n * @description\n * This prop is only relevant when `shouldShowOnHover` is enabled. When set to `true`, the popup closes immediately\n * after the pointer leaves the trigger element instead of waiting for the delayed hide behavior.\n * This prop has no effect while `isOpen` is used as a controlled prop.\n * @default false\n * @example\n * <Popup shouldShowOnHover shouldHideOnChildrenLeave content=\"Details\">Open</Popup>\n * @optional\n */\n shouldHideOnChildrenLeave?: boolean;\n /**\n * Keeps the popup aligned within the scrolling content container.\n * @description\n * When set to `true`, the popup uses the resolved container for positioning and scroll synchronization.\n * When set to `false`, it is positioned relative to the document body instead.\n * @default true\n * @example\n * <Popup shouldScrollWithContent={false} content=\"Details\">Open</Popup>\n * @optional\n */\n shouldScrollWithContent?: boolean;\n /**\n * Opens the popup when the trigger element is hovered instead of clicked.\n * @description\n * By default, the popup opens on click. Set this prop to `true` to switch to hover-based interaction.\n * This prop has no effect while `isOpen` is used as a controlled prop.\n * @default false\n * @example\n * <Popup shouldShowOnHover content=\"Details\">Open</Popup>\n * @optional\n */\n shouldShowOnHover?: boolean;\n /**\n * Uses the trigger element width as the popup width reference.\n * @description\n * When enabled, the popup measurement and layout respect the width of the trigger element.\n * Disable this when the popup should size itself more freely based on its content.\n * @default true\n * @example\n * <Popup shouldUseChildrenWidth={false} content=\"Details\">Open</Popup>\n * @optional\n */\n shouldUseChildrenWidth?: boolean;\n /**\n * Stretches the trigger element to the full available width.\n * @description\n * This affects the wrapper around the popup trigger and is useful when the trigger should behave like a block-level element.\n * @default false\n * @example\n * <Popup shouldUseFullWidth content=\"Details\">Open</Popup>\n * @optional\n */\n shouldUseFullWidth?: boolean;\n /**\n * Requests that the popup should be opened from outside.\n * @description\n * Unlike `isOpen`, this prop does not fully control visibility. It acts as an external open trigger and keeps compatibility\n * with the existing behavior, while other internal interactions may still influence the popup state.\n * Use `isOpen` when you need full external control over showing and hiding the popup.\n * @default false\n * @example\n * <Popup shouldBeOpen={shouldOpenInitially} content=\"Details\">Open</Popup>\n * @optional\n */\n shouldBeOpen?: boolean;\n /**\n * Vertical offset between the trigger element and the popup.\n * @description\n * Use this prop to fine-tune the popup position on the Y axis. Positive and negative values can be used depending on the desired spacing.\n * @default 0\n * @example\n * <Popup yOffset={8} content=\"Details\">Open</Popup>\n * @optional\n */\n yOffset?: number;\n};\n"],"mappings":"","ignoreList":[]}
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_VerificationBadge","_AreaContextProvider","_interopRequireWildcard","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_Badge2","_container","_dropdown","_element","_ref","_Filter","_AnimatedNumber","_FileList","_FileSelect","_DropdownBodyWrapper","_ComboBox","_ContentCard","_HighlightSlider","_ContextMenu","_ContextMenu2","_ExpandableContent","_FileInput","_FilterButton","_FilterButtons","_GridImage","_GroupedImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_MentionFinder","_MultiActionButton","_NumberInput","_PageProvider","_Popup","_PopupContent","_ProgressBar","_popup","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SelectButton","_SetupWizardItem","_SetupWizard","_SharingContextMenu","_SharingBar","_SharingButton","_Signature","_SliderButton","_Slider","_SmallWaitCursor","_TagInput","_TextArea","_Tooltip","_Truncation","_mentionFinder","_contentCard","_file","_filterButtons","_MultiActionButton2","_truncation","_environment","_fileDialog","_isTobitEmployee","_pageProvider","_uploadFile","_ComboBox2","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\n\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as VerificationBadge } from './components/verification-badge/VerificationBadge';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport {\n default as ColorSchemeProvider,\n useColorScheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { BadgeSize, BadgeDesign } from './components/badge/Badge.types';\nexport type {\n ColorSchemeContextProps,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { useContainer, ContainerAnchor } from './hooks/container';\nexport { DropdownDirection, type DropdownCoordinates } from './types/dropdown';\nexport { useIsMeasuredClone } from './hooks/element';\nexport { useCombinedRefs } from './hooks/ref';\nexport { default as Filter, type FilterRightIcon } from './components/filter/Filter';\nexport {\n type SortItem,\n type SearchConfig,\n type SortConfig,\n type CheckboxConfig,\n type FilterButtonConfig,\n type FilterRef,\n} from './types/filter';\nexport { default as AnimatedNumber } from './components/animated-number/AnimatedNumber';\nexport {\n default as FileList,\n type IFileItem as FileListItem,\n} from './components/file-list/FileList';\nexport { default as FileSelect } from './components/file-select/FileSelect';\nexport { default as DropdownBodyWrapper } from './components/dropdown-body-wrapper/DropdownBodyWrapper';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as HighlightSlider } from './components/highlight-slider/HighlightSlider';\nexport type { HighlightSliderItemColors as HighlightSliderColors } from './components/highlight-slider/highlight-slider-item/HighlightSliderItem';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport {\n ContextMenuAlignment,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n type ContextMenuProps,\n type ContextMenuRef,\n} from './components/context-menu/ContextMenu.types';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport {\n default as FileInput,\n type FileInputRef,\n STREAMINGSERVICE_FILE_TYPES,\n TSIMG_FILE_TYPES,\n} from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as GroupedImage } from './components/grouped-image/GroupedImage';\nexport { default as Icon, type IconProps } from './components/icon/Icon';\nexport { default as Input, InputSize } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n type ListItemRef,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as MultiActionButton } from './components/multi-action-button/MultiActionButton';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { PopupAlignment } from './types/popup';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingContextMenu } from './components/sharing-context-menu/SharingContextMenu';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as SharingButton } from './components/sharing-button/SharingButton';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport type { Tag } from './types/tagInput';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport type { TagInputRef } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/element';\nexport type { BrowserName } from './types/chayns';\nexport { ContentCardType } from './types/contentCard';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport { isValidFileType } from './utils/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport {\n type MultiActionButtonAction,\n type MultiActionButtonActionEvent,\n type MultiActionButtonActionStatus,\n MultiActionButtonHeight,\n type MultiActionButtonProps,\n MultiActionButtonStatusType,\n} from './components/multi-action-button/MultiActionButton.types';\nexport { ClampPosition } from './types/truncation';\nexport { useIsTouch } from './utils/environment';\nexport { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\nexport type { Theme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport { ComboBoxSize } from './components/combobox/ComboBox.types';\nexport type {\n IComboBoxItem as ComboBoxItem,\n ComboBoxTextStyles,\n IComboBoxItems as ComboBoxItems,\n ComboBoxRef,\n} from './components/combobox/ComboBox.types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAAA,SAAAhF,uBAAA+E,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAK,UAAA,GAAAL,CAAA,KAAAU,OAAA,EAAAV,CAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_VerificationBadge","_AreaContextProvider","_interopRequireWildcard","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_Badge2","_container","_dropdown","_element","_ref","_Filter","_AnimatedNumber","_FileList","_FileSelect","_DropdownBodyWrapper","_ComboBox","_ContentCard","_HighlightSlider","_ContextMenu","_ContextMenu2","_ExpandableContent","_FileInput","_FilterButton","_FilterButtons","_GridImage","_GroupedImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_MentionFinder","_MultiActionButton","_NumberInput","_PageProvider","_Popup","_PopupContent","_ProgressBar","_popup","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SelectButton","_SetupWizardItem","_SetupWizard","_SharingContextMenu","_SharingBar","_SharingButton","_Signature","_SliderButton","_Slider","_SmallWaitCursor","_TagInput","_TextArea","_Tooltip","_Truncation","_mentionFinder","_contentCard","_file","_filterButtons","_MultiActionButton2","_truncation","_environment","_fileDialog","_isTobitEmployee","_pageProvider","_uploadFile","_ComboBox2","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\n\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as VerificationBadge } from './components/verification-badge/VerificationBadge';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport {\n default as ColorSchemeProvider,\n useColorScheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { BadgeSize, BadgeDesign } from './components/badge/Badge.types';\nexport type {\n ColorSchemeContextProps,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { useContainer, ContainerAnchor } from './hooks/container';\nexport { DropdownDirection, type DropdownCoordinates } from './types/dropdown';\nexport { useIsMeasuredClone } from './hooks/element';\nexport { useCombinedRefs } from './hooks/ref';\nexport { default as Filter, type FilterRightIcon } from './components/filter/Filter';\nexport {\n type SortItem,\n type SearchConfig,\n type SortConfig,\n type CheckboxConfig,\n type FilterButtonConfig,\n type FilterRef,\n} from './types/filter';\nexport { default as AnimatedNumber } from './components/animated-number/AnimatedNumber';\nexport {\n default as FileList,\n type IFileItem as FileListItem,\n} from './components/file-list/FileList';\nexport { default as FileSelect } from './components/file-select/FileSelect';\nexport { default as DropdownBodyWrapper } from './components/dropdown-body-wrapper/DropdownBodyWrapper';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as HighlightSlider } from './components/highlight-slider/HighlightSlider';\nexport type { HighlightSliderItemColors as HighlightSliderColors } from './components/highlight-slider/highlight-slider-item/HighlightSliderItem';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport {\n ContextMenuAlignment,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n type ContextMenuProps,\n type ContextMenuRef,\n} from './components/context-menu/ContextMenu.types';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport {\n default as FileInput,\n type FileInputRef,\n STREAMINGSERVICE_FILE_TYPES,\n TSIMG_FILE_TYPES,\n} from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as GroupedImage } from './components/grouped-image/GroupedImage';\nexport { default as Icon, type IconProps } from './components/icon/Icon';\nexport { default as Input, InputSize } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n type ListItemRef,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as MultiActionButton } from './components/multi-action-button/MultiActionButton';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { PopupAlignment } from './types/popup';\nexport type { PopupProps } from './components/popup/Popup.types';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingContextMenu } from './components/sharing-context-menu/SharingContextMenu';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as SharingButton } from './components/sharing-button/SharingButton';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport type { Tag } from './types/tagInput';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport type { TagInputRef } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/element';\nexport type { BrowserName } from './types/chayns';\nexport { ContentCardType } from './types/contentCard';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport { isValidFileType } from './utils/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport {\n type MultiActionButtonAction,\n type MultiActionButtonActionEvent,\n type MultiActionButtonActionStatus,\n MultiActionButtonHeight,\n type MultiActionButtonProps,\n MultiActionButtonStatusType,\n} from './components/multi-action-button/MultiActionButton.types';\nexport { ClampPosition } from './types/truncation';\nexport { useIsTouch } from './utils/environment';\nexport { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\nexport type { Theme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport { ComboBoxSize } from './components/combobox/ComboBox.types';\nexport type {\n IComboBoxItem as ComboBoxItem,\n ComboBoxTextStyles,\n IComboBoxItems as ComboBoxItems,\n ComboBoxRef,\n} from './components/combobox/ComboBox.types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
17
|
+
isOpen,
|
|
17
18
|
shouldHideOnChildrenLeave,
|
|
18
19
|
shouldShowOnHover = false,
|
|
19
20
|
shouldUseChildrenWidth = true,
|
|
@@ -28,13 +29,16 @@ const Popup = /*#__PURE__*/forwardRef(({
|
|
|
28
29
|
});
|
|
29
30
|
const [internalAlignment, setInternalAlignment] = useState(PopupAlignment.TopLeft);
|
|
30
31
|
const [offset, setOffset] = useState(0);
|
|
31
|
-
const [
|
|
32
|
+
const [isInternallyOpen, setIsInternallyOpen] = useState(shouldBeOpen);
|
|
32
33
|
const [portal, setPortal] = useState();
|
|
33
34
|
const [pseudoSize, setPseudoSize] = useState();
|
|
34
35
|
const [newContainer, setNewContainer] = useState(container ?? null);
|
|
35
36
|
const [contentMaxHeight, setContentMaxHeight] = useState(undefined);
|
|
36
37
|
const timeout = useRef();
|
|
38
|
+
const previousIsVisibleRef = useRef(false);
|
|
37
39
|
const uuid = useUuid();
|
|
40
|
+
const isControlled = typeof isOpen === 'boolean';
|
|
41
|
+
const isPopupOpen = isControlled ? isOpen : isInternallyOpen;
|
|
38
42
|
const {
|
|
39
43
|
height,
|
|
40
44
|
width,
|
|
@@ -63,7 +67,7 @@ const Popup = /*#__PURE__*/forwardRef(({
|
|
|
63
67
|
width
|
|
64
68
|
});
|
|
65
69
|
}, [height, width]);
|
|
66
|
-
const
|
|
70
|
+
const updatePopupPosition = useCallback(() => {
|
|
67
71
|
if (popupRef.current && pseudoSize) {
|
|
68
72
|
if (!newContainer) {
|
|
69
73
|
return;
|
|
@@ -129,21 +133,33 @@ const Popup = /*#__PURE__*/forwardRef(({
|
|
|
129
133
|
y
|
|
130
134
|
});
|
|
131
135
|
}
|
|
132
|
-
setIsOpen(true);
|
|
133
136
|
}
|
|
134
137
|
}, [alignment, newContainer, pseudoSize, shouldScrollWithContent, yOffset]);
|
|
138
|
+
const handleShow = useCallback(() => {
|
|
139
|
+
updatePopupPosition();
|
|
140
|
+
if (isControlled) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
setIsInternallyOpen(true);
|
|
144
|
+
}, [isControlled, updatePopupPosition]);
|
|
135
145
|
useEffect(() => {
|
|
146
|
+
if (isControlled) {
|
|
147
|
+
if (isOpen) {
|
|
148
|
+
updatePopupPosition();
|
|
149
|
+
}
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
136
152
|
if (shouldBeOpen) {
|
|
137
153
|
handleShow();
|
|
138
154
|
}
|
|
139
|
-
}, [handleShow, shouldBeOpen]);
|
|
155
|
+
}, [handleShow, isControlled, isOpen, shouldBeOpen, updatePopupPosition]);
|
|
140
156
|
const handleReposition = useCallback(() => {
|
|
141
|
-
if (
|
|
142
|
-
|
|
157
|
+
if (isPopupOpen) {
|
|
158
|
+
updatePopupPosition();
|
|
143
159
|
}
|
|
144
|
-
}, [
|
|
160
|
+
}, [isPopupOpen, updatePopupPosition]);
|
|
145
161
|
useEffect(() => {
|
|
146
|
-
if (!
|
|
162
|
+
if (!isPopupOpen) {
|
|
147
163
|
return;
|
|
148
164
|
}
|
|
149
165
|
window.addEventListener('resize', handleReposition);
|
|
@@ -152,7 +168,7 @@ const Popup = /*#__PURE__*/forwardRef(({
|
|
|
152
168
|
window.removeEventListener('resize', handleReposition);
|
|
153
169
|
window.removeEventListener('scroll', handleReposition, true);
|
|
154
170
|
};
|
|
155
|
-
}, [handleReposition,
|
|
171
|
+
}, [handleReposition, isPopupOpen]);
|
|
156
172
|
useEffect(() => {
|
|
157
173
|
if (!newContainer || !popupRef.current) return;
|
|
158
174
|
const viewHeight = newContainer.clientHeight;
|
|
@@ -164,18 +180,30 @@ const Popup = /*#__PURE__*/forwardRef(({
|
|
|
164
180
|
}
|
|
165
181
|
}, [coordinates.y, internalAlignment, newContainer]);
|
|
166
182
|
const handleChildrenClick = () => {
|
|
183
|
+
if (isControlled) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
167
186
|
handleShow();
|
|
168
187
|
};
|
|
169
188
|
const handleHide = useCallback(() => {
|
|
170
|
-
|
|
171
|
-
|
|
189
|
+
if (isControlled) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
setIsInternallyOpen(false);
|
|
193
|
+
}, [isControlled]);
|
|
172
194
|
const handleMouseEnter = useCallback(() => {
|
|
195
|
+
if (isControlled) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
173
198
|
if (shouldShowOnHover) {
|
|
174
199
|
window.clearTimeout(timeout.current);
|
|
175
200
|
handleShow();
|
|
176
201
|
}
|
|
177
|
-
}, [handleShow, shouldShowOnHover]);
|
|
202
|
+
}, [handleShow, isControlled, shouldShowOnHover]);
|
|
178
203
|
const handleMouseLeave = useCallback(() => {
|
|
204
|
+
if (isControlled) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
179
207
|
if (!shouldShowOnHover) {
|
|
180
208
|
return;
|
|
181
209
|
}
|
|
@@ -186,7 +214,7 @@ const Popup = /*#__PURE__*/forwardRef(({
|
|
|
186
214
|
timeout.current = window.setTimeout(() => {
|
|
187
215
|
handleHide();
|
|
188
216
|
}, 500);
|
|
189
|
-
}, [handleHide, shouldHideOnChildrenLeave, shouldShowOnHover]);
|
|
217
|
+
}, [handleHide, isControlled, shouldHideOnChildrenLeave, shouldShowOnHover]);
|
|
190
218
|
const handleDocumentClick = useCallback(event => {
|
|
191
219
|
if (!popupContentRef.current?.contains(event.target)) {
|
|
192
220
|
handleHide();
|
|
@@ -197,27 +225,36 @@ const Popup = /*#__PURE__*/forwardRef(({
|
|
|
197
225
|
show: handleShow
|
|
198
226
|
}), [handleHide, handleShow]);
|
|
199
227
|
useEffect(() => {
|
|
200
|
-
if (
|
|
228
|
+
if (!isPopupOpen) {
|
|
229
|
+
return undefined;
|
|
230
|
+
}
|
|
231
|
+
if (!isControlled && !shouldBeOpen) {
|
|
201
232
|
document.addEventListener('click', handleDocumentClick, true);
|
|
202
233
|
window.addEventListener('blur', handleHide);
|
|
203
|
-
if (typeof onShow === 'function') {
|
|
204
|
-
onShow();
|
|
205
|
-
}
|
|
206
|
-
} else if (typeof onHide === 'function') {
|
|
207
|
-
onHide();
|
|
208
234
|
}
|
|
209
235
|
return () => {
|
|
210
236
|
document.removeEventListener('click', handleDocumentClick, true);
|
|
211
237
|
window.removeEventListener('blur', handleHide);
|
|
212
238
|
};
|
|
213
|
-
}, [handleDocumentClick, handleHide,
|
|
239
|
+
}, [handleDocumentClick, handleHide, isControlled, isPopupOpen, shouldBeOpen]);
|
|
240
|
+
useEffect(() => {
|
|
241
|
+
if (previousIsVisibleRef.current === isPopupOpen) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
previousIsVisibleRef.current = isPopupOpen;
|
|
245
|
+
if (isPopupOpen) {
|
|
246
|
+
onShow?.();
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
onHide?.();
|
|
250
|
+
}, [isPopupOpen, onHide, onShow]);
|
|
214
251
|
useEffect(() => {
|
|
215
252
|
if (!newContainer) {
|
|
216
253
|
return;
|
|
217
254
|
}
|
|
218
255
|
setPortal(() => /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement(AnimatePresence, {
|
|
219
256
|
initial: false
|
|
220
|
-
},
|
|
257
|
+
}, isPopupOpen && /*#__PURE__*/React.createElement(PopupContentWrapper, {
|
|
221
258
|
width: pseudoSize?.width ?? 0,
|
|
222
259
|
offset: offset,
|
|
223
260
|
shouldScrollWithContent: shouldScrollWithContent,
|
|
@@ -231,7 +268,7 @@ const Popup = /*#__PURE__*/forwardRef(({
|
|
|
231
268
|
}, /*#__PURE__*/React.createElement(AreaContextProvider, {
|
|
232
269
|
shouldChangeColor: true
|
|
233
270
|
}, content))), newContainer));
|
|
234
|
-
}, [contentMaxHeight, internalAlignment, newContainer, content, coordinates, handleMouseEnter, handleMouseLeave,
|
|
271
|
+
}, [contentMaxHeight, internalAlignment, newContainer, content, coordinates, handleMouseEnter, handleMouseLeave, isPopupOpen, offset, pseudoSize?.width, uuid, shouldScrollWithContent]);
|
|
235
272
|
return /*#__PURE__*/React.createElement(React.Fragment, null, measuredElement, /*#__PURE__*/React.createElement(StyledPopup, {
|
|
236
273
|
className: "beta-chayns-popup",
|
|
237
274
|
ref: popupRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.js","names":["AnimatePresence","React","forwardRef","useCallback","useEffect","useImperativeHandle","useRef","useState","createPortal","useUuid","PopupAlignment","AreaContextProvider","PopupContentWrapper","StyledPopup","useMeasuredClone","Popup","alignment","content","onShow","container","onHide","children","shouldHideOnChildrenLeave","shouldShowOnHover","shouldUseChildrenWidth","shouldScrollWithContent","shouldUseFullWidth","yOffset","shouldBeOpen","ref","coordinates","setCoordinates","x","y","internalAlignment","setInternalAlignment","TopLeft","offset","setOffset","isOpen","setIsOpen","portal","setPortal","pseudoSize","setPseudoSize","newContainer","setNewContainer","contentMaxHeight","setContentMaxHeight","undefined","timeout","uuid","height","width","measuredElement","shouldPreventTextWrapping","popupContentRef","popupRef","current","el","element","closest","Element","handleShow","HORIZONTAL_PADDING","pseudoHeight","pseudoWidth","childrenHeight","left","childrenLeft","top","childrenTop","childrenWidth","getBoundingClientRect","document","body","containerHeight","containerWidth","zoomX","offsetWidth","zoomY","offsetHeight","childrenCenterX","scrollLeft","scrollTop","boundaryLeft","boundaryWidth","relativeX","shouldShowBottom","BottomLeft","BottomRight","BottomCenter","shouldForceRight","TopRight","shouldUseCenterAlignment","TopCenter","hasEnoughSpaceForCenter","isRight","newOffset","right","newX","handleReposition","window","addEventListener","removeEventListener","viewHeight","clientHeight","includes","handleChildrenClick","handleHide","handleMouseEnter","clearTimeout","handleMouseLeave","setTimeout","handleDocumentClick","event","contains","target","hide","show","createElement","initial","key","maxHeight","onMouseLeave","onMouseEnter","shouldChangeColor","Fragment","className","onClick","$shouldUseChildrenWidth","$shouldUseFullWidth","displayName"],"sources":["../../../../src/components/popup/Popup.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n forwardRef,\n ReactNode,\n ReactPortal,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { useUuid } from '../../hooks/uuid';\nimport { PopupAlignment, PopupCoordinates, PopupRef } from '../../types/popup';\nimport AreaContextProvider from '../area-provider/AreaContextProvider';\nimport PopupContentWrapper from './popup-content-wrapper/PopupContentWrapper';\nimport { StyledPopup } from './Popup.styles';\nimport { useMeasuredClone } from '../../hooks/element';\n\nexport type PopupProps = {\n /**\n * The alignment of the popup. By default, the popup will calculate the best alignment.\n */\n alignment?: PopupAlignment;\n /**\n * The element over which the content of the `ContextMenu` should be displayed.\n */\n children?: ReactNode;\n /**\n * The element where the content of the `Popup` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * The content that should be displayed inside the popup.\n */\n content: ReactNode;\n /**\n * Function to be executed when the content of the Context menu has been hidden.\n */\n onHide?: VoidFunction;\n /**\n * Function to be executed when the content of the Context menu has been shown.\n */\n onShow?: VoidFunction;\n /**\n * Whether the tooltip should be hidden after the children is not hovered.\n */\n shouldHideOnChildrenLeave?: boolean;\n /**\n * Whether the popup should scroll with the content.\n */\n shouldScrollWithContent?: boolean;\n /**\n * Whether the popup should be opened on hover. If not, the popup will be opened on click.\n */\n shouldShowOnHover?: boolean;\n /**\n * Whether the width of the children should be used.\n */\n shouldUseChildrenWidth?: boolean;\n /**\n * Whether the popup children should use the full width.\n */\n shouldUseFullWidth?: boolean;\n /**\n * The Y offset of the popup to the children.\n */\n yOffset?: number;\n /**\n * Whether the popup should be open. This can be used to control the popup from outside.\n */\n shouldBeOpen?: boolean;\n};\n\nconst Popup = forwardRef<PopupRef, PopupProps>(\n (\n {\n alignment,\n content,\n onShow,\n container,\n onHide,\n children,\n shouldHideOnChildrenLeave,\n shouldShowOnHover = false,\n shouldUseChildrenWidth = true,\n shouldScrollWithContent = true,\n shouldUseFullWidth = false,\n yOffset = 0,\n shouldBeOpen = false,\n },\n ref,\n ) => {\n const [coordinates, setCoordinates] = useState<PopupCoordinates>({\n x: 0,\n y: 0,\n });\n\n const [internalAlignment, setInternalAlignment] = useState<PopupAlignment>(\n PopupAlignment.TopLeft,\n );\n const [offset, setOffset] = useState<number>(0);\n const [isOpen, setIsOpen] = useState(shouldBeOpen);\n const [portal, setPortal] = useState<ReactPortal>();\n const [pseudoSize, setPseudoSize] = useState<{ height: number; width: number }>();\n const [newContainer, setNewContainer] = useState<Element | null>(container ?? null);\n const [contentMaxHeight, setContentMaxHeight] = useState<number | undefined>(undefined);\n\n const timeout = useRef<number>();\n\n const uuid = useUuid();\n\n const { height, width, measuredElement } = useMeasuredClone({\n content,\n shouldPreventTextWrapping: !shouldUseChildrenWidth,\n });\n\n const popupContentRef = useRef<HTMLDivElement>(null);\n const popupRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (popupRef.current && !container) {\n const el = popupRef.current as HTMLElement;\n\n const element = el.closest('.dialog-inner, .page-provider, .tapp, body');\n\n setNewContainer(element);\n }\n }, [container]);\n\n useEffect(() => {\n if (container instanceof Element) {\n setNewContainer(container);\n }\n }, [container]);\n\n useEffect(() => {\n setPseudoSize({ height, width });\n }, [height, width]);\n\n const handleShow = useCallback(() => {\n if (popupRef.current && pseudoSize) {\n if (!newContainer) {\n return;\n }\n\n const HORIZONTAL_PADDING = 23;\n\n const { height: pseudoHeight, width: pseudoWidth } = pseudoSize;\n\n const {\n height: childrenHeight,\n left: childrenLeft,\n top: childrenTop,\n width: childrenWidth,\n } = popupRef.current.getBoundingClientRect();\n\n const element = shouldScrollWithContent ? newContainer : document.body;\n\n const {\n height: containerHeight,\n width: containerWidth,\n top,\n left,\n } = element.getBoundingClientRect();\n\n const zoomX = containerWidth / (element as HTMLElement).offsetWidth;\n const zoomY = containerHeight / (element as HTMLElement).offsetHeight;\n\n const childrenCenterX = childrenLeft + childrenWidth / 2;\n const x = (childrenCenterX - left) / zoomX + element.scrollLeft;\n const y =\n (childrenTop + childrenHeight / 2 - top) / zoomY + element.scrollTop - yOffset;\n\n // Use one coordinate space for all horizontal bounds checks.\n const boundaryLeft = element.scrollLeft;\n const boundaryWidth = containerWidth / zoomX;\n const relativeX = x - boundaryLeft;\n\n const shouldShowBottom =\n pseudoHeight > childrenTop - 25 ||\n alignment === PopupAlignment.BottomLeft ||\n alignment === PopupAlignment.BottomRight ||\n alignment === PopupAlignment.BottomCenter;\n\n const shouldForceRight = shouldShowBottom\n ? alignment === PopupAlignment.BottomRight\n : alignment === PopupAlignment.TopRight;\n\n const shouldUseCenterAlignment = shouldShowBottom\n ? alignment === PopupAlignment.BottomCenter\n : alignment === PopupAlignment.TopCenter;\n\n const hasEnoughSpaceForCenter =\n pseudoWidth / 2 <= relativeX - HORIZONTAL_PADDING &&\n pseudoWidth / 2 <= boundaryWidth - relativeX - HORIZONTAL_PADDING;\n\n if (shouldUseCenterAlignment && hasEnoughSpaceForCenter) {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomCenter : PopupAlignment.TopCenter,\n );\n setOffset(0);\n setCoordinates({\n x,\n y,\n });\n } else {\n let isRight = false;\n\n if (pseudoWidth > relativeX - HORIZONTAL_PADDING || shouldForceRight) {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomRight : PopupAlignment.TopRight,\n );\n isRight = true;\n } else {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomLeft : PopupAlignment.TopLeft,\n );\n }\n\n let newOffset;\n\n if (isRight) {\n newOffset =\n relativeX + pseudoWidth >= boundaryWidth - HORIZONTAL_PADDING\n ? relativeX + pseudoWidth - (boundaryWidth - HORIZONTAL_PADDING)\n : 0;\n } else {\n const right = boundaryWidth - relativeX;\n\n newOffset =\n right + pseudoWidth >= boundaryWidth + HORIZONTAL_PADDING\n ? right + pseudoWidth - (boundaryWidth + HORIZONTAL_PADDING)\n : 0;\n }\n\n setOffset(newOffset);\n\n const newX = x - newOffset;\n\n setCoordinates({\n x: newX,\n y,\n });\n }\n\n setIsOpen(true);\n }\n }, [alignment, newContainer, pseudoSize, shouldScrollWithContent, yOffset]);\n\n useEffect(() => {\n if (shouldBeOpen) {\n handleShow();\n }\n }, [handleShow, shouldBeOpen]);\n\n const handleReposition = useCallback(() => {\n if (isOpen) {\n handleShow();\n }\n }, [handleShow, isOpen]);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n\n window.addEventListener('resize', handleReposition);\n window.addEventListener('scroll', handleReposition, true);\n\n return () => {\n window.removeEventListener('resize', handleReposition);\n window.removeEventListener('scroll', handleReposition, true);\n };\n }, [handleReposition, isOpen]);\n\n useEffect(() => {\n if (!newContainer || !popupRef.current) return;\n\n const viewHeight = newContainer.clientHeight;\n const childrenHeight = popupRef.current.getBoundingClientRect().height;\n\n if (\n [\n PopupAlignment.TopLeft,\n PopupAlignment.TopRight,\n PopupAlignment.TopCenter,\n ].includes(internalAlignment)\n ) {\n setContentMaxHeight(coordinates.y - 20);\n } else {\n setContentMaxHeight(viewHeight - childrenHeight - coordinates.y - 20);\n }\n }, [coordinates.y, internalAlignment, newContainer]);\n\n const handleChildrenClick = () => {\n handleShow();\n };\n\n const handleHide = useCallback(() => {\n setIsOpen(false);\n }, []);\n\n const handleMouseEnter = useCallback(() => {\n if (shouldShowOnHover) {\n window.clearTimeout(timeout.current);\n handleShow();\n }\n }, [handleShow, shouldShowOnHover]);\n\n const handleMouseLeave = useCallback(() => {\n if (!shouldShowOnHover) {\n return;\n }\n\n if (shouldHideOnChildrenLeave) {\n handleHide();\n\n return;\n }\n\n timeout.current = window.setTimeout(() => {\n handleHide();\n }, 500);\n }, [handleHide, shouldHideOnChildrenLeave, shouldShowOnHover]);\n\n const handleDocumentClick = useCallback<EventListener>(\n (event) => {\n if (!popupContentRef.current?.contains(event.target as Node)) {\n handleHide();\n }\n },\n [handleHide],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleHide,\n show: handleShow,\n }),\n [handleHide, handleShow],\n );\n\n useEffect(() => {\n if (isOpen && !shouldBeOpen) {\n document.addEventListener('click', handleDocumentClick, true);\n window.addEventListener('blur', handleHide);\n\n if (typeof onShow === 'function') {\n onShow();\n }\n } else if (typeof onHide === 'function') {\n onHide();\n }\n\n return () => {\n document.removeEventListener('click', handleDocumentClick, true);\n window.removeEventListener('blur', handleHide);\n };\n }, [handleDocumentClick, handleHide, isOpen, onHide, onShow, shouldBeOpen]);\n\n useEffect(() => {\n if (!newContainer) {\n return;\n }\n\n setPortal(() =>\n createPortal(\n <AnimatePresence initial={false}>\n {isOpen && (\n <PopupContentWrapper\n width={pseudoSize?.width ?? 0}\n offset={offset}\n shouldScrollWithContent={shouldScrollWithContent}\n coordinates={coordinates}\n key={`tooltip_${uuid}`}\n maxHeight={contentMaxHeight}\n alignment={internalAlignment}\n ref={popupContentRef}\n onMouseLeave={handleMouseLeave}\n onMouseEnter={handleMouseEnter}\n >\n <AreaContextProvider shouldChangeColor>\n {content}\n </AreaContextProvider>\n </PopupContentWrapper>\n )}\n </AnimatePresence>,\n newContainer,\n ),\n );\n }, [\n contentMaxHeight,\n internalAlignment,\n newContainer,\n content,\n coordinates,\n handleMouseEnter,\n handleMouseLeave,\n isOpen,\n offset,\n pseudoSize?.width,\n uuid,\n shouldScrollWithContent,\n ]);\n\n return (\n <>\n {measuredElement}\n <StyledPopup\n className=\"beta-chayns-popup\"\n ref={popupRef}\n onClick={handleChildrenClick}\n onMouseLeave={handleMouseLeave}\n onMouseEnter={handleMouseEnter}\n $shouldUseChildrenWidth={shouldUseChildrenWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n {children}\n </StyledPopup>\n {portal}\n </>\n );\n },\n);\n\nPopup.displayName = 'Popup';\n\nexport default Popup;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IACRC,UAAU,EAGVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,YAAY,QAAQ,WAAW;AACxC,SAASC,OAAO,QAAQ,kBAAkB;AAC1C,SAASC,cAAc,QA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UAAU,EAAEU,KAAK,IAAI,CAAE;MAC9BhB,MAAM,EAAEA,MAAO;MACfZ,uBAAuB,EAAEA,uBAAwB;MACjDK,WAAW,EAAEA,WAAY;MACzB4F,GAAG,EAAE,WAAWvE,IAAI,EAAG;MACvBwE,SAAS,EAAE5E,gBAAiB;MAC5B/B,SAAS,EAAEkB,iBAAkB;MAC7BL,GAAG,EAAE2B,eAAgB;MACrBoE,YAAY,EAAEZ,gBAAiB;MAC/Ba,YAAY,EAAEf;IAAiB,gBAE/B7G,KAAA,CAAAuH,aAAA,CAAC7G,mBAAmB;MAACmH,iBAAiB;IAAA,GACjC7G,OACgB,CACJ,CAEZ,CAAC,EAClB4B,YACJ,CACJ,CAAC;EACL,CAAC,EAAE,CACCE,gBAAgB,EAChBb,iBAAiB,EACjBW,YAAY,EACZ5B,OAAO,EACPa,WAAW,EACXgF,gBAAgB,EAChBE,gBAAgB,EAChBzE,MAAM,EACNF,MAAM,EACNM,UAAU,EAAEU,KAAK,EACjBF,IAAI,EACJ1B,uBAAuB,CAC1B,CAAC;EAEF,oBACIxB,KAAA,CAAAuH,aAAA,CAAAvH,KAAA,CAAA8H,QAAA,QACKzE,eAAe,eAChBrD,KAAA,CAAAuH,aAAA,CAAC3G,WAAW;IACRmH,SAAS,EAAC,mBAAmB;IAC7BnG,GAAG,EAAE4B,QAAS;IACdwE,OAAO,EAAErB,mBAAoB;IAC7BgB,YAAY,EAAEZ,gBAAiB;IAC/Ba,YAAY,EAAEf,gBAAiB;IAC/BoB,uBAAuB,EAAE1G,sBAAuB;IAChD2G,mBAAmB,EAAEzG;EAAmB,GAEvCL,QACQ,CAAC,EACboB,MACH,CAAC;AAEX,CACJ,CAAC;AAED1B,KAAK,CAACqH,WAAW,GAAG,OAAO;AAE3B,eAAerH,KAAK","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Popup.js","names":["AnimatePresence","React","forwardRef","useCallback","useEffect","useImperativeHandle","useRef","useState","createPortal","useUuid","PopupAlignment","AreaContextProvider","PopupContentWrapper","StyledPopup","useMeasuredClone","Popup","alignment","content","onShow","container","onHide","children","isOpen","shouldHideOnChildrenLeave","shouldShowOnHover","shouldUseChildrenWidth","shouldScrollWithContent","shouldUseFullWidth","yOffset","shouldBeOpen","ref","coordinates","setCoordinates","x","y","internalAlignment","setInternalAlignment","TopLeft","offset","setOffset","isInternallyOpen","setIsInternallyOpen","portal","setPortal","pseudoSize","setPseudoSize","newContainer","setNewContainer","contentMaxHeight","setContentMaxHeight","undefined","timeout","previousIsVisibleRef","uuid","isControlled","isPopupOpen","height","width","measuredElement","shouldPreventTextWrapping","popupContentRef","popupRef","current","el","element","closest","Element","updatePopupPosition","HORIZONTAL_PADDING","pseudoHeight","pseudoWidth","childrenHeight","left","childrenLeft","top","childrenTop","childrenWidth","getBoundingClientRect","document","body","containerHeight","containerWidth","zoomX","offsetWidth","zoomY","offsetHeight","childrenCenterX","scrollLeft","scrollTop","boundaryLeft","boundaryWidth","relativeX","shouldShowBottom","BottomLeft","BottomRight","BottomCenter","shouldForceRight","TopRight","shouldUseCenterAlignment","TopCenter","hasEnoughSpaceForCenter","isRight","newOffset","right","newX","handleShow","handleReposition","window","addEventListener","removeEventListener","viewHeight","clientHeight","includes","handleChildrenClick","handleHide","handleMouseEnter","clearTimeout","handleMouseLeave","setTimeout","handleDocumentClick","event","contains","target","hide","show","createElement","initial","key","maxHeight","onMouseLeave","onMouseEnter","shouldChangeColor","Fragment","className","onClick","$shouldUseChildrenWidth","$shouldUseFullWidth","displayName"],"sources":["../../../../src/components/popup/Popup.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n forwardRef,\n ReactPortal,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { useUuid } from '../../hooks/uuid';\nimport { PopupAlignment, PopupCoordinates, PopupRef } from '../../types/popup';\nimport AreaContextProvider from '../area-provider/AreaContextProvider';\nimport PopupContentWrapper from './popup-content-wrapper/PopupContentWrapper';\nimport { StyledPopup } from './Popup.styles';\nimport { useMeasuredClone } from '../../hooks/element';\nimport type { PopupProps } from './Popup.types';\n\nexport type { PopupProps } from './Popup.types';\n\nconst Popup = forwardRef<PopupRef, PopupProps>(\n (\n {\n alignment,\n content,\n onShow,\n container,\n onHide,\n children,\n isOpen,\n shouldHideOnChildrenLeave,\n shouldShowOnHover = false,\n shouldUseChildrenWidth = true,\n shouldScrollWithContent = true,\n shouldUseFullWidth = false,\n yOffset = 0,\n shouldBeOpen = false,\n },\n ref,\n ) => {\n const [coordinates, setCoordinates] = useState<PopupCoordinates>({\n x: 0,\n y: 0,\n });\n\n const [internalAlignment, setInternalAlignment] = useState<PopupAlignment>(\n PopupAlignment.TopLeft,\n );\n const [offset, setOffset] = useState<number>(0);\n const [isInternallyOpen, setIsInternallyOpen] = useState(shouldBeOpen);\n const [portal, setPortal] = useState<ReactPortal>();\n const [pseudoSize, setPseudoSize] = useState<{ height: number; width: number }>();\n const [newContainer, setNewContainer] = useState<Element | null>(container ?? null);\n const [contentMaxHeight, setContentMaxHeight] = useState<number | undefined>(undefined);\n\n const timeout = useRef<number>();\n const previousIsVisibleRef = useRef(false);\n\n const uuid = useUuid();\n const isControlled = typeof isOpen === 'boolean';\n const isPopupOpen = isControlled ? isOpen : isInternallyOpen;\n\n const { height, width, measuredElement } = useMeasuredClone({\n content,\n shouldPreventTextWrapping: !shouldUseChildrenWidth,\n });\n\n const popupContentRef = useRef<HTMLDivElement>(null);\n const popupRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (popupRef.current && !container) {\n const el = popupRef.current as HTMLElement;\n\n const element = el.closest('.dialog-inner, .page-provider, .tapp, body');\n\n setNewContainer(element);\n }\n }, [container]);\n\n useEffect(() => {\n if (container instanceof Element) {\n setNewContainer(container);\n }\n }, [container]);\n\n useEffect(() => {\n setPseudoSize({ height, width });\n }, [height, width]);\n\n const updatePopupPosition = useCallback(() => {\n if (popupRef.current && pseudoSize) {\n if (!newContainer) {\n return;\n }\n\n const HORIZONTAL_PADDING = 23;\n\n const { height: pseudoHeight, width: pseudoWidth } = pseudoSize;\n\n const {\n height: childrenHeight,\n left: childrenLeft,\n top: childrenTop,\n width: childrenWidth,\n } = popupRef.current.getBoundingClientRect();\n\n const element = shouldScrollWithContent ? newContainer : document.body;\n\n const {\n height: containerHeight,\n width: containerWidth,\n top,\n left,\n } = element.getBoundingClientRect();\n\n const zoomX = containerWidth / (element as HTMLElement).offsetWidth;\n const zoomY = containerHeight / (element as HTMLElement).offsetHeight;\n\n const childrenCenterX = childrenLeft + childrenWidth / 2;\n const x = (childrenCenterX - left) / zoomX + element.scrollLeft;\n const y =\n (childrenTop + childrenHeight / 2 - top) / zoomY + element.scrollTop - yOffset;\n\n // Use one coordinate space for all horizontal bounds checks.\n const boundaryLeft = element.scrollLeft;\n const boundaryWidth = containerWidth / zoomX;\n const relativeX = x - boundaryLeft;\n\n const shouldShowBottom =\n pseudoHeight > childrenTop - 25 ||\n alignment === PopupAlignment.BottomLeft ||\n alignment === PopupAlignment.BottomRight ||\n alignment === PopupAlignment.BottomCenter;\n\n const shouldForceRight = shouldShowBottom\n ? alignment === PopupAlignment.BottomRight\n : alignment === PopupAlignment.TopRight;\n\n const shouldUseCenterAlignment = shouldShowBottom\n ? alignment === PopupAlignment.BottomCenter\n : alignment === PopupAlignment.TopCenter;\n\n const hasEnoughSpaceForCenter =\n pseudoWidth / 2 <= relativeX - HORIZONTAL_PADDING &&\n pseudoWidth / 2 <= boundaryWidth - relativeX - HORIZONTAL_PADDING;\n\n if (shouldUseCenterAlignment && hasEnoughSpaceForCenter) {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomCenter : PopupAlignment.TopCenter,\n );\n setOffset(0);\n setCoordinates({\n x,\n y,\n });\n } else {\n let isRight = false;\n\n if (pseudoWidth > relativeX - HORIZONTAL_PADDING || shouldForceRight) {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomRight : PopupAlignment.TopRight,\n );\n isRight = true;\n } else {\n setInternalAlignment(\n shouldShowBottom ? PopupAlignment.BottomLeft : PopupAlignment.TopLeft,\n );\n }\n\n let newOffset;\n\n if (isRight) {\n newOffset =\n relativeX + pseudoWidth >= boundaryWidth - HORIZONTAL_PADDING\n ? relativeX + pseudoWidth - (boundaryWidth - HORIZONTAL_PADDING)\n : 0;\n } else {\n const right = boundaryWidth - relativeX;\n\n newOffset =\n right + pseudoWidth >= boundaryWidth + HORIZONTAL_PADDING\n ? right + pseudoWidth - (boundaryWidth + HORIZONTAL_PADDING)\n : 0;\n }\n\n setOffset(newOffset);\n\n const newX = x - newOffset;\n\n setCoordinates({\n x: newX,\n y,\n });\n }\n }\n }, [alignment, newContainer, pseudoSize, shouldScrollWithContent, yOffset]);\n\n const handleShow = useCallback(() => {\n updatePopupPosition();\n\n if (isControlled) {\n return;\n }\n\n setIsInternallyOpen(true);\n }, [isControlled, updatePopupPosition]);\n\n useEffect(() => {\n if (isControlled) {\n if (isOpen) {\n updatePopupPosition();\n }\n\n return;\n }\n\n if (shouldBeOpen) {\n handleShow();\n }\n }, [handleShow, isControlled, isOpen, shouldBeOpen, updatePopupPosition]);\n\n const handleReposition = useCallback(() => {\n if (isPopupOpen) {\n updatePopupPosition();\n }\n }, [isPopupOpen, updatePopupPosition]);\n\n useEffect(() => {\n if (!isPopupOpen) {\n return;\n }\n\n window.addEventListener('resize', handleReposition);\n window.addEventListener('scroll', handleReposition, true);\n\n return () => {\n window.removeEventListener('resize', handleReposition);\n window.removeEventListener('scroll', handleReposition, true);\n };\n }, [handleReposition, isPopupOpen]);\n\n useEffect(() => {\n if (!newContainer || !popupRef.current) return;\n\n const viewHeight = newContainer.clientHeight;\n const childrenHeight = popupRef.current.getBoundingClientRect().height;\n\n if (\n [\n PopupAlignment.TopLeft,\n PopupAlignment.TopRight,\n PopupAlignment.TopCenter,\n ].includes(internalAlignment)\n ) {\n setContentMaxHeight(coordinates.y - 20);\n } else {\n setContentMaxHeight(viewHeight - childrenHeight - coordinates.y - 20);\n }\n }, [coordinates.y, internalAlignment, newContainer]);\n\n const handleChildrenClick = () => {\n if (isControlled) {\n return;\n }\n\n handleShow();\n };\n\n const handleHide = useCallback(() => {\n if (isControlled) {\n return;\n }\n\n setIsInternallyOpen(false);\n }, [isControlled]);\n\n const handleMouseEnter = useCallback(() => {\n if (isControlled) {\n return;\n }\n\n if (shouldShowOnHover) {\n window.clearTimeout(timeout.current);\n handleShow();\n }\n }, [handleShow, isControlled, shouldShowOnHover]);\n\n const handleMouseLeave = useCallback(() => {\n if (isControlled) {\n return;\n }\n\n if (!shouldShowOnHover) {\n return;\n }\n\n if (shouldHideOnChildrenLeave) {\n handleHide();\n\n return;\n }\n\n timeout.current = window.setTimeout(() => {\n handleHide();\n }, 500);\n }, [handleHide, isControlled, shouldHideOnChildrenLeave, shouldShowOnHover]);\n\n const handleDocumentClick = useCallback<EventListener>(\n (event) => {\n if (!popupContentRef.current?.contains(event.target as Node)) {\n handleHide();\n }\n },\n [handleHide],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleHide,\n show: handleShow,\n }),\n [handleHide, handleShow],\n );\n\n useEffect(() => {\n if (!isPopupOpen) {\n return undefined;\n }\n\n if (!isControlled && !shouldBeOpen) {\n document.addEventListener('click', handleDocumentClick, true);\n window.addEventListener('blur', handleHide);\n }\n\n return () => {\n document.removeEventListener('click', handleDocumentClick, true);\n window.removeEventListener('blur', handleHide);\n };\n }, [handleDocumentClick, handleHide, isControlled, isPopupOpen, shouldBeOpen]);\n\n useEffect(() => {\n if (previousIsVisibleRef.current === isPopupOpen) {\n return;\n }\n\n previousIsVisibleRef.current = isPopupOpen;\n\n if (isPopupOpen) {\n onShow?.();\n\n return;\n }\n\n onHide?.();\n }, [isPopupOpen, onHide, onShow]);\n\n useEffect(() => {\n if (!newContainer) {\n return;\n }\n\n setPortal(() =>\n createPortal(\n <AnimatePresence initial={false}>\n {isPopupOpen && (\n <PopupContentWrapper\n width={pseudoSize?.width ?? 0}\n offset={offset}\n shouldScrollWithContent={shouldScrollWithContent}\n coordinates={coordinates}\n key={`tooltip_${uuid}`}\n maxHeight={contentMaxHeight}\n alignment={internalAlignment}\n ref={popupContentRef}\n onMouseLeave={handleMouseLeave}\n onMouseEnter={handleMouseEnter}\n >\n <AreaContextProvider shouldChangeColor>\n {content}\n </AreaContextProvider>\n </PopupContentWrapper>\n )}\n </AnimatePresence>,\n newContainer,\n ),\n );\n }, [\n contentMaxHeight,\n internalAlignment,\n newContainer,\n content,\n coordinates,\n handleMouseEnter,\n handleMouseLeave,\n isPopupOpen,\n offset,\n pseudoSize?.width,\n uuid,\n shouldScrollWithContent,\n ]);\n\n return (\n <>\n {measuredElement}\n <StyledPopup\n className=\"beta-chayns-popup\"\n ref={popupRef}\n onClick={handleChildrenClick}\n onMouseLeave={handleMouseLeave}\n onMouseEnter={handleMouseEnter}\n $shouldUseChildrenWidth={shouldUseChildrenWidth}\n $shouldUseFullWidth={shouldUseFullWidth}\n >\n {children}\n </StyledPopup>\n {portal}\n </>\n );\n },\n);\n\nPopup.displayName = 'Popup';\n\nexport default Popup;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IACRC,UAAU,EAEVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,YAAY,QAAQ,WAAW;AACxC,SAASC,OAAO,QAAQ,kBAAkB;AAC1C,SAASC,cAAc,QAAoC,mBAAmB;AAC9E,OAAOC,mBAAmB,MAAM,sCAAsC;AACtE,OAAOC,mBAAmB,MAAM,6CAA6C;AAC7E,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,gBAAgB,QAAQ,qBAAqB;AAKtD,MAAMC,KAAK,gBAAGb,UAAU,CACpB,CACI;EACIc,SAAS;EACTC,OAAO;EACPC,MAAM;EACNC,SAAS;EACTC,MAAM;EACNC,QAAQ;EACRC,MAAM;EACNC,yBAA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C1B,CAAC;EAEF,oBACIzB,KAAA,CAAA4H,aAAA,CAAA5H,KAAA,CAAAmI,QAAA,QACK1E,eAAe,eAChBzD,KAAA,CAAA4H,aAAA,CAAChH,WAAW;IACRwH,SAAS,EAAC,mBAAmB;IAC7BvG,GAAG,EAAE+B,QAAS;IACdyE,OAAO,EAAErB,mBAAoB;IAC7BgB,YAAY,EAAEZ,gBAAiB;IAC/Ba,YAAY,EAAEf,gBAAiB;IAC/BoB,uBAAuB,EAAE9G,sBAAuB;IAChD+G,mBAAmB,EAAE7G;EAAmB,GAEvCN,QACQ,CAAC,EACbqB,MACH,CAAC;AAEX,CACJ,CAAC;AAED3B,KAAK,CAAC0H,WAAW,GAAG,OAAO;AAE3B,eAAe1H,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popup.types.js","names":[],"sources":["../../../../src/components/popup/Popup.types.ts"],"sourcesContent":["import { ReactNode } from 'react';\nimport { PopupAlignment } from '../../types/popup';\n\nexport type PopupProps = {\n /**\n * The preferred alignment of the popup relative to its trigger element.\n * @description\n * Use this prop to influence where the popup should appear around its trigger. If no alignment is provided,\n * the component automatically chooses a suitable position based on the available space.\n * @example\n * <Popup alignment={PopupAlignment.BottomRight} content=\"Details\">Open</Popup>\n * @optional\n */\n alignment?: PopupAlignment;\n /**\n * The trigger element that the popup is attached to.\n * @description\n * This content is rendered in place and acts as the interactive anchor for the popup.\n * Depending on the configured behavior, clicking or hovering this element can show or hide the popup.\n * @example\n * <Popup content=\"Details\"><button type=\"button\">Open</button></Popup>\n * @optional\n */\n children?: ReactNode;\n /**\n * The DOM element that should receive the popup portal.\n * @description\n * By default, the popup resolves a suitable container automatically. Use this prop when the popup should be rendered\n * into a specific element instead, for example to keep it inside a dialog or another scrollable area.\n * @example\n * <Popup container={document.body} content=\"Details\">Open</Popup>\n * @optional\n */\n container?: Element;\n /**\n * The content rendered inside the popup.\n * @description\n * This can be any React node, such as text, markup, or a fully custom component tree.\n * @example\n * <Popup content={<div>Additional information</div>}>Open</Popup>\n */\n content: ReactNode;\n /**\n * Fully controls whether the popup is visible.\n * @description\n * When this prop receives a boolean value, the popup becomes fully controlled from the outside.\n * Internal triggers such as click, hover, outside click, blur handling, or imperative `show` and `hide`\n * calls no longer change the visibility state. The popup is then shown only when `isOpen` is `true`\n * and hidden only when `isOpen` is `false`.\n * @example\n * <Popup isOpen={isPopupOpen} content=\"Details\">Open</Popup>\n * @optional\n */\n isOpen?: boolean;\n /**\n * Callback that is called after the popup becomes hidden.\n * @description\n * Use this callback to react to the popup closing, for example to synchronize external UI state.\n * It is called when the effective popup visibility changes from open to closed.\n * @example\n * <Popup onHide={() => console.log('Popup hidden')} content=\"Details\">Open</Popup>\n * @optional\n */\n onHide?: VoidFunction;\n /**\n * Callback that is called after the popup becomes visible.\n * @description\n * Use this callback to react to the popup opening, for example to start related UI behavior or analytics.\n * It is called when the effective popup visibility changes from closed to open.\n * @example\n * <Popup onShow={() => console.log('Popup shown')} content=\"Details\">Open</Popup>\n * @optional\n */\n onShow?: VoidFunction;\n /**\n * Hides the popup when the pointer leaves the trigger element.\n * @description\n * This prop is only relevant when `shouldShowOnHover` is enabled. When set to `true`, the popup closes immediately\n * after the pointer leaves the trigger element instead of waiting for the delayed hide behavior.\n * This prop has no effect while `isOpen` is used as a controlled prop.\n * @default false\n * @example\n * <Popup shouldShowOnHover shouldHideOnChildrenLeave content=\"Details\">Open</Popup>\n * @optional\n */\n shouldHideOnChildrenLeave?: boolean;\n /**\n * Keeps the popup aligned within the scrolling content container.\n * @description\n * When set to `true`, the popup uses the resolved container for positioning and scroll synchronization.\n * When set to `false`, it is positioned relative to the document body instead.\n * @default true\n * @example\n * <Popup shouldScrollWithContent={false} content=\"Details\">Open</Popup>\n * @optional\n */\n shouldScrollWithContent?: boolean;\n /**\n * Opens the popup when the trigger element is hovered instead of clicked.\n * @description\n * By default, the popup opens on click. Set this prop to `true` to switch to hover-based interaction.\n * This prop has no effect while `isOpen` is used as a controlled prop.\n * @default false\n * @example\n * <Popup shouldShowOnHover content=\"Details\">Open</Popup>\n * @optional\n */\n shouldShowOnHover?: boolean;\n /**\n * Uses the trigger element width as the popup width reference.\n * @description\n * When enabled, the popup measurement and layout respect the width of the trigger element.\n * Disable this when the popup should size itself more freely based on its content.\n * @default true\n * @example\n * <Popup shouldUseChildrenWidth={false} content=\"Details\">Open</Popup>\n * @optional\n */\n shouldUseChildrenWidth?: boolean;\n /**\n * Stretches the trigger element to the full available width.\n * @description\n * This affects the wrapper around the popup trigger and is useful when the trigger should behave like a block-level element.\n * @default false\n * @example\n * <Popup shouldUseFullWidth content=\"Details\">Open</Popup>\n * @optional\n */\n shouldUseFullWidth?: boolean;\n /**\n * Requests that the popup should be opened from outside.\n * @description\n * Unlike `isOpen`, this prop does not fully control visibility. It acts as an external open trigger and keeps compatibility\n * with the existing behavior, while other internal interactions may still influence the popup state.\n * Use `isOpen` when you need full external control over showing and hiding the popup.\n * @default false\n * @example\n * <Popup shouldBeOpen={shouldOpenInitially} content=\"Details\">Open</Popup>\n * @optional\n */\n shouldBeOpen?: boolean;\n /**\n * Vertical offset between the trigger element and the popup.\n * @description\n * Use this prop to fine-tune the popup position on the Y axis. Positive and negative values can be used depending on the desired spacing.\n * @default 0\n * @example\n * <Popup yOffset={8} content=\"Details\">Open</Popup>\n * @optional\n */\n yOffset?: number;\n};\n"],"mappings":"","ignoreList":[]}
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","Accordion","AccordionContent","AccordionGroup","AccordionIntro","AccordionItem","AmountControl","VerificationBadge","AreaContext","AreaProvider","Badge","Button","Checkbox","ColorSchemeProvider","useColorScheme","BadgeSize","BadgeDesign","useContainer","ContainerAnchor","DropdownDirection","useIsMeasuredClone","useCombinedRefs","Filter","AnimatedNumber","FileList","FileSelect","DropdownBodyWrapper","ComboBox","ContentCard","HighlightSlider","ContextMenu","ContextMenuAlignment","ExpandableContent","FileInput","STREAMINGSERVICE_FILE_TYPES","TSIMG_FILE_TYPES","FilterButton","FilterButtons","GridImage","GroupedImage","Icon","Input","InputSize","List","ListItemContent","ListItem","MentionFinder","MultiActionButton","NumberInput","PageProvider","Popup","PopupContent","ProgressBar","PopupAlignment","RadioButtonGroup","RadioButton","ScrollView","SearchBox","SearchInput","SelectButton","SetupWizardItem","SetupWizard","SharingContextMenu","SharingBar","SharingButton","Signature","SliderButton","Slider","SmallWaitCursor","SmallWaitCursorSize","SmallWaitCursorSpeed","TagInput","TextArea","Tooltip","Truncation","MentionFinderPopupAlignment","useElementSize","ContentCardType","isValidFileType","FilterButtonItemShape","FilterButtonSize","MultiActionButtonHeight","MultiActionButtonStatusType","ClampPosition","useIsTouch","filterFilesByMimeType","getFileAsArrayBuffer","selectFiles","isTobitEmployee","getUsableHeight","uploadFile","ComboBoxSize"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\n\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as VerificationBadge } from './components/verification-badge/VerificationBadge';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport {\n default as ColorSchemeProvider,\n useColorScheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { BadgeSize, BadgeDesign } from './components/badge/Badge.types';\nexport type {\n ColorSchemeContextProps,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { useContainer, ContainerAnchor } from './hooks/container';\nexport { DropdownDirection, type DropdownCoordinates } from './types/dropdown';\nexport { useIsMeasuredClone } from './hooks/element';\nexport { useCombinedRefs } from './hooks/ref';\nexport { default as Filter, type FilterRightIcon } from './components/filter/Filter';\nexport {\n type SortItem,\n type SearchConfig,\n type SortConfig,\n type CheckboxConfig,\n type FilterButtonConfig,\n type FilterRef,\n} from './types/filter';\nexport { default as AnimatedNumber } from './components/animated-number/AnimatedNumber';\nexport {\n default as FileList,\n type IFileItem as FileListItem,\n} from './components/file-list/FileList';\nexport { default as FileSelect } from './components/file-select/FileSelect';\nexport { default as DropdownBodyWrapper } from './components/dropdown-body-wrapper/DropdownBodyWrapper';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as HighlightSlider } from './components/highlight-slider/HighlightSlider';\nexport type { HighlightSliderItemColors as HighlightSliderColors } from './components/highlight-slider/highlight-slider-item/HighlightSliderItem';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport {\n ContextMenuAlignment,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n type ContextMenuProps,\n type ContextMenuRef,\n} from './components/context-menu/ContextMenu.types';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport {\n default as FileInput,\n type FileInputRef,\n STREAMINGSERVICE_FILE_TYPES,\n TSIMG_FILE_TYPES,\n} from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as GroupedImage } from './components/grouped-image/GroupedImage';\nexport { default as Icon, type IconProps } from './components/icon/Icon';\nexport { default as Input, InputSize } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n type ListItemRef,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as MultiActionButton } from './components/multi-action-button/MultiActionButton';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { PopupAlignment } from './types/popup';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingContextMenu } from './components/sharing-context-menu/SharingContextMenu';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as SharingButton } from './components/sharing-button/SharingButton';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport type { Tag } from './types/tagInput';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport type { TagInputRef } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/element';\nexport type { BrowserName } from './types/chayns';\nexport { ContentCardType } from './types/contentCard';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport { isValidFileType } from './utils/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport {\n type MultiActionButtonAction,\n type MultiActionButtonActionEvent,\n type MultiActionButtonActionStatus,\n MultiActionButtonHeight,\n type MultiActionButtonProps,\n MultiActionButtonStatusType,\n} from './components/multi-action-button/MultiActionButton.types';\nexport { ClampPosition } from './types/truncation';\nexport { useIsTouch } from './utils/environment';\nexport { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\nexport type { Theme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport { ComboBoxSize } from './components/combobox/ComboBox.types';\nexport type {\n IComboBoxItem as ComboBoxItem,\n ComboBoxTextStyles,\n IComboBoxItems as ComboBoxItems,\n ComboBoxRef,\n} from './components/combobox/ComboBox.types';\n"],"mappings":"AAAA;;AAEA,SAASA,OAAO,IAAIC,SAAS,QAAQ,kCAAkC;AACvE,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,2DAA2D;AACvG,SAASF,OAAO,IAAIG,cAAc,QAAQ,uDAAuD;AACjG,SAASH,OAAO,IAAII,cAAc,QAAQ,uDAAuD;AACjG,SAASJ,OAAO,IAAIK,aAAa,QAAQ,qDAAqD;AAC9F,SAASL,OAAO,IAAIM,aAAa,QAAQ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ACpG,SAAS9D,OAAO,IAAI+D,UAAU,QAAQ,qCAAqC;AAC3E,SAAS/D,OAAO,IAAIgE,aAAa,QAAQ,2CAA2C;AACpF,SAAShE,OAAO,IAAIiE,SAAS,QAAQ,kCAAkC;AAEvE,SAASjE,OAAO,IAAIkE,YAAY,QAAQ,yCAAyC;AACjF,SAASlE,OAAO,IAAImE,MAAM,QAAQ,4BAA4B;AAC9D,SACInE,OAAO,IAAIoE,eAAe,EAC1BC,mBAAmB,EACnBC,oBAAoB,QACjB,gDAAgD;AAEvD,SAAStE,OAAO,IAAIuE,QAAQ,QAAQ,iCAAiC;AAErE,SAASvE,OAAO,IAAIwE,QAAQ,QAAQ,iCAAiC;AACrE,SAASxE,OAAO,IAAIyE,OAAO,QAAQ,8BAA8B;AACjE,SAASzE,OAAO,IAAI0E,UAAU,QAAQ,oCAAoC;AAC1E,SAASC,2BAA2B,QAAQ,2BAA2B;AACvE,SAASC,cAAc,QAAQ,iBAAiB;AAEhD,SAASC,eAAe,QAAQ,qBAAqB;AAErD,SAASC,eAAe,QAAQ,cAAc;AAE9C,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ,uBAAuB;AAW/E,SAIIC,uBAAuB,EAEvBC,2BAA2B,QACxB,0DAA0D;AACjE,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,UAAU,QAAQ,qBAAqB;AAChD,SAASC,qBAAqB,EAAEC,oBAAoB,EAAEC,WAAW,QAAQ,oBAAoB;AAC7F,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,UAAU,QAAQ,oBAAoB;AAE/C,SAASC,YAAY,QAAQ,sCAAsC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","Accordion","AccordionContent","AccordionGroup","AccordionIntro","AccordionItem","AmountControl","VerificationBadge","AreaContext","AreaProvider","Badge","Button","Checkbox","ColorSchemeProvider","useColorScheme","BadgeSize","BadgeDesign","useContainer","ContainerAnchor","DropdownDirection","useIsMeasuredClone","useCombinedRefs","Filter","AnimatedNumber","FileList","FileSelect","DropdownBodyWrapper","ComboBox","ContentCard","HighlightSlider","ContextMenu","ContextMenuAlignment","ExpandableContent","FileInput","STREAMINGSERVICE_FILE_TYPES","TSIMG_FILE_TYPES","FilterButton","FilterButtons","GridImage","GroupedImage","Icon","Input","InputSize","List","ListItemContent","ListItem","MentionFinder","MultiActionButton","NumberInput","PageProvider","Popup","PopupContent","ProgressBar","PopupAlignment","RadioButtonGroup","RadioButton","ScrollView","SearchBox","SearchInput","SelectButton","SetupWizardItem","SetupWizard","SharingContextMenu","SharingBar","SharingButton","Signature","SliderButton","Slider","SmallWaitCursor","SmallWaitCursorSize","SmallWaitCursorSpeed","TagInput","TextArea","Tooltip","Truncation","MentionFinderPopupAlignment","useElementSize","ContentCardType","isValidFileType","FilterButtonItemShape","FilterButtonSize","MultiActionButtonHeight","MultiActionButtonStatusType","ClampPosition","useIsTouch","filterFilesByMimeType","getFileAsArrayBuffer","selectFiles","isTobitEmployee","getUsableHeight","uploadFile","ComboBoxSize"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\n\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as VerificationBadge } from './components/verification-badge/VerificationBadge';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport {\n default as ColorSchemeProvider,\n useColorScheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { BadgeSize, BadgeDesign } from './components/badge/Badge.types';\nexport type {\n ColorSchemeContextProps,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { useContainer, ContainerAnchor } from './hooks/container';\nexport { DropdownDirection, type DropdownCoordinates } from './types/dropdown';\nexport { useIsMeasuredClone } from './hooks/element';\nexport { useCombinedRefs } from './hooks/ref';\nexport { default as Filter, type FilterRightIcon } from './components/filter/Filter';\nexport {\n type SortItem,\n type SearchConfig,\n type SortConfig,\n type CheckboxConfig,\n type FilterButtonConfig,\n type FilterRef,\n} from './types/filter';\nexport { default as AnimatedNumber } from './components/animated-number/AnimatedNumber';\nexport {\n default as FileList,\n type IFileItem as FileListItem,\n} from './components/file-list/FileList';\nexport { default as FileSelect } from './components/file-select/FileSelect';\nexport { default as DropdownBodyWrapper } from './components/dropdown-body-wrapper/DropdownBodyWrapper';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as HighlightSlider } from './components/highlight-slider/HighlightSlider';\nexport type { HighlightSliderItemColors as HighlightSliderColors } from './components/highlight-slider/highlight-slider-item/HighlightSliderItem';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport {\n ContextMenuAlignment,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n type ContextMenuProps,\n type ContextMenuRef,\n} from './components/context-menu/ContextMenu.types';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport {\n default as FileInput,\n type FileInputRef,\n STREAMINGSERVICE_FILE_TYPES,\n TSIMG_FILE_TYPES,\n} from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as GroupedImage } from './components/grouped-image/GroupedImage';\nexport { default as Icon, type IconProps } from './components/icon/Icon';\nexport { default as Input, InputSize } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n type ListItemRef,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as MultiActionButton } from './components/multi-action-button/MultiActionButton';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { PopupAlignment } from './types/popup';\nexport type { PopupProps } from './components/popup/Popup.types';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingContextMenu } from './components/sharing-context-menu/SharingContextMenu';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as SharingButton } from './components/sharing-button/SharingButton';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport type { Tag } from './types/tagInput';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport type { TagInputRef } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/element';\nexport type { BrowserName } from './types/chayns';\nexport { ContentCardType } from './types/contentCard';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport { isValidFileType } from './utils/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport {\n type MultiActionButtonAction,\n type MultiActionButtonActionEvent,\n type MultiActionButtonActionStatus,\n MultiActionButtonHeight,\n type MultiActionButtonProps,\n MultiActionButtonStatusType,\n} from './components/multi-action-button/MultiActionButton.types';\nexport { ClampPosition } from './types/truncation';\nexport { useIsTouch } from './utils/environment';\nexport { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\nexport type { Theme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport { ComboBoxSize } from './components/combobox/ComboBox.types';\nexport type {\n IComboBoxItem as ComboBoxItem,\n ComboBoxTextStyles,\n IComboBoxItems as ComboBoxItems,\n ComboBoxRef,\n} from './components/combobox/ComboBox.types';\n"],"mappings":"AAAA;;AAEA,SAASA,OAAO,IAAIC,SAAS,QAAQ,kCAAkC;AACvE,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,2DAA2D;AACvG,SAASF,OAAO,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+1,6 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* The alignment of the popup. By default, the popup will calculate the best alignment.
|
|
6
|
-
*/
|
|
7
|
-
alignment?: PopupAlignment;
|
|
8
|
-
/**
|
|
9
|
-
* The element over which the content of the `ContextMenu` should be displayed.
|
|
10
|
-
*/
|
|
11
|
-
children?: ReactNode;
|
|
12
|
-
/**
|
|
13
|
-
* The element where the content of the `Popup` should be rendered via React Portal.
|
|
14
|
-
*/
|
|
15
|
-
container?: Element;
|
|
16
|
-
/**
|
|
17
|
-
* The content that should be displayed inside the popup.
|
|
18
|
-
*/
|
|
19
|
-
content: ReactNode;
|
|
20
|
-
/**
|
|
21
|
-
* Function to be executed when the content of the Context menu has been hidden.
|
|
22
|
-
*/
|
|
23
|
-
onHide?: VoidFunction;
|
|
24
|
-
/**
|
|
25
|
-
* Function to be executed when the content of the Context menu has been shown.
|
|
26
|
-
*/
|
|
27
|
-
onShow?: VoidFunction;
|
|
28
|
-
/**
|
|
29
|
-
* Whether the tooltip should be hidden after the children is not hovered.
|
|
30
|
-
*/
|
|
31
|
-
shouldHideOnChildrenLeave?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Whether the popup should scroll with the content.
|
|
34
|
-
*/
|
|
35
|
-
shouldScrollWithContent?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Whether the popup should be opened on hover. If not, the popup will be opened on click.
|
|
38
|
-
*/
|
|
39
|
-
shouldShowOnHover?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Whether the width of the children should be used.
|
|
42
|
-
*/
|
|
43
|
-
shouldUseChildrenWidth?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Whether the popup children should use the full width.
|
|
46
|
-
*/
|
|
47
|
-
shouldUseFullWidth?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* The Y offset of the popup to the children.
|
|
50
|
-
*/
|
|
51
|
-
yOffset?: number;
|
|
52
|
-
/**
|
|
53
|
-
* Whether the popup should be open. This can be used to control the popup from outside.
|
|
54
|
-
*/
|
|
55
|
-
shouldBeOpen?: boolean;
|
|
56
|
-
};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PopupRef } from '../../types/popup';
|
|
3
|
+
import type { PopupProps } from './Popup.types';
|
|
4
|
+
export type { PopupProps } from './Popup.types';
|
|
57
5
|
declare const Popup: React.ForwardRefExoticComponent<PopupProps & React.RefAttributes<PopupRef>>;
|
|
58
6
|
export default Popup;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { PopupAlignment } from '../../types/popup';
|
|
3
|
+
export type PopupProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The preferred alignment of the popup relative to its trigger element.
|
|
6
|
+
* @description
|
|
7
|
+
* Use this prop to influence where the popup should appear around its trigger. If no alignment is provided,
|
|
8
|
+
* the component automatically chooses a suitable position based on the available space.
|
|
9
|
+
* @example
|
|
10
|
+
* <Popup alignment={PopupAlignment.BottomRight} content="Details">Open</Popup>
|
|
11
|
+
* @optional
|
|
12
|
+
*/
|
|
13
|
+
alignment?: PopupAlignment;
|
|
14
|
+
/**
|
|
15
|
+
* The trigger element that the popup is attached to.
|
|
16
|
+
* @description
|
|
17
|
+
* This content is rendered in place and acts as the interactive anchor for the popup.
|
|
18
|
+
* Depending on the configured behavior, clicking or hovering this element can show or hide the popup.
|
|
19
|
+
* @example
|
|
20
|
+
* <Popup content="Details"><button type="button">Open</button></Popup>
|
|
21
|
+
* @optional
|
|
22
|
+
*/
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* The DOM element that should receive the popup portal.
|
|
26
|
+
* @description
|
|
27
|
+
* By default, the popup resolves a suitable container automatically. Use this prop when the popup should be rendered
|
|
28
|
+
* into a specific element instead, for example to keep it inside a dialog or another scrollable area.
|
|
29
|
+
* @example
|
|
30
|
+
* <Popup container={document.body} content="Details">Open</Popup>
|
|
31
|
+
* @optional
|
|
32
|
+
*/
|
|
33
|
+
container?: Element;
|
|
34
|
+
/**
|
|
35
|
+
* The content rendered inside the popup.
|
|
36
|
+
* @description
|
|
37
|
+
* This can be any React node, such as text, markup, or a fully custom component tree.
|
|
38
|
+
* @example
|
|
39
|
+
* <Popup content={<div>Additional information</div>}>Open</Popup>
|
|
40
|
+
*/
|
|
41
|
+
content: ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* Fully controls whether the popup is visible.
|
|
44
|
+
* @description
|
|
45
|
+
* When this prop receives a boolean value, the popup becomes fully controlled from the outside.
|
|
46
|
+
* Internal triggers such as click, hover, outside click, blur handling, or imperative `show` and `hide`
|
|
47
|
+
* calls no longer change the visibility state. The popup is then shown only when `isOpen` is `true`
|
|
48
|
+
* and hidden only when `isOpen` is `false`.
|
|
49
|
+
* @example
|
|
50
|
+
* <Popup isOpen={isPopupOpen} content="Details">Open</Popup>
|
|
51
|
+
* @optional
|
|
52
|
+
*/
|
|
53
|
+
isOpen?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Callback that is called after the popup becomes hidden.
|
|
56
|
+
* @description
|
|
57
|
+
* Use this callback to react to the popup closing, for example to synchronize external UI state.
|
|
58
|
+
* It is called when the effective popup visibility changes from open to closed.
|
|
59
|
+
* @example
|
|
60
|
+
* <Popup onHide={() => console.log('Popup hidden')} content="Details">Open</Popup>
|
|
61
|
+
* @optional
|
|
62
|
+
*/
|
|
63
|
+
onHide?: VoidFunction;
|
|
64
|
+
/**
|
|
65
|
+
* Callback that is called after the popup becomes visible.
|
|
66
|
+
* @description
|
|
67
|
+
* Use this callback to react to the popup opening, for example to start related UI behavior or analytics.
|
|
68
|
+
* It is called when the effective popup visibility changes from closed to open.
|
|
69
|
+
* @example
|
|
70
|
+
* <Popup onShow={() => console.log('Popup shown')} content="Details">Open</Popup>
|
|
71
|
+
* @optional
|
|
72
|
+
*/
|
|
73
|
+
onShow?: VoidFunction;
|
|
74
|
+
/**
|
|
75
|
+
* Hides the popup when the pointer leaves the trigger element.
|
|
76
|
+
* @description
|
|
77
|
+
* This prop is only relevant when `shouldShowOnHover` is enabled. When set to `true`, the popup closes immediately
|
|
78
|
+
* after the pointer leaves the trigger element instead of waiting for the delayed hide behavior.
|
|
79
|
+
* This prop has no effect while `isOpen` is used as a controlled prop.
|
|
80
|
+
* @default false
|
|
81
|
+
* @example
|
|
82
|
+
* <Popup shouldShowOnHover shouldHideOnChildrenLeave content="Details">Open</Popup>
|
|
83
|
+
* @optional
|
|
84
|
+
*/
|
|
85
|
+
shouldHideOnChildrenLeave?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Keeps the popup aligned within the scrolling content container.
|
|
88
|
+
* @description
|
|
89
|
+
* When set to `true`, the popup uses the resolved container for positioning and scroll synchronization.
|
|
90
|
+
* When set to `false`, it is positioned relative to the document body instead.
|
|
91
|
+
* @default true
|
|
92
|
+
* @example
|
|
93
|
+
* <Popup shouldScrollWithContent={false} content="Details">Open</Popup>
|
|
94
|
+
* @optional
|
|
95
|
+
*/
|
|
96
|
+
shouldScrollWithContent?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Opens the popup when the trigger element is hovered instead of clicked.
|
|
99
|
+
* @description
|
|
100
|
+
* By default, the popup opens on click. Set this prop to `true` to switch to hover-based interaction.
|
|
101
|
+
* This prop has no effect while `isOpen` is used as a controlled prop.
|
|
102
|
+
* @default false
|
|
103
|
+
* @example
|
|
104
|
+
* <Popup shouldShowOnHover content="Details">Open</Popup>
|
|
105
|
+
* @optional
|
|
106
|
+
*/
|
|
107
|
+
shouldShowOnHover?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Uses the trigger element width as the popup width reference.
|
|
110
|
+
* @description
|
|
111
|
+
* When enabled, the popup measurement and layout respect the width of the trigger element.
|
|
112
|
+
* Disable this when the popup should size itself more freely based on its content.
|
|
113
|
+
* @default true
|
|
114
|
+
* @example
|
|
115
|
+
* <Popup shouldUseChildrenWidth={false} content="Details">Open</Popup>
|
|
116
|
+
* @optional
|
|
117
|
+
*/
|
|
118
|
+
shouldUseChildrenWidth?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Stretches the trigger element to the full available width.
|
|
121
|
+
* @description
|
|
122
|
+
* This affects the wrapper around the popup trigger and is useful when the trigger should behave like a block-level element.
|
|
123
|
+
* @default false
|
|
124
|
+
* @example
|
|
125
|
+
* <Popup shouldUseFullWidth content="Details">Open</Popup>
|
|
126
|
+
* @optional
|
|
127
|
+
*/
|
|
128
|
+
shouldUseFullWidth?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Requests that the popup should be opened from outside.
|
|
131
|
+
* @description
|
|
132
|
+
* Unlike `isOpen`, this prop does not fully control visibility. It acts as an external open trigger and keeps compatibility
|
|
133
|
+
* with the existing behavior, while other internal interactions may still influence the popup state.
|
|
134
|
+
* Use `isOpen` when you need full external control over showing and hiding the popup.
|
|
135
|
+
* @default false
|
|
136
|
+
* @example
|
|
137
|
+
* <Popup shouldBeOpen={shouldOpenInitially} content="Details">Open</Popup>
|
|
138
|
+
* @optional
|
|
139
|
+
*/
|
|
140
|
+
shouldBeOpen?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Vertical offset between the trigger element and the popup.
|
|
143
|
+
* @description
|
|
144
|
+
* Use this prop to fine-tune the popup position on the Y axis. Positive and negative values can be used depending on the desired spacing.
|
|
145
|
+
* @default 0
|
|
146
|
+
* @example
|
|
147
|
+
* <Popup yOffset={8} content="Details">Open</Popup>
|
|
148
|
+
* @optional
|
|
149
|
+
*/
|
|
150
|
+
yOffset?: number;
|
|
151
|
+
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export { default as Popup } from './components/popup/Popup';
|
|
|
48
48
|
export { default as PopupContent } from './components/popup/popup-content/PopupContent';
|
|
49
49
|
export { default as ProgressBar } from './components/progress-bar/ProgressBar';
|
|
50
50
|
export { PopupAlignment } from './types/popup';
|
|
51
|
+
export type { PopupProps } from './components/popup/Popup.types';
|
|
51
52
|
export { default as RadioButtonGroup, type RadioButtonGroupRef, } from './components/radio-button/radio-button-group/RadioButtonGroup';
|
|
52
53
|
export { default as RadioButton } from './components/radio-button/RadioButton';
|
|
53
54
|
export { default as ScrollView } from './components/scroll-view/ScrollView';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.47",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"browserslist": [
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "61763dfb8b0044595dedc804061e3c8f26f42a8c"
|
|
91
91
|
}
|