@splunk/react-ui 4.5.2 → 4.7.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/Accordion.js +10 -9
- package/Anchor.js +2 -2
- package/Animation.js +2 -2
- package/AnimationToggle.js +2 -2
- package/Box.js +2 -2
- package/Button.js +13 -13
- package/ButtonGroup.js +4 -4
- package/ButtonSimple.js +6 -6
- package/CHANGELOG.md +42 -1
- package/Calendar.js +16 -16
- package/Card.js +48 -53
- package/CardLayout.js +4 -4
- package/Chip.js +10 -10
- package/Clickable.js +41 -15
- package/CloseButton.js +8 -8
- package/Code.js +8 -7
- package/CollapsiblePanel.js +11 -14
- package/Color.js +48 -48
- package/ColumnLayout.js +4 -4
- package/ComboBox.js +8 -8
- package/Concertina.js +15 -15
- package/ControlGroup.js +30 -37
- package/Date.js +10 -10
- package/DefinitionList.js +2 -2
- package/Dropdown.js +4 -4
- package/EventListener.js +4 -4
- package/FetchOptions.js +8 -8
- package/File.js +27 -27
- package/FormRows.js +21 -23
- package/Heading.js +2 -2
- package/Image.js +14 -14
- package/JSONTree.js +4 -4
- package/Layer.js +10 -10
- package/Link.js +6 -6
- package/List.js +2 -2
- package/Markdown.js +28 -16
- package/Menu.js +135 -70
- package/Message.js +246 -305
- package/MessageBar.d.ts +2 -0
- package/MessageBar.js +789 -0
- package/Modal.js +95 -61
- package/ModalLayer.js +5 -4
- package/Monogram.js +4 -4
- package/Multiselect.js +293 -42
- package/Number.js +8 -8
- package/Paginator.js +24 -24
- package/Paragraph.js +2 -2
- package/Popover.js +12 -12
- package/Progress.js +6 -6
- package/RadioBar.js +4 -4
- package/RadioList.js +2 -2
- package/Resize.js +8 -8
- package/ResultsMenu.js +25 -23
- package/ScreenReaderContent.js +2 -2
- package/Scroll.js +6 -6
- package/ScrollContainerContext.js +2 -2
- package/Search.js +14 -14
- package/Select.js +286 -36
- package/SidePanel.js +6 -6
- package/Slider.js +20 -14
- package/SlidingPanels.js +4 -4
- package/StaticContent.js +2 -2
- package/StepBar.js +18 -18
- package/Switch.js +17 -31
- package/TabBar.js +60 -46
- package/TabLayout.js +4 -4
- package/Table.js +63 -55
- package/Text.js +163 -146
- package/Tooltip.js +14 -14
- package/TransitionOpen.js +69 -44
- package/WaitSpinner.js +2 -2
- package/cypress/plugins/index.ts +15 -0
- package/cypress/support/commands.ts +1 -0
- package/cypress/support/index.ts +10 -0
- package/cypress.json +12 -0
- package/package.json +18 -5
- package/types/src/Animation/Animation.d.ts +0 -1
- package/types/src/Calendar/DateTable.d.ts +0 -1
- package/types/src/Clickable/Clickable.d.ts +12 -2
- package/types/src/Clickable/NavigationProvider.d.ts +12 -2
- package/types/src/Color/Color.d.ts +3 -3
- package/types/src/Date/Date.d.ts +3 -3
- package/types/src/Date/Icon.d.ts +0 -1
- package/types/src/File/Icon.d.ts +0 -1
- package/types/src/File/IconCloud.d.ts +0 -1
- package/types/src/File/PaperClip.d.ts +0 -1
- package/types/src/File/Retry.d.ts +0 -1
- package/types/src/File/Trash.d.ts +0 -1
- package/types/src/Markdown/renderers/MarkdownCode.d.ts +0 -1
- package/types/src/Markdown/renderers/MarkdownCodeBlock.d.ts +0 -1
- package/types/src/Markdown/renderers/MarkdownImage.d.ts +0 -1
- package/types/src/Menu/Divider.d.ts +0 -1
- package/types/src/Message/Link.d.ts +2 -0
- package/types/src/Message/Message.d.ts +6 -1
- package/types/src/MessageBar/MessageBar.d.ts +28 -0
- package/types/src/MessageBar/index.d.ts +2 -0
- package/types/src/Modal/Modal.d.ts +3 -0
- package/types/src/Modal/ModalContext.d.ts +6 -0
- package/types/src/Monogram/Monogram.d.ts +2 -2
- package/types/src/Multiselect/Multiselect.d.ts +1 -0
- package/types/src/Number/IncrementIcon.d.ts +0 -1
- package/types/src/Number/Number.d.ts +3 -3
- package/types/src/Paginator/PageSeparator.d.ts +0 -1
- package/types/src/Popover/Popover.d.ts +1 -2
- package/types/src/RadioBar/RadioBar.d.ts +3 -3
- package/types/src/Select/Select.d.ts +8 -3
- package/types/src/Select/SelectBase.d.ts +17 -5
- package/types/src/Select/matchUtils.d.ts +12 -0
- package/types/src/Slider/Slider.d.ts +3 -3
- package/types/src/Switch/CheckIcon.d.ts +0 -1
- package/types/src/Switch/Switch.d.ts +7 -7
- package/types/src/Table/DragHandle.d.ts +0 -1
- package/types/src/Table/HeadExpandRowsIcon.d.ts +0 -1
- package/types/src/Table/Toggle.d.ts +0 -1
- package/types/src/Text/IconOutlinedHide.d.ts +0 -1
- package/types/src/Text/IconOutlinedView.d.ts +0 -1
- package/types/src/Text/Text.d.ts +12 -5
- package/types/src/Tooltip/InfoIcon.d.ts +0 -1
- package/types/src/TransitionOpen/TransitionOpen.d.ts +1 -0
- package/types/src/icons/Alert.d.ts +0 -1
- package/types/src/icons/AlertFilled.d.ts +0 -1
- package/types/src/icons/CaretDown.d.ts +0 -1
- package/types/src/icons/CaretRight.d.ts +0 -1
- package/types/src/icons/Check.d.ts +0 -1
- package/types/src/icons/ChevronDown.d.ts +0 -1
- package/types/src/icons/ChevronLeft.d.ts +0 -1
- package/types/src/icons/ChevronRight.d.ts +0 -1
- package/types/src/icons/CrossMark.d.ts +0 -1
- package/types/src/icons/External.d.ts +0 -1
- package/types/src/icons/InfoFilled.d.ts +0 -1
- package/types/src/icons/More.d.ts +0 -1
- package/types/src/icons/MoreVertical.d.ts +0 -1
- package/types/src/icons/Plus.d.ts +0 -1
- package/types/src/icons/SVG.d.ts +0 -1
- package/types/src/icons/Search.d.ts +0 -1
- package/types/src/icons/Sort.d.ts +0 -1
- package/types/src/icons/SortedDown.d.ts +0 -1
- package/types/src/icons/SortedUp.d.ts +0 -1
- package/types/src/icons/Success.d.ts +0 -1
- package/types/src/icons/SuccessFilled.d.ts +0 -1
- package/types/src/icons/WarningFilled.d.ts +0 -1
- package/types/src/utils/types.d.ts +0 -1
- package/unit-test-setup-testing-library.ts +9 -0
- package/usePrevious.js +2 -2
- package/types/src/Message/Banner.d.ts +0 -8
package/TransitionOpen.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 = 175);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
@@ -101,7 +101,7 @@ module.exports = require("prop-types");
|
|
|
101
101
|
|
|
102
102
|
/***/ }),
|
|
103
103
|
|
|
104
|
-
/***/
|
|
104
|
+
/***/ 175:
|
|
105
105
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
106
106
|
|
|
107
107
|
"use strict";
|
|
@@ -126,10 +126,10 @@ var external_lodash_ = __webpack_require__(4);
|
|
|
126
126
|
var Animation_ = __webpack_require__(30);
|
|
127
127
|
|
|
128
128
|
// EXTERNAL MODULE: external "@splunk/ui-utils/focus"
|
|
129
|
-
var focus_ = __webpack_require__(
|
|
129
|
+
var focus_ = __webpack_require__(26);
|
|
130
130
|
|
|
131
131
|
// EXTERNAL MODULE: external "@splunk/ui-utils/style"
|
|
132
|
-
var style_ = __webpack_require__(
|
|
132
|
+
var style_ = __webpack_require__(40);
|
|
133
133
|
|
|
134
134
|
// EXTERNAL MODULE: external "react-spring"
|
|
135
135
|
var external_react_spring_ = __webpack_require__(18);
|
|
@@ -291,7 +291,8 @@ var TransitionOpen_TransitionOpen = /*#__PURE__*/function (_Component) {
|
|
|
291
291
|
});
|
|
292
292
|
|
|
293
293
|
_defineProperty(_assertThisInitialized(_this), "internalRender", function (_ref) {
|
|
294
|
-
var value = _ref.value
|
|
294
|
+
var value = _ref.value,
|
|
295
|
+
transform = _ref.transform;
|
|
295
296
|
var _this$props2 = _this.props,
|
|
296
297
|
animation = _this$props2.animation,
|
|
297
298
|
className = _this$props2.className,
|
|
@@ -304,37 +305,19 @@ var TransitionOpen_TransitionOpen = /*#__PURE__*/function (_Component) {
|
|
|
304
305
|
outerId = _this$props2.outerId,
|
|
305
306
|
outerStyle = _this$props2.outerStyle;
|
|
306
307
|
var animating = _this.state.animating;
|
|
307
|
-
var offset = value.to(function (v) {
|
|
308
|
-
return _this.state.value || 0 - v;
|
|
309
|
-
});
|
|
310
|
-
var transform;
|
|
311
308
|
var dimension;
|
|
312
309
|
|
|
313
310
|
if (animating) {
|
|
314
311
|
switch (animation) {
|
|
315
312
|
case 'slideFromTop':
|
|
316
|
-
transform = "translateY(-".concat(offset, "px)");
|
|
317
|
-
dimension = 'height';
|
|
318
|
-
break;
|
|
319
|
-
|
|
320
313
|
case 'slideFromBottom':
|
|
314
|
+
case 'expandHeight':
|
|
321
315
|
case 'none':
|
|
322
316
|
dimension = 'height';
|
|
323
317
|
break;
|
|
324
318
|
|
|
325
319
|
case 'slideFromLeft':
|
|
326
|
-
transform = "translateX(".concat(-offset, "px)");
|
|
327
|
-
dimension = 'width';
|
|
328
|
-
break;
|
|
329
|
-
|
|
330
320
|
case 'slideFromRight':
|
|
331
|
-
dimension = 'width';
|
|
332
|
-
break;
|
|
333
|
-
|
|
334
|
-
case 'expandHeight':
|
|
335
|
-
dimension = 'height';
|
|
336
|
-
break;
|
|
337
|
-
|
|
338
321
|
case 'expandWidth':
|
|
339
322
|
dimension = 'width';
|
|
340
323
|
break;
|
|
@@ -365,6 +348,58 @@ var TransitionOpen_TransitionOpen = /*#__PURE__*/function (_Component) {
|
|
|
365
348
|
}), children));
|
|
366
349
|
});
|
|
367
350
|
|
|
351
|
+
_defineProperty(_assertThisInitialized(_this), "getSpringTransition", function () {
|
|
352
|
+
var _this$props3 = _this.props,
|
|
353
|
+
open = _this$props3.open,
|
|
354
|
+
animation = _this$props3.animation;
|
|
355
|
+
var value = _this.state.value;
|
|
356
|
+
var toValue = {
|
|
357
|
+
value: open ? value : 0
|
|
358
|
+
};
|
|
359
|
+
var fromValue = {
|
|
360
|
+
value: open ? 0 : value
|
|
361
|
+
};
|
|
362
|
+
var config = {
|
|
363
|
+
precision: 1
|
|
364
|
+
}; // Only use precision when not using transform, otherwise transform animation will break
|
|
365
|
+
// Expansion doesn't require a valid value; the subsequent render animates it.
|
|
366
|
+
|
|
367
|
+
if (animation === 'expandWidth' || animation === 'expandHeight' || animation === 'none') {
|
|
368
|
+
return {
|
|
369
|
+
to: toValue,
|
|
370
|
+
config: config
|
|
371
|
+
};
|
|
372
|
+
} // Slide transitions require a valid value, render without transition first.
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
if (!value) {
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if (animation !== 'slideFromTop' && animation !== 'slideFromLeft') {
|
|
380
|
+
// Return the standard transition if not using a transform.
|
|
381
|
+
return {
|
|
382
|
+
to: toValue,
|
|
383
|
+
from: fromValue,
|
|
384
|
+
config: config
|
|
385
|
+
};
|
|
386
|
+
} // The top and left directions require an additional transform of their inner content to match the outer dimension animation.
|
|
387
|
+
// This is needed to achieve a clipping effect from the outer div, rather than the consumer providing their own.
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
var orientation = animation === 'slideFromTop' ? 'Y' : 'X';
|
|
391
|
+
var toTransform = "translate".concat(orientation, "(").concat(open ? 0 : -value, "px)");
|
|
392
|
+
var fromTransform = "translate".concat(orientation, "(").concat(open ? -value : 0, "px)");
|
|
393
|
+
return {
|
|
394
|
+
to: _objectSpread({
|
|
395
|
+
transform: toTransform
|
|
396
|
+
}, toValue),
|
|
397
|
+
from: _objectSpread({
|
|
398
|
+
transform: fromTransform
|
|
399
|
+
}, fromValue)
|
|
400
|
+
};
|
|
401
|
+
});
|
|
402
|
+
|
|
368
403
|
_this.state = {
|
|
369
404
|
animating: props.animateOnMount ? props.open : false,
|
|
370
405
|
innerEl: null,
|
|
@@ -379,7 +414,7 @@ var TransitionOpen_TransitionOpen = /*#__PURE__*/function (_Component) {
|
|
|
379
414
|
value: function componentDidUpdate() {
|
|
380
415
|
var value = this.getValue(this.state.innerEl);
|
|
381
416
|
|
|
382
|
-
if (this.state.value !== value) {
|
|
417
|
+
if (this.state.value !== value && !this.state.animating) {
|
|
383
418
|
this.setState({
|
|
384
419
|
value: value
|
|
385
420
|
}); // eslint-disable-line react/no-did-update-set-state
|
|
@@ -388,21 +423,11 @@ var TransitionOpen_TransitionOpen = /*#__PURE__*/function (_Component) {
|
|
|
388
423
|
}, {
|
|
389
424
|
key: "render",
|
|
390
425
|
value: function render() {
|
|
391
|
-
var
|
|
392
|
-
|
|
393
|
-
animation = _this$props3.animation;
|
|
394
|
-
var value = this.state.value;
|
|
395
|
-
var animateTo = open ? value : 0;
|
|
396
|
-
return /*#__PURE__*/external_react_default.a.createElement(Animation_["Spring"], {
|
|
397
|
-
to: {
|
|
398
|
-
value: animateTo || 0
|
|
399
|
-
},
|
|
426
|
+
var animation = this.props.animation;
|
|
427
|
+
return /*#__PURE__*/external_react_default.a.createElement(Animation_["Spring"], _extends({}, this.getSpringTransition(), {
|
|
400
428
|
immediate: animation === 'none',
|
|
401
|
-
onRest: this.handleRest
|
|
402
|
-
|
|
403
|
-
precision: 1
|
|
404
|
-
}
|
|
405
|
-
}, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
429
|
+
onRest: this.handleRest
|
|
430
|
+
}), // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
406
431
|
this.internalRender);
|
|
407
432
|
}
|
|
408
433
|
}]);
|
|
@@ -445,7 +470,7 @@ module.exports = require("react");
|
|
|
445
470
|
|
|
446
471
|
/***/ }),
|
|
447
472
|
|
|
448
|
-
/***/
|
|
473
|
+
/***/ 26:
|
|
449
474
|
/***/ (function(module, exports) {
|
|
450
475
|
|
|
451
476
|
module.exports = require("@splunk/ui-utils/focus");
|
|
@@ -466,17 +491,17 @@ module.exports = require("@splunk/react-ui/Animation");
|
|
|
466
491
|
|
|
467
492
|
/***/ }),
|
|
468
493
|
|
|
469
|
-
/***/
|
|
494
|
+
/***/ 4:
|
|
470
495
|
/***/ (function(module, exports) {
|
|
471
496
|
|
|
472
|
-
module.exports = require("
|
|
497
|
+
module.exports = require("lodash");
|
|
473
498
|
|
|
474
499
|
/***/ }),
|
|
475
500
|
|
|
476
|
-
/***/
|
|
501
|
+
/***/ 40:
|
|
477
502
|
/***/ (function(module, exports) {
|
|
478
503
|
|
|
479
|
-
module.exports = require("
|
|
504
|
+
module.exports = require("@splunk/ui-utils/style");
|
|
480
505
|
|
|
481
506
|
/***/ })
|
|
482
507
|
|
package/WaitSpinner.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 = 176);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
@@ -101,7 +101,7 @@ module.exports = require("prop-types");
|
|
|
101
101
|
|
|
102
102
|
/***/ }),
|
|
103
103
|
|
|
104
|
-
/***/
|
|
104
|
+
/***/ 176:
|
|
105
105
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
106
106
|
|
|
107
107
|
"use strict";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* eslint-env node */
|
|
2
|
+
|
|
3
|
+
import { startDevServer } from '@cypress/webpack-dev-server';
|
|
4
|
+
import webpackConfig from '../../webpack.test.config';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @type {Cypress.PluginConfig}
|
|
8
|
+
*/
|
|
9
|
+
module.exports = (on, config) => {
|
|
10
|
+
if (config.testingType === 'component') {
|
|
11
|
+
on('dev-server:start', (options) => startDevServer({ options, webpackConfig }));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return config;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/cypress/add-commands';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { setGlobalConfig } from '@storybook/testing-react';
|
|
2
|
+
import { configure } from '@testing-library/cypress';
|
|
3
|
+
import 'cypress-real-events/support';
|
|
4
|
+
|
|
5
|
+
import './commands';
|
|
6
|
+
import * as sbPreview from '../../.storybook/preview';
|
|
7
|
+
|
|
8
|
+
configure({ testIdAttribute: 'data-test' });
|
|
9
|
+
|
|
10
|
+
setGlobalConfig(sbPreview);
|
package/cypress.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"baseUrl": "http://localhost:8080",
|
|
3
|
+
"env": {},
|
|
4
|
+
"defaultCommandTimeout": 1000,
|
|
5
|
+
"fixturesFolder": false,
|
|
6
|
+
"video": false,
|
|
7
|
+
"videoUploadOnPasses": false,
|
|
8
|
+
"component": {
|
|
9
|
+
"componentFolder": "src",
|
|
10
|
+
"testFiles": "**/**/tests/*.spec.tsx"
|
|
11
|
+
}
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splunk/react-ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "Library of React components that implement the Splunk design language",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Splunk Inc.",
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
"test:functional:coverage": "cross-env NODE_ENV=test-coverage splunk-wdio-functional-test-runner functional.local.conf.js --coverage",
|
|
23
23
|
"test:functional:ci": "cross-env NODE_ENV=test-coverage splunk-wdio-functional-test-runner functional.ci.conf.js --coverage-maps",
|
|
24
24
|
"test:functional:cloud": "splunk-wdio-functional-test-runner functional.cloud.conf.js",
|
|
25
|
+
"test:cypress": "yarn cypress open-ct",
|
|
26
|
+
"test:cypress:ci": "yarn cypress run-ct",
|
|
25
27
|
"test:visual:cloud": "splunk-wdio-functional-test-runner functional.visual.conf.js",
|
|
26
28
|
"types:build": "tsc --emitDeclarationOnly --declaration --declarationDir ./types && node ./scripts/pruneTypes.js",
|
|
27
29
|
"types:start": "tsc --emitDeclarationOnly --declaration --declarationDir ./types --watch"
|
|
@@ -29,11 +31,11 @@
|
|
|
29
31
|
"peerDependencies": {
|
|
30
32
|
"react": "^16.8",
|
|
31
33
|
"react-dom": "^16.8",
|
|
32
|
-
"styled-components": "
|
|
34
|
+
"styled-components": "5.1.1"
|
|
33
35
|
},
|
|
34
36
|
"dependencies": {
|
|
35
|
-
"@splunk/react-icons": "^3.
|
|
36
|
-
"@splunk/themes": "^0.
|
|
37
|
+
"@splunk/react-icons": "^3.2.0",
|
|
38
|
+
"@splunk/themes": "^0.11.0",
|
|
37
39
|
"@splunk/ui-utils": "^1.4.0",
|
|
38
40
|
"@types/commonmark": "^0.27.0",
|
|
39
41
|
"@types/lodash": "^4.14.156",
|
|
@@ -56,6 +58,8 @@
|
|
|
56
58
|
},
|
|
57
59
|
"devDependencies": {
|
|
58
60
|
"@babel/core": "^7.2.0",
|
|
61
|
+
"@cypress/react": "^5.12.4",
|
|
62
|
+
"@cypress/webpack-dev-server": "^1.8.2",
|
|
59
63
|
"@splunk/babel-preset": "^3.0.0",
|
|
60
64
|
"@splunk/eslint-config": "^4.0.0",
|
|
61
65
|
"@splunk/stylelint-config": "^4.0.0",
|
|
@@ -66,6 +70,11 @@
|
|
|
66
70
|
"@storybook/addon-essentials": "^6.3.0",
|
|
67
71
|
"@storybook/csf": "^0.0.1",
|
|
68
72
|
"@storybook/react": "^6.3.0",
|
|
73
|
+
"@storybook/testing-react": "^1.2.3",
|
|
74
|
+
"@testing-library/cypress": "^8.0.2",
|
|
75
|
+
"@testing-library/jest-dom": "^5.16.1",
|
|
76
|
+
"@testing-library/react": "^12.1.2",
|
|
77
|
+
"@testing-library/react-hooks": "^7.0.2",
|
|
69
78
|
"@types/chai": "^3.5.2",
|
|
70
79
|
"@types/enzyme": "^3.10.5",
|
|
71
80
|
"@types/jest": "^25.2.1",
|
|
@@ -83,12 +92,15 @@
|
|
|
83
92
|
"chai": "^3.5.0",
|
|
84
93
|
"core-js": "^3.6.4",
|
|
85
94
|
"cross-env": "^6.0.3",
|
|
95
|
+
"cypress": "^9.5.1",
|
|
96
|
+
"cypress-real-events": "^1.7.0",
|
|
86
97
|
"enzyme": "^3.11.0",
|
|
87
98
|
"enzyme-adapter-react-16": "^1.15.2",
|
|
88
99
|
"eslint": "^7.14.0",
|
|
89
100
|
"eslint-config-airbnb": "^18.2.1",
|
|
90
101
|
"eslint-config-prettier": "^6.15.0",
|
|
91
102
|
"eslint-import-resolver-webpack": "^0.13.0",
|
|
103
|
+
"eslint-plugin-cypress": "^2.12.1",
|
|
92
104
|
"eslint-plugin-import": "^2.22.1",
|
|
93
105
|
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
94
106
|
"eslint-plugin-react": "^7.21.5",
|
|
@@ -105,7 +117,7 @@
|
|
|
105
117
|
"raw-loader": "^0.5.1",
|
|
106
118
|
"react": "^16.12.0",
|
|
107
119
|
"react-dom": "^16.12.0",
|
|
108
|
-
"react-test-renderer": "^16.
|
|
120
|
+
"react-test-renderer": "^16.13.1",
|
|
109
121
|
"sinon": "^2.1.0",
|
|
110
122
|
"styled-components": "5.1.1",
|
|
111
123
|
"stylelint": "^13.0.0",
|
|
@@ -114,6 +126,7 @@
|
|
|
114
126
|
"wdio-image-comparison-service": "^1.9.0",
|
|
115
127
|
"webpack": "^4.16.2",
|
|
116
128
|
"webpack-cli": "^3.1.0",
|
|
129
|
+
"webpack-dev-server": "^4.7.4",
|
|
117
130
|
"webpack-merge": "^4.1.3"
|
|
118
131
|
},
|
|
119
132
|
"engines": {
|
|
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
|
|
|
2
2
|
import { legacyRefMode } from '@splunk/react-ui/Dropdown';
|
|
3
3
|
import { NavigationProviderClickHandler } from './NavigationProvider';
|
|
4
4
|
import { ClassComponentProps } from '../utils/types';
|
|
5
|
-
export declare const isInternalLink: (to: string) => boolean;
|
|
5
|
+
export declare const isInternalLink: (to: string | undefined) => boolean;
|
|
6
6
|
interface ClickablePropsBase {
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
/**
|
|
@@ -25,6 +25,13 @@ interface ClickablePropsBase {
|
|
|
25
25
|
* Ignored if not in link mode.
|
|
26
26
|
*/
|
|
27
27
|
openInNewContext?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The text representation of the navigational link.
|
|
30
|
+
* This should be provided if child content is not a string.
|
|
31
|
+
*
|
|
32
|
+
* Ignored if not in link mode.
|
|
33
|
+
*/
|
|
34
|
+
navigationLabel?: string;
|
|
28
35
|
/**
|
|
29
36
|
* A URL for a link. If set and not disabled, an `a` element is used instead
|
|
30
37
|
* of a `button` element (link mode).
|
|
@@ -41,7 +48,10 @@ declare type ClickableProps = ClickableButtonProps | ClickableLinkProps;
|
|
|
41
48
|
*/
|
|
42
49
|
declare class Clickable extends Component<ClickableProps> {
|
|
43
50
|
private el;
|
|
44
|
-
static contextType: React.Context<
|
|
51
|
+
static contextType: React.Context<{
|
|
52
|
+
onClick?: NavigationProviderClickHandler | undefined;
|
|
53
|
+
prefix?: string | undefined;
|
|
54
|
+
}>;
|
|
45
55
|
static propTypes: React.WeakValidationMap<ClassComponentProps<ClickablePropsBase, Required<Pick<ClickablePropsBase, "disabled" | "openInNewContext">>, "button", never>> | React.WeakValidationMap<ClassComponentProps<ClickablePropsBase, Required<Pick<ClickablePropsBase, "disabled" | "openInNewContext">>, "a", "href">>;
|
|
46
56
|
static defaultProps: Required<Pick<ClickablePropsBase, "disabled" | "openInNewContext">>;
|
|
47
57
|
static [legacyRefMode]: boolean;
|
|
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
declare type NavigationProviderClickHandler = (event: React.MouseEvent<HTMLAnchorElement>, data: {
|
|
5
5
|
openInNewContext?: boolean;
|
|
6
6
|
to: string;
|
|
7
|
+
label?: string;
|
|
7
8
|
}) => void;
|
|
8
9
|
interface NavigationProviderProps {
|
|
9
10
|
children?: React.ReactNode;
|
|
@@ -12,17 +13,26 @@ interface NavigationProviderProps {
|
|
|
12
13
|
* The function takes the event and an options argument with `to` and `openInNewContext`
|
|
13
14
|
*/
|
|
14
15
|
onClick?: NavigationProviderClickHandler;
|
|
16
|
+
/**
|
|
17
|
+
* If set, all links that use the NavigationProvider's context will have this prepended to them.
|
|
18
|
+
*/
|
|
19
|
+
prefix?: string;
|
|
15
20
|
}
|
|
16
|
-
declare
|
|
21
|
+
declare type NavigationContextValue = {
|
|
22
|
+
onClick?: NavigationProviderClickHandler;
|
|
23
|
+
prefix?: string;
|
|
24
|
+
};
|
|
25
|
+
declare const NavigationContext: React.Context<NavigationContextValue>;
|
|
17
26
|
/**
|
|
18
27
|
* Used to provide an override for the `onClick` for links for single page applications so that
|
|
19
28
|
* internal links can navigate without a page reload.
|
|
20
29
|
*/
|
|
21
|
-
declare function NavigationProvider({ children, onClick }: NavigationProviderProps): JSX.Element;
|
|
30
|
+
declare function NavigationProvider({ children, onClick, prefix }: NavigationProviderProps): JSX.Element;
|
|
22
31
|
declare namespace NavigationProvider {
|
|
23
32
|
var propTypes: {
|
|
24
33
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
25
34
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
35
|
+
prefix: PropTypes.Requireable<string>;
|
|
26
36
|
};
|
|
27
37
|
}
|
|
28
38
|
export { NavigationContext, NavigationProvider, NavigationProviderClickHandler };
|