@splunk/visualizations-shared 26.4.1 → 27.0.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 (63) hide show
  1. package/.loki/reference/chrome_docker_SizeAwareWrapper_50_parent.png +0 -0
  2. package/.loki/reference/chrome_docker_SizeAwareWrapper_Fix_size_container.png +0 -0
  3. package/.loki/reference/chrome_docker_SizeAwareWrapper_Flex_layout_container.png +0 -0
  4. package/.loki/reference/chrome_docker_SizeAwareWrapper_Flex_layout_container_with_extra_wrapper.png +0 -0
  5. package/Downloader.js +164 -403
  6. package/Downloader.js.map +7 -1
  7. package/FileDownloader.js +121 -557
  8. package/FileDownloader.js.map +7 -1
  9. package/JSONSchemaUtils.js +58 -134
  10. package/JSONSchemaUtils.js.map +7 -1
  11. package/Message.js +105 -270
  12. package/Message.js.map +7 -1
  13. package/RemoteIcon.js +272 -736
  14. package/RemoteIcon.js.map +7 -1
  15. package/RemoteImage.js +190 -458
  16. package/RemoteImage.js.map +7 -1
  17. package/SanitizeProps.js +117 -238
  18. package/SanitizeProps.js.map +7 -1
  19. package/SizeAwareWrapper.js +108 -306
  20. package/SizeAwareWrapper.js.map +7 -1
  21. package/SizeAwareWrapperDeprecated.js +117 -326
  22. package/SizeAwareWrapperDeprecated.js.map +7 -1
  23. package/VisualizationDocPage.js +212 -461
  24. package/VisualizationDocPage.js.map +7 -1
  25. package/colorConstants.js +81 -132
  26. package/colorConstants.js.map +7 -1
  27. package/colorUtils.js +47 -134
  28. package/colorUtils.js.map +7 -1
  29. package/configUtils.js +28 -112
  30. package/configUtils.js.map +7 -1
  31. package/console.js +45 -183
  32. package/console.js.map +7 -1
  33. package/dataSourceUtils.js +45 -140
  34. package/dataSourceUtils.js.map +7 -1
  35. package/domUtils.js +58 -122
  36. package/domUtils.js.map +7 -1
  37. package/hocUtils.js +45 -122
  38. package/hocUtils.js.map +7 -1
  39. package/i18n.js +168 -323
  40. package/i18n.js.map +7 -1
  41. package/iconUtils.js +47 -178
  42. package/iconUtils.js.map +7 -1
  43. package/mapUtils.js +45 -122
  44. package/mapUtils.js.map +7 -1
  45. package/numberUtils.js +101 -275
  46. package/numberUtils.js.map +7 -1
  47. package/package.json +18 -22
  48. package/previewVizMessage.js +28 -108
  49. package/previewVizMessage.js.map +7 -1
  50. package/propUtils.js +88 -212
  51. package/propUtils.js.map +7 -1
  52. package/schemaUtils.js +58 -185
  53. package/schemaUtils.js.map +7 -1
  54. package/simpleXMLOptions.js +142 -225
  55. package/simpleXMLOptions.js.map +7 -1
  56. package/style.js +65 -168
  57. package/style.js.map +7 -1
  58. package/testHelper.js +247 -303
  59. package/testHelper.js.map +7 -1
  60. package/themeUtils.js +63 -142
  61. package/themeUtils.js.map +7 -1
  62. package/trellisUtils.js +108 -276
  63. package/trellisUtils.js.map +7 -1
@@ -1 +1,7 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///external \"react\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///external \"@babel/runtime/helpers/taggedTemplateLiteral\"","webpack:///external \"styled-components\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"lodash/pick\"","webpack:///external \"@splunk/visualization-context/ImageContext\"","webpack:///external \"@splunk/visualizations-shared/style\"","webpack:///./src/RemoteImage.jsx"],"names":["isRemoteImage","src","type","toImageDimensions","props","toDimension","pick","Image","styled","RemoteImage","imageDataURI","preserveAspectRatio","prevProps","imageRegistry","image","dataURI","console","width","height","title","_","e","PureComponent","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B;;AAIL,UAAI,CAAJ,cAAmB;AACf;AACH;;AACD,0BACI;AACI,WAAG,EADP;AAEI,iCAAyB,EAAE,WAF/B;AAGI,aAAK,EAHT;AAII,cAAM,EAJV;AAKI,WAAG,EAAEC,gEAAC,CALV,KAKU,CALV;AAMI,eAAO,EAAE,oBAAK;AACVC,WAAC,CAADA,aAAeD,gEAAC,CAAhBC,iBAAgB,CAAhBA;AACH;AARL,QADJ;AAYH;;;;EAlEqBC,oD;;6EAApBb,W,iBACmBc,kF;;6EADnBd,W,eAGiB;AACfe,UAAQ,EAAEC,kDAAC,CADI;AAEfR,OAAK,EAAEQ,kDAAC,CAADA,UAAY,CAACA,kDAAC,CAAF,QAAWA,kDAAC,CAFhB,MAEI,CAAZA,CAFQ;AAGfP,QAAM,EAAEO,kDAAC,CAADA,UAAY,CAACA,kDAAC,CAAF,QAAWA,kDAAC,CAHjB,MAGK,CAAZA,CAHO;AAIfd,qBAAmB,EAAEc,kDAAC,CAJP;AAKfN,OAAK,EAAEM,kDAAC,CAACC;AALM,C;;6EAHjBjB,W,kBAWoB;AAClBE,qBAAmB,EAAE;AADH,C;;AA0D1B,4E","file":"RemoteImage.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 45);\n","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","module.exports = require(\"@babel/runtime/helpers/taggedTemplateLiteral\");","module.exports = require(\"styled-components\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"lodash/pick\");","module.exports = require(\"@splunk/visualization-context/ImageContext\");","module.exports = require(\"@splunk/visualizations-shared/style\");","import React, { PureComponent } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport pick from 'lodash/pick';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageContext from '@splunk/visualization-context/ImageContext';\nimport { toDimension } from '@splunk/visualizations-shared/style';\n\n/**\n * check if an image is considered as remote image\n * @param {*} src\n */\nexport const isRemoteImage = (src = '') => {\n const [type] = src.split('://');\n return src.indexOf('://') > -1 && type !== 'http' && type !== 'https';\n};\n\nconst toImageDimensions = props => {\n if (props.shouldPreserveAspectRatio) {\n return `\n max-width: 100%;\n max-height: 100%;\n width: auto;\n height: auto;\n `;\n }\n return toDimension(pick(props, ['width', 'height']));\n};\n\nconst Image = styled.img`\n display: block;\n ${props => toImageDimensions(props)};\n`;\n\nclass RemoteImage extends PureComponent {\n static contextType = ImageContext;\n\n static propTypes = {\n imageURL: T.string,\n width: T.oneOfType([T.string, T.number]),\n height: T.oneOfType([T.string, T.number]),\n preserveAspectRatio: T.bool,\n title: T.string,\n };\n\n static defaultProps = {\n preserveAspectRatio: false,\n };\n\n constructor(props) {\n super(props);\n this.state = { imageDataURI: null, preserveAspectRatio: props.preserveAspectRatio };\n }\n\n componentDidMount() {\n this.getImage(this.props.imageURL);\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.imageURL !== this.props.imageURL) {\n this.getImage(this.props.imageURL);\n }\n if (prevProps.preserveAspectRatio !== this.props.preserveAspectRatio) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({ preserveAspectRatio: this.props.preserveAspectRatio });\n }\n }\n\n async getImage(imageURL) {\n const imageRegistry = this.context;\n if (imageRegistry) {\n try {\n const image = await imageRegistry.getByURL(imageURL);\n this.setState({ imageDataURI: image.dataURI });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error);\n }\n }\n }\n\n render() {\n const { imageDataURI } = this.state;\n const { width, height, title } = this.props;\n\n if (!imageDataURI) {\n return null;\n }\n return (\n <Image\n src={imageDataURI}\n shouldPreserveAspectRatio={this.state.preserveAspectRatio}\n width={width}\n height={height}\n alt={_(title)}\n onError={e => {\n e.target.alt = _('Image not found');\n }}\n />\n );\n }\n}\n\nexport default RemoteImage;\n"],"sourceRoot":""}
1
+ {
2
+ "version": 3,
3
+ "sources": ["src/RemoteImage.jsx", "esm-externals:react", "esm-externals:prop-types", "esm-externals:styled-components", "esm-externals:lodash/pick", "esm-externals:@splunk/ui-utils/i18n", "esm-externals:@splunk/visualization-context/ImageContext", "esm-externals:@splunk/visualizations-shared/style"],
4
+ "sourcesContent": ["import React, { PureComponent } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport pick from 'lodash/pick';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageContext from '@splunk/visualization-context/ImageContext';\nimport { toDimension } from '@splunk/visualizations-shared/style';\n\n/**\n * check if an image is considered as remote image\n * @param {*} src\n */\nexport const isRemoteImage = (src = '') => {\n const [type] = src.split('://');\n return src.indexOf('://') > -1 && type !== 'http' && type !== 'https';\n};\n\nconst toImageDimensions = props => {\n if (props.shouldPreserveAspectRatio) {\n return `\n max-width: 100%;\n max-height: 100%;\n width: auto;\n height: auto;\n `;\n }\n return toDimension(pick(props, ['width', 'height']));\n};\n\nconst Image = styled.img`\n display: block;\n ${props => toImageDimensions(props)};\n`;\n\nclass RemoteImage extends PureComponent {\n static contextType = ImageContext;\n\n static propTypes = {\n imageURL: T.string,\n width: T.oneOfType([T.string, T.number]),\n height: T.oneOfType([T.string, T.number]),\n preserveAspectRatio: T.bool,\n title: T.string,\n };\n\n static defaultProps = {\n preserveAspectRatio: false,\n };\n\n constructor(props) {\n super(props);\n this.state = { imageDataURI: null, preserveAspectRatio: props.preserveAspectRatio };\n }\n\n componentDidMount() {\n this.getImage(this.props.imageURL);\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.imageURL !== this.props.imageURL) {\n this.getImage(this.props.imageURL);\n }\n if (prevProps.preserveAspectRatio !== this.props.preserveAspectRatio) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({ preserveAspectRatio: this.props.preserveAspectRatio });\n }\n }\n\n async getImage(imageURL) {\n const imageRegistry = this.context;\n if (imageRegistry) {\n try {\n const image = await imageRegistry.getByURL(imageURL);\n this.setState({ imageDataURI: image.dataURI });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error);\n }\n }\n }\n\n render() {\n const { imageDataURI } = this.state;\n const { width, height, title } = this.props;\n\n if (!imageDataURI) {\n return null;\n }\n return (\n <Image\n src={imageDataURI}\n shouldPreserveAspectRatio={this.state.preserveAspectRatio}\n width={width}\n height={height}\n alt={_(title)}\n onError={e => {\n e.target.alt = _('Image not found');\n }}\n />\n );\n }\n}\n\nexport default RemoteImage;\n", "\nimport * as defaultImport from \"react\";\nexport * from \"react\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"prop-types\";\nexport * from \"prop-types\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"styled-components\";\nexport * from \"styled-components\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"lodash/pick\";\nexport * from \"lodash/pick\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/ui-utils/i18n\";\nexport * from \"@splunk/ui-utils/i18n\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualization-context/ImageContext\";\nexport * from \"@splunk/visualization-context/ImageContext\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualizations-shared/style\";\nexport * from \"@splunk/visualizations-shared/style\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AACA,oBAA+B;AAC/B,0BAAc;AACd,IAAO,gBAAS,aAAa,gBAA8B,wBAAU;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAA,iBAA+B;AAC/B,+BAAc;AACd,IAAO,qBAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,sCAAc;AACd,IAAO,4BAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,yBAAc;AACd,IAAO,eAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,yBAAc;AACd,IAAO,eAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,iCAAc;AACd,IAAO,uBAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,0BAAc;AACd,IAAO,gBAAS,aAAaA,iBAA8B,yBAAUA;;;APS9D,IAAM,gBAAgB,CAAC,MAAM,OAAO;AACvC,QAAM,CAAC,IAAI,IAAI,IAAI,MAAM,KAAK;AAC9B,SAAO,IAAI,QAAQ,KAAK,IAAI,MAAM,SAA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MAAM;AAAA,QACtC;AAAA,QACA;AAAA,QACA,SAAK,gBAAE,KAAK;AAAA,QACZ,SAAS,OAAK;AACV,YAAE,OAAO,UAAM,gBAAE,iBAAiB;AAAA,QACtC;AAAA;AAAA,IACJ;AAAA,EAER;AACJ;AAlEI,cADE,aACK,eAAc;AAErB,cAHE,aAGK,aAAY;AAAA,EACf,UAAU,mBAAE;AAAA,EACZ,OAAO,mBAAE,UAAU,CAAC,mBAAE,QAAQ,mBAAE,MAAM,CAAC;AAAA,EACvC,QAAQ,mBAAE,UAAU,CAAC,mBAAE,QAAQ,mBAAE,MAAM,CAAC;AAAA,EACxC,qBAAqB,mBAAE;AAAA,EACvB,OAAO,mBAAE;AACb;AAEA,cAXE,aAWK,gBAAe;AAAA,EAClB,qBAAqB;AACzB;AAwDJ,IAAO,sBAAQ;",
6
+ "names": ["defaultImport", "defaultImport", "defaultImport", "defaultImport", "defaultImport", "defaultImport"]
7
+ }
package/SanitizeProps.js CHANGED
@@ -1,261 +1,140 @@
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 = 46);
91
- /******/ })
92
- /************************************************************************/
93
- /******/ ({
94
-
95
- /***/ 1:
96
- /***/ (function(module, exports) {
97
-
98
- module.exports = require("react");
99
-
100
- /***/ }),
101
-
102
- /***/ 25:
103
- /***/ (function(module, exports, __webpack_require__) {
104
-
105
- "use strict";
106
-
107
-
108
- Object.defineProperty(exports, "__esModule", {
109
- value: true
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]);
21
+ }
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 });
33
+ }
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
+
47
+ // src/SanitizeProps.tsx
48
+ var SanitizeProps_exports = {};
49
+ __export(SanitizeProps_exports, {
50
+ sanitize: () => sanitize,
51
+ withSanitizedProps: () => withSanitizedProps
110
52
  });
111
- exports.sanitizeArrayOfColors = exports.isArrayOfColors = exports.isColor = void 0;
112
-
113
- var colorUtils_1 = __webpack_require__(26);
53
+ module.exports = __toCommonJS(SanitizeProps_exports);
114
54
 
115
- Object.defineProperty(exports, "isColor", {
116
- enumerable: true,
117
- get: function get() {
118
- return colorUtils_1.isColor;
119
- }
55
+ // esm-externals:react
56
+ var react_exports = {};
57
+ __export(react_exports, {
58
+ default: () => react_default
120
59
  });
121
- Object.defineProperty(exports, "isArrayOfColors", {
122
- enumerable: true,
123
- get: function get() {
124
- return colorUtils_1.isArrayOfColors;
125
- }
60
+ var defaultImport = __toESM(require("react"));
61
+ __reExport(react_exports, require("react"));
62
+ var react_default = "default" in defaultImport ? defaultImport.default : defaultImport;
63
+
64
+ // esm-externals:lodash
65
+ var lodash_exports = {};
66
+ __export(lodash_exports, {
67
+ default: () => lodash_default
126
68
  });
127
- Object.defineProperty(exports, "sanitizeArrayOfColors", {
128
- enumerable: true,
129
- get: function get() {
130
- return colorUtils_1.sanitizeArrayOfColors;
131
- }
69
+ var defaultImport2 = __toESM(require("lodash"));
70
+ __reExport(lodash_exports, require("lodash"));
71
+ var lodash_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
72
+
73
+ // esm-externals:@splunk/visualization-encoding/utils/colorUtils
74
+ var colorUtils_exports = {};
75
+ __export(colorUtils_exports, {
76
+ default: () => colorUtils_default
132
77
  });
78
+ var defaultImport3 = __toESM(require("@splunk/visualization-encoding/utils/colorUtils"));
79
+ __reExport(colorUtils_exports, require("@splunk/visualization-encoding/utils/colorUtils"));
80
+ var colorUtils_default = "default" in defaultImport3 ? defaultImport3.default : defaultImport3;
133
81
 
134
- /***/ }),
135
-
136
- /***/ 26:
137
- /***/ (function(module, exports) {
138
-
139
- module.exports = require("@splunk/visualization-encoding/utils/colorUtils");
140
-
141
- /***/ }),
142
-
143
- /***/ 4:
144
- /***/ (function(module, exports) {
145
-
146
- module.exports = require("lodash");
147
-
148
- /***/ }),
149
-
150
- /***/ 46:
151
- /***/ (function(module, exports, __webpack_require__) {
152
-
153
- "use strict";
154
-
155
-
156
- Object.defineProperty(exports, "__esModule", {
157
- value: true
158
- });
159
- exports.withSanitizedProps = exports.sanitize = void 0;
160
- /* eslint-disable no-param-reassign */
161
-
162
- var React = __webpack_require__(1);
163
-
164
- var lodash_1 = __webpack_require__(4);
165
-
166
- var colorUtils_1 = __webpack_require__(25);
167
-
82
+ // src/SanitizeProps.tsx
168
83
  var propsKeyValidators = {
169
- backgroundColor: colorUtils_1.isColor,
170
- deltaColor: colorUtils_1.isColor,
171
- trendColor: colorUtils_1.isColor,
172
- fontColor: colorUtils_1.isColor,
173
- fillColor: colorUtils_1.isColor,
174
- gaugeColor: colorUtils_1.isColor,
175
- majorColor: colorUtils_1.isColor,
176
- radialBackgroundColor: colorUtils_1.isColor,
177
- radialStrokeColor: colorUtils_1.isColor,
178
- sparklineFillColor: colorUtils_1.isColor,
179
- sparklineStrokeColor: colorUtils_1.isColor,
180
- strokeColor: colorUtils_1.isColor,
181
- strokeHighlightColor: colorUtils_1.isColor,
182
- headerBackgroundColor: colorUtils_1.isColor,
183
- rowBackgroundColorOdd: colorUtils_1.isColor,
184
- rowBackgroundColorEven: colorUtils_1.isColor,
185
- headerTextColor: colorUtils_1.isColor,
186
- rowTextColorOdd: colorUtils_1.isColor,
187
- rowTextColorEven: colorUtils_1.isColor,
188
- color: colorUtils_1.isColor,
189
- textColor: colorUtils_1.isColor,
190
- defaultFontColor: colorUtils_1.isColor,
191
- defaultBlockFontColor: colorUtils_1.isColor,
192
- sparklineAreaColor: colorUtils_1.isColor,
193
- iconColor: colorUtils_1.isColor,
194
- areaColor: colorUtils_1.isColor,
195
- nodeColor: colorUtils_1.isColor,
196
- nodeHighlightColor: colorUtils_1.isColor,
197
- linkColor: colorUtils_1.isColor,
198
- nodeTextColor: colorUtils_1.isColor,
199
- nodeTextHighlightColor: colorUtils_1.isColor,
200
- trellisBackgroundColor: colorUtils_1.isColor
84
+ backgroundColor: colorUtils_exports.isColor,
85
+ deltaColor: colorUtils_exports.isColor,
86
+ // SV react-visualizations & dashboard-visualizations
87
+ trendColor: colorUtils_exports.isColor,
88
+ // SV visualizations
89
+ fontColor: colorUtils_exports.isColor,
90
+ fillColor: colorUtils_exports.isColor,
91
+ gaugeColor: colorUtils_exports.isColor,
92
+ majorColor: colorUtils_exports.isColor,
93
+ radialBackgroundColor: colorUtils_exports.isColor,
94
+ radialStrokeColor: colorUtils_exports.isColor,
95
+ sparklineFillColor: colorUtils_exports.isColor,
96
+ sparklineStrokeColor: colorUtils_exports.isColor,
97
+ strokeColor: colorUtils_exports.isColor,
98
+ strokeHighlightColor: colorUtils_exports.isColor,
99
+ headerBackgroundColor: colorUtils_exports.isColor,
100
+ rowBackgroundColorOdd: colorUtils_exports.isColor,
101
+ rowBackgroundColorEven: colorUtils_exports.isColor,
102
+ headerTextColor: colorUtils_exports.isColor,
103
+ rowTextColorOdd: colorUtils_exports.isColor,
104
+ rowTextColorEven: colorUtils_exports.isColor,
105
+ color: colorUtils_exports.isColor,
106
+ textColor: colorUtils_exports.isColor,
107
+ defaultFontColor: colorUtils_exports.isColor,
108
+ defaultBlockFontColor: colorUtils_exports.isColor,
109
+ sparklineAreaColor: colorUtils_exports.isColor,
110
+ iconColor: colorUtils_exports.isColor,
111
+ areaColor: colorUtils_exports.isColor,
112
+ nodeColor: colorUtils_exports.isColor,
113
+ nodeHighlightColor: colorUtils_exports.isColor,
114
+ linkColor: colorUtils_exports.isColor,
115
+ nodeTextColor: colorUtils_exports.isColor,
116
+ nodeTextHighlightColor: colorUtils_exports.isColor,
117
+ trellisBackgroundColor: colorUtils_exports.isColor
201
118
  };
202
- /**
203
- * Validates if a given key value pair are valid
204
- * based on a set of predefined rules.
205
- *
206
- * @param {string} key
207
- * @param {string} value
208
- * @returns {boolean}
209
- */
210
-
211
119
  function isValidProperty(key, value) {
212
- var hasOwnProperty = Object.prototype.hasOwnProperty;
120
+ const { hasOwnProperty } = Object.prototype;
213
121
  return hasOwnProperty.call(propsKeyValidators, key) ? propsKeyValidators[key](value) : true;
214
122
  }
215
- /**
216
- * Validates every property in the key and return
217
- * only valid keys
218
- *
219
- * @export
220
- * @template T
221
- * @param {T} props
222
- * @returns {Partial<T>}
223
- */
224
-
225
-
226
123
  function sanitize(props) {
227
- return Object.keys(props).reduce(function (accum, key) {
228
- if (key === 'options' && (0, lodash_1.isPlainObject)(props.options)) {
124
+ return Object.keys(props).reduce((accum, key) => {
125
+ if (key === "options" && (0, lodash_exports.isPlainObject)(props.options)) {
229
126
  accum[key] = sanitize(props.options);
230
127
  } else if (isValidProperty(key, props[key])) {
231
128
  accum[key] = props[key];
232
129
  }
233
-
234
130
  return accum;
235
131
  }, {});
236
132
  }
237
-
238
- exports.sanitize = sanitize;
239
- /**
240
- * Helper HOC which will sanitize invalid props
241
- *
242
- * @export
243
- * @param {React.ComponentType} WrappedComponent
244
- * @returns {React.ComponentType}
245
- */
246
-
247
133
  function withSanitizedProps(WrappedComponent) {
248
- var Wrapper = function Wrapper(props) {
249
- var sanitizedProps = sanitize(props);
250
- return React.createElement(WrappedComponent, Object.assign({}, sanitizedProps));
134
+ const Wrapper = (props) => {
135
+ const sanitizedProps = sanitize(props);
136
+ return /* @__PURE__ */ react_exports.createElement(WrappedComponent, __spreadValues({}, sanitizedProps));
251
137
  };
252
-
253
138
  return Wrapper;
254
139
  }
255
-
256
- exports.withSanitizedProps = withSanitizedProps;
257
-
258
- /***/ })
259
-
260
- /******/ });
261
- //# sourceMappingURL=SanitizeProps.js.map
140
+ //# sourceMappingURL=SanitizeProps.js.map
@@ -1 +1,7 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///./src/colorUtils.ts","webpack:///external \"@splunk/visualization-encoding/utils/colorUtils\"","webpack:///external \"lodash\"","webpack:///./src/SanitizeProps.tsx"],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,kC;;;;;;;;;;;;;;;AC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ACpB,MAAM,CAAC,SADa,CACvC,cADuC;AAE/C,SAAO,cAAc,CAAC,IAAf,CAAoB,kBAApB,EAAwC,GAAxC,IAA+C,kBAAkB,CAAC,GAAD,CAAlB,CAAwB,KAAxB,CAA/C,GAAgF,IAAvF;AACH;AAED;;;;;;;;AAQG;;;AACH,SAAgB,QAAhB,CAAwD,KAAxD,EAAgE;AAC5D,SAAO,MAAM,CAAC,IAAP,CAAY,KAAZ,EAAmB,MAAnB,CAA0B,UAAC,KAAD,EAAQ,GAAR,EAAe;AAC5C,QAAI,GAAG,KAAK,SAAR,IAAqB,4BAAc,KAAK,CAAC,OAApB,CAAzB,EAAuD;AACnD,WAAK,CAAC,GAAD,CAAL,GAAa,QAAQ,CAAC,KAAK,CAAC,OAAP,CAArB;AACH,KAFD,MAEO,IAAI,eAAe,CAAC,GAAD,EAAM,KAAK,CAAC,GAAD,CAAX,CAAnB,EAAsC;AACzC,WAAK,CAAC,GAAD,CAAL,GAAa,KAAK,CAAC,GAAD,CAAlB;AACH;;AACD,WAAO,KAAP;AACH,GAPM,EAOJ,EAPI,CAAP;AAQH;;AATD;AAWA;;;;;;AAMG;;AACH,SAAgB,kBAAhB,CACI,gBADJ,EAC4C;AAExC,MAAM,OAAO,GAAG,SAAV,OAAU,CAAC,KAAD,EAAa;AACzB,QAAM,cAAc,GAAG,QAAQ,CAAC,KAAD,CAA/B;AACA,WAAO,oBAAC,gBAAD,EAAiB,kBAAM,cAAN,CAAjB,CAAP;AACH,GAHD;;AAIA,SAAO,OAAP;AACH;;AARD,gD","file":"SanitizeProps.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 46);\n","module.exports = require(\"react\");","export {\n isColor,\n isArrayOfColors,\n sanitizeArrayOfColors,\n} from '@splunk/visualization-encoding/utils/colorUtils';\n","module.exports = require(\"@splunk/visualization-encoding/utils/colorUtils\");","module.exports = require(\"lodash\");","/* eslint-disable no-param-reassign */\nimport * as React from 'react';\nimport { isPlainObject } from 'lodash';\nimport { isColor } from './colorUtils';\n\nconst propsKeyValidators = {\n backgroundColor: isColor,\n deltaColor: isColor, // SV react-visualizations & dashboard-visualizations\n trendColor: isColor, // SV visualizations\n fontColor: isColor,\n fillColor: isColor,\n gaugeColor: isColor,\n majorColor: isColor,\n radialBackgroundColor: isColor,\n radialStrokeColor: isColor,\n sparklineFillColor: isColor,\n sparklineStrokeColor: isColor,\n strokeColor: isColor,\n strokeHighlightColor: isColor,\n headerBackgroundColor: isColor,\n rowBackgroundColorOdd: isColor,\n rowBackgroundColorEven: isColor,\n headerTextColor: isColor,\n rowTextColorOdd: isColor,\n rowTextColorEven: isColor,\n color: isColor,\n textColor: isColor,\n defaultFontColor: isColor,\n defaultBlockFontColor: isColor,\n sparklineAreaColor: isColor,\n iconColor: isColor,\n areaColor: isColor,\n nodeColor: isColor,\n nodeHighlightColor: isColor,\n linkColor: isColor,\n nodeTextColor: isColor,\n nodeTextHighlightColor: isColor,\n trellisBackgroundColor: isColor,\n};\n\n/**\n * Validates if a given key value pair are valid\n * based on a set of predefined rules.\n *\n * @param {string} key\n * @param {string} value\n * @returns {boolean}\n */\nfunction isValidProperty(key: string, value: string): boolean {\n const { hasOwnProperty } = Object.prototype;\n return hasOwnProperty.call(propsKeyValidators, key) ? propsKeyValidators[key](value) : true;\n}\n\n/**\n * Validates every property in the key and return\n * only valid keys\n *\n * @export\n * @template T\n * @param {T} props\n * @returns {Partial<T>}\n */\nexport function sanitize<T extends Record<string, any>>(props: T): Partial<T> {\n return Object.keys(props).reduce((accum, key) => {\n if (key === 'options' && isPlainObject(props.options)) {\n accum[key] = sanitize(props.options);\n } else if (isValidProperty(key, props[key])) {\n accum[key] = props[key];\n }\n return accum;\n }, {});\n}\n\n/**\n * Helper HOC which will sanitize invalid props\n *\n * @export\n * @param {React.ComponentType} WrappedComponent\n * @returns {React.ComponentType}\n */\nexport function withSanitizedProps<T>(\n WrappedComponent: React.ComponentType<T>\n): React.ComponentType<Partial<T>> {\n const Wrapper = (props: T) => {\n const sanitizedProps = sanitize(props);\n return <WrappedComponent {...(sanitizedProps as T)} />;\n };\n return Wrapper;\n}\n"],"sourceRoot":""}
1
+ {
2
+ "version": 3,
3
+ "sources": ["src/SanitizeProps.tsx", "esm-externals:react", "esm-externals:lodash", "esm-externals:@splunk/visualization-encoding/utils/colorUtils"],
4
+ "sourcesContent": ["/* eslint-disable no-param-reassign */\nimport * as React from 'react';\nimport { isPlainObject } from 'lodash';\nimport { isColor } from './colorUtils';\n\nconst propsKeyValidators = {\n backgroundColor: isColor,\n deltaColor: isColor, // SV react-visualizations & dashboard-visualizations\n trendColor: isColor, // SV visualizations\n fontColor: isColor,\n fillColor: isColor,\n gaugeColor: isColor,\n majorColor: isColor,\n radialBackgroundColor: isColor,\n radialStrokeColor: isColor,\n sparklineFillColor: isColor,\n sparklineStrokeColor: isColor,\n strokeColor: isColor,\n strokeHighlightColor: isColor,\n headerBackgroundColor: isColor,\n rowBackgroundColorOdd: isColor,\n rowBackgroundColorEven: isColor,\n headerTextColor: isColor,\n rowTextColorOdd: isColor,\n rowTextColorEven: isColor,\n color: isColor,\n textColor: isColor,\n defaultFontColor: isColor,\n defaultBlockFontColor: isColor,\n sparklineAreaColor: isColor,\n iconColor: isColor,\n areaColor: isColor,\n nodeColor: isColor,\n nodeHighlightColor: isColor,\n linkColor: isColor,\n nodeTextColor: isColor,\n nodeTextHighlightColor: isColor,\n trellisBackgroundColor: isColor,\n};\n\n/**\n * Validates if a given key value pair are valid\n * based on a set of predefined rules.\n *\n * @param {string} key\n * @param {string} value\n * @returns {boolean}\n */\nfunction isValidProperty(key: string, value: string): boolean {\n const { hasOwnProperty } = Object.prototype;\n return hasOwnProperty.call(propsKeyValidators, key) ? propsKeyValidators[key](value) : true;\n}\n\n/**\n * Validates every property in the key and return\n * only valid keys\n *\n * @export\n * @template T\n * @param {T} props\n * @returns {Partial<T>}\n */\nexport function sanitize<T extends Record<string, any>>(props: T): Partial<T> {\n return Object.keys(props).reduce((accum, key) => {\n if (key === 'options' && isPlainObject(props.options)) {\n accum[key] = sanitize(props.options);\n } else if (isValidProperty(key, props[key])) {\n accum[key] = props[key];\n }\n return accum;\n }, {});\n}\n\n/**\n * Helper HOC which will sanitize invalid props\n *\n * @export\n * @param {React.ComponentType} WrappedComponent\n * @returns {React.ComponentType}\n */\nexport function withSanitizedProps<T>(\n WrappedComponent: React.ComponentType<T>\n): React.ComponentType<Partial<T>> {\n const Wrapper = (props: T) => {\n const sanitizedProps = sanitize(props);\n return <WrappedComponent {...(sanitizedProps as T)} />;\n };\n return Wrapper;\n}\n", "\nimport * as defaultImport from \"react\";\nexport * from \"react\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"lodash\";\nexport * from \"lodash\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualization-encoding/utils/colorUtils\";\nexport * from \"@splunk/visualization-encoding/utils/colorUtils\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AACA,oBAA+B;AAC/B,0BAAc;AACd,IAAO,gBAAS,aAAa,gBAA8B,wBAAU;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAA,iBAA+B;AAC/B,2BAAc;AACd,IAAO,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