@splunk/visualizations 26.4.1 → 27.1.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 (153) hide show
  1. package/Area.config.js +1399 -1590
  2. package/Area.config.js.map +7 -1
  3. package/Area.js +3750 -4822
  4. package/Area.js.map +7 -1
  5. package/Bar.config.js +1423 -1566
  6. package/Bar.config.js.map +7 -1
  7. package/Bar.js +3856 -4884
  8. package/Bar.js.map +7 -1
  9. package/Bubble.config.js +1009 -1200
  10. package/Bubble.config.js.map +7 -1
  11. package/Bubble.js +2768 -4491
  12. package/Bubble.js.map +7 -1
  13. package/ChoroplethSvg.config.js +282 -582
  14. package/ChoroplethSvg.config.js.map +7 -1
  15. package/ChoroplethSvg.js +2032 -3808
  16. package/ChoroplethSvg.js.map +7 -1
  17. package/Column.config.js +1390 -1534
  18. package/Column.config.js.map +7 -1
  19. package/Column.js +3849 -4906
  20. package/Column.js.map +7 -1
  21. package/Ellipse.config.js +443 -774
  22. package/Ellipse.config.js.map +7 -1
  23. package/Ellipse.js +1667 -3327
  24. package/Ellipse.js.map +7 -1
  25. package/Events.config.js +207 -492
  26. package/Events.config.js.map +7 -1
  27. package/Events.js +2643 -4647
  28. package/Events.js.map +7 -1
  29. package/FillerGauge.config.js +420 -775
  30. package/FillerGauge.config.js.map +7 -1
  31. package/FillerGauge.js +2164 -4575
  32. package/FillerGauge.js.map +7 -1
  33. package/Image.config.js +144 -411
  34. package/Image.config.js.map +7 -1
  35. package/Image.js +1423 -3046
  36. package/Image.js.map +7 -1
  37. package/Line.config.js +1421 -1616
  38. package/Line.config.js.map +7 -1
  39. package/Line.js +3790 -4901
  40. package/Line.js.map +7 -1
  41. package/LinkGraph.config.js +390 -632
  42. package/LinkGraph.config.js.map +7 -1
  43. package/LinkGraph.js +5272 -6185
  44. package/LinkGraph.js.map +7 -1
  45. package/MIGRATION.md +6 -0
  46. package/Map.config.js +501 -801
  47. package/Map.config.js.map +7 -1
  48. package/Map.js +3382 -5659
  49. package/Map.js.map +7 -1
  50. package/Markdown.config.js +232 -528
  51. package/Markdown.config.js.map +7 -1
  52. package/Markdown.js +1671 -3212
  53. package/Markdown.js.map +7 -1
  54. package/MarkerGauge.config.js +308 -613
  55. package/MarkerGauge.config.js.map +7 -1
  56. package/MarkerGauge.js +2215 -4531
  57. package/MarkerGauge.js.map +7 -1
  58. package/ParallelCoordinates.config.js +282 -581
  59. package/ParallelCoordinates.config.js.map +7 -1
  60. package/ParallelCoordinates.js +2057 -4718
  61. package/ParallelCoordinates.js.map +7 -1
  62. package/Pie.config.js +278 -547
  63. package/Pie.config.js.map +7 -1
  64. package/Pie.js +2107 -3984
  65. package/Pie.js.map +7 -1
  66. package/Punchcard.config.js +291 -578
  67. package/Punchcard.config.js.map +7 -1
  68. package/Punchcard.js +2734 -5037
  69. package/Punchcard.js.map +7 -1
  70. package/Rectangle.config.js +455 -770
  71. package/Rectangle.config.js.map +7 -1
  72. package/Rectangle.js +1664 -3258
  73. package/Rectangle.js.map +7 -1
  74. package/Sankey.config.js +291 -626
  75. package/Sankey.config.js.map +7 -1
  76. package/Sankey.js +2766 -4908
  77. package/Sankey.js.map +7 -1
  78. package/Scatter.config.js +988 -1180
  79. package/Scatter.config.js.map +7 -1
  80. package/Scatter.js +2801 -4506
  81. package/Scatter.js.map +7 -1
  82. package/SingleValue.config.js +794 -1250
  83. package/SingleValue.config.js.map +7 -1
  84. package/SingleValue.js +4185 -7327
  85. package/SingleValue.js.map +7 -1
  86. package/SingleValueBasic.js +382 -1527
  87. package/SingleValueBasic.js.map +7 -1
  88. package/SingleValueIcon.config.js +757 -1207
  89. package/SingleValueIcon.config.js.map +7 -1
  90. package/SingleValueIcon.js +3427 -6293
  91. package/SingleValueIcon.js.map +7 -1
  92. package/SingleValueRadial.config.js +686 -1121
  93. package/SingleValueRadial.config.js.map +7 -1
  94. package/SingleValueRadial.js +3923 -6994
  95. package/SingleValueRadial.js.map +7 -1
  96. package/SparkLine.js +439 -746
  97. package/SparkLine.js.map +7 -1
  98. package/TRELLIS.md +16 -15
  99. package/Table.config.js +565 -879
  100. package/Table.config.js.map +7 -1
  101. package/Table.js +3260 -5334
  102. package/Table.js.map +7 -1
  103. package/common/Charting.js +617 -1498
  104. package/common/Charting.js.map +7 -1
  105. package/common/ChartingApi.js +46 -170
  106. package/common/ChartingApi.js.map +7 -1
  107. package/common/DocExampleWithVizSandbox.js +270 -473
  108. package/common/DocExampleWithVizSandbox.js.map +7 -1
  109. package/common/EventsDoc.js +172 -464
  110. package/common/EventsDoc.js.map +7 -1
  111. package/common/GaugeMajorTicks.js +249 -347
  112. package/common/GaugeMajorTicks.js.map +7 -1
  113. package/common/GaugeValueMarker.js +201 -311
  114. package/common/GaugeValueMarker.js.map +7 -1
  115. package/common/OptionsDoc.js +351 -911
  116. package/common/OptionsDoc.js.map +7 -1
  117. package/common/OverviewDoc.js +435 -769
  118. package/common/OverviewDoc.js.map +7 -1
  119. package/common/SplunkVisualization.js +116 -259
  120. package/common/SplunkVisualization.js.map +7 -1
  121. package/common/SplunkVisualizationApi.js +40 -156
  122. package/common/SplunkVisualizationApi.js.map +7 -1
  123. package/common/ThemesDoc.js +271 -420
  124. package/common/ThemesDoc.js.map +7 -1
  125. package/common/chartingUtils.js +140 -312
  126. package/common/chartingUtils.js.map +7 -1
  127. package/common/docUtils.js +148 -266
  128. package/common/docUtils.js.map +7 -1
  129. package/common/gaugeUtils.js +280 -808
  130. package/common/gaugeUtils.js.map +7 -1
  131. package/common/shapeUtils.js +106 -211
  132. package/common/shapeUtils.js.map +7 -1
  133. package/common/utils/configUtils.js +126 -252
  134. package/common/utils/configUtils.js.map +7 -1
  135. package/common/utils/dataUtils.js +217 -812
  136. package/common/utils/dataUtils.js.map +7 -1
  137. package/common/utils/featureFlagUtils.js +53 -133
  138. package/common/utils/featureFlagUtils.js.map +7 -1
  139. package/common/utils/hocUtils.js +32 -122
  140. package/common/utils/hocUtils.js.map +7 -1
  141. package/common/utils/mapUtils.js +502 -1337
  142. package/common/utils/mapUtils.js.map +7 -1
  143. package/common/utils/singleValueUtils.js +466 -1013
  144. package/common/utils/singleValueUtils.js.map +7 -1
  145. package/common/utils/testHelper.js +92 -146
  146. package/common/utils/testHelper.js.map +7 -1
  147. package/common/utils/trellisUtils.js +277 -489
  148. package/common/utils/trellisUtils.js.map +7 -1
  149. package/common/utils/urlUtils.js +28 -112
  150. package/common/utils/urlUtils.js.map +7 -1
  151. package/common/withDashboardViz.js +1191 -2431
  152. package/common/withDashboardViz.js.map +7 -1
  153. package/package.json +53 -45
package/SparkLine.js CHANGED
@@ -1,480 +1,309 @@
1
- /*!
2
- * Copyright © 2024 Splunk Inc.
3
- * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
- * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
- */
6
- module.exports =
7
- /******/ (function(modules) { // webpackBootstrap
8
- /******/ // The module cache
9
- /******/ var installedModules = {};
10
- /******/
11
- /******/ // The require function
12
- /******/ function __webpack_require__(moduleId) {
13
- /******/
14
- /******/ // Check if module is in cache
15
- /******/ if(installedModules[moduleId]) {
16
- /******/ return installedModules[moduleId].exports;
17
- /******/ }
18
- /******/ // Create a new module (and put it into the cache)
19
- /******/ var module = installedModules[moduleId] = {
20
- /******/ i: moduleId,
21
- /******/ l: false,
22
- /******/ exports: {}
23
- /******/ };
24
- /******/
25
- /******/ // Execute the module function
26
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
27
- /******/
28
- /******/ // Flag the module as loaded
29
- /******/ module.l = true;
30
- /******/
31
- /******/ // Return the exports of the module
32
- /******/ return module.exports;
33
- /******/ }
34
- /******/
35
- /******/
36
- /******/ // expose the modules object (__webpack_modules__)
37
- /******/ __webpack_require__.m = modules;
38
- /******/
39
- /******/ // expose the module cache
40
- /******/ __webpack_require__.c = installedModules;
41
- /******/
42
- /******/ // define getter function for harmony exports
43
- /******/ __webpack_require__.d = function(exports, name, getter) {
44
- /******/ if(!__webpack_require__.o(exports, name)) {
45
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
46
- /******/ }
47
- /******/ };
48
- /******/
49
- /******/ // define __esModule on exports
50
- /******/ __webpack_require__.r = function(exports) {
51
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
52
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
53
- /******/ }
54
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
55
- /******/ };
56
- /******/
57
- /******/ // create a fake namespace object
58
- /******/ // mode & 1: value is a module id, require it
59
- /******/ // mode & 2: merge all properties of value into the ns
60
- /******/ // mode & 4: return value when already ns object
61
- /******/ // mode & 8|1: behave like require
62
- /******/ __webpack_require__.t = function(value, mode) {
63
- /******/ if(mode & 1) value = __webpack_require__(value);
64
- /******/ if(mode & 8) return value;
65
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
66
- /******/ var ns = Object.create(null);
67
- /******/ __webpack_require__.r(ns);
68
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
69
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
70
- /******/ return ns;
71
- /******/ };
72
- /******/
73
- /******/ // getDefaultExport function for compatibility with non-harmony modules
74
- /******/ __webpack_require__.n = function(module) {
75
- /******/ var getter = module && module.__esModule ?
76
- /******/ function getDefault() { return module['default']; } :
77
- /******/ function getModuleExports() { return module; };
78
- /******/ __webpack_require__.d(getter, 'a', getter);
79
- /******/ return getter;
80
- /******/ };
81
- /******/
82
- /******/ // Object.prototype.hasOwnProperty.call
83
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
84
- /******/
85
- /******/ // __webpack_public_path__
86
- /******/ __webpack_require__.p = "";
87
- /******/
88
- /******/
89
- /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 114);
91
- /******/ })
92
- /************************************************************************/
93
- /******/ ({
94
-
95
- /***/ 0:
96
- /***/ (function(module, exports) {
97
-
98
- module.exports = require("prop-types");
99
-
100
- /***/ }),
101
-
102
- /***/ 1:
103
- /***/ (function(module, exports) {
104
-
105
- module.exports = require("react");
106
-
107
- /***/ }),
108
-
109
- /***/ 108:
110
- /***/ (function(module, exports) {
111
-
112
- module.exports = require("@babel/runtime/helpers/assertThisInitialized");
113
-
114
- /***/ }),
115
-
116
- /***/ 114:
117
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
118
-
119
- "use strict";
120
- __webpack_require__.r(__webpack_exports__);
121
- /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(68);
122
- /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
123
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8);
124
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
125
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(24);
126
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__);
127
- /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(108);
128
- /* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__);
129
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(91);
130
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__);
131
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(92);
132
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__);
133
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(82);
134
- /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__);
135
- /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(12);
136
- /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7__);
137
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(0);
138
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_8__);
139
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(1);
140
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_9__);
141
- /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(2);
142
- /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_10__);
143
- /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(4);
144
- /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_11__);
145
- /* harmony import */ var _splunk_react_ui_Popover__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(81);
146
- /* harmony import */ var _splunk_react_ui_Popover__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_splunk_react_ui_Popover__WEBPACK_IMPORTED_MODULE_12__);
147
- /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(3);
148
- /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_13__);
149
- /* harmony import */ var _splunk_ui_utils_id__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(30);
150
- /* harmony import */ var _splunk_ui_utils_id__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_id__WEBPACK_IMPORTED_MODULE_14__);
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
- function _createSuper(Derived) {
161
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
162
-
163
- return function _createSuperInternal() {
164
- var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(Derived),
165
- result;
166
-
167
- if (hasNativeReflectConstruct) {
168
- var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(this).constructor;
169
-
170
- result = Reflect.construct(Super, arguments, NewTarget);
171
- } else {
172
- result = Super.apply(this, arguments);
1
+ /* Copyright © 2020 Splunk Inc.
2
+ SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
3
+ in part without a valid written license from Splunk Inc. is PROHIBITED. */
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
173
21
  }
174
-
175
- return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default()(this, result);
176
- };
177
- }
178
-
179
- function _isNativeReflectConstruct() {
180
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
181
- if (Reflect.construct.sham) return false;
182
- if (typeof Proxy === "function") return true;
183
-
184
- try {
185
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
186
- return true;
187
- } catch (e) {
188
- return false;
22
+ return a;
23
+ };
24
+ var __export = (target, all) => {
25
+ for (var name in all)
26
+ __defProp(target, name, { get: all[name], enumerable: true });
27
+ };
28
+ var __copyProps = (to, from, except, desc) => {
29
+ if (from && typeof from === "object" || typeof from === "function") {
30
+ for (let key of __getOwnPropNames(from))
31
+ if (!__hasOwnProp.call(to, key) && key !== except)
32
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
189
33
  }
190
- }
191
-
192
-
193
-
194
-
195
-
196
-
197
-
198
-
199
- var StyledSvg = styled_components__WEBPACK_IMPORTED_MODULE_11___default.a.svg.withConfig({
200
- displayName: "SparkLine__StyledSvg",
201
- componentId: "sc-5oplra-0"
202
- })(["overflow:hidden;"]);
203
- var StyledTooltip = styled_components__WEBPACK_IMPORTED_MODULE_11___default.a.div.withConfig({
204
- displayName: "SparkLine__StyledTooltip",
205
- componentId: "sc-5oplra-1"
206
- })(["padding:3px 8px;font-size:12px;"]);
207
-
208
- var SparkLine = /*#__PURE__*/function (_Component) {
209
- _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default()(SparkLine, _Component);
210
-
211
- var _super = _createSuper(SparkLine);
212
-
213
- function SparkLine(props) {
214
- var _this;
215
-
216
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, SparkLine);
217
-
218
- for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
219
- rest[_key - 1] = arguments[_key];
220
- }
221
-
222
- _this = _super.call.apply(_super, [this, props].concat(rest));
34
+ return to;
35
+ };
36
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
37
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
38
+ // If the importer is in node compatibility mode or this is not an ESM
39
+ // file that has been converted to a CommonJS file using a Babel-
40
+ // compatible transform (i.e. "__esModule" has not been set), then set
41
+ // "default" to the CommonJS "module.exports" for node compatibility.
42
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
43
+ mod
44
+ ));
45
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
47
+
48
+ // src/SparkLine/SparkLine.jsx
49
+ var SparkLine_exports = {};
50
+ __export(SparkLine_exports, {
51
+ default: () => SparkLine_default
52
+ });
53
+ module.exports = __toCommonJS(SparkLine_exports);
223
54
 
224
- _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(_this), "handleCursorMount", function (el) {
225
- _this.setState({
55
+ // esm-externals:prop-types
56
+ var prop_types_exports = {};
57
+ __export(prop_types_exports, {
58
+ default: () => prop_types_default
59
+ });
60
+ var defaultImport = __toESM(require("prop-types"));
61
+ __reExport(prop_types_exports, require("prop-types"));
62
+ var prop_types_default = "default" in defaultImport ? defaultImport.default : defaultImport;
63
+
64
+ // esm-externals:react
65
+ var react_exports = {};
66
+ __export(react_exports, {
67
+ default: () => react_default
68
+ });
69
+ var defaultImport2 = __toESM(require("react"));
70
+ __reExport(react_exports, require("react"));
71
+ var react_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
72
+
73
+ // esm-externals:lodash
74
+ var lodash_exports = {};
75
+ __export(lodash_exports, {
76
+ default: () => lodash_default
77
+ });
78
+ var defaultImport3 = __toESM(require("lodash"));
79
+ __reExport(lodash_exports, require("lodash"));
80
+ var lodash_default = "default" in defaultImport3 ? defaultImport3.default : defaultImport3;
81
+
82
+ // esm-externals:styled-components
83
+ var styled_components_exports = {};
84
+ __export(styled_components_exports, {
85
+ default: () => styled_components_default
86
+ });
87
+ var defaultImport4 = __toESM(require("styled-components"));
88
+ __reExport(styled_components_exports, require("styled-components"));
89
+ var styled_components_default = "default" in defaultImport4 ? defaultImport4.default : defaultImport4;
90
+
91
+ // esm-externals:@splunk/react-ui/Popover
92
+ var Popover_exports = {};
93
+ __export(Popover_exports, {
94
+ default: () => Popover_default
95
+ });
96
+ var defaultImport5 = __toESM(require("@splunk/react-ui/Popover"));
97
+ __reExport(Popover_exports, require("@splunk/react-ui/Popover"));
98
+ var Popover_default = "default" in defaultImport5 ? defaultImport5.default : defaultImport5;
99
+
100
+ // esm-externals:@splunk/ui-utils/i18n
101
+ var i18n_exports = {};
102
+ __export(i18n_exports, {
103
+ default: () => i18n_default
104
+ });
105
+ var defaultImport6 = __toESM(require("@splunk/ui-utils/i18n"));
106
+ __reExport(i18n_exports, require("@splunk/ui-utils/i18n"));
107
+ var i18n_default = "default" in defaultImport6 ? defaultImport6.default : defaultImport6;
108
+
109
+ // esm-externals:@splunk/ui-utils/id
110
+ var id_exports = {};
111
+ __export(id_exports, {
112
+ default: () => id_default
113
+ });
114
+ var defaultImport7 = __toESM(require("@splunk/ui-utils/id"));
115
+ __reExport(id_exports, require("@splunk/ui-utils/id"));
116
+ var id_default = "default" in defaultImport7 ? defaultImport7.default : defaultImport7;
117
+
118
+ // src/SparkLine/SparkLine.jsx
119
+ var StyledSvg = styled_components_default.svg`
120
+ /* For fixing IE11 shows overflow part line issue */
121
+ overflow: hidden;
122
+ `;
123
+ var StyledTooltip = styled_components_default.div`
124
+ padding: 3px 8px;
125
+ font-size: 12px;
126
+ `;
127
+ var _SparkLine = class _SparkLine extends react_exports.Component {
128
+ constructor(props, ...rest) {
129
+ super(props, ...rest);
130
+ __publicField(this, "handleCursorMount", (el) => {
131
+ this.setState({
226
132
  anchor: el
227
133
  });
228
134
  });
229
-
230
- _this.state = {
135
+ this.state = {
231
136
  anchor: null,
232
137
  currentPointX: null,
233
138
  open: false,
234
139
  rectArea: null,
235
140
  tooltip: null
236
141
  };
237
- _this.titleId = Object(_splunk_ui_utils_id__WEBPACK_IMPORTED_MODULE_14__["createDOMID"])();
238
- return _this;
142
+ this.titleId = (0, id_exports.createDOMID)();
239
143
  }
240
-
241
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(SparkLine, [{
242
- key: "getMax",
243
- value: function getMax() {
244
- var _this2 = this;
245
-
246
- var _this$props = this.props,
247
- data = _this$props.data,
248
- acceptNull = _this$props.acceptNull,
249
- yMax = _this$props.yMax;
250
-
251
- var dataMax = function dataMax() {
252
- return acceptNull ? Object(lodash__WEBPACK_IMPORTED_MODULE_10__["max"])(_this2.fillNull(data)) : Object(lodash__WEBPACK_IMPORTED_MODULE_10__["max"])(data);
253
- };
254
-
255
- return yMax !== undefined ? yMax : dataMax();
256
- }
257
- }, {
258
- key: "getMin",
259
- value: function getMin() {
260
- var _this3 = this;
261
-
262
- var _this$props2 = this.props,
263
- data = _this$props2.data,
264
- acceptNull = _this$props2.acceptNull,
265
- yMin = _this$props2.yMin;
266
-
267
- var dataMin = function dataMin() {
268
- return acceptNull ? Object(lodash__WEBPACK_IMPORTED_MODULE_10__["min"])(_this3.fillNull(data)) : Object(lodash__WEBPACK_IMPORTED_MODULE_10__["min"])(data);
269
- };
270
-
271
- return yMin !== undefined ? yMin : dataMin();
272
- }
273
- /**
274
- * Gets unit value of x axis.
275
- * @param {Number} xMargin - margin of x axis.
276
- * @return {Number} unit value of x axis.
277
- * @private
278
- */
279
-
280
- }, {
281
- key: "getXUnit",
282
- value: function getXUnit(xMargin) {
283
- var _this$props3 = this.props,
284
- data = _this$props3.data,
285
- width = _this$props3.width; // Calculate xUnit. Width substract the left margin and right margin, then divide by data length.
286
-
287
- var xUnit = (width - xMargin * 2) / (data.length > 1 ? data.length - 1 : 1);
288
- return Math.max(0, xUnit);
289
- }
290
- /**
291
- * Gets unit value of y axis.
292
- * @param {String} yMargin - margin of y axis.
293
- * @return {Number} unit value of y axis.
294
- * @private
295
- */
296
-
297
- }, {
298
- key: "getYUnit",
299
- value: function getYUnit(yMargin) {
300
- var height = this.props.height;
301
- var maxValue = this.getMax();
302
- var minValue = this.getMin(); // Calculate yUnit. Height substract the upper margin and bottom margin, then divide by value range of values in data.
303
- // if the maxValue equals minValue, means all values in data are the same, then, we need to set the YUnit at the mid value of Height.
304
- // So, draws sparkline right in the mid of the container.
305
-
306
- var yUnit = (height - yMargin * 2) / (maxValue - minValue || 2);
307
- return Math.max(0, yUnit);
308
- }
309
- /**
310
- * Get a list of arrays of points for drawing lines, based on acceptNull property
311
- * @method getSegmentSets
312
- * @param {Array} data
313
- * @param {Array} points
314
- * @returns {Array} List of datapoint sets used for drawing lines
315
- */
316
-
317
- }, {
318
- key: "getSegmentSets",
319
- value: function getSegmentSets(data, points) {
320
- var acceptNull = this.props.acceptNull;
321
- var lines = [];
322
- var currentLine = [];
323
- data.forEach(function (p, idx) {
324
- // Found null data
325
- if (!acceptNull && Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isNull"])(p)) {
326
- // need at least 2 points to draw a segment
327
- if (currentLine.length > 1) {
328
- lines.push(currentLine);
329
- } // reset for the next segment
330
-
331
-
332
- currentLine = [];
333
- } else {
334
- // data is good, add point data
335
- currentLine.push(points[idx]);
144
+ getMax() {
145
+ const { data, acceptNull, yMax } = this.props;
146
+ const dataMax = () => acceptNull ? (0, lodash_exports.max)(this.fillNull(data)) : (0, lodash_exports.max)(data);
147
+ return yMax !== void 0 ? yMax : dataMax();
148
+ }
149
+ getMin() {
150
+ const { data, acceptNull, yMin } = this.props;
151
+ const dataMin = () => acceptNull ? (0, lodash_exports.min)(this.fillNull(data)) : (0, lodash_exports.min)(data);
152
+ return yMin !== void 0 ? yMin : dataMin();
153
+ }
154
+ /**
155
+ * Gets unit value of x axis.
156
+ * @param {Number} xMargin - margin of x axis.
157
+ * @return {Number} unit value of x axis.
158
+ * @private
159
+ */
160
+ getXUnit(xMargin) {
161
+ const { data, width } = this.props;
162
+ const xUnit = (width - xMargin * 2) / (data.length > 1 ? data.length - 1 : 1);
163
+ return Math.max(0, xUnit);
164
+ }
165
+ /**
166
+ * Gets unit value of y axis.
167
+ * @param {String} yMargin - margin of y axis.
168
+ * @return {Number} unit value of y axis.
169
+ * @private
170
+ */
171
+ getYUnit(yMargin) {
172
+ const { height } = this.props;
173
+ const maxValue = this.getMax();
174
+ const minValue = this.getMin();
175
+ const yUnit = (height - yMargin * 2) / (maxValue - minValue || 2);
176
+ return Math.max(0, yUnit);
177
+ }
178
+ /**
179
+ * Get a list of arrays of points for drawing lines, based on acceptNull property
180
+ * @method getSegmentSets
181
+ * @param {Array} data
182
+ * @param {Array} points
183
+ * @returns {Array} List of datapoint sets used for drawing lines
184
+ */
185
+ getSegmentSets(data, points) {
186
+ const { acceptNull } = this.props;
187
+ const lines = [];
188
+ let currentLine = [];
189
+ data.forEach((p, idx) => {
190
+ if (!acceptNull && (0, lodash_exports.isNull)(p)) {
191
+ if (currentLine.length > 1) {
192
+ lines.push(currentLine);
336
193
  }
337
- }); // Add the last line
338
-
339
- if (currentLine.length > 1) {
340
- lines.push(currentLine);
194
+ currentLine = [];
195
+ } else {
196
+ currentLine.push(points[idx]);
341
197
  }
342
-
343
- return lines;
344
- }
345
- }, {
346
- key: "fillNull",
347
- value:
348
- /**
349
- * Utility for fill null value with number 0.
350
- * @private
351
- */
352
- function fillNull() {
353
- var data = this.props.data;
354
- return data.map(function (value) {
355
- return value === null ? 0 : value;
356
- });
357
- }
358
- /**
359
- * Converts data to points in svg
360
- * @param {Number} xMargin - margin of x axis.
361
- * @param {Number} yMargin - margin of x axis.
362
- * @return {Array} points coordination.
363
- * @private
364
- */
365
-
366
- }, {
367
- key: "dataToPoints",
368
- value: function dataToPoints(xMargin, yMargin) {
369
- var data = this.props.data;
370
- var xUnit = this.getXUnit(xMargin);
371
- var yUnit = this.getYUnit(yMargin);
372
- var maxValue = this.getMax();
373
- var minValue = this.getMin();
374
- return data.map(function (val, idx) {
375
- return {
376
- x: idx * xUnit + xMargin,
377
- y: maxValue === minValue ? yUnit + yMargin : (maxValue - val) * yUnit + yMargin
378
- };
379
- }).map(function (p) {
380
- return [p.x, p.y];
381
- });
198
+ });
199
+ if (currentLine.length > 1) {
200
+ lines.push(currentLine);
382
201
  }
383
- /**
384
- * Renders rect area for helping figure out which is the nearest point so that
385
- * render related cursor and tooltip.
386
- * @param {Array} points - array of points coordination.
387
- * @param {Number} xMargin - margin of x axis.
388
- * @return {Array} array of svg rect objects
389
- * @private
390
- */
391
-
392
- }, {
393
- key: "renderRect",
394
- value: function renderRect(points, xMargin) {
395
- var _this4 = this;
396
-
397
- var _this$props4 = this.props,
398
- data = _this$props4.data,
399
- height = _this$props4.height;
400
- var xUnit = this.getXUnit(xMargin);
401
- return points.map(function (p, i) {
402
- return (
403
- /*#__PURE__*/
404
-
405
- /* eslint-disable react/no-array-index-key */
406
- react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("rect", {
407
- // eslint-disable-line jsx-a11y/mouse-events-have-key-events
408
- key: "".concat(i, "_").concat(p[0]),
409
- "data-test": "rect-".concat(i),
410
- x: p[0] - xUnit / 2 <= 0 ? 0 : p[0] - xUnit / 2,
411
- y: 0,
412
- width: i === 0 && data.length !== 1 ? xUnit / 2 : xUnit,
413
- height: height,
414
- style: {
415
- fillOpacity: 0
416
- },
417
- onMouseOver: function onMouseOver(e) {
418
- _this4.setState({
419
- open: data[i] !== null,
420
- rectArea: data[i] === null ? null : e.target,
421
- tooltip: data[i],
422
- currentPointX: p[0]
423
- });
424
- }
425
- })
426
- /* eslint-enable react/no-array-index-key */
427
-
428
- );
429
- });
430
- } // Renders area chart
431
-
432
- }, {
433
- key: "renderArea",
434
- value: function renderArea(points) {
435
- var _this$props5 = this.props,
436
- data = _this$props5.data,
437
- fillColor = _this$props5.fillColor,
438
- fillOpacity = _this$props5.fillOpacity,
439
- height = _this$props5.height,
440
- isArea = _this$props5.isArea;
441
-
442
- if (!isArea || points.length === 0) {
443
- return null;
444
- }
445
-
446
- var segments = this.getSegmentSets(data, points);
447
- segments = segments.map(function (s) {
448
- return s.concat([[s[s.length - 1][0], height], // down to bottom of graph
449
- [s[0][0], height], // over to below first data point
450
- s[0] // up to first data point to close the box
451
- ]);
452
- });
453
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", {
454
- "data-test": "area"
455
- }, segments.map(function (s) {
456
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("polyline", {
457
- key: "area".concat(s.join('')),
458
- points: s.join(' '),
459
- "data-test": "area-line",
460
- style: {
461
- fill: fillColor,
462
- fillOpacity: fillOpacity,
463
- strokeWidth: '0'
202
+ return lines;
203
+ }
204
+ /**
205
+ * Utility for fill null value with number 0.
206
+ * @private
207
+ */
208
+ fillNull() {
209
+ const { data } = this.props;
210
+ return data.map((value) => value === null ? 0 : value);
211
+ }
212
+ /**
213
+ * Converts data to points in svg
214
+ * @param {Number} xMargin - margin of x axis.
215
+ * @param {Number} yMargin - margin of x axis.
216
+ * @return {Array} points coordination.
217
+ * @private
218
+ */
219
+ dataToPoints(xMargin, yMargin) {
220
+ const { data } = this.props;
221
+ const xUnit = this.getXUnit(xMargin);
222
+ const yUnit = this.getYUnit(yMargin);
223
+ const maxValue = this.getMax();
224
+ const minValue = this.getMin();
225
+ return data.map((val, idx) => ({
226
+ x: idx * xUnit + xMargin,
227
+ y: maxValue === minValue ? yUnit + yMargin : (maxValue - val) * yUnit + yMargin
228
+ })).map((p) => [p.x, p.y]);
229
+ }
230
+ /**
231
+ * Renders rect area for helping figure out which is the nearest point so that
232
+ * render related cursor and tooltip.
233
+ * @param {Array} points - array of points coordination.
234
+ * @param {Number} xMargin - margin of x axis.
235
+ * @return {Array} array of svg rect objects
236
+ * @private
237
+ */
238
+ renderRect(points, xMargin) {
239
+ const { data, height } = this.props;
240
+ const xUnit = this.getXUnit(xMargin);
241
+ return points.map((p, i) => (
242
+ /* eslint-disable react/no-array-index-key */
243
+ /* @__PURE__ */ react_default.createElement(
244
+ "rect",
245
+ {
246
+ key: `${i}_${p[0]}`,
247
+ "data-test": `rect-${i}`,
248
+ x: p[0] - xUnit / 2 <= 0 ? 0 : p[0] - xUnit / 2,
249
+ y: 0,
250
+ width: i === 0 && data.length !== 1 ? xUnit / 2 : xUnit,
251
+ height,
252
+ style: { fillOpacity: 0 },
253
+ onMouseOver: (e) => {
254
+ this.setState({
255
+ open: data[i] !== null,
256
+ rectArea: data[i] === null ? null : e.target,
257
+ tooltip: data[i],
258
+ currentPointX: p[0]
259
+ });
464
260
  }
465
- });
466
- }));
261
+ }
262
+ )
263
+ ));
264
+ }
265
+ // Renders area chart
266
+ renderArea(points) {
267
+ const { data, fillColor, fillOpacity, height, isArea } = this.props;
268
+ if (!isArea || points.length === 0) {
269
+ return null;
467
270
  }
468
- }, {
469
- key: "renderCursor",
470
- value: function renderCursor() {
471
- var _this$props6 = this.props,
472
- cursorStroke = _this$props6.cursorStroke,
473
- cursorStrokeWidth = _this$props6.cursorStrokeWidth,
474
- cursorStrokeLinecap = _this$props6.cursorStrokeLinecap,
475
- cursorStrokeDasharray = _this$props6.cursorStrokeDasharray,
476
- height = _this$props6.height;
477
- return this.state.rectArea !== null && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("line", {
271
+ let segments = this.getSegmentSets(data, points);
272
+ segments = segments.map(
273
+ (s) => s.concat([
274
+ [s[s.length - 1][0], height],
275
+ // down to bottom of graph
276
+ [s[0][0], height],
277
+ // over to below first data point
278
+ s[0]
279
+ // up to first data point to close the box
280
+ ])
281
+ );
282
+ return /* @__PURE__ */ react_default.createElement("g", { "data-test": "area" }, segments.map((s) => /* @__PURE__ */ react_default.createElement(
283
+ "polyline",
284
+ {
285
+ key: `area${s.join("")}`,
286
+ points: s.join(" "),
287
+ "data-test": "area-line",
288
+ style: {
289
+ fill: fillColor,
290
+ fillOpacity,
291
+ strokeWidth: "0"
292
+ }
293
+ }
294
+ )));
295
+ }
296
+ renderCursor() {
297
+ const {
298
+ cursorStroke,
299
+ cursorStrokeWidth,
300
+ cursorStrokeLinecap,
301
+ cursorStrokeDasharray,
302
+ height
303
+ } = this.props;
304
+ return this.state.rectArea !== null && /* @__PURE__ */ react_default.createElement(
305
+ "line",
306
+ {
478
307
  "data-test": "cursor",
479
308
  ref: this.handleCursorMount,
480
309
  x1: this.state.currentPointX,
@@ -487,12 +316,13 @@ var SparkLine = /*#__PURE__*/function (_Component) {
487
316
  strokeLinecap: cursorStrokeLinecap,
488
317
  strokeDasharray: cursorStrokeDasharray
489
318
  }
490
- });
491
- }
492
- }, {
493
- key: "renderTooltip",
494
- value: function renderTooltip() {
495
- return this.state.anchor !== null && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(_splunk_react_ui_Popover__WEBPACK_IMPORTED_MODULE_12___default.a, {
319
+ }
320
+ );
321
+ }
322
+ renderTooltip() {
323
+ return this.state.anchor !== null && /* @__PURE__ */ react_default.createElement(
324
+ Popover_default,
325
+ {
496
326
  "data-test": "tooltip",
497
327
  open: this.state.open,
498
328
  anchor: this.state.anchor,
@@ -500,109 +330,92 @@ var SparkLine = /*#__PURE__*/function (_Component) {
500
330
  appearance: "inverted",
501
331
  defaultPlacement: "above",
502
332
  animation: false
503
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(StyledTooltip, null, this.state.anchor !== null ? this.state.tooltip : undefined));
504
- }
505
- /**
506
- * Renders one or more svg circles to highlight values on the sparkline
507
- * @method renderEndDots
508
- * @param {Array[Array[Number]]} points // x,y coordinates of values
509
- * @param {Number} dotsToShow // number of end dots to display
510
- * @param {Number} xMargin // used when calculating the dot radius
511
- * @returns {Object} React representation of SVG group
512
- * @private
513
- */
514
-
515
- }, {
516
- key: "renderEndDots",
517
- value: function renderEndDots(points, dotsToShow, xMargin) {
518
- var _this$props7 = this.props,
519
- endDotFillColor = _this$props7.endDotFillColor,
520
- endDotRadius = _this$props7.endDotRadius,
521
- endDotStroke = _this$props7.endDotStroke,
522
- endDotStrokeWidth = _this$props7.endDotStrokeWidth;
523
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", null, points.slice(-dotsToShow).map(function (point) {
524
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("circle", {
525
- key: "end-dot".concat(point[0]).concat(point[1]),
526
- "data-test": "end-dot",
527
- cx: point[0],
528
- cy: point[1],
529
- r: endDotRadius === 0 ? xMargin : endDotRadius,
530
- style: {
531
- fill: endDotFillColor,
532
- stroke: endDotStroke,
533
- strokeWidth: endDotStrokeWidth
534
- }
535
- });
536
- }));
537
- }
538
- /**
539
- * Renders the line(s) above the area graph
540
- * @method renderPolyline
541
- * @param {Array} points
542
- * @returns {Object} SVG Group of polylines
543
- */
544
-
545
- }, {
546
- key: "renderPolyline",
547
- value: function renderPolyline(points) {
548
- var _this$props8 = this.props,
549
- data = _this$props8.data,
550
- lineColor = _this$props8.lineColor,
551
- lineLength = _this$props8.lineLength,
552
- lineStrokeWidth = _this$props8.lineStrokeWidth;
553
- var linePoints = Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(lineLength) && lineLength > 0 ? lineLength : points.length;
554
- var lines = this.getSegmentSets(data.slice(-linePoints), points.slice(-linePoints));
555
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", {
556
- "data-test": "sparkline"
557
- }, lines.map(function (lineData) {
558
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("polyline", {
559
- key: "line".concat(lineData.join('')),
560
- "data-test": "polyline",
561
- style: {
562
- fill: 'none',
563
- stroke: lineColor,
564
- strokeWidth: lineStrokeWidth,
565
- strokeLinejoin: 'round',
566
- strokeLinecap: 'round'
567
- },
568
- points: lineData.join(' ')
569
- });
570
- }));
333
+ },
334
+ /* @__PURE__ */ react_default.createElement(StyledTooltip, null, this.state.anchor !== null ? this.state.tooltip : void 0)
335
+ );
336
+ }
337
+ /**
338
+ * Renders one or more svg circles to highlight values on the sparkline
339
+ * @method renderEndDots
340
+ * @param {Array[Array[Number]]} points // x,y coordinates of values
341
+ * @param {Number} dotsToShow // number of end dots to display
342
+ * @param {Number} xMargin // used when calculating the dot radius
343
+ * @returns {Object} React representation of SVG group
344
+ * @private
345
+ */
346
+ renderEndDots(points, dotsToShow, xMargin) {
347
+ const { endDotFillColor, endDotRadius, endDotStroke, endDotStrokeWidth } = this.props;
348
+ return /* @__PURE__ */ react_default.createElement("g", null, points.slice(-dotsToShow).map((point) => /* @__PURE__ */ react_default.createElement(
349
+ "circle",
350
+ {
351
+ key: `end-dot${point[0]}${point[1]}`,
352
+ "data-test": "end-dot",
353
+ cx: point[0],
354
+ cy: point[1],
355
+ r: endDotRadius === 0 ? xMargin : endDotRadius,
356
+ style: {
357
+ fill: endDotFillColor,
358
+ stroke: endDotStroke,
359
+ strokeWidth: endDotStrokeWidth
360
+ }
361
+ }
362
+ )));
363
+ }
364
+ /**
365
+ * Renders the line(s) above the area graph
366
+ * @method renderPolyline
367
+ * @param {Array} points
368
+ * @returns {Object} SVG Group of polylines
369
+ */
370
+ renderPolyline(points) {
371
+ const { data, lineColor, lineLength, lineStrokeWidth } = this.props;
372
+ const linePoints = (0, lodash_exports.isFinite)(lineLength) && lineLength > 0 ? lineLength : points.length;
373
+ const lines = this.getSegmentSets(data.slice(-linePoints), points.slice(-linePoints));
374
+ return /* @__PURE__ */ react_default.createElement("g", { "data-test": "sparkline" }, lines.map((lineData) => /* @__PURE__ */ react_default.createElement(
375
+ "polyline",
376
+ {
377
+ key: `line${lineData.join("")}`,
378
+ "data-test": "polyline",
379
+ style: {
380
+ fill: "none",
381
+ stroke: lineColor,
382
+ strokeWidth: lineStrokeWidth,
383
+ strokeLinejoin: "round",
384
+ strokeLinecap: "round"
385
+ },
386
+ points: lineData.join(" ")
387
+ }
388
+ )));
389
+ }
390
+ render() {
391
+ const {
392
+ data,
393
+ elementRef,
394
+ showTooltip,
395
+ showEndDot,
396
+ endDotRadius,
397
+ endDotStrokeWidth,
398
+ endDotCount,
399
+ height,
400
+ isArea,
401
+ lineStrokeWidth,
402
+ width,
403
+ title
404
+ } = this.props;
405
+ if (data.length === 0) {
406
+ return null;
571
407
  }
572
- }, {
573
- key: "render",
574
- value: function render() {
575
- var _this5 = this;
576
-
577
- var _this$props9 = this.props,
578
- data = _this$props9.data,
579
- elementRef = _this$props9.elementRef,
580
- showTooltip = _this$props9.showTooltip,
581
- showEndDot = _this$props9.showEndDot,
582
- endDotRadius = _this$props9.endDotRadius,
583
- endDotStrokeWidth = _this$props9.endDotStrokeWidth,
584
- endDotCount = _this$props9.endDotCount,
585
- height = _this$props9.height,
586
- isArea = _this$props9.isArea,
587
- lineStrokeWidth = _this$props9.lineStrokeWidth,
588
- width = _this$props9.width,
589
- title = _this$props9.title;
590
-
591
- if (data.length === 0) {
592
- return null;
593
- } // Calculate horizontal and vertical margin so that fit line or end dot.
594
-
595
-
596
- var xMargin = endDotRadius + endDotStrokeWidth / 2;
597
- var yMargin = Math.max(lineStrokeWidth / 2, endDotRadius + endDotStrokeWidth / 2);
598
- var points = this.dataToPoints(xMargin, yMargin);
599
- var dotsToShow = Math.max(showEndDot && 1, Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(endDotCount) && endDotCount > 0 && endDotCount);
600
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("div", _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({
601
- // eslint-disable-line jsx-a11y/mouse-events-have-key-events
408
+ const xMargin = endDotRadius + endDotStrokeWidth / 2;
409
+ const yMargin = Math.max(lineStrokeWidth / 2, endDotRadius + endDotStrokeWidth / 2);
410
+ const points = this.dataToPoints(xMargin, yMargin);
411
+ const dotsToShow = Math.max(showEndDot && 1, (0, lodash_exports.isFinite)(endDotCount) && endDotCount > 0 && endDotCount);
412
+ return /* @__PURE__ */ react_default.createElement(
413
+ "div",
414
+ __spreadValues({
602
415
  "data-test": "line",
603
- "data-test-type": isArea ? 'area' : 'line',
604
- onMouseOut: function onMouseOut() {
605
- _this5.setState({
416
+ "data-test-type": isArea ? "area" : "line",
417
+ onMouseOut: () => {
418
+ this.setState({
606
419
  open: false,
607
420
  anchor: null,
608
421
  rectArea: null,
@@ -610,234 +423,114 @@ var SparkLine = /*#__PURE__*/function (_Component) {
610
423
  });
611
424
  },
612
425
  ref: elementRef
613
- }, Object(lodash__WEBPACK_IMPORTED_MODULE_10__["omit"])(this.props, Object(lodash__WEBPACK_IMPORTED_MODULE_10__["keys"])(SparkLine.propTypes))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(StyledSvg, {
614
- height: height,
615
- width: width,
616
- role: "img",
617
- "aria-labelledby": this.titleId,
618
- "data-test": "sparkline-svg"
619
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("title", {
620
- id: this.titleId,
621
- "data-test": "sparkline-title"
622
- }, title || Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_13__["_"])('Source count over time sparkline trend')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", null, this.renderCursor(), this.renderPolyline(points), this.renderArea(points), dotsToShow ? this.renderEndDots(points, dotsToShow, xMargin) : null, showTooltip ? this.renderRect(points, xMargin) : null, showTooltip ? this.renderTooltip() : null)));
623
- }
624
- }]);
625
-
626
- return SparkLine;
627
- }(react__WEBPACK_IMPORTED_MODULE_9__["Component"]);
628
-
629
- _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(SparkLine, "propTypes", {
426
+ }, (0, lodash_exports.omit)(this.props, (0, lodash_exports.keys)(_SparkLine.propTypes))),
427
+ /* @__PURE__ */ react_default.createElement(
428
+ StyledSvg,
429
+ {
430
+ height,
431
+ width,
432
+ role: "img",
433
+ "aria-labelledby": this.titleId,
434
+ "data-test": "sparkline-svg"
435
+ },
436
+ /* @__PURE__ */ react_default.createElement("title", { id: this.titleId, "data-test": "sparkline-title" }, title || (0, i18n_exports._)("Source count over time sparkline trend")),
437
+ /* @__PURE__ */ react_default.createElement("g", null, this.renderCursor(), this.renderPolyline(points), this.renderArea(points), dotsToShow ? this.renderEndDots(points, dotsToShow, xMargin) : null, showTooltip ? this.renderRect(points, xMargin) : null, showTooltip ? this.renderTooltip() : null)
438
+ )
439
+ );
440
+ }
441
+ };
442
+ __publicField(_SparkLine, "propTypes", {
630
443
  /**
631
444
  * If true, data can contain `null` as a value and is treated as `0`. If false, this throws error when data contains `null`.
632
445
  */
633
- acceptNull: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
634
-
446
+ acceptNull: prop_types_default.bool,
635
447
  /** Array of numbers. These data numbers are converted to points and show on sparkline. */
636
- data: function data(props) {
637
- if (!Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isArray"])(props.data)) {
638
- return new Error('Data provided to Sparkline must be an array.');
448
+ data: (props) => {
449
+ if (!(0, lodash_exports.isArray)(props.data)) {
450
+ return new Error("Data provided to Sparkline must be an array.");
639
451
  }
640
-
641
- if (props.acceptNull && !props.data.every(function (value) {
642
- return Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isNull"])(value) || Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(value);
643
- })) {
644
- return new Error('Data provided to Sparkline must be finite numbers or null.');
452
+ if (props.acceptNull && !props.data.every((value) => (0, lodash_exports.isNull)(value) || (0, lodash_exports.isFinite)(value))) {
453
+ return new Error("Data provided to Sparkline must be finite numbers or null.");
645
454
  }
646
-
647
- if (!props.acceptNull && !props.data.every(function (value) {
648
- return Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(value);
649
- })) {
650
- return new Error('Data provided to Sparkline must be finite numbers.');
455
+ if (!props.acceptNull && !props.data.every((value) => (0, lodash_exports.isFinite)(value))) {
456
+ return new Error("Data provided to Sparkline must be finite numbers.");
651
457
  }
652
-
653
458
  return null;
654
459
  },
655
-
656
460
  /** A React ref which is set to the DOM element when the component mounts and `null` when it unmounts. */
657
- elementRef: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.func, prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.object]),
658
-
461
+ elementRef: prop_types_default.oneOfType([prop_types_default.func, prop_types_default.object]),
659
462
  /** Sets the number of end dots to display. When showEndDot is set to `true`, endDotCount is at least 1. If set to a positive value, this overrides showEndDot. */
660
- endDotCount: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
661
-
463
+ endDotCount: prop_types_default.number,
662
464
  /** Fills color to the end dot. */
663
- endDotFillColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
664
-
465
+ endDotFillColor: prop_types_default.string,
665
466
  /**
666
467
  * Sets end dot radius. End dot radius must be less than or equal to the margin. By default, its value equals the margin.
667
468
  */
668
- endDotRadius: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
669
-
469
+ endDotRadius: prop_types_default.number,
670
470
  /** Sets end dot circle stroke color. */
671
- endDotStroke: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
672
-
471
+ endDotStroke: prop_types_default.string,
673
472
  /** Sets end dot circle stroke width in pixels. */
674
- endDotStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
675
-
473
+ endDotStrokeWidth: prop_types_default.number,
676
474
  /** Fills color to area. */
677
- fillColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
678
-
475
+ fillColor: prop_types_default.string,
679
476
  /** Fills opacity to area. Value must be in 0 ~ 1. */
680
- fillOpacity: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
681
-
477
+ fillOpacity: prop_types_default.string,
682
478
  /** Sets cursor stroke color. */
683
- cursorStroke: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
684
-
479
+ cursorStroke: prop_types_default.string,
685
480
  /** Sets cursor stroke width in pixels. */
686
- cursorStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
687
-
481
+ cursorStrokeWidth: prop_types_default.number,
688
482
  /** Sets cursor line cap style. */
689
- cursorStrokeLinecap: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.oneOf(['butt', 'round', 'square']),
690
-
483
+ cursorStrokeLinecap: prop_types_default.oneOf(["butt", "round", "square"]),
691
484
  /** Sets cursor dash array style. */
692
- cursorStrokeDasharray: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
693
-
485
+ cursorStrokeDasharray: prop_types_default.string,
694
486
  /**
695
487
  * Container height. If this value is specified, sparkline calculates the size using this height. If height isn't specified,
696
488
  * sparkline figures out the container height by itself.
697
489
  */
698
- height: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number.isRequired,
699
-
490
+ height: prop_types_default.number.isRequired,
700
491
  /** When set to `true`, sparkline shows as area. */
701
- isArea: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
702
-
492
+ isArea: prop_types_default.bool,
703
493
  /** The sparkline line color. */
704
- lineColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
705
-
494
+ lineColor: prop_types_default.string,
706
495
  /** Allows user to draw only the last data points for the line. */
707
- lineLength: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
708
-
496
+ lineLength: prop_types_default.number,
709
497
  /** The sparkline line stroke width in pixels. */
710
- lineStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
711
-
498
+ lineStrokeWidth: prop_types_default.number,
712
499
  /** Enable to show end dot. */
713
- showEndDot: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
714
-
500
+ showEndDot: prop_types_default.bool,
715
501
  /** Enable to show tooltip. */
716
- showTooltip: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
717
-
502
+ showTooltip: prop_types_default.bool,
718
503
  /** Sets the data value range and maximum value shown on sparkline. */
719
- yMax: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
720
-
504
+ yMax: prop_types_default.number,
721
505
  /** Sets the data value range and minimum value shown on sparkline. */
722
- yMin: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
723
-
506
+ yMin: prop_types_default.number,
724
507
  /**
725
508
  * The width of the container.
726
509
  */
727
- width: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number.isRequired,
728
-
510
+ width: prop_types_default.number.isRequired,
729
511
  /** Sets the a11y title text on sparkline. */
730
- title: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string
512
+ title: prop_types_default.string
731
513
  });
732
-
733
- _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(SparkLine, "defaultProps", {
514
+ __publicField(_SparkLine, "defaultProps", {
734
515
  acceptNull: false,
735
516
  data: [],
736
517
  showTooltip: true,
737
518
  endDotCount: 0,
738
519
  showEndDot: false,
739
520
  endDotRadius: 0,
740
- endDotFillColor: 'white',
741
- endDotStroke: 'black',
521
+ endDotFillColor: "white",
522
+ endDotStroke: "black",
742
523
  endDotStrokeWidth: 0,
743
- fillColor: '#65a637',
744
- fillOpacity: '.1',
745
- cursorStroke: '#5184AF',
524
+ fillColor: "#65a637",
525
+ fillOpacity: ".1",
526
+ cursorStroke: "#5184AF",
746
527
  cursorStrokeWidth: 3,
747
- cursorStrokeLinecap: 'square',
748
- cursorStrokeDasharray: '1, 5',
528
+ cursorStrokeLinecap: "square",
529
+ cursorStrokeDasharray: "1, 5",
749
530
  isArea: false,
750
- lineColor: '#65a637',
531
+ lineColor: "#65a637",
751
532
  lineStrokeWidth: 1
752
533
  });
753
-
754
- /* harmony default export */ __webpack_exports__["default"] = (SparkLine);
755
-
756
- /***/ }),
757
-
758
- /***/ 12:
759
- /***/ (function(module, exports) {
760
-
761
- module.exports = require("@babel/runtime/helpers/defineProperty");
762
-
763
- /***/ }),
764
-
765
- /***/ 2:
766
- /***/ (function(module, exports) {
767
-
768
- module.exports = require("lodash");
769
-
770
- /***/ }),
771
-
772
- /***/ 24:
773
- /***/ (function(module, exports) {
774
-
775
- module.exports = require("@babel/runtime/helpers/createClass");
776
-
777
- /***/ }),
778
-
779
- /***/ 3:
780
- /***/ (function(module, exports) {
781
-
782
- module.exports = require("@splunk/ui-utils/i18n");
783
-
784
- /***/ }),
785
-
786
- /***/ 30:
787
- /***/ (function(module, exports) {
788
-
789
- module.exports = require("@splunk/ui-utils/id");
790
-
791
- /***/ }),
792
-
793
- /***/ 4:
794
- /***/ (function(module, exports) {
795
-
796
- module.exports = require("styled-components");
797
-
798
- /***/ }),
799
-
800
- /***/ 68:
801
- /***/ (function(module, exports) {
802
-
803
- module.exports = require("@babel/runtime/helpers/extends");
804
-
805
- /***/ }),
806
-
807
- /***/ 8:
808
- /***/ (function(module, exports) {
809
-
810
- module.exports = require("@babel/runtime/helpers/classCallCheck");
811
-
812
- /***/ }),
813
-
814
- /***/ 81:
815
- /***/ (function(module, exports) {
816
-
817
- module.exports = require("@splunk/react-ui/Popover");
818
-
819
- /***/ }),
820
-
821
- /***/ 82:
822
- /***/ (function(module, exports) {
823
-
824
- module.exports = require("@babel/runtime/helpers/getPrototypeOf");
825
-
826
- /***/ }),
827
-
828
- /***/ 91:
829
- /***/ (function(module, exports) {
830
-
831
- module.exports = require("@babel/runtime/helpers/inherits");
832
-
833
- /***/ }),
834
-
835
- /***/ 92:
836
- /***/ (function(module, exports) {
837
-
838
- module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
839
-
840
- /***/ })
841
-
842
- /******/ });
843
- //# sourceMappingURL=SparkLine.js.map
534
+ var SparkLine = _SparkLine;
535
+ var SparkLine_default = SparkLine;
536
+ //# sourceMappingURL=SparkLine.js.map