@splunk/react-ui 4.21.0 → 4.22.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.
Files changed (92) hide show
  1. package/Accordion.js +425 -325
  2. package/Anchor.js +147 -117
  3. package/Animation.js +142 -94
  4. package/AnimationToggle.js +197 -193
  5. package/Box.js +145 -118
  6. package/Breadcrumbs.js +288 -206
  7. package/Button.js +488 -465
  8. package/ButtonGroup.js +160 -128
  9. package/ButtonSimple.js +543 -462
  10. package/CHANGELOG.md +24 -3
  11. package/Calendar.js +1111 -1001
  12. package/Card.js +771 -598
  13. package/CardLayout.js +205 -147
  14. package/Chip.js +509 -488
  15. package/Clickable.js +414 -352
  16. package/CloseButton.js +165 -142
  17. package/Code.js +1807 -2084
  18. package/CollapsiblePanel.js +586 -519
  19. package/Color.js +1068 -1068
  20. package/ColumnLayout.js +402 -363
  21. package/ComboBox.js +903 -794
  22. package/Concertina.js +997 -802
  23. package/ControlGroup.js +687 -594
  24. package/Date.js +567 -547
  25. package/DefinitionList.js +308 -234
  26. package/Divider.js +149 -118
  27. package/Dropdown.js +459 -416
  28. package/DualListbox.js +1479 -1541
  29. package/EventListener.js +94 -97
  30. package/File.js +1051 -969
  31. package/FormRows.js +883 -696
  32. package/Heading.js +216 -193
  33. package/Image.js +446 -402
  34. package/JSONTree.js +690 -551
  35. package/Layer.js +437 -410
  36. package/Link.js +336 -255
  37. package/List.js +213 -161
  38. package/Markdown.js +509 -487
  39. package/Menu.js +1104 -1056
  40. package/Message.js +475 -441
  41. package/MessageBar.js +387 -373
  42. package/Modal.js +810 -634
  43. package/ModalLayer.js +326 -243
  44. package/Monogram.js +308 -276
  45. package/Multiselect.js +3564 -3364
  46. package/Number.js +729 -687
  47. package/Paginator.js +510 -449
  48. package/Paragraph.js +145 -112
  49. package/Popover.js +1459 -1432
  50. package/Progress.js +301 -246
  51. package/RadioBar.js +634 -527
  52. package/RadioList.js +483 -444
  53. package/Resize.js +530 -489
  54. package/ResultsMenu.js +479 -455
  55. package/ScreenReaderContent.js +142 -111
  56. package/Scroll.js +595 -456
  57. package/ScrollContainerContext.js +197 -206
  58. package/Search.js +756 -650
  59. package/Select.js +2446 -2345
  60. package/SidePanel.js +390 -284
  61. package/Slider.js +680 -676
  62. package/SlidingPanels.js +639 -503
  63. package/SplitButton.js +464 -367
  64. package/StaticContent.js +161 -133
  65. package/StepBar.js +386 -358
  66. package/Switch.js +710 -640
  67. package/TabBar.js +741 -680
  68. package/TabLayout.js +406 -322
  69. package/Table.js +4974 -4616
  70. package/Text.js +1170 -1138
  71. package/TextArea.js +1102 -1090
  72. package/Tooltip.js +624 -581
  73. package/TransitionOpen.js +489 -422
  74. package/Typography.js +176 -153
  75. package/WaitSpinner.js +230 -206
  76. package/package.json +7 -7
  77. package/types/src/Color/Color.d.ts +0 -1
  78. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  79. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  80. package/types/src/RadioBar/RadioBar.d.ts +1 -0
  81. package/types/src/ResultsMenu/ResultsMenu.d.ts +0 -2
  82. package/types/src/Select/docs/examples/Icons.d.ts +1 -9
  83. package/types/src/Slider/Slider.d.ts +1 -0
  84. package/types/src/TabBar/Tab.d.ts +10 -1
  85. package/types/src/TabBar/TabBar.d.ts +4 -2
  86. package/types/src/Table/Head.d.ts +7 -3
  87. package/types/src/Table/Table.d.ts +3 -2
  88. package/types/src/Table/TableContext.d.ts +2 -0
  89. package/useForceUpdate.js +112 -82
  90. package/useKeyPress.js +74 -71
  91. package/usePrevious.js +65 -65
  92. package/useRovingFocus.js +122 -138
package/Clickable.js CHANGED
@@ -1,366 +1,428 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/ // The require scope
4
- /******/ var __webpack_require__ = {};
5
- /******/
6
- /************************************************************************/
7
- /******/ /* webpack/runtime/compat get default export */
8
- /******/ (() => {
9
- /******/ // getDefaultExport function for compatibility with non-harmony modules
10
- /******/ __webpack_require__.n = (module) => {
11
- /******/ var getter = module && module.__esModule ?
12
- /******/ () => (module['default']) :
13
- /******/ () => (module);
14
- /******/ __webpack_require__.d(getter, { a: getter });
15
- /******/ return getter;
16
- /******/ };
17
- /******/ })();
18
- /******/
19
- /******/ /* webpack/runtime/define property getters */
20
- /******/ (() => {
21
- /******/ // define getter functions for harmony exports
22
- /******/ __webpack_require__.d = (exports, definition) => {
23
- /******/ for(var key in definition) {
24
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
25
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26
- /******/ }
27
- /******/ }
28
- /******/ };
29
- /******/ })();
30
- /******/
31
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
32
- /******/ (() => {
33
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
34
- /******/ })();
35
- /******/
36
- /******/ /* webpack/runtime/make namespace object */
37
- /******/ (() => {
38
- /******/ // define __esModule on exports
39
- /******/ __webpack_require__.r = (exports) => {
40
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
41
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
42
- /******/ }
43
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
44
- /******/ };
45
- /******/ })();
46
- /******/
47
- /************************************************************************/
48
- var __webpack_exports__ = {};
49
- // ESM COMPAT FLAG
50
- __webpack_require__.r(__webpack_exports__);
51
-
52
- // EXPORTS
53
- __webpack_require__.d(__webpack_exports__, {
54
- NavigationContext: () => (/* reexport */ NavigationContext),
55
- NavigationProvider: () => (/* reexport */ NavigationProvider),
56
- "default": () => (/* reexport */ Clickable_Clickable),
57
- isInternalLink: () => (/* reexport */ isInternalLink)
58
- });
59
-
60
- ;// CONCATENATED MODULE: external "react"
61
- const external_react_namespaceObject = require("react");
62
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
63
- ;// CONCATENATED MODULE: external "prop-types"
64
- const external_prop_types_namespaceObject = require("prop-types");
65
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
66
- ;// CONCATENATED MODULE: external "lodash/has"
67
- const has_namespaceObject = require("lodash/has");
68
- ;// CONCATENATED MODULE: external "lodash/isString"
69
- const isString_namespaceObject = require("lodash/isString");
70
- var isString_default = /*#__PURE__*/__webpack_require__.n(isString_namespaceObject);
71
- ;// CONCATENATED MODULE: external "lodash/omit"
72
- const omit_namespaceObject = require("lodash/omit");
73
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_namespaceObject);
74
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Dropdown"
75
- const Dropdown_namespaceObject = require("@splunk/react-ui/Dropdown");
76
- ;// CONCATENATED MODULE: external "styled-components"
77
- const external_styled_components_namespaceObject = require("styled-components");
78
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
79
- ;// CONCATENATED MODULE: external "@splunk/themes"
80
- const themes_namespaceObject = require("@splunk/themes");
81
- ;// CONCATENATED MODULE: ./src/Clickable/ClickableStyles.ts
82
-
83
-
84
- var StyledA = external_styled_components_default().a.withConfig({
85
- displayName: "ClickableStyles__StyledA",
86
- componentId: "sc-7al1vw-0"
87
- })(["", " cursor:pointer;&[disabled],&[aria-disabled='true']{color:", ";}&::-moz-focus-inner{border:0;padding:0;}"], themes_namespaceObject.mixins.reset('inline'), themes_namespaceObject.variables.contentColorDisabled);
88
-
89
- ;// CONCATENATED MODULE: ./src/Clickable/NavigationProvider.tsx
90
-
91
-
92
- /** @public */
93
-
94
- var propTypes = {
95
- children: (external_prop_types_default()).node,
96
- onClick: (external_prop_types_default()).func,
97
- prefix: (external_prop_types_default()).string
98
- };
99
- var NavigationContext = /*#__PURE__*/external_react_default().createContext({});
100
- /**
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
+ /**
101
104
  * Used to provide an override for the `onClick` for links for single page applications so that
102
105
  * internal links can navigate without a page reload.
103
- */
104
-
105
- function NavigationProvider(_ref) {
106
- var children = _ref.children,
107
- onClick = _ref.onClick,
108
- prefix = _ref.prefix;
109
- // @docs-props-type NavigationProviderProps
110
- return /*#__PURE__*/external_react_default().createElement(NavigationContext.Provider, {
111
- value: {
112
- onClick: onClick,
113
- prefix: prefix
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);
114
116
  }
115
- }, children);
116
- }
117
-
118
- NavigationProvider.propTypes = propTypes;
119
-
120
- ;// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
121
- /**
117
+ m.propTypes = v;
118
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
119
+ /**
122
120
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
123
121
  *
124
122
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
125
123
  * @param current - The new value of the ref.
126
124
  */
127
- function updateReactRef(ref, current) {
128
- if (ref) {
129
- if (typeof ref === 'function') {
130
- ref(current);
131
- } else {
132
- // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
133
- // the intention here is to signal "we will take care of setting 'current', not you".
134
- 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
+ }
135
136
  }
136
- }
137
- }
138
-
139
-
140
- ;// CONCATENATED MODULE: ./src/Clickable/Clickable.tsx
141
- 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); }
142
-
143
- 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); }
144
-
145
- 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; }
146
-
147
- 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; }
148
-
149
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
150
-
151
- 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); } }
152
-
153
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
154
-
155
- 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); }
156
-
157
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
158
-
159
- 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); }; }
160
-
161
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
162
-
163
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
164
-
165
- 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; } }
166
-
167
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
168
-
169
- 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; }
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
- var WITH_SCHEME = /^[a-z0-9]+:/;
181
- var SCHEME_RELATIVE = /^\/\//;
182
- var IS_RELATIVE = /^\//;
183
- var isInternalLink = function isInternalLink(to) {
184
- return to != null && !WITH_SCHEME.test(to) && !SCHEME_RELATIVE.test(to);
185
- };
186
- var Clickable_propTypes = {
187
- /** @private */
188
- allowDisabledLink: (external_prop_types_default()).bool,
189
- children: (external_prop_types_default()).node,
190
- disabled: (external_prop_types_default()).bool,
191
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
192
- onClick: (external_prop_types_default()).func,
193
- openInNewContext: (external_prop_types_default()).bool,
194
- navigationLabel: (external_prop_types_default()).string,
195
- to: (external_prop_types_default()).string
196
- };
197
- var defaultProps = {
198
- disabled: false,
199
- openInNewContext: false
200
- };
201
-
202
- function isLink(props) {
203
- return !!props.to && !props.disabled;
204
- }
205
-
206
- function getPrefixedURL(to, prefix) {
207
- if (prefix != null && isInternalLink(to) && IS_RELATIVE.test(to)) {
208
- return "".concat(prefix).concat(to);
209
- }
210
-
211
- return to;
212
- }
213
- /**
214
- * `Clickable` renders as a `button` element, or as an `a` element if the `to` prop is set
215
- * and the `disabled` prop is `false`. This is called link mode.
216
- */
217
-
218
-
219
- var Clickable = /*#__PURE__*/function (_Component) {
220
- _inherits(Clickable, _Component);
221
-
222
- var _super = _createSuper(Clickable);
223
-
224
- // @docs-props-type ClickablePropsBase
225
- // should use ClickablePropsBase but fails on refs - observe
226
- function Clickable(props) {
227
- var _this;
228
-
229
- _classCallCheck(this, Clickable);
230
-
231
- _this = _super.call(this, props);
232
-
233
- _defineProperty(_assertThisInitialized(_this), "el", null);
234
-
235
- _defineProperty(_assertThisInitialized(_this), "handleMount", function (el) {
236
- _this.el = el;
237
- updateReactRef(_this.props.elementRef, el);
238
- });
239
-
240
- _defineProperty(_assertThisInitialized(_this), "createHandleOnClick", function (providedOnClick) {
241
- return function (e) {
242
- if (isLink(_this.props)) {
243
- // when user command-click on mac or ctrl-click on other platforms, and
244
- // Tag is an <a>, let the click pass through, let the <a> to achieve user's
245
- // intent of 'open in new context'
246
- // on mac, ctrl-click will be caught and open option menu even before hitting
247
- // the DOM, so we're safe to check both metaKey and ctrlKey here
248
- // without platform sniffing
249
- if ((e.metaKey || e.ctrlKey) && _this.props.to) {
250
- return;
251
- }
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
+ };
252
148
  }
253
-
254
- if (_this.props.onClick) {
255
- _this.props.onClick(e);
256
- } else if (isLink(_this.props) && providedOnClick) {
257
- var prefix = _this.context.prefix;
258
- var label = _this.props.navigationLabel;
259
-
260
- if (!label && isString_default()(_this.props.children)) {
261
- label = _this.props.children;
262
- }
263
-
264
- providedOnClick(e, {
265
- to: getPrefixedURL(_this.props.to, prefix),
266
- originalTo: _this.props.to,
267
- openInNewContext: _this.props.openInNewContext,
268
- label: label
269
- });
149
+ return O(e);
150
+ }
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
+ }
177
+ }
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");
195
+ }
196
+ }
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);
270
204
  }
271
- };
272
- });
273
-
274
- if (false) {}
275
-
276
- return _this;
277
- }
278
-
279
- _createClass(Clickable, [{
280
- key: "focus",
281
-
282
- /**
283
- * Place focus on the element.
284
- */
285
- value: function focus() {
286
- var _this$el;
287
-
288
- (_this$el = this.el) === null || _this$el === void 0 ? void 0 : _this$el.focus();
289
205
  }
290
- }, {
291
- key: "render",
292
- value: function render() {
293
- var _this$context = this.context,
294
- onClick = _this$context.onClick,
295
- prefix = _this$context.prefix;
296
- var handleOnClick = this.createHandleOnClick(onClick); // Only set the href attribute when enabled, and therefore using an <a> tag
297
-
298
- if (isLink(this.props)) {
299
- var _this$props = this.props,
300
- _children = _this$props.children,
301
- openInNewContext = _this$props.openInNewContext,
302
- to = _this$props.to,
303
- _otherProps = _objectWithoutProperties(_this$props, ["children", "openInNewContext", "to"]);
304
-
305
- var target = openInNewContext ? '_blank' : undefined;
306
- var rel = openInNewContext && isInternalLink(to) ? 'noopener noreferrer' : undefined;
307
- return /*#__PURE__*/external_react_default().createElement(StyledA, _extends({
308
- "data-test": "clickable",
309
- ref: this.handleMount,
310
- href: getPrefixedURL(this.props.to, prefix),
311
- target: target,
312
- rel: rel,
313
- onClick: handleOnClick
314
- }, omit_default()(_otherProps, 'disabled', 'elementRef', 'onClick')), _children);
315
- }
316
-
317
- if (this.props.allowDisabledLink) {
318
- var _ref = this.props,
319
- _children2 = _ref.children,
320
- _otherProps2 = _objectWithoutProperties(_ref, ["children"]);
321
-
322
- if (this.props.disabled && this.props.to != null) {
323
- return /*#__PURE__*/external_react_default().createElement(StyledA, _extends({
324
- "data-test": "clickable",
325
- ref: this.handleMount,
326
- role: "link",
327
- "aria-disabled": "true"
328
- }, omit_default()(_otherProps2, 'href', 'to', 'elementRef', 'onClick', 'disabled')), _children2);
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;
329
247
  }
330
- } // button variant
331
-
332
-
333
- var _ref2 = this.props,
334
- children = _ref2.children,
335
- type = _ref2.type,
336
- otherProps = _objectWithoutProperties(_ref2, ["children", "type"]);
337
-
338
- return /*#__PURE__*/external_react_default().createElement(StyledA, _extends({
339
- as: "button",
340
- "data-test": "clickable",
341
- ref: this.handleMount,
342
- type: type || 'button',
343
- onClick: handleOnClick
344
- }, omit_default()(otherProps, 'elementRef', 'onClick', 'openInNewContext', 'to')), children);
248
+ return N(e);
345
249
  }
346
- }]);
347
-
348
- return Clickable;
349
- }(external_react_namespaceObject.Component);
350
-
351
- _defineProperty(Clickable, "contextType", NavigationContext);
352
-
353
- _defineProperty(Clickable, "propTypes", Clickable_propTypes);
354
-
355
- _defineProperty(Clickable, "defaultProps", defaultProps);
356
-
357
- _defineProperty(Clickable, Dropdown_namespaceObject.legacyRefMode, true);
358
-
359
- /* harmony default export */ const Clickable_Clickable = (Clickable);
360
- ;// CONCATENATED MODULE: ./src/Clickable/index.ts
361
-
362
-
363
-
364
- module.exports = __webpack_exports__;
365
- /******/ })()
366
- ;
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
+ /******/})();