@splunk/react-ui 4.21.0 → 4.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/Accordion.js +425 -325
  2. package/Anchor.js +147 -117
  3. package/Animation.js +142 -94
  4. package/AnimationToggle.js +197 -193
  5. package/Box.js +145 -118
  6. package/Breadcrumbs.js +288 -206
  7. package/Button.js +488 -465
  8. package/ButtonGroup.js +160 -128
  9. package/ButtonSimple.js +543 -462
  10. package/CHANGELOG.md +24 -3
  11. package/Calendar.js +1111 -1001
  12. package/Card.js +771 -598
  13. package/CardLayout.js +205 -147
  14. package/Chip.js +509 -488
  15. package/Clickable.js +414 -352
  16. package/CloseButton.js +165 -142
  17. package/Code.js +1807 -2084
  18. package/CollapsiblePanel.js +586 -519
  19. package/Color.js +1068 -1068
  20. package/ColumnLayout.js +402 -363
  21. package/ComboBox.js +903 -794
  22. package/Concertina.js +997 -802
  23. package/ControlGroup.js +687 -594
  24. package/Date.js +567 -547
  25. package/DefinitionList.js +308 -234
  26. package/Divider.js +149 -118
  27. package/Dropdown.js +459 -416
  28. package/DualListbox.js +1479 -1541
  29. package/EventListener.js +94 -97
  30. package/File.js +1051 -969
  31. package/FormRows.js +883 -696
  32. package/Heading.js +216 -193
  33. package/Image.js +446 -402
  34. package/JSONTree.js +690 -551
  35. package/Layer.js +437 -410
  36. package/Link.js +336 -255
  37. package/List.js +213 -161
  38. package/Markdown.js +509 -487
  39. package/Menu.js +1104 -1056
  40. package/Message.js +475 -441
  41. package/MessageBar.js +387 -373
  42. package/Modal.js +810 -634
  43. package/ModalLayer.js +326 -243
  44. package/Monogram.js +308 -276
  45. package/Multiselect.js +3564 -3364
  46. package/Number.js +729 -687
  47. package/Paginator.js +510 -449
  48. package/Paragraph.js +145 -112
  49. package/Popover.js +1459 -1432
  50. package/Progress.js +301 -246
  51. package/RadioBar.js +634 -527
  52. package/RadioList.js +483 -444
  53. package/Resize.js +530 -489
  54. package/ResultsMenu.js +479 -455
  55. package/ScreenReaderContent.js +142 -111
  56. package/Scroll.js +595 -456
  57. package/ScrollContainerContext.js +197 -206
  58. package/Search.js +756 -650
  59. package/Select.js +2446 -2345
  60. package/SidePanel.js +390 -284
  61. package/Slider.js +680 -676
  62. package/SlidingPanels.js +639 -503
  63. package/SplitButton.js +464 -367
  64. package/StaticContent.js +161 -133
  65. package/StepBar.js +386 -358
  66. package/Switch.js +710 -640
  67. package/TabBar.js +741 -680
  68. package/TabLayout.js +406 -322
  69. package/Table.js +4974 -4616
  70. package/Text.js +1170 -1138
  71. package/TextArea.js +1102 -1090
  72. package/Tooltip.js +624 -581
  73. package/TransitionOpen.js +489 -422
  74. package/Typography.js +176 -153
  75. package/WaitSpinner.js +230 -206
  76. package/package.json +7 -7
  77. package/types/src/Color/Color.d.ts +0 -1
  78. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  79. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  80. package/types/src/RadioBar/RadioBar.d.ts +1 -0
  81. package/types/src/ResultsMenu/ResultsMenu.d.ts +0 -2
  82. package/types/src/Select/docs/examples/Icons.d.ts +1 -9
  83. package/types/src/Slider/Slider.d.ts +1 -0
  84. package/types/src/TabBar/Tab.d.ts +10 -1
  85. package/types/src/TabBar/TabBar.d.ts +4 -2
  86. package/types/src/Table/Head.d.ts +7 -3
  87. package/types/src/Table/Table.d.ts +3 -2
  88. package/types/src/Table/TableContext.d.ts +2 -0
  89. package/useForceUpdate.js +112 -82
  90. package/useKeyPress.js +74 -71
  91. package/usePrevious.js +65 -65
  92. package/useRovingFocus.js +122 -138
package/Number.js CHANGED
@@ -1,708 +1,750 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/ // The require scope
4
- /******/ var __webpack_require__ = {};
5
- /******/
6
- /************************************************************************/
7
- /******/ /* webpack/runtime/compat get default export */
8
- /******/ (() => {
9
- /******/ // getDefaultExport function for compatibility with non-harmony modules
10
- /******/ __webpack_require__.n = (module) => {
11
- /******/ var getter = module && module.__esModule ?
12
- /******/ () => (module['default']) :
13
- /******/ () => (module);
14
- /******/ __webpack_require__.d(getter, { a: getter });
15
- /******/ return getter;
16
- /******/ };
17
- /******/ })();
18
- /******/
19
- /******/ /* webpack/runtime/define property getters */
20
- /******/ (() => {
21
- /******/ // define getter functions for harmony exports
22
- /******/ __webpack_require__.d = (exports, definition) => {
23
- /******/ for(var key in definition) {
24
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
25
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26
- /******/ }
27
- /******/ }
28
- /******/ };
29
- /******/ })();
30
- /******/
31
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
32
- /******/ (() => {
33
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
34
- /******/ })();
35
- /******/
36
- /******/ /* webpack/runtime/make namespace object */
37
- /******/ (() => {
38
- /******/ // define __esModule on exports
39
- /******/ __webpack_require__.r = (exports) => {
40
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
41
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
42
- /******/ }
43
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
44
- /******/ };
45
- /******/ })();
46
- /******/
47
- /************************************************************************/
48
- var __webpack_exports__ = {};
49
- // ESM COMPAT FLAG
50
- __webpack_require__.r(__webpack_exports__);
51
-
52
- // EXPORTS
53
- __webpack_require__.d(__webpack_exports__, {
54
- "default": () => (/* reexport */ src_Number_Number)
55
- });
56
-
57
- ;// CONCATENATED MODULE: external "react"
58
- const external_react_namespaceObject = require("react");
59
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
60
- ;// CONCATENATED MODULE: external "prop-types"
61
- const external_prop_types_namespaceObject = require("prop-types");
62
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
63
- ;// CONCATENATED MODULE: external "lodash/has"
64
- const has_namespaceObject = require("lodash/has");
65
- var has_default = /*#__PURE__*/__webpack_require__.n(has_namespaceObject);
66
- ;// CONCATENATED MODULE: external "lodash/isFinite"
67
- const isFinite_namespaceObject = require("lodash/isFinite");
68
- var isFinite_default = /*#__PURE__*/__webpack_require__.n(isFinite_namespaceObject);
69
- ;// CONCATENATED MODULE: external "lodash/isString"
70
- const isString_namespaceObject = require("lodash/isString");
71
- var isString_default = /*#__PURE__*/__webpack_require__.n(isString_namespaceObject);
72
- ;// CONCATENATED MODULE: external "lodash/omit"
73
- const omit_namespaceObject = require("lodash/omit");
74
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_namespaceObject);
75
- ;// CONCATENATED MODULE: external "@splunk/themes"
76
- const themes_namespaceObject = require("@splunk/themes");
77
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
78
- const keyboard_namespaceObject = require("@splunk/ui-utils/keyboard");
79
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
80
- const i18n_namespaceObject = require("@splunk/ui-utils/i18n");
81
- ;// CONCATENATED MODULE: external "@splunk/react-icons/SVGEnterprise"
82
- const SVGEnterprise_namespaceObject = require("@splunk/react-icons/SVGEnterprise");
83
- var SVGEnterprise_default = /*#__PURE__*/__webpack_require__.n(SVGEnterprise_namespaceObject);
84
- ;// CONCATENATED MODULE: ./src/Number/IncrementIcon.tsx
85
- 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); }
86
-
87
-
88
-
89
- /* eslint-disable max-len */
90
-
91
- function SortedUp(props) {
92
- return /*#__PURE__*/external_react_default().createElement((SVGEnterprise_default()), _extends({
93
- viewBox: "0 0 933 600"
94
- }, props), /*#__PURE__*/external_react_default().createElement("path", {
95
- fill: "currentColor",
96
- d: "M0 466.438L466.438 0l466.44 467.466-134.59 133.56-331.85-331.848-331.85 331.85L0 466.438z"
97
- }));
98
- }
99
- ;// CONCATENATED MODULE: external "styled-components"
100
- const external_styled_components_namespaceObject = require("styled-components");
101
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
102
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Button"
103
- const Button_namespaceObject = require("@splunk/react-ui/Button");
104
- var Button_default = /*#__PURE__*/__webpack_require__.n(Button_namespaceObject);
105
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
106
- const Clickable_namespaceObject = require("@splunk/react-ui/Clickable");
107
- var Clickable_default = /*#__PURE__*/__webpack_require__.n(Clickable_namespaceObject);
108
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Text"
109
- const Text_namespaceObject = require("@splunk/react-ui/Text");
110
- var Text_default = /*#__PURE__*/__webpack_require__.n(Text_namespaceObject);
111
- ;// CONCATENATED MODULE: ./src/Number/NumberStyles.ts
112
-
113
-
114
-
115
-
116
-
117
- var StyledText = external_styled_components_default()((Text_default())).withConfig({
118
- displayName: "NumberStyles__StyledText",
119
- componentId: "sc-2ekj9s-0"
120
- })(["&[data-inline]{", "}"], (0,themes_namespaceObject.pick)({
121
- enterprise: {
122
- comfortable: (0,external_styled_components_namespaceObject.css)(["width:100px;"]),
123
- compact: (0,external_styled_components_namespaceObject.css)(["width:80px;"])
124
- },
125
- prisma: (0,external_styled_components_namespaceObject.css)(["width:100px;"])
126
- }));
127
- var StyledControls = external_styled_components_default().div.withConfig({
128
- displayName: "NumberStyles__StyledControls",
129
- componentId: "sc-2ekj9s-1"
130
- })(["width:", ";height:100%;", " ", ""], (0,themes_namespaceObject.pick)({
131
- enterprise: {
132
- comfortable: '20px',
133
- compact: '16px'
134
- },
135
- prisma: {
136
- comfortable: '24px',
137
- compact: '24px'
138
- }
139
- }), (0,themes_namespaceObject.pick)({
140
- enterprise: (0,external_styled_components_namespaceObject.css)(["transform:translateY(-1px);"]),
141
- prisma: (0,external_styled_components_namespaceObject.css)(["transform:translateX(1px);"])
142
- }), function (_ref) {
143
- var $isAppend = _ref.$isAppend;
144
- return $isAppend ? (0,external_styled_components_namespaceObject.css)(["margin-right:8px;", ""], (0,themes_namespaceObject.pick)({
145
- prisma: (0,external_styled_components_namespaceObject.css)(["transform:translateX(-1px);"])
146
- })) : (0,external_styled_components_namespaceObject.css)(["margin-left:8px;"]);
147
- });
148
- var incrementor = (0,external_styled_components_namespaceObject.css)(["position:relative;padding:3px;font-size:inherit;min-width:0;min-height:0;height:", ";width:100%;"], (0,themes_namespaceObject.pick)({
149
- enterprise: 'calc(50% + 1.5px)',
150
- prisma: '50%'
151
- }));
152
- var StyledPlusButton = external_styled_components_default()((Button_default())).withConfig({
153
- displayName: "NumberStyles__StyledPlusButton",
154
- componentId: "sc-2ekj9s-2"
155
- })(["", ";top:0;border-bottom-left-radius:0;border-bottom-right-radius:0;", " &:not([disabled]){&,&:hover{", ";}}"], incrementor, function (_ref2) {
156
- var append = _ref2.append;
157
- return append && (0,themes_namespaceObject.pick)({
158
- enterprise: {
159
- light: (0,external_styled_components_namespaceObject.css)(["border-right:1px solid ", ";"], themes_namespaceObject.variables.gray60),
160
- dark: (0,external_styled_components_namespaceObject.css)(["border-right:", ";"], themes_namespaceObject.variables.border)
161
- }
162
- });
163
- }, (0,themes_namespaceObject.pick)({
164
- enterprise: {
165
- dark: (0,external_styled_components_namespaceObject.css)(["border-color:", ";"], themes_namespaceObject.variables.gray20)
166
- }
167
- }));
168
- var StyledMinusButton = external_styled_components_default()((Button_default())).withConfig({
169
- displayName: "NumberStyles__StyledMinusButton",
170
- componentId: "sc-2ekj9s-3"
171
- })(["", ";bottom:1px;border-top-left-radius:0;border-top-right-radius:0;", " &:not([disabled]){&,&:hover{", ";}}"], incrementor, function (_ref3) {
172
- var append = _ref3.append;
173
- return append && (0,themes_namespaceObject.pick)({
174
- enterprise: {
175
- light: (0,external_styled_components_namespaceObject.css)(["border-right:1px solid ", ";"], themes_namespaceObject.variables.gray60),
176
- dark: (0,external_styled_components_namespaceObject.css)(["border-right:", ";"], themes_namespaceObject.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);
177
107
  }
178
- });
179
- }, (0,themes_namespaceObject.pick)({
180
- enterprise: {
181
- dark: (0,external_styled_components_namespaceObject.css)(["border-color:", ";"], themes_namespaceObject.variables.gray20)
182
- }
183
- }));
184
- var prismaButton = external_styled_components_default()((Clickable_default())).withConfig({
185
- displayName: "NumberStyles__prismaButton",
186
- componentId: "sc-2ekj9s-4"
187
- })(["", ";display:flex;align-items:center;justify-content:center;", " &:hover:not([disabled]){", "}&:active:not([disabled]){", "}"], incrementor, (0,themes_namespaceObject.pick)({
188
- prisma: (0,external_styled_components_namespaceObject.css)(["color:", ";"], themes_namespaceObject.variables.contentColorDefault)
189
- }), (0,themes_namespaceObject.pick)({
190
- prisma: (0,external_styled_components_namespaceObject.css)(["background-color:", ";color:", ";"], themes_namespaceObject.variables.interactiveColorOverlayHover, themes_namespaceObject.variables.contentColorActive)
191
- }), (0,themes_namespaceObject.pick)({
192
- prisma: (0,external_styled_components_namespaceObject.css)(["background-color:", ";color:", ";"], themes_namespaceObject.variables.interactiveColorOverlayActive, themes_namespaceObject.variables.contentColorActive)
193
- }));
194
- var StyledPrismaPlusButton = external_styled_components_default()(prismaButton).withConfig({
195
- displayName: "NumberStyles__StyledPrismaPlusButton",
196
- componentId: "sc-2ekj9s-5"
197
- })(["border-top-right-radius:4px;"]);
198
- var StyledPrismaMinusButton = external_styled_components_default()(prismaButton).withConfig({
199
- displayName: "NumberStyles__StyledPrismaMinusButton",
200
- componentId: "sc-2ekj9s-6"
201
- })(["border-bottom-right-radius:4px;padding-bottom:5px;"]);
202
-
203
- ;// CONCATENATED MODULE: ./src/Number/Number.tsx
204
- 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); }
205
-
206
- 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); }
207
-
208
- 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; }
209
-
210
- 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; }
211
-
212
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
213
-
214
- 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); } }
215
-
216
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
217
-
218
- 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); }
219
-
220
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
221
-
222
- 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); }; }
223
-
224
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
225
-
226
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
227
-
228
- 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; } }
229
-
230
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
231
-
232
- 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; }
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
-
243
-
244
-
245
- var propTypes = {
246
- append: (external_prop_types_default()).bool,
247
- children: (external_prop_types_default()).node,
248
- defaultValue: (external_prop_types_default()).number,
249
- describedBy: (external_prop_types_default()).string,
250
- disabled: (external_prop_types_default()).bool,
251
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
252
- inputRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
253
- error: (external_prop_types_default()).bool,
254
- hideStepButtons: (external_prop_types_default()).bool,
255
- inline: (external_prop_types_default()).bool,
256
- inputId: (external_prop_types_default()).string,
257
- labelledBy: (external_prop_types_default()).string,
258
- locale: (external_prop_types_default()).string,
259
- max: (external_prop_types_default()).number,
260
- min: (external_prop_types_default()).number,
261
- name: (external_prop_types_default()).string,
262
- onBlur: (external_prop_types_default()).func,
263
- onChange: (external_prop_types_default()).func,
264
- onFocus: (external_prop_types_default()).func,
265
- onKeyDown: (external_prop_types_default()).func,
266
- onKeyUp: (external_prop_types_default()).func,
267
- onSelect: (external_prop_types_default()).func,
268
- placeholder: (external_prop_types_default()).string,
269
- prepend: (external_prop_types_default()).bool,
270
- roundTo: (external_prop_types_default()).number,
271
- step: (external_prop_types_default()).number,
272
-
273
- /** @private */
274
- splunkTheme: (external_prop_types_default()).object,
275
- useSyntheticPlaceholder: (external_prop_types_default()).bool,
276
- value: (external_prop_types_default()).number
277
- };
278
- var defaultProps = {
279
- append: false,
280
- disabled: false,
281
- error: false,
282
- hideStepButtons: false,
283
- inline: false,
284
- locale: 'en-US',
285
- placeholder: '',
286
- prepend: false,
287
- roundTo: 5,
288
- step: 1
289
- };
290
-
291
- var Number_Number = /*#__PURE__*/function (_Component) {
292
- _inherits(Number, _Component);
293
-
294
- var _super = _createSuper(Number);
295
-
296
- _createClass(Number, null, [{
297
- key: "getDecimalSeparator",
298
- // @docs-props-type NumberPropsBase
299
- value: function getDecimalSeparator(locale) {
300
- // A more robust and expandable solution would be to use formatToParts() once IE requirements are dropped.
301
- var formattedNumber = new Intl.NumberFormat(locale.replace('_', '-')).format(1.2);
302
- 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
+ }));
303
116
  }
304
- }, {
305
- key: "validatePrependAppend",
306
- value: function validatePrependAppend(append, prepend) {
307
- 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);
308
230
  }
309
- }, {
310
- key: "stringToNumber",
311
- value: function stringToNumber(str, props) {
312
- var val = str;
313
-
314
- if (!isString_default()(val) || val === '') {
315
- return undefined;
316
- }
317
-
318
- if (Number.getDecimalSeparator(props.locale) === '.') {
319
- // remove leading non-numeric characters.
320
- val = val.replace(/^[^\d.-]/, '');
321
- } else {
322
- // remove leading non-numeric characters and replace comma with period
323
- val = val.replace(/^[^\d,-]/, '').replace(',', '.');
324
- }
325
-
326
- var valNumeric = Number.limitValue(parseFloat(val), props);
327
-
328
- if (isFinite_default()(valNumeric)) {
329
- return valNumeric;
330
- }
331
-
332
- 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);
333
244
  }
334
- }, {
335
- key: "numberToString",
336
- value: function numberToString(number, props) {
337
- if (number === undefined || !isFinite_default()(number)) {
338
- return '';
339
- }
340
-
341
- if (Number.getDecimalSeparator(props.locale) === '.') {
342
- return number.toString();
343
- } // comma separated case
344
-
345
-
346
- 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;
347
255
  }
348
- }, {
349
- key: "limitValue",
350
- value: function limitValue(val, _ref) {
351
- var min = _ref.min,
352
- max = _ref.max,
353
- roundTo = _ref.roundTo;
354
- var newVal = val;
355
-
356
- if (!isFinite_default()(val)) {
357
- return newVal;
358
- }
359
-
360
- if (min !== undefined && isFinite_default()(min)) {
361
- newVal = Math.max(min, newVal);
362
- }
363
-
364
- if (max !== undefined && isFinite_default()(max)) {
365
- newVal = Math.min(max, newVal);
366
- } // eslint-disable-next-line no-restricted-properties
367
-
368
-
369
- var pow = Math.pow(10, roundTo);
370
- 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;
371
272
  }
372
- }]);
373
-
374
- function Number(props) {
375
- var _this;
376
-
377
- _classCallCheck(this, Number);
378
-
379
- _this = _super.call(this, props);
380
-
381
- _defineProperty(_assertThisInitialized(_this), "controlledExternally", void 0);
382
-
383
- _defineProperty(_assertThisInitialized(_this), "text", null);
384
-
385
- _defineProperty(_assertThisInitialized(_this), "handleInputBlur", function (e) {
386
- var _this$props$onBlur, _this$props;
387
-
388
- _this.updateString();
389
-
390
- (_this$props$onBlur = (_this$props = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props, e);
391
- });
392
-
393
- _defineProperty(_assertThisInitialized(_this), "handleInputChange", function (e, _ref2) {
394
- var value = _ref2.value;
395
-
396
- _this.setValueFromString(e, value);
397
- });
398
-
399
- _defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (e) {
400
- var _this$props$onKeyDown, _this$props2;
401
-
402
- if (!e.metaKey && !e.ctrlKey && !e.altKey && (0,keyboard_namespaceObject.addsCharacter)(e.nativeEvent) !== false) {
403
- // only allow numbers, negative and decimals
404
- if (!(0,keyboard_namespaceObject.isNumeric)(e.nativeEvent, {
405
- locale: _this.props.locale
406
- })) {
407
- e.preventDefault();
408
- } // if minus is not allowed or there is already one, prevent input
409
-
410
-
411
- if ((0,keyboard_namespaceObject.isMinus)(e.nativeEvent) && (_this.preventNegativeNumbers() || _this.state.stringValue.indexOf('-') >= 0)) {
412
- e.preventDefault();
413
- } // if decimal is not allowed or there is already one, prevent input
414
-
415
-
416
- if ((0,keyboard_namespaceObject.isDecimal)(e.nativeEvent, {
417
- locale: _this.props.locale
418
- }) && (_this.props.roundTo <= 0 || _this.state.stringValue.indexOf(_this.props.locale) >= 0)) {
419
- e.preventDefault();
273
+ function F(e, t) {
274
+ if (!(e instanceof t)) {
275
+ throw new TypeError("Cannot call a class as a function");
420
276
  }
421
- } // Arrow up and down will increment
422
-
423
-
424
- if ((0,keyboard_namespaceObject.keycode)(e.nativeEvent) === 'up') {
425
- _this.increment(e, _this.props.step);
426
-
427
- e.preventDefault();
428
- } else if ((0,keyboard_namespaceObject.keycode)(e.nativeEvent) === 'down') {
429
- _this.increment(e, -_this.props.step);
430
-
431
- e.preventDefault();
432
- }
433
-
434
- (_this$props$onKeyDown = (_this$props2 = _this.props).onKeyDown) === null || _this$props$onKeyDown === void 0 ? void 0 : _this$props$onKeyDown.call(_this$props2, e);
435
- });
436
-
437
- _defineProperty(_assertThisInitialized(_this), "handleKeyUp", function (e) {
438
- var _this$props$onKeyUp, _this$props3;
439
-
440
- if ((0,keyboard_namespaceObject.keycode)(e.nativeEvent) === 'enter') {
441
- _this.updateString();
442
- }
443
-
444
- (_this$props$onKeyUp = (_this$props3 = _this.props).onKeyUp) === null || _this$props$onKeyUp === void 0 ? void 0 : _this$props$onKeyUp.call(_this$props3, e);
445
- });
446
-
447
- _defineProperty(_assertThisInitialized(_this), "handleIncrement", function (e) {
448
- _this.increment(e, _this.props.step);
449
- });
450
-
451
- _defineProperty(_assertThisInitialized(_this), "handleDecrement", function (e) {
452
- _this.increment(e, -_this.props.step);
453
- });
454
-
455
- _this.controlledExternally = has_default()(props, 'value');
456
-
457
- var _value = _this.isControlled() ? props.value : props.defaultValue;
458
-
459
- _this.state = {
460
- // value stores internal state, only in uncontrolled mode
461
- value: _this.isControlled() ? undefined : _value,
462
- // prevValueProp is used to keep track of changes to the value prop, only in controlled mode
463
- prevValueProp: _this.isControlled() ? _value : undefined,
464
- // eslint-disable-line react/no-unused-state
465
- // stringValue stores the current contents of the input text box - it might be out of range, invalid, ...
466
- stringValue: Number.numberToString(_value, props)
467
- };
468
-
469
- if (false) {}
470
-
471
- if (has_default()(props, 'useSyntheticPlaceholder')) {
472
- // eslint-disable-next-line no-console
473
- console.warn("The 'Number' prop 'useSyntheticPlaceholder' has been marked for deprecation.");
474
277
  }
475
-
476
- if (false) {}
477
-
478
- Number.validatePrependAppend(_this.props.append, _this.props.prepend);
479
- return _this;
480
- }
481
-
482
- _createClass(Number, [{
483
- key: "componentDidUpdate",
484
- value: function componentDidUpdate(prevProps) {
485
- if (false) {}
486
-
487
- if (false) {}
488
-
489
- 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
+ }
490
286
  }
491
- }, {
492
- key: "getValue",
493
- value: function getValue() {
494
- 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;
495
291
  }
496
- }, {
497
- key: "setValueFromString",
498
- value: function setValueFromString(e, str) {
499
- var _this2 = this;
500
-
501
- var value = Number.stringToNumber(str, this.props);
502
- var name = this.props.name;
503
- this.setState({
504
- value: this.isControlled() ? undefined : value,
505
- stringValue: str
506
- }, function () {
507
- if (_this2.getValue() !== value || !_this2.isControlled()) {
508
- var _this2$props$onChange, _this2$props;
509
-
510
- (_this2$props$onChange = (_this2$props = _this2.props).onChange) === null || _this2$props$onChange === void 0 ? void 0 : _this2$props$onChange.call(_this2$props, e, {
511
- value: value,
512
- name: name
513
- });
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");
514
295
  }
515
- });
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);
516
304
  }
517
- }, {
518
- key: "setValue",
519
- value: function setValue(e, value) {
520
- var _this3 = this;
521
-
522
- var name = this.props.name;
523
- this.setState({
524
- value: this.isControlled() ? undefined : value,
525
- stringValue: Number.numberToString(value, this.props)
526
- }, function () {
527
- if (_this3.getValue() !== value || !_this3.isControlled()) {
528
- var _this3$props$onChange, _this3$props;
529
-
530
- (_this3$props$onChange = (_this3$props = _this3.props).onChange) === null || _this3$props$onChange === void 0 ? void 0 : _this3$props$onChange.call(_this3$props, e, {
531
- value: value,
532
- name: name
533
- });
534
- }
535
- });
305
+ function $(e, t) {
306
+ $ = Object.setPrototypeOf || function e(t, r) {
307
+ t.__proto__ = r;
308
+ return t;
309
+ };
310
+ return $(e, t);
536
311
  }
537
- }, {
538
- key: "focus",
539
-
540
- /**
541
- * Place focus on the input.
542
- */
543
- value: function focus(options) {
544
- if (this.text) {
545
- this.text.focus(options);
546
- }
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
+ };
547
324
  }
548
- }, {
549
- key: "isControlled",
550
- value: function isControlled() {
551
- 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);
552
330
  }
553
- }, {
554
- key: "updateString",
555
- value: function updateString() {
556
- var value = this.getValue();
557
- this.setState({
558
- stringValue: Number.numberToString(value, this.props)
559
- });
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;
560
336
  }
561
- }, {
562
- key: "increment",
563
- value: function increment(e, amount) {
564
- var valNumeric = Number.stringToNumber(this.state.stringValue, this.props);
565
- var targetValNumeric; // increment appropriate number
566
-
567
- if (valNumeric !== undefined && isFinite_default()(valNumeric)) {
568
- // increment the entered value
569
- targetValNumeric = valNumeric + amount;
570
- } else if (this.props.defaultValue !== undefined && isFinite_default()(this.props.defaultValue)) {
571
- // increment the defaultValue
572
- targetValNumeric = this.props.defaultValue + amount;
573
- } else if (amount > 0) {
574
- // increment up to max or step value
575
- targetValNumeric = this.props.max || this.props.step;
576
- } else {
577
- // increment down to min or 0
578
- targetValNumeric = this.props.min || 0; // set to min or 0
579
- }
580
-
581
- 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
+ }
582
347
  }
583
- }, {
584
- key: "preventNegativeNumbers",
585
- value: function preventNegativeNumbers() {
586
- 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);
587
353
  }
588
- }, {
589
- key: "render",
590
- value: function render() {
591
- var _this4 = this;
592
-
593
- var _this$props4 = this.props,
594
- append = _this$props4.append,
595
- describedBy = _this$props4.describedBy,
596
- disabled = _this$props4.disabled,
597
- error = _this$props4.error,
598
- hideStepButtons = _this$props4.hideStepButtons,
599
- inline = _this$props4.inline,
600
- _this$props4$value = _this$props4.value,
601
- value = _this$props4$value === void 0 ? this.state.value : _this$props4$value,
602
- max = _this$props4.max,
603
- min = _this$props4.min,
604
- prepend = _this$props4.prepend,
605
- splunkTheme = _this$props4.splunkTheme;
606
- var textProps = omit_default()(this.props, ['defaultValue', 'hideStepButtons', 'max', 'min', 'roundTo', 'spellCheck', 'step']);
607
- var isPrisma = splunkTheme.isPrisma;
608
- var buttonProps = isPrisma ? {} : {
609
- append: append,
610
- prepend: !append,
611
- error: error,
612
- inline: false
613
- };
614
- var disableIncrement = value !== undefined && isFinite_default()(value) && max !== undefined && isFinite_default()(max) && value >= max;
615
- var disableDecrement = value !== undefined && isFinite_default()(value) && min !== undefined && isFinite_default()(min) && value <= min;
616
- var plusIcon = /*#__PURE__*/external_react_default().createElement(SortedUp, {
617
- width: "6px",
618
- height: "4px",
619
- screenReaderText: (0,i18n_namespaceObject._)('Increment')
620
- });
621
-
622
- var plusProps = _objectSpread({
623
- 'data-test': 'increment',
624
- disabled: disabled || disableIncrement,
625
- onClick: this.handleIncrement,
626
- tabIndex: -1
627
- }, buttonProps);
628
-
629
- var styledPlus = isPrisma ? /*#__PURE__*/external_react_default().createElement(StyledPrismaPlusButton, plusProps, plusIcon) : /*#__PURE__*/external_react_default().createElement(StyledPlusButton, plusProps, plusIcon);
630
- var minusIcon = /*#__PURE__*/external_react_default().createElement(SortedUp, {
631
- width: "6px",
632
- height: "4px",
633
- screenReaderText: (0,i18n_namespaceObject._)('Decrement'),
634
- style: {
635
- transform: 'rotateX(180deg)'
636
- }
637
- });
638
-
639
- var minusProps = _objectSpread({
640
- 'data-test': 'decrement',
641
- disabled: disabled || disableDecrement,
642
- onClick: this.handleDecrement,
643
- tabIndex: -1
644
- }, buttonProps);
645
-
646
- var styledMinus = isPrisma ? /*#__PURE__*/external_react_default().createElement(StyledPrismaMinusButton, minusProps, minusIcon) : /*#__PURE__*/external_react_default().createElement(StyledMinusButton, minusProps, minusIcon);
647
- var isAppend = append && !prepend;
648
- var startAdornment = (!disabled || isPrisma) && isAppend && !hideStepButtons && /*#__PURE__*/external_react_default().createElement(StyledControls, {
649
- $isAppend: isAppend
650
- }, styledPlus, styledMinus);
651
- var endAdornment = (!disabled || isPrisma) && !isAppend && !hideStepButtons && /*#__PURE__*/external_react_default().createElement(StyledControls, {
652
- $isAppend: isAppend
653
- }, styledPlus, styledMinus);
654
- return /*#__PURE__*/external_react_default().createElement(StyledText, Number_extends({
655
- autoCapitalize: "off",
656
- autoComplete: "off",
657
- autoCorrect: "off",
658
- spellCheck: false,
659
- "data-test": "number",
660
- ref: function ref(c) {
661
- _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;
662
364
  }
663
- }, textProps, {
664
- inline: inline,
665
- onChange: this.handleInputChange,
666
- onBlur: this.handleInputBlur,
667
- onKeyDown: this.handleKeyDown,
668
- onKeyUp: this.handleKeyUp,
669
- value: this.state.stringValue,
670
- "aria-describedby": describedBy,
671
- error: error,
672
- "data-test-value": value,
673
- startAdornment: startAdornment,
674
- endAdornment: endAdornment
675
- }));
365
+ return e;
676
366
  }
677
- }]);
678
-
679
- return Number;
680
- }(external_react_namespaceObject.Component);
681
-
682
- _defineProperty(Number_Number, "propTypes", propTypes);
683
-
684
- _defineProperty(Number_Number, "defaultProps", defaultProps);
685
-
686
- _defineProperty(Number_Number, "getDerivedStateFromProps", function (props, state) {
687
- if (has_default()(props, 'value') && props.value !== state.prevValueProp) {
688
- var valNumeric = Number_Number.stringToNumber(state.stringValue, props);
689
- return props.value !== valNumeric ? {
690
- prevValueProp: props.value,
691
- stringValue: Number_Number.numberToString(props.value, props)
692
- } : {
693
- 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
694
398
  };
695
- }
696
-
697
- return null;
698
- });
699
-
700
- var NumberWithTheme = (0,themes_namespaceObject.withSplunkTheme)(Number_Number);
701
- NumberWithTheme.propTypes = Number_Number.propTypes;
702
- /* harmony default export */ const src_Number_Number = (NumberWithTheme);
703
- ;// CONCATENATED MODULE: ./src/Number/index.ts
704
-
705
-
706
- module.exports = __webpack_exports__;
707
- /******/ })()
708
- ;
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
+ /******/})();