@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
@@ -1,272 +1,211 @@
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 = 47);
91
- /******/ })
92
- /************************************************************************/
93
- /******/ ({
94
-
95
- /***/ 0:
96
- /***/ (function(module, exports) {
97
-
98
- module.exports = require("react");
99
-
100
- /***/ }),
101
-
102
- /***/ 1:
103
- /***/ (function(module, exports) {
104
-
105
- module.exports = require("prop-types");
106
-
107
- /***/ }),
108
-
109
- /***/ 20:
110
- /***/ (function(module, exports, __webpack_require__) {
111
-
112
- "use strict";
113
-
114
-
115
- Object.defineProperty(exports, "__esModule", {
116
- value: true
117
- });
118
- exports.convertToDashboardJSON = exports.extractDataFromReactCode = exports.formatCodeStringToObject = exports.extractDocItems = exports.getFormatterClassdesc = void 0;
119
-
120
- var React = __webpack_require__(0);
121
-
122
- var UtilPage_1 = __webpack_require__(21);
123
-
124
- var sharedSelectors = ['getField', 'getType', 'min', 'max'];
125
-
126
- var formatSidebarItemName = function formatSidebarItemName(name, className) {
127
- return sharedSelectors.find(function (sharedSelector) {
128
- return name === sharedSelector;
129
- }) ? "".concat(className, "#").concat(name) : name;
130
- };
131
-
132
- var removePrependedClassName = function removePrependedClassName() {
133
- var longname = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
134
- return longname.slice(longname.indexOf('#') + 1);
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 __defProps = Object.defineProperties;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
11
+ var __getProtoOf = Object.getPrototypeOf;
12
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
13
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
14
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15
+ var __spreadValues = (a, b) => {
16
+ for (var prop in b || (b = {}))
17
+ if (__hasOwnProp.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ if (__getOwnPropSymbols)
20
+ for (var prop of __getOwnPropSymbols(b)) {
21
+ if (__propIsEnum.call(b, prop))
22
+ __defNormalProp(a, prop, b[prop]);
23
+ }
24
+ return a;
135
25
  };
136
-
137
- var formatDSLSelectorDocs = function formatDSLSelectorDocs(docs) {
138
- return docs.map(function (doc) {
139
- return Object.assign(Object.assign({}, doc), {
140
- longname: removePrependedClassName(doc.longname)
141
- });
142
- });
26
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27
+ var __export = (target, all) => {
28
+ for (var name in all)
29
+ __defProp(target, name, { get: all[name], enumerable: true });
143
30
  };
144
-
145
- var getFormatterClassdesc = function getFormatterClassdesc(formatterDocs, name) {
146
- return {
147
- name: name,
148
- markdown: "# ".concat(name, "\n ").concat(formatterDocs.find(function (doc) {
149
- return doc.name === name && doc.kind === 'class';
150
- }).classdesc)
151
- };
152
- };
153
-
154
- exports.getFormatterClassdesc = getFormatterClassdesc;
155
-
156
- var extractDocItems = function extractDocItems(docs, className) {
157
- var classHeaderDoc = docs[0];
158
- var fileDoc = docs[docs.length - 1];
159
- var filteredDocs = formatDSLSelectorDocs(docs).filter(function (_ref) {
160
- var access = _ref.access,
161
- comment = _ref.comment;
162
- return access === 'public' && comment;
163
- });
164
- return filteredDocs.map(function (doc) {
165
- return {
166
- name: formatSidebarItemName(doc.name, className),
167
- component: function UtilDoc() {
168
- // named function so linter doesnt raise react/display-name error
169
- return React.createElement(UtilPage_1.default, {
170
- title: "".concat(className, "#").concat(doc.name),
171
- status: 1,
172
- docs: [classHeaderDoc, doc, fileDoc]
173
- });
174
- }
175
- };
176
- }).sort(function (a, b) {
177
- return a.name.localeCompare(b.name);
178
- });
31
+ var __copyProps = (to, from, except, desc) => {
32
+ if (from && typeof from === "object" || typeof from === "function") {
33
+ for (let key of __getOwnPropNames(from))
34
+ if (!__hasOwnProp.call(to, key) && key !== except)
35
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
36
+ }
37
+ return to;
179
38
  };
39
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
40
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
41
+ // If the importer is in node compatibility mode or this is not an ESM
42
+ // file that has been converted to a CommonJS file using a Babel-
43
+ // compatible transform (i.e. "__esModule" has not been set), then set
44
+ // "default" to the CommonJS "module.exports" for node compatibility.
45
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
46
+ mod
47
+ ));
48
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
49
+
50
+ // src/common/DocExampleWithVizSandbox.tsx
51
+ var DocExampleWithVizSandbox_exports = {};
52
+ __export(DocExampleWithVizSandbox_exports, {
53
+ default: () => DocExampleWithVizSandbox_default
54
+ });
55
+ module.exports = __toCommonJS(DocExampleWithVizSandbox_exports);
180
56
 
181
- exports.extractDocItems = extractDocItems;
57
+ // esm-externals:react
58
+ var react_exports = {};
59
+ __export(react_exports, {
60
+ default: () => react_default
61
+ });
62
+ var defaultImport = __toESM(require("react"));
63
+ __reExport(react_exports, require("react"));
64
+ var react_default = "default" in defaultImport ? defaultImport.default : defaultImport;
65
+
66
+ // esm-externals:@splunk/react-docs/DocExample
67
+ var DocExample_exports = {};
68
+ __export(DocExample_exports, {
69
+ default: () => DocExample_default
70
+ });
71
+ var defaultImport2 = __toESM(require("@splunk/react-docs/DocExample"));
72
+ __reExport(DocExample_exports, require("@splunk/react-docs/DocExample"));
73
+ var DocExample_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
74
+
75
+ // esm-externals:@splunk/react-ui/Button
76
+ var Button_exports = {};
77
+ __export(Button_exports, {
78
+ default: () => Button_default
79
+ });
80
+ var defaultImport3 = __toESM(require("@splunk/react-ui/Button"));
81
+ __reExport(Button_exports, require("@splunk/react-ui/Button"));
82
+ var Button_default = "default" in defaultImport3 ? defaultImport3.default : defaultImport3;
83
+
84
+ // esm-externals:@splunk/react-ui/Code
85
+ var Code_exports = {};
86
+ __export(Code_exports, {
87
+ default: () => Code_default
88
+ });
89
+ var defaultImport4 = __toESM(require("@splunk/react-ui/Code"));
90
+ __reExport(Code_exports, require("@splunk/react-ui/Code"));
91
+ var Code_default = "default" in defaultImport4 ? defaultImport4.default : defaultImport4;
92
+
93
+ // esm-externals:@splunk/react-ui/TransitionOpen
94
+ var TransitionOpen_exports = {};
95
+ __export(TransitionOpen_exports, {
96
+ default: () => TransitionOpen_default
97
+ });
98
+ var defaultImport5 = __toESM(require("@splunk/react-ui/TransitionOpen"));
99
+ __reExport(TransitionOpen_exports, require("@splunk/react-ui/TransitionOpen"));
100
+ var TransitionOpen_default = "default" in defaultImport5 ? defaultImport5.default : defaultImport5;
101
+
102
+ // esm-externals:@splunk/react-icons/SquaresLayered
103
+ var SquaresLayered_exports = {};
104
+ __export(SquaresLayered_exports, {
105
+ default: () => SquaresLayered_default
106
+ });
107
+ var defaultImport6 = __toESM(require("@splunk/react-icons/SquaresLayered"));
108
+ __reExport(SquaresLayered_exports, require("@splunk/react-icons/SquaresLayered"));
109
+ var SquaresLayered_default = "default" in defaultImport6 ? defaultImport6.default : defaultImport6;
110
+
111
+ // esm-externals:@splunk/react-icons/Checkmark
112
+ var Checkmark_exports = {};
113
+ __export(Checkmark_exports, {
114
+ default: () => Checkmark_default
115
+ });
116
+ var defaultImport7 = __toESM(require("@splunk/react-icons/Checkmark"));
117
+ __reExport(Checkmark_exports, require("@splunk/react-icons/Checkmark"));
118
+ var Checkmark_default = "default" in defaultImport7 ? defaultImport7.default : defaultImport7;
119
+
120
+ // esm-externals:@splunk/react-icons/EyeSlashed
121
+ var EyeSlashed_exports = {};
122
+ __export(EyeSlashed_exports, {
123
+ default: () => EyeSlashed_default
124
+ });
125
+ var defaultImport8 = __toESM(require("@splunk/react-icons/EyeSlashed"));
126
+ __reExport(EyeSlashed_exports, require("@splunk/react-icons/EyeSlashed"));
127
+ var EyeSlashed_default = "default" in defaultImport8 ? defaultImport8.default : defaultImport8;
128
+
129
+ // esm-externals:@splunk/react-icons/WindowChevronsSlash
130
+ var WindowChevronsSlash_exports = {};
131
+ __export(WindowChevronsSlash_exports, {
132
+ default: () => WindowChevronsSlash_default
133
+ });
134
+ var defaultImport9 = __toESM(require("@splunk/react-icons/WindowChevronsSlash"));
135
+ __reExport(WindowChevronsSlash_exports, require("@splunk/react-icons/WindowChevronsSlash"));
136
+ var WindowChevronsSlash_default = "default" in defaultImport9 ? defaultImport9.default : defaultImport9;
137
+
138
+ // esm-externals:@splunk/ui-utils/i18n
139
+ var i18n_exports = {};
140
+ __export(i18n_exports, {
141
+ default: () => i18n_default
142
+ });
143
+ var defaultImport10 = __toESM(require("@splunk/ui-utils/i18n"));
144
+ __reExport(i18n_exports, require("@splunk/ui-utils/i18n"));
145
+ var i18n_default = "default" in defaultImport10 ? defaultImport10.default : defaultImport10;
146
+
147
+ // esm-externals:prop-types
148
+ var prop_types_exports = {};
149
+ __export(prop_types_exports, {
150
+ default: () => prop_types_default
151
+ });
152
+ var defaultImport11 = __toESM(require("prop-types"));
153
+ __reExport(prop_types_exports, require("prop-types"));
154
+ var prop_types_default = "default" in defaultImport11 ? defaultImport11.default : defaultImport11;
155
+
156
+ // esm-externals:@splunk/react-docs/UtilPage
157
+ var UtilPage_exports = {};
158
+ __export(UtilPage_exports, {
159
+ default: () => UtilPage_default
160
+ });
161
+ var defaultImport12 = __toESM(require("@splunk/react-docs/UtilPage"));
162
+ __reExport(UtilPage_exports, require("@splunk/react-docs/UtilPage"));
163
+ var UtilPage_default = "default" in defaultImport12 ? defaultImport12.default : defaultImport12;
182
164
 
183
- var formatCodeStringToObject = function formatCodeStringToObject(codeString, regexMatch) {
184
- var match = regexMatch.exec(codeString);
165
+ // src/common/docUtils.tsx
166
+ var formatCodeStringToObject = (codeString, regexMatch) => {
167
+ const match = regexMatch.exec(codeString);
185
168
  if (!match) return null;
186
- var stringToParse = "{".concat(match[1], "}"); // remove trailing commas
187
-
188
- var removedCommas = stringToParse.replace(/,(?!\s*?[-{["'\w])/g, ''); // convert double quotes (which only occur inside strings) to back quotes
189
-
190
- var backQuotes = removedCommas.replace(/"/g, '`'); // replace single quotes with double quotes
191
-
192
- var doubleQuotes = backQuotes.replace(/'/g, '"'); // replace back quotes with single quotes
193
-
194
- var singleQuotes = doubleQuotes.replace(/`/g, "'"); // add quotes around keys
195
-
196
- var quotesAroundKeys = singleQuotes.replace(/\b(\w+)\s*:(?=\s)/g, '"$1":');
197
- var retval = null;
198
-
169
+ const stringToParse = `{${match[1]}}`;
170
+ const removedCommas = stringToParse.replace(/,(?!\s*?[-{["'\w])/g, "");
171
+ const backQuotes = removedCommas.replace(/"/g, "`");
172
+ const doubleQuotes = backQuotes.replace(/'/g, '"');
173
+ const singleQuotes = doubleQuotes.replace(/`/g, "'");
174
+ const quotesAroundKeys = singleQuotes.replace(/\b(\w+)\s*:(?=\s)/g, '"$1":');
175
+ let retval = null;
199
176
  try {
200
177
  retval = JSON.parse(quotesAroundKeys);
201
178
  } catch (e) {
202
- // eslint-disable-next-line no-console
203
179
  console.error(e);
204
180
  }
205
-
206
181
  return retval;
207
182
  };
208
-
209
- exports.formatCodeStringToObject = formatCodeStringToObject;
210
-
211
- var extractDataFromReactCode = function extractDataFromReactCode(codeString) {
183
+ var extractDataFromReactCode = (codeString) => {
212
184
  var _a;
213
-
214
- var primaryRegex = /dataSources={{([\s\S]*?primary:[\s\S]*?)}}/;
215
-
216
- var _ref2 = (_a = (0, exports.formatCodeStringToObject)(codeString, primaryRegex)) !== null && _a !== void 0 ? _a : {},
217
- primary = _ref2.primary;
218
-
219
- var optionsRegex = /options={{([\s\S]*?)}}/;
220
- var options = (0, exports.formatCodeStringToObject)(codeString, optionsRegex);
221
- var contextRegex = /context={{([\s\S]*?)}}/;
222
- var context = (0, exports.formatCodeStringToObject)(codeString, contextRegex);
223
- return {
224
- primary: primary,
225
- options: options,
226
- context: context
227
- };
185
+ const primaryRegex = /dataSources={{([\s\S]*?primary:[\s\S]*?)}}/;
186
+ const { primary } = (_a = formatCodeStringToObject(codeString, primaryRegex)) != null ? _a : {};
187
+ const optionsRegex = /options={{([\s\S]*?)}}/;
188
+ const options = formatCodeStringToObject(codeString, optionsRegex);
189
+ const contextRegex = /context={{([\s\S]*?)}}/;
190
+ const context = formatCodeStringToObject(codeString, contextRegex);
191
+ return { primary, options, context };
228
192
  };
229
-
230
- exports.extractDataFromReactCode = extractDataFromReactCode; // Takes a stringified react viz example and a viz type
231
- // Returns a dashboard definition object.
232
- // e.g. codeString: '<Area dataSources={{}} options={{}} />'
233
- // type: 'splunk.area'
234
-
235
- var convertToDashboardJSON = function convertToDashboardJSON(codeString, type) {
236
- var _ref3 = (0, exports.extractDataFromReactCode)(codeString),
237
- options = _ref3.options,
238
- primary = _ref3.primary,
239
- context = _ref3.context;
240
-
241
- return Object.assign(Object.assign({
193
+ var convertToDashboardJSON = (codeString, type) => {
194
+ const { options, primary, context } = extractDataFromReactCode(codeString);
195
+ return __spreadProps(__spreadValues({
242
196
  visualizations: {
243
- test_viz: Object.assign(Object.assign(Object.assign({
244
- type: type
245
- }, options ? {
246
- options: options
247
- } : {}), primary ? {
248
- dataSources: {
249
- primary: 'primary'
250
- }
251
- } : {}), context ? {
252
- context: context
253
- } : {})
197
+ test_viz: __spreadValues(__spreadValues(__spreadValues({
198
+ type
199
+ }, options ? { options } : {}), primary ? { dataSources: { primary: "primary" } } : {}), context ? { context } : {})
254
200
  }
255
- }, primary ? {
256
- dataSources: {
257
- primary: {
258
- type: 'ds.test',
259
- options: primary
260
- }
261
- }
262
- } : {}), {
201
+ }, primary ? { dataSources: { primary: { type: "ds.test", options: primary } } } : {}), {
263
202
  defaults: {
264
203
  dataSources: {
265
204
  global: {
266
205
  options: {
267
206
  queryParameters: {
268
- latest: '$global_time.latest$',
269
- earliest: '$global_time.earliest$'
207
+ latest: "$global_time.latest$",
208
+ earliest: "$global_time.earliest$"
270
209
  }
271
210
  }
272
211
  }
@@ -274,254 +213,112 @@ var convertToDashboardJSON = function convertToDashboardJSON(codeString, type) {
274
213
  },
275
214
  inputs: {
276
215
  input_global_trp: {
277
- type: 'input.timerange',
216
+ type: "input.timerange",
278
217
  options: {
279
- token: 'global_time',
280
- defaultValue: '-24h@h,now'
218
+ token: "global_time",
219
+ defaultValue: "-24h@h,now"
281
220
  },
282
- title: 'Global Time Range'
221
+ title: "Global Time Range"
283
222
  }
284
223
  },
285
224
  layout: {
286
- type: 'absolute',
225
+ type: "absolute",
287
226
  options: {},
288
- structure: [{
289
- item: 'test_viz',
290
- type: 'block',
291
- position: {
292
- x: 0,
293
- y: 0,
294
- w: 800,
295
- h: 500
227
+ structure: [
228
+ {
229
+ item: "test_viz",
230
+ type: "block",
231
+ position: {
232
+ x: 0,
233
+ y: 0,
234
+ w: 800,
235
+ h: 500
236
+ }
296
237
  }
297
- }],
298
- globalInputs: ['input_global_trp']
238
+ ],
239
+ globalInputs: ["input_global_trp"]
299
240
  }
300
241
  });
301
242
  };
302
243
 
303
- exports.convertToDashboardJSON = convertToDashboardJSON;
304
-
305
- /***/ }),
306
-
307
- /***/ 21:
308
- /***/ (function(module, exports) {
309
-
310
- module.exports = require("@splunk/react-docs/UtilPage");
311
-
312
- /***/ }),
313
-
314
- /***/ 47:
315
- /***/ (function(module, exports, __webpack_require__) {
316
-
317
- "use strict";
318
-
319
-
320
- var _slicedToArray = __webpack_require__(8);
321
-
322
- Object.defineProperty(exports, "__esModule", {
323
- value: true
324
- });
325
-
326
- var React = __webpack_require__(0);
327
-
328
- var DocExample_1 = __webpack_require__(48);
329
-
330
- var Button_1 = __webpack_require__(49);
331
-
332
- var Code_1 = __webpack_require__(50);
333
-
334
- var TransitionOpen_1 = __webpack_require__(51);
335
-
336
- var SquaresLayered_1 = __webpack_require__(52);
337
-
338
- var Checkmark_1 = __webpack_require__(53);
339
-
340
- var EyeSlashed_1 = __webpack_require__(54);
341
-
342
- var WindowChevronsSlash_1 = __webpack_require__(55);
343
-
344
- var i18n_1 = __webpack_require__(5);
345
-
346
- var T = __webpack_require__(1);
347
-
348
- var docUtils_1 = __webpack_require__(20);
349
-
350
- var DocExampleWithVizSandbox = function DocExampleWithVizSandbox(props) {
351
- var type = props.type,
352
- title = props.title,
353
- code = props.code,
354
- example = props.example,
355
- _props$hideSandbox = props.hideSandbox,
356
- hideSandbox = _props$hideSandbox === void 0 ? false : _props$hideSandbox,
357
- description = props.description;
358
-
359
- var _React$useState = React.useState(false),
360
- _React$useState2 = _slicedToArray(_React$useState, 2),
361
- isCopied = _React$useState2[0],
362
- setIsCopied = _React$useState2[1];
363
-
364
- var _React$useState3 = React.useState(false),
365
- _React$useState4 = _slicedToArray(_React$useState3, 2),
366
- showCode = _React$useState4[0],
367
- setShowCode = _React$useState4[1];
368
-
369
- var isMounted = React.useRef(true);
370
- var toggleShowCode = React.useCallback(function () {
371
- setShowCode(function (state) {
372
- return !state;
373
- });
244
+ // src/common/DocExampleWithVizSandbox.tsx
245
+ var DocExampleWithVizSandbox = (props) => {
246
+ const { type, title, code, example, hideSandbox = false, description } = props;
247
+ const [isCopied, setIsCopied] = react_exports.useState(false);
248
+ const [showCode, setShowCode] = react_exports.useState(false);
249
+ const isMounted = react_exports.useRef(true);
250
+ const toggleShowCode = react_exports.useCallback(() => {
251
+ setShowCode((state) => !state);
374
252
  }, []);
375
- React.useEffect(function () {
376
- return function () {
253
+ react_exports.useEffect(() => {
254
+ return () => {
377
255
  isMounted.current = false;
378
256
  setIsCopied(false);
379
- }; // eslint-disable-next-line react-hooks/exhaustive-deps
257
+ };
380
258
  }, []);
381
- if (hideSandbox) return React.createElement(DocExample_1.default, {
382
- title: title,
383
- code: code,
384
- example: example
385
- });
386
- var objDefn = (0, docUtils_1.convertToDashboardJSON)(code, type); // set spacing level to 4
387
-
388
- var prettyJson = JSON.stringify(objDefn, null, 4);
389
-
390
- var copyToClipBoard = function copyToClipBoard() {
391
- if ('clipboard' in navigator) {
259
+ if (hideSandbox) return /* @__PURE__ */ react_exports.createElement(DocExample_default, { title, code, example });
260
+ const objDefn = convertToDashboardJSON(code, type);
261
+ const prettyJson = JSON.stringify(objDefn, null, 4);
262
+ const copyToClipBoard = () => {
263
+ if ("clipboard" in navigator) {
392
264
  navigator.clipboard.writeText(prettyJson);
393
265
  setIsCopied(true);
394
266
  }
395
-
396
- setTimeout(function () {
267
+ setTimeout(() => {
397
268
  if (isMounted.current) {
398
269
  setIsCopied(false);
399
270
  }
400
- }, 5000);
271
+ }, 5e3);
401
272
  };
402
-
403
- var renderAdditionalActions = function renderAdditionalActions() {
404
- return [React.createElement(Button_1.default, {
405
- key: "show-dashboard-definition",
406
- appearance: "toggle",
407
- onClick: toggleShowCode,
408
- icon: showCode ? React.createElement(EyeSlashed_1.default, null) : React.createElement(WindowChevronsSlash_1.default, null),
409
- label: showCode ? (0, i18n_1._)('Hide dashboard definition') : (0, i18n_1._)('Show dashboard definition')
410
- })];
411
- };
412
-
413
- return React.createElement(DocExample_1.default, {
414
- renderAdditionalActions: renderAdditionalActions,
415
- title: title,
416
- code: code,
417
- example: example,
418
- description: description
419
- }, React.createElement(TransitionOpen_1.default, {
420
- animation: "slideFromTop",
421
- open: showCode,
422
- retainFocus: false,
423
- takeFocus: false,
424
- renderChildrenWhenCollapsed: false,
425
- animateOnMount: false
426
- }, React.createElement("div", {
427
- style: {
428
- display: 'flex',
429
- justifyContent: 'space-between'
430
- }
431
- }, React.createElement(Code_1.default, {
432
- value: prettyJson,
433
- language: "json"
434
- }), React.createElement(Button_1.default, {
435
- onClick: copyToClipBoard,
436
- icon: isCopied ? React.createElement(Checkmark_1.default, null) : React.createElement(SquaresLayered_1.default, null),
437
- label: isCopied ? (0, i18n_1._)('Copied') : (0, i18n_1._)('Copy to clipboard'),
438
- style: {
439
- height: '30px',
440
- maxWidth: '164px'
441
- }
442
- }))));
273
+ const renderAdditionalActions = () => [
274
+ /* @__PURE__ */ react_exports.createElement(
275
+ Button_default,
276
+ {
277
+ key: "show-dashboard-definition",
278
+ appearance: "toggle",
279
+ onClick: toggleShowCode,
280
+ icon: showCode ? /* @__PURE__ */ react_exports.createElement(EyeSlashed_default, null) : /* @__PURE__ */ react_exports.createElement(WindowChevronsSlash_default, null),
281
+ label: showCode ? (0, i18n_exports._)("Hide dashboard definition") : (0, i18n_exports._)("Show dashboard definition")
282
+ }
283
+ )
284
+ ];
285
+ return /* @__PURE__ */ react_exports.createElement(
286
+ DocExample_default,
287
+ {
288
+ renderAdditionalActions,
289
+ title,
290
+ code,
291
+ example,
292
+ description
293
+ },
294
+ /* @__PURE__ */ react_exports.createElement(
295
+ TransitionOpen_default,
296
+ {
297
+ animation: "slideFromTop",
298
+ open: showCode,
299
+ retainFocus: false,
300
+ takeFocus: false,
301
+ renderChildrenWhenCollapsed: false,
302
+ animateOnMount: false
303
+ },
304
+ /* @__PURE__ */ react_exports.createElement("div", { style: { display: "flex", justifyContent: "space-between" } }, /* @__PURE__ */ react_exports.createElement(Code_default, { value: prettyJson, language: "json" }), /* @__PURE__ */ react_exports.createElement(
305
+ Button_default,
306
+ {
307
+ onClick: copyToClipBoard,
308
+ icon: isCopied ? /* @__PURE__ */ react_exports.createElement(Checkmark_default, null) : /* @__PURE__ */ react_exports.createElement(SquaresLayered_default, null),
309
+ label: isCopied ? (0, i18n_exports._)("Copied") : (0, i18n_exports._)("Copy to clipboard"),
310
+ style: { height: "30px", maxWidth: "164px" }
311
+ }
312
+ ))
313
+ )
314
+ );
443
315
  };
444
-
445
316
  DocExampleWithVizSandbox.propTypes = {
446
- type: T.string,
447
- title: T.string,
448
- code: T.string,
449
- example: T.func,
450
- hideSandbox: T.bool
317
+ type: prop_types_exports.string,
318
+ title: prop_types_exports.string,
319
+ code: prop_types_exports.string,
320
+ example: prop_types_exports.func,
321
+ hideSandbox: prop_types_exports.bool
451
322
  };
452
- exports.default = DocExampleWithVizSandbox;
453
-
454
- /***/ }),
455
-
456
- /***/ 48:
457
- /***/ (function(module, exports) {
458
-
459
- module.exports = require("@splunk/react-docs/DocExample");
460
-
461
- /***/ }),
462
-
463
- /***/ 49:
464
- /***/ (function(module, exports) {
465
-
466
- module.exports = require("@splunk/react-ui/Button");
467
-
468
- /***/ }),
469
-
470
- /***/ 5:
471
- /***/ (function(module, exports) {
472
-
473
- module.exports = require("@splunk/ui-utils/i18n");
474
-
475
- /***/ }),
476
-
477
- /***/ 50:
478
- /***/ (function(module, exports) {
479
-
480
- module.exports = require("@splunk/react-ui/Code");
481
-
482
- /***/ }),
483
-
484
- /***/ 51:
485
- /***/ (function(module, exports) {
486
-
487
- module.exports = require("@splunk/react-ui/TransitionOpen");
488
-
489
- /***/ }),
490
-
491
- /***/ 52:
492
- /***/ (function(module, exports) {
493
-
494
- module.exports = require("@splunk/react-icons/SquaresLayered");
495
-
496
- /***/ }),
497
-
498
- /***/ 53:
499
- /***/ (function(module, exports) {
500
-
501
- module.exports = require("@splunk/react-icons/Checkmark");
502
-
503
- /***/ }),
504
-
505
- /***/ 54:
506
- /***/ (function(module, exports) {
507
-
508
- module.exports = require("@splunk/react-icons/EyeSlashed");
509
-
510
- /***/ }),
511
-
512
- /***/ 55:
513
- /***/ (function(module, exports) {
514
-
515
- module.exports = require("@splunk/react-icons/WindowChevronsSlash");
516
-
517
- /***/ }),
518
-
519
- /***/ 8:
520
- /***/ (function(module, exports) {
521
-
522
- module.exports = require("@babel/runtime/helpers/slicedToArray");
523
-
524
- /***/ })
525
-
526
- /******/ });
527
- //# sourceMappingURL=DocExampleWithVizSandbox.js.map
323
+ var DocExampleWithVizSandbox_default = DocExampleWithVizSandbox;
324
+ //# sourceMappingURL=DocExampleWithVizSandbox.js.map