@splunk/dynamic-editors 0.37.2 → 0.37.4

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 (68) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/DynamicEditor.js +88 -88
  3. package/DynamicEditor.js.map +1 -1
  4. package/containers/EditorItem.js +56 -56
  5. package/containers/EditorItem.js.map +1 -1
  6. package/containers/EditorLayout.js +112 -112
  7. package/containers/EditorLayout.js.map +1 -1
  8. package/containers/EditorLayoutItem.js +108 -108
  9. package/containers/EditorLayoutItem.js.map +1 -1
  10. package/containers/EncodingItem.js +1 -1
  11. package/containers/EncodingItem.js.map +1 -1
  12. package/editors/AdvancedConfigCard.js +4 -4
  13. package/editors/AdvancedConfigCard.js.map +1 -1
  14. package/editors/ArrayOfStringsEditor.js +2 -2
  15. package/editors/ArrayOfStringsEditor.js.map +1 -1
  16. package/editors/CheckboxEditor.js +7 -7
  17. package/editors/CheckboxEditor.js.map +1 -1
  18. package/editors/ColorEditor.js +8 -8
  19. package/editors/ColorEditor.js.map +1 -1
  20. package/editors/ColumnMultiSelectionByFieldNameEditor.js +2 -2
  21. package/editors/ColumnMultiSelectionByFieldNameEditor.js.map +1 -1
  22. package/editors/ColumnMultiSelectionEditor.js +1 -1
  23. package/editors/ColumnMultiSelectionEditor.js.map +1 -1
  24. package/editors/ColumnSelectionEditor.js +2 -2
  25. package/editors/ColumnSelectionEditor.js.map +1 -1
  26. package/editors/DynamicColorEditor.js +3 -3
  27. package/editors/DynamicColorEditor.js.map +1 -1
  28. package/editors/DynamicColorEditorWithPrecedence.js +5 -5
  29. package/editors/DynamicColorEditorWithPrecedence.js.map +1 -1
  30. package/editors/DynamicItemEditor.js +4 -4
  31. package/editors/DynamicItemEditor.js.map +1 -1
  32. package/editors/ImageEditor.js +5 -5
  33. package/editors/ImageEditor.js.map +1 -1
  34. package/editors/MarkdownEditor.js +1 -1
  35. package/editors/MarkdownEditor.js.map +1 -1
  36. package/editors/MultiColorPickerEditor.js +13 -13
  37. package/editors/MultiColorPickerEditor.js.map +1 -1
  38. package/editors/NumberEditor.js +1 -1
  39. package/editors/NumberEditor.js.map +1 -1
  40. package/editors/PercentEditor.js +3 -3
  41. package/editors/PercentEditor.js.map +1 -1
  42. package/editors/PresetSelectorEditor.js +1 -1
  43. package/editors/PresetSelectorEditor.js.map +1 -1
  44. package/editors/RadioBarEditor.js +2 -2
  45. package/editors/RadioBarEditor.js.map +1 -1
  46. package/editors/SelectEditor.js +4 -4
  47. package/editors/SelectEditor.js.map +1 -1
  48. package/editors/SeriesColorsByFieldEditor.js +13 -13
  49. package/editors/SeriesColorsByFieldEditor.js.map +1 -1
  50. package/editors/SeriesColorsEditor.js +16 -16
  51. package/editors/SeriesColorsEditor.js.map +1 -1
  52. package/editors/SliderEditor.js +1 -1
  53. package/editors/SliderEditor.js.map +1 -1
  54. package/editors/StaticItemEditor.js +6 -6
  55. package/editors/StaticItemEditor.js.map +1 -1
  56. package/editors/TableColumnFormatterEditor.js +54 -54
  57. package/editors/TableColumnFormatterEditor.js.map +1 -1
  58. package/editors/TextAreaEditor.js +1 -1
  59. package/editors/TextAreaEditor.js.map +1 -1
  60. package/editors/TextEditor.js +4 -4
  61. package/editors/TextEditor.js.map +1 -1
  62. package/editors/ThresholdEditor.js +22 -22
  63. package/editors/ThresholdEditor.js.map +1 -1
  64. package/editors/ToggleEditor.js +1 -1
  65. package/editors/ToggleEditor.js.map +1 -1
  66. package/package.json +2 -2
  67. package/shared/AdvancedControlGroup.js +2 -2
  68. package/shared/AdvancedControlGroup.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ImageEditor.js","mappings":";;;;6EAAA,gBA0BS,EAAAA,wBAtBuB,CAACC,EAAaC,EAA8B,UACxE,MAAOC,EAAWC,IAAgB,IAAAC,UAAwBH,GAkB1D,OAjBA,IAAAI,YAAU,KACN,MAAMC,EAAmBC,IAChBA,EAAEC,aAAeR,GAAOO,EAAEC,aAAe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AwDbyH,CAAatB,EAAenG,GAE9CsG,EAAW7G,EAAI8H,SACff,EAAY/G,EAAI+H,SAASvB,KAC7B,GAGJyB,EAAc,GACf,CAAC1H,EAAOmG,IAGPtI,IAAAA,cAAC8J,IAAY,CAAClM,MAAOA,EAAOW,cAAeA,EAAeC,WAAYA,GACjE2D,EACGnC,IAAAA,cAAC+H,EAAc,CACX7C,SAAUwD,EACVvD,aAAcqD,EACdR,cAAesB,EACfrB,qBAAsBA,IAG1BjI,IAAAA,cAACuD,EAAiB,CACdsC,eAAgBA,EAChBF,gBAAiB0C,EACjBhE,kBAAmBgF,IAGhB,EAIvBlB,EAAY5I,UAAY,CAQpB2G,SAAU1G,IAAAA,KAAOuK,WAIjB3B,KAAM5I,IAAAA,OAASuK,WAIfnM,MAAO4B,IAAAA,OAASuK,WAIhB5H,MAAO3C,IAAAA,OAIPjB,cAAeiB,IAAAA,MAAQ,CAAC,MAAO,SAC/BhB,WAAYgB,IAAAA,OAIZ6I,gBAAiB7I,IAAAA,MAIjBqG,eAAgBrG,IAAAA,KAIhByI,qBAAsBzI,IAAAA,QAG1B2I,EAAYvI,aAAe,CACvBrB,cAAe,OAGnB,S","sources":["webpack://@splunk/dynamic-editors/./src/hooks/useCSPViolationObserver.tsx","webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/./src/shared/CSPMessage.tsx","webpack://@splunk/dynamic-editors/./src/shared/MessageContainer.tsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/defineProperty\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/Cross\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/SlidersDoubleHorizontal\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Button\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ControlGroup\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Link\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Message\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Text\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Tooltip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-context/FeatureFlagContext\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-context/MessageContext\"","webpack://@splunk/dynamic-editors/external commonjs2 \"lodash\"","webpack://@splunk/dynamic-editors/external commonjs2 \"prop-types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react\"","webpack://@splunk/dynamic-editors/external commonjs2 \"styled-components\"","webpack://@splunk/dynamic-editors/webpack/bootstrap","webpack://@splunk/dynamic-editors/webpack/runtime/compat get default export","webpack://@splunk/dynamic-editors/webpack/runtime/define property getters","webpack://@splunk/dynamic-editors/webpack/runtime/hasOwnProperty shorthand","webpack://@splunk/dynamic-editors/webpack/runtime/make namespace object","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-context/ImageContext\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Image\"","webpack://@splunk/dynamic-editors/./src/components/UploadImageEditor.jsx","webpack://@splunk/dynamic-editors/./src/components/ImageThumbnail.jsx","webpack://@splunk/dynamic-editors/./src/editors/ImageEditor.jsx"],"sourcesContent":["import { useState, useEffect } from 'react';\n\ntype ViolationType = 'error' | 'warning' | 'none';\n\nconst useCSPViolationObserver = (src: string, defaultValue: ViolationType = 'none'): ViolationType => {\n const [violation, setViolation] = useState<ViolationType>(defaultValue);\n useEffect(() => {\n const violationHandler = e => {\n if ((e.blockedURI === src || e.blockedURI === `${src}/`) && e.disposition === 'enforce') {\n // the second src condition is required as Chrome rewrites\n // URLs without query parameters (e.g. foo.com -> foo.com/ )\n setViolation('error');\n } else if ((e.blockedURI === src || e.blockedURI === `${src}/`) && e.disposition === 'report') {\n setViolation('warning');\n }\n };\n document.addEventListener('securitypolicyviolation', violationHandler);\n setViolation(defaultValue);\n return () => {\n document.removeEventListener('securitypolicyviolation', violationHandler);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [src]);\n return violation;\n};\n\nexport { useCSPViolationObserver };\n","import React, { Children, cloneElement, ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport Button, { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport SUIControlGroup, { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nAdvancedControlGroup.defaultProps = {\n isAdvanced: false,\n};\n\nexport default AdvancedControlGroup;\n","import * as React from 'react';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Message from '@splunk/react-ui/Message';\nimport Link from '@splunk/react-ui/Link';\nimport MessageContext from '@splunk/visualization-context/MessageContext';\n\nexport type CSPMessageProps = { type: 'warning' | 'error' };\n\nexport const CSPMessage = ({ type }: CSPMessageProps) => {\n const { cspMessageLink } = React.useContext(MessageContext) as Record<string, string>; // NOSONAR\n return (\n <Message appearance=\"fill\" type={type} data-test={`csp-message-${type}`}>\n {_(\n 'External image URLs must now have their domains listed in the Dashboards Trusted Domains List by working with your administrator. Alternatively, you can upload the image directly into the dashboard. '\n )}\n {cspMessageLink && (\n <Link to={cspMessageLink} openInNewContext>\n {_('Learn more')}\n </Link>\n )}\n </Message>\n );\n};\n","import styled from 'styled-components';\n\nexport const MessageContainer = styled.div`\n margin-top: 10px;\n`;\n","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@splunk/react-icons/Cross\");","module.exports = require(\"@splunk/react-icons/SlidersDoubleHorizontal\");","module.exports = require(\"@splunk/react-ui/Button\");","module.exports = require(\"@splunk/react-ui/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Link\");","module.exports = require(\"@splunk/react-ui/Message\");","module.exports = require(\"@splunk/react-ui/Text\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/visualization-context/FeatureFlagContext\");","module.exports = require(\"@splunk/visualization-context/MessageContext\");","module.exports = require(\"lodash\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"styled-components\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@splunk/visualization-context/ImageContext\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@splunk/react-ui/Image\");","import React, { Component } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Message from '@splunk/react-ui/Message';\nimport Text from '@splunk/react-ui/Text';\nimport ImageFileReader from '@splunk/react-ui/Image';\nimport FeatureFlagContext from '@splunk/visualization-context/FeatureFlagContext';\nimport { memoize } from 'lodash';\nimport { CSPMessage } from '../shared/CSPMessage';\n\nconst EditorContainer = styled.div`\n padding-bottom: 5px;\n width: 100%;\n text-align: center;\n`;\n\nconst textStyle = { marginBottom: 10 };\nconst imageFileReaderStyle = { width: '100%' };\nconst SharingWarning = styled.span`\n font-size: smaller;\n font-style: italic;\n`;\n\nexport const warningText = _(\n 'Note: Uploaded image files can be accessed and deleted by others in your organization'\n);\n\nexport const calculateAllowedImageFileTypes = memoize(\n (mediaTypes, enableSVGImageUpload) => {\n const allowedImageFileTypes = mediaTypes.slice();\n if (enableSVGImageUpload) {\n if (allowedImageFileTypes.indexOf('svg') === -1) {\n allowedImageFileTypes.push('svg');\n }\n } else {\n // if enableSVGImageUpload is set to false, then remove the svg upload capability\n const index = allowedImageFileTypes.indexOf('svg');\n if (index > -1) {\n allowedImageFileTypes.splice(index, 1);\n }\n }\n return allowedImageFileTypes;\n },\n (mediaTypes, enableSVGImageUpload) => `${enableSVGImageUpload}-${mediaTypes.join('-')}`\n);\n\nclass UploadImageEditor extends Component {\n static contextType = FeatureFlagContext;\n\n constructor(props) {\n super(props);\n this.state = {\n urlValue: '',\n validUrl: true,\n violationType: 'none',\n };\n\n // Reference to rendered SUI input clear button\n this.inputRef = React.createRef();\n }\n\n componentDidMount() {\n document.addEventListener('securitypolicyviolation', this.violationHandler);\n }\n\n componentWillUnmount() {\n document.removeEventListener('securitypolicyviolation', this.violationHandler);\n\n if (this.inputRef.current) {\n this.inputRef.current.removeEventListener('focusout', this.handleBlur);\n }\n }\n\n violationHandler = e => {\n if (\n (e.blockedURI === this.state.urlValue || e.blockedURI === `${this.state.urlValue}/`) &&\n e.disposition === 'enforce'\n ) {\n this.setState({\n violationType: 'error',\n });\n } else if (\n (e.blockedURI === this.state.urlValue || e.blockedURI === `${this.state.urlValue}/`) &&\n e.disposition === 'report'\n ) {\n this.setState({\n violationType: 'warning',\n });\n }\n };\n\n /**\n * Executes and passes the url to the callback function, handleImageUpload(), if the image url is valid, else sets the boolean validURL to false\n * @method checkImage\n * @param {String} src\n */\n checkImage = src => {\n if (!src) {\n return;\n }\n const img = new Image();\n img.onload = () => {\n this.props.handleImageUpload({ src });\n };\n img.onerror = () => {\n // Only set validUrl=false when there's a URL value in state\n this.setState(state => (!state.urlValue ? undefined : { validUrl: false }));\n };\n img.src = src;\n };\n\n /**\n * Callback to update text box value (url) on change\n * @method handleURLChange\n * @param {String} value\n * @param {Object} e\n */\n handleURLChange = (e, { value }) => {\n this.setState({\n urlValue: value,\n validUrl: true,\n violationType: 'none',\n });\n };\n\n /**\n * Checks if text key down is 'enter' and calls checkImage() accordingly\n * @method handleTextKeyDown\n * @param {Object} e\n */\n handleTextKeyDown = e => {\n if (e.key === 'Enter') {\n e.preventDefault();\n this.checkImage(this.state.urlValue);\n }\n };\n\n handleBlur = event => {\n // If the element taking focus from the input is in the input tree\n // then it's probably the clear button\n if (this.inputRef.current?.contains(event.relatedTarget)) {\n return;\n }\n\n this.checkImage(this.state.urlValue);\n };\n\n // Custom ref/event listener for the Text input because SUI uses a blur event\n // which doesn't bubble. By using focusout the event will bubble and the clear\n // button can prevent checking for an image while it has focus but doesn't\n // block the check if a user tabs through the button\n trackInputRef = element => {\n this.inputRef.current = element;\n if (element) {\n element.addEventListener('focusout', this.handleBlur);\n }\n };\n\n /**\n * Executes and passes the filename+dataURI to the callback function, handleImageUpload()\n * @method handleOnImageChange\n * @param {Object} {filename, dataURI}\n */\n handleOnImageChange = ({ filename, imageDataURI }) => {\n if (filename && imageDataURI) {\n this.props.handleImageUpload({ filename, imageDataURI });\n } else {\n this.props.handleImageUpload({ filename: null, imageDataURI: null });\n }\n };\n\n render() {\n const {\n enableImageFileUpload,\n enableSVGImageUpload,\n enableSvgHttpDownloader,\n enableGallerySharingWarning,\n } = this.context || {};\n const allowedImageFileTypes = calculateAllowedImageFileTypes(\n this.props.validImageTypes,\n enableSVGImageUpload\n );\n\n // 1. allowedImageFileTypes does not have svg, show URL Input Field\n // 2. allowedImageFileTypes has svg and svg is rendered as dom (ChoroplethSvg), then if feature flag enableSvgHttpDownloader is true, show URL Input Field\n // 3. allowedImageFileTypes has svg and svg is not rendered as dom but with <img> (Image Viz), show URL Input Field\n\n const shouldShowURLField =\n allowedImageFileTypes.indexOf('svg') < 0 ||\n (this.props.svgRenderAsDom &&\n allowedImageFileTypes.indexOf('svg') > -1 &&\n enableSvgHttpDownloader) ||\n (!this.props.svgRenderAsDom && allowedImageFileTypes.indexOf('svg') > -1);\n\n const errorMessage =\n this.state.violationType !== 'none' ? (\n <CSPMessage type={this.state.violationType} />\n ) : (\n <Message appearance=\"fill\" type=\"error\">\n {_(\"We can't find an image with this URL. Please enter a new URL.\")}\n </Message>\n );\n return (\n <EditorContainer>\n {shouldShowURLField && (\n <Text\n canClear\n value={this.state.urlValue}\n onChange={this.handleURLChange}\n onKeyDown={this.handleTextKeyDown}\n style={textStyle}\n elementRef={this.trackInputRef}\n />\n )}\n {this.state.validUrl\n ? enableImageFileUpload && (\n <React.Fragment>\n <ImageFileReader\n style={imageFileReaderStyle}\n defaultFilename={null}\n defaultImageDataURI={null}\n onImageChange={this.handleOnImageChange}\n allowExtensions={allowedImageFileTypes}\n />\n {enableGallerySharingWarning && (\n <SharingWarning data-test=\"gallery-sharing-warning\">\n {warningText}\n </SharingWarning>\n )}\n </React.Fragment>\n )\n : errorMessage}\n </EditorContainer>\n );\n }\n}\n\nUploadImageEditor.propTypes = {\n handleImageUpload: T.func,\n validImageTypes: T.array,\n svgRenderAsDom: T.bool,\n};\n\nUploadImageEditor.defaultProps = {\n handleImageUpload: () => {},\n validImageTypes: ['gif', 'jpeg', 'jpg', 'png', 'webp'],\n svgRenderAsDom: false,\n};\n\nexport default UploadImageEditor;\n","import React from 'react';\nimport styled from 'styled-components';\nimport T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Cross from '@splunk/react-icons/Cross';\nimport Button from '@splunk/react-ui/Button';\nimport { variables, mixins } from '@splunk/themes';\nimport { useCSPViolationObserver } from '../hooks/useCSPViolationObserver';\nimport { CSPMessage } from '../shared/CSPMessage';\nimport { MessageContainer } from '../shared/MessageContainer';\n\nconst RemoveButtonIcon = <Cross />;\n\nconst ImageUrlReaderContainer = styled.div`\n width: 100%;\n padding-bottom: 5px;\n`;\n\nconst StyledImagePreview = styled.div`\n border: 1px solid ${variables.borderColor};\n position: relative;\n min-height: 30px;\n height: auto;\n`;\n\nconst StyledTitleContainer = styled.div`\n background-color: ${variables.backgroundColorPage};\n color: ${variables.contentColorDefault};\n opacity: 0.9;\n position: absolute;\n width: 100%;\n min-height: 30px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n`;\n\nconst StyledTitle = styled.div`\n margin-left: ${variables.spacingMedium};\n overflow: hidden;\n text-align: start;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst StyledRemoveButton = styled(Button).attrs({\n 'data-test': 'image-remove-button',\n})`\n flex-grow: 0;\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.actionColorBackgroundSecondaryHover} !important;\n }\n`;\n\nconst StyledImageThumbnail = styled.img`\n ${mixins.reset('block')};\n margin: 0 auto;\n max-width: 100%;\n max-height: 180px;\n`;\n\nconst ImageThumbnail = ({ filename, imageDataURI, onImageRemove, overrideCSPViolation }) => {\n const violationType = useCSPViolationObserver(imageDataURI, overrideCSPViolation);\n\n return (\n <ImageUrlReaderContainer>\n <StyledImagePreview>\n <StyledTitleContainer>\n <StyledTitle>{filename}</StyledTitle>\n <StyledRemoveButton\n aria-label={_('Remove image')}\n appearance=\"subtle\"\n icon={RemoveButtonIcon}\n onClick={onImageRemove}\n />\n </StyledTitleContainer>\n <StyledImageThumbnail alt={filename} src={imageDataURI} />\n </StyledImagePreview>\n {violationType !== 'none' && (\n <MessageContainer>\n <CSPMessage type={violationType} />\n </MessageContainer>\n )}\n </ImageUrlReaderContainer>\n );\n};\n\nImageThumbnail.propTypes = {\n filename: T.string,\n imageDataURI: T.string,\n onImageRemove: T.func,\n overrideCSPViolation: T.string,\n};\n\nImageThumbnail.defaultProps = {\n onImageRemove: () => {},\n filename: null,\n imageDataURI: null,\n};\n\nexport default ImageThumbnail;\n","import React, { useContext, useEffect, useCallback, useState } from 'react';\nimport T from 'prop-types';\nimport ImageContext from '@splunk/visualization-context/ImageContext';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport UploadImageEditor from '../components/UploadImageEditor';\nimport ImageThumbnail from '../components/ImageThumbnail';\n\nconst getImageData = async (registry, value) => {\n if (registry?.isResourceURL(value)) {\n return registry.getByURL(value);\n }\n return { dataURI: value, metaData: { name: value } };\n};\n\nconst ImageEditor = ({\n onChange,\n name,\n value,\n labelPosition,\n labelWidth,\n label,\n validMediaTypes,\n svgRenderAsDom,\n overrideCSPViolation,\n}) => {\n const imageRegistry = useContext(ImageContext);\n const [dataUri, setDataUri] = useState(null);\n const [fileName, setFileName] = useState(null);\n\n const uploadImage = useCallback(\n async (file, imageDataUri) => {\n try {\n const imageId = await imageRegistry.upload(\n imageDataUri,\n { name: file },\n null,\n validMediaTypes\n );\n onChange(null, name, imageId);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn(error);\n }\n },\n [imageRegistry, validMediaTypes, onChange, name]\n );\n\n const handleUpload = useCallback(\n ({ src, filename: file, imageDataURI }) => {\n if (src) {\n return onChange(null, name, src);\n }\n\n if (file !== null && imageDataURI !== null) {\n return uploadImage(file, imageDataURI);\n }\n\n return onChange(null, name, null);\n },\n [uploadImage, onChange, name]\n );\n\n const handleRemove = useCallback(event => onChange(event, name, null), [onChange, name]);\n\n useEffect(() => {\n const populateData = async () => {\n if (value) {\n const obj = await getImageData(imageRegistry, value);\n\n setDataUri(obj.dataURI);\n setFileName(obj.metaData.name);\n }\n };\n\n populateData();\n }, [value, imageRegistry]);\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth}>\n {value ? (\n <ImageThumbnail\n filename={fileName}\n imageDataURI={dataUri}\n onImageRemove={handleRemove}\n overrideCSPViolation={overrideCSPViolation}\n />\n ) : (\n <UploadImageEditor\n svgRenderAsDom={svgRenderAsDom}\n validImageTypes={validMediaTypes}\n handleImageUpload={handleUpload}\n />\n )}\n </ControlGroup>\n );\n};\n\nImageEditor.propTypes = {\n /**\n * Callback when changing the text value\n *\n * @param {SyntheticEvent} event The react `SyntheticEvent`\n * @param {string} name The option name\n * @param {string} value The option value\n */\n onChange: T.func.isRequired,\n /**\n * The option name\n */\n name: T.string.isRequired,\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n /**\n * The option value\n */\n value: T.string,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['top', 'left']),\n labelWidth: T.number,\n /**\n * The valid media type\n */\n validMediaTypes: T.array,\n /**\n * Boolean to indicate if svg render in domNode directly\n */\n svgRenderAsDom: T.bool,\n /**\n * Simulate CSP Violation\n */\n overrideCSPViolation: T.string,\n};\n\nImageEditor.defaultProps = {\n labelPosition: 'top',\n};\n\nexport default ImageEditor;\n"],"names":["useCSPViolationObserver","src","defaultValue","violation","setViolation","useState","useEffect","violationHandler","e","blockedURI","disposition","document","addEventListener","removeEventListener","ControlGroupContainer","variables","spacingMedium","StyledToolTip","StyledAdvancedConfigButton","contentColorActive","interactiveColorOverlayDrag","AdvancedConfigButton","label","onClick","content","_","icon","appearance","AdvancedControlGroup","dataTest","children","isAdvanced","hideLabel","labelPosition","labelWidth","tooltip","help","style","error","controlsLayout","onAdvancedConfigButtonClick","Children","toArray","filter","Boolean","map","child","cloneElement","flex","propTypes","T","object","bool","func","defaultProps","CSPMessage","type","cspMessageLink","React","useContext","to","openInNewContext","MessageContainer","div","module","exports","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","value","EditorContainer","styled","textStyle","marginBottom","imageFileReaderStyle","width","SharingWarning","warningText","calculateAllowedImageFileTypes","memoize","mediaTypes","enableSVGImageUpload","allowedImageFileTypes","slice","indexOf","push","index","splice","join","UploadImageEditor","Component","constructor","props","super","_defineProperty","this","state","urlValue","setState","violationType","img","Image","onload","handleImageUpload","onerror","validUrl","preventDefault","checkImage","event","_this$inputRef$curren","inputRef","current","contains","relatedTarget","element","handleBlur","filename","imageDataURI","componentDidMount","componentWillUnmount","render","enableImageFileUpload","enableSvgHttpDownloader","enableGallerySharingWarning","context","validImageTypes","shouldShowURLField","svgRenderAsDom","errorMessage","Message","Text","canClear","onChange","handleURLChange","onKeyDown","handleTextKeyDown","elementRef","trackInputRef","ImageFileReader","defaultFilename","defaultImageDataURI","onImageChange","handleOnImageChange","allowExtensions","FeatureFlagContext","RemoveButtonIcon","Cross","ImageUrlReaderContainer","StyledImagePreview","borderColor","StyledTitleContainer","backgroundColorPage","contentColorDefault","StyledTitle","StyledRemoveButton","Button","attrs","actionColorBackgroundSecondaryHover","StyledImageThumbnail","mixins","reset","ImageThumbnail","onImageRemove","overrideCSPViolation","alt","ImageEditor","name","validMediaTypes","imageRegistry","ImageContext","dataUri","setDataUri","fileName","setFileName","uploadImage","useCallback","async","file","imageDataUri","imageId","upload","console","warn","handleUpload","handleRemove","registry","isResourceURL","getByURL","dataURI","metaData","getImageData","populateData","ControlGroup","isRequired"],"sourceRoot":""}
1
+ {"version":3,"file":"ImageEditor.js","mappings":";;;;6EAAA,gBA0BS,EAAAA,wBAtBuB,CAACC,EAAaC,EAA8B,UACxE,MAAOC,EAAWC,IAAgB,IAAAC,UAAwBH,GAkB1D,OAjBA,IAAAI,YAAU,KACN,MAAMC,EAAmBC,IAChBA,EAAEC,aAAeR,GAAOO,EAAEC,aAAe,GAAGR,MAA6B,YAAlBO,EAAEE,YAIlDF,EAAEC,aAAeR,GAAOO,EAAEC,aAAe,GAAGR,MAA6B,WAAlBO,EAAEE,aACjEN,EAAa,WAFbA,EAAa,QAGjB,EAIJ,OAFAO,SAASC,iBAAiB,0BAA2BL,GACrDH,EAAaF,GACN,KACHS,SAASE,oBAAoB,0BAA2BN,EAAiB,CAC5E,GAEF,CAACN,IACGE,CAAS,C,8zBCvBpB,mBACA,WACA,YACA,UACA,aACA,UACA,aACA,aACA,aAgBMW,GAAwB,aAAO,UAAgB;;;;qBAIhC,EAAAC,UAAUC;;;;;;;;;;;;;;;;EAmBzBC,GAAgB,aAAO,UAAQ;;;;;;EAQ/BC,GAA6B,aAAO,UAAoB;aACjD,EAAAH,UAAUI;;4BAEK,EAAAJ,UAAUK;;EAIzB,EAAAC,qBAAuB,EAChCC,QAAQ,GACRC,aAGI,wBAACN,E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AA,MAIjBoG,eAAgBpG,IAAAA,KAIhB0I,qBAAsB1I,IAAAA,QAG1B,S","sources":["webpack://@splunk/dynamic-editors/./src/hooks/useCSPViolationObserver.tsx","webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/./src/shared/CSPMessage.tsx","webpack://@splunk/dynamic-editors/./src/shared/MessageContainer.tsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/defineProperty\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/Cross\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/SlidersDoubleHorizontal\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Button\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ControlGroup\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Link\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Message\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Text\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Tooltip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-context/FeatureFlagContext\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-context/MessageContext\"","webpack://@splunk/dynamic-editors/external commonjs2 \"lodash\"","webpack://@splunk/dynamic-editors/external commonjs2 \"prop-types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react\"","webpack://@splunk/dynamic-editors/external commonjs2 \"styled-components\"","webpack://@splunk/dynamic-editors/webpack/bootstrap","webpack://@splunk/dynamic-editors/webpack/runtime/compat get default export","webpack://@splunk/dynamic-editors/webpack/runtime/define property getters","webpack://@splunk/dynamic-editors/webpack/runtime/hasOwnProperty shorthand","webpack://@splunk/dynamic-editors/webpack/runtime/make namespace object","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-context/ImageContext\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Image\"","webpack://@splunk/dynamic-editors/./src/components/UploadImageEditor.jsx","webpack://@splunk/dynamic-editors/./src/components/ImageThumbnail.jsx","webpack://@splunk/dynamic-editors/./src/editors/ImageEditor.jsx"],"sourcesContent":["import { useState, useEffect } from 'react';\n\ntype ViolationType = 'error' | 'warning' | 'none';\n\nconst useCSPViolationObserver = (src: string, defaultValue: ViolationType = 'none'): ViolationType => {\n const [violation, setViolation] = useState<ViolationType>(defaultValue);\n useEffect(() => {\n const violationHandler = e => {\n if ((e.blockedURI === src || e.blockedURI === `${src}/`) && e.disposition === 'enforce') {\n // the second src condition is required as Chrome rewrites\n // URLs without query parameters (e.g. foo.com -> foo.com/ )\n setViolation('error');\n } else if ((e.blockedURI === src || e.blockedURI === `${src}/`) && e.disposition === 'report') {\n setViolation('warning');\n }\n };\n document.addEventListener('securitypolicyviolation', violationHandler);\n setViolation(defaultValue);\n return () => {\n document.removeEventListener('securitypolicyviolation', violationHandler);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [src]);\n return violation;\n};\n\nexport { useCSPViolationObserver };\n","import React, { Children, cloneElement, ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport Button, { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport SUIControlGroup, { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced = false,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nexport default AdvancedControlGroup;\n","import * as React from 'react';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Message from '@splunk/react-ui/Message';\nimport Link from '@splunk/react-ui/Link';\nimport MessageContext from '@splunk/visualization-context/MessageContext';\n\nexport type CSPMessageProps = { type: 'warning' | 'error' };\n\nexport const CSPMessage = ({ type }: CSPMessageProps) => {\n const { cspMessageLink } = React.useContext(MessageContext) as Record<string, string>; // NOSONAR\n return (\n <Message appearance=\"fill\" type={type} data-test={`csp-message-${type}`}>\n {_(\n 'External image URLs must now have their domains listed in the Dashboards Trusted Domains List by working with your administrator. Alternatively, you can upload the image directly into the dashboard. '\n )}\n {cspMessageLink && (\n <Link to={cspMessageLink} openInNewContext>\n {_('Learn more')}\n </Link>\n )}\n </Message>\n );\n};\n","import styled from 'styled-components';\n\nexport const MessageContainer = styled.div`\n margin-top: 10px;\n`;\n","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@splunk/react-icons/Cross\");","module.exports = require(\"@splunk/react-icons/SlidersDoubleHorizontal\");","module.exports = require(\"@splunk/react-ui/Button\");","module.exports = require(\"@splunk/react-ui/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Link\");","module.exports = require(\"@splunk/react-ui/Message\");","module.exports = require(\"@splunk/react-ui/Text\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/visualization-context/FeatureFlagContext\");","module.exports = require(\"@splunk/visualization-context/MessageContext\");","module.exports = require(\"lodash\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"styled-components\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@splunk/visualization-context/ImageContext\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@splunk/react-ui/Image\");","import React, { Component } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Message from '@splunk/react-ui/Message';\nimport Text from '@splunk/react-ui/Text';\nimport ImageFileReader from '@splunk/react-ui/Image';\nimport FeatureFlagContext from '@splunk/visualization-context/FeatureFlagContext';\nimport { memoize } from 'lodash';\nimport { CSPMessage } from '../shared/CSPMessage';\n\nconst EditorContainer = styled.div`\n padding-bottom: 5px;\n width: 100%;\n text-align: center;\n`;\n\nconst textStyle = { marginBottom: 10 };\nconst imageFileReaderStyle = { width: '100%' };\nconst SharingWarning = styled.span`\n font-size: smaller;\n font-style: italic;\n`;\n\nexport const warningText = _(\n 'Note: Uploaded image files can be accessed and deleted by others in your organization'\n);\n\nexport const calculateAllowedImageFileTypes = memoize(\n (mediaTypes, enableSVGImageUpload) => {\n const allowedImageFileTypes = mediaTypes.slice();\n if (enableSVGImageUpload) {\n if (allowedImageFileTypes.indexOf('svg') === -1) {\n allowedImageFileTypes.push('svg');\n }\n } else {\n // if enableSVGImageUpload is set to false, then remove the svg upload capability\n const index = allowedImageFileTypes.indexOf('svg');\n if (index > -1) {\n allowedImageFileTypes.splice(index, 1);\n }\n }\n return allowedImageFileTypes;\n },\n (mediaTypes, enableSVGImageUpload) => `${enableSVGImageUpload}-${mediaTypes.join('-')}`\n);\n\nclass UploadImageEditor extends Component {\n static contextType = FeatureFlagContext;\n\n constructor(props) {\n super(props);\n this.state = {\n urlValue: '',\n validUrl: true,\n violationType: 'none',\n };\n\n // Reference to rendered SUI input clear button\n this.inputRef = React.createRef();\n }\n\n componentDidMount() {\n document.addEventListener('securitypolicyviolation', this.violationHandler);\n }\n\n componentWillUnmount() {\n document.removeEventListener('securitypolicyviolation', this.violationHandler);\n\n if (this.inputRef.current) {\n this.inputRef.current.removeEventListener('focusout', this.handleBlur);\n }\n }\n\n violationHandler = e => {\n if (\n (e.blockedURI === this.state.urlValue || e.blockedURI === `${this.state.urlValue}/`) &&\n e.disposition === 'enforce'\n ) {\n this.setState({\n violationType: 'error',\n });\n } else if (\n (e.blockedURI === this.state.urlValue || e.blockedURI === `${this.state.urlValue}/`) &&\n e.disposition === 'report'\n ) {\n this.setState({\n violationType: 'warning',\n });\n }\n };\n\n /**\n * Executes and passes the url to the callback function, handleImageUpload(), if the image url is valid, else sets the boolean validURL to false\n * @method checkImage\n * @param {String} src\n */\n checkImage = src => {\n if (!src) {\n return;\n }\n const img = new Image();\n img.onload = () => {\n this.props.handleImageUpload({ src });\n };\n img.onerror = () => {\n // Only set validUrl=false when there's a URL value in state\n this.setState(state => (!state.urlValue ? undefined : { validUrl: false }));\n };\n img.src = src;\n };\n\n /**\n * Callback to update text box value (url) on change\n * @method handleURLChange\n * @param {String} value\n * @param {Object} e\n */\n handleURLChange = (e, { value }) => {\n this.setState({\n urlValue: value,\n validUrl: true,\n violationType: 'none',\n });\n };\n\n /**\n * Checks if text key down is 'enter' and calls checkImage() accordingly\n * @method handleTextKeyDown\n * @param {Object} e\n */\n handleTextKeyDown = e => {\n if (e.key === 'Enter') {\n e.preventDefault();\n this.checkImage(this.state.urlValue);\n }\n };\n\n handleBlur = event => {\n // If the element taking focus from the input is in the input tree\n // then it's probably the clear button\n if (this.inputRef.current?.contains(event.relatedTarget)) {\n return;\n }\n\n this.checkImage(this.state.urlValue);\n };\n\n // Custom ref/event listener for the Text input because SUI uses a blur event\n // which doesn't bubble. By using focusout the event will bubble and the clear\n // button can prevent checking for an image while it has focus but doesn't\n // block the check if a user tabs through the button\n trackInputRef = element => {\n this.inputRef.current = element;\n if (element) {\n element.addEventListener('focusout', this.handleBlur);\n }\n };\n\n /**\n * Executes and passes the filename+dataURI to the callback function, handleImageUpload()\n * @method handleOnImageChange\n * @param {Object} {filename, dataURI}\n */\n handleOnImageChange = ({ filename, imageDataURI }) => {\n if (filename && imageDataURI) {\n this.props.handleImageUpload({ filename, imageDataURI });\n } else {\n this.props.handleImageUpload({ filename: null, imageDataURI: null });\n }\n };\n\n render() {\n const {\n enableImageFileUpload,\n enableSVGImageUpload,\n enableSvgHttpDownloader,\n enableGallerySharingWarning,\n } = this.context || {};\n const allowedImageFileTypes = calculateAllowedImageFileTypes(\n this.props.validImageTypes,\n enableSVGImageUpload\n );\n\n // 1. allowedImageFileTypes does not have svg, show URL Input Field\n // 2. allowedImageFileTypes has svg and svg is rendered as dom (ChoroplethSvg), then if feature flag enableSvgHttpDownloader is true, show URL Input Field\n // 3. allowedImageFileTypes has svg and svg is not rendered as dom but with <img> (Image Viz), show URL Input Field\n\n const shouldShowURLField =\n allowedImageFileTypes.indexOf('svg') < 0 ||\n (this.props.svgRenderAsDom &&\n allowedImageFileTypes.indexOf('svg') > -1 &&\n enableSvgHttpDownloader) ||\n (!this.props.svgRenderAsDom && allowedImageFileTypes.indexOf('svg') > -1);\n\n const errorMessage =\n this.state.violationType !== 'none' ? (\n <CSPMessage type={this.state.violationType} />\n ) : (\n <Message appearance=\"fill\" type=\"error\">\n {_(\"We can't find an image with this URL. Please enter a new URL.\")}\n </Message>\n );\n return (\n <EditorContainer>\n {shouldShowURLField && (\n <Text\n canClear\n value={this.state.urlValue}\n onChange={this.handleURLChange}\n onKeyDown={this.handleTextKeyDown}\n style={textStyle}\n elementRef={this.trackInputRef}\n />\n )}\n {this.state.validUrl\n ? enableImageFileUpload && (\n <React.Fragment>\n <ImageFileReader\n style={imageFileReaderStyle}\n defaultFilename={null}\n defaultImageDataURI={null}\n onImageChange={this.handleOnImageChange}\n allowExtensions={allowedImageFileTypes}\n />\n {enableGallerySharingWarning && (\n <SharingWarning data-test=\"gallery-sharing-warning\">\n {warningText}\n </SharingWarning>\n )}\n </React.Fragment>\n )\n : errorMessage}\n </EditorContainer>\n );\n }\n}\n\nUploadImageEditor.propTypes = {\n handleImageUpload: T.func,\n validImageTypes: T.array,\n svgRenderAsDom: T.bool,\n};\n\nUploadImageEditor.defaultProps = {\n handleImageUpload: () => {},\n validImageTypes: ['gif', 'jpeg', 'jpg', 'png', 'webp'],\n svgRenderAsDom: false,\n};\n\nexport default UploadImageEditor;\n","import React from 'react';\nimport styled from 'styled-components';\nimport T from 'prop-types';\nimport { noop } from 'lodash';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Cross from '@splunk/react-icons/Cross';\nimport Button from '@splunk/react-ui/Button';\nimport { variables, mixins } from '@splunk/themes';\nimport { useCSPViolationObserver } from '../hooks/useCSPViolationObserver';\nimport { CSPMessage } from '../shared/CSPMessage';\nimport { MessageContainer } from '../shared/MessageContainer';\n\nconst RemoveButtonIcon = <Cross />;\n\nconst ImageUrlReaderContainer = styled.div`\n width: 100%;\n padding-bottom: 5px;\n`;\n\nconst StyledImagePreview = styled.div`\n border: 1px solid ${variables.borderColor};\n position: relative;\n min-height: 30px;\n height: auto;\n`;\n\nconst StyledTitleContainer = styled.div`\n background-color: ${variables.backgroundColorPage};\n color: ${variables.contentColorDefault};\n opacity: 0.9;\n position: absolute;\n width: 100%;\n min-height: 30px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n`;\n\nconst StyledTitle = styled.div`\n margin-left: ${variables.spacingMedium};\n overflow: hidden;\n text-align: start;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst StyledRemoveButton = styled(Button).attrs({\n 'data-test': 'image-remove-button',\n})`\n flex-grow: 0;\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.actionColorBackgroundSecondaryHover} !important;\n }\n`;\n\nconst StyledImageThumbnail = styled.img`\n ${mixins.reset('block')};\n margin: 0 auto;\n max-width: 100%;\n max-height: 180px;\n`;\n\nconst ImageThumbnail = ({\n filename = null,\n imageDataURI = null,\n onImageRemove = noop,\n overrideCSPViolation,\n}) => {\n const violationType = useCSPViolationObserver(imageDataURI, overrideCSPViolation);\n\n return (\n <ImageUrlReaderContainer>\n <StyledImagePreview>\n <StyledTitleContainer>\n <StyledTitle>{filename}</StyledTitle>\n <StyledRemoveButton\n aria-label={_('Remove image')}\n appearance=\"subtle\"\n icon={RemoveButtonIcon}\n onClick={onImageRemove}\n />\n </StyledTitleContainer>\n <StyledImageThumbnail alt={filename} src={imageDataURI} />\n </StyledImagePreview>\n {violationType !== 'none' && (\n <MessageContainer>\n <CSPMessage type={violationType} />\n </MessageContainer>\n )}\n </ImageUrlReaderContainer>\n );\n};\n\nImageThumbnail.propTypes = {\n filename: T.string,\n imageDataURI: T.string,\n onImageRemove: T.func,\n overrideCSPViolation: T.string,\n};\n\nexport default ImageThumbnail;\n","import React, { useContext, useEffect, useCallback, useState } from 'react';\nimport T from 'prop-types';\nimport ImageContext from '@splunk/visualization-context/ImageContext';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport UploadImageEditor from '../components/UploadImageEditor';\nimport ImageThumbnail from '../components/ImageThumbnail';\n\nconst getImageData = async (registry, value) => {\n if (registry?.isResourceURL(value)) {\n return registry.getByURL(value);\n }\n return { dataURI: value, metaData: { name: value } };\n};\n\nconst ImageEditor = ({\n onChange,\n name,\n value,\n labelPosition = 'top',\n labelWidth,\n label,\n validMediaTypes,\n svgRenderAsDom,\n overrideCSPViolation,\n}) => {\n const imageRegistry = useContext(ImageContext);\n const [dataUri, setDataUri] = useState(null);\n const [fileName, setFileName] = useState(null);\n\n const uploadImage = useCallback(\n async (file, imageDataUri) => {\n try {\n const imageId = await imageRegistry.upload(\n imageDataUri,\n { name: file },\n null,\n validMediaTypes\n );\n onChange(null, name, imageId);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn(error);\n }\n },\n [imageRegistry, validMediaTypes, onChange, name]\n );\n\n const handleUpload = useCallback(\n ({ src, filename: file, imageDataURI }) => {\n if (src) {\n return onChange(null, name, src);\n }\n\n if (file !== null && imageDataURI !== null) {\n return uploadImage(file, imageDataURI);\n }\n\n return onChange(null, name, null);\n },\n [uploadImage, onChange, name]\n );\n\n const handleRemove = useCallback(event => onChange(event, name, null), [onChange, name]);\n\n useEffect(() => {\n const populateData = async () => {\n if (value) {\n const obj = await getImageData(imageRegistry, value);\n\n setDataUri(obj.dataURI);\n setFileName(obj.metaData.name);\n }\n };\n\n populateData();\n }, [value, imageRegistry]);\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth}>\n {value ? (\n <ImageThumbnail\n filename={fileName}\n imageDataURI={dataUri}\n onImageRemove={handleRemove}\n overrideCSPViolation={overrideCSPViolation}\n />\n ) : (\n <UploadImageEditor\n svgRenderAsDom={svgRenderAsDom}\n validImageTypes={validMediaTypes}\n handleImageUpload={handleUpload}\n />\n )}\n </ControlGroup>\n );\n};\n\nImageEditor.propTypes = {\n /**\n * Callback when changing the text value\n *\n * @param {SyntheticEvent} event The react `SyntheticEvent`\n * @param {string} name The option name\n * @param {string} value The option value\n */\n onChange: T.func.isRequired,\n /**\n * The option name\n */\n name: T.string.isRequired,\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n /**\n * The option value\n */\n value: T.string,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['top', 'left']),\n labelWidth: T.number,\n /**\n * The valid media type\n */\n validMediaTypes: T.array,\n /**\n * Boolean to indicate if svg render in domNode directly\n */\n svgRenderAsDom: T.bool,\n /**\n * Simulate CSP Violation\n */\n overrideCSPViolation: T.string,\n};\n\nexport default ImageEditor;\n"],"names":["useCSPViolationObserver","src","defaultValue","violation","setViolation","useState","useEffect","violationHandler","e","blockedURI","disposition","document","addEventListener","removeEventListener","ControlGroupContainer","variables","spacingMedium","StyledToolTip","StyledAdvancedConfigButton","contentColorActive","interactiveColorOverlayDrag","AdvancedConfigButton","label","onClick","content","_","icon","appearance","AdvancedControlGroup","dataTest","children","isAdvanced","hideLabel","labelPosition","labelWidth","tooltip","help","style","error","controlsLayout","onAdvancedConfigButtonClick","Children","toArray","filter","Boolean","map","child","cloneElement","flex","propTypes","T","object","bool","func","CSPMessage","type","cspMessageLink","React","useContext","to","openInNewContext","MessageContainer","div","module","exports","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","value","EditorContainer","styled","textStyle","marginBottom","imageFileReaderStyle","width","SharingWarning","warningText","calculateAllowedImageFileTypes","memoize","mediaTypes","enableSVGImageUpload","allowedImageFileTypes","slice","indexOf","push","index","splice","join","UploadImageEditor","Component","constructor","props","super","_defineProperty","this","state","urlValue","setState","violationType","img","Image","onload","handleImageUpload","onerror","validUrl","preventDefault","checkImage","event","_this$inputRef$curren","inputRef","current","contains","relatedTarget","element","handleBlur","filename","imageDataURI","componentDidMount","componentWillUnmount","render","enableImageFileUpload","enableSvgHttpDownloader","enableGallerySharingWarning","context","validImageTypes","shouldShowURLField","svgRenderAsDom","errorMessage","Message","Text","canClear","onChange","handleURLChange","onKeyDown","handleTextKeyDown","elementRef","trackInputRef","ImageFileReader","defaultFilename","defaultImageDataURI","onImageChange","handleOnImageChange","allowExtensions","FeatureFlagContext","defaultProps","RemoveButtonIcon","Cross","ImageUrlReaderContainer","StyledImagePreview","borderColor","StyledTitleContainer","backgroundColorPage","contentColorDefault","StyledTitle","StyledRemoveButton","Button","attrs","actionColorBackgroundSecondaryHover","StyledImageThumbnail","mixins","reset","ImageThumbnail","onImageRemove","noop","overrideCSPViolation","alt","ImageEditor","name","validMediaTypes","imageRegistry","ImageContext","dataUri","setDataUri","fileName","setFileName","uploadImage","useCallback","async","file","imageDataUri","imageId","upload","console","warn","handleUpload","handleRemove","registry","isResourceURL","getByURL","dataURI","metaData","getImageData","populateData","ControlGroup","isRequired"],"sourceRoot":""}
@@ -19,7 +19,7 @@
19
19
  }
20
20
  `,_=l.default.div`
21
21
  display: none;
22
- `,y={error:1,warning:2,other:3},x=({onChange:e,defaultErrors:t={},name:r,value:n})=>{const[a,o]=s.useState("write"),[i,u]=s.useState(n),[l,m]=s.useState(t),x=s.useCallback((e=>u(e)),[u]),O=s.useCallback((a=>{i!==n&&(e(a,r,i),m(t))}),[i,n,e,r,t]),M=s.useMemo((()=>{let e=null;return Object.values(l).includes("error")?e=s.createElement(b.CSPMessage,{type:"error"}):Object.values(l).includes("warning")&&(e=s.createElement(b.CSPMessage,{type:"warning"})),Object.values(l).includes("other")&&(e=s.createElement(s.Fragment,null,e,s.createElement(f.default,{appearance:"fill",type:"error","data-test":"image-error"},(0,p._)("We can't find an image with this URL. Please enter a new URL")))),e}),[Object.values(l).join("")]),P=s.useMemo((()=>{return s.createElement(_,null,s.createElement(d.default,{text:n,imageRenderer:(e=(e,t)=>{var r,n;(null!==(r=y[l[e]])&&void 0!==r?r:1/0)>(null!==(n=y[t])&&void 0!==n?n:0)&&m(Object.assign(Object.assign({},l),{[e]:t}))},function({src:t,alt:r}){const n=(0,v.useCSPViolationObserver)(t);return s.useEffect((()=>{"none"!==n&&e(t,n)}),[n,t]),s.createElement("img",{src:t,alt:r,onError:()=>{"none"===n&&e(t,"other")}})})}));var e}),[n,l]);return s.createElement(h,{"data-test":r},s.createElement(c.default,{value:i,toolbarCommands:[["header","bold","italic","link","quote","code","image","unordered-list","ordered-list"]],onChange:x,selectedTab:a,onTabChange:o,disablePreview:!0,childProps:{textArea:{onBlur:O}}}),P,M&&s.createElement(g.MessageContainer,null,M))};x.propTypes={onChange:u.func.isRequired,name:u.string.isRequired,value:u.string,defaultErrors:u.string},x.defaultProps={value:""},t.default=x},5135:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useCSPViolationObserver=void 0;const n=r(9497);t.useCSPViolationObserver=(e,t="none")=>{const[r,a]=(0,n.useState)(t);return(0,n.useEffect)((()=>{const r=t=>{t.blockedURI!==e&&t.blockedURI!==`${e}/`||"enforce"!==t.disposition?t.blockedURI!==e&&t.blockedURI!==`${e}/`||"report"!==t.disposition||a("warning"):a("error")};return document.addEventListener("securitypolicyviolation",r),a(t),()=>{document.removeEventListener("securitypolicyviolation",r)}}),[e]),r}},962:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return a(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CSPMessage=void 0;const s=o(r(9497)),u=r(6649),l=i(r(6447)),c=i(r(451)),d=i(r(5711));t.CSPMessage=({type:e})=>{const{cspMessageLink:t}=s.useContext(d.default);return s.createElement(l.default,{appearance:"fill",type:e,"data-test":`csp-message-${e}`},(0,u._)("External image URLs must now have their domains listed in the Dashboards Trusted Domains List by working with your administrator. Alternatively, you can upload the image directly into the dashboard. "),t&&s.createElement(c.default,{to:t,openInNewContext:!0},(0,u._)("Learn more")))}},137:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageContainer=void 0;const a=n(r(232));t.MessageContainer=a.default.div`
22
+ `,y={error:1,warning:2,other:3},x=({onChange:e,defaultErrors:t={},name:r,value:n=""})=>{const[a,o]=s.useState("write"),[i,u]=s.useState(n),[l,m]=s.useState(t),x=s.useCallback((e=>u(e)),[u]),O=s.useCallback((a=>{i!==n&&(e(a,r,i),m(t))}),[i,n,e,r,t]),M=s.useMemo((()=>{let e=null;return Object.values(l).includes("error")?e=s.createElement(b.CSPMessage,{type:"error"}):Object.values(l).includes("warning")&&(e=s.createElement(b.CSPMessage,{type:"warning"})),Object.values(l).includes("other")&&(e=s.createElement(s.Fragment,null,e,s.createElement(f.default,{appearance:"fill",type:"error","data-test":"image-error"},(0,p._)("We can't find an image with this URL. Please enter a new URL")))),e}),[Object.values(l).join("")]),j=s.useMemo((()=>{return s.createElement(_,null,s.createElement(d.default,{text:n,imageRenderer:(e=(e,t)=>{var r,n;(null!==(r=y[l[e]])&&void 0!==r?r:1/0)>(null!==(n=y[t])&&void 0!==n?n:0)&&m(Object.assign(Object.assign({},l),{[e]:t}))},function({src:t,alt:r}){const n=(0,v.useCSPViolationObserver)(t);return s.useEffect((()=>{"none"!==n&&e(t,n)}),[n,t]),s.createElement("img",{src:t,alt:r,onError:()=>{"none"===n&&e(t,"other")}})})}));var e}),[n,l]);return s.createElement(h,{"data-test":r},s.createElement(c.default,{value:i,toolbarCommands:[["header","bold","italic","link","quote","code","image","unordered-list","ordered-list"]],onChange:x,selectedTab:a,onTabChange:o,disablePreview:!0,childProps:{textArea:{onBlur:O}}}),j,M&&s.createElement(g.MessageContainer,null,M))};x.propTypes={onChange:u.func.isRequired,name:u.string.isRequired,value:u.string,defaultErrors:u.string},t.default=x},5135:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useCSPViolationObserver=void 0;const n=r(9497);t.useCSPViolationObserver=(e,t="none")=>{const[r,a]=(0,n.useState)(t);return(0,n.useEffect)((()=>{const r=t=>{t.blockedURI!==e&&t.blockedURI!==`${e}/`||"enforce"!==t.disposition?t.blockedURI!==e&&t.blockedURI!==`${e}/`||"report"!==t.disposition||a("warning"):a("error")};return document.addEventListener("securitypolicyviolation",r),a(t),()=>{document.removeEventListener("securitypolicyviolation",r)}}),[e]),r}},962:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return a(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CSPMessage=void 0;const s=o(r(9497)),u=r(6649),l=i(r(6447)),c=i(r(451)),d=i(r(5711));t.CSPMessage=({type:e})=>{const{cspMessageLink:t}=s.useContext(d.default);return s.createElement(l.default,{appearance:"fill",type:e,"data-test":`csp-message-${e}`},(0,u._)("External image URLs must now have their domains listed in the Dashboards Trusted Domains List by working with your administrator. Alternatively, you can upload the image directly into the dashboard. "),t&&s.createElement(c.default,{to:t,openInNewContext:!0},(0,u._)("Learn more")))}},137:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageContainer=void 0;const a=n(r(232));t.MessageContainer=a.default.div`
23
23
  margin-top: 10px;
24
24
  `},451:e=>{e.exports=require("@splunk/react-ui/Link")},1018:e=>{e.exports=require("@splunk/react-ui/Markdown")},6447:e=>{e.exports=require("@splunk/react-ui/Message")},3563:e=>{e.exports=require("@splunk/themes")},6649:e=>{e.exports=require("@splunk/ui-utils/i18n")},5711:e=>{e.exports=require("@splunk/visualization-context/MessageContext")},23:e=>{e.exports=require("prop-types")},9497:e=>{e.exports=require("react")},348:e=>{e.exports=require("react-mde")},6265:e=>{e.exports=require("react-mde/lib/styles/css/react-mde-all.css")},232:e=>{e.exports=require("styled-components")}},t={};var r=function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}(7970);module.exports=r})();
25
25
  //# sourceMappingURL=MarkdownEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownEditor.js","mappings":";;;;2zBAAA,mBACA,WACA,YACA,YACA,QACA,mBACA,UACA,aACA,UACA,UACA,SACA,SAEMA,EAAgC,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BN,EAAiB,CAC5E,GAEF,CAACvB,IACGqB,CAAS,C,mzBCvBpB,mBACA,UACA,aACA,YACA,aAIa,EAAA9B,WAAa,EAAGC,WACzB,MAAM,eAAEsC,GAAmBxD,EAAMyD,WAAW,WAC5C,OACI,gBAAC,UAAO,CAACtC,WAAW,OAAOD,KAAMA,EAAI,YAAa,eAAeA,MAC5D,IAAAE,GACG,2MAEHoC,GACG,gBAAC,UAAI,CAACE,GAAIF,EAAgBG,kBAAgB,IACrC,IAAAvC,GAAE,eAIlB,C,qLCrBL,kBAEa,EAAAmB,iBAAmB,UAAOxD,GAAG;;WCF1C6E,EAAOC,QAAUC,QAAQ,wB,WCAzBF,EAAOC,QAAUC,QAAQ,4B,WCAzBF,EAAOC,QAAUC,QAAQ,2B,WCAzBF,EAAOC,QAAUC,QAAQ,iB,WCAzBF,EAAOC,QAAUC,QAAQ,wB,WCAzBF,EAAOC,QAAUC,QAAQ,+C,SCAzBF,EAAOC,QAAUC,QAAQ,a,WCAzBF,EAAOC,QAAUC,QAAQ,Q,UCAzBF,EAAOC,QAAUC,QAAQ,Y,WCAzBF,EAAOC,QAAUC,QAAQ,6C,UCAzBF,EAAOC,QAAUC,QAAQ,oB,GCCrBC,EAA2B,CAAC,ECEhC,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaN,QAGrB,IAAID,EAASG,EAAyBG,GAAY,CAGjDL,QAAS,CAAC,GAOX,OAHAQ,EAAoBH,GAAUI,KAAKV,EAAOC,QAASD,EAAQA,EAAOC,QAASI,GAGpEL,EAAOC,OACf,CCnB0BI,CAAoB,M","sources":["webpack://@splunk/dynamic-editors/./src/editors/MarkdownEditor.tsx","webpack://@splunk/dynamic-editors/./src/hooks/useCSPViolationObserver.tsx","webpack://@splunk/dynamic-editors/./src/shared/CSPMessage.tsx","webpack://@splunk/dynamic-editors/./src/shared/MessageContainer.tsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Link\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Markdown\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Message\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-context/MessageContext\"","webpack://@splunk/dynamic-editors/external commonjs2 \"prop-types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react-mde\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react-mde/lib/styles/css/react-mde-all.css\"","webpack://@splunk/dynamic-editors/external commonjs2 \"styled-components\"","webpack://@splunk/dynamic-editors/webpack/bootstrap","webpack://@splunk/dynamic-editors/webpack/startup"],"sourcesContent":["import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport ReactMde from 'react-mde';\nimport 'react-mde/lib/styles/css/react-mde-all.css';\nimport Markdown from '@splunk/react-ui/Markdown';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Message from '@splunk/react-ui/Message';\nimport { variables } from '@splunk/themes';\nimport { useCSPViolationObserver } from '../hooks/useCSPViolationObserver';\nimport { CSPMessage } from '../shared/CSPMessage';\nimport { MessageContainer } from '../shared/MessageContainer';\n\nconst StyledMarkdownEditorContainer = styled.div`\n font-family: ${variables.sansFontFamily};\n .react-mde * {\n font-family: inherit;\n }\n .mde-header,\n .mde-preview,\n .mde-textarea-wrapper textarea.mde-text {\n background-color: ${variables.backgroundColorPopup};\n }\n .mde-header .mde-tabs button,\n .mde-header ul.mde-header-group li.mde-header-item button,\n .mde-textarea-wrapper textarea.mde-text {\n color: ${variables.contentColorActive};\n }\n`;\n\nconst HiddenPreview = styled.div`\n display: none;\n`;\n\nconst getCustomRenderer = errorCallback =>\n function ImageRenderer({ src, alt }: { src: string; alt: string }) {\n const violationType = useCSPViolationObserver(src);\n React.useEffect(() => {\n if (violationType !== 'none') {\n errorCallback(src, violationType);\n }\n }, [violationType, src]);\n return (\n <img\n src={src}\n alt={alt}\n onError={() => {\n if (violationType === 'none') {\n errorCallback(src, 'other');\n }\n }}\n />\n );\n };\n\nconst errorPriority = {\n error: 1,\n warning: 2,\n other: 3,\n} as const;\n\n/**\n * an object mapping resource URLs to error types\n * e.g. { \"https://foo.com\": \"warning\" }\n */\ntype ErrorState = {\n [url: string]: 'warning' | 'error' | 'other';\n};\n\n// TODO: Type this component\nconst MarkdownEditor = ({ onChange, defaultErrors = {}, name, value }): React.ReactElement => {\n const [selectedTab, setSelectedTab] = React.useState<'write' | 'preview'>('write');\n const [val, setValueState] = React.useState(value);\n const [errors, setErrors] = React.useState<ErrorState>(defaultErrors);\n\n const handleValueChange = React.useCallback(v => setValueState(v), [setValueState]);\n const handleBlur = React.useCallback(\n event => {\n if (val !== value) {\n onChange(event, name, val);\n setErrors(defaultErrors);\n }\n },\n [val, value, onChange, name, defaultErrors]\n );\n // This excludes 'strikethrough' and 'checked-list' which is in default toolbar, as markdown component doesnt support it yet\n const toolbarCommands = [\n ['header', 'bold', 'italic', 'link', 'quote', 'code', 'image', 'unordered-list', 'ordered-list'],\n ];\n\n const errorMessage = React.useMemo(() => {\n let message = null;\n if (Object.values(errors).includes('error')) {\n message = <CSPMessage type=\"error\" />;\n } else if (Object.values(errors).includes('warning')) {\n message = <CSPMessage type=\"warning\" />;\n }\n if (Object.values(errors).includes('other')) {\n message = (\n <>\n {message}\n <Message appearance=\"fill\" type=\"error\" data-test=\"image-error\">\n {_(\"We can't find an image with this URL. Please enter a new URL\")}\n </Message>\n </>\n );\n }\n return message;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [Object.values(errors).join('')]);\n\n const hiddenMarkdownPreview = React.useMemo(\n () => (\n <HiddenPreview>\n <Markdown\n text={value}\n imageRenderer={getCustomRenderer((src, error) => {\n if ((errorPriority[errors[src]] ?? Infinity) > (errorPriority[error] ?? 0)) {\n setErrors({ ...errors, [src]: error });\n }\n })}\n />\n </HiddenPreview>\n ),\n [value, errors]\n );\n\n return (\n <StyledMarkdownEditorContainer data-test={name}>\n <ReactMde\n value={val}\n toolbarCommands={toolbarCommands}\n onChange={handleValueChange}\n selectedTab={selectedTab}\n onTabChange={setSelectedTab}\n disablePreview\n childProps={{\n textArea: {\n onBlur: handleBlur,\n },\n }}\n />\n {hiddenMarkdownPreview}\n {errorMessage && <MessageContainer>{errorMessage}</MessageContainer>}\n </StyledMarkdownEditorContainer>\n );\n};\n\nMarkdownEditor.propTypes = {\n /**\n * Callback when markdown input is changed\n */\n onChange: T.func.isRequired,\n /**\n * Name of the markdown editor\n */\n name: T.string.isRequired,\n /**\n * Markdown input string in the editor\n */\n value: T.string,\n /**\n * Simulate CSP Violation Error\n */\n defaultErrors: T.string,\n};\n\nMarkdownEditor.defaultProps = {\n value: '',\n};\nexport default MarkdownEditor;\n","import { useState, useEffect } from 'react';\n\ntype ViolationType = 'error' | 'warning' | 'none';\n\nconst useCSPViolationObserver = (src: string, defaultValue: ViolationType = 'none'): ViolationType => {\n const [violation, setViolation] = useState<ViolationType>(defaultValue);\n useEffect(() => {\n const violationHandler = e => {\n if ((e.blockedURI === src || e.blockedURI === `${src}/`) && e.disposition === 'enforce') {\n // the second src condition is required as Chrome rewrites\n // URLs without query parameters (e.g. foo.com -> foo.com/ )\n setViolation('error');\n } else if ((e.blockedURI === src || e.blockedURI === `${src}/`) && e.disposition === 'report') {\n setViolation('warning');\n }\n };\n document.addEventListener('securitypolicyviolation', violationHandler);\n setViolation(defaultValue);\n return () => {\n document.removeEventListener('securitypolicyviolation', violationHandler);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [src]);\n return violation;\n};\n\nexport { useCSPViolationObserver };\n","import * as React from 'react';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Message from '@splunk/react-ui/Message';\nimport Link from '@splunk/react-ui/Link';\nimport MessageContext from '@splunk/visualization-context/MessageContext';\n\nexport type CSPMessageProps = { type: 'warning' | 'error' };\n\nexport const CSPMessage = ({ type }: CSPMessageProps) => {\n const { cspMessageLink } = React.useContext(MessageContext) as Record<string, string>; // NOSONAR\n return (\n <Message appearance=\"fill\" type={type} data-test={`csp-message-${type}`}>\n {_(\n 'External image URLs must now have their domains listed in the Dashboards Trusted Domains List by working with your administrator. Alternatively, you can upload the image directly into the dashboard. '\n )}\n {cspMessageLink && (\n <Link to={cspMessageLink} openInNewContext>\n {_('Learn more')}\n </Link>\n )}\n </Message>\n );\n};\n","import styled from 'styled-components';\n\nexport const MessageContainer = styled.div`\n margin-top: 10px;\n`;\n","module.exports = require(\"@splunk/react-ui/Link\");","module.exports = require(\"@splunk/react-ui/Markdown\");","module.exports = require(\"@splunk/react-ui/Message\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/visualization-context/MessageContext\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"react-mde\");","module.exports = require(\"react-mde/lib/styles/css/react-mde-all.css\");","module.exports = require(\"styled-components\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(7970);\n"],"names":["StyledMarkdownEditorContainer","div","variables","sansFontFamily","backgroundColorPopup","contentColorActive","HiddenPreview","errorPriority","error","warning","other","MarkdownEditor","onChange","defaultErrors","name","value","selectedTab","setSelectedTab","React","useState","val","setValueState","errors","setErrors","handleValueChange","useCallback","v","handleBlur","event","errorMessage","useMemo","message","Object","values","includes","CSPMessage","type","appearance","_","join","hiddenMarkdownPreview","text","imageRenderer","errorCallback","src","Infinity","alt","violationType","useCSPViolationObserver","useEffect","onError","toolbarCommands","onTabChange","disablePreview","childProps","textArea","onBlur","MessageContainer","propTypes","T","func","isRequired","string","defaultProps","defaultValue","violation","setViolation","violationHandler","e","blockedURI","disposition","document","addEventListener","removeEventListener","cspMessageLink","useContext","to","openInNewContext","module","exports","require","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call"],"sourceRoot":""}
1
+ {"version":3,"file":"MarkdownEditor.js","mappings":";;;;2zBAAA,mBACA,WACA,YACA,YACA,QACA,mBACA,UACA,aACA,UACA,UACA,SACA,SAEMA,EAAgC,UAAOC,GAAG;mBAC7B,EAAAC,UAAUC;;;;;;;4BAOD,EAAAD,UAAUE;;;;;iBAKrB,EAAAF,UAAUG;;EAIrBC,EAAgB,UAAOL,GAAG;;EAyB1BM,EAAgB,CAClBC,MAAO,EACPC,QAAS,EACTC,MAAO,GAYLC,EAAiB,EAAGC,WAAUC,gBAAgB,CAAC,EAAGC,OAAMC,QAAQ,OAClE,MAAOC,EAAaC,GAAkBC,EAAMC,SAA8B,UACnEC,EAAKC,GAAiBH,EAAMC,SAASJ,IACrCO,EAAQC,GAAaL,EAAMC,SAAqBN,GAEjDW,EAAoBN,EAAMO,aAAYC,GAAKL,EAAcK,IAAI,CAACL,IAC9DM,EAAaT,EAAMO,aACrBG,IACQR,IAAQL,IACRH,EAASgB,EAAOd,EAAMM,GACtBG,EAAUV,GACd,GAEJ,CAACO,EAAKL,EAAOH,EAAUE,EAAMD,IAO3BgB,EAAeX,EAAMY,SAAQ,KAC/B,IAAIC,EAAU,KAgBd,OAfIC,OAAOC,OA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QAAUC,QAAQ,Y,WCAzBF,EAAOC,QAAUC,QAAQ,6C,UCAzBF,EAAOC,QAAUC,QAAQ,oB,GCCrBC,EAA2B,CAAC,ECEhC,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaN,QAGrB,IAAID,EAASG,EAAyBG,GAAY,CAGjDL,QAAS,CAAC,GAOX,OAHAQ,EAAoBH,GAAUI,KAAKV,EAAOC,QAASD,EAAQA,EAAOC,QAASI,GAGpEL,EAAOC,OACf,CCnB0BI,CAAoB,M","sources":["webpack://@splunk/dynamic-editors/./src/editors/MarkdownEditor.tsx","webpack://@splunk/dynamic-editors/./src/hooks/useCSPViolationObserver.tsx","webpack://@splunk/dynamic-editors/./src/shared/CSPMessage.tsx","webpack://@splunk/dynamic-editors/./src/shared/MessageContainer.tsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Link\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Markdown\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Message\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-context/MessageContext\"","webpack://@splunk/dynamic-editors/external commonjs2 \"prop-types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react-mde\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react-mde/lib/styles/css/react-mde-all.css\"","webpack://@splunk/dynamic-editors/external commonjs2 \"styled-components\"","webpack://@splunk/dynamic-editors/webpack/bootstrap","webpack://@splunk/dynamic-editors/webpack/startup"],"sourcesContent":["import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport ReactMde from 'react-mde';\nimport 'react-mde/lib/styles/css/react-mde-all.css';\nimport Markdown from '@splunk/react-ui/Markdown';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Message from '@splunk/react-ui/Message';\nimport { variables } from '@splunk/themes';\nimport { useCSPViolationObserver } from '../hooks/useCSPViolationObserver';\nimport { CSPMessage } from '../shared/CSPMessage';\nimport { MessageContainer } from '../shared/MessageContainer';\n\nconst StyledMarkdownEditorContainer = styled.div`\n font-family: ${variables.sansFontFamily};\n .react-mde * {\n font-family: inherit;\n }\n .mde-header,\n .mde-preview,\n .mde-textarea-wrapper textarea.mde-text {\n background-color: ${variables.backgroundColorPopup};\n }\n .mde-header .mde-tabs button,\n .mde-header ul.mde-header-group li.mde-header-item button,\n .mde-textarea-wrapper textarea.mde-text {\n color: ${variables.contentColorActive};\n }\n`;\n\nconst HiddenPreview = styled.div`\n display: none;\n`;\n\nconst getCustomRenderer = errorCallback =>\n function ImageRenderer({ src, alt }: { src: string; alt: string }) {\n const violationType = useCSPViolationObserver(src);\n React.useEffect(() => {\n if (violationType !== 'none') {\n errorCallback(src, violationType);\n }\n }, [violationType, src]);\n return (\n <img\n src={src}\n alt={alt}\n onError={() => {\n if (violationType === 'none') {\n errorCallback(src, 'other');\n }\n }}\n />\n );\n };\n\nconst errorPriority = {\n error: 1,\n warning: 2,\n other: 3,\n} as const;\n\n/**\n * an object mapping resource URLs to error types\n * e.g. { \"https://foo.com\": \"warning\" }\n */\ntype ErrorState = {\n [url: string]: 'warning' | 'error' | 'other';\n};\n\n// TODO: Type this component\nconst MarkdownEditor = ({ onChange, defaultErrors = {}, name, value = '' }): React.ReactElement => {\n const [selectedTab, setSelectedTab] = React.useState<'write' | 'preview'>('write');\n const [val, setValueState] = React.useState(value);\n const [errors, setErrors] = React.useState<ErrorState>(defaultErrors);\n\n const handleValueChange = React.useCallback(v => setValueState(v), [setValueState]);\n const handleBlur = React.useCallback(\n event => {\n if (val !== value) {\n onChange(event, name, val);\n setErrors(defaultErrors);\n }\n },\n [val, value, onChange, name, defaultErrors]\n );\n // This excludes 'strikethrough' and 'checked-list' which is in default toolbar, as markdown component doesnt support it yet\n const toolbarCommands = [\n ['header', 'bold', 'italic', 'link', 'quote', 'code', 'image', 'unordered-list', 'ordered-list'],\n ];\n\n const errorMessage = React.useMemo(() => {\n let message = null;\n if (Object.values(errors).includes('error')) {\n message = <CSPMessage type=\"error\" />;\n } else if (Object.values(errors).includes('warning')) {\n message = <CSPMessage type=\"warning\" />;\n }\n if (Object.values(errors).includes('other')) {\n message = (\n <>\n {message}\n <Message appearance=\"fill\" type=\"error\" data-test=\"image-error\">\n {_(\"We can't find an image with this URL. Please enter a new URL\")}\n </Message>\n </>\n );\n }\n return message;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [Object.values(errors).join('')]);\n\n const hiddenMarkdownPreview = React.useMemo(\n () => (\n <HiddenPreview>\n <Markdown\n text={value}\n imageRenderer={getCustomRenderer((src, error) => {\n if ((errorPriority[errors[src]] ?? Infinity) > (errorPriority[error] ?? 0)) {\n setErrors({ ...errors, [src]: error });\n }\n })}\n />\n </HiddenPreview>\n ),\n [value, errors]\n );\n\n return (\n <StyledMarkdownEditorContainer data-test={name}>\n <ReactMde\n value={val}\n toolbarCommands={toolbarCommands}\n onChange={handleValueChange}\n selectedTab={selectedTab}\n onTabChange={setSelectedTab}\n disablePreview\n childProps={{\n textArea: {\n onBlur: handleBlur,\n },\n }}\n />\n {hiddenMarkdownPreview}\n {errorMessage && <MessageContainer>{errorMessage}</MessageContainer>}\n </StyledMarkdownEditorContainer>\n );\n};\n\nMarkdownEditor.propTypes = {\n /**\n * Callback when markdown input is changed\n */\n onChange: T.func.isRequired,\n /**\n * Name of the markdown editor\n */\n name: T.string.isRequired,\n /**\n * Markdown input string in the editor\n */\n value: T.string,\n /**\n * Simulate CSP Violation Error\n */\n defaultErrors: T.string,\n};\n\nexport default MarkdownEditor;\n","import { useState, useEffect } from 'react';\n\ntype ViolationType = 'error' | 'warning' | 'none';\n\nconst useCSPViolationObserver = (src: string, defaultValue: ViolationType = 'none'): ViolationType => {\n const [violation, setViolation] = useState<ViolationType>(defaultValue);\n useEffect(() => {\n const violationHandler = e => {\n if ((e.blockedURI === src || e.blockedURI === `${src}/`) && e.disposition === 'enforce') {\n // the second src condition is required as Chrome rewrites\n // URLs without query parameters (e.g. foo.com -> foo.com/ )\n setViolation('error');\n } else if ((e.blockedURI === src || e.blockedURI === `${src}/`) && e.disposition === 'report') {\n setViolation('warning');\n }\n };\n document.addEventListener('securitypolicyviolation', violationHandler);\n setViolation(defaultValue);\n return () => {\n document.removeEventListener('securitypolicyviolation', violationHandler);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [src]);\n return violation;\n};\n\nexport { useCSPViolationObserver };\n","import * as React from 'react';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Message from '@splunk/react-ui/Message';\nimport Link from '@splunk/react-ui/Link';\nimport MessageContext from '@splunk/visualization-context/MessageContext';\n\nexport type CSPMessageProps = { type: 'warning' | 'error' };\n\nexport const CSPMessage = ({ type }: CSPMessageProps) => {\n const { cspMessageLink } = React.useContext(MessageContext) as Record<string, string>; // NOSONAR\n return (\n <Message appearance=\"fill\" type={type} data-test={`csp-message-${type}`}>\n {_(\n 'External image URLs must now have their domains listed in the Dashboards Trusted Domains List by working with your administrator. Alternatively, you can upload the image directly into the dashboard. '\n )}\n {cspMessageLink && (\n <Link to={cspMessageLink} openInNewContext>\n {_('Learn more')}\n </Link>\n )}\n </Message>\n );\n};\n","import styled from 'styled-components';\n\nexport const MessageContainer = styled.div`\n margin-top: 10px;\n`;\n","module.exports = require(\"@splunk/react-ui/Link\");","module.exports = require(\"@splunk/react-ui/Markdown\");","module.exports = require(\"@splunk/react-ui/Message\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/visualization-context/MessageContext\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"react-mde\");","module.exports = require(\"react-mde/lib/styles/css/react-mde-all.css\");","module.exports = require(\"styled-components\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(7970);\n"],"names":["StyledMarkdownEditorContainer","div","variables","sansFontFamily","backgroundColorPopup","contentColorActive","HiddenPreview","errorPriority","error","warning","other","MarkdownEditor","onChange","defaultErrors","name","value","selectedTab","setSelectedTab","React","useState","val","setValueState","errors","setErrors","handleValueChange","useCallback","v","handleBlur","event","errorMessage","useMemo","message","Object","values","includes","CSPMessage","type","appearance","_","join","hiddenMarkdownPreview","text","imageRenderer","errorCallback","src","Infinity","alt","violationType","useCSPViolationObserver","useEffect","onError","toolbarCommands","onTabChange","disablePreview","childProps","textArea","onBlur","MessageContainer","propTypes","T","func","isRequired","string","defaultValue","violation","setViolation","violationHandler","e","blockedURI","disposition","document","addEventListener","removeEventListener","cspMessageLink","useContext","to","openInNewContext","module","exports","require","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call"],"sourceRoot":""}
@@ -2,13 +2,13 @@
2
2
  * Copyright © 2018 Splunk Inc.
3
3
  * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
4
  * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
- */(()=>{"use strict";var e={437:(e,t,o)=>{o.r(t),o.d(t,{default:()=>M});var l=o(9497),a=o.n(l),r=o(23),n=o.n(r),i=o(232),u=o.n(i),d=o(4793),s=o(3563),c=o(7408),p=o.n(c),f=o(4082),b=o.n(f),h=o(8987),m=o(6649);const g=require("@splunk/react-ui/ScreenReaderContent");var C=o.n(g);const v=require("@splunk/visualizations-shared/colorConstants");var y=o(3283),x=o(4008),_=o.n(x);const k=u().div.attrs((()=>({"data-test":"text-container"})))`
5
+ */(()=>{"use strict";var e={437:(e,t,o)=>{o.r(t),o.d(t,{default:()=>w});var l=o(9497),r=o.n(l),a=o(23),n=o.n(a),i=o(232),u=o.n(i),d=o(4793),s=o(3563),c=o(7408),p=o.n(c),f=o(4082),b=o.n(f),h=o(8987),m=o(6649);const g=require("@splunk/react-ui/ScreenReaderContent");var C=o.n(g);const v=require("@splunk/visualizations-shared/colorConstants");var y=o(3283),x=o(4008),_=o.n(x);const k=u().div`
6
6
  max-height: ${s.variables.inputHeight};
7
7
  width: 100%;
8
8
  min-width: 0;
9
- `,O=u()(b()).attrs((({name:e})=>({"data-test":e})))`
9
+ `,O=u()(b())`
10
10
  max-height: ${s.variables.inputHeight};
11
- `,E=({color:e,defaultColor:t,prevColor:o})=>{const l="string"==typeof e?e.trim():e;return(0,y.isColor)(l)||null===l?l:(0,y.isColor)(t)?t:(0,y.isColor)(o)||null===o?o:"transparent"},P=({id:e,showTextInput:t,color:o,palette:r,handleColorChange:n,labelledBy:i,textWidth:u,value:d,name:s,handleTextColorChange:c,handleKeyPress:f,handleBlur:b,isDisabled:g})=>{const v=(0,l.useMemo)((()=>(0,h.createDOMID)("color-code")),[]);return a().createElement(a().Fragment,null,a().createElement("div",null,a().createElement(p(),{key:"color-editor",append:t,value:E({color:o}),palette:r,onChange:n,"data-test":`color-picker-${s}`,disabled:g,hideInput:!0,labelledBy:i})),t&&a().createElement(k,{textWidth:u},a().createElement(C(),{id:v},(0,m._)("Color code input")),a().createElement(O,{key:d,"data-test":s,prepend:!0,value:null===o?"N/A":o,onChange:c,onKeyDown:f,onBlur:b,disabled:g,style:{height:"32px"},labelledBy:`${i} ${v}`,inputId:e})))};P.propTypes={id:n().string,showTextInput:n().bool,color:n().string,palette:n().arrayOf(n().string),handleColorChange:n().func,labelledBy:n().string,textWidth:n().oneOfType([n().string,n().number]),value:n().string,name:n().string.isRequired,handleTextColorChange:n().func,handleKeyPress:n().func,handleBlur:n().func,isDisabled:n().bool};const j=({name:e="color",value:t,label:o="",labelPosition:r,labelWidth:n,palette:i,onChange:u=(()=>{}),itemSchema:s,isDisabled:c,textWidth:p,hideLabel:f,showTextInput:b,style:h={}})=>{const[m,g]=(0,l.useState)(t);(0,l.useEffect)((()=>{g(t)}),[t]);const C=(0,l.useMemo)((()=>(0,d.debounce)(u,250)),[u]),v=(0,l.useCallback)((({value:o})=>{const l=E({color:o,defaultColor:s.default,prevColor:t});g(l),t!==l&&C(null,e,l)}),[C,s.default,e,t]),y=(0,l.useCallback)(((e,{value:t})=>{const o="n/a"===(0,d.toLower)(t).trim()?null:t;g(o)}),[]),x=(0,l.useCallback)((o=>{if("Escape"!==o.key){if("Enter"===o.key&&t!==m){const l=E({color:m,defaultColor:s.default,prevColor:t});g(l),l!==t&&u(o,e,l)}}else g(t)}),[e,m,t,u,s.default]),k=(0,l.useCallback)((o=>{if(m!==t){const l=E({color:m,defaultColor:s.default,prevColor:t});g(l),l!==t&&u(o,e,l)}}),[e,m,t,u,s.default]);return a().createElement(_(),{label:o,labelPosition:r,labelWidth:n,style:h,hideLabel:f,controlsLayout:"fillJoin"},a().createElement(P,{showTextInput:b,color:m,palette:i,handleColorChange:v,name:e,isDisabled:c,textWidth:p,value:t,handleTextColorChange:y,handleKeyPress:x,handleBlur:k}))};j.propTypes={name:n().string.isRequired,value:n().string,itemSchema:n().object,label:n().string.isRequired,hideLabel:n().bool,showTextInput:n().bool,style:n().object,labelPosition:n().oneOf(["top","left"]),labelWidth:n().number,palette:n().arrayOf(n().string),onChange:n().func.isRequired,isDisabled:n().bool,textWidth:n().oneOfType([n().string,n().number])},j.defaultProps={value:"transparent",labelPosition:"top",palette:v.COLOR_EDITOR_PALETTE,itemSchema:{default:"transparent"},isDisabled:!1,textWidth:"auto",hideLabel:!1,showTextInput:!0,style:{}};const M=j},2965:function(e,t,o){var l=this&&this.__createBinding||(Object.create?function(e,t,o,l){void 0===l&&(l=o);var a=Object.getOwnPropertyDescriptor(t,o);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,l,a)}:function(e,t,o,l){void 0===l&&(l=o),e[l]=t[o]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&l(t,e,o);return a(t,e),t},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ColorFlyoutEditor=void 0;const i=r(o(9497)),u=r(o(23)),d=n(o(232)),s=n(o(4566)),c=o(6649),p=n(o(8965)),f=o(8987),b=n(o(7020)),h=n(o(1551)),m=o(3850),g=o(6801),C=n(o(4008)),v=n(o(437)),y={padding:"10px"},x={width:"314px"},_=(0,d.default)(b.default)`
11
+ `,E=({color:e,defaultColor:t,prevColor:o})=>{const l="string"==typeof e?e.trim():e;return(0,y.isColor)(l)||null===l?l:(0,y.isColor)(t)?t:(0,y.isColor)(o)||null===o?o:"transparent"},P=({id:e,showTextInput:t,color:o,palette:a,handleColorChange:n,labelledBy:i,textWidth:u,value:d,name:s,handleTextColorChange:c,handleKeyPress:f,handleBlur:b,isDisabled:g})=>{const v=(0,l.useMemo)((()=>(0,h.createDOMID)("color-code")),[]);return r().createElement(r().Fragment,null,r().createElement("div",null,r().createElement(p(),{key:"color-editor",append:t,value:E({color:o}),palette:a,onChange:n,"data-test":`color-picker-${s}`,disabled:g,hideInput:!0,labelledBy:i})),t&&r().createElement(k,{"data-test":"text-container",textWidth:u},r().createElement(C(),{id:v},(0,m._)("Color code input")),r().createElement(O,{key:d,"data-test":s,prepend:!0,value:null===o?"N/A":o,onChange:c,onKeyDown:f,onBlur:b,disabled:g,style:{height:"32px"},labelledBy:`${i} ${v}`,inputId:e})))};P.propTypes={id:n().string,showTextInput:n().bool,color:n().string,palette:n().arrayOf(n().string),handleColorChange:n().func,labelledBy:n().string,textWidth:n().oneOfType([n().string,n().number]),value:n().string,name:n().string.isRequired,handleTextColorChange:n().func,handleKeyPress:n().func,handleBlur:n().func,isDisabled:n().bool};const j={default:"transparent"},M={},T=({name:e="color",value:t="transparent",label:o="",labelPosition:a="top",labelWidth:n,palette:i=v.COLOR_EDITOR_PALETTE,onChange:u=d.noop,itemSchema:s=j,isDisabled:c=!1,textWidth:p="auto",hideLabel:f=!1,showTextInput:b=!0,style:h=M})=>{const[m,g]=(0,l.useState)(t);(0,l.useEffect)((()=>{g(t)}),[t]);const C=(0,l.useMemo)((()=>(0,d.debounce)(u,250)),[u]),y=(0,l.useCallback)((({value:o})=>{const l=E({color:o,defaultColor:s.default,prevColor:t});g(l),t!==l&&C(null,e,l)}),[C,s.default,e,t]),x=(0,l.useCallback)(((e,{value:t})=>{const o="n/a"===(0,d.toLower)(t).trim()?null:t;g(o)}),[]),k=(0,l.useCallback)((o=>{if("Escape"!==o.key){if("Enter"===o.key&&t!==m){const l=E({color:m,defaultColor:s.default,prevColor:t});g(l),l!==t&&u(o,e,l)}}else g(t)}),[e,m,t,u,s.default]),O=(0,l.useCallback)((o=>{if(m!==t){const l=E({color:m,defaultColor:s.default,prevColor:t});g(l),l!==t&&u(o,e,l)}}),[e,m,t,u,s.default]);return r().createElement(_(),{label:o,labelPosition:a,labelWidth:n,style:h,hideLabel:f,controlsLayout:"fillJoin"},r().createElement(P,{showTextInput:b,color:m,palette:i,handleColorChange:y,name:e,isDisabled:c,textWidth:p,value:t,handleTextColorChange:x,handleKeyPress:k,handleBlur:O}))};T.propTypes={name:n().string.isRequired,value:n().string,itemSchema:n().object,label:n().string.isRequired,hideLabel:n().bool,showTextInput:n().bool,style:n().object,labelPosition:n().oneOf(["top","left"]),labelWidth:n().number,palette:n().arrayOf(n().string),onChange:n().func.isRequired,isDisabled:n().bool,textWidth:n().oneOfType([n().string,n().number])};const w=T},2965:function(e,t,o){var l=this&&this.__createBinding||(Object.create?function(e,t,o,l){void 0===l&&(l=o);var r=Object.getOwnPropertyDescriptor(t,o);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,l,r)}:function(e,t,o,l){void 0===l&&(l=o),e[l]=t[o]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&l(t,e,o);return r(t,e),t},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ColorFlyoutEditor=void 0;const i=a(o(9497)),u=a(o(23)),d=n(o(232)),s=o(4793),c=n(o(4566)),p=o(6649),f=n(o(8965)),b=o(8987),h=n(o(7020)),m=n(o(1551)),g=o(3850),C=o(6801),v=n(o(4008)),y=n(o(437)),x={padding:"10px"},_={width:"314px"},k=(0,d.default)(h.default)`
12
12
  padding: 8px;
13
13
  width: 100%;
14
14
  min-height: 40px;
@@ -18,30 +18,30 @@
18
18
  justify-content: space-evenly;
19
19
  grid-gap: 4px;
20
20
  }
21
- background-color: ${s.default.interactiveColorBackground};
22
- `,k=d.default.div`
21
+ background-color: ${c.default.interactiveColorBackground};
22
+ `,O=d.default.div`
23
23
  width: 26px;
24
24
  height: 24px;
25
25
  background-color: ${e=>e.color};
26
26
  border-radius: 2px;
27
- `,O=d.default.div`
27
+ `,E=d.default.div`
28
28
  box-sizing: border-box;
29
29
  padding: 8px;
30
30
  width: 312px;
31
31
  max-height: 484px;
32
- background-color: ${s.default.backgroundColorPopup};
33
- `,E=d.default.div`
32
+ background-color: ${c.default.backgroundColorPopup};
33
+ `,P=d.default.div`
34
34
  font-weight: 500;
35
35
  font-size: 14px;
36
36
  line-height: 20px;
37
37
  padding: 8px 8px 0 8px;
38
- font-family: ${s.default.fontFamily};
39
- color: ${s.default.contentColorActive};
40
- `,P=d.default.div`
38
+ font-family: ${c.default.fontFamily};
39
+ color: ${c.default.contentColorActive};
40
+ `,j=d.default.div`
41
41
  height: 412px;
42
42
  overflow-y: auto;
43
43
  padding: 8px 10px;
44
- `;t.ColorFlyoutEditor=({colors:e,CustomColorMatchEditor:t,handleColorRemove:o,handleColorChange:l,flyoutTitle:a,addColorButtonLabel:r,handleColorAdd:n,handleColorMove:u})=>{const d=(0,i.useMemo)((()=>e.map(((e,a)=>{const r=null==t;return i.default.createElement(p.default.Row,{index:a,key:(0,f.createDOMID)(),"data-color":e,onRequestRemove:o},i.default.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},i.default.createElement(v.default,{value:e,key:(0,f.createDOMID)(),onChange:l(a),hideLabel:!0,label:" ",name:"color",style:{marginBottom:0,marginTop:0,width:r?"100%":32},showTextInput:r}),"function"==typeof t&&i.default.createElement(t,{index:a})))}))),[e,t,o,l]);return i.default.createElement(O,{"data-test":"MultiColorPickerFlyoutContent"},i.default.createElement(E,{"data-test":"MultiColorPickerFlyoutTitle"},a),i.default.createElement(P,null,i.default.createElement(p.default,{addLabel:r,onRequestAdd:n,onRequestMove:u,"data-test":"ColorListEditor"},d)))};let j=0;const M=({CustomColorMatchEditor:e,onChange:o=(()=>{}),canReorderColors:l,value:a,flyoutTitle:r,addColorButtonLabel:n,name:u="seriesColors",label:d="",labelPosition:s="top",labelWidth:c,isDisabled:p=!1,hideLabel:b,canAddNewColors:g})=>{const[v,O]=(0,i.useState)(!1),[E,P]=(0,i.useState)(a),M=(0,i.useRef)(null);(0,i.useEffect)((()=>{P(a)}),[a]);const T=(0,i.useCallback)((()=>{o(null,u,[...E,m.VIZ_CATEGORICAL[j%m.VIZ_CATEGORICAL.length]]),j+=1}),[u,o,E]),w=(0,i.useCallback)((e=>(t,l,a)=>{const r=[...E];r.splice(e,1,a),o(null,u,r)}),[u,o,E]),B=(0,i.useCallback)(((e,{index:t})=>{const l=[...E];l.splice(t,1),o(null,u,l)}),[u,o,E]),q=(0,i.useCallback)((({fromIndex:e,toIndex:t})=>{const l=[...E],a=l[e];l.splice(e,1),l.splice(t,0,a),o(null,u,l)}),[u,o,E]),A=(0,i.useCallback)((({event:e,reason:t})=>{var o;(null===(o=null==e?void 0:e.srcElement)||void 0===o?void 0:o.sortableHandle)||O(!1),"escapeKey"===t&&M.current.focus()}),[]),D=(0,i.useMemo)((()=>E.map((e=>i.default.createElement(k,{color:e,key:(0,f.createDOMID)()})))),[E]),L=(0,i.useCallback)((()=>{O((e=>!e))}),[]);return i.default.createElement(C.default,{label:d,labelPosition:s,labelWidth:c,hideLabel:b,"data-test":"MultiColorPickerEditor"},i.default.createElement(_,{inline:!1,"data-test":"MultiColorPickerButton",appearance:"default",ref:M,onClick:L,disabled:p,style:x},D),i.default.createElement(h.default,{"data-test":"MultiColorPickerFlyout",open:v,anchor:M.current,defaultPlacement:"horizontal",style:y,onRequestClose:A,takeFocus:!0},i.default.createElement(t.ColorFlyoutEditor,{colors:E,CustomColorMatchEditor:e,handleColorRemove:B,handleColorChange:w,handleColorAdd:g?T:void 0,handleColorMove:l?q:void 0,flyoutTitle:r,addColorButtonLabel:n})))};M.propTypes=Object.assign(Object.assign({},g.BaseEditorPropTypes),{canReorderColors:u.bool,canAddNewColors:u.bool,value:u.arrayOf(u.string),flyoutTitle:u.string,addColorButtonLabel:u.string,CustomColorMatchEditor:u.func,hideLabel:u.bool}),M.defaultProps={value:m.VIZ_CATEGORICAL,canReorderColors:!0,flyoutTitle:(0,c._)("Customize colors"),addColorButtonLabel:(0,c._)("Add color"),hideLabel:!0,canAddNewColors:!0},t.default=M},6801:function(e,t,o){var l=this&&this.__createBinding||(Object.create?function(e,t,o,l){void 0===l&&(l=o);var a=Object.getOwnPropertyDescriptor(t,o);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,l,a)}:function(e,t,o,l){void 0===l&&(l=o),e[l]=t[o]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&l(t,e,o);return a(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseEditorPropTypes=void 0;const n=r(o(23));t.BaseEditorPropTypes={name:n.string.isRequired,value:n.oneOfType([n.string,n.object,n.arrayOf(n.string)]),context:n.object,label:n.string,labelPosition:n.oneOf(["top","left"]),labelWidth:n.number,onChange:n.func,isAdvanced:n.bool,isDisabled:n.bool,dataSourceBindings:n.object,options:n.object,optionsSchema:n.object}},4008:function(e,t,o){var l=this&&this.__createBinding||(Object.create?function(e,t,o,l){void 0===l&&(l=o);var a=Object.getOwnPropertyDescriptor(t,o);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,l,a)}:function(e,t,o,l){void 0===l&&(l=o),e[l]=t[o]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&l(t,e,o);return a(t,e),t},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdvancedConfigButton=void 0;const i=r(o(9497)),u=r(o(23)),d=n(o(232)),s=o(6649),c=n(o(6643)),p=o(3563),f=n(o(6379)),b=n(o(7020)),h=n(o(9250)),m=(0,d.default)(h.default)`
44
+ `;t.ColorFlyoutEditor=({colors:e,CustomColorMatchEditor:t,handleColorRemove:o,handleColorChange:l,flyoutTitle:r,addColorButtonLabel:a,handleColorAdd:n,handleColorMove:u})=>{const d=(0,i.useMemo)((()=>e.map(((e,r)=>{const a=null==t;return i.default.createElement(f.default.Row,{index:r,key:(0,b.createDOMID)(),"data-color":e,onRequestRemove:o},i.default.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},i.default.createElement(y.default,{value:e,key:(0,b.createDOMID)(),onChange:l(r),hideLabel:!0,label:" ",name:"color",style:{marginBottom:0,marginTop:0,width:a?"100%":32},showTextInput:a}),"function"==typeof t&&i.default.createElement(t,{index:r})))}))),[e,t,o,l]);return i.default.createElement(E,{"data-test":"MultiColorPickerFlyoutContent"},i.default.createElement(P,{"data-test":"MultiColorPickerFlyoutTitle"},r),i.default.createElement(j,null,i.default.createElement(f.default,{addLabel:a,onRequestAdd:n,onRequestMove:u,"data-test":"ColorListEditor"},d)))};let M=0;const T=({CustomColorMatchEditor:e,onChange:o=s.noop,canReorderColors:l=!0,value:r=g.VIZ_CATEGORICAL,flyoutTitle:a=(0,p._)("Customize colors"),addColorButtonLabel:n=(0,p._)("Add color"),name:u="seriesColors",label:d="",labelPosition:c="top",labelWidth:f,isDisabled:h=!1,hideLabel:C=!0,canAddNewColors:y=!0})=>{const[E,P]=(0,i.useState)(!1),[j,T]=(0,i.useState)(r),w=(0,i.useRef)(null);(0,i.useEffect)((()=>{T(r)}),[r]);const q=(0,i.useCallback)((()=>{o(null,u,[...j,g.VIZ_CATEGORICAL[M%g.VIZ_CATEGORICAL.length]]),M+=1}),[u,o,j]),B=(0,i.useCallback)((e=>(t,l,r)=>{const a=[...j];a.splice(e,1,r),o(null,u,a)}),[u,o,j]),D=(0,i.useCallback)(((e,{index:t})=>{const l=[...j];l.splice(t,1),o(null,u,l)}),[u,o,j]),A=(0,i.useCallback)((({fromIndex:e,toIndex:t})=>{const l=[...j],r=l[e];l.splice(e,1),l.splice(t,0,r),o(null,u,l)}),[u,o,j]),L=(0,i.useCallback)((({event:e,reason:t})=>{var o;(null===(o=null==e?void 0:e.srcElement)||void 0===o?void 0:o.sortableHandle)||P(!1),"escapeKey"===t&&w.current.focus()}),[]),R=(0,i.useMemo)((()=>j.map((e=>i.default.createElement(O,{color:e,key:(0,b.createDOMID)()})))),[j]),I=(0,i.useCallback)((()=>{P((e=>!e))}),[]);return i.default.createElement(v.default,{label:d,labelPosition:c,labelWidth:f,hideLabel:C,"data-test":"MultiColorPickerEditor"},i.default.createElement(k,{inline:!1,"data-test":"MultiColorPickerButton",appearance:"default",ref:w,onClick:I,disabled:h,style:_},R),i.default.createElement(m.default,{"data-test":"MultiColorPickerFlyout",open:E,anchor:w.current,defaultPlacement:"horizontal",style:x,onRequestClose:L,takeFocus:!0},i.default.createElement(t.ColorFlyoutEditor,{colors:j,CustomColorMatchEditor:e,handleColorRemove:D,handleColorChange:B,handleColorAdd:y?q:void 0,handleColorMove:l?A:void 0,flyoutTitle:a,addColorButtonLabel:n})))};T.propTypes=Object.assign(Object.assign({},C.BaseEditorPropTypes),{canReorderColors:u.bool,canAddNewColors:u.bool,value:u.arrayOf(u.string),flyoutTitle:u.string,addColorButtonLabel:u.string,CustomColorMatchEditor:u.func,hideLabel:u.bool}),t.default=T},6801:function(e,t,o){var l=this&&this.__createBinding||(Object.create?function(e,t,o,l){void 0===l&&(l=o);var r=Object.getOwnPropertyDescriptor(t,o);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,l,r)}:function(e,t,o,l){void 0===l&&(l=o),e[l]=t[o]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&l(t,e,o);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseEditorPropTypes=void 0;const n=a(o(23));t.BaseEditorPropTypes={name:n.string.isRequired,value:n.oneOfType([n.string,n.object,n.arrayOf(n.string)]),context:n.object,label:n.string,labelPosition:n.oneOf(["top","left"]),labelWidth:n.number,onChange:n.func,isAdvanced:n.bool,isDisabled:n.bool,dataSourceBindings:n.object,options:n.object,optionsSchema:n.object}},4008:function(e,t,o){var l=this&&this.__createBinding||(Object.create?function(e,t,o,l){void 0===l&&(l=o);var r=Object.getOwnPropertyDescriptor(t,o);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,l,r)}:function(e,t,o,l){void 0===l&&(l=o),e[l]=t[o]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&l(t,e,o);return r(t,e),t},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdvancedConfigButton=void 0;const i=a(o(9497)),u=a(o(23)),d=n(o(232)),s=o(6649),c=n(o(6643)),p=o(3563),f=n(o(6379)),b=n(o(7020)),h=n(o(9250)),m=(0,d.default)(h.default)`
45
45
  margin-top: 0;
46
46
  padding: 0;
47
47
  // adjust bottom margin according to theme
@@ -72,5 +72,5 @@
72
72
  &:hover {
73
73
  background-color: ${p.variables.interactiveColorOverlayDrag} !important;
74
74
  }
75
- `;t.AdvancedConfigButton=({label:e="",onClick:t})=>i.default.createElement(g,{"data-test":`${e}-advanced-config-button-tooltip`,content:(0,s._)("Advanced configurations")},i.default.createElement(C,{"data-test":`${e}-advanced-config-button`,icon:i.default.createElement(c.default,{"data-test":`${e}-advanced-config-button-icon`}),appearance:"subtle",onClick:t}));const v=({"data-test":e,children:o,isAdvanced:l,label:a,hideLabel:r,labelPosition:n,labelWidth:u,tooltip:d,help:s,style:c,error:p,controlsLayout:f,onClick:b,onAdvancedConfigButtonClick:h})=>i.default.createElement(m,{"data-test":null!=e?e:"control-group",label:a,hideLabel:r,labelPosition:n,labelWidth:u,tooltip:d,help:s,error:p,style:c,onClick:b,controlsLayout:f},l?i.Children.toArray(o).filter(Boolean).map((e=>(0,i.cloneElement)(e,{style:{flex:1}}))):o,l?i.default.createElement(t.AdvancedConfigButton,{label:a,onClick:h}):null);v.propTypes={style:u.object,isAdvanced:u.bool,onClick:u.func,onAdvancedConfigButtonClick:u.func},v.defaultProps={isAdvanced:!1},t.default=v},6643:e=>{e.exports=require("@splunk/react-icons/SlidersDoubleHorizontal")},7020:e=>{e.exports=require("@splunk/react-ui/Button")},7408:e=>{e.exports=require("@splunk/react-ui/Color")},9250:e=>{e.exports=require("@splunk/react-ui/ControlGroup")},8965:e=>{e.exports=require("@splunk/react-ui/FormRows")},1551:e=>{e.exports=require("@splunk/react-ui/Popover")},4082:e=>{e.exports=require("@splunk/react-ui/Text")},6379:e=>{e.exports=require("@splunk/react-ui/Tooltip")},3563:e=>{e.exports=require("@splunk/themes")},4566:e=>{e.exports=require("@splunk/themes/variables")},6649:e=>{e.exports=require("@splunk/ui-utils/i18n")},8987:e=>{e.exports=require("@splunk/ui-utils/id")},3850:e=>{e.exports=require("@splunk/visualization-color-palettes")},3283:e=>{e.exports=require("@splunk/visualizations-shared/colorUtils")},4793:e=>{e.exports=require("lodash")},23:e=>{e.exports=require("prop-types")},9497:e=>{e.exports=require("react")},232:e=>{e.exports=require("styled-components")}},t={};function o(l){var a=t[l];if(void 0!==a)return a.exports;var r=t[l]={exports:{}};return e[l].call(r.exports,r,r.exports,o),r.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var l in t)o.o(t,l)&&!o.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l=o(2965);module.exports=l})();
75
+ `;t.AdvancedConfigButton=({label:e="",onClick:t})=>i.default.createElement(g,{"data-test":`${e}-advanced-config-button-tooltip`,content:(0,s._)("Advanced configurations")},i.default.createElement(C,{"data-test":`${e}-advanced-config-button`,icon:i.default.createElement(c.default,{"data-test":`${e}-advanced-config-button-icon`}),appearance:"subtle",onClick:t}));const v=({"data-test":e,children:o,isAdvanced:l=!1,label:r,hideLabel:a,labelPosition:n,labelWidth:u,tooltip:d,help:s,style:c,error:p,controlsLayout:f,onClick:b,onAdvancedConfigButtonClick:h})=>i.default.createElement(m,{"data-test":null!=e?e:"control-group",label:r,hideLabel:a,labelPosition:n,labelWidth:u,tooltip:d,help:s,error:p,style:c,onClick:b,controlsLayout:f},l?i.Children.toArray(o).filter(Boolean).map((e=>(0,i.cloneElement)(e,{style:{flex:1}}))):o,l?i.default.createElement(t.AdvancedConfigButton,{label:r,onClick:h}):null);v.propTypes={style:u.object,isAdvanced:u.bool,onClick:u.func,onAdvancedConfigButtonClick:u.func},t.default=v},6643:e=>{e.exports=require("@splunk/react-icons/SlidersDoubleHorizontal")},7020:e=>{e.exports=require("@splunk/react-ui/Button")},7408:e=>{e.exports=require("@splunk/react-ui/Color")},9250:e=>{e.exports=require("@splunk/react-ui/ControlGroup")},8965:e=>{e.exports=require("@splunk/react-ui/FormRows")},1551:e=>{e.exports=require("@splunk/react-ui/Popover")},4082:e=>{e.exports=require("@splunk/react-ui/Text")},6379:e=>{e.exports=require("@splunk/react-ui/Tooltip")},3563:e=>{e.exports=require("@splunk/themes")},4566:e=>{e.exports=require("@splunk/themes/variables")},6649:e=>{e.exports=require("@splunk/ui-utils/i18n")},8987:e=>{e.exports=require("@splunk/ui-utils/id")},3850:e=>{e.exports=require("@splunk/visualization-color-palettes")},3283:e=>{e.exports=require("@splunk/visualizations-shared/colorUtils")},4793:e=>{e.exports=require("lodash")},23:e=>{e.exports=require("prop-types")},9497:e=>{e.exports=require("react")},232:e=>{e.exports=require("styled-components")}},t={};function o(l){var r=t[l];if(void 0!==r)return r.exports;var a=t[l]={exports:{}};return e[l].call(a.exports,a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var l in t)o.o(t,l)&&!o.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l=o(2965);module.exports=l})();
76
76
  //# sourceMappingURL=MultiColorPickerEditor.js.map