@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.
- package/Accordion.js +425 -325
- package/Anchor.js +147 -117
- package/Animation.js +142 -94
- package/AnimationToggle.js +197 -193
- package/Box.js +145 -118
- package/Breadcrumbs.js +288 -206
- package/Button.js +488 -465
- package/ButtonGroup.js +160 -128
- package/ButtonSimple.js +543 -462
- package/CHANGELOG.md +24 -3
- package/Calendar.js +1111 -1001
- package/Card.js +771 -598
- package/CardLayout.js +205 -147
- package/Chip.js +509 -488
- package/Clickable.js +414 -352
- package/CloseButton.js +165 -142
- package/Code.js +1807 -2084
- package/CollapsiblePanel.js +586 -519
- package/Color.js +1068 -1068
- package/ColumnLayout.js +402 -363
- package/ComboBox.js +903 -794
- package/Concertina.js +997 -802
- package/ControlGroup.js +687 -594
- package/Date.js +567 -547
- package/DefinitionList.js +308 -234
- package/Divider.js +149 -118
- package/Dropdown.js +459 -416
- package/DualListbox.js +1479 -1541
- package/EventListener.js +94 -97
- package/File.js +1051 -969
- package/FormRows.js +883 -696
- package/Heading.js +216 -193
- package/Image.js +446 -402
- package/JSONTree.js +690 -551
- package/Layer.js +437 -410
- package/Link.js +336 -255
- package/List.js +213 -161
- package/Markdown.js +509 -487
- package/Menu.js +1104 -1056
- package/Message.js +475 -441
- package/MessageBar.js +387 -373
- package/Modal.js +810 -634
- package/ModalLayer.js +326 -243
- package/Monogram.js +308 -276
- package/Multiselect.js +3564 -3364
- package/Number.js +729 -687
- package/Paginator.js +510 -449
- package/Paragraph.js +145 -112
- package/Popover.js +1459 -1432
- package/Progress.js +301 -246
- package/RadioBar.js +634 -527
- package/RadioList.js +483 -444
- package/Resize.js +530 -489
- package/ResultsMenu.js +479 -455
- package/ScreenReaderContent.js +142 -111
- package/Scroll.js +595 -456
- package/ScrollContainerContext.js +197 -206
- package/Search.js +756 -650
- package/Select.js +2446 -2345
- package/SidePanel.js +390 -284
- package/Slider.js +680 -676
- package/SlidingPanels.js +639 -503
- package/SplitButton.js +464 -367
- package/StaticContent.js +161 -133
- package/StepBar.js +386 -358
- package/Switch.js +710 -640
- package/TabBar.js +741 -680
- package/TabLayout.js +406 -322
- package/Table.js +4974 -4616
- package/Text.js +1170 -1138
- package/TextArea.js +1102 -1090
- package/Tooltip.js +624 -581
- package/TransitionOpen.js +489 -422
- package/Typography.js +176 -153
- package/WaitSpinner.js +230 -206
- package/package.json +7 -7
- package/types/src/Color/Color.d.ts +0 -1
- package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
- package/types/src/JSONTree/TreeNode.d.ts +5 -0
- package/types/src/RadioBar/RadioBar.d.ts +1 -0
- package/types/src/ResultsMenu/ResultsMenu.d.ts +0 -2
- package/types/src/Select/docs/examples/Icons.d.ts +1 -9
- package/types/src/Slider/Slider.d.ts +1 -0
- package/types/src/TabBar/Tab.d.ts +10 -1
- package/types/src/TabBar/TabBar.d.ts +4 -2
- package/types/src/Table/Head.d.ts +7 -3
- package/types/src/Table/Table.d.ts +3 -2
- package/types/src/Table/TableContext.d.ts +2 -0
- package/useForceUpdate.js +112 -82
- package/useKeyPress.js +74 -71
- package/usePrevious.js +65 -65
- package/useRovingFocus.js +122 -138
package/Clickable.js
CHANGED
|
@@ -1,366 +1,428 @@
|
|
|
1
|
-
/******/ (() => {
|
|
2
|
-
|
|
3
|
-
/******/
|
|
4
|
-
/******/
|
|
5
|
-
/******/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/******/
|
|
9
|
-
/******/
|
|
10
|
-
/******/
|
|
11
|
-
/******/
|
|
12
|
-
/******/
|
|
13
|
-
/******/
|
|
14
|
-
/******/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/******/
|
|
20
|
-
/******/
|
|
21
|
-
/******/
|
|
22
|
-
/******/
|
|
23
|
-
/******/
|
|
24
|
-
/******/
|
|
25
|
-
/******/
|
|
26
|
-
/******/
|
|
27
|
-
/******/
|
|
28
|
-
/******/
|
|
29
|
-
/******/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/******/
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/
|
|
37
|
-
/******/
|
|
38
|
-
/******/
|
|
39
|
-
/******/
|
|
40
|
-
/******/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/******/
|
|
44
|
-
/******/
|
|
45
|
-
/******/
|
|
46
|
-
/******/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
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
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
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
|
-
|
|
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
|
-
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
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
|
+
/******/})();
|