@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/Number.js CHANGED
@@ -1,864 +1,750 @@
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 = 205);
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
- /***/ 11:
105
- /***/ (function(module, exports) {
106
-
107
- module.exports = require("lodash/has");
108
-
109
- /***/ }),
110
-
111
- /***/ 12:
112
- /***/ (function(module, exports) {
113
-
114
- module.exports = require("@splunk/react-ui/Clickable");
115
-
116
- /***/ }),
117
-
118
- /***/ 17:
119
- /***/ (function(module, exports) {
120
-
121
- module.exports = require("@splunk/react-ui/Button");
122
-
123
- /***/ }),
124
-
125
- /***/ 19:
126
- /***/ (function(module, exports) {
127
-
128
- module.exports = require("lodash/isFinite");
129
-
130
- /***/ }),
131
-
132
- /***/ 2:
133
- /***/ (function(module, exports) {
134
-
135
- module.exports = require("react");
136
-
137
- /***/ }),
138
-
139
- /***/ 205:
140
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
141
-
142
- "use strict";
143
- // ESM COMPAT FLAG
144
- __webpack_require__.r(__webpack_exports__);
145
-
146
- // EXPORTS
147
- __webpack_require__.d(__webpack_exports__, "default", function() { return /* reexport */ src_Number_Number; });
148
-
149
- // EXTERNAL MODULE: external "react"
150
- var external_react_ = __webpack_require__(2);
151
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
152
-
153
- // EXTERNAL MODULE: external "prop-types"
154
- var external_prop_types_ = __webpack_require__(1);
155
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
156
-
157
- // EXTERNAL MODULE: external "lodash/has"
158
- var has_ = __webpack_require__(11);
159
- var has_default = /*#__PURE__*/__webpack_require__.n(has_);
160
-
161
- // EXTERNAL MODULE: external "lodash/isFinite"
162
- var isFinite_ = __webpack_require__(19);
163
- var isFinite_default = /*#__PURE__*/__webpack_require__.n(isFinite_);
164
-
165
- // EXTERNAL MODULE: external "lodash/isString"
166
- var isString_ = __webpack_require__(23);
167
- var isString_default = /*#__PURE__*/__webpack_require__.n(isString_);
168
-
169
- // EXTERNAL MODULE: external "lodash/omit"
170
- var omit_ = __webpack_require__(5);
171
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_);
172
-
173
- // EXTERNAL MODULE: external "@splunk/themes"
174
- var themes_ = __webpack_require__(0);
175
-
176
- // EXTERNAL MODULE: external "@splunk/ui-utils/keyboard"
177
- var keyboard_ = __webpack_require__(7);
178
-
179
- // EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
180
- var i18n_ = __webpack_require__(4);
181
-
182
- // EXTERNAL MODULE: external "@splunk/react-icons/SVGEnterprise"
183
- var SVGEnterprise_ = __webpack_require__(34);
184
- var SVGEnterprise_default = /*#__PURE__*/__webpack_require__.n(SVGEnterprise_);
185
-
186
- // CONCATENATED MODULE: ./src/Number/IncrementIcon.tsx
187
- 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); }
188
-
189
-
190
-
191
- /* eslint-disable max-len */
192
-
193
- function SortedUp(props) {
194
- return /*#__PURE__*/external_react_default.a.createElement(SVGEnterprise_default.a, _extends({
195
- viewBox: "0 0 933 600"
196
- }, props), /*#__PURE__*/external_react_default.a.createElement("path", {
197
- fill: "currentColor",
198
- d: "M0 466.438L466.438 0l466.44 467.466-134.59 133.56-331.85-331.848-331.85 331.85L0 466.438z"
199
- }));
200
- }
201
- // EXTERNAL MODULE: external "styled-components"
202
- var external_styled_components_ = __webpack_require__(3);
203
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
204
-
205
- // EXTERNAL MODULE: external "@splunk/react-ui/Button"
206
- var Button_ = __webpack_require__(17);
207
- var Button_default = /*#__PURE__*/__webpack_require__.n(Button_);
208
-
209
- // EXTERNAL MODULE: external "@splunk/react-ui/Clickable"
210
- var Clickable_ = __webpack_require__(12);
211
- var Clickable_default = /*#__PURE__*/__webpack_require__.n(Clickable_);
212
-
213
- // EXTERNAL MODULE: external "@splunk/react-ui/Text"
214
- var Text_ = __webpack_require__(32);
215
- var Text_default = /*#__PURE__*/__webpack_require__.n(Text_);
216
-
217
- // CONCATENATED MODULE: ./src/Number/NumberStyles.ts
218
-
219
-
220
-
221
-
222
-
223
- var StyledText = external_styled_components_default()(Text_default.a).withConfig({
224
- displayName: "NumberStyles__StyledText",
225
- componentId: "sc-2ekj9s-0"
226
- })(["&[data-inline]{", "}"], Object(themes_["pick"])({
227
- enterprise: {
228
- comfortable: Object(external_styled_components_["css"])(["width:100px;"]),
229
- compact: Object(external_styled_components_["css"])(["width:80px;"])
230
- },
231
- prisma: Object(external_styled_components_["css"])(["width:100px;"])
232
- }));
233
- var StyledControls = external_styled_components_default.a.div.withConfig({
234
- displayName: "NumberStyles__StyledControls",
235
- componentId: "sc-2ekj9s-1"
236
- })(["width:", ";height:100%;", " ", ""], Object(themes_["pick"])({
237
- enterprise: {
238
- comfortable: '20px',
239
- compact: '16px'
240
- },
241
- prisma: {
242
- comfortable: '24px',
243
- compact: '24px'
244
- }
245
- }), Object(themes_["pick"])({
246
- enterprise: Object(external_styled_components_["css"])(["transform:translateY(-1px);"]),
247
- prisma: Object(external_styled_components_["css"])(["transform:translateX(1px);"])
248
- }), function (_ref) {
249
- var $isAppend = _ref.$isAppend;
250
- return $isAppend ? Object(external_styled_components_["css"])(["margin-right:8px;", ""], Object(themes_["pick"])({
251
- prisma: Object(external_styled_components_["css"])(["transform:translateX(-1px);"])
252
- })) : Object(external_styled_components_["css"])(["margin-left:8px;"]);
253
- });
254
- var incrementor = Object(external_styled_components_["css"])(["position:relative;padding:3px;font-size:inherit;min-width:0;min-height:0;height:", ";width:100%;"], Object(themes_["pick"])({
255
- enterprise: 'calc(50% + 1.5px)',
256
- prisma: '50%'
257
- }));
258
- var StyledPlusButton = external_styled_components_default()(Button_default.a).withConfig({
259
- displayName: "NumberStyles__StyledPlusButton",
260
- componentId: "sc-2ekj9s-2"
261
- })(["", ";top:0;border-bottom-left-radius:0;border-bottom-right-radius:0;", " &:not([disabled]){&,&:hover{", ";}}"], incrementor, function (_ref2) {
262
- var append = _ref2.append;
263
- return append && Object(themes_["pick"])({
264
- enterprise: {
265
- light: Object(external_styled_components_["css"])(["border-right:1px solid ", ";"], themes_["variables"].gray60),
266
- dark: Object(external_styled_components_["css"])(["border-right:", ";"], themes_["variables"].border)
267
- }
268
- });
269
- }, Object(themes_["pick"])({
270
- enterprise: {
271
- dark: Object(external_styled_components_["css"])(["border-color:", ";"], themes_["variables"].gray20)
272
- }
273
- }));
274
- var StyledMinusButton = external_styled_components_default()(Button_default.a).withConfig({
275
- displayName: "NumberStyles__StyledMinusButton",
276
- componentId: "sc-2ekj9s-3"
277
- })(["", ";bottom:1px;border-top-left-radius:0;border-top-right-radius:0;", " &:not([disabled]){&,&:hover{", ";}}"], incrementor, function (_ref3) {
278
- var append = _ref3.append;
279
- return append && Object(themes_["pick"])({
280
- enterprise: {
281
- light: Object(external_styled_components_["css"])(["border-right:1px solid ", ";"], themes_["variables"].gray60),
282
- dark: Object(external_styled_components_["css"])(["border-right:", ";"], themes_["variables"].border)
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 r = t && t.__esModule ?
13
+ /******/ () => t["default"]
14
+ /******/ : () => t
15
+ /******/;
16
+ e.d(r, {
17
+ a: r
18
+ });
19
+ /******/ return r;
20
+ /******/ };
21
+ /******/ })();
22
+ /******/
23
+ /******/ /* webpack/runtime/define property getters */
24
+ /******/ (() => {
25
+ /******/ // define getter functions for harmony exports
26
+ /******/ e.d = (t, r) => {
27
+ /******/ for (var n in r) {
28
+ /******/ if (e.o(r, n) && !e.o(t, n)) {
29
+ /******/ Object.defineProperty(t, n, {
30
+ enumerable: true,
31
+ get: r[n]
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
+ default: () => /* reexport */ re
65
+ });
66
+ // CONCATENATED MODULE: external "react"
67
+ const r = require("react");
68
+ var n = e.n(r);
69
+ // CONCATENATED MODULE: external "prop-types"
70
+ const o = require("prop-types");
71
+ var i = e.n(o);
72
+ // CONCATENATED MODULE: external "lodash/has"
73
+ const a = require("lodash/has");
74
+ var l = e.n(a);
75
+ // CONCATENATED MODULE: external "lodash/isFinite"
76
+ const s = require("lodash/isFinite");
77
+ var u = e.n(s);
78
+ // CONCATENATED MODULE: external "lodash/isString"
79
+ const p = require("lodash/isString");
80
+ var c = e.n(p);
81
+ // CONCATENATED MODULE: external "lodash/omit"
82
+ const d = require("lodash/omit");
83
+ var f = e.n(d);
84
+ // CONCATENATED MODULE: external "@splunk/themes"
85
+ const v = require("@splunk/themes");
86
+ // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
87
+ const m = require("@splunk/ui-utils/keyboard");
88
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
89
+ const h = require("@splunk/ui-utils/i18n");
90
+ // CONCATENATED MODULE: external "@splunk/react-icons/SVGEnterprise"
91
+ const b = require("@splunk/react-icons/SVGEnterprise");
92
+ var y = e.n(b);
93
+ // CONCATENATED MODULE: ./src/Number/IncrementIcon.tsx
94
+ function g() {
95
+ g = Object.assign || function(e) {
96
+ for (var t = 1; t < arguments.length; t++) {
97
+ var r = arguments[t];
98
+ for (var n in r) {
99
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
100
+ e[n] = r[n];
101
+ }
102
+ }
103
+ }
104
+ return e;
105
+ };
106
+ return g.apply(this, arguments);
283
107
  }
284
- });
285
- }, Object(themes_["pick"])({
286
- enterprise: {
287
- dark: Object(external_styled_components_["css"])(["border-color:", ";"], themes_["variables"].gray20)
288
- }
289
- }));
290
- var prismaButton = external_styled_components_default()(Clickable_default.a).withConfig({
291
- displayName: "NumberStyles__prismaButton",
292
- componentId: "sc-2ekj9s-4"
293
- })(["", ";display:flex;align-items:center;justify-content:center;", " &:hover:not([disabled]){", "}&:active:not([disabled]){", "}"], incrementor, Object(themes_["pick"])({
294
- prisma: Object(external_styled_components_["css"])(["color:", ";"], themes_["variables"].contentColorDefault)
295
- }), Object(themes_["pick"])({
296
- prisma: Object(external_styled_components_["css"])(["background-color:", ";color:", ";"], themes_["variables"].interactiveColorOverlayHover, themes_["variables"].contentColorActive)
297
- }), Object(themes_["pick"])({
298
- prisma: Object(external_styled_components_["css"])(["background-color:", ";color:", ";"], themes_["variables"].interactiveColorOverlayActive, themes_["variables"].contentColorActive)
299
- }));
300
- var StyledPrismaPlusButton = external_styled_components_default()(prismaButton).withConfig({
301
- displayName: "NumberStyles__StyledPrismaPlusButton",
302
- componentId: "sc-2ekj9s-5"
303
- })(["border-top-right-radius:4px;"]);
304
- var StyledPrismaMinusButton = external_styled_components_default()(prismaButton).withConfig({
305
- displayName: "NumberStyles__StyledPrismaMinusButton",
306
- componentId: "sc-2ekj9s-6"
307
- })(["border-bottom-right-radius:4px;padding-bottom:5px;"]);
308
-
309
- // CONCATENATED MODULE: ./src/Number/Number.tsx
310
- 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); }
311
-
312
- function Number_extends() { Number_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 Number_extends.apply(this, arguments); }
313
-
314
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
315
-
316
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
317
-
318
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
319
-
320
- 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); } }
321
-
322
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
323
-
324
- 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); }
325
-
326
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
327
-
328
- 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); }; }
329
-
330
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
331
-
332
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
333
-
334
- 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; } }
335
-
336
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
337
-
338
- 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; }
339
-
340
-
341
-
342
-
343
-
344
-
345
-
346
-
347
-
348
-
349
-
350
-
351
- var propTypes = {
352
- append: external_prop_types_default.a.bool,
353
- children: external_prop_types_default.a.node,
354
- defaultValue: external_prop_types_default.a.number,
355
- describedBy: external_prop_types_default.a.string,
356
- disabled: external_prop_types_default.a.bool,
357
- elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
358
- inputRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
359
- error: external_prop_types_default.a.bool,
360
- hideStepButtons: external_prop_types_default.a.bool,
361
- inline: external_prop_types_default.a.bool,
362
- inputId: external_prop_types_default.a.string,
363
- labelledBy: external_prop_types_default.a.string,
364
- locale: external_prop_types_default.a.string,
365
- max: external_prop_types_default.a.number,
366
- min: external_prop_types_default.a.number,
367
- name: external_prop_types_default.a.string,
368
- onBlur: external_prop_types_default.a.func,
369
- onChange: external_prop_types_default.a.func,
370
- onFocus: external_prop_types_default.a.func,
371
- onKeyDown: external_prop_types_default.a.func,
372
- onKeyUp: external_prop_types_default.a.func,
373
- onSelect: external_prop_types_default.a.func,
374
- placeholder: external_prop_types_default.a.string,
375
- prepend: external_prop_types_default.a.bool,
376
- roundTo: external_prop_types_default.a.number,
377
- step: external_prop_types_default.a.number,
378
-
379
- /** @private */
380
- splunkTheme: external_prop_types_default.a.object,
381
- useSyntheticPlaceholder: external_prop_types_default.a.bool,
382
- value: external_prop_types_default.a.number
383
- };
384
- var defaultProps = {
385
- append: false,
386
- disabled: false,
387
- error: false,
388
- hideStepButtons: false,
389
- inline: false,
390
- locale: 'en-US',
391
- placeholder: '',
392
- prepend: false,
393
- roundTo: 5,
394
- step: 1
395
- };
396
-
397
- var Number_Number = /*#__PURE__*/function (_Component) {
398
- _inherits(Number, _Component);
399
-
400
- var _super = _createSuper(Number);
401
-
402
- _createClass(Number, null, [{
403
- key: "getDecimalSeparator",
404
- // @docs-props-type NumberPropsBase
405
- value: function getDecimalSeparator(locale) {
406
- // A more robust and expandable solution would be to use formatToParts() once IE requirements are dropped.
407
- var formattedNumber = new Intl.NumberFormat(locale.replace('_', '-')).format(1.2);
408
- return formattedNumber.indexOf(',') > -1 ? ',' : '.';
108
+ /* eslint-disable max-len */ function k(e) {
109
+
110
+ return n().createElement(y(), g({
111
+ viewBox: "0 0 933 600"
112
+ }, e), n().createElement("path", {
113
+ fill: "currentColor",
114
+ d: "M0 466.438L466.438 0l466.44 467.466-134.59 133.56-331.85-331.848-331.85 331.85L0 466.438z"
115
+ }));
409
116
  }
410
- }, {
411
- key: "validatePrependAppend",
412
- value: function validatePrependAppend(append, prepend) {
413
- if (false) {}
117
+ // CONCATENATED MODULE: external "styled-components"
118
+ const S = require("styled-components");
119
+ var x = e.n(S);
120
+ // CONCATENATED MODULE: external "@splunk/react-ui/Button"
121
+ const O = require("@splunk/react-ui/Button");
122
+ var w = e.n(O);
123
+ // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
124
+ const C = require("@splunk/react-ui/Clickable");
125
+ var j = e.n(C);
126
+ // CONCATENATED MODULE: external "@splunk/react-ui/Text"
127
+ const P = require("@splunk/react-ui/Text");
128
+ var V = e.n(P);
129
+ // CONCATENATED MODULE: ./src/Number/NumberStyles.ts
130
+ var T = x()(V()).withConfig({
131
+ displayName: "NumberStyles__StyledText",
132
+ componentId: "sc-2ekj9s-0"
133
+ })([ "&[data-inline]{", "}" ], (0, v.pick)({
134
+ enterprise: {
135
+ comfortable: (0, S.css)([ "width:100px;" ]),
136
+ compact: (0, S.css)([ "width:80px;" ])
137
+ },
138
+ prisma: (0, S.css)([ "width:100px;" ])
139
+ }));
140
+ var _ = x().div.withConfig({
141
+ displayName: "NumberStyles__StyledControls",
142
+ componentId: "sc-2ekj9s-1"
143
+ })([ "width:", ";height:100%;", " ", "" ], (0, v.pick)({
144
+ enterprise: {
145
+ comfortable: "20px",
146
+ compact: "16px"
147
+ },
148
+ prisma: {
149
+ comfortable: "24px",
150
+ compact: "24px"
151
+ }
152
+ }), (0, v.pick)({
153
+ enterprise: (0, S.css)([ "transform:translateY(-1px);" ]),
154
+ prisma: (0, S.css)([ "transform:translateX(1px);" ])
155
+ }), (function(e) {
156
+ var t = e.$isAppend;
157
+ return t ? (0, S.css)([ "margin-right:8px;", "" ], (0, v.pick)({
158
+ prisma: (0, S.css)([ "transform:translateX(-1px);" ])
159
+ })) : (0, S.css)([ "margin-left:8px;" ]);
160
+ }));
161
+ var E = (0, S.css)([ "position:relative;padding:3px;font-size:inherit;min-width:0;min-height:0;height:", ";width:100%;" ], (0,
162
+ v.pick)({
163
+ enterprise: "calc(50% + 1.5px)",
164
+ prisma: "50%"
165
+ }));
166
+ var D = x()(w()).withConfig({
167
+ displayName: "NumberStyles__StyledPlusButton",
168
+ componentId: "sc-2ekj9s-2"
169
+ })([ "", ";top:0;border-bottom-left-radius:0;border-bottom-right-radius:0;", " &:not([disabled]){&,&:hover{", ";}}" ], E, (function(e) {
170
+ var t = e.append;
171
+ return t && (0, v.pick)({
172
+ enterprise: {
173
+ light: (0, S.css)([ "border-right:1px solid ", ";" ], v.variables.gray60),
174
+ dark: (0, S.css)([ "border-right:", ";" ], v.variables.border)
175
+ }
176
+ });
177
+ }), (0, v.pick)({
178
+ enterprise: {
179
+ dark: (0, S.css)([ "border-color:", ";" ], v.variables.gray20)
180
+ }
181
+ }));
182
+ var N = x()(w()).withConfig({
183
+ displayName: "NumberStyles__StyledMinusButton",
184
+ componentId: "sc-2ekj9s-3"
185
+ })([ "", ";bottom:1px;border-top-left-radius:0;border-top-right-radius:0;", " &:not([disabled]){&,&:hover{", ";}}" ], E, (function(e) {
186
+ var t = e.append;
187
+ return t && (0, v.pick)({
188
+ enterprise: {
189
+ light: (0, S.css)([ "border-right:1px solid ", ";" ], v.variables.gray60),
190
+ dark: (0, S.css)([ "border-right:", ";" ], v.variables.border)
191
+ }
192
+ });
193
+ }), (0, v.pick)({
194
+ enterprise: {
195
+ dark: (0, S.css)([ "border-color:", ";" ], v.variables.gray20)
196
+ }
197
+ }));
198
+ var B = x()(j()).withConfig({
199
+ displayName: "NumberStyles__prismaButton",
200
+ componentId: "sc-2ekj9s-4"
201
+ })([ "", ";display:flex;align-items:center;justify-content:center;", " &:hover:not([disabled]){", "}&:active:not([disabled]){", "}" ], E, (0,
202
+ v.pick)({
203
+ prisma: (0, S.css)([ "color:", ";" ], v.variables.contentColorDefault)
204
+ }), (0, v.pick)({
205
+ prisma: (0, S.css)([ "background-color:", ";color:", ";" ], v.variables.interactiveColorOverlayHover, v.variables.contentColorActive)
206
+ }), (0, v.pick)({
207
+ prisma: (0, S.css)([ "background-color:", ";color:", ";" ], v.variables.interactiveColorOverlayActive, v.variables.contentColorActive)
208
+ }));
209
+ var I = x()(B).withConfig({
210
+ displayName: "NumberStyles__StyledPrismaPlusButton",
211
+ componentId: "sc-2ekj9s-5"
212
+ })([ "border-top-right-radius:4px;" ]);
213
+ var q = x()(B).withConfig({
214
+ displayName: "NumberStyles__StyledPrismaMinusButton",
215
+ componentId: "sc-2ekj9s-6"
216
+ })([ "border-bottom-right-radius:4px;padding-bottom:5px;" ]);
217
+ // CONCATENATED MODULE: ./src/Number/Number.tsx
218
+ function K(e) {
219
+ "@babel/helpers - typeof";
220
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
221
+ K = function e(t) {
222
+ return typeof t;
223
+ };
224
+ } else {
225
+ K = function e(t) {
226
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
227
+ };
228
+ }
229
+ return K(e);
414
230
  }
415
- }, {
416
- key: "stringToNumber",
417
- value: function stringToNumber(str, props) {
418
- var val = str;
419
-
420
- if (!isString_default()(val) || val === '') {
421
- return undefined;
422
- }
423
-
424
- if (Number.getDecimalSeparator(props.locale) === '.') {
425
- // remove leading non-numeric characters.
426
- val = val.replace(/^[^\d.-]/, '');
427
- } else {
428
- // remove leading non-numeric characters and replace comma with period
429
- val = val.replace(/^[^\d,-]/, '').replace(',', '.');
430
- }
431
-
432
- var valNumeric = Number.limitValue(parseFloat(val), props);
433
-
434
- if (isFinite_default()(valNumeric)) {
435
- return valNumeric;
436
- }
437
-
438
- return undefined;
231
+ function A() {
232
+ A = Object.assign || function(e) {
233
+ for (var t = 1; t < arguments.length; t++) {
234
+ var r = arguments[t];
235
+ for (var n in r) {
236
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
237
+ e[n] = r[n];
238
+ }
239
+ }
240
+ }
241
+ return e;
242
+ };
243
+ return A.apply(this, arguments);
439
244
  }
440
- }, {
441
- key: "numberToString",
442
- value: function numberToString(number, props) {
443
- if (number === undefined || !isFinite_default()(number)) {
444
- return '';
445
- }
446
-
447
- if (Number.getDecimalSeparator(props.locale) === '.') {
448
- return number.toString();
449
- } // comma separated case
450
-
451
-
452
- return number.toString().replace('.', ',');
245
+ function M(e, t) {
246
+ var r = Object.keys(e);
247
+ if (Object.getOwnPropertySymbols) {
248
+ var n = Object.getOwnPropertySymbols(e);
249
+ if (t) n = n.filter((function(t) {
250
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
251
+ }));
252
+ r.push.apply(r, n);
253
+ }
254
+ return r;
453
255
  }
454
- }, {
455
- key: "limitValue",
456
- value: function limitValue(val, _ref) {
457
- var min = _ref.min,
458
- max = _ref.max,
459
- roundTo = _ref.roundTo;
460
- var newVal = val;
461
-
462
- if (!isFinite_default()(val)) {
463
- return newVal;
464
- }
465
-
466
- if (min !== undefined && isFinite_default()(min)) {
467
- newVal = Math.max(min, newVal);
468
- }
469
-
470
- if (max !== undefined && isFinite_default()(max)) {
471
- newVal = Math.min(max, newVal);
472
- } // eslint-disable-next-line no-restricted-properties
473
-
474
-
475
- var pow = Math.pow(10, roundTo);
476
- return Math.round(newVal * pow) / pow;
256
+ function R(e) {
257
+ for (var t = 1; t < arguments.length; t++) {
258
+ var r = arguments[t] != null ? arguments[t] : {};
259
+ if (t % 2) {
260
+ M(Object(r), true).forEach((function(t) {
261
+ Q(e, t, r[t]);
262
+ }));
263
+ } else if (Object.getOwnPropertyDescriptors) {
264
+ Object.defineProperties(e, Object.getOwnPropertyDescriptors(r));
265
+ } else {
266
+ M(Object(r)).forEach((function(t) {
267
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
268
+ }));
269
+ }
270
+ }
271
+ return e;
477
272
  }
478
- }]);
479
-
480
- function Number(props) {
481
- var _this;
482
-
483
- _classCallCheck(this, Number);
484
-
485
- _this = _super.call(this, props);
486
-
487
- _defineProperty(_assertThisInitialized(_this), "controlledExternally", void 0);
488
-
489
- _defineProperty(_assertThisInitialized(_this), "text", null);
490
-
491
- _defineProperty(_assertThisInitialized(_this), "handleInputBlur", function (e) {
492
- var _this$props$onBlur, _this$props;
493
-
494
- _this.updateString();
495
-
496
- (_this$props$onBlur = (_this$props = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props, e);
497
- });
498
-
499
- _defineProperty(_assertThisInitialized(_this), "handleInputChange", function (e, _ref2) {
500
- var value = _ref2.value;
501
-
502
- _this.setValueFromString(e, value);
503
- });
504
-
505
- _defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (e) {
506
- var _this$props$onKeyDown, _this$props2;
507
-
508
- if (!e.metaKey && !e.ctrlKey && !e.altKey && Object(keyboard_["addsCharacter"])(e.nativeEvent) !== false) {
509
- // only allow numbers, negative and decimals
510
- if (!Object(keyboard_["isNumeric"])(e.nativeEvent, {
511
- locale: _this.props.locale
512
- })) {
513
- e.preventDefault();
514
- } // if minus is not allowed or there is already one, prevent input
515
-
516
-
517
- if (Object(keyboard_["isMinus"])(e.nativeEvent) && (_this.preventNegativeNumbers() || _this.state.stringValue.indexOf('-') >= 0)) {
518
- e.preventDefault();
519
- } // if decimal is not allowed or there is already one, prevent input
520
-
521
-
522
- if (Object(keyboard_["isDecimal"])(e.nativeEvent, {
523
- locale: _this.props.locale
524
- }) && (_this.props.roundTo <= 0 || _this.state.stringValue.indexOf(_this.props.locale) >= 0)) {
525
- e.preventDefault();
273
+ function F(e, t) {
274
+ if (!(e instanceof t)) {
275
+ throw new TypeError("Cannot call a class as a function");
526
276
  }
527
- } // Arrow up and down will increment
528
-
529
-
530
- if (Object(keyboard_["keycode"])(e.nativeEvent) === 'up') {
531
- _this.increment(e, _this.props.step);
532
-
533
- e.preventDefault();
534
- } else if (Object(keyboard_["keycode"])(e.nativeEvent) === 'down') {
535
- _this.increment(e, -_this.props.step);
536
-
537
- e.preventDefault();
538
- }
539
-
540
- (_this$props$onKeyDown = (_this$props2 = _this.props).onKeyDown) === null || _this$props$onKeyDown === void 0 ? void 0 : _this$props$onKeyDown.call(_this$props2, e);
541
- });
542
-
543
- _defineProperty(_assertThisInitialized(_this), "handleKeyUp", function (e) {
544
- var _this$props$onKeyUp, _this$props3;
545
-
546
- if (Object(keyboard_["keycode"])(e.nativeEvent) === 'enter') {
547
- _this.updateString();
548
- }
549
-
550
- (_this$props$onKeyUp = (_this$props3 = _this.props).onKeyUp) === null || _this$props$onKeyUp === void 0 ? void 0 : _this$props$onKeyUp.call(_this$props3, e);
551
- });
552
-
553
- _defineProperty(_assertThisInitialized(_this), "handleIncrement", function (e) {
554
- _this.increment(e, _this.props.step);
555
- });
556
-
557
- _defineProperty(_assertThisInitialized(_this), "handleDecrement", function (e) {
558
- _this.increment(e, -_this.props.step);
559
- });
560
-
561
- _this.controlledExternally = has_default()(props, 'value');
562
-
563
- var _value = _this.isControlled() ? props.value : props.defaultValue;
564
-
565
- _this.state = {
566
- // value stores internal state, only in uncontrolled mode
567
- value: _this.isControlled() ? undefined : _value,
568
- // prevValueProp is used to keep track of changes to the value prop, only in controlled mode
569
- prevValueProp: _this.isControlled() ? _value : undefined,
570
- // eslint-disable-line react/no-unused-state
571
- // stringValue stores the current contents of the input text box - it might be out of range, invalid, ...
572
- stringValue: Number.numberToString(_value, props)
573
- };
574
-
575
- if (false) {}
576
-
577
- if (has_default()(props, 'useSyntheticPlaceholder')) {
578
- // eslint-disable-next-line no-console
579
- console.warn("The 'Number' prop 'useSyntheticPlaceholder' has been marked for deprecation.");
580
277
  }
581
-
582
- if (false) {}
583
-
584
- Number.validatePrependAppend(_this.props.append, _this.props.prepend);
585
- return _this;
586
- }
587
-
588
- _createClass(Number, [{
589
- key: "componentDidUpdate",
590
- value: function componentDidUpdate(prevProps) {
591
- if (false) {}
592
-
593
- if (false) {}
594
-
595
- Number.validatePrependAppend(this.props.append, this.props.prepend);
278
+ function U(e, t) {
279
+ for (var r = 0; r < t.length; r++) {
280
+ var n = t[r];
281
+ n.enumerable = n.enumerable || false;
282
+ n.configurable = true;
283
+ if ("value" in n) n.writable = true;
284
+ Object.defineProperty(e, n.key, n);
285
+ }
596
286
  }
597
- }, {
598
- key: "getValue",
599
- value: function getValue() {
600
- return this.isControlled() ? this.props.value : this.state.value;
287
+ function z(e, t, r) {
288
+ if (t) U(e.prototype, t);
289
+ if (r) U(e, r);
290
+ return e;
601
291
  }
602
- }, {
603
- key: "setValueFromString",
604
- value: function setValueFromString(e, str) {
605
- var _this2 = this;
606
-
607
- var value = Number.stringToNumber(str, this.props);
608
- var name = this.props.name;
609
- this.setState({
610
- value: this.isControlled() ? undefined : value,
611
- stringValue: str
612
- }, function () {
613
- if (_this2.getValue() !== value || !_this2.isControlled()) {
614
- var _this2$props$onChange, _this2$props;
615
-
616
- (_this2$props$onChange = (_this2$props = _this2.props).onChange) === null || _this2$props$onChange === void 0 ? void 0 : _this2$props$onChange.call(_this2$props, e, {
617
- value: value,
618
- name: name
619
- });
292
+ function X(e, t) {
293
+ if (typeof t !== "function" && t !== null) {
294
+ throw new TypeError("Super expression must either be null or a function");
620
295
  }
621
- });
296
+ e.prototype = Object.create(t && t.prototype, {
297
+ constructor: {
298
+ value: e,
299
+ writable: true,
300
+ configurable: true
301
+ }
302
+ });
303
+ if (t) $(e, t);
622
304
  }
623
- }, {
624
- key: "setValue",
625
- value: function setValue(e, value) {
626
- var _this3 = this;
627
-
628
- var name = this.props.name;
629
- this.setState({
630
- value: this.isControlled() ? undefined : value,
631
- stringValue: Number.numberToString(value, this.props)
632
- }, function () {
633
- if (_this3.getValue() !== value || !_this3.isControlled()) {
634
- var _this3$props$onChange, _this3$props;
635
-
636
- (_this3$props$onChange = (_this3$props = _this3.props).onChange) === null || _this3$props$onChange === void 0 ? void 0 : _this3$props$onChange.call(_this3$props, e, {
637
- value: value,
638
- name: name
639
- });
640
- }
641
- });
305
+ function $(e, t) {
306
+ $ = Object.setPrototypeOf || function e(t, r) {
307
+ t.__proto__ = r;
308
+ return t;
309
+ };
310
+ return $(e, t);
642
311
  }
643
- }, {
644
- key: "focus",
645
-
646
- /**
647
- * Place focus on the input.
648
- */
649
- value: function focus(options) {
650
- if (this.text) {
651
- this.text.focus(options);
652
- }
312
+ function L(e) {
313
+ var t = Y();
314
+ return function r() {
315
+ var n = J(e), o;
316
+ if (t) {
317
+ var i = J(this).constructor;
318
+ o = Reflect.construct(n, arguments, i);
319
+ } else {
320
+ o = n.apply(this, arguments);
321
+ }
322
+ return G(this, o);
323
+ };
653
324
  }
654
- }, {
655
- key: "isControlled",
656
- value: function isControlled() {
657
- return this.controlledExternally;
325
+ function G(e, t) {
326
+ if (t && (K(t) === "object" || typeof t === "function")) {
327
+ return t;
328
+ }
329
+ return H(e);
658
330
  }
659
- }, {
660
- key: "updateString",
661
- value: function updateString() {
662
- var value = this.getValue();
663
- this.setState({
664
- stringValue: Number.numberToString(value, this.props)
665
- });
331
+ function H(e) {
332
+ if (e === void 0) {
333
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
334
+ }
335
+ return e;
666
336
  }
667
- }, {
668
- key: "increment",
669
- value: function increment(e, amount) {
670
- var valNumeric = Number.stringToNumber(this.state.stringValue, this.props);
671
- var targetValNumeric; // increment appropriate number
672
-
673
- if (valNumeric !== undefined && isFinite_default()(valNumeric)) {
674
- // increment the entered value
675
- targetValNumeric = valNumeric + amount;
676
- } else if (this.props.defaultValue !== undefined && isFinite_default()(this.props.defaultValue)) {
677
- // increment the defaultValue
678
- targetValNumeric = this.props.defaultValue + amount;
679
- } else if (amount > 0) {
680
- // increment up to max or step value
681
- targetValNumeric = this.props.max || this.props.step;
682
- } else {
683
- // increment down to min or 0
684
- targetValNumeric = this.props.min || 0; // set to min or 0
685
- }
686
-
687
- this.setValue(e, Number.limitValue(targetValNumeric, this.props));
337
+ function Y() {
338
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
339
+ if (Reflect.construct.sham) return false;
340
+ if (typeof Proxy === "function") return true;
341
+ try {
342
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
343
+ return true;
344
+ } catch (e) {
345
+ return false;
346
+ }
688
347
  }
689
- }, {
690
- key: "preventNegativeNumbers",
691
- value: function preventNegativeNumbers() {
692
- return this.props.min !== undefined && isFinite_default()(this.props.min) && this.props.min >= 0;
348
+ function J(e) {
349
+ J = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
350
+ return t.__proto__ || Object.getPrototypeOf(t);
351
+ };
352
+ return J(e);
693
353
  }
694
- }, {
695
- key: "render",
696
- value: function render() {
697
- var _this4 = this;
698
-
699
- var _this$props4 = this.props,
700
- append = _this$props4.append,
701
- describedBy = _this$props4.describedBy,
702
- disabled = _this$props4.disabled,
703
- error = _this$props4.error,
704
- hideStepButtons = _this$props4.hideStepButtons,
705
- inline = _this$props4.inline,
706
- _this$props4$value = _this$props4.value,
707
- value = _this$props4$value === void 0 ? this.state.value : _this$props4$value,
708
- max = _this$props4.max,
709
- min = _this$props4.min,
710
- prepend = _this$props4.prepend,
711
- splunkTheme = _this$props4.splunkTheme;
712
- var textProps = omit_default()(this.props, ['defaultValue', 'hideStepButtons', 'max', 'min', 'roundTo', 'spellCheck', 'step']);
713
- var isPrisma = splunkTheme.isPrisma;
714
- var buttonProps = isPrisma ? {} : {
715
- append: append,
716
- prepend: !append,
717
- error: error,
718
- inline: false
719
- };
720
- var disableIncrement = value !== undefined && isFinite_default()(value) && max !== undefined && isFinite_default()(max) && value >= max;
721
- var disableDecrement = value !== undefined && isFinite_default()(value) && min !== undefined && isFinite_default()(min) && value <= min;
722
- var plusIcon = /*#__PURE__*/external_react_default.a.createElement(SortedUp, {
723
- width: "6px",
724
- height: "4px",
725
- screenReaderText: Object(i18n_["_"])('Increment')
726
- });
727
-
728
- var plusProps = _objectSpread({
729
- 'data-test': 'increment',
730
- disabled: disabled || disableIncrement,
731
- onClick: this.handleIncrement,
732
- tabIndex: -1
733
- }, buttonProps);
734
-
735
- var styledPlus = isPrisma ? /*#__PURE__*/external_react_default.a.createElement(StyledPrismaPlusButton, plusProps, plusIcon) : /*#__PURE__*/external_react_default.a.createElement(StyledPlusButton, plusProps, plusIcon);
736
- var minusIcon = /*#__PURE__*/external_react_default.a.createElement(SortedUp, {
737
- width: "6px",
738
- height: "4px",
739
- screenReaderText: Object(i18n_["_"])('Decrement'),
740
- style: {
741
- transform: 'rotateX(180deg)'
742
- }
743
- });
744
-
745
- var minusProps = _objectSpread({
746
- 'data-test': 'decrement',
747
- disabled: disabled || disableDecrement,
748
- onClick: this.handleDecrement,
749
- tabIndex: -1
750
- }, buttonProps);
751
-
752
- var styledMinus = isPrisma ? /*#__PURE__*/external_react_default.a.createElement(StyledPrismaMinusButton, minusProps, minusIcon) : /*#__PURE__*/external_react_default.a.createElement(StyledMinusButton, minusProps, minusIcon);
753
- var isAppend = append && !prepend;
754
- var startAdornment = (!disabled || isPrisma) && isAppend && !hideStepButtons && /*#__PURE__*/external_react_default.a.createElement(StyledControls, {
755
- $isAppend: isAppend
756
- }, styledPlus, styledMinus);
757
- var endAdornment = (!disabled || isPrisma) && !isAppend && !hideStepButtons && /*#__PURE__*/external_react_default.a.createElement(StyledControls, {
758
- $isAppend: isAppend
759
- }, styledPlus, styledMinus);
760
- return /*#__PURE__*/external_react_default.a.createElement(StyledText, Number_extends({
761
- autoCapitalize: "off",
762
- autoComplete: "off",
763
- autoCorrect: "off",
764
- spellCheck: false,
765
- "data-test": "number",
766
- ref: function ref(c) {
767
- _this4.text = c;
354
+ function Q(e, t, r) {
355
+ if (t in e) {
356
+ Object.defineProperty(e, t, {
357
+ value: r,
358
+ enumerable: true,
359
+ configurable: true,
360
+ writable: true
361
+ });
362
+ } else {
363
+ e[t] = r;
768
364
  }
769
- }, textProps, {
770
- inline: inline,
771
- onChange: this.handleInputChange,
772
- onBlur: this.handleInputBlur,
773
- onKeyDown: this.handleKeyDown,
774
- onKeyUp: this.handleKeyUp,
775
- value: this.state.stringValue,
776
- "aria-describedby": describedBy,
777
- error: error,
778
- "data-test-value": value,
779
- startAdornment: startAdornment,
780
- endAdornment: endAdornment
781
- }));
365
+ return e;
782
366
  }
783
- }]);
784
-
785
- return Number;
786
- }(external_react_["Component"]);
787
-
788
- _defineProperty(Number_Number, "propTypes", propTypes);
789
-
790
- _defineProperty(Number_Number, "defaultProps", defaultProps);
791
-
792
- _defineProperty(Number_Number, "getDerivedStateFromProps", function (props, state) {
793
- if (has_default()(props, 'value') && props.value !== state.prevValueProp) {
794
- var valNumeric = Number_Number.stringToNumber(state.stringValue, props);
795
- return props.value !== valNumeric ? {
796
- prevValueProp: props.value,
797
- stringValue: Number_Number.numberToString(props.value, props)
798
- } : {
799
- prevValueProp: props.value
367
+ var W = {
368
+ append: i().bool,
369
+ children: i().node,
370
+ defaultValue: i().number,
371
+ describedBy: i().string,
372
+ disabled: i().bool,
373
+ elementRef: i().oneOfType([ i().func, i().object ]),
374
+ inputRef: i().oneOfType([ i().func, i().object ]),
375
+ error: i().bool,
376
+ hideStepButtons: i().bool,
377
+ inline: i().bool,
378
+ inputId: i().string,
379
+ labelledBy: i().string,
380
+ locale: i().string,
381
+ max: i().number,
382
+ min: i().number,
383
+ name: i().string,
384
+ onBlur: i().func,
385
+ onChange: i().func,
386
+ onFocus: i().func,
387
+ onKeyDown: i().func,
388
+ onKeyUp: i().func,
389
+ onSelect: i().func,
390
+ placeholder: i().string,
391
+ prepend: i().bool,
392
+ roundTo: i().number,
393
+ step: i().number,
394
+ /** @private */
395
+ splunkTheme: i().object,
396
+ useSyntheticPlaceholder: i().bool,
397
+ value: i().number
800
398
  };
801
- }
802
-
803
- return null;
804
- });
805
-
806
- var NumberWithTheme = Object(themes_["withSplunkTheme"])(Number_Number);
807
- NumberWithTheme.propTypes = Number_Number.propTypes;
808
- /* harmony default export */ var src_Number_Number = (NumberWithTheme);
809
- // CONCATENATED MODULE: ./src/Number/index.ts
810
-
811
-
812
-
813
- /***/ }),
814
-
815
- /***/ 23:
816
- /***/ (function(module, exports) {
817
-
818
- module.exports = require("lodash/isString");
819
-
820
- /***/ }),
821
-
822
- /***/ 3:
823
- /***/ (function(module, exports) {
824
-
825
- module.exports = require("styled-components");
826
-
827
- /***/ }),
828
-
829
- /***/ 32:
830
- /***/ (function(module, exports) {
831
-
832
- module.exports = require("@splunk/react-ui/Text");
833
-
834
- /***/ }),
835
-
836
- /***/ 34:
837
- /***/ (function(module, exports) {
838
-
839
- module.exports = require("@splunk/react-icons/SVGEnterprise");
840
-
841
- /***/ }),
842
-
843
- /***/ 4:
844
- /***/ (function(module, exports) {
845
-
846
- module.exports = require("@splunk/ui-utils/i18n");
847
-
848
- /***/ }),
849
-
850
- /***/ 5:
851
- /***/ (function(module, exports) {
852
-
853
- module.exports = require("lodash/omit");
854
-
855
- /***/ }),
856
-
857
- /***/ 7:
858
- /***/ (function(module, exports) {
859
-
860
- module.exports = require("@splunk/ui-utils/keyboard");
861
-
862
- /***/ })
863
-
864
- /******/ });
399
+ var Z = {
400
+ append: false,
401
+ disabled: false,
402
+ error: false,
403
+ hideStepButtons: false,
404
+ inline: false,
405
+ locale: "en-US",
406
+ placeholder: "",
407
+ prepend: false,
408
+ roundTo: 5,
409
+ step: 1
410
+ };
411
+ var ee = function(e) {
412
+ X(r, e);
413
+ var t = L(r);
414
+ z(r, null, [ {
415
+ key: "getDecimalSeparator",
416
+ // @docs-props-type NumberPropsBase
417
+ value: function e(t) {
418
+ // A more robust and expandable solution would be to use formatToParts() once IE requirements are dropped.
419
+ var r = new Intl.NumberFormat(t.replace("_", "-")).format(1.2);
420
+ return r.indexOf(",") > -1 ? "," : ".";
421
+ }
422
+ }, {
423
+ key: "validatePrependAppend",
424
+ value: function e(t, r) {
425
+ if (false) {}
426
+ }
427
+ }, {
428
+ key: "stringToNumber",
429
+ value: function e(t, n) {
430
+ var o = t;
431
+ if (!c()(o) || o === "") {
432
+ return undefined;
433
+ }
434
+ if (r.getDecimalSeparator(n.locale) === ".") {
435
+ // remove leading non-numeric characters.
436
+ o = o.replace(/^[^\d.-]/, "");
437
+ } else {
438
+ // remove leading non-numeric characters and replace comma with period
439
+ o = o.replace(/^[^\d,-]/, "").replace(",", ".");
440
+ }
441
+ var i = r.limitValue(parseFloat(o), n);
442
+ if (u()(i)) {
443
+ return i;
444
+ }
445
+ return undefined;
446
+ }
447
+ }, {
448
+ key: "numberToString",
449
+ value: function e(t, n) {
450
+ if (t === undefined || !u()(t)) {
451
+ return "";
452
+ }
453
+ if (r.getDecimalSeparator(n.locale) === ".") {
454
+ return t.toString();
455
+ }
456
+ // comma separated case
457
+ return t.toString().replace(".", ",");
458
+ }
459
+ }, {
460
+ key: "limitValue",
461
+ value: function e(t, r) {
462
+ var n = r.min, o = r.max, i = r.roundTo;
463
+ var a = t;
464
+ if (!u()(t)) {
465
+ return a;
466
+ }
467
+ if (n !== undefined && u()(n)) {
468
+ a = Math.max(n, a);
469
+ }
470
+ if (o !== undefined && u()(o)) {
471
+ a = Math.min(o, a);
472
+ }
473
+ // eslint-disable-next-line no-restricted-properties
474
+ var l = Math.pow(10, i);
475
+ return Math.round(a * l) / l;
476
+ }
477
+ } ]);
478
+ function r(e) {
479
+ var n;
480
+ F(this, r);
481
+ n = t.call(this, e);
482
+ Q(H(n), "controlledExternally", void 0);
483
+ Q(H(n), "text", null);
484
+ Q(H(n), "handleInputBlur", (function(e) {
485
+ var t, r;
486
+ n.updateString();
487
+ (t = (r = n.props).onBlur) === null || t === void 0 ? void 0 : t.call(r, e);
488
+ }));
489
+ Q(H(n), "handleInputChange", (function(e, t) {
490
+ var r = t.value;
491
+ n.setValueFromString(e, r);
492
+ }));
493
+ Q(H(n), "handleKeyDown", (function(e) {
494
+ var t, r;
495
+ if (!e.metaKey && !e.ctrlKey && !e.altKey && (0, m.addsCharacter)(e.nativeEvent) !== false) {
496
+ // only allow numbers, negative and decimals
497
+ if (!(0, m.isNumeric)(e.nativeEvent, {
498
+ locale: n.props.locale
499
+ })) {
500
+ e.preventDefault();
501
+ }
502
+ // if minus is not allowed or there is already one, prevent input
503
+ if ((0, m.isMinus)(e.nativeEvent) && (n.preventNegativeNumbers() || n.state.stringValue.indexOf("-") >= 0)) {
504
+ e.preventDefault();
505
+ }
506
+ // if decimal is not allowed or there is already one, prevent input
507
+ if ((0, m.isDecimal)(e.nativeEvent, {
508
+ locale: n.props.locale
509
+ }) && (n.props.roundTo <= 0 || n.state.stringValue.indexOf(n.props.locale) >= 0)) {
510
+ e.preventDefault();
511
+ }
512
+ }
513
+ // Arrow up and down will increment
514
+ if ((0, m.keycode)(e.nativeEvent) === "up") {
515
+ n.increment(e, n.props.step);
516
+ e.preventDefault();
517
+ } else if ((0, m.keycode)(e.nativeEvent) === "down") {
518
+ n.increment(e, -n.props.step);
519
+ e.preventDefault();
520
+ }
521
+ (t = (r = n.props).onKeyDown) === null || t === void 0 ? void 0 : t.call(r, e);
522
+ }));
523
+ Q(H(n), "handleKeyUp", (function(e) {
524
+ var t, r;
525
+ if ((0, m.keycode)(e.nativeEvent) === "enter") {
526
+ n.updateString();
527
+ }
528
+ (t = (r = n.props).onKeyUp) === null || t === void 0 ? void 0 : t.call(r, e);
529
+ }));
530
+ Q(H(n), "handleIncrement", (function(e) {
531
+ n.increment(e, n.props.step);
532
+ }));
533
+ Q(H(n), "handleDecrement", (function(e) {
534
+ n.increment(e, -n.props.step);
535
+ }));
536
+ n.controlledExternally = l()(e, "value");
537
+ var o = n.isControlled() ? e.value : e.defaultValue;
538
+ n.state = {
539
+ // value stores internal state, only in uncontrolled mode
540
+ value: n.isControlled() ? undefined : o,
541
+ // prevValueProp is used to keep track of changes to the value prop, only in controlled mode
542
+ prevValueProp: n.isControlled() ? o : undefined,
543
+ // eslint-disable-line react/no-unused-state
544
+ // stringValue stores the current contents of the input text box - it might be out of range, invalid, ...
545
+ stringValue: r.numberToString(o, e)
546
+ };
547
+ if (false) {}
548
+ if (l()(e, "useSyntheticPlaceholder")) {
549
+ // eslint-disable-next-line no-console
550
+ console.warn("The 'Number' prop 'useSyntheticPlaceholder' has been marked for deprecation.");
551
+ }
552
+ if (false) {}
553
+ r.validatePrependAppend(n.props.append, n.props.prepend);
554
+ return n;
555
+ }
556
+ z(r, [ {
557
+ key: "componentDidUpdate",
558
+ value: function e(t) {
559
+ if (false) {}
560
+ if (false) {}
561
+ r.validatePrependAppend(this.props.append, this.props.prepend);
562
+ }
563
+ }, {
564
+ key: "getValue",
565
+ value: function e() {
566
+ return this.isControlled() ? this.props.value : this.state.value;
567
+ }
568
+ }, {
569
+ key: "setValueFromString",
570
+ value: function e(t, n) {
571
+ var o = this;
572
+ var i = r.stringToNumber(n, this.props);
573
+ var a = this.props.name;
574
+ this.setState({
575
+ value: this.isControlled() ? undefined : i,
576
+ stringValue: n
577
+ }, (function() {
578
+ if (o.getValue() !== i || !o.isControlled()) {
579
+ var e, r;
580
+ (e = (r = o.props).onChange) === null || e === void 0 ? void 0 : e.call(r, t, {
581
+ value: i,
582
+ name: a
583
+ });
584
+ }
585
+ }));
586
+ }
587
+ }, {
588
+ key: "setValue",
589
+ value: function e(t, n) {
590
+ var o = this;
591
+ var i = this.props.name;
592
+ this.setState({
593
+ value: this.isControlled() ? undefined : n,
594
+ stringValue: r.numberToString(n, this.props)
595
+ }, (function() {
596
+ if (o.getValue() !== n || !o.isControlled()) {
597
+ var e, r;
598
+ (e = (r = o.props).onChange) === null || e === void 0 ? void 0 : e.call(r, t, {
599
+ value: n,
600
+ name: i
601
+ });
602
+ }
603
+ }));
604
+ }
605
+ }, {
606
+ key: "focus",
607
+ /**
608
+ * Place focus on the input.
609
+ */
610
+ value: function e(t) {
611
+ if (this.text) {
612
+ this.text.focus(t);
613
+ }
614
+ }
615
+ }, {
616
+ key: "isControlled",
617
+ value: function e() {
618
+ return this.controlledExternally;
619
+ }
620
+ }, {
621
+ key: "updateString",
622
+ value: function e() {
623
+ var t = this.getValue();
624
+ this.setState({
625
+ stringValue: r.numberToString(t, this.props)
626
+ });
627
+ }
628
+ }, {
629
+ key: "increment",
630
+ value: function e(t, n) {
631
+ var o = r.stringToNumber(this.state.stringValue, this.props);
632
+ var i;
633
+ // increment appropriate number
634
+ if (o !== undefined && u()(o)) {
635
+ // increment the entered value
636
+ i = o + n;
637
+ } else if (this.props.defaultValue !== undefined && u()(this.props.defaultValue)) {
638
+ // increment the defaultValue
639
+ i = this.props.defaultValue + n;
640
+ } else if (n > 0) {
641
+ // increment up to max or step value
642
+ i = this.props.max || this.props.step;
643
+ } else {
644
+ // increment down to min or 0
645
+ i = this.props.min || 0;
646
+ // set to min or 0
647
+ }
648
+ this.setValue(t, r.limitValue(i, this.props));
649
+ }
650
+ }, {
651
+ key: "preventNegativeNumbers",
652
+ value: function e() {
653
+ return this.props.min !== undefined && u()(this.props.min) && this.props.min >= 0;
654
+ }
655
+ }, {
656
+ key: "render",
657
+ value: function e() {
658
+ var t = this;
659
+ var r = this.props, o = r.append, i = r.describedBy, a = r.disabled, l = r.error, s = r.hideStepButtons, p = r.inline, c = r.value, d = c === void 0 ? this.state.value : c, v = r.max, m = r.min, b = r.prepend, y = r.splunkTheme;
660
+ var g = f()(this.props, [ "defaultValue", "hideStepButtons", "max", "min", "roundTo", "spellCheck", "step" ]);
661
+ var S = y.isPrisma;
662
+ var x = S ? {} : {
663
+ append: o,
664
+ prepend: !o,
665
+ error: l,
666
+ inline: false
667
+ };
668
+ var O = d !== undefined && u()(d) && v !== undefined && u()(v) && d >= v;
669
+ var w = d !== undefined && u()(d) && m !== undefined && u()(m) && d <= m;
670
+ var C = n().createElement(k, {
671
+ width: "6px",
672
+ height: "4px",
673
+ screenReaderText: (0, h._)("Increment")
674
+ });
675
+ var j = R({
676
+ "data-test": "increment",
677
+ disabled: a || O,
678
+ onClick: this.handleIncrement,
679
+ tabIndex: -1
680
+ }, x);
681
+ var P = S ? n().createElement(I, j, C) : n().createElement(D, j, C);
682
+ var V = n().createElement(k, {
683
+ width: "6px",
684
+ height: "4px",
685
+ screenReaderText: (0, h._)("Decrement"),
686
+ style: {
687
+ transform: "rotateX(180deg)"
688
+ }
689
+ });
690
+ var E = R({
691
+ "data-test": "decrement",
692
+ disabled: a || w,
693
+ onClick: this.handleDecrement,
694
+ tabIndex: -1
695
+ }, x);
696
+ var B = S ? n().createElement(q, E, V) : n().createElement(N, E, V);
697
+ var K = o && !b;
698
+ var M = (!a || S) && K && !s && n().createElement(_, {
699
+ $isAppend: K
700
+ }, P, B);
701
+ var F = (!a || S) && !K && !s && n().createElement(_, {
702
+ $isAppend: K
703
+ }, P, B);
704
+
705
+ return n().createElement(T, A({
706
+ autoCapitalize: "off",
707
+ autoComplete: "off",
708
+ autoCorrect: "off",
709
+ spellCheck: false,
710
+ "data-test": "number",
711
+ ref: function e(r) {
712
+ t.text = r;
713
+ }
714
+ }, g, {
715
+ inline: p,
716
+ onChange: this.handleInputChange,
717
+ onBlur: this.handleInputBlur,
718
+ onKeyDown: this.handleKeyDown,
719
+ onKeyUp: this.handleKeyUp,
720
+ value: this.state.stringValue,
721
+ "aria-describedby": i,
722
+ error: l,
723
+ "data-test-value": d,
724
+ startAdornment: M,
725
+ endAdornment: F
726
+ }));
727
+ }
728
+ } ]);
729
+ return r;
730
+ }(r.Component);
731
+ Q(ee, "propTypes", W);
732
+ Q(ee, "defaultProps", Z);
733
+ Q(ee, "getDerivedStateFromProps", (function(e, t) {
734
+ if (l()(e, "value") && e.value !== t.prevValueProp) {
735
+ var r = ee.stringToNumber(t.stringValue, e);
736
+ return e.value !== r ? {
737
+ prevValueProp: e.value,
738
+ stringValue: ee.numberToString(e.value, e)
739
+ } : {
740
+ prevValueProp: e.value
741
+ };
742
+ }
743
+ return null;
744
+ }));
745
+ var te = (0, v.withSplunkTheme)(ee);
746
+ te.propTypes = ee.propTypes;
747
+ /* harmony default export */ const re = te;
748
+ // CONCATENATED MODULE: ./src/Number/index.ts
749
+ module.exports = t;
750
+ /******/})();