@splunk/react-ui 4.21.0 → 4.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion.js +425 -325
- package/Anchor.js +147 -117
- package/Animation.js +142 -94
- package/AnimationToggle.js +197 -193
- package/Box.js +145 -118
- package/Breadcrumbs.js +288 -206
- package/Button.js +488 -465
- package/ButtonGroup.js +160 -128
- package/ButtonSimple.js +543 -462
- package/CHANGELOG.md +24 -3
- package/Calendar.js +1111 -1001
- package/Card.js +771 -598
- package/CardLayout.js +205 -147
- package/Chip.js +509 -488
- package/Clickable.js +414 -352
- package/CloseButton.js +165 -142
- package/Code.js +1807 -2084
- package/CollapsiblePanel.js +586 -519
- package/Color.js +1068 -1068
- package/ColumnLayout.js +402 -363
- package/ComboBox.js +903 -794
- package/Concertina.js +997 -802
- package/ControlGroup.js +687 -594
- package/Date.js +567 -547
- package/DefinitionList.js +308 -234
- package/Divider.js +149 -118
- package/Dropdown.js +459 -416
- package/DualListbox.js +1479 -1541
- package/EventListener.js +94 -97
- package/File.js +1051 -969
- package/FormRows.js +883 -696
- package/Heading.js +216 -193
- package/Image.js +446 -402
- package/JSONTree.js +690 -551
- package/Layer.js +437 -410
- package/Link.js +336 -255
- package/List.js +213 -161
- package/Markdown.js +509 -487
- package/Menu.js +1104 -1056
- package/Message.js +475 -441
- package/MessageBar.js +387 -373
- package/Modal.js +810 -634
- package/ModalLayer.js +326 -243
- package/Monogram.js +308 -276
- package/Multiselect.js +3564 -3364
- package/Number.js +729 -687
- package/Paginator.js +510 -449
- package/Paragraph.js +145 -112
- package/Popover.js +1459 -1432
- package/Progress.js +301 -246
- package/RadioBar.js +634 -527
- package/RadioList.js +483 -444
- package/Resize.js +530 -489
- package/ResultsMenu.js +479 -455
- package/ScreenReaderContent.js +142 -111
- package/Scroll.js +595 -456
- package/ScrollContainerContext.js +197 -206
- package/Search.js +756 -650
- package/Select.js +2446 -2345
- package/SidePanel.js +390 -284
- package/Slider.js +680 -676
- package/SlidingPanels.js +639 -503
- package/SplitButton.js +464 -367
- package/StaticContent.js +161 -133
- package/StepBar.js +386 -358
- package/Switch.js +710 -640
- package/TabBar.js +741 -680
- package/TabLayout.js +406 -322
- package/Table.js +4974 -4616
- package/Text.js +1170 -1138
- package/TextArea.js +1102 -1090
- package/Tooltip.js +624 -581
- package/TransitionOpen.js +489 -422
- package/Typography.js +176 -153
- package/WaitSpinner.js +230 -206
- package/package.json +7 -7
- package/types/src/Color/Color.d.ts +0 -1
- package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
- package/types/src/JSONTree/TreeNode.d.ts +5 -0
- package/types/src/RadioBar/RadioBar.d.ts +1 -0
- package/types/src/ResultsMenu/ResultsMenu.d.ts +0 -2
- package/types/src/Select/docs/examples/Icons.d.ts +1 -9
- package/types/src/Slider/Slider.d.ts +1 -0
- package/types/src/TabBar/Tab.d.ts +10 -1
- package/types/src/TabBar/TabBar.d.ts +4 -2
- package/types/src/Table/Head.d.ts +7 -3
- package/types/src/Table/Table.d.ts +3 -2
- package/types/src/Table/TableContext.d.ts +2 -0
- package/useForceUpdate.js +112 -82
- package/useKeyPress.js +74 -71
- package/usePrevious.js +65 -65
- package/useRovingFocus.js +122 -138
package/Number.js
CHANGED
|
@@ -1,708 +1,750 @@
|
|
|
1
|
-
/******/ (() => {
|
|
2
|
-
|
|
3
|
-
/******/
|
|
4
|
-
/******/
|
|
5
|
-
/******/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/******/
|
|
9
|
-
/******/
|
|
10
|
-
/******/
|
|
11
|
-
/******/
|
|
12
|
-
/******/
|
|
13
|
-
/******/
|
|
14
|
-
/******/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/******/
|
|
20
|
-
/******/
|
|
21
|
-
/******/
|
|
22
|
-
/******/
|
|
23
|
-
/******/
|
|
24
|
-
/******/
|
|
25
|
-
/******/
|
|
26
|
-
/******/
|
|
27
|
-
/******/
|
|
28
|
-
/******/
|
|
29
|
-
/******/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/******/
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/
|
|
37
|
-
/******/
|
|
38
|
-
/******/
|
|
39
|
-
/******/
|
|
40
|
-
/******/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/******/
|
|
44
|
-
/******/
|
|
45
|
-
/******/
|
|
46
|
-
/******/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
-
|
|
306
|
-
|
|
307
|
-
|
|
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
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
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
|
-
|
|
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
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
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
|
-
|
|
493
|
-
|
|
494
|
-
|
|
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
|
-
|
|
498
|
-
|
|
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
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
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
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
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
|
-
|
|
550
|
-
|
|
551
|
-
|
|
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
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
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
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
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
|
-
|
|
585
|
-
|
|
586
|
-
|
|
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
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
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
|
-
|
|
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
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
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
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
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
|
+
/******/})();
|