@splunk/react-ui 4.13.0 → 4.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +2 -0
- package/Accordion.js +41 -16
- package/Anchor.js +9 -9
- package/Animation.js +6 -6
- package/AnimationToggle.js +2 -2
- package/Box.js +9 -9
- package/Button.js +47 -46
- package/ButtonGroup.js +9 -9
- package/ButtonSimple.js +14 -14
- package/CHANGELOG.md +46 -1
- package/Calendar.js +460 -147
- package/Card.js +85 -83
- package/CardLayout.js +9 -9
- package/Chip.js +23 -23
- package/Clickable.js +39 -15
- package/CloseButton.js +23 -23
- package/Code.js +484 -436
- package/CollapsiblePanel.js +64 -35
- package/Color.js +298 -188
- package/ColumnLayout.js +18 -17
- package/ComboBox.js +81 -32
- package/Concertina.js +89 -28
- package/ControlGroup.js +85 -27
- package/Date.js +134 -58
- package/DefinitionList.js +14 -8
- package/Divider.d.ts +2 -0
- package/Divider.js +194 -0
- package/Dockerfile.enterprise.storybook +7 -0
- package/Dockerfile.prisma.storybook +7 -0
- package/Dockerfile.visual +10 -0
- package/Dropdown.js +79 -19
- package/EventListener.js +17 -17
- package/File.js +96 -43
- package/FormRows.js +40 -39
- package/Heading.js +83 -55
- package/Image.js +67 -42
- package/JSONTree.js +106 -21
- package/Layer.js +130 -28
- package/Link.js +17 -17
- package/List.js +3 -3
- package/Markdown.js +71 -65
- package/Menu.js +155 -121
- package/Message.js +135 -135
- package/MessageBar.js +136 -136
- package/Modal.js +99 -48
- package/ModalLayer.js +15 -15
- package/Monogram.js +18 -17
- package/Multiselect.js +2788 -2310
- package/Number.js +76 -37
- package/Paginator.js +99 -86
- package/Paragraph.js +10 -10
- package/Popover.js +343 -48
- package/Progress.js +23 -22
- package/RadioBar.js +32 -14
- package/RadioList.js +17 -11
- package/Resize.js +34 -21
- package/ResultsMenu.js +44 -31
- package/ScreenReaderContent.js +9 -9
- package/Scroll.js +52 -27
- package/ScrollContainerContext.js +157 -6
- package/Search.js +71 -34
- package/Select.js +347 -69
- package/SidePanel.js +37 -24
- package/Slider.js +50 -20
- package/SlidingPanels.js +56 -18
- package/SplitButton.js +27 -26
- package/StaticContent.js +9 -9
- package/StepBar.js +22 -22
- package/Switch.js +18 -13
- package/TabBar.js +28 -28
- package/TabLayout.js +43 -18
- package/Table.js +549 -158
- package/Text.js +93 -50
- package/TextArea.d.ts +2 -0
- package/TextArea.js +134 -56
- package/Tooltip.js +246 -63
- package/TransitionOpen.js +63 -26
- package/Typography.d.ts +2 -0
- package/Typography.js +17 -16
- package/WaitSpinner.js +15 -81
- package/docker-compose.yml +42 -0
- package/package.json +20 -20
- package/test-runner-jest.config.js +23 -5
- package/types/src/Accordion/AccordionContext.d.ts +1 -0
- package/types/src/Button/docs/examples/Selected.d.ts +2 -2
- package/types/src/ButtonGroup/ButtonGroupContext.d.ts +1 -0
- package/types/src/Calendar/Calendar.d.ts +17 -2
- package/types/src/Calendar/DateTable.d.ts +7 -3
- package/types/src/Calendar/Day.d.ts +14 -5
- package/types/src/CardLayout/CardLayoutContext.d.ts +1 -0
- package/types/src/CollapsiblePanel/CollapsiblePanel.d.ts +7 -3
- package/types/src/Concertina/ConcertinaContext.d.ts +1 -0
- package/types/src/ControlGroup/ControlGroup.d.ts +15 -8
- package/types/src/ControlGroup/docs/examples/HelpWithErrorText.d.ts +2 -0
- package/types/src/ControlGroup/docs/examples/Required.d.ts +2 -0
- package/types/src/Date/Date.d.ts +17 -8
- package/types/src/Date/docs/examples/CustomDate.d.ts +2 -2
- package/types/src/Date/docs/examples/Disabled.d.ts +2 -2
- package/types/src/Date/docs/examples/prisma/WithoutCalendar.d.ts +2 -0
- package/types/src/Divider/Divider.d.ts +20 -0
- package/types/src/Divider/docs/examples/AriaHidden.d.ts +2 -0
- package/types/src/Divider/docs/examples/Basic.d.ts +2 -0
- package/types/src/Divider/docs/examples/CustomStyle.d.ts +2 -0
- package/types/src/Divider/docs/examples/Vertical.d.ts +2 -0
- package/types/src/Divider/index.d.ts +1 -0
- package/types/src/File/File.d.ts +4 -2
- package/types/src/File/FileContext.d.ts +1 -0
- package/types/src/FormRows/FormRowsContext.d.ts +1 -0
- package/types/src/Markdown/renderers/MarkdownLink.d.ts +1 -1
- package/types/src/Menu/MenuContext.d.ts +1 -0
- package/types/src/Modal/Modal.d.ts +7 -3
- package/types/src/Modal/ModalContext.d.ts +2 -0
- package/types/src/Multiselect/Compact.d.ts +10 -1
- package/types/src/Multiselect/Multiselect.d.ts +12 -1
- package/types/src/Multiselect/Normal.d.ts +2 -0
- package/types/src/Number/Number.d.ts +5 -1
- package/types/src/Popover/Popover.d.ts +25 -5
- package/types/src/Popover/PopoverContext.d.ts +1 -0
- package/types/src/RadioBar/RadioBar.d.ts +5 -3
- package/types/src/RadioBar/RadioBarContext.d.ts +1 -0
- package/types/src/RadioList/RadioList.d.ts +5 -1
- package/types/src/RadioList/RadioListContext.d.ts +1 -0
- package/types/src/Select/SelectBase.d.ts +2 -0
- package/types/src/Slider/Slider.d.ts +5 -3
- package/types/src/SplitButton/docs/examples/Disabled.d.ts +1 -1
- package/types/src/SplitButton/docs/examples/prisma/Disabled.d.ts +1 -1
- package/types/src/StepBar/StepBarContext.d.ts +1 -0
- package/types/src/Switch/Switch.d.ts +2 -0
- package/types/src/TabBar/TabBarContext.d.ts +1 -0
- package/types/src/Table/Head.d.ts +2 -0
- package/types/src/Table/TableContext.d.ts +1 -0
- package/types/src/Table/docs/examples/FilterColumnValues.d.ts +14 -0
- package/types/src/Text/Text.d.ts +5 -3
- package/types/src/TextArea/TextArea.d.ts +5 -3
- package/types/src/Tooltip/Tooltip.d.ts +26 -9
- package/types/src/TransitionOpen/TransitionOpen.d.ts +7 -3
- package/types/src/WaitSpinner/WaitSpinner.d.ts +1 -1
- package/types/src/useForceUpdate/useForceUpdate.d.ts +1 -0
- package/types/src/useKeyPress/index.d.ts +37 -0
- package/useForceUpdate.js +9 -9
- package/{useIsSsr.js → useKeyPress.js} +56 -49
- package/usePrevious.js +9 -9
- package/types/src/useIsSsr/index.d.ts +0 -2
- package/types/src/useIsSsr/useIsSsr.d.ts +0 -8
package/Tooltip.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 201);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
@@ -101,28 +101,42 @@ module.exports = require("prop-types");
|
|
|
101
101
|
|
|
102
102
|
/***/ }),
|
|
103
103
|
|
|
104
|
-
/***/
|
|
104
|
+
/***/ 11:
|
|
105
|
+
/***/ (function(module, exports) {
|
|
106
|
+
|
|
107
|
+
module.exports = require("lodash/has");
|
|
108
|
+
|
|
109
|
+
/***/ }),
|
|
110
|
+
|
|
111
|
+
/***/ 13:
|
|
105
112
|
/***/ (function(module, exports) {
|
|
106
113
|
|
|
107
114
|
module.exports = require("@splunk/ui-utils/id");
|
|
108
115
|
|
|
109
116
|
/***/ }),
|
|
110
117
|
|
|
111
|
-
/***/
|
|
118
|
+
/***/ 14:
|
|
112
119
|
/***/ (function(module, exports) {
|
|
113
120
|
|
|
114
121
|
module.exports = require("@splunk/react-ui/Clickable");
|
|
115
122
|
|
|
116
123
|
/***/ }),
|
|
117
124
|
|
|
118
|
-
/***/
|
|
125
|
+
/***/ 16:
|
|
119
126
|
/***/ (function(module, exports) {
|
|
120
127
|
|
|
121
128
|
module.exports = require("@splunk/react-ui/ScreenReaderContent");
|
|
122
129
|
|
|
123
130
|
/***/ }),
|
|
124
131
|
|
|
125
|
-
/***/
|
|
132
|
+
/***/ 2:
|
|
133
|
+
/***/ (function(module, exports) {
|
|
134
|
+
|
|
135
|
+
module.exports = require("react");
|
|
136
|
+
|
|
137
|
+
/***/ }),
|
|
138
|
+
|
|
139
|
+
/***/ 201:
|
|
126
140
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
127
141
|
|
|
128
142
|
"use strict";
|
|
@@ -140,28 +154,33 @@ var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_)
|
|
|
140
154
|
var external_prop_types_ = __webpack_require__(1);
|
|
141
155
|
var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
|
|
142
156
|
|
|
143
|
-
// EXTERNAL MODULE: external "lodash"
|
|
144
|
-
var
|
|
157
|
+
// EXTERNAL MODULE: external "lodash/has"
|
|
158
|
+
var has_ = __webpack_require__(11);
|
|
159
|
+
var has_default = /*#__PURE__*/__webpack_require__.n(has_);
|
|
160
|
+
|
|
161
|
+
// EXTERNAL MODULE: external "lodash/throttle"
|
|
162
|
+
var throttle_ = __webpack_require__(31);
|
|
163
|
+
var throttle_default = /*#__PURE__*/__webpack_require__.n(throttle_);
|
|
145
164
|
|
|
146
165
|
// EXTERNAL MODULE: external "@splunk/react-ui/Popover"
|
|
147
|
-
var Popover_ = __webpack_require__(
|
|
166
|
+
var Popover_ = __webpack_require__(23);
|
|
148
167
|
var Popover_default = /*#__PURE__*/__webpack_require__.n(Popover_);
|
|
149
168
|
|
|
150
169
|
// EXTERNAL MODULE: external "@splunk/react-ui/ScreenReaderContent"
|
|
151
|
-
var ScreenReaderContent_ = __webpack_require__(
|
|
170
|
+
var ScreenReaderContent_ = __webpack_require__(16);
|
|
152
171
|
var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_);
|
|
153
172
|
|
|
154
173
|
// EXTERNAL MODULE: external "@splunk/themes"
|
|
155
174
|
var themes_ = __webpack_require__(0);
|
|
156
175
|
|
|
157
176
|
// EXTERNAL MODULE: external "@splunk/ui-utils/id"
|
|
158
|
-
var id_ = __webpack_require__(
|
|
177
|
+
var id_ = __webpack_require__(13);
|
|
159
178
|
|
|
160
179
|
// EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
|
|
161
|
-
var i18n_ = __webpack_require__(
|
|
180
|
+
var i18n_ = __webpack_require__(4);
|
|
162
181
|
|
|
163
182
|
// EXTERNAL MODULE: external "@splunk/react-icons/SVG"
|
|
164
|
-
var SVG_ = __webpack_require__(
|
|
183
|
+
var SVG_ = __webpack_require__(32);
|
|
165
184
|
var SVG_default = /*#__PURE__*/__webpack_require__.n(SVG_);
|
|
166
185
|
|
|
167
186
|
// CONCATENATED MODULE: ./src/Tooltip/InfoIcon.tsx
|
|
@@ -209,7 +228,7 @@ var external_styled_components_ = __webpack_require__(3);
|
|
|
209
228
|
var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
|
|
210
229
|
|
|
211
230
|
// EXTERNAL MODULE: external "@splunk/react-ui/Clickable"
|
|
212
|
-
var Clickable_ = __webpack_require__(
|
|
231
|
+
var Clickable_ = __webpack_require__(14);
|
|
213
232
|
var Clickable_default = /*#__PURE__*/__webpack_require__.n(Clickable_);
|
|
214
233
|
|
|
215
234
|
// CONCATENATED MODULE: ./src/Tooltip/TooltipStyles.ts
|
|
@@ -220,11 +239,11 @@ var TooltipStyles_size = '16px';
|
|
|
220
239
|
var Styled = external_styled_components_default.a.span.withConfig({
|
|
221
240
|
displayName: "TooltipStyles__Styled",
|
|
222
241
|
componentId: "sc-67fvgm-0"
|
|
223
|
-
})(["", ";"], themes_["mixins"].reset('block'));
|
|
242
|
+
})(["", ";position:relative;"], themes_["mixins"].reset('block'));
|
|
224
243
|
var StyledInline = external_styled_components_default.a.span.withConfig({
|
|
225
244
|
displayName: "TooltipStyles__StyledInline",
|
|
226
245
|
componentId: "sc-67fvgm-1"
|
|
227
|
-
})(["", ";"], themes_["mixins"].reset('inline-block'));
|
|
246
|
+
})(["", ";position:relative;"], themes_["mixins"].reset('inline-block'));
|
|
228
247
|
var StyledToggle = external_styled_components_default.a.span.withConfig({
|
|
229
248
|
displayName: "TooltipStyles__StyledToggle",
|
|
230
249
|
componentId: "sc-67fvgm-2"
|
|
@@ -264,6 +283,10 @@ var StyledButton = external_styled_components_default()(Clickable_default.a).wit
|
|
|
264
283
|
compact: Object(external_styled_components_["css"])(["padding:6px;"])
|
|
265
284
|
}
|
|
266
285
|
}), themes_["variables"].focusShadow);
|
|
286
|
+
var StyledHitArea = external_styled_components_default.a.svg.withConfig({
|
|
287
|
+
displayName: "TooltipStyles__StyledHitArea",
|
|
288
|
+
componentId: "sc-67fvgm-6"
|
|
289
|
+
})(["position:absolute;pointer-events:none;path{pointer-events:auto;stroke-width:0;stroke:transparent;fill:transparent;}"]);
|
|
267
290
|
|
|
268
291
|
// CONCATENATED MODULE: ./src/Tooltip/Tooltip.tsx
|
|
269
292
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
@@ -306,11 +329,15 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
306
329
|
|
|
307
330
|
|
|
308
331
|
|
|
332
|
+
|
|
309
333
|
var propTypes = {
|
|
310
334
|
/** @private */
|
|
311
335
|
appearance: external_prop_types_default.a.string,
|
|
312
336
|
children: external_prop_types_default.a.node,
|
|
313
337
|
closeDelay: external_prop_types_default.a.number,
|
|
338
|
+
|
|
339
|
+
/** @private */
|
|
340
|
+
closeWhen: external_prop_types_default.a.oneOf(['default', 'notOnClick']),
|
|
314
341
|
content: external_prop_types_default.a.node,
|
|
315
342
|
contentRelationship: external_prop_types_default.a.oneOf(['label', 'description']),
|
|
316
343
|
defaultPlacement: external_prop_types_default.a.oneOf(['above', 'below', 'left', 'right', 'theme']),
|
|
@@ -326,7 +353,8 @@ var propTypes = {
|
|
|
326
353
|
};
|
|
327
354
|
var defaultProps = {
|
|
328
355
|
appearance: 'inverted',
|
|
329
|
-
closeDelay:
|
|
356
|
+
closeDelay: 300,
|
|
357
|
+
closeWhen: 'default',
|
|
330
358
|
contentRelationship: 'description',
|
|
331
359
|
defaultPlacement: 'theme',
|
|
332
360
|
inline: true,
|
|
@@ -359,20 +387,20 @@ var Tooltip_Tooltip = /*#__PURE__*/function (_Component) {
|
|
|
359
387
|
_defineProperty(_assertThisInitialized(_this), "timeout", void 0);
|
|
360
388
|
|
|
361
389
|
_defineProperty(_assertThisInitialized(_this), "handleMount", function (el) {
|
|
362
|
-
// Handle
|
|
390
|
+
// Handle mouse events with native events due to current issues with how they
|
|
363
391
|
// are handled by react. See https://github.com/facebook/react/issues/4251,
|
|
364
392
|
// https://github.com/facebook/react/issues/19419, and SUI-1232.
|
|
365
393
|
if (el) {
|
|
366
394
|
el.addEventListener('mouseenter', _this.handleMouseEnter);
|
|
367
395
|
el.addEventListener('mouseleave', _this.handleMouseLeave);
|
|
368
|
-
} else if (_this.state.
|
|
369
|
-
_this.state.
|
|
396
|
+
} else if (_this.state.anchorEl) {
|
|
397
|
+
_this.state.anchorEl.removeEventListener('mouseenter', _this.handleMouseEnter);
|
|
370
398
|
|
|
371
|
-
_this.state.
|
|
399
|
+
_this.state.anchorEl.removeEventListener('mouseleave', _this.handleMouseLeave);
|
|
372
400
|
}
|
|
373
401
|
|
|
374
402
|
_this.setState({
|
|
375
|
-
|
|
403
|
+
anchorEl: el
|
|
376
404
|
});
|
|
377
405
|
});
|
|
378
406
|
|
|
@@ -388,6 +416,35 @@ var Tooltip_Tooltip = /*#__PURE__*/function (_Component) {
|
|
|
388
416
|
|
|
389
417
|
_this.setState({
|
|
390
418
|
popoverEl: el
|
|
419
|
+
}, function () {
|
|
420
|
+
return _this.updateHitArea;
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
_defineProperty(_assertThisInitialized(_this), "handlePopoverOuterMount", function (el) {
|
|
425
|
+
_this.setState({
|
|
426
|
+
popoverOuterEl: el
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
_defineProperty(_assertThisInitialized(_this), "handleHitAreaMount", function (el) {
|
|
431
|
+
// Handle mouse events with native events due to current issues with how they
|
|
432
|
+
// are handled by react. See https://github.com/facebook/react/issues/4251,
|
|
433
|
+
// https://github.com/facebook/react/issues/19419, and SUI-1232.
|
|
434
|
+
if (el) {
|
|
435
|
+
el.addEventListener('mouseenter', _this.handleMouseEnterHitArea);
|
|
436
|
+
el.addEventListener('mousemove', _this.handleMouseMoveHitArea);
|
|
437
|
+
el.addEventListener('mouseleave', _this.handleMouseLeaveHitArea);
|
|
438
|
+
} else if (_this.state.hitAreaEl) {
|
|
439
|
+
_this.state.hitAreaEl.removeEventListener('mouseenter', _this.handleMouseEnterHitArea);
|
|
440
|
+
|
|
441
|
+
_this.state.hitAreaEl.removeEventListener('mousemove', _this.handleMouseMoveHitArea);
|
|
442
|
+
|
|
443
|
+
_this.state.hitAreaEl.removeEventListener('mouseleave', _this.handleMouseLeaveHitArea);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
_this.setState({
|
|
447
|
+
hitAreaEl: el
|
|
391
448
|
});
|
|
392
449
|
});
|
|
393
450
|
|
|
@@ -398,29 +455,49 @@ var Tooltip_Tooltip = /*#__PURE__*/function (_Component) {
|
|
|
398
455
|
});
|
|
399
456
|
|
|
400
457
|
_defineProperty(_assertThisInitialized(_this), "handleMouseEnterPopover", function (e) {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
});
|
|
405
|
-
}
|
|
458
|
+
_this.handleRequestOpen(e, {
|
|
459
|
+
reason: 'mouseEnterPopover'
|
|
460
|
+
});
|
|
406
461
|
});
|
|
407
462
|
|
|
408
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
409
|
-
_this.
|
|
410
|
-
reason: '
|
|
463
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseEnterHitArea", function (e) {
|
|
464
|
+
_this.handleRequestOpen(e, {
|
|
465
|
+
reason: 'mouseEnterHitArea'
|
|
411
466
|
});
|
|
412
467
|
});
|
|
413
468
|
|
|
469
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseLeave", function (e) {
|
|
470
|
+
var reason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'mouseLeaveToggle';
|
|
471
|
+
|
|
472
|
+
if (e.relatedTarget == null || e.relatedTarget !== _this.state.popoverEl && e.relatedTarget !== _this.state.popoverOuterEl) {
|
|
473
|
+
_this.handleRequestClose(e, {
|
|
474
|
+
reason: reason
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
|
|
414
479
|
_defineProperty(_assertThisInitialized(_this), "handleMouseLeavePopover", function (e) {
|
|
480
|
+
_this.handleMouseLeave(e, 'mouseLeavePopover');
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseLeaveHitArea", function (e) {
|
|
484
|
+
_this.handleMouseLeave(e, 'mouseLeaveHitArea');
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseMoveHitAreaImpl", function (e) {
|
|
415
488
|
_this.handleRequestClose(e, {
|
|
416
|
-
reason: '
|
|
489
|
+
reason: 'mouseStopHitArea'
|
|
417
490
|
});
|
|
418
491
|
});
|
|
419
492
|
|
|
493
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseMoveHitArea", throttle_default()(_this.handleMouseMoveHitAreaImpl, 10));
|
|
494
|
+
|
|
420
495
|
_defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
|
|
421
|
-
_this.
|
|
422
|
-
|
|
423
|
-
|
|
496
|
+
if (_this.props.closeWhen !== 'notOnClick') {
|
|
497
|
+
_this.handleRequestClose(e, {
|
|
498
|
+
reason: 'toggleClick'
|
|
499
|
+
});
|
|
500
|
+
}
|
|
424
501
|
});
|
|
425
502
|
|
|
426
503
|
_defineProperty(_assertThisInitialized(_this), "handleFocus", function (e) {
|
|
@@ -455,10 +532,6 @@ var Tooltip_Tooltip = /*#__PURE__*/function (_Component) {
|
|
|
455
532
|
});
|
|
456
533
|
}
|
|
457
534
|
|
|
458
|
-
_this.setState({
|
|
459
|
-
lastCloseReason: data.reason
|
|
460
|
-
});
|
|
461
|
-
|
|
462
535
|
(_this$props$onRequest = (_this$props = _this.props).onRequestClose) === null || _this$props$onRequest === void 0 ? void 0 : _this$props$onRequest.call(_this$props, e, data);
|
|
463
536
|
}, closeDelay);
|
|
464
537
|
});
|
|
@@ -473,7 +546,7 @@ var Tooltip_Tooltip = /*#__PURE__*/function (_Component) {
|
|
|
473
546
|
}
|
|
474
547
|
|
|
475
548
|
_this.timeout = setTimeout(function () {
|
|
476
|
-
var
|
|
549
|
+
var wasOpen = _this.isOpen();
|
|
477
550
|
|
|
478
551
|
if (!_this.isControlled()) {
|
|
479
552
|
_this.setState({
|
|
@@ -481,18 +554,114 @@ var Tooltip_Tooltip = /*#__PURE__*/function (_Component) {
|
|
|
481
554
|
});
|
|
482
555
|
}
|
|
483
556
|
|
|
484
|
-
|
|
557
|
+
if (!wasOpen) {
|
|
558
|
+
var _this$props$onRequest2, _this$props2;
|
|
559
|
+
|
|
560
|
+
(_this$props$onRequest2 = (_this$props2 = _this.props).onRequestOpen) === null || _this$props$onRequest2 === void 0 ? void 0 : _this$props$onRequest2.call(_this$props2, e, data);
|
|
561
|
+
}
|
|
485
562
|
}, finalDelay);
|
|
486
563
|
});
|
|
487
564
|
|
|
488
|
-
_this
|
|
565
|
+
_defineProperty(_assertThisInitialized(_this), "updateHitArea", function () {
|
|
566
|
+
var placementInfo = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
567
|
+
var placement = placementInfo.placement;
|
|
568
|
+
|
|
569
|
+
_this.setState(function (_ref) {
|
|
570
|
+
var anchorEl = _ref.anchorEl,
|
|
571
|
+
popoverEl = _ref.popoverEl,
|
|
572
|
+
statePopoverPlacement = _ref.popoverPlacement;
|
|
573
|
+
var popoverPlacement = placement != null ? placement : statePopoverPlacement;
|
|
574
|
+
|
|
575
|
+
if (anchorEl != null && popoverEl != null && popoverPlacement != null) {
|
|
576
|
+
var anchorRect = anchorEl.getBoundingClientRect();
|
|
577
|
+
var menuRect = popoverEl.getBoundingClientRect();
|
|
578
|
+
|
|
579
|
+
if (popoverPlacement === 'above' || popoverPlacement === 'below') {
|
|
580
|
+
var anchorLeftEdge = anchorRect.x - menuRect.x;
|
|
581
|
+
var verticalStart = anchorRect.height;
|
|
582
|
+
var verticalEnd = 0;
|
|
583
|
+
|
|
584
|
+
if (popoverPlacement === 'above') {
|
|
585
|
+
verticalStart = 0;
|
|
586
|
+
verticalEnd = anchorRect.height;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
var menuStart = "0 ".concat(verticalStart);
|
|
590
|
+
var menuEnd = "".concat(menuRect.width, " ").concat(verticalStart);
|
|
591
|
+
var anchorStartNear = "".concat(anchorLeftEdge, " ").concat(verticalStart);
|
|
592
|
+
var anchorStartFar = "".concat(anchorLeftEdge, " ").concat(verticalEnd);
|
|
593
|
+
var anchorEndNear = "".concat(anchorLeftEdge + anchorRect.width, " ").concat(verticalStart);
|
|
594
|
+
var anchorEndFar = "".concat(anchorLeftEdge + anchorRect.width, " ").concat(verticalEnd);
|
|
595
|
+
var hitAreaPath = "\n M ".concat(menuStart, "\n S ").concat(anchorStartNear, " , ").concat(anchorStartFar, "\n L ").concat(anchorStartNear, "\n L ").concat(anchorEndNear, "\n L ").concat(anchorEndFar, "\n S ").concat(anchorEndNear, " , ").concat(menuEnd, "\n ");
|
|
596
|
+
return {
|
|
597
|
+
popoverPlacement: popoverPlacement,
|
|
598
|
+
hitAreaPath: hitAreaPath,
|
|
599
|
+
hitAreaStyle: {
|
|
600
|
+
left: menuRect.left - anchorRect.left,
|
|
601
|
+
top: 0,
|
|
602
|
+
width: menuRect.width,
|
|
603
|
+
height: anchorRect.height
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
if (popoverPlacement === 'left' || popoverPlacement === 'right') {
|
|
609
|
+
var anchorTopEdge = anchorRect.top - menuRect.top;
|
|
610
|
+
var horizontalStart = 0;
|
|
611
|
+
var horizontalEnd = anchorRect.width;
|
|
612
|
+
|
|
613
|
+
if (popoverPlacement === 'right') {
|
|
614
|
+
horizontalStart = anchorRect.width;
|
|
615
|
+
horizontalEnd = 0;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
var _menuStart = "".concat(horizontalStart, " 0");
|
|
619
|
+
|
|
620
|
+
var _menuEnd = "".concat(horizontalStart, " ").concat(menuRect.height);
|
|
621
|
+
|
|
622
|
+
var _anchorStartNear = "".concat(horizontalStart, " ").concat(anchorTopEdge);
|
|
623
|
+
|
|
624
|
+
var _anchorStartFar = "".concat(horizontalEnd, " ").concat(anchorTopEdge);
|
|
625
|
+
|
|
626
|
+
var _anchorEndNear = "".concat(horizontalStart, " ").concat(anchorTopEdge + anchorRect.height);
|
|
627
|
+
|
|
628
|
+
var _anchorEndFar = "".concat(horizontalEnd, " ").concat(anchorTopEdge + anchorRect.height);
|
|
629
|
+
|
|
630
|
+
var _hitAreaPath = "\n M ".concat(_menuStart, "\n S ").concat(_anchorStartNear, " , ").concat(_anchorStartFar, "\n L ").concat(_anchorStartNear, "\n L ").concat(_anchorEndNear, "\n L ").concat(_anchorEndFar, "\n S ").concat(_anchorEndNear, " , ").concat(_menuEnd, "\n ");
|
|
631
|
+
|
|
632
|
+
return {
|
|
633
|
+
popoverPlacement: popoverPlacement,
|
|
634
|
+
hitAreaPath: _hitAreaPath,
|
|
635
|
+
hitAreaStyle: {
|
|
636
|
+
left: 0,
|
|
637
|
+
top: menuRect.top - anchorRect.top,
|
|
638
|
+
width: anchorRect.width,
|
|
639
|
+
height: menuRect.height
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
return {
|
|
646
|
+
popoverPlacement: popoverPlacement,
|
|
647
|
+
hitAreaPath: null,
|
|
648
|
+
hitAreaStyle: {}
|
|
649
|
+
};
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
_this.controlledExternally = has_default()(props, 'open');
|
|
489
654
|
_this.popoverId = Object(id_["createDOMID"])('popover');
|
|
490
655
|
_this.ariaId = Object(id_["createDOMID"])('aria-id');
|
|
491
656
|
_this.state = {
|
|
492
|
-
|
|
657
|
+
anchorEl: null,
|
|
493
658
|
open: false,
|
|
494
659
|
popoverEl: null,
|
|
495
|
-
|
|
660
|
+
popoverOuterEl: null,
|
|
661
|
+
popoverPlacement: null,
|
|
662
|
+
hitAreaEl: null,
|
|
663
|
+
hitAreaPath: null,
|
|
664
|
+
hitAreaStyle: {}
|
|
496
665
|
};
|
|
497
666
|
return _this;
|
|
498
667
|
}
|
|
@@ -514,6 +683,12 @@ var Tooltip_Tooltip = /*#__PURE__*/function (_Component) {
|
|
|
514
683
|
value: function isControlled() {
|
|
515
684
|
return this.controlledExternally;
|
|
516
685
|
}
|
|
686
|
+
}, {
|
|
687
|
+
key: "isOpen",
|
|
688
|
+
value: function isOpen() {
|
|
689
|
+
var hasContent = !!this.props.content;
|
|
690
|
+
return !!this.state.anchorEl && this.isControlled() ? this.props.open : hasContent && this.state.open;
|
|
691
|
+
}
|
|
517
692
|
}, {
|
|
518
693
|
key: "render",
|
|
519
694
|
value: function render() {
|
|
@@ -526,14 +701,16 @@ var Tooltip_Tooltip = /*#__PURE__*/function (_Component) {
|
|
|
526
701
|
inline = _this$props3.inline,
|
|
527
702
|
onRequestClose = _this$props3.onRequestClose,
|
|
528
703
|
onRequestOpen = _this$props3.onRequestOpen,
|
|
529
|
-
open = _this$props3.open,
|
|
530
704
|
splunkTheme = _this$props3.splunkTheme,
|
|
531
705
|
contentRelationship = _this$props3.contentRelationship,
|
|
532
|
-
otherProps = _objectWithoutProperties(_this$props3, ["appearance", "children", "content", "defaultPlacement", "elementRef", "inline", "onRequestClose", "onRequestOpen", "
|
|
706
|
+
otherProps = _objectWithoutProperties(_this$props3, ["appearance", "children", "content", "defaultPlacement", "elementRef", "inline", "onRequestClose", "onRequestOpen", "splunkTheme", "contentRelationship"]);
|
|
533
707
|
|
|
534
|
-
var
|
|
708
|
+
var _this$state = this.state,
|
|
709
|
+
anchorEl = _this$state.anchorEl,
|
|
710
|
+
hitAreaPath = _this$state.hitAreaPath,
|
|
711
|
+
hitAreaStyle = _this$state.hitAreaStyle;
|
|
535
712
|
var hasContent = !!content;
|
|
536
|
-
var openRender =
|
|
713
|
+
var openRender = this.isOpen();
|
|
537
714
|
var StyledComp = inline ? StyledInline : Styled;
|
|
538
715
|
var StyledToggleComp = inline ? StyledToggleInline : StyledToggle;
|
|
539
716
|
var isPrisma = splunkTheme.isPrisma;
|
|
@@ -577,17 +754,30 @@ var Tooltip_Tooltip = /*#__PURE__*/function (_Component) {
|
|
|
577
754
|
"aria-hidden": "true"
|
|
578
755
|
}, "?"), /*#__PURE__*/external_react_default.a.createElement(ScreenReaderContent_default.a, null, Object(i18n_["_"])('More info')))), hasContent && /*#__PURE__*/external_react_default.a.createElement(ScreenReaderContent_default.a, {
|
|
579
756
|
id: this.ariaId
|
|
580
|
-
}, content)), /*#__PURE__*/external_react_default.a.createElement(
|
|
757
|
+
}, content)), openRender && hitAreaPath != null && /*#__PURE__*/external_react_default.a.createElement(StyledHitArea, {
|
|
758
|
+
style: hitAreaStyle
|
|
759
|
+
}, /*#__PURE__*/external_react_default.a.createElement("path", {
|
|
760
|
+
d: hitAreaPath,
|
|
761
|
+
ref: this.handleHitAreaMount
|
|
762
|
+
})), /*#__PURE__*/external_react_default.a.createElement(Popover_default.a, {
|
|
581
763
|
role: "tooltip",
|
|
582
764
|
align: "center",
|
|
583
|
-
anchor:
|
|
765
|
+
anchor: anchorEl // override Popver's default animation to make it faster
|
|
766
|
+
// this keeps the overall amount of time the Tooltip is on-screen the same
|
|
767
|
+
// even with the increased default closeDelay to address SUI-5116
|
|
768
|
+
,
|
|
769
|
+
animationConfig: {
|
|
770
|
+
tension: 400
|
|
771
|
+
},
|
|
584
772
|
appearance: appearance,
|
|
585
773
|
closeReasons: ['offScreen', 'escapeKey'],
|
|
586
774
|
defaultPlacement: defaultPlacement === 'theme' ? placement : defaultPlacement,
|
|
587
775
|
id: this.popoverId,
|
|
588
776
|
open: openRender,
|
|
777
|
+
onReposition: this.updateHitArea,
|
|
589
778
|
onRequestClose: this.handlePopoverOnRequestClose,
|
|
590
|
-
elementRef: this.handlePopoverMount
|
|
779
|
+
elementRef: this.handlePopoverMount,
|
|
780
|
+
outerRef: this.handlePopoverOuterMount
|
|
591
781
|
}, /*#__PURE__*/external_react_default.a.createElement(StyledContent, {
|
|
592
782
|
$isLabel: contentRelationship === 'label'
|
|
593
783
|
}, content)));
|
|
@@ -610,44 +800,37 @@ TooltipWithTheme.propTypes = Tooltip_Tooltip.propTypes;
|
|
|
610
800
|
|
|
611
801
|
/***/ }),
|
|
612
802
|
|
|
613
|
-
/***/
|
|
803
|
+
/***/ 23:
|
|
614
804
|
/***/ (function(module, exports) {
|
|
615
805
|
|
|
616
806
|
module.exports = require("@splunk/react-ui/Popover");
|
|
617
807
|
|
|
618
808
|
/***/ }),
|
|
619
809
|
|
|
620
|
-
/***/
|
|
810
|
+
/***/ 3:
|
|
621
811
|
/***/ (function(module, exports) {
|
|
622
812
|
|
|
623
|
-
module.exports = require("
|
|
813
|
+
module.exports = require("styled-components");
|
|
624
814
|
|
|
625
815
|
/***/ }),
|
|
626
816
|
|
|
627
|
-
/***/
|
|
817
|
+
/***/ 31:
|
|
628
818
|
/***/ (function(module, exports) {
|
|
629
819
|
|
|
630
|
-
module.exports = require("
|
|
820
|
+
module.exports = require("lodash/throttle");
|
|
631
821
|
|
|
632
822
|
/***/ }),
|
|
633
823
|
|
|
634
|
-
/***/
|
|
824
|
+
/***/ 32:
|
|
635
825
|
/***/ (function(module, exports) {
|
|
636
826
|
|
|
637
|
-
module.exports = require("
|
|
827
|
+
module.exports = require("@splunk/react-icons/SVG");
|
|
638
828
|
|
|
639
829
|
/***/ }),
|
|
640
830
|
|
|
641
831
|
/***/ 4:
|
|
642
832
|
/***/ (function(module, exports) {
|
|
643
833
|
|
|
644
|
-
module.exports = require("lodash");
|
|
645
|
-
|
|
646
|
-
/***/ }),
|
|
647
|
-
|
|
648
|
-
/***/ 5:
|
|
649
|
-
/***/ (function(module, exports) {
|
|
650
|
-
|
|
651
834
|
module.exports = require("@splunk/ui-utils/i18n");
|
|
652
835
|
|
|
653
836
|
/***/ })
|