@geneui/components 2.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/ActionableList.js +1761 -0
  2. package/AdvancedSearch.js +872 -0
  3. package/Alert.js +98 -0
  4. package/Avatar.js +77 -0
  5. package/Badge.js +76 -0
  6. package/Breadcrumb.js +128 -0
  7. package/BusyLoader.js +69 -0
  8. package/Button.js +130 -0
  9. package/CHANGELOG.md +424 -0
  10. package/Card.js +513 -0
  11. package/CardList.js +705 -0
  12. package/CellMeasurerCache-c11cec83.js +229 -0
  13. package/Charts.js +99 -0
  14. package/Checkbox.js +232 -0
  15. package/CheckboxGroup.js +206 -0
  16. package/CheckboxGroupWithSearch.js +279 -0
  17. package/Collapse.js +196 -0
  18. package/ColorPicker.js +210 -0
  19. package/ComboBox.js +99 -0
  20. package/Counter.js +99 -0
  21. package/DateFilter.js +179 -0
  22. package/DatePicker.js +1231 -0
  23. package/DatePickerInput.js +30 -0
  24. package/Divider.js +56 -0
  25. package/Drawer.js +264 -0
  26. package/Dropdown.js +99 -0
  27. package/Editor.js +22965 -0
  28. package/Empty.js +132 -0
  29. package/ExtendedInput.js +578 -0
  30. package/Form.js +116 -0
  31. package/FormContainer.js +189 -0
  32. package/FormableCheckbox.js +27 -0
  33. package/FormableDatePicker.js +39 -0
  34. package/FormableDropdown.js +105 -0
  35. package/FormableEditor.js +24 -0
  36. package/FormableHOC-21051057.js +83 -0
  37. package/FormableMultiSelectDropdown.js +105 -0
  38. package/FormableNumberInput.js +31 -0
  39. package/FormableRadio.js +23 -0
  40. package/FormableSwitcher.js +23 -0
  41. package/FormableTextInput.js +31 -0
  42. package/FormableUploader.js +40 -0
  43. package/GeneUIProvider.js +256 -0
  44. package/Grid.js +166 -0
  45. package/Holder.js +99 -0
  46. package/Icon.js +63 -0
  47. package/Image.js +130 -0
  48. package/ImagePreview.js +99 -0
  49. package/KeyValue.js +63 -0
  50. package/Label.js +58 -0
  51. package/LinkButton.js +104 -0
  52. package/Menu.js +277 -0
  53. package/MobileNavigation.js +95 -0
  54. package/MobilePopup.js +180 -0
  55. package/Modal.js +251 -0
  56. package/ModuleTitle.js +99 -0
  57. package/NavigationMenu.js +212 -0
  58. package/Notification.js +120 -0
  59. package/Option.js +186 -0
  60. package/Overlay.js +99 -0
  61. package/Overspread.js +343 -0
  62. package/Pagination.js +258 -0
  63. package/Paper.js +97 -0
  64. package/Popover-f4d1cac0.js +411 -0
  65. package/Popover.js +20 -0
  66. package/PopoverV2.js +19 -0
  67. package/Portal.js +58 -0
  68. package/Products.js +115 -0
  69. package/Profile.js +99 -0
  70. package/Progress.js +200 -0
  71. package/QRCode.js +816 -0
  72. package/README.md +90 -0
  73. package/Radio.js +152 -0
  74. package/RadioGroup.js +105 -0
  75. package/Range.js +14 -0
  76. package/RichEditor-b7928765.js +228 -0
  77. package/RichEditor.js +13 -0
  78. package/Scrollbar.js +1587 -0
  79. package/Search.js +72 -0
  80. package/SearchWithDropdown.js +195 -0
  81. package/Section.js +62 -0
  82. package/SkeletonLoader.js +82 -0
  83. package/Slider.js +256 -0
  84. package/Status.js +104 -0
  85. package/Steps.js +312 -0
  86. package/SuggestionList.js +15 -0
  87. package/Switcher.js +194 -0
  88. package/Table.js +102 -0
  89. package/TableCompositions.js +17028 -0
  90. package/Tabs.js +236 -0
  91. package/Tag.js +103 -0
  92. package/TextLink.js +22 -0
  93. package/Textarea.js +239 -0
  94. package/Time.js +63 -0
  95. package/TimePicker.js +99 -0
  96. package/Timeline.js +114 -0
  97. package/Title.js +66 -0
  98. package/Toaster.js +116 -0
  99. package/Tooltip.js +157 -0
  100. package/TransferList.js +502 -0
  101. package/Uploader.js +32 -0
  102. package/ValidatableCheckbox.js +126 -0
  103. package/ValidatableDatePicker.js +312 -0
  104. package/ValidatableDropdown.js +99 -0
  105. package/ValidatableElements.js +99 -0
  106. package/ValidatableMultiSelectDropdown.js +99 -0
  107. package/ValidatableNumberInput.js +194 -0
  108. package/ValidatableRadio.js +117 -0
  109. package/ValidatableSwitcher.js +94 -0
  110. package/ValidatableTextInput.js +164 -0
  111. package/ValidatableTimeInput.js +171 -0
  112. package/ValidatableUploader.js +94 -0
  113. package/Widget.js +99 -0
  114. package/_commonjsHelpers-24198af3.js +35 -0
  115. package/_rollupPluginBabelHelpers-e8fb2e5c.js +16 -0
  116. package/checkTimeValidation-e56771be.js +16 -0
  117. package/checkboxRadioSwitcher-5b69d7bd.js +4 -0
  118. package/clsx.m-2bb6df4b.js +3 -0
  119. package/configs-91c86664.js +96 -0
  120. package/configs.js +131 -0
  121. package/dateValidation-67caec66.js +225 -0
  122. package/debounce-4419bc2f.js +17 -0
  123. package/globalStyling-9c60a159.js +4 -0
  124. package/guid-8ddf77b3.js +16 -0
  125. package/index-00fe8887.js +193 -0
  126. package/index-0cf65939.js +30991 -0
  127. package/index-122432cd.js +270 -0
  128. package/index-262edd7a.js +77 -0
  129. package/index-5cea9a7d.js +407 -0
  130. package/index-5e722d91.js +867 -0
  131. package/index-67f4d4d1.js +6568 -0
  132. package/index-6ff23041.js +66 -0
  133. package/index-702bf24a.js +1938 -0
  134. package/index-a4635754.js +329 -0
  135. package/index-a59530cd.js +4 -0
  136. package/index-ac59cb10.js +169 -0
  137. package/index-b7a33c58.js +11 -0
  138. package/index-d9e8a888.js +987 -0
  139. package/index-e0af0caf.js +1182 -0
  140. package/index-e8776f3d.js +807 -0
  141. package/index.js +128 -0
  142. package/localization-4ba17032.js +46 -0
  143. package/objectWithoutPropertiesLoose-299691d8.js +78 -0
  144. package/package.json +190 -0
  145. package/rangeAndSlider-20599da4.js +8839 -0
  146. package/react-beautiful-dnd.esm-38c37304.js +10117 -0
  147. package/style-inject.es-746bb8ed.js +28 -0
  148. package/useClickOutside-5183e396.js +25 -0
  149. package/useDeviceType-dd51db38.js +15 -0
  150. package/useEllipsisDetection-ef536015.js +23 -0
  151. package/useKeyDown-38102ae7.js +21 -0
  152. package/useMount-6fef51a5.js +9 -0
  153. package/useWidth-9f4647f8.js +15 -0
  154. package/useWindowSize-80369d76.js +33 -0
@@ -0,0 +1,411 @@
1
+ import { c as commonjsGlobal } from './_commonjsHelpers-24198af3.js';
2
+ import React__default from 'react';
3
+ import ReactDOM__default from 'react-dom';
4
+
5
+ var Popover$1 = {};
6
+
7
+ var util = {};
8
+
9
+ Object.defineProperty(util, "__esModule", { value: true });
10
+ util.Constants = {
11
+ POPOVER_CONTAINER_CLASS_NAME: 'react-tiny-popover-container',
12
+ DEFAULT_PADDING: 6,
13
+ DEFAULT_WINDOW_PADDING: 6,
14
+ FADE_TRANSITION: 0.35,
15
+ DEFAULT_ARROW_COLOR: 'black',
16
+ DEFAULT_POSITIONS: ['top', 'left', 'right', 'bottom'],
17
+ EMPTY_CLIENT_RECT: {
18
+ top: 0,
19
+ left: 0,
20
+ bottom: 0,
21
+ height: 0,
22
+ right: 0,
23
+ width: 0,
24
+ },
25
+ };
26
+ util.arrayUnique = function (array) { return array.filter(function (value, index, self) { return self.indexOf(value) === index; }); };
27
+
28
+ var ArrowContainer$1 = {};
29
+
30
+ var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
31
+ __assign = Object.assign || function(t) {
32
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
33
+ s = arguments[i];
34
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
35
+ t[p] = s[p];
36
+ }
37
+ return t;
38
+ };
39
+ return __assign.apply(this, arguments);
40
+ };
41
+ Object.defineProperty(ArrowContainer$1, "__esModule", { value: true });
42
+ var React$1 = React__default;
43
+ var util_1$1 = util;
44
+ var ArrowContainer = function (_a) {
45
+ var position = _a.position, children = _a.children, style = _a.style, _b = _a.arrowColor, arrowColor = _b === void 0 ? util_1$1.Constants.DEFAULT_ARROW_COLOR : _b, _c = _a.arrowSize, arrowSize = _c === void 0 ? 10 : _c, arrowStyle = _a.arrowStyle, popoverRect = _a.popoverRect, targetRect = _a.targetRect;
46
+ return (React$1.createElement("div", { style: __assign({ paddingLeft: position === 'right' ? arrowSize : 0, paddingTop: position === 'bottom' ? arrowSize : 0, paddingBottom: position === 'top' ? arrowSize : 0, paddingRight: position === 'left' ? arrowSize : 0 }, style) },
47
+ React$1.createElement("div", { style: __assign({ position: 'absolute' }, (function () {
48
+ var arrowWidth = arrowSize * 2;
49
+ var top = (targetRect.top - popoverRect.top) + (targetRect.height / 2) - (arrowWidth / 2);
50
+ var left = (targetRect.left - popoverRect.left) + (targetRect.width / 2) - (arrowWidth / 2);
51
+ left = left < 0 ? 0 : left;
52
+ left = left + arrowWidth > popoverRect.width ? popoverRect.width - arrowWidth : left;
53
+ top = top < 0 ? 0 : top;
54
+ top = top + arrowWidth > popoverRect.height ? popoverRect.height - arrowWidth : top;
55
+ switch (position) {
56
+ case 'right':
57
+ return {
58
+ borderTop: arrowSize + "px solid transparent",
59
+ borderBottom: arrowSize + "px solid transparent",
60
+ borderRight: arrowSize + "px solid " + arrowColor,
61
+ left: 0,
62
+ top: top,
63
+ };
64
+ case 'left':
65
+ return {
66
+ borderTop: arrowSize + "px solid transparent",
67
+ borderBottom: arrowSize + "px solid transparent",
68
+ borderLeft: arrowSize + "px solid " + arrowColor,
69
+ right: 0,
70
+ top: top,
71
+ };
72
+ case 'bottom':
73
+ return {
74
+ borderLeft: arrowSize + "px solid transparent",
75
+ borderRight: arrowSize + "px solid transparent",
76
+ borderBottom: arrowSize + "px solid " + arrowColor,
77
+ top: 0,
78
+ left: left,
79
+ };
80
+ case 'top':
81
+ default:
82
+ return {
83
+ borderLeft: arrowSize + "px solid transparent",
84
+ borderRight: arrowSize + "px solid transparent",
85
+ borderTop: arrowSize + "px solid " + arrowColor,
86
+ bottom: 0,
87
+ left: left,
88
+ };
89
+ }
90
+ })(), arrowStyle) }),
91
+ children));
92
+ };
93
+ ArrowContainer$1.ArrowContainer = ArrowContainer;
94
+
95
+ var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
96
+ var extendStatics = function (d, b) {
97
+ extendStatics = Object.setPrototypeOf ||
98
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
99
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
100
+ return extendStatics(d, b);
101
+ };
102
+ return function (d, b) {
103
+ extendStatics(d, b);
104
+ function __() { this.constructor = d; }
105
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
106
+ };
107
+ })();
108
+ Object.defineProperty(Popover$1, "__esModule", { value: true });
109
+ var React = React__default;
110
+ var react_dom_1 = ReactDOM__default;
111
+ var util_1 = util;
112
+ var ArrowContainer_1 = ArrowContainer$1;
113
+ Popover$1.ArrowContainer = ArrowContainer_1.ArrowContainer;
114
+ var Popover = /** @class */ (function (_super) {
115
+ __extends(Popover, _super);
116
+ function Popover() {
117
+ var _this = _super !== null && _super.apply(this, arguments) || this;
118
+ _this.target = null;
119
+ _this.targetRect = null;
120
+ _this.targetPositionIntervalHandler = null;
121
+ _this.popoverDiv = null;
122
+ _this.positionOrder = null;
123
+ _this.willUnmount = false;
124
+ _this.willMount = false;
125
+ _this.onResize = function (e) {
126
+ _this.renderPopover();
127
+ };
128
+ _this.onClick = function (e) {
129
+ var _a = _this.props, onClickOutside = _a.onClickOutside, isOpen = _a.isOpen;
130
+ if (!_this.willUnmount && !_this.willMount && !_this.popoverDiv.contains(e.target) && !_this.target.contains(e.target) && onClickOutside && isOpen) {
131
+ onClickOutside(e);
132
+ }
133
+ };
134
+ return _this;
135
+ }
136
+ Popover.prototype.componentDidMount = function () {
137
+ var _this = this;
138
+ window.setTimeout(function () { return _this.willMount = false; });
139
+ var _a = this.props, position = _a.position, isOpen = _a.isOpen;
140
+ this.target = react_dom_1.findDOMNode(this);
141
+ this.positionOrder = this.getPositionPriorityOrder(position);
142
+ this.updatePopover(isOpen);
143
+ };
144
+ Popover.prototype.componentDidUpdate = function (prevProps) {
145
+ if (this.target == null) {
146
+ this.target = react_dom_1.findDOMNode(this);
147
+ }
148
+ var prevIsOpen = prevProps.isOpen, prevPosition = prevProps.position, prevBody = prevProps.content;
149
+ var _a = this.props, isOpen = _a.isOpen, content = _a.content, position = _a.position;
150
+ this.positionOrder = this.getPositionPriorityOrder(this.props.position);
151
+ var hasNewDestination = prevProps.contentDestination !== this.props.contentDestination;
152
+ if (prevIsOpen !== isOpen ||
153
+ prevBody !== content ||
154
+ prevPosition !== position ||
155
+ hasNewDestination) {
156
+ if (hasNewDestination) {
157
+ this.removePopover();
158
+ this.popoverDiv.remove();
159
+ }
160
+ this.updatePopover(isOpen);
161
+ }
162
+ };
163
+ Popover.prototype.componentWillMount = function () {
164
+ this.willUnmount = false;
165
+ this.willMount = true;
166
+ };
167
+ Popover.prototype.componentWillUnmount = function () {
168
+ this.willUnmount = true;
169
+ this.removePopover();
170
+ };
171
+ Popover.prototype.render = function () {
172
+ return this.props.children;
173
+ };
174
+ Popover.prototype.updatePopover = function (isOpen) {
175
+ if (isOpen && this.target != null) {
176
+ if (!this.popoverDiv || !this.popoverDiv.parentNode) {
177
+ var transitionDuration = this.props.transitionDuration;
178
+ this.popoverDiv = this.createContainer();
179
+ this.popoverDiv.style.opacity = '0';
180
+ this.popoverDiv.style.transition = "opacity " + (transitionDuration || util_1.Constants.FADE_TRANSITION) + "s";
181
+ (this.props.contentDestination || window.document.body).appendChild(this.popoverDiv);
182
+ window.addEventListener('resize', this.onResize);
183
+ window.addEventListener('click', this.onClick);
184
+ }
185
+ this.renderPopover();
186
+ }
187
+ else if (this.popoverDiv && this.popoverDiv.parentNode) {
188
+ this.removePopover();
189
+ }
190
+ };
191
+ Popover.prototype.renderPopover = function (positionIndex) {
192
+ var _this = this;
193
+ if (positionIndex === void 0) { positionIndex = 0; }
194
+ if (positionIndex >= this.positionOrder.length) {
195
+ this.removePopover();
196
+ return;
197
+ }
198
+ this.renderWithPosition({ position: this.positionOrder[positionIndex], targetRect: this.target.getBoundingClientRect() }, function (violation, rect) {
199
+ var _a;
200
+ var _b = _this.props, disableReposition = _b.disableReposition, contentLocation = _b.contentLocation;
201
+ if (violation && !disableReposition && !(typeof contentLocation === 'object')) {
202
+ _this.renderPopover(positionIndex + 1);
203
+ }
204
+ else {
205
+ var _c = _this.props, contentLocation_1 = _c.contentLocation, align = _c.align;
206
+ var _d = _this.getNudgedPopoverPosition(rect), nudgedTop = _d.top, nudgedLeft = _d.left;
207
+ var rectTop = rect.top, rectLeft = rect.left;
208
+ var position = _this.positionOrder[positionIndex];
209
+ var _e = disableReposition ? { top: rectTop, left: rectLeft } : { top: nudgedTop, left: nudgedLeft }, top_1 = _e.top, left = _e.left;
210
+ if (contentLocation_1) {
211
+ var targetRect = _this.target.getBoundingClientRect();
212
+ var popoverRect = _this.popoverDiv.getBoundingClientRect();
213
+ (_a = typeof contentLocation_1 === 'function' ? contentLocation_1({ targetRect: targetRect, popoverRect: popoverRect, position: position, align: align, nudgedLeft: nudgedLeft, nudgedTop: nudgedTop }) : contentLocation_1, top_1 = _a.top, left = _a.left);
214
+ _this.popoverDiv.style.left = left.toFixed() + "px";
215
+ _this.popoverDiv.style.top = top_1.toFixed() + "px";
216
+ }
217
+ else {
218
+ var destinationTopOffset = 0;
219
+ var destinationLeftOffset = 0;
220
+ if (_this.props.contentDestination) {
221
+ var destRect = _this.props.contentDestination.getBoundingClientRect();
222
+ destinationTopOffset = -destRect.top;
223
+ destinationLeftOffset = -destRect.left;
224
+ }
225
+ var _f = [top_1 + window.pageYOffset, left + window.pageXOffset], absoluteTop = _f[0], absoluteLeft = _f[1];
226
+ var finalLeft = absoluteLeft + destinationTopOffset;
227
+ var finalTop = absoluteTop + destinationLeftOffset;
228
+ _this.popoverDiv.style.left = finalLeft.toFixed() + "px";
229
+ _this.popoverDiv.style.top = finalTop.toFixed() + "px";
230
+ }
231
+ _this.popoverDiv.style.width = null;
232
+ _this.popoverDiv.style.height = null;
233
+ _this.renderWithPosition({
234
+ position: position,
235
+ nudgedTop: nudgedTop - rect.top,
236
+ nudgedLeft: nudgedLeft - rect.left,
237
+ targetRect: _this.target.getBoundingClientRect(),
238
+ popoverRect: _this.popoverDiv.getBoundingClientRect(),
239
+ }, function () {
240
+ _this.startTargetPositionListener(10);
241
+ if (_this.popoverDiv.style.opacity !== '1') {
242
+ _this.popoverDiv.style.opacity = '1';
243
+ }
244
+ });
245
+ }
246
+ });
247
+ };
248
+ Popover.prototype.startTargetPositionListener = function (checkInterval) {
249
+ var _this = this;
250
+ if (this.targetPositionIntervalHandler === null) {
251
+ this.targetPositionIntervalHandler = window.setInterval(function () {
252
+ var newTargetRect = _this.target.getBoundingClientRect();
253
+ if (_this.targetPositionHasChanged(_this.targetRect, newTargetRect)) {
254
+ _this.renderPopover();
255
+ }
256
+ _this.targetRect = newTargetRect;
257
+ }, checkInterval);
258
+ }
259
+ };
260
+ Popover.prototype.renderWithPosition = function (_a, callback) {
261
+ var _this = this;
262
+ var position = _a.position, _b = _a.nudgedLeft, nudgedLeft = _b === void 0 ? 0 : _b, _c = _a.nudgedTop, nudgedTop = _c === void 0 ? 0 : _c, _d = _a.targetRect, targetRect = _d === void 0 ? util_1.Constants.EMPTY_CLIENT_RECT : _d, _e = _a.popoverRect, popoverRect = _e === void 0 ? util_1.Constants.EMPTY_CLIENT_RECT : _e;
263
+ var _f = this.props, padding = _f.windowBorderPadding, content = _f.content, align = _f.align;
264
+ var getContent = function (args) {
265
+ return typeof content === 'function'
266
+ ? content(args)
267
+ : content;
268
+ };
269
+ react_dom_1.unstable_renderSubtreeIntoContainer(this, getContent({ position: position, nudgedLeft: nudgedLeft, nudgedTop: nudgedTop, targetRect: targetRect, popoverRect: popoverRect, align: align }), this.popoverDiv, function () {
270
+ if (_this.willUnmount) {
271
+ return;
272
+ }
273
+ var targetRect = _this.target.getBoundingClientRect();
274
+ var popoverRect = _this.popoverDiv.getBoundingClientRect();
275
+ var _a = _this.getLocationForPosition(position, targetRect, popoverRect), top = _a.top, left = _a.left;
276
+ callback(position === 'top' && top < padding ||
277
+ position === 'left' && left < padding ||
278
+ position === 'right' && left + popoverRect.width > window.innerWidth - padding ||
279
+ position === 'bottom' && top + popoverRect.height > window.innerHeight - padding, { width: popoverRect.width, height: popoverRect.height, top: top, left: left });
280
+ });
281
+ };
282
+ Popover.prototype.getNudgedPopoverPosition = function (_a) {
283
+ var top = _a.top, left = _a.left, width = _a.width, height = _a.height;
284
+ var padding = this.props.windowBorderPadding;
285
+ top = top < padding ? padding : top;
286
+ top = top + height > window.innerHeight - padding ? window.innerHeight - padding - height : top;
287
+ left = left < padding ? padding : left;
288
+ left = left + width > window.innerWidth - padding ? window.innerWidth - padding - width : left;
289
+ return { top: top, left: left };
290
+ };
291
+ Popover.prototype.removePopover = function () {
292
+ var _this = this;
293
+ if (this.popoverDiv) {
294
+ var transitionDuration = this.props.transitionDuration;
295
+ this.popoverDiv.style.opacity = '0';
296
+ var remove = function () {
297
+ if (_this.willUnmount || !_this.props.isOpen || !_this.popoverDiv.parentNode) {
298
+ window.clearInterval(_this.targetPositionIntervalHandler);
299
+ window.removeEventListener('resize', _this.onResize);
300
+ window.removeEventListener('click', _this.onClick);
301
+ _this.targetPositionIntervalHandler = null;
302
+ if (_this.popoverDiv.parentNode) {
303
+ _this.popoverDiv.parentNode.removeChild(_this.popoverDiv);
304
+ }
305
+ }
306
+ };
307
+ if (!this.willUnmount) {
308
+ window.setTimeout(remove, (transitionDuration || util_1.Constants.FADE_TRANSITION) * 1000);
309
+ }
310
+ else {
311
+ remove();
312
+ }
313
+ }
314
+ };
315
+ Popover.prototype.getPositionPriorityOrder = function (position) {
316
+ if (position && typeof position !== 'string') {
317
+ if (util_1.Constants.DEFAULT_POSITIONS.every(function (defaultPosition) { return position.find(function (p) { return p === defaultPosition; }) !== undefined; })) {
318
+ return util_1.arrayUnique(position);
319
+ }
320
+ else {
321
+ var remainingPositions = util_1.Constants.DEFAULT_POSITIONS.filter(function (defaultPosition) { return position.find(function (p) { return p === defaultPosition; }) === undefined; });
322
+ return util_1.arrayUnique(position.concat(remainingPositions));
323
+ }
324
+ }
325
+ else if (position && typeof position === 'string') {
326
+ var remainingPositions = util_1.Constants.DEFAULT_POSITIONS.filter(function (defaultPosition) { return defaultPosition !== position; });
327
+ return util_1.arrayUnique([position].concat(remainingPositions));
328
+ }
329
+ };
330
+ Popover.prototype.createContainer = function () {
331
+ var _a = this.props, containerStyle = _a.containerStyle, containerClassName = _a.containerClassName;
332
+ var container = window.document.createElement('div');
333
+ container.style.overflow = 'hidden';
334
+ if (containerStyle) {
335
+ Object.keys(containerStyle).forEach(function (key) { return container.style[key] = containerStyle[key]; });
336
+ }
337
+ container.className = containerClassName;
338
+ container.style.position = 'absolute';
339
+ container.style.top = '0';
340
+ container.style.left = '0';
341
+ return container;
342
+ };
343
+ Popover.prototype.getLocationForPosition = function (position, newTargetRect, popoverRect) {
344
+ var _a = this.props, padding = _a.padding, align = _a.align;
345
+ var targetMidX = newTargetRect.left + (newTargetRect.width / 2);
346
+ var targetMidY = newTargetRect.top + (newTargetRect.height / 2);
347
+ var top;
348
+ var left;
349
+ switch (position) {
350
+ case 'top':
351
+ top = newTargetRect.top - popoverRect.height - padding;
352
+ left = targetMidX - (popoverRect.width / 2);
353
+ if (align === 'start') {
354
+ left = newTargetRect.left;
355
+ }
356
+ if (align === 'end') {
357
+ left = newTargetRect.right - popoverRect.width;
358
+ }
359
+ break;
360
+ case 'left':
361
+ top = targetMidY - (popoverRect.height / 2);
362
+ left = newTargetRect.left - padding - popoverRect.width;
363
+ if (align === 'start') {
364
+ top = newTargetRect.top;
365
+ }
366
+ if (align === 'end') {
367
+ top = newTargetRect.bottom - popoverRect.height;
368
+ }
369
+ break;
370
+ case 'bottom':
371
+ top = newTargetRect.bottom + padding;
372
+ left = targetMidX - (popoverRect.width / 2);
373
+ if (align === 'start') {
374
+ left = newTargetRect.left;
375
+ }
376
+ if (align === 'end') {
377
+ left = newTargetRect.right - popoverRect.width;
378
+ }
379
+ break;
380
+ case 'right':
381
+ top = targetMidY - (popoverRect.height / 2);
382
+ left = newTargetRect.right + padding;
383
+ if (align === 'start') {
384
+ top = newTargetRect.top;
385
+ }
386
+ if (align === 'end') {
387
+ top = newTargetRect.bottom - popoverRect.height;
388
+ }
389
+ break;
390
+ }
391
+ return { top: top, left: left };
392
+ };
393
+ Popover.prototype.targetPositionHasChanged = function (oldTargetRect, newTargetRect) {
394
+ return oldTargetRect === null
395
+ || oldTargetRect.left !== newTargetRect.left
396
+ || oldTargetRect.top !== newTargetRect.top
397
+ || oldTargetRect.width !== newTargetRect.width
398
+ || oldTargetRect.height !== newTargetRect.height;
399
+ };
400
+ Popover.defaultProps = {
401
+ padding: util_1.Constants.DEFAULT_PADDING,
402
+ windowBorderPadding: util_1.Constants.DEFAULT_WINDOW_PADDING,
403
+ position: ['top', 'right', 'left', 'bottom'],
404
+ align: 'center',
405
+ containerClassName: util_1.Constants.POPOVER_CONTAINER_CLASS_NAME,
406
+ };
407
+ return Popover;
408
+ }(React.Component));
409
+ var _default = Popover$1.default = Popover;
410
+
411
+ export { _default as _ };
package/Popover.js ADDED
@@ -0,0 +1,20 @@
1
+ import './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import 'react';
3
+ import './Popover-f4d1cac0.js';
4
+ import './index-122432cd.js';
5
+ import './index-6ff23041.js';
6
+ import './index-e0af0caf.js';
7
+ import './index-ac59cb10.js';
8
+ import './useDeviceType-dd51db38.js';
9
+ export { P as default } from './index-a4635754.js';
10
+ import './configs-91c86664.js';
11
+ import './GeneUIProvider.js';
12
+ import './Portal.js';
13
+ import './Scrollbar.js';
14
+ import './globalStyling-9c60a159.js';
15
+ import './guid-8ddf77b3.js';
16
+ import './_commonjsHelpers-24198af3.js';
17
+ import 'react-dom';
18
+ import './dateValidation-67caec66.js';
19
+ import './useWindowSize-80369d76.js';
20
+ import './style-inject.es-746bb8ed.js';
package/PopoverV2.js ADDED
@@ -0,0 +1,19 @@
1
+ import './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import 'react';
3
+ export { P as default } from './index-702bf24a.js';
4
+ import './index-122432cd.js';
5
+ import './index-6ff23041.js';
6
+ import './index-e0af0caf.js';
7
+ import './index-ac59cb10.js';
8
+ import './useDeviceType-dd51db38.js';
9
+ import './useClickOutside-5183e396.js';
10
+ import './configs-91c86664.js';
11
+ import './Scrollbar.js';
12
+ import './globalStyling-9c60a159.js';
13
+ import './GeneUIProvider.js';
14
+ import './debounce-4419bc2f.js';
15
+ import './_commonjsHelpers-24198af3.js';
16
+ import 'react-dom';
17
+ import './style-inject.es-746bb8ed.js';
18
+ import './dateValidation-67caec66.js';
19
+ import './useWindowSize-80369d76.js';
package/Portal.js ADDED
@@ -0,0 +1,58 @@
1
+ import { memo, useState, useContext, useEffect } from 'react';
2
+ import ReactDOM__default from 'react-dom';
3
+ import { p as propTypesExports } from './index-e0af0caf.js';
4
+ import './globalStyling-9c60a159.js';
5
+ import { GeneUIDesignSystemContext } from './GeneUIProvider.js';
6
+ import './style-inject.es-746bb8ed.js';
7
+
8
+ function Portal(_ref) {
9
+ let {
10
+ isOpen,
11
+ children,
12
+ className,
13
+ container: propsContainer
14
+ } = _ref;
15
+ const [container, setContainer] = useState(propsContainer);
16
+ const {
17
+ geneUIProviderRef
18
+ } = useContext(GeneUIDesignSystemContext);
19
+ useEffect(() => {
20
+ if (!propsContainer) {
21
+ const div = document.createElement('div');
22
+ if (className) {
23
+ div.className = className;
24
+ }
25
+ setContainer(div);
26
+ geneUIProviderRef.current.appendChild(div);
27
+ return () => {
28
+ var _geneUIProviderRef$cu;
29
+ (_geneUIProviderRef$cu = geneUIProviderRef.current) === null || _geneUIProviderRef$cu === void 0 ? void 0 : _geneUIProviderRef$cu.removeChild(div);
30
+ };
31
+ }
32
+ }, [className, propsContainer]);
33
+ return isOpen && container ? /*#__PURE__*/ReactDOM__default.createPortal(children, container) : null;
34
+ }
35
+ Portal.propTypes = {
36
+ /**
37
+ * Specify Portal visibility
38
+ */
39
+ isOpen: propTypesExports.bool,
40
+ /**
41
+ * A DOM element for Portal to be appended. When not specified the Portal will create a "div" element and append in body
42
+ */
43
+ container: propTypesExports.instanceOf(Element),
44
+ /**
45
+ * Additional className
46
+ */
47
+ className: propTypesExports.string,
48
+ /**
49
+ * Anything passed to the Portal as child will be rendered in "container". Any valid React node
50
+ */
51
+ children: propTypesExports.node
52
+ };
53
+ Portal.defaultProps = {
54
+ isOpen: false
55
+ };
56
+ var Portal$1 = /*#__PURE__*/memo(Portal);
57
+
58
+ export { Portal$1 as default };
package/Products.js ADDED
@@ -0,0 +1,115 @@
1
+ import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
2
+ import React__default from 'react';
3
+ import { p as propTypesExports } from './index-e0af0caf.js';
4
+ import { c as classnames } from './index-6ff23041.js';
5
+ import { s as screenTypes } from './configs-91c86664.js';
6
+ import './dateValidation-67caec66.js';
7
+ import 'react-dom';
8
+ import { u as useDeviceType } from './useDeviceType-dd51db38.js';
9
+ import Icon from './Icon.js';
10
+ import Divider from './Divider.js';
11
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
12
+ import './_commonjsHelpers-24198af3.js';
13
+ import './useWindowSize-80369d76.js';
14
+ import './globalStyling-9c60a159.js';
15
+
16
+ var css_248z = "[data-gene-ui-version=\"2.11.0\"] .products-switcher-holder{display:flex;flex-wrap:wrap;justify-content:flex-start;padding:.5rem 2rem;text-align:center;width:100%}[data-gene-ui-version=\"2.11.0\"] .products-switcher-holder .divider{margin-left:auto;margin-right:auto}[data-gene-ui-version=\"2.11.0\"] .product-item{border:1px solid #0000;border-radius:1rem;cursor:pointer;display:flex;flex-wrap:wrap;font:600 1.2rem/1.42 var(--font-family);justify-content:center;margin:.5rem 0;padding:1rem .5rem;text-align:center;width:33.3333333333%}[data-gene-ui-version=\"2.11.0\"] .product-item .icon{align-items:center;background:rgba(var(--background-sc-rgb),.05);border-radius:100%;display:flex;height:5rem;justify-content:center;margin:0 0 .5rem;transition:color .2s,background .2s;width:5rem}[data-gene-ui-version=\"2.11.0\"] .product-item p{width:100%}@media (hover:hover){[data-gene-ui-version=\"2.11.0\"] .product-item:hover .icon{background:var(--hero);color:var(--hero-sc)}}[data-gene-ui-version=\"2.11.0\"] .product-item.active .icon{background:var(--hero);color:var(--hero-sc)}[data-gene-ui-version=\"2.11.0\"] .product-item.active{pointer-events:none}@media (hover:hover){[data-gene-ui-version=\"2.11.0\"] .product-item:hover{border-color:rgba(var(--background-sc-rgb),.11)}}";
17
+ styleInject(css_248z);
18
+
19
+ function Products(_ref) {
20
+ let {
21
+ list,
22
+ activeSlug,
23
+ onChange,
24
+ favorites,
25
+ className,
26
+ screenType,
27
+ ...restProps
28
+ } = _ref;
29
+ const {
30
+ isMobile
31
+ } = useDeviceType(screenType);
32
+ const hasFavorites = favorites.length;
33
+ const handleClick = event => {
34
+ const {
35
+ index
36
+ } = event.currentTarget.dataset;
37
+ const item = list[index];
38
+ onChange && onChange(item);
39
+ };
40
+ return /*#__PURE__*/React__default.createElement("div", _extends({
41
+ className: classnames('products-switcher-holder', className)
42
+ }, restProps), list.map((item, index) => /*#__PURE__*/React__default.createElement("button", {
43
+ key: item.slug,
44
+ className: classnames('product-item', {
45
+ active: item.slug === activeSlug
46
+ }),
47
+ "data-index": index,
48
+ onClick: handleClick,
49
+ title: item.title
50
+ }, /*#__PURE__*/React__default.createElement(Icon, {
51
+ type: item.icon
52
+ }), /*#__PURE__*/React__default.createElement("p", {
53
+ className: "ellipsis-text"
54
+ }, item.title))), hasFavorites > 0 && /*#__PURE__*/React__default.createElement(Divider, {
55
+ type: "horizontal",
56
+ size: isMobile ? '76%' : '100%'
57
+ }), hasFavorites > 0 && favorites.map((item, index) => /*#__PURE__*/React__default.createElement("button", {
58
+ key: item.slug,
59
+ className: classnames('product-item', {
60
+ active: item.slug === activeSlug
61
+ }),
62
+ "data-index": index,
63
+ onClick: handleClick,
64
+ title: item.title
65
+ }, /*#__PURE__*/React__default.createElement(Icon, {
66
+ type: item.icon
67
+ }), /*#__PURE__*/React__default.createElement("p", {
68
+ className: "ellipsis-text"
69
+ }, item.title))));
70
+ }
71
+ const propShape = propTypesExports.arrayOf(propTypesExports.shape({
72
+ /**
73
+ * Product title
74
+ */
75
+ title: propTypesExports.string,
76
+ /**
77
+ * Product slug
78
+ */
79
+ slug: propTypesExports.string,
80
+ /**
81
+ * Product icon
82
+ */
83
+ icon: propTypesExports.string
84
+ }));
85
+ Products.propTypes = {
86
+ /**
87
+ * Array of products data
88
+ */
89
+ list: propShape.isRequired,
90
+ /**
91
+ * Array of favorite products data
92
+ */
93
+ favorites: propShape,
94
+ /**
95
+ * Selected item
96
+ */
97
+ activeSlug: propTypesExports.string,
98
+ /**
99
+ * CSS class name for element
100
+ */
101
+ className: propTypesExports.string,
102
+ /**
103
+ * Callback fires when click on product
104
+ */
105
+ onClick: propTypesExports.func,
106
+ /**
107
+ * Pass screenType to control appearance, weather it should be mobile version etc.
108
+ */
109
+ screenType: propTypesExports.oneOf(screenTypes)
110
+ };
111
+ Products.defaultProps = {
112
+ favorites: []
113
+ };
114
+
115
+ export { Products as default };