@splunk/dynamic-editors 0.43.0 → 0.43.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"EditorItem.js","mappings":";;;;iRAMA,MAAMA,EAAeA,EACjBC,WACAC,OACAC,QAAQ,KACRC,gBAAgB,MAChBC,aACAC,QACAC,MACAC,MACAC,OACAC,aACAC,OACAC,aAAa,QACbC,mBAEA,MAAMC,GAAgBC,EAAAA,EAAAA,cAClB,CAACC,EAAOC,KACJ,QAA4B,IAAjBJ,GAAqC,MAALI,EAGvC,YADAhB,EAASe,EAAOd,EAAMe,GAI1B,MAAMC,EAAWC,WAAWF,QAAAA,EAAKJ,GAC7BO,OAAOC,SAASH,IAEhBjB,EAASe,EAAOd,EAAMgB,EAC1B,GAEJ,CAACL,EAAcZ,EAAUC,KAGvB,aAAEoB,EAAY,aAAEC,EAAY,WAAEC,EAAU,YAAEC,EAAW,eAAEC,IAAmBC,EAAAA,EAAAA,gBAAe,CAC3FxB,QACAI,MACAC,MACAK,eACAC,kBAGJ,OACIc,IAAAA,cAACC,IAAY,CACTvB,MAAOA,EACPF,cAAeA,EACfC,WAAYA,EACZM,KAAqB,UAAfC,EAAyBD,OAAOmB,EACtCC,QAAwB,YAAfnB,EAA2BD,OAAOmB,EAC3CE,wBAAwB,OAExBJ,IAAAA,cAACK,IAAS,CACN,YAAW/B,EACXK,IAAKA,EACLC,IAAKA,EACLC,KAAMA,EACNR,SAAUsB,EACVW,OAAQV,EACRW,QAASV,EACTW,UAAWV,EACXvB,MAAOmB,EACPe,SAAU3B,IAEH,EAIvBV,EAAasC,UAAY,CAQrBrC,SAAUsC,IAAAA,KAAOC,WAIjBtC,KAAMqC,IAAAA,OAASC,WAIflC,MAAOiC,IAAAA,OAASC,WAIhBrC,MAAOoC,IAAAA,OAIP1B,aAAc0B,IAAAA,OAIdnC,cAAemC,IAAAA,MAAQ,CAAC,MAAO,SAC/B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AAOC,OACf,CCrBAE,EAAoB7/C,EAAK0/C,IACxB,IAAIQ,EAASR,GAAUA,EAAOS,WAC7B,IAAOT,EAAiB,QACxB,IAAM,EAEP,OADAG,EAAoBO,EAAEF,EAAQ,CAAEz0C,EAAGy0C,IAC5BA,CAAM,ECLdL,EAAoBO,EAAI,CAACT,EAASU,KACjC,IAAI,IAAIx9C,KAAOw9C,EACXR,EAAoBS,EAAED,EAAYx9C,KAASg9C,EAAoBS,EAAEX,EAAS98C,IAC5EgN,OAAO0wC,eAAeZ,EAAS98C,EAAK,CAAE29C,YAAY,EAAM59B,IAAKy9B,EAAWx9C,IAE1E,ECNDg9C,EAAoBS,EAAI,CAAC13C,EAAK63C,IAAU5wC,OAAO6wC,UAAUC,eAAeV,KAAKr3C,EAAK63C,GCClFZ,EAAoBnY,EAAKiY,IACH,oBAAXiB,QAA0BA,OAAOC,aAC1ChxC,OAAO0wC,eAAeZ,EAASiB,OAAOC,YAAa,CAAEpjD,MAAO,WAE7DoS,OAAO0wC,eAAeZ,EAAS,aAAc,CAAEliD,OAAO,GAAO,ECF9D,IAAIqjD,EAAsBjB,EAAoB,M","sources":["webpack://@splunk/dynamic-editors/./src/editors/NumberEditor.jsx","webpack://@splunk/dynamic-editors/./src/editors/PercentEditor.jsx","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","webpack://@splunk/dynamic-editors/./src/editors/threshold/ThresholdError.jsx","webpack://@splunk/dynamic-editors/./src/editors/threshold/ThresholdBoundary.jsx","webpack://@splunk/dynamic-editors/./src/utils/threshold.js","webpack://@splunk/dynamic-editors/./src/editors/threshold/AddThreshold.jsx","webpack://@splunk/dynamic-editors/./src/editors/threshold/ThresholdTo.jsx","webpack://@splunk/dynamic-editors/./src/editors/threshold/Threshold.jsx","webpack://@splunk/dynamic-editors/./src/editors/threshold/ThresholdList.jsx","webpack://@splunk/dynamic-editors/./src/editors/threshold/ThresholdColor.jsx","webpack://@splunk/dynamic-editors/./src/editors/ThresholdEditor.jsx","webpack://@splunk/dynamic-editors/./src/containers/EditorItem.jsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/colorConstants\"","webpack://@splunk/dynamic-editors/./src/editors/ColorEditor.jsx","webpack://@splunk/dynamic-editors/./src/editors/RadioBarEditor.jsx","webpack://@splunk/dynamic-editors/./src/editors/SelectEditor.jsx","webpack://@splunk/dynamic-editors/./src/editors/StaticItemEditor.jsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/objectWithoutProperties\"","webpack://@splunk/dynamic-editors/./src/editors/TextEditor.jsx","webpack://@splunk/dynamic-editors/./src/editors/ToggleEditor.jsx","webpack://@splunk/dynamic-editors/./src/shared/Header.jsx","webpack://@splunk/dynamic-editors/./src/shared/Separator.jsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/schemaUtils\"","webpack://@splunk/dynamic-editors/./src/utils/EditorFunctions.js","webpack://@splunk/dynamic-editors/./src/utils/token.js","webpack://@splunk/dynamic-editors/./src/editors/ArrayOfStringsEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/CheckboxEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/ColumnMultiSelectionByFieldNameEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/ColumnMultiSelectionEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/ColumnSelectionEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/CustomizedInSourceEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/DynamicColorEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/DynamicColorEditorWithPrecedence.tsx","webpack://@splunk/dynamic-editors/./src/editors/DynamicItemEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/MarkdownEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/MultiColorPickerEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/NetworkGraphDynamicColorEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/PresetSelectorEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/SeriesColorsByFieldEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/SeriesColorsEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/SliderEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/TableColumnFormatterEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/TableDynamicColorEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/TextAreaEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/ColorPreview.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/FormatterEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Gradient/AddAndReverseStops.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Gradient/GradientColor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Gradient/GradientPreview.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Gradient/GradientTextColor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Gradient/GradientValueConfigurer.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Gradient/RemoveStop.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Gradient/gradientUtils.ts","webpack://@splunk/dynamic-editors/./src/editors/formatters/GradientEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValue/AddAndReverseMatches.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValue/MatchColor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValue/MatchValueConfigurer.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValue/MatchValueText.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValue/RemoveMatch.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValue/matchValueUtils.ts","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValueEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValuePreview.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Palettes/PalettesConfigurer.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Palettes/PalettesDropdown.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Palettes/PresetPaletteTheme.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Palettes/paletteUtils.ts","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValue/AddAndReverseRanges.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValue/RangeBoundary.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValue/RangeColor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValue/RangeValueConfigurer.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValue/RemoveRange.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValue/rangeValueUtils.ts","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValueEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValuePreview.tsx","webpack://@splunk/dynamic-editors/./src/editors/table/AddColumn.tsx","webpack://@splunk/dynamic-editors/./src/editors/table/BackgroundColor.tsx","webpack://@splunk/dynamic-editors/./src/editors/table/ColumnColorEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/table/ColumnFormatterEntry.tsx","webpack://@splunk/dynamic-editors/./src/editors/table/DynamicColorUtils.ts","webpack://@splunk/dynamic-editors/./src/editors/table/FormatByTypeEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/table/columnFormattingUtils.ts","webpack://@splunk/dynamic-editors/./src/editors/table/common/props.ts","webpack://@splunk/dynamic-editors/./src/editors/trellis/TrellisSplitBySelectionEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/useColumnSelectorFooterMessage.tsx","webpack://@splunk/dynamic-editors/./src/hooks/useCSPViolationObserver.tsx","webpack://@splunk/dynamic-editors/./src/hooks/useDataSource.tsx","webpack://@splunk/dynamic-editors/./src/hooks/useNumberInput.ts","webpack://@splunk/dynamic-editors/./src/interfaces/BaseEditorProps.ts","webpack://@splunk/dynamic-editors/./src/interfaces/DynamicColorEditorProps.ts","webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/./src/shared/ArrowLayer.tsx","webpack://@splunk/dynamic-editors/./src/shared/CSPMessage.tsx","webpack://@splunk/dynamic-editors/./src/shared/ClickableIcon.tsx","webpack://@splunk/dynamic-editors/./src/shared/ColumnSelectorFooterMessage.tsx","webpack://@splunk/dynamic-editors/./src/shared/CustomizedInSourceMessage.tsx","webpack://@splunk/dynamic-editors/./src/shared/FormatFieldName.tsx","webpack://@splunk/dynamic-editors/./src/shared/MessageContainer.tsx","webpack://@splunk/dynamic-editors/./src/shared/PreviewWrapper.tsx","webpack://@splunk/dynamic-editors/./src/shared/dimensionConstants.ts","webpack://@splunk/dynamic-editors/./src/utils/columnSelectionUtils.ts","webpack://@splunk/dynamic-editors/./src/utils/dynamicItemInputEditor.ts","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/defineProperty\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/extends\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/ArrowDown\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/ArrowUp\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/ArrowsRectangularDouble\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/Chain\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/ChevronsSlash\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/Cross\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/List\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/ListNumbered\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/Pencil\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/Picture\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/QuotationDouble\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/SlidersDoubleHorizontal\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/TextBBold\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/TextH\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/TextIItalic\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/TrashCanCross\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Button\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Chip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Color\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ColumnLayout\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ControlGroup\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Dropdown\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/FormRows\"","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/Menu\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Message\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Multiselect\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Number\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Popover\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/RadioBar\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ScreenReaderContent\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Select\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Slider\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Switch\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Text\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/TextArea\"","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/themes/variables\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/format\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/id\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-color-palettes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-color-palettes/editors/PresetPalettes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-context/DataSourceContext\"","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 \"@splunk/visualization-encoding/DslParser\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-encoding/EncodingParser\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-encoding/Options\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-encoding/utils/dsl\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-encoding/utils/types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-icons/PresetIcons\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/colorUtils\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/dataSourceUtils\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/style\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/trellisUtils\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@uiw/react-md-editor/nohighlight\"","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/webpack/startup"],"sourcesContent":["import React, { useCallback } from 'react';\nimport T from 'prop-types';\nimport SUINumber from '@splunk/react-ui/Number';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { useNumberInput } from '../hooks/useNumberInput';\n\nconst NumberEditor = ({\n onChange,\n name,\n value = null,\n labelPosition = 'top',\n labelWidth,\n label,\n min,\n max,\n step,\n isDisabled,\n help,\n helpFormat = 'under',\n defaultValue,\n}) => {\n const onValueChange = useCallback(\n (event, v) => {\n if (typeof defaultValue === 'undefined' && v == null) {\n // emit onChange if there's no default value and value is null/undefined (clearing the input)\n onChange(event, name, v);\n return;\n }\n\n const newValue = parseFloat(v ?? defaultValue);\n if (Number.isFinite(newValue)) {\n // emit onChange if the value was updated (by the user, or as a result of defaultValue) to a number\n onChange(event, name, newValue);\n }\n },\n [defaultValue, onChange, name]\n );\n\n const { currentValue, handleChange, handleBlur, handleFocus, handleKeyPress } = useNumberInput({\n value,\n min,\n max,\n defaultValue,\n onValueChange,\n });\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n help={helpFormat === 'under' ? help : undefined}\n tooltip={helpFormat === 'tooltip' ? help : undefined}\n tooltipDefaultPlacement=\"top\"\n >\n <SUINumber\n data-test={name}\n min={min}\n max={max}\n step={step}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyDown={handleKeyPress}\n value={currentValue}\n disabled={isDisabled}\n />\n </ControlGroup>\n );\n};\n\nNumberEditor.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.number,\n /**\n * The option default value\n */\n defaultValue: T.number,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['top', 'left']),\n labelWidth: T.number,\n /**\n * Number component props\n */\n min: T.number,\n max: T.number,\n step: T.number,\n /**\n * Disabled state of component\n */\n isDisabled: T.bool,\n /**\n * Text to display under the the input\n */\n help: T.string,\n /**\n * help text format\n */\n helpFormat: T.oneOf(['text', 'under']),\n};\n\nexport default NumberEditor;\n","import React, { useCallback } from 'react';\nimport T from 'prop-types';\nimport NumberEditor from './NumberEditor';\n\nconst PercentEditor = ({\n name,\n value = 0,\n labelPosition = 'top',\n labelWidth,\n label,\n onChange,\n isDisabled = false,\n help,\n}) => {\n const handleChange = useCallback(\n (event, n, v) => {\n // convert to percentage if the value is defined or we will get a NaN\n onChange(event, n, v == null ? v : v / 100);\n },\n [onChange]\n );\n\n return (\n <NumberEditor\n name={name}\n value={Math.round(value * 100)}\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n onChange={handleChange}\n min={0}\n max={100}\n step={1}\n disabled={isDisabled}\n help={help}\n />\n );\n};\n\nPercentEditor.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 labelWidth: T.number,\n /**\n * The option value\n */\n value: T.number,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['top', 'left']),\n /**\n * Disabled state of component\n */\n isDisabled: T.bool,\n /**\n * Text to display under the the input\n */\n help: T.string,\n};\n\nexport default PercentEditor;\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","import React from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { sprintf } from '@splunk/ui-utils/format';\n\nconst StyledThresholdError = styled.div.attrs(() => ({ 'data-test': 'threshold-error' }))`\n color: ${variables.contentColorNegative};\n padding-top: 5px;\n font-size: 12px;\n display: block;\n`;\n\nconst ThresholdError = ({ error, id, thresholdIndex }) => {\n if (error) {\n return (\n <StyledThresholdError id={id}>\n {typeof thresholdIndex === 'number'\n ? sprintf(_('Error for threshold %(thresholdIndex)d : %(error)s'), {\n thresholdIndex,\n error,\n })\n : sprintf(_('Error: %(error)s'), {\n error,\n })}\n </StyledThresholdError>\n );\n }\n\n return null;\n};\n\nThresholdError.propTypes = {\n id: T.string,\n error: T.string,\n thresholdIndex: T.number,\n};\n\nexport default ThresholdError;\n","import React, { useState, useCallback, useEffect } from 'react';\nimport T from 'prop-types';\nimport { noop } from 'lodash';\nimport Number from '@splunk/react-ui/Number';\nimport { sprintf } from '@splunk/ui-utils/format';\nimport { _ } from '@splunk/ui-utils/i18n';\n\nconst ThresholdBoundary = ({\n 'data-test': dataTest = 'threshold-boundary-input',\n boundary,\n isDisabled = false,\n isEditable = true,\n errorId,\n onChange = noop,\n onRequestClose = noop,\n onValidate = noop,\n index,\n}) => {\n const [boundaryValue, setBoundaryValue] = useState(boundary);\n\n useEffect(() => {\n setBoundaryValue(boundary);\n }, [boundary]);\n\n const handleFromChange = useCallback(\n (e, { value }) => {\n setBoundaryValue(value);\n onValidate(value);\n },\n [onValidate]\n );\n\n const handleKeyDown = useCallback(\n e => {\n if (e.key === 'Enter') {\n onChange(boundaryValue);\n }\n if (e.key === 'Escape') {\n onRequestClose();\n }\n },\n [boundaryValue, onChange, onRequestClose]\n );\n\n const handleBlur = useCallback(() => {\n onChange(boundaryValue);\n }, [onChange, boundaryValue]);\n\n const label =\n typeof index === 'number' ? sprintf(_('Threshold number %(index)d'), { index }) : _('Threshold');\n\n return isEditable ? (\n <Number\n aria-label={\n boundaryValue\n ? sprintf(_('%(label)s, value %(boundaryValue)d'), { label, boundaryValue })\n : sprintf(_('%(label)s, no value'), { label })\n }\n inline\n hideStepButtons\n disabled={isDisabled}\n value={boundaryValue || boundaryValue === 0 ? boundaryValue : null}\n onChange={handleFromChange}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n error={!!errorId}\n data-test={dataTest}\n describedBy={errorId}\n />\n ) : null;\n};\nThresholdBoundary.propTypes = {\n 'data-test': T.string,\n boundary: T.number,\n isDisabled: T.bool,\n isEditable: T.bool,\n errorId: T.string,\n onChange: T.func,\n onRequestClose: T.func,\n onValidate: T.func,\n index: T.number,\n};\n\nexport default ThresholdBoundary;\n","import { difference, get, isNaN, omit, uniqBy } from 'lodash';\n\nimport { _ } from '@splunk/ui-utils/i18n';\n\nexport const defaultThresholds = [\n {\n from: 100,\n value: '#cb3b43',\n },\n {\n from: 70,\n to: 100,\n value: '#ff7152',\n },\n {\n from: 50,\n to: 70,\n value: '#fc9850',\n },\n {\n from: 30,\n to: 50,\n value: '#f4df7a',\n },\n {\n from: 10,\n to: 30,\n value: '#4beba8',\n },\n {\n to: 10,\n value: '#5fbcff',\n },\n];\n\nexport const defaultThresholdColors = [\n '#dc4e41',\n '#f1813f',\n '#f8be34',\n '#53a051',\n '#0877a6',\n '#006d9c',\n '#ec9960',\n '#af575a',\n '#62b3b2',\n '#4fa484',\n '#f8be44',\n '#5a4575',\n '#708794',\n '#294e70',\n '#b6c75a',\n];\n\n/**\n * returns thresholds for a viz definition\n *\n * @param {object} viz definition\n * @return {array} the thresholds configuration for the thresholds editor\n */\nexport function getThresholdsForVizDefinition(vizDefinition, thresholdField) {\n return get(vizDefinition, `encoding.${thresholdField}.format.ranges`, []);\n}\n\n/**\n * Translates a thresholds configuration back into a viz definition.\n * This fn checks whether encoding exists and updates / adds an encoding configuration\n *\n * @param {object} viz definition\n * @param {array) thresholds configuration in form [{ from: <boundary>, to: <boundary>, value: <threshold value> }]\n * @param {string} the field where threshold should be applied to\n * @param {string} the default encoding field value to be used if no encoding was present\n * @return {object} an updated viz defintion with thresholds configuration applied\n */\nexport function getUpdatedVizConfigForThresholds(\n vizDefinition,\n thresholds,\n thresholdField,\n defaultEncodingFieldValue\n) {\n const formatConfig = {\n type: 'rangevalue',\n ranges: thresholds,\n };\n // @TODO(pwied):\n // future:\n // - viz data contract should expose which encoding fields are thresholdable\n // - threshold editor needs to know about the encoding field and pass it to this fn\n // - a visualization definition should always come with encoding (contract parsing needs to happen in dashboards)\n\n const getOverloadedThresholdFieldValue = tf => {\n if (typeof tf === 'object') {\n return tf;\n }\n if (typeof tf === 'string') {\n return { field: tf };\n }\n return { field: defaultEncodingFieldValue };\n };\n\n const encoding = vizDefinition?.encoding;\n const thresholdFieldValue = getOverloadedThresholdFieldValue(get(encoding, [thresholdField]));\n\n return {\n ...vizDefinition,\n encoding: {\n ...encoding,\n [thresholdField]: {\n ...thresholdFieldValue,\n format: formatConfig,\n },\n },\n };\n}\n\n/**\n * returns a viz definition with default thresholds set\n *\n * @param {object} viz definition\n * @param {string} the encoding field where threshold should be used\n * @param {string} the default encoding field value for the threshold field (ie primary[0])\n * @return {object} an updated viz defintion with default thresholds configuration applied\n */\nexport function getVizConfigWithDefaultThresholds(vizDefinition, thresholdField, defaultEncodingFieldValue) {\n return getUpdatedVizConfigForThresholds(\n vizDefinition,\n defaultThresholds,\n thresholdField,\n defaultEncodingFieldValue\n );\n}\n\n/**\n * returns a viz definition without threshold options\n *\n * @param {object} viz definition\n * @param {string} the encoding field where threshold is applied\n * @return {object} an updated viz defintion without threshold options\n */\nexport function getVizConfigWithoutThresholds(vizDefinition, thresholdField) {\n return omit(vizDefinition, `encoding.${thresholdField}`);\n}\n\n/**\n * returns a new threshold color\n *\n * @param {array} an array of threshold colors that should not be picked\n * @return {string} a color from default threshold colors that is not in the passed parameter\n * or #444000 if all colors from default colors are already used\n */\nexport function getNewThresholdColor(thresholdColors = []) {\n const diff = difference(defaultThresholdColors, thresholdColors);\n if (diff.length > 0) {\n return diff[0];\n }\n return '#444000';\n}\n\n/**\n * getUpdatedThresholdConfig calculates new threshold boundaries given an array\n * of outdated threshold configurations.\n * - the first element will always be an open upper boundary\n * - the last element will always be an open lower boundary\n * - all elements inbetween will have well defined, closed boundaries\n *\n * @param {array} array of thresholds\n * @return {array} an array of thresholds with updated boundaries\n */\nexport function getUpdatedThresholdConfig(thresholds = []) {\n if (thresholds.length < 2) {\n // a threshold config needs at least 2 levels\n // eslint-disable-next-line no-console\n console.warn('Invalid threshold configuration: at least 2 thresholds required');\n return thresholds;\n }\n // convert from and to values to numbers if they are available\n const updatedThresholds = thresholds.map(threshold => {\n const updatedThreshold = { ...threshold };\n if (threshold.from) {\n updatedThreshold.from = +threshold.from;\n }\n if (threshold.to) {\n updatedThreshold.to = +threshold.to;\n }\n return updatedThreshold;\n });\n const openLowerBounds = updatedThresholds.filter(t => t.from === undefined);\n if (openLowerBounds.length > 1) {\n // eslint-disable-next-line no-console\n console.warn('Invalid threshold configuration: multiple open lower boundaries');\n }\n // in order to determine the threshold order and ranges we can ignore the open lower bound\n const otherThresholds = updatedThresholds.filter(t => t.from !== undefined);\n if (otherThresholds.length !== uniqBy(otherThresholds, 'from').length) {\n // eslint-disable-next-line no-console\n console.warn('Invalid threshold configuration: duplicate from values');\n }\n const sortedOtherThresholds = otherThresholds.sort((a, b) => +b.from - +a.from);\n\n // This range set has open boundaries\n if (openLowerBounds.length) {\n const openLowerBound = openLowerBounds[0];\n // if the lowest from-value is not the open lower bound's to-value, update the open lower bound\n if (openLowerBound.to !== sortedOtherThresholds[sortedOtherThresholds.length - 1].from) {\n openLowerBound.to = sortedOtherThresholds[sortedOtherThresholds.length - 1].from;\n }\n // calculate the threshold ranges\n sortedOtherThresholds.forEach((el, index) => {\n const threshold = { ...el };\n if (index > 0) {\n threshold.to = sortedOtherThresholds[index - 1].from;\n } else {\n // the open uper bound is on index=0, it should not have a to value\n delete threshold.to;\n }\n sortedOtherThresholds[index] = threshold;\n });\n return [...sortedOtherThresholds, openLowerBound];\n }\n\n // This rangeset is closed ranges\n // calculate the threshold ranges\n sortedOtherThresholds.forEach((el, index) => {\n const threshold = { ...el };\n if (index > 0) {\n threshold.to = sortedOtherThresholds[index - 1].from;\n }\n sortedOtherThresholds[index] = threshold;\n });\n\n return sortedOtherThresholds;\n}\n\n/**\n * validate whether a threshold boundary update is valid\n *\n * @param {string} thresholdValueStr\n * @param {array} thresholds\n * @return {object} validation result containing error flag and an error message\n */\nexport function validateThresholdBoundary(thresholdValueStr = '', thresholds = []) {\n const thresholdValue = parseFloat(thresholdValueStr);\n if (isNaN(thresholdValue) || isNaN(+thresholdValueStr)) {\n return {\n error: true,\n errorMessage: _('Not a valid threshold. Must be a number'),\n };\n }\n if (thresholds.filter(t => t.from === thresholdValue).length > 0) {\n return {\n error: true,\n errorMessage: _('Value already exists'),\n };\n }\n return {\n error: false,\n errorMessage: null,\n };\n}\n\n/**\n * validate whether a threshold boundary update is valid\n *\n * @param {String|Number} thresholdValueStr\n * @param {String|Number} fromValueStr\n * @return {Object} validation result containing error flag and an error message\n */\nexport function validateThresholdUpperBoundary(thresholdValueStr = '', fromValueStr = '') {\n const thresholdValue = parseFloat(thresholdValueStr);\n const fromValue = parseFloat(fromValueStr);\n\n if (isNaN(thresholdValue) || isNaN(+thresholdValueStr) || isNaN(fromValue) || isNaN(+fromValueStr)) {\n return {\n error: true,\n errorMessage: _('Not a valid threshold. Must be a number'),\n };\n }\n if (thresholdValue < fromValue) {\n return {\n error: true,\n errorMessage: _('Upper boundary must exceed lower boundary'),\n };\n }\n return {\n error: false,\n errorMessage: null,\n };\n}\n","import React, { useState, useCallback } from 'react';\nimport T from 'prop-types';\nimport { noop } from 'lodash';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport Button from '@splunk/react-ui/Button';\nimport ThresholdError from './ThresholdError';\nimport ThresholdBoundary from './ThresholdBoundary';\nimport { validateThresholdBoundary } from '../../utils/threshold';\n\nconst StyledAddThreshold = styled.div.attrs(() => ({ 'data-test': 'add-threshold-level' }))`\n margin-bottom: 10px;\n`;\n\nconst AddThreshold = ({ thresholds, onAddThreshold = noop }) => {\n const [showInput, setShowInput] = useState(false);\n const [error, setError] = useState(null);\n\n const handleInputToggle = useCallback(() => {\n setShowInput(!showInput);\n }, [showInput]);\n\n const handleBoundaryChange = useCallback(\n value => {\n const validationResult = validateThresholdBoundary(value, thresholds);\n\n if (validationResult.error) {\n setError(validationResult.errorMessage);\n } else {\n onAddThreshold(value);\n }\n },\n [thresholds, onAddThreshold]\n );\n\n const handleValidateBoundary = useCallback(\n value => {\n const validationResult = validateThresholdBoundary(value, thresholds);\n\n if (validationResult.error) {\n setError(validationResult.errorMessage);\n }\n },\n [thresholds]\n );\n\n return (\n <StyledAddThreshold>\n {showInput ? (\n <React.Fragment>\n <ThresholdBoundary\n data-test=\"add-threshold-input\"\n isError={!!error}\n onChange={handleBoundaryChange}\n onRequestClose={handleInputToggle}\n onValidate={handleValidateBoundary}\n />\n <ThresholdError error={error} />\n </React.Fragment>\n ) : (\n <Button\n appearance=\"secondary\"\n onClick={handleInputToggle}\n label={`+ ${_('Add threshold level')}`}\n />\n )}\n </StyledAddThreshold>\n );\n};\n\nAddThreshold.propTypes = {\n onAddThreshold: T.func,\n thresholds: T.array,\n};\n\nexport default AddThreshold;\n","import React from 'react';\nimport T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport ThresholdBoundary from './ThresholdBoundary';\n\nconst StyledThresholdBoundaryInput = styled.div`\n margin-right: 10px;\n width: 100px;\n display: inline-block;\n`;\n\nconst StyledThresholdBoundaryText = styled.div.attrs(() => ({ 'data-test': 'threshold-boundary-label' }))`\n flex-grow: 1;\n flex-direction: row;\n`;\n\nconst ToContentSpan = styled.span`\n line-height: 36px;\n margin-right: 10px;\n color: ${props => (props.isDisabled ? variables.contentColorDisabled : variables.contentColorMuted)};\n`;\n\nconst ToContentValue = styled.span`\n display: inline-block;\n color: ${props => (props.isDisabled ? variables.contentColorDisabled : variables.contentColorMuted)};\n width: 30px;\n text-overflow: ellipsis;\n vertical-align: bottom;\n overflow: hidden;\n white-space: nowrap;\n`;\n\n// Span with extra wrapping to handle aria describedBy attribute passed by tooltip\nconst ToContent = ({ describedBy, isDisabled, to }) => (\n <ToContentValue aria-describedby={describedBy} isDisabled={isDisabled}>\n {to}\n </ToContentValue>\n);\nToContent.propTypes = {\n describedBy: T.any,\n isDisabled: T.bool,\n to: T.number,\n};\n\nconst ToTooltip = ({ isDisabled, to }) => (\n <Tooltip content={`${to}`}>\n <ToContent to={to} isDisabled={isDisabled} />\n </Tooltip>\n);\nToTooltip.propTypes = {\n isDisabled: T.bool,\n to: T.number,\n};\n\n/**\n * To\n */\nconst ThresholdTo = ({ index, to, isRemovable, isEditable, onChange, isDisabled, errorId }) => {\n const isFirst = index === 0;\n const prefix = isRemovable ? `${_('and')} ` : '';\n\n return isEditable ? (\n <StyledThresholdBoundaryText>\n <ToContentSpan isDisabled={isDisabled}>{_('to')}</ToContentSpan>\n <StyledThresholdBoundaryInput>\n <ThresholdBoundary\n data-test=\"threshold-to-level\"\n boundary={to}\n isDisabled={isDisabled}\n isEditable\n errorId={errorId}\n onChange={onChange}\n />\n </StyledThresholdBoundaryInput>\n </StyledThresholdBoundaryText>\n ) : (\n <StyledThresholdBoundaryText>\n {isFirst && <ToContentSpan isDisabled={isDisabled}>{_('and above')}</ToContentSpan>}\n {!isFirst && (\n <React.Fragment>\n <ToContentSpan isDisabled={isDisabled}>{`${prefix}${_('below')}`}</ToContentSpan>\n <ToTooltip isDisabled={isDisabled} to={to} />\n </React.Fragment>\n )}\n </StyledThresholdBoundaryText>\n );\n};\nThresholdTo.propTypes = {\n to: T.number,\n index: T.number,\n isRemovable: T.bool,\n isEditable: T.bool,\n isDisabled: T.bool,\n onChange: T.func,\n errorId: T.string,\n};\n\nexport default ThresholdTo;\n","import React, { useCallback, useMemo } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport ClearIcon from '@splunk/react-icons/Cross';\nimport Button from '@splunk/react-ui/Button';\nimport { createDOMID } from '@splunk/ui-utils/id';\nimport { variables } from '@splunk/themes';\nimport ThresholdError from './ThresholdError';\nimport ThresholdBoundary from './ThresholdBoundary';\nimport ThresholdTo from './ThresholdTo';\n\nconst StyledThresholdLevel = styled.div.attrs(() => ({ 'data-test': 'threshold-level' }))`\n width: 100%;\n position: relative;\n display: flex;\n align-items: flex-end;\n margin-bottom: 5px;\n`;\n\nconst StyledThresholdBoundaryInput = styled.div`\n margin-right: 10px;\n width: 100px;\n display: inline-block;\n`;\n\nconst StyledThresholdValueArea = styled.div`\n display: flex;\n margin-left: auto;\n`;\n\nconst StyledRemoveArea = styled.div`\n margin-left: ${variables.spacingXSmall};\n width: ${variables.spacingXXLarge};\n`;\nconst RemoveAreaButton = styled(Button)`\n color: ${props =>\n props.disabled ? variables.contentColorDisabled : variables.contentColorActive} !important;\n &:hover {\n background-color: ${props => !props.disabled && variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nconst Threshold = ({\n editFrom,\n editTo,\n editValue,\n error,\n from,\n index,\n isDisabled = false,\n isRemovable = false,\n onChange,\n onRemove,\n renderThresholdValueEditor,\n to,\n value,\n}) => {\n const handleFromChange = useCallback(\n newFrom => {\n if (error || newFrom !== from) {\n onChange(index, {\n from: newFrom,\n value,\n to,\n });\n }\n },\n [onChange, from, value, to, index, error]\n );\n\n const handleToChange = useCallback(\n newTo => {\n if (error || newTo !== to) {\n onChange(index, {\n from,\n value,\n to: newTo,\n });\n }\n },\n [onChange, from, value, to, index, error]\n );\n\n const onValueChange = useCallback(\n ({ value: val }) => {\n onChange(index, {\n from,\n value: val,\n to,\n });\n },\n [onChange, index, from, to]\n );\n\n const handleRemove = useCallback(() => onRemove(index), [onRemove, index]);\n\n const errorId = useMemo(() => (error ? createDOMID('threshold-error') : undefined), [error]);\n\n return (\n <React.Fragment>\n <StyledThresholdLevel>\n <StyledThresholdBoundaryInput>\n <ThresholdBoundary\n data-test=\"threshold-from-level\"\n boundary={from}\n isDisabled={isDisabled}\n isEditable={editFrom}\n errorId={errorId}\n onChange={handleFromChange}\n index={index}\n />\n </StyledThresholdBoundaryInput>\n <ThresholdTo\n to={to}\n index={index}\n isRemovable={isRemovable}\n isEditable={editTo}\n isDisabled={isDisabled}\n onChange={handleToChange}\n errorId={errorId}\n />\n <StyledThresholdValueArea>\n {renderThresholdValueEditor({\n value,\n onChange: onValueChange,\n isDisabled: isDisabled || !!error,\n editValue,\n })}\n </StyledThresholdValueArea>\n <StyledRemoveArea>\n {isRemovable && (\n <RemoveAreaButton\n data-test=\"threshold-remove-button\"\n icon={<ClearIcon />}\n appearance=\"subtle\"\n onClick={handleRemove}\n disabled={isDisabled}\n />\n )}\n </StyledRemoveArea>\n </StyledThresholdLevel>\n <ThresholdError error={error} id={errorId} thresholdIndex={index} />\n </React.Fragment>\n );\n};\n\nThreshold.propTypes = {\n editFrom: T.bool,\n editTo: T.bool,\n editValue: T.bool,\n error: T.string,\n from: T.number,\n index: T.number,\n isDisabled: T.bool,\n isRemovable: T.bool,\n onChange: T.func,\n onRemove: T.func,\n renderThresholdValueEditor: T.elementType.isRequired,\n to: T.number,\n value: T.string,\n};\n\nexport default Threshold;\n","import React, { useCallback, useState } from 'react';\nimport T from 'prop-types';\nimport { cloneDeep } from 'lodash';\nimport {\n validateThresholdBoundary,\n validateThresholdUpperBoundary,\n getUpdatedThresholdConfig,\n} from '../../utils/threshold';\nimport Threshold from './Threshold';\n\nconst defaultRanges = [];\n\nconst ThresholdList = ({\n ranges = defaultRanges,\n openRanges = true,\n isDisabled = false,\n onChange,\n renderThresholdValueEditor,\n}) => {\n const [errors, setErrors] = useState({});\n /**\n * Remove a threshold from the list\n */\n const handleRemoveThreshold = useCallback(\n index => {\n const result = cloneDeep(ranges);\n result.splice(index, 1);\n\n onChange(getUpdatedThresholdConfig(result));\n const errs = { ...errors };\n delete errs[index];\n setErrors(errs);\n },\n [errors, ranges, onChange]\n );\n\n /**\n * Update the threshold content at an index\n */\n const handleChangeThreshold = useCallback(\n (index, threshold) => {\n const result = cloneDeep(ranges);\n const errs = { ...errors };\n result.splice(index, 1, threshold);\n delete errs[index];\n\n if (!openRanges && index === 0) {\n const validationResult = validateThresholdUpperBoundary(threshold.to, threshold.from);\n\n if (validationResult.error) {\n errs[index] = validationResult.errorMessage;\n }\n }\n\n /*\n * When dealing with a closed range:\n * changes to range from values will overwrite all the to values of the lower ranges,\n * but the ranges are not sorted and overwritten until after validation\n * When a lower range becomes the top range, the top \"to\" value will not have anything to\n * be overwritten to, so it will remain an incorrect value lower than its associated from\n */\n if (\n !openRanges &&\n index !== 0 &&\n threshold.to < threshold.from &&\n threshold.from > ranges[0].from\n ) {\n // Since this will become the top threshold, we will add a new arbitrary top value like add threshold does\n result[index].to = threshold.from + 10;\n }\n\n // When open, the last threshold does not have an editable boundry, so skip validation\n if (!openRanges || index < ranges.length - 1) {\n const withoutCurrent = cloneDeep(ranges);\n withoutCurrent.splice(index, 1);\n\n const validationResult = validateThresholdBoundary(threshold.from, withoutCurrent);\n\n if (validationResult.error) {\n errs[index] = validationResult.errorMessage;\n }\n }\n\n setErrors(errs);\n\n if (!Object.keys(errs).length) {\n onChange(getUpdatedThresholdConfig(result));\n }\n },\n [errors, ranges, onChange, openRanges]\n );\n\n const hasErrors = !!Object.keys(errors).length;\n\n const canRemove = useCallback(\n index =>\n (!openRanges && ranges.length > 1) ||\n (openRanges && ranges.length > 2 && index !== ranges.length - 1),\n [openRanges, ranges]\n );\n\n return ranges.map((threshold, index) => (\n <Threshold\n key={`threshold-${threshold.from}-${threshold.to}-${threshold.value}`}\n onRemove={handleRemoveThreshold}\n onChange={handleChangeThreshold}\n index={index}\n from={threshold.from}\n to={threshold.to}\n value={threshold.value}\n error={errors[index]}\n editFrom={!openRanges || index !== ranges.length - 1}\n editTo={!openRanges && index === 0}\n editValue={!hasErrors}\n isRemovable={canRemove(index)}\n isDisabled={isDisabled}\n renderThresholdValueEditor={renderThresholdValueEditor}\n />\n ));\n};\n\nThresholdList.propTypes = {\n onChange: T.func.isRequired,\n ranges: T.arrayOf(\n T.shape({\n from: T.number,\n to: T.number,\n value: T.string,\n })\n ),\n isDisabled: T.bool,\n renderThresholdValueEditor: T.elementType.isRequired,\n openRanges: T.bool,\n};\n\nexport default ThresholdList;\n","import React from 'react';\nimport T from 'prop-types';\nimport Color from '@splunk/react-ui/Color';\nimport { isColor } from '@splunk/visualizations-shared/colorUtils';\nimport { defaultThresholdColors } from '../../utils/threshold';\n\nconst ThresholdColor = ({ isDisabled, value, onChange }) => (\n <Color\n disabled={isDisabled}\n value={isColor(value) ? value : 'transparent'}\n onChange={onChange}\n hideInput // prisma only\n palette={defaultThresholdColors}\n data-test=\"threshold-level-value\"\n />\n);\nThresholdColor.propTypes = {\n isDisabled: T.bool,\n value: T.string,\n onChange: T.func.isRequired,\n};\n\nexport default ThresholdColor;\n","import React, { useCallback } from 'react';\nimport T from 'prop-types';\nimport { cloneDeep } from 'lodash';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Switch from '@splunk/react-ui/Switch';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport AddThreshold from './threshold/AddThreshold';\nimport ThresholdList from './threshold/ThresholdList';\nimport { getNewThresholdColor, getUpdatedThresholdConfig } from '../utils/threshold';\nimport ThresholdColor from './threshold/ThresholdColor';\n\nconst Col = styled.div`\n flex-direction: column;\n flex-grow: 1;\n`;\n\nconst ThresholdEditor = ({\n onChange,\n name,\n itemSchema,\n value,\n labelPosition = 'top',\n labelWidth,\n label,\n isDisabled = false,\n isTogglable = true,\n openRanges = true,\n renderThresholdValueEditor = ThresholdColor,\n}) => {\n const isEnabled = Array.isArray(value) && value.length > 0;\n\n const setDefaultThresholds = useCallback(() => {\n onChange(null, name, itemSchema.default);\n }, [itemSchema, name, onChange]);\n\n const clearThresholds = useCallback(() => {\n onChange(null, name, null);\n }, [name, onChange]);\n\n const handleEnableClick = useCallback(() => {\n if (!isEnabled) {\n return setDefaultThresholds();\n }\n return clearThresholds();\n }, [isEnabled, setDefaultThresholds, clearThresholds]);\n\n const handleAddThreshold = useCallback(\n from => {\n const existingThresholds = cloneDeep(value);\n const color = getNewThresholdColor(existingThresholds.map(t => t.value));\n const result = { from, value: color };\n if (!openRanges) {\n // add an arbitrary to value in case this is a new top range\n result.to = from + 10;\n }\n existingThresholds.push(result);\n const sortedThresholds = getUpdatedThresholdConfig(existingThresholds);\n\n onChange(null, name, sortedThresholds);\n },\n [name, value, onChange, openRanges]\n );\n\n const handleThresholdChange = useCallback(\n thresholds => {\n onChange(null, name, thresholds);\n },\n [onChange, name]\n );\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth}>\n <Col data-test={name}>\n {isTogglable && (\n <Switch\n appearance=\"toggle\"\n selected={isEnabled}\n onClick={handleEnableClick}\n disabled={isDisabled}\n role=\"switch\"\n >\n {_('Threshold')}\n </Switch>\n )}\n {isEnabled && (\n <React.Fragment>\n {!isDisabled && (\n <AddThreshold onAddThreshold={handleAddThreshold} thresholds={value} />\n )}\n <ThresholdList\n onChange={handleThresholdChange}\n ranges={value}\n isDisabled={isDisabled}\n openRanges={openRanges}\n renderThresholdValueEditor={renderThresholdValueEditor}\n />\n </React.Fragment>\n )}\n </Col>\n </ControlGroup>\n );\n};\n\nThresholdEditor.propTypes = {\n /**\n * Callback when selecting an item from the menu\n *\n * @param {SyntheticEvent} event The React `SyntheticEvent`\n * @param {string} name The option name\n * @param {string|boolean} value The option value\n */\n onChange: T.func.isRequired,\n /**\n * The option name\n */\n name: T.string.isRequired,\n /**\n * The item JSON schema, it should contain `enum` property. Note this will only be used when `values` prop is undefined\n */\n itemSchema: T.object,\n /**\n * The option value\n */\n value: T.arrayOf(\n T.shape({\n from: T.number,\n to: T.number,\n value: T.string,\n })\n ),\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['left', 'top']),\n labelWidth: T.number,\n /**\n * Make thresholds editable\n */\n isDisabled: T.bool,\n openRanges: T.bool,\n renderThresholdValueEditor: T.elementType,\n isTogglable: T.bool,\n};\n\nexport default ThresholdEditor;\n","import React from 'react';\nimport T from 'prop-types';\nimport CheckboxEditor from '../editors/CheckboxEditor';\nimport SelectEditor from '../editors/SelectEditor';\nimport RadioBarEditor from '../editors/RadioBarEditor';\nimport TextEditor from '../editors/TextEditor';\nimport ToggleEditor from '../editors/ToggleEditor';\nimport NumberEditor from '../editors/NumberEditor';\nimport ColorEditor from '../editors/ColorEditor';\nimport PercentEditor from '../editors/PercentEditor';\nimport SliderEditor from '../editors/SliderEditor';\nimport PresetSelectorEditor from '../editors/PresetSelectorEditor';\nimport ImageEditor from '../editors/ImageEditor';\nimport ThresholdEditor from '../editors/ThresholdEditor';\nimport { getStaticItemSchema } from '../utils/EditorFunctions';\nimport { DynamicColorEditor } from '../editors/DynamicColorEditor';\nimport { DynamicColorEditorWithPrecedence } from '../editors/DynamicColorEditorWithPrecedence';\nimport ColumnMultiSelectionEditor from '../editors/ColumnMultiSelectionEditor';\nimport ColumnSelectionEditor from '../editors/ColumnSelectionEditor';\nimport TableColumnFormatterEditor from '../editors/TableColumnFormatterEditor';\nimport { TableDynamicColorEditor } from '../editors/TableDynamicColorEditor';\nimport { TableBackgroundColorEditor } from '../editors/table/BackgroundColor';\nimport MarkdownEditor from '../editors/MarkdownEditor';\nimport StaticItemEditor from '../editors/StaticItemEditor';\nimport DynamicItemEditor from '../editors/DynamicItemEditor';\nimport ArrayOfStringsEditor from '../editors/ArrayOfStringsEditor';\nimport MultiColorPickerEditor from '../editors/MultiColorPickerEditor';\nimport SeriesColorsEditor from '../editors/SeriesColorsEditor';\nimport SeriesColorsByFieldEditor from '../editors/SeriesColorsByFieldEditor';\nimport ColumnMultiSelectionByFieldNameEditor from '../editors/ColumnMultiSelectionByFieldNameEditor';\nimport TrellisSplitBySelectionEditor from '../editors/trellis/TrellisSplitBySelectionEditor';\nimport TextAreaEditor from '../editors/TextAreaEditor';\nimport { NetworkGraphDynamicColorEditor } from '../editors/NetworkGraphDynamicColorEditor';\n\nexport const editorTypeToComponentMap = {\n 'editor.checkbox': CheckboxEditor,\n 'editor.radioBar': RadioBarEditor,\n 'editor.select': SelectEditor,\n 'editor.text': TextEditor,\n 'editor.textArea': TextAreaEditor,\n 'editor.toggle': ToggleEditor,\n 'editor.number': NumberEditor,\n 'editor.color': ColorEditor,\n 'editor.percent': PercentEditor,\n 'editor.image': ImageEditor,\n 'editor.threshold': ThresholdEditor,\n 'editor.presetSelector': PresetSelectorEditor,\n 'editor.dynamicColor': DynamicColorEditor,\n 'editor.dynamicColorWithPrecedence': DynamicColorEditorWithPrecedence,\n 'editor.columnMultiSelector': ColumnMultiSelectionEditor,\n 'editor.columnSelector': ColumnSelectionEditor,\n 'editor.tableColumnFormatter': TableColumnFormatterEditor,\n 'editor.tableBackgroundColor': TableBackgroundColorEditor,\n 'editor.tableDynamicColor': TableDynamicColorEditor,\n 'editor.slider': SliderEditor,\n 'editor.markdown': MarkdownEditor,\n 'editor.staticItem': StaticItemEditor,\n 'editor.dynamicItem': DynamicItemEditor,\n 'editor.arrayOfStrings': ArrayOfStringsEditor,\n 'editor.multiColorPicker': MultiColorPickerEditor,\n 'editor.seriesColors': SeriesColorsEditor,\n 'editor.seriesColorsByField': SeriesColorsByFieldEditor,\n 'editor.columnMultiSelectionByFieldNameEditor': ColumnMultiSelectionByFieldNameEditor,\n 'editor.trellisSplitBy': TrellisSplitBySelectionEditor,\n 'editor.networkGraphDynamicColor': NetworkGraphDynamicColorEditor,\n};\n\nconst EditorItem = ({\n item,\n name,\n itemSchema,\n dataSourceBindings,\n context,\n value,\n onChange,\n isDisabled,\n options,\n optionsSchema,\n}) => {\n const { editor } = item;\n\n let Editor;\n if (typeof editor === 'string') {\n if (!editorTypeToComponentMap[editor]) {\n throw Error(`Invalid editor type: ${editor}`);\n }\n Editor = editorTypeToComponentMap[editor];\n } else {\n Editor = editor;\n }\n const staticItemSchema = getStaticItemSchema(itemSchema);\n\n return (\n <div key={item.option || item.encoding} data-test={`editor-${name}`}>\n <Editor\n {...item.editorProps}\n name={name}\n isOption={!!item.option}\n itemSchema={staticItemSchema}\n dataSourceBindings={dataSourceBindings}\n label={item.label}\n onChange={onChange}\n value={value}\n context={context}\n placeholder={item.placeholder}\n isAdvanced={item.isAdvanced}\n isDisabled={isDisabled}\n options={options}\n optionsSchema={optionsSchema}\n />\n </div>\n );\n};\n\nEditorItem.propTypes = {\n /**\n * Definition of the single item to edit\n * @param {Object} item { option, encoding, editor, label, editorProps }\n */\n item: T.object.isRequired,\n /**\n * TODO: Does this really need to be passed in or can this component determine it from item?\n * @param {String} name The option or encoding name\n */\n name: T.string.isRequired,\n /**\n * @param {Object} itemSchema Either the dataContract or schema for the selected item\n */\n itemSchema: T.object.isRequired,\n /**\n * @param {Object} context The visualization's context config\n */\n context: T.object,\n /**\n * @param {Object} dataSources The current datasource bindings for the visualization\n */\n dataSourceBindings: T.object,\n /**\n * @param {Mixed} value The current value of the item\n */\n value: T.any,\n /**\n * @param {Function} onChange Callback for when the editor value is updated\n */\n onChange: T.func.isRequired,\n /**\n * @param {Boolean} disabled Disabled state of item\n */\n isDisabled: T.bool,\n options: T.object,\n /**\n * @param {Object} optionsSchema Visualization's entire option schema\n */\n optionsSchema: T.object,\n};\n\nexport default EditorItem;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@splunk/visualizations-shared/colorConstants\");","import React, { useEffect, useCallback, useState, useMemo } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport { debounce, noop, toLower } from 'lodash';\nimport { variables } from '@splunk/themes';\nimport Color from '@splunk/react-ui/Color';\nimport Text from '@splunk/react-ui/Text';\nimport { createDOMID } from '@splunk/ui-utils/id';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ScreenReaderContent from '@splunk/react-ui/ScreenReaderContent';\nimport { COLOR_EDITOR_PALETTE } from '@splunk/visualizations-shared/colorConstants';\nimport { isColor } from '@splunk/visualizations-shared/colorUtils';\nimport ControlGroup from '../shared/AdvancedControlGroup';\n\nconst TextContainer = styled.div`\n max-height: ${variables.inputHeight};\n width: 100%;\n min-width: 0;\n`;\n\n// hardcoded style to sync with SUI color picker's hardcoded dimensions\n// TODO(fkurniawan): see if we can leverage prisma's consolidated textInput out of the box instead of our own component\n// right now, we're using hideInput\nconst StyledText = styled(Text)`\n max-height: ${variables.inputHeight};\n`;\n\n/**\n * Trims the color input and returns the result, or default color if the default color is valid, or previous color\n * @param {String} color The color the user entered\n * @param {String} defaultColor The default color of the component\n * @param {String} prevColor The previous color of the component\n * @returns {String}\n */\nconst getColor = ({ color, defaultColor, prevColor }) => {\n const newColor = typeof color === 'string' ? color.trim() : color;\n\n // color === null is `N/A` in color picker\n if (isColor(newColor) || newColor === null) {\n return newColor;\n }\n\n if (isColor(defaultColor)) {\n return defaultColor;\n }\n\n if (isColor(prevColor) || prevColor === null) {\n return prevColor;\n }\n\n return 'transparent';\n};\n\nconst ColorAndTextWrapper = ({\n id,\n showTextInput,\n color,\n palette,\n handleColorChange,\n labelledBy,\n textWidth,\n value,\n name,\n handleTextColorChange,\n handleKeyPress,\n handleBlur,\n isDisabled,\n}) => {\n const textLabelId = useMemo(() => createDOMID('color-code'), []);\n\n return (\n <>\n <div>\n <Color\n key=\"color-editor\"\n append={showTextInput}\n value={getColor({ color })}\n palette={palette}\n onChange={handleColorChange}\n data-test={`color-picker-${name}`}\n disabled={isDisabled}\n hideInput\n labelledBy={labelledBy}\n />\n </div>\n {showTextInput && (\n <TextContainer data-test=\"text-container\" textWidth={textWidth}>\n <ScreenReaderContent id={textLabelId}>{_('Color code input')}</ScreenReaderContent>\n <StyledText\n key={value}\n data-test={name}\n prepend\n value={color === null ? 'N/A' : color}\n onChange={handleTextColorChange}\n onKeyDown={handleKeyPress}\n onBlur={handleBlur}\n disabled={isDisabled}\n // hardcoded style to sync with SUI color picker's hardcoded dimensions\n // TODO(fkurniawan): see if we can leverage prisma's consolidated textInput out of the box\n style={{ height: '32px' }}\n labelledBy={`${labelledBy} ${textLabelId}`}\n inputId={id}\n />\n </TextContainer>\n )}\n </>\n );\n};\n\nColorAndTextWrapper.propTypes = {\n id: T.string,\n showTextInput: T.bool,\n color: T.string,\n palette: T.arrayOf(T.string),\n handleColorChange: T.func,\n labelledBy: T.string,\n textWidth: T.oneOfType([T.string, T.number]),\n value: T.string,\n name: T.string.isRequired,\n handleTextColorChange: T.func,\n handleKeyPress: T.func,\n handleBlur: T.func,\n isDisabled: T.bool,\n};\n\nconst defaultItemSchema = { default: 'transparent' };\nconst emptyStyle = {};\n\n// The propTypes typing for TS callers isn't working for the onChange callback\n/**\n * @param {Object} props\n * @param {(e: import('react').SyntheticEvent, name: string, value: string) => void} [props.onChange]\n * @returns\n */\nconst ColorEditor = ({\n name = 'color',\n value = 'transparent',\n label = '',\n labelPosition = 'top',\n labelWidth,\n palette = COLOR_EDITOR_PALETTE,\n onChange = noop,\n itemSchema = defaultItemSchema,\n isDisabled = false,\n textWidth = 'auto',\n hideLabel = false,\n showTextInput = true,\n style: customEditorStyle = emptyStyle,\n}) => {\n const [color, setColor] = useState(value);\n\n useEffect(() => {\n setColor(value);\n }, [value]);\n\n const debouncedOnChange = useMemo(() => debounce(onChange, 250), [onChange]);\n\n const handleColorChange = useCallback(\n ({ value: val }) => {\n const newColor = getColor({ color: val, defaultColor: itemSchema.default, prevColor: value });\n setColor(newColor);\n if (value !== newColor) {\n // No event to pass back, so it is null\n debouncedOnChange(null, name, newColor);\n }\n },\n [debouncedOnChange, itemSchema.default, name, value]\n );\n\n const handleTextColorChange = useCallback((_event, { value: val }) => {\n const colorToValue = toLower(val).trim() === 'n/a' ? null : val;\n setColor(colorToValue);\n }, []);\n\n const handleKeyPress = useCallback(\n event => {\n if (event.key === 'Escape') {\n setColor(value);\n return;\n }\n if (event.key !== 'Enter') {\n return;\n }\n\n if (value !== color) {\n const newColor = getColor({ color, defaultColor: itemSchema.default, prevColor: value });\n setColor(newColor);\n if (newColor !== value) {\n onChange(event, name, newColor);\n }\n }\n },\n [name, color, value, onChange, itemSchema.default]\n );\n\n const handleBlur = useCallback(\n event => {\n if (color !== value) {\n const newColor = getColor({ color, defaultColor: itemSchema.default, prevColor: value });\n setColor(newColor);\n if (newColor !== value) {\n onChange(event, name, newColor);\n }\n }\n },\n [name, color, value, onChange, itemSchema.default]\n );\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n style={customEditorStyle}\n hideLabel={hideLabel}\n controlsLayout=\"fillJoin\"\n >\n <ColorAndTextWrapper\n showTextInput={showTextInput}\n color={color}\n palette={palette}\n handleColorChange={handleColorChange}\n name={name}\n isDisabled={isDisabled}\n textWidth={textWidth}\n value={value}\n handleTextColorChange={handleTextColorChange}\n handleKeyPress={handleKeyPress}\n handleBlur={handleBlur}\n />\n </ControlGroup>\n );\n};\n\nColorEditor.propTypes = {\n /**\n * The option name\n */\n name: T.string.isRequired,\n\n /**\n * The option value\n */\n value: T.string,\n\n /**\n * @param {Object} itemSchema Either the dataContract or schema for the selected item\n */\n itemSchema: T.object,\n\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n\n /**\n * Flag to hide the editor label\n */\n hideLabel: T.bool,\n\n /**\n * Flag to hide the color text input\n */\n showTextInput: T.bool,\n\n /**\n * Custom styling for the editor layout, eg: setting margin-bottom to 0px for ControlGroup, SUI has it at 15px\n */\n style: T.object,\n\n /**\n * Label position\n */\n labelPosition: T.oneOf(['top', 'left']),\n\n /**\n * Label position\n */\n labelWidth: T.number,\n\n /**\n * An array of color swatch values\n */\n palette: T.arrayOf(T.string),\n\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 * Disabled state of component\n */\n isDisabled: T.bool,\n textWidth: T.oneOfType([T.string, T.number]),\n};\n\nexport default ColorEditor;\n","import React, { useCallback } from 'react';\nimport T from 'prop-types';\nimport RadioBar from '@splunk/react-ui/RadioBar';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport { hasTokens } from '../utils/token';\nimport { getOptions } from '../utils/EditorFunctions';\nimport { editorStyle } from '../shared/dimensionConstants';\nimport ControlGroup from '../shared/AdvancedControlGroup';\n\nconst RadioBarEditor = ({\n onChange,\n name,\n itemSchema,\n values,\n value,\n labelPosition = 'top',\n labelWidth,\n label,\n isDisabled = false,\n}) => {\n const options = getOptions(itemSchema, values);\n const disabled = hasTokens(value) || isDisabled;\n const handleChange = useCallback((event, { value: v }) => onChange(event, name, v), [onChange, name]);\n\n // TODO: SUI 4.0 renders empty labels differently. Labels should never be empty strings, instead pass\n // a valid label and set hideLabel on ControlGroup\n const controlGroupMarginFix = !label || label === '' ? { marginTop: '-8px' } : undefined;\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n style={controlGroupMarginFix}\n >\n <RadioBar\n data-test={name}\n onChange={handleChange}\n value={value}\n style={editorStyle}\n disabled={disabled}\n >\n {options.map(v => {\n const displayContent = v.label || v.value;\n\n // TODO: Revisit this. SUI supports label with icon, so why doesn't this editor?\n const optionProps = {};\n if (v.icon) {\n // Splunk-UI Button does not support tooltip as of now, so we need to use Tooltip on icon\n optionProps.startAdornment = (\n <Tooltip content={displayContent}>\n <v.icon hideDefaultTooltip />\n </Tooltip>\n );\n } else {\n optionProps.label = displayContent;\n }\n\n return (\n <RadioBar.Option key={v.value} value={v.value} disabled={disabled} {...optionProps} />\n );\n })}\n </RadioBar>\n </ControlGroup>\n );\n};\n\nRadioBarEditor.propTypes = {\n /**\n * Callback when selecting an item from radio bar\n *\n * @param {SyntheticEvent} event The React `SyntheticEvent`\n * @param {string} name The option name\n * @param {string|boolean} value The option value\n */\n onChange: T.func.isRequired,\n /**\n * The option name\n */\n name: T.string.isRequired,\n /**\n * The item JSON schema, it should contain `enum` property. Note this will only be used when `values` prop is undefined\n */\n itemSchema: T.object,\n /**\n * The option values that can be selected\n */\n values: T.arrayOf(\n T.shape({\n label: T.string,\n value: T.oneOfType([T.string, T.bool]).isRequired,\n })\n ),\n /**\n * The option value\n */\n value: T.oneOfType([T.string, T.bool]),\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['left', 'top']),\n labelWidth: T.number,\n /**\n * Disabled state of component\n */\n isDisabled: T.bool,\n};\n\nexport default RadioBarEditor;\n","import React, { useCallback } from 'react';\nimport T from 'prop-types';\nimport Select from '@splunk/react-ui/Select';\nimport { hasTokens } from '../utils/token';\nimport { getOptions } from '../utils/EditorFunctions';\nimport { editorStyle } from '../shared/dimensionConstants';\nimport ControlGroup from '../shared/AdvancedControlGroup';\n\nconst SelectEditor = ({\n onChange,\n name,\n itemSchema,\n values,\n value,\n labelPosition = 'top',\n labelWidth,\n label,\n tooltip,\n isDisabled = false,\n isAdvanced,\n hideLabel,\n help,\n}) => {\n const options = getOptions(itemSchema, values);\n const disabled = hasTokens(value) || isDisabled;\n const handleChange = useCallback((event, { value: v }) => onChange(event, name, v), [onChange, name]);\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n isAdvanced={isAdvanced}\n hideLabel={hideLabel}\n >\n <Select\n data-test={name}\n onChange={handleChange}\n value={value}\n disabled={disabled}\n style={editorStyle}\n >\n {options.map(v => (\n <Select.Option\n key={v.value}\n value={v.value}\n label={v.label || v.value}\n icon={v.icon ? <v.icon /> : null}\n description={v.description}\n />\n ))}\n </Select>\n </ControlGroup>\n );\n};\n\nSelectEditor.propTypes = {\n /**\n * Callback when selecting an item from the menu\n *\n * @param {SyntheticEvent} event The React `SyntheticEvent`\n * @param {string} name The option name\n * @param {string|boolean} value The option value\n */\n onChange: T.func.isRequired,\n /**\n * The option name\n */\n name: T.string.isRequired,\n /**\n * The item JSON schema, it should contain `enum` property. Note this will only be used when `values` prop is undefined\n */\n itemSchema: T.object,\n /**\n * The option values that can be selected\n */\n values: T.arrayOf(\n T.shape({\n label: T.string,\n value: T.oneOfType([T.string, T.number]).isRequired,\n description: T.string,\n })\n ),\n /**\n * The option value\n */\n value: T.oneOfType([T.string, T.number]),\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['left', 'top']),\n labelWidth: T.number,\n /**\n * Text to display in a tooltip next to the label\n */\n tooltip: T.string,\n /**\n * Disabled state of component\n */\n isDisabled: T.bool,\n /**\n * As advanced editor to show advanced config button\n */\n isAdvanced: T.bool,\n /**\n * Disable label of control group\n */\n hideLabel: T.bool,\n /**\n * Text to display under the the input\n */\n help: T.string,\n};\n\nexport default SelectEditor;\n","import React, { useCallback, useState, useEffect } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport { isEqual, uniqBy } from 'lodash';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport FormRows from '@splunk/react-ui/FormRows';\nimport TextEditor from './TextEditor';\nimport ControlGroup from '../shared/AdvancedControlGroup';\n\nconst RowContainer = styled.div`\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 10px;\n [data-test='control-group'] {\n margin: 0;\n }\n`;\n\nconst formRowHeader = (\n <RowContainer>\n <span data-test=\"form-row-header-label\">{_('Label')}</span>\n <span data-test=\"form-row-header-value\">{_('Value')}</span>\n </RowContainer>\n);\n\n/**\n * Remove an item from an array, return a new array\n * @param {Array} items The list of items\n * @param {Number} index The index of the item to remove\n * @returns {Array} list of items without the item at the specified index\n */\nconst removeItem = (items, index) => items.filter((_item, idx) => idx !== index);\n\n/**\n * Detect when a list of static items contains an invalid entry\n * @param {StaticItem[]} items List of static items\n * @returns {Boolean} true when no label or value is an empty string\n */\nconst isValid = items =>\n // exit early when an error found\n !items.some(\n ({ label, value }) =>\n typeof label !== 'string' ||\n label.trim() === '' ||\n typeof value !== 'string' ||\n value.trim() === ''\n ) &&\n uniqBy(items, item => item.value).length === items.length &&\n uniqBy(items, item => item.label).length === items.length;\n\n/**\n * Detect if a label or value in the list is an error case\n * @param {String} value either an item label or value\n * @param {StaticItem[]} items List of all items\n * @param {label | value} key The StaticItem key to check\n */\nconst isItemError = (value, items, key) => {\n // Just have an invalid type\n if (typeof value !== 'string' || value.trim() === '') {\n return true;\n }\n\n // Check the value is unique\n return items.filter(i => i[key] === value).length > 1;\n};\n\nconst isLabelError = (label, items) => isItemError(label, items, 'label');\nconst isValueError = (value, items) => isItemError(value, items, 'value');\n\nconst InputContainer = styled.div`\n width: 100%;\n`;\n\nconst defaultValue = [];\n\nconst StaticItemEditor = ({\n onChange,\n name,\n value = defaultValue,\n labelPosition = 'top',\n label = '',\n validate,\n}) => {\n const [staticItems, setItems] = useState(value);\n const [nextIndex, setIndex] = useState(value.length);\n\n useEffect(() => {\n setItems(value);\n if (value.length > nextIndex) {\n setIndex(value.length);\n }\n }, [value, nextIndex]);\n\n const handleChange = useCallback(\n newItems => {\n if (!isEqual(newItems, value) && isValid(newItems)) {\n // don't save newItems to state,\n // as this component will get a prop change as a result of the onChange call\n onChange(null, name, newItems);\n } else {\n // save invalid values so UI updates.\n setItems(newItems);\n }\n },\n [value, name, onChange]\n );\n\n const handleRequestRemove = useCallback(\n (_evt, { index }) => {\n const newItems = removeItem(staticItems, index);\n\n handleChange(newItems);\n },\n [staticItems, handleChange]\n );\n\n const handleRequestMove = useCallback(\n ({ fromIndex, toIndex }) => {\n const item = staticItems[fromIndex];\n const newItems = removeItem(staticItems, fromIndex);\n\n newItems.splice(toIndex, 0, item);\n handleChange(newItems);\n },\n [staticItems, handleChange]\n );\n\n const handleItemChange = useCallback(\n (idx, key) =>\n (_evt, _name, val = '') => {\n const item = staticItems[idx];\n const newItems = [...staticItems];\n\n newItems.splice(idx, 1, { ...item, [key]: val.trim() });\n handleChange(newItems);\n },\n [staticItems, handleChange]\n );\n\n const handleRequestAdd = useCallback(() => {\n const newItems = staticItems.concat({\n label: `Label ${nextIndex}`,\n value: `menu_v${nextIndex}`,\n });\n\n setIndex(nextIndex + 1);\n handleChange(newItems);\n }, [staticItems, nextIndex, handleChange]);\n\n const rows = staticItems.map((item, idx) => {\n const { label: l, value: v } = item;\n return (\n <FormRows.Row\n index={idx}\n // eslint-disable-next-line react/no-array-index-key\n key={`${l}_${v}_${idx}`} // NOSONAR\n onRequestRemove={handleRequestRemove}\n >\n <RowContainer>\n <TextEditor\n label={_('Label')}\n hideLabel\n value={l}\n onChange={handleItemChange(idx, 'label')}\n name=\"item-label-editor\"\n error={isLabelError(l, staticItems)}\n validate={validate}\n />\n <TextEditor\n label={_('Value')}\n hideLabel\n value={v}\n onChange={handleItemChange(idx, 'value')}\n name=\"item-value-editor\"\n error={isValueError(v, staticItems)}\n validate={validate}\n />\n </RowContainer>\n </FormRows.Row>\n );\n });\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition}>\n <InputContainer>\n <FormRows\n addLabel={_('Add new')}\n header={formRowHeader}\n onRequestAdd={handleRequestAdd}\n onRequestMove={handleRequestMove}\n >\n {rows}\n </FormRows>\n </InputContainer>\n </ControlGroup>\n );\n};\n\nStaticItemEditor.propTypes = {\n /**\n * Callback when changing the text value\n *\n * onChange function has the following properties\n * @param {SyntheticEvent} event The react `SyntheticEvent`\n * @param {String} name The option name\n * @param {StaticItem[]} 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,\n /**\n * The option value\n */\n value: T.arrayOf(T.exact({ label: T.string, value: T.string })),\n /**\n * Label position\n */\n labelPosition: T.oneOf(['top', 'left']),\n /**\n * Validate the value of the editor\n */\n validate: T.func,\n};\n\nexport default StaticItemEditor;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@babel/runtime/helpers/objectWithoutProperties\");","import React, { useState, useCallback, useEffect, useMemo } from 'react';\nimport T from 'prop-types';\nimport { debounce } from 'lodash';\nimport Text from '@splunk/react-ui/Text';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { editorStyle } from '../shared/dimensionConstants';\n\nconst defaultLabelStyle = {};\n\nconst TextEditor = ({\n onChange,\n name,\n value = '',\n label,\n labelPosition = 'top',\n labelWidth,\n labelStyle = defaultLabelStyle,\n hideLabel = false,\n isAdvanced,\n isDisabled = false,\n help,\n tooltip,\n validate,\n error,\n ...otherProps\n}) => {\n const [val, setValueState] = useState(value);\n\n const handleValidate = useCallback(\n newValue => (typeof validate === 'function' ? validate({ value: newValue }) : null),\n [validate]\n );\n const [errorState, setErrorState] = useState(handleValidate(value));\n const debouncedHandleValidate = useMemo(\n () =>\n debounce(newVal => {\n setErrorState(handleValidate(newVal));\n }, 250),\n [handleValidate]\n );\n\n useEffect(\n () => () => {\n // cancel debounce on component unmount\n debouncedHandleValidate.cancel();\n },\n [debouncedHandleValidate]\n );\n\n useEffect(() => {\n setValueState(value);\n setErrorState(handleValidate(value));\n }, [handleValidate, value]);\n\n const handleChange = useCallback(\n (_event, { value: v }) => {\n setValueState(v);\n debouncedHandleValidate(v);\n },\n [debouncedHandleValidate]\n );\n\n const handleBlur = useCallback(\n event => {\n const newVal = val.trim();\n if (newVal === value) {\n return;\n }\n const newError = handleValidate(newVal);\n // set error if there is one, or clear an existing error\n setErrorState(newError);\n if (!newError) {\n // only change value if there is no validation error\n onChange(event, name, newVal);\n }\n },\n [val, value, handleValidate, onChange, name]\n );\n\n const handleKeyPress = useCallback(\n event => {\n if (event.key === 'Enter') {\n handleBlur(event);\n }\n },\n [handleBlur]\n );\n\n const style = useMemo(\n () =>\n !label || label === ''\n ? {\n ...labelStyle,\n }\n : labelStyle,\n [label, labelStyle]\n );\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n style={style}\n hideLabel={hideLabel}\n help={help}\n tooltip={tooltip}\n error={errorState?.message || error}\n isAdvanced={isAdvanced}\n >\n <Text\n key={value}\n data-test={name}\n style={editorStyle}\n onChange={handleChange}\n onKeyDown={handleKeyPress}\n onBlur={handleBlur}\n value={val}\n disabled={isDisabled}\n canClear\n {...otherProps}\n error={!!errorState || error}\n />\n </ControlGroup>\n );\n};\n\nTextEditor.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 /**\n * Label width\n */\n labelWidth: T.number,\n /**\n * Styles to be passed to the ControlGroup\n */\n labelStyle: T.object,\n /**\n * Visually hide the label, but render it for screen readers\n */\n hideLabel: T.bool,\n /**\n * As advanced editor to show advanced config button\n */\n isAdvanced: T.bool,\n /**\n * Disabled state of component\n */\n isDisabled: T.bool,\n /**\n * Validate the value of the editor\n */\n validate: T.func,\n /**\n * If the input should display error state\n */\n error: T.bool,\n /**\n * Text to display under the the input\n */\n help: T.string,\n /**\n * Text to display in a tooltip next to the label\n */\n tooltip: T.string,\n};\n\nexport default TextEditor;\n","import React from 'react';\nimport CheckboxEditor from './CheckboxEditor';\n\nconst ToggleEditor = props => <CheckboxEditor {...props} appearance=\"toggle\" />;\n\n/**\n * @see {@link CheckboxEditor} for all the props information\n */\nexport default ToggleEditor;\n","import styled from 'styled-components';\n\nexport default styled.div`\n padding: 10px 15px 0px 15px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n`;\n","import styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\n\nconst Separator = styled.div.attrs(() => ({\n 'data-test': 'separator',\n}))`\n border-bottom: 1px solid ${variables.borderColorWeak};\n`;\n\nexport default Separator;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@splunk/visualizations-shared/schemaUtils\");","import { cloneDeep, forIn, isPlainObject, omit, set } from 'lodash';\nimport { DYNAMIC_OPTIONS_DSL_PATTERN } from '@splunk/visualizations-shared/schemaUtils';\n\n/**\n * Return values, or parse enum values if values do not exist\n * @param {Object} itemSchema Validation config for an editor item\n * @param {Object[]} values List of predefined { label, value } objects for use by editor\n * @returns {Object[]} List of { label, value } objects for use by editor\n */\nexport const getOptions = (itemSchema, values) => {\n if (Array.isArray(values)) {\n return values;\n }\n\n if (itemSchema && Array.isArray(itemSchema.enum)) {\n return itemSchema.enum.map(item => ({ value: item }));\n }\n\n throw Error(`No valid values provided to editor: ${JSON.stringify(itemSchema)}`);\n};\n\nexport function handleOptionsChange(name, value, options = { debounce: false }) {\n const { visualization } = this.props;\n if (value == null) {\n this.props.onVisualizationChange(\n {\n ...visualization,\n options: omit(visualization.options, [name]),\n },\n options\n );\n } else {\n this.props.onVisualizationChange(\n {\n ...visualization,\n options: {\n ...visualization.options,\n [name]: value,\n },\n },\n options\n );\n }\n}\n\n/*\n * @method isMultipleRulesSchema\n * @param {Object} itemSchema\n * @returns {Boolean}\n */\nexport const isMultipleRulesSchema = itemSchema => !!itemSchema.anyOf && itemSchema.anyOf.length > 0;\n\n/*\n * @method isDynamicOptionSchema\n * @param {Object} schema\n * @returns {Boolean}\n */\nexport const isDynamicOptionSchema = schema =>\n schema.type === 'string' && schema.pattern === DYNAMIC_OPTIONS_DSL_PATTERN;\n\n/*\n * @method isNestedOption\n * @param {String} optionName\n * @returns {Boolean}\n */\nexport const isNestedOption = optionName => {\n const nestedOptionPattern = /^\\w+\\[\\d+\\]\\.(.+)$/;\n return nestedOptionPattern.exec(optionName) !== null;\n};\n\n/*\n * @method getStaticItemSchema\n * @param {Object} itemSchema\n * @returns {Object} staticItemSchema\n */\nexport const getStaticItemSchema = itemSchema => {\n if (!isMultipleRulesSchema(itemSchema)) {\n return itemSchema;\n }\n\n const staticSchema = itemSchema.anyOf.find(schema => !isDynamicOptionSchema(schema));\n return { ...omit(itemSchema, 'anyOf'), ...staticSchema };\n};\n\n/**\n * @method isContextCompatibleWithFormatter\n * @param {Array | Object} contextConfig\n * @param {String} formatterType\n * @returns {Boolean} true if context structure is compatible with formatter type\n */\nconst isContextCompatibleWithFormatter = (contextConfig, formatterType) => {\n if (!contextConfig || !formatterType) {\n return false;\n }\n\n // Gradient formatter expects an object with 'colors' property\n if (formatterType === 'gradient') {\n return (\n typeof contextConfig === 'object' && !Array.isArray(contextConfig) && 'colors' in contextConfig\n );\n }\n\n // Range/Match formatters expect an array\n if (formatterType === 'rangeValue' || formatterType === 'matchValue') {\n return Array.isArray(contextConfig);\n }\n\n // For unknown formatters, assume compatible to maintain existing behavior\n return true;\n};\n\n/**\n * @method getFormatterConfig\n * @param {Object} props\n * @param {Array | Object} [props.contextConfig]\n * @param {Array} props.formatters\n * @param {String} props.formatterFromDSL\n * @param {String} props.selectedDataSelector\n * @returns {Array | Object} the default formatter config of dynamic color editors' fomatter\n */\nexport const getFormatterConfig = ({ contextConfig, formatters, formatterFromDSL, selectedDataSelector }) => {\n // If no context exists, use default config\n if (!contextConfig) {\n const currentFormatter = formatters?.find(formatter => formatter.value === formatterFromDSL);\n const formatterConfig = currentFormatter?.defaults?.[selectedDataSelector];\n return formatterConfig || [];\n }\n\n // If no formatter type is provided, return context as-is for backward compatibility\n if (!formatterFromDSL) {\n return contextConfig;\n }\n\n // Check if existing context is compatible with the formatter type\n if (isContextCompatibleWithFormatter(contextConfig, formatterFromDSL)) {\n return contextConfig;\n }\n\n // Context is incompatible, use default config instead\n const currentFormatter = formatters?.find(formatter => formatter.value === formatterFromDSL);\n const formatterConfig = currentFormatter?.defaults?.[selectedDataSelector];\n return formatterConfig || [];\n};\n\n/**\n * @method isSupportedDataSelector\n * @param {Object} config\n * @param {String} config.selectedDataSelector e.g. 'majorValue'\n * @param {Array} config.dataSelectors e.g. [{ label: 'value', value: 'majorValue'}]\n * @returns {Boolean} true if dataSelectors includes selectedDataSelector\n */\nexport const isSupportedDataSelector = ({ selectedDataSelector, dataSelectors }) => {\n if (!selectedDataSelector || !dataSelectors?.length) {\n return false;\n }\n return dataSelectors.some(ds => ds.value === selectedDataSelector);\n};\n\n/**\n * @method isSupportedFormatter\n * @param {Object} config\n * @param {String} [config.selectedFormatterType] e.g. 'rangeValue'\n * @param {Array} [config.formattersFromEditor] e.g. [{ label: 'rangle', value: 'rangeValue', defaults: {}}]\n * @param {Object} config.supportedFormatters e.g. {rangeValue: {}, matchValue: {}}\n * @returns {Boolean} true if formattersFromEditor includes selectedFormatterType and selectedFormatterType is one of supportedFormatters on editor\n */\nexport const isSupportedFormatter = ({\n selectedFormatterType,\n formattersFromEditor,\n supportedFormatters,\n}) => {\n if (\n !selectedFormatterType ||\n !supportedFormatters?.[selectedFormatterType] ||\n !formattersFromEditor?.length\n ) {\n return false;\n }\n return formattersFromEditor.some(fm => fm.value === selectedFormatterType);\n};\n\n/**\n * @method getFilteredRowsByShowEditor filters the EditorItem objects which are visible based on showEditor property\n * @param {Object} args\n * @param {Array} args.row\n * @param {Object} args.options // item options\n * @param {Object} args.encoding\n * @param {Object} args.featureFlags\n * @returns array of EditorItem objects or empty array\n */\nexport const getFilteredRowsByShowEditor = ({ row, options, encoding, featureFlags }) => {\n if (!row || !Array.isArray(row)) {\n return [];\n }\n const filteredRow = row.filter(\n item =>\n typeof item.showEditor === 'undefined' ||\n (typeof item.showEditor === 'function' && item.showEditor({ options, encoding, featureFlags }))\n );\n return filteredRow;\n};\n\n/**\n * @method removeEmptyEntries Removes of all entries where the value is null, undefined, and convert nulls in arrays to undefined\n * @param {Object} obj\n */\nconst removeEmptyEntries = obj => {\n const returnObj = cloneDeep(obj);\n forIn(returnObj, (value, key) => {\n if ((value !== null && value !== undefined && Array.isArray(value)) || isPlainObject(value)) {\n returnObj[key] = removeEmptyEntries(returnObj[key]);\n }\n if (Array.isArray(value)) {\n returnObj[key] = value.map(val => (val === null ? undefined : val));\n }\n if (value === null || value === undefined) {\n delete returnObj[key];\n }\n });\n return returnObj;\n};\n\n/**\n * @method getToggleOffValueForDataColors determines the appropriate value when toggling off dataColors\n * @param {Object} config\n * @param {String} config.name - the option name (e.g., 'dataColors', 'layers[0].dataColors')\n * @param {Object} config.options - all visualization options\n * @param {String[]} config.dataSelectors - available data selectors (e.g., ['areaValues'])\n * @returns {String} appropriate toggle-off value (empty string or gradient fallback)\n */\nexport const getToggleOffValueForDataColors = ({ name, options, dataSelectors = [] }) => {\n // Only process dataColors options\n if (!name?.includes('dataColors')) {\n return '';\n }\n\n // Check if this is a choropleth layer by examining the layer configuration\n const isChoroplethLayer = () => {\n // Handle top-level dataColors\n if (name === 'dataColors') {\n return options?.type === 'choropleth' || options?.layerType === 'choropleth';\n }\n\n // Handle nested layer dataColors (e.g., layers[0].dataColors)\n const layerPattern = /^layers\\[(\\d+)\\]\\.dataColors$/;\n const layerMatch = layerPattern.exec(name);\n if (layerMatch) {\n const layerIndex = parseInt(layerMatch[1], 10);\n const layer = options?.layers?.[layerIndex];\n return layer?.type === 'choropleth' || layer?.layerType === 'choropleth';\n }\n\n return false;\n };\n\n // Check if areaValues is available as a data selector\n const hasAreaValuesSelector = dataSelectors.includes('areaValues');\n\n // Return gradient fallback for choropleth layers with areaValues, empty string otherwise\n if (isChoroplethLayer() && hasAreaValuesSelector) {\n return '> areaValues | gradient()';\n }\n\n return '';\n};\n\n/**\n * @method convertEmptyDataColorsForChoropleth handles the conversion of empty dataColors option to gradient fallback for choropleth layers\n * @param {Object} config\n * @param {String} config.option - the option name (e.g., 'dataColors', 'layers[0].dataColors')\n * @param {Any} config.value - the option value\n * @param {Object} config.options - all visualization options\n * @param {String[]} config.dataSelectors - available data selectors (e.g., ['areaValues'])\n * @returns {String|Any} converted value for choropleth or original value\n */\nexport const convertEmptyDataColorsForChoropleth = ({ option, value, options, dataSelectors = [] }) => {\n // Only process dataColors options\n if (!option?.includes('dataColors')) {\n return value;\n }\n\n // Only convert empty string values\n if (value !== '') {\n return value;\n }\n\n // Use the toggle-off value logic\n return getToggleOffValueForDataColors({ name: option, options, dataSelectors });\n};\n\n/**\n * @method setOption sets an options value\n * @param {String} option\n * @param {Any} value\n * @param {Object} oldVisualization\n * @param {Object} optionSchema\n * @param {Object} defaultOverrides\n * @param {String[]} dataSelectors - available data selectors for choropleth conversion\n * @returns visualization object with updated options\n */\nexport const setOption = (option, value, oldVisualization, optionSchema, defaultOverrides, dataSelectors) => {\n const obj = {\n ...oldVisualization,\n };\n\n let newOption = option;\n let newValue = value;\n\n // Apply choropleth-specific conversion for empty dataColors\n if (newValue === '' && newOption?.includes('dataColors')) {\n newValue = convertEmptyDataColorsForChoropleth({\n option: newOption,\n value: newValue,\n options: oldVisualization.options,\n dataSelectors,\n });\n }\n\n // Remove from definition if value is null/undefined, and the key is explicitly set in the optionSchema\n if ((newValue === null || newValue === undefined) && optionSchema[newOption]) {\n obj.options = omit(oldVisualization.options, newOption);\n return obj;\n }\n\n // Remove from definition if value is the same as the default from the overrides or the schema\n const schemaDefault = defaultOverrides?.[newOption] ?? optionSchema[newOption]?.default;\n if (typeof schemaDefault !== 'undefined' && newValue === schemaDefault) {\n obj.options = omit(oldVisualization.options, newOption);\n return obj;\n }\n // Copy options\n obj.options = cloneDeep(oldVisualization.options);\n obj.options ??= {};\n // ColumnSelectionEditor returns the option as an object\n // with a key/value pair inside that object with the param value as undefiend\n if ((value === null || value === undefined) && isPlainObject(option) && isPlainObject(option.options)) {\n [newOption] = Object.keys(option.options);\n [newValue] = Object.values(option.options);\n }\n // Select explicitly exposed option first for non arrays / objects\n if (optionSchema[newOption]) {\n if (optionSchema[newOption].type !== 'array') {\n obj.options[newOption] = newValue;\n return obj;\n }\n }\n // Set option using loadash to translate string path like `object.object.key` to target a specific key within nested objects\n if (newValue === null) {\n newValue = undefined;\n }\n set(obj.options, newOption, newValue);\n // Remove any null, undefined, nad nulls from arrays\n obj.options = removeEmptyEntries(obj.options);\n return obj;\n};\n","const TOKEN_NAMESPACE_PREFIX_PATTERN = /(\\w+:)?/.source;\n// ex: token.name|suh (old-style filter chain)\n// ex: token.name|lower|capitalize (new-style filter chain)\nconst TOKEN_NAME_CHARS_PATTERN = /([^$|:]+?)(\\|[|\\w]+)?/.source;\n// ex: $ns:token.name|suh$\nconst TOKEN_PATTERN = /\\$/.source + TOKEN_NAMESPACE_PREFIX_PATTERN + TOKEN_NAME_CHARS_PATTERN + /\\$/.source;\n\nconst TokenRegExp = new RegExp(TOKEN_PATTERN);\n\nexport const hasTokens = value => typeof value === 'string' && TokenRegExp.test(value);\n","import * as React from 'react';\nimport Multiselect from '@splunk/react-ui/Multiselect';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport ControlGroup from '../shared/AdvancedControlGroup';\n\ninterface ArrayOfStringsEditorProps extends BaseEditorProps {\n help?: string;\n}\n\nconst style = { width: '330px' };\nconst menuStyle = { display: 'none' };\n\nconst ArrayOfStringsEditor = ({\n onChange,\n name,\n labelPosition = 'top',\n labelWidth,\n label,\n isDisabled = false,\n help,\n value,\n}: ArrayOfStringsEditorProps): JSX.Element => {\n let safeValues = [];\n if (Array.isArray(value)) {\n safeValues = value.map(v => (v !== null && typeof v === 'object' ? v.toString() : `${v}`));\n }\n const [currentValues, setCurrentValues] = React.useState(safeValues);\n\n const handleChange = React.useCallback(\n (event, { values: v }) => {\n setCurrentValues(v);\n onChange(event, name, v);\n },\n [onChange, name]\n );\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth} help={help}>\n <Multiselect\n allowNewValues\n values={currentValues}\n onChange={handleChange}\n disabled={isDisabled}\n inline\n style={style}\n menuStyle={menuStyle}\n placeholder=\"\"\n selectAllAppearance=\"checkbox\"\n />\n </ControlGroup>\n );\n};\n\nexport default ArrayOfStringsEditor;\n","import React, { useCallback } from 'react';\nimport styled from 'styled-components';\nimport Switch, { type SwitchClickHandler } from '@splunk/react-ui/Switch';\nimport Chip from '@splunk/react-ui/Chip';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport { variables } from '@splunk/themes';\nimport Link from '@splunk/react-ui/Link';\nimport { hasTokens } from '../utils/token';\nimport ControlGroup from '../shared/AdvancedControlGroup';\n\nconst StyledTooltip = styled(Tooltip)`\n float: right;\n [data-test='clickable'] {\n padding-block: 0;\n }\n`;\n\ninterface StyledSwitchProps {\n hasChip?: boolean;\n}\n\nconst StyledSwitch = styled(Switch)<StyledSwitchProps>`\n padding-block: 0;\n\n ${({ hasChip }) =>\n hasChip &&\n `\n display: inline-flex;\n align-items: center;\n label {\n display: inline-flex;\n align-items: center;\n vertical-align: middle;\n }\n `}\n`;\n\nconst CheckboxInfo = styled.div`\n margin-top: ${variables.spacingXSmall};\n color: ${variables.contentColorDefault};\n font-size: ${variables.fontSizeSmall};\n`;\n\nconst StyledChip = styled(Chip)`\n margin-left: auto;\n`;\n\nconst CenteredLabel = styled.span`\n display: inline-flex;\n align-items: center;\n min-height: ${variables.inputHeight};\n line-height: 0;\n`;\n\nconst sortValues = (values, variantForSelectedState) => {\n if (variantForSelectedState) {\n return [values.find(v => v !== variantForSelectedState), variantForSelectedState];\n }\n\n return values;\n};\n\nexport interface CheckboxEditorProps {\n /**\n * Callback when checking or unchecking the box\n *\n * @param {SyntheticEvent} event The React `SyntheticEvent`\n * @param {string} name The option name\n * @param {string|boolean} value The option value\n */\n onChange: (evt: React.MouseEvent, name: string, value: string | boolean) => void;\n /**\n * The option name\n */\n name: string;\n /**\n * The item JSON schema, note it needs to be either boolean type or enum that has exactly two variants\n *\n * @type {Object} itemSchema\n */\n itemSchema: { enum?: string[]; type: string };\n /**\n * This indicates how to map the enum variants to selected/unselected state.\n * For example, `variantForSelectedState=\"show\"` means the checkbox will be in selected state when value is `\"show\"`,\n * and will be in unselected state when value is `\"hide\"`.\n * If this prop is unspecified, the first variant in the enum will be used to represent unselected state.\n *\n * Note this prop is only used when itemSchema is enum type and has exactly two variants.\n */\n variantForSelectedState?: string;\n /**\n * A human readable label for the option\n */\n label: string;\n /**\n * The option value\n */\n value: string | boolean;\n /**\n * The option values that can be selected\n */\n values?: { label?: string; value: string }[];\n /**\n * Label position\n */\n labelPosition?: 'left' | 'top' | 'right';\n /**\n * Label width\n */\n labelWidth?: number;\n /**\n * Appearance of the component\n */\n appearance?: 'checkbox' | 'toggle';\n /**\n * Disabled state of component\n */\n isDisabled?: boolean;\n /**\n * help text\n */\n help?: string;\n /**\n * help text format\n */\n helpFormat?: 'tooltip' | 'under';\n /**\n *\n * @type {Object}\n */\n helpTextLink?: { label: string; href?: string };\n /**\n * show chip with text\n */\n chipText?: string;\n}\n\nconst CheckboxEditor = ({\n help,\n helpFormat = 'tooltip',\n onChange,\n name,\n value,\n values,\n itemSchema,\n variantForSelectedState,\n labelPosition = 'right',\n labelWidth,\n label,\n appearance = 'checkbox',\n isDisabled = false,\n helpTextLink,\n chipText,\n}: CheckboxEditorProps) => {\n const disabled = hasTokens(value) || isDisabled;\n let options;\n\n // Note: by default the first value will be mapped to unselected state\n if (Array.isArray(values) && values.length === 2) {\n options = sortValues(\n values.map(v => v.value),\n variantForSelectedState\n );\n } else if (Array.isArray(itemSchema.enum) && itemSchema.enum.length === 2) {\n options = sortValues(itemSchema.enum, variantForSelectedState);\n } else if (itemSchema.type === 'boolean') {\n options = [false, true];\n } else {\n throw Error(`No valid values provided to CheckboxEditor: ${JSON.stringify(itemSchema)}`);\n }\n\n const handleClick = useCallback<SwitchClickHandler>(\n event => onChange(event, name, value === options[1] ? options[0] : options[1]),\n [onChange, options, name, value]\n );\n\n if (labelPosition === 'right') {\n return (\n <>\n <StyledSwitch\n data-test={name}\n disabled={disabled}\n value={name}\n onClick={handleClick}\n selected={value === options[1]}\n appearance={appearance}\n hasChip={!!chipText}\n >\n <CenteredLabel>{label}</CenteredLabel>\n {chipText && <StyledChip data-test=\"beta-chip\">{chipText}</StyledChip>}\n {help && helpFormat === 'tooltip' && <StyledTooltip content={help} />}\n </StyledSwitch>\n {help && helpFormat === 'under' && (\n <CheckboxInfo>\n {help}\n {` `}\n {helpTextLink?.label && (\n <>\n <br />\n <Link data-test=\"help-text-link\" to={helpTextLink?.href || null}>\n {helpTextLink.label}\n </Link>\n </>\n )}\n </CheckboxInfo>\n )}\n </>\n );\n }\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth} tooltip={help}>\n <StyledSwitch\n data-test={name}\n disabled={disabled}\n value={name}\n onClick={handleClick}\n selected={value === options[1]}\n appearance={appearance}\n />\n </ControlGroup>\n );\n};\n\nexport default CheckboxEditor;\n","import React, { useCallback, useMemo } from 'react';\nimport T from 'prop-types';\nimport Multiselect from '@splunk/react-ui/Multiselect';\nimport type { DataType } from '@splunk/visualization-encoding/DataPrimitive';\nimport { getDataSourceStateInfo } from '@splunk/visualizations-shared/dataSourceUtils';\nimport { BaseEditorPropTypes } from '../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport { useDataSource } from '../hooks/useDataSource';\nimport { getAvailableFieldsWithTypes, sanitizeFieldNames } from '../utils/columnSelectionUtils';\nimport ControlGroup from '../shared/AdvancedControlGroup';\n\nexport const EDITOR_NAME = 'columnMultiSelectionByFieldName-editor';\ninterface ColumnMultiSelectionByFieldNameEditorProps extends BaseEditorProps {\n tooltip?: boolean;\n filterByTypes?: DataType[];\n isAdvanced?: boolean;\n}\n\nconst defaultFilterByTypes: ColumnMultiSelectionByFieldNameEditorProps['filterByTypes'] = [];\n\nconst ColumnMultiSelectionByFieldNameEditor = ({\n name,\n value,\n label,\n labelPosition = 'top',\n labelWidth,\n isAdvanced = false,\n isDisabled = false,\n tooltip,\n dataSourceBindings,\n filterByTypes = defaultFilterByTypes,\n onChange,\n}: ColumnMultiSelectionByFieldNameEditorProps): JSX.Element => {\n // fetch dataSource fields\n const dataSource = useDataSource({ dataSourceBindings, dataSourceKey: 'primary' });\n\n // disable editor when necessary\n const { hasError, isMissing, isLoading } = useMemo(\n () => getDataSourceStateInfo(dataSource),\n [dataSource]\n );\n const disabled = useMemo(() => isMissing || hasError || isDisabled, [hasError, isDisabled, isMissing]);\n\n // get field types\n const { columns, fields } = useMemo(() => dataSource?.data || { columns: [], fields: [] }, [dataSource]);\n const fieldsWithTypes = useMemo(() => getAvailableFieldsWithTypes(columns, fields), [columns, fields]);\n\n const fieldNames = useMemo(\n () =>\n sanitizeFieldNames(\n value,\n fieldsWithTypes.map(field => field.name)\n ),\n [value, fieldsWithTypes]\n );\n\n const handleFieldNameChange = useCallback(\n (event, { values }): void => {\n onChange(event, name, values);\n },\n [onChange, name]\n );\n\n return (\n <ControlGroup\n data-test={`${EDITOR_NAME}-${name}`}\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n isAdvanced={isAdvanced}\n >\n <Multiselect\n data-test={`${EDITOR_NAME}-select-${name}`}\n onChange={handleFieldNameChange}\n values={fieldNames}\n disabled={disabled}\n isLoadingOptions={isLoading}\n compact\n selectAllAppearance=\"checkbox\"\n >\n {fieldsWithTypes.map(field => (\n <Multiselect.Option\n data-test={`${EDITOR_NAME}-option-${field.name}`}\n key={field.name}\n value={field.name}\n label={`${field.name} (${field.type})`}\n disabled={filterByTypes.length > 0 && !filterByTypes.find(f => f === field.type)}\n />\n ))}\n </Multiselect>\n </ControlGroup>\n );\n};\n\nColumnMultiSelectionByFieldNameEditor.propTypes = {\n ...BaseEditorPropTypes,\n tooltip: T.bool,\n labelPosition: T.oneOf(['top', 'left']),\n isAdvanced: T.bool,\n isDisabled: T.bool,\n};\n\nexport default ColumnMultiSelectionByFieldNameEditor;\n","import React, { useState, useCallback, useMemo } from 'react';\nimport Multiselect from '@splunk/react-ui/Multiselect';\nimport { get } from 'lodash';\nimport { getFieldsFromDSL } from '@splunk/visualization-encoding/utils/dsl';\nimport { getDataSourceStateInfo } from '@splunk/visualizations-shared/dataSourceUtils';\nimport type { DataType } from '@splunk/visualization-encoding/DataPrimitive';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport { useDataSource } from '../hooks/useDataSource';\nimport { getAvailableFieldsWithTypes, getPlaceholderMessage } from '../utils/columnSelectionUtils';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { useColumnSelectorFooterMessage } from './useColumnSelectorFooterMessage';\nimport type { DynamicOptionsConfig, JSONPrimitive } from '../types';\n\ninterface ColumnMultiSelectionEditorProps extends BaseEditorProps {\n dataSourceKey: string;\n prepareValue?: (id: DynamicOptionsConfig) => DynamicOptionsConfig;\n excludeByNames?: string[];\n filterByTypes?: DataType[];\n shouldShowInternalFields?: boolean;\n}\n\nexport const isInternal = (field: { name: string }): boolean =>\n field?.name?.startsWith('_') && field.name !== '_time';\n\nexport const ColumnMultiSelectionEditor: React.FunctionComponent<ColumnMultiSelectionEditorProps> = ({\n name,\n value,\n label = '',\n labelPosition = 'top',\n dataSourceKey = 'primary',\n dataSourceBindings,\n prepareValue = (id: DynamicOptionsConfig): DynamicOptionsConfig => id,\n onChange,\n isAdvanced,\n isDisabled,\n shouldShowInternalFields = true,\n filterByTypes,\n excludeByNames,\n}) => {\n const dataSource = useDataSource({ dataSourceBindings, dataSourceKey });\n const { columns, fields } = dataSource?.data || { columns: [], fields: [] };\n const adjustedDataSource = useMemo(\n () =>\n shouldShowInternalFields\n ? dataSource\n : {\n ...dataSource,\n data: {\n fields: fields.filter((field: { name: string }) => !isInternal(field)),\n columns: columns.filter((_c: JSONPrimitive, i: number) => !isInternal(fields[i])),\n },\n },\n [columns, dataSource, fields, shouldShowInternalFields]\n );\n const { columns: adjustedColumns, fields: adjustedFields } = get(adjustedDataSource, 'data') || {\n columns: [],\n fields: [],\n };\n const availableFieldsWithTypes = useMemo(\n () => getAvailableFieldsWithTypes(adjustedColumns, adjustedFields),\n [adjustedColumns, adjustedFields]\n );\n const [filter, setFilter] = useState('');\n // return `value` if `value` is undefined or null so editor shows placeholder message\n const fieldNames = useMemo(\n () =>\n value == null\n ? value\n : getFieldsFromDSL(value, {\n [dataSourceKey]: adjustedDataSource,\n }),\n [adjustedDataSource, dataSourceKey, value]\n );\n const [selectedFields, setSelectedFields] = useState<string[]>(fieldNames || []);\n\n React.useEffect((): void => {\n if (fieldNames?.length) {\n setSelectedFields(fieldNames);\n }\n }, [fieldNames]);\n\n const filteredFields = availableFieldsWithTypes.filter(\n (field): boolean => field.name.indexOf(filter) !== -1\n );\n const footerMessage = useColumnSelectorFooterMessage({\n availableFields: availableFieldsWithTypes,\n filteredFields,\n filter,\n selectedFields,\n });\n\n const handleValuesChange = useCallback(\n (event, { values: selectedValues }): void => {\n setSelectedFields(selectedValues);\n const seriesNamesStr = `'${selectedValues.join(\"','\")}'`;\n const update = prepareValue({\n options: {\n [name]: `> ${dataSourceKey} | frameBySeriesNames(${seriesNamesStr})`,\n },\n });\n onChange(event, update);\n },\n [dataSourceKey, name, onChange, prepareValue]\n );\n\n const handleFilterChange = useCallback((e, { keyword }): void => {\n setFilter(keyword);\n }, []);\n\n const { hasError, isMissing, isLoading } = getDataSourceStateInfo(dataSource);\n const disabled = isMissing || hasError || isDisabled;\n const placeholderMessage = getPlaceholderMessage({\n isMissing,\n isLoading,\n hasError,\n defaultMessage: 'Select field(s) from data source',\n });\n return (\n <ControlGroup label={label} labelPosition={labelPosition} isAdvanced={isAdvanced}>\n <Multiselect\n data-test=\"ColumnMultiSelectionEditor\"\n disabled={disabled}\n values={selectedFields}\n onChange={handleValuesChange}\n onFilterChange={handleFilterChange}\n footerMessage={footerMessage}\n placeholder={placeholderMessage}\n isLoadingOptions={isLoading}\n error={hasError}\n compact\n selectAllAppearance=\"checkbox\"\n >\n {filteredFields.map(field => (\n <Multiselect.Option\n key={field.name}\n label={`${field.name} (${field.type})`}\n value={field.name}\n disabled={\n (filterByTypes?.length && !filterByTypes.find(f => f === field.type)) ||\n excludeByNames?.includes(field.name)\n }\n />\n ))}\n </Multiselect>\n </ControlGroup>\n );\n};\n\nexport default ColumnMultiSelectionEditor;\n","import React, { useState, useCallback } from 'react';\nimport Select from '@splunk/react-ui/Select';\nimport { getFieldsFromDSL } from '@splunk/visualization-encoding/utils/dsl';\nimport { getDataSourceStateInfo } from '@splunk/visualizations-shared/dataSourceUtils';\nimport type { DataType } from '@splunk/visualization-encoding/DataPrimitive';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport { useDataSource } from '../hooks/useDataSource';\nimport { getAvailableFieldsWithTypes, getPlaceholderMessage } from '../utils/columnSelectionUtils';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { editorStyle } from '../shared/dimensionConstants';\nimport { useColumnSelectorFooterMessage } from './useColumnSelectorFooterMessage';\nimport type { DynamicOptionsConfig } from '../types';\n\ninterface ColumnSelectionEditorProps extends BaseEditorProps {\n dataSourceKey: string;\n prepareValue?: (id: DynamicOptionsConfig) => DynamicOptionsConfig;\n filterByTypes?: DataType[];\n tooltip?: string;\n hideEditorWhenLoading?: boolean;\n}\n\nexport const ColumnSelectionEditor: React.FunctionComponent<ColumnSelectionEditorProps> = ({\n name,\n value,\n label = '',\n labelPosition = 'top',\n dataSourceKey = 'primary',\n dataSourceBindings,\n prepareValue = (id: DynamicOptionsConfig): DynamicOptionsConfig => id,\n onChange,\n isAdvanced,\n isDisabled,\n filterByTypes,\n tooltip,\n hideEditorWhenLoading = false,\n}) => {\n const dataSource = useDataSource({ dataSourceBindings, dataSourceKey });\n const { columns, fields } = dataSource?.data || { columns: [], fields: [] };\n const availableFieldsWithTypes = getAvailableFieldsWithTypes(columns, fields);\n // return `value` if `value` is undefined or null so editor shows placeholder message\n const fieldName =\n value == null\n ? value\n : getFieldsFromDSL(value, {\n [dataSourceKey]: dataSource,\n })[0] || '';\n const [selectedField, setSelectedField] = useState(fieldName);\n React.useEffect((): void => {\n setSelectedField(fieldName);\n }, [fieldName]);\n const [filter, setFilter] = useState('');\n const filteredFields = availableFieldsWithTypes.filter(\n (field): boolean => field.name.indexOf(filter) !== -1\n );\n const footerMessage = useColumnSelectorFooterMessage({\n availableFields: availableFieldsWithTypes,\n selectedFields: [selectedField],\n filteredFields,\n filter,\n });\n\n const handleValueChange = useCallback(\n (event, { value: selectedValue }): void => {\n setSelectedField(selectedValue);\n const update = prepareValue({\n options: {\n [name]: `> ${dataSourceKey} | seriesByName('${selectedValue}')`,\n },\n });\n onChange(event, update);\n },\n [dataSourceKey, name, onChange, prepareValue]\n );\n\n const handleFilterChange = useCallback((e, { keyword }): void => {\n setFilter(keyword);\n }, []);\n const { hasError, isMissing, isLoading } = getDataSourceStateInfo(dataSource);\n const disabled = isMissing || hasError || isDisabled;\n const placeholderMessage = getPlaceholderMessage({ isMissing, isLoading, hasError });\n const shouldRenderEditor = hideEditorWhenLoading ? !!selectedField : true;\n\n return (\n shouldRenderEditor && (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n tooltip={tooltip}\n isAdvanced={isAdvanced}\n >\n <Select\n data-test=\"ColumnSelectionEditor\"\n value={selectedField}\n onFilterChange={handleFilterChange}\n onChange={handleValueChange}\n footerMessage={footerMessage}\n disabled={disabled}\n placeholder={placeholderMessage}\n isLoadingOptions={isLoading}\n error={hasError}\n style={editorStyle}\n filter\n >\n {filteredFields.map(field => (\n <Select.Option\n key={field.name}\n label={`${field.name} (${field.type})`}\n value={field.name}\n disabled={!!filterByTypes?.length && !filterByTypes.find(f => f === field.type)}\n />\n ))}\n </Select>\n </ControlGroup>\n )\n );\n};\n\nexport default ColumnSelectionEditor;\n","import * as React from 'react';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport Button from '@splunk/react-ui/Button';\nimport Popover from '@splunk/react-ui/Popover';\nimport CustomizedInSourceMessage from '../shared/CustomizedInSourceMessage';\n\nconst { useRef, useState, useCallback } = React;\n\nexport interface CustomizedInSourceEditorProps {\n label: string;\n labelPosition?: 'left' | 'top';\n labelWidth?: number;\n onResetToDefault?: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nconst CustomizedInSourceEditor = ({\n label,\n labelPosition = 'left',\n labelWidth,\n onResetToDefault,\n}: CustomizedInSourceEditorProps) => {\n const [open, setOpen] = useState(false);\n const anchor = useRef(null);\n const handleOpen = useCallback((): void => setOpen(true), []);\n const handleRequestClose = useCallback((): void => setOpen(false), []);\n\n return (\n <ControlGroup label={_(label)} labelPosition={labelPosition} labelWidth={labelWidth}>\n <Button\n data-test=\"customized-in-source-button\"\n onClick={handleOpen}\n appearance=\"default\"\n ref={anchor}\n label={_('Customized in source')}\n />\n <Popover\n data-test=\"customized-in-source-popover\"\n open={open}\n anchor={anchor.current}\n onRequestClose={handleRequestClose}\n defaultPlacement=\"horizontal\"\n >\n <CustomizedInSourceMessage onResetToDefault={onResetToDefault} />\n </Popover>\n </ControlGroup>\n );\n};\n\nexport default CustomizedInSourceEditor;\n","import * as React from 'react';\nimport { toPx } from '@splunk/visualizations-shared/style';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport Button from '@splunk/react-ui/Button';\nimport Popover from '@splunk/react-ui/Popover';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { defaultPalettesConfig as initialPalettesConfig } from '@splunk/visualization-color-palettes/editors/PresetPalettes';\nimport { find, isEmpty } from 'lodash';\nimport {\n getDataSelectorsFromDSL,\n getLastFormatterFromDSL,\n buildDSLFromDataSelectorAndFormatter,\n} from '@splunk/visualization-encoding/utils/dsl';\nimport type { OptionsStanza } from '@splunk/visualization-encoding/AST';\nimport type { RadioBarChangeHandler } from '@splunk/react-ui/RadioBar';\nimport RadioBar from '@splunk/react-ui/RadioBar';\nimport { FormatterEditor, supportedFormatters } from './formatters/FormatterEditor';\nimport type { UiConfig, FormatterUiConfig } from './formatters/FormatterEditor';\nimport CustomizedInSourceEditor from './CustomizedInSourceEditor';\nimport { FLYOUT_WIDTH, FLYOUT_PADDING } from '../shared/dimensionConstants';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport type { PalettesConfig } from '../interfaces/PalettesConfig';\nimport { getFormatterConfig, isSupportedDataSelector, isSupportedFormatter } from '../utils/EditorFunctions';\n\nconst { useRef, useState, useEffect } = React;\n\nconst FlyoutHeader = styled.div`\n font-weight: 600;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 8px;\n`;\n\nconst StyledLabel = styled.div`\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 8px;\n`;\n\nconst StyledFlyoutContent = styled.div.attrs((): { 'data-test': string } => ({\n 'data-test': 'DynamicColorFlyoutContent',\n}))`\n box-sizing: border-box;\n padding: ${toPx(FLYOUT_PADDING)};\n width: ${toPx(FLYOUT_WIDTH)};\n`;\n\nconst StyledButton = styled(Button)`\n padding: '4px';\n`;\n\nexport type ColorMode = 'text' | 'background' | 'off';\n\ntype RadioBarChangeEvent = Parameters<RadioBarChangeHandler>[0];\ntype RadioBarChangeData = Parameters<RadioBarChangeHandler>[1];\n\nexport type ColorModeChangeHandler = (\n event: RadioBarChangeEvent,\n data: Omit<RadioBarChangeData, 'value'> & { value: ColorMode }\n) => ReturnType<RadioBarChangeHandler>;\n\nexport interface DynamicColorEditorProps extends BaseEditorProps {\n value: string;\n flyoutTitle?: string;\n dataSelectors?: UiConfig[];\n formatters?: FormatterUiConfig[];\n defaultPalettesConfig: PalettesConfig;\n showStaticTextColor?: boolean;\n colorMode?: ColorMode;\n handleColorModeChange?: ColorModeChangeHandler;\n}\n\nexport const prepareUpdate = ({\n name,\n selectedDataSelector,\n selectedFormatterType,\n currentFormatterConfig,\n}): OptionsStanza => {\n const contextKey = `${name}EditorConfig`;\n // use regex to remove top-level array references. keeping only the nested field name.\n // if only top-level, stay unchanged.\n // example 1: layers[0].dataColorsEditorConfig → dataColorsEditorConfig\n // example 2: rangeValueColorConfig → rangeValueColorConfig\n const extractedContextKey = contextKey.replace(/^\\w+\\[\\d+\\]\\.(.+)$/, '$1');\n\n return {\n options: {\n [name]: buildDSLFromDataSelectorAndFormatter(\n selectedDataSelector,\n selectedFormatterType,\n contextKey\n ),\n },\n context: {\n [extractedContextKey]: currentFormatterConfig,\n },\n };\n};\n/**\n * The DynamicColorEditor receives a DSL string as value prop and breaks it up into two parts\n * 1) a data selector\n * 2) a formatter\n * Based on those two parts and editorProps from the editor config (formatters & dataSelectors) it initializes a UI to edit color formatter configurations.\n *\n * For now the data selector part is limited to a data selector reference that needs to be defined in editorProps.dataSelectors\n *\n * Example:\n * `> majorValue | rangeValue(config)` requires majorValue to be part of editorProps.dataSelectors and rangeValue to be part of editorProps.formatters\n * Advanced data selection such as `> primary | seriesByIndex(0) | rangeValue(config)` exceeds the capabilities of the editor\n */\nexport const DynamicColorEditor: React.FunctionComponent<DynamicColorEditorProps> = ({\n name,\n value,\n label = '',\n labelPosition = 'left',\n labelWidth,\n context,\n onChange = (): void => undefined,\n flyoutTitle = _('Dynamic coloring'),\n formatters = [],\n dataSelectors = [],\n defaultPalettesConfig = initialPalettesConfig,\n isDisabled = false,\n showStaticTextColor = false,\n colorMode = undefined,\n handleColorModeChange = undefined,\n}) => {\n const [showFlyout, setShowFlyout] = useState(false);\n const buttonRef = useRef(null);\n const { type: formatterFromDSL, paramKey: formatterContextKey } = getLastFormatterFromDSL(value) || {\n type: 'unknown',\n paramKey: 'unknown',\n };\n const dataSelectorFromDSL = getDataSelectorsFromDSL(value)[0];\n const [selectedFormatterType, setSelectedFormatterType] = useState(formatterFromDSL);\n useEffect((): void => {\n setSelectedFormatterType(formatterFromDSL);\n }, [formatterFromDSL]);\n\n const [selectedDataSelector, setSelectedDataSelector] = useState(dataSelectorFromDSL);\n useEffect((): void => {\n setSelectedDataSelector(dataSelectorFromDSL);\n }, [dataSelectorFromDSL]);\n\n const formatterConfigFromDSL = getFormatterConfig({\n contextConfig: context[formatterContextKey],\n formatters,\n formatterFromDSL,\n selectedDataSelector,\n });\n const [currentFormatterConfig, setCurrentFormatterConfig] = useState(formatterConfigFromDSL);\n useEffect((): void => {\n setCurrentFormatterConfig(formatterConfigFromDSL);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [context, formatters, formatterContextKey, formatterFromDSL, dataSelectorFromDSL]);\n\n const handleDataSelectorChange = (event, editorName, newDataSelector): void => {\n setSelectedDataSelector(newDataSelector);\n // pick the first available formatter that has a config for this data selector\n const formatter = find(\n formatters,\n (f): Record<string, unknown> => f.defaults[newDataSelector]\n ) as FormatterUiConfig;\n setSelectedFormatterType(formatter.value);\n const formatterCfg = formatter.defaults[newDataSelector];\n setCurrentFormatterConfig(formatterCfg);\n onChange(\n event,\n prepareUpdate({\n name,\n selectedDataSelector: newDataSelector,\n selectedFormatterType: formatter.value,\n currentFormatterConfig: formatterCfg,\n })\n );\n };\n const handleFormatterChange = (event, editorName, newFormatter): void => {\n setSelectedFormatterType(newFormatter);\n const formatter = find(formatters, ['value', newFormatter]);\n const formatterCfg = formatter.defaults[selectedDataSelector];\n setCurrentFormatterConfig(formatterCfg);\n onChange(\n event,\n prepareUpdate({\n name,\n selectedDataSelector,\n selectedFormatterType: newFormatter,\n currentFormatterConfig: formatterCfg,\n })\n );\n };\n const handleFormatterConfigChange = (event, editorName, newFormatterConfig): void => {\n setCurrentFormatterConfig(newFormatterConfig);\n onChange(\n event,\n prepareUpdate({\n name,\n selectedDataSelector,\n selectedFormatterType,\n currentFormatterConfig: newFormatterConfig,\n })\n );\n };\n const handleResetToDefault = (event): void => {\n const getDefaultFormatter = (): FormatterUiConfig => {\n return find(formatters, (f): boolean => f.isDefault);\n };\n const getRangeValueFormatter = (): FormatterUiConfig => {\n return find(formatters, (f): boolean => f.value === 'rangeValue');\n };\n const formatter = getDefaultFormatter() || getRangeValueFormatter() || formatters[0];\n if (isEmpty(formatter)) {\n return;\n }\n\n const defaultFormatter = formatter.value;\n const defaultDataSelector = Object.keys(formatter.defaults)[0];\n const formatterCfg = formatter.defaults[defaultDataSelector];\n\n setSelectedDataSelector(defaultDataSelector);\n setSelectedFormatterType(defaultFormatter);\n setCurrentFormatterConfig(formatterCfg);\n onChange(\n event,\n prepareUpdate({\n name,\n selectedDataSelector: defaultDataSelector,\n selectedFormatterType: defaultFormatter,\n currentFormatterConfig: formatterCfg,\n })\n );\n };\n\n const handleButtonClick = React.useCallback(() => {\n setShowFlyout(currentValue => !currentValue);\n }, []);\n\n // implement source exceeds editor state\n if (\n !isSupportedDataSelector({ selectedDataSelector, dataSelectors }) ||\n !isSupportedFormatter({\n selectedFormatterType,\n formattersFromEditor: formatters,\n supportedFormatters,\n })\n ) {\n return (\n <CustomizedInSourceEditor\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n onResetToDefault={handleResetToDefault}\n />\n );\n }\n\n const FormatterConfigPreview = supportedFormatters[selectedFormatterType].preview;\n\n return (\n <>\n <ControlGroup\n data-test=\"DynamicColorEditorGroup\"\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n >\n <StyledButton\n inline={false}\n data-test=\"DynamicColorEditorButton\"\n appearance=\"default\"\n ref={buttonRef}\n onClick={handleButtonClick}\n disabled={isDisabled}\n >\n <FormatterConfigPreview\n data-test=\"FormatterConfigPreview\"\n config={currentFormatterConfig}\n />\n </StyledButton>\n </ControlGroup>\n <Popover\n data-test=\"DynamicColorEditorFlyout\"\n open={showFlyout}\n anchor={buttonRef.current}\n defaultPlacement=\"horizontal\"\n style={{ padding: '10px' }}\n onRequestClose={(): void => setShowFlyout(false)}\n takeFocus\n >\n <StyledFlyoutContent>\n {!colorMode && <FlyoutHeader>{flyoutTitle}</FlyoutHeader>}\n {colorMode && (\n <ControlGroup\n data-test=\"TableDynamicColorEditorGroup\"\n label={flyoutTitle}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n >\n <RadioBar value={colorMode} onChange={handleColorModeChange}>\n {[\n { label: _('Off'), value: 'off' },\n { label: _('Text'), value: 'text' },\n { label: _('Background'), value: 'background' },\n ].map(({ label: optionLabel, value: optionValue }) => (\n <RadioBar.Option\n key={optionValue}\n value={optionValue}\n label={_(optionLabel)}\n />\n ))}\n </RadioBar>\n </ControlGroup>\n )}\n {colorMode && <StyledLabel>{_('Method')}</StyledLabel>}\n <FormatterEditor\n selectedDataSelector={selectedDataSelector}\n selectedFormatterType={selectedFormatterType}\n currentFormatterConfig={currentFormatterConfig}\n onDataSelectorChange={handleDataSelectorChange}\n onFormatterTypeChange={handleFormatterChange}\n onFormatterConfigChange={handleFormatterConfigChange}\n formatters={formatters}\n dataSelectors={dataSelectors}\n defaultPalettesConfig={defaultPalettesConfig}\n showStaticTextColor={showStaticTextColor}\n />\n </StyledFlyoutContent>\n </Popover>\n </>\n );\n};\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { defaultPalettesConfig as initialPalettesConfig } from '@splunk/visualization-color-palettes/editors/PresetPalettes';\nimport type { OptionsStanza } from '@splunk/visualization-encoding/AST';\nimport type { UiConfig, FormatterUiConfig } from './formatters/FormatterEditor';\nimport { DynamicColorEditorPropTypes } from '../interfaces/DynamicColorEditorProps';\nimport { DynamicColorEditor } from './DynamicColorEditor';\nimport ToggleEditor from './ToggleEditor';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport type { PalettesConfig } from '../interfaces/PalettesConfig';\nimport { getToggleOffValueForDataColors } from '../utils/EditorFunctions';\n\nexport interface DynamicColorEditorWithPrecedenceProps extends BaseEditorProps {\n name: string;\n value: any;\n flyoutTitle?: string;\n dataSelectors?: UiConfig[];\n formatters?: FormatterUiConfig[];\n defaultPalettesConfig: PalettesConfig;\n tooltip?: string;\n options?: Record<string, any>; // Pass in current visualization options to determine choropleth status\n onChange: (...args: any[]) => void;\n}\n\nconst propTypes: Record<keyof DynamicColorEditorWithPrecedenceProps, T.Validator<any>> = {\n ...DynamicColorEditorPropTypes,\n};\n\nexport const DynamicColorEditorWithPrecedence: React.FC<DynamicColorEditorWithPrecedenceProps> = ({\n name, // the option links to both the toggle and the dynamic color editor\n value, // the option value\n label = '',\n labelPosition,\n labelWidth,\n context,\n flyoutTitle = _('Dynamic coloring'),\n formatters = [],\n dataSelectors = [],\n defaultPalettesConfig = initialPalettesConfig,\n tooltip,\n options = {},\n onChange = () => undefined,\n}) => {\n // Helper function to check if value represents the \"off\" state\n const isValueInOffState = React.useCallback((val: any) => {\n if (!val || val === '') {\n return true;\n }\n\n // Check if it's the choropleth fallback pattern: \"> areaValues | gradient()\"\n if (typeof val === 'string') {\n const choroplethPattern = /^>\\s*areaValues\\s*\\|\\s*gradient\\(\\s*\\)$/;\n return choroplethPattern.exec(val) !== null;\n }\n\n return false;\n }, []);\n\n const [isDynamicEditorEnabled, setDynamicEditorEnabled] = React.useState(!isValueInOffState(value));\n React.useEffect(() => {\n setDynamicEditorEnabled(!isValueInOffState(value));\n }, [value, isValueInOffState]);\n\n const handleToggleChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, _optionStanza: OptionsStanza) => {\n setDynamicEditorEnabled(prevState => !prevState);\n\n const updatedOptions: Record<string, any> = {};\n const updatedContext: Record<string, any> = {};\n\n if (isDynamicEditorEnabled) {\n // toggle off: use choropleth-aware logic to determine appropriate fallback value\n const dataSelectorValues = dataSelectors.map(ds => ds.value);\n updatedOptions[name] = getToggleOffValueForDataColors({\n name,\n options,\n dataSelectors: dataSelectorValues,\n });\n // Remove dataColorsEditorConfig from context\n if (context && context.dataColorsEditorConfig !== undefined) {\n updatedContext.dataColorsEditorConfig = undefined;\n }\n } else {\n // toggle on: check if we're coming from choropleth fallback or from empty state\n const choroplethPattern = /^>\\s*areaValues\\s*\\|\\s*gradient\\(\\s*\\)$/;\n const isFromChoroplethFallback =\n typeof value === 'string' && choroplethPattern.exec(value) !== null;\n\n if (isFromChoroplethFallback) {\n // Convert choropleth fallback to active gradient configuration\n updatedOptions[name] = '> areaValues | gradient(dataColorsEditorConfig)';\n // Use default gradient configuration\n const defaultGradientContext = formatters.find(f => f.value === 'gradient')?.defaults\n ?.areaValues;\n if (defaultGradientContext) {\n updatedContext.dataColorsEditorConfig = defaultGradientContext;\n }\n } else if (name.endsWith('dataColors')) {\n // toggle on from empty state: apply default formatter colors\n const dataSelector = dataSelectors[0]?.value;\n const formatter = formatters[0]?.value;\n const defaultContext = formatters[0]?.defaults?.[dataSelector];\n\n if (!dataSelector || !formatter || !defaultContext) {\n return;\n }\n updatedOptions[\n name\n ] = `> ${dataSelectors[0].value} | ${formatter}(dataColorsEditorConfig)`;\n updatedContext.dataColorsEditorConfig = defaultContext;\n }\n }\n\n onChange(event, { options: updatedOptions, context: updatedContext });\n },\n [context, dataSelectors, formatters, isDynamicEditorEnabled, name, onChange, options, value]\n );\n\n const handleDynamicColorEditorChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, optionStanza: OptionsStanza) => {\n onChange(event, optionStanza);\n },\n [onChange]\n );\n\n return (\n <div data-test=\"dynamic-color-toggle\">\n <ToggleEditor\n name={name}\n label={_('Dynamic coloring')}\n labelPosition=\"right\"\n value={isDynamicEditorEnabled}\n onChange={handleToggleChange}\n itemSchema={{ type: 'boolean' }}\n help={tooltip}\n />\n {isDynamicEditorEnabled && (\n <div data-test=\"dynamic-color-editor\">\n <DynamicColorEditor\n name={name}\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n value={value}\n context={context}\n onChange={handleDynamicColorEditorChange}\n flyoutTitle={flyoutTitle}\n formatters={formatters}\n dataSelectors={dataSelectors}\n defaultPalettesConfig={defaultPalettesConfig}\n />\n </div>\n )}\n </div>\n );\n};\n\nDynamicColorEditorWithPrecedence.propTypes = propTypes;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { unzip } from 'lodash';\nimport Text from '@splunk/react-ui/Text';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport ColumnLayout from '@splunk/react-ui/ColumnLayout';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ColumnSelectionEditor from './ColumnSelectionEditor';\nimport StaticItemEditor from './StaticItemEditor';\nimport {\n getDynamicOptionsFromConfig,\n getFieldFromFieldNameDsl,\n isConfigAdvanced,\n} from '../utils/dynamicItemInputEditor';\nimport { VERTICAL_EDITOR_SPACING } from '../shared/dimensionConstants';\nimport type { StaticItem, DynamicOptionsContext } from '../types';\n\ninterface DynamicOptionsConfig {\n context?: DynamicOptionsContext;\n options?: Record<string, unknown>;\n}\n\ninterface DynamicItemEditorProps {\n name: string;\n value: StaticItem[] | string;\n label: string;\n labelPosition?: 'top' | 'left';\n labelWidth?: number;\n onChange: (event: React.SyntheticEvent | null, updatedConfig: DynamicOptionsConfig) => void;\n context: DynamicOptionsContext;\n dataSourceBindings: { primary?: string };\n help?: string;\n validate?: (args: { value: string }) => { message: string } | null;\n [key: string]: unknown;\n}\n\nconst defaultHelpText = _(\n 'Advanced configuration options are being used by this input. Please edit in source mode.'\n);\n\nconst DynamicItemEditor = ({\n name,\n context,\n value = '',\n label,\n onChange,\n dataSourceBindings,\n labelPosition = 'top',\n labelWidth,\n help = defaultHelpText,\n validate,\n}: DynamicItemEditorProps): JSX.Element => {\n const [staticItems, setItems] = React.useState<StaticItem[]>([]);\n const [dynamicItemsLabelField, setLabel] = React.useState('');\n const [dynamicItemsValueField, setValue] = React.useState('');\n\n // update static and dynamic options when the props change\n React.useEffect(() => {\n const { staticOptions, dynamicOptionsLabel, dynamicOptionsValue } = getDynamicOptionsFromConfig({\n items: value,\n context,\n });\n\n setItems(staticOptions);\n setLabel(dynamicOptionsLabel);\n setValue(dynamicOptionsValue);\n }, [value, context]);\n\n // use static mode if no data source is configured\n React.useEffect(() => {\n const currDataSource = dataSourceBindings.primary;\n if (currDataSource !== undefined || Array.isArray(value)) {\n return;\n }\n\n onChange(null, {\n context: {\n formattedConfig: undefined,\n formattedStatics: undefined,\n statics: undefined,\n label: undefined,\n value: undefined,\n },\n options: {\n [name]: staticItems,\n },\n });\n }, [dataSourceBindings, name, value, onChange, staticItems]);\n\n const handleChange = React.useCallback(\n (newItems, newLabelField, newValueField) => {\n const isStaticConfiguration = Array.isArray(value) && (!newLabelField || !newValueField);\n\n if (isStaticConfiguration) {\n onChange(null, { options: { [name]: newItems } });\n } else {\n const statics: string[][] = unzip(\n newItems.map(({ label: l, value: v }: StaticItem) => [l, v])\n );\n onChange(null, {\n context: {\n formattedConfig: { number: { prefix: '' } },\n formattedStatics: '>statics | formatByType(formattedConfig)',\n statics,\n label: `>primary | seriesByName(\"${newLabelField}\") | renameSeries(\"label\") | formatByType(formattedConfig)`,\n value: `>primary | seriesByName(\"${newValueField}\") | renameSeries(\"value\") | formatByType(formattedConfig)`,\n },\n options: {\n [name]: '>frame(label, value) | prepend(formattedStatics) | objects()',\n },\n });\n }\n },\n [name, value, onChange]\n );\n\n const handleStaticItemChange = React.useCallback(\n (_event, _name, newItems) => {\n handleChange(newItems, dynamicItemsLabelField, dynamicItemsValueField);\n },\n [handleChange, dynamicItemsLabelField, dynamicItemsValueField]\n );\n\n const handleDynamicLabelFieldChange = React.useCallback(\n (_event, { value: newLabel }) => {\n if (dynamicItemsValueField === '') {\n // it is unecessary to update the definition until both label and value are set\n setLabel(newLabel);\n } else {\n handleChange(staticItems, newLabel, dynamicItemsValueField);\n }\n },\n [handleChange, staticItems, dynamicItemsValueField]\n );\n\n const handleDynamicValueFieldChange = React.useCallback(\n (_event, { value: newValue }) => {\n if (dynamicItemsLabelField === '') {\n // it is unecessary to update the definition until both label and value are set\n setValue(newValue);\n } else {\n handleChange(staticItems, dynamicItemsLabelField, newValue);\n }\n },\n [handleChange, staticItems, dynamicItemsLabelField]\n );\n\n const prepareDynamicFieldValue =\n (key: string) =>\n (config: DynamicOptionsConfig): Record<string, unknown> => {\n const fieldDsl = config?.options?.[key];\n if (typeof fieldDsl === 'string') {\n return { value: getFieldFromFieldNameDsl(fieldDsl) };\n }\n return { value: '' };\n };\n\n const usingAdvancedConfig = React.useMemo(\n () => isConfigAdvanced({ items: value, context }),\n [value, context]\n );\n if (usingAdvancedConfig) {\n return (\n <ControlGroup label={_(label)} labelPosition={labelPosition} labelWidth={labelWidth} help={help}>\n <Text key={value.toString()} data-test={name} disabled defaultValue={value.toString()} />\n </ControlGroup>\n );\n }\n\n const dataSourceConfigured = !!dataSourceBindings.primary;\n return (\n <>\n <StaticItemEditor\n name=\"\"\n label={_('Static menu configuration')}\n labelPosition={labelPosition}\n value={staticItems}\n onChange={handleStaticItemChange}\n validate={validate}\n />\n {dataSourceConfigured && (\n <ColumnLayout key=\"dynamic-item-editor-label-value-layout\" gutter={VERTICAL_EDITOR_SPACING}>\n <ColumnLayout.Row key=\"dynamic-item-editor-label-row\">\n <ColumnSelectionEditor\n name=\"label\"\n label={_('Dynamic menu label field')}\n dataSourceKey=\"primary\"\n dataSourceBindings={dataSourceBindings}\n value={`>primary | seriesByName(\"${dynamicItemsLabelField}\")`}\n context={context}\n onChange={handleDynamicLabelFieldChange}\n prepareValue={prepareDynamicFieldValue('label')}\n />\n </ColumnLayout.Row>\n <ColumnLayout.Row key=\"dynamic-item-editor-value-row\">\n <ColumnSelectionEditor\n name=\"value\"\n label={_('Dynamic menu value field')}\n dataSourceKey=\"primary\"\n dataSourceBindings={dataSourceBindings}\n value={`>primary | seriesByName(\"${dynamicItemsValueField}\")`}\n context={context}\n onChange={handleDynamicValueFieldChange}\n prepareValue={prepareDynamicFieldValue('value')}\n />\n </ColumnLayout.Row>\n </ColumnLayout>\n )}\n </>\n );\n};\n\nDynamicItemEditor.propTypes = {\n /**\n * Callback when changing the text value\n *\n * onChange function has the following properties\n * @param {SyntheticEvent} event The react `SyntheticEvent`\n * @param {String} name The option name\n * @param {StaticItem[]} 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.oneOfType([\n T.arrayOf(\n T.shape({\n label: T.string.isRequired,\n value: T.string.isRequired,\n }).isRequired\n ),\n T.string,\n ]),\n /**\n * Label position\n */\n labelPosition: T.oneOf(['top', 'left']),\n /**\n * Label width\n */\n labelWidth: T.number,\n /**\n * The context object\n */\n context: T.shape({\n label: T.string,\n value: T.string,\n statics: T.arrayOf(T.arrayOf(T.string.isRequired).isRequired),\n }).isRequired,\n /**\n * Primary data source binding\n */\n dataSourceBindings: T.shape({ primary: T.any }).isRequired,\n help: T.string,\n};\n\nexport default DynamicItemEditor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport {\n handleKeyDown,\n shortcuts,\n TextAreaCommandOrchestrator,\n commands,\n type ICommand,\n} from '@uiw/react-md-editor/nohighlight';\n\nimport Markdown from '@splunk/react-ui/Markdown';\nimport Message from '@splunk/react-ui/Message';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { createDOMID } from '@splunk/ui-utils/id';\nimport TextBBold from '@splunk/react-icons/TextBBold';\nimport Chain from '@splunk/react-icons/Chain';\nimport TextH from '@splunk/react-icons/TextH';\nimport TextIItalic from '@splunk/react-icons/TextIItalic';\nimport ChevronsSlash from '@splunk/react-icons/ChevronsSlash';\nimport Picture from '@splunk/react-icons/Picture';\nimport List from '@splunk/react-icons/List';\nimport ListNumbered from '@splunk/react-icons/ListNumbered';\nimport QuotationDouble from '@splunk/react-icons/QuotationDouble';\nimport Button from '@splunk/react-ui/Button';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport TextArea from '@splunk/react-ui/TextArea';\nimport ScreenReaderContent from '@splunk/react-ui/ScreenReaderContent';\nimport { variables } from '@splunk/themes';\nimport { useCSPViolationObserver } from '../hooks/useCSPViolationObserver';\nimport { CSPMessage } from '../shared/CSPMessage';\nimport { MessageContainer } from '../shared/MessageContainer';\n\nconst TOOLBAR_COMMANDS: ICommand[] = [\n {\n ...commands.heading3,\n icon: <TextH />,\n name: 'header',\n },\n {\n ...commands.bold,\n icon: <TextBBold />,\n name: 'bold',\n },\n {\n ...commands.italic,\n icon: <TextIItalic />,\n name: 'italic',\n },\n {\n ...commands.link,\n icon: <Chain />,\n name: 'link',\n },\n {\n ...commands.quote,\n icon: <QuotationDouble />,\n name: 'quote',\n },\n {\n ...commands.code,\n icon: <ChevronsSlash />,\n name: 'code',\n },\n {\n ...commands.image,\n icon: <Picture />,\n name: 'image',\n },\n {\n ...commands.unorderedListCommand,\n icon: <List />,\n name: 'unordered-list',\n },\n {\n ...commands.orderedListCommand,\n icon: <ListNumbered />,\n name: 'ordered-list',\n },\n];\n\nconst EditorContainer = styled.div`\n font-family: ${variables.sansFontFamily};\n`;\n\nconst Toolbar = styled.div`\n display: flex;\n padding: 12px 0;\n justify-content: space-between;\n`;\n\nconst StyledTextArea = styled(TextArea)`\n [data-test='textbox'] {\n resize: vertical;\n }\n`;\n\nconst HiddenPreview = styled.div`\n display: none;\n`;\n\nconst ToolbarButtonStyled = styled(Button)`\n flex: 0;\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\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\ninterface ToolbarButtonProps {\n command: ICommand;\n isFocusable: boolean;\n onFocus: (name: string) => void;\n onExecute: (command: ICommand) => void;\n}\n\nconst ToolbarButton: React.FC<ToolbarButtonProps> = React.memo(\n ({ command, isFocusable, onFocus, onExecute }) => {\n const { icon, buttonProps } = command;\n const { title } = buttonProps || {};\n\n return (\n <Tooltip\n content={title || ''}\n contentRelationship=\"label\"\n renderAnchor={({\n onFocus: tooltipAnchorOnFocus,\n onClick: tooltipAnchorOnClick,\n ...anchorProps\n }) => (\n <ToolbarButtonStyled\n appearance=\"subtle\"\n data-name={command.name}\n onFocus={event => {\n tooltipAnchorOnFocus(event);\n onFocus(command.name || '');\n }}\n tabIndex={isFocusable ? 0 : -1}\n onClick={event => {\n tooltipAnchorOnClick(event);\n onExecute(command);\n }}\n {...anchorProps}\n >\n {icon}\n </ToolbarButtonStyled>\n )}\n />\n );\n }\n);\n\nToolbarButton.displayName = 'ToolbarButton';\n\nToolbarButton.propTypes = {\n command: T.object.isRequired,\n isFocusable: T.bool.isRequired,\n onFocus: T.func.isRequired,\n onExecute: T.func.isRequired,\n};\n\ninterface MarkdownEditorProps {\n onChange: (event: any, name: string, value: string) => void;\n name: string;\n value?: string;\n defaultErrors?: ErrorState;\n}\n\nconst MarkdownEditor: React.FC<MarkdownEditorProps> = ({\n onChange,\n name,\n value = '',\n defaultErrors = {},\n}) => {\n const instanceId = React.useMemo(() => createDOMID('markdown-editor'), []);\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const [val, setValueState] = React.useState(value);\n const [focusableCommand, setFocusableCommand] = React.useState<string>(TOOLBAR_COMMANDS[0].name || '');\n const orchestratorRef = React.useRef<TextAreaCommandOrchestrator | null>(null);\n const [errors, setErrors] = React.useState<ErrorState>(defaultErrors);\n\n // Initialize command orchestrator when textarea is available\n React.useEffect(() => {\n if (textareaRef.current && !orchestratorRef.current) {\n orchestratorRef.current = new TextAreaCommandOrchestrator(textareaRef.current);\n }\n\n return () => {\n orchestratorRef.current = null;\n };\n }, []);\n\n const handleValueChange = React.useCallback(\n (\n _event: React.ChangeEvent<HTMLTextAreaElement> | React.MouseEvent<HTMLSpanElement>,\n { value: newValue }: { value: string }\n ) => {\n setValueState(newValue);\n },\n []\n );\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent<HTMLTextAreaElement>) => {\n if (val !== value) {\n onChange(event, name, val);\n setErrors(defaultErrors);\n }\n },\n [val, value, onChange, name, defaultErrors]\n );\n\n const executeCommand = React.useCallback((command: ICommand) => {\n if (orchestratorRef.current && textareaRef.current) {\n orchestratorRef.current.executeCommand(command);\n setValueState(textareaRef.current.value);\n }\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 const handleToolbarKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n const item = e.target as HTMLElement;\n if (item.tagName !== 'BUTTON') return;\n\n const toolbar = e.currentTarget;\n const buttons = Array.from(toolbar.querySelectorAll<HTMLElement>('button'));\n const currentIndex = buttons.indexOf(item);\n\n if (currentIndex === -1) return;\n\n const prevPressed = e.key === 'ArrowLeft';\n const nextPressed = e.key === 'ArrowRight';\n const firstPressed = e.key === 'Home';\n const lastPressed = e.key === 'End';\n\n let newFocus: HTMLElement | null = null;\n if (prevPressed) {\n // Wrap to last button if at first\n newFocus = buttons[currentIndex - 1] ?? buttons[buttons.length - 1];\n } else if (nextPressed) {\n // Wrap to first button if at last\n newFocus = buttons[currentIndex + 1] ?? buttons[0];\n } else if (firstPressed) {\n [newFocus] = buttons;\n } else if (lastPressed) {\n newFocus = buttons[buttons.length - 1];\n }\n\n if (newFocus) {\n e.preventDefault();\n newFocus.focus();\n }\n }, []);\n\n const handleTextareaKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // Handle tab key and newlines\n handleKeyDown(e, 2, true); // tab size 2, allow default tab to exit the textarea\n\n // Handle markdown keyboard shortcuts\n if (orchestratorRef.current) {\n shortcuts(e, TOOLBAR_COMMANDS, orchestratorRef.current);\n // Update value after command execution\n if (textareaRef.current) {\n setValueState(textareaRef.current.value);\n }\n }\n }, []);\n\n return (\n <EditorContainer data-test={name}>\n <Toolbar\n role=\"toolbar\"\n aria-label={_('Markdown formatting')}\n aria-orientation=\"horizontal\"\n aria-controls={`${instanceId}-textarea`}\n onKeyDown={handleToolbarKeyDown}\n >\n {TOOLBAR_COMMANDS.map(command => (\n <ToolbarButton\n key={command.name}\n command={command}\n isFocusable={focusableCommand === command.name}\n onFocus={setFocusableCommand}\n onExecute={executeCommand}\n />\n ))}\n </Toolbar>\n <ScreenReaderContent id={`${instanceId}-textarea-label`}>\n {_('Markdown editor')}\n </ScreenReaderContent>\n <StyledTextArea\n inputRef={textareaRef}\n data-test={`${name}-textarea`}\n id={`${instanceId}-textarea`}\n labelledBy={`${instanceId}-textarea-label`}\n value={val}\n onChange={handleValueChange}\n onBlur={handleBlur}\n onKeyDown={handleTextareaKeyDown}\n />\n {hiddenMarkdownPreview}\n {errorMessage && <MessageContainer>{errorMessage}</MessageContainer>}\n </EditorContainer>\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 * Initial error state for CSP violations and image loading\n */\n defaultErrors: T.objectOf(T.oneOf(['warning', 'error', 'other'])),\n};\n\nexport default MarkdownEditor;\n","import React, { useState, useRef, useEffect, useCallback, useMemo } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { noop } from 'lodash';\nimport variables from '@splunk/themes/variables';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport FormRows from '@splunk/react-ui/FormRows';\nimport { createDOMID } from '@splunk/ui-utils/id';\nimport Button from '@splunk/react-ui/Button';\nimport type { PopoverRequestCloseHandler } from '@splunk/react-ui/Popover';\nimport Popover from '@splunk/react-ui/Popover';\nimport { VIZ_CATEGORICAL } from '@splunk/visualization-color-palettes';\nimport { BaseEditorPropTypes } from '../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport ColorEditor from './ColorEditor';\n\nconst popoverStyle = { padding: '10px' };\nconst colorButtonStyle = { width: '314px' };\n\nconst StyledButton = styled(Button)`\n padding: 8px;\n width: 100%;\n min-height: 40px;\n & > span {\n display: grid;\n grid-template-columns: repeat(auto-fill, 26px);\n justify-content: space-evenly;\n grid-gap: 4px;\n }\n background-color: ${variables.interactiveColorBackground};\n`;\n\nconst ColorChip = styled.div`\n width: 26px;\n height: 24px;\n background-color: ${(props): string => props.color};\n border-radius: 2px;\n border: 1px solid ${variables.neutral100};\n`;\n\nconst StyledFlyoutContent = styled.div`\n box-sizing: border-box;\n padding: 8px;\n width: 312px;\n max-height: 484px;\n background-color: ${variables.backgroundColorPopup};\n`;\n\nconst FlyoutHeader = styled.div`\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n padding: 8px 8px 0 8px;\n font-family: ${variables.fontFamily};\n color: ${variables.contentColorActive};\n`;\n\nconst ColorListEditor = styled.div`\n height: 412px;\n overflow-y: auto;\n padding: 8px 10px;\n`;\n\nexport interface ColorFlyoutEditorProps {\n colors: string[];\n handleColorRemove: (_e, { index }: { index: number }) => void;\n handleColorChange: (idx: number) => (_evt, name: string, value: string) => void;\n CustomColorMatchEditor?: (props: { index: number }) => React.ReactNode;\n flyoutTitle: string;\n addColorButtonLabel: string;\n handleColorAdd: () => void;\n handleColorMove: (data: { fromIndex: number; toIndex: number }) => void;\n}\n\nexport const ColorFlyoutEditor = ({\n colors,\n CustomColorMatchEditor,\n handleColorRemove,\n handleColorChange,\n flyoutTitle,\n addColorButtonLabel,\n handleColorAdd,\n handleColorMove,\n}: ColorFlyoutEditorProps) => {\n const ColorRowItems = useMemo(() => {\n return colors.map((color, idx) => {\n // disable the color editor's text input when a custom input editor is available to render adjacently\n const showTextInput = CustomColorMatchEditor == null;\n return (\n <FormRows.Row\n index={idx}\n key={createDOMID()}\n data-color={color}\n onRequestRemove={handleColorRemove}\n >\n <div style={{ display: 'flex', justifyContent: 'space-between' }}>\n <ColorEditor\n value={color}\n key={createDOMID()}\n onChange={handleColorChange(idx)}\n hideLabel\n label=\" \"\n name=\"color\"\n style={{ marginBottom: 0, marginTop: 0, width: showTextInput ? '100%' : 32 }}\n showTextInput={showTextInput}\n />\n {typeof CustomColorMatchEditor === 'function' && (\n <CustomColorMatchEditor index={idx} />\n )}\n </div>\n </FormRows.Row>\n );\n });\n }, [colors, CustomColorMatchEditor, handleColorRemove, handleColorChange]);\n\n return (\n <StyledFlyoutContent data-test=\"MultiColorPickerFlyoutContent\">\n <FlyoutHeader data-test=\"MultiColorPickerFlyoutTitle\">{flyoutTitle}</FlyoutHeader>\n <ColorListEditor>\n <FormRows\n addLabel={addColorButtonLabel}\n onRequestAdd={handleColorAdd}\n onRequestMove={handleColorMove}\n data-test=\"ColorListEditor\"\n >\n {ColorRowItems}\n </FormRows>\n </ColorListEditor>\n </StyledFlyoutContent>\n );\n};\n\nexport interface MultiColorPickerEditorProps extends BaseEditorProps {\n CustomColorMatchEditor?: (props: { index: number }) => React.ReactNode;\n canReorderColors?: boolean;\n value: string[];\n flyoutTitle?: string;\n addColorButtonLabel?: string;\n hideLabel?: boolean;\n canAddNewColors?: boolean;\n}\n\nconst MultiColorPickerEditor: React.FunctionComponent<MultiColorPickerEditorProps> = ({\n CustomColorMatchEditor,\n onChange = noop,\n canReorderColors = true,\n value: vizColors = VIZ_CATEGORICAL,\n flyoutTitle = _('Customize colors'),\n addColorButtonLabel = _('Add color'),\n name = 'seriesColors',\n label = '',\n labelPosition = 'top',\n labelWidth,\n isDisabled = false,\n hideLabel = true,\n canAddNewColors = true,\n}) => {\n const [showFlyout, setShowFlyout] = useState(false);\n const [colors, setColors] = useState(vizColors);\n const buttonRef = useRef(null);\n\n useEffect(() => {\n setColors(vizColors);\n }, [vizColors]);\n\n // callbacks to add, remove, update and reorder a color form row\n const handleColorAdd = useCallback(() => {\n const userColorsSet = new Set(colors);\n let nextColor = VIZ_CATEGORICAL.find(color => !userColorsSet.has(color));\n if (!nextColor) {\n // All picked, count appearances\n const countMap = new Map<string, number>();\n VIZ_CATEGORICAL.forEach(color => countMap.set(color, 0));\n colors.forEach(color => {\n countMap.set(color, (countMap.get(color) || 0) + 1);\n });\n // Find color with minimum appearances\n let minCount = Infinity;\n VIZ_CATEGORICAL.forEach(color => {\n const count = countMap.get(color) || 0;\n if (count < minCount) {\n minCount = count;\n nextColor = color;\n }\n });\n }\n onChange(null, name, [...colors, nextColor]);\n }, [name, onChange, colors]);\n\n const handleColorChange = useCallback(\n idx => (_evt, _name, value) => {\n const colorsCopy = [...colors];\n colorsCopy.splice(idx, 1, value);\n onChange(null, name, colorsCopy);\n },\n [name, onChange, colors]\n );\n\n const handleColorRemove = useCallback(\n (e, { index }) => {\n const colorsCopy = [...colors];\n colorsCopy.splice(index, 1);\n onChange(null, name, colorsCopy);\n },\n [name, onChange, colors]\n );\n\n const handleColorMove = useCallback(\n ({ fromIndex, toIndex }) => {\n const colorsCopy = [...colors];\n const movedColor = colorsCopy[fromIndex];\n colorsCopy.splice(fromIndex, 1); // first, delete the color at the original position\n colorsCopy.splice(toIndex, 0, movedColor); // then reinsert it at the new position\n onChange(null, name, colorsCopy);\n },\n [name, onChange, colors]\n );\n\n /**\n * custom logic is required for closing the flyout as the FormRows component is rendered inside a Popover, and\n * when we sort the form rows, the popover closes mid-sorting (closeReason=\"clickAway\") as the dragged element is\n * taken out of the flow. Current workaround is to check if the event's source element has a sortable handle,\n * if yes, the flyout is kept open.\n *\n * Additionally, focus is returned to the trigger button when exiting through escape key press\n */\n const handleFlyoutClose: PopoverRequestCloseHandler = useCallback(({ event, reason }) => {\n // @ts-ignore\n if (!event?.srcElement?.sortableHandle) {\n setShowFlyout(false);\n }\n if (reason === 'escapeKey') {\n buttonRef.current.focus();\n }\n }, []);\n\n const ColorChips = useMemo(\n () => colors.map(color => <ColorChip color={color} key={createDOMID()} />),\n [colors]\n );\n\n const toggleShowFlyout = useCallback(() => {\n setShowFlyout(isShown => !isShown);\n }, []);\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n hideLabel={hideLabel}\n data-test=\"MultiColorPickerEditor\"\n >\n <StyledButton\n inline={false}\n data-test=\"MultiColorPickerButton\"\n appearance=\"default\"\n ref={buttonRef}\n onClick={toggleShowFlyout}\n disabled={isDisabled}\n style={colorButtonStyle}\n >\n {ColorChips}\n </StyledButton>\n <Popover\n data-test=\"MultiColorPickerFlyout\"\n open={showFlyout}\n anchor={buttonRef.current}\n defaultPlacement=\"horizontal\"\n style={popoverStyle}\n onRequestClose={handleFlyoutClose}\n takeFocus\n >\n <ColorFlyoutEditor\n colors={colors}\n CustomColorMatchEditor={CustomColorMatchEditor}\n handleColorRemove={handleColorRemove}\n handleColorChange={handleColorChange}\n handleColorAdd={canAddNewColors ? handleColorAdd : undefined}\n handleColorMove={canReorderColors ? handleColorMove : undefined}\n flyoutTitle={flyoutTitle}\n addColorButtonLabel={addColorButtonLabel}\n />\n </Popover>\n </ControlGroup>\n );\n};\n\nMultiColorPickerEditor.propTypes = {\n ...BaseEditorPropTypes,\n /**\n * Colors can be reordered manually\n */\n canReorderColors: T.bool,\n /**\n * Can add a new color\n */\n canAddNewColors: T.bool,\n /**\n * List of colors\n */\n value: T.arrayOf(T.string),\n /**\n * Title of the flyout editor\n */\n flyoutTitle: T.string,\n /**\n * Button label for adding a new color row\n */\n addColorButtonLabel: T.string,\n /**\n * Custom input editor for mapping a value to color, eg: dropdown for field -> color\n */\n CustomColorMatchEditor: T.func,\n /**\n * Flag to hide the editor label\n */\n hideLabel: T.bool,\n};\n\nexport default MultiColorPickerEditor;\n","import * as React from 'react';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ColumnLayout from '@splunk/react-ui/ColumnLayout';\nimport type { OptionsStanza, Option as VisualizationOption } from '@splunk/visualization-encoding/AST';\nimport type { UiConfig, FormatterUiConfig } from './formatters/FormatterEditor';\nimport { DynamicColorEditor } from './DynamicColorEditor';\nimport SelectEditor from './SelectEditor';\nimport ColorEditor from './ColorEditor';\n\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport type { PalettesConfig } from '../interfaces/PalettesConfig';\nimport type { DynamicOptionsConfig } from '../types';\n\ntype Options = Record<string, VisualizationOption | null | undefined>;\n\nexport interface NetworkGraphDynamicColorEditorProps extends BaseEditorProps {\n name: string;\n value: string;\n contextName: string;\n flyoutTitle?: string;\n dataSelectors?: UiConfig[];\n formatters?: FormatterUiConfig[];\n defaultPalettesConfig: PalettesConfig;\n tooltip?: string;\n options?: Options;\n onChange: (event: React.SyntheticEvent | null, updatedConfig: DynamicOptionsConfig) => void;\n}\n\nconst TOTAL_COLUMN_SPAN = 12;\nconst COLOR_COLUMN_SPAN = TOTAL_COLUMN_SPAN / 2;\n\nexport const NetworkGraphDynamicColorEditor: React.FC<NetworkGraphDynamicColorEditorProps> = ({\n name,\n value,\n contextName,\n label = '',\n labelWidth,\n context,\n flyoutTitle = _('Dynamic coloring'),\n formatters = [],\n dataSelectors = [],\n defaultPalettesConfig,\n tooltip,\n options = {},\n onChange = () => undefined,\n}) => {\n const dataSelector = dataSelectors[0]?.value;\n\n const getCurrentColoringType = React.useCallback((optionValue: string) => {\n // if option is undefined, the default is static coloring\n if (!optionValue || optionValue.trim().startsWith('#')) return 'static';\n\n return 'dynamic';\n }, []);\n\n const [coloringType, setColoringType] = React.useState(getCurrentColoringType(value));\n const selectColumnSpan = TOTAL_COLUMN_SPAN - COLOR_COLUMN_SPAN;\n\n // Change coloring type if value changes in source code\n React.useEffect(() => {\n const newColoringType = getCurrentColoringType(value);\n setColoringType(newColoringType);\n }, [getCurrentColoringType, value]);\n\n const handleSelectChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, selectedName, selectedValue) => {\n setColoringType(selectedValue);\n\n const updatedOptions: Options = {\n ...options,\n };\n const updatedContext: Record<string, any> = { ...context };\n\n if (selectedValue === 'dynamic') {\n const defaultFormatter = formatters[0]?.value || 'gradient';\n const defaultConfig = formatters[0]?.defaults?.[dataSelector] || {};\n\n const dsl = `> ${dataSelector} | ${defaultFormatter}(${contextName})`;\n updatedOptions[name] = dsl;\n updatedContext[contextName] = defaultConfig;\n\n onChange(event, { options: updatedOptions, context: updatedContext });\n } else if (selectedValue === 'static') {\n updatedOptions[name] = undefined;\n updatedContext[contextName] = undefined;\n onChange(event, { options: updatedOptions, context: updatedContext });\n }\n },\n [options, context, formatters, dataSelector, contextName, name, onChange]\n );\n\n const handleDynamicColorEditorChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, optionStanza: OptionsStanza) => {\n const dsl = optionStanza.options[name];\n const config = optionStanza.context?.[contextName];\n const updatedOptions: Options = { ...options, [name]: dsl };\n\n const updatedContext = { ...context, [contextName]: config };\n onChange(event, { options: updatedOptions, context: updatedContext });\n },\n [options, name, context, onChange, contextName]\n );\n\n const handleStaticColorChange = React.useCallback(\n (event, optionName: string, color: string) => {\n const updatedOptions: Options = { ...options, [optionName]: color };\n const updatedContext = { ...context };\n updatedContext[contextName] = undefined;\n\n onChange(event, { options: updatedOptions, context: updatedContext });\n },\n [context, onChange, options, contextName]\n );\n\n return (\n <ColumnLayout data-test=\"dynamic-color-toggle\" gutter={15}>\n <ColumnLayout.Row data-test=\"network-graph-dynamic-color-row\" alignItems=\"start\">\n <ColumnLayout.Column span={selectColumnSpan}>\n <SelectEditor\n name={name}\n label={_(label)}\n labelPosition=\"top\"\n value={coloringType}\n onChange={handleSelectChange}\n itemSchema={{ type: 'string' }}\n values={[\n { label: _('Static coloring'), value: 'static' },\n {\n label: _('Dynamic coloring'),\n value: 'dynamic',\n },\n ]}\n help={tooltip}\n />\n </ColumnLayout.Column>\n {coloringType === 'dynamic' && (\n <ColumnLayout.Column span={COLOR_COLUMN_SPAN}>\n <DynamicColorEditor\n name={name}\n label={' '}\n labelPosition=\"top\"\n labelWidth={labelWidth}\n value={value}\n context={context}\n onChange={handleDynamicColorEditorChange}\n flyoutTitle={flyoutTitle}\n formatters={formatters}\n dataSelectors={dataSelectors}\n defaultPalettesConfig={defaultPalettesConfig}\n />\n </ColumnLayout.Column>\n )}\n {coloringType === 'static' && (\n <ColumnLayout.Column span={COLOR_COLUMN_SPAN}>\n <ColorEditor\n name={name}\n label={' '}\n labelPosition=\"top\"\n labelWidth={labelWidth}\n value={value}\n onChange={handleStaticColorChange}\n />\n </ColumnLayout.Column>\n )}\n </ColumnLayout.Row>\n </ColumnLayout>\n );\n};\n","import React, { useEffect, useRef } from 'react';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\nimport Button from '@splunk/react-ui/Button';\nimport Popover from '@splunk/react-ui/Popover';\nimport PresetIcons from '@splunk/visualization-icons/PresetIcons';\nimport { mixins } from '@splunk/themes';\nimport Header from '../shared/Header';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\n\nconst StyledHeader = styled(Header)`\n background-color: ${variables.backgroundColorPopup};\n`;\n\nconst PresetHeaderLabel = styled.span`\n font-weight: 500;\n font-size: 13px;\n margin-bottom: 7px;\n background-color: ${variables.backgroundColorPopup};\n`;\n\nconst PresetList = styled.ul`\n ${mixins.reset('block')};\n`;\n\nconst PresetListItem = styled.li`\n list-style: none;\n`;\n\nconst PresetOption = styled.button<{ selected: boolean }>`\n background-color: ${({ selected }) =>\n selected ? variables.interactiveColorOverlaySelected : variables.backgroundColorPopup};\n border: none;\n display: flex;\n padding: 7px 60px 7px 15px;\n position: relative;\n width: 100%;\n &:hover {\n cursor: pointer;\n background-color: ${variables.interactiveColorOverlayHover};\n }\n &:focus {\n box-shadow: ${variables.focusShadow};\n outline: none;\n z-index: 3;\n }\n`;\n\nconst PresetIconWrapper = styled.div`\n margin-right: 10px;\n &:hover {\n cursor: pointer;\n }\n`;\n\nconst PresetLabelWrapper = styled.div`\n align-items: center;\n display: flex;\n`;\n\nconst PresetLabel = styled.span`\n font-size: 13px;\n font-weight: normal;\n`;\n\ninterface PresetEntry {\n name: string;\n value: unknown;\n label: string;\n}\n\n// PresetSelectorEditorProps diverges from BaseEditorProps marking the value prop as optional.\n// If a base interface requires a property an extending interface cannot override it to be optional.\nexport interface PresetSelectorEditorProps extends Omit<BaseEditorProps, 'value'> {\n animation?: boolean;\n onChange: (e: React.MouseEvent<HTMLButtonElement>, val: unknown) => void;\n presets: PresetEntry[];\n label: string;\n value?: string;\n}\n\ninterface PresetOptionWrapperProps {\n presetName: string;\n presetLabel: string;\n presetValue: unknown;\n selectedPreset: string;\n onPopoverClick: (\n e: React.MouseEvent<HTMLButtonElement>,\n presetLabel: string,\n presetValue: unknown\n ) => void;\n open: boolean;\n}\n\nconst PresetOptionWrapper = ({\n presetName,\n presetLabel,\n presetValue,\n selectedPreset,\n onPopoverClick,\n open,\n}: PresetOptionWrapperProps) => {\n const ref = useRef<HTMLButtonElement | null>();\n const PresetIcon = PresetIcons[presetName];\n const handlePopoverClick = React.useCallback(\n e => {\n onPopoverClick(e, presetLabel, presetValue);\n },\n [onPopoverClick, presetLabel, presetValue]\n );\n\n useEffect(() => {\n if (open && presetLabel === selectedPreset) {\n ref.current?.focus();\n }\n }, [open, presetLabel, selectedPreset]);\n\n return (\n <PresetListItem key={presetLabel}>\n <PresetOption\n data-test={`flyout-preset-option-${presetLabel}`}\n selected={presetLabel === selectedPreset}\n onClick={handlePopoverClick}\n ref={ref}\n >\n <PresetIconWrapper>\n {PresetIcon && <PresetIcon data-test={`icon-label-${presetLabel}`} />}\n </PresetIconWrapper>\n <PresetLabelWrapper>\n <PresetLabel>{presetLabel}</PresetLabel>\n </PresetLabelWrapper>\n </PresetOption>\n </PresetListItem>\n );\n};\n\nconst PresetSelectorEditor = ({\n animation = true, // allow for disabling for unit testing purposes\n labelPosition = 'top',\n onChange,\n label,\n labelWidth,\n presets,\n value,\n}: PresetSelectorEditorProps) => {\n const [isFlyoutOpen, setIsFlyoutOpen] = React.useState(false);\n // todo: design input on info state for custom context\n const [selectedPreset, setSelectedPreset] = React.useState(value || 'Select...');\n const [anchor, setAnchor] = React.useState<HTMLButtonElement>();\n const anchorRef = React.useCallback(el => setAnchor(el), []);\n\n const handleButtonClick = React.useCallback(() => setIsFlyoutOpen(prevState => !prevState), []);\n\n const handleRequestClose = React.useCallback(\n ({ event, reason }) => {\n if (event && reason === 'clickAway') {\n let el = event.target;\n\n while (el) {\n if (el === anchor || typeof el?.parentNode === 'undefined') {\n return;\n }\n el = el.parentNode;\n }\n }\n setIsFlyoutOpen(false);\n anchor.focus();\n },\n [anchor]\n );\n\n const onPopoverClick = React.useCallback(\n (e, presetLabel, presetValue) => {\n setSelectedPreset(presetLabel);\n onChange(e, presetValue);\n setIsFlyoutOpen(false);\n anchor.focus();\n },\n [anchor, onChange]\n );\n const popoverId = `preset-editor-flyout-${label.replace(' ', '-')}`;\n\n return (\n <>\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth}>\n <Button\n data-test=\"preset-selector-button\"\n label={selectedPreset}\n isMenu\n elementRef={anchorRef}\n onClick={handleButtonClick}\n aria-label={`${label}, ${selectedPreset}`}\n aria-expanded={isFlyoutOpen}\n aria-controls={popoverId}\n />\n </ControlGroup>\n <Popover\n id={popoverId}\n animation={animation}\n data-test=\"preset-editor-flyout\"\n open={isFlyoutOpen}\n anchor={anchor}\n appearance=\"normal\"\n defaultPlacement=\"horizontal\"\n onRequestClose={handleRequestClose}\n role=\"dialog\"\n >\n <StyledHeader data-test=\"flyout-header\">\n <PresetHeaderLabel data-test=\"preset-selector-flyout-label\">{label}</PresetHeaderLabel>\n </StyledHeader>\n <PresetList>\n {presets.map(v => (\n <PresetOptionWrapper\n key={v.label}\n presetName={v.name}\n presetLabel={v.label}\n presetValue={v.value}\n selectedPreset={selectedPreset}\n onPopoverClick={onPopoverClick}\n open={isFlyoutOpen}\n />\n ))}\n </PresetList>\n </Popover>\n </>\n );\n};\n\nexport default PresetSelectorEditor;\n","import React, { useState, useCallback, useEffect, useMemo } from 'react';\nimport * as T from 'prop-types';\nimport { isEmpty } from 'lodash';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { createDOMID } from '@splunk/ui-utils/id';\nimport Select from '@splunk/react-ui/Select';\nimport { Options } from '@splunk/visualization-encoding/Options';\nimport EncodingParser from '@splunk/visualization-encoding/EncodingParser';\nimport { getDataSourceStateInfo } from '@splunk/visualizations-shared/dataSourceUtils';\nimport MultiColorPickerEditor from './MultiColorPickerEditor';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { BaseEditorPropTypes } from '../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport { useDataSource } from '../hooks/useDataSource';\n\ntype ObjS = Record<string, string>;\ninterface FieldEditorProps {\n fields: string[];\n dsFields: string[];\n handleFieldChange: (args: { newFieldIndex: number; currFieldIndex: number }) => void;\n}\n\nconst FieldEditor = ({\n fields,\n dsFields,\n handleFieldChange,\n}: FieldEditorProps): (({ index }: { index: number }) => JSX.Element) => {\n const FieldSelector = ({ index }) => {\n const SelectOptions = useMemo(\n () =>\n dsFields.map((dsField, idx) => (\n <Select.Option\n label={dsField}\n value={idx}\n key={createDOMID()}\n data-test={`${dsField}-${index}`}\n />\n )),\n [index]\n );\n\n const handleChange = useCallback(\n (e, { value: newFieldIndex }): void => {\n handleFieldChange({ newFieldIndex, currFieldIndex: index });\n },\n [index]\n );\n\n const selectedField = dsFields.indexOf(fields[index]);\n\n return (\n <Select\n value={selectedField}\n onChange={handleChange}\n style={{ width: 190 }}\n data-test=\"field-select\"\n >\n {SelectOptions}\n </Select>\n );\n };\n FieldSelector.propTypes = {\n index: T.number,\n };\n return FieldSelector;\n};\n\nexport type SeriesColorsByFieldEditorProps = BaseEditorProps & { isCategorical?: boolean };\n\nconst defaultValue = {} as SeriesColorsByFieldEditorProps['value'];\nconst defaultOptions = {} as SeriesColorsByFieldEditorProps['options'];\nconst defaultOptionsSchema = {} as SeriesColorsByFieldEditorProps['optionsSchema'];\n\nconst SeriesColorsByFieldEditor = ({\n name,\n value = defaultValue,\n dataSourceBindings,\n onChange,\n options = defaultOptions,\n isCategorical = false,\n context,\n optionsSchema = defaultOptionsSchema,\n}: SeriesColorsByFieldEditorProps) => {\n const [colors, setColors] = useState<string[]>(Object.values(value));\n const [fields, setFields] = useState<string[]>(Object.keys(value));\n\n useEffect(() => {\n setColors(Object.values(value));\n setFields(Object.keys(value));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [JSON.stringify(value)]);\n\n // fetch the dataSource fields\n const dataSource = useDataSource({ dataSourceBindings, dataSourceKey: 'primary' });\n const { isLoading } = useMemo(() => getDataSourceStateInfo(dataSource), [dataSource]);\n\n // for bubble and scatter, we fallback on the 'category' option default in case it's not user defined\n const { category = optionsSchema?.category?.default } = options ?? {};\n\n const dsFields = useMemo(() => {\n if (isCategorical) {\n if (!category) {\n return [];\n }\n\n if (Array.isArray(category)) {\n return [...new Set(category.map(val => val?.toString()).filter(val => !isEmpty(val)))];\n }\n\n if (!isLoading && EncodingParser.isDslString(category)) {\n const results = Options.evaluate(\n { context, options: { ...options, category } },\n { primary: dataSource }\n );\n if (Array.isArray(results.category)) {\n return [\n ...new Set(results.category.map(val => val?.toString()).filter(val => !isEmpty(val))),\n ];\n }\n }\n\n return [];\n }\n return dataSource?.data?.fields.map(val => val.name) ?? [];\n }, [context, dataSource, isCategorical, options, category, isLoading]);\n\n const { editorLabel, flyoutTitle, addColorButtonLabel } = useMemo(\n () =>\n isCategorical\n ? {\n editorLabel: _('Series colors by category name'),\n flyoutTitle: _('Color by category name'),\n addColorButtonLabel: _('Add category'),\n }\n : {\n editorLabel: _('Series colors by field name'),\n flyoutTitle: _('Color by field name'),\n addColorButtonLabel: _('Add field'),\n },\n [isCategorical]\n );\n\n // create the mapping of fields -> colors\n const getUpdatedValue = ({ updatedColors, updatedFields }) => {\n const updatedValue: ObjS = {};\n updatedFields.forEach((field, idx) => {\n updatedValue[field] = updatedColors[idx];\n });\n return updatedValue;\n };\n\n const handleColorChange = useCallback(\n (_evt: null, _name: string, updatedColors: string[]): void => {\n // don't allow the user to add a new field row if all fields are mapped to a color\n if (updatedColors.length > dsFields.length) {\n return;\n }\n\n const updatedFields = fields;\n\n // new field row has been added\n if (updatedColors.length > colors.length) {\n const newField = dsFields.find(dsField => !fields.includes(dsField));\n updatedFields.push(newField);\n }\n\n // if a field row is removed, remove the field entry associated with that row\n if (updatedColors.length < colors.length) {\n const delRowIndex = colors.findIndex(color => !updatedColors.includes(color));\n updatedFields.splice(delRowIndex, 1);\n }\n\n onChange(null, name, getUpdatedValue({ updatedColors, updatedFields }));\n },\n [dsFields, onChange, name, fields, colors]\n );\n\n const handleFieldChange = useCallback(\n ({ newFieldIndex, currFieldIndex }: { newFieldIndex: number; currFieldIndex: number }): void => {\n // find if the selected field has already been set in a different field row\n const doesFieldExist = fields.includes(dsFields[newFieldIndex]);\n\n const updatedFields = fields;\n\n // fields have to be swapped\n if (doesFieldExist) {\n const existingFieldIndex = fields.indexOf(dsFields[newFieldIndex]);\n const currField = fields[currFieldIndex];\n updatedFields[currFieldIndex] = fields[existingFieldIndex];\n updatedFields[existingFieldIndex] = currField;\n } else {\n updatedFields[currFieldIndex] = dsFields[newFieldIndex]; // a new field has been selected and we don't need to swap fields\n }\n\n onChange(null, name, getUpdatedValue({ updatedColors: colors, updatedFields }));\n },\n [fields, dsFields, colors, name, onChange]\n );\n\n const CustomColorMatchEditor = useMemo(\n () => FieldEditor({ fields, dsFields, handleFieldChange }),\n [dsFields, fields, handleFieldChange]\n );\n\n return (\n <ControlGroup label={editorLabel} labelPosition=\"top\" data-test=\"SeriesColorsByFieldEditor\">\n <MultiColorPickerEditor\n value={colors}\n onChange={handleColorChange}\n name=\"series\"\n canReorderColors={false}\n flyoutTitle={flyoutTitle}\n addColorButtonLabel={addColorButtonLabel}\n CustomColorMatchEditor={CustomColorMatchEditor}\n isDisabled={dsFields.length < 1}\n canAddNewColors={fields.length < dsFields.length}\n />\n </ControlGroup>\n );\n};\n\nSeriesColorsByFieldEditor.propTypes = { ...BaseEditorPropTypes, isCategorical: T.bool };\n\nexport default SeriesColorsByFieldEditor;\n","import React, { useState, useCallback, useMemo } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { isEqual } from 'lodash';\nimport Button from '@splunk/react-ui/Button';\nimport ColumnLayout from '@splunk/react-ui/ColumnLayout';\nimport Dropdown from '@splunk/react-ui/Dropdown';\nimport Menu from '@splunk/react-ui/Menu';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { VIZ_CATEGORICAL } from '@splunk/visualization-color-palettes';\nimport MultiColorPickerEditor from './MultiColorPickerEditor';\nimport { ColorPreview } from './formatters/ColorPreview';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport PreviewWrapper from '../shared/PreviewWrapper';\nimport { VERTICAL_EDITOR_SPACING, DROPDOWN_MENU_WIDTH } from '../shared/dimensionConstants';\nimport { BaseEditorPropTypes } from '../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\n\nconst MAX_PREVIEW_COLOR_COUNT = 8;\n\n// to add more warm/cold... palettes\nexport type PaletteType = 'default' | 'custom';\n\nexport interface PaletteDefinition<P extends PaletteType = PaletteType> {\n id: P;\n name: string;\n palette: string[];\n}\n\ntype Palettes = {\n [P in PaletteType]: PaletteDefinition<P>;\n};\n\nexport const PALETTES = {\n default: { id: 'default', name: _('Default'), palette: VIZ_CATEGORICAL },\n custom: { id: 'custom', name: _('Custom'), palette: [] },\n} satisfies Palettes;\n\nconst NameWrapper = styled.div`\n width: 120px;\n margin-right: 20px;\n display: flex;\n`;\n\nconst PaletteWrapper = styled(PreviewWrapper)`\n display: flex;\n align-items: center;\n`;\n\nconst ColorPreviewWrapper = styled.div`\n flex: 1 0 1px;\n height: 100%;\n`;\n\nconst SeriesColorsEditor = ({ label, value, name, onChange }: BaseEditorProps) => {\n const overrideCustomPalette = useMemo(() => !!value?.length && !isEqual(value, VIZ_CATEGORICAL), [value]);\n\n // use `value` to override the custom palette if value is not empty\n const originalPalettes = useMemo(() => {\n if (overrideCustomPalette) {\n return {\n ...PALETTES,\n custom: { ...PALETTES.custom, palette: value },\n };\n }\n return PALETTES;\n }, [overrideCustomPalette, value]);\n\n // selected palette ID\n const [selectedPalette, setSelectedPalette] = useState<PaletteType>(\n overrideCustomPalette ? 'custom' : 'default'\n );\n // current palettes on update\n const [palettes, setPalettes] = useState(originalPalettes);\n\n const handleMenuSelect = useCallback(\n (paletteId: PaletteType) => {\n setSelectedPalette(paletteId);\n onChange(null, name, palettes[paletteId].palette);\n },\n [name, onChange, palettes]\n );\n\n const handleColorChange = useCallback(\n (_evt, _name, newColors) => {\n if (newColors.length) {\n // override the previous custom palette\n setPalettes(prev => ({\n ...prev,\n custom: { ...PALETTES.custom, palette: newColors },\n }));\n setSelectedPalette('custom');\n onChange(null, name, newColors);\n } else {\n // set the colors to `Default` if MultiColorPicker returns empty array\n setPalettes(prev => ({\n ...prev,\n custom: PALETTES.custom,\n }));\n setSelectedPalette('default');\n onChange(null, name, PALETTES.default.palette);\n }\n },\n [name, onChange]\n );\n\n const toggle = (\n <Button\n appearance=\"default\"\n data-test=\"palette-dropdown-button\"\n label={palettes[selectedPalette].name}\n isMenu\n />\n );\n\n const renderMenuItem = (paletteConfig: PaletteDefinition) => {\n const { id, palette, name: paletteName } = paletteConfig;\n return (\n <Menu.Item\n key={`SeriesColorsDropdownMenuItem-${id}`}\n data-test={`palette-dropdown-menu-${id}`}\n selectable\n selected={selectedPalette === id}\n onClick={() => handleMenuSelect(id)}\n >\n <PaletteWrapper>\n <NameWrapper>{paletteName}</NameWrapper>\n <ColorPreviewWrapper>\n <ColorPreview\n colors={palette.slice(0, MAX_PREVIEW_COLOR_COUNT)}\n maxColorCount={MAX_PREVIEW_COLOR_COUNT}\n expandToFillHorizontalSpace={false}\n />\n </ColorPreviewWrapper>\n </PaletteWrapper>\n </Menu.Item>\n );\n };\n\n const isCustomPaletteAvailable = palettes.custom.palette.length > 0;\n\n return (\n <ColumnLayout gutter={VERTICAL_EDITOR_SPACING}>\n <ColumnLayout.Row>\n <ControlGroup\n label={label || _('Series colors')}\n labelPosition=\"top\"\n data-test=\"series-colors-editor\"\n >\n <Dropdown toggle={toggle}>\n <Menu style={{ width: DROPDOWN_MENU_WIDTH }}>\n {isCustomPaletteAvailable && renderMenuItem(palettes.custom)}\n {isCustomPaletteAvailable && <Menu.Divider />}\n {renderMenuItem(PALETTES.default)}\n </Menu>\n </Dropdown>\n </ControlGroup>\n </ColumnLayout.Row>\n <ColumnLayout.Row>\n <MultiColorPickerEditor\n name=\"series-colors\"\n value={palettes[selectedPalette].palette}\n flyoutTitle={_('Customize colors')}\n addColorButtonLabel={_('Add color')}\n onChange={handleColorChange}\n />\n </ColumnLayout.Row>\n </ColumnLayout>\n );\n};\n\nSeriesColorsEditor.propTypes = {\n ...BaseEditorPropTypes,\n value: T.arrayOf(T.string),\n};\n\nexport default SeriesColorsEditor;\n","import * as React from 'react';\nimport styled from 'styled-components';\nimport Slider from '@splunk/react-ui/Slider';\nimport NumberInput from '@splunk/react-ui/Number';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport { useNumberInput } from '../hooks/useNumberInput';\n\nconst numberStyle = { flexBasis: 92, flexGrow: 0, flexShrink: 0 };\n\nconst StyledSlider = styled(Slider)`\n div:has(> [data-test='bar']) {\n min-width: 0;\n }\n`;\n\ninterface SliderEditorProps extends BaseEditorProps {\n /** help text under controls */\n help?: string;\n /** max value for slider */\n max?: number;\n /** label for max value */\n maxLabel?: React.ReactNode;\n /** min value for slider */\n min?: number;\n /** label for min value */\n minLabel?: React.ReactNode;\n /** units to skip when moving slider */\n step?: number;\n /** display sections for drag bar */\n stepMarks?: 'focus' | 'always' | 'none';\n /** current value of field */\n value: number;\n /** default value of the option */\n defaultValue?: number;\n}\n\nexport const SliderEditor = ({\n help,\n isDisabled = false,\n label,\n labelPosition = 'top',\n labelWidth,\n max,\n maxLabel = null,\n min,\n minLabel = null,\n name,\n onChange,\n step,\n stepMarks = 'focus',\n value = null,\n defaultValue,\n}: SliderEditorProps): JSX.Element => {\n const handleSliderChange = React.useCallback(\n (event, { value: v }) => {\n // emit onChange if value is a number\n if (parseFloat(v) || v === 0) {\n onChange(event, name, v);\n }\n },\n [onChange, name]\n );\n const handleNumberChange = React.useCallback(\n (event, v) => {\n // emit onChange if value is a number\n if (parseFloat(v) || v === 0) {\n onChange(event, name, v);\n }\n },\n [onChange, name]\n );\n\n const { currentValue, handleChange, handleBlur, handleFocus, handleKeyPress } = useNumberInput({\n value,\n min,\n max,\n defaultValue,\n onValueChange: handleNumberChange,\n });\n\n // if there is no value show input as blank by passing undefined\n const displayValue = currentValue != null ? Number(currentValue) : undefined;\n\n // stepMarks = 'none'is not valid for react-ui/Slider\n const suiStepMarks = stepMarks === 'none' ? 'never' : stepMarks;\n return (\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth} help={help}>\n <StyledSlider\n data-test={name}\n min={min}\n minLabel={minLabel}\n max={max}\n maxLabel={maxLabel}\n step={step}\n stepMarks={suiStepMarks}\n value={displayValue}\n disabled={isDisabled}\n onChange={handleSliderChange}\n />\n <NumberInput\n inline\n min={min}\n max={max}\n step={step}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyDown={handleKeyPress}\n value={displayValue}\n disabled={isDisabled}\n style={numberStyle}\n />\n </ControlGroup>\n );\n};\n\nexport default SliderEditor;\n","import * as React from 'react';\nimport { cloneDeep, defaultsDeep, get, set } from 'lodash';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport { getDataSourceStateInfo } from '@splunk/visualizations-shared/dataSourceUtils';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport { getAvailableFieldsWithTypes, getPlaceholderMessage } from '../utils/columnSelectionUtils';\nimport type { FieldTuple } from '../utils/columnSelectionUtils';\nimport type {\n ColumnColoring,\n ColumnEntry,\n EditorSupportedFormatOptions,\n} from '../interfaces/ColumnFormatter';\nimport ColumnFormatterEntry from './table/ColumnFormatterEntry';\nimport AddColumn from './table/AddColumn';\nimport {\n checkExceedsEditorCapabilities,\n getColumnFormatDefFromState,\n getFormattingOptDSLKey,\n getGlobalTableFormatting,\n getInitialColumnFormattingState,\n getEditorSupportedFormatOptions,\n getExistingTextFormatting,\n TextDataType,\n} from './table/columnFormattingUtils';\nimport type { ColumnColoringConfig, FlyoutConfig } from './table/common/props';\nimport { useDataSource } from '../hooks/useDataSource';\n\ninterface TextFormatOption {\n label: string;\n editor: string;\n option: string;\n editorProps?: Record<string, unknown>;\n [key: string]: unknown;\n}\n\ntype TextFormatConfig = TextFormatOption[][];\n\ninterface TableColumnFormatterEditorProps extends BaseEditorProps {\n dataSourceKey?: string;\n defaultOptionsByType?: {\n [type: string]: {\n [option: string]: string | boolean | number;\n };\n };\n flyoutConfig: FlyoutConfig;\n columnColoringConfig: ColumnColoringConfig;\n textFormatConfig?: TextFormatConfig;\n}\n\n// TODO(fkurniawan): can be converted one-lined as getObjectFromMap(map) with TS v4\n// 😭 need node >= v12 for getObjectFromMap to work in test files\nconst getObjectFromMap = (map: Map<string, any>): any => {\n const objectFromMap = {};\n map.forEach((value, key): void => {\n objectFromMap[key] = value;\n });\n return objectFromMap;\n};\n\nconst TableColumnFormatterEditor: React.FunctionComponent<TableColumnFormatterEditorProps> = ({\n dataSourceKey = 'primary',\n dataSourceBindings,\n label,\n labelPosition = 'top',\n labelWidth,\n columnColoringConfig,\n defaultOptionsByType,\n flyoutConfig = [[]],\n onChange,\n value,\n textFormatConfig = [],\n}): React.ReactElement => {\n const {\n context: vizContext = {},\n columnFormat: columnFormatOption = {},\n tableFormat: tableFormatOption = {},\n } = value;\n const dataSource = useDataSource({ dataSourceBindings, dataSourceKey });\n const { columns, fields } = get(dataSource, 'data') || { columns: [], fields: [] };\n const availableFieldsWithTypes = getAvailableFieldsWithTypes(columns, fields);\n const editorSupportedFormatOptions = React.useMemo(\n (): EditorSupportedFormatOptions => getEditorSupportedFormatOptions(flyoutConfig),\n [flyoutConfig]\n );\n const [editorColumnFormatting, setEditorColumnFormatting] = React.useState(\n getInitialColumnFormattingState({\n availableFieldsWithTypes,\n coloringTypes: columnColoringConfig.coloringTypes,\n columnFormatOption,\n editorSupportedFormatOptions,\n vizContext,\n })\n );\n\n React.useEffect(\n (): void => {\n // if the list of available fields changes, need to reinitialize initialColumnFormatting editor\n setEditorColumnFormatting(\n getInitialColumnFormattingState({\n availableFieldsWithTypes,\n coloringTypes: columnColoringConfig.coloringTypes,\n columnFormatOption,\n editorSupportedFormatOptions,\n vizContext,\n })\n );\n },\n // since fields is an array of shallow name/type tuples, deep equality dependency here should not be too expensive\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [JSON.stringify(availableFieldsWithTypes)]\n );\n\n const handleResetColumnToDefault = React.useCallback(\n ({ columnName, columnDataType: dataType }): void => {\n const contextKey = getFormattingOptDSLKey(columnFormatOption[columnName]);\n const sourceCustomizedFormatByType = vizContext[contextKey] || { [dataType]: {} };\n const formatByTypeConfigOptsToReset = Object.keys(sourceCustomizedFormatByType[dataType]).reduce(\n (resetConfig, optToClear) => {\n // eslint-disable-next-line no-param-reassign\n resetConfig[optToClear] = null;\n return resetConfig;\n },\n {}\n );\n\n const formatText = getExistingTextFormatting(columnName, columnFormatOption);\n const updatedEditorColumnFormatting = new Map(editorColumnFormatting);\n const updatedColumnFormatEntry = {\n columnColoring: get(editorColumnFormatting.get(columnName), 'columnColoring', {\n _meta: {\n dynamicallyColoredOption: 'Off',\n },\n }),\n formatByType: {\n [dataType]: {\n ...formatByTypeConfigOptsToReset,\n ...defaultOptionsByType[dataType],\n _meta: {\n exceedsEditorCapabilities: false,\n },\n },\n },\n formatText,\n };\n updatedEditorColumnFormatting.set(columnName, updatedColumnFormatEntry as ColumnEntry);\n setEditorColumnFormatting(updatedEditorColumnFormatting);\n onChange(\n null,\n getColumnFormatDefFromState(\n cloneDeep({\n columnFormatOption,\n updatedEditorColumnFormatting: getObjectFromMap(updatedEditorColumnFormatting),\n })\n )\n );\n },\n [columnFormatOption, defaultOptionsByType, editorColumnFormatting, onChange, vizContext]\n );\n\n const updateDefinition = React.useCallback(\n (columnName, updatedColumnEntry, skipOnChange = false): void => {\n const updatedEditorColumnFormatting = new Map(editorColumnFormatting);\n updatedEditorColumnFormatting.set(columnName, updatedColumnEntry);\n setEditorColumnFormatting(updatedEditorColumnFormatting);\n if (skipOnChange) return;\n onChange(\n null,\n getColumnFormatDefFromState(\n cloneDeep({\n columnFormatOption,\n updatedEditorColumnFormatting: getObjectFromMap(updatedEditorColumnFormatting),\n })\n )\n );\n },\n [columnFormatOption, editorColumnFormatting, onChange]\n );\n\n const handleColumnColoringUpdate = React.useCallback(\n ({ columnName, coloringTypes, dynamicallyColoredOption }): void => {\n if (Array.isArray(coloringTypes)) {\n const updatedColumnFormatEntry: ColumnEntry = cloneDeep(\n editorColumnFormatting.get(columnName)\n );\n coloringTypes.forEach(\n ({ coloringType, colorContextKey, colorOptionDSL, colorContextConfig }) => {\n set(updatedColumnFormatEntry, ['columnColoring', coloringType], {\n colorContextKey,\n colorOptionDSL,\n colorContextConfig,\n });\n }\n );\n set(updatedColumnFormatEntry, ['columnColoring', '_meta'], {\n dynamicallyColoredOption,\n });\n updateDefinition(columnName, updatedColumnFormatEntry);\n }\n },\n [editorColumnFormatting, updateDefinition]\n );\n\n const handleColumnFormattingUpdate = React.useCallback(\n ({ columnName, optionName, value: newOptionValue }): void => {\n // TODO(fkurniawan): since the table editor currently associates one data type with a column, this only returns one type\n // however, may need to handle mixed-type column formatting in the future\n const [dataType] = Object.keys(editorColumnFormatting.get(columnName).formatByType);\n const updatedColumnFormatEntry: ColumnEntry = defaultsDeep(\n {},\n {\n formatByType: {\n [dataType]: {\n [optionName]: newOptionValue,\n _meta: {\n // an editor can only persist a change if all options in state are editor-supported\n exceedsEditorCapabilities: false,\n },\n },\n },\n },\n editorColumnFormatting.get(columnName)\n );\n updateDefinition(columnName, updatedColumnFormatEntry);\n },\n [editorColumnFormatting, updateDefinition]\n );\n\n const handleTextFormattingUpdate = React.useCallback(\n ({ columnName, optionName, value: newOptionValue }): void => {\n const updatedTextFormatEntry: ColumnEntry = defaultsDeep(\n {},\n {\n formatText: {\n [optionName]: newOptionValue,\n },\n },\n editorColumnFormatting.get(columnName)\n );\n updateDefinition(columnName, updatedTextFormatEntry);\n },\n [editorColumnFormatting, updateDefinition]\n );\n\n const handleAddColumnFormatting = React.useCallback(\n (e, { value: newValue }: { value: FieldTuple }): void => {\n const { name: columnName, type: columnDataType } = newValue;\n const columnDSLContextKey = getFormattingOptDSLKey(columnFormatOption[columnName]);\n\n /* if a context config key still exists when the user is adding a column via editor,\n * this means the user previously configured non-editor supported options via source and removed the column from the editor sidebar.\n *\n * There shouldn't be any other way that the editor reaches this condition when a user adds a column to be formatted via editor\n */\n let columnEntryToInsert;\n const supportedOptions = editorSupportedFormatOptions[columnDataType];\n if (columnDSLContextKey) {\n const columnFormatConfig = vizContext[columnDSLContextKey];\n columnEntryToInsert = {\n columnColoring: {\n _meta: {\n dynamicallyColoredOption: 'Off',\n },\n },\n formatByType: {\n [columnDataType]: {\n ...get(vizContext, [columnDSLContextKey, columnDataType], {}),\n _meta: {\n exceedsEditorCapabilities: checkExceedsEditorCapabilities(\n columnFormatConfig[columnDataType],\n supportedOptions\n ),\n },\n },\n },\n formatText: {},\n };\n // no need to call onChange for a column addition into table viz if it was source-customized, since there is nothing to persist back into state\n updateDefinition(columnName, columnEntryToInsert, true);\n return;\n }\n\n const globalFormattingForDataType = getGlobalTableFormatting(\n tableFormatOption,\n columnDataType,\n vizContext\n );\n columnEntryToInsert = {\n columnColoring: {\n _meta: {\n dynamicallyColoredOption: 'Off',\n },\n },\n formatByType: {\n [columnDataType]: {\n ...defaultOptionsByType[columnDataType],\n ...globalFormattingForDataType,\n _meta: {\n exceedsEditorCapabilities: checkExceedsEditorCapabilities(\n globalFormattingForDataType,\n supportedOptions\n ),\n },\n },\n },\n formatText: {\n ...defaultOptionsByType[TextDataType],\n },\n };\n updateDefinition(columnName, columnEntryToInsert);\n },\n [\n columnFormatOption,\n defaultOptionsByType,\n editorSupportedFormatOptions,\n updateDefinition,\n tableFormatOption,\n vizContext,\n ]\n );\n\n const handleRemoveColumnFormatting = React.useCallback(\n ({ columnName, columnDataType: dataType }): void => {\n const updatedEditorColumnFormatting = new Map(editorColumnFormatting);\n updatedEditorColumnFormatting.delete(columnName);\n setEditorColumnFormatting(updatedEditorColumnFormatting);\n\n // if the user is removing an added column which exceeded editor capabilities, it means they didn't change anything via editor\n const columnToRemove = editorColumnFormatting.get(columnName);\n const formatByTypeExceedsEditorCapabilities = get(columnToRemove, [\n 'formatByType',\n dataType,\n '_meta',\n 'exceedsEditorCapabilities',\n ]);\n if (!formatByTypeExceedsEditorCapabilities) {\n onChange(\n null,\n getColumnFormatDefFromState(\n cloneDeep({\n columnFormatOption,\n updatedEditorColumnFormatting: {\n ...getObjectFromMap(editorColumnFormatting),\n // explicit to indicate that the column should be removed when recursively merging keys\n [columnName]: null,\n },\n })\n )\n );\n } else {\n // this is to preserve the original formatByType, but strip out any dynamic coloring when writing back to the definition\n // TODO(fkurniawan): this will have to be modified once exceedsEditorCapabilities for dynamic coloring state exists\n const contextKey = getFormattingOptDSLKey(columnFormatOption[columnName]);\n const persistedFormatByType = vizContext[contextKey] || {};\n const { colorContextKey: rowColorsContextKey } = get(\n editorColumnFormatting.get(columnName),\n ['columnColoring', 'rowColors'],\n {} as ColumnColoring\n );\n const { colorContextKey: rowBackgroundColorsContextKey } = get(\n editorColumnFormatting.get(columnName),\n ['columnColoring', 'rowBackgroundColors'],\n {} as ColumnColoring\n );\n\n onChange(\n null,\n getColumnFormatDefFromState(\n cloneDeep({\n columnFormatOption,\n updatedEditorColumnFormatting: {\n ...getObjectFromMap(editorColumnFormatting),\n [columnName]: {\n formatByType: {\n ...persistedFormatByType,\n },\n columnColoring: {\n ...(rowColorsContextKey && {\n rowColors: {\n colorContextKey: rowColorsContextKey,\n colorOptionsDSL: null,\n colorContextConfig: null,\n },\n }),\n ...(rowBackgroundColorsContextKey && {\n rowBackgroundColors: {\n colorContextKey: rowBackgroundColorsContextKey,\n colorOptionsDSL: null,\n colorContextConfig: null,\n },\n }),\n },\n formatText: {},\n },\n },\n })\n )\n );\n }\n },\n [columnFormatOption, editorColumnFormatting, onChange, vizContext]\n );\n\n // use forEach iterator to populate ColumnFormatterEntry elements, since JS Map does not have .map\n const columnFormatterEntries = [];\n editorColumnFormatting.forEach((columnFormatEntry, columnName): void => {\n // TODO(fkurniawan): handle potential mixed-mode column formatting in the future\n const [dataType] = Object.keys(columnFormatEntry.formatByType);\n const isSourceCustomized = get(columnFormatEntry, [\n 'formatByType',\n dataType,\n '_meta',\n 'exceedsEditorCapabilities',\n ]);\n columnFormatterEntries.push(\n <ColumnFormatterEntry\n // eslint-disable-next-line react/no-array-index-key\n key={columnName}\n columnName={columnName}\n columnDataType={dataType}\n columnColoring={columnFormatEntry.columnColoring}\n columnColoringConfig={columnColoringConfig}\n columnFormattingByType={columnFormatEntry.formatByType}\n columnTextFormatting={columnFormatEntry.formatText}\n defaultOptionsByType={defaultOptionsByType}\n flyoutConfigForDataType={flyoutConfig[dataType] || []} // empty column to handle unsupported data type editors\n textFormatConfig={textFormatConfig}\n isSourceCustomized={isSourceCustomized}\n removeColumnFormatting={handleRemoveColumnFormatting}\n resetColumnToDefault={handleResetColumnToDefault}\n updateColumnColoring={handleColumnColoringUpdate}\n updateColumnFormatting={handleColumnFormattingUpdate}\n updateColumnTextFormatting={handleTextFormattingUpdate}\n />\n );\n });\n\n const { hasError, isMissing, isLoading } = getDataSourceStateInfo(dataSource);\n\n // TODO: SUI 4.0 renders empty labels differently. Labels should never be empty strings, instead pass\n // a valid label and set hideLabel on ControlGroup\n const controlGroupMarginFix = !label || label === '' ? { marginTop: '-8px' } : undefined;\n\n return (\n <>\n <div>{columnFormatterEntries}</div>\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n style={controlGroupMarginFix}\n >\n <AddColumn\n availableFieldsWithTypes={availableFieldsWithTypes}\n columnFormatting={editorColumnFormatting}\n disableToggle={isMissing || hasError}\n editorSupportedFormatOptions={editorSupportedFormatOptions}\n handleAddColumnFormatting={handleAddColumnFormatting}\n placeholderMessage={getPlaceholderMessage({\n isMissing,\n isLoading,\n hasError,\n defaultMessage: '+ Add column to format',\n })}\n />\n </ControlGroup>\n </>\n );\n};\n\nexport default TableColumnFormatterEditor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport type { OptionsStanza } from '@splunk/visualization-encoding/AST';\nimport type { UiConfig, FormatterUiConfig } from './formatters/FormatterEditor';\nimport type { ColorModeChangeHandler } from './DynamicColorEditor';\nimport { DynamicColorEditor } from './DynamicColorEditor';\nimport ToggleEditor from './ToggleEditor';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport type { PalettesConfig } from '../interfaces/PalettesConfig';\nimport { DynamicColorEditorPropTypes } from '../interfaces/DynamicColorEditorProps';\nimport { clearDynamicColoring, moveDslBetweenModes } from './table/DynamicColorUtils';\n\nexport interface TableDynamicColorEditorProps extends BaseEditorProps {\n name: string;\n value: any;\n flyoutTitle?: string;\n dataSelectors?: UiConfig[];\n formatters?: FormatterUiConfig[];\n defaultPalettesConfig: PalettesConfig;\n tooltip?: string;\n options?: Record<string, any>;\n onChange: (...args: any[]) => void;\n}\n\nconst propTypes: T.WeakValidationMap<TableDynamicColorEditorProps> = {\n ...DynamicColorEditorPropTypes,\n};\n\nexport const TableDynamicColorEditor: React.FC<TableDynamicColorEditorProps> = ({\n name, // the option links to both the toggle and the dynamic color editor\n value, // the option value (deprecated, use options.tableFormat)\n label = '',\n labelPosition,\n labelWidth,\n context,\n flyoutTitle = _('Dynamic coloring'),\n formatters = [],\n dataSelectors = [],\n defaultPalettesConfig,\n tooltip,\n options = {},\n onChange = () => undefined,\n}) => {\n // Determine initial mode from options (defensive when tableFormat may be removed)\n const tableFormat = options?.tableFormat || {};\n const initialMode: 'background' | 'text' = tableFormat?.rowColors ? 'text' : 'background';\n const [colorMode, setColorMode] = React.useState<'background' | 'text'>(initialMode);\n\n // Always derive the current value from options.tableFormat for controlled behavior\n const currentTableFormat = options?.tableFormat || {};\n const [isDynamicEditorEnabled, setDynamicEditorEnabled] = React.useState(\n Boolean(currentTableFormat.rowColors || currentTableFormat.rowBackgroundColors)\n );\n React.useEffect(() => {\n const currentFormat = options?.tableFormat || {};\n const { rowColors, rowBackgroundColors } = currentFormat;\n const hasDsl = Boolean(rowColors || rowBackgroundColors);\n setDynamicEditorEnabled(hasDsl);\n if (!hasDsl) {\n setColorMode('background');\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [options?.tableFormat]);\n\n // Handle color mode change\n const handleColorModeChange: ColorModeChangeHandler = (event, { value: modeValue }) => {\n const updatedOptions = { ...options, tableFormat: { ...tableFormat } };\n const updatedContext = { ...context };\n\n if (modeValue === 'off') {\n setDynamicEditorEnabled(false);\n Object.assign(updatedOptions.tableFormat, clearDynamicColoring(colorMode));\n updatedContext.tableFormatEditorConfig = undefined;\n } else if (colorMode === 'background' && modeValue === 'text') {\n // background -> text: move DSL, keep config as tableFormatEditorConfig\n Object.assign(updatedOptions.tableFormat, moveDslBetweenModes('background', 'text', tableFormat));\n setColorMode('text');\n } else if (colorMode === 'text' && modeValue === 'background') {\n // text -> background: move DSL, keep config as tableFormatEditorConfig\n Object.assign(updatedOptions.tableFormat, moveDslBetweenModes('text', 'background', tableFormat));\n setColorMode('background');\n }\n onChange(event, { options: updatedOptions, context: updatedContext });\n };\n\n const handleToggleChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, _optionStanza: OptionsStanza) => {\n setDynamicEditorEnabled(prevState => !prevState);\n\n const updatedOptions: Record<string, any> = {\n ...options,\n tableFormat: { ...options.tableFormat },\n };\n const updatedContext: Record<string, any> = { ...context };\n\n if (!isDynamicEditorEnabled) {\n // Toggling ON: set to default formatter and config\n const dataSelector = dataSelectors[0]?.value || 'table';\n // Prefer the first formatter as default, or fallback to 'gradient'\n const defaultFormatter = formatters[0]?.value || 'gradient';\n const defaultConfig = formatters[0]?.defaults?.[dataSelector] || {};\n const dsl = `> ${dataSelector} | ${defaultFormatter}(tableFormatEditorConfig)`;\n if (colorMode === 'background') {\n updatedOptions.tableFormat.rowBackgroundColors = dsl;\n updatedOptions.tableFormat.rowColors = undefined;\n } else {\n updatedOptions.tableFormat.rowColors = dsl;\n updatedOptions.tableFormat.rowBackgroundColors = undefined;\n }\n updatedContext.tableFormatEditorConfig = defaultConfig;\n onChange(event, { options: updatedOptions, context: updatedContext });\n } else {\n // Toggling OFF\n Object.assign(updatedOptions.tableFormat, clearDynamicColoring(colorMode));\n updatedContext.tableFormatEditorConfig = undefined;\n onChange(event, { options: updatedOptions, context: updatedContext });\n }\n },\n [options, context, isDynamicEditorEnabled, onChange, colorMode, dataSelectors, formatters]\n );\n\n const handleDynamicColorEditorChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, optionStanza: OptionsStanza) => {\n // The DSL is now always in optionStanza.options.tableFormat (string)\n const dsl = optionStanza.options?.tableFormat;\n const config = optionStanza.context?.tableFormatEditorConfig;\n const updatedOptions = { ...options, tableFormat: { ...options.tableFormat } };\n if (colorMode === 'background') {\n updatedOptions.tableFormat.rowBackgroundColors = dsl;\n updatedOptions.tableFormat.rowColors = undefined;\n } else if (colorMode === 'text') {\n updatedOptions.tableFormat.rowColors = dsl;\n updatedOptions.tableFormat.rowBackgroundColors = undefined;\n }\n // Always keep tableFormat as an object\n if (\n updatedOptions.tableFormat.rowBackgroundColors === undefined &&\n updatedOptions.tableFormat.rowColors === undefined\n ) {\n updatedOptions.tableFormat = {};\n }\n // Set only the new config for the selected formatter\n const updatedContext = { ...context, tableFormatEditorConfig: config };\n onChange(event, { options: updatedOptions, context: updatedContext });\n },\n [onChange, options, context, colorMode]\n );\n\n return (\n <div data-test=\"dynamic-color-toggle\">\n <ToggleEditor\n name={name}\n label={_('Dynamic coloring')}\n labelPosition=\"right\"\n value={isDynamicEditorEnabled}\n onChange={handleToggleChange}\n itemSchema={{ type: 'boolean' }}\n help={tooltip}\n />\n {isDynamicEditorEnabled && (\n <DynamicColorEditor\n name={name}\n label={label || _('Dynamic coloring')}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n value={colorMode === 'background' ? value?.rowBackgroundColors : value?.rowColors}\n context={context}\n onChange={handleDynamicColorEditorChange}\n flyoutTitle={flyoutTitle}\n formatters={formatters}\n dataSelectors={dataSelectors}\n defaultPalettesConfig={defaultPalettesConfig}\n colorMode={colorMode}\n handleColorModeChange={handleColorModeChange}\n />\n )}\n </div>\n );\n};\n\nTableDynamicColorEditor.propTypes = propTypes;\n","import React, { useState, useCallback, useEffect } from 'react';\nimport T from 'prop-types';\nimport styled, { css } from 'styled-components';\nimport TextArea from '@splunk/react-ui/TextArea';\nimport { pick, variables } from '@splunk/themes';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { editorStyle } from '../shared/dimensionConstants';\nimport { BaseEditorPropTypes } from '../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\n\n// The dark disabled textarea theme is being overriden by a global style in\n// core, so we need to specify it here so it has higher priority\nconst StyledTextArea = styled(TextArea)`\n textarea[disabled] {\n ${pick({\n enterprise: {\n dark: css`\n color: ${variables.textDisabledColor};\n background-color: ${variables.borderColor};\n border-color: ${variables.backgroundColorHover};\n `,\n },\n })}\n }\n`;\n\ninterface TextAreaEditorProps extends BaseEditorProps {\n /** current value of field */\n value: string;\n /** visually hide the label, but render it for screen readers */\n hideLabel?: boolean;\n /** help text under controls */\n help?: string;\n /** text to display in a tooltip next to the label */\n tooltip?: string;\n /** if the input should display error state */\n error?: boolean;\n}\n\nconst TextAreaEditor = ({\n onChange,\n name,\n value = '',\n label,\n labelPosition = 'top',\n labelWidth,\n hideLabel,\n isDisabled,\n help,\n tooltip,\n error,\n ...otherProps\n}: TextAreaEditorProps) => {\n const [val, setVal] = useState<string>(value);\n\n // maintain consistency of value state with prop\n useEffect(() => setVal(value), [value]);\n\n const handleChange = useCallback(\n (\n _event: React.ChangeEvent<HTMLTextAreaElement> | React.MouseEvent<HTMLSpanElement>,\n { value: v }: { value: string }\n ) => {\n setVal(v);\n },\n []\n );\n\n const handleBlur = useCallback(\n (event: React.FocusEvent<HTMLTextAreaElement> | React.KeyboardEvent<HTMLTextAreaElement>) => {\n const newVal = val.trim();\n if (newVal === value) {\n return;\n }\n // only change value if it is different from previous\n onChange(event, name, newVal);\n },\n [val, value, onChange, name]\n );\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n hideLabel={hideLabel}\n help={help}\n tooltip={tooltip}\n error={error}\n >\n <StyledTextArea\n key={value}\n data-test={name}\n style={editorStyle}\n onChange={handleChange}\n onBlur={handleBlur}\n value={val}\n disabled={isDisabled}\n {...otherProps}\n error={error}\n />\n </ControlGroup>\n );\n};\n\nconst propTypes: Record<keyof TextAreaEditorProps, T.Validator<any>> = {\n ...BaseEditorPropTypes,\n value: T.string,\n hideLabel: T.bool,\n help: T.string,\n tooltip: T.string,\n error: T.bool,\n};\n\nTextAreaEditor.propTypes = propTypes;\n\nexport default TextAreaEditor;\n","import * as React from 'react';\nimport styled from 'styled-components';\nimport { isColor } from '@splunk/visualizations-shared/colorUtils';\nimport { createDOMID } from '@splunk/ui-utils/id';\n\nconst DEFAULT_MAX_COLOR_COUNT = 7;\n\ninterface ColorPreviewWrapperProps {\n isReversed?: boolean;\n}\n\nconst ColorPreviewWrapper = styled.div.attrs<ColorPreviewWrapperProps>(props => ({\n 'data-test': 'ColorPreviewWrapper',\n isReversed: props.isReversed,\n}))<ColorPreviewWrapperProps>`\n display: flex;\n flex-direction: row;\n height: 100%;\n`;\n\ninterface ColorPreviewItemProps {\n color: string;\n widthGrow?: boolean;\n maxColorCount?: number;\n}\n\nconst ColorPreviewItem = styled.div.attrs<ColorPreviewItemProps>(() => ({\n 'data-test': 'ColorPreviewItem',\n}))<ColorPreviewItemProps>`\n flex-grow: ${({ widthGrow }): number => (widthGrow ? 1 : 0)};\n width: ${({ maxColorCount }): string => `calc(100% / ${maxColorCount})`};\n margin-right: 1px;\n background-color: ${({ color }): string => color};\n &:last-of-type {\n margin-right: 0;\n }\n`;\n\ninterface ColorPreviewProps {\n colors: string[];\n maxColorCount?: number;\n expandToFillHorizontalSpace?: boolean;\n isReversed?: boolean;\n}\n\nexport const ColorPreview: React.FunctionComponent<ColorPreviewProps> = ({\n colors = [],\n maxColorCount = DEFAULT_MAX_COLOR_COUNT,\n expandToFillHorizontalSpace = true,\n isReversed = false,\n}): React.ReactElement => {\n const trueColors = isReversed ? [...colors].reverse() : [...colors];\n return (\n <ColorPreviewWrapper isReversed={isReversed}>\n {trueColors.map(\n (color, _i): React.ReactElement =>\n isColor(color) && (\n <ColorPreviewItem\n key={createDOMID()}\n color={color}\n widthGrow={expandToFillHorizontalSpace}\n maxColorCount={maxColorCount}\n />\n )\n )}\n </ColorPreviewWrapper>\n );\n};\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport type { RangesConfig } from '@splunk/visualization-encoding/formatters/RangeValue';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { createGradientConfigFromPalettes } from './Gradient/gradientUtils';\nimport type { GradientConfig } from './Gradient/gradientUtils';\nimport type { BaseEditorProps } from '../../interfaces/BaseEditorProps';\nimport type { BasePreviewProps } from '../../interfaces/BasePreviewProps';\nimport type { PalettesConfig } from '../../interfaces/PalettesConfig';\nimport { RangeValuePreview } from './RangeValuePreview';\nimport { MatchValuePreview } from './MatchValuePreview';\nimport GradientPreview from './Gradient/GradientPreview';\nimport RadioBarEditor from '../RadioBarEditor';\nimport RangeValueEditor from './RangeValueEditor';\nimport MatchValueEditor from './MatchValueEditor';\nimport GradientEditor from './GradientEditor';\nimport type { MatchValueEditorProps } from './MatchValueEditor';\nimport CustomizedInSourceEditor from '../CustomizedInSourceEditor';\n\nexport const sharedPalettesConfigPropType = T.exact({\n paletteTheme: T.string,\n paletteEntry: T.exact({\n type: T.string,\n index: T.number,\n }),\n});\n\nexport const getSortedRanges = (ranges = []): RangesConfig[] => {\n const rangesToSort = [...(Array.isArray(ranges) ? ranges : [])];\n rangesToSort.sort((a, b): number => {\n if (a.to == null) return 1;\n if (b.to == null) return -1;\n return +a.to - +b.to;\n });\n return rangesToSort;\n};\n\nconst DEFAULT_GRADIENT_PALETTES_CONFIG: PalettesConfig = {\n paletteTheme: 'DARK_COLORS',\n paletteEntry: {\n type: 'sequential',\n index: 0,\n },\n};\n\ntype FormatterChangeEvent = React.SyntheticEvent | string | null | undefined;\n\ntype FormatterChangeHandler<TConfig> = (\n event: FormatterChangeEvent,\n name: string | null | undefined,\n config: TConfig\n) => void;\n\nexport interface RangeValueEditorProps extends BaseEditorProps {\n defaultPalettesConfig: PalettesConfig;\n selectedDataSelector?: string;\n value: RangesConfig[] | null;\n onChange?: FormatterChangeHandler<RangesConfig[]>;\n}\n\nexport const RangeValueEditorWrapper: React.FunctionComponent<RangeValueEditorProps> = ({\n defaultPalettesConfig,\n value,\n onChange,\n selectedDataSelector,\n}): React.ReactElement => (\n <RangeValueEditor\n data-test=\"RangeValueEditor\"\n defaultPalettesConfig={defaultPalettesConfig}\n value={value}\n onChange={(event, name, rangeValues): void => onChange(event, name, rangeValues)}\n selectedDataSelector={selectedDataSelector}\n />\n);\n\nRangeValueEditorWrapper.propTypes = {\n defaultPalettesConfig: sharedPalettesConfigPropType,\n value: T.arrayOf(\n T.shape({\n from: T.number,\n to: T.number,\n value: T.string,\n })\n ),\n onChange: T.func,\n selectedDataSelector: T.string,\n} as T.WeakValidationMap<RangeValueEditorProps>;\n\nexport const MatchValueEditorWrapper: React.FunctionComponent<MatchValueEditorProps> = ({\n defaultPalettesConfig,\n value,\n onChange,\n selectedDataSelector,\n}): React.ReactElement => (\n <MatchValueEditor\n data-test=\"MatchValueEditor\"\n defaultPalettesConfig={defaultPalettesConfig}\n value={value}\n onChange={(event, name, matchValues): void => onChange(event, name, matchValues)}\n selectedDataSelector={selectedDataSelector}\n />\n);\n\nMatchValueEditorWrapper.propTypes = {\n defaultPalettesConfig: sharedPalettesConfigPropType,\n value: T.arrayOf(\n T.shape({\n match: T.oneOfType([T.string, T.number]),\n value: T.string,\n })\n ),\n onChange: T.func,\n selectedDataSelector: T.string,\n};\n\nexport interface GradientEditorProps extends BaseEditorProps {\n defaultPalettesConfig: PalettesConfig;\n value: GradientConfig;\n showStaticTextColor?: boolean;\n selectedDataSelector?: string;\n onChange: (event: React.SyntheticEvent, name: string, value: GradientConfig) => void;\n}\n\nexport const GradientEditorWrapper: React.FunctionComponent<GradientEditorProps> = ({\n defaultPalettesConfig = DEFAULT_GRADIENT_PALETTES_CONFIG,\n value,\n onChange,\n showStaticTextColor,\n selectedDataSelector,\n}): React.ReactElement => {\n // if stops are defined or more than 7 colors, it means the gradient is customized\n const isCustomized = value?.stops?.length > 0 || (value?.colors?.length ?? 0) > 7;\n if (isCustomized) {\n return (\n <CustomizedInSourceEditor\n label=\"Data colors\"\n labelPosition=\"top\"\n onResetToDefault={() => {\n const defaultGradient = createGradientConfigFromPalettes(defaultPalettesConfig);\n onChange(undefined, undefined, defaultGradient);\n }}\n />\n );\n }\n\n return (\n <GradientEditor\n data-test=\"GradientEditor\"\n name=\"gradient\"\n defaultPalettesConfig={defaultPalettesConfig}\n value={value}\n onChange={(event, name, gradientValues): void => onChange(event, name, gradientValues)}\n showStaticTextColor={showStaticTextColor}\n selectedDataSelector={selectedDataSelector}\n />\n );\n};\n\nGradientEditorWrapper.propTypes = {\n defaultPalettesConfig: sharedPalettesConfigPropType,\n value: T.exact({\n colors: T.arrayOf(T.string).isRequired,\n textColor: T.string,\n }).isRequired,\n onChange: T.func,\n showStaticTextColor: T.bool,\n selectedDataSelector: T.string,\n};\n\ntype ValidEditorProps = BaseEditorProps | RangeValueEditorProps | MatchValueEditorProps | GradientEditorProps;\n\ntype RangeFormatterConfig = RangeValueEditorProps['value'];\ntype MatchFormatterConfig = MatchValueEditorProps['value'];\ntype GradientFormatterConfig = GradientEditorProps['value'];\n\nexport type FormatterConfig =\n | RangeFormatterConfig\n | MatchFormatterConfig\n | GradientFormatterConfig\n | Record<string, unknown>\n | undefined;\n\ninterface SupportedFormattersShape {\n [key: string]: {\n preview: React.JSXElementConstructor<BasePreviewProps>;\n // @TODO: extend w/ other props types once other formatting editors are added\n editor?: React.JSXElementConstructor<ValidEditorProps>;\n };\n}\n/**\n * This object will be used to dynamically look up the preview/editor to render\n */\nexport const supportedFormatters: SupportedFormattersShape = {\n gradient: {\n preview: GradientPreview,\n editor: GradientEditorWrapper,\n },\n rangeValue: {\n preview: RangeValuePreview,\n editor: RangeValueEditorWrapper,\n },\n matchValue: {\n preview: MatchValuePreview,\n editor: MatchValueEditorWrapper,\n },\n};\nconst validFormatterTypes = Object.keys(supportedFormatters);\nexport interface UiConfig {\n label: string;\n value: string;\n}\nexport interface FormatterUiConfig extends UiConfig {\n /**\n * Keys in this object reference DataSelectors.\n * Values represent default formatter configurations for this data selector.\n *\n * Example:\n * {\n * majorValue: [{ from: 0, value: '#f00' }],\n * deltaValue: [{ to: 0, value: 'red' }, { from: 0, value: 'green' }]\n * }\n *\n */\n defaults: Partial<Record<string, FormatterConfig>>;\n /*\n * show it by default when open dynamic color flyout\n */\n isDefault?: boolean;\n}\n\ninterface FormatterEditorProps {\n selectedDataSelector: string;\n selectedFormatterType: (typeof validFormatterTypes)[number];\n currentFormatterConfig: FormatterConfig;\n dataSelectors: UiConfig[];\n formatters: FormatterUiConfig[];\n showStaticTextColor?: boolean;\n onDataSelectorChange?: (evt: string, name: string, newDataSelector: string) => void;\n onFormatterTypeChange: (evt: string, name: string, newFormatter: string) => void;\n onFormatterConfigChange: FormatterChangeHandler<FormatterConfig>;\n defaultPalettesConfig: PalettesConfig;\n}\nconst formatterConfigPropType = T.oneOfType([\n T.arrayOf(\n T.shape({\n from: T.number,\n to: T.number,\n value: T.string,\n })\n ),\n T.arrayOf(\n T.shape({\n match: T.oneOfType([T.string, T.number]),\n value: T.string,\n })\n ),\n T.exact({\n colors: T.arrayOf(T.string).isRequired,\n stops: T.arrayOf(T.number),\n textColor: T.string,\n }),\n T.object,\n T.oneOf([null]),\n]) as T.Validator<FormatterConfig>;\n\nconst propTypes = {\n selectedDataSelector: T.string,\n selectedFormatterType: T.oneOf(validFormatterTypes),\n currentFormatterConfig: formatterConfigPropType,\n formatters: T.arrayOf(\n T.shape({\n label: T.string,\n value: T.string,\n defaults: T.object,\n isDefault: T.bool,\n })\n ),\n dataSelectors: T.arrayOf(\n T.shape({\n label: T.string,\n value: T.string,\n })\n ),\n onDataSelectorChange: T.func,\n onFormatterTypeChange: T.func,\n onFormatterConfigChange: T.func,\n defaultPalettesConfig: sharedPalettesConfigPropType,\n showStaticTextColor: T.bool,\n} as T.WeakValidationMap<FormatterEditorProps>;\n\nexport const FormatterEditor: React.FunctionComponent<FormatterEditorProps> = ({\n selectedDataSelector,\n selectedFormatterType,\n currentFormatterConfig,\n formatters = [],\n dataSelectors = [],\n onDataSelectorChange,\n onFormatterTypeChange,\n onFormatterConfigChange,\n defaultPalettesConfig,\n showStaticTextColor = false,\n}): React.ReactElement => {\n // if there's only 1 dataselector don't show a button group\n const showDataSelectorButtonGroup = dataSelectors.length > 1;\n const formatterSelectorLabel = showDataSelectorButtonGroup ? _('Method') : '';\n const filteredFormatters = formatters.filter(formatter => formatter.defaults?.[selectedDataSelector]);\n // same for formatters\n const showFormatterButtonGroup = filteredFormatters.length > 1;\n const FormatterConfigEditor = supportedFormatters[selectedFormatterType]?.editor;\n return (\n <>\n {showDataSelectorButtonGroup && (\n <RadioBarEditor\n name=\"dataSelector\"\n label={_('Based on')}\n data-test=\"FormatterEditorDataSelector\"\n values={dataSelectors}\n value={selectedDataSelector}\n onChange={onDataSelectorChange}\n />\n )}\n {showFormatterButtonGroup && (\n <RadioBarEditor\n name=\"formatterSelector\"\n label={formatterSelectorLabel}\n data-test=\"FormatterEditorFormatterSelector\"\n values={filteredFormatters}\n value={selectedFormatterType}\n onChange={onFormatterTypeChange}\n />\n )}\n <FormatterConfigEditor\n data-test=\"FormatterEditorConfigEditor\"\n name=\"formatterConfig\"\n value={currentFormatterConfig}\n onChange={onFormatterConfigChange}\n defaultPalettesConfig={defaultPalettesConfig}\n selectedDataSelector={selectedDataSelector}\n showStaticTextColor={selectedFormatterType === 'gradient' && showStaticTextColor}\n />\n </>\n );\n};\n\nFormatterEditor.propTypes = propTypes;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport Button from '@splunk/react-ui/Button';\nimport ArrowsRectangularDouble from '@splunk/react-icons/ArrowsRectangularDouble';\n\nconst AddStopWrapper = styled.div`\n display: flex;\n flex-direction: row;\n margin-bottom: 10px;\n`;\n\nconst AddStopButtonWrapper = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n`;\n\nconst ReverseStopWrapper = styled.div`\n display: flex;\n`;\n\nconst ButtonStyle = {\n marginRight: '12px',\n};\n\nconst reverseIcon = <ArrowsRectangularDouble />;\n\nconst AddAndReverseStops = ({\n disableAddStops = false,\n handleAddStop,\n handleReverse,\n}: {\n disableAddStops: boolean;\n handleAddStop: () => void;\n handleReverse: () => void;\n}): React.ReactElement => {\n return (\n <AddStopWrapper>\n <ReverseStopWrapper>\n <Button\n data-test=\"reverse-stops-button\"\n icon={reverseIcon}\n style={ButtonStyle}\n onClick={handleReverse}\n />\n </ReverseStopWrapper>\n <AddStopButtonWrapper>\n <Button\n data-test=\"add-stop-button\"\n appearance=\"secondary\"\n label={`+ ${_('Add stop')}`}\n disabled={disableAddStops}\n onClick={handleAddStop}\n />\n </AddStopButtonWrapper>\n </AddStopWrapper>\n );\n};\n\nAddAndReverseStops.propTypes = {\n disableAddStops: T.bool,\n handleAddStop: T.func,\n handleReverse: T.func,\n};\n\nexport default AddAndReverseStops;\n","import * as React from 'react';\nimport Color, { defaultPalette } from '@splunk/react-ui/Color';\n\ninterface GradientColorProps {\n color: string;\n colorIndex: number;\n palette: string[];\n onChange: (payload: { colorIndex: number; value: string }) => void;\n}\n\nconst GradientColor: React.FunctionComponent<GradientColorProps> = ({\n color,\n colorIndex,\n palette,\n onChange,\n}) => {\n const handleColorChange = React.useCallback(\n ({ value }: { value: string }): void => {\n if (\n value == null ||\n value === '' ||\n value.toLowerCase() === 'n/a' ||\n value.toLowerCase() === 'null'\n ) {\n return; // disallow n/a, null, or empty\n }\n onChange({ colorIndex, value });\n },\n [colorIndex, onChange]\n );\n\n return (\n <Color\n data-test={`gradient-color-${color}`}\n value={color}\n palette={palette || [...defaultPalette, 'transparent']}\n onChange={handleColorChange}\n hideInput\n />\n );\n};\n\nexport default GradientColor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport type { BasePreviewProps } from '../../../interfaces/BasePreviewProps';\nimport type { GradientConfig } from './gradientUtils';\nimport ArrowLayer from '../../../shared/ArrowLayer';\nimport PreviewWrapper from '../../../shared/PreviewWrapper';\n\n// Simple luminance calculation for hex colors\nfunction getLuminance(hex: string): number {\n let c = hex.replace('#', '');\n if (c.length === 3)\n c = c\n .split('')\n .map(x => x + x)\n .join('');\n const r = parseInt(c.substring(0, 2), 16) / 255;\n const g = parseInt(c.substring(2, 4), 16) / 255;\n const b = parseInt(c.substring(4, 6), 16) / 255;\n // Standard luminance formula\n return 0.299 * r + 0.587 * g + 0.114 * b;\n}\n\ninterface GradientPreviewProps extends BasePreviewProps {\n config: GradientConfig;\n}\n\nconst GradientPreview: React.FunctionComponent<GradientPreviewProps> = ({ config }) => {\n // Only renders once per test, as expected.\n const { colors = [] } = config || {};\n const gradientString = `linear-gradient(90deg, ${colors.join(', ')})`;\n\n // Calculate luminance for the first and last color for the arrows\n const firstColor = colors && colors.length > 0 ? colors[0] : '#fff';\n const lastColor = colors && colors.length > 1 ? colors[colors.length - 1] : firstColor;\n const luminanceFirst = getLuminance(firstColor);\n const luminanceLast = getLuminance(lastColor);\n const arrowDownColor = luminanceFirst > 0.5 ? '#000' : '#fff';\n const arrowUpColor = luminanceLast > 0.5 ? '#000' : '#fff';\n\n return (\n <PreviewWrapper>\n <ArrowLayer colorDown={arrowDownColor} colorUp={arrowUpColor} />\n <div\n data-test=\"gradient-color-preview\"\n style={{\n width: '100%',\n height: 18,\n borderRadius: 4,\n background: gradientString,\n }}\n />\n </PreviewWrapper>\n );\n};\n\nGradientPreview.propTypes = {\n config: T.any.isRequired,\n};\n\nexport default GradientPreview;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\nimport Text from '@splunk/react-ui/Text';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport Color from '@splunk/react-ui/Color';\n\nconst StyledControlGroup = styled(ControlGroup)`\n margin-bottom: 16px;\n width: 100%;\n`;\n\nconst TextColorContainer = styled.div`\n display: flex;\n align-items: stretch;\n width: 100%;\n position: relative;\n flex: 1 1 0%;\n`;\n\nconst TextColorWrapper = styled.div`\n display: flex;\n align-items: stretch;\n width: 100%;\n min-width: 0;\n box-sizing: border-box;\n position: relative;\n`;\n\nconst SwatchWrapper = styled.div`\n display: flex;\n align-items: stretch;\n height: 32px;\n flex: 0 0 32px;\n width: 32px;\n min-width: 32px;\n max-width: 32px;\n border-radius: 4px 0 0 4px;\n overflow: hidden;\n`;\n\nconst AutoSwatch = styled.div<{ color?: string; $isAuto?: boolean }>`\n width: 32px;\n height: 32px;\n border: 1px solid ${variables.borderColor};\n border-right: none;\n background: linear-gradient(135deg, #fff 50%, #000 50%);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n box-sizing: border-box;\n border-radius: 4px 0 0 4px;\n overflow: hidden;\n`;\n\nconst StyledText = styled(Text).attrs(({ name }) => ({\n 'data-test': name,\n}))`\n max-height: ${variables.inputHeight};\n width: 100%;\n min-width: 0;\n flex: 1 1 0%;\n border-radius: 0 4px 4px 0;\n border: 1px solid ${variables.borderColor};\n border-left: none;\n background: transparent;\n color: ${variables.contentColorActive};\n font-size: 14px;\n padding: 0 12px;\n height: 32px;\n outline: none;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n`;\n\nconst SwatchButton = styled.button`\n background: none;\n border: none;\n padding: 0;\n margin: 0;\n cursor: pointer;\n outline: none;\n display: flex;\n align-items: stretch;\n height: 32px;\n`;\n\nconst ClearButton = styled.button`\n background: none;\n border: none;\n color: ${variables.contentColorActive};\n font-size: 18px;\n cursor: pointer;\n position: absolute;\n right: 0;\n top: 0;\n height: 32px;\n width: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 2;\n /* Remove margin-left and margin-right to avoid shifting layout */\n padding: 0;\n`;\n\nconst AutoTextDisplay = styled.div`\n display: flex;\n align-items: center;\n padding: 0 12px;\n height: 32px;\n font-size: 14px;\n color: ${variables.contentColorActive};\n background: transparent;\n border: 1px solid ${variables.borderColor};\n border-left: none;\n border-radius: 0 4px 4px 0;\n min-width: 0;\n flex: 1 1 0%;\n box-sizing: border-box;\n`;\n\nconst AUTO_OPTION = 'auto';\nconst DEFAULT_PALETTE_COLOR = '#ffffff';\n\ninterface GradientTextColorProps {\n textColor: string;\n onTextColorChange: (color: string) => void;\n}\n\nconst GradientTextColor: React.FunctionComponent<GradientTextColorProps> = ({\n textColor,\n onTextColorChange,\n}) => {\n const [isAuto, setIsAuto] = React.useState(!textColor || textColor === AUTO_OPTION);\n const [color, setColor] = React.useState(isAuto ? '' : textColor || '');\n const colorRef = React.useRef<HTMLButtonElement | null>(null);\n\n React.useEffect(() => {\n setIsAuto(!textColor || textColor === AUTO_OPTION);\n setColor(!textColor || textColor === AUTO_OPTION ? '' : textColor);\n }, [textColor]);\n\n // Handle color swatch or color picker change\n const handleColorChange = React.useCallback(\n data => {\n const value = data?.value || '';\n if (value === AUTO_OPTION) {\n setIsAuto(true);\n setColor('');\n onTextColorChange(AUTO_OPTION);\n } else {\n setIsAuto(false);\n setColor(value);\n onTextColorChange(value);\n }\n },\n [onTextColorChange]\n );\n\n // Handle text input change\n const handleInputChange = React.useCallback(\n e => {\n const val = e.target.value;\n setColor(val);\n setIsAuto(false);\n onTextColorChange(val);\n },\n [onTextColorChange]\n );\n\n // Handle key press for text input\n const handleKeyPress = React.useCallback(\n event => {\n if (event.key === 'Escape') {\n setColor(textColor || '');\n }\n },\n [textColor]\n );\n\n // Handle clear button\n const handleClear = React.useCallback(() => {\n setColor('');\n setIsAuto(true);\n onTextColorChange(AUTO_OPTION);\n }, [onTextColorChange]);\n\n // When switching from auto to color, focus the color swatch\n React.useEffect(() => {\n if (!isAuto && colorRef.current) {\n colorRef.current.focus();\n }\n }, [isAuto]);\n\n return (\n <StyledControlGroup\n label={_('Static text color')}\n tooltip={_('Auto will choose black or white for text color to get more contrast')}\n style={{ width: '100%' }}\n >\n <TextColorContainer>\n {isAuto ? (\n <TextColorWrapper>\n <SwatchWrapper>\n <SwatchButton\n type=\"button\"\n aria-label={_('Choose text color')}\n onClick={() => {\n setIsAuto(false);\n setColor(DEFAULT_PALETTE_COLOR);\n onTextColorChange(DEFAULT_PALETTE_COLOR);\n }}\n tabIndex={0}\n >\n <AutoSwatch />\n </SwatchButton>\n </SwatchWrapper>\n <AutoTextDisplay data-test=\"gradient-text-color-auto\">{_('Auto')}</AutoTextDisplay>\n </TextColorWrapper>\n ) : (\n <TextColorWrapper>\n <SwatchWrapper>\n <Color\n key=\"gradient-text-color-editor\"\n value={color || ''}\n onChange={handleColorChange}\n hideInput\n append\n />\n </SwatchWrapper>\n <StyledText\n name=\"gradient-text-color-input\"\n value={color}\n onChange={handleInputChange}\n onKeyDown={handleKeyPress}\n />\n\n <ClearButton\n type=\"button\"\n aria-label={_('Clear text color')}\n onClick={handleClear}\n tabIndex={0}\n >\n ×\n </ClearButton>\n </TextColorWrapper>\n )}\n </TextColorContainer>\n </StyledControlGroup>\n );\n};\n\nGradientTextColor.propTypes = {\n textColor: T.string.isRequired,\n onTextColorChange: T.func.isRequired,\n};\n\nexport default GradientTextColor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { variables } from '@splunk/themes';\nimport { addCustomGradientStop, addPaletteGradientStop } from './gradientUtils';\nimport type { GradientConfig as GradientConfigType } from './gradientUtils';\nimport type { BaseEditorProps } from '../../../interfaces/BaseEditorProps';\nimport AddAndReverseStops from './AddAndReverseStops';\nimport GradientColor from './GradientColor';\nimport GradientTextColor from './GradientTextColor';\nimport RemoveStop from './RemoveStop';\n\nconst GradientValueConfigurerWrapper = styled.div`\n padding-top: 10px;\n`;\n\nconst GradientsWrapper = styled.div`\n display: flex;\n flex-direction: column-reverse;\n`;\n\nconst GradientEntry = styled.div.attrs((): { 'data-test': string } => ({\n 'data-test': 'gradient-entry-row',\n}))`\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-bottom: 10px;\n justify-content: space-between;\n`;\n\nconst GradientLeft = styled.div`\n display: flex;\n align-items: center;\n`;\n\nconst GradientLabel = styled.div`\n margin-left: 8px;\n color: ${variables.contentColorMuted};\n`;\n\ninterface GradientValueConfigurerProps extends BaseEditorProps {\n showStaticTextColor?: boolean;\n value: GradientConfigType;\n onChange: (payload: { colors: string[]; textColor?: string }) => void;\n isReversed?: boolean;\n swatchColors?: string[];\n setIsReversed?: (isReversed: boolean) => void;\n selectedColors: string[];\n isSwatchCustomized?: boolean;\n disableAddStops?: boolean; // <-- add this prop\n}\n\nconst GradientValueConfigurer: React.FC<GradientValueConfigurerProps> = props => {\n const {\n value,\n onChange,\n showStaticTextColor,\n isReversed,\n swatchColors,\n setIsReversed,\n selectedColors,\n isSwatchCustomized,\n disableAddStops: disableAddStopsProp,\n } = props;\n const textColor = value?.textColor;\n // state to track if addStops should be disabled\n const [disableAddStops, setDisableAddStops] = React.useState(false);\n // state to track interpolated vs chosen colors for custom state\n const [isCustomSelected, setIsCustomSelected] = React.useState(selectedColors.map(() => true));\n\n React.useEffect(() => {\n if (typeof disableAddStopsProp === 'boolean') {\n setDisableAddStops(disableAddStopsProp);\n return;\n }\n const shouldDisable = !isSwatchCustomized ? selectedColors.length >= swatchColors?.length : false;\n setDisableAddStops(shouldDisable);\n }, [isReversed, selectedColors, isSwatchCustomized, swatchColors?.length, disableAddStopsProp]);\n\n const handleTextColorChange = React.useCallback(\n newTextColor => {\n const payload: any = { colors: selectedColors, textColor: newTextColor };\n onChange(payload);\n },\n [selectedColors, onChange]\n );\n\n const handleRemoveStop = React.useCallback(\n (indexToRemove: number) => {\n // remove the color at the specified index\n const newColors = [...selectedColors].filter((unused, idx) => idx !== indexToRemove);\n const payload: any = { colors: newColors };\n onChange(payload);\n // remove the custom item\n if (isSwatchCustomized) {\n const newIsCustomSelected = isCustomSelected.filter((unused, idx) => idx !== indexToRemove);\n setIsCustomSelected(newIsCustomSelected);\n }\n },\n [selectedColors, onChange, isSwatchCustomized, isCustomSelected]\n );\n\n const handleAddStop = React.useCallback(() => {\n if (selectedColors.length === 1) {\n // If only one color, add black as the highest value\n const newColors = [selectedColors[0], '#000000'];\n const payload: any = { colors: newColors };\n onChange(payload);\n return;\n }\n if (!isSwatchCustomized) {\n // prevent adding more stops than swatchColors allows\n if (selectedColors.length >= swatchColors?.length) {\n setDisableAddStops(true);\n return;\n }\n const newColors = addPaletteGradientStop(swatchColors, selectedColors, isReversed);\n if (newColors) {\n const payload: any = { colors: newColors };\n onChange(payload);\n if (newColors.length >= swatchColors?.length) {\n setDisableAddStops(true);\n }\n }\n return;\n }\n // fallback to custom interpolation if not using a palette or palette is null/undefined\n const newColors = addCustomGradientStop(selectedColors, isCustomSelected, setIsCustomSelected);\n const payload: any = { colors: newColors };\n onChange(payload);\n }, [isSwatchCustomized, selectedColors, isCustomSelected, onChange, swatchColors, isReversed]);\n\n const handleReverse = React.useCallback(() => {\n const reversedColors = [...selectedColors].reverse();\n const payload: any = { colors: reversedColors };\n onChange(payload);\n setIsReversed?.(!isReversed);\n if (isSwatchCustomized) {\n const newIsCustomSelected = [...isCustomSelected].reverse();\n setIsCustomSelected(newIsCustomSelected);\n }\n }, [selectedColors, onChange, setIsReversed, isReversed, isSwatchCustomized, isCustomSelected]);\n\n const handleColorChange = React.useCallback(\n (payload: { colorIndex: number; value: string }): void => {\n const { colorIndex, value: newColor } = payload;\n const newSelectedColors = [...selectedColors];\n newSelectedColors[colorIndex] = newColor;\n onChange({ colors: newSelectedColors });\n if (isSwatchCustomized) {\n const newIsCustomSelected = [...isCustomSelected];\n newIsCustomSelected[colorIndex] = true;\n setIsCustomSelected(newIsCustomSelected);\n }\n },\n [isCustomSelected, isSwatchCustomized, onChange, selectedColors]\n );\n\n return (\n <GradientValueConfigurerWrapper data-test=\"gradient-configurer\">\n <AddAndReverseStops\n data-test=\"add-reverse-stops\"\n disableAddStops={disableAddStops}\n handleAddStop={handleAddStop}\n handleReverse={handleReverse}\n />\n <GradientsWrapper data-test=\"gradients-wrapper\">\n {selectedColors.map((color: string, i: number): React.ReactElement => {\n // render from highest (last) to lowest (first)\n let label = '';\n if (i === 0) label = _(`Lowest value`);\n else if (i === selectedColors.length - 1) label = _(`Highest value`);\n const canRemove = selectedColors.length > 2 && i !== 0 && i !== selectedColors.length - 1;\n // Use both color and index in the key to avoid duplicate key issues with duplicate colors\n return (\n // eslint-disable-next-line react/no-array-index-key\n <GradientEntry\n key={`gradient-color-${color.replace('#', '')}`}\n data-test={`gradient-entry-row-${i}`}\n >\n <GradientLeft data-test={`gradient-left-${i}`}>\n <GradientColor\n data-test={`gradient-color-${color}`}\n color={color}\n colorIndex={i}\n palette={isSwatchCustomized ? undefined : swatchColors}\n onChange={handleColorChange}\n />\n <GradientLabel data-test={`gradient-label-${i}`}>{label}</GradientLabel>\n </GradientLeft>\n {canRemove && (\n <RemoveStop\n data-test={`gradient-remove-button-${i}`}\n colorIndex={i}\n onRemove={() => handleRemoveStop(i)}\n />\n )}\n </GradientEntry>\n );\n })}\n </GradientsWrapper>\n {showStaticTextColor && (\n <GradientEntry data-test=\"gradient-text-color-entry\">\n <GradientTextColor\n data-test=\"gradient-text-color\"\n textColor={textColor}\n onTextColorChange={handleTextColorChange}\n />\n </GradientEntry>\n )}\n </GradientValueConfigurerWrapper>\n );\n};\n\nGradientValueConfigurer.propTypes = {\n value: T.any,\n onChange: T.func,\n showStaticTextColor: T.bool,\n};\n\nexport default GradientValueConfigurer;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport type { ButtonProps } from '@splunk/react-ui/Button';\nimport Button from '@splunk/react-ui/Button';\nimport CloseIcon from '@splunk/react-icons/Cross';\nimport { variables } from '@splunk/themes';\n\nconst RemoveStopWrapper = styled.div`\n width: 32px;\n height: 32px;\n align-self: flex-end;\n`;\n\nconst RemoveStopButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nconst RemoveStop = ({\n colorIndex,\n onRemove,\n}: {\n colorIndex: number;\n onRemove: (colorIdx: number) => void;\n}): React.ReactElement => {\n const handleOnRemove = React.useCallback((): void => onRemove(colorIndex), [colorIndex, onRemove]);\n\n return (\n <RemoveStopWrapper>\n <RemoveStopButton\n data-test=\"gradient-remove-button\"\n icon={<CloseIcon />}\n appearance=\"subtle\"\n onClick={handleOnRemove}\n />\n </RemoveStopWrapper>\n );\n};\n\nRemoveStop.propTypes = {\n onRemove: T.func,\n};\n\nexport default RemoveStop;\n","import palettes from '@splunk/visualization-color-palettes/editors/PresetPalettes';\nimport type { PalettesConfig } from '../../../interfaces/PalettesConfig';\nimport type { Palettes, PaletteEntry } from '../Palettes/paletteUtils';\n\nexport interface GradientConfig {\n colors: string[];\n stops?: number[];\n textColor?: string;\n}\n\nexport const defaultDarkGradientConfig: GradientConfig = {\n colors: [\n palettes.DARK_COLORS.sequential.swatches[1][0],\n palettes.DARK_COLORS.sequential.swatches[1][palettes.DARK_COLORS.sequential.swatches[1].length - 1],\n ],\n};\n\nexport const defaultLightGradientConfig: GradientConfig = {\n colors: [\n palettes.LIGHT_COLORS.sequential.swatches[1][0],\n palettes.LIGHT_COLORS.sequential.swatches[1][palettes.LIGHT_COLORS.sequential.swatches[1].length - 1],\n ],\n};\n\n/**\n * Creates a default palette configuration with proper fallbacks\n * paletteTheme: DARK_COLORS || providedPaletteTheme\n * paletteEntry: {\n * type: 'sequential' || providedType\n * index: 1 || providedIndex\n * }\n */\nexport const createDefaultPalettesConfig = (providedConfig?: PalettesConfig): PalettesConfig => {\n const paletteTheme = providedConfig?.paletteTheme || 'DARK_COLORS';\n const type = providedConfig?.paletteEntry?.type || 'sequential';\n const index = providedConfig?.paletteEntry?.index ?? 1;\n\n return {\n paletteTheme,\n paletteEntry: {\n type,\n index,\n },\n };\n};\n\n/**\n * Creates a gradient config based on the provided palettes configuration\n * If only paletteTheme is provided, uses the 2nd item (index 1) in the sequential type\n * If all items are provided, uses that specific configuration\n * For gradients, only uses the first and last colors from the selected palette\n */\nexport const createGradientConfigFromPalettes = (\n palettesConfig?: PalettesConfig,\n showTextColor?: boolean,\n textColor?: string\n): GradientConfig => {\n const defaultedConfig = createDefaultPalettesConfig(palettesConfig);\n const { paletteTheme, paletteEntry } = defaultedConfig;\n\n const paletteColors =\n palettes[paletteTheme]?.[paletteEntry.type]?.swatches?.[paletteEntry.index] ||\n defaultDarkGradientConfig.colors;\n\n // For gradients, only use the first and last colors from the palette\n const colors =\n paletteColors.length >= 2\n ? [paletteColors[0], paletteColors[paletteColors.length - 1]]\n : paletteColors;\n\n if (!showTextColor) {\n return {\n colors,\n };\n }\n return {\n colors,\n textColor: textColor || 'auto',\n };\n};\n// Find the best position to insert the new color (largest gap)\n\n/**\n * Interpolates between two hex colors\n * @param color1 - First hex color (e.g., \"#FF0000\")\n * @param color2 - Second hex color (e.g., \"#00FF00\")\n * @param factor - Interpolation factor between 0 and 1\n * @returns Interpolated hex color\n */\nexport const interpolateColor = (color1: string, color2: string, factor: number): string => {\n // Remove # and convert to RGB\n const hex1 = color1.replace('#', '');\n const hex2 = color2.replace('#', '');\n\n const r1 = parseInt(hex1.substring(0, 2), 16);\n const g1 = parseInt(hex1.substring(2, 4), 16);\n const b1 = parseInt(hex1.substring(4, 6), 16);\n\n const r2 = parseInt(hex2.substring(0, 2), 16);\n const g2 = parseInt(hex2.substring(2, 4), 16);\n const b2 = parseInt(hex2.substring(4, 6), 16);\n\n // Interpolate each channel\n const r = Math.round(r1 + factor * (r2 - r1));\n const g = Math.round(g1 + factor * (g2 - g1));\n const b = Math.round(b1 + factor * (b2 - b1));\n\n // Convert back to hex\n const toHex = (n: number) => n.toString(16).padStart(2, '0');\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n};\n\nexport const addCustomGradientStop = (\n colors: string[],\n isCustomSelected: boolean[],\n setIsCustomSelected: (selected: boolean[]) => void\n): string[] => {\n if (colors.length < 2) {\n return colors;\n }\n\n // find all indices where isCustomSelected is true\n const customIndices = isCustomSelected.map((v, i) => (v ? i : -1)).filter(i => i !== -1);\n\n // if there are less than 2 custom points, fallback to default behavior (interpolate before highest)\n if (customIndices.length < 2) {\n const highestColor = colors[colors.length - 1];\n const beforeHighestColor = colors[colors.length - 2];\n const newColor = interpolateColor(beforeHighestColor, highestColor, 0.5);\n const newColors = [...colors.slice(0, colors.length - 1), newColor, highestColor];\n const newIsCustomSelected = [\n ...isCustomSelected.slice(0, isCustomSelected.length - 1),\n false,\n isCustomSelected[isCustomSelected.length - 1] ?? false,\n ];\n setIsCustomSelected(newIsCustomSelected);\n return newColors;\n }\n\n // for each pair of custom indices, interpolate all falses between them\n let newColors = [...colors];\n let newIsCustomSelected = [...isCustomSelected];\n for (let i = 0; i < customIndices.length - 1; i += 1) {\n const startIdx = customIndices[i];\n const endIdx = customIndices[i + 1];\n const segmentLength = endIdx - startIdx;\n\n // only interpolate if there are any falses between startIdx and endIdx\n if (segmentLength > 1) {\n const colorA = colors[startIdx];\n const colorB = colors[endIdx];\n\n // Count how many falses are between startIdx and endIdx\n const falseIndices: number[] = [];\n for (let j = startIdx + 1; j < endIdx; j += 1) {\n if (!isCustomSelected[j]) {\n falseIndices.push(j);\n }\n }\n\n // If there are any falses, recalculate their colors\n if (falseIndices.length > 0) {\n for (let m = 0; m < falseIndices.length; m += 1) {\n const idx = falseIndices[m];\n // Evenly space the interpolation for each false\n const t = (idx - startIdx) / (endIdx - startIdx);\n newColors[idx] = interpolateColor(colorA, colorB, t);\n }\n }\n }\n }\n\n // Always insert a new interpolated color before the last color\n const highestColor = newColors[newColors.length - 1];\n const beforeHighestColor = newColors[newColors.length - 2];\n const newColor = interpolateColor(beforeHighestColor, highestColor, 0.5);\n newColors = [...newColors.slice(0, newColors.length - 1), newColor, highestColor];\n newIsCustomSelected = [\n ...newIsCustomSelected.slice(0, newIsCustomSelected.length - 1),\n false,\n newIsCustomSelected[newIsCustomSelected.length - 1] ?? false,\n ];\n\n setIsCustomSelected(newIsCustomSelected);\n return newColors;\n};\n\n/**\n * Adds a palette color at the specified insert index.\n * @param swatch The full palette swatch array.\n * @param selectedColors The current array of selected colors.\n * @param isReversed If true, reverse the swatch before picking the color.\n * @returns The new colors array with the palette color inserted.\n */\nexport const addPaletteGradientStop = (\n swatch: string[],\n selectedColors: string[],\n isReversed: boolean\n): string[] => {\n const insertIndex = selectedColors.length - 1; // Insert before the last color\n // Only allow up to insertIndex <= 5\n if (insertIndex > 5) {\n return selectedColors;\n }\n const palette = isReversed ? [...swatch].reverse() : swatch;\n // Clamp insertIndex to valid palette range\n const idx = Math.max(1, Math.min(insertIndex, palette.length - 2));\n const colorToAdd = palette[idx];\n return [...selectedColors.slice(0, insertIndex), colorToAdd, ...selectedColors.slice(insertIndex)];\n};\n\n// Find a palette match, considering both normal and reversed order\nexport const findMatchingPaletteGradient = (\n colorArr: string[],\n paletteObj: Palettes\n): {\n paletteTheme: string;\n paletteEntry: { type: string; index: number };\n isReversed: boolean;\n} | null => {\n if (\n !Array.isArray(colorArr) ||\n colorArr.length < 2 ||\n !paletteObj ||\n typeof paletteObj !== 'object' ||\n !paletteObj.DARK_COLORS ||\n !paletteObj.LIGHT_COLORS\n ) {\n return null;\n }\n const themes = ['DARK_COLORS', 'LIGHT_COLORS'];\n const candidates: Array<{\n paletteTheme: string;\n paletteEntry: { type: string; index: number };\n isReversed: boolean;\n swatch: string[];\n }> = [];\n themes.forEach(theme => {\n const themePalettes = paletteObj[theme];\n if (!themePalettes) {\n return;\n }\n const entries = Object.entries(themePalettes)\n .filter(([type]) => type !== '_meta')\n .flatMap(([type, entry]) => {\n const { swatches } = entry as PaletteEntry;\n return swatches.map((swatch, i) => ({ type, swatch, index: i }));\n });\n entries.forEach(({ type, swatch, index }) => {\n // Skip if the color array has more colors than the swatch can provide\n if (colorArr.length > swatch.length) {\n return;\n }\n\n if (\n swatch.length >= 2 &&\n swatch[0].trim().toLowerCase() === colorArr[0].trim().toLowerCase() &&\n swatch[swatch.length - 1].trim().toLowerCase() ===\n colorArr[colorArr.length - 1].trim().toLowerCase()\n ) {\n candidates.push({\n paletteTheme: theme,\n paletteEntry: { type, index },\n isReversed: false,\n swatch,\n });\n } else if (\n swatch.length >= 2 &&\n swatch[0].trim().toLowerCase() === colorArr[colorArr.length - 1].trim().toLowerCase() &&\n swatch[swatch.length - 1].trim().toLowerCase() === colorArr[0].trim().toLowerCase()\n ) {\n candidates.push({\n paletteTheme: theme,\n paletteEntry: { type, index },\n isReversed: true,\n swatch,\n });\n }\n });\n });\n // If more than 2 colors, prefer full match (middle colors can be any order)\n if (colorArr.length > 2 && candidates.length > 0) {\n const fullMatch = candidates.find(({ swatch, isReversed }) => {\n if (swatch.length < colorArr.length) return false;\n const compareArr = isReversed ? [...swatch].reverse() : swatch;\n // Endpoints must match\n if (\n colorArr[0].trim().toLowerCase() !== compareArr[0].trim().toLowerCase() ||\n colorArr[colorArr.length - 1].trim().toLowerCase() !==\n compareArr[compareArr.length - 1].trim().toLowerCase()\n ) {\n return false;\n }\n // Middle colors can be any order\n const inputMiddle = colorArr.slice(1, colorArr.length - 1).map(c => c.trim().toLowerCase());\n const swatchMiddle = compareArr.slice(1, colorArr.length - 1).map(c => c.trim().toLowerCase());\n return inputMiddle.every(c => swatchMiddle.includes(c));\n });\n if (fullMatch) {\n return {\n paletteTheme: fullMatch.paletteTheme,\n paletteEntry: fullMatch.paletteEntry,\n isReversed: fullMatch.isReversed,\n };\n }\n }\n // Otherwise, return first high/low match\n if (candidates.length > 0) {\n const first = candidates[0];\n return {\n paletteTheme: first.paletteTheme,\n paletteEntry: first.paletteEntry,\n isReversed: first.isReversed,\n };\n }\n return null;\n};\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport defaultPalettes from '@splunk/visualization-color-palettes/editors/PresetPalettes';\nimport type { BaseEditorProps } from '../../interfaces/BaseEditorProps';\nimport type { PalettesConfig } from '../../interfaces/PalettesConfig';\nimport PalettesConfigurer from './Palettes/PalettesConfigurer';\nimport { findMatchingPaletteGradient } from './Gradient/gradientUtils';\nimport type { GradientConfig as GradientConfigType } from './Gradient/gradientUtils';\nimport { getSwatchColorsFromPalette, hasCustomColors } from './Palettes/paletteUtils';\nimport type { Palettes, PaletteInfo } from './Palettes/paletteUtils';\nimport GradientValueConfigurer from './Gradient/GradientValueConfigurer';\n\ninterface GradientEditorProps extends BaseEditorProps {\n defaultPalettesConfig?: PalettesConfig;\n showStaticTextColor?: boolean;\n value: GradientConfigType;\n palettes?: Palettes;\n selectedDataSelector?: string;\n onChange: (event: React.SyntheticEvent, name: string, value: GradientConfigType) => void;\n}\n\nexport const GradientEditor: React.FunctionComponent<GradientEditorProps> = ({\n defaultPalettesConfig = { paletteTheme: 'DARK_COLORS', paletteEntry: { type: 'sequential', index: 1 } },\n onChange,\n palettes = defaultPalettes,\n showStaticTextColor = false,\n selectedDataSelector,\n value = { colors: ['#252214', '#b846bb'], textColor: 'auto' },\n}) => {\n const { colors, textColor } = value;\n // Get initial palette config and reversed state from findMatchingPaletteGradient\n let initialPaletteTheme: string | null = null;\n let initialPaletteEntry: PaletteInfo | null = null;\n let initialIsReversed: boolean | undefined;\n if (colors && colors.length > 1) {\n const match = findMatchingPaletteGradient(colors, palettes);\n if (match) {\n initialPaletteTheme = match.paletteTheme;\n initialPaletteEntry = match.paletteEntry;\n initialIsReversed = match.isReversed;\n }\n }\n // Fallbacks if no match\n if (!initialPaletteTheme && defaultPalettesConfig?.paletteTheme) {\n initialPaletteTheme = defaultPalettesConfig.paletteTheme;\n }\n if (!initialPaletteEntry && defaultPalettesConfig?.paletteEntry) {\n initialPaletteEntry = defaultPalettesConfig.paletteEntry;\n }\n\n const [palettesConfig, setPalettesConfig] = React.useState<{\n paletteTheme: string;\n paletteEntry: PaletteInfo;\n }>(() => ({\n paletteTheme: initialPaletteTheme,\n paletteEntry: initialPaletteEntry,\n }));\n const selectedPaletteTheme = palettesConfig?.paletteTheme ?? defaultPalettesConfig.paletteTheme;\n const selectedPaletteEntry = palettesConfig?.paletteEntry ?? defaultPalettesConfig.paletteEntry;\n\n // Only get swatch colors if palette is selected\n const currentSwatchColors =\n selectedPaletteTheme && selectedPaletteEntry\n ? getSwatchColorsFromPalette({\n palettes,\n paletteInfo: selectedPaletteEntry,\n paletteTheme: selectedPaletteTheme,\n })\n : [];\n\n const isSwatchCustomized = hasCustomColors({\n currentSwatchColors,\n selectedColors: colors,\n });\n\n // Limit custom colors to MAX_CUSTOM_COLORS\n const MAX_CUSTOM_COLORS = 7;\n const limitedColors =\n isSwatchCustomized && colors.length > MAX_CUSTOM_COLORS ? colors.slice(0, MAX_CUSTOM_COLORS) : colors;\n\n // Disable add stop if custom and at max\n const disableAddStops =\n (isSwatchCustomized && limitedColors.length >= MAX_CUSTOM_COLORS) ||\n (!isSwatchCustomized && limitedColors.length >= currentSwatchColors.length);\n\n const [isReversed, setIsReversed] = React.useState(initialIsReversed || false);\n\n // Always align to palette: lowest at index 0, highest at last index\n\n type OnChangePaletteTheme = (newPaletteTheme: string) => void;\n\n const handleOnGradientValueChange = React.useCallback(\n (payload: { colors?: string[]; textColor?: string }): void => {\n // Defensive: always pass a valid colors array\n const result: { colors: string[]; textColor?: string } = {\n colors: payload?.colors || colors,\n };\n if (showStaticTextColor) {\n result.textColor = payload.textColor || textColor;\n }\n onChange(null, null, result);\n },\n [colors, showStaticTextColor, onChange, textColor]\n );\n\n const onChangePaletteTheme: OnChangePaletteTheme = React.useCallback(\n (newPaletteTheme: string): void => {\n if (!selectedPaletteEntry) return;\n let swatch: string[] = getSwatchColorsFromPalette({\n palettes,\n paletteInfo: selectedPaletteEntry,\n paletteTheme: newPaletteTheme,\n });\n if (isReversed) {\n swatch = [...swatch].reverse();\n }\n let newColors: string[] = [];\n if (isSwatchCustomized && colors.length > 7) {\n newColors = swatch.slice();\n } else {\n const count: number = colors.length;\n if (count === 1) {\n newColors = [swatch[swatch.length - 1]];\n } else if (count === 2) {\n newColors = [swatch[0], swatch[swatch.length - 1]];\n } else if (count > 2) {\n newColors = [swatch[0]];\n for (let i = 1; i < count - 1; i += 1) {\n newColors.push(swatch[i]);\n }\n newColors.push(swatch[swatch.length - 1]);\n }\n }\n setPalettesConfig(prev => ({ ...prev, paletteTheme: newPaletteTheme }));\n handleOnGradientValueChange({ colors: newColors });\n },\n [selectedPaletteEntry, palettes, isReversed, handleOnGradientValueChange, isSwatchCustomized, colors]\n );\n\n const onPaletteChange = React.useCallback(\n (paletteInfo: PaletteInfo | null) => {\n if (!paletteInfo) {\n setPalettesConfig({ paletteTheme: null, paletteEntry: null });\n setIsReversed(false);\n return;\n }\n const swatch =\n selectedPaletteTheme && paletteInfo\n ? getSwatchColorsFromPalette({\n palettes,\n paletteInfo,\n paletteTheme: selectedPaletteTheme,\n })\n : [];\n const count = colors.length;\n let newColors: string[] = [];\n if (isSwatchCustomized && colors.length > 7) {\n newColors = swatch.slice();\n } else if (count === 1) {\n newColors = [swatch[swatch.length - 1]];\n } else if (count === 2) {\n newColors = [swatch[0], swatch[swatch.length - 1]];\n } else if (count > 2) {\n newColors = [swatch[0]];\n for (let i = 1; i < count - 1; i += 1) {\n newColors.push(swatch[i]);\n }\n newColors.push(swatch[swatch.length - 1]);\n }\n setPalettesConfig({ paletteTheme: selectedPaletteTheme, paletteEntry: paletteInfo });\n setIsReversed(false);\n const payload: any = { colors: newColors };\n if (showStaticTextColor) {\n payload.textColor = textColor;\n }\n handleOnGradientValueChange(payload);\n },\n [\n selectedPaletteTheme,\n palettes,\n showStaticTextColor,\n handleOnGradientValueChange,\n textColor,\n isSwatchCustomized,\n colors,\n ]\n );\n // if the user changes the dataSelector (e.g. from major to trend) for something like background coloring,\n // reinitialize the palette config and the initial range values + colors using the newly selected formatter config (value)\n React.useEffect((): void => {\n setPalettesConfig(findMatchingPaletteGradient(colors, palettes));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedDataSelector]);\n\n return (\n <>\n <PalettesConfigurer\n isSwatchCustomized={isSwatchCustomized}\n isReversed={isReversed}\n onChangePaletteTheme={onChangePaletteTheme}\n onPaletteChange={onPaletteChange}\n palettes={palettes}\n selectedPaletteInfo={selectedPaletteEntry}\n selectedPaletteTheme={selectedPaletteTheme}\n />\n <GradientValueConfigurer\n isSwatchCustomized={isSwatchCustomized}\n isReversed={isReversed}\n setIsReversed={setIsReversed}\n onChange={handleOnGradientValueChange}\n value={value}\n swatchColors={currentSwatchColors}\n selectedColors={limitedColors}\n name=\"GradientValueConfigurer\"\n showStaticTextColor={showStaticTextColor}\n disableAddStops={disableAddStops}\n />\n </>\n );\n};\n\nGradientEditor.propTypes = {\n value: T.any,\n onChange: T.func,\n palettes: T.shape({\n _meta: T.any.isRequired,\n }),\n showStaticTextColor: T.bool,\n};\n\nexport default GradientEditor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport Button from '@splunk/react-ui/Button';\nimport ArrowsRectangularDouble from '@splunk/react-icons/ArrowsRectangularDouble';\n\nconst AddMatchWrapper = styled.div`\n display: flex;\n flex-direction: row;\n margin-bottom: 10px;\n`;\n\nconst AddMatchButtonWrapper = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n`;\n\nconst ReverseMatchWrapper = styled.div`\n display: flex;\n`;\n\nconst reverseMatchButtonStyle = { marginRight: '12px' };\n\nconst reverseIcon = <ArrowsRectangularDouble />;\n\nconst AddAndReverseMatches = ({\n disableAddMatches = false,\n handleAddMatch,\n handleReverse,\n}: {\n disableAddMatches: boolean;\n handleAddMatch: () => void;\n handleReverse: () => void;\n}): React.ReactElement => {\n return (\n <AddMatchWrapper>\n <ReverseMatchWrapper>\n <Button\n data-test=\"reverse-matches-button\"\n icon={reverseIcon}\n style={reverseMatchButtonStyle}\n onClick={handleReverse}\n />\n </ReverseMatchWrapper>\n <AddMatchButtonWrapper>\n <Button\n data-test=\"add-match-button\"\n appearance=\"secondary\"\n label={`+ ${_('Add match')}`}\n disabled={disableAddMatches}\n onClick={handleAddMatch}\n />\n </AddMatchButtonWrapper>\n </AddMatchWrapper>\n );\n};\n\nAddAndReverseMatches.propTypes = {\n disableAddMatches: T.bool,\n handleAddMatch: T.func,\n handleReverse: T.func,\n};\n\nexport default AddAndReverseMatches;\n","import * as React from 'react';\nimport Color from '@splunk/react-ui/Color';\n\nconst MatchColor = ({\n color,\n colorIndex,\n onChange,\n palette,\n}: {\n color: string;\n colorIndex: number;\n onChange: (payload: { colorIndex: number; value: string }) => void;\n palette: string[];\n}): React.ReactElement => {\n const handleColorChange = React.useCallback(\n ({ value }): void => onChange({ colorIndex, value }),\n [colorIndex, onChange]\n );\n\n return (\n <Color\n data-test={`match-color-${color}`}\n value={color}\n palette={palette}\n onChange={handleColorChange}\n hideInput // prisma only\n />\n );\n};\n\nexport default MatchColor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { getNewColors } from '../Palettes/paletteUtils';\nimport AddAndReverseMatches from './AddAndReverseMatches';\n\nimport MatchColor from './MatchColor';\nimport MatchValueText from './MatchValueText';\nimport { isNumeric } from './matchValueUtils';\nimport RemoveMatch from './RemoveMatch';\n\nconst MatchValueConfigurerWrapper = styled.div`\n padding-top: 10px;\n`;\n\nconst MatchesWrapper = styled.div`\n display: flex;\n flex-direction: column-reverse;\n`;\n\nconst MatchEntry = styled.div.attrs((): { 'data-test': string } => ({\n 'data-test': 'match-entry-row',\n}))`\n display: flex;\n flex-direction: row;\n margin-bottom: 10px;\n`;\n\nconst MatchValueConfigurer = ({\n // while this could be calculated inside the MatchValueConfigurer directly,\n // the palette dropdown also needs to know if the swatch was customized\n // it was more convenient to hoist up customizedColors than recalculating it in the child components\n customizedColors,\n isReversed,\n onChange,\n precedence,\n swatchColors,\n matchValues,\n setIsReversed,\n selectedColors,\n}: {\n customizedColors: boolean;\n isReversed: boolean;\n onChange: (payload: { colors: string[]; matchValues: (string | number)[] }) => void;\n precedence: number[][];\n swatchColors: string[];\n matchValues: (string | number)[];\n setIsReversed: (payload: boolean) => void;\n selectedColors: string[];\n}): React.ReactElement => {\n const handleColorChange = React.useCallback(\n ({ colorIndex, value }): void => {\n const newSelectedColors = [...selectedColors];\n newSelectedColors[colorIndex] = value;\n onChange({ colors: newSelectedColors, matchValues });\n },\n [onChange, matchValues, selectedColors]\n );\n\n const handleAddMatch = React.useCallback((): void => {\n // Can add as many empty matches, per PM discussion, so this is commented.\n // if(matchValues.some(match => match === '')) return;\n const newMatchValues = [...matchValues, ''];\n const newSelectedColors = customizedColors\n ? [...selectedColors, '#000000'] // insert black color as per design if colors are customized\n : getNewColors({\n isReversed,\n // number of colors = number of matches\n numColors: newMatchValues.length,\n precedence,\n swatchColors,\n });\n onChange({ colors: newSelectedColors, matchValues: newMatchValues });\n }, [onChange, matchValues, customizedColors, selectedColors, isReversed, precedence, swatchColors]);\n\n const handleReverse = React.useCallback((): void => {\n const newColors = [...selectedColors];\n newColors.reverse();\n setIsReversed(!isReversed);\n onChange({ colors: newColors, matchValues });\n }, [onChange, matchValues, isReversed, selectedColors, setIsReversed]);\n\n const handleUpdateMatch = React.useCallback(\n (updatedValue, matchIndex): { error: string } => {\n // Evaluates whether the inputted value should be treated as a number for matching.\n const value = isNumeric(updatedValue) ? Number(updatedValue) : updatedValue;\n if (matchValues.includes(value)) {\n return { error: _('Value already exists') };\n }\n const newMatchValues = [...matchValues];\n newMatchValues[matchIndex] = value;\n onChange({ colors: selectedColors, matchValues: newMatchValues });\n return { error: null };\n },\n [onChange, selectedColors, matchValues]\n );\n\n const handleRemoveMatch = React.useCallback(\n (colorIndex: number, matchIndex: number): void => {\n if (matchValues.length > 1) {\n const newMatchValues = [...matchValues];\n newMatchValues.splice(matchIndex, 1);\n\n // check if there are still custom colors after the user removes the current one\n const newSelectedColorsWithCurrentOmitted = [...selectedColors];\n newSelectedColorsWithCurrentOmitted.splice(colorIndex, 1);\n onChange({ colors: newSelectedColorsWithCurrentOmitted, matchValues: newMatchValues });\n }\n },\n [onChange, matchValues, selectedColors]\n );\n\n return (\n <MatchValueConfigurerWrapper>\n <AddAndReverseMatches\n disableAddMatches={selectedColors.length > 6}\n handleAddMatch={handleAddMatch}\n handleReverse={handleReverse}\n />\n <MatchesWrapper>\n {selectedColors.map((color: string, i: number): React.ReactElement => {\n const matchValue = matchValues[i];\n const key = `${color}-${matchValue}-${i}`;\n\n return (\n <MatchEntry key={key}>\n <MatchColor\n color={color}\n colorIndex={i}\n palette={swatchColors}\n onChange={handleColorChange}\n />\n <MatchValueText\n initialValue={matchValue}\n matchValues={matchValues}\n matchIndex={i}\n updateMatch={handleUpdateMatch}\n />\n <RemoveMatch\n colorIndex={i}\n matchIndex={i}\n disabled={matchValues.length < 2}\n onRemove={handleRemoveMatch}\n />\n </MatchEntry>\n );\n })}\n </MatchesWrapper>\n </MatchValueConfigurerWrapper>\n );\n};\n\nMatchValueConfigurer.propTypes = {\n customizedColors: T.bool,\n isReversed: T.bool,\n precedence: T.arrayOf(T.arrayOf(T.number)),\n swatchColors: T.arrayOf(T.string),\n matchValues: T.arrayOf(T.oneOfType([T.string, T.number])),\n setIsReversed: T.func,\n selectedColors: T.arrayOf(T.string),\n};\n\nexport default MatchValueConfigurer;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport Text from '@splunk/react-ui/Text';\nimport variables from '@splunk/themes/variables';\n\nconst MatchTextWrapper = styled.div`\n display: flex;\n flex-grow: 1;\n margin-left: ${variables.spacingMedium};\n`;\n\nconst TextRowWrapper = styled.div`\n flex-grow: 1;\n`;\n\nconst MatchErrorMessage = styled.div.attrs((): { 'data-test': string } => ({\n 'data-test': 'match-value-error',\n}))`\n color: ${variables.contentColorNegative};\n padding-top: 5px;\n font-size: 12px;\n display: block;\n`;\n\nexport const handleUpdateMatch = ({\n matchIndex,\n setError,\n shouldUpdate,\n updateMatch,\n value,\n}: {\n matchIndex: number;\n setError: (payload: string) => void;\n shouldUpdate: boolean;\n updateMatch: (payload: number | string, idx: number) => { error: string };\n value: number | string;\n}): void => {\n if (shouldUpdate) {\n const result = updateMatch(value, matchIndex);\n if (result && result.error) {\n setError(result.error);\n }\n }\n};\n\nconst MatchValueText = ({\n initialValue,\n matchIndex,\n matchValues,\n updateMatch,\n}: {\n initialValue?: number | string;\n matchIndex: number;\n matchValues: (string | number)[];\n updateMatch: (value: number | string, index: number) => { error: string };\n}): React.ReactElement => {\n const [updatedMatchValue, setUpdatedMatchValue] = React.useState(null);\n const [isFocused, setIsFocused] = React.useState(false);\n const [error, setError] = React.useState(null);\n\n const handleOnFocus = React.useCallback((): void => {\n setIsFocused(true);\n }, []);\n\n const handleOnChange = React.useCallback(\n (e, { value }: { e: React.KeyboardEvent<HTMLDivElement>; value: string }): void => {\n setUpdatedMatchValue(value);\n handleUpdateMatch({\n matchIndex,\n setError,\n shouldUpdate: !isFocused,\n updateMatch,\n value,\n });\n },\n [isFocused, matchIndex, updateMatch]\n );\n\n const handleOnBlur = React.useCallback((): void => {\n setIsFocused(false);\n handleUpdateMatch({\n matchIndex,\n setError,\n shouldUpdate: updatedMatchValue != null && updatedMatchValue !== initialValue,\n updateMatch,\n value: updatedMatchValue,\n });\n }, [matchIndex, updatedMatchValue, initialValue, updateMatch]);\n\n const handleOnKeyUp = React.useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>): void =>\n handleUpdateMatch({\n matchIndex,\n setError,\n shouldUpdate:\n e.key === 'Enter' && updatedMatchValue !== null && updatedMatchValue !== initialValue,\n updateMatch,\n value: updatedMatchValue,\n }),\n [matchIndex, updatedMatchValue, initialValue, updateMatch]\n );\n\n // if changes made to match values by editing an adjacent value to address the duplication,\n // clear the error state and persist the currently state value if the current state value would not cause duplication\n React.useEffect((): void => {\n // Added .map since values may be numbers.\n if (error && !matchValues.map(value => `${value}`).includes(updatedMatchValue)) {\n setError(null);\n handleUpdateMatch({\n matchIndex,\n setError,\n shouldUpdate: true,\n updateMatch,\n value: updatedMatchValue,\n });\n }\n }, [updatedMatchValue, error, matchIndex, matchValues, updateMatch]);\n\n return (\n <MatchTextWrapper>\n <TextRowWrapper>\n <Text\n data-test=\"match-text-editor\"\n canClear={false}\n error={!!error}\n onChange={handleOnChange}\n onFocus={handleOnFocus}\n onBlur={handleOnBlur}\n onKeyUp={handleOnKeyUp}\n value={`${updatedMatchValue ?? initialValue}`}\n />\n {error && <MatchErrorMessage>{error}</MatchErrorMessage>}\n </TextRowWrapper>\n </MatchTextWrapper>\n );\n};\n\nMatchValueText.propTypes = {\n initialValue: T.oneOfType([T.string, T.number]),\n matchValues: T.arrayOf(T.oneOfType([T.string, T.number])),\n updateMatch: T.func,\n};\n\nexport default MatchValueText;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport type { ButtonProps } from '@splunk/react-ui/Button';\nimport Button from '@splunk/react-ui/Button';\nimport CloseIcon from '@splunk/react-icons/Cross';\nimport { variables } from '@splunk/themes';\n\nconst RemoveMatchWrapper = styled.div`\n display: flex;\n flex: 1;\n justify-content: flex-end;\n`;\n\nconst RemoveMatchButton = styled(Button)<ButtonProps>`\n color: ${props =>\n props.disabled ? variables.contentColorDisabled : variables.contentColorActive} !important;\n &:hover {\n background-color: ${props => !props.disabled && variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nconst RemoveMatch = ({\n colorIndex,\n disabled = false,\n onRemove,\n matchIndex,\n}: {\n colorIndex: number;\n disabled?: boolean;\n onRemove: (colorIdx: number, matchIdx: number) => void;\n matchIndex: number;\n}): React.ReactElement => {\n const handleOnRemove = React.useCallback(\n (): void => onRemove(colorIndex, matchIndex),\n [colorIndex, onRemove, matchIndex]\n );\n\n return (\n <RemoveMatchWrapper>\n <div>\n <RemoveMatchButton\n data-test=\"match-remove-button\"\n disabled={disabled}\n icon={<CloseIcon />}\n appearance=\"subtle\"\n onClick={handleOnRemove}\n />\n </div>\n </RemoveMatchWrapper>\n );\n};\n\nRemoveMatch.propTypes = {\n disabled: T.bool,\n onRemove: T.func,\n};\n\nexport default RemoveMatch;\n","import { isEmpty } from 'lodash';\nimport type { MatchesConfig } from '@splunk/visualization-encoding/formatters/MatchValue';\n\n/*\n * @method getMatches\n * @params {Array} matches\n * @return {Array} matches or an initialized match array by default\n */\nexport const getMatches = (matches = []): MatchesConfig[] => {\n if (isEmpty(matches)) {\n return [{ match: '', value: '#ff0000' }];\n }\n return matches;\n};\n\n/*\n * @method isNumeric\n * @params {string} val - input value for the given match\n * @return {boolean} whether the string is numeric\n */\nexport const isNumeric = (val: string): boolean => {\n // eslint-disable-next-line no-restricted-globals\n return !isNaN(Number(val)) && !isNaN(parseFloat(val));\n};\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { variables } from '@splunk/themes';\nimport defaultPalettes from '@splunk/visualization-color-palettes/editors/PresetPalettes';\nimport type { PalettesConfig } from '../../interfaces/PalettesConfig';\nimport PalettesConfigurer from './Palettes/PalettesConfigurer';\nimport MatchValueConfigurer from './MatchValue/MatchValueConfigurer';\nimport {\n getSwatchColorsFromPalette,\n getPrecedenceFromPalette,\n inferInitialPaletteFromContext,\n hasCustomColors,\n hasInitiallyReversedColors,\n} from './Palettes/paletteUtils';\nimport type { Palettes } from './Palettes/paletteUtils';\nimport { getMatches } from './MatchValue/matchValueUtils';\n\nexport const MATCH_VALUE_WILDCARD_INFO_TEXT = _(\"Enter a value to match. Wildcards '*' can be used.\");\n\nconst MatchValueWildcardInfo = styled.div`\n margin: 6px 0px;\n color: ${variables.contentColorMuted};\n`;\n\ninterface MatchesConfig {\n match?: string | number;\n value?: string;\n}\n\nexport interface MatchValueEditorProps {\n defaultPalettesConfig: PalettesConfig;\n onChange?: (e: string, opt: string, payload: MatchesConfig[]) => void;\n palettes?: Palettes;\n selectedDataSelector?: string;\n value?: MatchesConfig[] | null;\n}\n\nconst getNewColorsFromPalette = ({\n palettes,\n paletteTheme,\n paletteInfo,\n matchValues,\n setIsReversed,\n}): string[] => {\n const newSwatchColors = getSwatchColorsFromPalette({\n palettes,\n paletteInfo,\n paletteTheme,\n });\n const precedence = getPrecedenceFromPalette({\n palettes,\n paletteTheme,\n paletteInfo,\n });\n\n const n = matchValues.length;\n // It's an array of 6 elements (indices from 0 to 5) so if there are\n // less than 7 match values, select the precedence normally. If 7 or greater,\n // select the final array in the precedence array at index 5.\n // Added .slice because there is one too many colors -\n // e.g. for matchValues array of length 1, precedence[0] returns\n // 2 elements (as was the minimum # for use with rangeValue)\n const newSelectedColors = precedence[n < 7 ? n - 1 : 5]\n .map((colorIdx): string => newSwatchColors[colorIdx])\n .slice(0, n);\n\n setIsReversed(false);\n return newSelectedColors;\n};\n\nexport const matchValuesToContextConfig = ({ colors, matchValues }): MatchesConfig[] =>\n colors.map((color, i): MatchesConfig => {\n const entry: MatchesConfig = {\n match: matchValues[i],\n value: color,\n };\n\n return entry;\n });\n\nconst MatchValueEditor = ({\n defaultPalettesConfig,\n onChange = () => undefined,\n palettes = defaultPalettes,\n selectedDataSelector,\n value,\n}: MatchValueEditorProps): React.ReactElement => {\n const matches = React.useMemo(() => getMatches(value), [value]);\n\n const { matchValues, selectedColors } = React.useMemo(\n () =>\n matches.reduce(\n (acc, next) => {\n acc.matchValues.push(next.match);\n acc.selectedColors.push(next.value);\n return acc;\n },\n { matchValues: [], selectedColors: [] }\n ),\n [matches]\n );\n\n const [{ paletteTheme: selectedPaletteTheme, paletteEntry: selectedPaletteEntry }, setPalettesConfig] =\n React.useState<PalettesConfig>(() =>\n inferInitialPaletteFromContext({ defaultPalettesConfig, palettes, ranges: matches })\n );\n\n const currentSwatchColors = getSwatchColorsFromPalette({\n palettes,\n paletteInfo: selectedPaletteEntry,\n paletteTheme: selectedPaletteTheme,\n });\n\n const isSwatchCustomized = React.useMemo(\n () => hasCustomColors({ currentSwatchColors, selectedColors }),\n [currentSwatchColors, selectedColors]\n );\n\n // we only want to calculate the initial reversed state when the RangeValueEditor opens since this is somewhat expensive\n // after this, the reversed state should be tracked internally by the editor itself\n\n const [isReversed, setIsReversed] = React.useState(() =>\n hasInitiallyReversedColors({\n isSwatchCustomized,\n palettes,\n selectedColors,\n selectedPaletteInfo: selectedPaletteEntry,\n selectedPaletteTheme,\n minimumNumberOfColors: 1,\n })\n );\n const calculateNewColors = React.useCallback(\n ({ paletteTheme, paletteInfo }): string[] => {\n // RangeValue had 6 here because it was the number of boundaries -\n // we have max 7 matches.\n if (matchValues.length > 7) return selectedColors;\n return getNewColorsFromPalette({\n palettes,\n paletteTheme,\n paletteInfo,\n matchValues,\n setIsReversed,\n });\n },\n [matchValues, palettes, selectedColors]\n );\n\n const onChangePaletteTheme = React.useCallback(\n (newPaletteTheme): void => {\n const newColors = calculateNewColors({\n paletteTheme: newPaletteTheme,\n paletteInfo: selectedPaletteEntry,\n });\n setPalettesConfig(prev => ({ ...prev, paletteTheme: newPaletteTheme }));\n const newMatches = matchValuesToContextConfig({ colors: newColors, matchValues });\n onChange(null, null, newMatches);\n },\n [calculateNewColors, selectedPaletteEntry, matchValues, onChange]\n );\n\n const onPaletteChange = React.useCallback(\n (newPaletteInfo): void => {\n const newColors = calculateNewColors({\n paletteTheme: selectedPaletteTheme,\n paletteInfo: newPaletteInfo,\n });\n setPalettesConfig(prev => ({ ...prev, paletteEntry: newPaletteInfo }));\n const newMatches = matchValuesToContextConfig({ colors: newColors, matchValues });\n onChange(null, null, newMatches);\n },\n [calculateNewColors, selectedPaletteTheme, matchValues, onChange]\n );\n\n const handleOnMatchValueChange = React.useCallback(\n ({ colors, matchValues: newMatchValues }): void => {\n const newMatches = matchValuesToContextConfig({ colors, matchValues: newMatchValues });\n onChange(null, null, newMatches);\n },\n [onChange]\n );\n\n // if the user changes the dataSelector (e.g. from major to trend) for something like background coloring,\n // reinitialize the palette config and the initial match values + colors using the newly selected formatter config (value)\n React.useEffect((): void => {\n setPalettesConfig(\n inferInitialPaletteFromContext({\n defaultPalettesConfig,\n palettes,\n ranges: matches,\n })\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedDataSelector]);\n\n return (\n <>\n <PalettesConfigurer\n isReversed={isReversed}\n isSwatchCustomized={isSwatchCustomized}\n shouldShowArrows={false}\n onChangePaletteTheme={onChangePaletteTheme}\n onPaletteChange={onPaletteChange}\n palettes={palettes}\n selectedPaletteInfo={selectedPaletteEntry}\n selectedPaletteTheme={selectedPaletteTheme}\n />\n <MatchValueConfigurer\n customizedColors={isSwatchCustomized}\n isReversed={isReversed}\n onChange={handleOnMatchValueChange}\n precedence={getPrecedenceFromPalette({\n palettes,\n paletteTheme: selectedPaletteTheme,\n paletteInfo: selectedPaletteEntry,\n })}\n matchValues={matchValues}\n selectedColors={selectedColors}\n swatchColors={currentSwatchColors}\n setIsReversed={setIsReversed}\n />\n <MatchValueWildcardInfo>{MATCH_VALUE_WILDCARD_INFO_TEXT}</MatchValueWildcardInfo>\n </>\n );\n};\n\nMatchValueEditor.propTypes = {\n /**\n * An onChange callback that allows the editor to customize the context accordingly based on the new thresholds\n */\n onChange: T.func,\n /**\n * The palettes object\n *\n * This consists of a theme and each themed-variant of the palettes\n */\n palettes: T.objectOf(\n T.shape({\n precedence: T.arrayOf(T.arrayOf(T.number)),\n swatches: T.arrayOf(T.arrayOf(T.string)),\n })\n ),\n /**\n * The initial matches config from the viz context\n */\n value: T.arrayOf(\n T.shape({\n match: T.oneOfType([T.string, T.number]),\n value: T.string,\n })\n ),\n /**\n * The field upon which the matchValue formatter is operating on - e.g. 'majorValue'\n */\n selectedDataSelector: T.string,\n /**\n * The default palette configuration, consisting of the theme and specific palette entry\n */\n defaultPalettesConfig: T.shape({\n paletteTheme: T.string,\n paletteEntry: T.shape({\n type: T.string,\n index: T.number,\n }),\n }),\n};\n\nexport default MatchValueEditor;\n","import React, { useMemo } from 'react';\nimport type { MatchesConfig } from '@splunk/visualization-encoding/formatters/MatchValue';\nimport { ColorPreview } from './ColorPreview';\nimport type { BasePreviewProps } from '../../interfaces/BasePreviewProps';\nimport PreviewWrapper from '../../shared/PreviewWrapper';\n\nconst MAX_PREVIEW_COLOR_COUNT = 8;\ntype MatchValuePreviewProps = Omit<BasePreviewProps, 'config'> & {\n config: MatchesConfig[];\n};\n\nexport const MatchValuePreview: React.FunctionComponent<MatchValuePreviewProps> = ({\n config,\n}): React.ReactElement => {\n const colors = useMemo(\n () => config.map((entry): string => entry.value).slice(0, MAX_PREVIEW_COLOR_COUNT),\n [config]\n );\n return (\n <PreviewWrapper>\n <ColorPreview data-test=\"ColorPreview\" colors={colors} maxColorCount={MAX_PREVIEW_COLOR_COUNT} />\n </PreviewWrapper>\n );\n};\n","import * as React from 'react';\nimport PresetPaletteTheme from './PresetPaletteTheme';\nimport PalettesDropdown from './PalettesDropdown';\nimport { getThemedPalettesWithoutMeta } from './paletteUtils';\nimport type { Palettes, PaletteInfo, PaletteEntryMap, PaletteThemeMeta } from './paletteUtils';\n\nconst PalettesConfigurer = ({\n isReversed,\n isSwatchCustomized,\n shouldShowArrows = true,\n onChangePaletteTheme,\n onPaletteChange,\n palettes,\n selectedPaletteInfo,\n selectedPaletteTheme,\n}: {\n isReversed: boolean;\n isSwatchCustomized: boolean;\n shouldShowArrows?: boolean;\n onChangePaletteTheme: (theme: string) => void;\n onPaletteChange: ({ type, index }: PaletteInfo) => void;\n palettes: Palettes;\n selectedPaletteInfo: PaletteInfo;\n selectedPaletteTheme: string;\n}): React.ReactElement => {\n const paletteThemes = React.useMemo(\n (): PaletteThemeMeta[] =>\n Object.keys(palettes).map(\n (palette): PaletteThemeMeta => ({\n value: palette,\n // eslint-disable-next-line no-underscore-dangle\n label: palettes[palette]._meta.label,\n })\n ),\n [palettes]\n );\n\n const filteredThemedPalettes = React.useMemo(\n (): PaletteEntryMap => getThemedPalettesWithoutMeta({ palettes, paletteTheme: selectedPaletteTheme }),\n [palettes, selectedPaletteTheme]\n );\n\n return (\n <>\n <PresetPaletteTheme\n onChange={onChangePaletteTheme}\n paletteThemes={paletteThemes}\n selectedPaletteTheme={selectedPaletteTheme}\n />\n <PalettesDropdown\n isReversed={isReversed}\n isSwatchCustomized={isSwatchCustomized}\n shouldShowArrows={shouldShowArrows}\n onPaletteChange={onPaletteChange}\n palettes={filteredThemedPalettes}\n selectedPaletteInfo={selectedPaletteInfo}\n />\n </>\n );\n};\n\nexport default PalettesConfigurer;\n","import * as React from 'react';\nimport { get } from 'lodash';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Button from '@splunk/react-ui/Button';\nimport Dropdown from '@splunk/react-ui/Dropdown';\nimport Menu from '@splunk/react-ui/Menu';\nimport variables from '@splunk/themes/variables';\nimport ArrowLayer from '../../../shared/ArrowLayer';\nimport { ColorPreview } from '../ColorPreview';\nimport PreviewWrapper from '../../../shared/PreviewWrapper';\nimport type { PaletteInfo } from './paletteUtils';\n\nexport interface PalettesDropdownProps {\n isReversed?: boolean;\n isSwatchCustomized?: boolean;\n shouldShowArrows?: boolean;\n onPaletteChange: ({ type, index }: PaletteInfo) => void;\n palettes: { [key: string]: { swatches: string[][]; precedence: number[][] } };\n selectedPaletteInfo: { type: string; index: number };\n}\n\nconst ColorPreviewSpacer = styled.div`\n width: ${variables.spacingMedium}; //enterprise: 15px, prisma: 12px\n`;\n\nconst CustomizedSwatchText = styled.span.attrs(() => ({\n 'data-test': 'custom-swatch-text',\n}))`\n display: flex;\n flex: 1;\n padding-left: 10px;\n`;\nconst PalettesDropdown = ({\n isReversed = false,\n isSwatchCustomized = false,\n shouldShowArrows = true,\n onPaletteChange,\n palettes,\n selectedPaletteInfo,\n}: PalettesDropdownProps): React.ReactElement => {\n const previewColors = get(\n palettes,\n [selectedPaletteInfo.type, 'swatches', selectedPaletteInfo.index],\n []\n );\n\n const initialPalettePreview = (\n <Button\n style={{ width: '100%', padding: `0 ${variables.spacingSmall}` }}\n isMenu\n data-test=\"palettes-dropdown-toggle\"\n >\n {isSwatchCustomized ? (\n <CustomizedSwatchText>Customized in swatches below</CustomizedSwatchText>\n ) : (\n <>\n <PreviewWrapper>\n {shouldShowArrows && <ArrowLayer />}\n <ColorPreview colors={previewColors} isReversed={isReversed} />\n </PreviewWrapper>\n <ColorPreviewSpacer />\n </>\n )}\n </Button>\n );\n\n const menuItems = React.useMemo(\n // can't use React.Fragment - it will break keyboard navigation,\n // Menu accepts only Menu.Item, Menu.Heading, Menu.Divider as child components\n () =>\n Object.keys(palettes).reduce<JSX.Element[]>((items, palette, index, arr) => {\n items.push(\n <Menu.Heading key={`title-${palette}`} title>\n {_(palette).toUpperCase()}\n </Menu.Heading>\n );\n items.push(\n ...palettes[palette].swatches.map((colors: string[], i) => {\n const isSelected =\n !isSwatchCustomized &&\n palette === selectedPaletteInfo.type &&\n selectedPaletteInfo.index === i;\n\n return (\n <Menu.Item\n data-test={`palette-swatch-row-${palette}-${i}`}\n key={`${palette}-${JSON.stringify(colors)}`}\n onClick={() => onPaletteChange({ type: palette, index: i })}\n selected={isSelected}\n selectable\n >\n <PreviewWrapper>\n <ColorPreview colors={colors} />\n </PreviewWrapper>\n </Menu.Item>\n );\n })\n );\n if (index < arr.length - 1) {\n items.push(<Menu.Divider key={`divider-${palette}`} />);\n }\n return items;\n }, []),\n [isSwatchCustomized, onPaletteChange, palettes, selectedPaletteInfo.index, selectedPaletteInfo.type]\n );\n\n return (\n <Dropdown toggle={initialPalettePreview}>\n <Menu style={{ width: 302 }}>{menuItems}</Menu>\n </Dropdown>\n );\n};\n\nexport default PalettesDropdown;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport RadioBar from '@splunk/react-ui/RadioBar';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport type { PaletteThemeMeta } from './paletteUtils';\n\nconst PresetPaletteTheme = ({\n labelPosition = 'top',\n onChange,\n paletteThemes,\n selectedPaletteTheme,\n}: {\n labelPosition?: 'left' | 'top';\n onChange: (payload: string) => void;\n paletteThemes: PaletteThemeMeta[];\n selectedPaletteTheme: string;\n}): React.ReactElement => {\n const onPaletteThemeChange = React.useCallback((e, { value }): void => onChange(value), [onChange]);\n\n return (\n <ControlGroup label={_('Preset palette')} labelPosition={labelPosition}>\n <RadioBar onChange={onPaletteThemeChange} value={selectedPaletteTheme}>\n {paletteThemes.map(\n ({ value, label }): React.ReactElement => (\n <RadioBar.Option\n key={value}\n value={value}\n label={label}\n data-test={`preset-palette-theme-${value}`}\n />\n )\n )}\n </RadioBar>\n </ControlGroup>\n );\n};\n\nPresetPaletteTheme.propTypes = {\n labelPosition: T.string,\n onChange: T.func,\n paletteThemes: T.arrayOf(\n T.shape({\n value: T.string,\n label: T.string,\n })\n ),\n selectedPaletteTheme: T.string,\n};\n\nexport default PresetPaletteTheme;\n","import { get } from 'lodash';\nimport type { RangesConfig } from '@splunk/visualization-encoding/formatters/RangeValue';\nimport type { MatchesConfig } from '@splunk/visualization-encoding/formatters/MatchValue';\nimport type { PalettesConfig } from '../../../interfaces/PalettesConfig';\n\nexport interface PaletteEntry {\n swatches: string[][];\n precedence: number[][];\n}\n\nexport interface PaletteEntryMap {\n [palette: string]: PaletteEntry;\n}\n\nexport interface PaletteInfo {\n type: string;\n index: number;\n}\n\ninterface PaletteThemeMetadata {\n label: string;\n paletteTheme?: string;\n [key: string]: unknown;\n}\n\ninterface PaletteTheme {\n _meta: PaletteThemeMetadata;\n [key: string]: PaletteEntry | PaletteThemeMetadata;\n}\n\nexport type Palettes = Record<string, PaletteTheme>;\n\nconst isPaletteEntry = (value: PaletteEntry | PaletteThemeMetadata | undefined): value is PaletteEntry => {\n if (!value || typeof value !== 'object') {\n return false;\n }\n return 'swatches' in value && Array.isArray((value as PaletteEntry).swatches);\n};\n\nexport interface PaletteThemeMeta {\n value: string;\n label: string;\n}\n\ninterface SharedPalettesParams {\n palettes: Palettes;\n paletteInfo: PaletteInfo;\n paletteTheme: string;\n}\n\nexport const defaultPalettesConfig = {\n paletteTheme: 'DARK_COLORS',\n paletteEntry: {\n type: 'sequential',\n index: 0,\n },\n};\n\n/**\n * Obtains the new colors given the set of swatchColors and a precedence to pick the desired swatch colors\n * Each entry in 2D precedence dictates which colors out of the (i + 2) colors, where i is the index for the entry\n * E.g the 0th precedence entry tells us which 2 elements to select from the swatch colors\n * the 1st entry tells us which 3 elements to select, and so forth\n *\n * @param {Boolean} params.isReversed - indicates that the selected colors should be reversed based on the insertion precedence\n * @param {Number} params.numColors - number of colors to return\n * @param {Number[][]} params.precedence - the order from which the new selected colors should pick from the swatch\n * the ith precedence entry dictates the indices that should be selected for (i + 2) swatchColors (e.g. [[0, 1], [0, 1, 2], [0, 1, 2, 3]])\n * @param {String[]} params.swatchColors - the swatch from which the colors are picked from\n */\nexport const getNewColors = ({\n isReversed,\n numColors,\n precedence,\n swatchColors,\n}: {\n isReversed: boolean;\n numColors: number;\n precedence: number[][];\n swatchColors: string[];\n}): string[] => {\n const newSelectedColors = Array.isArray(precedence[numColors - 2])\n ? precedence[numColors - 2].map((colorIdx): string => {\n return swatchColors[colorIdx];\n })\n : [];\n\n if (isReversed) {\n newSelectedColors.reverse();\n }\n return newSelectedColors;\n};\n\n/**\n * Returns the swatch precedence defined for a given palette type\n *\n * @param {Palettes} params.palettes - the nested palettes object\n * @param {PaletteInfo} params.paletteInfo - object holding the palette type (e.g. divergent, categorical), and index within the palette swatches\n * @param {String} params.paletteTheme - the palette theme that should be a key at the root level of the Palettes object\n *\n * @return {Number[][]}\n */\nexport const getPrecedenceFromPalette = ({\n palettes,\n paletteInfo,\n paletteTheme,\n}: SharedPalettesParams): number[][] => {\n return get(palettes, [paletteTheme, paletteInfo.type, 'precedence'], []);\n};\n\n/**\n * Returns the swatch colors for a given palette type and index\n *\n * @param {Palettes} params.palettes - the nested palettes object\n * @param {PaletteInfo} params.paletteInfo - object holding the palette type (e.g. divergent, categorical), and index within the palette swatches\n * @param {String} params.paletteTheme - the palette theme that should be a key at the root level of the Palettes object\n *\n * @return {String[]}\n */\nexport const getSwatchColorsFromPalette = ({\n palettes,\n paletteInfo,\n paletteTheme,\n}: SharedPalettesParams): string[] => {\n return get(palettes, [paletteTheme, paletteInfo.type, 'swatches', paletteInfo.index], []);\n};\n\n/**\n * Determines if the current selected colors are customized compared to the current swatch colors\n *\n * @param {String[]} params.currentSwatchColors - the currently selected swatch within the Palette Dropdown\n * @param {String[]} params.selectedColors - the colors present within the range value config\n *\n * @return {Boolean}\n */\nexport const hasCustomColors = ({\n currentSwatchColors,\n selectedColors,\n}: {\n currentSwatchColors: string[];\n selectedColors: string[];\n}): boolean => {\n if (selectedColors.length > currentSwatchColors.length) {\n return true;\n }\n\n // NOTE: for detecting custom colors, the color to evaluate must be lowercased, as SUI's Color editor\n // converts all selected hex colors to their lowercased counterpart, regardless of the casing in the palette\n const swatchColorMap = {};\n currentSwatchColors.forEach((color): void => {\n swatchColorMap[color.toLowerCase()] = color.toLowerCase();\n });\n\n return selectedColors.some((color): boolean => !swatchColorMap[color.toLowerCase()]);\n};\n\n/**\n * Returns the palette entries within the palettes object for a given theme without the _meta field\n *\n * @param {Palettes} params.palettes - the nested palettes object\n * @param {String} params.paletteTheme - the palette theme that should be a key at the root level of the Palettes object\n *\n * @return {Palettes} - the selectedTheme palettes object with the _meta field stripped out from each palette entry\n */\nexport const getThemedPalettesWithoutMeta = ({\n palettes,\n paletteTheme,\n}: {\n palettes: Palettes;\n paletteTheme: string;\n}): PaletteEntryMap => {\n return Object.keys(palettes[paletteTheme]).reduce((filteredPalettes, field): Record<string, unknown> => {\n if (field !== '_meta') {\n // eslint-disable-next-line no-param-reassign\n filteredPalettes[field] = palettes[paletteTheme][field];\n }\n return filteredPalettes;\n }, {});\n};\n\n/**\n * Internal helper to check if the user-selected colors adhere to the default palette insertion order\n */\nconst hasMatchingPrecedence = ({\n currentSwatchColors,\n precedence,\n selectedColors,\n}: {\n currentSwatchColors: string[];\n precedence: number[];\n selectedColors: string[];\n}): boolean => {\n if (!precedence) {\n return false;\n }\n if (precedence.every((idx: number): boolean => currentSwatchColors[idx] === selectedColors[idx]))\n return true;\n const reversedPrecedenceEntry = [...precedence].reverse();\n if (\n reversedPrecedenceEntry.every(\n (idx: number): boolean => currentSwatchColors[idx] === selectedColors[idx]\n )\n )\n return true;\n\n // the given precedence (nor its reversed counterpart) do not match\n return false;\n};\n\n/**\n * Determines if the selected colors relative to the palette had a reversed precedence\n * @param {Boolean} params.isSwatchCustomized - indicates if user was using non-palette derived colors\n * @param {Palettes} params.palettes - the palettes object used to power the range value editor palette\n * @param {String[]} params.selectedColors - the colors that are currently populating the range value formatter editor\n * @param {PaletteInfo} params.selectedPaletteInfo - metadata about the currently selected palette for the range value formatter editor\n * @param {String} params.selectedPaletteTheme - the current palette theme\n *\n * @returns {Boolean}\n */\nexport const hasInitiallyReversedColors = ({\n isSwatchCustomized,\n palettes,\n selectedColors,\n selectedPaletteInfo,\n selectedPaletteTheme,\n // minimumNumberOfColors reflects the minimum number of colors needed in the particular formatter editor's implementation\n // defaulted to two as to not break previous rangeValue formatter editor implementation\n minimumNumberOfColors = 2,\n}: {\n isSwatchCustomized: boolean;\n palettes: Palettes;\n selectedColors: string[];\n selectedPaletteInfo: PaletteInfo;\n selectedPaletteTheme: string;\n minimumNumberOfColors?: number;\n}): boolean => {\n if (isSwatchCustomized) {\n return false;\n }\n\n const n = selectedColors.length;\n // if for rangevalue (min # of colors = 2) then default behavior, otherwise adjust for matchvalue\n const precedenceIndexIfMatch = n < 7 ? n - 1 : 5;\n const precedenceIndex = minimumNumberOfColors === 2 ? n - 2 : precedenceIndexIfMatch;\n\n const currentPaletteColors =\n palettes?.[selectedPaletteTheme]?.[selectedPaletteInfo.type]?.swatches?.[selectedPaletteInfo.index];\n const currentPrecedence =\n palettes?.[selectedPaletteTheme]?.[selectedPaletteInfo.type]?.precedence?.[precedenceIndex];\n\n const reversedPrecedence = [...currentPrecedence].reverse();\n\n return selectedColors.every(\n (selectedColor, index) =>\n currentPaletteColors[reversedPrecedence[index]].toLowerCase() === selectedColor.toLowerCase()\n );\n};\n\n/**\n * Helper to determine if the user was using a pre-existing palette to populate the rangeValue, matchValue, or gradient config.\n *\n * Accepts RangesConfig, MatchesConfig, or GradientConfig (array of colors).\n * Checks all palettes from all themes to determine which one the user was previously using.\n * If multiple matches are found (possible since palettes can have overlapping colors), insertion precedence is used to infer the correct palette type.\n * If no match is found, returns the defaultPalettesConfig.\n *\n * @param {PalettesConfig} params.defaultPalettesConfig - if no palette match is found, the swatch info from this palette will be used for the color editors\n * @param {RangesConfig[] | MatchesConfig[]} params.ranges - the ranges/matches context config or gradient config\n * @param {Palettes} params.palettes - the nested palettes object\n */\nexport const inferInitialPaletteFromContext = ({\n defaultPalettesConfig: defaultPalettes,\n ranges,\n palettes,\n}: {\n defaultPalettesConfig: PalettesConfig;\n ranges: RangesConfig[] | MatchesConfig[];\n palettes: Palettes;\n}): PalettesConfig => {\n // Determine selectedColors based on input type\n let selectedColors: string[] = [];\n if (Array.isArray(ranges)) {\n // RangesConfig or MatchesConfig\n selectedColors = ranges.map(({ value }) => value);\n }\n\n let matchingPalette;\n let matchedPrecedence = false;\n\n Object.keys(palettes).forEach(paletteTheme => {\n Object.keys(palettes[paletteTheme])\n .filter(paletteType => paletteType !== '_meta')\n .forEach(paletteType => {\n const entry = palettes[paletteTheme][paletteType];\n if (!isPaletteEntry(entry)) {\n return;\n }\n const { swatches, precedence } = entry;\n const precedenceForLength = precedence[selectedColors.length - 2] ?? [];\n for (let k = 0; k < swatches.length; k += 1) {\n const currentSwatchColors = swatches[k];\n if (!hasCustomColors({ currentSwatchColors, selectedColors })) {\n matchedPrecedence = hasMatchingPrecedence({\n currentSwatchColors,\n selectedColors,\n precedence: precedenceForLength,\n });\n if (!matchingPalette || matchedPrecedence) {\n matchingPalette = {\n paletteTheme,\n paletteEntry: {\n type: paletteType,\n index: k,\n },\n };\n }\n }\n }\n });\n });\n\n return matchingPalette || defaultPalettes;\n};\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport Button from '@splunk/react-ui/Button';\nimport ArrowsRectangularDouble from '@splunk/react-icons/ArrowsRectangularDouble';\n\nconst AddRangeWrapper = styled.div`\n display: flex;\n flex-direction: row;\n margin-bottom: 10px;\n`;\n\nconst AddRangeButtonWrapper = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n`;\n\nconst ReverseRangeWrapper = styled.div`\n display: flex;\n`;\n\nconst ButtonStyle = {\n marginRight: '12px',\n};\n\nconst reverseIcon = <ArrowsRectangularDouble />;\n\nconst AddAndReverseRanges = ({\n disableAddRanges = false,\n handleAddRange,\n handleReverse,\n}: {\n disableAddRanges: boolean;\n handleAddRange: () => void;\n handleReverse: () => void;\n}): React.ReactElement => {\n return (\n <AddRangeWrapper>\n <ReverseRangeWrapper>\n <Button\n data-test=\"reverse-ranges-button\"\n icon={reverseIcon}\n style={ButtonStyle}\n onClick={handleReverse}\n />\n </ReverseRangeWrapper>\n <AddRangeButtonWrapper>\n <Button\n data-test=\"add-range-button\"\n appearance=\"secondary\"\n label={`+ ${_('Add range')}`}\n disabled={disableAddRanges}\n onClick={handleAddRange}\n />\n </AddRangeButtonWrapper>\n </AddRangeWrapper>\n );\n};\n\nAddAndReverseRanges.propTypes = {\n disableAddRanges: T.bool,\n handleAddRange: T.func,\n handleReverse: T.func,\n};\n\nexport default AddAndReverseRanges;\n","import * as React from 'react';\nimport styled from 'styled-components';\nimport Number, { type NumberChangeHandler } from '@splunk/react-ui/Number';\nimport variables from '@splunk/themes/variables';\n\nconst RangeBoundaryText = styled.div.attrs((): { 'data-test': string } => ({\n 'data-test': 'range-boundary-text',\n}))`\n color: ${variables.contentColorMuted};\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-right: 10px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst BoundaryErrorMessage = styled.div.attrs((): { 'data-test': string } => ({\n 'data-test': 'range-boundary-error',\n}))`\n color: ${variables.contentColorNegative};\n padding-top: 5px;\n font-size: 12px;\n display: block;\n`;\n\nconst StyledNumberEditor = styled(Number)`\n max-width: 105px;\n margin-right: ${variables.spacingMedium};\n`;\n\nconst BoundaryRowWrapper = styled.div`\n display: flex;\n height: 100%;\n`;\n\nconst RangeBoundaryWrapper = styled.div`\n display: flex;\n flex-direction: column;\n margin-left: ${variables.spacingMedium};\n`;\n\nexport const handleUpdateRangeBoundary = ({\n rangeBoundaryIndex,\n setError,\n shouldUpdate,\n updateRangeBoundary,\n value,\n}: {\n rangeBoundaryIndex: number;\n setError: (payload: string) => void;\n shouldUpdate: boolean;\n updateRangeBoundary: (payload: number, idx: number) => { error: string };\n value: number;\n}): void => {\n if (shouldUpdate) {\n const result = updateRangeBoundary(value, rangeBoundaryIndex);\n if (result && result.error) {\n setError(result.error);\n }\n }\n};\n\nconst RangeBoundary = ({\n initialValue,\n rangeBoundaryIndex,\n rangeText,\n rangeValues,\n showNumberEditor = true,\n updateRangeBoundary,\n}: {\n initialValue?: number;\n rangeBoundaryIndex: number;\n rangeText: string;\n rangeValues: number[];\n showNumberEditor?: boolean;\n updateRangeBoundary: (value: number, updatedRangeBoundaryIndex: number) => { error: string };\n}): React.ReactElement => {\n const [boundaryInputValue, setBoundaryInputValue] = React.useState(null);\n const [isFocused, setIsFocused] = React.useState(false);\n const [error, setError] = React.useState(null);\n\n const handleOnFocus = React.useCallback((): void => {\n setIsFocused(true);\n }, []);\n\n const handleOnChange = React.useCallback<NumberChangeHandler>(\n (_e, { value }): void => {\n // this is invoked if the user uses the up/down arrows (want to update rangevalues immediately)\n setBoundaryInputValue(value);\n handleUpdateRangeBoundary({\n rangeBoundaryIndex,\n setError,\n shouldUpdate: !isFocused,\n updateRangeBoundary,\n value,\n });\n },\n [isFocused, rangeBoundaryIndex, updateRangeBoundary]\n );\n\n const handleOnBlur = React.useCallback((): void => {\n setIsFocused(false);\n handleUpdateRangeBoundary({\n rangeBoundaryIndex,\n setError,\n shouldUpdate: typeof boundaryInputValue === 'number' && boundaryInputValue !== initialValue,\n updateRangeBoundary,\n value: boundaryInputValue,\n });\n }, [rangeBoundaryIndex, boundaryInputValue, initialValue, updateRangeBoundary]);\n\n const handleOnKeyUp = React.useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>): void =>\n handleUpdateRangeBoundary({\n rangeBoundaryIndex,\n setError,\n shouldUpdate:\n e.key === 'Enter' &&\n typeof boundaryInputValue === 'number' &&\n boundaryInputValue !== initialValue,\n updateRangeBoundary,\n value: boundaryInputValue,\n }),\n [rangeBoundaryIndex, boundaryInputValue, initialValue, updateRangeBoundary]\n );\n\n // if the changes the range values by editing an adjacent value to address the duplication,\n // clear the error state and persist the currently state value if the current state value would not cause duplication\n React.useEffect((): void => {\n if (error && !rangeValues.includes(boundaryInputValue)) {\n setError(null);\n handleUpdateRangeBoundary({\n rangeBoundaryIndex,\n setError,\n shouldUpdate: typeof boundaryInputValue === 'number',\n updateRangeBoundary,\n value: boundaryInputValue,\n });\n }\n }, [boundaryInputValue, error, rangeBoundaryIndex, rangeValues, updateRangeBoundary]);\n\n return (\n <RangeBoundaryWrapper>\n <BoundaryRowWrapper>\n {showNumberEditor && (\n <StyledNumberEditor\n data-test=\"range-boundary-editor\"\n error={!!error}\n onBlur={handleOnBlur}\n onChange={handleOnChange}\n onFocus={handleOnFocus}\n onKeyUp={handleOnKeyUp}\n value={boundaryInputValue ?? initialValue}\n />\n )}\n <RangeBoundaryText>{rangeText}</RangeBoundaryText>\n </BoundaryRowWrapper>\n {showNumberEditor && error && <BoundaryErrorMessage>{error}</BoundaryErrorMessage>}\n </RangeBoundaryWrapper>\n );\n};\n\nexport default RangeBoundary;\n","import * as React from 'react';\nimport Color from '@splunk/react-ui/Color';\n\nconst RangeColor = ({\n color,\n colorIndex,\n onChange,\n palette,\n}: {\n color: string;\n colorIndex: number;\n onChange: (payload: { colorIndex: number; value: string }) => void;\n palette: string[];\n}): React.ReactElement => {\n const handleColorChange = React.useCallback(\n ({ value }): void => {\n let valueToUse = value;\n if (valueToUse === null) {\n valueToUse = 'transparent';\n }\n return onChange({ colorIndex, value: valueToUse });\n },\n [colorIndex, onChange]\n );\n\n return (\n <Color\n data-test={`range-color-${color}`}\n value={color}\n palette={palette}\n onChange={handleColorChange}\n hideInput // prisma only\n />\n );\n};\n\nexport default RangeColor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AddAndReverseRanges from './AddAndReverseRanges';\nimport RangeBoundary from './RangeBoundary';\nimport RangeColor from './RangeColor';\nimport RemoveRange from './RemoveRange';\nimport { getNewColors, hasCustomColors } from '../Palettes/paletteUtils';\n\nconst RangeValueConfigurerWrapper = styled.div`\n padding-top: 10px;\n`;\n\nconst RangesWrapper = styled.div`\n display: flex;\n flex-direction: column-reverse;\n`;\n\nconst RangeEntry = styled.div.attrs((): { 'data-test': string } => ({\n 'data-test': 'range-entry-row',\n}))`\n display: flex;\n flex-direction: row;\n margin-bottom: 10px;\n`;\n\n// note; getRangeText applies i18n at the static string level\nconst getRangeText = ({ lastColorIndex, rangeBoundaryIndex, rangeValues }): string => {\n switch (rangeBoundaryIndex) {\n case lastColorIndex:\n return _('and greater');\n case 0:\n return `${_('less than')} ${rangeValues[rangeBoundaryIndex]}`;\n default:\n return `${_('to')} ${rangeValues[rangeBoundaryIndex]}`;\n }\n};\n\nconst RangeValueConfigurer = ({\n // while this could be calculated inside the RangeValueConfigurer directly,\n // the palette dropdown also needs to know if the swatch was customized\n // it was more convenient to hoist up customizedColors than recalculating it in the child components\n customizedColors,\n isReversed,\n onChange,\n precedence,\n swatchColors,\n rangeValues,\n setIsReversed,\n selectedColors,\n}: {\n customizedColors: boolean;\n isReversed: boolean;\n onChange: (payload: { colors: string[]; rangeValues: number[] }) => void;\n precedence: number[][];\n swatchColors: string[];\n rangeValues: number[];\n setIsReversed: (payload: boolean) => void;\n selectedColors: string[];\n}): React.ReactElement => {\n const handleColorChange = React.useCallback(\n ({ colorIndex, value }): void => {\n const newSelectedColors = [...selectedColors];\n newSelectedColors[colorIndex] = value;\n onChange({ colors: newSelectedColors, rangeValues });\n },\n [onChange, rangeValues, selectedColors]\n );\n\n const handleAddRange = React.useCallback((): void => {\n // TODO(fkurniawan): figure out how to determine value of newly added range\n const newRangeValues = [...rangeValues, rangeValues[rangeValues.length - 1] + 10];\n const newSelectedColors = customizedColors\n ? [...selectedColors, '#000000'] // insert black color as per design if colors are customized\n : getNewColors({\n isReversed,\n // there is one more color than there are range boundaries\n numColors: newRangeValues.length + 1,\n precedence,\n swatchColors,\n });\n onChange({ colors: newSelectedColors, rangeValues: newRangeValues });\n }, [onChange, rangeValues, customizedColors, selectedColors, isReversed, precedence, swatchColors]);\n\n const handleReverse = React.useCallback((): void => {\n const newColors = [...selectedColors];\n newColors.reverse();\n setIsReversed(!isReversed);\n onChange({ colors: newColors, rangeValues });\n }, [onChange, rangeValues, isReversed, selectedColors, setIsReversed]);\n\n const handleUpdateRangeBoundary = React.useCallback(\n (updatedValue, rangeBoundaryIndex): { error: string } => {\n if (rangeValues.includes(updatedValue)) {\n return { error: _('Value already exists') };\n }\n const newRangeValues = [...rangeValues];\n newRangeValues[rangeBoundaryIndex] = updatedValue;\n newRangeValues.sort((a, b): number => a - b);\n onChange({ colors: selectedColors, rangeValues: newRangeValues });\n return { error: null };\n },\n [onChange, selectedColors, rangeValues]\n );\n\n const handleRemoveRange = React.useCallback(\n (colorIndex: number, rangeBoundaryIndex: number): void => {\n if (rangeValues.length > 1) {\n const newRangeValues = [...rangeValues];\n newRangeValues.splice(rangeBoundaryIndex, 1);\n\n // check if there are still custom colors after the user removes the current one\n const newSelectedColorsWithCurrentOmitted = [...selectedColors];\n newSelectedColorsWithCurrentOmitted.splice(colorIndex, 1);\n\n const newSelectedColors = hasCustomColors({\n currentSwatchColors: swatchColors,\n selectedColors: newSelectedColorsWithCurrentOmitted,\n })\n ? newSelectedColorsWithCurrentOmitted\n : getNewColors({\n isReversed,\n // there is one more color than there are range boundaries\n numColors: newRangeValues.length + 1,\n precedence,\n swatchColors,\n });\n\n onChange({ colors: newSelectedColors, rangeValues: newRangeValues });\n }\n },\n [isReversed, onChange, precedence, rangeValues, selectedColors, swatchColors]\n );\n\n return (\n <RangeValueConfigurerWrapper>\n <AddAndReverseRanges\n // TODO(fkurniawan): CTA if the user wishes to configure more than 7 ranges\n // the info state should tell users that anything > 7 ranges should be added via source\n disableAddRanges={selectedColors.length > 6}\n handleAddRange={handleAddRange}\n handleReverse={handleReverse}\n />\n <RangesWrapper>\n {selectedColors.map((color: string, i: number): React.ReactElement => {\n // there is always one more color than the number of range boundaries (unless there is only one range)\n // the customizable rangeBoundaryIndex corresponds to one less than the current selectedColor index\n const isLastItem = i === selectedColors.length - 1;\n const rangeBoundaryIndex = i > 0 ? i - 1 : 0;\n const rangeBoundaryValue = rangeValues[rangeBoundaryIndex];\n\n return (\n <RangeEntry key={`${color}-${rangeBoundaryValue}`}>\n <RangeColor\n color={color}\n colorIndex={i}\n palette={swatchColors}\n onChange={handleColorChange}\n />\n <RangeBoundary\n initialValue={rangeBoundaryValue}\n rangeBoundaryIndex={rangeBoundaryIndex}\n rangeText={getRangeText({\n lastColorIndex: selectedColors.length - 1,\n rangeBoundaryIndex: i,\n rangeValues,\n })}\n // unfortunately RangeBoundary has to know adjacent rangeValues if the user tries to address duplicates by changing an adjacent range\n // (instead of changing the currently errored RangeBoundary)\n rangeValues={rangeValues}\n showNumberEditor={isLastItem || i > 0}\n updateRangeBoundary={handleUpdateRangeBoundary}\n />\n <RemoveRange\n colorIndex={i}\n disabled={rangeValues.length < 2}\n onRemove={handleRemoveRange}\n rangeBoundaryIndex={rangeBoundaryIndex}\n />\n </RangeEntry>\n );\n })}\n </RangesWrapper>\n </RangeValueConfigurerWrapper>\n );\n};\n\nRangeValueConfigurer.propTypes = {\n customizedColors: T.bool,\n isReversed: T.bool,\n precedence: T.arrayOf(T.arrayOf(T.number)),\n swatchColors: T.arrayOf(T.string),\n rangeValues: T.arrayOf(T.number),\n setIsReversed: T.func,\n selectedColors: T.arrayOf(T.string),\n};\n\nexport default RangeValueConfigurer;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport type { ButtonProps } from '@splunk/react-ui/Button';\nimport Button from '@splunk/react-ui/Button';\nimport CloseIcon from '@splunk/react-icons/Cross';\nimport { variables } from '@splunk/themes';\n\nconst RemoveRangeWrapper = styled.div`\n display: flex;\n flex: 1;\n justify-content: flex-end;\n`;\n\nconst RemoveRangeButton = styled(Button)<ButtonProps>`\n color: ${props =>\n props.disabled ? variables.contentColorDisabled : variables.contentColorActive} !important;\n &:hover {\n background-color: ${props => !props.disabled && variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nconst RemoveRange = ({\n colorIndex,\n disabled = false,\n onRemove,\n rangeBoundaryIndex,\n}: {\n colorIndex: number;\n disabled?: boolean;\n onRemove: (colorIdx: number, rangeBoundaryIdx: number) => void;\n rangeBoundaryIndex: number;\n}): React.ReactElement => {\n const handleOnRemove = React.useCallback(\n (): void => onRemove(colorIndex, rangeBoundaryIndex),\n [colorIndex, onRemove, rangeBoundaryIndex]\n );\n\n return (\n <RemoveRangeWrapper>\n <div>\n <RemoveRangeButton\n data-test=\"range-remove-button\"\n disabled={disabled}\n icon={<CloseIcon />}\n appearance=\"subtle\"\n onClick={handleOnRemove}\n />\n </div>\n </RemoveRangeWrapper>\n );\n};\n\nRemoveRange.propTypes = {\n disabled: T.bool,\n onRemove: T.func,\n};\n\nexport default RemoveRange;\n","import { isEmpty } from 'lodash';\nimport type { RangesConfig } from '@splunk/visualization-encoding/formatters/RangeValue';\n\n/*\n * @method getSortedRanges\n * @params {Array} ranges\n * @return {Array} sorted ranges\n */\nexport const getSortedRanges = (ranges = []): RangesConfig[] => {\n if (isEmpty(ranges)) {\n return [\n { to: 0, value: '#f00' },\n { from: 0, value: '#0f0' },\n ];\n }\n const rangesToSort = [...ranges];\n rangesToSort.sort((a, b): number => {\n if (a.to == null) return 1;\n if (b.to == null) return -1;\n return +a.to - +b.to;\n });\n return rangesToSort;\n};\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport defaultPalettes from '@splunk/visualization-color-palettes/editors/PresetPalettes';\nimport type { RangesConfig } from '@splunk/visualization-encoding/formatters/RangeValue';\nimport type { PalettesConfig } from '../../interfaces/PalettesConfig';\nimport PalettesConfigurer from './Palettes/PalettesConfigurer';\nimport RangeValueConfigurer from './RangeValue/RangeValueConfigurer';\nimport { getSortedRanges } from './RangeValue/rangeValueUtils';\nimport {\n getSwatchColorsFromPalette,\n getPrecedenceFromPalette,\n inferInitialPaletteFromContext,\n hasCustomColors,\n hasInitiallyReversedColors,\n} from './Palettes/paletteUtils';\nimport type { Palettes } from './Palettes/paletteUtils';\n\nconst getNewColorsFromPalette = ({\n palettes,\n paletteTheme,\n paletteInfo,\n rangeValues,\n setIsReversed,\n}): string[] => {\n const newSwatchColors = getSwatchColorsFromPalette({\n palettes,\n paletteInfo,\n paletteTheme,\n });\n const precedence = getPrecedenceFromPalette({\n palettes,\n paletteTheme,\n paletteInfo,\n });\n\n const newSelectedColors = precedence[rangeValues.length - 1].map(\n (colorIdx): string => newSwatchColors[colorIdx]\n );\n setIsReversed(false);\n return newSelectedColors;\n};\n\nexport const rangeValuesToContextConfig = ({ colors, rangeValues }): RangesConfig[] =>\n colors.map((color, i): RangesConfig => {\n const entry: RangesConfig = {\n value: color,\n };\n\n if (i > 0) {\n entry.from = rangeValues[i - 1];\n }\n if (i < colors.length - 1) {\n entry.to = rangeValues[i];\n }\n\n return entry;\n });\n\nconst RangeValueEditor = ({\n defaultPalettesConfig,\n onChange = () => undefined,\n palettes = defaultPalettes,\n selectedDataSelector,\n value,\n}: {\n defaultPalettesConfig: PalettesConfig;\n onChange?: (e: string, opt: string, payload: RangesConfig[]) => void;\n palettes?: Palettes;\n selectedDataSelector?: string;\n value: RangesConfig[] | null;\n}): React.ReactElement => {\n const sortedRanges = React.useMemo((): RangesConfig[] => getSortedRanges(value), [value]);\n\n const { rangeValues, selectedColors } = React.useMemo(\n () =>\n sortedRanges.reduce(\n (acc, next) => {\n if (typeof next.to === 'number') {\n acc.rangeValues.push(next.to);\n }\n acc.selectedColors.push(next.value);\n return acc;\n },\n { rangeValues: [], selectedColors: [] }\n ),\n [sortedRanges]\n );\n\n const [{ paletteTheme: selectedPaletteTheme, paletteEntry: selectedPaletteEntry }, setPalettesConfig] =\n React.useState<PalettesConfig>(() =>\n inferInitialPaletteFromContext({ defaultPalettesConfig, palettes, ranges: sortedRanges })\n );\n\n const currentSwatchColors = getSwatchColorsFromPalette({\n palettes,\n paletteInfo: selectedPaletteEntry,\n paletteTheme: selectedPaletteTheme,\n });\n\n const isSwatchCustomized = hasCustomColors({ currentSwatchColors, selectedColors });\n\n // we only want to calculate the initial reversed state when the RangeValueEditor opens since this is somewhat expensive\n // after this, the reversed state should be tracked internally by the editor itself\n\n const [isReversed, setIsReversed] = React.useState(() =>\n hasInitiallyReversedColors({\n isSwatchCustomized,\n palettes,\n selectedColors,\n selectedPaletteInfo: selectedPaletteEntry,\n selectedPaletteTheme,\n })\n );\n const calculateNewColors = React.useCallback(\n ({ paletteTheme, paletteInfo }): string[] => {\n // we don't have insertion orders if the user has gone beyond 6 range boundaries\n // in this case, the previously selected colors would be used\n // TODO(fkurniawan): A/C for more graceful state handling if more than 6 boundaries are configured\n if (rangeValues.length > 6) return selectedColors;\n return getNewColorsFromPalette({\n palettes,\n paletteTheme,\n paletteInfo,\n rangeValues,\n setIsReversed,\n });\n },\n [palettes, rangeValues, selectedColors]\n );\n\n const onChangePaletteTheme = React.useCallback(\n (newPaletteTheme): void => {\n const newColors = calculateNewColors({\n paletteTheme: newPaletteTheme,\n paletteInfo: selectedPaletteEntry,\n });\n setPalettesConfig(prev => ({ ...prev, paletteTheme: newPaletteTheme }));\n const newRanges = rangeValuesToContextConfig({ colors: newColors, rangeValues });\n onChange(null, null, newRanges);\n },\n [calculateNewColors, selectedPaletteEntry, rangeValues, onChange]\n );\n\n const onPaletteChange = React.useCallback(\n (newPaletteInfo): void => {\n const newColors = calculateNewColors({\n paletteTheme: selectedPaletteTheme,\n paletteInfo: newPaletteInfo,\n });\n setPalettesConfig(prev => ({ ...prev, paletteEntry: newPaletteInfo }));\n const newRanges = rangeValuesToContextConfig({ colors: newColors, rangeValues });\n onChange(null, null, newRanges);\n },\n [calculateNewColors, selectedPaletteTheme, rangeValues, onChange]\n );\n\n const handleOnRangeValueChange = React.useCallback(\n ({ colors, rangeValues: newRangeValues }): void => {\n const newRanges = rangeValuesToContextConfig({ colors, rangeValues: newRangeValues });\n onChange(null, null, newRanges);\n },\n [onChange]\n );\n\n // if the user changes the dataSelector (e.g. from major to trend) for something like background coloring,\n // reinitialize the palette config and the initial range values + colors using the newly selected formatter config (value)\n React.useEffect((): void => {\n setPalettesConfig(\n inferInitialPaletteFromContext({\n defaultPalettesConfig,\n palettes,\n ranges: sortedRanges,\n })\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedDataSelector]);\n\n return (\n <>\n <PalettesConfigurer\n isReversed={isReversed}\n isSwatchCustomized={isSwatchCustomized}\n onChangePaletteTheme={onChangePaletteTheme}\n onPaletteChange={onPaletteChange}\n palettes={palettes}\n selectedPaletteInfo={selectedPaletteEntry}\n selectedPaletteTheme={selectedPaletteTheme}\n />\n <RangeValueConfigurer\n customizedColors={isSwatchCustomized}\n isReversed={isReversed}\n onChange={handleOnRangeValueChange}\n precedence={getPrecedenceFromPalette({\n palettes,\n paletteTheme: selectedPaletteTheme,\n paletteInfo: selectedPaletteEntry,\n })}\n rangeValues={rangeValues}\n selectedColors={selectedColors}\n swatchColors={currentSwatchColors}\n setIsReversed={setIsReversed}\n />\n </>\n );\n};\n\nRangeValueEditor.propTypes = {\n /**\n * An onChange callback that allows the editor to customize the context accordingly based on the new thresholds\n */\n onChange: T.func,\n /**\n * The palettes object\n *\n * This consists of a theme and each themed-variant of the palettes\n */\n palettes: T.objectOf(\n T.shape({\n precedence: T.arrayOf(T.arrayOf(T.number)),\n swatches: T.arrayOf(T.arrayOf(T.string)),\n })\n ),\n /**\n * The initial ranges config from the viz context\n */\n value: T.any,\n};\n\nexport default RangeValueEditor;\n","import React, { useMemo } from 'react';\nimport type { RangesConfig } from '@splunk/visualization-encoding/formatters/RangeValue';\nimport ArrowLayer from '../../shared/ArrowLayer';\nimport { ColorPreview } from './ColorPreview';\nimport type { BasePreviewProps } from '../../interfaces/BasePreviewProps';\nimport PreviewWrapper from '../../shared/PreviewWrapper';\nimport { getSortedRanges } from './RangeValue/rangeValueUtils';\n\nconst MAX_PREVIEW_COLOR_COUNT = 8;\ninterface RangeValuePreviewProps extends BasePreviewProps {\n config: RangesConfig[];\n}\n\n/**\n * Range value previews always to map to colors\n */\nexport const RangeValuePreview: React.FunctionComponent<RangeValuePreviewProps> = ({\n config,\n}): React.ReactElement => {\n const sortedRanges = useMemo(() => getSortedRanges(config), [config]);\n const colors = useMemo(\n () => sortedRanges.map((entry): string => entry.value).slice(0, MAX_PREVIEW_COLOR_COUNT),\n [sortedRanges]\n );\n return (\n <PreviewWrapper>\n <ArrowLayer />\n <ColorPreview data-test=\"ColorPreview\" colors={colors} maxColorCount={MAX_PREVIEW_COLOR_COUNT} />\n </PreviewWrapper>\n );\n};\n","import * as React from 'react';\nimport { isEmpty } from 'lodash';\nimport styled from 'styled-components';\nimport Select from '@splunk/react-ui/Select';\nimport FormatFieldName from '../../shared/FormatFieldName';\nimport { getFilteredFields } from '../../utils/columnSelectionUtils';\nimport type { FieldTuple } from '../../utils/columnSelectionUtils';\nimport { useColumnSelectorFooterMessage } from '../useColumnSelectorFooterMessage';\n\nconst StyledSelectOption = styled(Select.Option)`\n padding-left: 20px;\n`;\n\nStyledSelectOption.displayName = 'ColumnOption';\n\nconst getLabelName = (name, type): string => (name !== '_time' ? `${name} - ${type}` : name);\n\ninterface AddColumnProps {\n availableFieldsWithTypes: FieldTuple[];\n columnFormatting;\n disableToggle: boolean;\n editorSupportedFormatOptions: {\n [type: string]: {\n [formatOption: string]: string;\n };\n };\n handleAddColumnFormatting: (e: Event, payload: { value: FieldTuple }) => void;\n placeholderMessage: string;\n}\n\nconst AddColumn: React.FunctionComponent<AddColumnProps> = ({\n availableFieldsWithTypes,\n columnFormatting,\n disableToggle,\n editorSupportedFormatOptions,\n handleAddColumnFormatting,\n placeholderMessage,\n}): React.ReactElement => {\n const [filter, setFilter] = React.useState('');\n const filteredFields = getFilteredFields(availableFieldsWithTypes, filter);\n const handleFilterChange = React.useCallback((e, { keyword }): void => {\n setFilter(keyword);\n }, []);\n\n const footerMessage = useColumnSelectorFooterMessage({\n availableFields: availableFieldsWithTypes,\n filteredFields,\n filter,\n noSelectedFieldsInfo: true,\n });\n const handleAddColumn = React.useCallback(\n (e, { value }): void => {\n const tuple: FieldTuple = availableFieldsWithTypes.find(field => field.name === value);\n handleAddColumnFormatting(e, { value: tuple });\n },\n [availableFieldsWithTypes, handleAddColumnFormatting]\n );\n\n return (\n <Select\n data-test=\"add-column-toggle\"\n disabled={disableToggle}\n filter\n footerMessage={footerMessage}\n inline={false}\n onFilterChange={handleFilterChange}\n onChange={handleAddColumn}\n placeholder={placeholderMessage}\n value={placeholderMessage}\n >\n {filteredFields.map((field): React.ReactElement => {\n const label = getLabelName(field.name, field.type);\n return (\n <StyledSelectOption\n data-test={`add-column-option-${label}`}\n disabled={\n !!columnFormatting.get(field.name) ||\n isEmpty(editorSupportedFormatOptions[field.type])\n }\n label={label}\n key={field.name}\n value={field.name}\n >\n <FormatFieldName columnName={field.name} dataType={field.type} />\n </StyledSelectOption>\n );\n })}\n </Select>\n );\n};\n\nexport default AddColumn;\n","import * as React from 'react';\nimport { ThemeContext } from 'styled-components';\nimport { cloneDeep, get, isEmpty, isPlainObject, set } from 'lodash';\nimport { isColor } from '@splunk/visualizations-shared/colorUtils';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport EncodingParser from '@splunk/visualization-encoding/EncodingParser';\nimport type { BaseEditorProps } from '../../interfaces/BaseEditorProps';\nimport ColorEditor from '../ColorEditor';\nimport CheckboxEditor from '../CheckboxEditor';\n\ninterface ThemeObject {\n defaultBackgroundColor?: string;\n}\n\ntype ThemesConfig = {\n defaultBackgroundColor?: (args: { theme: ThemeObject }) => string | undefined;\n} & Record<string, unknown>;\n\nexport interface TableBackgroundColorEditorProps extends BaseEditorProps {\n palette?: string[];\n themes?: ThemesConfig;\n}\n\n// Intrinsic dependency on table's default context. Any changes can break the editor.\n\nexport const FLAT_BY_THEME = '> table | seriesByIndex(0) | pick(tableRowBackgroundColorsByTheme)';\nexport const ALT_BY_THEME = '> table | seriesByIndex(0) | pick(tableAltRowBackgroundColorsByTheme)';\n\nexport const FLAT_BY_COLOR = '> table | seriesByIndex(0) | pick(tableRowBackgroundColorsByBackgroundColor)';\nexport const ALT_BY_COLOR = '> table | seriesByIndex(0) | pick(tableAltRowBackgroundColorsByBackgroundColor)';\n\nexport const HEADER_BACKGROUND_BY_COLOR =\n '> backgroundColor | setColorChannel(tableHeaderBackgroundColorConfig)';\nexport const ROW_COLOR_BY_CONTRAST = '> rowBackgroundColors | maxContrast(tableRowColorMaxContrast)';\nexport const HEADER_COLOR_BY_CONTRAST = '> headerBackgroundColor | maxContrast(tableRowColorMaxContrast)';\n\nexport const DEFAULT_BACKGROUND_COLOR = '> themes.defaultBackgroundColor';\n\ntype Option = string | number | boolean | null;\ntype Options = Record<string, Option | Record<string, Option>>;\n\ninterface CalculateStateArgs {\n options?: Options;\n value?: string;\n defaultBackgroundColor?: string;\n}\ninterface State {\n color: string;\n disableColor: boolean;\n shouldAltRows: boolean;\n disableAltRows: boolean;\n}\n\nexport const calculateState = ({\n options = {},\n value,\n defaultBackgroundColor,\n}: CalculateStateArgs = {}): State => {\n let color;\n let disableColor = false;\n let shouldAltRows = false;\n let disableAltRows = false;\n\n const backgroundColor = get(options, 'backgroundColor');\n const rowBackgroundColors = get(options, 'tableFormat.rowBackgroundColors', ALT_BY_THEME);\n\n if (isColor(backgroundColor)) {\n color = backgroundColor;\n } else if (EncodingParser.isDslString(backgroundColor) && !isColor(value)) {\n disableColor = true;\n } else if (isColor(value)) {\n color = value;\n } else if (isColor(defaultBackgroundColor)) {\n color = defaultBackgroundColor;\n }\n\n if (rowBackgroundColors === ALT_BY_COLOR || rowBackgroundColors === ALT_BY_THEME) {\n shouldAltRows = true;\n } else if (rowBackgroundColors === FLAT_BY_THEME || rowBackgroundColors === FLAT_BY_COLOR) {\n shouldAltRows = false;\n } else if (!isEmpty(rowBackgroundColors)) {\n disableAltRows = true;\n }\n\n return { color, disableColor, shouldAltRows, disableAltRows };\n};\ninterface OptionsObj {\n options: Options;\n}\ninterface CalculateOptionForBG {\n options?: Options;\n value?: string;\n defaultThemeBackgroundColor?: string;\n}\n\nexport const calculateOptionOnBackgroundColorChange = ({\n options = {},\n value,\n defaultThemeBackgroundColor,\n}: CalculateOptionForBG = {}): OptionsObj => {\n const newOptions = cloneDeep(options);\n const rowBackgroundColors = get(newOptions, 'tableFormat.rowBackgroundColors', ALT_BY_THEME);\n const rowColors = get(newOptions, 'tableFormat.rowColors');\n const headerColor = get(newOptions, 'tableFormat.headerColor');\n\n const headerBackgroundColor = get(newOptions, 'tableFormat.headerBackgroundColor');\n\n if (value && value === defaultThemeBackgroundColor) {\n set(newOptions, 'backgroundColor', DEFAULT_BACKGROUND_COLOR);\n if (rowBackgroundColors === ALT_BY_COLOR) {\n set(newOptions, 'tableFormat.rowBackgroundColors', ALT_BY_THEME);\n }\n if (rowColors === ROW_COLOR_BY_CONTRAST) {\n set(newOptions, 'tableFormat.rowColors', null);\n }\n if (headerBackgroundColor === HEADER_BACKGROUND_BY_COLOR) {\n set(newOptions, 'tableFormat.headerBackgroundColor', null);\n }\n if (headerColor === HEADER_COLOR_BY_CONTRAST) {\n set(newOptions, 'tableFormat.headerColor', null);\n }\n } else if (value && isColor(value)) {\n set(newOptions, 'backgroundColor', value);\n if (rowBackgroundColors === ALT_BY_THEME) {\n set(newOptions, 'tableFormat.rowBackgroundColors', ALT_BY_COLOR);\n } else if (rowBackgroundColors === FLAT_BY_THEME) {\n set(newOptions, 'tableFormat.rowBackgroundColors', FLAT_BY_COLOR);\n }\n if (isEmpty(headerBackgroundColor)) {\n set(newOptions, 'tableFormat.headerBackgroundColor', HEADER_BACKGROUND_BY_COLOR);\n }\n if (isEmpty(rowColors)) {\n set(newOptions, 'tableFormat.rowColors', ROW_COLOR_BY_CONTRAST);\n }\n if (isEmpty(headerColor)) {\n set(newOptions, 'tableFormat.headerColor', HEADER_COLOR_BY_CONTRAST);\n }\n }\n\n if (newOptions.tableFormat && isPlainObject(newOptions.tableFormat) && isEmpty(newOptions.tableFormat)) {\n set(newOptions, 'tableFormat', null);\n }\n\n return { options: newOptions };\n};\n\ninterface CalculateOptionsForAltRows {\n options?: Options;\n value?: boolean;\n}\n\nexport const calculateOptionsOnAltRowsChange = ({\n options = {},\n value,\n}: CalculateOptionsForAltRows = {}): OptionsObj => {\n const newOptions = cloneDeep(options);\n\n const backgroundColor = get(options, 'backgroundColor');\n const rowBackgroundColors = get(options, 'tableFormat.rowBackgroundColors', ALT_BY_THEME);\n const rowColors = get(options, 'tableFormat.rowColors');\n const headerColor = get(options, 'tableFormat.headerColor');\n const headerBackgroundColor = get(options, 'tableFormat.headerBackgroundColor');\n\n if (backgroundColor === DEFAULT_BACKGROUND_COLOR || backgroundColor === undefined) {\n if (\n typeof value === 'boolean' &&\n [ALT_BY_THEME, ALT_BY_COLOR, FLAT_BY_COLOR, FLAT_BY_THEME].includes(rowBackgroundColors)\n ) {\n set(newOptions, 'tableFormat.rowBackgroundColors', value === true ? ALT_BY_THEME : FLAT_BY_THEME);\n }\n } else {\n if (\n typeof value === 'boolean' &&\n [ALT_BY_THEME, ALT_BY_COLOR, FLAT_BY_COLOR, FLAT_BY_THEME].includes(rowBackgroundColors)\n ) {\n set(newOptions, 'tableFormat.rowBackgroundColors', value ? ALT_BY_COLOR : FLAT_BY_COLOR);\n }\n if (isEmpty(rowColors)) {\n set(newOptions, 'tableFormat.rowColors', ROW_COLOR_BY_CONTRAST);\n }\n if (isEmpty(headerBackgroundColor)) {\n set(newOptions, 'tableFormat.headerBackgroundColor', HEADER_BACKGROUND_BY_COLOR);\n }\n if (isEmpty(headerColor)) {\n set(newOptions, 'tableFormat.headerColor', HEADER_COLOR_BY_CONTRAST);\n }\n }\n return { options: newOptions };\n};\n\nexport const TableBackgroundColorEditor: React.FunctionComponent<TableBackgroundColorEditorProps> = ({\n options,\n onChange,\n labelPosition = 'left',\n labelWidth,\n value,\n palette,\n themes,\n}): React.ReactElement => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const theme: ThemeObject = React.useContext(ThemeContext) || {};\n\n const handleColorChange = React.useCallback(\n (event, editor, val): void => {\n const defaultThemeBackgroundColor =\n typeof themes?.defaultBackgroundColor === 'function'\n ? themes?.defaultBackgroundColor({ theme })\n : undefined;\n onChange(\n event,\n calculateOptionOnBackgroundColorChange({ options, value: val, defaultThemeBackgroundColor })\n );\n },\n [themes, theme, onChange, options]\n );\n\n const handleAltChange = React.useCallback(\n (event, editor, val): void => {\n onChange(event, calculateOptionsOnAltRowsChange({ options, value: val }));\n },\n [options, onChange]\n );\n\n const { color, disableColor, shouldAltRows, disableAltRows } = calculateState({\n options,\n value,\n defaultBackgroundColor: theme.defaultBackgroundColor,\n });\n return (\n <>\n <ColorEditor\n name=\"backgroundColor\"\n label={_('Background color')}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n itemSchema={{ default: theme.defaultBackgroundColor }}\n palette={\n Array.isArray(palette) && isColor(color) && !palette.includes(color)\n ? [...palette, color]\n : palette\n }\n value={color}\n isDisabled={disableColor}\n onChange={handleColorChange}\n />\n <CheckboxEditor\n name=\"alternateRowColors\"\n label={_('Alternate row colors')}\n labelPosition=\"right\"\n labelWidth={labelWidth}\n value={shouldAltRows}\n isDisabled={disableAltRows}\n itemSchema={{ type: 'boolean' }}\n onChange={handleAltChange}\n />\n </>\n );\n};\n","import * as React from 'react';\nimport { get, upperFirst } from 'lodash';\nimport styled, { ThemeContext } from 'styled-components';\nimport * as T from 'prop-types';\nimport { getLastFormatterFromDSL } from '@splunk/visualization-encoding/utils/dsl';\nimport { defaultPalettesConfig as initialPalettesConfig } from '@splunk/visualization-color-palettes/editors/PresetPalettes';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport RadioBar from '@splunk/react-ui/RadioBar';\nimport { toPx } from '@splunk/visualizations-shared/style';\nimport { FLYOUT_PADDING } from '../../shared/dimensionConstants';\nimport { FormatterEditor } from '../formatters/FormatterEditor';\nimport ColorEditor from '../ColorEditor';\nimport { columnColoringConfigPropType } from './common/props';\nimport type { ColumnColoringConfig } from './common/props';\nimport { sanitizeColumnName } from './columnFormattingUtils';\nimport type { ColumnColoringState } from '../../interfaces/ColumnFormatter';\nimport type { PalettesConfig } from '../../interfaces/PalettesConfig';\nimport type { FormatterUiConfig } from '../formatters/FormatterEditor';\n\nconst ColumnColorEditorWrapper = styled.div`\n padding: 14px ${toPx(FLYOUT_PADDING)};\n`;\n\nconst FormatterMethodWrapper = styled.div`\n margin-bottom: 8px;\n`;\n\n// TODO(fkurniawan): figure out if more complex data selectors are needed for Table DSL\n// currently, all column coloring dataSelectors are of the format `> table | seriesByName() | `\nconst dataSelectors = [];\n\ninterface ColumnColorEditorPropsInterface {\n columnColoring?: ColumnColoringState;\n columnColoringConfig: ColumnColoringConfig;\n columnName: string;\n columnDataType: string;\n defaultPalettesConfig?: PalettesConfig;\n // isSourceCustomized: boolean; TODO(fkurniawan): handle in follow up for source-customized column coloring\n handleColumnColoringUpdate: ({ columnName, coloringTypes, dynamicallyColoredOption }) => void;\n label?: string;\n}\n\nconst propTypes: Record<keyof ColumnColorEditorPropsInterface, T.Validator<any>> = {\n columnColoring: T.any,\n columnColoringConfig: columnColoringConfigPropType,\n columnName: T.string,\n columnDataType: T.string,\n defaultPalettesConfig: T.any,\n // isSourceCustomized: T.bool,\n handleColumnColoringUpdate: T.func,\n label: T.string,\n};\n\n// TODO(fkurniawan): need to address 'customized in source' if the user configures alternating colors\n// this would have a config like ['#000000', '#FF0000']\nexport const getStaticColor = (\n columnColoring = {},\n coloringType = '',\n themeContext = undefined,\n themes = undefined\n): string => {\n const formatter = getLastFormatterFromDSL(get(columnColoring, [coloringType, 'colorOptionDSL']));\n if (get(formatter, 'type') === 'pick') {\n // colorContextConfig should be array for pick\n return get(columnColoring, [coloringType, 'colorContextConfig', 0]);\n }\n return typeof themes?.textColor === 'function' ? themes?.textColor({ theme: themeContext }) : '#000000';\n};\n\n// retrieve the appropriate formatter type upon opening the Column Formatting UI:\n// parses DSL for the formatter, and if undefined, defaults to the first available formatter\n// first available formatter for `number`-typed columns is the RangeValue formatter; for `string`, the MatchValue formatter\nexport const getSelectedFormatterUponOpen = (\n columnColoring = {},\n formatters: FormatterUiConfig[] = []\n): FormatterUiConfig => {\n const dynamicallyColoredOption = get(columnColoring, ['_meta', 'dynamicallyColoredOption']);\n const selectedFormatterFromDSL = getLastFormatterFromDSL(\n get(columnColoring, [dynamicallyColoredOption, 'colorOptionDSL'])\n );\n\n // if no formatter has been defined for this option, return formatters[0]\n if (selectedFormatterFromDSL === undefined) {\n return get(formatters, [0]);\n }\n\n // finds the formatter based on type (`rangeValue`/`matchValue`) in DSL\n return formatters.find(formatterOption => formatterOption.value === selectedFormatterFromDSL.type);\n};\n\nconst ColumnColorEditor: React.FunctionComponent<ColumnColorEditorPropsInterface> = ({\n columnColoring,\n columnColoringConfig,\n columnDataType,\n columnName,\n defaultPalettesConfig = initialPalettesConfig,\n handleColumnColoringUpdate,\n label = _('Dynamic coloring'),\n}): React.ReactElement => {\n const theme = React.useContext(ThemeContext);\n const { coloringTypes, themes } = columnColoringConfig;\n\n // if column is of data type `string`, only expose MatchValue formatter\n const formatters = React.useMemo(\n () =>\n columnDataType === 'string'\n ? columnColoringConfig.formatters.filter(formatter => formatter.value === 'matchValue')\n : columnColoringConfig.formatters,\n [columnDataType, columnColoringConfig]\n );\n\n // only Text has static coloring support (i.e. rowColors)\n const staticTextColor = getStaticColor(columnColoring, 'rowColors', theme, themes);\n const dynamicallyColoredOptionFromDef = get(columnColoring, ['_meta', 'dynamicallyColoredOption']);\n\n const [selectedFormatter, setSelectedFormatter] = React.useState(\n getSelectedFormatterUponOpen(columnColoring, formatters)\n );\n\n const [dynamicallyColoredOption, setDynamicallyColoredOption] = React.useState(\n dynamicallyColoredOptionFromDef\n );\n const [formatterConfig, setFormatterConfig] = React.useState(\n get(columnColoring, [dynamicallyColoredOption, 'colorContextConfig'])\n );\n\n const handleDynamicallyColoredOptionChange = React.useCallback(\n (e, { value: newDynamicallyColoredOption }): void => {\n // multiple color options have to be updated when changing the type\n const updatedColoringTypes = [];\n const sanitizedColName = sanitizeColumnName(columnName);\n\n // handle side effects here\n // e.g. if rowBackgroundColors is the new dynamically powered color, rowColors becomes statically powered (by pick)\n switch (newDynamicallyColoredOption) {\n case 'Off':\n coloringTypes.forEach(({ value: coloringType }) => {\n // we need the colorContextKey stored separately from the DSL\n // since we delete DSL by setting it to undefined, we need know which corresponding contextKey needs to be cleared\n updatedColoringTypes.push({\n coloringType,\n colorContextKey: `${sanitizedColName}${upperFirst(coloringType)}EditorConfig`,\n colorOptionDSL: null,\n colorContextConfig: null,\n });\n });\n break;\n case 'rowBackgroundColors':\n updatedColoringTypes.push({\n coloringType: 'rowColors',\n colorContextKey: `${sanitizedColName}RowColorsEditorConfig`,\n colorContextConfig: [staticTextColor],\n colorOptionDSL: `> table | seriesByName('${columnName}') | pick(${sanitizedColName}RowColorsEditorConfig)`,\n });\n break;\n case 'rowColors':\n updatedColoringTypes.push({\n coloringType: 'rowBackgroundColors',\n colorContextKey: `${sanitizedColName}RowBackgroundColorsEditorConfig`,\n colorContextConfig: null,\n colorOptionDSL: null,\n });\n break;\n default:\n break;\n }\n\n // push the dynamically colored option as another color to update\n const { defaults, value: formatterName } = selectedFormatter;\n const newColorContextConfig = formatterConfig || defaults[newDynamicallyColoredOption];\n if (newDynamicallyColoredOption !== 'Off') {\n // e.g. column1RowColorsEditorConfig\n const colorContextKey = `${sanitizedColName}${upperFirst(\n newDynamicallyColoredOption\n )}EditorConfig`;\n updatedColoringTypes.push({\n coloringType: newDynamicallyColoredOption,\n colorContextKey,\n colorContextConfig: newColorContextConfig,\n colorOptionDSL: `> table | seriesByName('${columnName}') | ${formatterName}(${colorContextKey})`,\n });\n }\n\n setDynamicallyColoredOption(newDynamicallyColoredOption);\n handleColumnColoringUpdate({\n columnName,\n coloringTypes: updatedColoringTypes,\n dynamicallyColoredOption: newDynamicallyColoredOption,\n });\n if (!formatterConfig) {\n // persist formatter config state when switching options if there was no pre-existing dynamic coloring\n setFormatterConfig(newColorContextConfig);\n }\n },\n [\n coloringTypes,\n columnName,\n formatterConfig,\n handleColumnColoringUpdate,\n selectedFormatter,\n staticTextColor,\n ]\n );\n\n const handleStaticColorChange = React.useCallback(\n (e, coloringType, value) => {\n const colorContextKey = `${sanitizeColumnName(columnName)}${upperFirst(\n coloringType\n )}EditorConfig`;\n handleColumnColoringUpdate({\n columnName,\n coloringTypes: [\n {\n coloringType,\n colorContextKey,\n colorContextConfig: [value],\n colorOptionDSL: `> table | seriesByName(\"${columnName}\") | pick(${colorContextKey})`,\n },\n ],\n dynamicallyColoredOption,\n });\n },\n [columnName, dynamicallyColoredOption, handleColumnColoringUpdate]\n );\n\n const handleFormatterConfigChange = React.useCallback(\n (_e, _editorName, newColorContextConfig): void => {\n const { value: formatterName } = selectedFormatter;\n const colorContextKey = `${sanitizeColumnName(columnName)}${upperFirst(\n dynamicallyColoredOption\n )}EditorConfig`;\n setFormatterConfig(newColorContextConfig);\n handleColumnColoringUpdate({\n columnName,\n coloringTypes: [\n {\n coloringType: dynamicallyColoredOption,\n colorContextKey,\n colorContextConfig: newColorContextConfig,\n colorOptionDSL: `> table | seriesByName(\"${columnName}\") | ${formatterName}(${colorContextKey})`,\n },\n ],\n dynamicallyColoredOption,\n });\n },\n [columnName, dynamicallyColoredOption, handleColumnColoringUpdate, selectedFormatter]\n );\n\n // TODO(fkurniawan): handle multiple formatters when number has high/low editor; currently only RangeValueEditor is present\n const handleFormatterChange = React.useCallback(\n (evt, name, formatterValue): void => {\n const newlySelectedFormatter = formatters.find(formatter => formatter.value === formatterValue);\n const { defaults } = newlySelectedFormatter;\n\n const newColorContextConfig = defaults[dynamicallyColoredOption];\n const colorContextKey = `${sanitizeColumnName(columnName)}${upperFirst(\n dynamicallyColoredOption\n )}EditorConfig`;\n\n // update the formatter and its respective config\n setSelectedFormatter(newlySelectedFormatter);\n setFormatterConfig(newColorContextConfig);\n handleColumnColoringUpdate({\n columnName,\n coloringTypes: [\n {\n coloringType: dynamicallyColoredOption,\n colorContextKey,\n colorContextConfig: newColorContextConfig,\n colorOptionDSL: `> table | seriesByName(\"${columnName}\") | ${formatterValue}(${colorContextKey})`,\n },\n ],\n dynamicallyColoredOption,\n });\n },\n [formatters, columnName, dynamicallyColoredOption, handleColumnColoringUpdate, setFormatterConfig]\n );\n\n return (\n <ColumnColorEditorWrapper>\n <ControlGroup label={_(label)} labelPosition=\"top\">\n <RadioBar\n data-test=\"dynamic-color-option\"\n onChange={handleDynamicallyColoredOptionChange}\n value={dynamicallyColoredOption}\n >\n <RadioBar.Option value=\"Off\" label={_('Off')} />\n {coloringTypes.map(({ label: optionLabel, value }) => (\n <RadioBar.Option value={value} label={_(optionLabel)} key={value} />\n ))}\n </RadioBar>\n </ControlGroup>\n {dynamicallyColoredOption && dynamicallyColoredOption !== 'Off' && (\n <>\n {formatters.length === 1 && (\n <FormatterMethodWrapper data-test=\"single-formatter-method\">\n Method: {selectedFormatter.label}\n </FormatterMethodWrapper>\n )}\n <FormatterEditor\n selectedDataSelector={dynamicallyColoredOption}\n selectedFormatterType={selectedFormatter.value}\n currentFormatterConfig={formatterConfig}\n onFormatterTypeChange={handleFormatterChange}\n onFormatterConfigChange={handleFormatterConfigChange}\n formatters={formatters}\n dataSelectors={dataSelectors}\n defaultPalettesConfig={defaultPalettesConfig}\n />\n {dynamicallyColoredOption === 'rowBackgroundColors' && (\n <ColorEditor\n name=\"rowColors\"\n value={staticTextColor}\n label={_('Static text color')}\n labelPosition=\"top\"\n onChange={handleStaticColorChange}\n textWidth=\"100%\"\n />\n )}\n </>\n )}\n </ColumnColorEditorWrapper>\n );\n};\n\nColumnColorEditor.propTypes = propTypes;\n\nexport default ColumnColorEditor;\n","import * as React from 'react';\nimport styled from 'styled-components';\nimport Popover from '@splunk/react-ui/Popover';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport { pick, variables } from '@splunk/themes';\nimport { toPx } from '@splunk/visualizations-shared/style';\nimport Pencil from '@splunk/react-icons/Pencil';\nimport TrashCanCross from '@splunk/react-icons/TrashCanCross';\nimport { _ } from '@splunk/ui-utils/i18n';\n\nimport ClickableIcon from '../../shared/ClickableIcon';\nimport FormatFieldName from '../../shared/FormatFieldName';\nimport Separator from '../../shared/Separator';\nimport { FLYOUT_WIDTH } from '../../shared/dimensionConstants';\nimport FormatByTypeEditor from './FormatByTypeEditor';\nimport ColumnColorEditor from './ColumnColorEditor';\nimport type { ColumnColoringConfig, FlyoutConfig } from './common/props';\nimport Header from '../../shared/Header';\nimport { TextDataType } from './columnFormattingUtils';\nimport type { ColumnColoringState, ColumnEntry } from '../../interfaces/ColumnFormatter';\n\n// TODO(fkurniawan): sync with updated UDF designs\nconst ColumnFormatterToggle = styled.div.attrs((props): { 'data-test': string } => ({\n 'data-test': props['data-test'],\n}))`\n flex: 1;\n display: flex;\n align-items: center;\n display: flex;\n justify-content: space-between;\n margin-bottom: 14px;\n padding-left: 15px;\n background-color: ${pick({\n enterprise: {\n light: variables.backgroundColorPage,\n dark: variables.backgroundColorSection,\n },\n prisma: variables.backgroundColorSection,\n })};\n color: transparent;\n &:last-of-type {\n margin-bottom: 4px;\n }\n`;\n\nconst PopoverContents = styled.div`\n background-color: ${variables.backgroundColorPopup};\n width: ${toPx(FLYOUT_WIDTH)};\n max-height: 95vh;\n overflow-y: auto;\n padding: 8px 0px;\n`;\n\nconst SelectedColumnLabel = styled.span`\n display: inline-block;\n`;\n\nconst IconsWrapper = styled.div`\n align-items: center;\n display: flex;\n`;\n\nconst StyledHeader = styled(Header)`\n cursor: auto;\n font-weight: 600;\n font-size: 14px;\n padding: 4px 16px;\n`;\n\nconst ColumnFormatterHeader = styled.span`\n font-weight: 500;\n font-size: 14px;\n margin-bottom: 7px;\n`;\n\ntype FlyoutConfigRows = FlyoutConfig[keyof FlyoutConfig];\n\ninterface ColumnTogglePropsInterface {\n columnColoring?: ColumnColoringState;\n columnColoringConfig: ColumnColoringConfig;\n columnFormattingByType: ColumnEntry['formatByType'];\n columnTextFormatting?: ColumnEntry['formatText'];\n columnName: string;\n columnDataType: string;\n defaultOptionsByType?: {\n [type: string]: {\n [option: string]: string | boolean | number;\n };\n };\n flyoutConfigForDataType: FlyoutConfigRows;\n textFormatConfig: FlyoutConfigRows;\n isSourceCustomized: boolean;\n removeColumnFormatting: (payload: { columnName: string; columnDataType: string }) => void;\n resetColumnToDefault: (payload: { columnName: string; columnDataType: string }) => void;\n updateColumnColoring: (payload: {\n columnName: string;\n coloringTypes: string[];\n dynamicallyColoredOption;\n }) => void;\n updateColumnFormatting: (payload: { columnName: string; optionName: string; value: string }) => void;\n updateColumnTextFormatting?: (payload: { columnName: string; optionName: string; value: string }) => void;\n}\n\nconst ColumnFormatterEntry: React.FunctionComponent<ColumnTogglePropsInterface> = ({\n columnColoring,\n columnColoringConfig,\n columnName,\n columnFormattingByType,\n columnTextFormatting,\n columnDataType,\n defaultOptionsByType = {},\n flyoutConfigForDataType,\n textFormatConfig,\n isSourceCustomized,\n removeColumnFormatting,\n resetColumnToDefault,\n updateColumnFormatting,\n updateColumnColoring,\n updateColumnTextFormatting,\n}): React.ReactElement => {\n const [flyoutOpen, setFlyoutOpen] = React.useState(false);\n const handleFlyoutOpen = React.useCallback((): void => setFlyoutOpen(true), []);\n const handleFlyoutClose = React.useCallback((): void => setFlyoutOpen(false), []);\n const anchor = React.useRef(null);\n\n const handleRemoveColumnFormatting = React.useCallback(\n (): void => removeColumnFormatting({ columnName, columnDataType }),\n [columnName, columnDataType, removeColumnFormatting]\n );\n\n const handleResetColumnToDefault = React.useCallback(\n (): void => resetColumnToDefault({ columnName, columnDataType }),\n [columnName, columnDataType, resetColumnToDefault]\n );\n\n return (\n <>\n <ColumnFormatterToggle ref={anchor} data-test={`column-toggle-${columnName}`}>\n <Tooltip data-test={`selected-column-label-${columnName}`}>\n <SelectedColumnLabel>\n <FormatFieldName columnName={columnName} dataType={columnDataType} />\n </SelectedColumnLabel>\n </Tooltip>\n <IconsWrapper>\n <ClickableIcon dataTestKey={`edit-column-icon-${columnName}`} onClick={handleFlyoutOpen}>\n <Pencil />\n </ClickableIcon>\n <ClickableIcon\n dataTestKey={`remove-column-icon-${columnName}`}\n onClick={handleRemoveColumnFormatting}\n >\n <TrashCanCross />\n </ClickableIcon>\n </IconsWrapper>\n </ColumnFormatterToggle>\n\n <Popover\n data-test={`column-formatter-flyout-${columnName}`}\n anchor={anchor.current}\n open={flyoutOpen}\n onRequestClose={handleFlyoutClose}\n appearance=\"normal\"\n defaultPlacement=\"horizontal\"\n >\n <PopoverContents data-test=\"popover-contents\">\n <StyledHeader>\n <ColumnFormatterHeader data-test=\"column-formatter-flyout-header\">\n {`${_('Column formatting')}: \"${columnName}\"`}\n </ColumnFormatterHeader>\n </StyledHeader>\n <FormatByTypeEditor\n columnFormatting={columnTextFormatting}\n columnDataType={TextDataType}\n columnName={columnName}\n defaultOptionsByType={defaultOptionsByType}\n flyoutConfigForDataType={textFormatConfig}\n handleResetColumnToDefault={handleResetColumnToDefault}\n updateColumnFormatting={updateColumnTextFormatting}\n isSourceCustomized={false}\n />\n <Separator />\n <FormatByTypeEditor\n columnFormatting={columnFormattingByType}\n columnDataType={columnDataType}\n columnName={columnName}\n defaultOptionsByType={defaultOptionsByType}\n flyoutConfigForDataType={flyoutConfigForDataType}\n handleResetColumnToDefault={handleResetColumnToDefault}\n updateColumnFormatting={updateColumnFormatting}\n isSourceCustomized={isSourceCustomized}\n />\n {(columnDataType === 'number' || columnDataType === 'string') && (\n <>\n <Separator />\n <ColumnColorEditor\n columnColoring={columnColoring}\n columnColoringConfig={columnColoringConfig}\n columnDataType={columnDataType}\n columnName={columnName}\n handleColumnColoringUpdate={updateColumnColoring}\n />\n </>\n )}\n </PopoverContents>\n </Popover>\n </>\n );\n};\n\nexport default ColumnFormatterEntry;\n","/**\n * Utility functions for table dynamic color operations\n */\n\n/**\n * Helper function to clear dynamic coloring based on current mode\n * @param colorMode - The current color mode ('background' or 'text')\n * @returns Object with the appropriate property set to undefined\n */\nexport const clearDynamicColoring = (colorMode: 'background' | 'text'): Record<string, any> => {\n const updates: Record<string, any> = {};\n if (colorMode === 'background') {\n updates.rowBackgroundColors = undefined;\n } else if (colorMode === 'text') {\n updates.rowColors = undefined;\n }\n return updates;\n};\n\n/**\n * Helper function to move DSL between background and text modes\n * @param fromMode - The mode to move from ('background' or 'text')\n * @param toMode - The mode to move to ('background' or 'text')\n * @param tableFormat - The table format object containing the DSL\n * @returns Object with DSL moved from one mode to another\n */\nexport const moveDslBetweenModes = (\n fromMode: 'background' | 'text',\n toMode: 'background' | 'text',\n tableFormat: Record<string, any>\n): Record<string, any> => {\n const fromKey = fromMode === 'background' ? 'rowBackgroundColors' : 'rowColors';\n const toKey = toMode === 'background' ? 'rowBackgroundColors' : 'rowColors';\n\n const dsl = tableFormat[fromKey] || '> table | gradient(tableFormatEditorConfig)';\n const processedDsl = dsl.replace(/tableFormatEditorConfig/g, 'tableFormatEditorConfig');\n\n return {\n [toKey]: processedDsl,\n [fromKey]: undefined,\n };\n};\n","import * as React from 'react';\nimport styled from 'styled-components';\nimport { get, isEmpty } from 'lodash';\nimport { toPx } from '@splunk/visualizations-shared/style';\nimport ColumnLayout from '@splunk/react-ui/ColumnLayout';\nimport CustomizedInSourceMessage from '../../shared/CustomizedInSourceMessage';\nimport { editorTypeToComponentMap } from '../../containers/EditorItem';\nimport { COLUMN_FLYOUT_PADDING } from '../../shared/dimensionConstants';\nimport { TextDataType } from './columnFormattingUtils';\nimport type { ColumnEntry } from '../../interfaces/ColumnFormatter';\nimport type { FlyoutConfig } from './common/props';\n\nconst rowKey = (row, rItr): string => `row_${row.map((i): string => i.option).join('_')}_${rItr}`;\n\nconst SUI_COL_SPAN_TOTAL = 12; // Each column defines in own span, but the total in a row must be 12\n\nconst FormatByTypeEditorContents = styled.div`\n padding: 12px ${toPx(COLUMN_FLYOUT_PADDING)};\n`;\n\ntype ColumnFormattingState = ColumnEntry['formatByType'] | ColumnEntry['formatText'] | undefined;\ntype FlyoutConfigRows = FlyoutConfig[keyof FlyoutConfig];\n\ninterface FormatByTypeEditorPropsInterface {\n columnFormatting?: ColumnFormattingState;\n columnName: string;\n columnDataType: string;\n defaultOptionsByType?: {\n [type: string]: {\n [option: string]: string | boolean | number;\n };\n };\n flyoutConfigForDataType: FlyoutConfigRows;\n isSourceCustomized: boolean;\n handleResetColumnToDefault: (payload: { columnName: string; columnDataType: string }) => void;\n updateColumnFormatting: (payload: { columnName: string; optionName: string; value: string }) => void;\n}\n\nexport const getEditorItemValue = (\n item: Record<string, unknown>,\n columnFormatting: ColumnFormattingState,\n columnDataType: string,\n defaultOptionsByType: FormatByTypeEditorPropsInterface['defaultOptionsByType']\n): number | string | boolean | undefined => {\n const editorPersistedValue =\n columnDataType === TextDataType\n ? get(columnFormatting, item.option)\n : get(columnFormatting, [columnDataType, item.option]);\n if (editorPersistedValue !== undefined) {\n return editorPersistedValue;\n }\n return get(defaultOptionsByType, [columnDataType, item.option]);\n};\n\n// TODO(fkurniawan): consolidate isCustomizedSourceMessage\n// currently, if ColumnColorEditor and FormatByTypeEditor are source-customized, two \"customized in source\" messages will appear\nconst FormatByTypeEditor: React.FunctionComponent<FormatByTypeEditorPropsInterface> = ({\n columnFormatting,\n columnDataType,\n columnName,\n defaultOptionsByType = {},\n flyoutConfigForDataType,\n handleResetColumnToDefault,\n updateColumnFormatting,\n isSourceCustomized,\n}): React.ReactElement => {\n const handleUpdateColumnFormatting = React.useCallback(\n (e, optionName, value): void => updateColumnFormatting({ columnName, optionName, value }),\n [columnName, updateColumnFormatting]\n );\n\n return (\n <FormatByTypeEditorContents>\n {isSourceCustomized ? (\n <CustomizedInSourceMessage\n onResetToDefault={handleResetColumnToDefault}\n style={{ padding: `0px 0px 16px 0px`, width: 'auto' }}\n />\n ) : (\n <ColumnLayout>\n {flyoutConfigForDataType.map(\n (row, rItr): React.ReactElement => (\n <ColumnLayout.Row\n key={rowKey(row, rItr)}\n data-test=\"column-formatter-flyout-row\"\n style={{\n marginBottom: rItr === flyoutConfigForDataType.length ? '0px' : '12px',\n }}\n >\n {row.map((item, iItr): React.ReactElement => {\n let editorItem = null;\n const colSpan = SUI_COL_SPAN_TOTAL / row.length;\n const colOption = item ? `${item.option}_` : '';\n const colKey = `item_${colOption}${rItr}_${iItr}`;\n\n // If item is an empty object, it's just for alignment purposes\n if (!isEmpty(item)) {\n const EditorItem = editorTypeToComponentMap[item.editor];\n editorItem = (\n <EditorItem\n {...item.editorProps}\n label={item.label}\n name={item.option}\n itemSchema={item.itemSchema}\n value={getEditorItemValue(\n item,\n columnFormatting,\n columnDataType,\n defaultOptionsByType\n )}\n onChange={handleUpdateColumnFormatting}\n />\n );\n }\n return (\n <ColumnLayout.Column key={colKey} span={colSpan}>\n {editorItem}\n </ColumnLayout.Column>\n );\n })}\n </ColumnLayout.Row>\n )\n )}\n </ColumnLayout>\n )}\n </FormatByTypeEditorContents>\n );\n};\n\nexport default FormatByTypeEditor;\n","import { cloneDeep, get, isEmpty, isPlainObject, pick, set, unset } from 'lodash';\nimport EncodingParser from '@splunk/visualization-encoding/EncodingParser';\nimport { getLastFormatterFromDSL } from '@splunk/visualization-encoding/utils/dsl';\nimport type { FieldTuple } from '../../utils/columnSelectionUtils';\nimport type {\n ColumnEntry,\n EditorSupportedFormatOptions,\n ColumnFormatOptions,\n ColumnTextFormatOptions,\n} from '../../interfaces/ColumnFormatter';\n\nconst EDITOR_CONFIG_SUFFIX = 'ColumnFormatEditorConfig';\n// hardcoded table coloring\n// TODO(fkurniawan): look into cleaning this up when accounting for 'customized in source'\nconst supportedFormatters = {\n pick: 'pick',\n rangeValue: 'rangeValue',\n matchValue: 'matchValue',\n};\n\nconst supportedTextFormatTypes = {\n align: 'align',\n headerAlign: 'headerAlign',\n textOverflow: 'textOverflow',\n};\n\nconst supportedColumnFormatEditorOptions = {\n rowBackgroundColors: 'rowBackgroundColors',\n rowColors: 'rowColors',\n data: 'data',\n ...supportedTextFormatTypes,\n};\n\nexport const TextDataType = 'text';\n\n/**\n * Extract the list of text formatting options for a specific column from the column format options.\n * @param {string} columnName\n * @param {ColumnEntry} columnFormatOptions\n * @returns {ColumnTextFormatOptions}\n */\nexport const getExistingTextFormatting = (\n columnName: string,\n columnFormatOptions: ColumnFormatOptions\n): ColumnTextFormatOptions => {\n const formatText = {};\n Object.keys(supportedTextFormatTypes).forEach(textFormatType => {\n const textFormatValue = get(columnFormatOptions, [columnName, textFormatType]);\n if (textFormatValue) {\n formatText[textFormatType] = textFormatValue;\n }\n });\n return formatText;\n};\n\n/**\n * Extract the list of editorSupportedFormatOptions for a given dataType\n *\n * since numbro custom formatting can conflict with the limited editor supported format options subset,\n * we need this to determine when the user has configured non-editor supported format options\n *\n * @param {Object} flyoutConfig\n */\nexport const getEditorSupportedFormatOptions = (flyoutConfig): EditorSupportedFormatOptions => {\n const editorSupportedFormatOptions = { text: {} };\n Object.keys(flyoutConfig).forEach((dataType): void => {\n editorSupportedFormatOptions[dataType] = {};\n flyoutConfig[dataType].forEach((configRow): void => {\n configRow.forEach((item): void => {\n editorSupportedFormatOptions[dataType][item.option] = item.option;\n });\n });\n });\n return editorSupportedFormatOptions;\n};\n\n/**\n * helper to convert availableFieldsWithTypes to a map of { [columnName]: dataType }\n *\n * @param {FieldTuple[]} availableFieldsWithTypes - available fields for the given datasource\n *\n * @returns {Object}\n */\nexport const getColumnDataTypeMap = (\n availableFieldsWithTypes: FieldTuple[]\n): { [columnName: string]: string } =>\n availableFieldsWithTypes.reduce(\n (\n zippedColumnsAndFields,\n { name, type }\n ): {\n [columnName: string]: string;\n } => {\n // eslint-disable-next-line no-param-reassign\n zippedColumnsAndFields[name] = type;\n return zippedColumnsAndFields;\n },\n {}\n );\n\n/**\n * helper to remove white space and dashes in column name with an underscore (since this causes issues when trying to reference a DSL context config key)\n * if the column name begins with a number, prepend an underscore so that the DSL recognizes it as an identifier\n *\n * @param {String} columnName - columnName to be sanitized\n *\n * @returns {String}\n */\nexport const sanitizeColumnName = (columnName: string): string => {\n // prefix context key with a leading underscore if column starts with number, since string identifiers in context can't have leading digits\n // a leading digit would conflict with numeric literals for arguments (e.g. seriesByIndex(0)) since nearley does not allow backtracking\n // since other special characters will be replaced, we only need to check for leading digits (since we allow for non-leading digits in identifiers)\n let sanitizedColumnName = columnName;\n if (columnName.match(/^[0-9]/)) {\n sanitizedColumnName = `_${sanitizedColumnName}`;\n }\n\n return `${sanitizedColumnName.replace(/[^a-zA-Z0-9]/g, '_')}`;\n};\n\n/**\n * Checks if the user configured formatting (either table or column) options beyond the editor-supported options\n *\n * @param {Object} configFormat - the formatting object used to specify column-specific formatting or global table formatting for a given dataType\n * @param {Object} editorSupportedFormatOptions - hashified map of editor supported formatting options\n *\n * @returns {Boolean}\n */\nexport const checkExceedsEditorCapabilities = (\n configFormat: Record<string, unknown>,\n editorSupportedFormatOptions: { [formatOptionName: string]: string }\n): boolean => {\n return Object.keys(configFormat).some(\n (configFormatOption): boolean => !editorSupportedFormatOptions[configFormatOption]\n );\n};\n\n/**\n * Obtains the context key used for a table-formatting DSL string from the options.tableFormat or options.columnFormat[columnName]\n * e.g. getFormattingOptDSLKey({ data: '> table | formatByType(contextKey)' }) would return 'contextKey'\n *\n * @param {Object} formattingOpt - the original options.columnFormat or options.tableFromat in the viz definition\n *\n * @returns {String}\n */\nexport const getFormattingOptDSLKey = (formattingOpt: { data?: string | string[] | null } = {}): string => {\n if (typeof formattingOpt.data !== 'string' || !EncodingParser.isDslString(formattingOpt.data)) {\n return null;\n }\n return get(getLastFormatterFromDSL(formattingOpt.data), 'paramKey', null);\n};\n\n/**\n * Obtains the table-wide formatting applied applied to the table viz for a given data type\n *\n * @param {Object} tableFormatOpt - the DSL used to provide table-wide formatting (e.g. '> table | formatByType(customTableFormatting)'),\n * @param {String} dataType - the data type formatting to obtain\n * @param {Object} context - the table viz context\n *\n * @returns {Object}\n */\nexport const getGlobalTableFormatting = (\n tableFormatOpt: Record<string, unknown>,\n dataType: string,\n context: Record<string, unknown>\n): Record<string, unknown> => {\n const tableFormatDSLContextKey = getFormattingOptDSLKey(tableFormatOpt);\n return get(context, [tableFormatDSLContextKey, dataType], {});\n};\n\n/**\n * Check if the columnFormat option for a given columnName has properties which are configurable by editor\n * Right now this is limited to `data` which is powered by formatByType,\n *\n * @param {Object} columnFormat\n */\nconst isColumnFormatEditorConfigurable = (columnFormat, columnName): boolean => {\n if (!columnFormat[columnName]) {\n return true;\n }\n return Object.keys(columnFormat[columnName]).some(\n (subOption): boolean => !!supportedColumnFormatEditorOptions[subOption]\n );\n};\n\n/**\n * Returns `true` if the formatter is of type `rangeValue` or `matchValue`, and `false` otherwise.\n *\n * @param {string} formatterType\n */\nexport const isValidColorFormatter = (formatterType: string): boolean => {\n return formatterType === 'rangeValue' || formatterType === 'matchValue';\n};\n\nexport interface GetInitialColumnFormattingStateArgs {\n availableFieldsWithTypes: FieldTuple[];\n coloringTypes?: { value: string }[];\n columnFormatOption: Record<string, unknown>;\n editorSupportedFormatOptions: Record<string, Record<string, string>>;\n vizContext: Record<string, unknown>;\n}\n\n/**\n * Returns the initial column state given the original viz def and context as a Map\n * To prevent the editor column list from reordering, a Map is used to track addition/deletion order\n *\n * @param {FieldTuple[]} param.availableFieldsWithTypes - all available field types to use for\n * @param {Object} param.columnFormatOption - original value of options.columnFormat from the viz definition\n * @param {{dataType, String[]}} param.editorSupportedOptions - object holding editor-supported options for a given dataType\n * @param {Object} param.vizContext - the table viz context\n *\n * @returns {Map<string, ColumnEntry>}\n */\nexport const getInitialColumnFormattingState = ({\n availableFieldsWithTypes,\n coloringTypes = [],\n columnFormatOption,\n editorSupportedFormatOptions,\n vizContext,\n}: GetInitialColumnFormattingStateArgs): Map<string, ColumnEntry> => {\n if (!columnFormatOption || typeof columnFormatOption !== 'object') {\n return new Map();\n }\n\n const columnDataTypeMap = getColumnDataTypeMap(availableFieldsWithTypes);\n return Object.keys(columnFormatOption).reduce((initialState, columnName): Map<string, ColumnEntry> => {\n const columnDataType = columnDataTypeMap[columnName];\n const columnDSLContextKey = getFormattingOptDSLKey(columnFormatOption[columnName]);\n const columnFormatByTypeContextConfig = vizContext[columnDSLContextKey];\n const hasInvalidContextKey =\n EncodingParser.isDslString(get(columnFormatOption, [columnName, 'data'])) &&\n !columnFormatByTypeContextConfig;\n\n // this checks if the columnFormat[fieldName] contained fields like `align`,\n // if no editor configurable options are available, don't add this to the list of initial columns\n if (!isColumnFormatEditorConfigurable(columnFormatOption, columnName)) {\n return initialState;\n }\n\n const formatText = getExistingTextFormatting(columnName, columnFormatOption);\n\n // currently, we only allow text or background coloring via editor for number or string data\n if (!isEmpty(editorSupportedFormatOptions[columnDataType]) && !hasInvalidContextKey) {\n const columnColoring = { _meta: { dynamicallyColoredOption: 'Off' } };\n\n // hardcode editor edge case for determining the dynamically powered option\n // TODO(fkurniawan): account for 'customized in source' derivation for Table Dynamic Coloring\n // TODO(fkurniawan): more generalizable logic\n const rowColorsFormatter = get(\n getLastFormatterFromDSL(get(columnFormatOption, [columnName, 'rowColors'])),\n 'type'\n );\n const rowBackgroundColorsFormatter = get(\n getLastFormatterFromDSL(get(columnFormatOption, [columnName, 'rowBackgroundColors'])),\n 'type'\n );\n\n // our column coloring editor only supports two dynamic coloring states:\n // 1. rowColors is dynamically powered, and rowBackgroundColors is not used\n // 2. rowBackgroundColors is dynamically powered, and rowColors is statically powered by pick\n if (isValidColorFormatter(rowColorsFormatter) && !rowBackgroundColorsFormatter) {\n // eslint-disable-next-line no-underscore-dangle\n columnColoring._meta.dynamicallyColoredOption = 'rowColors';\n } else if (rowColorsFormatter === 'pick' && isValidColorFormatter(rowBackgroundColorsFormatter)) {\n // eslint-disable-next-line no-underscore-dangle\n columnColoring._meta.dynamicallyColoredOption = 'rowBackgroundColors';\n }\n\n // currently only rowColors or rowBackgroundColors, but can be expanded to include sparklineColors or sparklineAreaColors\n coloringTypes.forEach(({ value }): void => {\n const colorOptionDSL = get(columnFormatOption, [columnName, value]);\n if (colorOptionDSL) {\n // because static coloring (i.e. pick) is only supported for Text coloring as per designs, there is a lot of hard-coded edge case logic\n const { type: formatter, paramKey: colorContextKey } =\n getLastFormatterFromDSL(colorOptionDSL) ||\n ({} as ReturnType<typeof getLastFormatterFromDSL>);\n\n // do not initialize pick formatting in state if background colors is not powered by ranges or matches\n if (\n formatter === 'pick' &&\n value === 'rowColors' &&\n !isValidColorFormatter(rowBackgroundColorsFormatter)\n ) {\n return;\n }\n\n // do not initialize pick formatting in state if applied on anything besides row text colors\n if ((formatter === 'pick' && value !== 'rowColors') || !supportedFormatters[formatter]) {\n return;\n }\n\n // do not initialize dynamic rowBackgroundColors if row text color is not statically powered\n if (\n isValidColorFormatter(formatter) &&\n value === 'rowBackgroundColors' &&\n rowColorsFormatter !== 'pick'\n ) {\n return;\n }\n\n columnColoring[value] = {\n colorContextKey,\n // TODO(fkurniawan): what happens if the user started off with malformed DSL (e.g. non-existent contextKey)?\n colorContextConfig: get(vizContext, [colorContextKey], {}),\n colorOptionDSL,\n };\n }\n });\n\n const hasEditorSupportedColoring = Object.keys(columnColoring).length > 1;\n const preexistingFormatByTypeConfig = get(vizContext, [columnDSLContextKey, columnDataType], {});\n if (\n hasEditorSupportedColoring ||\n !isEmpty(preexistingFormatByTypeConfig) ||\n !isEmpty(formatText)\n ) {\n initialState.set(columnName, {\n columnColoring,\n formatByType: {\n [columnDataType]: {\n // prevent persisting non-editor supported options into editor state\n // this can happen if the user adds dynamic coloring while the other format options are source-customized\n ...pick(\n preexistingFormatByTypeConfig,\n Object.keys(editorSupportedFormatOptions[columnDataType])\n ),\n _meta: {\n exceedsEditorCapabilities: checkExceedsEditorCapabilities(\n get(columnFormatByTypeContextConfig, [columnDataType], {}),\n editorSupportedFormatOptions[columnDataType]\n ),\n },\n },\n },\n formatText,\n });\n }\n }\n return initialState;\n }, new Map());\n};\n\n/**\n * internal helper for checking if a given context entry is empty\n *\n * @param {Object} contextConfigEntry\n */\nconst isContextConfigEmpty = (contextConfigEntry): boolean => {\n return Object.keys(contextConfigEntry).every((formattingDataType): boolean =>\n isEmpty(contextConfigEntry[formattingDataType])\n );\n};\n\n/**\n * Converts the editorColumnFormatting state persisted in the definition into a { context, options } entry that can be merged into the viz definition\n * The updatedEditorColumnFormatting should hold all of the formatting options (both original and newly applied)\n *\n * the columnFormatting option is persisted in the viz definition as follows:\n * {\n * context: {\n * ...otherContextConfigs,\n * col1FormatConfig: {\n * precision: 1,\n * thousandSeparated: true,\n * }\n * col2FormatConfig: { ...cellSpecificFormatting }\n * },\n * option: {\n * columnFormat: {\n * col1: {\n * data: '> table | seriesByName(\"col1\") | formatByType(col1FormatConfig)',\n * },\n * col2: {\n * data: '> table | seriesByName(\"col2\") | formatByType(col2FormatConfig)',\n * },\n * }\n * };\n * }\n *\n * @param {Object} param.columnFormatOption - the original options.columnFormat in the viz definition\n * @param {{columnName, ColumnEntry}} param.updatedEditorColumnFormatting - the updated editorColumnFormatting state to merge into the definition\n *\n * @returns {Object}\n */\nexport const getColumnFormatDefFromState = ({\n columnFormatOption,\n updatedEditorColumnFormatting,\n}: {\n columnFormatOption: {\n [columnName: string]: {\n data: string;\n };\n };\n updatedEditorColumnFormatting: { [columnName: string]: ColumnEntry };\n}): {\n context: Record<string, string | number | boolean | Record<string, string | number | boolean>>;\n options: {\n columnFormat: Record<string, string | number | boolean | Record<string, string | number | boolean>>;\n };\n} => {\n const columnFormattingEditorContextConfig = {};\n const editorDerivedColumnFormatOption = cloneDeep(columnFormatOption);\n Object.keys(updatedEditorColumnFormatting).forEach((columnName): void => {\n const sanitizedColumnName = sanitizeColumnName(columnName);\n const contextFormattingKey = `${sanitizedColumnName}${EDITOR_CONFIG_SUFFIX}`;\n if (isPlainObject(updatedEditorColumnFormatting[columnName])) {\n // persist columnColoring changes\n const columnColoring = get(updatedEditorColumnFormatting, [columnName, 'columnColoring']);\n unset(columnColoring, ['_meta']);\n\n if (isPlainObject(columnColoring)) {\n Object.keys(columnColoring).forEach((coloringType): void => {\n const { colorContextConfig, colorOptionDSL, colorContextKey } =\n columnColoring[coloringType];\n\n if (colorOptionDSL == null) {\n columnFormattingEditorContextConfig[colorContextKey] = null;\n set(editorDerivedColumnFormatOption, [columnName, coloringType], null);\n } else if (colorContextKey) {\n columnFormattingEditorContextConfig[colorContextKey] = colorContextConfig;\n // sets the DSL for `rowColors` or `rowBackgroundColors` inside `columnFormat[fieldName]`\n // can also set it to null\n set(editorDerivedColumnFormatOption, [columnName, coloringType], colorOptionDSL);\n }\n });\n }\n\n // strip out editor-related _meta information\n if (isPlainObject(updatedEditorColumnFormatting[columnName].formatByType)) {\n Object.keys(updatedEditorColumnFormatting[columnName].formatByType).forEach(\n (dataType): void => {\n unset(updatedEditorColumnFormatting, [columnName, 'formatByType', dataType, '_meta']);\n }\n );\n // persist all formatByType options in context if formatByType is not empty\n if (!isContextConfigEmpty(updatedEditorColumnFormatting[columnName].formatByType)) {\n columnFormattingEditorContextConfig[contextFormattingKey] = {\n ...updatedEditorColumnFormatting[columnName].formatByType,\n };\n\n set(\n editorDerivedColumnFormatOption,\n [columnName, 'data'],\n `> table | seriesByName(\"${columnName}\") | formatByType(${contextFormattingKey})`\n );\n } else {\n // if formatByType entry is empty, remove context related to formatByType\n // however, it's still possible that coloring was applied, so still need the columnFormat[fieldName] option\n columnFormattingEditorContextConfig[contextFormattingKey] = null;\n }\n }\n\n const { formatText } = updatedEditorColumnFormatting[columnName];\n if (isPlainObject(formatText)) {\n Object.keys(formatText).forEach((textFormatOption): void => {\n set(\n editorDerivedColumnFormatOption,\n [columnName, textFormatOption],\n formatText[textFormatOption]\n );\n });\n }\n } else {\n // if the columnName entry is null, the key will be removed from the externally persisted state\n // defensively remove any editorConfig persisted coloring here\n columnFormattingEditorContextConfig[contextFormattingKey] = null;\n columnFormattingEditorContextConfig[`${sanitizedColumnName}RowColorsEditorConfig`] = null;\n columnFormattingEditorContextConfig[`${sanitizedColumnName}RowBackgroundColorsEditorConfig`] =\n null;\n editorDerivedColumnFormatOption[columnName] = null;\n }\n });\n\n return {\n context: columnFormattingEditorContextConfig,\n options: {\n columnFormat: editorDerivedColumnFormatOption,\n },\n };\n};\n","import * as T from 'prop-types';\nimport type { FormatterUiConfig } from '../../formatters/FormatterEditor';\n\nexport interface ColumnColoringConfig {\n coloringTypes: { label: string; value: string }[];\n formatters: FormatterUiConfig[];\n themes: Record<string, any>;\n}\n\nexport const columnColoringConfigPropType = T.shape({\n coloringTypes: T.arrayOf(\n T.shape({\n label: T.string,\n value: T.string,\n })\n ),\n formatters: T.arrayOf(\n T.shape({\n label: T.string,\n value: T.string,\n defaults: T.object,\n })\n ),\n themes: T.object,\n});\n\nexport interface FlyoutConfigItem {\n label?: string;\n editor?: string;\n option?: string;\n editorProps?: Record<string, unknown>;\n itemSchema?: unknown;\n [key: string]: unknown;\n}\n\nexport type FlyoutConfigRow = FlyoutConfigItem[];\n\nexport interface FlyoutConfig {\n number: FlyoutConfigRow[];\n sparkline: FlyoutConfigRow[];\n string: FlyoutConfigRow[];\n time: FlyoutConfigRow[];\n}\n\nexport const flyoutConfigPropType = T.shape({\n number: T.arrayOf(T.any),\n string: T.arrayOf(T.any),\n sparkline: T.arrayOf(T.any),\n time: T.arrayOf(T.any),\n});\n","import React, { useState, useCallback, useMemo, useEffect } from 'react';\nimport * as T from 'prop-types';\nimport Select from '@splunk/react-ui/Select';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport FeatureFlagContext from '@splunk/visualization-context/FeatureFlagContext';\nimport { getDataSourceStateInfo } from '@splunk/visualizations-shared/dataSourceUtils';\nimport { getAllPossibleSplitByFields } from '@splunk/visualizations-shared/trellisUtils';\nimport { getPlaceholderMessage } from '../../utils/columnSelectionUtils';\nimport { BaseEditorPropTypes } from '../../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../../interfaces/BaseEditorProps';\nimport { useDataSource } from '../../hooks/useDataSource';\nimport ControlGroup from '../../shared/AdvancedControlGroup';\nimport { useColumnSelectorFooterMessage } from '../useColumnSelectorFooterMessage';\n\nexport const EDITOR_NAME = 'trellisSplitBySelectionEditor';\ninterface TrellisSplitBySelectionEditorProps extends BaseEditorProps {\n dataSourceKey: string;\n prepareValue?: (id: Record<string, unknown>) => Record<string, unknown>;\n}\n\n/*\nconst propTypes: Record<keyof TrellisSplitBySelectionEditorProps, T.Validator<any>> = {\n ...BaseEditorPropTypes,\n dataSourceKey: T.string.isRequired,\n prepareValue: T.func,\n};\n*/\n\nexport const AGGREGATIONS = 'aggregations';\n\ninterface FieldOption {\n name: string;\n value: string;\n description: string;\n [key: string]: string;\n}\n\nconst defaultPrepareValueFn = (id: Record<string, unknown>): Record<string, unknown> => id;\n\nexport const TrellisSplitBySelectionEditor: React.FunctionComponent<TrellisSplitBySelectionEditorProps> = ({\n name,\n value,\n label = '',\n labelPosition = 'top',\n dataSourceKey = 'primary',\n dataSourceBindings,\n isDisabled,\n onChange,\n prepareValue = defaultPrepareValueFn,\n}): React.ReactElement => {\n const featureFlagContext = React.useContext(FeatureFlagContext) as Record<string, boolean>;\n const isTrellisFeatureFlagOn = Boolean(featureFlagContext?.visualizations_enableTrellis);\n const dataSource = useDataSource({ dataSourceBindings, dataSourceKey });\n const { fields } = dataSource?.data || { columns: [], fields: [] };\n const splitByFieldsObject = useMemo(() => getAllPossibleSplitByFields(fields), [fields]);\n const { hasError, isMissing, isLoading } = getDataSourceStateInfo(dataSource);\n const disabled = isMissing || hasError || isDisabled;\n const placeholderMessage = getPlaceholderMessage({\n isMissing,\n isLoading,\n hasError,\n defaultMessage: `${_('Select a splitby field from datasource')}`,\n });\n const defaultSelection = splitByFieldsObject.fields?.length\n ? splitByFieldsObject.fields[0]\n : AGGREGATIONS;\n\n const [filter, setFilter] = useState('');\n const handleFilterChange = useCallback((e, { keyword }): void => {\n setFilter(keyword);\n }, []);\n\n const selectedFieldName = value || defaultSelection;\n const [selectedField, setSelectedField] = useState(selectedFieldName);\n\n useEffect((): void => {\n setSelectedField(selectedFieldName);\n }, [selectedFieldName]);\n\n const handleValueChange = React.useCallback(\n (event, { value: selectedValue }): void => {\n setSelectedField(selectedValue);\n const update = prepareValue({\n options: {\n [name]: `${selectedValue}`,\n },\n });\n onChange(event, update);\n },\n [onChange, prepareValue, name]\n );\n\n const { filteredFields, splitByFields } = useMemo(() => {\n let splitByFieldsResults: FieldOption[] = splitByFieldsObject.fields.map(field => ({\n name: field,\n value: field,\n description: '',\n }));\n if (splitByFieldsObject.aggregations?.length) {\n splitByFieldsResults = [\n ...splitByFieldsResults,\n {\n name: `${_('Aggregations')} (${splitByFieldsObject.aggregations.length})`,\n description: splitByFieldsObject.aggregations.join(', '),\n value: AGGREGATIONS,\n },\n ];\n }\n const filteredFieldResults = splitByFieldsResults.filter(\n (field): boolean => field && field.value.toLowerCase().indexOf(filter.toLowerCase()) !== -1\n );\n return { filteredFields: filteredFieldResults, splitByFields: splitByFieldsResults };\n }, [filter, splitByFieldsObject.aggregations, splitByFieldsObject.fields]);\n\n const footerMessage = useColumnSelectorFooterMessage({\n availableFields: splitByFields,\n selectedFields: [selectedField],\n filteredFields,\n filter,\n });\n\n if (!isTrellisFeatureFlagOn) {\n return null;\n }\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition} data-test={`${EDITOR_NAME}-${name}`}>\n <Select\n data-test={`${EDITOR_NAME}-select-${name}`}\n value={selectedField}\n onFilterChange={handleFilterChange}\n onChange={handleValueChange}\n footerMessage={footerMessage}\n placeholder={placeholderMessage}\n disabled={disabled}\n isLoadingOptions={isLoading}\n error={hasError}\n filter\n >\n {filteredFields.map(\n (field): React.ReactElement =>\n field && (\n <Select.Option\n key={field.name}\n data-test={`${EDITOR_NAME}-option-${field.value}`}\n label={`${field.name}`}\n value={field.value}\n description={field.description}\n />\n )\n )}\n </Select>\n </ControlGroup>\n );\n};\n\nTrellisSplitBySelectionEditor.propTypes = {\n ...BaseEditorPropTypes,\n dataSourceKey: T.string.isRequired,\n prepareValue: T.func,\n};\nexport default TrellisSplitBySelectionEditor;\n","import React, { useMemo } from 'react';\nimport { ColumnSelectorFooterMessage } from '../shared/ColumnSelectorFooterMessage';\nimport type { FieldTuple } from '../utils/columnSelectionUtils';\n\ntype ObjectWithName = {\n name: string;\n [key: string]: string;\n};\n\ntype Fields = FieldTuple[] | ObjectWithName[];\n\ninterface FooterMessageProps {\n noSelectedFieldsInfo?: boolean;\n filter: string;\n availableFields: Fields;\n selectedFields?: string[];\n filteredFields: Fields;\n}\n\nexport const useColumnSelectorFooterMessage = ({\n filter,\n availableFields,\n selectedFields,\n filteredFields,\n noSelectedFieldsInfo = false,\n}: FooterMessageProps) => {\n const selectedFilteredFields = useMemo(() => {\n if (!selectedFields || !filteredFields) return [];\n\n const validSelectedFields = new Set(\n selectedFields.filter(field => field !== '' && field !== undefined)\n );\n\n return filteredFields.filter(item => validSelectedFields.has(item.name));\n }, [selectedFields, filteredFields]);\n\n // make sure to display only 'No matches' text when there is no result of filtering\n if (filter && !filteredFields.length) {\n return null;\n }\n\n return (\n <ColumnSelectorFooterMessage\n noSelectedFieldsInfo={noSelectedFieldsInfo}\n numSelected={selectedFilteredFields?.length} // if no filter is applied filteredFields equal availableFields\n numFiltered={filteredFields.length}\n numAvailable={availableFields.length}\n filter={filter}\n />\n );\n};\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 { useState, useEffect, useContext } from 'react';\nimport DataSourceContext, {\n type BindingsSnapshot,\n type DataSourceApi,\n} from '@splunk/visualization-context/DataSourceContext';\nimport { get, isFunction } from 'lodash';\n\ninterface UseDataSourceParams {\n dataSourceBindings: BindingsSnapshot;\n dataSourceKey: string;\n}\n// @TODO(pwied): use DataSource interface in return type (w/o dependency on @splunk/visualizations)\nexport const useDataSource = ({\n dataSourceBindings,\n dataSourceKey,\n}: UseDataSourceParams): BindingsSnapshot => {\n const dataSourceApi = useContext<DataSourceApi>(DataSourceContext);\n const [dataSource, setDataSource] = useState<BindingsSnapshot>();\n useEffect((): (() => void) => {\n if (!get(dataSourceBindings, dataSourceKey)) {\n setDataSource(null);\n return () => undefined;\n }\n const unsubscribe =\n isFunction(dataSourceApi.subscribe) &&\n dataSourceApi.subscribe(dataSourceKey, (snapshot): void => setDataSource(snapshot));\n return () => {\n if (unsubscribe) {\n unsubscribe();\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dataSourceBindings]);\n return dataSource;\n};\n","import type React from 'react';\nimport { useCallback, useRef, useLayoutEffect, useState, useMemo } from 'react';\nimport {\n type NumberBlurHandler,\n type NumberChangeHandler,\n type NumberFocusHandler,\n type NumberPropsBase,\n} from '@splunk/react-ui/Number';\nimport { clamp, debounce, noop } from 'lodash';\n\nexport type OnValueChangeType = (e: Parameters<NumberChangeHandler>[0], newValue?: string | number) => void;\n\ninterface UseNumberInputArgs extends Pick<NumberPropsBase, 'value' | 'defaultValue' | 'min' | 'max'> {\n onValueChange: OnValueChangeType;\n}\n\nexport const useNumberInput = ({\n min = Number.NEGATIVE_INFINITY,\n max = Number.POSITIVE_INFINITY,\n value,\n defaultValue,\n onValueChange = noop,\n}: UseNumberInputArgs) => {\n const [currentValue, setCurrentValue] = useState(value);\n const isFocusedRef = useRef(false);\n\n const commitValue = useCallback(\n (e, newValue?: string | number) => {\n if (newValue == null) {\n // if we're clearing the input, revert local state back to default or old value\n setCurrentValue(defaultValue ?? value);\n }\n\n onValueChange(e, newValue);\n },\n [defaultValue, onValueChange, value]\n );\n\n const handleChangeDebounced = useMemo(\n () => debounce<NumberChangeHandler>((e, payload) => commitValue(e, payload.value), 250),\n [commitValue]\n );\n\n useLayoutEffect(() => {\n // layout effect prevents double-render during external change to derived state\n setCurrentValue(value);\n }, [value]);\n\n const handleChange = useCallback<NumberChangeHandler>(\n (e, payload) => {\n setCurrentValue(payload.value);\n if (isFocusedRef.current) {\n // if focus is in the text box of the number input, don't commit the state yet\n // this includes being focused inside the text box and using UP + DOWN arrow keys to increment/decrement. It will only\n // commit the value on blur or Enter key.\n return;\n }\n\n // if the focus is outside, it's because the user is clicking the increment/decrement buttons directly\n handleChangeDebounced(e, payload);\n },\n [handleChangeDebounced]\n );\n\n const handleBlur = useCallback<NumberBlurHandler>(\n e => {\n isFocusedRef.current = false;\n if (value !== currentValue) {\n commitValue(e, currentValue);\n }\n },\n [currentValue, commitValue, value]\n );\n\n const handleFocus = useCallback<NumberFocusHandler>(() => {\n isFocusedRef.current = true;\n }, []);\n\n const handleKeyPress = useCallback<React.KeyboardEventHandler<HTMLInputElement>>(\n e => {\n if (typeof e.key === 'string' && e.key.toLowerCase() === 'enter') {\n const targetValue = (e.target as HTMLInputElement)?.value;\n const eventValue = targetValue ? Number(targetValue) : undefined;\n\n // the raw input value will not have min/max clamp applied from the SUINumber component\n const clampedValue = typeof eventValue === 'number' ? clamp(eventValue, min, max) : undefined;\n\n if (value !== clampedValue) {\n commitValue(e, clampedValue);\n }\n }\n // if pressing the ESC key, revert value to the initial one before editing\n if (typeof e.key === 'string' && e.key.toLowerCase() === 'escape') {\n // This key doesn't work with Chrome 75\n setCurrentValue(value);\n }\n },\n [commitValue, value, min, max]\n );\n\n return {\n handleChange,\n handleBlur,\n handleFocus,\n handleKeyPress,\n currentValue,\n };\n};\n","import * as T from 'prop-types';\nimport type { JSONSchema7 } from 'json-schema';\n\nexport interface BaseEditorProps {\n name: string;\n value: any;\n onChange?: (...args: any[]) => void;\n label?: string; // @TODO(pwied): this should not live in editor props\n labelPosition?: 'top' | 'left'; // ^^^\n context?: Record<string, any>;\n labelWidth?: number;\n isAdvanced?: boolean;\n isDisabled?: boolean;\n dataSourceBindings?: Record<string, any>;\n options?: { [k: string]: any };\n optionsSchema?: {\n [key: string]: JSONSchema7;\n };\n}\n\nexport const BaseEditorPropTypes: Record<keyof BaseEditorProps, T.Validator<any>> = {\n name: T.string.isRequired,\n value: T.oneOfType([T.string, T.object, T.arrayOf(T.string)]),\n context: T.object,\n label: T.string,\n labelPosition: T.oneOf(['top', 'left']),\n labelWidth: T.number,\n onChange: T.func,\n isAdvanced: T.bool,\n isDisabled: T.bool,\n dataSourceBindings: T.object,\n options: T.object,\n optionsSchema: T.object,\n};\n","import * as T from 'prop-types';\nimport { BaseEditorPropTypes } from './BaseEditorProps';\nimport { sharedPalettesConfigPropType } from '../editors/formatters/FormatterEditor';\n\n// Common propTypes used by DynamicColor-based editors to reduce duplication\nexport const DynamicColorEditorPropTypes = {\n ...BaseEditorPropTypes,\n name: T.string.isRequired,\n value: T.any,\n onChange: T.func,\n flyoutTitle: T.string,\n dataSelectors: T.arrayOf(\n T.exact({\n label: T.string.isRequired,\n value: T.string.isRequired,\n }).isRequired\n ),\n formatters: T.arrayOf(\n T.exact({\n label: T.string.isRequired,\n value: T.string.isRequired,\n defaults: T.object.isRequired,\n isDefault: T.bool,\n }).isRequired\n ),\n defaultPalettesConfig: sharedPalettesConfigPropType.isRequired,\n tooltip: T.string,\n options: T.object,\n};\n","import React, { Children, cloneElement } from 'react';\nimport type { 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 type { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport Button from '@splunk/react-ui/Button';\nimport SUIControlGroup from '@splunk/react-ui/ControlGroup';\nimport type { 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 styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ArrowDown from '@splunk/react-icons/ArrowDown';\nimport ArrowUp from '@splunk/react-icons/ArrowUp';\n\nconst Wrapper = styled.div`\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n /* this aligns the first item on the far left and the other item is aligned to flex end */\n & :first-child {\n margin-right: auto;\n }\n & {\n padding: 4px 1px;\n }\n`;\n\ninterface ArrowLayerProps {\n colorDown?: string;\n colorUp?: string;\n}\n\nconst ArrowLayer = ({ colorDown, colorUp }: ArrowLayerProps): React.ReactElement => (\n <Wrapper>\n <ArrowDown aria-label={_('Bottom range')} style={{ color: colorDown || 'white' }} />\n <ArrowUp aria-label={_('Top range')} style={{ color: colorUp || 'white' }} />\n </Wrapper>\n);\n\nexport default ArrowLayer;\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 * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\n\nconst Icon = styled.div.attrs<{ 'data-test': string; onClick: React.MouseEventHandler<HTMLDivElement> }>(\n (props): { 'data-test': string } => ({\n 'data-test': props['data-test'],\n })\n)<{ 'data-test': string }>`\n display: flex;\n height: 35px;\n width: 35px;\n align-items: center;\n justify-content: center;\n color: ${variables.contentColorActive};\n border-radius: ${variables.borderRadius};\n &:hover {\n background-color: ${variables.interactiveColorOverlayHover};\n cursor: pointer;\n }\n`;\n\ninterface ClickableIconProps {\n dataTestKey?: string;\n children: React.ReactNode;\n onClick: React.MouseEventHandler<HTMLDivElement>;\n}\n\nconst propTypes: Record<keyof ClickableIconProps, T.Validator<any>> = {\n dataTestKey: T.string,\n children: T.node,\n onClick: T.func,\n};\n\nconst ClickableIcon: React.FunctionComponent<ClickableIconProps> = ({\n children,\n dataTestKey,\n onClick,\n}): React.ReactElement => (\n <Icon data-test={dataTestKey} onClick={onClick}>\n {children}\n </Icon>\n);\n\nClickableIcon.propTypes = propTypes;\n\nexport default ClickableIcon;\n","import * as React from 'react';\nimport { sprintf } from '@splunk/ui-utils/format';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { useMemo } from 'react';\n\ninterface FooterProps {\n filter: string;\n numSelected?: number;\n numFiltered: number;\n numAvailable: number;\n noSelectedFieldsInfo?: boolean; // it is needed for AddColumn component which has different logic than other selection editors\n}\n\nexport const ColumnSelectorFooterMessage = ({\n numSelected,\n numFiltered,\n numAvailable,\n filter,\n noSelectedFieldsInfo,\n}: FooterProps) => {\n const footerMessageText = useMemo(() => {\n if (filter) {\n if (noSelectedFieldsInfo) {\n return sprintf(_('%(filtered)d filtered from %(available)d fields'), {\n filtered: numFiltered,\n available: numAvailable,\n });\n }\n return sprintf(_('%(selected)d selected from %(filtered)d filtered'), {\n selected: numSelected,\n filtered: numFiltered,\n });\n }\n return noSelectedFieldsInfo\n ? sprintf(_('%(shown)d of %(available)d fields'), {\n shown: numFiltered,\n available: numAvailable,\n })\n : sprintf(_('%(selected)d selected from %(available)d'), {\n selected: numSelected,\n available: numAvailable,\n });\n }, [filter, noSelectedFieldsInfo, numFiltered, numAvailable, numSelected]);\n\n return (\n <span data-test=\"footer-message\" aria-live=\"polite\" aria-atomic=\"true\">\n {footerMessageText}\n </span>\n );\n};\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\nimport Message from '@splunk/react-ui/Message';\nimport Button from '@splunk/react-ui/Button';\n\nconst defaultHeaderText = _('Dynamic Option: Customized in source');\nconst defaultInfo = _(\n 'Configured in source code beyond what can be shown here. Resetting to default will overwrite this custom configurations.'\n);\nconst defaultResetButtonText = _('Reset to default');\n\nconst PopoverContent = styled.div<{\n padding?: number | string;\n width?: number | string;\n}>`\n padding: ${({ padding }: any) => padding ?? '20px'};\n width: ${({ width }: any) => width ?? '300px'};\n color: ${variables.contentColorActive};\n`;\n\nconst PopoverHeader = styled.div`\n font-weight: 600;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 10px;\n`;\n\nexport interface CustomizedInSourceMessageProps {\n headerText?: string;\n info?: string;\n resetButtonText?: string;\n onResetToDefault?: (...args: any[]) => void;\n style?: Record<string, any>;\n}\n\nconst propTypes: Record<keyof CustomizedInSourceMessageProps, T.Validator<any>> = {\n headerText: T.string,\n info: T.string,\n resetButtonText: T.string,\n onResetToDefault: T.func,\n style: T.object,\n};\n\nconst CustomizedInSourceMessage = ({\n headerText = defaultHeaderText,\n info = defaultInfo,\n resetButtonText = defaultResetButtonText,\n onResetToDefault = (): void => undefined,\n style = {},\n}: CustomizedInSourceMessageProps): React.ReactElement => (\n <PopoverContent style={style}>\n <PopoverHeader data-test=\"popover-header\">{headerText}</PopoverHeader>\n <Message data-test=\"customized-source-popover-message\" type=\"info\">\n {info}\n </Message>\n <Button\n data-test=\"popover-reset\"\n appearance=\"secondary\"\n onClick={onResetToDefault}\n label={resetButtonText}\n />\n </PopoverContent>\n);\n\nCustomizedInSourceMessage.propTypes = propTypes;\n\nexport default CustomizedInSourceMessage;\n","import * as React from 'react';\nimport * as T from 'prop-types';\n\nconst FormatFieldName = ({\n columnName,\n dataType,\n}: {\n columnName: string;\n dataType: string;\n}): React.ReactElement => {\n // as per design, `_time` column name doesn't have dataType appended\n if (columnName === '_time') {\n return <span>_time</span>;\n }\n return (\n <span data-test={`format-field-name-${columnName}`}>\n {`${columnName} - `}\n <span style={{ fontStyle: 'italic' }}>{dataType}</span>\n </span>\n );\n};\n\nFormatFieldName.propTypes = {\n columnName: T.string,\n dataType: T.string,\n};\n\nexport default FormatFieldName;\n","import styled from 'styled-components';\n\nexport const MessageContainer = styled.div`\n margin-top: 10px;\n`;\n","import styled from 'styled-components';\n\nexport default styled.div`\n border-radius: 3px; /* @TODO(pwied): should this be imported from SUI variables? */\n overflow: hidden;\n position: relative;\n width: 100%;\n height: 20px;\n`;\n","export const FLYOUT_PADDING = 21;\nexport const COLUMN_FLYOUT_PADDING = 16;\nexport const FLYOUT_WIDTH = 344;\n\nexport const VERTICAL_EDITOR_SPACING = 16;\n\nexport const DROPDOWN_MENU_WIDTH = 327;\n\nexport const editorStyle = { width: '100%' };\n","import { _ } from '@splunk/ui-utils/i18n';\nimport {\n inferDataTypeFromData,\n canInferTypeFromMeta,\n getDataTypeForMeta,\n} from '@splunk/visualization-encoding/utils/types';\n\nexport interface FieldTuple {\n name: string;\n type: string;\n}\n\nexport const getAvailableFieldsWithTypes = (\n columns: unknown[][],\n fields: { name: string; type?: string }[]\n): FieldTuple[] => {\n const fieldsWithType = fields.map((field, index) => {\n const { name } = field;\n const inferredType = canInferTypeFromMeta(field)\n ? getDataTypeForMeta(field)\n : inferDataTypeFromData(columns[index]);\n return {\n name,\n type: inferredType,\n };\n });\n return fieldsWithType;\n};\n\nexport const getFilteredFields = (availableFieldsWithTypes: FieldTuple[], filter: string): FieldTuple[] => {\n return availableFieldsWithTypes.filter((field): boolean => field.name.indexOf(filter) !== -1);\n};\n\nexport const sanitizeFieldNames = (value: unknown, fieldNames: string[]): string[] => {\n if (typeof value === 'string' && fieldNames.includes(value)) {\n return [value];\n }\n if (Array.isArray(value)) {\n return value.filter(name => fieldNames.includes(name));\n }\n return [];\n};\n\nexport const getPlaceholderMessage = ({\n hasError,\n isLoading,\n isMissing,\n defaultMessage = 'Select a field from data source',\n}: {\n hasError: boolean;\n isLoading: boolean;\n isMissing: boolean;\n defaultMessage?: string;\n}): string => {\n if (isMissing) {\n return _('Set up data source to select');\n }\n if (hasError) {\n return _('Please set up valid data source to select');\n }\n if (isLoading) {\n return _('Loading data source...');\n }\n return _(defaultMessage);\n};\n","import { find, findLastIndex, get, isMatch, zipWith } from 'lodash';\nimport { DslParser } from '@splunk/visualization-encoding/DslParser';\nimport EncodingParser from '@splunk/visualization-encoding/EncodingParser';\nimport type { StaticItem, DynamicOptionsContext } from '../types';\n\n/**\n * The Dropdown/Multiselect inputs expect a config that has the following format. Additional\n * formatting clauses and options may be present. This is the \"standard dynamic config\".\n * {\n * context: {\n * statics: [\n * ['label1', 'label2', ...],\n * ['value1', 'value2', ...]\n * ],\n * label: '>primary | seriesByName(\"<label field name>\") | renameSeries('label'),\n * value: '>primary | seriesByName(\"<value field name>\") | renameSeries('value')\n * },\n * options: {\n * items: '>frame(label, value) | prepend(statics) | objects()'\n * }\n * }\n *\n * The \"standard static config\" is as follows. The contents of context do not matter.\n * {\n * context: {},\n * options: {\n * items: [\n * { label: 'label1', value: 'value1 },\n * { label: 'label2', value: 'value2 },\n * ...\n * ]\n * }\n * }\n *\n * \"Advanced configs\" are any config that does not follow the above formats.\n */\n\n/**\n * Retrieve the first field name from a DSL string containing seriesByName().\n */\nexport const getFieldFromFieldNameDsl = (dsl: string): string => {\n try {\n const ast = DslParser.parse(EncodingParser.withoutArrow(dsl));\n const seriesByNameNode = find(ast, {\n type: 'method',\n name: 'seriesByName',\n });\n return get(seriesByNameNode, ['args', '0', 'v'], '');\n } catch {\n return '';\n }\n};\n\n/**\n * Simple validation to check that a DSL string matches the standard config for the\n * context label/value field of Dynamic Options.\n */\nconst isFieldNameDslStandard = (dsl: string): boolean => {\n try {\n const ast = DslParser.parse(EncodingParser.withoutArrow(dsl));\n const seriesIdx = findLastIndex(ast, {\n type: 'method',\n name: 'seriesByName',\n });\n const renameIdx = findLastIndex(ast, {\n type: 'method',\n name: 'renameSeries',\n });\n return seriesIdx !== -1 && renameIdx !== -1 && seriesIdx < renameIdx;\n } catch {\n return false;\n }\n};\n\n/**\n * Simple validation to check that a DSL string matches the standard config for the\n * options items field of Dynamic Options.\n */\nconst isItemsDslStandard = (dsl: string): boolean => {\n try {\n const ast = DslParser.parse(EncodingParser.withoutArrow(dsl));\n return (\n ast.length === 3 &&\n isMatch(ast[0], { type: 'method', name: 'frame' }) &&\n isMatch(ast[1], { type: 'method', name: 'prepend' }) &&\n isMatch(ast[2], { type: 'method', name: 'objects' })\n );\n } catch {\n return false;\n }\n};\n\n/**\n * Simple validation to determine if the config of an input matches the schema for the\n * Dynamic Options.\n */\nexport const isConfigAdvanced = ({\n items,\n context,\n}: {\n items?: StaticItem[] | string;\n context: DynamicOptionsContext;\n}): boolean => {\n if (typeof items !== 'string') {\n return false;\n }\n\n const { label, value } = context;\n if (typeof label !== 'string' || typeof value !== 'string') {\n return true;\n }\n\n return !isItemsDslStandard(items) || !isFieldNameDslStandard(label) || !isFieldNameDslStandard(value);\n};\n\n/**\n * Retrieves static items and Dynamic Options for a dropdown/multiselect input from the input\n * config.\n */\nexport const getDynamicOptionsFromConfig = ({\n items,\n context,\n}: {\n items?: StaticItem[] | string;\n context: DynamicOptionsContext;\n}): {\n staticOptions: StaticItem[];\n dynamicOptionsLabel: string;\n dynamicOptionsValue: string;\n} => {\n if (Array.isArray(items)) {\n return {\n staticOptions: items,\n dynamicOptionsLabel: '',\n dynamicOptionsValue: '',\n };\n }\n\n const statics = context.statics || [];\n const staticOptions = zipWith(...statics, (label: string, value: string) => ({\n label,\n value,\n }));\n\n const { label, value } = context;\n\n const dynamicOptionsLabel = label ? getFieldFromFieldNameDsl(label) : '';\n const dynamicOptionsValue = value ? getFieldFromFieldNameDsl(value) : '';\n\n return {\n staticOptions,\n dynamicOptionsLabel,\n dynamicOptionsValue,\n };\n};\n","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/extends\");","module.exports = require(\"@splunk/react-icons/ArrowDown\");","module.exports = require(\"@splunk/react-icons/ArrowUp\");","module.exports = require(\"@splunk/react-icons/ArrowsRectangularDouble\");","module.exports = require(\"@splunk/react-icons/Chain\");","module.exports = require(\"@splunk/react-icons/ChevronsSlash\");","module.exports = require(\"@splunk/react-icons/Cross\");","module.exports = require(\"@splunk/react-icons/List\");","module.exports = require(\"@splunk/react-icons/ListNumbered\");","module.exports = require(\"@splunk/react-icons/Pencil\");","module.exports = require(\"@splunk/react-icons/Picture\");","module.exports = require(\"@splunk/react-icons/QuotationDouble\");","module.exports = require(\"@splunk/react-icons/SlidersDoubleHorizontal\");","module.exports = require(\"@splunk/react-icons/TextBBold\");","module.exports = require(\"@splunk/react-icons/TextH\");","module.exports = require(\"@splunk/react-icons/TextIItalic\");","module.exports = require(\"@splunk/react-icons/TrashCanCross\");","module.exports = require(\"@splunk/react-ui/Button\");","module.exports = require(\"@splunk/react-ui/Chip\");","module.exports = require(\"@splunk/react-ui/Color\");","module.exports = require(\"@splunk/react-ui/ColumnLayout\");","module.exports = require(\"@splunk/react-ui/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Dropdown\");","module.exports = require(\"@splunk/react-ui/FormRows\");","module.exports = require(\"@splunk/react-ui/Link\");","module.exports = require(\"@splunk/react-ui/Markdown\");","module.exports = require(\"@splunk/react-ui/Menu\");","module.exports = require(\"@splunk/react-ui/Message\");","module.exports = require(\"@splunk/react-ui/Multiselect\");","module.exports = require(\"@splunk/react-ui/Number\");","module.exports = require(\"@splunk/react-ui/Popover\");","module.exports = require(\"@splunk/react-ui/RadioBar\");","module.exports = require(\"@splunk/react-ui/ScreenReaderContent\");","module.exports = require(\"@splunk/react-ui/Select\");","module.exports = require(\"@splunk/react-ui/Slider\");","module.exports = require(\"@splunk/react-ui/Switch\");","module.exports = require(\"@splunk/react-ui/Text\");","module.exports = require(\"@splunk/react-ui/TextArea\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/themes/variables\");","module.exports = require(\"@splunk/ui-utils/format\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/ui-utils/id\");","module.exports = require(\"@splunk/visualization-color-palettes\");","module.exports = require(\"@splunk/visualization-color-palettes/editors/PresetPalettes\");","module.exports = require(\"@splunk/visualization-context/DataSourceContext\");","module.exports = require(\"@splunk/visualization-context/FeatureFlagContext\");","module.exports = require(\"@splunk/visualization-context/MessageContext\");","module.exports = require(\"@splunk/visualization-encoding/DslParser\");","module.exports = require(\"@splunk/visualization-encoding/EncodingParser\");","module.exports = require(\"@splunk/visualization-encoding/Options\");","module.exports = require(\"@splunk/visualization-encoding/utils/dsl\");","module.exports = require(\"@splunk/visualization-encoding/utils/types\");","module.exports = require(\"@splunk/visualization-icons/PresetIcons\");","module.exports = require(\"@splunk/visualizations-shared/colorUtils\");","module.exports = require(\"@splunk/visualizations-shared/dataSourceUtils\");","module.exports = require(\"@splunk/visualizations-shared/style\");","module.exports = require(\"@splunk/visualizations-shared/trellisUtils\");","module.exports = require(\"@uiw/react-md-editor/nohighlight\");","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};","// 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__(9952);\n"],"names":["NumberEditor","onChange","name","value","labelPosition","labelWidth","label","min","max","step","isDisabled","help","helpFormat","defaultValue","onValueChange","useCallback","event","v","newValue","parseFloat","Number","isFinite","currentValue","handleChange","handleBlur","handleFocus","handleKeyPress","useNumberInput","React","ControlGroup","undefined","tooltip","tooltipDefaultPlacement","SUINumber","onBlur","onFocus","onKeyDown","disabled","propTypes","T","isRequired","PercentEditor","n","Math","round","require","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","e","blockedURI","this","state","urlValue","disposition","setState","violationType","src","img","Image","onload","handleImageUpload","onerror","validUrl","key","preventDefault","checkImage","_this$inputRef$curren","inputRef","current","contains","relatedTarget","element","addEventListener","filename","imageDataURI","componentDidMount","document","violationHandler","componentWillUnmount","removeEventListener","render","enableImageFileUpload","enableSvgHttpDownloader","enableGallerySharingWarning","context","validImageTypes","shouldShowURLField","svgRenderAsDom","errorMessage","CSPMessage","type","Message","appearance","Text","canClear","handleURLChange","handleTextKeyDown","style","elementRef","trackInputRef","ImageFileReader","defaultFilename","defaultImageDataURI","onImageChange","handleOnImageChange","allowExtensions","FeatureFlagContext","defaultProps","RemoveButtonIcon","Cross","ImageUrlReaderContainer","StyledImagePreview","variables","borderColor","StyledTitleContainer","backgroundColorPage","contentColorDefault","StyledTitle","spacingMedium","StyledRemoveButton","Button","attrs","contentColorActive","actionColorBackgroundSecondaryHover","StyledImageThumbnail","mixins","reset","ImageThumbnail","onImageRemove","noop","overrideCSPViolation","useCSPViolationObserver","icon","onClick","alt","MessageContainer","ImageEditor","validMediaTypes","imageRegistry","useContext","ImageContext","dataUri","setDataUri","useState","fileName","setFileName","uploadImage","async","file","imageDataUri","imageId","upload","error","console","warn","handleUpload","handleRemove","useEffect","obj","registry","isResourceURL","getByURL","dataURI","metaData","getImageData","populateData","StyledThresholdError","ThresholdError","id","thresholdIndex","sprintf","ThresholdBoundary","dataTest","boundary","isEditable","errorId","onRequestClose","onValidate","boundaryValue","setBoundaryValue","handleFromChange","handleKeyDown","inline","hideStepButtons","describedBy","defaultThresholdColors","getUpdatedThresholdConfig","thresholds","length","updatedThresholds","map","threshold","updatedThreshold","_objectSpread","from","to","openLowerBounds","filter","t","otherThresholds","uniqBy","sortedOtherThresholds","sort","a","b","openLowerBound","forEach","el","validateThresholdBoundary","thresholdValueStr","thresholdValue","isNaN","StyledAddThreshold","AddThreshold","onAddThreshold","showInput","setShowInput","setError","handleInputToggle","handleBoundaryChange","validationResult","handleValidateBoundary","isError","StyledThresholdBoundaryInput","StyledThresholdBoundaryText","ToContentSpan","ToContentValue","ToContent","ToTooltip","Tooltip","content","ThresholdTo","isRemovable","isFirst","prefix","StyledThresholdLevel","StyledThresholdValueArea","StyledRemoveArea","spacingXSmall","spacingXXLarge","RemoveAreaButton","contentColorDisabled","interactiveColorOverlayDrag","Threshold","editFrom","editTo","editValue","onRemove","renderThresholdValueEditor","newFrom","handleToChange","newTo","val","useMemo","createDOMID","ClearIcon","defaultRanges","ThresholdList","ranges","openRanges","errors","setErrors","handleRemoveThreshold","result","cloneDeep","errs","handleChangeThreshold","fromValueStr","fromValue","validateThresholdUpperBoundary","withoutCurrent","Object","keys","hasErrors","canRemove","ThresholdColor","Color","isColor","hideInput","palette","Col","ThresholdEditor","itemSchema","isTogglable","isEnabled","Array","isArray","setDefaultThresholds","default","clearThresholds","handleEnableClick","handleAddThreshold","existingThresholds","thresholdColors","diff","difference","getNewThresholdColor","sortedThresholds","handleThresholdChange","Switch","selected","role","editorTypeToComponentMap","CheckboxEditor","RadioBarEditor","SelectEditor","TextEditor","TextAreaEditor","ToggleEditor","ColorEditor","PresetSelectorEditor","DynamicColorEditor","DynamicColorEditorWithPrecedence","ColumnMultiSelectionEditor","ColumnSelectionEditor","TableColumnFormatterEditor","TableBackgroundColorEditor","TableDynamicColorEditor","SliderEditor","MarkdownEditor","StaticItemEditor","DynamicItemEditor","ArrayOfStringsEditor","MultiColorPickerEditor","SeriesColorsEditor","SeriesColorsByFieldEditor","ColumnMultiSelectionByFieldNameEditor","TrellisSplitBySelectionEditor","NetworkGraphDynamicColorEditor","EditorItem","item","dataSourceBindings","options","optionsSchema","editor","Editor","Error","staticItemSchema","getStaticItemSchema","option","encoding","_extends","editorProps","isOption","placeholder","isAdvanced","TextContainer","inputHeight","StyledText","getColor","color","defaultColor","prevColor","newColor","trim","ColorAndTextWrapper","showTextInput","handleColorChange","labelledBy","textWidth","handleTextColorChange","textLabelId","append","ScreenReaderContent","prepend","height","inputId","defaultItemSchema","emptyStyle","COLOR_EDITOR_PALETTE","hideLabel","customEditorStyle","setColor","debouncedOnChange","debounce","_event","colorToValue","toLower","controlsLayout","values","getOptions","hasTokens","controlGroupMarginFix","marginTop","RadioBar","editorStyle","displayContent","optionProps","startAdornment","hideDefaultTooltip","Select","description","RowContainer","formRowHeader","removeItem","items","_item","idx","isItemError","i","isLabelError","isValueError","InputContainer","validate","staticItems","setItems","nextIndex","setIndex","newItems","isEqual","some","handleRequestRemove","_evt","handleRequestMove","fromIndex","toIndex","handleItemChange","_name","handleRequestAdd","concat","rows","l","FormRows","onRequestRemove","addLabel","header","onRequestAdd","onRequestMove","defaultLabelStyle","_ref","labelStyle","otherProps","_objectWithoutProperties","_excluded","setValueState","handleValidate","errorState","setErrorState","debouncedHandleValidate","newVal","cancel","newError","message","enum","JSON","stringify","handleOptionsChange","visualization","onVisualizationChange","omit","isMultipleRulesSchema","anyOf","isDynamicOptionSchema","schema","pattern","DYNAMIC_OPTIONS_DSL_PATTERN","isNestedOption","optionName","exec","staticSchema","find","getFormatterConfig","contextConfig","formatters","formatterFromDSL","selectedDataSelector","_currentFormatter$def2","_currentFormatter$def","currentFormatter","formatter","defaults","isContextCompatibleWithFormatter","formatterType","isSupportedDataSelector","dataSelectors","ds","isSupportedFormatter","selectedFormatterType","formattersFromEditor","supportedFormatters","fm","getFilteredRowsByShowEditor","row","featureFlags","showEditor","removeEmptyEntries","returnObj","forIn","isPlainObject","getToggleOffValueForDataColors","includes","hasAreaValuesSelector","isChoroplethLayer","layerType","layerMatch","_options$layers","layerIndex","parseInt","layer","layers","convertEmptyDataColorsForChoropleth","setOption","oldVisualization","optionSchema","defaultOverrides","_newOption","_defaultOverrides$new","_optionSchema$newOpti","_obj$options","newOption","schemaDefault","set","TokenRegExp","RegExp","source","test","menuStyle","display","safeValues","toString","currentValues","setCurrentValues","allowNewValues","selectAllAppearance","StyledTooltip","StyledSwitch","hasChip","CheckboxInfo","div","fontSizeSmall","StyledChip","CenteredLabel","span","sortValues","variantForSelectedState","helpTextLink","chipText","handleClick","href","EDITOR_NAME","defaultFilterByTypes","filterByTypes","dataSource","useDataSource","dataSourceKey","hasError","isMissing","isLoading","getDataSourceStateInfo","columns","fields","data","fieldsWithTypes","getAvailableFieldsWithTypes","fieldNames","sanitizeFieldNames","field","handleFieldNameChange","isLoadingOptions","compact","Option","f","BaseEditorPropTypes","bool","oneOf","isInternal","startsWith","prepareValue","shouldShowInternalFields","excludeByNames","adjustedDataSource","_c","adjustedColumns","adjustedFields","get","availableFieldsWithTypes","setFilter","getFieldsFromDSL","selectedFields","setSelectedFields","filteredFields","footerMessage","useColumnSelectorFooterMessage","availableFields","handleValuesChange","selectedValues","seriesNamesStr","update","handleFilterChange","keyword","placeholderMessage","getPlaceholderMessage","defaultMessage","onFilterChange","hideEditorWhenLoading","fieldName","selectedField","setSelectedField","handleValueChange","selectedValue","useRef","onResetToDefault","open","setOpen","anchor","handleOpen","handleRequestClose","ref","defaultPlacement","FlyoutHeader","StyledLabel","StyledFlyoutContent","toPx","FLYOUT_PADDING","FLYOUT_WIDTH","StyledButton","prepareUpdate","currentFormatterConfig","contextKey","extractedContextKey","replace","buildDSLFromDataSelectorAndFormatter","flyoutTitle","defaultPalettesConfig","showStaticTextColor","colorMode","handleColorModeChange","showFlyout","setShowFlyout","buttonRef","paramKey","formatterContextKey","getLastFormatterFromDSL","dataSelectorFromDSL","getDataSelectorsFromDSL","setSelectedFormatterType","setSelectedDataSelector","formatterConfigFromDSL","setCurrentFormatterConfig","handleResetToDefault","isDefault","isEmpty","defaultFormatter","defaultDataSelector","formatterCfg","handleButtonClick","FormatterConfigPreview","preview","config","padding","takeFocus","optionLabel","optionValue","FormatterEditor","onDataSelectorChange","editorName","newDataSelector","onFormatterTypeChange","newFormatter","onFormatterConfigChange","newFormatterConfig","DynamicColorEditorPropTypes","isValueInOffState","isDynamicEditorEnabled","setDynamicEditorEnabled","handleToggleChange","_optionStanza","prevState","updatedOptions","updatedContext","dataSelectorValues","dataColorsEditorConfig","defaultGradientContext","areaValues","endsWith","dataSelector","defaultContext","handleDynamicColorEditorChange","optionStanza","defaultHelpText","dynamicItemsLabelField","setLabel","dynamicItemsValueField","setValue","staticOptions","dynamicOptionsLabel","dynamicOptionsValue","getDynamicOptionsFromConfig","primary","formattedConfig","formattedStatics","statics","newLabelField","newValueField","unzip","number","handleStaticItemChange","handleDynamicLabelFieldChange","newLabel","handleDynamicValueFieldChange","prepareDynamicFieldValue","fieldDsl","getFieldFromFieldNameDsl","isConfigAdvanced","dataSourceConfigured","gutter","VERTICAL_EDITOR_SPACING","Row","func","string","oneOfType","arrayOf","shape","any","TOOLBAR_COMMANDS","commands","heading3","bold","italic","link","quote","code","image","unorderedListCommand","orderedListCommand","sansFontFamily","Toolbar","StyledTextArea","HiddenPreview","ToolbarButtonStyled","errorPriority","warning","other","ToolbarButton","memo","command","isFocusable","onExecute","buttonProps","title","contentRelationship","renderAnchor","tooltipAnchorOnFocus","tooltipAnchorOnClick","anchorProps","tabIndex","displayName","object","defaultErrors","instanceId","textareaRef","focusableCommand","setFocusableCommand","orchestratorRef","TextAreaCommandOrchestrator","executeCommand","hiddenMarkdownPreview","text","imageRenderer","errorCallback","Infinity","onError","handleToolbarKeyDown","target","tagName","toolbar","currentTarget","buttons","querySelectorAll","currentIndex","prevPressed","nextPressed","firstPressed","lastPressed","newFocus","focus","handleTextareaKeyDown","shortcuts","objectOf","popoverStyle","colorButtonStyle","interactiveColorBackground","ColorChip","neutral100","backgroundColorPopup","fontFamily","ColorListEditor","ColorFlyoutEditor","colors","CustomColorMatchEditor","handleColorRemove","addColorButtonLabel","handleColorAdd","handleColorMove","ColorRowItems","justifyContent","canReorderColors","vizColors","VIZ_CATEGORICAL","canAddNewColors","setColors","userColorsSet","Set","nextColor","has","countMap","Map","minCount","count","colorsCopy","movedColor","handleFlyoutClose","reason","srcElement","sortableHandle","ColorChips","toggleShowFlyout","isShown","contextName","getCurrentColoringType","coloringType","setColoringType","newColoringType","handleSelectChange","selectedName","defaultConfig","dsl","handleStaticColorChange","alignItems","Column","TOTAL_COLUMN_SPAN","StyledHeader","PresetHeaderLabel","PresetList","ul","PresetListItem","li","PresetOption","button","interactiveColorOverlaySelected","interactiveColorOverlayHover","focusShadow","PresetIconWrapper","PresetLabelWrapper","PresetLabel","PresetOptionWrapper","presetName","presetLabel","presetValue","selectedPreset","onPopoverClick","PresetIcon","handlePopoverClick","animation","presets","isFlyoutOpen","setIsFlyoutOpen","setSelectedPreset","setAnchor","anchorRef","parentNode","popoverId","isMenu","defaultOptions","defaultOptionsSchema","isCategorical","setFields","category","dsFields","isDslString","results","Options","evaluate","editorLabel","getUpdatedValue","updatedColors","updatedFields","updatedValue","newField","dsField","delRowIndex","findIndex","handleFieldChange","newFieldIndex","currFieldIndex","doesFieldExist","existingFieldIndex","currField","FieldSelector","SelectOptions","FieldEditor","PALETTES","custom","NameWrapper","PaletteWrapper","ColorPreviewWrapper","overrideCustomPalette","originalPalettes","selectedPalette","setSelectedPalette","palettes","setPalettes","handleMenuSelect","paletteId","newColors","prev","toggle","renderMenuItem","paletteConfig","paletteName","Item","selectable","ColorPreview","maxColorCount","expandToFillHorizontalSpace","isCustomPaletteAvailable","DROPDOWN_MENU_WIDTH","Divider","numberStyle","flexBasis","flexGrow","flexShrink","StyledSlider","maxLabel","minLabel","stepMarks","handleSliderChange","handleNumberChange","displayValue","suiStepMarks","getObjectFromMap","objectFromMap","columnColoringConfig","defaultOptionsByType","flyoutConfig","textFormatConfig","vizContext","columnFormat","columnFormatOption","tableFormat","tableFormatOption","editorSupportedFormatOptions","getEditorSupportedFormatOptions","editorColumnFormatting","setEditorColumnFormatting","getInitialColumnFormattingState","coloringTypes","handleResetColumnToDefault","columnName","columnDataType","dataType","getFormattingOptDSLKey","sourceCustomizedFormatByType","formatByTypeConfigOptsToReset","reduce","resetConfig","optToClear","formatText","getExistingTextFormatting","updatedEditorColumnFormatting","updatedColumnFormatEntry","columnColoring","_meta","dynamicallyColoredOption","formatByType","exceedsEditorCapabilities","getColumnFormatDefFromState","updateDefinition","updatedColumnEntry","skipOnChange","handleColumnColoringUpdate","colorContextKey","colorOptionDSL","colorContextConfig","handleColumnFormattingUpdate","newOptionValue","defaultsDeep","handleTextFormattingUpdate","updatedTextFormatEntry","handleAddColumnFormatting","columnDSLContextKey","columnEntryToInsert","supportedOptions","columnFormatConfig","checkExceedsEditorCapabilities","globalFormattingForDataType","getGlobalTableFormatting","TextDataType","handleRemoveColumnFormatting","delete","columnToRemove","persistedFormatByType","rowColorsContextKey","rowBackgroundColorsContextKey","rowColors","colorOptionsDSL","rowBackgroundColors","columnFormatterEntries","columnFormatEntry","isSourceCustomized","columnFormattingByType","columnTextFormatting","flyoutConfigForDataType","removeColumnFormatting","resetColumnToDefault","updateColumnColoring","updateColumnFormatting","updateColumnTextFormatting","columnFormatting","disableToggle","initialMode","setColorMode","currentTableFormat","Boolean","currentFormat","hasDsl","assign","clearDynamicColoring","tableFormatEditorConfig","modeValue","moveDslBetweenModes","pick","enterprise","dark","css","textDisabledColor","backgroundColorHover","setVal","isReversed","ColorPreviewItem","widthGrow","trueColors","reverse","_i","sharedPalettesConfigPropType","exact","paletteTheme","paletteEntry","getSortedRanges","rangesToSort","DEFAULT_GRADIENT_PALETTES_CONFIG","RangeValueEditorWrapper","rangeValues","MatchValueEditorWrapper","matchValues","match","GradientEditorWrapper","stops","defaultGradient","createGradientConfigFromPalettes","gradientValues","textColor","gradient","rangeValue","RangeValuePreview","matchValue","MatchValuePreview","validFormatterTypes","formatterConfigPropType","showDataSelectorButtonGroup","formatterSelectorLabel","filteredFormatters","showFormatterButtonGroup","FormatterConfigEditor","AddStopWrapper","AddStopButtonWrapper","ReverseStopWrapper","ButtonStyle","marginRight","reverseIcon","AddAndReverseStops","disableAddStops","handleAddStop","handleReverse","colorIndex","toLowerCase","defaultPalette","getLuminance","hex","c","split","x","substring","GradientPreview","gradientString","firstColor","lastColor","arrowDownColor","arrowUpColor","colorDown","colorUp","borderRadius","background","StyledControlGroup","TextColorContainer","TextColorWrapper","SwatchWrapper","AutoSwatch","SwatchButton","ClearButton","AutoTextDisplay","AUTO_OPTION","DEFAULT_PALETTE_COLOR","GradientTextColor","onTextColorChange","isAuto","setIsAuto","colorRef","handleInputChange","handleClear","GradientValueConfigurerWrapper","GradientsWrapper","GradientEntry","GradientLeft","GradientLabel","contentColorMuted","GradientValueConfigurer","swatchColors","setIsReversed","selectedColors","isSwatchCustomized","disableAddStopsProp","setDisableAddStops","isCustomSelected","setIsCustomSelected","shouldDisable","newTextColor","handleRemoveStop","indexToRemove","unused","newIsCustomSelected","addPaletteGradientStop","addCustomGradientStop","reversedColors","payload","newSelectedColors","RemoveStopWrapper","RemoveStopButton","RemoveStop","handleOnRemove","defaultDarkGradientConfig","DARK_COLORS","sequential","swatches","defaultLightGradientConfig","LIGHT_COLORS","createDefaultPalettesConfig","providedConfig","palettesConfig","showTextColor","defaultedConfig","paletteColors","interpolateColor","color1","color2","factor","hex1","hex2","r1","g1","b1","r2","g2","b2","r","g","toHex","padStart","customIndices","highestColor","beforeHighestColor","startIdx","endIdx","colorA","colorB","falseIndices","j","m","swatch","insertIndex","colorToAdd","findMatchingPaletteGradient","colorArr","paletteObj","candidates","theme","themePalettes","entries","flatMap","entry","fullMatch","compareArr","inputMiddle","swatchMiddle","every","first","GradientEditor","initialIsReversed","initialPaletteTheme","initialPaletteEntry","setPalettesConfig","selectedPaletteTheme","selectedPaletteEntry","currentSwatchColors","getSwatchColorsFromPalette","paletteInfo","hasCustomColors","limitedColors","handleOnGradientValueChange","onChangePaletteTheme","newPaletteTheme","onPaletteChange","selectedPaletteInfo","AddMatchWrapper","AddMatchButtonWrapper","ReverseMatchWrapper","reverseMatchButtonStyle","AddAndReverseMatches","disableAddMatches","handleAddMatch","MatchValueConfigurerWrapper","MatchesWrapper","MatchEntry","MatchValueConfigurer","customizedColors","precedence","newMatchValues","getNewColors","numColors","handleUpdateMatch","matchIndex","isNumeric","handleRemoveMatch","newSelectedColorsWithCurrentOmitted","initialValue","updateMatch","MatchTextWrapper","TextRowWrapper","MatchErrorMessage","contentColorNegative","shouldUpdate","MatchValueText","updatedMatchValue","setUpdatedMatchValue","isFocused","setIsFocused","handleOnFocus","handleOnChange","handleOnBlur","handleOnKeyUp","onKeyUp","RemoveMatchWrapper","RemoveMatchButton","RemoveMatch","getMatches","matches","MATCH_VALUE_WILDCARD_INFO_TEXT","MatchValueWildcardInfo","matchValuesToContextConfig","MatchValueEditor","acc","next","inferInitialPaletteFromContext","hasInitiallyReversedColors","minimumNumberOfColors","calculateNewColors","newSwatchColors","getPrecedenceFromPalette","colorIdx","getNewColorsFromPalette","newMatches","newPaletteInfo","handleOnMatchValueChange","shouldShowArrows","paletteThemes","filteredThemedPalettes","getThemedPalettesWithoutMeta","ColorPreviewSpacer","CustomizedSwatchText","previewColors","initialPalettePreview","spacingSmall","menuItems","arr","Heading","toUpperCase","isSelected","PresetPaletteTheme","onPaletteThemeChange","swatchColorMap","filteredPalettes","hasMatchingPrecedence","precedenceIndex","currentPaletteColors","reversedPrecedence","selectedColor","defaultPalettes","matchingPalette","matchedPrecedence","paletteType","precedenceForLength","k","AddRangeWrapper","AddRangeButtonWrapper","ReverseRangeWrapper","AddAndReverseRanges","disableAddRanges","handleAddRange","RangeBoundaryText","BoundaryErrorMessage","StyledNumberEditor","BoundaryRowWrapper","RangeBoundaryWrapper","handleUpdateRangeBoundary","rangeBoundaryIndex","updateRangeBoundary","rangeText","showNumberEditor","boundaryInputValue","setBoundaryInputValue","_e","valueToUse","RangeValueConfigurerWrapper","RangesWrapper","RangeEntry","getRangeText","lastColorIndex","RangeValueConfigurer","newRangeValues","handleRemoveRange","isLastItem","rangeBoundaryValue","RemoveRangeWrapper","RemoveRangeButton","RemoveRange","rangeValuesToContextConfig","RangeValueEditor","sortedRanges","newRanges","handleOnRangeValueChange","StyledSelectOption","getFilteredFields","noSelectedFieldsInfo","handleAddColumn","tuple","FLAT_BY_THEME","ALT_BY_THEME","FLAT_BY_COLOR","ALT_BY_COLOR","HEADER_BACKGROUND_BY_COLOR","ROW_COLOR_BY_CONTRAST","HEADER_COLOR_BY_CONTRAST","DEFAULT_BACKGROUND_COLOR","calculateState","defaultBackgroundColor","disableColor","shouldAltRows","disableAltRows","backgroundColor","calculateOptionOnBackgroundColorChange","defaultThemeBackgroundColor","newOptions","headerColor","headerBackgroundColor","calculateOptionsOnAltRowsChange","themes","ThemeContext","handleAltChange","ColumnColorEditorWrapper","FormatterMethodWrapper","columnColoringConfigPropType","getStaticColor","themeContext","getSelectedFormatterUponOpen","selectedFormatterFromDSL","formatterOption","ColumnColorEditor","staticTextColor","dynamicallyColoredOptionFromDef","selectedFormatter","setSelectedFormatter","setDynamicallyColoredOption","formatterConfig","setFormatterConfig","handleDynamicallyColoredOptionChange","newDynamicallyColoredOption","updatedColoringTypes","sanitizedColName","sanitizeColumnName","upperFirst","formatterName","newColorContextConfig","handleFormatterConfigChange","_editorName","handleFormatterChange","evt","formatterValue","newlySelectedFormatter","ColumnFormatterToggle","light","backgroundColorSection","prisma","PopoverContents","SelectedColumnLabel","IconsWrapper","ColumnFormatterHeader","flyoutOpen","setFlyoutOpen","handleFlyoutOpen","dataTestKey","updates","fromMode","toMode","fromKey","rowKey","rItr","FormatByTypeEditorContents","COLUMN_FLYOUT_PADDING","getEditorItemValue","editorPersistedValue","handleUpdateColumnFormatting","iItr","editorItem","colSpan","colKey","supportedTextFormatTypes","align","headerAlign","textOverflow","supportedColumnFormatEditorOptions","columnFormatOptions","textFormatType","textFormatValue","configRow","getColumnDataTypeMap","zippedColumnsAndFields","sanitizedColumnName","configFormat","configFormatOption","formattingOpt","tableFormatOpt","tableFormatDSLContextKey","isValidColorFormatter","columnDataTypeMap","initialState","columnFormatByTypeContextConfig","hasInvalidContextKey","subOption","isColumnFormatEditorConfigurable","rowColorsFormatter","rowBackgroundColorsFormatter","hasEditorSupportedColoring","preexistingFormatByTypeConfig","columnFormattingEditorContextConfig","editorDerivedColumnFormatOption","contextFormattingKey","unset","contextConfigEntry","formattingDataType","textFormatOption","flyoutConfigPropType","sparkline","time","AGGREGATIONS","defaultPrepareValueFn","featureFlagContext","isTrellisFeatureFlagOn","visualizations_enableTrellis","splitByFieldsObject","getAllPossibleSplitByFields","defaultSelection","selectedFieldName","splitByFields","splitByFieldsResults","aggregations","selectedFilteredFields","validSelectedFields","ColumnSelectorFooterMessage","numSelected","numFiltered","numAvailable","violation","setViolation","dataSourceApi","setDataSource","unsubscribe","isFunction","subscribe","snapshot","NEGATIVE_INFINITY","POSITIVE_INFINITY","setCurrentValue","isFocusedRef","commitValue","handleChangeDebounced","useLayoutEffect","targetValue","eventValue","clampedValue","clamp","ControlGroupContainer","StyledToolTip","StyledAdvancedConfigButton","AdvancedConfigButton","AdvancedControlGroup","children","onAdvancedConfigButtonClick","Children","toArray","child","cloneElement","flex","Wrapper","cspMessageLink","openInNewContext","Icon","node","ClickableIcon","footerMessageText","filtered","available","shown","defaultHeaderText","defaultInfo","defaultResetButtonText","PopoverContent","PopoverHeader","headerText","info","resetButtonText","CustomizedInSourceMessage","FormatFieldName","fontStyle","canInferTypeFromMeta","getDataTypeForMeta","inferDataTypeFromData","ast","DslParser","parse","withoutArrow","seriesByNameNode","isFieldNameDslStandard","seriesIdx","findLastIndex","renameIdx","isMatch","isItemsDslStandard","zipWith","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","call","getter","__esModule","d","definition","o","defineProperty","enumerable","prop","prototype","hasOwnProperty","Symbol","toStringTag","__webpack_exports__"],"sourceRoot":""}
1
+ {"version":3,"file":"EditorItem.js","mappings":";;;;iRAMA,MAAMA,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/C,QAAQ,oB,GCCrB0/C,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqB3gD,IAAjB4gD,EACH,OAAOA,EAAaJ,QAGrB,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,CAAC,GAOX,OAHAK,EAAoBF,GAAUG,KAAKP,EAAOC,QAASD,EAAQA,EAAOC,QAASE,GAGpEH,EAAOC,OACf,CCrBAE,EAAoB9/C,EAAK2/C,IACxB,IAAIQ,EAASR,GAAUA,EAAOS,WAC7B,IAAOT,EAAiB,QACxB,IAAM,EAEP,OADAG,EAAoBO,EAAEF,EAAQ,CAAE10C,EAAG00C,IAC5BA,CAAM,ECLdL,EAAoBO,EAAI,CAACT,EAASU,KACjC,IAAI,IAAIz9C,KAAOy9C,EACXR,EAAoBS,EAAED,EAAYz9C,KAASi9C,EAAoBS,EAAEX,EAAS/8C,IAC5EgN,OAAO2wC,eAAeZ,EAAS/8C,EAAK,CAAE49C,YAAY,EAAM59B,IAAKy9B,EAAWz9C,IAE1E,ECNDi9C,EAAoBS,EAAI,CAAC33C,EAAK83C,IAAU7wC,OAAO8wC,UAAUC,eAAeV,KAAKt3C,EAAK83C,GCClFZ,EAAoBnY,EAAKiY,IACH,oBAAXiB,QAA0BA,OAAOC,aAC1CjxC,OAAO2wC,eAAeZ,EAASiB,OAAOC,YAAa,CAAErjD,MAAO,WAE7DoS,OAAO2wC,eAAeZ,EAAS,aAAc,CAAEniD,OAAO,GAAO,ECF9D,IAAIsjD,EAAsBjB,EAAoB,M","sources":["webpack://@splunk/dynamic-editors/./src/editors/NumberEditor.jsx","webpack://@splunk/dynamic-editors/./src/editors/PercentEditor.jsx","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","webpack://@splunk/dynamic-editors/./src/editors/threshold/ThresholdError.jsx","webpack://@splunk/dynamic-editors/./src/editors/threshold/ThresholdBoundary.jsx","webpack://@splunk/dynamic-editors/./src/utils/threshold.js","webpack://@splunk/dynamic-editors/./src/editors/threshold/AddThreshold.jsx","webpack://@splunk/dynamic-editors/./src/editors/threshold/ThresholdTo.jsx","webpack://@splunk/dynamic-editors/./src/editors/threshold/Threshold.jsx","webpack://@splunk/dynamic-editors/./src/editors/threshold/ThresholdList.jsx","webpack://@splunk/dynamic-editors/./src/editors/threshold/ThresholdColor.jsx","webpack://@splunk/dynamic-editors/./src/editors/ThresholdEditor.jsx","webpack://@splunk/dynamic-editors/./src/containers/EditorItem.jsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/colorConstants\"","webpack://@splunk/dynamic-editors/./src/editors/ColorEditor.jsx","webpack://@splunk/dynamic-editors/./src/editors/RadioBarEditor.jsx","webpack://@splunk/dynamic-editors/./src/editors/SelectEditor.jsx","webpack://@splunk/dynamic-editors/./src/editors/StaticItemEditor.jsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/objectWithoutProperties\"","webpack://@splunk/dynamic-editors/./src/editors/TextEditor.jsx","webpack://@splunk/dynamic-editors/./src/editors/ToggleEditor.jsx","webpack://@splunk/dynamic-editors/./src/shared/Header.jsx","webpack://@splunk/dynamic-editors/./src/shared/Separator.jsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/schemaUtils\"","webpack://@splunk/dynamic-editors/./src/utils/EditorFunctions.js","webpack://@splunk/dynamic-editors/./src/utils/token.js","webpack://@splunk/dynamic-editors/./src/editors/ArrayOfStringsEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/CheckboxEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/ColumnMultiSelectionByFieldNameEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/ColumnMultiSelectionEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/ColumnSelectionEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/CustomizedInSourceEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/DynamicColorEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/DynamicColorEditorWithPrecedence.tsx","webpack://@splunk/dynamic-editors/./src/editors/DynamicItemEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/MarkdownEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/MultiColorPickerEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/NetworkGraphDynamicColorEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/PresetSelectorEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/SeriesColorsByFieldEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/SeriesColorsEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/SliderEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/TableColumnFormatterEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/TableDynamicColorEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/TextAreaEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/ColorPreview.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/FormatterEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Gradient/AddAndReverseStops.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Gradient/GradientColor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Gradient/GradientPreview.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Gradient/GradientTextColor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Gradient/GradientValueConfigurer.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Gradient/RemoveStop.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Gradient/gradientUtils.ts","webpack://@splunk/dynamic-editors/./src/editors/formatters/GradientEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValue/AddAndReverseMatches.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValue/MatchColor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValue/MatchValueConfigurer.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValue/MatchValueText.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValue/RemoveMatch.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValue/matchValueUtils.ts","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValueEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/MatchValuePreview.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Palettes/PalettesConfigurer.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Palettes/PalettesDropdown.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Palettes/PresetPaletteTheme.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/Palettes/paletteUtils.ts","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValue/AddAndReverseRanges.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValue/RangeBoundary.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValue/RangeColor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValue/RangeValueConfigurer.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValue/RemoveRange.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValue/rangeValueUtils.ts","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValueEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/formatters/RangeValuePreview.tsx","webpack://@splunk/dynamic-editors/./src/editors/table/AddColumn.tsx","webpack://@splunk/dynamic-editors/./src/editors/table/BackgroundColor.tsx","webpack://@splunk/dynamic-editors/./src/editors/table/ColumnColorEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/table/ColumnFormatterEntry.tsx","webpack://@splunk/dynamic-editors/./src/editors/table/DynamicColorUtils.ts","webpack://@splunk/dynamic-editors/./src/editors/table/FormatByTypeEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/table/columnFormattingUtils.ts","webpack://@splunk/dynamic-editors/./src/editors/table/common/props.ts","webpack://@splunk/dynamic-editors/./src/editors/trellis/TrellisSplitBySelectionEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/useColumnSelectorFooterMessage.tsx","webpack://@splunk/dynamic-editors/./src/hooks/useCSPViolationObserver.tsx","webpack://@splunk/dynamic-editors/./src/hooks/useDataSource.tsx","webpack://@splunk/dynamic-editors/./src/hooks/useNumberInput.ts","webpack://@splunk/dynamic-editors/./src/interfaces/BaseEditorProps.ts","webpack://@splunk/dynamic-editors/./src/interfaces/DynamicColorEditorProps.ts","webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/./src/shared/ArrowLayer.tsx","webpack://@splunk/dynamic-editors/./src/shared/CSPMessage.tsx","webpack://@splunk/dynamic-editors/./src/shared/ClickableIcon.tsx","webpack://@splunk/dynamic-editors/./src/shared/ColumnSelectorFooterMessage.tsx","webpack://@splunk/dynamic-editors/./src/shared/CustomizedInSourceMessage.tsx","webpack://@splunk/dynamic-editors/./src/shared/FormatFieldName.tsx","webpack://@splunk/dynamic-editors/./src/shared/MessageContainer.tsx","webpack://@splunk/dynamic-editors/./src/shared/PreviewWrapper.tsx","webpack://@splunk/dynamic-editors/./src/shared/dimensionConstants.ts","webpack://@splunk/dynamic-editors/./src/utils/columnSelectionUtils.ts","webpack://@splunk/dynamic-editors/./src/utils/dynamicItemInputEditor.ts","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/defineProperty\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/extends\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/ArrowDown\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/ArrowUp\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/ArrowsRectangularDouble\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/Chain\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/ChevronsSlash\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/Cross\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/List\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/ListNumbered\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/Pencil\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/Picture\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/QuotationDouble\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/SlidersDoubleHorizontal\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/TextBBold\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/TextH\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/TextIItalic\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/TrashCanCross\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Button\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Chip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Color\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ColumnLayout\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ControlGroup\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Dropdown\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/FormRows\"","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/Menu\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Message\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Multiselect\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Number\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Popover\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/RadioBar\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ScreenReaderContent\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Select\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Slider\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Switch\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Text\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/TextArea\"","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/themes/variables\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/format\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/id\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-color-palettes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-color-palettes/editors/PresetPalettes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-context/DataSourceContext\"","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 \"@splunk/visualization-encoding/DslParser\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-encoding/EncodingParser\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-encoding/Options\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-encoding/utils/dsl\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-encoding/utils/types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-icons/PresetIcons\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/colorUtils\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/dataSourceUtils\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/style\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/trellisUtils\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@uiw/react-md-editor/nohighlight\"","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/webpack/startup"],"sourcesContent":["import React, { useCallback } from 'react';\nimport T from 'prop-types';\nimport SUINumber from '@splunk/react-ui/Number';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { useNumberInput } from '../hooks/useNumberInput';\n\nconst NumberEditor = ({\n onChange,\n name,\n value = null,\n labelPosition = 'top',\n labelWidth,\n label,\n min,\n max,\n step,\n isDisabled,\n help,\n helpFormat = 'under',\n defaultValue,\n}) => {\n const onValueChange = useCallback(\n (event, v) => {\n if (typeof defaultValue === 'undefined' && v == null) {\n // emit onChange if there's no default value and value is null/undefined (clearing the input)\n onChange(event, name, v);\n return;\n }\n\n const newValue = parseFloat(v ?? defaultValue);\n if (Number.isFinite(newValue)) {\n // emit onChange if the value was updated (by the user, or as a result of defaultValue) to a number\n onChange(event, name, newValue);\n }\n },\n [defaultValue, onChange, name]\n );\n\n const { currentValue, handleChange, handleBlur, handleFocus, handleKeyPress } = useNumberInput({\n value,\n min,\n max,\n defaultValue,\n onValueChange,\n });\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n help={helpFormat === 'under' ? help : undefined}\n tooltip={helpFormat === 'tooltip' ? help : undefined}\n tooltipDefaultPlacement=\"top\"\n >\n <SUINumber\n data-test={name}\n min={min}\n max={max}\n step={step}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyDown={handleKeyPress}\n value={currentValue}\n disabled={isDisabled}\n />\n </ControlGroup>\n );\n};\n\nNumberEditor.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.number,\n /**\n * The option default value\n */\n defaultValue: T.number,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['top', 'left']),\n labelWidth: T.number,\n /**\n * Number component props\n */\n min: T.number,\n max: T.number,\n step: T.number,\n /**\n * Disabled state of component\n */\n isDisabled: T.bool,\n /**\n * Text to display under the the input\n */\n help: T.string,\n /**\n * help text format\n */\n helpFormat: T.oneOf(['text', 'under']),\n};\n\nexport default NumberEditor;\n","import React, { useCallback } from 'react';\nimport T from 'prop-types';\nimport NumberEditor from './NumberEditor';\n\nconst PercentEditor = ({\n name,\n value = 0,\n labelPosition = 'top',\n labelWidth,\n label,\n onChange,\n isDisabled = false,\n help,\n}) => {\n const handleChange = useCallback(\n (event, n, v) => {\n // convert to percentage if the value is defined or we will get a NaN\n onChange(event, n, v == null ? v : v / 100);\n },\n [onChange]\n );\n\n return (\n <NumberEditor\n name={name}\n value={Math.round(value * 100)}\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n onChange={handleChange}\n min={0}\n max={100}\n step={1}\n disabled={isDisabled}\n help={help}\n />\n );\n};\n\nPercentEditor.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 labelWidth: T.number,\n /**\n * The option value\n */\n value: T.number,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['top', 'left']),\n /**\n * Disabled state of component\n */\n isDisabled: T.bool,\n /**\n * Text to display under the the input\n */\n help: T.string,\n};\n\nexport default PercentEditor;\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","import React from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { sprintf } from '@splunk/ui-utils/format';\n\nconst StyledThresholdError = styled.div.attrs(() => ({ 'data-test': 'threshold-error' }))`\n color: ${variables.contentColorNegative};\n padding-top: 5px;\n font-size: 12px;\n display: block;\n`;\n\nconst ThresholdError = ({ error, id, thresholdIndex }) => {\n if (error) {\n return (\n <StyledThresholdError id={id}>\n {typeof thresholdIndex === 'number'\n ? sprintf(_('Error for threshold %(thresholdIndex)d : %(error)s'), {\n thresholdIndex,\n error,\n })\n : sprintf(_('Error: %(error)s'), {\n error,\n })}\n </StyledThresholdError>\n );\n }\n\n return null;\n};\n\nThresholdError.propTypes = {\n id: T.string,\n error: T.string,\n thresholdIndex: T.number,\n};\n\nexport default ThresholdError;\n","import React, { useState, useCallback, useEffect } from 'react';\nimport T from 'prop-types';\nimport { noop } from 'lodash';\nimport Number from '@splunk/react-ui/Number';\nimport { sprintf } from '@splunk/ui-utils/format';\nimport { _ } from '@splunk/ui-utils/i18n';\n\nconst ThresholdBoundary = ({\n 'data-test': dataTest = 'threshold-boundary-input',\n boundary,\n isDisabled = false,\n isEditable = true,\n errorId,\n onChange = noop,\n onRequestClose = noop,\n onValidate = noop,\n index,\n}) => {\n const [boundaryValue, setBoundaryValue] = useState(boundary);\n\n useEffect(() => {\n setBoundaryValue(boundary);\n }, [boundary]);\n\n const handleFromChange = useCallback(\n (e, { value }) => {\n setBoundaryValue(value);\n onValidate(value);\n },\n [onValidate]\n );\n\n const handleKeyDown = useCallback(\n e => {\n if (e.key === 'Enter') {\n onChange(boundaryValue);\n }\n if (e.key === 'Escape') {\n onRequestClose();\n }\n },\n [boundaryValue, onChange, onRequestClose]\n );\n\n const handleBlur = useCallback(() => {\n onChange(boundaryValue);\n }, [onChange, boundaryValue]);\n\n const label =\n typeof index === 'number' ? sprintf(_('Threshold number %(index)d'), { index }) : _('Threshold');\n\n return isEditable ? (\n <Number\n aria-label={\n boundaryValue\n ? sprintf(_('%(label)s, value %(boundaryValue)d'), { label, boundaryValue })\n : sprintf(_('%(label)s, no value'), { label })\n }\n inline\n hideStepButtons\n disabled={isDisabled}\n value={boundaryValue || boundaryValue === 0 ? boundaryValue : null}\n onChange={handleFromChange}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n error={!!errorId}\n data-test={dataTest}\n describedBy={errorId}\n />\n ) : null;\n};\nThresholdBoundary.propTypes = {\n 'data-test': T.string,\n boundary: T.number,\n isDisabled: T.bool,\n isEditable: T.bool,\n errorId: T.string,\n onChange: T.func,\n onRequestClose: T.func,\n onValidate: T.func,\n index: T.number,\n};\n\nexport default ThresholdBoundary;\n","import { difference, get, isNaN, omit, uniqBy } from 'lodash';\n\nimport { _ } from '@splunk/ui-utils/i18n';\n\nexport const defaultThresholds = [\n {\n from: 100,\n value: '#cb3b43',\n },\n {\n from: 70,\n to: 100,\n value: '#ff7152',\n },\n {\n from: 50,\n to: 70,\n value: '#fc9850',\n },\n {\n from: 30,\n to: 50,\n value: '#f4df7a',\n },\n {\n from: 10,\n to: 30,\n value: '#4beba8',\n },\n {\n to: 10,\n value: '#5fbcff',\n },\n];\n\nexport const defaultThresholdColors = [\n '#dc4e41',\n '#f1813f',\n '#f8be34',\n '#53a051',\n '#0877a6',\n '#006d9c',\n '#ec9960',\n '#af575a',\n '#62b3b2',\n '#4fa484',\n '#f8be44',\n '#5a4575',\n '#708794',\n '#294e70',\n '#b6c75a',\n];\n\n/**\n * returns thresholds for a viz definition\n *\n * @param {object} viz definition\n * @return {array} the thresholds configuration for the thresholds editor\n */\nexport function getThresholdsForVizDefinition(vizDefinition, thresholdField) {\n return get(vizDefinition, `encoding.${thresholdField}.format.ranges`, []);\n}\n\n/**\n * Translates a thresholds configuration back into a viz definition.\n * This fn checks whether encoding exists and updates / adds an encoding configuration\n *\n * @param {object} viz definition\n * @param {array) thresholds configuration in form [{ from: <boundary>, to: <boundary>, value: <threshold value> }]\n * @param {string} the field where threshold should be applied to\n * @param {string} the default encoding field value to be used if no encoding was present\n * @return {object} an updated viz defintion with thresholds configuration applied\n */\nexport function getUpdatedVizConfigForThresholds(\n vizDefinition,\n thresholds,\n thresholdField,\n defaultEncodingFieldValue\n) {\n const formatConfig = {\n type: 'rangevalue',\n ranges: thresholds,\n };\n // @TODO(pwied):\n // future:\n // - viz data contract should expose which encoding fields are thresholdable\n // - threshold editor needs to know about the encoding field and pass it to this fn\n // - a visualization definition should always come with encoding (contract parsing needs to happen in dashboards)\n\n const getOverloadedThresholdFieldValue = tf => {\n if (typeof tf === 'object') {\n return tf;\n }\n if (typeof tf === 'string') {\n return { field: tf };\n }\n return { field: defaultEncodingFieldValue };\n };\n\n const encoding = vizDefinition?.encoding;\n const thresholdFieldValue = getOverloadedThresholdFieldValue(get(encoding, [thresholdField]));\n\n return {\n ...vizDefinition,\n encoding: {\n ...encoding,\n [thresholdField]: {\n ...thresholdFieldValue,\n format: formatConfig,\n },\n },\n };\n}\n\n/**\n * returns a viz definition with default thresholds set\n *\n * @param {object} viz definition\n * @param {string} the encoding field where threshold should be used\n * @param {string} the default encoding field value for the threshold field (ie primary[0])\n * @return {object} an updated viz defintion with default thresholds configuration applied\n */\nexport function getVizConfigWithDefaultThresholds(vizDefinition, thresholdField, defaultEncodingFieldValue) {\n return getUpdatedVizConfigForThresholds(\n vizDefinition,\n defaultThresholds,\n thresholdField,\n defaultEncodingFieldValue\n );\n}\n\n/**\n * returns a viz definition without threshold options\n *\n * @param {object} viz definition\n * @param {string} the encoding field where threshold is applied\n * @return {object} an updated viz defintion without threshold options\n */\nexport function getVizConfigWithoutThresholds(vizDefinition, thresholdField) {\n return omit(vizDefinition, `encoding.${thresholdField}`);\n}\n\n/**\n * returns a new threshold color\n *\n * @param {array} an array of threshold colors that should not be picked\n * @return {string} a color from default threshold colors that is not in the passed parameter\n * or #444000 if all colors from default colors are already used\n */\nexport function getNewThresholdColor(thresholdColors = []) {\n const diff = difference(defaultThresholdColors, thresholdColors);\n if (diff.length > 0) {\n return diff[0];\n }\n return '#444000';\n}\n\n/**\n * getUpdatedThresholdConfig calculates new threshold boundaries given an array\n * of outdated threshold configurations.\n * - the first element will always be an open upper boundary\n * - the last element will always be an open lower boundary\n * - all elements inbetween will have well defined, closed boundaries\n *\n * @param {array} array of thresholds\n * @return {array} an array of thresholds with updated boundaries\n */\nexport function getUpdatedThresholdConfig(thresholds = []) {\n if (thresholds.length < 2) {\n // a threshold config needs at least 2 levels\n // eslint-disable-next-line no-console\n console.warn('Invalid threshold configuration: at least 2 thresholds required');\n return thresholds;\n }\n // convert from and to values to numbers if they are available\n const updatedThresholds = thresholds.map(threshold => {\n const updatedThreshold = { ...threshold };\n if (threshold.from) {\n updatedThreshold.from = +threshold.from;\n }\n if (threshold.to) {\n updatedThreshold.to = +threshold.to;\n }\n return updatedThreshold;\n });\n const openLowerBounds = updatedThresholds.filter(t => t.from === undefined);\n if (openLowerBounds.length > 1) {\n // eslint-disable-next-line no-console\n console.warn('Invalid threshold configuration: multiple open lower boundaries');\n }\n // in order to determine the threshold order and ranges we can ignore the open lower bound\n const otherThresholds = updatedThresholds.filter(t => t.from !== undefined);\n if (otherThresholds.length !== uniqBy(otherThresholds, 'from').length) {\n // eslint-disable-next-line no-console\n console.warn('Invalid threshold configuration: duplicate from values');\n }\n const sortedOtherThresholds = otherThresholds.sort((a, b) => +b.from - +a.from);\n\n // This range set has open boundaries\n if (openLowerBounds.length) {\n const openLowerBound = openLowerBounds[0];\n // if the lowest from-value is not the open lower bound's to-value, update the open lower bound\n if (openLowerBound.to !== sortedOtherThresholds[sortedOtherThresholds.length - 1].from) {\n openLowerBound.to = sortedOtherThresholds[sortedOtherThresholds.length - 1].from;\n }\n // calculate the threshold ranges\n sortedOtherThresholds.forEach((el, index) => {\n const threshold = { ...el };\n if (index > 0) {\n threshold.to = sortedOtherThresholds[index - 1].from;\n } else {\n // the open uper bound is on index=0, it should not have a to value\n delete threshold.to;\n }\n sortedOtherThresholds[index] = threshold;\n });\n return [...sortedOtherThresholds, openLowerBound];\n }\n\n // This rangeset is closed ranges\n // calculate the threshold ranges\n sortedOtherThresholds.forEach((el, index) => {\n const threshold = { ...el };\n if (index > 0) {\n threshold.to = sortedOtherThresholds[index - 1].from;\n }\n sortedOtherThresholds[index] = threshold;\n });\n\n return sortedOtherThresholds;\n}\n\n/**\n * validate whether a threshold boundary update is valid\n *\n * @param {string} thresholdValueStr\n * @param {array} thresholds\n * @return {object} validation result containing error flag and an error message\n */\nexport function validateThresholdBoundary(thresholdValueStr = '', thresholds = []) {\n const thresholdValue = parseFloat(thresholdValueStr);\n if (isNaN(thresholdValue) || isNaN(+thresholdValueStr)) {\n return {\n error: true,\n errorMessage: _('Not a valid threshold. Must be a number'),\n };\n }\n if (thresholds.filter(t => t.from === thresholdValue).length > 0) {\n return {\n error: true,\n errorMessage: _('Value already exists'),\n };\n }\n return {\n error: false,\n errorMessage: null,\n };\n}\n\n/**\n * validate whether a threshold boundary update is valid\n *\n * @param {String|Number} thresholdValueStr\n * @param {String|Number} fromValueStr\n * @return {Object} validation result containing error flag and an error message\n */\nexport function validateThresholdUpperBoundary(thresholdValueStr = '', fromValueStr = '') {\n const thresholdValue = parseFloat(thresholdValueStr);\n const fromValue = parseFloat(fromValueStr);\n\n if (isNaN(thresholdValue) || isNaN(+thresholdValueStr) || isNaN(fromValue) || isNaN(+fromValueStr)) {\n return {\n error: true,\n errorMessage: _('Not a valid threshold. Must be a number'),\n };\n }\n if (thresholdValue < fromValue) {\n return {\n error: true,\n errorMessage: _('Upper boundary must exceed lower boundary'),\n };\n }\n return {\n error: false,\n errorMessage: null,\n };\n}\n","import React, { useState, useCallback } from 'react';\nimport T from 'prop-types';\nimport { noop } from 'lodash';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport Button from '@splunk/react-ui/Button';\nimport ThresholdError from './ThresholdError';\nimport ThresholdBoundary from './ThresholdBoundary';\nimport { validateThresholdBoundary } from '../../utils/threshold';\n\nconst StyledAddThreshold = styled.div.attrs(() => ({ 'data-test': 'add-threshold-level' }))`\n margin-bottom: 10px;\n`;\n\nconst AddThreshold = ({ thresholds, onAddThreshold = noop }) => {\n const [showInput, setShowInput] = useState(false);\n const [error, setError] = useState(null);\n\n const handleInputToggle = useCallback(() => {\n setShowInput(!showInput);\n }, [showInput]);\n\n const handleBoundaryChange = useCallback(\n value => {\n const validationResult = validateThresholdBoundary(value, thresholds);\n\n if (validationResult.error) {\n setError(validationResult.errorMessage);\n } else {\n onAddThreshold(value);\n }\n },\n [thresholds, onAddThreshold]\n );\n\n const handleValidateBoundary = useCallback(\n value => {\n const validationResult = validateThresholdBoundary(value, thresholds);\n\n if (validationResult.error) {\n setError(validationResult.errorMessage);\n }\n },\n [thresholds]\n );\n\n return (\n <StyledAddThreshold>\n {showInput ? (\n <React.Fragment>\n <ThresholdBoundary\n data-test=\"add-threshold-input\"\n isError={!!error}\n onChange={handleBoundaryChange}\n onRequestClose={handleInputToggle}\n onValidate={handleValidateBoundary}\n />\n <ThresholdError error={error} />\n </React.Fragment>\n ) : (\n <Button\n appearance=\"secondary\"\n onClick={handleInputToggle}\n label={`+ ${_('Add threshold level')}`}\n />\n )}\n </StyledAddThreshold>\n );\n};\n\nAddThreshold.propTypes = {\n onAddThreshold: T.func,\n thresholds: T.array,\n};\n\nexport default AddThreshold;\n","import React from 'react';\nimport T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport ThresholdBoundary from './ThresholdBoundary';\n\nconst StyledThresholdBoundaryInput = styled.div`\n margin-right: 10px;\n width: 100px;\n display: inline-block;\n`;\n\nconst StyledThresholdBoundaryText = styled.div.attrs(() => ({ 'data-test': 'threshold-boundary-label' }))`\n flex-grow: 1;\n flex-direction: row;\n`;\n\nconst ToContentSpan = styled.span`\n line-height: 36px;\n margin-right: 10px;\n color: ${props => (props.isDisabled ? variables.contentColorDisabled : variables.contentColorMuted)};\n`;\n\nconst ToContentValue = styled.span`\n display: inline-block;\n color: ${props => (props.isDisabled ? variables.contentColorDisabled : variables.contentColorMuted)};\n width: 30px;\n text-overflow: ellipsis;\n vertical-align: bottom;\n overflow: hidden;\n white-space: nowrap;\n`;\n\n// Span with extra wrapping to handle aria describedBy attribute passed by tooltip\nconst ToContent = ({ describedBy, isDisabled, to }) => (\n <ToContentValue aria-describedby={describedBy} isDisabled={isDisabled}>\n {to}\n </ToContentValue>\n);\nToContent.propTypes = {\n describedBy: T.any,\n isDisabled: T.bool,\n to: T.number,\n};\n\nconst ToTooltip = ({ isDisabled, to }) => (\n <Tooltip content={`${to}`}>\n <ToContent to={to} isDisabled={isDisabled} />\n </Tooltip>\n);\nToTooltip.propTypes = {\n isDisabled: T.bool,\n to: T.number,\n};\n\n/**\n * To\n */\nconst ThresholdTo = ({ index, to, isRemovable, isEditable, onChange, isDisabled, errorId }) => {\n const isFirst = index === 0;\n const prefix = isRemovable ? `${_('and')} ` : '';\n\n return isEditable ? (\n <StyledThresholdBoundaryText>\n <ToContentSpan isDisabled={isDisabled}>{_('to')}</ToContentSpan>\n <StyledThresholdBoundaryInput>\n <ThresholdBoundary\n data-test=\"threshold-to-level\"\n boundary={to}\n isDisabled={isDisabled}\n isEditable\n errorId={errorId}\n onChange={onChange}\n />\n </StyledThresholdBoundaryInput>\n </StyledThresholdBoundaryText>\n ) : (\n <StyledThresholdBoundaryText>\n {isFirst && <ToContentSpan isDisabled={isDisabled}>{_('and above')}</ToContentSpan>}\n {!isFirst && (\n <React.Fragment>\n <ToContentSpan isDisabled={isDisabled}>{`${prefix}${_('below')}`}</ToContentSpan>\n <ToTooltip isDisabled={isDisabled} to={to} />\n </React.Fragment>\n )}\n </StyledThresholdBoundaryText>\n );\n};\nThresholdTo.propTypes = {\n to: T.number,\n index: T.number,\n isRemovable: T.bool,\n isEditable: T.bool,\n isDisabled: T.bool,\n onChange: T.func,\n errorId: T.string,\n};\n\nexport default ThresholdTo;\n","import React, { useCallback, useMemo } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport ClearIcon from '@splunk/react-icons/Cross';\nimport Button from '@splunk/react-ui/Button';\nimport { createDOMID } from '@splunk/ui-utils/id';\nimport { variables } from '@splunk/themes';\nimport ThresholdError from './ThresholdError';\nimport ThresholdBoundary from './ThresholdBoundary';\nimport ThresholdTo from './ThresholdTo';\n\nconst StyledThresholdLevel = styled.div.attrs(() => ({ 'data-test': 'threshold-level' }))`\n width: 100%;\n position: relative;\n display: flex;\n align-items: flex-end;\n margin-bottom: 5px;\n`;\n\nconst StyledThresholdBoundaryInput = styled.div`\n margin-right: 10px;\n width: 100px;\n display: inline-block;\n`;\n\nconst StyledThresholdValueArea = styled.div`\n display: flex;\n margin-left: auto;\n`;\n\nconst StyledRemoveArea = styled.div`\n margin-left: ${variables.spacingXSmall};\n width: ${variables.spacingXXLarge};\n`;\nconst RemoveAreaButton = styled(Button)`\n color: ${props =>\n props.disabled ? variables.contentColorDisabled : variables.contentColorActive} !important;\n &:hover {\n background-color: ${props => !props.disabled && variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nconst Threshold = ({\n editFrom,\n editTo,\n editValue,\n error,\n from,\n index,\n isDisabled = false,\n isRemovable = false,\n onChange,\n onRemove,\n renderThresholdValueEditor,\n to,\n value,\n}) => {\n const handleFromChange = useCallback(\n newFrom => {\n if (error || newFrom !== from) {\n onChange(index, {\n from: newFrom,\n value,\n to,\n });\n }\n },\n [onChange, from, value, to, index, error]\n );\n\n const handleToChange = useCallback(\n newTo => {\n if (error || newTo !== to) {\n onChange(index, {\n from,\n value,\n to: newTo,\n });\n }\n },\n [onChange, from, value, to, index, error]\n );\n\n const onValueChange = useCallback(\n ({ value: val }) => {\n onChange(index, {\n from,\n value: val,\n to,\n });\n },\n [onChange, index, from, to]\n );\n\n const handleRemove = useCallback(() => onRemove(index), [onRemove, index]);\n\n const errorId = useMemo(() => (error ? createDOMID('threshold-error') : undefined), [error]);\n\n return (\n <React.Fragment>\n <StyledThresholdLevel>\n <StyledThresholdBoundaryInput>\n <ThresholdBoundary\n data-test=\"threshold-from-level\"\n boundary={from}\n isDisabled={isDisabled}\n isEditable={editFrom}\n errorId={errorId}\n onChange={handleFromChange}\n index={index}\n />\n </StyledThresholdBoundaryInput>\n <ThresholdTo\n to={to}\n index={index}\n isRemovable={isRemovable}\n isEditable={editTo}\n isDisabled={isDisabled}\n onChange={handleToChange}\n errorId={errorId}\n />\n <StyledThresholdValueArea>\n {renderThresholdValueEditor({\n value,\n onChange: onValueChange,\n isDisabled: isDisabled || !!error,\n editValue,\n })}\n </StyledThresholdValueArea>\n <StyledRemoveArea>\n {isRemovable && (\n <RemoveAreaButton\n data-test=\"threshold-remove-button\"\n icon={<ClearIcon />}\n appearance=\"subtle\"\n onClick={handleRemove}\n disabled={isDisabled}\n />\n )}\n </StyledRemoveArea>\n </StyledThresholdLevel>\n <ThresholdError error={error} id={errorId} thresholdIndex={index} />\n </React.Fragment>\n );\n};\n\nThreshold.propTypes = {\n editFrom: T.bool,\n editTo: T.bool,\n editValue: T.bool,\n error: T.string,\n from: T.number,\n index: T.number,\n isDisabled: T.bool,\n isRemovable: T.bool,\n onChange: T.func,\n onRemove: T.func,\n renderThresholdValueEditor: T.elementType.isRequired,\n to: T.number,\n value: T.string,\n};\n\nexport default Threshold;\n","import React, { useCallback, useState } from 'react';\nimport T from 'prop-types';\nimport { cloneDeep } from 'lodash';\nimport {\n validateThresholdBoundary,\n validateThresholdUpperBoundary,\n getUpdatedThresholdConfig,\n} from '../../utils/threshold';\nimport Threshold from './Threshold';\n\nconst defaultRanges = [];\n\nconst ThresholdList = ({\n ranges = defaultRanges,\n openRanges = true,\n isDisabled = false,\n onChange,\n renderThresholdValueEditor,\n}) => {\n const [errors, setErrors] = useState({});\n /**\n * Remove a threshold from the list\n */\n const handleRemoveThreshold = useCallback(\n index => {\n const result = cloneDeep(ranges);\n result.splice(index, 1);\n\n onChange(getUpdatedThresholdConfig(result));\n const errs = { ...errors };\n delete errs[index];\n setErrors(errs);\n },\n [errors, ranges, onChange]\n );\n\n /**\n * Update the threshold content at an index\n */\n const handleChangeThreshold = useCallback(\n (index, threshold) => {\n const result = cloneDeep(ranges);\n const errs = { ...errors };\n result.splice(index, 1, threshold);\n delete errs[index];\n\n if (!openRanges && index === 0) {\n const validationResult = validateThresholdUpperBoundary(threshold.to, threshold.from);\n\n if (validationResult.error) {\n errs[index] = validationResult.errorMessage;\n }\n }\n\n /*\n * When dealing with a closed range:\n * changes to range from values will overwrite all the to values of the lower ranges,\n * but the ranges are not sorted and overwritten until after validation\n * When a lower range becomes the top range, the top \"to\" value will not have anything to\n * be overwritten to, so it will remain an incorrect value lower than its associated from\n */\n if (\n !openRanges &&\n index !== 0 &&\n threshold.to < threshold.from &&\n threshold.from > ranges[0].from\n ) {\n // Since this will become the top threshold, we will add a new arbitrary top value like add threshold does\n result[index].to = threshold.from + 10;\n }\n\n // When open, the last threshold does not have an editable boundry, so skip validation\n if (!openRanges || index < ranges.length - 1) {\n const withoutCurrent = cloneDeep(ranges);\n withoutCurrent.splice(index, 1);\n\n const validationResult = validateThresholdBoundary(threshold.from, withoutCurrent);\n\n if (validationResult.error) {\n errs[index] = validationResult.errorMessage;\n }\n }\n\n setErrors(errs);\n\n if (!Object.keys(errs).length) {\n onChange(getUpdatedThresholdConfig(result));\n }\n },\n [errors, ranges, onChange, openRanges]\n );\n\n const hasErrors = !!Object.keys(errors).length;\n\n const canRemove = useCallback(\n index =>\n (!openRanges && ranges.length > 1) ||\n (openRanges && ranges.length > 2 && index !== ranges.length - 1),\n [openRanges, ranges]\n );\n\n return ranges.map((threshold, index) => (\n <Threshold\n key={`threshold-${threshold.from}-${threshold.to}-${threshold.value}`}\n onRemove={handleRemoveThreshold}\n onChange={handleChangeThreshold}\n index={index}\n from={threshold.from}\n to={threshold.to}\n value={threshold.value}\n error={errors[index]}\n editFrom={!openRanges || index !== ranges.length - 1}\n editTo={!openRanges && index === 0}\n editValue={!hasErrors}\n isRemovable={canRemove(index)}\n isDisabled={isDisabled}\n renderThresholdValueEditor={renderThresholdValueEditor}\n />\n ));\n};\n\nThresholdList.propTypes = {\n onChange: T.func.isRequired,\n ranges: T.arrayOf(\n T.shape({\n from: T.number,\n to: T.number,\n value: T.string,\n })\n ),\n isDisabled: T.bool,\n renderThresholdValueEditor: T.elementType.isRequired,\n openRanges: T.bool,\n};\n\nexport default ThresholdList;\n","import React from 'react';\nimport T from 'prop-types';\nimport Color from '@splunk/react-ui/Color';\nimport { isColor } from '@splunk/visualizations-shared/colorUtils';\nimport { defaultThresholdColors } from '../../utils/threshold';\n\nconst ThresholdColor = ({ isDisabled, value, onChange }) => {\n const handleColorChange = React.useCallback(\n ({ value: selectedColor }) => {\n const nextValue = selectedColor == null || selectedColor === '' ? 'transparent' : selectedColor;\n onChange({ value: nextValue });\n },\n [onChange]\n );\n\n return (\n <Color\n disabled={isDisabled}\n value={isColor(value) ? value : 'transparent'}\n onChange={handleColorChange}\n hideInput // prisma only\n palette={defaultThresholdColors}\n data-test=\"threshold-level-value\"\n />\n );\n};\nThresholdColor.propTypes = {\n isDisabled: T.bool,\n value: T.string,\n onChange: T.func.isRequired,\n};\n\nexport default ThresholdColor;\n","import React, { useCallback } from 'react';\nimport T from 'prop-types';\nimport { cloneDeep } from 'lodash';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Switch from '@splunk/react-ui/Switch';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport AddThreshold from './threshold/AddThreshold';\nimport ThresholdList from './threshold/ThresholdList';\nimport { getNewThresholdColor, getUpdatedThresholdConfig } from '../utils/threshold';\nimport ThresholdColor from './threshold/ThresholdColor';\n\nconst Col = styled.div`\n flex-direction: column;\n flex-grow: 1;\n`;\n\nconst ThresholdEditor = ({\n onChange,\n name,\n itemSchema,\n value,\n labelPosition = 'top',\n labelWidth,\n label,\n isDisabled = false,\n isTogglable = true,\n openRanges = true,\n renderThresholdValueEditor = ThresholdColor,\n}) => {\n const isEnabled = Array.isArray(value) && value.length > 0;\n\n const setDefaultThresholds = useCallback(() => {\n onChange(null, name, itemSchema.default);\n }, [itemSchema, name, onChange]);\n\n const clearThresholds = useCallback(() => {\n onChange(null, name, null);\n }, [name, onChange]);\n\n const handleEnableClick = useCallback(() => {\n if (!isEnabled) {\n return setDefaultThresholds();\n }\n return clearThresholds();\n }, [isEnabled, setDefaultThresholds, clearThresholds]);\n\n const handleAddThreshold = useCallback(\n from => {\n const existingThresholds = cloneDeep(value);\n const color = getNewThresholdColor(existingThresholds.map(t => t.value));\n const result = { from, value: color };\n if (!openRanges) {\n // add an arbitrary to value in case this is a new top range\n result.to = from + 10;\n }\n existingThresholds.push(result);\n const sortedThresholds = getUpdatedThresholdConfig(existingThresholds);\n\n onChange(null, name, sortedThresholds);\n },\n [name, value, onChange, openRanges]\n );\n\n const handleThresholdChange = useCallback(\n thresholds => {\n onChange(null, name, thresholds);\n },\n [onChange, name]\n );\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth}>\n <Col data-test={name}>\n {isTogglable && (\n <Switch\n appearance=\"toggle\"\n selected={isEnabled}\n onClick={handleEnableClick}\n disabled={isDisabled}\n role=\"switch\"\n >\n {_('Threshold')}\n </Switch>\n )}\n {isEnabled && (\n <React.Fragment>\n {!isDisabled && (\n <AddThreshold onAddThreshold={handleAddThreshold} thresholds={value} />\n )}\n <ThresholdList\n onChange={handleThresholdChange}\n ranges={value}\n isDisabled={isDisabled}\n openRanges={openRanges}\n renderThresholdValueEditor={renderThresholdValueEditor}\n />\n </React.Fragment>\n )}\n </Col>\n </ControlGroup>\n );\n};\n\nThresholdEditor.propTypes = {\n /**\n * Callback when selecting an item from the menu\n *\n * @param {SyntheticEvent} event The React `SyntheticEvent`\n * @param {string} name The option name\n * @param {string|boolean} value The option value\n */\n onChange: T.func.isRequired,\n /**\n * The option name\n */\n name: T.string.isRequired,\n /**\n * The item JSON schema, it should contain `enum` property. Note this will only be used when `values` prop is undefined\n */\n itemSchema: T.object,\n /**\n * The option value\n */\n value: T.arrayOf(\n T.shape({\n from: T.number,\n to: T.number,\n value: T.string,\n })\n ),\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['left', 'top']),\n labelWidth: T.number,\n /**\n * Make thresholds editable\n */\n isDisabled: T.bool,\n openRanges: T.bool,\n renderThresholdValueEditor: T.elementType,\n isTogglable: T.bool,\n};\n\nexport default ThresholdEditor;\n","import React from 'react';\nimport T from 'prop-types';\nimport CheckboxEditor from '../editors/CheckboxEditor';\nimport SelectEditor from '../editors/SelectEditor';\nimport RadioBarEditor from '../editors/RadioBarEditor';\nimport TextEditor from '../editors/TextEditor';\nimport ToggleEditor from '../editors/ToggleEditor';\nimport NumberEditor from '../editors/NumberEditor';\nimport ColorEditor from '../editors/ColorEditor';\nimport PercentEditor from '../editors/PercentEditor';\nimport SliderEditor from '../editors/SliderEditor';\nimport PresetSelectorEditor from '../editors/PresetSelectorEditor';\nimport ImageEditor from '../editors/ImageEditor';\nimport ThresholdEditor from '../editors/ThresholdEditor';\nimport { getStaticItemSchema } from '../utils/EditorFunctions';\nimport { DynamicColorEditor } from '../editors/DynamicColorEditor';\nimport { DynamicColorEditorWithPrecedence } from '../editors/DynamicColorEditorWithPrecedence';\nimport ColumnMultiSelectionEditor from '../editors/ColumnMultiSelectionEditor';\nimport ColumnSelectionEditor from '../editors/ColumnSelectionEditor';\nimport TableColumnFormatterEditor from '../editors/TableColumnFormatterEditor';\nimport { TableDynamicColorEditor } from '../editors/TableDynamicColorEditor';\nimport { TableBackgroundColorEditor } from '../editors/table/BackgroundColor';\nimport MarkdownEditor from '../editors/MarkdownEditor';\nimport StaticItemEditor from '../editors/StaticItemEditor';\nimport DynamicItemEditor from '../editors/DynamicItemEditor';\nimport ArrayOfStringsEditor from '../editors/ArrayOfStringsEditor';\nimport MultiColorPickerEditor from '../editors/MultiColorPickerEditor';\nimport SeriesColorsEditor from '../editors/SeriesColorsEditor';\nimport SeriesColorsByFieldEditor from '../editors/SeriesColorsByFieldEditor';\nimport ColumnMultiSelectionByFieldNameEditor from '../editors/ColumnMultiSelectionByFieldNameEditor';\nimport TrellisSplitBySelectionEditor from '../editors/trellis/TrellisSplitBySelectionEditor';\nimport TextAreaEditor from '../editors/TextAreaEditor';\nimport { NetworkGraphDynamicColorEditor } from '../editors/NetworkGraphDynamicColorEditor';\n\nexport const editorTypeToComponentMap = {\n 'editor.checkbox': CheckboxEditor,\n 'editor.radioBar': RadioBarEditor,\n 'editor.select': SelectEditor,\n 'editor.text': TextEditor,\n 'editor.textArea': TextAreaEditor,\n 'editor.toggle': ToggleEditor,\n 'editor.number': NumberEditor,\n 'editor.color': ColorEditor,\n 'editor.percent': PercentEditor,\n 'editor.image': ImageEditor,\n 'editor.threshold': ThresholdEditor,\n 'editor.presetSelector': PresetSelectorEditor,\n 'editor.dynamicColor': DynamicColorEditor,\n 'editor.dynamicColorWithPrecedence': DynamicColorEditorWithPrecedence,\n 'editor.columnMultiSelector': ColumnMultiSelectionEditor,\n 'editor.columnSelector': ColumnSelectionEditor,\n 'editor.tableColumnFormatter': TableColumnFormatterEditor,\n 'editor.tableBackgroundColor': TableBackgroundColorEditor,\n 'editor.tableDynamicColor': TableDynamicColorEditor,\n 'editor.slider': SliderEditor,\n 'editor.markdown': MarkdownEditor,\n 'editor.staticItem': StaticItemEditor,\n 'editor.dynamicItem': DynamicItemEditor,\n 'editor.arrayOfStrings': ArrayOfStringsEditor,\n 'editor.multiColorPicker': MultiColorPickerEditor,\n 'editor.seriesColors': SeriesColorsEditor,\n 'editor.seriesColorsByField': SeriesColorsByFieldEditor,\n 'editor.columnMultiSelectionByFieldNameEditor': ColumnMultiSelectionByFieldNameEditor,\n 'editor.trellisSplitBy': TrellisSplitBySelectionEditor,\n 'editor.networkGraphDynamicColor': NetworkGraphDynamicColorEditor,\n};\n\nconst EditorItem = ({\n item,\n name,\n itemSchema,\n dataSourceBindings,\n context,\n value,\n onChange,\n isDisabled,\n options,\n optionsSchema,\n}) => {\n const { editor } = item;\n\n let Editor;\n if (typeof editor === 'string') {\n if (!editorTypeToComponentMap[editor]) {\n throw Error(`Invalid editor type: ${editor}`);\n }\n Editor = editorTypeToComponentMap[editor];\n } else {\n Editor = editor;\n }\n const staticItemSchema = getStaticItemSchema(itemSchema);\n\n return (\n <div key={item.option || item.encoding} data-test={`editor-${name}`}>\n <Editor\n {...item.editorProps}\n name={name}\n isOption={!!item.option}\n itemSchema={staticItemSchema}\n dataSourceBindings={dataSourceBindings}\n label={item.label}\n onChange={onChange}\n value={value}\n context={context}\n placeholder={item.placeholder}\n isAdvanced={item.isAdvanced}\n isDisabled={isDisabled}\n options={options}\n optionsSchema={optionsSchema}\n />\n </div>\n );\n};\n\nEditorItem.propTypes = {\n /**\n * Definition of the single item to edit\n * @param {Object} item { option, encoding, editor, label, editorProps }\n */\n item: T.object.isRequired,\n /**\n * TODO: Does this really need to be passed in or can this component determine it from item?\n * @param {String} name The option or encoding name\n */\n name: T.string.isRequired,\n /**\n * @param {Object} itemSchema Either the dataContract or schema for the selected item\n */\n itemSchema: T.object.isRequired,\n /**\n * @param {Object} context The visualization's context config\n */\n context: T.object,\n /**\n * @param {Object} dataSources The current datasource bindings for the visualization\n */\n dataSourceBindings: T.object,\n /**\n * @param {Mixed} value The current value of the item\n */\n value: T.any,\n /**\n * @param {Function} onChange Callback for when the editor value is updated\n */\n onChange: T.func.isRequired,\n /**\n * @param {Boolean} disabled Disabled state of item\n */\n isDisabled: T.bool,\n options: T.object,\n /**\n * @param {Object} optionsSchema Visualization's entire option schema\n */\n optionsSchema: T.object,\n};\n\nexport default EditorItem;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@splunk/visualizations-shared/colorConstants\");","import React, { useEffect, useCallback, useState, useMemo } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport { debounce, noop, toLower } from 'lodash';\nimport { variables } from '@splunk/themes';\nimport Color from '@splunk/react-ui/Color';\nimport Text from '@splunk/react-ui/Text';\nimport { createDOMID } from '@splunk/ui-utils/id';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ScreenReaderContent from '@splunk/react-ui/ScreenReaderContent';\nimport { COLOR_EDITOR_PALETTE } from '@splunk/visualizations-shared/colorConstants';\nimport { isColor } from '@splunk/visualizations-shared/colorUtils';\nimport ControlGroup from '../shared/AdvancedControlGroup';\n\nconst TextContainer = styled.div`\n max-height: ${variables.inputHeight};\n width: 100%;\n min-width: 0;\n`;\n\n// hardcoded style to sync with SUI color picker's hardcoded dimensions\n// TODO(fkurniawan): see if we can leverage prisma's consolidated textInput out of the box instead of our own component\n// right now, we're using hideInput\nconst StyledText = styled(Text)`\n max-height: ${variables.inputHeight};\n`;\n\n/**\n * Trims the color input and returns the result, or default color if the default color is valid, or previous color\n * @param {String} color The color the user entered\n * @param {String} defaultColor The default color of the component\n * @param {String} prevColor The previous color of the component\n * @returns {String}\n */\nconst getColor = ({ color, defaultColor, prevColor }) => {\n const newColor = typeof color === 'string' ? color.trim() : color;\n\n // color === null is `N/A` in color picker\n if (isColor(newColor) || newColor === null) {\n return newColor;\n }\n\n if (isColor(defaultColor)) {\n return defaultColor;\n }\n\n if (isColor(prevColor) || prevColor === null) {\n return prevColor;\n }\n\n return 'transparent';\n};\n\nconst ColorAndTextWrapper = ({\n id,\n showTextInput,\n color,\n palette,\n handleColorChange,\n labelledBy,\n textWidth,\n value,\n name,\n handleTextColorChange,\n handleKeyPress,\n handleBlur,\n isDisabled,\n}) => {\n const textLabelId = useMemo(() => createDOMID('color-code'), []);\n\n return (\n <>\n <div>\n <Color\n key=\"color-editor\"\n append={showTextInput}\n value={getColor({ color })}\n palette={palette}\n onChange={handleColorChange}\n data-test={`color-picker-${name}`}\n disabled={isDisabled}\n hideInput\n labelledBy={labelledBy}\n />\n </div>\n {showTextInput && (\n <TextContainer data-test=\"text-container\" textWidth={textWidth}>\n <ScreenReaderContent id={textLabelId}>{_('Color code input')}</ScreenReaderContent>\n <StyledText\n key={value}\n data-test={name}\n prepend\n value={color === null ? 'N/A' : color}\n onChange={handleTextColorChange}\n onKeyDown={handleKeyPress}\n onBlur={handleBlur}\n disabled={isDisabled}\n // hardcoded style to sync with SUI color picker's hardcoded dimensions\n // TODO(fkurniawan): see if we can leverage prisma's consolidated textInput out of the box\n style={{ height: '32px' }}\n labelledBy={`${labelledBy} ${textLabelId}`}\n inputId={id}\n />\n </TextContainer>\n )}\n </>\n );\n};\n\nColorAndTextWrapper.propTypes = {\n id: T.string,\n showTextInput: T.bool,\n color: T.string,\n palette: T.arrayOf(T.string),\n handleColorChange: T.func,\n labelledBy: T.string,\n textWidth: T.oneOfType([T.string, T.number]),\n value: T.string,\n name: T.string.isRequired,\n handleTextColorChange: T.func,\n handleKeyPress: T.func,\n handleBlur: T.func,\n isDisabled: T.bool,\n};\n\nconst defaultItemSchema = { default: 'transparent' };\nconst emptyStyle = {};\n\n// The propTypes typing for TS callers isn't working for the onChange callback\n/**\n * @param {Object} props\n * @param {(e: import('react').SyntheticEvent, name: string, value: string) => void} [props.onChange]\n * @returns\n */\nconst ColorEditor = ({\n name = 'color',\n value = 'transparent',\n label = '',\n labelPosition = 'top',\n labelWidth,\n palette = COLOR_EDITOR_PALETTE,\n onChange = noop,\n itemSchema = defaultItemSchema,\n isDisabled = false,\n textWidth = 'auto',\n hideLabel = false,\n showTextInput = true,\n style: customEditorStyle = emptyStyle,\n}) => {\n const [color, setColor] = useState(value);\n\n useEffect(() => {\n setColor(value);\n }, [value]);\n\n const debouncedOnChange = useMemo(() => debounce(onChange, 250), [onChange]);\n\n const handleColorChange = useCallback(\n ({ value: val }) => {\n const newColor = getColor({ color: val, defaultColor: itemSchema.default, prevColor: value });\n setColor(newColor);\n if (value !== newColor) {\n // No event to pass back, so it is null\n debouncedOnChange(null, name, newColor);\n }\n },\n [debouncedOnChange, itemSchema.default, name, value]\n );\n\n const handleTextColorChange = useCallback((_event, { value: val }) => {\n const colorToValue = toLower(val).trim() === 'n/a' ? null : val;\n setColor(colorToValue);\n }, []);\n\n const handleKeyPress = useCallback(\n event => {\n if (event.key === 'Escape') {\n setColor(value);\n return;\n }\n if (event.key !== 'Enter') {\n return;\n }\n\n if (value !== color) {\n const newColor = getColor({ color, defaultColor: itemSchema.default, prevColor: value });\n setColor(newColor);\n if (newColor !== value) {\n onChange(event, name, newColor);\n }\n }\n },\n [name, color, value, onChange, itemSchema.default]\n );\n\n const handleBlur = useCallback(\n event => {\n if (color !== value) {\n const newColor = getColor({ color, defaultColor: itemSchema.default, prevColor: value });\n setColor(newColor);\n if (newColor !== value) {\n onChange(event, name, newColor);\n }\n }\n },\n [name, color, value, onChange, itemSchema.default]\n );\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n style={customEditorStyle}\n hideLabel={hideLabel}\n controlsLayout=\"fillJoin\"\n >\n <ColorAndTextWrapper\n showTextInput={showTextInput}\n color={color}\n palette={palette}\n handleColorChange={handleColorChange}\n name={name}\n isDisabled={isDisabled}\n textWidth={textWidth}\n value={value}\n handleTextColorChange={handleTextColorChange}\n handleKeyPress={handleKeyPress}\n handleBlur={handleBlur}\n />\n </ControlGroup>\n );\n};\n\nColorEditor.propTypes = {\n /**\n * The option name\n */\n name: T.string.isRequired,\n\n /**\n * The option value\n */\n value: T.string,\n\n /**\n * @param {Object} itemSchema Either the dataContract or schema for the selected item\n */\n itemSchema: T.object,\n\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n\n /**\n * Flag to hide the editor label\n */\n hideLabel: T.bool,\n\n /**\n * Flag to hide the color text input\n */\n showTextInput: T.bool,\n\n /**\n * Custom styling for the editor layout, eg: setting margin-bottom to 0px for ControlGroup, SUI has it at 15px\n */\n style: T.object,\n\n /**\n * Label position\n */\n labelPosition: T.oneOf(['top', 'left']),\n\n /**\n * Label position\n */\n labelWidth: T.number,\n\n /**\n * An array of color swatch values\n */\n palette: T.arrayOf(T.string),\n\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 * Disabled state of component\n */\n isDisabled: T.bool,\n textWidth: T.oneOfType([T.string, T.number]),\n};\n\nexport default ColorEditor;\n","import React, { useCallback } from 'react';\nimport T from 'prop-types';\nimport RadioBar from '@splunk/react-ui/RadioBar';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport { hasTokens } from '../utils/token';\nimport { getOptions } from '../utils/EditorFunctions';\nimport { editorStyle } from '../shared/dimensionConstants';\nimport ControlGroup from '../shared/AdvancedControlGroup';\n\nconst RadioBarEditor = ({\n onChange,\n name,\n itemSchema,\n values,\n value,\n labelPosition = 'top',\n labelWidth,\n label,\n isDisabled = false,\n}) => {\n const options = getOptions(itemSchema, values);\n const disabled = hasTokens(value) || isDisabled;\n const handleChange = useCallback((event, { value: v }) => onChange(event, name, v), [onChange, name]);\n\n // TODO: SUI 4.0 renders empty labels differently. Labels should never be empty strings, instead pass\n // a valid label and set hideLabel on ControlGroup\n const controlGroupMarginFix = !label || label === '' ? { marginTop: '-8px' } : undefined;\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n style={controlGroupMarginFix}\n >\n <RadioBar\n data-test={name}\n onChange={handleChange}\n value={value}\n style={editorStyle}\n disabled={disabled}\n >\n {options.map(v => {\n const displayContent = v.label || v.value;\n\n // TODO: Revisit this. SUI supports label with icon, so why doesn't this editor?\n const optionProps = {};\n if (v.icon) {\n // Splunk-UI Button does not support tooltip as of now, so we need to use Tooltip on icon\n optionProps.startAdornment = (\n <Tooltip content={displayContent}>\n <v.icon hideDefaultTooltip />\n </Tooltip>\n );\n } else {\n optionProps.label = displayContent;\n }\n\n return (\n <RadioBar.Option key={v.value} value={v.value} disabled={disabled} {...optionProps} />\n );\n })}\n </RadioBar>\n </ControlGroup>\n );\n};\n\nRadioBarEditor.propTypes = {\n /**\n * Callback when selecting an item from radio bar\n *\n * @param {SyntheticEvent} event The React `SyntheticEvent`\n * @param {string} name The option name\n * @param {string|boolean} value The option value\n */\n onChange: T.func.isRequired,\n /**\n * The option name\n */\n name: T.string.isRequired,\n /**\n * The item JSON schema, it should contain `enum` property. Note this will only be used when `values` prop is undefined\n */\n itemSchema: T.object,\n /**\n * The option values that can be selected\n */\n values: T.arrayOf(\n T.shape({\n label: T.string,\n value: T.oneOfType([T.string, T.bool]).isRequired,\n })\n ),\n /**\n * The option value\n */\n value: T.oneOfType([T.string, T.bool]),\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['left', 'top']),\n labelWidth: T.number,\n /**\n * Disabled state of component\n */\n isDisabled: T.bool,\n};\n\nexport default RadioBarEditor;\n","import React, { useCallback } from 'react';\nimport T from 'prop-types';\nimport Select from '@splunk/react-ui/Select';\nimport { hasTokens } from '../utils/token';\nimport { getOptions } from '../utils/EditorFunctions';\nimport { editorStyle } from '../shared/dimensionConstants';\nimport ControlGroup from '../shared/AdvancedControlGroup';\n\nconst SelectEditor = ({\n onChange,\n name,\n itemSchema,\n values,\n value,\n labelPosition = 'top',\n labelWidth,\n label,\n tooltip,\n isDisabled = false,\n isAdvanced,\n hideLabel,\n help,\n}) => {\n const options = getOptions(itemSchema, values);\n const disabled = hasTokens(value) || isDisabled;\n const handleChange = useCallback((event, { value: v }) => onChange(event, name, v), [onChange, name]);\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n isAdvanced={isAdvanced}\n hideLabel={hideLabel}\n >\n <Select\n data-test={name}\n onChange={handleChange}\n value={value}\n disabled={disabled}\n style={editorStyle}\n >\n {options.map(v => (\n <Select.Option\n key={v.value}\n value={v.value}\n label={v.label || v.value}\n icon={v.icon ? <v.icon /> : null}\n description={v.description}\n />\n ))}\n </Select>\n </ControlGroup>\n );\n};\n\nSelectEditor.propTypes = {\n /**\n * Callback when selecting an item from the menu\n *\n * @param {SyntheticEvent} event The React `SyntheticEvent`\n * @param {string} name The option name\n * @param {string|boolean} value The option value\n */\n onChange: T.func.isRequired,\n /**\n * The option name\n */\n name: T.string.isRequired,\n /**\n * The item JSON schema, it should contain `enum` property. Note this will only be used when `values` prop is undefined\n */\n itemSchema: T.object,\n /**\n * The option values that can be selected\n */\n values: T.arrayOf(\n T.shape({\n label: T.string,\n value: T.oneOfType([T.string, T.number]).isRequired,\n description: T.string,\n })\n ),\n /**\n * The option value\n */\n value: T.oneOfType([T.string, T.number]),\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['left', 'top']),\n labelWidth: T.number,\n /**\n * Text to display in a tooltip next to the label\n */\n tooltip: T.string,\n /**\n * Disabled state of component\n */\n isDisabled: T.bool,\n /**\n * As advanced editor to show advanced config button\n */\n isAdvanced: T.bool,\n /**\n * Disable label of control group\n */\n hideLabel: T.bool,\n /**\n * Text to display under the the input\n */\n help: T.string,\n};\n\nexport default SelectEditor;\n","import React, { useCallback, useState, useEffect } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport { isEqual, uniqBy } from 'lodash';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport FormRows from '@splunk/react-ui/FormRows';\nimport TextEditor from './TextEditor';\nimport ControlGroup from '../shared/AdvancedControlGroup';\n\nconst RowContainer = styled.div`\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 10px;\n [data-test='control-group'] {\n margin: 0;\n }\n`;\n\nconst formRowHeader = (\n <RowContainer>\n <span data-test=\"form-row-header-label\">{_('Label')}</span>\n <span data-test=\"form-row-header-value\">{_('Value')}</span>\n </RowContainer>\n);\n\n/**\n * Remove an item from an array, return a new array\n * @param {Array} items The list of items\n * @param {Number} index The index of the item to remove\n * @returns {Array} list of items without the item at the specified index\n */\nconst removeItem = (items, index) => items.filter((_item, idx) => idx !== index);\n\n/**\n * Detect when a list of static items contains an invalid entry\n * @param {StaticItem[]} items List of static items\n * @returns {Boolean} true when no label or value is an empty string\n */\nconst isValid = items =>\n // exit early when an error found\n !items.some(\n ({ label, value }) =>\n typeof label !== 'string' ||\n label.trim() === '' ||\n typeof value !== 'string' ||\n value.trim() === ''\n ) &&\n uniqBy(items, item => item.value).length === items.length &&\n uniqBy(items, item => item.label).length === items.length;\n\n/**\n * Detect if a label or value in the list is an error case\n * @param {String} value either an item label or value\n * @param {StaticItem[]} items List of all items\n * @param {label | value} key The StaticItem key to check\n */\nconst isItemError = (value, items, key) => {\n // Just have an invalid type\n if (typeof value !== 'string' || value.trim() === '') {\n return true;\n }\n\n // Check the value is unique\n return items.filter(i => i[key] === value).length > 1;\n};\n\nconst isLabelError = (label, items) => isItemError(label, items, 'label');\nconst isValueError = (value, items) => isItemError(value, items, 'value');\n\nconst InputContainer = styled.div`\n width: 100%;\n`;\n\nconst defaultValue = [];\n\nconst StaticItemEditor = ({\n onChange,\n name,\n value = defaultValue,\n labelPosition = 'top',\n label = '',\n validate,\n}) => {\n const [staticItems, setItems] = useState(value);\n const [nextIndex, setIndex] = useState(value.length);\n\n useEffect(() => {\n setItems(value);\n if (value.length > nextIndex) {\n setIndex(value.length);\n }\n }, [value, nextIndex]);\n\n const handleChange = useCallback(\n newItems => {\n if (!isEqual(newItems, value) && isValid(newItems)) {\n // don't save newItems to state,\n // as this component will get a prop change as a result of the onChange call\n onChange(null, name, newItems);\n } else {\n // save invalid values so UI updates.\n setItems(newItems);\n }\n },\n [value, name, onChange]\n );\n\n const handleRequestRemove = useCallback(\n (_evt, { index }) => {\n const newItems = removeItem(staticItems, index);\n\n handleChange(newItems);\n },\n [staticItems, handleChange]\n );\n\n const handleRequestMove = useCallback(\n ({ fromIndex, toIndex }) => {\n const item = staticItems[fromIndex];\n const newItems = removeItem(staticItems, fromIndex);\n\n newItems.splice(toIndex, 0, item);\n handleChange(newItems);\n },\n [staticItems, handleChange]\n );\n\n const handleItemChange = useCallback(\n (idx, key) =>\n (_evt, _name, val = '') => {\n const item = staticItems[idx];\n const newItems = [...staticItems];\n\n newItems.splice(idx, 1, { ...item, [key]: val.trim() });\n handleChange(newItems);\n },\n [staticItems, handleChange]\n );\n\n const handleRequestAdd = useCallback(() => {\n const newItems = staticItems.concat({\n label: `Label ${nextIndex}`,\n value: `menu_v${nextIndex}`,\n });\n\n setIndex(nextIndex + 1);\n handleChange(newItems);\n }, [staticItems, nextIndex, handleChange]);\n\n const rows = staticItems.map((item, idx) => {\n const { label: l, value: v } = item;\n return (\n <FormRows.Row\n index={idx}\n // eslint-disable-next-line react/no-array-index-key\n key={`${l}_${v}_${idx}`} // NOSONAR\n onRequestRemove={handleRequestRemove}\n >\n <RowContainer>\n <TextEditor\n label={_('Label')}\n hideLabel\n value={l}\n onChange={handleItemChange(idx, 'label')}\n name=\"item-label-editor\"\n error={isLabelError(l, staticItems)}\n validate={validate}\n />\n <TextEditor\n label={_('Value')}\n hideLabel\n value={v}\n onChange={handleItemChange(idx, 'value')}\n name=\"item-value-editor\"\n error={isValueError(v, staticItems)}\n validate={validate}\n />\n </RowContainer>\n </FormRows.Row>\n );\n });\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition}>\n <InputContainer>\n <FormRows\n addLabel={_('Add new')}\n header={formRowHeader}\n onRequestAdd={handleRequestAdd}\n onRequestMove={handleRequestMove}\n >\n {rows}\n </FormRows>\n </InputContainer>\n </ControlGroup>\n );\n};\n\nStaticItemEditor.propTypes = {\n /**\n * Callback when changing the text value\n *\n * onChange function has the following properties\n * @param {SyntheticEvent} event The react `SyntheticEvent`\n * @param {String} name The option name\n * @param {StaticItem[]} 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,\n /**\n * The option value\n */\n value: T.arrayOf(T.exact({ label: T.string, value: T.string })),\n /**\n * Label position\n */\n labelPosition: T.oneOf(['top', 'left']),\n /**\n * Validate the value of the editor\n */\n validate: T.func,\n};\n\nexport default StaticItemEditor;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@babel/runtime/helpers/objectWithoutProperties\");","import React, { useState, useCallback, useEffect, useMemo } from 'react';\nimport T from 'prop-types';\nimport { debounce } from 'lodash';\nimport Text from '@splunk/react-ui/Text';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { editorStyle } from '../shared/dimensionConstants';\n\nconst defaultLabelStyle = {};\n\nconst TextEditor = ({\n onChange,\n name,\n value = '',\n label,\n labelPosition = 'top',\n labelWidth,\n labelStyle = defaultLabelStyle,\n hideLabel = false,\n isAdvanced,\n isDisabled = false,\n help,\n tooltip,\n validate,\n error,\n ...otherProps\n}) => {\n const [val, setValueState] = useState(value);\n\n const handleValidate = useCallback(\n newValue => (typeof validate === 'function' ? validate({ value: newValue }) : null),\n [validate]\n );\n const [errorState, setErrorState] = useState(handleValidate(value));\n const debouncedHandleValidate = useMemo(\n () =>\n debounce(newVal => {\n setErrorState(handleValidate(newVal));\n }, 250),\n [handleValidate]\n );\n\n useEffect(\n () => () => {\n // cancel debounce on component unmount\n debouncedHandleValidate.cancel();\n },\n [debouncedHandleValidate]\n );\n\n useEffect(() => {\n setValueState(value);\n setErrorState(handleValidate(value));\n }, [handleValidate, value]);\n\n const handleChange = useCallback(\n (_event, { value: v }) => {\n setValueState(v);\n debouncedHandleValidate(v);\n },\n [debouncedHandleValidate]\n );\n\n const handleBlur = useCallback(\n event => {\n const newVal = val.trim();\n if (newVal === value) {\n return;\n }\n const newError = handleValidate(newVal);\n // set error if there is one, or clear an existing error\n setErrorState(newError);\n if (!newError) {\n // only change value if there is no validation error\n onChange(event, name, newVal);\n }\n },\n [val, value, handleValidate, onChange, name]\n );\n\n const handleKeyPress = useCallback(\n event => {\n if (event.key === 'Enter') {\n handleBlur(event);\n }\n },\n [handleBlur]\n );\n\n const style = useMemo(\n () =>\n !label || label === ''\n ? {\n ...labelStyle,\n }\n : labelStyle,\n [label, labelStyle]\n );\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n style={style}\n hideLabel={hideLabel}\n help={help}\n tooltip={tooltip}\n error={errorState?.message || error}\n isAdvanced={isAdvanced}\n >\n <Text\n key={value}\n data-test={name}\n style={editorStyle}\n onChange={handleChange}\n onKeyDown={handleKeyPress}\n onBlur={handleBlur}\n value={val}\n disabled={isDisabled}\n canClear\n {...otherProps}\n error={!!errorState || error}\n />\n </ControlGroup>\n );\n};\n\nTextEditor.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 /**\n * Label width\n */\n labelWidth: T.number,\n /**\n * Styles to be passed to the ControlGroup\n */\n labelStyle: T.object,\n /**\n * Visually hide the label, but render it for screen readers\n */\n hideLabel: T.bool,\n /**\n * As advanced editor to show advanced config button\n */\n isAdvanced: T.bool,\n /**\n * Disabled state of component\n */\n isDisabled: T.bool,\n /**\n * Validate the value of the editor\n */\n validate: T.func,\n /**\n * If the input should display error state\n */\n error: T.bool,\n /**\n * Text to display under the the input\n */\n help: T.string,\n /**\n * Text to display in a tooltip next to the label\n */\n tooltip: T.string,\n};\n\nexport default TextEditor;\n","import React from 'react';\nimport CheckboxEditor from './CheckboxEditor';\n\nconst ToggleEditor = props => <CheckboxEditor {...props} appearance=\"toggle\" />;\n\n/**\n * @see {@link CheckboxEditor} for all the props information\n */\nexport default ToggleEditor;\n","import styled from 'styled-components';\n\nexport default styled.div`\n padding: 10px 15px 0px 15px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n`;\n","import styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\n\nconst Separator = styled.div.attrs(() => ({\n 'data-test': 'separator',\n}))`\n border-bottom: 1px solid ${variables.borderColorWeak};\n`;\n\nexport default Separator;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@splunk/visualizations-shared/schemaUtils\");","import { cloneDeep, forIn, isPlainObject, omit, set } from 'lodash';\nimport { DYNAMIC_OPTIONS_DSL_PATTERN } from '@splunk/visualizations-shared/schemaUtils';\n\n/**\n * Return values, or parse enum values if values do not exist\n * @param {Object} itemSchema Validation config for an editor item\n * @param {Object[]} values List of predefined { label, value } objects for use by editor\n * @returns {Object[]} List of { label, value } objects for use by editor\n */\nexport const getOptions = (itemSchema, values) => {\n if (Array.isArray(values)) {\n return values;\n }\n\n if (itemSchema && Array.isArray(itemSchema.enum)) {\n return itemSchema.enum.map(item => ({ value: item }));\n }\n\n throw Error(`No valid values provided to editor: ${JSON.stringify(itemSchema)}`);\n};\n\nexport function handleOptionsChange(name, value, options = { debounce: false }) {\n const { visualization } = this.props;\n if (value == null) {\n this.props.onVisualizationChange(\n {\n ...visualization,\n options: omit(visualization.options, [name]),\n },\n options\n );\n } else {\n this.props.onVisualizationChange(\n {\n ...visualization,\n options: {\n ...visualization.options,\n [name]: value,\n },\n },\n options\n );\n }\n}\n\n/*\n * @method isMultipleRulesSchema\n * @param {Object} itemSchema\n * @returns {Boolean}\n */\nexport const isMultipleRulesSchema = itemSchema => !!itemSchema.anyOf && itemSchema.anyOf.length > 0;\n\n/*\n * @method isDynamicOptionSchema\n * @param {Object} schema\n * @returns {Boolean}\n */\nexport const isDynamicOptionSchema = schema =>\n schema.type === 'string' && schema.pattern === DYNAMIC_OPTIONS_DSL_PATTERN;\n\n/*\n * @method isNestedOption\n * @param {String} optionName\n * @returns {Boolean}\n */\nexport const isNestedOption = optionName => {\n const nestedOptionPattern = /^\\w+\\[\\d+\\]\\.(.+)$/;\n return nestedOptionPattern.exec(optionName) !== null;\n};\n\n/*\n * @method getStaticItemSchema\n * @param {Object} itemSchema\n * @returns {Object} staticItemSchema\n */\nexport const getStaticItemSchema = itemSchema => {\n if (!isMultipleRulesSchema(itemSchema)) {\n return itemSchema;\n }\n\n const staticSchema = itemSchema.anyOf.find(schema => !isDynamicOptionSchema(schema));\n return { ...omit(itemSchema, 'anyOf'), ...staticSchema };\n};\n\n/**\n * @method isContextCompatibleWithFormatter\n * @param {Array | Object} contextConfig\n * @param {String} formatterType\n * @returns {Boolean} true if context structure is compatible with formatter type\n */\nconst isContextCompatibleWithFormatter = (contextConfig, formatterType) => {\n if (!contextConfig || !formatterType) {\n return false;\n }\n\n // Gradient formatter expects an object with 'colors' property\n if (formatterType === 'gradient') {\n return (\n typeof contextConfig === 'object' && !Array.isArray(contextConfig) && 'colors' in contextConfig\n );\n }\n\n // Range/Match formatters expect an array\n if (formatterType === 'rangeValue' || formatterType === 'matchValue') {\n return Array.isArray(contextConfig);\n }\n\n // For unknown formatters, assume compatible to maintain existing behavior\n return true;\n};\n\n/**\n * @method getFormatterConfig\n * @param {Object} props\n * @param {Array | Object} [props.contextConfig]\n * @param {Array} props.formatters\n * @param {String} props.formatterFromDSL\n * @param {String} props.selectedDataSelector\n * @returns {Array | Object} the default formatter config of dynamic color editors' fomatter\n */\nexport const getFormatterConfig = ({ contextConfig, formatters, formatterFromDSL, selectedDataSelector }) => {\n // If no context exists, use default config\n if (!contextConfig) {\n const currentFormatter = formatters?.find(formatter => formatter.value === formatterFromDSL);\n const formatterConfig = currentFormatter?.defaults?.[selectedDataSelector];\n return formatterConfig || [];\n }\n\n // If no formatter type is provided, return context as-is for backward compatibility\n if (!formatterFromDSL) {\n return contextConfig;\n }\n\n // Check if existing context is compatible with the formatter type\n if (isContextCompatibleWithFormatter(contextConfig, formatterFromDSL)) {\n return contextConfig;\n }\n\n // Context is incompatible, use default config instead\n const currentFormatter = formatters?.find(formatter => formatter.value === formatterFromDSL);\n const formatterConfig = currentFormatter?.defaults?.[selectedDataSelector];\n return formatterConfig || [];\n};\n\n/**\n * @method isSupportedDataSelector\n * @param {Object} config\n * @param {String} config.selectedDataSelector e.g. 'majorValue'\n * @param {Array} config.dataSelectors e.g. [{ label: 'value', value: 'majorValue'}]\n * @returns {Boolean} true if dataSelectors includes selectedDataSelector\n */\nexport const isSupportedDataSelector = ({ selectedDataSelector, dataSelectors }) => {\n if (!selectedDataSelector || !dataSelectors?.length) {\n return false;\n }\n return dataSelectors.some(ds => ds.value === selectedDataSelector);\n};\n\n/**\n * @method isSupportedFormatter\n * @param {Object} config\n * @param {String} [config.selectedFormatterType] e.g. 'rangeValue'\n * @param {Array} [config.formattersFromEditor] e.g. [{ label: 'rangle', value: 'rangeValue', defaults: {}}]\n * @param {Object} config.supportedFormatters e.g. {rangeValue: {}, matchValue: {}}\n * @returns {Boolean} true if formattersFromEditor includes selectedFormatterType and selectedFormatterType is one of supportedFormatters on editor\n */\nexport const isSupportedFormatter = ({\n selectedFormatterType,\n formattersFromEditor,\n supportedFormatters,\n}) => {\n if (\n !selectedFormatterType ||\n !supportedFormatters?.[selectedFormatterType] ||\n !formattersFromEditor?.length\n ) {\n return false;\n }\n return formattersFromEditor.some(fm => fm.value === selectedFormatterType);\n};\n\n/**\n * @method getFilteredRowsByShowEditor filters the EditorItem objects which are visible based on showEditor property\n * @param {Object} args\n * @param {Array} args.row\n * @param {Object} args.options // item options\n * @param {Object} args.encoding\n * @param {Object} args.featureFlags\n * @returns array of EditorItem objects or empty array\n */\nexport const getFilteredRowsByShowEditor = ({ row, options, encoding, featureFlags }) => {\n if (!row || !Array.isArray(row)) {\n return [];\n }\n const filteredRow = row.filter(\n item =>\n typeof item.showEditor === 'undefined' ||\n (typeof item.showEditor === 'function' && item.showEditor({ options, encoding, featureFlags }))\n );\n return filteredRow;\n};\n\n/**\n * @method removeEmptyEntries Removes of all entries where the value is null, undefined, and convert nulls in arrays to undefined\n * @param {Object} obj\n */\nconst removeEmptyEntries = obj => {\n const returnObj = cloneDeep(obj);\n forIn(returnObj, (value, key) => {\n if ((value !== null && value !== undefined && Array.isArray(value)) || isPlainObject(value)) {\n returnObj[key] = removeEmptyEntries(returnObj[key]);\n }\n if (Array.isArray(value)) {\n returnObj[key] = value.map(val => (val === null ? undefined : val));\n }\n if (value === null || value === undefined) {\n delete returnObj[key];\n }\n });\n return returnObj;\n};\n\n/**\n * @method getToggleOffValueForDataColors determines the appropriate value when toggling off dataColors\n * @param {Object} config\n * @param {String} config.name - the option name (e.g., 'dataColors', 'layers[0].dataColors')\n * @param {Object} config.options - all visualization options\n * @param {String[]} config.dataSelectors - available data selectors (e.g., ['areaValues'])\n * @returns {String} appropriate toggle-off value (empty string or gradient fallback)\n */\nexport const getToggleOffValueForDataColors = ({ name, options, dataSelectors = [] }) => {\n // Only process dataColors options\n if (!name?.includes('dataColors')) {\n return '';\n }\n\n // Check if this is a choropleth layer by examining the layer configuration\n const isChoroplethLayer = () => {\n // Handle top-level dataColors\n if (name === 'dataColors') {\n return options?.type === 'choropleth' || options?.layerType === 'choropleth';\n }\n\n // Handle nested layer dataColors (e.g., layers[0].dataColors)\n const layerPattern = /^layers\\[(\\d+)\\]\\.dataColors$/;\n const layerMatch = layerPattern.exec(name);\n if (layerMatch) {\n const layerIndex = parseInt(layerMatch[1], 10);\n const layer = options?.layers?.[layerIndex];\n return layer?.type === 'choropleth' || layer?.layerType === 'choropleth';\n }\n\n return false;\n };\n\n // Check if areaValues is available as a data selector\n const hasAreaValuesSelector = dataSelectors.includes('areaValues');\n\n // Return gradient fallback for choropleth layers with areaValues, empty string otherwise\n if (isChoroplethLayer() && hasAreaValuesSelector) {\n return '> areaValues | gradient()';\n }\n\n return '';\n};\n\n/**\n * @method convertEmptyDataColorsForChoropleth handles the conversion of empty dataColors option to gradient fallback for choropleth layers\n * @param {Object} config\n * @param {String} config.option - the option name (e.g., 'dataColors', 'layers[0].dataColors')\n * @param {Any} config.value - the option value\n * @param {Object} config.options - all visualization options\n * @param {String[]} config.dataSelectors - available data selectors (e.g., ['areaValues'])\n * @returns {String|Any} converted value for choropleth or original value\n */\nexport const convertEmptyDataColorsForChoropleth = ({ option, value, options, dataSelectors = [] }) => {\n // Only process dataColors options\n if (!option?.includes('dataColors')) {\n return value;\n }\n\n // Only convert empty string values\n if (value !== '') {\n return value;\n }\n\n // Use the toggle-off value logic\n return getToggleOffValueForDataColors({ name: option, options, dataSelectors });\n};\n\n/**\n * @method setOption sets an options value\n * @param {String} option\n * @param {Any} value\n * @param {Object} oldVisualization\n * @param {Object} optionSchema\n * @param {Object} defaultOverrides\n * @param {String[]} dataSelectors - available data selectors for choropleth conversion\n * @returns visualization object with updated options\n */\nexport const setOption = (option, value, oldVisualization, optionSchema, defaultOverrides, dataSelectors) => {\n const obj = {\n ...oldVisualization,\n };\n\n let newOption = option;\n let newValue = value;\n\n // Apply choropleth-specific conversion for empty dataColors\n if (newValue === '' && newOption?.includes('dataColors')) {\n newValue = convertEmptyDataColorsForChoropleth({\n option: newOption,\n value: newValue,\n options: oldVisualization.options,\n dataSelectors,\n });\n }\n\n // Remove from definition if value is null/undefined, and the key is explicitly set in the optionSchema\n if ((newValue === null || newValue === undefined) && optionSchema[newOption]) {\n obj.options = omit(oldVisualization.options, newOption);\n return obj;\n }\n\n // Remove from definition if value is the same as the default from the overrides or the schema\n const schemaDefault = defaultOverrides?.[newOption] ?? optionSchema[newOption]?.default;\n if (typeof schemaDefault !== 'undefined' && newValue === schemaDefault) {\n obj.options = omit(oldVisualization.options, newOption);\n return obj;\n }\n // Copy options\n obj.options = cloneDeep(oldVisualization.options);\n obj.options ??= {};\n // ColumnSelectionEditor returns the option as an object\n // with a key/value pair inside that object with the param value as undefiend\n if ((value === null || value === undefined) && isPlainObject(option) && isPlainObject(option.options)) {\n [newOption] = Object.keys(option.options);\n [newValue] = Object.values(option.options);\n }\n // Select explicitly exposed option first for non arrays / objects\n if (optionSchema[newOption]) {\n if (optionSchema[newOption].type !== 'array') {\n obj.options[newOption] = newValue;\n return obj;\n }\n }\n // Set option using loadash to translate string path like `object.object.key` to target a specific key within nested objects\n if (newValue === null) {\n newValue = undefined;\n }\n set(obj.options, newOption, newValue);\n // Remove any null, undefined, nad nulls from arrays\n obj.options = removeEmptyEntries(obj.options);\n return obj;\n};\n","const TOKEN_NAMESPACE_PREFIX_PATTERN = /(\\w+:)?/.source;\n// ex: token.name|suh (old-style filter chain)\n// ex: token.name|lower|capitalize (new-style filter chain)\nconst TOKEN_NAME_CHARS_PATTERN = /([^$|:]+?)(\\|[|\\w]+)?/.source;\n// ex: $ns:token.name|suh$\nconst TOKEN_PATTERN = /\\$/.source + TOKEN_NAMESPACE_PREFIX_PATTERN + TOKEN_NAME_CHARS_PATTERN + /\\$/.source;\n\nconst TokenRegExp = new RegExp(TOKEN_PATTERN);\n\nexport const hasTokens = value => typeof value === 'string' && TokenRegExp.test(value);\n","import * as React from 'react';\nimport Multiselect from '@splunk/react-ui/Multiselect';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport ControlGroup from '../shared/AdvancedControlGroup';\n\ninterface ArrayOfStringsEditorProps extends BaseEditorProps {\n help?: string;\n}\n\nconst style = { width: '330px' };\nconst menuStyle = { display: 'none' };\n\nconst ArrayOfStringsEditor = ({\n onChange,\n name,\n labelPosition = 'top',\n labelWidth,\n label,\n isDisabled = false,\n help,\n value,\n}: ArrayOfStringsEditorProps): JSX.Element => {\n let safeValues = [];\n if (Array.isArray(value)) {\n safeValues = value.map(v => (v !== null && typeof v === 'object' ? v.toString() : `${v}`));\n }\n const [currentValues, setCurrentValues] = React.useState(safeValues);\n\n const handleChange = React.useCallback(\n (event, { values: v }) => {\n setCurrentValues(v);\n onChange(event, name, v);\n },\n [onChange, name]\n );\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth} help={help}>\n <Multiselect\n allowNewValues\n values={currentValues}\n onChange={handleChange}\n disabled={isDisabled}\n inline\n style={style}\n menuStyle={menuStyle}\n placeholder=\"\"\n selectAllAppearance=\"checkbox\"\n />\n </ControlGroup>\n );\n};\n\nexport default ArrayOfStringsEditor;\n","import React, { useCallback } from 'react';\nimport styled from 'styled-components';\nimport Switch, { type SwitchClickHandler } from '@splunk/react-ui/Switch';\nimport Chip from '@splunk/react-ui/Chip';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport { variables } from '@splunk/themes';\nimport Link from '@splunk/react-ui/Link';\nimport { hasTokens } from '../utils/token';\nimport ControlGroup from '../shared/AdvancedControlGroup';\n\nconst StyledTooltip = styled(Tooltip)`\n float: right;\n [data-test='clickable'] {\n padding-block: 0;\n }\n`;\n\ninterface StyledSwitchProps {\n hasChip?: boolean;\n}\n\nconst StyledSwitch = styled(Switch)<StyledSwitchProps>`\n padding-block: 0;\n\n ${({ hasChip }) =>\n hasChip &&\n `\n display: inline-flex;\n align-items: center;\n label {\n display: inline-flex;\n align-items: center;\n vertical-align: middle;\n }\n `}\n`;\n\nconst CheckboxInfo = styled.div`\n margin-top: ${variables.spacingXSmall};\n color: ${variables.contentColorDefault};\n font-size: ${variables.fontSizeSmall};\n`;\n\nconst StyledChip = styled(Chip)`\n margin-left: auto;\n`;\n\nconst CenteredLabel = styled.span`\n display: inline-flex;\n align-items: center;\n min-height: ${variables.inputHeight};\n line-height: 0;\n`;\n\nconst sortValues = (values, variantForSelectedState) => {\n if (variantForSelectedState) {\n return [values.find(v => v !== variantForSelectedState), variantForSelectedState];\n }\n\n return values;\n};\n\nexport interface CheckboxEditorProps {\n /**\n * Callback when checking or unchecking the box\n *\n * @param {SyntheticEvent} event The React `SyntheticEvent`\n * @param {string} name The option name\n * @param {string|boolean} value The option value\n */\n onChange: (evt: React.MouseEvent, name: string, value: string | boolean) => void;\n /**\n * The option name\n */\n name: string;\n /**\n * The item JSON schema, note it needs to be either boolean type or enum that has exactly two variants\n *\n * @type {Object} itemSchema\n */\n itemSchema: { enum?: string[]; type: string };\n /**\n * This indicates how to map the enum variants to selected/unselected state.\n * For example, `variantForSelectedState=\"show\"` means the checkbox will be in selected state when value is `\"show\"`,\n * and will be in unselected state when value is `\"hide\"`.\n * If this prop is unspecified, the first variant in the enum will be used to represent unselected state.\n *\n * Note this prop is only used when itemSchema is enum type and has exactly two variants.\n */\n variantForSelectedState?: string;\n /**\n * A human readable label for the option\n */\n label: string;\n /**\n * The option value\n */\n value: string | boolean;\n /**\n * The option values that can be selected\n */\n values?: { label?: string; value: string }[];\n /**\n * Label position\n */\n labelPosition?: 'left' | 'top' | 'right';\n /**\n * Label width\n */\n labelWidth?: number;\n /**\n * Appearance of the component\n */\n appearance?: 'checkbox' | 'toggle';\n /**\n * Disabled state of component\n */\n isDisabled?: boolean;\n /**\n * help text\n */\n help?: string;\n /**\n * help text format\n */\n helpFormat?: 'tooltip' | 'under';\n /**\n *\n * @type {Object}\n */\n helpTextLink?: { label: string; href?: string };\n /**\n * show chip with text\n */\n chipText?: string;\n}\n\nconst CheckboxEditor = ({\n help,\n helpFormat = 'tooltip',\n onChange,\n name,\n value,\n values,\n itemSchema,\n variantForSelectedState,\n labelPosition = 'right',\n labelWidth,\n label,\n appearance = 'checkbox',\n isDisabled = false,\n helpTextLink,\n chipText,\n}: CheckboxEditorProps) => {\n const disabled = hasTokens(value) || isDisabled;\n let options;\n\n // Note: by default the first value will be mapped to unselected state\n if (Array.isArray(values) && values.length === 2) {\n options = sortValues(\n values.map(v => v.value),\n variantForSelectedState\n );\n } else if (Array.isArray(itemSchema.enum) && itemSchema.enum.length === 2) {\n options = sortValues(itemSchema.enum, variantForSelectedState);\n } else if (itemSchema.type === 'boolean') {\n options = [false, true];\n } else {\n throw Error(`No valid values provided to CheckboxEditor: ${JSON.stringify(itemSchema)}`);\n }\n\n const handleClick = useCallback<SwitchClickHandler>(\n event => onChange(event, name, value === options[1] ? options[0] : options[1]),\n [onChange, options, name, value]\n );\n\n if (labelPosition === 'right') {\n return (\n <>\n <StyledSwitch\n data-test={name}\n disabled={disabled}\n value={name}\n onClick={handleClick}\n selected={value === options[1]}\n appearance={appearance}\n hasChip={!!chipText}\n >\n <CenteredLabel>{label}</CenteredLabel>\n {chipText && <StyledChip data-test=\"beta-chip\">{chipText}</StyledChip>}\n {help && helpFormat === 'tooltip' && <StyledTooltip content={help} />}\n </StyledSwitch>\n {help && helpFormat === 'under' && (\n <CheckboxInfo>\n {help}\n {` `}\n {helpTextLink?.label && (\n <>\n <br />\n <Link data-test=\"help-text-link\" to={helpTextLink?.href || null}>\n {helpTextLink.label}\n </Link>\n </>\n )}\n </CheckboxInfo>\n )}\n </>\n );\n }\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth} tooltip={help}>\n <StyledSwitch\n data-test={name}\n disabled={disabled}\n value={name}\n onClick={handleClick}\n selected={value === options[1]}\n appearance={appearance}\n />\n </ControlGroup>\n );\n};\n\nexport default CheckboxEditor;\n","import React, { useCallback, useMemo } from 'react';\nimport T from 'prop-types';\nimport Multiselect from '@splunk/react-ui/Multiselect';\nimport type { DataType } from '@splunk/visualization-encoding/DataPrimitive';\nimport { getDataSourceStateInfo } from '@splunk/visualizations-shared/dataSourceUtils';\nimport { BaseEditorPropTypes } from '../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport { useDataSource } from '../hooks/useDataSource';\nimport { getAvailableFieldsWithTypes, sanitizeFieldNames } from '../utils/columnSelectionUtils';\nimport ControlGroup from '../shared/AdvancedControlGroup';\n\nexport const EDITOR_NAME = 'columnMultiSelectionByFieldName-editor';\ninterface ColumnMultiSelectionByFieldNameEditorProps extends BaseEditorProps {\n tooltip?: boolean;\n filterByTypes?: DataType[];\n isAdvanced?: boolean;\n}\n\nconst defaultFilterByTypes: ColumnMultiSelectionByFieldNameEditorProps['filterByTypes'] = [];\n\nconst ColumnMultiSelectionByFieldNameEditor = ({\n name,\n value,\n label,\n labelPosition = 'top',\n labelWidth,\n isAdvanced = false,\n isDisabled = false,\n tooltip,\n dataSourceBindings,\n filterByTypes = defaultFilterByTypes,\n onChange,\n}: ColumnMultiSelectionByFieldNameEditorProps): JSX.Element => {\n // fetch dataSource fields\n const dataSource = useDataSource({ dataSourceBindings, dataSourceKey: 'primary' });\n\n // disable editor when necessary\n const { hasError, isMissing, isLoading } = useMemo(\n () => getDataSourceStateInfo(dataSource),\n [dataSource]\n );\n const disabled = useMemo(() => isMissing || hasError || isDisabled, [hasError, isDisabled, isMissing]);\n\n // get field types\n const { columns, fields } = useMemo(() => dataSource?.data || { columns: [], fields: [] }, [dataSource]);\n const fieldsWithTypes = useMemo(() => getAvailableFieldsWithTypes(columns, fields), [columns, fields]);\n\n const fieldNames = useMemo(\n () =>\n sanitizeFieldNames(\n value,\n fieldsWithTypes.map(field => field.name)\n ),\n [value, fieldsWithTypes]\n );\n\n const handleFieldNameChange = useCallback(\n (event, { values }): void => {\n onChange(event, name, values);\n },\n [onChange, name]\n );\n\n return (\n <ControlGroup\n data-test={`${EDITOR_NAME}-${name}`}\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n isAdvanced={isAdvanced}\n >\n <Multiselect\n data-test={`${EDITOR_NAME}-select-${name}`}\n onChange={handleFieldNameChange}\n values={fieldNames}\n disabled={disabled}\n isLoadingOptions={isLoading}\n compact\n selectAllAppearance=\"checkbox\"\n >\n {fieldsWithTypes.map(field => (\n <Multiselect.Option\n data-test={`${EDITOR_NAME}-option-${field.name}`}\n key={field.name}\n value={field.name}\n label={`${field.name} (${field.type})`}\n disabled={filterByTypes.length > 0 && !filterByTypes.find(f => f === field.type)}\n />\n ))}\n </Multiselect>\n </ControlGroup>\n );\n};\n\nColumnMultiSelectionByFieldNameEditor.propTypes = {\n ...BaseEditorPropTypes,\n tooltip: T.bool,\n labelPosition: T.oneOf(['top', 'left']),\n isAdvanced: T.bool,\n isDisabled: T.bool,\n};\n\nexport default ColumnMultiSelectionByFieldNameEditor;\n","import React, { useState, useCallback, useMemo } from 'react';\nimport Multiselect from '@splunk/react-ui/Multiselect';\nimport { get } from 'lodash';\nimport { getFieldsFromDSL } from '@splunk/visualization-encoding/utils/dsl';\nimport { getDataSourceStateInfo } from '@splunk/visualizations-shared/dataSourceUtils';\nimport type { DataType } from '@splunk/visualization-encoding/DataPrimitive';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport { useDataSource } from '../hooks/useDataSource';\nimport { getAvailableFieldsWithTypes, getPlaceholderMessage } from '../utils/columnSelectionUtils';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { useColumnSelectorFooterMessage } from './useColumnSelectorFooterMessage';\nimport type { DynamicOptionsConfig, JSONPrimitive } from '../types';\n\ninterface ColumnMultiSelectionEditorProps extends BaseEditorProps {\n dataSourceKey: string;\n prepareValue?: (id: DynamicOptionsConfig) => DynamicOptionsConfig;\n excludeByNames?: string[];\n filterByTypes?: DataType[];\n shouldShowInternalFields?: boolean;\n}\n\nexport const isInternal = (field: { name: string }): boolean =>\n field?.name?.startsWith('_') && field.name !== '_time';\n\nexport const ColumnMultiSelectionEditor: React.FunctionComponent<ColumnMultiSelectionEditorProps> = ({\n name,\n value,\n label = '',\n labelPosition = 'top',\n dataSourceKey = 'primary',\n dataSourceBindings,\n prepareValue = (id: DynamicOptionsConfig): DynamicOptionsConfig => id,\n onChange,\n isAdvanced,\n isDisabled,\n shouldShowInternalFields = true,\n filterByTypes,\n excludeByNames,\n}) => {\n const dataSource = useDataSource({ dataSourceBindings, dataSourceKey });\n const { columns, fields } = dataSource?.data || { columns: [], fields: [] };\n const adjustedDataSource = useMemo(\n () =>\n shouldShowInternalFields\n ? dataSource\n : {\n ...dataSource,\n data: {\n fields: fields.filter((field: { name: string }) => !isInternal(field)),\n columns: columns.filter((_c: JSONPrimitive, i: number) => !isInternal(fields[i])),\n },\n },\n [columns, dataSource, fields, shouldShowInternalFields]\n );\n const { columns: adjustedColumns, fields: adjustedFields } = get(adjustedDataSource, 'data') || {\n columns: [],\n fields: [],\n };\n const availableFieldsWithTypes = useMemo(\n () => getAvailableFieldsWithTypes(adjustedColumns, adjustedFields),\n [adjustedColumns, adjustedFields]\n );\n const [filter, setFilter] = useState('');\n // return `value` if `value` is undefined or null so editor shows placeholder message\n const fieldNames = useMemo(\n () =>\n value == null\n ? value\n : getFieldsFromDSL(value, {\n [dataSourceKey]: adjustedDataSource,\n }),\n [adjustedDataSource, dataSourceKey, value]\n );\n const [selectedFields, setSelectedFields] = useState<string[]>(fieldNames || []);\n\n React.useEffect((): void => {\n if (fieldNames?.length) {\n setSelectedFields(fieldNames);\n }\n }, [fieldNames]);\n\n const filteredFields = availableFieldsWithTypes.filter(\n (field): boolean => field.name.indexOf(filter) !== -1\n );\n const footerMessage = useColumnSelectorFooterMessage({\n availableFields: availableFieldsWithTypes,\n filteredFields,\n filter,\n selectedFields,\n });\n\n const handleValuesChange = useCallback(\n (event, { values: selectedValues }): void => {\n setSelectedFields(selectedValues);\n const seriesNamesStr = `'${selectedValues.join(\"','\")}'`;\n const update = prepareValue({\n options: {\n [name]: `> ${dataSourceKey} | frameBySeriesNames(${seriesNamesStr})`,\n },\n });\n onChange(event, update);\n },\n [dataSourceKey, name, onChange, prepareValue]\n );\n\n const handleFilterChange = useCallback((e, { keyword }): void => {\n setFilter(keyword);\n }, []);\n\n const { hasError, isMissing, isLoading } = getDataSourceStateInfo(dataSource);\n const disabled = isMissing || hasError || isDisabled;\n const placeholderMessage = getPlaceholderMessage({\n isMissing,\n isLoading,\n hasError,\n defaultMessage: 'Select field(s) from data source',\n });\n return (\n <ControlGroup label={label} labelPosition={labelPosition} isAdvanced={isAdvanced}>\n <Multiselect\n data-test=\"ColumnMultiSelectionEditor\"\n disabled={disabled}\n values={selectedFields}\n onChange={handleValuesChange}\n onFilterChange={handleFilterChange}\n footerMessage={footerMessage}\n placeholder={placeholderMessage}\n isLoadingOptions={isLoading}\n error={hasError}\n compact\n selectAllAppearance=\"checkbox\"\n >\n {filteredFields.map(field => (\n <Multiselect.Option\n key={field.name}\n label={`${field.name} (${field.type})`}\n value={field.name}\n disabled={\n (filterByTypes?.length && !filterByTypes.find(f => f === field.type)) ||\n excludeByNames?.includes(field.name)\n }\n />\n ))}\n </Multiselect>\n </ControlGroup>\n );\n};\n\nexport default ColumnMultiSelectionEditor;\n","import React, { useState, useCallback } from 'react';\nimport Select from '@splunk/react-ui/Select';\nimport { getFieldsFromDSL } from '@splunk/visualization-encoding/utils/dsl';\nimport { getDataSourceStateInfo } from '@splunk/visualizations-shared/dataSourceUtils';\nimport type { DataType } from '@splunk/visualization-encoding/DataPrimitive';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport { useDataSource } from '../hooks/useDataSource';\nimport { getAvailableFieldsWithTypes, getPlaceholderMessage } from '../utils/columnSelectionUtils';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { editorStyle } from '../shared/dimensionConstants';\nimport { useColumnSelectorFooterMessage } from './useColumnSelectorFooterMessage';\nimport type { DynamicOptionsConfig } from '../types';\n\ninterface ColumnSelectionEditorProps extends BaseEditorProps {\n dataSourceKey: string;\n prepareValue?: (id: DynamicOptionsConfig) => DynamicOptionsConfig;\n filterByTypes?: DataType[];\n tooltip?: string;\n hideEditorWhenLoading?: boolean;\n}\n\nexport const ColumnSelectionEditor: React.FunctionComponent<ColumnSelectionEditorProps> = ({\n name,\n value,\n label = '',\n labelPosition = 'top',\n dataSourceKey = 'primary',\n dataSourceBindings,\n prepareValue = (id: DynamicOptionsConfig): DynamicOptionsConfig => id,\n onChange,\n isAdvanced,\n isDisabled,\n filterByTypes,\n tooltip,\n hideEditorWhenLoading = false,\n}) => {\n const dataSource = useDataSource({ dataSourceBindings, dataSourceKey });\n const { columns, fields } = dataSource?.data || { columns: [], fields: [] };\n const availableFieldsWithTypes = getAvailableFieldsWithTypes(columns, fields);\n // return `value` if `value` is undefined or null so editor shows placeholder message\n const fieldName =\n value == null\n ? value\n : getFieldsFromDSL(value, {\n [dataSourceKey]: dataSource,\n })[0] || '';\n const [selectedField, setSelectedField] = useState(fieldName);\n React.useEffect((): void => {\n setSelectedField(fieldName);\n }, [fieldName]);\n const [filter, setFilter] = useState('');\n const filteredFields = availableFieldsWithTypes.filter(\n (field): boolean => field.name.indexOf(filter) !== -1\n );\n const footerMessage = useColumnSelectorFooterMessage({\n availableFields: availableFieldsWithTypes,\n selectedFields: [selectedField],\n filteredFields,\n filter,\n });\n\n const handleValueChange = useCallback(\n (event, { value: selectedValue }): void => {\n setSelectedField(selectedValue);\n const update = prepareValue({\n options: {\n [name]: `> ${dataSourceKey} | seriesByName('${selectedValue}')`,\n },\n });\n onChange(event, update);\n },\n [dataSourceKey, name, onChange, prepareValue]\n );\n\n const handleFilterChange = useCallback((e, { keyword }): void => {\n setFilter(keyword);\n }, []);\n const { hasError, isMissing, isLoading } = getDataSourceStateInfo(dataSource);\n const disabled = isMissing || hasError || isDisabled;\n const placeholderMessage = getPlaceholderMessage({ isMissing, isLoading, hasError });\n const shouldRenderEditor = hideEditorWhenLoading ? !!selectedField : true;\n\n return (\n shouldRenderEditor && (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n tooltip={tooltip}\n isAdvanced={isAdvanced}\n >\n <Select\n data-test=\"ColumnSelectionEditor\"\n value={selectedField}\n onFilterChange={handleFilterChange}\n onChange={handleValueChange}\n footerMessage={footerMessage}\n disabled={disabled}\n placeholder={placeholderMessage}\n isLoadingOptions={isLoading}\n error={hasError}\n style={editorStyle}\n filter\n >\n {filteredFields.map(field => (\n <Select.Option\n key={field.name}\n label={`${field.name} (${field.type})`}\n value={field.name}\n disabled={!!filterByTypes?.length && !filterByTypes.find(f => f === field.type)}\n />\n ))}\n </Select>\n </ControlGroup>\n )\n );\n};\n\nexport default ColumnSelectionEditor;\n","import * as React from 'react';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport Button from '@splunk/react-ui/Button';\nimport Popover from '@splunk/react-ui/Popover';\nimport CustomizedInSourceMessage from '../shared/CustomizedInSourceMessage';\n\nconst { useRef, useState, useCallback } = React;\n\nexport interface CustomizedInSourceEditorProps {\n label: string;\n labelPosition?: 'left' | 'top';\n labelWidth?: number;\n onResetToDefault?: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nconst CustomizedInSourceEditor = ({\n label,\n labelPosition = 'left',\n labelWidth,\n onResetToDefault,\n}: CustomizedInSourceEditorProps) => {\n const [open, setOpen] = useState(false);\n const anchor = useRef(null);\n const handleOpen = useCallback((): void => setOpen(true), []);\n const handleRequestClose = useCallback((): void => setOpen(false), []);\n\n return (\n <ControlGroup label={_(label)} labelPosition={labelPosition} labelWidth={labelWidth}>\n <Button\n data-test=\"customized-in-source-button\"\n onClick={handleOpen}\n appearance=\"default\"\n ref={anchor}\n label={_('Customized in source')}\n />\n <Popover\n data-test=\"customized-in-source-popover\"\n open={open}\n anchor={anchor.current}\n onRequestClose={handleRequestClose}\n defaultPlacement=\"horizontal\"\n >\n <CustomizedInSourceMessage onResetToDefault={onResetToDefault} />\n </Popover>\n </ControlGroup>\n );\n};\n\nexport default CustomizedInSourceEditor;\n","import * as React from 'react';\nimport { toPx } from '@splunk/visualizations-shared/style';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport Button from '@splunk/react-ui/Button';\nimport Popover from '@splunk/react-ui/Popover';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { defaultPalettesConfig as initialPalettesConfig } from '@splunk/visualization-color-palettes/editors/PresetPalettes';\nimport { find, isEmpty } from 'lodash';\nimport {\n getDataSelectorsFromDSL,\n getLastFormatterFromDSL,\n buildDSLFromDataSelectorAndFormatter,\n} from '@splunk/visualization-encoding/utils/dsl';\nimport type { OptionsStanza } from '@splunk/visualization-encoding/AST';\nimport type { RadioBarChangeHandler } from '@splunk/react-ui/RadioBar';\nimport RadioBar from '@splunk/react-ui/RadioBar';\nimport { FormatterEditor, supportedFormatters } from './formatters/FormatterEditor';\nimport type { UiConfig, FormatterUiConfig } from './formatters/FormatterEditor';\nimport CustomizedInSourceEditor from './CustomizedInSourceEditor';\nimport { FLYOUT_WIDTH, FLYOUT_PADDING } from '../shared/dimensionConstants';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport type { PalettesConfig } from '../interfaces/PalettesConfig';\nimport { getFormatterConfig, isSupportedDataSelector, isSupportedFormatter } from '../utils/EditorFunctions';\n\nconst { useRef, useState, useEffect } = React;\n\nconst FlyoutHeader = styled.div`\n font-weight: 600;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 8px;\n`;\n\nconst StyledLabel = styled.div`\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 8px;\n`;\n\nconst StyledFlyoutContent = styled.div.attrs((): { 'data-test': string } => ({\n 'data-test': 'DynamicColorFlyoutContent',\n}))`\n box-sizing: border-box;\n padding: ${toPx(FLYOUT_PADDING)};\n width: ${toPx(FLYOUT_WIDTH)};\n`;\n\nconst StyledButton = styled(Button)`\n padding: '4px';\n`;\n\nexport type ColorMode = 'text' | 'background' | 'off';\n\ntype RadioBarChangeEvent = Parameters<RadioBarChangeHandler>[0];\ntype RadioBarChangeData = Parameters<RadioBarChangeHandler>[1];\n\nexport type ColorModeChangeHandler = (\n event: RadioBarChangeEvent,\n data: Omit<RadioBarChangeData, 'value'> & { value: ColorMode }\n) => ReturnType<RadioBarChangeHandler>;\n\nexport interface DynamicColorEditorProps extends BaseEditorProps {\n value: string;\n flyoutTitle?: string;\n dataSelectors?: UiConfig[];\n formatters?: FormatterUiConfig[];\n defaultPalettesConfig: PalettesConfig;\n showStaticTextColor?: boolean;\n colorMode?: ColorMode;\n handleColorModeChange?: ColorModeChangeHandler;\n}\n\nexport const prepareUpdate = ({\n name,\n selectedDataSelector,\n selectedFormatterType,\n currentFormatterConfig,\n}): OptionsStanza => {\n const contextKey = `${name}EditorConfig`;\n // use regex to remove top-level array references. keeping only the nested field name.\n // if only top-level, stay unchanged.\n // example 1: layers[0].dataColorsEditorConfig → dataColorsEditorConfig\n // example 2: rangeValueColorConfig → rangeValueColorConfig\n const extractedContextKey = contextKey.replace(/^\\w+\\[\\d+\\]\\.(.+)$/, '$1');\n\n return {\n options: {\n [name]: buildDSLFromDataSelectorAndFormatter(\n selectedDataSelector,\n selectedFormatterType,\n contextKey\n ),\n },\n context: {\n [extractedContextKey]: currentFormatterConfig,\n },\n };\n};\n/**\n * The DynamicColorEditor receives a DSL string as value prop and breaks it up into two parts\n * 1) a data selector\n * 2) a formatter\n * Based on those two parts and editorProps from the editor config (formatters & dataSelectors) it initializes a UI to edit color formatter configurations.\n *\n * For now the data selector part is limited to a data selector reference that needs to be defined in editorProps.dataSelectors\n *\n * Example:\n * `> majorValue | rangeValue(config)` requires majorValue to be part of editorProps.dataSelectors and rangeValue to be part of editorProps.formatters\n * Advanced data selection such as `> primary | seriesByIndex(0) | rangeValue(config)` exceeds the capabilities of the editor\n */\nexport const DynamicColorEditor: React.FunctionComponent<DynamicColorEditorProps> = ({\n name,\n value,\n label = '',\n labelPosition = 'left',\n labelWidth,\n context,\n onChange = (): void => undefined,\n flyoutTitle = _('Dynamic coloring'),\n formatters = [],\n dataSelectors = [],\n defaultPalettesConfig = initialPalettesConfig,\n isDisabled = false,\n showStaticTextColor = false,\n colorMode = undefined,\n handleColorModeChange = undefined,\n}) => {\n const [showFlyout, setShowFlyout] = useState(false);\n const buttonRef = useRef(null);\n const { type: formatterFromDSL, paramKey: formatterContextKey } = getLastFormatterFromDSL(value) || {\n type: 'unknown',\n paramKey: 'unknown',\n };\n const dataSelectorFromDSL = getDataSelectorsFromDSL(value)[0];\n const [selectedFormatterType, setSelectedFormatterType] = useState(formatterFromDSL);\n useEffect((): void => {\n setSelectedFormatterType(formatterFromDSL);\n }, [formatterFromDSL]);\n\n const [selectedDataSelector, setSelectedDataSelector] = useState(dataSelectorFromDSL);\n useEffect((): void => {\n setSelectedDataSelector(dataSelectorFromDSL);\n }, [dataSelectorFromDSL]);\n\n const formatterConfigFromDSL = getFormatterConfig({\n contextConfig: context[formatterContextKey],\n formatters,\n formatterFromDSL,\n selectedDataSelector,\n });\n const [currentFormatterConfig, setCurrentFormatterConfig] = useState(formatterConfigFromDSL);\n useEffect((): void => {\n setCurrentFormatterConfig(formatterConfigFromDSL);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [context, formatters, formatterContextKey, formatterFromDSL, dataSelectorFromDSL]);\n\n const handleDataSelectorChange = (event, editorName, newDataSelector): void => {\n setSelectedDataSelector(newDataSelector);\n // pick the first available formatter that has a config for this data selector\n const formatter = find(\n formatters,\n (f): Record<string, unknown> => f.defaults[newDataSelector]\n ) as FormatterUiConfig;\n setSelectedFormatterType(formatter.value);\n const formatterCfg = formatter.defaults[newDataSelector];\n setCurrentFormatterConfig(formatterCfg);\n onChange(\n event,\n prepareUpdate({\n name,\n selectedDataSelector: newDataSelector,\n selectedFormatterType: formatter.value,\n currentFormatterConfig: formatterCfg,\n })\n );\n };\n const handleFormatterChange = (event, editorName, newFormatter): void => {\n setSelectedFormatterType(newFormatter);\n const formatter = find(formatters, ['value', newFormatter]);\n const formatterCfg = formatter.defaults[selectedDataSelector];\n setCurrentFormatterConfig(formatterCfg);\n onChange(\n event,\n prepareUpdate({\n name,\n selectedDataSelector,\n selectedFormatterType: newFormatter,\n currentFormatterConfig: formatterCfg,\n })\n );\n };\n const handleFormatterConfigChange = (event, editorName, newFormatterConfig): void => {\n setCurrentFormatterConfig(newFormatterConfig);\n onChange(\n event,\n prepareUpdate({\n name,\n selectedDataSelector,\n selectedFormatterType,\n currentFormatterConfig: newFormatterConfig,\n })\n );\n };\n const handleResetToDefault = (event): void => {\n const getDefaultFormatter = (): FormatterUiConfig => {\n return find(formatters, (f): boolean => f.isDefault);\n };\n const getRangeValueFormatter = (): FormatterUiConfig => {\n return find(formatters, (f): boolean => f.value === 'rangeValue');\n };\n const formatter = getDefaultFormatter() || getRangeValueFormatter() || formatters[0];\n if (isEmpty(formatter)) {\n return;\n }\n\n const defaultFormatter = formatter.value;\n const defaultDataSelector = Object.keys(formatter.defaults)[0];\n const formatterCfg = formatter.defaults[defaultDataSelector];\n\n setSelectedDataSelector(defaultDataSelector);\n setSelectedFormatterType(defaultFormatter);\n setCurrentFormatterConfig(formatterCfg);\n onChange(\n event,\n prepareUpdate({\n name,\n selectedDataSelector: defaultDataSelector,\n selectedFormatterType: defaultFormatter,\n currentFormatterConfig: formatterCfg,\n })\n );\n };\n\n const handleButtonClick = React.useCallback(() => {\n setShowFlyout(currentValue => !currentValue);\n }, []);\n\n // implement source exceeds editor state\n if (\n !isSupportedDataSelector({ selectedDataSelector, dataSelectors }) ||\n !isSupportedFormatter({\n selectedFormatterType,\n formattersFromEditor: formatters,\n supportedFormatters,\n })\n ) {\n return (\n <CustomizedInSourceEditor\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n onResetToDefault={handleResetToDefault}\n />\n );\n }\n\n const FormatterConfigPreview = supportedFormatters[selectedFormatterType].preview;\n\n return (\n <>\n <ControlGroup\n data-test=\"DynamicColorEditorGroup\"\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n >\n <StyledButton\n inline={false}\n data-test=\"DynamicColorEditorButton\"\n appearance=\"default\"\n ref={buttonRef}\n onClick={handleButtonClick}\n disabled={isDisabled}\n >\n <FormatterConfigPreview\n data-test=\"FormatterConfigPreview\"\n config={currentFormatterConfig}\n />\n </StyledButton>\n </ControlGroup>\n <Popover\n data-test=\"DynamicColorEditorFlyout\"\n open={showFlyout}\n anchor={buttonRef.current}\n defaultPlacement=\"horizontal\"\n style={{ padding: '10px' }}\n onRequestClose={(): void => setShowFlyout(false)}\n takeFocus\n >\n <StyledFlyoutContent>\n {!colorMode && <FlyoutHeader>{flyoutTitle}</FlyoutHeader>}\n {colorMode && (\n <ControlGroup\n data-test=\"TableDynamicColorEditorGroup\"\n label={flyoutTitle}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n >\n <RadioBar value={colorMode} onChange={handleColorModeChange}>\n {[\n { label: _('Off'), value: 'off' },\n { label: _('Text'), value: 'text' },\n { label: _('Background'), value: 'background' },\n ].map(({ label: optionLabel, value: optionValue }) => (\n <RadioBar.Option\n key={optionValue}\n value={optionValue}\n label={_(optionLabel)}\n />\n ))}\n </RadioBar>\n </ControlGroup>\n )}\n {colorMode && <StyledLabel>{_('Method')}</StyledLabel>}\n <FormatterEditor\n selectedDataSelector={selectedDataSelector}\n selectedFormatterType={selectedFormatterType}\n currentFormatterConfig={currentFormatterConfig}\n onDataSelectorChange={handleDataSelectorChange}\n onFormatterTypeChange={handleFormatterChange}\n onFormatterConfigChange={handleFormatterConfigChange}\n formatters={formatters}\n dataSelectors={dataSelectors}\n defaultPalettesConfig={defaultPalettesConfig}\n showStaticTextColor={showStaticTextColor}\n />\n </StyledFlyoutContent>\n </Popover>\n </>\n );\n};\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { defaultPalettesConfig as initialPalettesConfig } from '@splunk/visualization-color-palettes/editors/PresetPalettes';\nimport type { OptionsStanza } from '@splunk/visualization-encoding/AST';\nimport type { UiConfig, FormatterUiConfig } from './formatters/FormatterEditor';\nimport { DynamicColorEditorPropTypes } from '../interfaces/DynamicColorEditorProps';\nimport { DynamicColorEditor } from './DynamicColorEditor';\nimport ToggleEditor from './ToggleEditor';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport type { PalettesConfig } from '../interfaces/PalettesConfig';\nimport { getToggleOffValueForDataColors } from '../utils/EditorFunctions';\n\nexport interface DynamicColorEditorWithPrecedenceProps extends BaseEditorProps {\n name: string;\n value: any;\n flyoutTitle?: string;\n dataSelectors?: UiConfig[];\n formatters?: FormatterUiConfig[];\n defaultPalettesConfig: PalettesConfig;\n tooltip?: string;\n options?: Record<string, any>; // Pass in current visualization options to determine choropleth status\n onChange: (...args: any[]) => void;\n}\n\nconst propTypes: Record<keyof DynamicColorEditorWithPrecedenceProps, T.Validator<any>> = {\n ...DynamicColorEditorPropTypes,\n};\n\nexport const DynamicColorEditorWithPrecedence: React.FC<DynamicColorEditorWithPrecedenceProps> = ({\n name, // the option links to both the toggle and the dynamic color editor\n value, // the option value\n label = '',\n labelPosition,\n labelWidth,\n context,\n flyoutTitle = _('Dynamic coloring'),\n formatters = [],\n dataSelectors = [],\n defaultPalettesConfig = initialPalettesConfig,\n tooltip,\n options = {},\n onChange = () => undefined,\n}) => {\n // Helper function to check if value represents the \"off\" state\n const isValueInOffState = React.useCallback((val: any) => {\n if (!val || val === '') {\n return true;\n }\n\n // Check if it's the choropleth fallback pattern: \"> areaValues | gradient()\"\n if (typeof val === 'string') {\n const choroplethPattern = /^>\\s*areaValues\\s*\\|\\s*gradient\\(\\s*\\)$/;\n return choroplethPattern.exec(val) !== null;\n }\n\n return false;\n }, []);\n\n const [isDynamicEditorEnabled, setDynamicEditorEnabled] = React.useState(!isValueInOffState(value));\n React.useEffect(() => {\n setDynamicEditorEnabled(!isValueInOffState(value));\n }, [value, isValueInOffState]);\n\n const handleToggleChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, _optionStanza: OptionsStanza) => {\n setDynamicEditorEnabled(prevState => !prevState);\n\n const updatedOptions: Record<string, any> = {};\n const updatedContext: Record<string, any> = {};\n\n if (isDynamicEditorEnabled) {\n // toggle off: use choropleth-aware logic to determine appropriate fallback value\n const dataSelectorValues = dataSelectors.map(ds => ds.value);\n updatedOptions[name] = getToggleOffValueForDataColors({\n name,\n options,\n dataSelectors: dataSelectorValues,\n });\n // Remove dataColorsEditorConfig from context\n if (context && context.dataColorsEditorConfig !== undefined) {\n updatedContext.dataColorsEditorConfig = undefined;\n }\n } else {\n // toggle on: check if we're coming from choropleth fallback or from empty state\n const choroplethPattern = /^>\\s*areaValues\\s*\\|\\s*gradient\\(\\s*\\)$/;\n const isFromChoroplethFallback =\n typeof value === 'string' && choroplethPattern.exec(value) !== null;\n\n if (isFromChoroplethFallback) {\n // Convert choropleth fallback to active gradient configuration\n updatedOptions[name] = '> areaValues | gradient(dataColorsEditorConfig)';\n // Use default gradient configuration\n const defaultGradientContext = formatters.find(f => f.value === 'gradient')?.defaults\n ?.areaValues;\n if (defaultGradientContext) {\n updatedContext.dataColorsEditorConfig = defaultGradientContext;\n }\n } else if (name.endsWith('dataColors')) {\n // toggle on from empty state: apply default formatter colors\n const dataSelector = dataSelectors[0]?.value;\n const formatter = formatters[0]?.value;\n const defaultContext = formatters[0]?.defaults?.[dataSelector];\n\n if (!dataSelector || !formatter || !defaultContext) {\n return;\n }\n updatedOptions[\n name\n ] = `> ${dataSelectors[0].value} | ${formatter}(dataColorsEditorConfig)`;\n updatedContext.dataColorsEditorConfig = defaultContext;\n }\n }\n\n onChange(event, { options: updatedOptions, context: updatedContext });\n },\n [context, dataSelectors, formatters, isDynamicEditorEnabled, name, onChange, options, value]\n );\n\n const handleDynamicColorEditorChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, optionStanza: OptionsStanza) => {\n onChange(event, optionStanza);\n },\n [onChange]\n );\n\n return (\n <div data-test=\"dynamic-color-toggle\">\n <ToggleEditor\n name={name}\n label={_('Dynamic coloring')}\n labelPosition=\"right\"\n value={isDynamicEditorEnabled}\n onChange={handleToggleChange}\n itemSchema={{ type: 'boolean' }}\n help={tooltip}\n />\n {isDynamicEditorEnabled && (\n <div data-test=\"dynamic-color-editor\">\n <DynamicColorEditor\n name={name}\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n value={value}\n context={context}\n onChange={handleDynamicColorEditorChange}\n flyoutTitle={flyoutTitle}\n formatters={formatters}\n dataSelectors={dataSelectors}\n defaultPalettesConfig={defaultPalettesConfig}\n />\n </div>\n )}\n </div>\n );\n};\n\nDynamicColorEditorWithPrecedence.propTypes = propTypes;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { unzip } from 'lodash';\nimport Text from '@splunk/react-ui/Text';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport ColumnLayout from '@splunk/react-ui/ColumnLayout';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ColumnSelectionEditor from './ColumnSelectionEditor';\nimport StaticItemEditor from './StaticItemEditor';\nimport {\n getDynamicOptionsFromConfig,\n getFieldFromFieldNameDsl,\n isConfigAdvanced,\n} from '../utils/dynamicItemInputEditor';\nimport { VERTICAL_EDITOR_SPACING } from '../shared/dimensionConstants';\nimport type { StaticItem, DynamicOptionsContext } from '../types';\n\ninterface DynamicOptionsConfig {\n context?: DynamicOptionsContext;\n options?: Record<string, unknown>;\n}\n\ninterface DynamicItemEditorProps {\n name: string;\n value: StaticItem[] | string;\n label: string;\n labelPosition?: 'top' | 'left';\n labelWidth?: number;\n onChange: (event: React.SyntheticEvent | null, updatedConfig: DynamicOptionsConfig) => void;\n context: DynamicOptionsContext;\n dataSourceBindings: { primary?: string };\n help?: string;\n validate?: (args: { value: string }) => { message: string } | null;\n [key: string]: unknown;\n}\n\nconst defaultHelpText = _(\n 'Advanced configuration options are being used by this input. Please edit in source mode.'\n);\n\nconst DynamicItemEditor = ({\n name,\n context,\n value = '',\n label,\n onChange,\n dataSourceBindings,\n labelPosition = 'top',\n labelWidth,\n help = defaultHelpText,\n validate,\n}: DynamicItemEditorProps): JSX.Element => {\n const [staticItems, setItems] = React.useState<StaticItem[]>([]);\n const [dynamicItemsLabelField, setLabel] = React.useState('');\n const [dynamicItemsValueField, setValue] = React.useState('');\n\n // update static and dynamic options when the props change\n React.useEffect(() => {\n const { staticOptions, dynamicOptionsLabel, dynamicOptionsValue } = getDynamicOptionsFromConfig({\n items: value,\n context,\n });\n\n setItems(staticOptions);\n setLabel(dynamicOptionsLabel);\n setValue(dynamicOptionsValue);\n }, [value, context]);\n\n // use static mode if no data source is configured\n React.useEffect(() => {\n const currDataSource = dataSourceBindings.primary;\n if (currDataSource !== undefined || Array.isArray(value)) {\n return;\n }\n\n onChange(null, {\n context: {\n formattedConfig: undefined,\n formattedStatics: undefined,\n statics: undefined,\n label: undefined,\n value: undefined,\n },\n options: {\n [name]: staticItems,\n },\n });\n }, [dataSourceBindings, name, value, onChange, staticItems]);\n\n const handleChange = React.useCallback(\n (newItems, newLabelField, newValueField) => {\n const isStaticConfiguration = Array.isArray(value) && (!newLabelField || !newValueField);\n\n if (isStaticConfiguration) {\n onChange(null, { options: { [name]: newItems } });\n } else {\n const statics: string[][] = unzip(\n newItems.map(({ label: l, value: v }: StaticItem) => [l, v])\n );\n onChange(null, {\n context: {\n formattedConfig: { number: { prefix: '' } },\n formattedStatics: '>statics | formatByType(formattedConfig)',\n statics,\n label: `>primary | seriesByName(\"${newLabelField}\") | renameSeries(\"label\") | formatByType(formattedConfig)`,\n value: `>primary | seriesByName(\"${newValueField}\") | renameSeries(\"value\") | formatByType(formattedConfig)`,\n },\n options: {\n [name]: '>frame(label, value) | prepend(formattedStatics) | objects()',\n },\n });\n }\n },\n [name, value, onChange]\n );\n\n const handleStaticItemChange = React.useCallback(\n (_event, _name, newItems) => {\n handleChange(newItems, dynamicItemsLabelField, dynamicItemsValueField);\n },\n [handleChange, dynamicItemsLabelField, dynamicItemsValueField]\n );\n\n const handleDynamicLabelFieldChange = React.useCallback(\n (_event, { value: newLabel }) => {\n if (dynamicItemsValueField === '') {\n // it is unecessary to update the definition until both label and value are set\n setLabel(newLabel);\n } else {\n handleChange(staticItems, newLabel, dynamicItemsValueField);\n }\n },\n [handleChange, staticItems, dynamicItemsValueField]\n );\n\n const handleDynamicValueFieldChange = React.useCallback(\n (_event, { value: newValue }) => {\n if (dynamicItemsLabelField === '') {\n // it is unecessary to update the definition until both label and value are set\n setValue(newValue);\n } else {\n handleChange(staticItems, dynamicItemsLabelField, newValue);\n }\n },\n [handleChange, staticItems, dynamicItemsLabelField]\n );\n\n const prepareDynamicFieldValue =\n (key: string) =>\n (config: DynamicOptionsConfig): Record<string, unknown> => {\n const fieldDsl = config?.options?.[key];\n if (typeof fieldDsl === 'string') {\n return { value: getFieldFromFieldNameDsl(fieldDsl) };\n }\n return { value: '' };\n };\n\n const usingAdvancedConfig = React.useMemo(\n () => isConfigAdvanced({ items: value, context }),\n [value, context]\n );\n if (usingAdvancedConfig) {\n return (\n <ControlGroup label={_(label)} labelPosition={labelPosition} labelWidth={labelWidth} help={help}>\n <Text key={value.toString()} data-test={name} disabled defaultValue={value.toString()} />\n </ControlGroup>\n );\n }\n\n const dataSourceConfigured = !!dataSourceBindings.primary;\n return (\n <>\n <StaticItemEditor\n name=\"\"\n label={_('Static menu configuration')}\n labelPosition={labelPosition}\n value={staticItems}\n onChange={handleStaticItemChange}\n validate={validate}\n />\n {dataSourceConfigured && (\n <ColumnLayout key=\"dynamic-item-editor-label-value-layout\" gutter={VERTICAL_EDITOR_SPACING}>\n <ColumnLayout.Row key=\"dynamic-item-editor-label-row\">\n <ColumnSelectionEditor\n name=\"label\"\n label={_('Dynamic menu label field')}\n dataSourceKey=\"primary\"\n dataSourceBindings={dataSourceBindings}\n value={`>primary | seriesByName(\"${dynamicItemsLabelField}\")`}\n context={context}\n onChange={handleDynamicLabelFieldChange}\n prepareValue={prepareDynamicFieldValue('label')}\n />\n </ColumnLayout.Row>\n <ColumnLayout.Row key=\"dynamic-item-editor-value-row\">\n <ColumnSelectionEditor\n name=\"value\"\n label={_('Dynamic menu value field')}\n dataSourceKey=\"primary\"\n dataSourceBindings={dataSourceBindings}\n value={`>primary | seriesByName(\"${dynamicItemsValueField}\")`}\n context={context}\n onChange={handleDynamicValueFieldChange}\n prepareValue={prepareDynamicFieldValue('value')}\n />\n </ColumnLayout.Row>\n </ColumnLayout>\n )}\n </>\n );\n};\n\nDynamicItemEditor.propTypes = {\n /**\n * Callback when changing the text value\n *\n * onChange function has the following properties\n * @param {SyntheticEvent} event The react `SyntheticEvent`\n * @param {String} name The option name\n * @param {StaticItem[]} 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.oneOfType([\n T.arrayOf(\n T.shape({\n label: T.string.isRequired,\n value: T.string.isRequired,\n }).isRequired\n ),\n T.string,\n ]),\n /**\n * Label position\n */\n labelPosition: T.oneOf(['top', 'left']),\n /**\n * Label width\n */\n labelWidth: T.number,\n /**\n * The context object\n */\n context: T.shape({\n label: T.string,\n value: T.string,\n statics: T.arrayOf(T.arrayOf(T.string.isRequired).isRequired),\n }).isRequired,\n /**\n * Primary data source binding\n */\n dataSourceBindings: T.shape({ primary: T.any }).isRequired,\n help: T.string,\n};\n\nexport default DynamicItemEditor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport {\n handleKeyDown,\n shortcuts,\n TextAreaCommandOrchestrator,\n commands,\n type ICommand,\n} from '@uiw/react-md-editor/nohighlight';\n\nimport Markdown from '@splunk/react-ui/Markdown';\nimport Message from '@splunk/react-ui/Message';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { createDOMID } from '@splunk/ui-utils/id';\nimport TextBBold from '@splunk/react-icons/TextBBold';\nimport Chain from '@splunk/react-icons/Chain';\nimport TextH from '@splunk/react-icons/TextH';\nimport TextIItalic from '@splunk/react-icons/TextIItalic';\nimport ChevronsSlash from '@splunk/react-icons/ChevronsSlash';\nimport Picture from '@splunk/react-icons/Picture';\nimport List from '@splunk/react-icons/List';\nimport ListNumbered from '@splunk/react-icons/ListNumbered';\nimport QuotationDouble from '@splunk/react-icons/QuotationDouble';\nimport Button from '@splunk/react-ui/Button';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport TextArea from '@splunk/react-ui/TextArea';\nimport ScreenReaderContent from '@splunk/react-ui/ScreenReaderContent';\nimport { variables } from '@splunk/themes';\nimport { useCSPViolationObserver } from '../hooks/useCSPViolationObserver';\nimport { CSPMessage } from '../shared/CSPMessage';\nimport { MessageContainer } from '../shared/MessageContainer';\n\nconst TOOLBAR_COMMANDS: ICommand[] = [\n {\n ...commands.heading3,\n icon: <TextH />,\n name: 'header',\n },\n {\n ...commands.bold,\n icon: <TextBBold />,\n name: 'bold',\n },\n {\n ...commands.italic,\n icon: <TextIItalic />,\n name: 'italic',\n },\n {\n ...commands.link,\n icon: <Chain />,\n name: 'link',\n },\n {\n ...commands.quote,\n icon: <QuotationDouble />,\n name: 'quote',\n },\n {\n ...commands.code,\n icon: <ChevronsSlash />,\n name: 'code',\n },\n {\n ...commands.image,\n icon: <Picture />,\n name: 'image',\n },\n {\n ...commands.unorderedListCommand,\n icon: <List />,\n name: 'unordered-list',\n },\n {\n ...commands.orderedListCommand,\n icon: <ListNumbered />,\n name: 'ordered-list',\n },\n];\n\nconst EditorContainer = styled.div`\n font-family: ${variables.sansFontFamily};\n`;\n\nconst Toolbar = styled.div`\n display: flex;\n padding: 12px 0;\n justify-content: space-between;\n`;\n\nconst StyledTextArea = styled(TextArea)`\n [data-test='textbox'] {\n resize: vertical;\n }\n`;\n\nconst HiddenPreview = styled.div`\n display: none;\n`;\n\nconst ToolbarButtonStyled = styled(Button)`\n flex: 0;\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\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\ninterface ToolbarButtonProps {\n command: ICommand;\n isFocusable: boolean;\n onFocus: (name: string) => void;\n onExecute: (command: ICommand) => void;\n}\n\nconst ToolbarButton: React.FC<ToolbarButtonProps> = React.memo(\n ({ command, isFocusable, onFocus, onExecute }) => {\n const { icon, buttonProps } = command;\n const { title } = buttonProps || {};\n\n return (\n <Tooltip\n content={title || ''}\n contentRelationship=\"label\"\n renderAnchor={({\n onFocus: tooltipAnchorOnFocus,\n onClick: tooltipAnchorOnClick,\n ...anchorProps\n }) => (\n <ToolbarButtonStyled\n appearance=\"subtle\"\n data-name={command.name}\n onFocus={event => {\n tooltipAnchorOnFocus(event);\n onFocus(command.name || '');\n }}\n tabIndex={isFocusable ? 0 : -1}\n onClick={event => {\n tooltipAnchorOnClick(event);\n onExecute(command);\n }}\n {...anchorProps}\n >\n {icon}\n </ToolbarButtonStyled>\n )}\n />\n );\n }\n);\n\nToolbarButton.displayName = 'ToolbarButton';\n\nToolbarButton.propTypes = {\n command: T.object.isRequired,\n isFocusable: T.bool.isRequired,\n onFocus: T.func.isRequired,\n onExecute: T.func.isRequired,\n};\n\ninterface MarkdownEditorProps {\n onChange: (event: any, name: string, value: string) => void;\n name: string;\n value?: string;\n defaultErrors?: ErrorState;\n}\n\nconst MarkdownEditor: React.FC<MarkdownEditorProps> = ({\n onChange,\n name,\n value = '',\n defaultErrors = {},\n}) => {\n const instanceId = React.useMemo(() => createDOMID('markdown-editor'), []);\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const [val, setValueState] = React.useState(value);\n const [focusableCommand, setFocusableCommand] = React.useState<string>(TOOLBAR_COMMANDS[0].name || '');\n const orchestratorRef = React.useRef<TextAreaCommandOrchestrator | null>(null);\n const [errors, setErrors] = React.useState<ErrorState>(defaultErrors);\n\n // Initialize command orchestrator when textarea is available\n React.useEffect(() => {\n if (textareaRef.current && !orchestratorRef.current) {\n orchestratorRef.current = new TextAreaCommandOrchestrator(textareaRef.current);\n }\n\n return () => {\n orchestratorRef.current = null;\n };\n }, []);\n\n const handleValueChange = React.useCallback(\n (\n _event: React.ChangeEvent<HTMLTextAreaElement> | React.MouseEvent<HTMLSpanElement>,\n { value: newValue }: { value: string }\n ) => {\n setValueState(newValue);\n },\n []\n );\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent<HTMLTextAreaElement>) => {\n if (val !== value) {\n onChange(event, name, val);\n setErrors(defaultErrors);\n }\n },\n [val, value, onChange, name, defaultErrors]\n );\n\n const executeCommand = React.useCallback((command: ICommand) => {\n if (orchestratorRef.current && textareaRef.current) {\n orchestratorRef.current.executeCommand(command);\n setValueState(textareaRef.current.value);\n }\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 const handleToolbarKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n const item = e.target as HTMLElement;\n if (item.tagName !== 'BUTTON') return;\n\n const toolbar = e.currentTarget;\n const buttons = Array.from(toolbar.querySelectorAll<HTMLElement>('button'));\n const currentIndex = buttons.indexOf(item);\n\n if (currentIndex === -1) return;\n\n const prevPressed = e.key === 'ArrowLeft';\n const nextPressed = e.key === 'ArrowRight';\n const firstPressed = e.key === 'Home';\n const lastPressed = e.key === 'End';\n\n let newFocus: HTMLElement | null = null;\n if (prevPressed) {\n // Wrap to last button if at first\n newFocus = buttons[currentIndex - 1] ?? buttons[buttons.length - 1];\n } else if (nextPressed) {\n // Wrap to first button if at last\n newFocus = buttons[currentIndex + 1] ?? buttons[0];\n } else if (firstPressed) {\n [newFocus] = buttons;\n } else if (lastPressed) {\n newFocus = buttons[buttons.length - 1];\n }\n\n if (newFocus) {\n e.preventDefault();\n newFocus.focus();\n }\n }, []);\n\n const handleTextareaKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // Handle tab key and newlines\n handleKeyDown(e, 2, true); // tab size 2, allow default tab to exit the textarea\n\n // Handle markdown keyboard shortcuts\n if (orchestratorRef.current) {\n shortcuts(e, TOOLBAR_COMMANDS, orchestratorRef.current);\n // Update value after command execution\n if (textareaRef.current) {\n setValueState(textareaRef.current.value);\n }\n }\n }, []);\n\n return (\n <EditorContainer data-test={name}>\n <Toolbar\n role=\"toolbar\"\n aria-label={_('Markdown formatting')}\n aria-orientation=\"horizontal\"\n aria-controls={`${instanceId}-textarea`}\n onKeyDown={handleToolbarKeyDown}\n >\n {TOOLBAR_COMMANDS.map(command => (\n <ToolbarButton\n key={command.name}\n command={command}\n isFocusable={focusableCommand === command.name}\n onFocus={setFocusableCommand}\n onExecute={executeCommand}\n />\n ))}\n </Toolbar>\n <ScreenReaderContent id={`${instanceId}-textarea-label`}>\n {_('Markdown editor')}\n </ScreenReaderContent>\n <StyledTextArea\n inputRef={textareaRef}\n data-test={`${name}-textarea`}\n id={`${instanceId}-textarea`}\n labelledBy={`${instanceId}-textarea-label`}\n value={val}\n onChange={handleValueChange}\n onBlur={handleBlur}\n onKeyDown={handleTextareaKeyDown}\n />\n {hiddenMarkdownPreview}\n {errorMessage && <MessageContainer>{errorMessage}</MessageContainer>}\n </EditorContainer>\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 * Initial error state for CSP violations and image loading\n */\n defaultErrors: T.objectOf(T.oneOf(['warning', 'error', 'other'])),\n};\n\nexport default MarkdownEditor;\n","import React, { useState, useRef, useEffect, useCallback, useMemo } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { noop } from 'lodash';\nimport variables from '@splunk/themes/variables';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport FormRows from '@splunk/react-ui/FormRows';\nimport { createDOMID } from '@splunk/ui-utils/id';\nimport Button from '@splunk/react-ui/Button';\nimport type { PopoverRequestCloseHandler } from '@splunk/react-ui/Popover';\nimport Popover from '@splunk/react-ui/Popover';\nimport { VIZ_CATEGORICAL } from '@splunk/visualization-color-palettes';\nimport { BaseEditorPropTypes } from '../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport ColorEditor from './ColorEditor';\n\nconst popoverStyle = { padding: '10px' };\nconst colorButtonStyle = { width: '314px' };\n\nconst StyledButton = styled(Button)`\n padding: 8px;\n width: 100%;\n min-height: 40px;\n & > span {\n display: grid;\n grid-template-columns: repeat(auto-fill, 26px);\n justify-content: space-evenly;\n grid-gap: 4px;\n }\n background-color: ${variables.interactiveColorBackground};\n`;\n\nconst ColorChip = styled.div`\n width: 26px;\n height: 24px;\n background-color: ${(props): string => props.color};\n border-radius: 2px;\n border: 1px solid ${variables.neutral100};\n`;\n\nconst StyledFlyoutContent = styled.div`\n box-sizing: border-box;\n padding: 8px;\n width: 312px;\n max-height: 484px;\n background-color: ${variables.backgroundColorPopup};\n`;\n\nconst FlyoutHeader = styled.div`\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n padding: 8px 8px 0 8px;\n font-family: ${variables.fontFamily};\n color: ${variables.contentColorActive};\n`;\n\nconst ColorListEditor = styled.div`\n height: 412px;\n overflow-y: auto;\n padding: 8px 10px;\n`;\n\nexport interface ColorFlyoutEditorProps {\n colors: string[];\n handleColorRemove: (_e, { index }: { index: number }) => void;\n handleColorChange: (idx: number) => (_evt, name: string, value: string) => void;\n CustomColorMatchEditor?: (props: { index: number }) => React.ReactNode;\n flyoutTitle: string;\n addColorButtonLabel: string;\n handleColorAdd: () => void;\n handleColorMove: (data: { fromIndex: number; toIndex: number }) => void;\n}\n\nexport const ColorFlyoutEditor = ({\n colors,\n CustomColorMatchEditor,\n handleColorRemove,\n handleColorChange,\n flyoutTitle,\n addColorButtonLabel,\n handleColorAdd,\n handleColorMove,\n}: ColorFlyoutEditorProps) => {\n const ColorRowItems = useMemo(() => {\n return colors.map((color, idx) => {\n // disable the color editor's text input when a custom input editor is available to render adjacently\n const showTextInput = CustomColorMatchEditor == null;\n return (\n <FormRows.Row\n index={idx}\n key={createDOMID()}\n data-color={color}\n onRequestRemove={handleColorRemove}\n >\n <div style={{ display: 'flex', justifyContent: 'space-between' }}>\n <ColorEditor\n value={color}\n key={createDOMID()}\n onChange={handleColorChange(idx)}\n hideLabel\n label=\" \"\n name=\"color\"\n style={{ marginBottom: 0, marginTop: 0, width: showTextInput ? '100%' : 32 }}\n showTextInput={showTextInput}\n />\n {typeof CustomColorMatchEditor === 'function' && (\n <CustomColorMatchEditor index={idx} />\n )}\n </div>\n </FormRows.Row>\n );\n });\n }, [colors, CustomColorMatchEditor, handleColorRemove, handleColorChange]);\n\n return (\n <StyledFlyoutContent data-test=\"MultiColorPickerFlyoutContent\">\n <FlyoutHeader data-test=\"MultiColorPickerFlyoutTitle\">{flyoutTitle}</FlyoutHeader>\n <ColorListEditor>\n <FormRows\n addLabel={addColorButtonLabel}\n onRequestAdd={handleColorAdd}\n onRequestMove={handleColorMove}\n data-test=\"ColorListEditor\"\n >\n {ColorRowItems}\n </FormRows>\n </ColorListEditor>\n </StyledFlyoutContent>\n );\n};\n\nexport interface MultiColorPickerEditorProps extends BaseEditorProps {\n CustomColorMatchEditor?: (props: { index: number }) => React.ReactNode;\n canReorderColors?: boolean;\n value: string[];\n flyoutTitle?: string;\n addColorButtonLabel?: string;\n hideLabel?: boolean;\n canAddNewColors?: boolean;\n}\n\nconst MultiColorPickerEditor: React.FunctionComponent<MultiColorPickerEditorProps> = ({\n CustomColorMatchEditor,\n onChange = noop,\n canReorderColors = true,\n value: vizColors = VIZ_CATEGORICAL,\n flyoutTitle = _('Customize colors'),\n addColorButtonLabel = _('Add color'),\n name = 'seriesColors',\n label = '',\n labelPosition = 'top',\n labelWidth,\n isDisabled = false,\n hideLabel = true,\n canAddNewColors = true,\n}) => {\n const [showFlyout, setShowFlyout] = useState(false);\n const [colors, setColors] = useState(vizColors);\n const buttonRef = useRef(null);\n\n useEffect(() => {\n setColors(vizColors);\n }, [vizColors]);\n\n // callbacks to add, remove, update and reorder a color form row\n const handleColorAdd = useCallback(() => {\n const userColorsSet = new Set(colors);\n let nextColor = VIZ_CATEGORICAL.find(color => !userColorsSet.has(color));\n if (!nextColor) {\n // All picked, count appearances\n const countMap = new Map<string, number>();\n VIZ_CATEGORICAL.forEach(color => countMap.set(color, 0));\n colors.forEach(color => {\n countMap.set(color, (countMap.get(color) || 0) + 1);\n });\n // Find color with minimum appearances\n let minCount = Infinity;\n VIZ_CATEGORICAL.forEach(color => {\n const count = countMap.get(color) || 0;\n if (count < minCount) {\n minCount = count;\n nextColor = color;\n }\n });\n }\n onChange(null, name, [...colors, nextColor]);\n }, [name, onChange, colors]);\n\n const handleColorChange = useCallback(\n idx => (_evt, _name, value) => {\n const colorsCopy = [...colors];\n colorsCopy.splice(idx, 1, value);\n onChange(null, name, colorsCopy);\n },\n [name, onChange, colors]\n );\n\n const handleColorRemove = useCallback(\n (e, { index }) => {\n const colorsCopy = [...colors];\n colorsCopy.splice(index, 1);\n onChange(null, name, colorsCopy);\n },\n [name, onChange, colors]\n );\n\n const handleColorMove = useCallback(\n ({ fromIndex, toIndex }) => {\n const colorsCopy = [...colors];\n const movedColor = colorsCopy[fromIndex];\n colorsCopy.splice(fromIndex, 1); // first, delete the color at the original position\n colorsCopy.splice(toIndex, 0, movedColor); // then reinsert it at the new position\n onChange(null, name, colorsCopy);\n },\n [name, onChange, colors]\n );\n\n /**\n * custom logic is required for closing the flyout as the FormRows component is rendered inside a Popover, and\n * when we sort the form rows, the popover closes mid-sorting (closeReason=\"clickAway\") as the dragged element is\n * taken out of the flow. Current workaround is to check if the event's source element has a sortable handle,\n * if yes, the flyout is kept open.\n *\n * Additionally, focus is returned to the trigger button when exiting through escape key press\n */\n const handleFlyoutClose: PopoverRequestCloseHandler = useCallback(({ event, reason }) => {\n // @ts-ignore\n if (!event?.srcElement?.sortableHandle) {\n setShowFlyout(false);\n }\n if (reason === 'escapeKey') {\n buttonRef.current.focus();\n }\n }, []);\n\n const ColorChips = useMemo(\n () => colors.map(color => <ColorChip color={color} key={createDOMID()} />),\n [colors]\n );\n\n const toggleShowFlyout = useCallback(() => {\n setShowFlyout(isShown => !isShown);\n }, []);\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n hideLabel={hideLabel}\n data-test=\"MultiColorPickerEditor\"\n >\n <StyledButton\n inline={false}\n data-test=\"MultiColorPickerButton\"\n appearance=\"default\"\n ref={buttonRef}\n onClick={toggleShowFlyout}\n disabled={isDisabled}\n style={colorButtonStyle}\n >\n {ColorChips}\n </StyledButton>\n <Popover\n data-test=\"MultiColorPickerFlyout\"\n open={showFlyout}\n anchor={buttonRef.current}\n defaultPlacement=\"horizontal\"\n style={popoverStyle}\n onRequestClose={handleFlyoutClose}\n takeFocus\n >\n <ColorFlyoutEditor\n colors={colors}\n CustomColorMatchEditor={CustomColorMatchEditor}\n handleColorRemove={handleColorRemove}\n handleColorChange={handleColorChange}\n handleColorAdd={canAddNewColors ? handleColorAdd : undefined}\n handleColorMove={canReorderColors ? handleColorMove : undefined}\n flyoutTitle={flyoutTitle}\n addColorButtonLabel={addColorButtonLabel}\n />\n </Popover>\n </ControlGroup>\n );\n};\n\nMultiColorPickerEditor.propTypes = {\n ...BaseEditorPropTypes,\n /**\n * Colors can be reordered manually\n */\n canReorderColors: T.bool,\n /**\n * Can add a new color\n */\n canAddNewColors: T.bool,\n /**\n * List of colors\n */\n value: T.arrayOf(T.string),\n /**\n * Title of the flyout editor\n */\n flyoutTitle: T.string,\n /**\n * Button label for adding a new color row\n */\n addColorButtonLabel: T.string,\n /**\n * Custom input editor for mapping a value to color, eg: dropdown for field -> color\n */\n CustomColorMatchEditor: T.func,\n /**\n * Flag to hide the editor label\n */\n hideLabel: T.bool,\n};\n\nexport default MultiColorPickerEditor;\n","import * as React from 'react';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ColumnLayout from '@splunk/react-ui/ColumnLayout';\nimport type { OptionsStanza, Option as VisualizationOption } from '@splunk/visualization-encoding/AST';\nimport type { UiConfig, FormatterUiConfig } from './formatters/FormatterEditor';\nimport { DynamicColorEditor } from './DynamicColorEditor';\nimport SelectEditor from './SelectEditor';\nimport ColorEditor from './ColorEditor';\n\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport type { PalettesConfig } from '../interfaces/PalettesConfig';\nimport type { DynamicOptionsConfig } from '../types';\n\ntype Options = Record<string, VisualizationOption | null | undefined>;\n\nexport interface NetworkGraphDynamicColorEditorProps extends BaseEditorProps {\n name: string;\n value: string;\n contextName: string;\n flyoutTitle?: string;\n dataSelectors?: UiConfig[];\n formatters?: FormatterUiConfig[];\n defaultPalettesConfig: PalettesConfig;\n tooltip?: string;\n options?: Options;\n onChange: (event: React.SyntheticEvent | null, updatedConfig: DynamicOptionsConfig) => void;\n}\n\nconst TOTAL_COLUMN_SPAN = 12;\nconst COLOR_COLUMN_SPAN = TOTAL_COLUMN_SPAN / 2;\n\nexport const NetworkGraphDynamicColorEditor: React.FC<NetworkGraphDynamicColorEditorProps> = ({\n name,\n value,\n contextName,\n label = '',\n labelWidth,\n context,\n flyoutTitle = _('Dynamic coloring'),\n formatters = [],\n dataSelectors = [],\n defaultPalettesConfig,\n tooltip,\n options = {},\n onChange = () => undefined,\n}) => {\n const dataSelector = dataSelectors[0]?.value;\n\n const getCurrentColoringType = React.useCallback((optionValue: string) => {\n // if option is undefined, the default is static coloring\n if (!optionValue || optionValue.trim().startsWith('#')) return 'static';\n\n return 'dynamic';\n }, []);\n\n const [coloringType, setColoringType] = React.useState(getCurrentColoringType(value));\n const selectColumnSpan = TOTAL_COLUMN_SPAN - COLOR_COLUMN_SPAN;\n\n // Change coloring type if value changes in source code\n React.useEffect(() => {\n const newColoringType = getCurrentColoringType(value);\n setColoringType(newColoringType);\n }, [getCurrentColoringType, value]);\n\n const handleSelectChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, selectedName, selectedValue) => {\n setColoringType(selectedValue);\n\n const updatedOptions: Options = {\n ...options,\n };\n const updatedContext: Record<string, any> = { ...context };\n\n if (selectedValue === 'dynamic') {\n const defaultFormatter = formatters[0]?.value || 'gradient';\n const defaultConfig = formatters[0]?.defaults?.[dataSelector] || {};\n\n const dsl = `> ${dataSelector} | ${defaultFormatter}(${contextName})`;\n updatedOptions[name] = dsl;\n updatedContext[contextName] = defaultConfig;\n\n onChange(event, { options: updatedOptions, context: updatedContext });\n } else if (selectedValue === 'static') {\n updatedOptions[name] = undefined;\n updatedContext[contextName] = undefined;\n onChange(event, { options: updatedOptions, context: updatedContext });\n }\n },\n [options, context, formatters, dataSelector, contextName, name, onChange]\n );\n\n const handleDynamicColorEditorChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, optionStanza: OptionsStanza) => {\n const dsl = optionStanza.options[name];\n const config = optionStanza.context?.[contextName];\n const updatedOptions: Options = { ...options, [name]: dsl };\n\n const updatedContext = { ...context, [contextName]: config };\n onChange(event, { options: updatedOptions, context: updatedContext });\n },\n [options, name, context, onChange, contextName]\n );\n\n const handleStaticColorChange = React.useCallback(\n (event, optionName: string, color: string) => {\n const updatedOptions: Options = { ...options, [optionName]: color };\n const updatedContext = { ...context };\n updatedContext[contextName] = undefined;\n\n onChange(event, { options: updatedOptions, context: updatedContext });\n },\n [context, onChange, options, contextName]\n );\n\n return (\n <ColumnLayout data-test=\"dynamic-color-toggle\" gutter={15}>\n <ColumnLayout.Row data-test=\"network-graph-dynamic-color-row\" alignItems=\"start\">\n <ColumnLayout.Column span={selectColumnSpan}>\n <SelectEditor\n name={name}\n label={_(label)}\n labelPosition=\"top\"\n value={coloringType}\n onChange={handleSelectChange}\n itemSchema={{ type: 'string' }}\n values={[\n { label: _('Static coloring'), value: 'static' },\n {\n label: _('Dynamic coloring'),\n value: 'dynamic',\n },\n ]}\n help={tooltip}\n />\n </ColumnLayout.Column>\n {coloringType === 'dynamic' && (\n <ColumnLayout.Column span={COLOR_COLUMN_SPAN}>\n <DynamicColorEditor\n name={name}\n label={' '}\n labelPosition=\"top\"\n labelWidth={labelWidth}\n value={value}\n context={context}\n onChange={handleDynamicColorEditorChange}\n flyoutTitle={flyoutTitle}\n formatters={formatters}\n dataSelectors={dataSelectors}\n defaultPalettesConfig={defaultPalettesConfig}\n />\n </ColumnLayout.Column>\n )}\n {coloringType === 'static' && (\n <ColumnLayout.Column span={COLOR_COLUMN_SPAN}>\n <ColorEditor\n name={name}\n label={' '}\n labelPosition=\"top\"\n labelWidth={labelWidth}\n value={value}\n onChange={handleStaticColorChange}\n />\n </ColumnLayout.Column>\n )}\n </ColumnLayout.Row>\n </ColumnLayout>\n );\n};\n","import React, { useEffect, useRef } from 'react';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\nimport Button from '@splunk/react-ui/Button';\nimport Popover from '@splunk/react-ui/Popover';\nimport PresetIcons from '@splunk/visualization-icons/PresetIcons';\nimport { mixins } from '@splunk/themes';\nimport Header from '../shared/Header';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\n\nconst StyledHeader = styled(Header)`\n background-color: ${variables.backgroundColorPopup};\n`;\n\nconst PresetHeaderLabel = styled.span`\n font-weight: 500;\n font-size: 13px;\n margin-bottom: 7px;\n background-color: ${variables.backgroundColorPopup};\n`;\n\nconst PresetList = styled.ul`\n ${mixins.reset('block')};\n`;\n\nconst PresetListItem = styled.li`\n list-style: none;\n`;\n\nconst PresetOption = styled.button<{ selected: boolean }>`\n background-color: ${({ selected }) =>\n selected ? variables.interactiveColorOverlaySelected : variables.backgroundColorPopup};\n border: none;\n display: flex;\n padding: 7px 60px 7px 15px;\n position: relative;\n width: 100%;\n &:hover {\n cursor: pointer;\n background-color: ${variables.interactiveColorOverlayHover};\n }\n &:focus {\n box-shadow: ${variables.focusShadow};\n outline: none;\n z-index: 3;\n }\n`;\n\nconst PresetIconWrapper = styled.div`\n margin-right: 10px;\n &:hover {\n cursor: pointer;\n }\n`;\n\nconst PresetLabelWrapper = styled.div`\n align-items: center;\n display: flex;\n`;\n\nconst PresetLabel = styled.span`\n font-size: 13px;\n font-weight: normal;\n`;\n\ninterface PresetEntry {\n name: string;\n value: unknown;\n label: string;\n}\n\n// PresetSelectorEditorProps diverges from BaseEditorProps marking the value prop as optional.\n// If a base interface requires a property an extending interface cannot override it to be optional.\nexport interface PresetSelectorEditorProps extends Omit<BaseEditorProps, 'value'> {\n animation?: boolean;\n onChange: (e: React.MouseEvent<HTMLButtonElement>, val: unknown) => void;\n presets: PresetEntry[];\n label: string;\n value?: string;\n}\n\ninterface PresetOptionWrapperProps {\n presetName: string;\n presetLabel: string;\n presetValue: unknown;\n selectedPreset: string;\n onPopoverClick: (\n e: React.MouseEvent<HTMLButtonElement>,\n presetLabel: string,\n presetValue: unknown\n ) => void;\n open: boolean;\n}\n\nconst PresetOptionWrapper = ({\n presetName,\n presetLabel,\n presetValue,\n selectedPreset,\n onPopoverClick,\n open,\n}: PresetOptionWrapperProps) => {\n const ref = useRef<HTMLButtonElement | null>();\n const PresetIcon = PresetIcons[presetName];\n const handlePopoverClick = React.useCallback(\n e => {\n onPopoverClick(e, presetLabel, presetValue);\n },\n [onPopoverClick, presetLabel, presetValue]\n );\n\n useEffect(() => {\n if (open && presetLabel === selectedPreset) {\n ref.current?.focus();\n }\n }, [open, presetLabel, selectedPreset]);\n\n return (\n <PresetListItem key={presetLabel}>\n <PresetOption\n data-test={`flyout-preset-option-${presetLabel}`}\n selected={presetLabel === selectedPreset}\n onClick={handlePopoverClick}\n ref={ref}\n >\n <PresetIconWrapper>\n {PresetIcon && <PresetIcon data-test={`icon-label-${presetLabel}`} />}\n </PresetIconWrapper>\n <PresetLabelWrapper>\n <PresetLabel>{presetLabel}</PresetLabel>\n </PresetLabelWrapper>\n </PresetOption>\n </PresetListItem>\n );\n};\n\nconst PresetSelectorEditor = ({\n animation = true, // allow for disabling for unit testing purposes\n labelPosition = 'top',\n onChange,\n label,\n labelWidth,\n presets,\n value,\n}: PresetSelectorEditorProps) => {\n const [isFlyoutOpen, setIsFlyoutOpen] = React.useState(false);\n // todo: design input on info state for custom context\n const [selectedPreset, setSelectedPreset] = React.useState(value || 'Select...');\n const [anchor, setAnchor] = React.useState<HTMLButtonElement>();\n const anchorRef = React.useCallback(el => setAnchor(el), []);\n\n const handleButtonClick = React.useCallback(() => setIsFlyoutOpen(prevState => !prevState), []);\n\n const handleRequestClose = React.useCallback(\n ({ event, reason }) => {\n if (event && reason === 'clickAway') {\n let el = event.target;\n\n while (el) {\n if (el === anchor || typeof el?.parentNode === 'undefined') {\n return;\n }\n el = el.parentNode;\n }\n }\n setIsFlyoutOpen(false);\n anchor.focus();\n },\n [anchor]\n );\n\n const onPopoverClick = React.useCallback(\n (e, presetLabel, presetValue) => {\n setSelectedPreset(presetLabel);\n onChange(e, presetValue);\n setIsFlyoutOpen(false);\n anchor.focus();\n },\n [anchor, onChange]\n );\n const popoverId = `preset-editor-flyout-${label.replace(' ', '-')}`;\n\n return (\n <>\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth}>\n <Button\n data-test=\"preset-selector-button\"\n label={selectedPreset}\n isMenu\n elementRef={anchorRef}\n onClick={handleButtonClick}\n aria-label={`${label}, ${selectedPreset}`}\n aria-expanded={isFlyoutOpen}\n aria-controls={popoverId}\n />\n </ControlGroup>\n <Popover\n id={popoverId}\n animation={animation}\n data-test=\"preset-editor-flyout\"\n open={isFlyoutOpen}\n anchor={anchor}\n appearance=\"normal\"\n defaultPlacement=\"horizontal\"\n onRequestClose={handleRequestClose}\n role=\"dialog\"\n >\n <StyledHeader data-test=\"flyout-header\">\n <PresetHeaderLabel data-test=\"preset-selector-flyout-label\">{label}</PresetHeaderLabel>\n </StyledHeader>\n <PresetList>\n {presets.map(v => (\n <PresetOptionWrapper\n key={v.label}\n presetName={v.name}\n presetLabel={v.label}\n presetValue={v.value}\n selectedPreset={selectedPreset}\n onPopoverClick={onPopoverClick}\n open={isFlyoutOpen}\n />\n ))}\n </PresetList>\n </Popover>\n </>\n );\n};\n\nexport default PresetSelectorEditor;\n","import React, { useState, useCallback, useEffect, useMemo } from 'react';\nimport * as T from 'prop-types';\nimport { isEmpty } from 'lodash';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { createDOMID } from '@splunk/ui-utils/id';\nimport Select from '@splunk/react-ui/Select';\nimport { Options } from '@splunk/visualization-encoding/Options';\nimport EncodingParser from '@splunk/visualization-encoding/EncodingParser';\nimport { getDataSourceStateInfo } from '@splunk/visualizations-shared/dataSourceUtils';\nimport MultiColorPickerEditor from './MultiColorPickerEditor';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { BaseEditorPropTypes } from '../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport { useDataSource } from '../hooks/useDataSource';\n\ntype ObjS = Record<string, string>;\ninterface FieldEditorProps {\n fields: string[];\n dsFields: string[];\n handleFieldChange: (args: { newFieldIndex: number; currFieldIndex: number }) => void;\n}\n\nconst FieldEditor = ({\n fields,\n dsFields,\n handleFieldChange,\n}: FieldEditorProps): (({ index }: { index: number }) => JSX.Element) => {\n const FieldSelector = ({ index }) => {\n const SelectOptions = useMemo(\n () =>\n dsFields.map((dsField, idx) => (\n <Select.Option\n label={dsField}\n value={idx}\n key={createDOMID()}\n data-test={`${dsField}-${index}`}\n />\n )),\n [index]\n );\n\n const handleChange = useCallback(\n (e, { value: newFieldIndex }): void => {\n handleFieldChange({ newFieldIndex, currFieldIndex: index });\n },\n [index]\n );\n\n const selectedField = dsFields.indexOf(fields[index]);\n\n return (\n <Select\n value={selectedField}\n onChange={handleChange}\n style={{ width: 190 }}\n data-test=\"field-select\"\n >\n {SelectOptions}\n </Select>\n );\n };\n FieldSelector.propTypes = {\n index: T.number,\n };\n return FieldSelector;\n};\n\nexport type SeriesColorsByFieldEditorProps = BaseEditorProps & { isCategorical?: boolean };\n\nconst defaultValue = {} as SeriesColorsByFieldEditorProps['value'];\nconst defaultOptions = {} as SeriesColorsByFieldEditorProps['options'];\nconst defaultOptionsSchema = {} as SeriesColorsByFieldEditorProps['optionsSchema'];\n\nconst SeriesColorsByFieldEditor = ({\n name,\n value = defaultValue,\n dataSourceBindings,\n onChange,\n options = defaultOptions,\n isCategorical = false,\n context,\n optionsSchema = defaultOptionsSchema,\n}: SeriesColorsByFieldEditorProps) => {\n const [colors, setColors] = useState<string[]>(Object.values(value));\n const [fields, setFields] = useState<string[]>(Object.keys(value));\n\n useEffect(() => {\n setColors(Object.values(value));\n setFields(Object.keys(value));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [JSON.stringify(value)]);\n\n // fetch the dataSource fields\n const dataSource = useDataSource({ dataSourceBindings, dataSourceKey: 'primary' });\n const { isLoading } = useMemo(() => getDataSourceStateInfo(dataSource), [dataSource]);\n\n // for bubble and scatter, we fallback on the 'category' option default in case it's not user defined\n const { category = optionsSchema?.category?.default } = options ?? {};\n\n const dsFields = useMemo(() => {\n if (isCategorical) {\n if (!category) {\n return [];\n }\n\n if (Array.isArray(category)) {\n return [...new Set(category.map(val => val?.toString()).filter(val => !isEmpty(val)))];\n }\n\n if (!isLoading && EncodingParser.isDslString(category)) {\n const results = Options.evaluate(\n { context, options: { ...options, category } },\n { primary: dataSource }\n );\n if (Array.isArray(results.category)) {\n return [\n ...new Set(results.category.map(val => val?.toString()).filter(val => !isEmpty(val))),\n ];\n }\n }\n\n return [];\n }\n return dataSource?.data?.fields.map(val => val.name) ?? [];\n }, [context, dataSource, isCategorical, options, category, isLoading]);\n\n const { editorLabel, flyoutTitle, addColorButtonLabel } = useMemo(\n () =>\n isCategorical\n ? {\n editorLabel: _('Series colors by category name'),\n flyoutTitle: _('Color by category name'),\n addColorButtonLabel: _('Add category'),\n }\n : {\n editorLabel: _('Series colors by field name'),\n flyoutTitle: _('Color by field name'),\n addColorButtonLabel: _('Add field'),\n },\n [isCategorical]\n );\n\n // create the mapping of fields -> colors\n const getUpdatedValue = ({ updatedColors, updatedFields }) => {\n const updatedValue: ObjS = {};\n updatedFields.forEach((field, idx) => {\n updatedValue[field] = updatedColors[idx];\n });\n return updatedValue;\n };\n\n const handleColorChange = useCallback(\n (_evt: null, _name: string, updatedColors: string[]): void => {\n // don't allow the user to add a new field row if all fields are mapped to a color\n if (updatedColors.length > dsFields.length) {\n return;\n }\n\n const updatedFields = fields;\n\n // new field row has been added\n if (updatedColors.length > colors.length) {\n const newField = dsFields.find(dsField => !fields.includes(dsField));\n updatedFields.push(newField);\n }\n\n // if a field row is removed, remove the field entry associated with that row\n if (updatedColors.length < colors.length) {\n const delRowIndex = colors.findIndex(color => !updatedColors.includes(color));\n updatedFields.splice(delRowIndex, 1);\n }\n\n onChange(null, name, getUpdatedValue({ updatedColors, updatedFields }));\n },\n [dsFields, onChange, name, fields, colors]\n );\n\n const handleFieldChange = useCallback(\n ({ newFieldIndex, currFieldIndex }: { newFieldIndex: number; currFieldIndex: number }): void => {\n // find if the selected field has already been set in a different field row\n const doesFieldExist = fields.includes(dsFields[newFieldIndex]);\n\n const updatedFields = fields;\n\n // fields have to be swapped\n if (doesFieldExist) {\n const existingFieldIndex = fields.indexOf(dsFields[newFieldIndex]);\n const currField = fields[currFieldIndex];\n updatedFields[currFieldIndex] = fields[existingFieldIndex];\n updatedFields[existingFieldIndex] = currField;\n } else {\n updatedFields[currFieldIndex] = dsFields[newFieldIndex]; // a new field has been selected and we don't need to swap fields\n }\n\n onChange(null, name, getUpdatedValue({ updatedColors: colors, updatedFields }));\n },\n [fields, dsFields, colors, name, onChange]\n );\n\n const CustomColorMatchEditor = useMemo(\n () => FieldEditor({ fields, dsFields, handleFieldChange }),\n [dsFields, fields, handleFieldChange]\n );\n\n return (\n <ControlGroup label={editorLabel} labelPosition=\"top\" data-test=\"SeriesColorsByFieldEditor\">\n <MultiColorPickerEditor\n value={colors}\n onChange={handleColorChange}\n name=\"series\"\n canReorderColors={false}\n flyoutTitle={flyoutTitle}\n addColorButtonLabel={addColorButtonLabel}\n CustomColorMatchEditor={CustomColorMatchEditor}\n isDisabled={dsFields.length < 1}\n canAddNewColors={fields.length < dsFields.length}\n />\n </ControlGroup>\n );\n};\n\nSeriesColorsByFieldEditor.propTypes = { ...BaseEditorPropTypes, isCategorical: T.bool };\n\nexport default SeriesColorsByFieldEditor;\n","import React, { useState, useCallback, useMemo } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { isEqual } from 'lodash';\nimport Button from '@splunk/react-ui/Button';\nimport ColumnLayout from '@splunk/react-ui/ColumnLayout';\nimport Dropdown from '@splunk/react-ui/Dropdown';\nimport Menu from '@splunk/react-ui/Menu';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { VIZ_CATEGORICAL } from '@splunk/visualization-color-palettes';\nimport MultiColorPickerEditor from './MultiColorPickerEditor';\nimport { ColorPreview } from './formatters/ColorPreview';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport PreviewWrapper from '../shared/PreviewWrapper';\nimport { VERTICAL_EDITOR_SPACING, DROPDOWN_MENU_WIDTH } from '../shared/dimensionConstants';\nimport { BaseEditorPropTypes } from '../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\n\nconst MAX_PREVIEW_COLOR_COUNT = 8;\n\n// to add more warm/cold... palettes\nexport type PaletteType = 'default' | 'custom';\n\nexport interface PaletteDefinition<P extends PaletteType = PaletteType> {\n id: P;\n name: string;\n palette: string[];\n}\n\ntype Palettes = {\n [P in PaletteType]: PaletteDefinition<P>;\n};\n\nexport const PALETTES = {\n default: { id: 'default', name: _('Default'), palette: VIZ_CATEGORICAL },\n custom: { id: 'custom', name: _('Custom'), palette: [] },\n} satisfies Palettes;\n\nconst NameWrapper = styled.div`\n width: 120px;\n margin-right: 20px;\n display: flex;\n`;\n\nconst PaletteWrapper = styled(PreviewWrapper)`\n display: flex;\n align-items: center;\n`;\n\nconst ColorPreviewWrapper = styled.div`\n flex: 1 0 1px;\n height: 100%;\n`;\n\nconst SeriesColorsEditor = ({ label, value, name, onChange }: BaseEditorProps) => {\n const overrideCustomPalette = useMemo(() => !!value?.length && !isEqual(value, VIZ_CATEGORICAL), [value]);\n\n // use `value` to override the custom palette if value is not empty\n const originalPalettes = useMemo(() => {\n if (overrideCustomPalette) {\n return {\n ...PALETTES,\n custom: { ...PALETTES.custom, palette: value },\n };\n }\n return PALETTES;\n }, [overrideCustomPalette, value]);\n\n // selected palette ID\n const [selectedPalette, setSelectedPalette] = useState<PaletteType>(\n overrideCustomPalette ? 'custom' : 'default'\n );\n // current palettes on update\n const [palettes, setPalettes] = useState(originalPalettes);\n\n const handleMenuSelect = useCallback(\n (paletteId: PaletteType) => {\n setSelectedPalette(paletteId);\n onChange(null, name, palettes[paletteId].palette);\n },\n [name, onChange, palettes]\n );\n\n const handleColorChange = useCallback(\n (_evt, _name, newColors) => {\n if (newColors.length) {\n // override the previous custom palette\n setPalettes(prev => ({\n ...prev,\n custom: { ...PALETTES.custom, palette: newColors },\n }));\n setSelectedPalette('custom');\n onChange(null, name, newColors);\n } else {\n // set the colors to `Default` if MultiColorPicker returns empty array\n setPalettes(prev => ({\n ...prev,\n custom: PALETTES.custom,\n }));\n setSelectedPalette('default');\n onChange(null, name, PALETTES.default.palette);\n }\n },\n [name, onChange]\n );\n\n const toggle = (\n <Button\n appearance=\"default\"\n data-test=\"palette-dropdown-button\"\n label={palettes[selectedPalette].name}\n isMenu\n />\n );\n\n const renderMenuItem = (paletteConfig: PaletteDefinition) => {\n const { id, palette, name: paletteName } = paletteConfig;\n return (\n <Menu.Item\n key={`SeriesColorsDropdownMenuItem-${id}`}\n data-test={`palette-dropdown-menu-${id}`}\n selectable\n selected={selectedPalette === id}\n onClick={() => handleMenuSelect(id)}\n >\n <PaletteWrapper>\n <NameWrapper>{paletteName}</NameWrapper>\n <ColorPreviewWrapper>\n <ColorPreview\n colors={palette.slice(0, MAX_PREVIEW_COLOR_COUNT)}\n maxColorCount={MAX_PREVIEW_COLOR_COUNT}\n expandToFillHorizontalSpace={false}\n />\n </ColorPreviewWrapper>\n </PaletteWrapper>\n </Menu.Item>\n );\n };\n\n const isCustomPaletteAvailable = palettes.custom.palette.length > 0;\n\n return (\n <ColumnLayout gutter={VERTICAL_EDITOR_SPACING}>\n <ColumnLayout.Row>\n <ControlGroup\n label={label || _('Series colors')}\n labelPosition=\"top\"\n data-test=\"series-colors-editor\"\n >\n <Dropdown toggle={toggle}>\n <Menu style={{ width: DROPDOWN_MENU_WIDTH }}>\n {isCustomPaletteAvailable && renderMenuItem(palettes.custom)}\n {isCustomPaletteAvailable && <Menu.Divider />}\n {renderMenuItem(PALETTES.default)}\n </Menu>\n </Dropdown>\n </ControlGroup>\n </ColumnLayout.Row>\n <ColumnLayout.Row>\n <MultiColorPickerEditor\n name=\"series-colors\"\n value={palettes[selectedPalette].palette}\n flyoutTitle={_('Customize colors')}\n addColorButtonLabel={_('Add color')}\n onChange={handleColorChange}\n />\n </ColumnLayout.Row>\n </ColumnLayout>\n );\n};\n\nSeriesColorsEditor.propTypes = {\n ...BaseEditorPropTypes,\n value: T.arrayOf(T.string),\n};\n\nexport default SeriesColorsEditor;\n","import * as React from 'react';\nimport styled from 'styled-components';\nimport Slider from '@splunk/react-ui/Slider';\nimport NumberInput from '@splunk/react-ui/Number';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport { useNumberInput } from '../hooks/useNumberInput';\n\nconst numberStyle = { flexBasis: 92, flexGrow: 0, flexShrink: 0 };\n\nconst StyledSlider = styled(Slider)`\n div:has(> [data-test='bar']) {\n min-width: 0;\n }\n`;\n\ninterface SliderEditorProps extends BaseEditorProps {\n /** help text under controls */\n help?: string;\n /** max value for slider */\n max?: number;\n /** label for max value */\n maxLabel?: React.ReactNode;\n /** min value for slider */\n min?: number;\n /** label for min value */\n minLabel?: React.ReactNode;\n /** units to skip when moving slider */\n step?: number;\n /** display sections for drag bar */\n stepMarks?: 'focus' | 'always' | 'none';\n /** current value of field */\n value: number;\n /** default value of the option */\n defaultValue?: number;\n}\n\nexport const SliderEditor = ({\n help,\n isDisabled = false,\n label,\n labelPosition = 'top',\n labelWidth,\n max,\n maxLabel = null,\n min,\n minLabel = null,\n name,\n onChange,\n step,\n stepMarks = 'focus',\n value = null,\n defaultValue,\n}: SliderEditorProps): JSX.Element => {\n const handleSliderChange = React.useCallback(\n (event, { value: v }) => {\n // emit onChange if value is a number\n if (parseFloat(v) || v === 0) {\n onChange(event, name, v);\n }\n },\n [onChange, name]\n );\n const handleNumberChange = React.useCallback(\n (event, v) => {\n // emit onChange if value is a number\n if (parseFloat(v) || v === 0) {\n onChange(event, name, v);\n }\n },\n [onChange, name]\n );\n\n const { currentValue, handleChange, handleBlur, handleFocus, handleKeyPress } = useNumberInput({\n value,\n min,\n max,\n defaultValue,\n onValueChange: handleNumberChange,\n });\n\n // if there is no value show input as blank by passing undefined\n const displayValue = currentValue != null ? Number(currentValue) : undefined;\n\n // stepMarks = 'none'is not valid for react-ui/Slider\n const suiStepMarks = stepMarks === 'none' ? 'never' : stepMarks;\n return (\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth} help={help}>\n <StyledSlider\n data-test={name}\n min={min}\n minLabel={minLabel}\n max={max}\n maxLabel={maxLabel}\n step={step}\n stepMarks={suiStepMarks}\n value={displayValue}\n disabled={isDisabled}\n onChange={handleSliderChange}\n />\n <NumberInput\n inline\n min={min}\n max={max}\n step={step}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyDown={handleKeyPress}\n value={displayValue}\n disabled={isDisabled}\n style={numberStyle}\n />\n </ControlGroup>\n );\n};\n\nexport default SliderEditor;\n","import * as React from 'react';\nimport { cloneDeep, defaultsDeep, get, set } from 'lodash';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport { getDataSourceStateInfo } from '@splunk/visualizations-shared/dataSourceUtils';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport { getAvailableFieldsWithTypes, getPlaceholderMessage } from '../utils/columnSelectionUtils';\nimport type { FieldTuple } from '../utils/columnSelectionUtils';\nimport type {\n ColumnColoring,\n ColumnEntry,\n EditorSupportedFormatOptions,\n} from '../interfaces/ColumnFormatter';\nimport ColumnFormatterEntry from './table/ColumnFormatterEntry';\nimport AddColumn from './table/AddColumn';\nimport {\n checkExceedsEditorCapabilities,\n getColumnFormatDefFromState,\n getFormattingOptDSLKey,\n getGlobalTableFormatting,\n getInitialColumnFormattingState,\n getEditorSupportedFormatOptions,\n getExistingTextFormatting,\n TextDataType,\n} from './table/columnFormattingUtils';\nimport type { ColumnColoringConfig, FlyoutConfig } from './table/common/props';\nimport { useDataSource } from '../hooks/useDataSource';\n\ninterface TextFormatOption {\n label: string;\n editor: string;\n option: string;\n editorProps?: Record<string, unknown>;\n [key: string]: unknown;\n}\n\ntype TextFormatConfig = TextFormatOption[][];\n\ninterface TableColumnFormatterEditorProps extends BaseEditorProps {\n dataSourceKey?: string;\n defaultOptionsByType?: {\n [type: string]: {\n [option: string]: string | boolean | number;\n };\n };\n flyoutConfig: FlyoutConfig;\n columnColoringConfig: ColumnColoringConfig;\n textFormatConfig?: TextFormatConfig;\n}\n\n// TODO(fkurniawan): can be converted one-lined as getObjectFromMap(map) with TS v4\n// 😭 need node >= v12 for getObjectFromMap to work in test files\nconst getObjectFromMap = (map: Map<string, any>): any => {\n const objectFromMap = {};\n map.forEach((value, key): void => {\n objectFromMap[key] = value;\n });\n return objectFromMap;\n};\n\nconst TableColumnFormatterEditor: React.FunctionComponent<TableColumnFormatterEditorProps> = ({\n dataSourceKey = 'primary',\n dataSourceBindings,\n label,\n labelPosition = 'top',\n labelWidth,\n columnColoringConfig,\n defaultOptionsByType,\n flyoutConfig = [[]],\n onChange,\n value,\n textFormatConfig = [],\n}): React.ReactElement => {\n const {\n context: vizContext = {},\n columnFormat: columnFormatOption = {},\n tableFormat: tableFormatOption = {},\n } = value;\n const dataSource = useDataSource({ dataSourceBindings, dataSourceKey });\n const { columns, fields } = get(dataSource, 'data') || { columns: [], fields: [] };\n const availableFieldsWithTypes = getAvailableFieldsWithTypes(columns, fields);\n const editorSupportedFormatOptions = React.useMemo(\n (): EditorSupportedFormatOptions => getEditorSupportedFormatOptions(flyoutConfig),\n [flyoutConfig]\n );\n const [editorColumnFormatting, setEditorColumnFormatting] = React.useState(\n getInitialColumnFormattingState({\n availableFieldsWithTypes,\n coloringTypes: columnColoringConfig.coloringTypes,\n columnFormatOption,\n editorSupportedFormatOptions,\n vizContext,\n })\n );\n\n React.useEffect(\n (): void => {\n // if the list of available fields changes, need to reinitialize initialColumnFormatting editor\n setEditorColumnFormatting(\n getInitialColumnFormattingState({\n availableFieldsWithTypes,\n coloringTypes: columnColoringConfig.coloringTypes,\n columnFormatOption,\n editorSupportedFormatOptions,\n vizContext,\n })\n );\n },\n // since fields is an array of shallow name/type tuples, deep equality dependency here should not be too expensive\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [JSON.stringify(availableFieldsWithTypes)]\n );\n\n const handleResetColumnToDefault = React.useCallback(\n ({ columnName, columnDataType: dataType }): void => {\n const contextKey = getFormattingOptDSLKey(columnFormatOption[columnName]);\n const sourceCustomizedFormatByType = vizContext[contextKey] || { [dataType]: {} };\n const formatByTypeConfigOptsToReset = Object.keys(sourceCustomizedFormatByType[dataType]).reduce(\n (resetConfig, optToClear) => {\n // eslint-disable-next-line no-param-reassign\n resetConfig[optToClear] = null;\n return resetConfig;\n },\n {}\n );\n\n const formatText = getExistingTextFormatting(columnName, columnFormatOption);\n const updatedEditorColumnFormatting = new Map(editorColumnFormatting);\n const updatedColumnFormatEntry = {\n columnColoring: get(editorColumnFormatting.get(columnName), 'columnColoring', {\n _meta: {\n dynamicallyColoredOption: 'Off',\n },\n }),\n formatByType: {\n [dataType]: {\n ...formatByTypeConfigOptsToReset,\n ...defaultOptionsByType[dataType],\n _meta: {\n exceedsEditorCapabilities: false,\n },\n },\n },\n formatText,\n };\n updatedEditorColumnFormatting.set(columnName, updatedColumnFormatEntry as ColumnEntry);\n setEditorColumnFormatting(updatedEditorColumnFormatting);\n onChange(\n null,\n getColumnFormatDefFromState(\n cloneDeep({\n columnFormatOption,\n updatedEditorColumnFormatting: getObjectFromMap(updatedEditorColumnFormatting),\n })\n )\n );\n },\n [columnFormatOption, defaultOptionsByType, editorColumnFormatting, onChange, vizContext]\n );\n\n const updateDefinition = React.useCallback(\n (columnName, updatedColumnEntry, skipOnChange = false): void => {\n const updatedEditorColumnFormatting = new Map(editorColumnFormatting);\n updatedEditorColumnFormatting.set(columnName, updatedColumnEntry);\n setEditorColumnFormatting(updatedEditorColumnFormatting);\n if (skipOnChange) return;\n onChange(\n null,\n getColumnFormatDefFromState(\n cloneDeep({\n columnFormatOption,\n updatedEditorColumnFormatting: getObjectFromMap(updatedEditorColumnFormatting),\n })\n )\n );\n },\n [columnFormatOption, editorColumnFormatting, onChange]\n );\n\n const handleColumnColoringUpdate = React.useCallback(\n ({ columnName, coloringTypes, dynamicallyColoredOption }): void => {\n if (Array.isArray(coloringTypes)) {\n const updatedColumnFormatEntry: ColumnEntry = cloneDeep(\n editorColumnFormatting.get(columnName)\n );\n coloringTypes.forEach(\n ({ coloringType, colorContextKey, colorOptionDSL, colorContextConfig }) => {\n set(updatedColumnFormatEntry, ['columnColoring', coloringType], {\n colorContextKey,\n colorOptionDSL,\n colorContextConfig,\n });\n }\n );\n set(updatedColumnFormatEntry, ['columnColoring', '_meta'], {\n dynamicallyColoredOption,\n });\n updateDefinition(columnName, updatedColumnFormatEntry);\n }\n },\n [editorColumnFormatting, updateDefinition]\n );\n\n const handleColumnFormattingUpdate = React.useCallback(\n ({ columnName, optionName, value: newOptionValue }): void => {\n // TODO(fkurniawan): since the table editor currently associates one data type with a column, this only returns one type\n // however, may need to handle mixed-type column formatting in the future\n const [dataType] = Object.keys(editorColumnFormatting.get(columnName).formatByType);\n const updatedColumnFormatEntry: ColumnEntry = defaultsDeep(\n {},\n {\n formatByType: {\n [dataType]: {\n [optionName]: newOptionValue,\n _meta: {\n // an editor can only persist a change if all options in state are editor-supported\n exceedsEditorCapabilities: false,\n },\n },\n },\n },\n editorColumnFormatting.get(columnName)\n );\n updateDefinition(columnName, updatedColumnFormatEntry);\n },\n [editorColumnFormatting, updateDefinition]\n );\n\n const handleTextFormattingUpdate = React.useCallback(\n ({ columnName, optionName, value: newOptionValue }): void => {\n const updatedTextFormatEntry: ColumnEntry = defaultsDeep(\n {},\n {\n formatText: {\n [optionName]: newOptionValue,\n },\n },\n editorColumnFormatting.get(columnName)\n );\n updateDefinition(columnName, updatedTextFormatEntry);\n },\n [editorColumnFormatting, updateDefinition]\n );\n\n const handleAddColumnFormatting = React.useCallback(\n (e, { value: newValue }: { value: FieldTuple }): void => {\n const { name: columnName, type: columnDataType } = newValue;\n const columnDSLContextKey = getFormattingOptDSLKey(columnFormatOption[columnName]);\n\n /* if a context config key still exists when the user is adding a column via editor,\n * this means the user previously configured non-editor supported options via source and removed the column from the editor sidebar.\n *\n * There shouldn't be any other way that the editor reaches this condition when a user adds a column to be formatted via editor\n */\n let columnEntryToInsert;\n const supportedOptions = editorSupportedFormatOptions[columnDataType];\n if (columnDSLContextKey) {\n const columnFormatConfig = vizContext[columnDSLContextKey];\n columnEntryToInsert = {\n columnColoring: {\n _meta: {\n dynamicallyColoredOption: 'Off',\n },\n },\n formatByType: {\n [columnDataType]: {\n ...get(vizContext, [columnDSLContextKey, columnDataType], {}),\n _meta: {\n exceedsEditorCapabilities: checkExceedsEditorCapabilities(\n columnFormatConfig[columnDataType],\n supportedOptions\n ),\n },\n },\n },\n formatText: {},\n };\n // no need to call onChange for a column addition into table viz if it was source-customized, since there is nothing to persist back into state\n updateDefinition(columnName, columnEntryToInsert, true);\n return;\n }\n\n const globalFormattingForDataType = getGlobalTableFormatting(\n tableFormatOption,\n columnDataType,\n vizContext\n );\n columnEntryToInsert = {\n columnColoring: {\n _meta: {\n dynamicallyColoredOption: 'Off',\n },\n },\n formatByType: {\n [columnDataType]: {\n ...defaultOptionsByType[columnDataType],\n ...globalFormattingForDataType,\n _meta: {\n exceedsEditorCapabilities: checkExceedsEditorCapabilities(\n globalFormattingForDataType,\n supportedOptions\n ),\n },\n },\n },\n formatText: {\n ...defaultOptionsByType[TextDataType],\n },\n };\n updateDefinition(columnName, columnEntryToInsert);\n },\n [\n columnFormatOption,\n defaultOptionsByType,\n editorSupportedFormatOptions,\n updateDefinition,\n tableFormatOption,\n vizContext,\n ]\n );\n\n const handleRemoveColumnFormatting = React.useCallback(\n ({ columnName, columnDataType: dataType }): void => {\n const updatedEditorColumnFormatting = new Map(editorColumnFormatting);\n updatedEditorColumnFormatting.delete(columnName);\n setEditorColumnFormatting(updatedEditorColumnFormatting);\n\n // if the user is removing an added column which exceeded editor capabilities, it means they didn't change anything via editor\n const columnToRemove = editorColumnFormatting.get(columnName);\n const formatByTypeExceedsEditorCapabilities = get(columnToRemove, [\n 'formatByType',\n dataType,\n '_meta',\n 'exceedsEditorCapabilities',\n ]);\n if (!formatByTypeExceedsEditorCapabilities) {\n onChange(\n null,\n getColumnFormatDefFromState(\n cloneDeep({\n columnFormatOption,\n updatedEditorColumnFormatting: {\n ...getObjectFromMap(editorColumnFormatting),\n // explicit to indicate that the column should be removed when recursively merging keys\n [columnName]: null,\n },\n })\n )\n );\n } else {\n // this is to preserve the original formatByType, but strip out any dynamic coloring when writing back to the definition\n // TODO(fkurniawan): this will have to be modified once exceedsEditorCapabilities for dynamic coloring state exists\n const contextKey = getFormattingOptDSLKey(columnFormatOption[columnName]);\n const persistedFormatByType = vizContext[contextKey] || {};\n const { colorContextKey: rowColorsContextKey } = get(\n editorColumnFormatting.get(columnName),\n ['columnColoring', 'rowColors'],\n {} as ColumnColoring\n );\n const { colorContextKey: rowBackgroundColorsContextKey } = get(\n editorColumnFormatting.get(columnName),\n ['columnColoring', 'rowBackgroundColors'],\n {} as ColumnColoring\n );\n\n onChange(\n null,\n getColumnFormatDefFromState(\n cloneDeep({\n columnFormatOption,\n updatedEditorColumnFormatting: {\n ...getObjectFromMap(editorColumnFormatting),\n [columnName]: {\n formatByType: {\n ...persistedFormatByType,\n },\n columnColoring: {\n ...(rowColorsContextKey && {\n rowColors: {\n colorContextKey: rowColorsContextKey,\n colorOptionsDSL: null,\n colorContextConfig: null,\n },\n }),\n ...(rowBackgroundColorsContextKey && {\n rowBackgroundColors: {\n colorContextKey: rowBackgroundColorsContextKey,\n colorOptionsDSL: null,\n colorContextConfig: null,\n },\n }),\n },\n formatText: {},\n },\n },\n })\n )\n );\n }\n },\n [columnFormatOption, editorColumnFormatting, onChange, vizContext]\n );\n\n // use forEach iterator to populate ColumnFormatterEntry elements, since JS Map does not have .map\n const columnFormatterEntries = [];\n editorColumnFormatting.forEach((columnFormatEntry, columnName): void => {\n // TODO(fkurniawan): handle potential mixed-mode column formatting in the future\n const [dataType] = Object.keys(columnFormatEntry.formatByType);\n const isSourceCustomized = get(columnFormatEntry, [\n 'formatByType',\n dataType,\n '_meta',\n 'exceedsEditorCapabilities',\n ]);\n columnFormatterEntries.push(\n <ColumnFormatterEntry\n // eslint-disable-next-line react/no-array-index-key\n key={columnName}\n columnName={columnName}\n columnDataType={dataType}\n columnColoring={columnFormatEntry.columnColoring}\n columnColoringConfig={columnColoringConfig}\n columnFormattingByType={columnFormatEntry.formatByType}\n columnTextFormatting={columnFormatEntry.formatText}\n defaultOptionsByType={defaultOptionsByType}\n flyoutConfigForDataType={flyoutConfig[dataType] || []} // empty column to handle unsupported data type editors\n textFormatConfig={textFormatConfig}\n isSourceCustomized={isSourceCustomized}\n removeColumnFormatting={handleRemoveColumnFormatting}\n resetColumnToDefault={handleResetColumnToDefault}\n updateColumnColoring={handleColumnColoringUpdate}\n updateColumnFormatting={handleColumnFormattingUpdate}\n updateColumnTextFormatting={handleTextFormattingUpdate}\n />\n );\n });\n\n const { hasError, isMissing, isLoading } = getDataSourceStateInfo(dataSource);\n\n // TODO: SUI 4.0 renders empty labels differently. Labels should never be empty strings, instead pass\n // a valid label and set hideLabel on ControlGroup\n const controlGroupMarginFix = !label || label === '' ? { marginTop: '-8px' } : undefined;\n\n return (\n <>\n <div>{columnFormatterEntries}</div>\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n style={controlGroupMarginFix}\n >\n <AddColumn\n availableFieldsWithTypes={availableFieldsWithTypes}\n columnFormatting={editorColumnFormatting}\n disableToggle={isMissing || hasError}\n editorSupportedFormatOptions={editorSupportedFormatOptions}\n handleAddColumnFormatting={handleAddColumnFormatting}\n placeholderMessage={getPlaceholderMessage({\n isMissing,\n isLoading,\n hasError,\n defaultMessage: '+ Add column to format',\n })}\n />\n </ControlGroup>\n </>\n );\n};\n\nexport default TableColumnFormatterEditor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport type { OptionsStanza } from '@splunk/visualization-encoding/AST';\nimport type { UiConfig, FormatterUiConfig } from './formatters/FormatterEditor';\nimport type { ColorModeChangeHandler } from './DynamicColorEditor';\nimport { DynamicColorEditor } from './DynamicColorEditor';\nimport ToggleEditor from './ToggleEditor';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport type { PalettesConfig } from '../interfaces/PalettesConfig';\nimport { DynamicColorEditorPropTypes } from '../interfaces/DynamicColorEditorProps';\nimport { clearDynamicColoring, moveDslBetweenModes } from './table/DynamicColorUtils';\n\nexport interface TableDynamicColorEditorProps extends BaseEditorProps {\n name: string;\n value: any;\n flyoutTitle?: string;\n dataSelectors?: UiConfig[];\n formatters?: FormatterUiConfig[];\n defaultPalettesConfig: PalettesConfig;\n tooltip?: string;\n options?: Record<string, any>;\n onChange: (...args: any[]) => void;\n}\n\nconst propTypes: T.WeakValidationMap<TableDynamicColorEditorProps> = {\n ...DynamicColorEditorPropTypes,\n};\n\nexport const TableDynamicColorEditor: React.FC<TableDynamicColorEditorProps> = ({\n name, // the option links to both the toggle and the dynamic color editor\n value, // the option value (deprecated, use options.tableFormat)\n label = '',\n labelPosition,\n labelWidth,\n context,\n flyoutTitle = _('Dynamic coloring'),\n formatters = [],\n dataSelectors = [],\n defaultPalettesConfig,\n tooltip,\n options = {},\n onChange = () => undefined,\n}) => {\n // Determine initial mode from options (defensive when tableFormat may be removed)\n const tableFormat = options?.tableFormat || {};\n const initialMode: 'background' | 'text' = tableFormat?.rowColors ? 'text' : 'background';\n const [colorMode, setColorMode] = React.useState<'background' | 'text'>(initialMode);\n\n // Always derive the current value from options.tableFormat for controlled behavior\n const currentTableFormat = options?.tableFormat || {};\n const [isDynamicEditorEnabled, setDynamicEditorEnabled] = React.useState(\n Boolean(currentTableFormat.rowColors || currentTableFormat.rowBackgroundColors)\n );\n React.useEffect(() => {\n const currentFormat = options?.tableFormat || {};\n const { rowColors, rowBackgroundColors } = currentFormat;\n const hasDsl = Boolean(rowColors || rowBackgroundColors);\n setDynamicEditorEnabled(hasDsl);\n if (!hasDsl) {\n setColorMode('background');\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [options?.tableFormat]);\n\n // Handle color mode change\n const handleColorModeChange: ColorModeChangeHandler = (event, { value: modeValue }) => {\n const updatedOptions = { ...options, tableFormat: { ...tableFormat } };\n const updatedContext = { ...context };\n\n if (modeValue === 'off') {\n setDynamicEditorEnabled(false);\n Object.assign(updatedOptions.tableFormat, clearDynamicColoring(colorMode));\n updatedContext.tableFormatEditorConfig = undefined;\n } else if (colorMode === 'background' && modeValue === 'text') {\n // background -> text: move DSL, keep config as tableFormatEditorConfig\n Object.assign(updatedOptions.tableFormat, moveDslBetweenModes('background', 'text', tableFormat));\n setColorMode('text');\n } else if (colorMode === 'text' && modeValue === 'background') {\n // text -> background: move DSL, keep config as tableFormatEditorConfig\n Object.assign(updatedOptions.tableFormat, moveDslBetweenModes('text', 'background', tableFormat));\n setColorMode('background');\n }\n onChange(event, { options: updatedOptions, context: updatedContext });\n };\n\n const handleToggleChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, _optionStanza: OptionsStanza) => {\n setDynamicEditorEnabled(prevState => !prevState);\n\n const updatedOptions: Record<string, any> = {\n ...options,\n tableFormat: { ...options.tableFormat },\n };\n const updatedContext: Record<string, any> = { ...context };\n\n if (!isDynamicEditorEnabled) {\n // Toggling ON: set to default formatter and config\n const dataSelector = dataSelectors[0]?.value || 'table';\n // Prefer the first formatter as default, or fallback to 'gradient'\n const defaultFormatter = formatters[0]?.value || 'gradient';\n const defaultConfig = formatters[0]?.defaults?.[dataSelector] || {};\n const dsl = `> ${dataSelector} | ${defaultFormatter}(tableFormatEditorConfig)`;\n if (colorMode === 'background') {\n updatedOptions.tableFormat.rowBackgroundColors = dsl;\n updatedOptions.tableFormat.rowColors = undefined;\n } else {\n updatedOptions.tableFormat.rowColors = dsl;\n updatedOptions.tableFormat.rowBackgroundColors = undefined;\n }\n updatedContext.tableFormatEditorConfig = defaultConfig;\n onChange(event, { options: updatedOptions, context: updatedContext });\n } else {\n // Toggling OFF\n Object.assign(updatedOptions.tableFormat, clearDynamicColoring(colorMode));\n updatedContext.tableFormatEditorConfig = undefined;\n onChange(event, { options: updatedOptions, context: updatedContext });\n }\n },\n [options, context, isDynamicEditorEnabled, onChange, colorMode, dataSelectors, formatters]\n );\n\n const handleDynamicColorEditorChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, optionStanza: OptionsStanza) => {\n // The DSL is now always in optionStanza.options.tableFormat (string)\n const dsl = optionStanza.options?.tableFormat;\n const config = optionStanza.context?.tableFormatEditorConfig;\n const updatedOptions = { ...options, tableFormat: { ...options.tableFormat } };\n if (colorMode === 'background') {\n updatedOptions.tableFormat.rowBackgroundColors = dsl;\n updatedOptions.tableFormat.rowColors = undefined;\n } else if (colorMode === 'text') {\n updatedOptions.tableFormat.rowColors = dsl;\n updatedOptions.tableFormat.rowBackgroundColors = undefined;\n }\n // Always keep tableFormat as an object\n if (\n updatedOptions.tableFormat.rowBackgroundColors === undefined &&\n updatedOptions.tableFormat.rowColors === undefined\n ) {\n updatedOptions.tableFormat = {};\n }\n // Set only the new config for the selected formatter\n const updatedContext = { ...context, tableFormatEditorConfig: config };\n onChange(event, { options: updatedOptions, context: updatedContext });\n },\n [onChange, options, context, colorMode]\n );\n\n return (\n <div data-test=\"dynamic-color-toggle\">\n <ToggleEditor\n name={name}\n label={_('Dynamic coloring')}\n labelPosition=\"right\"\n value={isDynamicEditorEnabled}\n onChange={handleToggleChange}\n itemSchema={{ type: 'boolean' }}\n help={tooltip}\n />\n {isDynamicEditorEnabled && (\n <DynamicColorEditor\n name={name}\n label={label || _('Dynamic coloring')}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n value={colorMode === 'background' ? value?.rowBackgroundColors : value?.rowColors}\n context={context}\n onChange={handleDynamicColorEditorChange}\n flyoutTitle={flyoutTitle}\n formatters={formatters}\n dataSelectors={dataSelectors}\n defaultPalettesConfig={defaultPalettesConfig}\n colorMode={colorMode}\n handleColorModeChange={handleColorModeChange}\n />\n )}\n </div>\n );\n};\n\nTableDynamicColorEditor.propTypes = propTypes;\n","import React, { useState, useCallback, useEffect } from 'react';\nimport T from 'prop-types';\nimport styled, { css } from 'styled-components';\nimport TextArea from '@splunk/react-ui/TextArea';\nimport { pick, variables } from '@splunk/themes';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { editorStyle } from '../shared/dimensionConstants';\nimport { BaseEditorPropTypes } from '../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\n\n// The dark disabled textarea theme is being overriden by a global style in\n// core, so we need to specify it here so it has higher priority\nconst StyledTextArea = styled(TextArea)`\n textarea[disabled] {\n ${pick({\n enterprise: {\n dark: css`\n color: ${variables.textDisabledColor};\n background-color: ${variables.borderColor};\n border-color: ${variables.backgroundColorHover};\n `,\n },\n })}\n }\n`;\n\ninterface TextAreaEditorProps extends BaseEditorProps {\n /** current value of field */\n value: string;\n /** visually hide the label, but render it for screen readers */\n hideLabel?: boolean;\n /** help text under controls */\n help?: string;\n /** text to display in a tooltip next to the label */\n tooltip?: string;\n /** if the input should display error state */\n error?: boolean;\n}\n\nconst TextAreaEditor = ({\n onChange,\n name,\n value = '',\n label,\n labelPosition = 'top',\n labelWidth,\n hideLabel,\n isDisabled,\n help,\n tooltip,\n error,\n ...otherProps\n}: TextAreaEditorProps) => {\n const [val, setVal] = useState<string>(value);\n\n // maintain consistency of value state with prop\n useEffect(() => setVal(value), [value]);\n\n const handleChange = useCallback(\n (\n _event: React.ChangeEvent<HTMLTextAreaElement> | React.MouseEvent<HTMLSpanElement>,\n { value: v }: { value: string }\n ) => {\n setVal(v);\n },\n []\n );\n\n const handleBlur = useCallback(\n (event: React.FocusEvent<HTMLTextAreaElement> | React.KeyboardEvent<HTMLTextAreaElement>) => {\n const newVal = val.trim();\n if (newVal === value) {\n return;\n }\n // only change value if it is different from previous\n onChange(event, name, newVal);\n },\n [val, value, onChange, name]\n );\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n hideLabel={hideLabel}\n help={help}\n tooltip={tooltip}\n error={error}\n >\n <StyledTextArea\n key={value}\n data-test={name}\n style={editorStyle}\n onChange={handleChange}\n onBlur={handleBlur}\n value={val}\n disabled={isDisabled}\n {...otherProps}\n error={error}\n />\n </ControlGroup>\n );\n};\n\nconst propTypes: Record<keyof TextAreaEditorProps, T.Validator<any>> = {\n ...BaseEditorPropTypes,\n value: T.string,\n hideLabel: T.bool,\n help: T.string,\n tooltip: T.string,\n error: T.bool,\n};\n\nTextAreaEditor.propTypes = propTypes;\n\nexport default TextAreaEditor;\n","import * as React from 'react';\nimport styled from 'styled-components';\nimport { isColor } from '@splunk/visualizations-shared/colorUtils';\nimport { createDOMID } from '@splunk/ui-utils/id';\n\nconst DEFAULT_MAX_COLOR_COUNT = 7;\n\ninterface ColorPreviewWrapperProps {\n isReversed?: boolean;\n}\n\nconst ColorPreviewWrapper = styled.div.attrs<ColorPreviewWrapperProps>(props => ({\n 'data-test': 'ColorPreviewWrapper',\n isReversed: props.isReversed,\n}))<ColorPreviewWrapperProps>`\n display: flex;\n flex-direction: row;\n height: 100%;\n`;\n\ninterface ColorPreviewItemProps {\n color: string;\n widthGrow?: boolean;\n maxColorCount?: number;\n}\n\nconst ColorPreviewItem = styled.div.attrs<ColorPreviewItemProps>(() => ({\n 'data-test': 'ColorPreviewItem',\n}))<ColorPreviewItemProps>`\n flex-grow: ${({ widthGrow }): number => (widthGrow ? 1 : 0)};\n width: ${({ maxColorCount }): string => `calc(100% / ${maxColorCount})`};\n margin-right: 1px;\n background-color: ${({ color }): string => color};\n &:last-of-type {\n margin-right: 0;\n }\n`;\n\ninterface ColorPreviewProps {\n colors: string[];\n maxColorCount?: number;\n expandToFillHorizontalSpace?: boolean;\n isReversed?: boolean;\n}\n\nexport const ColorPreview: React.FunctionComponent<ColorPreviewProps> = ({\n colors = [],\n maxColorCount = DEFAULT_MAX_COLOR_COUNT,\n expandToFillHorizontalSpace = true,\n isReversed = false,\n}): React.ReactElement => {\n const trueColors = isReversed ? [...colors].reverse() : [...colors];\n return (\n <ColorPreviewWrapper isReversed={isReversed}>\n {trueColors.map(\n (color, _i): React.ReactElement =>\n isColor(color) && (\n <ColorPreviewItem\n key={createDOMID()}\n color={color}\n widthGrow={expandToFillHorizontalSpace}\n maxColorCount={maxColorCount}\n />\n )\n )}\n </ColorPreviewWrapper>\n );\n};\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport type { RangesConfig } from '@splunk/visualization-encoding/formatters/RangeValue';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { createGradientConfigFromPalettes } from './Gradient/gradientUtils';\nimport type { GradientConfig } from './Gradient/gradientUtils';\nimport type { BaseEditorProps } from '../../interfaces/BaseEditorProps';\nimport type { BasePreviewProps } from '../../interfaces/BasePreviewProps';\nimport type { PalettesConfig } from '../../interfaces/PalettesConfig';\nimport { RangeValuePreview } from './RangeValuePreview';\nimport { MatchValuePreview } from './MatchValuePreview';\nimport GradientPreview from './Gradient/GradientPreview';\nimport RadioBarEditor from '../RadioBarEditor';\nimport RangeValueEditor from './RangeValueEditor';\nimport MatchValueEditor from './MatchValueEditor';\nimport GradientEditor from './GradientEditor';\nimport type { MatchValueEditorProps } from './MatchValueEditor';\nimport CustomizedInSourceEditor from '../CustomizedInSourceEditor';\n\nexport const sharedPalettesConfigPropType = T.exact({\n paletteTheme: T.string,\n paletteEntry: T.exact({\n type: T.string,\n index: T.number,\n }),\n});\n\nexport const getSortedRanges = (ranges = []): RangesConfig[] => {\n const rangesToSort = [...(Array.isArray(ranges) ? ranges : [])];\n rangesToSort.sort((a, b): number => {\n if (a.to == null) return 1;\n if (b.to == null) return -1;\n return +a.to - +b.to;\n });\n return rangesToSort;\n};\n\nconst DEFAULT_GRADIENT_PALETTES_CONFIG: PalettesConfig = {\n paletteTheme: 'DARK_COLORS',\n paletteEntry: {\n type: 'sequential',\n index: 0,\n },\n};\n\ntype FormatterChangeEvent = React.SyntheticEvent | string | null | undefined;\n\ntype FormatterChangeHandler<TConfig> = (\n event: FormatterChangeEvent,\n name: string | null | undefined,\n config: TConfig\n) => void;\n\nexport interface RangeValueEditorProps extends BaseEditorProps {\n defaultPalettesConfig: PalettesConfig;\n selectedDataSelector?: string;\n value: RangesConfig[] | null;\n onChange?: FormatterChangeHandler<RangesConfig[]>;\n}\n\nexport const RangeValueEditorWrapper: React.FunctionComponent<RangeValueEditorProps> = ({\n defaultPalettesConfig,\n value,\n onChange,\n selectedDataSelector,\n}): React.ReactElement => (\n <RangeValueEditor\n data-test=\"RangeValueEditor\"\n defaultPalettesConfig={defaultPalettesConfig}\n value={value}\n onChange={(event, name, rangeValues): void => onChange(event, name, rangeValues)}\n selectedDataSelector={selectedDataSelector}\n />\n);\n\nRangeValueEditorWrapper.propTypes = {\n defaultPalettesConfig: sharedPalettesConfigPropType,\n value: T.arrayOf(\n T.shape({\n from: T.number,\n to: T.number,\n value: T.string,\n })\n ),\n onChange: T.func,\n selectedDataSelector: T.string,\n} as T.WeakValidationMap<RangeValueEditorProps>;\n\nexport const MatchValueEditorWrapper: React.FunctionComponent<MatchValueEditorProps> = ({\n defaultPalettesConfig,\n value,\n onChange,\n selectedDataSelector,\n}): React.ReactElement => (\n <MatchValueEditor\n data-test=\"MatchValueEditor\"\n defaultPalettesConfig={defaultPalettesConfig}\n value={value}\n onChange={(event, name, matchValues): void => onChange(event, name, matchValues)}\n selectedDataSelector={selectedDataSelector}\n />\n);\n\nMatchValueEditorWrapper.propTypes = {\n defaultPalettesConfig: sharedPalettesConfigPropType,\n value: T.arrayOf(\n T.shape({\n match: T.oneOfType([T.string, T.number]),\n value: T.string,\n })\n ),\n onChange: T.func,\n selectedDataSelector: T.string,\n};\n\nexport interface GradientEditorProps extends BaseEditorProps {\n defaultPalettesConfig: PalettesConfig;\n value: GradientConfig;\n showStaticTextColor?: boolean;\n selectedDataSelector?: string;\n onChange: (event: React.SyntheticEvent, name: string, value: GradientConfig) => void;\n}\n\nexport const GradientEditorWrapper: React.FunctionComponent<GradientEditorProps> = ({\n defaultPalettesConfig = DEFAULT_GRADIENT_PALETTES_CONFIG,\n value,\n onChange,\n showStaticTextColor,\n selectedDataSelector,\n}): React.ReactElement => {\n // if stops are defined or more than 7 colors, it means the gradient is customized\n const isCustomized = value?.stops?.length > 0 || (value?.colors?.length ?? 0) > 7;\n if (isCustomized) {\n return (\n <CustomizedInSourceEditor\n label=\"Data colors\"\n labelPosition=\"top\"\n onResetToDefault={() => {\n const defaultGradient = createGradientConfigFromPalettes(defaultPalettesConfig);\n onChange(undefined, undefined, defaultGradient);\n }}\n />\n );\n }\n\n return (\n <GradientEditor\n data-test=\"GradientEditor\"\n name=\"gradient\"\n defaultPalettesConfig={defaultPalettesConfig}\n value={value}\n onChange={(event, name, gradientValues): void => onChange(event, name, gradientValues)}\n showStaticTextColor={showStaticTextColor}\n selectedDataSelector={selectedDataSelector}\n />\n );\n};\n\nGradientEditorWrapper.propTypes = {\n defaultPalettesConfig: sharedPalettesConfigPropType,\n value: T.exact({\n colors: T.arrayOf(T.string).isRequired,\n textColor: T.string,\n }).isRequired,\n onChange: T.func,\n showStaticTextColor: T.bool,\n selectedDataSelector: T.string,\n};\n\ntype ValidEditorProps = BaseEditorProps | RangeValueEditorProps | MatchValueEditorProps | GradientEditorProps;\n\ntype RangeFormatterConfig = RangeValueEditorProps['value'];\ntype MatchFormatterConfig = MatchValueEditorProps['value'];\ntype GradientFormatterConfig = GradientEditorProps['value'];\n\nexport type FormatterConfig =\n | RangeFormatterConfig\n | MatchFormatterConfig\n | GradientFormatterConfig\n | Record<string, unknown>\n | undefined;\n\ninterface SupportedFormattersShape {\n [key: string]: {\n preview: React.JSXElementConstructor<BasePreviewProps>;\n // @TODO: extend w/ other props types once other formatting editors are added\n editor?: React.JSXElementConstructor<ValidEditorProps>;\n };\n}\n/**\n * This object will be used to dynamically look up the preview/editor to render\n */\nexport const supportedFormatters: SupportedFormattersShape = {\n gradient: {\n preview: GradientPreview,\n editor: GradientEditorWrapper,\n },\n rangeValue: {\n preview: RangeValuePreview,\n editor: RangeValueEditorWrapper,\n },\n matchValue: {\n preview: MatchValuePreview,\n editor: MatchValueEditorWrapper,\n },\n};\nconst validFormatterTypes = Object.keys(supportedFormatters);\nexport interface UiConfig {\n label: string;\n value: string;\n}\nexport interface FormatterUiConfig extends UiConfig {\n /**\n * Keys in this object reference DataSelectors.\n * Values represent default formatter configurations for this data selector.\n *\n * Example:\n * {\n * majorValue: [{ from: 0, value: '#f00' }],\n * deltaValue: [{ to: 0, value: 'red' }, { from: 0, value: 'green' }]\n * }\n *\n */\n defaults: Partial<Record<string, FormatterConfig>>;\n /*\n * show it by default when open dynamic color flyout\n */\n isDefault?: boolean;\n}\n\ninterface FormatterEditorProps {\n selectedDataSelector: string;\n selectedFormatterType: (typeof validFormatterTypes)[number];\n currentFormatterConfig: FormatterConfig;\n dataSelectors: UiConfig[];\n formatters: FormatterUiConfig[];\n showStaticTextColor?: boolean;\n onDataSelectorChange?: (evt: string, name: string, newDataSelector: string) => void;\n onFormatterTypeChange: (evt: string, name: string, newFormatter: string) => void;\n onFormatterConfigChange: FormatterChangeHandler<FormatterConfig>;\n defaultPalettesConfig: PalettesConfig;\n}\nconst formatterConfigPropType = T.oneOfType([\n T.arrayOf(\n T.shape({\n from: T.number,\n to: T.number,\n value: T.string,\n })\n ),\n T.arrayOf(\n T.shape({\n match: T.oneOfType([T.string, T.number]),\n value: T.string,\n })\n ),\n T.exact({\n colors: T.arrayOf(T.string).isRequired,\n stops: T.arrayOf(T.number),\n textColor: T.string,\n }),\n T.object,\n T.oneOf([null]),\n]) as T.Validator<FormatterConfig>;\n\nconst propTypes = {\n selectedDataSelector: T.string,\n selectedFormatterType: T.oneOf(validFormatterTypes),\n currentFormatterConfig: formatterConfigPropType,\n formatters: T.arrayOf(\n T.shape({\n label: T.string,\n value: T.string,\n defaults: T.object,\n isDefault: T.bool,\n })\n ),\n dataSelectors: T.arrayOf(\n T.shape({\n label: T.string,\n value: T.string,\n })\n ),\n onDataSelectorChange: T.func,\n onFormatterTypeChange: T.func,\n onFormatterConfigChange: T.func,\n defaultPalettesConfig: sharedPalettesConfigPropType,\n showStaticTextColor: T.bool,\n} as T.WeakValidationMap<FormatterEditorProps>;\n\nexport const FormatterEditor: React.FunctionComponent<FormatterEditorProps> = ({\n selectedDataSelector,\n selectedFormatterType,\n currentFormatterConfig,\n formatters = [],\n dataSelectors = [],\n onDataSelectorChange,\n onFormatterTypeChange,\n onFormatterConfigChange,\n defaultPalettesConfig,\n showStaticTextColor = false,\n}): React.ReactElement => {\n // if there's only 1 dataselector don't show a button group\n const showDataSelectorButtonGroup = dataSelectors.length > 1;\n const formatterSelectorLabel = showDataSelectorButtonGroup ? _('Method') : '';\n const filteredFormatters = formatters.filter(formatter => formatter.defaults?.[selectedDataSelector]);\n // same for formatters\n const showFormatterButtonGroup = filteredFormatters.length > 1;\n const FormatterConfigEditor = supportedFormatters[selectedFormatterType]?.editor;\n return (\n <>\n {showDataSelectorButtonGroup && (\n <RadioBarEditor\n name=\"dataSelector\"\n label={_('Based on')}\n data-test=\"FormatterEditorDataSelector\"\n values={dataSelectors}\n value={selectedDataSelector}\n onChange={onDataSelectorChange}\n />\n )}\n {showFormatterButtonGroup && (\n <RadioBarEditor\n name=\"formatterSelector\"\n label={formatterSelectorLabel}\n data-test=\"FormatterEditorFormatterSelector\"\n values={filteredFormatters}\n value={selectedFormatterType}\n onChange={onFormatterTypeChange}\n />\n )}\n <FormatterConfigEditor\n data-test=\"FormatterEditorConfigEditor\"\n name=\"formatterConfig\"\n value={currentFormatterConfig}\n onChange={onFormatterConfigChange}\n defaultPalettesConfig={defaultPalettesConfig}\n selectedDataSelector={selectedDataSelector}\n showStaticTextColor={selectedFormatterType === 'gradient' && showStaticTextColor}\n />\n </>\n );\n};\n\nFormatterEditor.propTypes = propTypes;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport Button from '@splunk/react-ui/Button';\nimport ArrowsRectangularDouble from '@splunk/react-icons/ArrowsRectangularDouble';\n\nconst AddStopWrapper = styled.div`\n display: flex;\n flex-direction: row;\n margin-bottom: 10px;\n`;\n\nconst AddStopButtonWrapper = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n`;\n\nconst ReverseStopWrapper = styled.div`\n display: flex;\n`;\n\nconst ButtonStyle = {\n marginRight: '12px',\n};\n\nconst reverseIcon = <ArrowsRectangularDouble />;\n\nconst AddAndReverseStops = ({\n disableAddStops = false,\n handleAddStop,\n handleReverse,\n}: {\n disableAddStops: boolean;\n handleAddStop: () => void;\n handleReverse: () => void;\n}): React.ReactElement => {\n return (\n <AddStopWrapper>\n <ReverseStopWrapper>\n <Button\n data-test=\"reverse-stops-button\"\n icon={reverseIcon}\n style={ButtonStyle}\n onClick={handleReverse}\n />\n </ReverseStopWrapper>\n <AddStopButtonWrapper>\n <Button\n data-test=\"add-stop-button\"\n appearance=\"secondary\"\n label={`+ ${_('Add stop')}`}\n disabled={disableAddStops}\n onClick={handleAddStop}\n />\n </AddStopButtonWrapper>\n </AddStopWrapper>\n );\n};\n\nAddAndReverseStops.propTypes = {\n disableAddStops: T.bool,\n handleAddStop: T.func,\n handleReverse: T.func,\n};\n\nexport default AddAndReverseStops;\n","import * as React from 'react';\nimport Color, { defaultPalette } from '@splunk/react-ui/Color';\n\ninterface GradientColorProps {\n color: string;\n colorIndex: number;\n palette: string[];\n onChange: (payload: { colorIndex: number; value: string }) => void;\n}\n\nconst GradientColor: React.FunctionComponent<GradientColorProps> = ({\n color,\n colorIndex,\n palette,\n onChange,\n}) => {\n const handleColorChange = React.useCallback(\n ({ value }: { value: string }): void => {\n if (\n value == null ||\n value === '' ||\n value.toLowerCase() === 'n/a' ||\n value.toLowerCase() === 'null'\n ) {\n return; // disallow n/a, null, or empty\n }\n onChange({ colorIndex, value });\n },\n [colorIndex, onChange]\n );\n\n return (\n <Color\n data-test={`gradient-color-${color}`}\n value={color}\n palette={palette || [...defaultPalette, 'transparent']}\n onChange={handleColorChange}\n hideInput\n />\n );\n};\n\nexport default GradientColor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport type { BasePreviewProps } from '../../../interfaces/BasePreviewProps';\nimport type { GradientConfig } from './gradientUtils';\nimport ArrowLayer from '../../../shared/ArrowLayer';\nimport PreviewWrapper from '../../../shared/PreviewWrapper';\n\n// Simple luminance calculation for hex colors\nfunction getLuminance(hex: string): number {\n let c = hex.replace('#', '');\n if (c.length === 3)\n c = c\n .split('')\n .map(x => x + x)\n .join('');\n const r = parseInt(c.substring(0, 2), 16) / 255;\n const g = parseInt(c.substring(2, 4), 16) / 255;\n const b = parseInt(c.substring(4, 6), 16) / 255;\n // Standard luminance formula\n return 0.299 * r + 0.587 * g + 0.114 * b;\n}\n\ninterface GradientPreviewProps extends BasePreviewProps {\n config: GradientConfig;\n}\n\nconst GradientPreview: React.FunctionComponent<GradientPreviewProps> = ({ config }) => {\n // Only renders once per test, as expected.\n const { colors = [] } = config || {};\n const gradientString = `linear-gradient(90deg, ${colors.join(', ')})`;\n\n // Calculate luminance for the first and last color for the arrows\n const firstColor = colors && colors.length > 0 ? colors[0] : '#fff';\n const lastColor = colors && colors.length > 1 ? colors[colors.length - 1] : firstColor;\n const luminanceFirst = getLuminance(firstColor);\n const luminanceLast = getLuminance(lastColor);\n const arrowDownColor = luminanceFirst > 0.5 ? '#000' : '#fff';\n const arrowUpColor = luminanceLast > 0.5 ? '#000' : '#fff';\n\n return (\n <PreviewWrapper>\n <ArrowLayer colorDown={arrowDownColor} colorUp={arrowUpColor} />\n <div\n data-test=\"gradient-color-preview\"\n style={{\n width: '100%',\n height: 18,\n borderRadius: 4,\n background: gradientString,\n }}\n />\n </PreviewWrapper>\n );\n};\n\nGradientPreview.propTypes = {\n config: T.any.isRequired,\n};\n\nexport default GradientPreview;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\nimport Text from '@splunk/react-ui/Text';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport Color from '@splunk/react-ui/Color';\n\nconst StyledControlGroup = styled(ControlGroup)`\n margin-bottom: 16px;\n width: 100%;\n`;\n\nconst TextColorContainer = styled.div`\n display: flex;\n align-items: stretch;\n width: 100%;\n position: relative;\n flex: 1 1 0%;\n`;\n\nconst TextColorWrapper = styled.div`\n display: flex;\n align-items: stretch;\n width: 100%;\n min-width: 0;\n box-sizing: border-box;\n position: relative;\n`;\n\nconst SwatchWrapper = styled.div`\n display: flex;\n align-items: stretch;\n height: 32px;\n flex: 0 0 32px;\n width: 32px;\n min-width: 32px;\n max-width: 32px;\n border-radius: 4px 0 0 4px;\n overflow: hidden;\n`;\n\nconst AutoSwatch = styled.div<{ color?: string; $isAuto?: boolean }>`\n width: 32px;\n height: 32px;\n border: 1px solid ${variables.borderColor};\n border-right: none;\n background: linear-gradient(135deg, #fff 50%, #000 50%);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n box-sizing: border-box;\n border-radius: 4px 0 0 4px;\n overflow: hidden;\n`;\n\nconst StyledText = styled(Text).attrs(({ name }) => ({\n 'data-test': name,\n}))`\n max-height: ${variables.inputHeight};\n width: 100%;\n min-width: 0;\n flex: 1 1 0%;\n border-radius: 0 4px 4px 0;\n border: 1px solid ${variables.borderColor};\n border-left: none;\n background: transparent;\n color: ${variables.contentColorActive};\n font-size: 14px;\n padding: 0 12px;\n height: 32px;\n outline: none;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n`;\n\nconst SwatchButton = styled.button`\n background: none;\n border: none;\n padding: 0;\n margin: 0;\n cursor: pointer;\n outline: none;\n display: flex;\n align-items: stretch;\n height: 32px;\n`;\n\nconst ClearButton = styled.button`\n background: none;\n border: none;\n color: ${variables.contentColorActive};\n font-size: 18px;\n cursor: pointer;\n position: absolute;\n right: 0;\n top: 0;\n height: 32px;\n width: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 2;\n /* Remove margin-left and margin-right to avoid shifting layout */\n padding: 0;\n`;\n\nconst AutoTextDisplay = styled.div`\n display: flex;\n align-items: center;\n padding: 0 12px;\n height: 32px;\n font-size: 14px;\n color: ${variables.contentColorActive};\n background: transparent;\n border: 1px solid ${variables.borderColor};\n border-left: none;\n border-radius: 0 4px 4px 0;\n min-width: 0;\n flex: 1 1 0%;\n box-sizing: border-box;\n`;\n\nconst AUTO_OPTION = 'auto';\nconst DEFAULT_PALETTE_COLOR = '#ffffff';\n\ninterface GradientTextColorProps {\n textColor: string;\n onTextColorChange: (color: string) => void;\n}\n\nconst GradientTextColor: React.FunctionComponent<GradientTextColorProps> = ({\n textColor,\n onTextColorChange,\n}) => {\n const [isAuto, setIsAuto] = React.useState(!textColor || textColor === AUTO_OPTION);\n const [color, setColor] = React.useState(isAuto ? '' : textColor || '');\n const colorRef = React.useRef<HTMLButtonElement | null>(null);\n\n React.useEffect(() => {\n setIsAuto(!textColor || textColor === AUTO_OPTION);\n setColor(!textColor || textColor === AUTO_OPTION ? '' : textColor);\n }, [textColor]);\n\n // Handle color swatch or color picker change\n const handleColorChange = React.useCallback(\n data => {\n const value = data?.value || '';\n if (value === AUTO_OPTION) {\n setIsAuto(true);\n setColor('');\n onTextColorChange(AUTO_OPTION);\n } else {\n setIsAuto(false);\n setColor(value);\n onTextColorChange(value);\n }\n },\n [onTextColorChange]\n );\n\n // Handle text input change\n const handleInputChange = React.useCallback(\n e => {\n const val = e.target.value;\n setColor(val);\n setIsAuto(false);\n onTextColorChange(val);\n },\n [onTextColorChange]\n );\n\n // Handle key press for text input\n const handleKeyPress = React.useCallback(\n event => {\n if (event.key === 'Escape') {\n setColor(textColor || '');\n }\n },\n [textColor]\n );\n\n // Handle clear button\n const handleClear = React.useCallback(() => {\n setColor('');\n setIsAuto(true);\n onTextColorChange(AUTO_OPTION);\n }, [onTextColorChange]);\n\n // When switching from auto to color, focus the color swatch\n React.useEffect(() => {\n if (!isAuto && colorRef.current) {\n colorRef.current.focus();\n }\n }, [isAuto]);\n\n return (\n <StyledControlGroup\n label={_('Static text color')}\n tooltip={_('Auto will choose black or white for text color to get more contrast')}\n style={{ width: '100%' }}\n >\n <TextColorContainer>\n {isAuto ? (\n <TextColorWrapper>\n <SwatchWrapper>\n <SwatchButton\n type=\"button\"\n aria-label={_('Choose text color')}\n onClick={() => {\n setIsAuto(false);\n setColor(DEFAULT_PALETTE_COLOR);\n onTextColorChange(DEFAULT_PALETTE_COLOR);\n }}\n tabIndex={0}\n >\n <AutoSwatch />\n </SwatchButton>\n </SwatchWrapper>\n <AutoTextDisplay data-test=\"gradient-text-color-auto\">{_('Auto')}</AutoTextDisplay>\n </TextColorWrapper>\n ) : (\n <TextColorWrapper>\n <SwatchWrapper>\n <Color\n key=\"gradient-text-color-editor\"\n value={color || ''}\n onChange={handleColorChange}\n hideInput\n append\n />\n </SwatchWrapper>\n <StyledText\n name=\"gradient-text-color-input\"\n value={color}\n onChange={handleInputChange}\n onKeyDown={handleKeyPress}\n />\n\n <ClearButton\n type=\"button\"\n aria-label={_('Clear text color')}\n onClick={handleClear}\n tabIndex={0}\n >\n ×\n </ClearButton>\n </TextColorWrapper>\n )}\n </TextColorContainer>\n </StyledControlGroup>\n );\n};\n\nGradientTextColor.propTypes = {\n textColor: T.string.isRequired,\n onTextColorChange: T.func.isRequired,\n};\n\nexport default GradientTextColor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { variables } from '@splunk/themes';\nimport { addCustomGradientStop, addPaletteGradientStop } from './gradientUtils';\nimport type { GradientConfig as GradientConfigType } from './gradientUtils';\nimport type { BaseEditorProps } from '../../../interfaces/BaseEditorProps';\nimport AddAndReverseStops from './AddAndReverseStops';\nimport GradientColor from './GradientColor';\nimport GradientTextColor from './GradientTextColor';\nimport RemoveStop from './RemoveStop';\n\nconst GradientValueConfigurerWrapper = styled.div`\n padding-top: 10px;\n`;\n\nconst GradientsWrapper = styled.div`\n display: flex;\n flex-direction: column-reverse;\n`;\n\nconst GradientEntry = styled.div.attrs((): { 'data-test': string } => ({\n 'data-test': 'gradient-entry-row',\n}))`\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-bottom: 10px;\n justify-content: space-between;\n`;\n\nconst GradientLeft = styled.div`\n display: flex;\n align-items: center;\n`;\n\nconst GradientLabel = styled.div`\n margin-left: 8px;\n color: ${variables.contentColorMuted};\n`;\n\ninterface GradientValueConfigurerProps extends BaseEditorProps {\n showStaticTextColor?: boolean;\n value: GradientConfigType;\n onChange: (payload: { colors: string[]; textColor?: string }) => void;\n isReversed?: boolean;\n swatchColors?: string[];\n setIsReversed?: (isReversed: boolean) => void;\n selectedColors: string[];\n isSwatchCustomized?: boolean;\n disableAddStops?: boolean; // <-- add this prop\n}\n\nconst GradientValueConfigurer: React.FC<GradientValueConfigurerProps> = props => {\n const {\n value,\n onChange,\n showStaticTextColor,\n isReversed,\n swatchColors,\n setIsReversed,\n selectedColors,\n isSwatchCustomized,\n disableAddStops: disableAddStopsProp,\n } = props;\n const textColor = value?.textColor;\n // state to track if addStops should be disabled\n const [disableAddStops, setDisableAddStops] = React.useState(false);\n // state to track interpolated vs chosen colors for custom state\n const [isCustomSelected, setIsCustomSelected] = React.useState(selectedColors.map(() => true));\n\n React.useEffect(() => {\n if (typeof disableAddStopsProp === 'boolean') {\n setDisableAddStops(disableAddStopsProp);\n return;\n }\n const shouldDisable = !isSwatchCustomized ? selectedColors.length >= swatchColors?.length : false;\n setDisableAddStops(shouldDisable);\n }, [isReversed, selectedColors, isSwatchCustomized, swatchColors?.length, disableAddStopsProp]);\n\n const handleTextColorChange = React.useCallback(\n newTextColor => {\n const payload: any = { colors: selectedColors, textColor: newTextColor };\n onChange(payload);\n },\n [selectedColors, onChange]\n );\n\n const handleRemoveStop = React.useCallback(\n (indexToRemove: number) => {\n // remove the color at the specified index\n const newColors = [...selectedColors].filter((unused, idx) => idx !== indexToRemove);\n const payload: any = { colors: newColors };\n onChange(payload);\n // remove the custom item\n if (isSwatchCustomized) {\n const newIsCustomSelected = isCustomSelected.filter((unused, idx) => idx !== indexToRemove);\n setIsCustomSelected(newIsCustomSelected);\n }\n },\n [selectedColors, onChange, isSwatchCustomized, isCustomSelected]\n );\n\n const handleAddStop = React.useCallback(() => {\n if (selectedColors.length === 1) {\n // If only one color, add black as the highest value\n const newColors = [selectedColors[0], '#000000'];\n const payload: any = { colors: newColors };\n onChange(payload);\n return;\n }\n if (!isSwatchCustomized) {\n // prevent adding more stops than swatchColors allows\n if (selectedColors.length >= swatchColors?.length) {\n setDisableAddStops(true);\n return;\n }\n const newColors = addPaletteGradientStop(swatchColors, selectedColors, isReversed);\n if (newColors) {\n const payload: any = { colors: newColors };\n onChange(payload);\n if (newColors.length >= swatchColors?.length) {\n setDisableAddStops(true);\n }\n }\n return;\n }\n // fallback to custom interpolation if not using a palette or palette is null/undefined\n const newColors = addCustomGradientStop(selectedColors, isCustomSelected, setIsCustomSelected);\n const payload: any = { colors: newColors };\n onChange(payload);\n }, [isSwatchCustomized, selectedColors, isCustomSelected, onChange, swatchColors, isReversed]);\n\n const handleReverse = React.useCallback(() => {\n const reversedColors = [...selectedColors].reverse();\n const payload: any = { colors: reversedColors };\n onChange(payload);\n setIsReversed?.(!isReversed);\n if (isSwatchCustomized) {\n const newIsCustomSelected = [...isCustomSelected].reverse();\n setIsCustomSelected(newIsCustomSelected);\n }\n }, [selectedColors, onChange, setIsReversed, isReversed, isSwatchCustomized, isCustomSelected]);\n\n const handleColorChange = React.useCallback(\n (payload: { colorIndex: number; value: string }): void => {\n const { colorIndex, value: newColor } = payload;\n const newSelectedColors = [...selectedColors];\n newSelectedColors[colorIndex] = newColor;\n onChange({ colors: newSelectedColors });\n if (isSwatchCustomized) {\n const newIsCustomSelected = [...isCustomSelected];\n newIsCustomSelected[colorIndex] = true;\n setIsCustomSelected(newIsCustomSelected);\n }\n },\n [isCustomSelected, isSwatchCustomized, onChange, selectedColors]\n );\n\n return (\n <GradientValueConfigurerWrapper data-test=\"gradient-configurer\">\n <AddAndReverseStops\n data-test=\"add-reverse-stops\"\n disableAddStops={disableAddStops}\n handleAddStop={handleAddStop}\n handleReverse={handleReverse}\n />\n <GradientsWrapper data-test=\"gradients-wrapper\">\n {selectedColors.map((color: string, i: number): React.ReactElement => {\n // render from highest (last) to lowest (first)\n let label = '';\n if (i === 0) label = _(`Lowest value`);\n else if (i === selectedColors.length - 1) label = _(`Highest value`);\n const canRemove = selectedColors.length > 2 && i !== 0 && i !== selectedColors.length - 1;\n // Use both color and index in the key to avoid duplicate key issues with duplicate colors\n return (\n // eslint-disable-next-line react/no-array-index-key\n <GradientEntry\n key={`gradient-color-${color.replace('#', '')}`}\n data-test={`gradient-entry-row-${i}`}\n >\n <GradientLeft data-test={`gradient-left-${i}`}>\n <GradientColor\n data-test={`gradient-color-${color}`}\n color={color}\n colorIndex={i}\n palette={isSwatchCustomized ? undefined : swatchColors}\n onChange={handleColorChange}\n />\n <GradientLabel data-test={`gradient-label-${i}`}>{label}</GradientLabel>\n </GradientLeft>\n {canRemove && (\n <RemoveStop\n data-test={`gradient-remove-button-${i}`}\n colorIndex={i}\n onRemove={() => handleRemoveStop(i)}\n />\n )}\n </GradientEntry>\n );\n })}\n </GradientsWrapper>\n {showStaticTextColor && (\n <GradientEntry data-test=\"gradient-text-color-entry\">\n <GradientTextColor\n data-test=\"gradient-text-color\"\n textColor={textColor}\n onTextColorChange={handleTextColorChange}\n />\n </GradientEntry>\n )}\n </GradientValueConfigurerWrapper>\n );\n};\n\nGradientValueConfigurer.propTypes = {\n value: T.any,\n onChange: T.func,\n showStaticTextColor: T.bool,\n};\n\nexport default GradientValueConfigurer;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport type { ButtonProps } from '@splunk/react-ui/Button';\nimport Button from '@splunk/react-ui/Button';\nimport CloseIcon from '@splunk/react-icons/Cross';\nimport { variables } from '@splunk/themes';\n\nconst RemoveStopWrapper = styled.div`\n width: 32px;\n height: 32px;\n align-self: flex-end;\n`;\n\nconst RemoveStopButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nconst RemoveStop = ({\n colorIndex,\n onRemove,\n}: {\n colorIndex: number;\n onRemove: (colorIdx: number) => void;\n}): React.ReactElement => {\n const handleOnRemove = React.useCallback((): void => onRemove(colorIndex), [colorIndex, onRemove]);\n\n return (\n <RemoveStopWrapper>\n <RemoveStopButton\n data-test=\"gradient-remove-button\"\n icon={<CloseIcon />}\n appearance=\"subtle\"\n onClick={handleOnRemove}\n />\n </RemoveStopWrapper>\n );\n};\n\nRemoveStop.propTypes = {\n onRemove: T.func,\n};\n\nexport default RemoveStop;\n","import palettes from '@splunk/visualization-color-palettes/editors/PresetPalettes';\nimport type { PalettesConfig } from '../../../interfaces/PalettesConfig';\nimport type { Palettes, PaletteEntry } from '../Palettes/paletteUtils';\n\nexport interface GradientConfig {\n colors: string[];\n stops?: number[];\n textColor?: string;\n}\n\nexport const defaultDarkGradientConfig: GradientConfig = {\n colors: [\n palettes.DARK_COLORS.sequential.swatches[1][0],\n palettes.DARK_COLORS.sequential.swatches[1][palettes.DARK_COLORS.sequential.swatches[1].length - 1],\n ],\n};\n\nexport const defaultLightGradientConfig: GradientConfig = {\n colors: [\n palettes.LIGHT_COLORS.sequential.swatches[1][0],\n palettes.LIGHT_COLORS.sequential.swatches[1][palettes.LIGHT_COLORS.sequential.swatches[1].length - 1],\n ],\n};\n\n/**\n * Creates a default palette configuration with proper fallbacks\n * paletteTheme: DARK_COLORS || providedPaletteTheme\n * paletteEntry: {\n * type: 'sequential' || providedType\n * index: 1 || providedIndex\n * }\n */\nexport const createDefaultPalettesConfig = (providedConfig?: PalettesConfig): PalettesConfig => {\n const paletteTheme = providedConfig?.paletteTheme || 'DARK_COLORS';\n const type = providedConfig?.paletteEntry?.type || 'sequential';\n const index = providedConfig?.paletteEntry?.index ?? 1;\n\n return {\n paletteTheme,\n paletteEntry: {\n type,\n index,\n },\n };\n};\n\n/**\n * Creates a gradient config based on the provided palettes configuration\n * If only paletteTheme is provided, uses the 2nd item (index 1) in the sequential type\n * If all items are provided, uses that specific configuration\n * For gradients, only uses the first and last colors from the selected palette\n */\nexport const createGradientConfigFromPalettes = (\n palettesConfig?: PalettesConfig,\n showTextColor?: boolean,\n textColor?: string\n): GradientConfig => {\n const defaultedConfig = createDefaultPalettesConfig(palettesConfig);\n const { paletteTheme, paletteEntry } = defaultedConfig;\n\n const paletteColors =\n palettes[paletteTheme]?.[paletteEntry.type]?.swatches?.[paletteEntry.index] ||\n defaultDarkGradientConfig.colors;\n\n // For gradients, only use the first and last colors from the palette\n const colors =\n paletteColors.length >= 2\n ? [paletteColors[0], paletteColors[paletteColors.length - 1]]\n : paletteColors;\n\n if (!showTextColor) {\n return {\n colors,\n };\n }\n return {\n colors,\n textColor: textColor || 'auto',\n };\n};\n// Find the best position to insert the new color (largest gap)\n\n/**\n * Interpolates between two hex colors\n * @param color1 - First hex color (e.g., \"#FF0000\")\n * @param color2 - Second hex color (e.g., \"#00FF00\")\n * @param factor - Interpolation factor between 0 and 1\n * @returns Interpolated hex color\n */\nexport const interpolateColor = (color1: string, color2: string, factor: number): string => {\n // Remove # and convert to RGB\n const hex1 = color1.replace('#', '');\n const hex2 = color2.replace('#', '');\n\n const r1 = parseInt(hex1.substring(0, 2), 16);\n const g1 = parseInt(hex1.substring(2, 4), 16);\n const b1 = parseInt(hex1.substring(4, 6), 16);\n\n const r2 = parseInt(hex2.substring(0, 2), 16);\n const g2 = parseInt(hex2.substring(2, 4), 16);\n const b2 = parseInt(hex2.substring(4, 6), 16);\n\n // Interpolate each channel\n const r = Math.round(r1 + factor * (r2 - r1));\n const g = Math.round(g1 + factor * (g2 - g1));\n const b = Math.round(b1 + factor * (b2 - b1));\n\n // Convert back to hex\n const toHex = (n: number) => n.toString(16).padStart(2, '0');\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n};\n\nexport const addCustomGradientStop = (\n colors: string[],\n isCustomSelected: boolean[],\n setIsCustomSelected: (selected: boolean[]) => void\n): string[] => {\n if (colors.length < 2) {\n return colors;\n }\n\n // find all indices where isCustomSelected is true\n const customIndices = isCustomSelected.map((v, i) => (v ? i : -1)).filter(i => i !== -1);\n\n // if there are less than 2 custom points, fallback to default behavior (interpolate before highest)\n if (customIndices.length < 2) {\n const highestColor = colors[colors.length - 1];\n const beforeHighestColor = colors[colors.length - 2];\n const newColor = interpolateColor(beforeHighestColor, highestColor, 0.5);\n const newColors = [...colors.slice(0, colors.length - 1), newColor, highestColor];\n const newIsCustomSelected = [\n ...isCustomSelected.slice(0, isCustomSelected.length - 1),\n false,\n isCustomSelected[isCustomSelected.length - 1] ?? false,\n ];\n setIsCustomSelected(newIsCustomSelected);\n return newColors;\n }\n\n // for each pair of custom indices, interpolate all falses between them\n let newColors = [...colors];\n let newIsCustomSelected = [...isCustomSelected];\n for (let i = 0; i < customIndices.length - 1; i += 1) {\n const startIdx = customIndices[i];\n const endIdx = customIndices[i + 1];\n const segmentLength = endIdx - startIdx;\n\n // only interpolate if there are any falses between startIdx and endIdx\n if (segmentLength > 1) {\n const colorA = colors[startIdx];\n const colorB = colors[endIdx];\n\n // Count how many falses are between startIdx and endIdx\n const falseIndices: number[] = [];\n for (let j = startIdx + 1; j < endIdx; j += 1) {\n if (!isCustomSelected[j]) {\n falseIndices.push(j);\n }\n }\n\n // If there are any falses, recalculate their colors\n if (falseIndices.length > 0) {\n for (let m = 0; m < falseIndices.length; m += 1) {\n const idx = falseIndices[m];\n // Evenly space the interpolation for each false\n const t = (idx - startIdx) / (endIdx - startIdx);\n newColors[idx] = interpolateColor(colorA, colorB, t);\n }\n }\n }\n }\n\n // Always insert a new interpolated color before the last color\n const highestColor = newColors[newColors.length - 1];\n const beforeHighestColor = newColors[newColors.length - 2];\n const newColor = interpolateColor(beforeHighestColor, highestColor, 0.5);\n newColors = [...newColors.slice(0, newColors.length - 1), newColor, highestColor];\n newIsCustomSelected = [\n ...newIsCustomSelected.slice(0, newIsCustomSelected.length - 1),\n false,\n newIsCustomSelected[newIsCustomSelected.length - 1] ?? false,\n ];\n\n setIsCustomSelected(newIsCustomSelected);\n return newColors;\n};\n\n/**\n * Adds a palette color at the specified insert index.\n * @param swatch The full palette swatch array.\n * @param selectedColors The current array of selected colors.\n * @param isReversed If true, reverse the swatch before picking the color.\n * @returns The new colors array with the palette color inserted.\n */\nexport const addPaletteGradientStop = (\n swatch: string[],\n selectedColors: string[],\n isReversed: boolean\n): string[] => {\n const insertIndex = selectedColors.length - 1; // Insert before the last color\n // Only allow up to insertIndex <= 5\n if (insertIndex > 5) {\n return selectedColors;\n }\n const palette = isReversed ? [...swatch].reverse() : swatch;\n // Clamp insertIndex to valid palette range\n const idx = Math.max(1, Math.min(insertIndex, palette.length - 2));\n const colorToAdd = palette[idx];\n return [...selectedColors.slice(0, insertIndex), colorToAdd, ...selectedColors.slice(insertIndex)];\n};\n\n// Find a palette match, considering both normal and reversed order\nexport const findMatchingPaletteGradient = (\n colorArr: string[],\n paletteObj: Palettes\n): {\n paletteTheme: string;\n paletteEntry: { type: string; index: number };\n isReversed: boolean;\n} | null => {\n if (\n !Array.isArray(colorArr) ||\n colorArr.length < 2 ||\n !paletteObj ||\n typeof paletteObj !== 'object' ||\n !paletteObj.DARK_COLORS ||\n !paletteObj.LIGHT_COLORS\n ) {\n return null;\n }\n const themes = ['DARK_COLORS', 'LIGHT_COLORS'];\n const candidates: Array<{\n paletteTheme: string;\n paletteEntry: { type: string; index: number };\n isReversed: boolean;\n swatch: string[];\n }> = [];\n themes.forEach(theme => {\n const themePalettes = paletteObj[theme];\n if (!themePalettes) {\n return;\n }\n const entries = Object.entries(themePalettes)\n .filter(([type]) => type !== '_meta')\n .flatMap(([type, entry]) => {\n const { swatches } = entry as PaletteEntry;\n return swatches.map((swatch, i) => ({ type, swatch, index: i }));\n });\n entries.forEach(({ type, swatch, index }) => {\n // Skip if the color array has more colors than the swatch can provide\n if (colorArr.length > swatch.length) {\n return;\n }\n\n if (\n swatch.length >= 2 &&\n swatch[0].trim().toLowerCase() === colorArr[0].trim().toLowerCase() &&\n swatch[swatch.length - 1].trim().toLowerCase() ===\n colorArr[colorArr.length - 1].trim().toLowerCase()\n ) {\n candidates.push({\n paletteTheme: theme,\n paletteEntry: { type, index },\n isReversed: false,\n swatch,\n });\n } else if (\n swatch.length >= 2 &&\n swatch[0].trim().toLowerCase() === colorArr[colorArr.length - 1].trim().toLowerCase() &&\n swatch[swatch.length - 1].trim().toLowerCase() === colorArr[0].trim().toLowerCase()\n ) {\n candidates.push({\n paletteTheme: theme,\n paletteEntry: { type, index },\n isReversed: true,\n swatch,\n });\n }\n });\n });\n // If more than 2 colors, prefer full match (middle colors can be any order)\n if (colorArr.length > 2 && candidates.length > 0) {\n const fullMatch = candidates.find(({ swatch, isReversed }) => {\n if (swatch.length < colorArr.length) return false;\n const compareArr = isReversed ? [...swatch].reverse() : swatch;\n // Endpoints must match\n if (\n colorArr[0].trim().toLowerCase() !== compareArr[0].trim().toLowerCase() ||\n colorArr[colorArr.length - 1].trim().toLowerCase() !==\n compareArr[compareArr.length - 1].trim().toLowerCase()\n ) {\n return false;\n }\n // Middle colors can be any order\n const inputMiddle = colorArr.slice(1, colorArr.length - 1).map(c => c.trim().toLowerCase());\n const swatchMiddle = compareArr.slice(1, colorArr.length - 1).map(c => c.trim().toLowerCase());\n return inputMiddle.every(c => swatchMiddle.includes(c));\n });\n if (fullMatch) {\n return {\n paletteTheme: fullMatch.paletteTheme,\n paletteEntry: fullMatch.paletteEntry,\n isReversed: fullMatch.isReversed,\n };\n }\n }\n // Otherwise, return first high/low match\n if (candidates.length > 0) {\n const first = candidates[0];\n return {\n paletteTheme: first.paletteTheme,\n paletteEntry: first.paletteEntry,\n isReversed: first.isReversed,\n };\n }\n return null;\n};\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport defaultPalettes from '@splunk/visualization-color-palettes/editors/PresetPalettes';\nimport type { BaseEditorProps } from '../../interfaces/BaseEditorProps';\nimport type { PalettesConfig } from '../../interfaces/PalettesConfig';\nimport PalettesConfigurer from './Palettes/PalettesConfigurer';\nimport { findMatchingPaletteGradient } from './Gradient/gradientUtils';\nimport type { GradientConfig as GradientConfigType } from './Gradient/gradientUtils';\nimport { getSwatchColorsFromPalette, hasCustomColors } from './Palettes/paletteUtils';\nimport type { Palettes, PaletteInfo } from './Palettes/paletteUtils';\nimport GradientValueConfigurer from './Gradient/GradientValueConfigurer';\n\ninterface GradientEditorProps extends BaseEditorProps {\n defaultPalettesConfig?: PalettesConfig;\n showStaticTextColor?: boolean;\n value: GradientConfigType;\n palettes?: Palettes;\n selectedDataSelector?: string;\n onChange: (event: React.SyntheticEvent, name: string, value: GradientConfigType) => void;\n}\n\nexport const GradientEditor: React.FunctionComponent<GradientEditorProps> = ({\n defaultPalettesConfig = { paletteTheme: 'DARK_COLORS', paletteEntry: { type: 'sequential', index: 1 } },\n onChange,\n palettes = defaultPalettes,\n showStaticTextColor = false,\n selectedDataSelector,\n value = { colors: ['#252214', '#b846bb'], textColor: 'auto' },\n}) => {\n const { colors, textColor } = value;\n // Get initial palette config and reversed state from findMatchingPaletteGradient\n let initialPaletteTheme: string | null = null;\n let initialPaletteEntry: PaletteInfo | null = null;\n let initialIsReversed: boolean | undefined;\n if (colors && colors.length > 1) {\n const match = findMatchingPaletteGradient(colors, palettes);\n if (match) {\n initialPaletteTheme = match.paletteTheme;\n initialPaletteEntry = match.paletteEntry;\n initialIsReversed = match.isReversed;\n }\n }\n // Fallbacks if no match\n if (!initialPaletteTheme && defaultPalettesConfig?.paletteTheme) {\n initialPaletteTheme = defaultPalettesConfig.paletteTheme;\n }\n if (!initialPaletteEntry && defaultPalettesConfig?.paletteEntry) {\n initialPaletteEntry = defaultPalettesConfig.paletteEntry;\n }\n\n const [palettesConfig, setPalettesConfig] = React.useState<{\n paletteTheme: string;\n paletteEntry: PaletteInfo;\n }>(() => ({\n paletteTheme: initialPaletteTheme,\n paletteEntry: initialPaletteEntry,\n }));\n const selectedPaletteTheme = palettesConfig?.paletteTheme ?? defaultPalettesConfig.paletteTheme;\n const selectedPaletteEntry = palettesConfig?.paletteEntry ?? defaultPalettesConfig.paletteEntry;\n\n // Only get swatch colors if palette is selected\n const currentSwatchColors =\n selectedPaletteTheme && selectedPaletteEntry\n ? getSwatchColorsFromPalette({\n palettes,\n paletteInfo: selectedPaletteEntry,\n paletteTheme: selectedPaletteTheme,\n })\n : [];\n\n const isSwatchCustomized = hasCustomColors({\n currentSwatchColors,\n selectedColors: colors,\n });\n\n // Limit custom colors to MAX_CUSTOM_COLORS\n const MAX_CUSTOM_COLORS = 7;\n const limitedColors =\n isSwatchCustomized && colors.length > MAX_CUSTOM_COLORS ? colors.slice(0, MAX_CUSTOM_COLORS) : colors;\n\n // Disable add stop if custom and at max\n const disableAddStops =\n (isSwatchCustomized && limitedColors.length >= MAX_CUSTOM_COLORS) ||\n (!isSwatchCustomized && limitedColors.length >= currentSwatchColors.length);\n\n const [isReversed, setIsReversed] = React.useState(initialIsReversed || false);\n\n // Always align to palette: lowest at index 0, highest at last index\n\n type OnChangePaletteTheme = (newPaletteTheme: string) => void;\n\n const handleOnGradientValueChange = React.useCallback(\n (payload: { colors?: string[]; textColor?: string }): void => {\n // Defensive: always pass a valid colors array\n const result: { colors: string[]; textColor?: string } = {\n colors: payload?.colors || colors,\n };\n if (showStaticTextColor) {\n result.textColor = payload.textColor || textColor;\n }\n onChange(null, null, result);\n },\n [colors, showStaticTextColor, onChange, textColor]\n );\n\n const onChangePaletteTheme: OnChangePaletteTheme = React.useCallback(\n (newPaletteTheme: string): void => {\n if (!selectedPaletteEntry) return;\n let swatch: string[] = getSwatchColorsFromPalette({\n palettes,\n paletteInfo: selectedPaletteEntry,\n paletteTheme: newPaletteTheme,\n });\n if (isReversed) {\n swatch = [...swatch].reverse();\n }\n let newColors: string[] = [];\n if (isSwatchCustomized && colors.length > 7) {\n newColors = swatch.slice();\n } else {\n const count: number = colors.length;\n if (count === 1) {\n newColors = [swatch[swatch.length - 1]];\n } else if (count === 2) {\n newColors = [swatch[0], swatch[swatch.length - 1]];\n } else if (count > 2) {\n newColors = [swatch[0]];\n for (let i = 1; i < count - 1; i += 1) {\n newColors.push(swatch[i]);\n }\n newColors.push(swatch[swatch.length - 1]);\n }\n }\n setPalettesConfig(prev => ({ ...prev, paletteTheme: newPaletteTheme }));\n handleOnGradientValueChange({ colors: newColors });\n },\n [selectedPaletteEntry, palettes, isReversed, handleOnGradientValueChange, isSwatchCustomized, colors]\n );\n\n const onPaletteChange = React.useCallback(\n (paletteInfo: PaletteInfo | null) => {\n if (!paletteInfo) {\n setPalettesConfig({ paletteTheme: null, paletteEntry: null });\n setIsReversed(false);\n return;\n }\n const swatch =\n selectedPaletteTheme && paletteInfo\n ? getSwatchColorsFromPalette({\n palettes,\n paletteInfo,\n paletteTheme: selectedPaletteTheme,\n })\n : [];\n const count = colors.length;\n let newColors: string[] = [];\n if (isSwatchCustomized && colors.length > 7) {\n newColors = swatch.slice();\n } else if (count === 1) {\n newColors = [swatch[swatch.length - 1]];\n } else if (count === 2) {\n newColors = [swatch[0], swatch[swatch.length - 1]];\n } else if (count > 2) {\n newColors = [swatch[0]];\n for (let i = 1; i < count - 1; i += 1) {\n newColors.push(swatch[i]);\n }\n newColors.push(swatch[swatch.length - 1]);\n }\n setPalettesConfig({ paletteTheme: selectedPaletteTheme, paletteEntry: paletteInfo });\n setIsReversed(false);\n const payload: any = { colors: newColors };\n if (showStaticTextColor) {\n payload.textColor = textColor;\n }\n handleOnGradientValueChange(payload);\n },\n [\n selectedPaletteTheme,\n palettes,\n showStaticTextColor,\n handleOnGradientValueChange,\n textColor,\n isSwatchCustomized,\n colors,\n ]\n );\n // if the user changes the dataSelector (e.g. from major to trend) for something like background coloring,\n // reinitialize the palette config and the initial range values + colors using the newly selected formatter config (value)\n React.useEffect((): void => {\n setPalettesConfig(findMatchingPaletteGradient(colors, palettes));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedDataSelector]);\n\n return (\n <>\n <PalettesConfigurer\n isSwatchCustomized={isSwatchCustomized}\n isReversed={isReversed}\n onChangePaletteTheme={onChangePaletteTheme}\n onPaletteChange={onPaletteChange}\n palettes={palettes}\n selectedPaletteInfo={selectedPaletteEntry}\n selectedPaletteTheme={selectedPaletteTheme}\n />\n <GradientValueConfigurer\n isSwatchCustomized={isSwatchCustomized}\n isReversed={isReversed}\n setIsReversed={setIsReversed}\n onChange={handleOnGradientValueChange}\n value={value}\n swatchColors={currentSwatchColors}\n selectedColors={limitedColors}\n name=\"GradientValueConfigurer\"\n showStaticTextColor={showStaticTextColor}\n disableAddStops={disableAddStops}\n />\n </>\n );\n};\n\nGradientEditor.propTypes = {\n value: T.any,\n onChange: T.func,\n palettes: T.shape({\n _meta: T.any.isRequired,\n }),\n showStaticTextColor: T.bool,\n};\n\nexport default GradientEditor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport Button from '@splunk/react-ui/Button';\nimport ArrowsRectangularDouble from '@splunk/react-icons/ArrowsRectangularDouble';\n\nconst AddMatchWrapper = styled.div`\n display: flex;\n flex-direction: row;\n margin-bottom: 10px;\n`;\n\nconst AddMatchButtonWrapper = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n`;\n\nconst ReverseMatchWrapper = styled.div`\n display: flex;\n`;\n\nconst reverseMatchButtonStyle = { marginRight: '12px' };\n\nconst reverseIcon = <ArrowsRectangularDouble />;\n\nconst AddAndReverseMatches = ({\n disableAddMatches = false,\n handleAddMatch,\n handleReverse,\n}: {\n disableAddMatches: boolean;\n handleAddMatch: () => void;\n handleReverse: () => void;\n}): React.ReactElement => {\n return (\n <AddMatchWrapper>\n <ReverseMatchWrapper>\n <Button\n data-test=\"reverse-matches-button\"\n icon={reverseIcon}\n style={reverseMatchButtonStyle}\n onClick={handleReverse}\n />\n </ReverseMatchWrapper>\n <AddMatchButtonWrapper>\n <Button\n data-test=\"add-match-button\"\n appearance=\"secondary\"\n label={`+ ${_('Add match')}`}\n disabled={disableAddMatches}\n onClick={handleAddMatch}\n />\n </AddMatchButtonWrapper>\n </AddMatchWrapper>\n );\n};\n\nAddAndReverseMatches.propTypes = {\n disableAddMatches: T.bool,\n handleAddMatch: T.func,\n handleReverse: T.func,\n};\n\nexport default AddAndReverseMatches;\n","import * as React from 'react';\nimport Color from '@splunk/react-ui/Color';\n\nconst MatchColor = ({\n color,\n colorIndex,\n onChange,\n palette,\n}: {\n color: string;\n colorIndex: number;\n onChange: (payload: { colorIndex: number; value: string }) => void;\n palette: string[];\n}): React.ReactElement => {\n const handleColorChange = React.useCallback(\n ({ value }): void => {\n let nextValue = value;\n if (nextValue == null || nextValue === '') {\n nextValue = 'transparent';\n }\n onChange({ colorIndex, value: nextValue });\n },\n [colorIndex, onChange]\n );\n\n return (\n <Color\n data-test={`match-color-${color}`}\n value={color}\n palette={palette}\n onChange={handleColorChange}\n hideInput // prisma only\n />\n );\n};\n\nexport default MatchColor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { getNewColors } from '../Palettes/paletteUtils';\nimport AddAndReverseMatches from './AddAndReverseMatches';\n\nimport MatchColor from './MatchColor';\nimport MatchValueText from './MatchValueText';\nimport { isNumeric } from './matchValueUtils';\nimport RemoveMatch from './RemoveMatch';\n\nconst MatchValueConfigurerWrapper = styled.div`\n padding-top: 10px;\n`;\n\nconst MatchesWrapper = styled.div`\n display: flex;\n flex-direction: column-reverse;\n`;\n\nconst MatchEntry = styled.div.attrs((): { 'data-test': string } => ({\n 'data-test': 'match-entry-row',\n}))`\n display: flex;\n flex-direction: row;\n margin-bottom: 10px;\n`;\n\nconst MatchValueConfigurer = ({\n // while this could be calculated inside the MatchValueConfigurer directly,\n // the palette dropdown also needs to know if the swatch was customized\n // it was more convenient to hoist up customizedColors than recalculating it in the child components\n customizedColors,\n isReversed,\n onChange,\n precedence,\n swatchColors,\n matchValues,\n setIsReversed,\n selectedColors,\n}: {\n customizedColors: boolean;\n isReversed: boolean;\n onChange: (payload: { colors: string[]; matchValues: (string | number)[] }) => void;\n precedence: number[][];\n swatchColors: string[];\n matchValues: (string | number)[];\n setIsReversed: (payload: boolean) => void;\n selectedColors: string[];\n}): React.ReactElement => {\n const handleColorChange = React.useCallback(\n ({ colorIndex, value }): void => {\n const newSelectedColors = [...selectedColors];\n newSelectedColors[colorIndex] = value;\n onChange({ colors: newSelectedColors, matchValues });\n },\n [onChange, matchValues, selectedColors]\n );\n\n const handleAddMatch = React.useCallback((): void => {\n // Can add as many empty matches, per PM discussion, so this is commented.\n // if(matchValues.some(match => match === '')) return;\n const newMatchValues = [...matchValues, ''];\n const newSelectedColors = customizedColors\n ? [...selectedColors, '#000000'] // insert black color as per design if colors are customized\n : getNewColors({\n isReversed,\n // number of colors = number of matches\n numColors: newMatchValues.length,\n precedence,\n swatchColors,\n });\n onChange({ colors: newSelectedColors, matchValues: newMatchValues });\n }, [onChange, matchValues, customizedColors, selectedColors, isReversed, precedence, swatchColors]);\n\n const handleReverse = React.useCallback((): void => {\n const newColors = [...selectedColors];\n newColors.reverse();\n setIsReversed(!isReversed);\n onChange({ colors: newColors, matchValues });\n }, [onChange, matchValues, isReversed, selectedColors, setIsReversed]);\n\n const handleUpdateMatch = React.useCallback(\n (updatedValue, matchIndex): { error: string } => {\n // Evaluates whether the inputted value should be treated as a number for matching.\n const value = isNumeric(updatedValue) ? Number(updatedValue) : updatedValue;\n if (matchValues.includes(value)) {\n return { error: _('Value already exists') };\n }\n const newMatchValues = [...matchValues];\n newMatchValues[matchIndex] = value;\n onChange({ colors: selectedColors, matchValues: newMatchValues });\n return { error: null };\n },\n [onChange, selectedColors, matchValues]\n );\n\n const handleRemoveMatch = React.useCallback(\n (colorIndex: number, matchIndex: number): void => {\n if (matchValues.length > 1) {\n const newMatchValues = [...matchValues];\n newMatchValues.splice(matchIndex, 1);\n\n // check if there are still custom colors after the user removes the current one\n const newSelectedColorsWithCurrentOmitted = [...selectedColors];\n newSelectedColorsWithCurrentOmitted.splice(colorIndex, 1);\n onChange({ colors: newSelectedColorsWithCurrentOmitted, matchValues: newMatchValues });\n }\n },\n [onChange, matchValues, selectedColors]\n );\n\n return (\n <MatchValueConfigurerWrapper>\n <AddAndReverseMatches\n disableAddMatches={selectedColors.length > 6}\n handleAddMatch={handleAddMatch}\n handleReverse={handleReverse}\n />\n <MatchesWrapper>\n {selectedColors.map((color: string, i: number): React.ReactElement => {\n const matchValue = matchValues[i];\n const key = `${color}-${matchValue}-${i}`;\n\n return (\n <MatchEntry key={key}>\n <MatchColor\n color={color}\n colorIndex={i}\n palette={swatchColors}\n onChange={handleColorChange}\n />\n <MatchValueText\n initialValue={matchValue}\n matchValues={matchValues}\n matchIndex={i}\n updateMatch={handleUpdateMatch}\n />\n <RemoveMatch\n colorIndex={i}\n matchIndex={i}\n disabled={matchValues.length < 2}\n onRemove={handleRemoveMatch}\n />\n </MatchEntry>\n );\n })}\n </MatchesWrapper>\n </MatchValueConfigurerWrapper>\n );\n};\n\nMatchValueConfigurer.propTypes = {\n customizedColors: T.bool,\n isReversed: T.bool,\n precedence: T.arrayOf(T.arrayOf(T.number)),\n swatchColors: T.arrayOf(T.string),\n matchValues: T.arrayOf(T.oneOfType([T.string, T.number])),\n setIsReversed: T.func,\n selectedColors: T.arrayOf(T.string),\n};\n\nexport default MatchValueConfigurer;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport Text from '@splunk/react-ui/Text';\nimport variables from '@splunk/themes/variables';\n\nconst MatchTextWrapper = styled.div`\n display: flex;\n flex-grow: 1;\n margin-left: ${variables.spacingMedium};\n`;\n\nconst TextRowWrapper = styled.div`\n flex-grow: 1;\n`;\n\nconst MatchErrorMessage = styled.div.attrs((): { 'data-test': string } => ({\n 'data-test': 'match-value-error',\n}))`\n color: ${variables.contentColorNegative};\n padding-top: 5px;\n font-size: 12px;\n display: block;\n`;\n\nexport const handleUpdateMatch = ({\n matchIndex,\n setError,\n shouldUpdate,\n updateMatch,\n value,\n}: {\n matchIndex: number;\n setError: (payload: string) => void;\n shouldUpdate: boolean;\n updateMatch: (payload: number | string, idx: number) => { error: string };\n value: number | string;\n}): void => {\n if (shouldUpdate) {\n const result = updateMatch(value, matchIndex);\n if (result && result.error) {\n setError(result.error);\n }\n }\n};\n\nconst MatchValueText = ({\n initialValue,\n matchIndex,\n matchValues,\n updateMatch,\n}: {\n initialValue?: number | string;\n matchIndex: number;\n matchValues: (string | number)[];\n updateMatch: (value: number | string, index: number) => { error: string };\n}): React.ReactElement => {\n const [updatedMatchValue, setUpdatedMatchValue] = React.useState(null);\n const [isFocused, setIsFocused] = React.useState(false);\n const [error, setError] = React.useState(null);\n\n const handleOnFocus = React.useCallback((): void => {\n setIsFocused(true);\n }, []);\n\n const handleOnChange = React.useCallback(\n (e, { value }: { e: React.KeyboardEvent<HTMLDivElement>; value: string }): void => {\n setUpdatedMatchValue(value);\n handleUpdateMatch({\n matchIndex,\n setError,\n shouldUpdate: !isFocused,\n updateMatch,\n value,\n });\n },\n [isFocused, matchIndex, updateMatch]\n );\n\n const handleOnBlur = React.useCallback((): void => {\n setIsFocused(false);\n handleUpdateMatch({\n matchIndex,\n setError,\n shouldUpdate: updatedMatchValue != null && updatedMatchValue !== initialValue,\n updateMatch,\n value: updatedMatchValue,\n });\n }, [matchIndex, updatedMatchValue, initialValue, updateMatch]);\n\n const handleOnKeyUp = React.useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>): void =>\n handleUpdateMatch({\n matchIndex,\n setError,\n shouldUpdate:\n e.key === 'Enter' && updatedMatchValue !== null && updatedMatchValue !== initialValue,\n updateMatch,\n value: updatedMatchValue,\n }),\n [matchIndex, updatedMatchValue, initialValue, updateMatch]\n );\n\n // if changes made to match values by editing an adjacent value to address the duplication,\n // clear the error state and persist the currently state value if the current state value would not cause duplication\n React.useEffect((): void => {\n // Added .map since values may be numbers.\n if (error && !matchValues.map(value => `${value}`).includes(updatedMatchValue)) {\n setError(null);\n handleUpdateMatch({\n matchIndex,\n setError,\n shouldUpdate: true,\n updateMatch,\n value: updatedMatchValue,\n });\n }\n }, [updatedMatchValue, error, matchIndex, matchValues, updateMatch]);\n\n return (\n <MatchTextWrapper>\n <TextRowWrapper>\n <Text\n data-test=\"match-text-editor\"\n canClear={false}\n error={!!error}\n onChange={handleOnChange}\n onFocus={handleOnFocus}\n onBlur={handleOnBlur}\n onKeyUp={handleOnKeyUp}\n value={`${updatedMatchValue ?? initialValue}`}\n />\n {error && <MatchErrorMessage>{error}</MatchErrorMessage>}\n </TextRowWrapper>\n </MatchTextWrapper>\n );\n};\n\nMatchValueText.propTypes = {\n initialValue: T.oneOfType([T.string, T.number]),\n matchValues: T.arrayOf(T.oneOfType([T.string, T.number])),\n updateMatch: T.func,\n};\n\nexport default MatchValueText;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport type { ButtonProps } from '@splunk/react-ui/Button';\nimport Button from '@splunk/react-ui/Button';\nimport CloseIcon from '@splunk/react-icons/Cross';\nimport { variables } from '@splunk/themes';\n\nconst RemoveMatchWrapper = styled.div`\n display: flex;\n flex: 1;\n justify-content: flex-end;\n`;\n\nconst RemoveMatchButton = styled(Button)<ButtonProps>`\n color: ${props =>\n props.disabled ? variables.contentColorDisabled : variables.contentColorActive} !important;\n &:hover {\n background-color: ${props => !props.disabled && variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nconst RemoveMatch = ({\n colorIndex,\n disabled = false,\n onRemove,\n matchIndex,\n}: {\n colorIndex: number;\n disabled?: boolean;\n onRemove: (colorIdx: number, matchIdx: number) => void;\n matchIndex: number;\n}): React.ReactElement => {\n const handleOnRemove = React.useCallback(\n (): void => onRemove(colorIndex, matchIndex),\n [colorIndex, onRemove, matchIndex]\n );\n\n return (\n <RemoveMatchWrapper>\n <div>\n <RemoveMatchButton\n data-test=\"match-remove-button\"\n disabled={disabled}\n icon={<CloseIcon />}\n appearance=\"subtle\"\n onClick={handleOnRemove}\n />\n </div>\n </RemoveMatchWrapper>\n );\n};\n\nRemoveMatch.propTypes = {\n disabled: T.bool,\n onRemove: T.func,\n};\n\nexport default RemoveMatch;\n","import { isEmpty } from 'lodash';\nimport type { MatchesConfig } from '@splunk/visualization-encoding/formatters/MatchValue';\n\n/*\n * @method getMatches\n * @params {Array} matches\n * @return {Array} matches or an initialized match array by default\n */\nexport const getMatches = (matches = []): MatchesConfig[] => {\n if (isEmpty(matches)) {\n return [{ match: '', value: '#ff0000' }];\n }\n return matches;\n};\n\n/*\n * @method isNumeric\n * @params {string} val - input value for the given match\n * @return {boolean} whether the string is numeric\n */\nexport const isNumeric = (val: string): boolean => {\n // eslint-disable-next-line no-restricted-globals\n return !isNaN(Number(val)) && !isNaN(parseFloat(val));\n};\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { variables } from '@splunk/themes';\nimport defaultPalettes from '@splunk/visualization-color-palettes/editors/PresetPalettes';\nimport type { PalettesConfig } from '../../interfaces/PalettesConfig';\nimport PalettesConfigurer from './Palettes/PalettesConfigurer';\nimport MatchValueConfigurer from './MatchValue/MatchValueConfigurer';\nimport {\n getSwatchColorsFromPalette,\n getPrecedenceFromPalette,\n inferInitialPaletteFromContext,\n hasCustomColors,\n hasInitiallyReversedColors,\n} from './Palettes/paletteUtils';\nimport type { Palettes } from './Palettes/paletteUtils';\nimport { getMatches } from './MatchValue/matchValueUtils';\n\nexport const MATCH_VALUE_WILDCARD_INFO_TEXT = _(\"Enter a value to match. Wildcards '*' can be used.\");\n\nconst MatchValueWildcardInfo = styled.div`\n margin: 6px 0px;\n color: ${variables.contentColorMuted};\n`;\n\ninterface MatchesConfig {\n match?: string | number;\n value?: string;\n}\n\nexport interface MatchValueEditorProps {\n defaultPalettesConfig: PalettesConfig;\n onChange?: (e: string, opt: string, payload: MatchesConfig[]) => void;\n palettes?: Palettes;\n selectedDataSelector?: string;\n value?: MatchesConfig[] | null;\n}\n\nconst getNewColorsFromPalette = ({\n palettes,\n paletteTheme,\n paletteInfo,\n matchValues,\n setIsReversed,\n}): string[] => {\n const newSwatchColors = getSwatchColorsFromPalette({\n palettes,\n paletteInfo,\n paletteTheme,\n });\n const precedence = getPrecedenceFromPalette({\n palettes,\n paletteTheme,\n paletteInfo,\n });\n\n const n = matchValues.length;\n // It's an array of 6 elements (indices from 0 to 5) so if there are\n // less than 7 match values, select the precedence normally. If 7 or greater,\n // select the final array in the precedence array at index 5.\n // Added .slice because there is one too many colors -\n // e.g. for matchValues array of length 1, precedence[0] returns\n // 2 elements (as was the minimum # for use with rangeValue)\n const newSelectedColors = precedence[n < 7 ? n - 1 : 5]\n .map((colorIdx): string => newSwatchColors[colorIdx])\n .slice(0, n);\n\n setIsReversed(false);\n return newSelectedColors;\n};\n\nexport const matchValuesToContextConfig = ({ colors, matchValues }): MatchesConfig[] =>\n colors.map((color, i): MatchesConfig => {\n const entry: MatchesConfig = {\n match: matchValues[i],\n value: color,\n };\n\n return entry;\n });\n\nconst MatchValueEditor = ({\n defaultPalettesConfig,\n onChange = () => undefined,\n palettes = defaultPalettes,\n selectedDataSelector,\n value,\n}: MatchValueEditorProps): React.ReactElement => {\n const matches = React.useMemo(() => getMatches(value), [value]);\n\n const { matchValues, selectedColors } = React.useMemo(\n () =>\n matches.reduce(\n (acc, next) => {\n acc.matchValues.push(next.match);\n const selectedColor = typeof next.value === 'string' ? next.value : 'transparent';\n acc.selectedColors.push(selectedColor);\n return acc;\n },\n { matchValues: [], selectedColors: [] }\n ),\n [matches]\n );\n\n const [{ paletteTheme: selectedPaletteTheme, paletteEntry: selectedPaletteEntry }, setPalettesConfig] =\n React.useState<PalettesConfig>(() =>\n inferInitialPaletteFromContext({ defaultPalettesConfig, palettes, ranges: matches })\n );\n\n const currentSwatchColors = getSwatchColorsFromPalette({\n palettes,\n paletteInfo: selectedPaletteEntry,\n paletteTheme: selectedPaletteTheme,\n });\n\n const isSwatchCustomized = React.useMemo(\n () => hasCustomColors({ currentSwatchColors, selectedColors }),\n [currentSwatchColors, selectedColors]\n );\n\n // we only want to calculate the initial reversed state when the RangeValueEditor opens since this is somewhat expensive\n // after this, the reversed state should be tracked internally by the editor itself\n\n const [isReversed, setIsReversed] = React.useState(() =>\n hasInitiallyReversedColors({\n isSwatchCustomized,\n palettes,\n selectedColors,\n selectedPaletteInfo: selectedPaletteEntry,\n selectedPaletteTheme,\n minimumNumberOfColors: 1,\n })\n );\n const calculateNewColors = React.useCallback(\n ({ paletteTheme, paletteInfo }): string[] => {\n // RangeValue had 6 here because it was the number of boundaries -\n // we have max 7 matches.\n if (matchValues.length > 7) return selectedColors;\n return getNewColorsFromPalette({\n palettes,\n paletteTheme,\n paletteInfo,\n matchValues,\n setIsReversed,\n });\n },\n [matchValues, palettes, selectedColors]\n );\n\n const onChangePaletteTheme = React.useCallback(\n (newPaletteTheme): void => {\n const newColors = calculateNewColors({\n paletteTheme: newPaletteTheme,\n paletteInfo: selectedPaletteEntry,\n });\n setPalettesConfig(prev => ({ ...prev, paletteTheme: newPaletteTheme }));\n const newMatches = matchValuesToContextConfig({ colors: newColors, matchValues });\n onChange(null, null, newMatches);\n },\n [calculateNewColors, selectedPaletteEntry, matchValues, onChange]\n );\n\n const onPaletteChange = React.useCallback(\n (newPaletteInfo): void => {\n const newColors = calculateNewColors({\n paletteTheme: selectedPaletteTheme,\n paletteInfo: newPaletteInfo,\n });\n setPalettesConfig(prev => ({ ...prev, paletteEntry: newPaletteInfo }));\n const newMatches = matchValuesToContextConfig({ colors: newColors, matchValues });\n onChange(null, null, newMatches);\n },\n [calculateNewColors, selectedPaletteTheme, matchValues, onChange]\n );\n\n const handleOnMatchValueChange = React.useCallback(\n ({ colors, matchValues: newMatchValues }): void => {\n const newMatches = matchValuesToContextConfig({ colors, matchValues: newMatchValues });\n onChange(null, null, newMatches);\n },\n [onChange]\n );\n\n // if the user changes the dataSelector (e.g. from major to trend) for something like background coloring,\n // reinitialize the palette config and the initial match values + colors using the newly selected formatter config (value)\n React.useEffect((): void => {\n setPalettesConfig(\n inferInitialPaletteFromContext({\n defaultPalettesConfig,\n palettes,\n ranges: matches,\n })\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedDataSelector]);\n\n return (\n <>\n <PalettesConfigurer\n isReversed={isReversed}\n isSwatchCustomized={isSwatchCustomized}\n shouldShowArrows={false}\n onChangePaletteTheme={onChangePaletteTheme}\n onPaletteChange={onPaletteChange}\n palettes={palettes}\n selectedPaletteInfo={selectedPaletteEntry}\n selectedPaletteTheme={selectedPaletteTheme}\n />\n <MatchValueConfigurer\n customizedColors={isSwatchCustomized}\n isReversed={isReversed}\n onChange={handleOnMatchValueChange}\n precedence={getPrecedenceFromPalette({\n palettes,\n paletteTheme: selectedPaletteTheme,\n paletteInfo: selectedPaletteEntry,\n })}\n matchValues={matchValues}\n selectedColors={selectedColors}\n swatchColors={currentSwatchColors}\n setIsReversed={setIsReversed}\n />\n <MatchValueWildcardInfo>{MATCH_VALUE_WILDCARD_INFO_TEXT}</MatchValueWildcardInfo>\n </>\n );\n};\n\nMatchValueEditor.propTypes = {\n /**\n * An onChange callback that allows the editor to customize the context accordingly based on the new thresholds\n */\n onChange: T.func,\n /**\n * The palettes object\n *\n * This consists of a theme and each themed-variant of the palettes\n */\n palettes: T.objectOf(\n T.shape({\n precedence: T.arrayOf(T.arrayOf(T.number)),\n swatches: T.arrayOf(T.arrayOf(T.string)),\n })\n ),\n /**\n * The initial matches config from the viz context\n */\n value: T.arrayOf(\n T.shape({\n match: T.oneOfType([T.string, T.number]),\n value: T.string,\n })\n ),\n /**\n * The field upon which the matchValue formatter is operating on - e.g. 'majorValue'\n */\n selectedDataSelector: T.string,\n /**\n * The default palette configuration, consisting of the theme and specific palette entry\n */\n defaultPalettesConfig: T.shape({\n paletteTheme: T.string,\n paletteEntry: T.shape({\n type: T.string,\n index: T.number,\n }),\n }),\n};\n\nexport default MatchValueEditor;\n","import React, { useMemo } from 'react';\nimport type { MatchesConfig } from '@splunk/visualization-encoding/formatters/MatchValue';\nimport { ColorPreview } from './ColorPreview';\nimport type { BasePreviewProps } from '../../interfaces/BasePreviewProps';\nimport PreviewWrapper from '../../shared/PreviewWrapper';\n\nconst MAX_PREVIEW_COLOR_COUNT = 8;\ntype MatchValuePreviewProps = Omit<BasePreviewProps, 'config'> & {\n config: MatchesConfig[];\n};\n\nexport const MatchValuePreview: React.FunctionComponent<MatchValuePreviewProps> = ({\n config,\n}): React.ReactElement => {\n const colors = useMemo(\n () => config.map((entry): string => entry.value).slice(0, MAX_PREVIEW_COLOR_COUNT),\n [config]\n );\n return (\n <PreviewWrapper>\n <ColorPreview data-test=\"ColorPreview\" colors={colors} maxColorCount={MAX_PREVIEW_COLOR_COUNT} />\n </PreviewWrapper>\n );\n};\n","import * as React from 'react';\nimport PresetPaletteTheme from './PresetPaletteTheme';\nimport PalettesDropdown from './PalettesDropdown';\nimport { getThemedPalettesWithoutMeta } from './paletteUtils';\nimport type { Palettes, PaletteInfo, PaletteEntryMap, PaletteThemeMeta } from './paletteUtils';\n\nconst PalettesConfigurer = ({\n isReversed,\n isSwatchCustomized,\n shouldShowArrows = true,\n onChangePaletteTheme,\n onPaletteChange,\n palettes,\n selectedPaletteInfo,\n selectedPaletteTheme,\n}: {\n isReversed: boolean;\n isSwatchCustomized: boolean;\n shouldShowArrows?: boolean;\n onChangePaletteTheme: (theme: string) => void;\n onPaletteChange: ({ type, index }: PaletteInfo) => void;\n palettes: Palettes;\n selectedPaletteInfo: PaletteInfo;\n selectedPaletteTheme: string;\n}): React.ReactElement => {\n const paletteThemes = React.useMemo(\n (): PaletteThemeMeta[] =>\n Object.keys(palettes).map(\n (palette): PaletteThemeMeta => ({\n value: palette,\n // eslint-disable-next-line no-underscore-dangle\n label: palettes[palette]._meta.label,\n })\n ),\n [palettes]\n );\n\n const filteredThemedPalettes = React.useMemo(\n (): PaletteEntryMap => getThemedPalettesWithoutMeta({ palettes, paletteTheme: selectedPaletteTheme }),\n [palettes, selectedPaletteTheme]\n );\n\n return (\n <>\n <PresetPaletteTheme\n onChange={onChangePaletteTheme}\n paletteThemes={paletteThemes}\n selectedPaletteTheme={selectedPaletteTheme}\n />\n <PalettesDropdown\n isReversed={isReversed}\n isSwatchCustomized={isSwatchCustomized}\n shouldShowArrows={shouldShowArrows}\n onPaletteChange={onPaletteChange}\n palettes={filteredThemedPalettes}\n selectedPaletteInfo={selectedPaletteInfo}\n />\n </>\n );\n};\n\nexport default PalettesConfigurer;\n","import * as React from 'react';\nimport { get } from 'lodash';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Button from '@splunk/react-ui/Button';\nimport Dropdown from '@splunk/react-ui/Dropdown';\nimport Menu from '@splunk/react-ui/Menu';\nimport variables from '@splunk/themes/variables';\nimport ArrowLayer from '../../../shared/ArrowLayer';\nimport { ColorPreview } from '../ColorPreview';\nimport PreviewWrapper from '../../../shared/PreviewWrapper';\nimport type { PaletteInfo } from './paletteUtils';\n\nexport interface PalettesDropdownProps {\n isReversed?: boolean;\n isSwatchCustomized?: boolean;\n shouldShowArrows?: boolean;\n onPaletteChange: ({ type, index }: PaletteInfo) => void;\n palettes: { [key: string]: { swatches: string[][]; precedence: number[][] } };\n selectedPaletteInfo: { type: string; index: number };\n}\n\nconst ColorPreviewSpacer = styled.div`\n width: ${variables.spacingMedium}; //enterprise: 15px, prisma: 12px\n`;\n\nconst CustomizedSwatchText = styled.span.attrs(() => ({\n 'data-test': 'custom-swatch-text',\n}))`\n display: flex;\n flex: 1;\n padding-left: 10px;\n`;\nconst PalettesDropdown = ({\n isReversed = false,\n isSwatchCustomized = false,\n shouldShowArrows = true,\n onPaletteChange,\n palettes,\n selectedPaletteInfo,\n}: PalettesDropdownProps): React.ReactElement => {\n const previewColors = get(\n palettes,\n [selectedPaletteInfo.type, 'swatches', selectedPaletteInfo.index],\n []\n );\n\n const initialPalettePreview = (\n <Button\n style={{ width: '100%', padding: `0 ${variables.spacingSmall}` }}\n isMenu\n data-test=\"palettes-dropdown-toggle\"\n >\n {isSwatchCustomized ? (\n <CustomizedSwatchText>Customized in swatches below</CustomizedSwatchText>\n ) : (\n <>\n <PreviewWrapper>\n {shouldShowArrows && <ArrowLayer />}\n <ColorPreview colors={previewColors} isReversed={isReversed} />\n </PreviewWrapper>\n <ColorPreviewSpacer />\n </>\n )}\n </Button>\n );\n\n const menuItems = React.useMemo(\n // can't use React.Fragment - it will break keyboard navigation,\n // Menu accepts only Menu.Item, Menu.Heading, Menu.Divider as child components\n () =>\n Object.keys(palettes).reduce<JSX.Element[]>((items, palette, index, arr) => {\n items.push(\n <Menu.Heading key={`title-${palette}`} title>\n {_(palette).toUpperCase()}\n </Menu.Heading>\n );\n items.push(\n ...palettes[palette].swatches.map((colors: string[], i) => {\n const isSelected =\n !isSwatchCustomized &&\n palette === selectedPaletteInfo.type &&\n selectedPaletteInfo.index === i;\n\n return (\n <Menu.Item\n data-test={`palette-swatch-row-${palette}-${i}`}\n key={`${palette}-${JSON.stringify(colors)}`}\n onClick={() => onPaletteChange({ type: palette, index: i })}\n selected={isSelected}\n selectable\n >\n <PreviewWrapper>\n <ColorPreview colors={colors} />\n </PreviewWrapper>\n </Menu.Item>\n );\n })\n );\n if (index < arr.length - 1) {\n items.push(<Menu.Divider key={`divider-${palette}`} />);\n }\n return items;\n }, []),\n [isSwatchCustomized, onPaletteChange, palettes, selectedPaletteInfo.index, selectedPaletteInfo.type]\n );\n\n return (\n <Dropdown toggle={initialPalettePreview}>\n <Menu style={{ width: 302 }}>{menuItems}</Menu>\n </Dropdown>\n );\n};\n\nexport default PalettesDropdown;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport RadioBar from '@splunk/react-ui/RadioBar';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport type { PaletteThemeMeta } from './paletteUtils';\n\nconst PresetPaletteTheme = ({\n labelPosition = 'top',\n onChange,\n paletteThemes,\n selectedPaletteTheme,\n}: {\n labelPosition?: 'left' | 'top';\n onChange: (payload: string) => void;\n paletteThemes: PaletteThemeMeta[];\n selectedPaletteTheme: string;\n}): React.ReactElement => {\n const onPaletteThemeChange = React.useCallback((e, { value }): void => onChange(value), [onChange]);\n\n return (\n <ControlGroup label={_('Preset palette')} labelPosition={labelPosition}>\n <RadioBar onChange={onPaletteThemeChange} value={selectedPaletteTheme}>\n {paletteThemes.map(\n ({ value, label }): React.ReactElement => (\n <RadioBar.Option\n key={value}\n value={value}\n label={label}\n data-test={`preset-palette-theme-${value}`}\n />\n )\n )}\n </RadioBar>\n </ControlGroup>\n );\n};\n\nPresetPaletteTheme.propTypes = {\n labelPosition: T.string,\n onChange: T.func,\n paletteThemes: T.arrayOf(\n T.shape({\n value: T.string,\n label: T.string,\n })\n ),\n selectedPaletteTheme: T.string,\n};\n\nexport default PresetPaletteTheme;\n","import { get } from 'lodash';\nimport type { RangesConfig } from '@splunk/visualization-encoding/formatters/RangeValue';\nimport type { MatchesConfig } from '@splunk/visualization-encoding/formatters/MatchValue';\nimport type { PalettesConfig } from '../../../interfaces/PalettesConfig';\n\nexport interface PaletteEntry {\n swatches: string[][];\n precedence: number[][];\n}\n\nexport interface PaletteEntryMap {\n [palette: string]: PaletteEntry;\n}\n\nexport interface PaletteInfo {\n type: string;\n index: number;\n}\n\ninterface PaletteThemeMetadata {\n label: string;\n paletteTheme?: string;\n [key: string]: unknown;\n}\n\ninterface PaletteTheme {\n _meta: PaletteThemeMetadata;\n [key: string]: PaletteEntry | PaletteThemeMetadata;\n}\n\nexport type Palettes = Record<string, PaletteTheme>;\n\nconst isPaletteEntry = (value: PaletteEntry | PaletteThemeMetadata | undefined): value is PaletteEntry => {\n if (!value || typeof value !== 'object') {\n return false;\n }\n return 'swatches' in value && Array.isArray((value as PaletteEntry).swatches);\n};\n\nexport interface PaletteThemeMeta {\n value: string;\n label: string;\n}\n\ninterface SharedPalettesParams {\n palettes: Palettes;\n paletteInfo: PaletteInfo;\n paletteTheme: string;\n}\n\nexport const defaultPalettesConfig = {\n paletteTheme: 'DARK_COLORS',\n paletteEntry: {\n type: 'sequential',\n index: 0,\n },\n};\n\n/**\n * Obtains the new colors given the set of swatchColors and a precedence to pick the desired swatch colors\n * Each entry in 2D precedence dictates which colors out of the (i + 2) colors, where i is the index for the entry\n * E.g the 0th precedence entry tells us which 2 elements to select from the swatch colors\n * the 1st entry tells us which 3 elements to select, and so forth\n *\n * @param {Boolean} params.isReversed - indicates that the selected colors should be reversed based on the insertion precedence\n * @param {Number} params.numColors - number of colors to return\n * @param {Number[][]} params.precedence - the order from which the new selected colors should pick from the swatch\n * the ith precedence entry dictates the indices that should be selected for (i + 2) swatchColors (e.g. [[0, 1], [0, 1, 2], [0, 1, 2, 3]])\n * @param {String[]} params.swatchColors - the swatch from which the colors are picked from\n */\nexport const getNewColors = ({\n isReversed,\n numColors,\n precedence,\n swatchColors,\n}: {\n isReversed: boolean;\n numColors: number;\n precedence: number[][];\n swatchColors: string[];\n}): string[] => {\n const newSelectedColors = Array.isArray(precedence[numColors - 2])\n ? precedence[numColors - 2].map((colorIdx): string => {\n return swatchColors[colorIdx];\n })\n : [];\n\n if (isReversed) {\n newSelectedColors.reverse();\n }\n return newSelectedColors;\n};\n\n/**\n * Returns the swatch precedence defined for a given palette type\n *\n * @param {Palettes} params.palettes - the nested palettes object\n * @param {PaletteInfo} params.paletteInfo - object holding the palette type (e.g. divergent, categorical), and index within the palette swatches\n * @param {String} params.paletteTheme - the palette theme that should be a key at the root level of the Palettes object\n *\n * @return {Number[][]}\n */\nexport const getPrecedenceFromPalette = ({\n palettes,\n paletteInfo,\n paletteTheme,\n}: SharedPalettesParams): number[][] => {\n return get(palettes, [paletteTheme, paletteInfo.type, 'precedence'], []);\n};\n\n/**\n * Returns the swatch colors for a given palette type and index\n *\n * @param {Palettes} params.palettes - the nested palettes object\n * @param {PaletteInfo} params.paletteInfo - object holding the palette type (e.g. divergent, categorical), and index within the palette swatches\n * @param {String} params.paletteTheme - the palette theme that should be a key at the root level of the Palettes object\n *\n * @return {String[]}\n */\nexport const getSwatchColorsFromPalette = ({\n palettes,\n paletteInfo,\n paletteTheme,\n}: SharedPalettesParams): string[] => {\n return get(palettes, [paletteTheme, paletteInfo.type, 'swatches', paletteInfo.index], []);\n};\n\n/**\n * Determines if the current selected colors are customized compared to the current swatch colors\n *\n * @param {String[]} params.currentSwatchColors - the currently selected swatch within the Palette Dropdown\n * @param {String[]} params.selectedColors - the colors present within the range value config\n *\n * @return {Boolean}\n */\nexport const hasCustomColors = ({\n currentSwatchColors,\n selectedColors,\n}: {\n currentSwatchColors: string[];\n selectedColors: string[];\n}): boolean => {\n if (selectedColors.length > currentSwatchColors.length) {\n return true;\n }\n\n // NOTE: for detecting custom colors, the color to evaluate must be lowercased, as SUI's Color editor\n // converts all selected hex colors to their lowercased counterpart, regardless of the casing in the palette\n const swatchColorMap: Record<string, string> = {};\n currentSwatchColors.forEach((color): void => {\n if (typeof color === 'string') {\n swatchColorMap[color.toLowerCase()] = color.toLowerCase();\n }\n });\n\n return selectedColors.some((color): boolean => {\n if (typeof color !== 'string') {\n return true;\n }\n return !swatchColorMap[color.toLowerCase()];\n });\n};\n\n/**\n * Returns the palette entries within the palettes object for a given theme without the _meta field\n *\n * @param {Palettes} params.palettes - the nested palettes object\n * @param {String} params.paletteTheme - the palette theme that should be a key at the root level of the Palettes object\n *\n * @return {Palettes} - the selectedTheme palettes object with the _meta field stripped out from each palette entry\n */\nexport const getThemedPalettesWithoutMeta = ({\n palettes,\n paletteTheme,\n}: {\n palettes: Palettes;\n paletteTheme: string;\n}): PaletteEntryMap => {\n return Object.keys(palettes[paletteTheme]).reduce((filteredPalettes, field): Record<string, unknown> => {\n if (field !== '_meta') {\n // eslint-disable-next-line no-param-reassign\n filteredPalettes[field] = palettes[paletteTheme][field];\n }\n return filteredPalettes;\n }, {});\n};\n\n/**\n * Internal helper to check if the user-selected colors adhere to the default palette insertion order\n */\nconst hasMatchingPrecedence = ({\n currentSwatchColors,\n precedence,\n selectedColors,\n}: {\n currentSwatchColors: string[];\n precedence: number[];\n selectedColors: string[];\n}): boolean => {\n if (!precedence) {\n return false;\n }\n if (precedence.every((idx: number): boolean => currentSwatchColors[idx] === selectedColors[idx]))\n return true;\n const reversedPrecedenceEntry = [...precedence].reverse();\n if (\n reversedPrecedenceEntry.every(\n (idx: number): boolean => currentSwatchColors[idx] === selectedColors[idx]\n )\n )\n return true;\n\n // the given precedence (nor its reversed counterpart) do not match\n return false;\n};\n\n/**\n * Determines if the selected colors relative to the palette had a reversed precedence\n * @param {Boolean} params.isSwatchCustomized - indicates if user was using non-palette derived colors\n * @param {Palettes} params.palettes - the palettes object used to power the range value editor palette\n * @param {String[]} params.selectedColors - the colors that are currently populating the range value formatter editor\n * @param {PaletteInfo} params.selectedPaletteInfo - metadata about the currently selected palette for the range value formatter editor\n * @param {String} params.selectedPaletteTheme - the current palette theme\n *\n * @returns {Boolean}\n */\nexport const hasInitiallyReversedColors = ({\n isSwatchCustomized,\n palettes,\n selectedColors,\n selectedPaletteInfo,\n selectedPaletteTheme,\n // minimumNumberOfColors reflects the minimum number of colors needed in the particular formatter editor's implementation\n // defaulted to two as to not break previous rangeValue formatter editor implementation\n minimumNumberOfColors = 2,\n}: {\n isSwatchCustomized: boolean;\n palettes: Palettes;\n selectedColors: string[];\n selectedPaletteInfo: PaletteInfo;\n selectedPaletteTheme: string;\n minimumNumberOfColors?: number;\n}): boolean => {\n if (isSwatchCustomized) {\n return false;\n }\n\n const n = selectedColors.length;\n // if for rangevalue (min # of colors = 2) then default behavior, otherwise adjust for matchvalue\n const precedenceIndexIfMatch = n < 7 ? n - 1 : 5;\n const precedenceIndex = minimumNumberOfColors === 2 ? n - 2 : precedenceIndexIfMatch;\n\n const currentPaletteColors =\n palettes?.[selectedPaletteTheme]?.[selectedPaletteInfo.type]?.swatches?.[selectedPaletteInfo.index];\n const currentPrecedence =\n palettes?.[selectedPaletteTheme]?.[selectedPaletteInfo.type]?.precedence?.[precedenceIndex];\n\n const reversedPrecedence = [...currentPrecedence].reverse();\n\n return selectedColors.every(\n (selectedColor, index) =>\n currentPaletteColors[reversedPrecedence[index]].toLowerCase() === selectedColor.toLowerCase()\n );\n};\n\n/**\n * Helper to determine if the user was using a pre-existing palette to populate the rangeValue, matchValue, or gradient config.\n *\n * Accepts RangesConfig, MatchesConfig, or GradientConfig (array of colors).\n * Checks all palettes from all themes to determine which one the user was previously using.\n * If multiple matches are found (possible since palettes can have overlapping colors), insertion precedence is used to infer the correct palette type.\n * If no match is found, returns the defaultPalettesConfig.\n *\n * @param {PalettesConfig} params.defaultPalettesConfig - if no palette match is found, the swatch info from this palette will be used for the color editors\n * @param {RangesConfig[] | MatchesConfig[]} params.ranges - the ranges/matches context config or gradient config\n * @param {Palettes} params.palettes - the nested palettes object\n */\nexport const inferInitialPaletteFromContext = ({\n defaultPalettesConfig: defaultPalettes,\n ranges,\n palettes,\n}: {\n defaultPalettesConfig: PalettesConfig;\n ranges: RangesConfig[] | MatchesConfig[];\n palettes: Palettes;\n}): PalettesConfig => {\n // Determine selectedColors based on input type\n let selectedColors: string[] = [];\n if (Array.isArray(ranges)) {\n // RangesConfig or MatchesConfig\n selectedColors = ranges.map(({ value }) => value);\n }\n\n let matchingPalette;\n let matchedPrecedence = false;\n\n Object.keys(palettes).forEach(paletteTheme => {\n Object.keys(palettes[paletteTheme])\n .filter(paletteType => paletteType !== '_meta')\n .forEach(paletteType => {\n const entry = palettes[paletteTheme][paletteType];\n if (!isPaletteEntry(entry)) {\n return;\n }\n const { swatches, precedence } = entry;\n const precedenceForLength = precedence[selectedColors.length - 2] ?? [];\n for (let k = 0; k < swatches.length; k += 1) {\n const currentSwatchColors = swatches[k];\n if (!hasCustomColors({ currentSwatchColors, selectedColors })) {\n matchedPrecedence = hasMatchingPrecedence({\n currentSwatchColors,\n selectedColors,\n precedence: precedenceForLength,\n });\n if (!matchingPalette || matchedPrecedence) {\n matchingPalette = {\n paletteTheme,\n paletteEntry: {\n type: paletteType,\n index: k,\n },\n };\n }\n }\n }\n });\n });\n\n return matchingPalette || defaultPalettes;\n};\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport Button from '@splunk/react-ui/Button';\nimport ArrowsRectangularDouble from '@splunk/react-icons/ArrowsRectangularDouble';\n\nconst AddRangeWrapper = styled.div`\n display: flex;\n flex-direction: row;\n margin-bottom: 10px;\n`;\n\nconst AddRangeButtonWrapper = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n`;\n\nconst ReverseRangeWrapper = styled.div`\n display: flex;\n`;\n\nconst ButtonStyle = {\n marginRight: '12px',\n};\n\nconst reverseIcon = <ArrowsRectangularDouble />;\n\nconst AddAndReverseRanges = ({\n disableAddRanges = false,\n handleAddRange,\n handleReverse,\n}: {\n disableAddRanges: boolean;\n handleAddRange: () => void;\n handleReverse: () => void;\n}): React.ReactElement => {\n return (\n <AddRangeWrapper>\n <ReverseRangeWrapper>\n <Button\n data-test=\"reverse-ranges-button\"\n icon={reverseIcon}\n style={ButtonStyle}\n onClick={handleReverse}\n />\n </ReverseRangeWrapper>\n <AddRangeButtonWrapper>\n <Button\n data-test=\"add-range-button\"\n appearance=\"secondary\"\n label={`+ ${_('Add range')}`}\n disabled={disableAddRanges}\n onClick={handleAddRange}\n />\n </AddRangeButtonWrapper>\n </AddRangeWrapper>\n );\n};\n\nAddAndReverseRanges.propTypes = {\n disableAddRanges: T.bool,\n handleAddRange: T.func,\n handleReverse: T.func,\n};\n\nexport default AddAndReverseRanges;\n","import * as React from 'react';\nimport styled from 'styled-components';\nimport Number, { type NumberChangeHandler } from '@splunk/react-ui/Number';\nimport variables from '@splunk/themes/variables';\n\nconst RangeBoundaryText = styled.div.attrs((): { 'data-test': string } => ({\n 'data-test': 'range-boundary-text',\n}))`\n color: ${variables.contentColorMuted};\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-right: 10px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst BoundaryErrorMessage = styled.div.attrs((): { 'data-test': string } => ({\n 'data-test': 'range-boundary-error',\n}))`\n color: ${variables.contentColorNegative};\n padding-top: 5px;\n font-size: 12px;\n display: block;\n`;\n\nconst StyledNumberEditor = styled(Number)`\n max-width: 105px;\n margin-right: ${variables.spacingMedium};\n`;\n\nconst BoundaryRowWrapper = styled.div`\n display: flex;\n height: 100%;\n`;\n\nconst RangeBoundaryWrapper = styled.div`\n display: flex;\n flex-direction: column;\n margin-left: ${variables.spacingMedium};\n`;\n\nexport const handleUpdateRangeBoundary = ({\n rangeBoundaryIndex,\n setError,\n shouldUpdate,\n updateRangeBoundary,\n value,\n}: {\n rangeBoundaryIndex: number;\n setError: (payload: string) => void;\n shouldUpdate: boolean;\n updateRangeBoundary: (payload: number, idx: number) => { error: string };\n value: number;\n}): void => {\n if (shouldUpdate) {\n const result = updateRangeBoundary(value, rangeBoundaryIndex);\n if (result && result.error) {\n setError(result.error);\n }\n }\n};\n\nconst RangeBoundary = ({\n initialValue,\n rangeBoundaryIndex,\n rangeText,\n rangeValues,\n showNumberEditor = true,\n updateRangeBoundary,\n}: {\n initialValue?: number;\n rangeBoundaryIndex: number;\n rangeText: string;\n rangeValues: number[];\n showNumberEditor?: boolean;\n updateRangeBoundary: (value: number, updatedRangeBoundaryIndex: number) => { error: string };\n}): React.ReactElement => {\n const [boundaryInputValue, setBoundaryInputValue] = React.useState(null);\n const [isFocused, setIsFocused] = React.useState(false);\n const [error, setError] = React.useState(null);\n\n const handleOnFocus = React.useCallback((): void => {\n setIsFocused(true);\n }, []);\n\n const handleOnChange = React.useCallback<NumberChangeHandler>(\n (_e, { value }): void => {\n // this is invoked if the user uses the up/down arrows (want to update rangevalues immediately)\n setBoundaryInputValue(value);\n handleUpdateRangeBoundary({\n rangeBoundaryIndex,\n setError,\n shouldUpdate: !isFocused,\n updateRangeBoundary,\n value,\n });\n },\n [isFocused, rangeBoundaryIndex, updateRangeBoundary]\n );\n\n const handleOnBlur = React.useCallback((): void => {\n setIsFocused(false);\n\n if (typeof boundaryInputValue !== 'number') {\n setBoundaryInputValue(null);\n return;\n }\n\n handleUpdateRangeBoundary({\n rangeBoundaryIndex,\n setError,\n shouldUpdate: boundaryInputValue !== initialValue,\n updateRangeBoundary,\n value: boundaryInputValue,\n });\n }, [rangeBoundaryIndex, boundaryInputValue, initialValue, updateRangeBoundary]);\n\n const handleOnKeyUp = React.useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>): void => {\n if (e.key !== 'Enter') {\n return;\n }\n\n // If value is empty/invalid on Enter, revert to initial value\n if (typeof boundaryInputValue !== 'number') {\n setBoundaryInputValue(null);\n return;\n }\n\n handleUpdateRangeBoundary({\n rangeBoundaryIndex,\n setError,\n shouldUpdate: boundaryInputValue !== initialValue,\n updateRangeBoundary,\n value: boundaryInputValue,\n });\n },\n [rangeBoundaryIndex, boundaryInputValue, initialValue, updateRangeBoundary]\n );\n\n // if the changes the range values by editing an adjacent value to address the duplication,\n // clear the error state and persist the currently state value if the current state value would not cause duplication\n React.useEffect((): void => {\n if (error && !rangeValues.includes(boundaryInputValue)) {\n setError(null);\n handleUpdateRangeBoundary({\n rangeBoundaryIndex,\n setError,\n shouldUpdate: typeof boundaryInputValue === 'number',\n updateRangeBoundary,\n value: boundaryInputValue,\n });\n }\n }, [boundaryInputValue, error, rangeBoundaryIndex, rangeValues, updateRangeBoundary]);\n\n return (\n <RangeBoundaryWrapper>\n <BoundaryRowWrapper>\n {showNumberEditor && (\n <StyledNumberEditor\n data-test=\"range-boundary-editor\"\n error={!!error}\n onBlur={handleOnBlur}\n onChange={handleOnChange}\n onFocus={handleOnFocus}\n onKeyUp={handleOnKeyUp}\n value={boundaryInputValue === null ? initialValue : boundaryInputValue}\n />\n )}\n <RangeBoundaryText>{rangeText}</RangeBoundaryText>\n </BoundaryRowWrapper>\n {showNumberEditor && error && <BoundaryErrorMessage>{error}</BoundaryErrorMessage>}\n </RangeBoundaryWrapper>\n );\n};\n\nexport default RangeBoundary;\n","import * as React from 'react';\nimport Color from '@splunk/react-ui/Color';\n\nconst RangeColor = ({\n color,\n colorIndex,\n onChange,\n palette,\n}: {\n color: string;\n colorIndex: number;\n onChange: (payload: { colorIndex: number; value: string }) => void;\n palette: string[];\n}): React.ReactElement => {\n const handleColorChange = React.useCallback(\n ({ value }): void => {\n let valueToUse = value;\n if (valueToUse === null) {\n valueToUse = 'transparent';\n }\n return onChange({ colorIndex, value: valueToUse });\n },\n [colorIndex, onChange]\n );\n\n return (\n <Color\n data-test={`range-color-${color}`}\n value={color}\n palette={palette}\n onChange={handleColorChange}\n hideInput // prisma only\n />\n );\n};\n\nexport default RangeColor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AddAndReverseRanges from './AddAndReverseRanges';\nimport RangeBoundary from './RangeBoundary';\nimport RangeColor from './RangeColor';\nimport RemoveRange from './RemoveRange';\nimport { getNewColors, hasCustomColors } from '../Palettes/paletteUtils';\n\nconst RangeValueConfigurerWrapper = styled.div`\n padding-top: 10px;\n`;\n\nconst RangesWrapper = styled.div`\n display: flex;\n flex-direction: column-reverse;\n`;\n\nconst RangeEntry = styled.div.attrs((): { 'data-test': string } => ({\n 'data-test': 'range-entry-row',\n}))`\n display: flex;\n flex-direction: row;\n margin-bottom: 10px;\n`;\n\n// note; getRangeText applies i18n at the static string level\nconst getRangeText = ({ lastColorIndex, rangeBoundaryIndex, rangeValues }): string => {\n switch (rangeBoundaryIndex) {\n case lastColorIndex:\n return _('and greater');\n case 0:\n return `${_('less than')} ${rangeValues[rangeBoundaryIndex]}`;\n default:\n return `${_('to')} ${rangeValues[rangeBoundaryIndex]}`;\n }\n};\n\nconst RangeValueConfigurer = ({\n // while this could be calculated inside the RangeValueConfigurer directly,\n // the palette dropdown also needs to know if the swatch was customized\n // it was more convenient to hoist up customizedColors than recalculating it in the child components\n customizedColors,\n isReversed,\n onChange,\n precedence,\n swatchColors,\n rangeValues,\n setIsReversed,\n selectedColors,\n}: {\n customizedColors: boolean;\n isReversed: boolean;\n onChange: (payload: { colors: string[]; rangeValues: number[] }) => void;\n precedence: number[][];\n swatchColors: string[];\n rangeValues: number[];\n setIsReversed: (payload: boolean) => void;\n selectedColors: string[];\n}): React.ReactElement => {\n const handleColorChange = React.useCallback(\n ({ colorIndex, value }): void => {\n const newSelectedColors = [...selectedColors];\n newSelectedColors[colorIndex] = value;\n onChange({ colors: newSelectedColors, rangeValues });\n },\n [onChange, rangeValues, selectedColors]\n );\n\n const handleAddRange = React.useCallback((): void => {\n // TODO(fkurniawan): figure out how to determine value of newly added range\n const newRangeValues = [...rangeValues, rangeValues[rangeValues.length - 1] + 10];\n const newSelectedColors = customizedColors\n ? [...selectedColors, '#000000'] // insert black color as per design if colors are customized\n : getNewColors({\n isReversed,\n // there is one more color than there are range boundaries\n numColors: newRangeValues.length + 1,\n precedence,\n swatchColors,\n });\n onChange({ colors: newSelectedColors, rangeValues: newRangeValues });\n }, [onChange, rangeValues, customizedColors, selectedColors, isReversed, precedence, swatchColors]);\n\n const handleReverse = React.useCallback((): void => {\n const newColors = [...selectedColors];\n newColors.reverse();\n setIsReversed(!isReversed);\n onChange({ colors: newColors, rangeValues });\n }, [onChange, rangeValues, isReversed, selectedColors, setIsReversed]);\n\n const handleUpdateRangeBoundary = React.useCallback(\n (updatedValue, rangeBoundaryIndex): { error: string } => {\n if (rangeValues.includes(updatedValue)) {\n return { error: _('Value already exists') };\n }\n const newRangeValues = [...rangeValues];\n newRangeValues[rangeBoundaryIndex] = updatedValue;\n newRangeValues.sort((a, b): number => a - b);\n onChange({ colors: selectedColors, rangeValues: newRangeValues });\n return { error: null };\n },\n [onChange, selectedColors, rangeValues]\n );\n\n const handleRemoveRange = React.useCallback(\n (colorIndex: number, rangeBoundaryIndex: number): void => {\n if (rangeValues.length > 1) {\n const newRangeValues = [...rangeValues];\n newRangeValues.splice(rangeBoundaryIndex, 1);\n\n // check if there are still custom colors after the user removes the current one\n const newSelectedColorsWithCurrentOmitted = [...selectedColors];\n newSelectedColorsWithCurrentOmitted.splice(colorIndex, 1);\n\n const newSelectedColors = hasCustomColors({\n currentSwatchColors: swatchColors,\n selectedColors: newSelectedColorsWithCurrentOmitted,\n })\n ? newSelectedColorsWithCurrentOmitted\n : getNewColors({\n isReversed,\n // there is one more color than there are range boundaries\n numColors: newRangeValues.length + 1,\n precedence,\n swatchColors,\n });\n\n onChange({ colors: newSelectedColors, rangeValues: newRangeValues });\n }\n },\n [isReversed, onChange, precedence, rangeValues, selectedColors, swatchColors]\n );\n\n return (\n <RangeValueConfigurerWrapper>\n <AddAndReverseRanges\n // TODO(fkurniawan): CTA if the user wishes to configure more than 7 ranges\n // the info state should tell users that anything > 7 ranges should be added via source\n disableAddRanges={selectedColors.length > 6}\n handleAddRange={handleAddRange}\n handleReverse={handleReverse}\n />\n <RangesWrapper>\n {selectedColors.map((color: string, i: number): React.ReactElement => {\n // there is always one more color than the number of range boundaries (unless there is only one range)\n // the customizable rangeBoundaryIndex corresponds to one less than the current selectedColor index\n const isLastItem = i === selectedColors.length - 1;\n const rangeBoundaryIndex = i > 0 ? i - 1 : 0;\n const rangeBoundaryValue = rangeValues[rangeBoundaryIndex];\n\n return (\n <RangeEntry key={`${color}-${rangeBoundaryValue}`}>\n <RangeColor\n color={color}\n colorIndex={i}\n palette={swatchColors}\n onChange={handleColorChange}\n />\n <RangeBoundary\n initialValue={rangeBoundaryValue}\n rangeBoundaryIndex={rangeBoundaryIndex}\n rangeText={getRangeText({\n lastColorIndex: selectedColors.length - 1,\n rangeBoundaryIndex: i,\n rangeValues,\n })}\n // unfortunately RangeBoundary has to know adjacent rangeValues if the user tries to address duplicates by changing an adjacent range\n // (instead of changing the currently errored RangeBoundary)\n rangeValues={rangeValues}\n showNumberEditor={isLastItem || i > 0}\n updateRangeBoundary={handleUpdateRangeBoundary}\n />\n <RemoveRange\n colorIndex={i}\n disabled={rangeValues.length < 2}\n onRemove={handleRemoveRange}\n rangeBoundaryIndex={rangeBoundaryIndex}\n />\n </RangeEntry>\n );\n })}\n </RangesWrapper>\n </RangeValueConfigurerWrapper>\n );\n};\n\nRangeValueConfigurer.propTypes = {\n customizedColors: T.bool,\n isReversed: T.bool,\n precedence: T.arrayOf(T.arrayOf(T.number)),\n swatchColors: T.arrayOf(T.string),\n rangeValues: T.arrayOf(T.number),\n setIsReversed: T.func,\n selectedColors: T.arrayOf(T.string),\n};\n\nexport default RangeValueConfigurer;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport type { ButtonProps } from '@splunk/react-ui/Button';\nimport Button from '@splunk/react-ui/Button';\nimport CloseIcon from '@splunk/react-icons/Cross';\nimport { variables } from '@splunk/themes';\n\nconst RemoveRangeWrapper = styled.div`\n display: flex;\n flex: 1;\n justify-content: flex-end;\n`;\n\nconst RemoveRangeButton = styled(Button)<ButtonProps>`\n color: ${props =>\n props.disabled ? variables.contentColorDisabled : variables.contentColorActive} !important;\n &:hover {\n background-color: ${props => !props.disabled && variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nconst RemoveRange = ({\n colorIndex,\n disabled = false,\n onRemove,\n rangeBoundaryIndex,\n}: {\n colorIndex: number;\n disabled?: boolean;\n onRemove: (colorIdx: number, rangeBoundaryIdx: number) => void;\n rangeBoundaryIndex: number;\n}): React.ReactElement => {\n const handleOnRemove = React.useCallback(\n (): void => onRemove(colorIndex, rangeBoundaryIndex),\n [colorIndex, onRemove, rangeBoundaryIndex]\n );\n\n return (\n <RemoveRangeWrapper>\n <div>\n <RemoveRangeButton\n data-test=\"range-remove-button\"\n disabled={disabled}\n icon={<CloseIcon />}\n appearance=\"subtle\"\n onClick={handleOnRemove}\n />\n </div>\n </RemoveRangeWrapper>\n );\n};\n\nRemoveRange.propTypes = {\n disabled: T.bool,\n onRemove: T.func,\n};\n\nexport default RemoveRange;\n","import { isEmpty } from 'lodash';\nimport type { RangesConfig } from '@splunk/visualization-encoding/formatters/RangeValue';\n\n/*\n * @method getSortedRanges\n * @params {Array} ranges\n * @return {Array} sorted ranges\n */\nexport const getSortedRanges = (ranges = []): RangesConfig[] => {\n if (isEmpty(ranges)) {\n return [\n { to: 0, value: '#f00' },\n { from: 0, value: '#0f0' },\n ];\n }\n const rangesToSort = [...ranges];\n rangesToSort.sort((a, b): number => {\n if (a.to == null) return 1;\n if (b.to == null) return -1;\n return +a.to - +b.to;\n });\n return rangesToSort;\n};\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport defaultPalettes from '@splunk/visualization-color-palettes/editors/PresetPalettes';\nimport type { RangesConfig } from '@splunk/visualization-encoding/formatters/RangeValue';\nimport type { PalettesConfig } from '../../interfaces/PalettesConfig';\nimport PalettesConfigurer from './Palettes/PalettesConfigurer';\nimport RangeValueConfigurer from './RangeValue/RangeValueConfigurer';\nimport { getSortedRanges } from './RangeValue/rangeValueUtils';\nimport {\n getSwatchColorsFromPalette,\n getPrecedenceFromPalette,\n inferInitialPaletteFromContext,\n hasCustomColors,\n hasInitiallyReversedColors,\n} from './Palettes/paletteUtils';\nimport type { Palettes } from './Palettes/paletteUtils';\n\nconst getNewColorsFromPalette = ({\n palettes,\n paletteTheme,\n paletteInfo,\n rangeValues,\n setIsReversed,\n}): string[] => {\n const newSwatchColors = getSwatchColorsFromPalette({\n palettes,\n paletteInfo,\n paletteTheme,\n });\n const precedence = getPrecedenceFromPalette({\n palettes,\n paletteTheme,\n paletteInfo,\n });\n\n const newSelectedColors = precedence[rangeValues.length - 1].map(\n (colorIdx): string => newSwatchColors[colorIdx]\n );\n setIsReversed(false);\n return newSelectedColors;\n};\n\nexport const rangeValuesToContextConfig = ({ colors, rangeValues }): RangesConfig[] =>\n colors.map((color, i): RangesConfig => {\n const entry: RangesConfig = {\n value: color,\n };\n\n if (i > 0) {\n entry.from = rangeValues[i - 1];\n }\n if (i < colors.length - 1) {\n entry.to = rangeValues[i];\n }\n\n return entry;\n });\n\nconst RangeValueEditor = ({\n defaultPalettesConfig,\n onChange = () => undefined,\n palettes = defaultPalettes,\n selectedDataSelector,\n value,\n}: {\n defaultPalettesConfig: PalettesConfig;\n onChange?: (e: string, opt: string, payload: RangesConfig[]) => void;\n palettes?: Palettes;\n selectedDataSelector?: string;\n value: RangesConfig[] | null;\n}): React.ReactElement => {\n const sortedRanges = React.useMemo((): RangesConfig[] => getSortedRanges(value), [value]);\n\n const { rangeValues, selectedColors } = React.useMemo(\n () =>\n sortedRanges.reduce(\n (acc, next) => {\n if (typeof next.to === 'number') {\n acc.rangeValues.push(next.to);\n }\n acc.selectedColors.push(next.value);\n return acc;\n },\n { rangeValues: [], selectedColors: [] }\n ),\n [sortedRanges]\n );\n\n const [{ paletteTheme: selectedPaletteTheme, paletteEntry: selectedPaletteEntry }, setPalettesConfig] =\n React.useState<PalettesConfig>(() =>\n inferInitialPaletteFromContext({ defaultPalettesConfig, palettes, ranges: sortedRanges })\n );\n\n const currentSwatchColors = getSwatchColorsFromPalette({\n palettes,\n paletteInfo: selectedPaletteEntry,\n paletteTheme: selectedPaletteTheme,\n });\n\n const isSwatchCustomized = hasCustomColors({ currentSwatchColors, selectedColors });\n\n // we only want to calculate the initial reversed state when the RangeValueEditor opens since this is somewhat expensive\n // after this, the reversed state should be tracked internally by the editor itself\n\n const [isReversed, setIsReversed] = React.useState(() =>\n hasInitiallyReversedColors({\n isSwatchCustomized,\n palettes,\n selectedColors,\n selectedPaletteInfo: selectedPaletteEntry,\n selectedPaletteTheme,\n })\n );\n const calculateNewColors = React.useCallback(\n ({ paletteTheme, paletteInfo }): string[] => {\n // we don't have insertion orders if the user has gone beyond 6 range boundaries\n // in this case, the previously selected colors would be used\n // TODO(fkurniawan): A/C for more graceful state handling if more than 6 boundaries are configured\n if (rangeValues.length > 6) return selectedColors;\n return getNewColorsFromPalette({\n palettes,\n paletteTheme,\n paletteInfo,\n rangeValues,\n setIsReversed,\n });\n },\n [palettes, rangeValues, selectedColors]\n );\n\n const onChangePaletteTheme = React.useCallback(\n (newPaletteTheme): void => {\n const newColors = calculateNewColors({\n paletteTheme: newPaletteTheme,\n paletteInfo: selectedPaletteEntry,\n });\n setPalettesConfig(prev => ({ ...prev, paletteTheme: newPaletteTheme }));\n const newRanges = rangeValuesToContextConfig({ colors: newColors, rangeValues });\n onChange(null, null, newRanges);\n },\n [calculateNewColors, selectedPaletteEntry, rangeValues, onChange]\n );\n\n const onPaletteChange = React.useCallback(\n (newPaletteInfo): void => {\n const newColors = calculateNewColors({\n paletteTheme: selectedPaletteTheme,\n paletteInfo: newPaletteInfo,\n });\n setPalettesConfig(prev => ({ ...prev, paletteEntry: newPaletteInfo }));\n const newRanges = rangeValuesToContextConfig({ colors: newColors, rangeValues });\n onChange(null, null, newRanges);\n },\n [calculateNewColors, selectedPaletteTheme, rangeValues, onChange]\n );\n\n const handleOnRangeValueChange = React.useCallback(\n ({ colors, rangeValues: newRangeValues }): void => {\n const newRanges = rangeValuesToContextConfig({ colors, rangeValues: newRangeValues });\n onChange(null, null, newRanges);\n },\n [onChange]\n );\n\n // if the user changes the dataSelector (e.g. from major to trend) for something like background coloring,\n // reinitialize the palette config and the initial range values + colors using the newly selected formatter config (value)\n React.useEffect((): void => {\n setPalettesConfig(\n inferInitialPaletteFromContext({\n defaultPalettesConfig,\n palettes,\n ranges: sortedRanges,\n })\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedDataSelector]);\n\n return (\n <>\n <PalettesConfigurer\n isReversed={isReversed}\n isSwatchCustomized={isSwatchCustomized}\n onChangePaletteTheme={onChangePaletteTheme}\n onPaletteChange={onPaletteChange}\n palettes={palettes}\n selectedPaletteInfo={selectedPaletteEntry}\n selectedPaletteTheme={selectedPaletteTheme}\n />\n <RangeValueConfigurer\n customizedColors={isSwatchCustomized}\n isReversed={isReversed}\n onChange={handleOnRangeValueChange}\n precedence={getPrecedenceFromPalette({\n palettes,\n paletteTheme: selectedPaletteTheme,\n paletteInfo: selectedPaletteEntry,\n })}\n rangeValues={rangeValues}\n selectedColors={selectedColors}\n swatchColors={currentSwatchColors}\n setIsReversed={setIsReversed}\n />\n </>\n );\n};\n\nRangeValueEditor.propTypes = {\n /**\n * An onChange callback that allows the editor to customize the context accordingly based on the new thresholds\n */\n onChange: T.func,\n /**\n * The palettes object\n *\n * This consists of a theme and each themed-variant of the palettes\n */\n palettes: T.objectOf(\n T.shape({\n precedence: T.arrayOf(T.arrayOf(T.number)),\n swatches: T.arrayOf(T.arrayOf(T.string)),\n })\n ),\n /**\n * The initial ranges config from the viz context\n */\n value: T.any,\n};\n\nexport default RangeValueEditor;\n","import React, { useMemo } from 'react';\nimport type { RangesConfig } from '@splunk/visualization-encoding/formatters/RangeValue';\nimport ArrowLayer from '../../shared/ArrowLayer';\nimport { ColorPreview } from './ColorPreview';\nimport type { BasePreviewProps } from '../../interfaces/BasePreviewProps';\nimport PreviewWrapper from '../../shared/PreviewWrapper';\nimport { getSortedRanges } from './RangeValue/rangeValueUtils';\n\nconst MAX_PREVIEW_COLOR_COUNT = 8;\ninterface RangeValuePreviewProps extends BasePreviewProps {\n config: RangesConfig[];\n}\n\n/**\n * Range value previews always to map to colors\n */\nexport const RangeValuePreview: React.FunctionComponent<RangeValuePreviewProps> = ({\n config,\n}): React.ReactElement => {\n const sortedRanges = useMemo(() => getSortedRanges(config), [config]);\n const colors = useMemo(\n () => sortedRanges.map((entry): string => entry.value).slice(0, MAX_PREVIEW_COLOR_COUNT),\n [sortedRanges]\n );\n return (\n <PreviewWrapper>\n <ArrowLayer />\n <ColorPreview data-test=\"ColorPreview\" colors={colors} maxColorCount={MAX_PREVIEW_COLOR_COUNT} />\n </PreviewWrapper>\n );\n};\n","import * as React from 'react';\nimport { isEmpty } from 'lodash';\nimport styled from 'styled-components';\nimport Select from '@splunk/react-ui/Select';\nimport FormatFieldName from '../../shared/FormatFieldName';\nimport { getFilteredFields } from '../../utils/columnSelectionUtils';\nimport type { FieldTuple } from '../../utils/columnSelectionUtils';\nimport { useColumnSelectorFooterMessage } from '../useColumnSelectorFooterMessage';\n\nconst StyledSelectOption = styled(Select.Option)`\n padding-left: 20px;\n`;\n\nStyledSelectOption.displayName = 'ColumnOption';\n\nconst getLabelName = (name, type): string => (name !== '_time' ? `${name} - ${type}` : name);\n\ninterface AddColumnProps {\n availableFieldsWithTypes: FieldTuple[];\n columnFormatting;\n disableToggle: boolean;\n editorSupportedFormatOptions: {\n [type: string]: {\n [formatOption: string]: string;\n };\n };\n handleAddColumnFormatting: (e: Event, payload: { value: FieldTuple }) => void;\n placeholderMessage: string;\n}\n\nconst AddColumn: React.FunctionComponent<AddColumnProps> = ({\n availableFieldsWithTypes,\n columnFormatting,\n disableToggle,\n editorSupportedFormatOptions,\n handleAddColumnFormatting,\n placeholderMessage,\n}): React.ReactElement => {\n const [filter, setFilter] = React.useState('');\n const filteredFields = getFilteredFields(availableFieldsWithTypes, filter);\n const handleFilterChange = React.useCallback((e, { keyword }): void => {\n setFilter(keyword);\n }, []);\n\n const footerMessage = useColumnSelectorFooterMessage({\n availableFields: availableFieldsWithTypes,\n filteredFields,\n filter,\n noSelectedFieldsInfo: true,\n });\n const handleAddColumn = React.useCallback(\n (e, { value }): void => {\n const tuple: FieldTuple = availableFieldsWithTypes.find(field => field.name === value);\n handleAddColumnFormatting(e, { value: tuple });\n },\n [availableFieldsWithTypes, handleAddColumnFormatting]\n );\n\n return (\n <Select\n data-test=\"add-column-toggle\"\n disabled={disableToggle}\n filter\n footerMessage={footerMessage}\n inline={false}\n onFilterChange={handleFilterChange}\n onChange={handleAddColumn}\n placeholder={placeholderMessage}\n value={placeholderMessage}\n >\n {filteredFields.map((field): React.ReactElement => {\n const label = getLabelName(field.name, field.type);\n return (\n <StyledSelectOption\n data-test={`add-column-option-${label}`}\n disabled={\n !!columnFormatting.get(field.name) ||\n isEmpty(editorSupportedFormatOptions[field.type])\n }\n label={label}\n key={field.name}\n value={field.name}\n >\n <FormatFieldName columnName={field.name} dataType={field.type} />\n </StyledSelectOption>\n );\n })}\n </Select>\n );\n};\n\nexport default AddColumn;\n","import * as React from 'react';\nimport { ThemeContext } from 'styled-components';\nimport { cloneDeep, get, isEmpty, isPlainObject, set } from 'lodash';\nimport { isColor } from '@splunk/visualizations-shared/colorUtils';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport EncodingParser from '@splunk/visualization-encoding/EncodingParser';\nimport type { BaseEditorProps } from '../../interfaces/BaseEditorProps';\nimport ColorEditor from '../ColorEditor';\nimport CheckboxEditor from '../CheckboxEditor';\n\ninterface ThemeObject {\n defaultBackgroundColor?: string;\n}\n\ntype ThemesConfig = {\n defaultBackgroundColor?: (args: { theme: ThemeObject }) => string | undefined;\n} & Record<string, unknown>;\n\nexport interface TableBackgroundColorEditorProps extends BaseEditorProps {\n palette?: string[];\n themes?: ThemesConfig;\n}\n\n// Intrinsic dependency on table's default context. Any changes can break the editor.\n\nexport const FLAT_BY_THEME = '> table | seriesByIndex(0) | pick(tableRowBackgroundColorsByTheme)';\nexport const ALT_BY_THEME = '> table | seriesByIndex(0) | pick(tableAltRowBackgroundColorsByTheme)';\n\nexport const FLAT_BY_COLOR = '> table | seriesByIndex(0) | pick(tableRowBackgroundColorsByBackgroundColor)';\nexport const ALT_BY_COLOR = '> table | seriesByIndex(0) | pick(tableAltRowBackgroundColorsByBackgroundColor)';\n\nexport const HEADER_BACKGROUND_BY_COLOR =\n '> backgroundColor | setColorChannel(tableHeaderBackgroundColorConfig)';\nexport const ROW_COLOR_BY_CONTRAST = '> rowBackgroundColors | maxContrast(tableRowColorMaxContrast)';\nexport const HEADER_COLOR_BY_CONTRAST = '> headerBackgroundColor | maxContrast(tableRowColorMaxContrast)';\n\nexport const DEFAULT_BACKGROUND_COLOR = '> themes.defaultBackgroundColor';\n\ntype Option = string | number | boolean | null;\ntype Options = Record<string, Option | Record<string, Option>>;\n\ninterface CalculateStateArgs {\n options?: Options;\n value?: string;\n defaultBackgroundColor?: string;\n}\ninterface State {\n color: string;\n disableColor: boolean;\n shouldAltRows: boolean;\n disableAltRows: boolean;\n}\n\nexport const calculateState = ({\n options = {},\n value,\n defaultBackgroundColor,\n}: CalculateStateArgs = {}): State => {\n let color;\n let disableColor = false;\n let shouldAltRows = false;\n let disableAltRows = false;\n\n const backgroundColor = get(options, 'backgroundColor');\n const rowBackgroundColors = get(options, 'tableFormat.rowBackgroundColors', ALT_BY_THEME);\n\n if (isColor(backgroundColor)) {\n color = backgroundColor;\n } else if (EncodingParser.isDslString(backgroundColor) && !isColor(value)) {\n disableColor = true;\n } else if (isColor(value)) {\n color = value;\n } else if (isColor(defaultBackgroundColor)) {\n color = defaultBackgroundColor;\n }\n\n if (rowBackgroundColors === ALT_BY_COLOR || rowBackgroundColors === ALT_BY_THEME) {\n shouldAltRows = true;\n } else if (rowBackgroundColors === FLAT_BY_THEME || rowBackgroundColors === FLAT_BY_COLOR) {\n shouldAltRows = false;\n } else if (!isEmpty(rowBackgroundColors)) {\n disableAltRows = true;\n }\n\n return { color, disableColor, shouldAltRows, disableAltRows };\n};\ninterface OptionsObj {\n options: Options;\n}\ninterface CalculateOptionForBG {\n options?: Options;\n value?: string;\n defaultThemeBackgroundColor?: string;\n}\n\nexport const calculateOptionOnBackgroundColorChange = ({\n options = {},\n value,\n defaultThemeBackgroundColor,\n}: CalculateOptionForBG = {}): OptionsObj => {\n const newOptions = cloneDeep(options);\n const rowBackgroundColors = get(newOptions, 'tableFormat.rowBackgroundColors', ALT_BY_THEME);\n const rowColors = get(newOptions, 'tableFormat.rowColors');\n const headerColor = get(newOptions, 'tableFormat.headerColor');\n\n const headerBackgroundColor = get(newOptions, 'tableFormat.headerBackgroundColor');\n\n if (value && value === defaultThemeBackgroundColor) {\n set(newOptions, 'backgroundColor', DEFAULT_BACKGROUND_COLOR);\n if (rowBackgroundColors === ALT_BY_COLOR) {\n set(newOptions, 'tableFormat.rowBackgroundColors', ALT_BY_THEME);\n }\n if (rowColors === ROW_COLOR_BY_CONTRAST) {\n set(newOptions, 'tableFormat.rowColors', null);\n }\n if (headerBackgroundColor === HEADER_BACKGROUND_BY_COLOR) {\n set(newOptions, 'tableFormat.headerBackgroundColor', null);\n }\n if (headerColor === HEADER_COLOR_BY_CONTRAST) {\n set(newOptions, 'tableFormat.headerColor', null);\n }\n } else if (value && isColor(value)) {\n set(newOptions, 'backgroundColor', value);\n if (rowBackgroundColors === ALT_BY_THEME) {\n set(newOptions, 'tableFormat.rowBackgroundColors', ALT_BY_COLOR);\n } else if (rowBackgroundColors === FLAT_BY_THEME) {\n set(newOptions, 'tableFormat.rowBackgroundColors', FLAT_BY_COLOR);\n }\n if (isEmpty(headerBackgroundColor)) {\n set(newOptions, 'tableFormat.headerBackgroundColor', HEADER_BACKGROUND_BY_COLOR);\n }\n if (isEmpty(rowColors)) {\n set(newOptions, 'tableFormat.rowColors', ROW_COLOR_BY_CONTRAST);\n }\n if (isEmpty(headerColor)) {\n set(newOptions, 'tableFormat.headerColor', HEADER_COLOR_BY_CONTRAST);\n }\n }\n\n if (newOptions.tableFormat && isPlainObject(newOptions.tableFormat) && isEmpty(newOptions.tableFormat)) {\n set(newOptions, 'tableFormat', null);\n }\n\n return { options: newOptions };\n};\n\ninterface CalculateOptionsForAltRows {\n options?: Options;\n value?: boolean;\n}\n\nexport const calculateOptionsOnAltRowsChange = ({\n options = {},\n value,\n}: CalculateOptionsForAltRows = {}): OptionsObj => {\n const newOptions = cloneDeep(options);\n\n const backgroundColor = get(options, 'backgroundColor');\n const rowBackgroundColors = get(options, 'tableFormat.rowBackgroundColors', ALT_BY_THEME);\n const rowColors = get(options, 'tableFormat.rowColors');\n const headerColor = get(options, 'tableFormat.headerColor');\n const headerBackgroundColor = get(options, 'tableFormat.headerBackgroundColor');\n\n if (backgroundColor === DEFAULT_BACKGROUND_COLOR || backgroundColor === undefined) {\n if (\n typeof value === 'boolean' &&\n [ALT_BY_THEME, ALT_BY_COLOR, FLAT_BY_COLOR, FLAT_BY_THEME].includes(rowBackgroundColors)\n ) {\n set(newOptions, 'tableFormat.rowBackgroundColors', value === true ? ALT_BY_THEME : FLAT_BY_THEME);\n }\n } else {\n if (\n typeof value === 'boolean' &&\n [ALT_BY_THEME, ALT_BY_COLOR, FLAT_BY_COLOR, FLAT_BY_THEME].includes(rowBackgroundColors)\n ) {\n set(newOptions, 'tableFormat.rowBackgroundColors', value ? ALT_BY_COLOR : FLAT_BY_COLOR);\n }\n if (isEmpty(rowColors)) {\n set(newOptions, 'tableFormat.rowColors', ROW_COLOR_BY_CONTRAST);\n }\n if (isEmpty(headerBackgroundColor)) {\n set(newOptions, 'tableFormat.headerBackgroundColor', HEADER_BACKGROUND_BY_COLOR);\n }\n if (isEmpty(headerColor)) {\n set(newOptions, 'tableFormat.headerColor', HEADER_COLOR_BY_CONTRAST);\n }\n }\n return { options: newOptions };\n};\n\nexport const TableBackgroundColorEditor: React.FunctionComponent<TableBackgroundColorEditorProps> = ({\n options,\n onChange,\n labelPosition = 'left',\n labelWidth,\n value,\n palette,\n themes,\n}): React.ReactElement => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const theme: ThemeObject = React.useContext(ThemeContext) || {};\n\n const handleColorChange = React.useCallback(\n (event, editor, val): void => {\n const defaultThemeBackgroundColor =\n typeof themes?.defaultBackgroundColor === 'function'\n ? themes?.defaultBackgroundColor({ theme })\n : undefined;\n onChange(\n event,\n calculateOptionOnBackgroundColorChange({ options, value: val, defaultThemeBackgroundColor })\n );\n },\n [themes, theme, onChange, options]\n );\n\n const handleAltChange = React.useCallback(\n (event, editor, val): void => {\n onChange(event, calculateOptionsOnAltRowsChange({ options, value: val }));\n },\n [options, onChange]\n );\n\n const { color, disableColor, shouldAltRows, disableAltRows } = calculateState({\n options,\n value,\n defaultBackgroundColor: theme.defaultBackgroundColor,\n });\n return (\n <>\n <ColorEditor\n name=\"backgroundColor\"\n label={_('Background color')}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n itemSchema={{ default: theme.defaultBackgroundColor }}\n palette={\n Array.isArray(palette) && isColor(color) && !palette.includes(color)\n ? [...palette, color]\n : palette\n }\n value={color}\n isDisabled={disableColor}\n onChange={handleColorChange}\n />\n <CheckboxEditor\n name=\"alternateRowColors\"\n label={_('Alternate row colors')}\n labelPosition=\"right\"\n labelWidth={labelWidth}\n value={shouldAltRows}\n isDisabled={disableAltRows}\n itemSchema={{ type: 'boolean' }}\n onChange={handleAltChange}\n />\n </>\n );\n};\n","import * as React from 'react';\nimport { get, upperFirst } from 'lodash';\nimport styled, { ThemeContext } from 'styled-components';\nimport * as T from 'prop-types';\nimport { getLastFormatterFromDSL } from '@splunk/visualization-encoding/utils/dsl';\nimport { defaultPalettesConfig as initialPalettesConfig } from '@splunk/visualization-color-palettes/editors/PresetPalettes';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport RadioBar from '@splunk/react-ui/RadioBar';\nimport { toPx } from '@splunk/visualizations-shared/style';\nimport { FLYOUT_PADDING } from '../../shared/dimensionConstants';\nimport { FormatterEditor } from '../formatters/FormatterEditor';\nimport ColorEditor from '../ColorEditor';\nimport { columnColoringConfigPropType } from './common/props';\nimport type { ColumnColoringConfig } from './common/props';\nimport { sanitizeColumnName } from './columnFormattingUtils';\nimport type { ColumnColoringState } from '../../interfaces/ColumnFormatter';\nimport type { PalettesConfig } from '../../interfaces/PalettesConfig';\nimport type { FormatterUiConfig } from '../formatters/FormatterEditor';\n\nconst ColumnColorEditorWrapper = styled.div`\n padding: 14px ${toPx(FLYOUT_PADDING)};\n`;\n\nconst FormatterMethodWrapper = styled.div`\n margin-bottom: 8px;\n`;\n\n// TODO(fkurniawan): figure out if more complex data selectors are needed for Table DSL\n// currently, all column coloring dataSelectors are of the format `> table | seriesByName() | `\nconst dataSelectors = [];\n\ninterface ColumnColorEditorPropsInterface {\n columnColoring?: ColumnColoringState;\n columnColoringConfig: ColumnColoringConfig;\n columnName: string;\n columnDataType: string;\n defaultPalettesConfig?: PalettesConfig;\n // isSourceCustomized: boolean; TODO(fkurniawan): handle in follow up for source-customized column coloring\n handleColumnColoringUpdate: ({ columnName, coloringTypes, dynamicallyColoredOption }) => void;\n label?: string;\n}\n\nconst propTypes: Record<keyof ColumnColorEditorPropsInterface, T.Validator<any>> = {\n columnColoring: T.any,\n columnColoringConfig: columnColoringConfigPropType,\n columnName: T.string,\n columnDataType: T.string,\n defaultPalettesConfig: T.any,\n // isSourceCustomized: T.bool,\n handleColumnColoringUpdate: T.func,\n label: T.string,\n};\n\n// TODO(fkurniawan): need to address 'customized in source' if the user configures alternating colors\n// this would have a config like ['#000000', '#FF0000']\nexport const getStaticColor = (\n columnColoring = {},\n coloringType = '',\n themeContext = undefined,\n themes = undefined\n): string => {\n const formatter = getLastFormatterFromDSL(get(columnColoring, [coloringType, 'colorOptionDSL']));\n if (get(formatter, 'type') === 'pick') {\n // colorContextConfig should be array for pick\n return get(columnColoring, [coloringType, 'colorContextConfig', 0]);\n }\n return typeof themes?.textColor === 'function' ? themes?.textColor({ theme: themeContext }) : '#000000';\n};\n\n// retrieve the appropriate formatter type upon opening the Column Formatting UI:\n// parses DSL for the formatter, and if undefined, defaults to the first available formatter\n// first available formatter for `number`-typed columns is the RangeValue formatter; for `string`, the MatchValue formatter\nexport const getSelectedFormatterUponOpen = (\n columnColoring = {},\n formatters: FormatterUiConfig[] = []\n): FormatterUiConfig => {\n const dynamicallyColoredOption = get(columnColoring, ['_meta', 'dynamicallyColoredOption']);\n const selectedFormatterFromDSL = getLastFormatterFromDSL(\n get(columnColoring, [dynamicallyColoredOption, 'colorOptionDSL'])\n );\n\n // if no formatter has been defined for this option, return formatters[0]\n if (selectedFormatterFromDSL === undefined) {\n return get(formatters, [0]);\n }\n\n // finds the formatter based on type (`rangeValue`/`matchValue`) in DSL\n return formatters.find(formatterOption => formatterOption.value === selectedFormatterFromDSL.type);\n};\n\nconst ColumnColorEditor: React.FunctionComponent<ColumnColorEditorPropsInterface> = ({\n columnColoring,\n columnColoringConfig,\n columnDataType,\n columnName,\n defaultPalettesConfig = initialPalettesConfig,\n handleColumnColoringUpdate,\n label = _('Dynamic coloring'),\n}): React.ReactElement => {\n const theme = React.useContext(ThemeContext);\n const { coloringTypes, themes } = columnColoringConfig;\n\n // if column is of data type `string`, only expose MatchValue formatter\n const formatters = React.useMemo(\n () =>\n columnDataType === 'string'\n ? columnColoringConfig.formatters.filter(formatter => formatter.value === 'matchValue')\n : columnColoringConfig.formatters,\n [columnDataType, columnColoringConfig]\n );\n\n // only Text has static coloring support (i.e. rowColors)\n const staticTextColor = getStaticColor(columnColoring, 'rowColors', theme, themes);\n const dynamicallyColoredOptionFromDef = get(columnColoring, ['_meta', 'dynamicallyColoredOption']);\n\n const [selectedFormatter, setSelectedFormatter] = React.useState(\n getSelectedFormatterUponOpen(columnColoring, formatters)\n );\n\n const [dynamicallyColoredOption, setDynamicallyColoredOption] = React.useState(\n dynamicallyColoredOptionFromDef\n );\n const [formatterConfig, setFormatterConfig] = React.useState(\n get(columnColoring, [dynamicallyColoredOption, 'colorContextConfig'])\n );\n\n const handleDynamicallyColoredOptionChange = React.useCallback(\n (e, { value: newDynamicallyColoredOption }): void => {\n // multiple color options have to be updated when changing the type\n const updatedColoringTypes = [];\n const sanitizedColName = sanitizeColumnName(columnName);\n\n // handle side effects here\n // e.g. if rowBackgroundColors is the new dynamically powered color, rowColors becomes statically powered (by pick)\n switch (newDynamicallyColoredOption) {\n case 'Off':\n coloringTypes.forEach(({ value: coloringType }) => {\n // we need the colorContextKey stored separately from the DSL\n // since we delete DSL by setting it to undefined, we need know which corresponding contextKey needs to be cleared\n updatedColoringTypes.push({\n coloringType,\n colorContextKey: `${sanitizedColName}${upperFirst(coloringType)}EditorConfig`,\n colorOptionDSL: null,\n colorContextConfig: null,\n });\n });\n break;\n case 'rowBackgroundColors':\n updatedColoringTypes.push({\n coloringType: 'rowColors',\n colorContextKey: `${sanitizedColName}RowColorsEditorConfig`,\n colorContextConfig: [staticTextColor],\n colorOptionDSL: `> table | seriesByName('${columnName}') | pick(${sanitizedColName}RowColorsEditorConfig)`,\n });\n break;\n case 'rowColors':\n updatedColoringTypes.push({\n coloringType: 'rowBackgroundColors',\n colorContextKey: `${sanitizedColName}RowBackgroundColorsEditorConfig`,\n colorContextConfig: null,\n colorOptionDSL: null,\n });\n break;\n default:\n break;\n }\n\n // push the dynamically colored option as another color to update\n const { defaults, value: formatterName } = selectedFormatter;\n const newColorContextConfig = formatterConfig || defaults[newDynamicallyColoredOption];\n if (newDynamicallyColoredOption !== 'Off') {\n // e.g. column1RowColorsEditorConfig\n const colorContextKey = `${sanitizedColName}${upperFirst(\n newDynamicallyColoredOption\n )}EditorConfig`;\n updatedColoringTypes.push({\n coloringType: newDynamicallyColoredOption,\n colorContextKey,\n colorContextConfig: newColorContextConfig,\n colorOptionDSL: `> table | seriesByName('${columnName}') | ${formatterName}(${colorContextKey})`,\n });\n }\n\n setDynamicallyColoredOption(newDynamicallyColoredOption);\n handleColumnColoringUpdate({\n columnName,\n coloringTypes: updatedColoringTypes,\n dynamicallyColoredOption: newDynamicallyColoredOption,\n });\n if (!formatterConfig) {\n // persist formatter config state when switching options if there was no pre-existing dynamic coloring\n setFormatterConfig(newColorContextConfig);\n }\n },\n [\n coloringTypes,\n columnName,\n formatterConfig,\n handleColumnColoringUpdate,\n selectedFormatter,\n staticTextColor,\n ]\n );\n\n const handleStaticColorChange = React.useCallback(\n (e, coloringType, value) => {\n const colorContextKey = `${sanitizeColumnName(columnName)}${upperFirst(\n coloringType\n )}EditorConfig`;\n handleColumnColoringUpdate({\n columnName,\n coloringTypes: [\n {\n coloringType,\n colorContextKey,\n colorContextConfig: [value],\n colorOptionDSL: `> table | seriesByName(\"${columnName}\") | pick(${colorContextKey})`,\n },\n ],\n dynamicallyColoredOption,\n });\n },\n [columnName, dynamicallyColoredOption, handleColumnColoringUpdate]\n );\n\n const handleFormatterConfigChange = React.useCallback(\n (_e, _editorName, newColorContextConfig): void => {\n const { value: formatterName } = selectedFormatter;\n const colorContextKey = `${sanitizeColumnName(columnName)}${upperFirst(\n dynamicallyColoredOption\n )}EditorConfig`;\n setFormatterConfig(newColorContextConfig);\n handleColumnColoringUpdate({\n columnName,\n coloringTypes: [\n {\n coloringType: dynamicallyColoredOption,\n colorContextKey,\n colorContextConfig: newColorContextConfig,\n colorOptionDSL: `> table | seriesByName(\"${columnName}\") | ${formatterName}(${colorContextKey})`,\n },\n ],\n dynamicallyColoredOption,\n });\n },\n [columnName, dynamicallyColoredOption, handleColumnColoringUpdate, selectedFormatter]\n );\n\n // TODO(fkurniawan): handle multiple formatters when number has high/low editor; currently only RangeValueEditor is present\n const handleFormatterChange = React.useCallback(\n (evt, name, formatterValue): void => {\n const newlySelectedFormatter = formatters.find(formatter => formatter.value === formatterValue);\n const { defaults } = newlySelectedFormatter;\n\n const newColorContextConfig = defaults[dynamicallyColoredOption];\n const colorContextKey = `${sanitizeColumnName(columnName)}${upperFirst(\n dynamicallyColoredOption\n )}EditorConfig`;\n\n // update the formatter and its respective config\n setSelectedFormatter(newlySelectedFormatter);\n setFormatterConfig(newColorContextConfig);\n handleColumnColoringUpdate({\n columnName,\n coloringTypes: [\n {\n coloringType: dynamicallyColoredOption,\n colorContextKey,\n colorContextConfig: newColorContextConfig,\n colorOptionDSL: `> table | seriesByName(\"${columnName}\") | ${formatterValue}(${colorContextKey})`,\n },\n ],\n dynamicallyColoredOption,\n });\n },\n [formatters, columnName, dynamicallyColoredOption, handleColumnColoringUpdate, setFormatterConfig]\n );\n\n return (\n <ColumnColorEditorWrapper>\n <ControlGroup label={_(label)} labelPosition=\"top\">\n <RadioBar\n data-test=\"dynamic-color-option\"\n onChange={handleDynamicallyColoredOptionChange}\n value={dynamicallyColoredOption}\n >\n <RadioBar.Option value=\"Off\" label={_('Off')} />\n {coloringTypes.map(({ label: optionLabel, value }) => (\n <RadioBar.Option value={value} label={_(optionLabel)} key={value} />\n ))}\n </RadioBar>\n </ControlGroup>\n {dynamicallyColoredOption && dynamicallyColoredOption !== 'Off' && (\n <>\n {formatters.length === 1 && (\n <FormatterMethodWrapper data-test=\"single-formatter-method\">\n Method: {selectedFormatter.label}\n </FormatterMethodWrapper>\n )}\n <FormatterEditor\n selectedDataSelector={dynamicallyColoredOption}\n selectedFormatterType={selectedFormatter.value}\n currentFormatterConfig={formatterConfig}\n onFormatterTypeChange={handleFormatterChange}\n onFormatterConfigChange={handleFormatterConfigChange}\n formatters={formatters}\n dataSelectors={dataSelectors}\n defaultPalettesConfig={defaultPalettesConfig}\n />\n {dynamicallyColoredOption === 'rowBackgroundColors' && (\n <ColorEditor\n name=\"rowColors\"\n value={staticTextColor}\n label={_('Static text color')}\n labelPosition=\"top\"\n onChange={handleStaticColorChange}\n textWidth=\"100%\"\n />\n )}\n </>\n )}\n </ColumnColorEditorWrapper>\n );\n};\n\nColumnColorEditor.propTypes = propTypes;\n\nexport default ColumnColorEditor;\n","import * as React from 'react';\nimport styled from 'styled-components';\nimport Popover from '@splunk/react-ui/Popover';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport { pick, variables } from '@splunk/themes';\nimport { toPx } from '@splunk/visualizations-shared/style';\nimport Pencil from '@splunk/react-icons/Pencil';\nimport TrashCanCross from '@splunk/react-icons/TrashCanCross';\nimport { _ } from '@splunk/ui-utils/i18n';\n\nimport ClickableIcon from '../../shared/ClickableIcon';\nimport FormatFieldName from '../../shared/FormatFieldName';\nimport Separator from '../../shared/Separator';\nimport { FLYOUT_WIDTH } from '../../shared/dimensionConstants';\nimport FormatByTypeEditor from './FormatByTypeEditor';\nimport ColumnColorEditor from './ColumnColorEditor';\nimport type { ColumnColoringConfig, FlyoutConfig } from './common/props';\nimport Header from '../../shared/Header';\nimport { TextDataType } from './columnFormattingUtils';\nimport type { ColumnColoringState, ColumnEntry } from '../../interfaces/ColumnFormatter';\n\n// TODO(fkurniawan): sync with updated UDF designs\nconst ColumnFormatterToggle = styled.div.attrs((props): { 'data-test': string } => ({\n 'data-test': props['data-test'],\n}))`\n flex: 1;\n display: flex;\n align-items: center;\n display: flex;\n justify-content: space-between;\n margin-bottom: 14px;\n padding-left: 15px;\n background-color: ${pick({\n enterprise: {\n light: variables.backgroundColorPage,\n dark: variables.backgroundColorSection,\n },\n prisma: variables.backgroundColorSection,\n })};\n color: transparent;\n &:last-of-type {\n margin-bottom: 4px;\n }\n`;\n\nconst PopoverContents = styled.div`\n background-color: ${variables.backgroundColorPopup};\n width: ${toPx(FLYOUT_WIDTH)};\n max-height: 95vh;\n overflow-y: auto;\n padding: 8px 0px;\n`;\n\nconst SelectedColumnLabel = styled.span`\n display: inline-block;\n`;\n\nconst IconsWrapper = styled.div`\n align-items: center;\n display: flex;\n`;\n\nconst StyledHeader = styled(Header)`\n cursor: auto;\n font-weight: 600;\n font-size: 14px;\n padding: 4px 16px;\n`;\n\nconst ColumnFormatterHeader = styled.span`\n font-weight: 500;\n font-size: 14px;\n margin-bottom: 7px;\n`;\n\ntype FlyoutConfigRows = FlyoutConfig[keyof FlyoutConfig];\n\ninterface ColumnTogglePropsInterface {\n columnColoring?: ColumnColoringState;\n columnColoringConfig: ColumnColoringConfig;\n columnFormattingByType: ColumnEntry['formatByType'];\n columnTextFormatting?: ColumnEntry['formatText'];\n columnName: string;\n columnDataType: string;\n defaultOptionsByType?: {\n [type: string]: {\n [option: string]: string | boolean | number;\n };\n };\n flyoutConfigForDataType: FlyoutConfigRows;\n textFormatConfig: FlyoutConfigRows;\n isSourceCustomized: boolean;\n removeColumnFormatting: (payload: { columnName: string; columnDataType: string }) => void;\n resetColumnToDefault: (payload: { columnName: string; columnDataType: string }) => void;\n updateColumnColoring: (payload: {\n columnName: string;\n coloringTypes: string[];\n dynamicallyColoredOption;\n }) => void;\n updateColumnFormatting: (payload: { columnName: string; optionName: string; value: string }) => void;\n updateColumnTextFormatting?: (payload: { columnName: string; optionName: string; value: string }) => void;\n}\n\nconst ColumnFormatterEntry: React.FunctionComponent<ColumnTogglePropsInterface> = ({\n columnColoring,\n columnColoringConfig,\n columnName,\n columnFormattingByType,\n columnTextFormatting,\n columnDataType,\n defaultOptionsByType = {},\n flyoutConfigForDataType,\n textFormatConfig,\n isSourceCustomized,\n removeColumnFormatting,\n resetColumnToDefault,\n updateColumnFormatting,\n updateColumnColoring,\n updateColumnTextFormatting,\n}): React.ReactElement => {\n const [flyoutOpen, setFlyoutOpen] = React.useState(false);\n const handleFlyoutOpen = React.useCallback((): void => setFlyoutOpen(true), []);\n const handleFlyoutClose = React.useCallback((): void => setFlyoutOpen(false), []);\n const anchor = React.useRef(null);\n\n const handleRemoveColumnFormatting = React.useCallback(\n (): void => removeColumnFormatting({ columnName, columnDataType }),\n [columnName, columnDataType, removeColumnFormatting]\n );\n\n const handleResetColumnToDefault = React.useCallback(\n (): void => resetColumnToDefault({ columnName, columnDataType }),\n [columnName, columnDataType, resetColumnToDefault]\n );\n\n return (\n <>\n <ColumnFormatterToggle ref={anchor} data-test={`column-toggle-${columnName}`}>\n <Tooltip data-test={`selected-column-label-${columnName}`}>\n <SelectedColumnLabel>\n <FormatFieldName columnName={columnName} dataType={columnDataType} />\n </SelectedColumnLabel>\n </Tooltip>\n <IconsWrapper>\n <ClickableIcon dataTestKey={`edit-column-icon-${columnName}`} onClick={handleFlyoutOpen}>\n <Pencil />\n </ClickableIcon>\n <ClickableIcon\n dataTestKey={`remove-column-icon-${columnName}`}\n onClick={handleRemoveColumnFormatting}\n >\n <TrashCanCross />\n </ClickableIcon>\n </IconsWrapper>\n </ColumnFormatterToggle>\n\n <Popover\n data-test={`column-formatter-flyout-${columnName}`}\n anchor={anchor.current}\n open={flyoutOpen}\n onRequestClose={handleFlyoutClose}\n appearance=\"normal\"\n defaultPlacement=\"horizontal\"\n >\n <PopoverContents data-test=\"popover-contents\">\n <StyledHeader>\n <ColumnFormatterHeader data-test=\"column-formatter-flyout-header\">\n {`${_('Column formatting')}: \"${columnName}\"`}\n </ColumnFormatterHeader>\n </StyledHeader>\n <FormatByTypeEditor\n columnFormatting={columnTextFormatting}\n columnDataType={TextDataType}\n columnName={columnName}\n defaultOptionsByType={defaultOptionsByType}\n flyoutConfigForDataType={textFormatConfig}\n handleResetColumnToDefault={handleResetColumnToDefault}\n updateColumnFormatting={updateColumnTextFormatting}\n isSourceCustomized={false}\n />\n <Separator />\n <FormatByTypeEditor\n columnFormatting={columnFormattingByType}\n columnDataType={columnDataType}\n columnName={columnName}\n defaultOptionsByType={defaultOptionsByType}\n flyoutConfigForDataType={flyoutConfigForDataType}\n handleResetColumnToDefault={handleResetColumnToDefault}\n updateColumnFormatting={updateColumnFormatting}\n isSourceCustomized={isSourceCustomized}\n />\n {(columnDataType === 'number' || columnDataType === 'string') && (\n <>\n <Separator />\n <ColumnColorEditor\n columnColoring={columnColoring}\n columnColoringConfig={columnColoringConfig}\n columnDataType={columnDataType}\n columnName={columnName}\n handleColumnColoringUpdate={updateColumnColoring}\n />\n </>\n )}\n </PopoverContents>\n </Popover>\n </>\n );\n};\n\nexport default ColumnFormatterEntry;\n","/**\n * Utility functions for table dynamic color operations\n */\n\n/**\n * Helper function to clear dynamic coloring based on current mode\n * @param colorMode - The current color mode ('background' or 'text')\n * @returns Object with the appropriate property set to undefined\n */\nexport const clearDynamicColoring = (colorMode: 'background' | 'text'): Record<string, any> => {\n const updates: Record<string, any> = {};\n if (colorMode === 'background') {\n updates.rowBackgroundColors = undefined;\n } else if (colorMode === 'text') {\n updates.rowColors = undefined;\n }\n return updates;\n};\n\n/**\n * Helper function to move DSL between background and text modes\n * @param fromMode - The mode to move from ('background' or 'text')\n * @param toMode - The mode to move to ('background' or 'text')\n * @param tableFormat - The table format object containing the DSL\n * @returns Object with DSL moved from one mode to another\n */\nexport const moveDslBetweenModes = (\n fromMode: 'background' | 'text',\n toMode: 'background' | 'text',\n tableFormat: Record<string, any>\n): Record<string, any> => {\n const fromKey = fromMode === 'background' ? 'rowBackgroundColors' : 'rowColors';\n const toKey = toMode === 'background' ? 'rowBackgroundColors' : 'rowColors';\n\n const dsl = tableFormat[fromKey] || '> table | gradient(tableFormatEditorConfig)';\n const processedDsl = dsl.replace(/tableFormatEditorConfig/g, 'tableFormatEditorConfig');\n\n return {\n [toKey]: processedDsl,\n [fromKey]: undefined,\n };\n};\n","import * as React from 'react';\nimport styled from 'styled-components';\nimport { get, isEmpty } from 'lodash';\nimport { toPx } from '@splunk/visualizations-shared/style';\nimport ColumnLayout from '@splunk/react-ui/ColumnLayout';\nimport CustomizedInSourceMessage from '../../shared/CustomizedInSourceMessage';\nimport { editorTypeToComponentMap } from '../../containers/EditorItem';\nimport { COLUMN_FLYOUT_PADDING } from '../../shared/dimensionConstants';\nimport { TextDataType } from './columnFormattingUtils';\nimport type { ColumnEntry } from '../../interfaces/ColumnFormatter';\nimport type { FlyoutConfig } from './common/props';\n\nconst rowKey = (row, rItr): string => `row_${row.map((i): string => i.option).join('_')}_${rItr}`;\n\nconst SUI_COL_SPAN_TOTAL = 12; // Each column defines in own span, but the total in a row must be 12\n\nconst FormatByTypeEditorContents = styled.div`\n padding: 12px ${toPx(COLUMN_FLYOUT_PADDING)};\n`;\n\ntype ColumnFormattingState = ColumnEntry['formatByType'] | ColumnEntry['formatText'] | undefined;\ntype FlyoutConfigRows = FlyoutConfig[keyof FlyoutConfig];\n\ninterface FormatByTypeEditorPropsInterface {\n columnFormatting?: ColumnFormattingState;\n columnName: string;\n columnDataType: string;\n defaultOptionsByType?: {\n [type: string]: {\n [option: string]: string | boolean | number;\n };\n };\n flyoutConfigForDataType: FlyoutConfigRows;\n isSourceCustomized: boolean;\n handleResetColumnToDefault: (payload: { columnName: string; columnDataType: string }) => void;\n updateColumnFormatting: (payload: { columnName: string; optionName: string; value: string }) => void;\n}\n\nexport const getEditorItemValue = (\n item: Record<string, unknown>,\n columnFormatting: ColumnFormattingState,\n columnDataType: string,\n defaultOptionsByType: FormatByTypeEditorPropsInterface['defaultOptionsByType']\n): number | string | boolean | undefined => {\n const editorPersistedValue =\n columnDataType === TextDataType\n ? get(columnFormatting, item.option)\n : get(columnFormatting, [columnDataType, item.option]);\n if (editorPersistedValue !== undefined) {\n return editorPersistedValue;\n }\n return get(defaultOptionsByType, [columnDataType, item.option]);\n};\n\n// TODO(fkurniawan): consolidate isCustomizedSourceMessage\n// currently, if ColumnColorEditor and FormatByTypeEditor are source-customized, two \"customized in source\" messages will appear\nconst FormatByTypeEditor: React.FunctionComponent<FormatByTypeEditorPropsInterface> = ({\n columnFormatting,\n columnDataType,\n columnName,\n defaultOptionsByType = {},\n flyoutConfigForDataType,\n handleResetColumnToDefault,\n updateColumnFormatting,\n isSourceCustomized,\n}): React.ReactElement => {\n const handleUpdateColumnFormatting = React.useCallback(\n (e, optionName, value): void => updateColumnFormatting({ columnName, optionName, value }),\n [columnName, updateColumnFormatting]\n );\n\n return (\n <FormatByTypeEditorContents>\n {isSourceCustomized ? (\n <CustomizedInSourceMessage\n onResetToDefault={handleResetColumnToDefault}\n style={{ padding: `0px 0px 16px 0px`, width: 'auto' }}\n />\n ) : (\n <ColumnLayout>\n {flyoutConfigForDataType.map(\n (row, rItr): React.ReactElement => (\n <ColumnLayout.Row\n key={rowKey(row, rItr)}\n data-test=\"column-formatter-flyout-row\"\n style={{\n marginBottom: rItr === flyoutConfigForDataType.length ? '0px' : '12px',\n }}\n >\n {row.map((item, iItr): React.ReactElement => {\n let editorItem = null;\n const colSpan = SUI_COL_SPAN_TOTAL / row.length;\n const colOption = item ? `${item.option}_` : '';\n const colKey = `item_${colOption}${rItr}_${iItr}`;\n\n // If item is an empty object, it's just for alignment purposes\n if (!isEmpty(item)) {\n const EditorItem = editorTypeToComponentMap[item.editor];\n editorItem = (\n <EditorItem\n {...item.editorProps}\n label={item.label}\n name={item.option}\n itemSchema={item.itemSchema}\n value={getEditorItemValue(\n item,\n columnFormatting,\n columnDataType,\n defaultOptionsByType\n )}\n onChange={handleUpdateColumnFormatting}\n />\n );\n }\n return (\n <ColumnLayout.Column key={colKey} span={colSpan}>\n {editorItem}\n </ColumnLayout.Column>\n );\n })}\n </ColumnLayout.Row>\n )\n )}\n </ColumnLayout>\n )}\n </FormatByTypeEditorContents>\n );\n};\n\nexport default FormatByTypeEditor;\n","import { cloneDeep, get, isEmpty, isPlainObject, pick, set, unset } from 'lodash';\nimport EncodingParser from '@splunk/visualization-encoding/EncodingParser';\nimport { getLastFormatterFromDSL } from '@splunk/visualization-encoding/utils/dsl';\nimport type { FieldTuple } from '../../utils/columnSelectionUtils';\nimport type {\n ColumnEntry,\n EditorSupportedFormatOptions,\n ColumnFormatOptions,\n ColumnTextFormatOptions,\n} from '../../interfaces/ColumnFormatter';\n\nconst EDITOR_CONFIG_SUFFIX = 'ColumnFormatEditorConfig';\n// hardcoded table coloring\n// TODO(fkurniawan): look into cleaning this up when accounting for 'customized in source'\nconst supportedFormatters = {\n pick: 'pick',\n rangeValue: 'rangeValue',\n matchValue: 'matchValue',\n};\n\nconst supportedTextFormatTypes = {\n align: 'align',\n headerAlign: 'headerAlign',\n textOverflow: 'textOverflow',\n};\n\nconst supportedColumnFormatEditorOptions = {\n rowBackgroundColors: 'rowBackgroundColors',\n rowColors: 'rowColors',\n data: 'data',\n ...supportedTextFormatTypes,\n};\n\nexport const TextDataType = 'text';\n\n/**\n * Extract the list of text formatting options for a specific column from the column format options.\n * @param {string} columnName\n * @param {ColumnEntry} columnFormatOptions\n * @returns {ColumnTextFormatOptions}\n */\nexport const getExistingTextFormatting = (\n columnName: string,\n columnFormatOptions: ColumnFormatOptions\n): ColumnTextFormatOptions => {\n const formatText = {};\n Object.keys(supportedTextFormatTypes).forEach(textFormatType => {\n const textFormatValue = get(columnFormatOptions, [columnName, textFormatType]);\n if (textFormatValue) {\n formatText[textFormatType] = textFormatValue;\n }\n });\n return formatText;\n};\n\n/**\n * Extract the list of editorSupportedFormatOptions for a given dataType\n *\n * since numbro custom formatting can conflict with the limited editor supported format options subset,\n * we need this to determine when the user has configured non-editor supported format options\n *\n * @param {Object} flyoutConfig\n */\nexport const getEditorSupportedFormatOptions = (flyoutConfig): EditorSupportedFormatOptions => {\n const editorSupportedFormatOptions = { text: {} };\n Object.keys(flyoutConfig).forEach((dataType): void => {\n editorSupportedFormatOptions[dataType] = {};\n flyoutConfig[dataType].forEach((configRow): void => {\n configRow.forEach((item): void => {\n editorSupportedFormatOptions[dataType][item.option] = item.option;\n });\n });\n });\n return editorSupportedFormatOptions;\n};\n\n/**\n * helper to convert availableFieldsWithTypes to a map of { [columnName]: dataType }\n *\n * @param {FieldTuple[]} availableFieldsWithTypes - available fields for the given datasource\n *\n * @returns {Object}\n */\nexport const getColumnDataTypeMap = (\n availableFieldsWithTypes: FieldTuple[]\n): { [columnName: string]: string } =>\n availableFieldsWithTypes.reduce(\n (\n zippedColumnsAndFields,\n { name, type }\n ): {\n [columnName: string]: string;\n } => {\n // eslint-disable-next-line no-param-reassign\n zippedColumnsAndFields[name] = type;\n return zippedColumnsAndFields;\n },\n {}\n );\n\n/**\n * helper to remove white space and dashes in column name with an underscore (since this causes issues when trying to reference a DSL context config key)\n * if the column name begins with a number, prepend an underscore so that the DSL recognizes it as an identifier\n *\n * @param {String} columnName - columnName to be sanitized\n *\n * @returns {String}\n */\nexport const sanitizeColumnName = (columnName: string): string => {\n // prefix context key with a leading underscore if column starts with number, since string identifiers in context can't have leading digits\n // a leading digit would conflict with numeric literals for arguments (e.g. seriesByIndex(0)) since nearley does not allow backtracking\n // since other special characters will be replaced, we only need to check for leading digits (since we allow for non-leading digits in identifiers)\n let sanitizedColumnName = columnName;\n if (columnName.match(/^[0-9]/)) {\n sanitizedColumnName = `_${sanitizedColumnName}`;\n }\n\n return `${sanitizedColumnName.replace(/[^a-zA-Z0-9]/g, '_')}`;\n};\n\n/**\n * Checks if the user configured formatting (either table or column) options beyond the editor-supported options\n *\n * @param {Object} configFormat - the formatting object used to specify column-specific formatting or global table formatting for a given dataType\n * @param {Object} editorSupportedFormatOptions - hashified map of editor supported formatting options\n *\n * @returns {Boolean}\n */\nexport const checkExceedsEditorCapabilities = (\n configFormat: Record<string, unknown>,\n editorSupportedFormatOptions: { [formatOptionName: string]: string }\n): boolean => {\n return Object.keys(configFormat).some(\n (configFormatOption): boolean => !editorSupportedFormatOptions[configFormatOption]\n );\n};\n\n/**\n * Obtains the context key used for a table-formatting DSL string from the options.tableFormat or options.columnFormat[columnName]\n * e.g. getFormattingOptDSLKey({ data: '> table | formatByType(contextKey)' }) would return 'contextKey'\n *\n * @param {Object} formattingOpt - the original options.columnFormat or options.tableFromat in the viz definition\n *\n * @returns {String}\n */\nexport const getFormattingOptDSLKey = (formattingOpt: { data?: string | string[] | null } = {}): string => {\n if (typeof formattingOpt.data !== 'string' || !EncodingParser.isDslString(formattingOpt.data)) {\n return null;\n }\n return get(getLastFormatterFromDSL(formattingOpt.data), 'paramKey', null);\n};\n\n/**\n * Obtains the table-wide formatting applied applied to the table viz for a given data type\n *\n * @param {Object} tableFormatOpt - the DSL used to provide table-wide formatting (e.g. '> table | formatByType(customTableFormatting)'),\n * @param {String} dataType - the data type formatting to obtain\n * @param {Object} context - the table viz context\n *\n * @returns {Object}\n */\nexport const getGlobalTableFormatting = (\n tableFormatOpt: Record<string, unknown>,\n dataType: string,\n context: Record<string, unknown>\n): Record<string, unknown> => {\n const tableFormatDSLContextKey = getFormattingOptDSLKey(tableFormatOpt);\n return get(context, [tableFormatDSLContextKey, dataType], {});\n};\n\n/**\n * Check if the columnFormat option for a given columnName has properties which are configurable by editor\n * Right now this is limited to `data` which is powered by formatByType,\n *\n * @param {Object} columnFormat\n */\nconst isColumnFormatEditorConfigurable = (columnFormat, columnName): boolean => {\n if (!columnFormat[columnName]) {\n return true;\n }\n return Object.keys(columnFormat[columnName]).some(\n (subOption): boolean => !!supportedColumnFormatEditorOptions[subOption]\n );\n};\n\n/**\n * Returns `true` if the formatter is of type `rangeValue` or `matchValue`, and `false` otherwise.\n *\n * @param {string} formatterType\n */\nexport const isValidColorFormatter = (formatterType: string): boolean => {\n return formatterType === 'rangeValue' || formatterType === 'matchValue';\n};\n\nexport interface GetInitialColumnFormattingStateArgs {\n availableFieldsWithTypes: FieldTuple[];\n coloringTypes?: { value: string }[];\n columnFormatOption: Record<string, unknown>;\n editorSupportedFormatOptions: Record<string, Record<string, string>>;\n vizContext: Record<string, unknown>;\n}\n\n/**\n * Returns the initial column state given the original viz def and context as a Map\n * To prevent the editor column list from reordering, a Map is used to track addition/deletion order\n *\n * @param {FieldTuple[]} param.availableFieldsWithTypes - all available field types to use for\n * @param {Object} param.columnFormatOption - original value of options.columnFormat from the viz definition\n * @param {{dataType, String[]}} param.editorSupportedOptions - object holding editor-supported options for a given dataType\n * @param {Object} param.vizContext - the table viz context\n *\n * @returns {Map<string, ColumnEntry>}\n */\nexport const getInitialColumnFormattingState = ({\n availableFieldsWithTypes,\n coloringTypes = [],\n columnFormatOption,\n editorSupportedFormatOptions,\n vizContext,\n}: GetInitialColumnFormattingStateArgs): Map<string, ColumnEntry> => {\n if (!columnFormatOption || typeof columnFormatOption !== 'object') {\n return new Map();\n }\n\n const columnDataTypeMap = getColumnDataTypeMap(availableFieldsWithTypes);\n return Object.keys(columnFormatOption).reduce((initialState, columnName): Map<string, ColumnEntry> => {\n const columnDataType = columnDataTypeMap[columnName];\n const columnDSLContextKey = getFormattingOptDSLKey(columnFormatOption[columnName]);\n const columnFormatByTypeContextConfig = vizContext[columnDSLContextKey];\n const hasInvalidContextKey =\n EncodingParser.isDslString(get(columnFormatOption, [columnName, 'data'])) &&\n !columnFormatByTypeContextConfig;\n\n // this checks if the columnFormat[fieldName] contained fields like `align`,\n // if no editor configurable options are available, don't add this to the list of initial columns\n if (!isColumnFormatEditorConfigurable(columnFormatOption, columnName)) {\n return initialState;\n }\n\n const formatText = getExistingTextFormatting(columnName, columnFormatOption);\n\n // currently, we only allow text or background coloring via editor for number or string data\n if (!isEmpty(editorSupportedFormatOptions[columnDataType]) && !hasInvalidContextKey) {\n const columnColoring = { _meta: { dynamicallyColoredOption: 'Off' } };\n\n // hardcode editor edge case for determining the dynamically powered option\n // TODO(fkurniawan): account for 'customized in source' derivation for Table Dynamic Coloring\n // TODO(fkurniawan): more generalizable logic\n const rowColorsFormatter = get(\n getLastFormatterFromDSL(get(columnFormatOption, [columnName, 'rowColors'])),\n 'type'\n );\n const rowBackgroundColorsFormatter = get(\n getLastFormatterFromDSL(get(columnFormatOption, [columnName, 'rowBackgroundColors'])),\n 'type'\n );\n\n // our column coloring editor only supports two dynamic coloring states:\n // 1. rowColors is dynamically powered, and rowBackgroundColors is not used\n // 2. rowBackgroundColors is dynamically powered, and rowColors is statically powered by pick\n if (isValidColorFormatter(rowColorsFormatter) && !rowBackgroundColorsFormatter) {\n // eslint-disable-next-line no-underscore-dangle\n columnColoring._meta.dynamicallyColoredOption = 'rowColors';\n } else if (rowColorsFormatter === 'pick' && isValidColorFormatter(rowBackgroundColorsFormatter)) {\n // eslint-disable-next-line no-underscore-dangle\n columnColoring._meta.dynamicallyColoredOption = 'rowBackgroundColors';\n }\n\n // currently only rowColors or rowBackgroundColors, but can be expanded to include sparklineColors or sparklineAreaColors\n coloringTypes.forEach(({ value }): void => {\n const colorOptionDSL = get(columnFormatOption, [columnName, value]);\n if (colorOptionDSL) {\n // because static coloring (i.e. pick) is only supported for Text coloring as per designs, there is a lot of hard-coded edge case logic\n const { type: formatter, paramKey: colorContextKey } =\n getLastFormatterFromDSL(colorOptionDSL) ||\n ({} as ReturnType<typeof getLastFormatterFromDSL>);\n\n // do not initialize pick formatting in state if background colors is not powered by ranges or matches\n if (\n formatter === 'pick' &&\n value === 'rowColors' &&\n !isValidColorFormatter(rowBackgroundColorsFormatter)\n ) {\n return;\n }\n\n // do not initialize pick formatting in state if applied on anything besides row text colors\n if ((formatter === 'pick' && value !== 'rowColors') || !supportedFormatters[formatter]) {\n return;\n }\n\n // do not initialize dynamic rowBackgroundColors if row text color is not statically powered\n if (\n isValidColorFormatter(formatter) &&\n value === 'rowBackgroundColors' &&\n rowColorsFormatter !== 'pick'\n ) {\n return;\n }\n\n columnColoring[value] = {\n colorContextKey,\n // TODO(fkurniawan): what happens if the user started off with malformed DSL (e.g. non-existent contextKey)?\n colorContextConfig: get(vizContext, [colorContextKey], {}),\n colorOptionDSL,\n };\n }\n });\n\n const hasEditorSupportedColoring = Object.keys(columnColoring).length > 1;\n const preexistingFormatByTypeConfig = get(vizContext, [columnDSLContextKey, columnDataType], {});\n if (\n hasEditorSupportedColoring ||\n !isEmpty(preexistingFormatByTypeConfig) ||\n !isEmpty(formatText)\n ) {\n initialState.set(columnName, {\n columnColoring,\n formatByType: {\n [columnDataType]: {\n // prevent persisting non-editor supported options into editor state\n // this can happen if the user adds dynamic coloring while the other format options are source-customized\n ...pick(\n preexistingFormatByTypeConfig,\n Object.keys(editorSupportedFormatOptions[columnDataType])\n ),\n _meta: {\n exceedsEditorCapabilities: checkExceedsEditorCapabilities(\n get(columnFormatByTypeContextConfig, [columnDataType], {}),\n editorSupportedFormatOptions[columnDataType]\n ),\n },\n },\n },\n formatText,\n });\n }\n }\n return initialState;\n }, new Map());\n};\n\n/**\n * internal helper for checking if a given context entry is empty\n *\n * @param {Object} contextConfigEntry\n */\nconst isContextConfigEmpty = (contextConfigEntry): boolean => {\n return Object.keys(contextConfigEntry).every((formattingDataType): boolean =>\n isEmpty(contextConfigEntry[formattingDataType])\n );\n};\n\n/**\n * Converts the editorColumnFormatting state persisted in the definition into a { context, options } entry that can be merged into the viz definition\n * The updatedEditorColumnFormatting should hold all of the formatting options (both original and newly applied)\n *\n * the columnFormatting option is persisted in the viz definition as follows:\n * {\n * context: {\n * ...otherContextConfigs,\n * col1FormatConfig: {\n * precision: 1,\n * thousandSeparated: true,\n * }\n * col2FormatConfig: { ...cellSpecificFormatting }\n * },\n * option: {\n * columnFormat: {\n * col1: {\n * data: '> table | seriesByName(\"col1\") | formatByType(col1FormatConfig)',\n * },\n * col2: {\n * data: '> table | seriesByName(\"col2\") | formatByType(col2FormatConfig)',\n * },\n * }\n * };\n * }\n *\n * @param {Object} param.columnFormatOption - the original options.columnFormat in the viz definition\n * @param {{columnName, ColumnEntry}} param.updatedEditorColumnFormatting - the updated editorColumnFormatting state to merge into the definition\n *\n * @returns {Object}\n */\nexport const getColumnFormatDefFromState = ({\n columnFormatOption,\n updatedEditorColumnFormatting,\n}: {\n columnFormatOption: {\n [columnName: string]: {\n data: string;\n };\n };\n updatedEditorColumnFormatting: { [columnName: string]: ColumnEntry };\n}): {\n context: Record<string, string | number | boolean | Record<string, string | number | boolean>>;\n options: {\n columnFormat: Record<string, string | number | boolean | Record<string, string | number | boolean>>;\n };\n} => {\n const columnFormattingEditorContextConfig = {};\n const editorDerivedColumnFormatOption = cloneDeep(columnFormatOption);\n Object.keys(updatedEditorColumnFormatting).forEach((columnName): void => {\n const sanitizedColumnName = sanitizeColumnName(columnName);\n const contextFormattingKey = `${sanitizedColumnName}${EDITOR_CONFIG_SUFFIX}`;\n if (isPlainObject(updatedEditorColumnFormatting[columnName])) {\n // persist columnColoring changes\n const columnColoring = get(updatedEditorColumnFormatting, [columnName, 'columnColoring']);\n unset(columnColoring, ['_meta']);\n\n if (isPlainObject(columnColoring)) {\n Object.keys(columnColoring).forEach((coloringType): void => {\n const { colorContextConfig, colorOptionDSL, colorContextKey } =\n columnColoring[coloringType];\n\n if (colorOptionDSL == null) {\n columnFormattingEditorContextConfig[colorContextKey] = null;\n set(editorDerivedColumnFormatOption, [columnName, coloringType], null);\n } else if (colorContextKey) {\n columnFormattingEditorContextConfig[colorContextKey] = colorContextConfig;\n // sets the DSL for `rowColors` or `rowBackgroundColors` inside `columnFormat[fieldName]`\n // can also set it to null\n set(editorDerivedColumnFormatOption, [columnName, coloringType], colorOptionDSL);\n }\n });\n }\n\n // strip out editor-related _meta information\n if (isPlainObject(updatedEditorColumnFormatting[columnName].formatByType)) {\n Object.keys(updatedEditorColumnFormatting[columnName].formatByType).forEach(\n (dataType): void => {\n unset(updatedEditorColumnFormatting, [columnName, 'formatByType', dataType, '_meta']);\n }\n );\n // persist all formatByType options in context if formatByType is not empty\n if (!isContextConfigEmpty(updatedEditorColumnFormatting[columnName].formatByType)) {\n columnFormattingEditorContextConfig[contextFormattingKey] = {\n ...updatedEditorColumnFormatting[columnName].formatByType,\n };\n\n set(\n editorDerivedColumnFormatOption,\n [columnName, 'data'],\n `> table | seriesByName(\"${columnName}\") | formatByType(${contextFormattingKey})`\n );\n } else {\n // if formatByType entry is empty, remove context related to formatByType\n // however, it's still possible that coloring was applied, so still need the columnFormat[fieldName] option\n columnFormattingEditorContextConfig[contextFormattingKey] = null;\n }\n }\n\n const { formatText } = updatedEditorColumnFormatting[columnName];\n if (isPlainObject(formatText)) {\n Object.keys(formatText).forEach((textFormatOption): void => {\n set(\n editorDerivedColumnFormatOption,\n [columnName, textFormatOption],\n formatText[textFormatOption]\n );\n });\n }\n } else {\n // if the columnName entry is null, the key will be removed from the externally persisted state\n // defensively remove any editorConfig persisted coloring here\n columnFormattingEditorContextConfig[contextFormattingKey] = null;\n columnFormattingEditorContextConfig[`${sanitizedColumnName}RowColorsEditorConfig`] = null;\n columnFormattingEditorContextConfig[`${sanitizedColumnName}RowBackgroundColorsEditorConfig`] =\n null;\n editorDerivedColumnFormatOption[columnName] = null;\n }\n });\n\n return {\n context: columnFormattingEditorContextConfig,\n options: {\n columnFormat: editorDerivedColumnFormatOption,\n },\n };\n};\n","import * as T from 'prop-types';\nimport type { FormatterUiConfig } from '../../formatters/FormatterEditor';\n\nexport interface ColumnColoringConfig {\n coloringTypes: { label: string; value: string }[];\n formatters: FormatterUiConfig[];\n themes: Record<string, any>;\n}\n\nexport const columnColoringConfigPropType = T.shape({\n coloringTypes: T.arrayOf(\n T.shape({\n label: T.string,\n value: T.string,\n })\n ),\n formatters: T.arrayOf(\n T.shape({\n label: T.string,\n value: T.string,\n defaults: T.object,\n })\n ),\n themes: T.object,\n});\n\nexport interface FlyoutConfigItem {\n label?: string;\n editor?: string;\n option?: string;\n editorProps?: Record<string, unknown>;\n itemSchema?: unknown;\n [key: string]: unknown;\n}\n\nexport type FlyoutConfigRow = FlyoutConfigItem[];\n\nexport interface FlyoutConfig {\n number: FlyoutConfigRow[];\n sparkline: FlyoutConfigRow[];\n string: FlyoutConfigRow[];\n time: FlyoutConfigRow[];\n}\n\nexport const flyoutConfigPropType = T.shape({\n number: T.arrayOf(T.any),\n string: T.arrayOf(T.any),\n sparkline: T.arrayOf(T.any),\n time: T.arrayOf(T.any),\n});\n","import React, { useState, useCallback, useMemo, useEffect } from 'react';\nimport * as T from 'prop-types';\nimport Select from '@splunk/react-ui/Select';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport FeatureFlagContext from '@splunk/visualization-context/FeatureFlagContext';\nimport { getDataSourceStateInfo } from '@splunk/visualizations-shared/dataSourceUtils';\nimport { getAllPossibleSplitByFields } from '@splunk/visualizations-shared/trellisUtils';\nimport { getPlaceholderMessage } from '../../utils/columnSelectionUtils';\nimport { BaseEditorPropTypes } from '../../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../../interfaces/BaseEditorProps';\nimport { useDataSource } from '../../hooks/useDataSource';\nimport ControlGroup from '../../shared/AdvancedControlGroup';\nimport { useColumnSelectorFooterMessage } from '../useColumnSelectorFooterMessage';\n\nexport const EDITOR_NAME = 'trellisSplitBySelectionEditor';\ninterface TrellisSplitBySelectionEditorProps extends BaseEditorProps {\n dataSourceKey: string;\n prepareValue?: (id: Record<string, unknown>) => Record<string, unknown>;\n}\n\n/*\nconst propTypes: Record<keyof TrellisSplitBySelectionEditorProps, T.Validator<any>> = {\n ...BaseEditorPropTypes,\n dataSourceKey: T.string.isRequired,\n prepareValue: T.func,\n};\n*/\n\nexport const AGGREGATIONS = 'aggregations';\n\ninterface FieldOption {\n name: string;\n value: string;\n description: string;\n [key: string]: string;\n}\n\nconst defaultPrepareValueFn = (id: Record<string, unknown>): Record<string, unknown> => id;\n\nexport const TrellisSplitBySelectionEditor: React.FunctionComponent<TrellisSplitBySelectionEditorProps> = ({\n name,\n value,\n label = '',\n labelPosition = 'top',\n dataSourceKey = 'primary',\n dataSourceBindings,\n isDisabled,\n onChange,\n prepareValue = defaultPrepareValueFn,\n}): React.ReactElement => {\n const featureFlagContext = React.useContext(FeatureFlagContext) as Record<string, boolean>;\n const isTrellisFeatureFlagOn = Boolean(featureFlagContext?.visualizations_enableTrellis);\n const dataSource = useDataSource({ dataSourceBindings, dataSourceKey });\n const { fields } = dataSource?.data || { columns: [], fields: [] };\n const splitByFieldsObject = useMemo(() => getAllPossibleSplitByFields(fields), [fields]);\n const { hasError, isMissing, isLoading } = getDataSourceStateInfo(dataSource);\n const disabled = isMissing || hasError || isDisabled;\n const placeholderMessage = getPlaceholderMessage({\n isMissing,\n isLoading,\n hasError,\n defaultMessage: `${_('Select a splitby field from datasource')}`,\n });\n const defaultSelection = splitByFieldsObject.fields?.length\n ? splitByFieldsObject.fields[0]\n : AGGREGATIONS;\n\n const [filter, setFilter] = useState('');\n const handleFilterChange = useCallback((e, { keyword }): void => {\n setFilter(keyword);\n }, []);\n\n const selectedFieldName = value || defaultSelection;\n const [selectedField, setSelectedField] = useState(selectedFieldName);\n\n useEffect((): void => {\n setSelectedField(selectedFieldName);\n }, [selectedFieldName]);\n\n const handleValueChange = React.useCallback(\n (event, { value: selectedValue }): void => {\n setSelectedField(selectedValue);\n const update = prepareValue({\n options: {\n [name]: `${selectedValue}`,\n },\n });\n onChange(event, update);\n },\n [onChange, prepareValue, name]\n );\n\n const { filteredFields, splitByFields } = useMemo(() => {\n let splitByFieldsResults: FieldOption[] = splitByFieldsObject.fields.map(field => ({\n name: field,\n value: field,\n description: '',\n }));\n if (splitByFieldsObject.aggregations?.length) {\n splitByFieldsResults = [\n ...splitByFieldsResults,\n {\n name: `${_('Aggregations')} (${splitByFieldsObject.aggregations.length})`,\n description: splitByFieldsObject.aggregations.join(', '),\n value: AGGREGATIONS,\n },\n ];\n }\n const filteredFieldResults = splitByFieldsResults.filter(\n (field): boolean => field && field.value.toLowerCase().indexOf(filter.toLowerCase()) !== -1\n );\n return { filteredFields: filteredFieldResults, splitByFields: splitByFieldsResults };\n }, [filter, splitByFieldsObject.aggregations, splitByFieldsObject.fields]);\n\n const footerMessage = useColumnSelectorFooterMessage({\n availableFields: splitByFields,\n selectedFields: [selectedField],\n filteredFields,\n filter,\n });\n\n if (!isTrellisFeatureFlagOn) {\n return null;\n }\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition} data-test={`${EDITOR_NAME}-${name}`}>\n <Select\n data-test={`${EDITOR_NAME}-select-${name}`}\n value={selectedField}\n onFilterChange={handleFilterChange}\n onChange={handleValueChange}\n footerMessage={footerMessage}\n placeholder={placeholderMessage}\n disabled={disabled}\n isLoadingOptions={isLoading}\n error={hasError}\n filter\n >\n {filteredFields.map(\n (field): React.ReactElement =>\n field && (\n <Select.Option\n key={field.name}\n data-test={`${EDITOR_NAME}-option-${field.value}`}\n label={`${field.name}`}\n value={field.value}\n description={field.description}\n />\n )\n )}\n </Select>\n </ControlGroup>\n );\n};\n\nTrellisSplitBySelectionEditor.propTypes = {\n ...BaseEditorPropTypes,\n dataSourceKey: T.string.isRequired,\n prepareValue: T.func,\n};\nexport default TrellisSplitBySelectionEditor;\n","import React, { useMemo } from 'react';\nimport { ColumnSelectorFooterMessage } from '../shared/ColumnSelectorFooterMessage';\nimport type { FieldTuple } from '../utils/columnSelectionUtils';\n\ntype ObjectWithName = {\n name: string;\n [key: string]: string;\n};\n\ntype Fields = FieldTuple[] | ObjectWithName[];\n\ninterface FooterMessageProps {\n noSelectedFieldsInfo?: boolean;\n filter: string;\n availableFields: Fields;\n selectedFields?: string[];\n filteredFields: Fields;\n}\n\nexport const useColumnSelectorFooterMessage = ({\n filter,\n availableFields,\n selectedFields,\n filteredFields,\n noSelectedFieldsInfo = false,\n}: FooterMessageProps) => {\n const selectedFilteredFields = useMemo(() => {\n if (!selectedFields || !filteredFields) return [];\n\n const validSelectedFields = new Set(\n selectedFields.filter(field => field !== '' && field !== undefined)\n );\n\n return filteredFields.filter(item => validSelectedFields.has(item.name));\n }, [selectedFields, filteredFields]);\n\n // make sure to display only 'No matches' text when there is no result of filtering\n if (filter && !filteredFields.length) {\n return null;\n }\n\n return (\n <ColumnSelectorFooterMessage\n noSelectedFieldsInfo={noSelectedFieldsInfo}\n numSelected={selectedFilteredFields?.length} // if no filter is applied filteredFields equal availableFields\n numFiltered={filteredFields.length}\n numAvailable={availableFields.length}\n filter={filter}\n />\n );\n};\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 { useState, useEffect, useContext } from 'react';\nimport DataSourceContext, {\n type BindingsSnapshot,\n type DataSourceApi,\n} from '@splunk/visualization-context/DataSourceContext';\nimport { get, isFunction } from 'lodash';\n\ninterface UseDataSourceParams {\n dataSourceBindings: BindingsSnapshot;\n dataSourceKey: string;\n}\n// @TODO(pwied): use DataSource interface in return type (w/o dependency on @splunk/visualizations)\nexport const useDataSource = ({\n dataSourceBindings,\n dataSourceKey,\n}: UseDataSourceParams): BindingsSnapshot => {\n const dataSourceApi = useContext<DataSourceApi>(DataSourceContext);\n const [dataSource, setDataSource] = useState<BindingsSnapshot>();\n useEffect((): (() => void) => {\n if (!get(dataSourceBindings, dataSourceKey)) {\n setDataSource(null);\n return () => undefined;\n }\n const unsubscribe =\n isFunction(dataSourceApi.subscribe) &&\n dataSourceApi.subscribe(dataSourceKey, (snapshot): void => setDataSource(snapshot));\n return () => {\n if (unsubscribe) {\n unsubscribe();\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dataSourceBindings]);\n return dataSource;\n};\n","import type React from 'react';\nimport { useCallback, useRef, useLayoutEffect, useState, useMemo } from 'react';\nimport {\n type NumberBlurHandler,\n type NumberChangeHandler,\n type NumberFocusHandler,\n type NumberPropsBase,\n} from '@splunk/react-ui/Number';\nimport { clamp, debounce, noop } from 'lodash';\n\nexport type OnValueChangeType = (e: Parameters<NumberChangeHandler>[0], newValue?: string | number) => void;\n\ninterface UseNumberInputArgs extends Pick<NumberPropsBase, 'value' | 'defaultValue' | 'min' | 'max'> {\n onValueChange: OnValueChangeType;\n}\n\nexport const useNumberInput = ({\n min = Number.NEGATIVE_INFINITY,\n max = Number.POSITIVE_INFINITY,\n value,\n defaultValue,\n onValueChange = noop,\n}: UseNumberInputArgs) => {\n const [currentValue, setCurrentValue] = useState(value);\n const isFocusedRef = useRef(false);\n\n const commitValue = useCallback(\n (e, newValue?: string | number) => {\n if (newValue == null) {\n // if we're clearing the input, revert local state back to default or old value\n setCurrentValue(defaultValue ?? value);\n }\n\n onValueChange(e, newValue);\n },\n [defaultValue, onValueChange, value]\n );\n\n const handleChangeDebounced = useMemo(\n () => debounce<NumberChangeHandler>((e, payload) => commitValue(e, payload.value), 250),\n [commitValue]\n );\n\n useLayoutEffect(() => {\n // layout effect prevents double-render during external change to derived state\n setCurrentValue(value);\n }, [value]);\n\n const handleChange = useCallback<NumberChangeHandler>(\n (e, payload) => {\n setCurrentValue(payload.value);\n if (isFocusedRef.current) {\n // if focus is in the text box of the number input, don't commit the state yet\n // this includes being focused inside the text box and using UP + DOWN arrow keys to increment/decrement. It will only\n // commit the value on blur or Enter key.\n return;\n }\n\n // if the focus is outside, it's because the user is clicking the increment/decrement buttons directly\n handleChangeDebounced(e, payload);\n },\n [handleChangeDebounced]\n );\n\n const handleBlur = useCallback<NumberBlurHandler>(\n e => {\n isFocusedRef.current = false;\n if (value !== currentValue) {\n commitValue(e, currentValue);\n }\n },\n [currentValue, commitValue, value]\n );\n\n const handleFocus = useCallback<NumberFocusHandler>(() => {\n isFocusedRef.current = true;\n }, []);\n\n const handleKeyPress = useCallback<React.KeyboardEventHandler<HTMLInputElement>>(\n e => {\n if (typeof e.key === 'string' && e.key.toLowerCase() === 'enter') {\n const targetValue = (e.target as HTMLInputElement)?.value;\n const eventValue = targetValue ? Number(targetValue) : undefined;\n\n // the raw input value will not have min/max clamp applied from the SUINumber component\n const clampedValue = typeof eventValue === 'number' ? clamp(eventValue, min, max) : undefined;\n\n if (value !== clampedValue) {\n commitValue(e, clampedValue);\n }\n }\n // if pressing the ESC key, revert value to the initial one before editing\n if (typeof e.key === 'string' && e.key.toLowerCase() === 'escape') {\n // This key doesn't work with Chrome 75\n setCurrentValue(value);\n }\n },\n [commitValue, value, min, max]\n );\n\n return {\n handleChange,\n handleBlur,\n handleFocus,\n handleKeyPress,\n currentValue,\n };\n};\n","import * as T from 'prop-types';\nimport type { JSONSchema7 } from 'json-schema';\n\nexport interface BaseEditorProps {\n name: string;\n value: any;\n onChange?: (...args: any[]) => void;\n label?: string; // @TODO(pwied): this should not live in editor props\n labelPosition?: 'top' | 'left'; // ^^^\n context?: Record<string, any>;\n labelWidth?: number;\n isAdvanced?: boolean;\n isDisabled?: boolean;\n dataSourceBindings?: Record<string, any>;\n options?: { [k: string]: any };\n optionsSchema?: {\n [key: string]: JSONSchema7;\n };\n}\n\nexport const BaseEditorPropTypes: Record<keyof BaseEditorProps, T.Validator<any>> = {\n name: T.string.isRequired,\n value: T.oneOfType([T.string, T.object, T.arrayOf(T.string)]),\n context: T.object,\n label: T.string,\n labelPosition: T.oneOf(['top', 'left']),\n labelWidth: T.number,\n onChange: T.func,\n isAdvanced: T.bool,\n isDisabled: T.bool,\n dataSourceBindings: T.object,\n options: T.object,\n optionsSchema: T.object,\n};\n","import * as T from 'prop-types';\nimport { BaseEditorPropTypes } from './BaseEditorProps';\nimport { sharedPalettesConfigPropType } from '../editors/formatters/FormatterEditor';\n\n// Common propTypes used by DynamicColor-based editors to reduce duplication\nexport const DynamicColorEditorPropTypes = {\n ...BaseEditorPropTypes,\n name: T.string.isRequired,\n value: T.any,\n onChange: T.func,\n flyoutTitle: T.string,\n dataSelectors: T.arrayOf(\n T.exact({\n label: T.string.isRequired,\n value: T.string.isRequired,\n }).isRequired\n ),\n formatters: T.arrayOf(\n T.exact({\n label: T.string.isRequired,\n value: T.string.isRequired,\n defaults: T.object.isRequired,\n isDefault: T.bool,\n }).isRequired\n ),\n defaultPalettesConfig: sharedPalettesConfigPropType.isRequired,\n tooltip: T.string,\n options: T.object,\n};\n","import React, { Children, cloneElement } from 'react';\nimport type { 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 type { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport Button from '@splunk/react-ui/Button';\nimport SUIControlGroup from '@splunk/react-ui/ControlGroup';\nimport type { 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 styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ArrowDown from '@splunk/react-icons/ArrowDown';\nimport ArrowUp from '@splunk/react-icons/ArrowUp';\n\nconst Wrapper = styled.div`\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n /* this aligns the first item on the far left and the other item is aligned to flex end */\n & :first-child {\n margin-right: auto;\n }\n & {\n padding: 4px 1px;\n }\n`;\n\ninterface ArrowLayerProps {\n colorDown?: string;\n colorUp?: string;\n}\n\nconst ArrowLayer = ({ colorDown, colorUp }: ArrowLayerProps): React.ReactElement => (\n <Wrapper>\n <ArrowDown aria-label={_('Bottom range')} style={{ color: colorDown || 'white' }} />\n <ArrowUp aria-label={_('Top range')} style={{ color: colorUp || 'white' }} />\n </Wrapper>\n);\n\nexport default ArrowLayer;\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 * as React from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\n\nconst Icon = styled.div.attrs<{ 'data-test': string; onClick: React.MouseEventHandler<HTMLDivElement> }>(\n (props): { 'data-test': string } => ({\n 'data-test': props['data-test'],\n })\n)<{ 'data-test': string }>`\n display: flex;\n height: 35px;\n width: 35px;\n align-items: center;\n justify-content: center;\n color: ${variables.contentColorActive};\n border-radius: ${variables.borderRadius};\n &:hover {\n background-color: ${variables.interactiveColorOverlayHover};\n cursor: pointer;\n }\n`;\n\ninterface ClickableIconProps {\n dataTestKey?: string;\n children: React.ReactNode;\n onClick: React.MouseEventHandler<HTMLDivElement>;\n}\n\nconst propTypes: Record<keyof ClickableIconProps, T.Validator<any>> = {\n dataTestKey: T.string,\n children: T.node,\n onClick: T.func,\n};\n\nconst ClickableIcon: React.FunctionComponent<ClickableIconProps> = ({\n children,\n dataTestKey,\n onClick,\n}): React.ReactElement => (\n <Icon data-test={dataTestKey} onClick={onClick}>\n {children}\n </Icon>\n);\n\nClickableIcon.propTypes = propTypes;\n\nexport default ClickableIcon;\n","import * as React from 'react';\nimport { sprintf } from '@splunk/ui-utils/format';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { useMemo } from 'react';\n\ninterface FooterProps {\n filter: string;\n numSelected?: number;\n numFiltered: number;\n numAvailable: number;\n noSelectedFieldsInfo?: boolean; // it is needed for AddColumn component which has different logic than other selection editors\n}\n\nexport const ColumnSelectorFooterMessage = ({\n numSelected,\n numFiltered,\n numAvailable,\n filter,\n noSelectedFieldsInfo,\n}: FooterProps) => {\n const footerMessageText = useMemo(() => {\n if (filter) {\n if (noSelectedFieldsInfo) {\n return sprintf(_('%(filtered)d filtered from %(available)d fields'), {\n filtered: numFiltered,\n available: numAvailable,\n });\n }\n return sprintf(_('%(selected)d selected from %(filtered)d filtered'), {\n selected: numSelected,\n filtered: numFiltered,\n });\n }\n return noSelectedFieldsInfo\n ? sprintf(_('%(shown)d of %(available)d fields'), {\n shown: numFiltered,\n available: numAvailable,\n })\n : sprintf(_('%(selected)d selected from %(available)d'), {\n selected: numSelected,\n available: numAvailable,\n });\n }, [filter, noSelectedFieldsInfo, numFiltered, numAvailable, numSelected]);\n\n return (\n <span data-test=\"footer-message\" aria-live=\"polite\" aria-atomic=\"true\">\n {footerMessageText}\n </span>\n );\n};\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\nimport Message from '@splunk/react-ui/Message';\nimport Button from '@splunk/react-ui/Button';\n\nconst defaultHeaderText = _('Dynamic Option: Customized in source');\nconst defaultInfo = _(\n 'Configured in source code beyond what can be shown here. Resetting to default will overwrite this custom configurations.'\n);\nconst defaultResetButtonText = _('Reset to default');\n\nconst PopoverContent = styled.div<{\n padding?: number | string;\n width?: number | string;\n}>`\n padding: ${({ padding }: any) => padding ?? '20px'};\n width: ${({ width }: any) => width ?? '300px'};\n color: ${variables.contentColorActive};\n`;\n\nconst PopoverHeader = styled.div`\n font-weight: 600;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 10px;\n`;\n\nexport interface CustomizedInSourceMessageProps {\n headerText?: string;\n info?: string;\n resetButtonText?: string;\n onResetToDefault?: (...args: any[]) => void;\n style?: Record<string, any>;\n}\n\nconst propTypes: Record<keyof CustomizedInSourceMessageProps, T.Validator<any>> = {\n headerText: T.string,\n info: T.string,\n resetButtonText: T.string,\n onResetToDefault: T.func,\n style: T.object,\n};\n\nconst CustomizedInSourceMessage = ({\n headerText = defaultHeaderText,\n info = defaultInfo,\n resetButtonText = defaultResetButtonText,\n onResetToDefault = (): void => undefined,\n style = {},\n}: CustomizedInSourceMessageProps): React.ReactElement => (\n <PopoverContent style={style}>\n <PopoverHeader data-test=\"popover-header\">{headerText}</PopoverHeader>\n <Message data-test=\"customized-source-popover-message\" type=\"info\">\n {info}\n </Message>\n <Button\n data-test=\"popover-reset\"\n appearance=\"secondary\"\n onClick={onResetToDefault}\n label={resetButtonText}\n />\n </PopoverContent>\n);\n\nCustomizedInSourceMessage.propTypes = propTypes;\n\nexport default CustomizedInSourceMessage;\n","import * as React from 'react';\nimport * as T from 'prop-types';\n\nconst FormatFieldName = ({\n columnName,\n dataType,\n}: {\n columnName: string;\n dataType: string;\n}): React.ReactElement => {\n // as per design, `_time` column name doesn't have dataType appended\n if (columnName === '_time') {\n return <span>_time</span>;\n }\n return (\n <span data-test={`format-field-name-${columnName}`}>\n {`${columnName} - `}\n <span style={{ fontStyle: 'italic' }}>{dataType}</span>\n </span>\n );\n};\n\nFormatFieldName.propTypes = {\n columnName: T.string,\n dataType: T.string,\n};\n\nexport default FormatFieldName;\n","import styled from 'styled-components';\n\nexport const MessageContainer = styled.div`\n margin-top: 10px;\n`;\n","import styled from 'styled-components';\n\nexport default styled.div`\n border-radius: 3px; /* @TODO(pwied): should this be imported from SUI variables? */\n overflow: hidden;\n position: relative;\n width: 100%;\n height: 20px;\n`;\n","export const FLYOUT_PADDING = 21;\nexport const COLUMN_FLYOUT_PADDING = 16;\nexport const FLYOUT_WIDTH = 344;\n\nexport const VERTICAL_EDITOR_SPACING = 16;\n\nexport const DROPDOWN_MENU_WIDTH = 327;\n\nexport const editorStyle = { width: '100%' };\n","import { _ } from '@splunk/ui-utils/i18n';\nimport {\n inferDataTypeFromData,\n canInferTypeFromMeta,\n getDataTypeForMeta,\n} from '@splunk/visualization-encoding/utils/types';\n\nexport interface FieldTuple {\n name: string;\n type: string;\n}\n\nexport const getAvailableFieldsWithTypes = (\n columns: unknown[][],\n fields: { name: string; type?: string }[]\n): FieldTuple[] => {\n const fieldsWithType = fields.map((field, index) => {\n const { name } = field;\n const inferredType = canInferTypeFromMeta(field)\n ? getDataTypeForMeta(field)\n : inferDataTypeFromData(columns[index]);\n return {\n name,\n type: inferredType,\n };\n });\n return fieldsWithType;\n};\n\nexport const getFilteredFields = (availableFieldsWithTypes: FieldTuple[], filter: string): FieldTuple[] => {\n return availableFieldsWithTypes.filter((field): boolean => field.name.indexOf(filter) !== -1);\n};\n\nexport const sanitizeFieldNames = (value: unknown, fieldNames: string[]): string[] => {\n if (typeof value === 'string' && fieldNames.includes(value)) {\n return [value];\n }\n if (Array.isArray(value)) {\n return value.filter(name => fieldNames.includes(name));\n }\n return [];\n};\n\nexport const getPlaceholderMessage = ({\n hasError,\n isLoading,\n isMissing,\n defaultMessage = 'Select a field from data source',\n}: {\n hasError: boolean;\n isLoading: boolean;\n isMissing: boolean;\n defaultMessage?: string;\n}): string => {\n if (isMissing) {\n return _('Set up data source to select');\n }\n if (hasError) {\n return _('Please set up valid data source to select');\n }\n if (isLoading) {\n return _('Loading data source...');\n }\n return _(defaultMessage);\n};\n","import { find, findLastIndex, get, isMatch, zipWith } from 'lodash';\nimport { DslParser } from '@splunk/visualization-encoding/DslParser';\nimport EncodingParser from '@splunk/visualization-encoding/EncodingParser';\nimport type { StaticItem, DynamicOptionsContext } from '../types';\n\n/**\n * The Dropdown/Multiselect inputs expect a config that has the following format. Additional\n * formatting clauses and options may be present. This is the \"standard dynamic config\".\n * {\n * context: {\n * statics: [\n * ['label1', 'label2', ...],\n * ['value1', 'value2', ...]\n * ],\n * label: '>primary | seriesByName(\"<label field name>\") | renameSeries('label'),\n * value: '>primary | seriesByName(\"<value field name>\") | renameSeries('value')\n * },\n * options: {\n * items: '>frame(label, value) | prepend(statics) | objects()'\n * }\n * }\n *\n * The \"standard static config\" is as follows. The contents of context do not matter.\n * {\n * context: {},\n * options: {\n * items: [\n * { label: 'label1', value: 'value1 },\n * { label: 'label2', value: 'value2 },\n * ...\n * ]\n * }\n * }\n *\n * \"Advanced configs\" are any config that does not follow the above formats.\n */\n\n/**\n * Retrieve the first field name from a DSL string containing seriesByName().\n */\nexport const getFieldFromFieldNameDsl = (dsl: string): string => {\n try {\n const ast = DslParser.parse(EncodingParser.withoutArrow(dsl));\n const seriesByNameNode = find(ast, {\n type: 'method',\n name: 'seriesByName',\n });\n return get(seriesByNameNode, ['args', '0', 'v'], '');\n } catch {\n return '';\n }\n};\n\n/**\n * Simple validation to check that a DSL string matches the standard config for the\n * context label/value field of Dynamic Options.\n */\nconst isFieldNameDslStandard = (dsl: string): boolean => {\n try {\n const ast = DslParser.parse(EncodingParser.withoutArrow(dsl));\n const seriesIdx = findLastIndex(ast, {\n type: 'method',\n name: 'seriesByName',\n });\n const renameIdx = findLastIndex(ast, {\n type: 'method',\n name: 'renameSeries',\n });\n return seriesIdx !== -1 && renameIdx !== -1 && seriesIdx < renameIdx;\n } catch {\n return false;\n }\n};\n\n/**\n * Simple validation to check that a DSL string matches the standard config for the\n * options items field of Dynamic Options.\n */\nconst isItemsDslStandard = (dsl: string): boolean => {\n try {\n const ast = DslParser.parse(EncodingParser.withoutArrow(dsl));\n return (\n ast.length === 3 &&\n isMatch(ast[0], { type: 'method', name: 'frame' }) &&\n isMatch(ast[1], { type: 'method', name: 'prepend' }) &&\n isMatch(ast[2], { type: 'method', name: 'objects' })\n );\n } catch {\n return false;\n }\n};\n\n/**\n * Simple validation to determine if the config of an input matches the schema for the\n * Dynamic Options.\n */\nexport const isConfigAdvanced = ({\n items,\n context,\n}: {\n items?: StaticItem[] | string;\n context: DynamicOptionsContext;\n}): boolean => {\n if (typeof items !== 'string') {\n return false;\n }\n\n const { label, value } = context;\n if (typeof label !== 'string' || typeof value !== 'string') {\n return true;\n }\n\n return !isItemsDslStandard(items) || !isFieldNameDslStandard(label) || !isFieldNameDslStandard(value);\n};\n\n/**\n * Retrieves static items and Dynamic Options for a dropdown/multiselect input from the input\n * config.\n */\nexport const getDynamicOptionsFromConfig = ({\n items,\n context,\n}: {\n items?: StaticItem[] | string;\n context: DynamicOptionsContext;\n}): {\n staticOptions: StaticItem[];\n dynamicOptionsLabel: string;\n dynamicOptionsValue: string;\n} => {\n if (Array.isArray(items)) {\n return {\n staticOptions: items,\n dynamicOptionsLabel: '',\n dynamicOptionsValue: '',\n };\n }\n\n const statics = context.statics || [];\n const staticOptions = zipWith(...statics, (label: string, value: string) => ({\n label,\n value,\n }));\n\n const { label, value } = context;\n\n const dynamicOptionsLabel = label ? getFieldFromFieldNameDsl(label) : '';\n const dynamicOptionsValue = value ? getFieldFromFieldNameDsl(value) : '';\n\n return {\n staticOptions,\n dynamicOptionsLabel,\n dynamicOptionsValue,\n };\n};\n","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/extends\");","module.exports = require(\"@splunk/react-icons/ArrowDown\");","module.exports = require(\"@splunk/react-icons/ArrowUp\");","module.exports = require(\"@splunk/react-icons/ArrowsRectangularDouble\");","module.exports = require(\"@splunk/react-icons/Chain\");","module.exports = require(\"@splunk/react-icons/ChevronsSlash\");","module.exports = require(\"@splunk/react-icons/Cross\");","module.exports = require(\"@splunk/react-icons/List\");","module.exports = require(\"@splunk/react-icons/ListNumbered\");","module.exports = require(\"@splunk/react-icons/Pencil\");","module.exports = require(\"@splunk/react-icons/Picture\");","module.exports = require(\"@splunk/react-icons/QuotationDouble\");","module.exports = require(\"@splunk/react-icons/SlidersDoubleHorizontal\");","module.exports = require(\"@splunk/react-icons/TextBBold\");","module.exports = require(\"@splunk/react-icons/TextH\");","module.exports = require(\"@splunk/react-icons/TextIItalic\");","module.exports = require(\"@splunk/react-icons/TrashCanCross\");","module.exports = require(\"@splunk/react-ui/Button\");","module.exports = require(\"@splunk/react-ui/Chip\");","module.exports = require(\"@splunk/react-ui/Color\");","module.exports = require(\"@splunk/react-ui/ColumnLayout\");","module.exports = require(\"@splunk/react-ui/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Dropdown\");","module.exports = require(\"@splunk/react-ui/FormRows\");","module.exports = require(\"@splunk/react-ui/Link\");","module.exports = require(\"@splunk/react-ui/Markdown\");","module.exports = require(\"@splunk/react-ui/Menu\");","module.exports = require(\"@splunk/react-ui/Message\");","module.exports = require(\"@splunk/react-ui/Multiselect\");","module.exports = require(\"@splunk/react-ui/Number\");","module.exports = require(\"@splunk/react-ui/Popover\");","module.exports = require(\"@splunk/react-ui/RadioBar\");","module.exports = require(\"@splunk/react-ui/ScreenReaderContent\");","module.exports = require(\"@splunk/react-ui/Select\");","module.exports = require(\"@splunk/react-ui/Slider\");","module.exports = require(\"@splunk/react-ui/Switch\");","module.exports = require(\"@splunk/react-ui/Text\");","module.exports = require(\"@splunk/react-ui/TextArea\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/themes/variables\");","module.exports = require(\"@splunk/ui-utils/format\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/ui-utils/id\");","module.exports = require(\"@splunk/visualization-color-palettes\");","module.exports = require(\"@splunk/visualization-color-palettes/editors/PresetPalettes\");","module.exports = require(\"@splunk/visualization-context/DataSourceContext\");","module.exports = require(\"@splunk/visualization-context/FeatureFlagContext\");","module.exports = require(\"@splunk/visualization-context/MessageContext\");","module.exports = require(\"@splunk/visualization-encoding/DslParser\");","module.exports = require(\"@splunk/visualization-encoding/EncodingParser\");","module.exports = require(\"@splunk/visualization-encoding/Options\");","module.exports = require(\"@splunk/visualization-encoding/utils/dsl\");","module.exports = require(\"@splunk/visualization-encoding/utils/types\");","module.exports = require(\"@splunk/visualization-icons/PresetIcons\");","module.exports = require(\"@splunk/visualizations-shared/colorUtils\");","module.exports = require(\"@splunk/visualizations-shared/dataSourceUtils\");","module.exports = require(\"@splunk/visualizations-shared/style\");","module.exports = require(\"@splunk/visualizations-shared/trellisUtils\");","module.exports = require(\"@uiw/react-md-editor/nohighlight\");","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};","// 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__(9952);\n"],"names":["NumberEditor","onChange","name","value","labelPosition","labelWidth","label","min","max","step","isDisabled","help","helpFormat","defaultValue","onValueChange","useCallback","event","v","newValue","parseFloat","Number","isFinite","currentValue","handleChange","handleBlur","handleFocus","handleKeyPress","useNumberInput","React","ControlGroup","undefined","tooltip","tooltipDefaultPlacement","SUINumber","onBlur","onFocus","onKeyDown","disabled","propTypes","T","isRequired","PercentEditor","n","Math","round","require","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","e","blockedURI","this","state","urlValue","disposition","setState","violationType","src","img","Image","onload","handleImageUpload","onerror","validUrl","key","preventDefault","checkImage","_this$inputRef$curren","inputRef","current","contains","relatedTarget","element","addEventListener","filename","imageDataURI","componentDidMount","document","violationHandler","componentWillUnmount","removeEventListener","render","enableImageFileUpload","enableSvgHttpDownloader","enableGallerySharingWarning","context","validImageTypes","shouldShowURLField","svgRenderAsDom","errorMessage","CSPMessage","type","Message","appearance","Text","canClear","handleURLChange","handleTextKeyDown","style","elementRef","trackInputRef","ImageFileReader","defaultFilename","defaultImageDataURI","onImageChange","handleOnImageChange","allowExtensions","FeatureFlagContext","defaultProps","RemoveButtonIcon","Cross","ImageUrlReaderContainer","StyledImagePreview","variables","borderColor","StyledTitleContainer","backgroundColorPage","contentColorDefault","StyledTitle","spacingMedium","StyledRemoveButton","Button","attrs","contentColorActive","actionColorBackgroundSecondaryHover","StyledImageThumbnail","mixins","reset","ImageThumbnail","onImageRemove","noop","overrideCSPViolation","useCSPViolationObserver","icon","onClick","alt","MessageContainer","ImageEditor","validMediaTypes","imageRegistry","useContext","ImageContext","dataUri","setDataUri","useState","fileName","setFileName","uploadImage","async","file","imageDataUri","imageId","upload","error","console","warn","handleUpload","handleRemove","useEffect","obj","registry","isResourceURL","getByURL","dataURI","metaData","getImageData","populateData","StyledThresholdError","ThresholdError","id","thresholdIndex","sprintf","ThresholdBoundary","dataTest","boundary","isEditable","errorId","onRequestClose","onValidate","boundaryValue","setBoundaryValue","handleFromChange","handleKeyDown","inline","hideStepButtons","describedBy","defaultThresholdColors","getUpdatedThresholdConfig","thresholds","length","updatedThresholds","map","threshold","updatedThreshold","_objectSpread","from","to","openLowerBounds","filter","t","otherThresholds","uniqBy","sortedOtherThresholds","sort","a","b","openLowerBound","forEach","el","validateThresholdBoundary","thresholdValueStr","thresholdValue","isNaN","StyledAddThreshold","AddThreshold","onAddThreshold","showInput","setShowInput","setError","handleInputToggle","handleBoundaryChange","validationResult","handleValidateBoundary","isError","StyledThresholdBoundaryInput","StyledThresholdBoundaryText","ToContentSpan","ToContentValue","ToContent","ToTooltip","Tooltip","content","ThresholdTo","isRemovable","isFirst","prefix","StyledThresholdLevel","StyledThresholdValueArea","StyledRemoveArea","spacingXSmall","spacingXXLarge","RemoveAreaButton","contentColorDisabled","interactiveColorOverlayDrag","Threshold","editFrom","editTo","editValue","onRemove","renderThresholdValueEditor","newFrom","handleToChange","newTo","val","useMemo","createDOMID","ClearIcon","defaultRanges","ThresholdList","ranges","openRanges","errors","setErrors","handleRemoveThreshold","result","cloneDeep","errs","handleChangeThreshold","fromValueStr","fromValue","validateThresholdUpperBoundary","withoutCurrent","Object","keys","hasErrors","canRemove","ThresholdColor","handleColorChange","selectedColor","Color","isColor","hideInput","palette","Col","ThresholdEditor","itemSchema","isTogglable","isEnabled","Array","isArray","setDefaultThresholds","default","clearThresholds","handleEnableClick","handleAddThreshold","existingThresholds","thresholdColors","diff","difference","getNewThresholdColor","sortedThresholds","handleThresholdChange","Switch","selected","role","editorTypeToComponentMap","CheckboxEditor","RadioBarEditor","SelectEditor","TextEditor","TextAreaEditor","ToggleEditor","ColorEditor","PresetSelectorEditor","DynamicColorEditor","DynamicColorEditorWithPrecedence","ColumnMultiSelectionEditor","ColumnSelectionEditor","TableColumnFormatterEditor","TableBackgroundColorEditor","TableDynamicColorEditor","SliderEditor","MarkdownEditor","StaticItemEditor","DynamicItemEditor","ArrayOfStringsEditor","MultiColorPickerEditor","SeriesColorsEditor","SeriesColorsByFieldEditor","ColumnMultiSelectionByFieldNameEditor","TrellisSplitBySelectionEditor","NetworkGraphDynamicColorEditor","EditorItem","item","dataSourceBindings","options","optionsSchema","editor","Editor","Error","staticItemSchema","getStaticItemSchema","option","encoding","_extends","editorProps","isOption","placeholder","isAdvanced","TextContainer","inputHeight","StyledText","getColor","color","defaultColor","prevColor","newColor","trim","ColorAndTextWrapper","showTextInput","labelledBy","textWidth","handleTextColorChange","textLabelId","append","ScreenReaderContent","prepend","height","inputId","defaultItemSchema","emptyStyle","COLOR_EDITOR_PALETTE","hideLabel","customEditorStyle","setColor","debouncedOnChange","debounce","_event","colorToValue","toLower","controlsLayout","values","getOptions","hasTokens","controlGroupMarginFix","marginTop","RadioBar","editorStyle","displayContent","optionProps","startAdornment","hideDefaultTooltip","Select","description","RowContainer","formRowHeader","removeItem","items","_item","idx","isItemError","i","isLabelError","isValueError","InputContainer","validate","staticItems","setItems","nextIndex","setIndex","newItems","isEqual","some","handleRequestRemove","_evt","handleRequestMove","fromIndex","toIndex","handleItemChange","_name","handleRequestAdd","concat","rows","l","FormRows","onRequestRemove","addLabel","header","onRequestAdd","onRequestMove","defaultLabelStyle","_ref","labelStyle","otherProps","_objectWithoutProperties","_excluded","setValueState","handleValidate","errorState","setErrorState","debouncedHandleValidate","newVal","cancel","newError","message","enum","JSON","stringify","handleOptionsChange","visualization","onVisualizationChange","omit","isMultipleRulesSchema","anyOf","isDynamicOptionSchema","schema","pattern","DYNAMIC_OPTIONS_DSL_PATTERN","isNestedOption","optionName","exec","staticSchema","find","getFormatterConfig","contextConfig","formatters","formatterFromDSL","selectedDataSelector","_currentFormatter$def2","_currentFormatter$def","currentFormatter","formatter","defaults","isContextCompatibleWithFormatter","formatterType","isSupportedDataSelector","dataSelectors","ds","isSupportedFormatter","selectedFormatterType","formattersFromEditor","supportedFormatters","fm","getFilteredRowsByShowEditor","row","featureFlags","showEditor","removeEmptyEntries","returnObj","forIn","isPlainObject","getToggleOffValueForDataColors","includes","hasAreaValuesSelector","isChoroplethLayer","layerType","layerMatch","_options$layers","layerIndex","parseInt","layer","layers","convertEmptyDataColorsForChoropleth","setOption","oldVisualization","optionSchema","defaultOverrides","_newOption","_defaultOverrides$new","_optionSchema$newOpti","_obj$options","newOption","schemaDefault","set","TokenRegExp","RegExp","source","test","menuStyle","display","safeValues","toString","currentValues","setCurrentValues","allowNewValues","selectAllAppearance","StyledTooltip","StyledSwitch","hasChip","CheckboxInfo","div","fontSizeSmall","StyledChip","CenteredLabel","span","sortValues","variantForSelectedState","helpTextLink","chipText","handleClick","href","EDITOR_NAME","defaultFilterByTypes","filterByTypes","dataSource","useDataSource","dataSourceKey","hasError","isMissing","isLoading","getDataSourceStateInfo","columns","fields","data","fieldsWithTypes","getAvailableFieldsWithTypes","fieldNames","sanitizeFieldNames","field","handleFieldNameChange","isLoadingOptions","compact","Option","f","BaseEditorPropTypes","bool","oneOf","isInternal","startsWith","prepareValue","shouldShowInternalFields","excludeByNames","adjustedDataSource","_c","adjustedColumns","adjustedFields","get","availableFieldsWithTypes","setFilter","getFieldsFromDSL","selectedFields","setSelectedFields","filteredFields","footerMessage","useColumnSelectorFooterMessage","availableFields","handleValuesChange","selectedValues","seriesNamesStr","update","handleFilterChange","keyword","placeholderMessage","getPlaceholderMessage","defaultMessage","onFilterChange","hideEditorWhenLoading","fieldName","selectedField","setSelectedField","handleValueChange","selectedValue","useRef","onResetToDefault","open","setOpen","anchor","handleOpen","handleRequestClose","ref","defaultPlacement","FlyoutHeader","StyledLabel","StyledFlyoutContent","toPx","FLYOUT_PADDING","FLYOUT_WIDTH","StyledButton","prepareUpdate","currentFormatterConfig","contextKey","extractedContextKey","replace","buildDSLFromDataSelectorAndFormatter","flyoutTitle","defaultPalettesConfig","showStaticTextColor","colorMode","handleColorModeChange","showFlyout","setShowFlyout","buttonRef","paramKey","formatterContextKey","getLastFormatterFromDSL","dataSelectorFromDSL","getDataSelectorsFromDSL","setSelectedFormatterType","setSelectedDataSelector","formatterConfigFromDSL","setCurrentFormatterConfig","handleResetToDefault","isDefault","isEmpty","defaultFormatter","defaultDataSelector","formatterCfg","handleButtonClick","FormatterConfigPreview","preview","config","padding","takeFocus","optionLabel","optionValue","FormatterEditor","onDataSelectorChange","editorName","newDataSelector","onFormatterTypeChange","newFormatter","onFormatterConfigChange","newFormatterConfig","DynamicColorEditorPropTypes","isValueInOffState","isDynamicEditorEnabled","setDynamicEditorEnabled","handleToggleChange","_optionStanza","prevState","updatedOptions","updatedContext","dataSelectorValues","dataColorsEditorConfig","defaultGradientContext","areaValues","endsWith","dataSelector","defaultContext","handleDynamicColorEditorChange","optionStanza","defaultHelpText","dynamicItemsLabelField","setLabel","dynamicItemsValueField","setValue","staticOptions","dynamicOptionsLabel","dynamicOptionsValue","getDynamicOptionsFromConfig","primary","formattedConfig","formattedStatics","statics","newLabelField","newValueField","unzip","number","handleStaticItemChange","handleDynamicLabelFieldChange","newLabel","handleDynamicValueFieldChange","prepareDynamicFieldValue","fieldDsl","getFieldFromFieldNameDsl","isConfigAdvanced","dataSourceConfigured","gutter","VERTICAL_EDITOR_SPACING","Row","func","string","oneOfType","arrayOf","shape","any","TOOLBAR_COMMANDS","commands","heading3","bold","italic","link","quote","code","image","unorderedListCommand","orderedListCommand","sansFontFamily","Toolbar","StyledTextArea","HiddenPreview","ToolbarButtonStyled","errorPriority","warning","other","ToolbarButton","memo","command","isFocusable","onExecute","buttonProps","title","contentRelationship","renderAnchor","tooltipAnchorOnFocus","tooltipAnchorOnClick","anchorProps","tabIndex","displayName","object","defaultErrors","instanceId","textareaRef","focusableCommand","setFocusableCommand","orchestratorRef","TextAreaCommandOrchestrator","executeCommand","hiddenMarkdownPreview","text","imageRenderer","errorCallback","Infinity","onError","handleToolbarKeyDown","target","tagName","toolbar","currentTarget","buttons","querySelectorAll","currentIndex","prevPressed","nextPressed","firstPressed","lastPressed","newFocus","focus","handleTextareaKeyDown","shortcuts","objectOf","popoverStyle","colorButtonStyle","interactiveColorBackground","ColorChip","neutral100","backgroundColorPopup","fontFamily","ColorListEditor","ColorFlyoutEditor","colors","CustomColorMatchEditor","handleColorRemove","addColorButtonLabel","handleColorAdd","handleColorMove","ColorRowItems","justifyContent","canReorderColors","vizColors","VIZ_CATEGORICAL","canAddNewColors","setColors","userColorsSet","Set","nextColor","has","countMap","Map","minCount","count","colorsCopy","movedColor","handleFlyoutClose","reason","srcElement","sortableHandle","ColorChips","toggleShowFlyout","isShown","contextName","getCurrentColoringType","coloringType","setColoringType","newColoringType","handleSelectChange","selectedName","defaultConfig","dsl","handleStaticColorChange","alignItems","Column","TOTAL_COLUMN_SPAN","StyledHeader","PresetHeaderLabel","PresetList","ul","PresetListItem","li","PresetOption","button","interactiveColorOverlaySelected","interactiveColorOverlayHover","focusShadow","PresetIconWrapper","PresetLabelWrapper","PresetLabel","PresetOptionWrapper","presetName","presetLabel","presetValue","selectedPreset","onPopoverClick","PresetIcon","handlePopoverClick","animation","presets","isFlyoutOpen","setIsFlyoutOpen","setSelectedPreset","setAnchor","anchorRef","parentNode","popoverId","isMenu","defaultOptions","defaultOptionsSchema","isCategorical","setFields","category","dsFields","isDslString","results","Options","evaluate","editorLabel","getUpdatedValue","updatedColors","updatedFields","updatedValue","newField","dsField","delRowIndex","findIndex","handleFieldChange","newFieldIndex","currFieldIndex","doesFieldExist","existingFieldIndex","currField","FieldSelector","SelectOptions","FieldEditor","PALETTES","custom","NameWrapper","PaletteWrapper","ColorPreviewWrapper","overrideCustomPalette","originalPalettes","selectedPalette","setSelectedPalette","palettes","setPalettes","handleMenuSelect","paletteId","newColors","prev","toggle","renderMenuItem","paletteConfig","paletteName","Item","selectable","ColorPreview","maxColorCount","expandToFillHorizontalSpace","isCustomPaletteAvailable","DROPDOWN_MENU_WIDTH","Divider","numberStyle","flexBasis","flexGrow","flexShrink","StyledSlider","maxLabel","minLabel","stepMarks","handleSliderChange","handleNumberChange","displayValue","suiStepMarks","getObjectFromMap","objectFromMap","columnColoringConfig","defaultOptionsByType","flyoutConfig","textFormatConfig","vizContext","columnFormat","columnFormatOption","tableFormat","tableFormatOption","editorSupportedFormatOptions","getEditorSupportedFormatOptions","editorColumnFormatting","setEditorColumnFormatting","getInitialColumnFormattingState","coloringTypes","handleResetColumnToDefault","columnName","columnDataType","dataType","getFormattingOptDSLKey","sourceCustomizedFormatByType","formatByTypeConfigOptsToReset","reduce","resetConfig","optToClear","formatText","getExistingTextFormatting","updatedEditorColumnFormatting","updatedColumnFormatEntry","columnColoring","_meta","dynamicallyColoredOption","formatByType","exceedsEditorCapabilities","getColumnFormatDefFromState","updateDefinition","updatedColumnEntry","skipOnChange","handleColumnColoringUpdate","colorContextKey","colorOptionDSL","colorContextConfig","handleColumnFormattingUpdate","newOptionValue","defaultsDeep","handleTextFormattingUpdate","updatedTextFormatEntry","handleAddColumnFormatting","columnDSLContextKey","columnEntryToInsert","supportedOptions","columnFormatConfig","checkExceedsEditorCapabilities","globalFormattingForDataType","getGlobalTableFormatting","TextDataType","handleRemoveColumnFormatting","delete","columnToRemove","persistedFormatByType","rowColorsContextKey","rowBackgroundColorsContextKey","rowColors","colorOptionsDSL","rowBackgroundColors","columnFormatterEntries","columnFormatEntry","isSourceCustomized","columnFormattingByType","columnTextFormatting","flyoutConfigForDataType","removeColumnFormatting","resetColumnToDefault","updateColumnColoring","updateColumnFormatting","updateColumnTextFormatting","columnFormatting","disableToggle","initialMode","setColorMode","currentTableFormat","Boolean","currentFormat","hasDsl","assign","clearDynamicColoring","tableFormatEditorConfig","modeValue","moveDslBetweenModes","pick","enterprise","dark","css","textDisabledColor","backgroundColorHover","setVal","isReversed","ColorPreviewItem","widthGrow","trueColors","reverse","_i","sharedPalettesConfigPropType","exact","paletteTheme","paletteEntry","getSortedRanges","rangesToSort","DEFAULT_GRADIENT_PALETTES_CONFIG","RangeValueEditorWrapper","rangeValues","MatchValueEditorWrapper","matchValues","match","GradientEditorWrapper","stops","defaultGradient","createGradientConfigFromPalettes","gradientValues","textColor","gradient","rangeValue","RangeValuePreview","matchValue","MatchValuePreview","validFormatterTypes","formatterConfigPropType","showDataSelectorButtonGroup","formatterSelectorLabel","filteredFormatters","showFormatterButtonGroup","FormatterConfigEditor","AddStopWrapper","AddStopButtonWrapper","ReverseStopWrapper","ButtonStyle","marginRight","reverseIcon","AddAndReverseStops","disableAddStops","handleAddStop","handleReverse","colorIndex","toLowerCase","defaultPalette","getLuminance","hex","c","split","x","substring","GradientPreview","gradientString","firstColor","lastColor","arrowDownColor","arrowUpColor","colorDown","colorUp","borderRadius","background","StyledControlGroup","TextColorContainer","TextColorWrapper","SwatchWrapper","AutoSwatch","SwatchButton","ClearButton","AutoTextDisplay","AUTO_OPTION","DEFAULT_PALETTE_COLOR","GradientTextColor","onTextColorChange","isAuto","setIsAuto","colorRef","handleInputChange","handleClear","GradientValueConfigurerWrapper","GradientsWrapper","GradientEntry","GradientLeft","GradientLabel","contentColorMuted","GradientValueConfigurer","swatchColors","setIsReversed","selectedColors","isSwatchCustomized","disableAddStopsProp","setDisableAddStops","isCustomSelected","setIsCustomSelected","shouldDisable","newTextColor","handleRemoveStop","indexToRemove","unused","newIsCustomSelected","addPaletteGradientStop","addCustomGradientStop","reversedColors","payload","newSelectedColors","RemoveStopWrapper","RemoveStopButton","RemoveStop","handleOnRemove","defaultDarkGradientConfig","DARK_COLORS","sequential","swatches","defaultLightGradientConfig","LIGHT_COLORS","createDefaultPalettesConfig","providedConfig","palettesConfig","showTextColor","defaultedConfig","paletteColors","interpolateColor","color1","color2","factor","hex1","hex2","r1","g1","b1","r2","g2","b2","r","g","toHex","padStart","customIndices","highestColor","beforeHighestColor","startIdx","endIdx","colorA","colorB","falseIndices","j","m","swatch","insertIndex","colorToAdd","findMatchingPaletteGradient","colorArr","paletteObj","candidates","theme","themePalettes","entries","flatMap","entry","fullMatch","compareArr","inputMiddle","swatchMiddle","every","first","GradientEditor","initialIsReversed","initialPaletteTheme","initialPaletteEntry","setPalettesConfig","selectedPaletteTheme","selectedPaletteEntry","currentSwatchColors","getSwatchColorsFromPalette","paletteInfo","hasCustomColors","limitedColors","handleOnGradientValueChange","onChangePaletteTheme","newPaletteTheme","onPaletteChange","selectedPaletteInfo","AddMatchWrapper","AddMatchButtonWrapper","ReverseMatchWrapper","reverseMatchButtonStyle","AddAndReverseMatches","disableAddMatches","handleAddMatch","nextValue","MatchValueConfigurerWrapper","MatchesWrapper","MatchEntry","MatchValueConfigurer","customizedColors","precedence","newMatchValues","getNewColors","numColors","handleUpdateMatch","matchIndex","isNumeric","handleRemoveMatch","newSelectedColorsWithCurrentOmitted","initialValue","updateMatch","MatchTextWrapper","TextRowWrapper","MatchErrorMessage","contentColorNegative","shouldUpdate","MatchValueText","updatedMatchValue","setUpdatedMatchValue","isFocused","setIsFocused","handleOnFocus","handleOnChange","handleOnBlur","handleOnKeyUp","onKeyUp","RemoveMatchWrapper","RemoveMatchButton","RemoveMatch","getMatches","matches","MATCH_VALUE_WILDCARD_INFO_TEXT","MatchValueWildcardInfo","matchValuesToContextConfig","MatchValueEditor","acc","next","inferInitialPaletteFromContext","hasInitiallyReversedColors","minimumNumberOfColors","calculateNewColors","newSwatchColors","getPrecedenceFromPalette","colorIdx","getNewColorsFromPalette","newMatches","newPaletteInfo","handleOnMatchValueChange","shouldShowArrows","paletteThemes","filteredThemedPalettes","getThemedPalettesWithoutMeta","ColorPreviewSpacer","CustomizedSwatchText","previewColors","initialPalettePreview","spacingSmall","menuItems","arr","Heading","toUpperCase","isSelected","PresetPaletteTheme","onPaletteThemeChange","swatchColorMap","filteredPalettes","hasMatchingPrecedence","precedenceIndex","currentPaletteColors","reversedPrecedence","defaultPalettes","matchingPalette","matchedPrecedence","paletteType","precedenceForLength","k","AddRangeWrapper","AddRangeButtonWrapper","ReverseRangeWrapper","AddAndReverseRanges","disableAddRanges","handleAddRange","RangeBoundaryText","BoundaryErrorMessage","StyledNumberEditor","BoundaryRowWrapper","RangeBoundaryWrapper","handleUpdateRangeBoundary","rangeBoundaryIndex","updateRangeBoundary","rangeText","showNumberEditor","boundaryInputValue","setBoundaryInputValue","_e","valueToUse","RangeValueConfigurerWrapper","RangesWrapper","RangeEntry","getRangeText","lastColorIndex","RangeValueConfigurer","newRangeValues","handleRemoveRange","isLastItem","rangeBoundaryValue","RemoveRangeWrapper","RemoveRangeButton","RemoveRange","rangeValuesToContextConfig","RangeValueEditor","sortedRanges","newRanges","handleOnRangeValueChange","StyledSelectOption","getFilteredFields","noSelectedFieldsInfo","handleAddColumn","tuple","FLAT_BY_THEME","ALT_BY_THEME","FLAT_BY_COLOR","ALT_BY_COLOR","HEADER_BACKGROUND_BY_COLOR","ROW_COLOR_BY_CONTRAST","HEADER_COLOR_BY_CONTRAST","DEFAULT_BACKGROUND_COLOR","calculateState","defaultBackgroundColor","disableColor","shouldAltRows","disableAltRows","backgroundColor","calculateOptionOnBackgroundColorChange","defaultThemeBackgroundColor","newOptions","headerColor","headerBackgroundColor","calculateOptionsOnAltRowsChange","themes","ThemeContext","handleAltChange","ColumnColorEditorWrapper","FormatterMethodWrapper","columnColoringConfigPropType","getStaticColor","themeContext","getSelectedFormatterUponOpen","selectedFormatterFromDSL","formatterOption","ColumnColorEditor","staticTextColor","dynamicallyColoredOptionFromDef","selectedFormatter","setSelectedFormatter","setDynamicallyColoredOption","formatterConfig","setFormatterConfig","handleDynamicallyColoredOptionChange","newDynamicallyColoredOption","updatedColoringTypes","sanitizedColName","sanitizeColumnName","upperFirst","formatterName","newColorContextConfig","handleFormatterConfigChange","_editorName","handleFormatterChange","evt","formatterValue","newlySelectedFormatter","ColumnFormatterToggle","light","backgroundColorSection","prisma","PopoverContents","SelectedColumnLabel","IconsWrapper","ColumnFormatterHeader","flyoutOpen","setFlyoutOpen","handleFlyoutOpen","dataTestKey","updates","fromMode","toMode","fromKey","rowKey","rItr","FormatByTypeEditorContents","COLUMN_FLYOUT_PADDING","getEditorItemValue","editorPersistedValue","handleUpdateColumnFormatting","iItr","editorItem","colSpan","colKey","supportedTextFormatTypes","align","headerAlign","textOverflow","supportedColumnFormatEditorOptions","columnFormatOptions","textFormatType","textFormatValue","configRow","getColumnDataTypeMap","zippedColumnsAndFields","sanitizedColumnName","configFormat","configFormatOption","formattingOpt","tableFormatOpt","tableFormatDSLContextKey","isValidColorFormatter","columnDataTypeMap","initialState","columnFormatByTypeContextConfig","hasInvalidContextKey","subOption","isColumnFormatEditorConfigurable","rowColorsFormatter","rowBackgroundColorsFormatter","hasEditorSupportedColoring","preexistingFormatByTypeConfig","columnFormattingEditorContextConfig","editorDerivedColumnFormatOption","contextFormattingKey","unset","contextConfigEntry","formattingDataType","textFormatOption","flyoutConfigPropType","sparkline","time","AGGREGATIONS","defaultPrepareValueFn","featureFlagContext","isTrellisFeatureFlagOn","visualizations_enableTrellis","splitByFieldsObject","getAllPossibleSplitByFields","defaultSelection","selectedFieldName","splitByFields","splitByFieldsResults","aggregations","selectedFilteredFields","validSelectedFields","ColumnSelectorFooterMessage","numSelected","numFiltered","numAvailable","violation","setViolation","dataSourceApi","setDataSource","unsubscribe","isFunction","subscribe","snapshot","NEGATIVE_INFINITY","POSITIVE_INFINITY","setCurrentValue","isFocusedRef","commitValue","handleChangeDebounced","useLayoutEffect","targetValue","eventValue","clampedValue","clamp","ControlGroupContainer","StyledToolTip","StyledAdvancedConfigButton","AdvancedConfigButton","AdvancedControlGroup","children","onAdvancedConfigButtonClick","Children","toArray","child","cloneElement","flex","Wrapper","cspMessageLink","openInNewContext","Icon","node","ClickableIcon","footerMessageText","filtered","available","shown","defaultHeaderText","defaultInfo","defaultResetButtonText","PopoverContent","PopoverHeader","headerText","info","resetButtonText","CustomizedInSourceMessage","FormatFieldName","fontStyle","canInferTypeFromMeta","getDataTypeForMeta","inferDataTypeFromData","ast","DslParser","parse","withoutArrow","seriesByNameNode","isFieldNameDslStandard","seriesIdx","findLastIndex","renameIdx","isMatch","isItemsDslStandard","zipWith","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","call","getter","__esModule","d","definition","o","defineProperty","enumerable","prop","prototype","hasOwnProperty","Symbol","toStringTag","__webpack_exports__"],"sourceRoot":""}