@geneui/components 2.12.1 → 2.12.2

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.
Files changed (93) hide show
  1. package/ActionableList/index.js +1 -1
  2. package/AdvancedSearch/index.js +2 -3
  3. package/Alert/index.js +1 -1
  4. package/Avatar/index.js +1 -1
  5. package/Badge/index.js +1 -1
  6. package/Breadcrumb/index.js +1 -1
  7. package/BusyLoader/index.js +1 -1
  8. package/Button/index.js +1 -1
  9. package/CHANGELOG.md +13 -0
  10. package/Card/index.js +1 -1
  11. package/CardList/index.js +9 -7
  12. package/{CellMeasurerCache-bc2163c1.js → CellMeasurerCache-3741d716.js} +1 -1
  13. package/Charts/index.js +23 -23
  14. package/CheckboxGroupWithSearch/index.js +2 -2
  15. package/Collapse/index.js +1 -1
  16. package/ColorPicker/index.js +1 -1
  17. package/ComboBox/index.js +2 -2
  18. package/Counter/index.js +1 -1
  19. package/DateFilter/index.js +2 -3
  20. package/DatePicker/index.js +1 -1
  21. package/DatePickerInput/index.js +14 -14
  22. package/Divider/index.js +1 -1
  23. package/Drawer/index.js +1 -1
  24. package/Dropdown/index.js +4 -4
  25. package/Editor/index.js +1 -1
  26. package/Empty/index.js +1 -1
  27. package/ExtendedInput/index.js +2 -2
  28. package/Form/index.js +7 -10
  29. package/FormContainer/index.js +1 -1
  30. package/FormableDatePicker/index.js +1 -2
  31. package/FormableDropdown/index.js +6 -6
  32. package/FormableMultiSelectDropdown/index.js +6 -6
  33. package/GeneUIProvider/index.js +1 -1
  34. package/Grid/index.js +1 -1
  35. package/Holder/index.js +1 -1
  36. package/Icon/index.js +1 -1
  37. package/Image/index.js +1 -1
  38. package/ImagePreview/index.js +1 -1
  39. package/KeyValue/index.js +1 -1
  40. package/Label/index.js +1 -1
  41. package/LinkButton/index.js +1 -1
  42. package/Menu/index.js +1 -1
  43. package/MobileNavigation/index.js +1 -1
  44. package/MobilePopup/index.js +1 -1
  45. package/Modal/index.js +1 -1
  46. package/ModuleTitle/index.js +1 -1
  47. package/NavigationMenu/index.js +1 -1
  48. package/Notification/index.js +1 -1
  49. package/Option/index.js +1 -1
  50. package/Overlay/index.js +1 -1
  51. package/Overspread/index.js +5 -3
  52. package/Pagination/index.js +1 -1
  53. package/Paper/index.js +1 -1
  54. package/Popover/index.js +1 -1
  55. package/PopoverV2/index.js +16 -987
  56. package/Products/index.js +1 -1
  57. package/Profile/index.js +1 -1
  58. package/Progress/index.js +1 -1
  59. package/RichEditor/index.js +1 -1
  60. package/{RichEditor-8b9c3afa.js → RichEditor-8b0f7ccd.js} +1 -1
  61. package/Scrollbar/index.js +1 -1
  62. package/SearchWithDropdown/index.js +6 -6
  63. package/Section/index.js +1 -1
  64. package/SkeletonLoader/index.js +1 -1
  65. package/Status/index.js +1 -1
  66. package/Steps/index.js +1 -1
  67. package/SuggestionList/index.js +1 -1
  68. package/Switcher/index.js +1 -1
  69. package/Table/index.js +5 -5
  70. package/TableCompositions/index.js +12 -13
  71. package/Tabs/index.js +1 -1
  72. package/Tag/index.js +1 -1
  73. package/Time/index.js +1 -1
  74. package/TimePicker/index.js +2 -3
  75. package/Timeline/index.js +2 -2
  76. package/Title/index.js +1 -1
  77. package/Toaster/index.js +1 -1
  78. package/Tooltip/index.js +1 -1
  79. package/TransferList/index.js +3 -3
  80. package/Uploader/index.js +4 -4
  81. package/ValidatableDatePicker/index.js +1 -2
  82. package/ValidatableDropdown/index.js +7 -7
  83. package/ValidatableElements/index.js +7 -10
  84. package/ValidatableMultiSelectDropdown/index.js +7 -7
  85. package/ValidatableNumberInput/index.js +7 -0
  86. package/Widget/index.js +6 -6
  87. package/{index-78d2ea5b.js → index-11eea761.js} +7 -7
  88. package/{index-583e0b30.js → index-2ad83e03.js} +1 -1
  89. package/{index-bd525a3a.js → index-34e47647.js} +4 -4
  90. package/index-462461c0.js +1940 -0
  91. package/index.js +6 -7
  92. package/package.json +1 -1
  93. package/jsx-runtime-57b40d9e.js +0 -957
@@ -1,989 +1,18 @@
1
- import { _ as _extends } from '../_rollupPluginBabelHelpers-e8fb2e5c.js';
2
- import React__default, { forwardRef, useContext, useRef, useState, useMemo, useEffect, useCallback } from 'react';
3
- import { c as commonjsGlobal } from '../_commonjsHelpers-24198af3.js';
4
- import { j as jsxRuntimeExports } from '../jsx-runtime-57b40d9e.js';
5
- import ReactDOM__default from 'react-dom';
6
- import { u as useSwipeable } from '../index-122432cd.js';
7
- import { c as classnames } from '../index-6ff23041.js';
8
- import PropTypes from 'prop-types';
9
- import { n as noop, s as stopEvent } from '../index-a0e4e333.js';
10
- import useDeviceType from '../hooks/useDeviceType.js';
11
- import useClickOutside from '../hooks/useClickOutside.js';
12
- import { g as popoverV2Config, s as screenTypes } from '../configs-fed6ac34.js';
13
- import CustomScrollbar from '../Scrollbar/index.js';
14
- import { GeneUIDesignSystemContext } from '../GeneUIProvider/index.js';
15
- import { s as styleInject } from '../style-inject.es-746bb8ed.js';
16
- import { d as debounce } from '../debounce-4419bc2f.js';
1
+ import '../_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import 'react';
3
+ export { P as default } from '../index-462461c0.js';
4
+ import '../index-122432cd.js';
5
+ import '../index-6ff23041.js';
6
+ import 'prop-types';
7
+ import '../index-a0e4e333.js';
8
+ import '../hooks/useDeviceType.js';
9
+ import '../hooks/useClickOutside.js';
10
+ import '../configs-fed6ac34.js';
11
+ import '../Scrollbar/index.js';
12
+ import '../GeneUIProvider/index.js';
13
+ import '../debounce-4419bc2f.js';
14
+ import '../_commonjsHelpers-24198af3.js';
15
+ import 'react-dom';
16
+ import '../style-inject.es-746bb8ed.js';
17
17
  import '../dateValidation-67caec66.js';
18
18
  import '../hooks/useWindowSize.js';
19
-
20
- var Popover = {};
21
-
22
- var PopoverPortal$1 = {};
23
-
24
- Object.defineProperty(PopoverPortal$1, "__esModule", { value: true });
25
- PopoverPortal$1.PopoverPortal = void 0;
26
- var react_1$5 = React__default;
27
- var react_dom_1 = ReactDOM__default;
28
- var PopoverPortal = function (_a) {
29
- var container = _a.container, element = _a.element, children = _a.children;
30
- react_1$5.useLayoutEffect(function () {
31
- container.appendChild(element);
32
- return function () {
33
- container.removeChild(element);
34
- };
35
- }, [container, element]);
36
- return react_dom_1.createPortal(children, element);
37
- };
38
- PopoverPortal$1.PopoverPortal = PopoverPortal;
39
-
40
- var util = {};
41
-
42
- (function (exports) {
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.getNudgedPopoverRect = exports.getNewPopoverRect = exports.popoverRectForPosition = exports.createContainer = exports.targetPositionHasChanged = exports.popoverStatesAreEqual = exports.rectsAreEqual = exports.arrayUnique = exports.Constants = void 0;
45
- exports.Constants = {
46
- POPOVER_CONTAINER_CLASS_NAME: 'react-tiny-popover-container',
47
- DEFAULT_ALIGN: 'center',
48
- OBSERVER_THRESHOLDS: Array(1000)
49
- .fill(null)
50
- .map(function (_, i) { return i / 1000; })
51
- .reverse(),
52
- DEFAULT_POSITIONS: ['top', 'left', 'right', 'bottom'],
53
- EMPTY_CLIENT_RECT: {
54
- top: 0,
55
- left: 0,
56
- bottom: 0,
57
- height: 0,
58
- right: 0,
59
- width: 0,
60
- },
61
- };
62
- var arrayUnique = function (array) {
63
- return array.filter(function (value, index, self) { return self.indexOf(value) === index; });
64
- };
65
- exports.arrayUnique = arrayUnique;
66
- var rectsAreEqual = function (rectA, rectB) {
67
- return rectA === rectB ||
68
- ((rectA === null || rectA === void 0 ? void 0 : rectA.bottom) === (rectB === null || rectB === void 0 ? void 0 : rectB.bottom) &&
69
- (rectA === null || rectA === void 0 ? void 0 : rectA.height) === (rectB === null || rectB === void 0 ? void 0 : rectB.height) &&
70
- (rectA === null || rectA === void 0 ? void 0 : rectA.left) === (rectB === null || rectB === void 0 ? void 0 : rectB.left) &&
71
- (rectA === null || rectA === void 0 ? void 0 : rectA.right) === (rectB === null || rectB === void 0 ? void 0 : rectB.right) &&
72
- (rectA === null || rectA === void 0 ? void 0 : rectA.top) === (rectB === null || rectB === void 0 ? void 0 : rectB.top) &&
73
- (rectA === null || rectA === void 0 ? void 0 : rectA.width) === (rectB === null || rectB === void 0 ? void 0 : rectB.width));
74
- };
75
- exports.rectsAreEqual = rectsAreEqual;
76
- var popoverStatesAreEqual = function (stateA, stateB) {
77
- return stateA === stateB ||
78
- ((stateA === null || stateA === void 0 ? void 0 : stateA.align) === (stateB === null || stateB === void 0 ? void 0 : stateB.align) &&
79
- (stateA === null || stateA === void 0 ? void 0 : stateA.nudgedLeft) === (stateB === null || stateB === void 0 ? void 0 : stateB.nudgedLeft) &&
80
- (stateA === null || stateA === void 0 ? void 0 : stateA.nudgedTop) === (stateB === null || stateB === void 0 ? void 0 : stateB.nudgedTop) &&
81
- stateA.padding === stateB.padding &&
82
- exports.rectsAreEqual(stateA === null || stateA === void 0 ? void 0 : stateA.popoverRect, stateB === null || stateB === void 0 ? void 0 : stateB.popoverRect) &&
83
- exports.rectsAreEqual(stateA === null || stateA === void 0 ? void 0 : stateA.childRect, stateB === null || stateB === void 0 ? void 0 : stateB.childRect) &&
84
- (stateA === null || stateA === void 0 ? void 0 : stateA.position) === (stateB === null || stateB === void 0 ? void 0 : stateB.position));
85
- };
86
- exports.popoverStatesAreEqual = popoverStatesAreEqual;
87
- var targetPositionHasChanged = function (oldRect, newRect) {
88
- return oldRect === undefined ||
89
- oldRect.left !== newRect.left ||
90
- oldRect.top !== newRect.top ||
91
- oldRect.width !== newRect.width ||
92
- oldRect.height !== newRect.height;
93
- };
94
- exports.targetPositionHasChanged = targetPositionHasChanged;
95
- var createContainer = function (containerStyle, containerClassName) {
96
- var container = window.document.createElement('div');
97
- if (containerClassName)
98
- container.className = containerClassName;
99
- Object.assign(container.style, containerStyle);
100
- return container;
101
- };
102
- exports.createContainer = createContainer;
103
- var popoverRectForPosition = function (position, childRect, popoverRect, padding, align) {
104
- var targetMidX = childRect.left + childRect.width / 2;
105
- var targetMidY = childRect.top + childRect.height / 2;
106
- var width = popoverRect.width, height = popoverRect.height;
107
- var top;
108
- var left;
109
- switch (position) {
110
- case 'left':
111
- top = targetMidY - height / 2;
112
- left = childRect.left - padding - width;
113
- if (align === 'start') {
114
- top = childRect.top;
115
- }
116
- if (align === 'end') {
117
- top = childRect.bottom - height;
118
- }
119
- break;
120
- case 'bottom':
121
- top = childRect.bottom + padding;
122
- left = targetMidX - width / 2;
123
- if (align === 'start') {
124
- left = childRect.left;
125
- }
126
- if (align === 'end') {
127
- left = childRect.right - width;
128
- }
129
- break;
130
- case 'right':
131
- top = targetMidY - height / 2;
132
- left = childRect.right + padding;
133
- if (align === 'start') {
134
- top = childRect.top;
135
- }
136
- if (align === 'end') {
137
- top = childRect.bottom - height;
138
- }
139
- break;
140
- default:
141
- top = childRect.top - height - padding;
142
- left = targetMidX - width / 2;
143
- if (align === 'start') {
144
- left = childRect.left;
145
- }
146
- if (align === 'end') {
147
- left = childRect.right - width;
148
- }
149
- break;
150
- }
151
- return { top: top, left: left, width: width, height: height, right: left + width, bottom: top + height };
152
- };
153
- exports.popoverRectForPosition = popoverRectForPosition;
154
- var getNewPopoverRect = function (_a, boundaryInset) {
155
- var position = _a.position, align = _a.align, childRect = _a.childRect, popoverRect = _a.popoverRect, parentRect = _a.parentRect, padding = _a.padding, reposition = _a.reposition;
156
- var rect = exports.popoverRectForPosition(position, childRect, popoverRect, padding, align);
157
- var boundaryViolation = reposition &&
158
- ((position === 'top' && rect.top < parentRect.top + boundaryInset) ||
159
- (position === 'left' && rect.left < parentRect.left + boundaryInset) ||
160
- (position === 'right' && rect.right > parentRect.right - boundaryInset) ||
161
- (position === 'bottom' && rect.bottom > parentRect.bottom - boundaryInset));
162
- return {
163
- rect: rect,
164
- boundaryViolation: boundaryViolation,
165
- };
166
- };
167
- exports.getNewPopoverRect = getNewPopoverRect;
168
- var getNudgedPopoverRect = function (popoverRect, parentRect, boundaryInset) {
169
- var topBoundary = parentRect.top + boundaryInset;
170
- var leftBoundary = parentRect.left + boundaryInset;
171
- var rightBoundary = parentRect.right - boundaryInset;
172
- var bottomBoundary = parentRect.bottom - boundaryInset;
173
- var top = popoverRect.top < topBoundary ? topBoundary : popoverRect.top;
174
- top = top + popoverRect.height > bottomBoundary ? bottomBoundary - popoverRect.height : top;
175
- var left = popoverRect.left < leftBoundary ? leftBoundary : popoverRect.left;
176
- left = left + popoverRect.width > rightBoundary ? rightBoundary - popoverRect.width : left;
177
- return {
178
- top: top,
179
- left: left,
180
- width: popoverRect.width,
181
- height: popoverRect.height,
182
- right: left + popoverRect.width,
183
- bottom: top + popoverRect.height,
184
- };
185
- };
186
- exports.getNudgedPopoverRect = getNudgedPopoverRect;
187
-
188
- } (util));
189
-
190
- var usePopover$1 = {};
191
-
192
- var useElementRef$1 = {};
193
-
194
- Object.defineProperty(useElementRef$1, "__esModule", { value: true });
195
- useElementRef$1.useElementRef = void 0;
196
- var react_1$4 = React__default;
197
- var util_1$1 = util;
198
- var useElementRef = function (containerClassName, containerStyle) {
199
- var element = react_1$4.useMemo(function () { return util_1$1.createContainer(containerStyle, containerClassName); }, [containerClassName, containerStyle]);
200
- return react_1$4.useRef(element);
201
- };
202
- useElementRef$1.useElementRef = useElementRef;
203
-
204
- Object.defineProperty(usePopover$1, "__esModule", { value: true });
205
- usePopover$1.usePopover = void 0;
206
- var react_1$3 = React__default;
207
- var util_1 = util;
208
- var useElementRef_1 = useElementRef$1;
209
- var usePopover = function (_a) {
210
- var childRef = _a.childRef, positions = _a.positions, containerClassName = _a.containerClassName, containerParent = _a.containerParent, contentLocation = _a.contentLocation, align = _a.align, padding = _a.padding, reposition = _a.reposition, boundaryInset = _a.boundaryInset, onPositionPopover = _a.onPositionPopover;
211
- var popoverRef = useElementRef_1.useElementRef(containerClassName, {
212
- position: 'fixed',
213
- overflow: 'visible',
214
- top: '0px',
215
- left: '0px',
216
- });
217
- var positionPopover = react_1$3.useCallback(function (positionIndex, childRect, popoverRect, parentRect) {
218
- var _a;
219
- if (positionIndex === void 0) { positionIndex = 0; }
220
- if (childRect === void 0) { childRect = (_a = childRef === null || childRef === void 0 ? void 0 : childRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(); }
221
- if (popoverRect === void 0) { popoverRect = popoverRef.current.getBoundingClientRect(); }
222
- if (parentRect === void 0) { parentRect = containerParent === null || containerParent === void 0 ? void 0 : containerParent.getBoundingClientRect(); }
223
- if (!childRect || !parentRect) {
224
- return;
225
- }
226
- if (contentLocation) {
227
- var _b = typeof contentLocation === 'function'
228
- ? contentLocation({
229
- childRect: childRect,
230
- popoverRect: popoverRect,
231
- parentRect: parentRect,
232
- padding: padding,
233
- nudgedTop: 0,
234
- nudgedLeft: 0,
235
- boundaryInset: boundaryInset,
236
- })
237
- : contentLocation, inputTop = _b.top, inputLeft = _b.left;
238
- var left_1 = parentRect.left + inputLeft;
239
- var top_1 = parentRect.top + inputTop;
240
- popoverRef.current.style.transform = "translate(" + left_1 + "px, " + top_1 + "px)";
241
- onPositionPopover({
242
- childRect: childRect,
243
- popoverRect: popoverRect,
244
- parentRect: parentRect,
245
- padding: padding,
246
- nudgedTop: 0,
247
- nudgedLeft: 0,
248
- boundaryInset: boundaryInset,
249
- });
250
- return;
251
- }
252
- var isExhausted = positionIndex === positions.length;
253
- var position = isExhausted ? positions[0] : positions[positionIndex];
254
- var _c = util_1.getNewPopoverRect({
255
- childRect: childRect,
256
- popoverRect: popoverRect,
257
- parentRect: parentRect,
258
- position: position,
259
- align: align,
260
- padding: padding,
261
- reposition: reposition,
262
- }, boundaryInset), rect = _c.rect, boundaryViolation = _c.boundaryViolation;
263
- if (boundaryViolation && reposition && !isExhausted) {
264
- positionPopover(positionIndex + 1, childRect, popoverRect, parentRect);
265
- return;
266
- }
267
- var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
268
- var shouldNudge = reposition && !isExhausted;
269
- var _d = util_1.getNudgedPopoverRect(rect, parentRect, boundaryInset), nudgedLeft = _d.left, nudgedTop = _d.top;
270
- var finalTop = top;
271
- var finalLeft = left;
272
- if (shouldNudge) {
273
- finalTop = nudgedTop;
274
- finalLeft = nudgedLeft;
275
- }
276
- popoverRef.current.style.transform = "translate(" + finalLeft + "px, " + finalTop + "px)";
277
- onPositionPopover({
278
- childRect: childRect,
279
- popoverRect: {
280
- top: finalTop,
281
- left: finalLeft,
282
- width: width,
283
- height: height,
284
- right: finalLeft + width,
285
- bottom: finalTop + height,
286
- },
287
- parentRect: parentRect,
288
- position: position,
289
- align: align,
290
- padding: padding,
291
- nudgedTop: nudgedTop - top,
292
- nudgedLeft: nudgedLeft - left,
293
- boundaryInset: boundaryInset,
294
- });
295
- }, [
296
- childRef,
297
- popoverRef,
298
- positions,
299
- align,
300
- padding,
301
- reposition,
302
- boundaryInset,
303
- containerParent,
304
- contentLocation,
305
- onPositionPopover,
306
- ]);
307
- return [positionPopover, popoverRef];
308
- };
309
- usePopover$1.usePopover = usePopover;
310
-
311
- var useMemoizedArray$1 = {};
312
-
313
- Object.defineProperty(useMemoizedArray$1, "__esModule", { value: true });
314
- useMemoizedArray$1.useMemoizedArray = void 0;
315
- var react_1$2 = React__default;
316
- var useMemoizedArray = function (externalArray) {
317
- var prevArrayRef = react_1$2.useRef(externalArray);
318
- var array = react_1$2.useMemo(function () {
319
- if (prevArrayRef.current === externalArray)
320
- return prevArrayRef.current;
321
- if (prevArrayRef.current.length !== externalArray.length) {
322
- prevArrayRef.current = externalArray;
323
- return externalArray;
324
- }
325
- for (var i = 0; i < externalArray.length; i += 1) {
326
- if (externalArray[i] !== prevArrayRef.current[i]) {
327
- prevArrayRef.current = externalArray;
328
- return externalArray;
329
- }
330
- }
331
- return prevArrayRef.current;
332
- }, [externalArray]);
333
- return array;
334
- };
335
- useMemoizedArray$1.useMemoizedArray = useMemoizedArray;
336
-
337
- var useArrowContainer$1 = {};
338
-
339
- var __assign$1 = (commonjsGlobal && commonjsGlobal.__assign) || function () {
340
- __assign$1 = Object.assign || function(t) {
341
- for (var s, i = 1, n = arguments.length; i < n; i++) {
342
- s = arguments[i];
343
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
344
- t[p] = s[p];
345
- }
346
- return t;
347
- };
348
- return __assign$1.apply(this, arguments);
349
- };
350
- Object.defineProperty(useArrowContainer$1, "__esModule", { value: true });
351
- useArrowContainer$1.useArrowContainer = void 0;
352
- var react_1$1 = React__default;
353
- var useArrowContainer = function (_a) {
354
- var childRect = _a.childRect, popoverRect = _a.popoverRect, position = _a.position, arrowSize = _a.arrowSize, arrowColor = _a.arrowColor;
355
- var arrowContainerStyle = react_1$1.useMemo(function () {
356
- return ({
357
- padding: arrowSize,
358
- });
359
- }, [arrowSize]);
360
- var arrowStyle = react_1$1.useMemo(function () {
361
- return (__assign$1({ position: 'absolute' }, (function () {
362
- var arrowWidth = arrowSize * 2;
363
- var top = childRect.top - popoverRect.top + childRect.height / 2 - arrowWidth / 2;
364
- var left = childRect.left - popoverRect.left + childRect.width / 2 - arrowWidth / 2;
365
- var lowerBound = arrowSize;
366
- var leftUpperBound = popoverRect.width - arrowSize;
367
- var topUpperBound = popoverRect.height - arrowSize;
368
- left = left < lowerBound ? lowerBound : left;
369
- left = left + arrowWidth > leftUpperBound ? leftUpperBound - arrowWidth : left;
370
- top = top < lowerBound ? lowerBound : top;
371
- top = top + arrowWidth > topUpperBound ? topUpperBound - arrowWidth : top;
372
- top = Number.isNaN(top) ? 0 : top;
373
- left = Number.isNaN(left) ? 0 : left;
374
- switch (position) {
375
- case 'right':
376
- return {
377
- borderTop: arrowSize + "px solid transparent",
378
- borderBottom: arrowSize + "px solid transparent",
379
- borderRight: arrowSize + "px solid " + arrowColor,
380
- left: 0,
381
- top: top,
382
- };
383
- case 'left':
384
- return {
385
- borderTop: arrowSize + "px solid transparent",
386
- borderBottom: arrowSize + "px solid transparent",
387
- borderLeft: arrowSize + "px solid " + arrowColor,
388
- right: 0,
389
- top: top,
390
- };
391
- case 'bottom':
392
- return {
393
- borderLeft: arrowSize + "px solid transparent",
394
- borderRight: arrowSize + "px solid transparent",
395
- borderBottom: arrowSize + "px solid " + arrowColor,
396
- top: 0,
397
- left: left,
398
- };
399
- case 'top':
400
- return {
401
- borderLeft: arrowSize + "px solid transparent",
402
- borderRight: arrowSize + "px solid transparent",
403
- borderTop: arrowSize + "px solid " + arrowColor,
404
- bottom: 0,
405
- left: left,
406
- };
407
- default:
408
- return {
409
- display: 'hidden',
410
- };
411
- }
412
- })()));
413
- }, [
414
- arrowColor,
415
- arrowSize,
416
- childRect.height,
417
- childRect.left,
418
- childRect.top,
419
- childRect.width,
420
- popoverRect.height,
421
- popoverRect.left,
422
- popoverRect.top,
423
- popoverRect.width,
424
- position,
425
- ]);
426
- return {
427
- arrowContainerStyle: arrowContainerStyle,
428
- arrowStyle: arrowStyle,
429
- };
430
- };
431
- useArrowContainer$1.useArrowContainer = useArrowContainer;
432
-
433
- var ArrowContainer$1 = {};
434
-
435
- var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
436
- __assign = Object.assign || function(t) {
437
- for (var s, i = 1, n = arguments.length; i < n; i++) {
438
- s = arguments[i];
439
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
440
- t[p] = s[p];
441
- }
442
- return t;
443
- };
444
- return __assign.apply(this, arguments);
445
- };
446
- Object.defineProperty(ArrowContainer$1, "__esModule", { value: true });
447
- ArrowContainer$1.ArrowContainer = void 0;
448
- var jsx_runtime_1 = jsxRuntimeExports;
449
- var react_1 = React__default;
450
- var useArrowContainer_1 = useArrowContainer$1;
451
- var ArrowContainer = function (_a) {
452
- var childRect = _a.childRect, popoverRect = _a.popoverRect, position = _a.position, arrowColor = _a.arrowColor, arrowSize = _a.arrowSize, arrowClassName = _a.arrowClassName, externalArrowStyle = _a.arrowStyle, className = _a.className, children = _a.children, externalArrowContainerStyle = _a.style;
453
- var _b = useArrowContainer_1.useArrowContainer({
454
- childRect: childRect,
455
- popoverRect: popoverRect,
456
- position: position,
457
- arrowColor: arrowColor,
458
- arrowSize: arrowSize,
459
- }), arrowContainerStyle = _b.arrowContainerStyle, arrowStyle = _b.arrowStyle;
460
- var mergedContainerStyle = react_1.useMemo(function () { return (__assign(__assign({}, arrowContainerStyle), externalArrowContainerStyle)); }, [arrowContainerStyle, externalArrowContainerStyle]);
461
- var mergedArrowStyle = react_1.useMemo(function () { return (__assign(__assign({}, arrowStyle), externalArrowStyle)); }, [arrowStyle, externalArrowStyle]);
462
- return (jsx_runtime_1.jsxs("div", __assign({ className: className, style: mergedContainerStyle }, { children: [jsx_runtime_1.jsx("div", { style: mergedArrowStyle, className: arrowClassName }, void 0), children] }), void 0));
463
- };
464
- ArrowContainer$1.ArrowContainer = ArrowContainer;
465
-
466
- (function (exports) {
467
- var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
468
- __assign = Object.assign || function(t) {
469
- for (var s, i = 1, n = arguments.length; i < n; i++) {
470
- s = arguments[i];
471
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
472
- t[p] = s[p];
473
- }
474
- return t;
475
- };
476
- return __assign.apply(this, arguments);
477
- };
478
- Object.defineProperty(exports, "__esModule", { value: true });
479
- exports.Popover = exports.usePopover = exports.ArrowContainer = exports.useArrowContainer = void 0;
480
- var jsx_runtime_1 = jsxRuntimeExports;
481
- var react_1 = React__default;
482
- var PopoverPortal_1 = PopoverPortal$1;
483
- var util_1 = util;
484
- var usePopover_1 = usePopover$1;
485
- Object.defineProperty(exports, "usePopover", { enumerable: true, get: function () { return usePopover_1.usePopover; } });
486
- var useMemoizedArray_1 = useMemoizedArray$1;
487
- var useArrowContainer_1 = useArrowContainer$1;
488
- Object.defineProperty(exports, "useArrowContainer", { enumerable: true, get: function () { return useArrowContainer_1.useArrowContainer; } });
489
- var ArrowContainer_1 = ArrowContainer$1;
490
- Object.defineProperty(exports, "ArrowContainer", { enumerable: true, get: function () { return ArrowContainer_1.ArrowContainer; } });
491
- exports.Popover = react_1.forwardRef(function (_a, externalRef) {
492
- var isOpen = _a.isOpen, children = _a.children, content = _a.content, _b = _a.positions, externalPositions = _b === void 0 ? util_1.Constants.DEFAULT_POSITIONS : _b, _c = _a.align, align = _c === void 0 ? util_1.Constants.DEFAULT_ALIGN : _c, _d = _a.padding, padding = _d === void 0 ? 0 : _d, _e = _a.reposition, reposition = _e === void 0 ? true : _e, _f = _a.containerParent, containerParent = _f === void 0 ? window.document.body : _f, _g = _a.containerClassName, containerClassName = _g === void 0 ? 'react-tiny-popover-container' : _g, containerStyle = _a.containerStyle, contentLocation = _a.contentLocation, _h = _a.boundaryInset, boundaryInset = _h === void 0 ? 0 : _h, onClickOutside = _a.onClickOutside;
493
- var positions = useMemoizedArray_1.useMemoizedArray(externalPositions);
494
- // TODO: factor prevs out into a custom prevs hook
495
- var prevIsOpen = react_1.useRef(false);
496
- var prevPositions = react_1.useRef();
497
- var prevContentLocation = react_1.useRef();
498
- var prevReposition = react_1.useRef(reposition);
499
- var childRef = react_1.useRef();
500
- var _j = react_1.useState({
501
- align: align,
502
- nudgedLeft: 0,
503
- nudgedTop: 0,
504
- position: positions[0],
505
- padding: padding,
506
- childRect: util_1.Constants.EMPTY_CLIENT_RECT,
507
- popoverRect: util_1.Constants.EMPTY_CLIENT_RECT,
508
- parentRect: util_1.Constants.EMPTY_CLIENT_RECT,
509
- boundaryInset: boundaryInset,
510
- }), popoverState = _j[0], setPopoverState = _j[1];
511
- var onPositionPopover = react_1.useCallback(function (popoverState) { return setPopoverState(popoverState); }, []);
512
- var _k = usePopover_1.usePopover({
513
- childRef: childRef,
514
- containerClassName: containerClassName,
515
- containerParent: containerParent,
516
- contentLocation: contentLocation,
517
- positions: positions,
518
- align: align,
519
- padding: padding,
520
- boundaryInset: boundaryInset,
521
- reposition: reposition,
522
- onPositionPopover: onPositionPopover,
523
- }), positionPopover = _k[0], popoverRef = _k[1];
524
- react_1.useLayoutEffect(function () {
525
- var shouldUpdate = true;
526
- var updatePopover = function () {
527
- var _a, _b;
528
- if (isOpen && shouldUpdate) {
529
- var childRect = (_a = childRef === null || childRef === void 0 ? void 0 : childRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
530
- var popoverRect = (_b = popoverRef === null || popoverRef === void 0 ? void 0 : popoverRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
531
- if (childRect != null &&
532
- popoverRect != null &&
533
- (!util_1.rectsAreEqual(childRect, {
534
- top: popoverState.childRect.top,
535
- left: popoverState.childRect.left,
536
- width: popoverState.childRect.width,
537
- height: popoverState.childRect.height,
538
- bottom: popoverState.childRect.top + popoverState.childRect.height,
539
- right: popoverState.childRect.left + popoverState.childRect.width,
540
- }) ||
541
- popoverRect.width !== popoverState.popoverRect.width ||
542
- popoverRect.height !== popoverState.popoverRect.height ||
543
- popoverState.padding !== padding ||
544
- popoverState.align !== align ||
545
- positions !== prevPositions.current ||
546
- contentLocation !== prevContentLocation.current ||
547
- reposition !== prevReposition.current)) {
548
- positionPopover();
549
- }
550
- // TODO: factor prev checks out into the custom prevs hook
551
- if (positions !== prevPositions.current) {
552
- prevPositions.current = positions;
553
- }
554
- if (contentLocation !== prevContentLocation.current) {
555
- prevContentLocation.current = contentLocation;
556
- }
557
- if (reposition !== prevReposition.current) {
558
- prevReposition.current = reposition;
559
- }
560
- if (shouldUpdate) {
561
- window.requestAnimationFrame(updatePopover);
562
- }
563
- }
564
- prevIsOpen.current = isOpen;
565
- };
566
- window.requestAnimationFrame(updatePopover);
567
- return function () {
568
- shouldUpdate = false;
569
- };
570
- }, [
571
- align,
572
- contentLocation,
573
- isOpen,
574
- padding,
575
- popoverRef,
576
- popoverState.align,
577
- popoverState.childRect.height,
578
- popoverState.childRect.left,
579
- popoverState.childRect.top,
580
- popoverState.childRect.width,
581
- popoverState.padding,
582
- popoverState.popoverRect.height,
583
- popoverState.popoverRect.width,
584
- positionPopover,
585
- positions,
586
- reposition,
587
- ]);
588
- react_1.useEffect(function () {
589
- var popoverElement = popoverRef.current;
590
- Object.assign(popoverElement.style, containerStyle);
591
- return function () {
592
- Object.keys(containerStyle !== null && containerStyle !== void 0 ? containerStyle : {}).forEach(function (key) {
593
- return delete popoverElement.style[key];
594
- });
595
- };
596
- }, [containerStyle, isOpen, popoverRef]);
597
- var handleOnClickOutside = react_1.useCallback(function (e) {
598
- var _a, _b;
599
- if (isOpen &&
600
- !((_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) &&
601
- !((_b = childRef.current) === null || _b === void 0 ? void 0 : _b.contains(e.target))) {
602
- onClickOutside === null || onClickOutside === void 0 ? void 0 : onClickOutside(e);
603
- }
604
- }, [isOpen, onClickOutside, popoverRef]);
605
- var handleWindowResize = react_1.useCallback(function () {
606
- if (childRef.current) {
607
- window.requestAnimationFrame(function () { return positionPopover(); });
608
- }
609
- }, [positionPopover]);
610
- react_1.useEffect(function () {
611
- window.addEventListener('click', handleOnClickOutside);
612
- window.addEventListener('resize', handleWindowResize);
613
- return function () {
614
- window.removeEventListener('click', handleOnClickOutside);
615
- window.removeEventListener('resize', handleWindowResize);
616
- };
617
- }, [handleOnClickOutside, handleWindowResize]);
618
- var handleRef = react_1.useCallback(function (node) {
619
- childRef.current = node;
620
- if (externalRef != null) {
621
- if (typeof externalRef === 'object') {
622
- externalRef.current = node;
623
- }
624
- else if (typeof externalRef === 'function') {
625
- externalRef(node);
626
- }
627
- }
628
- }, [externalRef]);
629
- var renderChild = function () {
630
- return react_1.cloneElement(children, {
631
- ref: handleRef,
632
- });
633
- };
634
- var renderPopover = function () {
635
- if (!isOpen)
636
- return null;
637
- return (jsx_runtime_1.jsx(PopoverPortal_1.PopoverPortal, __assign({ element: popoverRef.current, container: containerParent }, { children: typeof content === 'function' ? content(popoverState) : content }), void 0));
638
- };
639
- return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [renderChild(), renderPopover()] }, void 0));
640
- });
641
-
642
- } (Popover));
643
-
644
- var css_248z = "[data-gene-ui-version=\"2.12.1\"] .popover-positioner{--popover-border-radius:1rem;--popover-shadow:0 0.2rem 0.4rem 0 #0000000d,0 0 0 1px rgba(var(--background-sc-rgb),0.08);z-index:400}[data-gene-ui-version=\"2.12.1\"] .popover-positioner.cr-smooth-radius{--popover-border-radius:0.4rem}[data-gene-ui-version=\"2.12.1\"] .popover-positioner.mobile-view{--popover-border-radius:0.8rem 0.8rem 0 0;--popover-shadow:0 -1px 0.2rem 0 #0000000d;bottom:0;left:0!important;overflow:hidden;position:fixed!important;top:0!important;transform:translate(0)!important;width:100%}[data-gene-ui-version=\"2.12.1\"] .popover-positioner .popover-top-bottom-padding{padding:1rem 0;width:100%}[data-gene-ui-version=\"2.12.1\"] .popover-positioner .popover-top-bottom-padding>div[style*=width]{width:100%!important}[data-gene-ui-version=\"2.12.1\"] .popover{width:100%}[data-gene-ui-version=\"2.12.1\"] .popover-positioner.mobile-view .popover{height:100%;position:relative}[data-gene-ui-version=\"2.12.1\"] .popover-positioner-disable{margin-top:5px;position:inherit!important;transform:none!important}[data-gene-ui-version=\"2.12.1\"] .popover-track{width:100%}[data-gene-ui-version=\"2.12.1\"] .popover-content{background:var(--background);border-radius:var(--popover-border-radius);box-shadow:var(--popover-shadow);overflow:hidden;padding:0 0 env(safe-area-inset-bottom);transition:padding .4s;width:100%}[data-gene-ui-version=\"2.12.1\"] .popover-positioner.mobile-view .popover-content{-webkit-overflow-scrolling:auto;bottom:0;left:0;max-height:calc(100% - 10rem);overflow-x:hidden;overflow-y:auto;position:absolute;z-index:1}[data-gene-ui-version=\"2.12.1\"] .popover-positioner.mobile-view[style*=\"opacity: 0\"] .popover-content{transform:translateY(100%)}[data-gene-ui-version=\"2.12.1\"] .popover-positioner.mobile-view .popover-content{transform:translateY(0)}[data-gene-ui-version=\"2.12.1\"] .popover-mobile-backdrop{background:#0003;height:100%;left:0;opacity:1;position:absolute;top:0;width:100%;z-index:0}[data-gene-ui-version=\"2.12.1\"] .popover-footer,[data-gene-ui-version=\"2.12.1\"] .popover-header{background:var(--background);position:-webkit-sticky;position:sticky;z-index:1}[data-gene-ui-version=\"2.12.1\"] .popover-header{border-bottom:1px solid rgba(var(--background-sc-rgb),.1);top:0}[data-gene-ui-version=\"2.12.1\"] .popover-footer{align-items:stretch;border-top:1px solid rgba(var(--background-sc-rgb),.1);bottom:calc(env(safe-area-inset-bottom)*-1);display:flex;padding:0 0 env(safe-area-inset-bottom);transition:padding .4s}[data-gene-ui-version=\"2.12.1\"] .popover-body{position:relative;z-index:0}[data-gene-ui-version=\"2.12.1\"] .popover-search{padding:1.4rem 1.5rem}[data-gene-ui-version=\"2.12.1\"] .empty-data-holder{align-items:center;display:flex;height:19rem;justify-content:center;width:100%}[data-gene-ui-version=\"2.12.1\"] .popover-disabled{opacity:.5;pointer-events:none;transition:opacity .5s}";
645
- styleInject(css_248z);
646
-
647
- const PopoverV2 = /*#__PURE__*/forwardRef((props, ref) => {
648
- var _popoverRef$current4;
649
- const {
650
- nativeOutsideClick,
651
- extendTargetWidth,
652
- disableReposition,
653
- disableTransform,
654
- containerParent,
655
- scrollbarNeeded,
656
- onClickOutside,
657
- trackClassName,
658
- toggleHandler,
659
- cornerRadius,
660
- getScrollRef,
661
- onSwipedDown,
662
- contentRef,
663
- screenType,
664
- minHeight,
665
- maxHeight,
666
- className,
667
- swipeable,
668
- children,
669
- position,
670
- disabled,
671
- Content,
672
- padding,
673
- behave,
674
- Header,
675
- Footer,
676
- isOpen,
677
- align,
678
- scrollbarProps,
679
- ...restProps
680
- } = props;
681
- const {
682
- geneUIProviderRef
683
- } = useContext(GeneUIDesignSystemContext);
684
- const popoverRef = useRef(null);
685
- const popoverBodyRef = useRef(null);
686
- const popoverTrackRef = useRef(null);
687
- const [updateKey, setUpdateKey] = useState(0);
688
- const [targetWidth, setTargetWidth] = useState(null);
689
- const [popoverOpened, setPopoverOpened] = useState(false);
690
- const [swipingPosition, setSwipingPosition] = useState(0);
691
- const {
692
- isMobile
693
- } = useDeviceType(screenType);
694
- const isControlled = ('isOpen' in props);
695
- const popoverState = isControlled ? isOpen : popoverOpened;
696
- const positions = useMemo(() => Array.isArray(position) ? position : [position], [position]);
697
- useEffect(() => {
698
- document.documentElement.classList[popoverState ? 'add' : 'remove'](popoverV2Config.onOpenClassName);
699
- }, [popoverState]);
700
- useEffect(() => {
701
- setUpdateKey(Date.now());
702
- }, [isMobile, cornerRadius]);
703
- useEffect(() => {
704
- var _popoverRef$current;
705
- if (popoverRef.current && (_popoverRef$current = popoverRef.current) !== null && _popoverRef$current !== void 0 && _popoverRef$current.offsetWidth) {
706
- var _popoverRef$current2;
707
- setTargetWidth((_popoverRef$current2 = popoverRef.current) === null || _popoverRef$current2 === void 0 ? void 0 : _popoverRef$current2.offsetWidth);
708
- const debouncedHandleResize = debounce(() => {
709
- var _popoverRef$current3;
710
- setTargetWidth((_popoverRef$current3 = popoverRef.current) === null || _popoverRef$current3 === void 0 ? void 0 : _popoverRef$current3.offsetWidth);
711
- }, 20);
712
- window.addEventListener('resize', debouncedHandleResize);
713
- return () => window.removeEventListener('resize', debouncedHandleResize);
714
- }
715
- }, [(_popoverRef$current4 = popoverRef.current) === null || _popoverRef$current4 === void 0 ? void 0 : _popoverRef$current4.offsetWidth]);
716
-
717
- /* *** START SWIPE FUNCTIONALITY *** */
718
- const checkBodyContains = event => popoverBodyRef.current.contains(event.target);
719
- const handleSwiped = event => setSwipingPosition(0);
720
- const handleSwipedDown = touchEvent => {
721
- !checkBodyContains(touchEvent.event) && onSwipedDown(touchEvent);
722
- };
723
- const handleSwiping = useCallback(_ref => {
724
- let {
725
- deltaY,
726
- event
727
- } = _ref;
728
- if (checkBodyContains(event)) {
729
- stopEvent(event);
730
- } else if (deltaY >= 0) {
731
- setSwipingPosition(deltaY * -1);
732
- }
733
- }, [popoverBodyRef, setSwipingPosition]);
734
- const swipeHandlers = useSwipeable(useMemo(() => swipeable ? {
735
- onSwipedDown: handleSwipedDown,
736
- onSwiping: handleSwiping,
737
- onSwiped: handleSwiped
738
- } : {}, [swipeable, handleSwipedDown, handleSwiping, handleSwiped]));
739
- /* *** END SWIPE FUNCTIONALITY *** */
740
-
741
- /* *** START OPEN/CLOSE FUNCTIONALITY *** */
742
- const togglePopupOpened = useCallback(event => {
743
- stopEvent(event);
744
- if (isControlled) {
745
- toggleHandler(event, isOpen);
746
- } else {
747
- setPopoverOpened(status => {
748
- toggleHandler(event, !status);
749
- return !status;
750
- });
751
- }
752
- }, [isControlled, toggleHandler, isOpen]);
753
- const handleTrackClick = useCallback(event => {
754
- if (!disabled) {
755
- if (behave === 'toggle') {
756
- togglePopupOpened(event);
757
- } else if (!isControlled && behave === 'open') {
758
- setPopoverOpened(true);
759
- }
760
- }
761
- }, [disabled, isControlled, behave, togglePopupOpened]);
762
- const handleOutsideClick = useClickOutside(event => {
763
- if (popoverRef && !popoverRef.current.contains(event.target)) {
764
- onClickOutside(event);
765
- if (!isControlled) {
766
- setPopoverOpened(false);
767
- }
768
- }
769
- });
770
- /* *** END OPEN/CLOSE FUNCTIONALITY *** */
771
-
772
- /* *** START GENERATE REFS *** */
773
- const generatePopoverRef = useCallback(element => {
774
- popoverRef && (popoverRef.current = element);
775
- ref && (ref.current = element);
776
- }, [ref]);
777
- const generateContentRef = useCallback(element => {
778
- isMobile && getScrollRef(element);
779
- handleOutsideClick(element);
780
- if (contentRef) {
781
- typeof contentRef === 'function' ? contentRef(element) : contentRef.current = element;
782
- }
783
- }, [isMobile, contentRef, getScrollRef]);
784
- /* *** END GENERATE REFS *** */
785
- const portalContent = /*#__PURE__*/React__default.createElement("div", swipeHandlers, /*#__PURE__*/React__default.createElement("ul", {
786
- onClick: stopEvent,
787
- ref: generateContentRef,
788
- className: "popover-content",
789
- style: {
790
- bottom: swipingPosition,
791
- width: extendTargetWidth && !isMobile && targetWidth || null
792
- }
793
- }, Header && /*#__PURE__*/React__default.createElement("li", {
794
- className: "popover-header"
795
- }, Header), /*#__PURE__*/React__default.createElement("li", {
796
- ref: popoverBodyRef,
797
- className: "popover-body"
798
- }, scrollbarNeeded && !isMobile ? /*#__PURE__*/React__default.createElement(CustomScrollbar, _extends({
799
- ref: scrollbar => {
800
- scrollbar && getScrollRef(scrollbar.view);
801
- },
802
- autoHeight: true,
803
- autoHeightMax: maxHeight,
804
- autoHeightMin: minHeight
805
- }, scrollbarProps), Content) : Content), Footer && /*#__PURE__*/React__default.createElement("li", {
806
- className: "popover-footer"
807
- }, Footer)), isMobile && /*#__PURE__*/React__default.createElement("div", {
808
- className: "popover-mobile-backdrop",
809
- onClick: togglePopupOpened
810
- }));
811
- const childElement = useMemo(() => /*#__PURE__*/React__default.createElement("div", {
812
- onClick: handleTrackClick,
813
- className: classnames('popover-track cursor-pointer', trackClassName, {
814
- 'popover-opened': popoverState,
815
- 'popover-disabled': disabled
816
- })
817
- }, children), [popoverTrackRef, children, trackClassName, popoverState, disabled, handleTrackClick]);
818
- if (!Content) {
819
- return childElement;
820
- }
821
- const containerParentMemo = useMemo(() => ({
822
- containerParent: containerParent || geneUIProviderRef.current
823
- }), [containerParent]);
824
- return /*#__PURE__*/React__default.createElement(Popover.Popover, _extends({
825
- key: updateKey,
826
- ref: generatePopoverRef,
827
- align: align,
828
- positions: positions,
829
- padding: padding,
830
- onClickOutside: nativeOutsideClick,
831
- isOpen: popoverState,
832
- content: portalContent,
833
- reposition: !isMobile && disableReposition,
834
- containerStyle: {
835
- overflow: null
836
- },
837
- containerClassName: classnames('popover-positioner', "cr-".concat(cornerRadius), className, {
838
- 'mobile-view': isMobile,
839
- 'popover-positioner-disable': disableTransform && containerParent && !isMobile
840
- }),
841
- children: childElement
842
- }, containerParentMemo, restProps));
843
- });
844
- PopoverV2.propTypes = {
845
- /**
846
- * The component that need to be displayed in the Popover. Any valid React node
847
- */
848
- Content: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
849
- /**
850
- * The component that need to be displayed as Popover header. Any valid React node
851
- */
852
- Header: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
853
- /**
854
- * The component that need to be displayed as Popover footer. Any valid React node
855
- */
856
- Footer: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
857
- /**
858
- * The component which click needs to trigger the Popover to open. Need to passed as child to Popover. Any valid React node
859
- */
860
- children: PropTypes.node,
861
- /**
862
- * The Popover will get the width of its child. The property will not work when "width" prop is specified
863
- */
864
- extendTargetWidth: PropTypes.bool,
865
- /**
866
- * The Popover "Content" minimum scroll height
867
- */
868
- minHeight: PropTypes.number,
869
- /**
870
- * The Popover "Content" maximum scroll height. Will not work when the "screenType" is "mobile"
871
- */
872
- maxHeight: PropTypes.number,
873
- /**
874
- * Use this prop to control the Popover. Note the component will start not to open and close automatically
875
- */
876
- isOpen: PropTypes.bool,
877
- /**
878
- * Popover position to be displayed
879
- */
880
- position: PropTypes.oneOfType([PropTypes.oneOf(popoverV2Config.position), PropTypes.arrayOf(PropTypes.oneOf(popoverV2Config.position))]),
881
- /**
882
- * Will called each time the popover need to be toggled(child click, close button click, backdrop click).
883
- * (event: Event, isOpen: bool) => void
884
- */
885
- toggleHandler: PropTypes.func,
886
- /**
887
- * Possible values are start, center, and end.
888
- * If start is specified, the popover content's top or left location is aligned with its target's.
889
- * With end specified, the content's bottom or right location is aligned with its target's.
890
- * If center is specified, the popover content and target's centers are aligned.
891
- */
892
- align: PropTypes.oneOf(popoverV2Config.align),
893
- /**
894
- * If you'd like to apply styles to the single container div that your popover content is rendered within via stylesheets,
895
- * you can specify a custom className for the container here.
896
- */
897
- className: PropTypes.string,
898
- /**
899
- * This number determines the gap, in pixels, between your target content and your popover content
900
- */
901
- padding: PropTypes.number,
902
- /**
903
- * If this property is enabled, rather than the popover content repositioning on a boundary collision,
904
- * the popover content container will move beyond the window's bounds.
905
- * You are, however, supplied with nudgedLeft and nudgedTop values, so you may choose to handle content overflow as you wish.
906
- */
907
- disableReposition: PropTypes.bool,
908
- /**
909
- * Popover corner radius
910
- */
911
- cornerRadius: PropTypes.oneOf(popoverV2Config.cornerRadius),
912
- /**
913
- * The switch between mobile and desktop version of Popover will be applied automatically, when the prop is not specified.
914
- * When the prop is present it must be changed from outside.
915
- */
916
- screenType: PropTypes.oneOf(screenTypes),
917
- /**
918
- * Specify does Popover needs to be toggled on child click
919
- */
920
- behave: PropTypes.oneOf(popoverV2Config.behave),
921
- /**
922
- * Given content prop can have its own scroll, and with this props we can use/not use default scroll that has popover
923
- */
924
- scrollbarNeeded: PropTypes.bool,
925
- /**
926
- * Popover content ref
927
- */
928
- contentRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
929
- current: PropTypes.any
930
- })]),
931
- disabled: PropTypes.bool,
932
- getScrollRef: PropTypes.func,
933
- /**
934
- * This number specifies the inset around your containerParent's border
935
- * that boundary violations are determined at. Defaults to 0. Can be negative.
936
- */
937
- boundaryInset: PropTypes.number,
938
- /**
939
- * If you want to apply styles to the popup tracker div where your children are using
940
- * stylesheets, you can provide a custom class name for the container here.
941
- */
942
- trackClassName: PropTypes.string,
943
- /*
944
- * After DOWN swipe (SwipeEventData) => void
945
- */
946
- onSwipedDown: PropTypes.func,
947
- swipeable: PropTypes.bool,
948
- /*
949
- * If react-tiny-popover detects a click event outside of the target and outside
950
- * of the popover, you may handle this event here, in the form of (e: MouseEvent) => void.
951
- */
952
- onClickOutside: PropTypes.func,
953
- nativeOutsideClick: PropTypes.func,
954
- /*
955
- * props for scrollbar
956
- */
957
- scrollbarProps: PropTypes.shape({
958
- ...CustomScrollbar.propTypes
959
- }),
960
- /*
961
- * When disableTransform is true and containerParent has ref.current, the popover generates in a dropdown wrapper instead of closing the body tag, and the position will not calculate.
962
- */
963
- disableTransform: PropTypes.bool,
964
- /*
965
- * Provide an HTML element ref here to have your popover content appended to that element rather than document.body. This is useful if you'd like your popover to sit at a particular place within the DOM.
966
- */
967
- containerParent: PropTypes.object
968
- };
969
- PopoverV2.defaultProps = {
970
- cornerRadius: popoverV2Config.cornerRadius[0],
971
- position: popoverV2Config.position,
972
- align: popoverV2Config.align[0],
973
- toggleHandler: noop,
974
- behave: popoverV2Config.behave[0],
975
- extendTargetWidth: true,
976
- disableReposition: true,
977
- disableTransform: false,
978
- minHeight: 0,
979
- maxHeight: 510,
980
- padding: 10,
981
- getScrollRef: noop,
982
- scrollbarNeeded: true,
983
- swipeable: false,
984
- onSwipedDown: noop,
985
- onClickOutside: noop,
986
- nativeOutsideClick: noop
987
- };
988
-
989
- export { PopoverV2 as default };