@splunk/react-ui 4.20.0 → 4.21.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 (101) hide show
  1. package/Accordion.js +425 -441
  2. package/Anchor.js +147 -193
  3. package/Animation.js +142 -166
  4. package/AnimationToggle.js +197 -253
  5. package/Box.js +145 -194
  6. package/Breadcrumbs.js +288 -298
  7. package/Button.js +488 -613
  8. package/ButtonGroup.js +160 -212
  9. package/ButtonSimple.js +543 -562
  10. package/CHANGELOG.md +26 -0
  11. package/Calendar.js +1107 -1195
  12. package/Card.js +771 -746
  13. package/CardLayout.js +205 -223
  14. package/Chip.js +509 -612
  15. package/Clickable.js +416 -472
  16. package/CloseButton.js +165 -250
  17. package/Code.js +1808 -2172
  18. package/Code.js.LICENSE.txt +8 -0
  19. package/CollapsiblePanel.js +586 -675
  20. package/Color.js +1066 -1297
  21. package/ColumnLayout.js +402 -465
  22. package/ComboBox.js +892 -969
  23. package/Concertina.js +998 -963
  24. package/ControlGroup.js +687 -718
  25. package/Date.js +567 -697
  26. package/DefinitionList.js +308 -310
  27. package/Divider.js +149 -194
  28. package/Dropdown.js +459 -558
  29. package/DualListbox.js +1480 -1735
  30. package/EventListener.js +94 -165
  31. package/File.js +1051 -1173
  32. package/FormRows.js +885 -880
  33. package/Heading.js +216 -263
  34. package/Image.js +446 -558
  35. package/JSONTree.js +690 -699
  36. package/Layer.js +442 -582
  37. package/Link.js +336 -361
  38. package/List.js +213 -237
  39. package/Markdown.js +510 -612
  40. package/Menu.js +1109 -1331
  41. package/Message.js +474 -629
  42. package/MessageBar.js +387 -561
  43. package/Modal.js +810 -798
  44. package/ModalLayer.js +326 -343
  45. package/Monogram.js +308 -368
  46. package/Multiselect.js +3558 -3998
  47. package/Number.js +729 -843
  48. package/Paginator.js +510 -615
  49. package/Paragraph.js +145 -188
  50. package/Popover.js +1470 -1693
  51. package/Progress.js +301 -362
  52. package/RadioBar.js +610 -651
  53. package/RadioList.js +483 -544
  54. package/Resize.js +530 -623
  55. package/ResultsMenu.js +494 -597
  56. package/ScreenReaderContent.js +142 -187
  57. package/Scroll.js +595 -598
  58. package/ScrollContainerContext.js +197 -278
  59. package/Search.js +745 -817
  60. package/Select.js +2441 -2746
  61. package/SidePanel.js +390 -392
  62. package/Slider.js +668 -825
  63. package/SlidingPanels.js +639 -645
  64. package/SplitButton.js +464 -499
  65. package/StaticContent.js +161 -217
  66. package/StepBar.js +386 -466
  67. package/Switch.js +710 -764
  68. package/TabBar.js +724 -815
  69. package/TabLayout.js +406 -438
  70. package/Table.js +4842 -5121
  71. package/Text.js +1169 -1351
  72. package/TextArea.js +1097 -1307
  73. package/Tooltip.js +624 -721
  74. package/TransitionOpen.js +489 -546
  75. package/Typography.js +176 -229
  76. package/WaitSpinner.js +230 -298
  77. package/package.json +14 -15
  78. package/stubs-splunkui.d.ts +4 -1
  79. package/types/src/ComboBox/Option.d.ts +1 -1
  80. package/types/src/Concertina/Concertina.d.ts +4 -0
  81. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  82. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  83. package/types/src/Link/Link.d.ts +7 -3
  84. package/types/src/Link/docs/examples/NewWindow.d.ts +2 -0
  85. package/types/src/Markdown/Markdown.d.ts +1 -1
  86. package/types/src/Markdown/renderers/MarkdownHeading.d.ts +1 -1
  87. package/types/src/Menu/Item.d.ts +1 -1
  88. package/types/src/Menu/Menu.d.ts +1 -0
  89. package/types/src/MessageBar/docs/examples/WithActions.d.ts +2 -0
  90. package/types/src/Multiselect/Option.d.ts +1 -1
  91. package/types/src/Search/Option.d.ts +1 -1
  92. package/types/src/Select/Option.d.ts +1 -1
  93. package/types/src/Select/OptionBase.d.ts +1 -1
  94. package/types/src/fixtures/FetchOptions.d.ts +2 -8
  95. package/useForceUpdate.js +112 -146
  96. package/useKeyPress.js +74 -128
  97. package/usePrevious.js +65 -129
  98. package/useRovingFocus.js +122 -218
  99. package/types/src/Link/docs/examples/NewTab.d.ts +0 -2
  100. /package/types/src/Table/docs/examples/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
  101. /package/types/src/Table/docs/examples/prisma/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
package/Clickable.js CHANGED
@@ -1,484 +1,428 @@
1
- module.exports =
2
- /******/ (function(modules) { // webpackBootstrap
3
- /******/ // The module cache
4
- /******/ var installedModules = {};
5
- /******/
6
- /******/ // The require function
7
- /******/ function __webpack_require__(moduleId) {
8
- /******/
9
- /******/ // Check if module is in cache
10
- /******/ if(installedModules[moduleId]) {
11
- /******/ return installedModules[moduleId].exports;
12
- /******/ }
13
- /******/ // Create a new module (and put it into the cache)
14
- /******/ var module = installedModules[moduleId] = {
15
- /******/ i: moduleId,
16
- /******/ l: false,
17
- /******/ exports: {}
18
- /******/ };
19
- /******/
20
- /******/ // Execute the module function
21
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
- /******/
23
- /******/ // Flag the module as loaded
24
- /******/ module.l = true;
25
- /******/
26
- /******/ // Return the exports of the module
27
- /******/ return module.exports;
28
- /******/ }
29
- /******/
30
- /******/
31
- /******/ // expose the modules object (__webpack_modules__)
32
- /******/ __webpack_require__.m = modules;
33
- /******/
34
- /******/ // expose the module cache
35
- /******/ __webpack_require__.c = installedModules;
36
- /******/
37
- /******/ // define getter function for harmony exports
38
- /******/ __webpack_require__.d = function(exports, name, getter) {
39
- /******/ if(!__webpack_require__.o(exports, name)) {
40
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41
- /******/ }
42
- /******/ };
43
- /******/
44
- /******/ // define __esModule on exports
45
- /******/ __webpack_require__.r = function(exports) {
46
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
- /******/ }
49
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
50
- /******/ };
51
- /******/
52
- /******/ // create a fake namespace object
53
- /******/ // mode & 1: value is a module id, require it
54
- /******/ // mode & 2: merge all properties of value into the ns
55
- /******/ // mode & 4: return value when already ns object
56
- /******/ // mode & 8|1: behave like require
57
- /******/ __webpack_require__.t = function(value, mode) {
58
- /******/ if(mode & 1) value = __webpack_require__(value);
59
- /******/ if(mode & 8) return value;
60
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61
- /******/ var ns = Object.create(null);
62
- /******/ __webpack_require__.r(ns);
63
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65
- /******/ return ns;
66
- /******/ };
67
- /******/
68
- /******/ // getDefaultExport function for compatibility with non-harmony modules
69
- /******/ __webpack_require__.n = function(module) {
70
- /******/ var getter = module && module.__esModule ?
71
- /******/ function getDefault() { return module['default']; } :
72
- /******/ function getModuleExports() { return module; };
73
- /******/ __webpack_require__.d(getter, 'a', getter);
74
- /******/ return getter;
75
- /******/ };
76
- /******/
77
- /******/ // Object.prototype.hasOwnProperty.call
78
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79
- /******/
80
- /******/ // __webpack_public_path__
81
- /******/ __webpack_require__.p = "";
82
- /******/
83
- /******/
84
- /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 198);
86
- /******/ })
87
- /************************************************************************/
88
- /******/ ({
89
-
90
- /***/ 0:
91
- /***/ (function(module, exports) {
92
-
93
- module.exports = require("@splunk/themes");
94
-
95
- /***/ }),
96
-
97
- /***/ 1:
98
- /***/ (function(module, exports) {
99
-
100
- module.exports = require("prop-types");
101
-
102
- /***/ }),
103
-
104
- /***/ 10:
105
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
106
-
107
- "use strict";
108
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return updateReactRef; });
109
- /**
1
+ /******/ (() => {
2
+ // webpackBootstrap
3
+ /******/ "use strict";
4
+ /******/ // The require scope
5
+ /******/ var e = {};
6
+ /******/
7
+ /************************************************************************/
8
+ /******/ /* webpack/runtime/compat get default export */
9
+ /******/ (() => {
10
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
11
+ /******/ e.n = t => {
12
+ /******/ var n = t && t.__esModule ?
13
+ /******/ () => t["default"]
14
+ /******/ : () => t
15
+ /******/;
16
+ e.d(n, {
17
+ a: n
18
+ });
19
+ /******/ return n;
20
+ /******/ };
21
+ /******/ })();
22
+ /******/
23
+ /******/ /* webpack/runtime/define property getters */
24
+ /******/ (() => {
25
+ /******/ // define getter functions for harmony exports
26
+ /******/ e.d = (t, n) => {
27
+ /******/ for (var r in n) {
28
+ /******/ if (e.o(n, r) && !e.o(t, r)) {
29
+ /******/ Object.defineProperty(t, r, {
30
+ enumerable: true,
31
+ get: n[r]
32
+ });
33
+ /******/ }
34
+ /******/ }
35
+ /******/ };
36
+ /******/ })();
37
+ /******/
38
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
39
+ /******/ (() => {
40
+ /******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
41
+ /******/;
42
+ })();
43
+ /******/
44
+ /******/ /* webpack/runtime/make namespace object */
45
+ /******/ (() => {
46
+ /******/ // define __esModule on exports
47
+ /******/ e.r = e => {
48
+ /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
49
+ /******/ Object.defineProperty(e, Symbol.toStringTag, {
50
+ value: "Module"
51
+ });
52
+ /******/ }
53
+ /******/ Object.defineProperty(e, "__esModule", {
54
+ value: true
55
+ });
56
+ /******/ };
57
+ /******/ })();
58
+ /******/
59
+ /************************************************************************/ var t = {};
60
+ // ESM COMPAT FLAG
61
+ e.r(t);
62
+ // EXPORTS
63
+ e.d(t, {
64
+ NavigationContext: () => /* reexport */ h,
65
+ NavigationProvider: () => /* reexport */ m,
66
+ default: () => /* reexport */ G,
67
+ isInternalLink: () => /* reexport */ z
68
+ });
69
+ // CONCATENATED MODULE: external "react"
70
+ const n = require("react");
71
+ var r = e.n(n);
72
+ // CONCATENATED MODULE: external "prop-types"
73
+ const o = require("prop-types");
74
+ var i = e.n(o);
75
+ // CONCATENATED MODULE: external "lodash/has"
76
+ const l = require("lodash/has");
77
+ // CONCATENATED MODULE: external "lodash/isString"
78
+ const a = require("lodash/isString");
79
+ var c = e.n(a);
80
+ // CONCATENATED MODULE: external "lodash/omit"
81
+ const u = require("lodash/omit");
82
+ var f = e.n(u);
83
+ // CONCATENATED MODULE: external "@splunk/react-ui/Dropdown"
84
+ const s = require("@splunk/react-ui/Dropdown");
85
+ // CONCATENATED MODULE: external "styled-components"
86
+ const p = require("styled-components");
87
+ var d = e.n(p);
88
+ // CONCATENATED MODULE: external "@splunk/themes"
89
+ const b = require("@splunk/themes");
90
+ // CONCATENATED MODULE: ./src/Clickable/ClickableStyles.ts
91
+ var y = d().a.withConfig({
92
+ displayName: "ClickableStyles__StyledA",
93
+ componentId: "sc-7al1vw-0"
94
+ })([ "", " cursor:pointer;&[disabled],&[aria-disabled='true']{color:", ";}&::-moz-focus-inner{border:0;padding:0;}" ], b.mixins.reset("inline"), b.variables.contentColorDisabled);
95
+ // CONCATENATED MODULE: ./src/Clickable/NavigationProvider.tsx
96
+ /** @public */
97
+ var v = {
98
+ children: i().node,
99
+ onClick: i().func,
100
+ prefix: i().string
101
+ };
102
+ var h = r().createContext({});
103
+ /**
104
+ * Used to provide an override for the `onClick` for links for single page applications so that
105
+ * internal links can navigate without a page reload.
106
+ */ function m(e) {
107
+ var t = e.children, n = e.onClick, o = e.prefix;
108
+ // @docs-props-type NavigationProviderProps
109
+
110
+ return r().createElement(h.Provider, {
111
+ value: {
112
+ onClick: n,
113
+ prefix: o
114
+ }
115
+ }, t);
116
+ }
117
+ m.propTypes = v;
118
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
119
+ /**
110
120
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
111
121
  *
112
122
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
113
123
  * @param current - The new value of the ref.
114
124
  */
115
- function updateReactRef(ref, current) {
116
- if (ref) {
117
- if (typeof ref === 'function') {
118
- ref(current);
119
- } else {
120
- // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
121
- // the intention here is to signal "we will take care of setting 'current', not you".
122
- ref.current = current; // eslint-disable-line no-param-reassign
125
+ function g(e, t) {
126
+ if (e) {
127
+ if (typeof e === "function") {
128
+ e(t);
129
+ } else {
130
+ // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
131
+ // the intention here is to signal "we will take care of setting 'current', not you".
132
+ e.current = t;
133
+ // eslint-disable-line no-param-reassign
134
+ }
135
+ }
123
136
  }
124
- }
125
- }
126
-
127
-
128
-
129
- /***/ }),
130
-
131
- /***/ 11:
132
- /***/ (function(module, exports) {
133
-
134
- module.exports = require("lodash/has");
135
-
136
- /***/ }),
137
-
138
- /***/ 198:
139
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
140
-
141
- "use strict";
142
- // ESM COMPAT FLAG
143
- __webpack_require__.r(__webpack_exports__);
144
-
145
- // EXPORTS
146
- __webpack_require__.d(__webpack_exports__, "default", function() { return /* reexport */ src_Clickable_Clickable; });
147
- __webpack_require__.d(__webpack_exports__, "isInternalLink", function() { return /* reexport */ isInternalLink; });
148
- __webpack_require__.d(__webpack_exports__, "NavigationContext", function() { return /* reexport */ NavigationContext; });
149
- __webpack_require__.d(__webpack_exports__, "NavigationProvider", function() { return /* reexport */ NavigationProvider; });
150
-
151
- // EXTERNAL MODULE: external "react"
152
- var external_react_ = __webpack_require__(2);
153
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
154
-
155
- // EXTERNAL MODULE: external "prop-types"
156
- var external_prop_types_ = __webpack_require__(1);
157
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
158
-
159
- // EXTERNAL MODULE: external "lodash/has"
160
- var has_ = __webpack_require__(11);
161
-
162
- // EXTERNAL MODULE: external "lodash/isString"
163
- var isString_ = __webpack_require__(23);
164
- var isString_default = /*#__PURE__*/__webpack_require__.n(isString_);
165
-
166
- // EXTERNAL MODULE: external "lodash/omit"
167
- var omit_ = __webpack_require__(5);
168
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_);
169
-
170
- // EXTERNAL MODULE: external "@splunk/react-ui/Dropdown"
171
- var Dropdown_ = __webpack_require__(22);
172
-
173
- // EXTERNAL MODULE: external "styled-components"
174
- var external_styled_components_ = __webpack_require__(3);
175
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
176
-
177
- // EXTERNAL MODULE: external "@splunk/themes"
178
- var themes_ = __webpack_require__(0);
179
-
180
- // CONCATENATED MODULE: ./src/Clickable/ClickableStyles.ts
181
-
182
-
183
- var StyledA = external_styled_components_default.a.a.withConfig({
184
- displayName: "ClickableStyles__StyledA",
185
- componentId: "sc-7al1vw-0"
186
- })(["", " cursor:pointer;&[disabled],&[aria-disabled='true']{color:", ";}&::-moz-focus-inner{border:0;padding:0;}"], themes_["mixins"].reset('inline'), themes_["variables"].contentColorDisabled);
187
-
188
- // CONCATENATED MODULE: ./src/Clickable/NavigationProvider.tsx
189
-
190
-
191
- /** @public */
192
-
193
- var propTypes = {
194
- children: external_prop_types_default.a.node,
195
- onClick: external_prop_types_default.a.func,
196
- prefix: external_prop_types_default.a.string
197
- };
198
- var NavigationContext = /*#__PURE__*/external_react_default.a.createContext({});
199
- /**
200
- * Used to provide an override for the `onClick` for links for single page applications so that
201
- * internal links can navigate without a page reload.
202
- */
203
-
204
- function NavigationProvider(_ref) {
205
- var children = _ref.children,
206
- onClick = _ref.onClick,
207
- prefix = _ref.prefix;
208
- // @docs-props-type NavigationProviderProps
209
- return /*#__PURE__*/external_react_default.a.createElement(NavigationContext.Provider, {
210
- value: {
211
- onClick: onClick,
212
- prefix: prefix
137
+ // CONCATENATED MODULE: ./src/Clickable/Clickable.tsx
138
+ function O(e) {
139
+ "@babel/helpers - typeof";
140
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
141
+ O = function e(t) {
142
+ return typeof t;
143
+ };
144
+ } else {
145
+ O = function e(t) {
146
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
147
+ };
148
+ }
149
+ return O(e);
213
150
  }
214
- }, children);
215
- }
216
-
217
- NavigationProvider.propTypes = propTypes;
218
-
219
- // EXTERNAL MODULE: ./src/utils/updateReactRef.ts
220
- var updateReactRef = __webpack_require__(10);
221
-
222
- // CONCATENATED MODULE: ./src/Clickable/Clickable.tsx
223
- 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); }
224
-
225
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
226
-
227
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
228
-
229
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
230
-
231
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
232
-
233
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
234
-
235
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
236
-
237
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
238
-
239
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
240
-
241
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
242
-
243
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
244
-
245
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
246
-
247
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
248
-
249
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
250
-
251
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
252
-
253
-
254
-
255
-
256
-
257
-
258
-
259
-
260
-
261
-
262
- var WITH_SCHEME = /^[a-z0-9]+:/;
263
- var SCHEME_RELATIVE = /^\/\//;
264
- var IS_RELATIVE = /^\//;
265
- var isInternalLink = function isInternalLink(to) {
266
- return to != null && !WITH_SCHEME.test(to) && !SCHEME_RELATIVE.test(to);
267
- };
268
- var Clickable_propTypes = {
269
- /** @private */
270
- allowDisabledLink: external_prop_types_default.a.bool,
271
- children: external_prop_types_default.a.node,
272
- disabled: external_prop_types_default.a.bool,
273
- elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
274
- onClick: external_prop_types_default.a.func,
275
- openInNewContext: external_prop_types_default.a.bool,
276
- navigationLabel: external_prop_types_default.a.string,
277
- to: external_prop_types_default.a.string
278
- };
279
- var defaultProps = {
280
- disabled: false,
281
- openInNewContext: false
282
- };
283
-
284
- function isLink(props) {
285
- return !!props.to && !props.disabled;
286
- }
287
-
288
- function getPrefixedURL(to, prefix) {
289
- if (prefix != null && isInternalLink(to) && IS_RELATIVE.test(to)) {
290
- return "".concat(prefix).concat(to);
291
- }
292
-
293
- return to;
294
- }
295
- /**
296
- * `Clickable` renders as a `button` element, or as an `a` element if the `to` prop is set
297
- * and the `disabled` prop is `false`. This is called link mode.
298
- */
299
-
300
-
301
- var Clickable_Clickable = /*#__PURE__*/function (_Component) {
302
- _inherits(Clickable, _Component);
303
-
304
- var _super = _createSuper(Clickable);
305
-
306
- // @docs-props-type ClickablePropsBase
307
- // should use ClickablePropsBase but fails on refs - observe
308
- function Clickable(props) {
309
- var _this;
310
-
311
- _classCallCheck(this, Clickable);
312
-
313
- _this = _super.call(this, props);
314
-
315
- _defineProperty(_assertThisInitialized(_this), "el", null);
316
-
317
- _defineProperty(_assertThisInitialized(_this), "handleMount", function (el) {
318
- _this.el = el;
319
- Object(updateReactRef["a" /* updateReactRef */])(_this.props.elementRef, el);
320
- });
321
-
322
- _defineProperty(_assertThisInitialized(_this), "createHandleOnClick", function (providedOnClick) {
323
- return function (e) {
324
- if (isLink(_this.props)) {
325
- // when user command-click on mac or ctrl-click on other platforms, and
326
- // Tag is an <a>, let the click pass through, let the <a> to achieve user's
327
- // intent of 'open in new context'
328
- // on mac, ctrl-click will be caught and open option menu even before hitting
329
- // the DOM, so we're safe to check both metaKey and ctrlKey here
330
- // without platform sniffing
331
- if ((e.metaKey || e.ctrlKey) && _this.props.to) {
332
- return;
333
- }
151
+ function k() {
152
+ k = Object.assign || function(e) {
153
+ for (var t = 1; t < arguments.length; t++) {
154
+ var n = arguments[t];
155
+ for (var r in n) {
156
+ if (Object.prototype.hasOwnProperty.call(n, r)) {
157
+ e[r] = n[r];
158
+ }
159
+ }
160
+ }
161
+ return e;
162
+ };
163
+ return k.apply(this, arguments);
164
+ }
165
+ function C(e, t) {
166
+ if (e == null) return {};
167
+ var n = w(e, t);
168
+ var r, o;
169
+ if (Object.getOwnPropertySymbols) {
170
+ var i = Object.getOwnPropertySymbols(e);
171
+ for (o = 0; o < i.length; o++) {
172
+ r = i[o];
173
+ if (t.indexOf(r) >= 0) continue;
174
+ if (!Object.prototype.propertyIsEnumerable.call(e, r)) continue;
175
+ n[r] = e[r];
176
+ }
334
177
  }
335
-
336
- if (_this.props.onClick) {
337
- _this.props.onClick(e);
338
- } else if (isLink(_this.props) && providedOnClick) {
339
- var prefix = _this.context.prefix;
340
- var label = _this.props.navigationLabel;
341
-
342
- if (!label && isString_default()(_this.props.children)) {
343
- label = _this.props.children;
344
- }
345
-
346
- providedOnClick(e, {
347
- to: getPrefixedURL(_this.props.to, prefix),
348
- originalTo: _this.props.to,
349
- openInNewContext: _this.props.openInNewContext,
350
- label: label
351
- });
178
+ return n;
179
+ }
180
+ function w(e, t) {
181
+ if (e == null) return {};
182
+ var n = {};
183
+ var r = Object.keys(e);
184
+ var o, i;
185
+ for (i = 0; i < r.length; i++) {
186
+ o = r[i];
187
+ if (t.indexOf(o) >= 0) continue;
188
+ n[o] = e[o];
189
+ }
190
+ return n;
191
+ }
192
+ function x(e, t) {
193
+ if (!(e instanceof t)) {
194
+ throw new TypeError("Cannot call a class as a function");
352
195
  }
353
- };
354
- });
355
-
356
- if (false) {}
357
-
358
- return _this;
359
- }
360
-
361
- _createClass(Clickable, [{
362
- key: "focus",
363
-
364
- /**
365
- * Place focus on the element.
366
- */
367
- value: function focus() {
368
- var _this$el;
369
-
370
- (_this$el = this.el) === null || _this$el === void 0 ? void 0 : _this$el.focus();
371
196
  }
372
- }, {
373
- key: "render",
374
- value: function render() {
375
- var _this$context = this.context,
376
- onClick = _this$context.onClick,
377
- prefix = _this$context.prefix;
378
- var handleOnClick = this.createHandleOnClick(onClick); // Only set the href attribute when enabled, and therefore using an <a> tag
379
-
380
- if (isLink(this.props)) {
381
- var _this$props = this.props,
382
- _children = _this$props.children,
383
- openInNewContext = _this$props.openInNewContext,
384
- to = _this$props.to,
385
- _otherProps = _objectWithoutProperties(_this$props, ["children", "openInNewContext", "to"]);
386
-
387
- var target = openInNewContext ? '_blank' : undefined;
388
- var rel = openInNewContext && isInternalLink(to) ? 'noopener noreferrer' : undefined;
389
- return /*#__PURE__*/external_react_default.a.createElement(StyledA, _extends({
390
- "data-test": "clickable",
391
- ref: this.handleMount,
392
- href: getPrefixedURL(this.props.to, prefix),
393
- target: target,
394
- rel: rel,
395
- onClick: handleOnClick
396
- }, omit_default()(_otherProps, 'disabled', 'elementRef', 'onClick')), _children);
397
- }
398
-
399
- if (this.props.allowDisabledLink) {
400
- var _ref = this.props,
401
- _children2 = _ref.children,
402
- _otherProps2 = _objectWithoutProperties(_ref, ["children"]);
403
-
404
- if (this.props.disabled && this.props.to != null) {
405
- return /*#__PURE__*/external_react_default.a.createElement(StyledA, _extends({
406
- "data-test": "clickable",
407
- ref: this.handleMount,
408
- role: "link",
409
- "aria-disabled": "true"
410
- }, omit_default()(_otherProps2, 'href', 'to', 'elementRef', 'onClick', 'disabled')), _children2);
197
+ function j(e, t) {
198
+ for (var n = 0; n < t.length; n++) {
199
+ var r = t[n];
200
+ r.enumerable = r.enumerable || false;
201
+ r.configurable = true;
202
+ if ("value" in r) r.writable = true;
203
+ Object.defineProperty(e, r.key, r);
411
204
  }
412
- } // button variant
413
-
414
-
415
- var _ref2 = this.props,
416
- children = _ref2.children,
417
- type = _ref2.type,
418
- otherProps = _objectWithoutProperties(_ref2, ["children", "type"]);
419
-
420
- return /*#__PURE__*/external_react_default.a.createElement(StyledA, _extends({
421
- as: "button",
422
- "data-test": "clickable",
423
- ref: this.handleMount,
424
- type: type || 'button',
425
- onClick: handleOnClick
426
- }, omit_default()(otherProps, 'elementRef', 'onClick', 'openInNewContext', 'to')), children);
427
205
  }
428
- }]);
429
-
430
- return Clickable;
431
- }(external_react_["Component"]);
432
-
433
- _defineProperty(Clickable_Clickable, "contextType", NavigationContext);
434
-
435
- _defineProperty(Clickable_Clickable, "propTypes", Clickable_propTypes);
436
-
437
- _defineProperty(Clickable_Clickable, "defaultProps", defaultProps);
438
-
439
- _defineProperty(Clickable_Clickable, Dropdown_["legacyRefMode"], true);
440
-
441
- /* harmony default export */ var src_Clickable_Clickable = (Clickable_Clickable);
442
- // CONCATENATED MODULE: ./src/Clickable/index.ts
443
-
444
-
445
-
446
-
447
- /***/ }),
448
-
449
- /***/ 2:
450
- /***/ (function(module, exports) {
451
-
452
- module.exports = require("react");
453
-
454
- /***/ }),
455
-
456
- /***/ 22:
457
- /***/ (function(module, exports) {
458
-
459
- module.exports = require("@splunk/react-ui/Dropdown");
460
-
461
- /***/ }),
462
-
463
- /***/ 23:
464
- /***/ (function(module, exports) {
465
-
466
- module.exports = require("lodash/isString");
467
-
468
- /***/ }),
469
-
470
- /***/ 3:
471
- /***/ (function(module, exports) {
472
-
473
- module.exports = require("styled-components");
474
-
475
- /***/ }),
476
-
477
- /***/ 5:
478
- /***/ (function(module, exports) {
479
-
480
- module.exports = require("lodash/omit");
481
-
482
- /***/ })
483
-
484
- /******/ });
206
+ function P(e, t, n) {
207
+ if (t) j(e.prototype, t);
208
+ if (n) j(e, n);
209
+ return e;
210
+ }
211
+ function S(e, t) {
212
+ if (typeof t !== "function" && t !== null) {
213
+ throw new TypeError("Super expression must either be null or a function");
214
+ }
215
+ e.prototype = Object.create(t && t.prototype, {
216
+ constructor: {
217
+ value: e,
218
+ writable: true,
219
+ configurable: true
220
+ }
221
+ });
222
+ if (t) _(e, t);
223
+ }
224
+ function _(e, t) {
225
+ _ = Object.setPrototypeOf || function e(t, n) {
226
+ t.__proto__ = n;
227
+ return t;
228
+ };
229
+ return _(e, t);
230
+ }
231
+ function R(e) {
232
+ var t = T();
233
+ return function n() {
234
+ var r = q(e), o;
235
+ if (t) {
236
+ var i = q(this).constructor;
237
+ o = Reflect.construct(r, arguments, i);
238
+ } else {
239
+ o = r.apply(this, arguments);
240
+ }
241
+ return I(this, o);
242
+ };
243
+ }
244
+ function I(e, t) {
245
+ if (t && (O(t) === "object" || typeof t === "function")) {
246
+ return t;
247
+ }
248
+ return N(e);
249
+ }
250
+ function N(e) {
251
+ if (e === void 0) {
252
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
253
+ }
254
+ return e;
255
+ }
256
+ function T() {
257
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
258
+ if (Reflect.construct.sham) return false;
259
+ if (typeof Proxy === "function") return true;
260
+ try {
261
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
262
+ return true;
263
+ } catch (e) {
264
+ return false;
265
+ }
266
+ }
267
+ function q(e) {
268
+ q = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
269
+ return t.__proto__ || Object.getPrototypeOf(t);
270
+ };
271
+ return q(e);
272
+ }
273
+ function E(e, t, n) {
274
+ if (t in e) {
275
+ Object.defineProperty(e, t, {
276
+ value: n,
277
+ enumerable: true,
278
+ configurable: true,
279
+ writable: true
280
+ });
281
+ } else {
282
+ e[t] = n;
283
+ }
284
+ return e;
285
+ }
286
+ var M = /^[a-z0-9]+:/;
287
+ var D = /^\/\//;
288
+ var L = /^\//;
289
+ var z = function e(t) {
290
+ return t != null && !M.test(t) && !D.test(t);
291
+ };
292
+ var H = {
293
+ /** @private */
294
+ allowDisabledLink: i().bool,
295
+ children: i().node,
296
+ disabled: i().bool,
297
+ elementRef: i().oneOfType([ i().func, i().object ]),
298
+ onClick: i().func,
299
+ openInNewContext: i().bool,
300
+ navigationLabel: i().string,
301
+ to: i().string
302
+ };
303
+ var K = {
304
+ disabled: false,
305
+ openInNewContext: false
306
+ };
307
+ function A(e) {
308
+ return !!e.to && !e.disabled;
309
+ }
310
+ function B(e, t) {
311
+ if (t != null && z(e) && L.test(e)) {
312
+ return "".concat(t).concat(e);
313
+ }
314
+ return e;
315
+ }
316
+ /**
317
+ * `Clickable` renders as a `button` element, or as an `a` element if the `to` prop is set
318
+ * and the `disabled` prop is `false`. This is called link mode.
319
+ */ var F = function(e) {
320
+ S(n, e);
321
+ var t = R(n);
322
+ // @docs-props-type ClickablePropsBase
323
+ // should use ClickablePropsBase but fails on refs - observe
324
+ function n(e) {
325
+ var r;
326
+ x(this, n);
327
+ r = t.call(this, e);
328
+ E(N(r), "el", null);
329
+ E(N(r), "handleMount", (function(e) {
330
+ r.el = e;
331
+ g(r.props.elementRef, e);
332
+ }));
333
+ E(N(r), "createHandleOnClick", (function(e) {
334
+ return function(t) {
335
+ if (A(r.props)) {
336
+ // when user command-click on mac or ctrl-click on other platforms, and
337
+ // Tag is an <a>, let the click pass through, let the <a> to achieve user's
338
+ // intent of 'open in new context'
339
+ // on mac, ctrl-click will be caught and open option menu even before hitting
340
+ // the DOM, so we're safe to check both metaKey and ctrlKey here
341
+ // without platform sniffing
342
+ if ((t.metaKey || t.ctrlKey) && r.props.to) {
343
+ return;
344
+ }
345
+ }
346
+ if (r.props.onClick) {
347
+ r.props.onClick(t);
348
+ } else if (A(r.props) && e) {
349
+ var n = r.context.prefix;
350
+ var o = r.props.navigationLabel;
351
+ if (!o && c()(r.props.children)) {
352
+ o = r.props.children;
353
+ }
354
+ e(t, {
355
+ to: B(r.props.to, n),
356
+ originalTo: r.props.to,
357
+ openInNewContext: r.props.openInNewContext,
358
+ label: o
359
+ });
360
+ }
361
+ };
362
+ }));
363
+ if (false) {}
364
+ return r;
365
+ }
366
+ P(n, [ {
367
+ key: "focus",
368
+ /**
369
+ * Place focus on the element.
370
+ */
371
+ value: function e() {
372
+ var t;
373
+ (t = this.el) === null || t === void 0 ? void 0 : t.focus();
374
+ }
375
+ }, {
376
+ key: "render",
377
+ value: function e() {
378
+ var t = this.context, n = t.onClick, o = t.prefix;
379
+ var i = this.createHandleOnClick(n);
380
+ // Only set the href attribute when enabled, and therefore using an <a> tag
381
+ if (A(this.props)) {
382
+ var l = this.props, a = l.children, c = l.openInNewContext, u = l.to, s = C(l, [ "children", "openInNewContext", "to" ]);
383
+ var p = c ? "_blank" : undefined;
384
+ var d = c && z(u) ? "noopener noreferrer" : undefined;
385
+
386
+ return r().createElement(y, k({
387
+ "data-test": "clickable",
388
+ ref: this.handleMount,
389
+ href: B(this.props.to, o),
390
+ target: p,
391
+ rel: d,
392
+ onClick: i
393
+ }, f()(s, "disabled", "elementRef", "onClick")), a);
394
+ }
395
+ if (this.props.allowDisabledLink) {
396
+ var b = this.props, v = b.children, h = C(b, [ "children" ]);
397
+ if (this.props.disabled && this.props.to != null) {
398
+
399
+ return r().createElement(y, k({
400
+ "data-test": "clickable",
401
+ ref: this.handleMount,
402
+ role: "link",
403
+ "aria-disabled": "true"
404
+ }, f()(h, "href", "to", "elementRef", "onClick", "disabled")), v);
405
+ }
406
+ }
407
+ // button variant
408
+ var m = this.props, g = m.children, O = m.type, w = C(m, [ "children", "type" ]);
409
+
410
+ return r().createElement(y, k({
411
+ as: "button",
412
+ "data-test": "clickable",
413
+ ref: this.handleMount,
414
+ type: O || "button",
415
+ onClick: i
416
+ }, f()(w, "elementRef", "onClick", "openInNewContext", "to")), g);
417
+ }
418
+ } ]);
419
+ return n;
420
+ }(n.Component);
421
+ E(F, "contextType", h);
422
+ E(F, "propTypes", H);
423
+ E(F, "defaultProps", K);
424
+ E(F, s.legacyRefMode, true);
425
+ /* harmony default export */ const G = F;
426
+ // CONCATENATED MODULE: ./src/Clickable/index.ts
427
+ module.exports = t;
428
+ /******/})();