@splunk/dynamic-editors 0.37.2 → 0.37.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/DynamicEditor.js +88 -88
  3. package/DynamicEditor.js.map +1 -1
  4. package/containers/EditorItem.js +56 -56
  5. package/containers/EditorItem.js.map +1 -1
  6. package/containers/EditorLayout.js +112 -112
  7. package/containers/EditorLayout.js.map +1 -1
  8. package/containers/EditorLayoutItem.js +108 -108
  9. package/containers/EditorLayoutItem.js.map +1 -1
  10. package/containers/EncodingItem.js +1 -1
  11. package/containers/EncodingItem.js.map +1 -1
  12. package/editors/AdvancedConfigCard.js +4 -4
  13. package/editors/AdvancedConfigCard.js.map +1 -1
  14. package/editors/ArrayOfStringsEditor.js +2 -2
  15. package/editors/ArrayOfStringsEditor.js.map +1 -1
  16. package/editors/CheckboxEditor.js +7 -7
  17. package/editors/CheckboxEditor.js.map +1 -1
  18. package/editors/ColorEditor.js +8 -8
  19. package/editors/ColorEditor.js.map +1 -1
  20. package/editors/ColumnMultiSelectionByFieldNameEditor.js +2 -2
  21. package/editors/ColumnMultiSelectionByFieldNameEditor.js.map +1 -1
  22. package/editors/ColumnMultiSelectionEditor.js +1 -1
  23. package/editors/ColumnMultiSelectionEditor.js.map +1 -1
  24. package/editors/ColumnSelectionEditor.js +2 -2
  25. package/editors/ColumnSelectionEditor.js.map +1 -1
  26. package/editors/DynamicColorEditor.js +3 -3
  27. package/editors/DynamicColorEditor.js.map +1 -1
  28. package/editors/DynamicColorEditorWithPrecedence.js +5 -5
  29. package/editors/DynamicColorEditorWithPrecedence.js.map +1 -1
  30. package/editors/DynamicItemEditor.js +4 -4
  31. package/editors/DynamicItemEditor.js.map +1 -1
  32. package/editors/ImageEditor.js +5 -5
  33. package/editors/ImageEditor.js.map +1 -1
  34. package/editors/MarkdownEditor.js +1 -1
  35. package/editors/MarkdownEditor.js.map +1 -1
  36. package/editors/MultiColorPickerEditor.js +13 -13
  37. package/editors/MultiColorPickerEditor.js.map +1 -1
  38. package/editors/NumberEditor.js +1 -1
  39. package/editors/NumberEditor.js.map +1 -1
  40. package/editors/PercentEditor.js +3 -3
  41. package/editors/PercentEditor.js.map +1 -1
  42. package/editors/PresetSelectorEditor.js +1 -1
  43. package/editors/PresetSelectorEditor.js.map +1 -1
  44. package/editors/RadioBarEditor.js +2 -2
  45. package/editors/RadioBarEditor.js.map +1 -1
  46. package/editors/SelectEditor.js +4 -4
  47. package/editors/SelectEditor.js.map +1 -1
  48. package/editors/SeriesColorsByFieldEditor.js +13 -13
  49. package/editors/SeriesColorsByFieldEditor.js.map +1 -1
  50. package/editors/SeriesColorsEditor.js +16 -16
  51. package/editors/SeriesColorsEditor.js.map +1 -1
  52. package/editors/SliderEditor.js +1 -1
  53. package/editors/SliderEditor.js.map +1 -1
  54. package/editors/StaticItemEditor.js +6 -6
  55. package/editors/StaticItemEditor.js.map +1 -1
  56. package/editors/TableColumnFormatterEditor.js +54 -54
  57. package/editors/TableColumnFormatterEditor.js.map +1 -1
  58. package/editors/TextAreaEditor.js +1 -1
  59. package/editors/TextAreaEditor.js.map +1 -1
  60. package/editors/TextEditor.js +4 -4
  61. package/editors/TextEditor.js.map +1 -1
  62. package/editors/ThresholdEditor.js +22 -22
  63. package/editors/ThresholdEditor.js.map +1 -1
  64. package/editors/ToggleEditor.js +1 -1
  65. package/editors/ToggleEditor.js.map +1 -1
  66. package/package.json +2 -2
  67. package/shared/AdvancedControlGroup.js +2 -2
  68. package/shared/AdvancedControlGroup.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ThresholdEditor.js","mappings":";;;;y1BAAA,mBACA,WACA,YACA,UACA,aACA,UACA,aACA,aACA,aAgBMA,GAAwB,aAAO,UAAgB;;;;qBAIhC,EAAAC,UAAUC;;;;;;;;;;;;;;;;EAmBzBC,GAAgB,aAAO,UAAQ;;;;;;EAQ/BC,GAA6B,aAAO,UAA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Q,CACJ2E,KAAM3E,IAAAA,OACN4E,GAAI5E,IAAAA,OACJkC,MAAOlC,IAAAA,UAMf5B,MAAO4B,IAAAA,OAAS4I,WAIhB7J,cAAeiB,IAAAA,MAAQ,CAAC,OAAQ,QAChChB,WAAYgB,IAAAA,OAIZ2C,WAAY3C,IAAAA,KACZ+I,WAAY/I,IAAAA,KACZkI,2BAA4BlI,IAAAA,YAC5BwK,YAAaxK,IAAAA,MAGjBqK,GAAgBjK,aAAe,CAC3BrB,cAAe,MACfgK,YAAY,EACZpG,YAAY,EACZuF,2BAA4B6B,GAC5BS,aAAa,GAGjB,W","sources":["webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/defineProperty\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/Cross\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/SlidersDoubleHorizontal\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Button\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Color\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ControlGroup\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Number\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Switch\"","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/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/id\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/colorUtils\"","webpack://@splunk/dynamic-editors/external commonjs2 \"lodash/omit\"","webpack://@splunk/dynamic-editors/external commonjs2 \"prop-types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react\"","webpack://@splunk/dynamic-editors/external commonjs2 \"styled-components\"","webpack://@splunk/dynamic-editors/webpack/bootstrap","webpack://@splunk/dynamic-editors/webpack/runtime/compat get default export","webpack://@splunk/dynamic-editors/webpack/runtime/define property getters","webpack://@splunk/dynamic-editors/webpack/runtime/hasOwnProperty shorthand","webpack://@splunk/dynamic-editors/webpack/runtime/make namespace object","webpack://@splunk/dynamic-editors/external commonjs2 \"lodash/cloneDeep\"","webpack://@splunk/dynamic-editors/./src/editors/threshold/ThresholdError.jsx","webpack://@splunk/dynamic-editors/./src/editors/threshold/ThresholdBoundary.jsx","webpack://@splunk/dynamic-editors/external commonjs2 \"lodash/difference\"","webpack://@splunk/dynamic-editors/external commonjs2 \"lodash/get\"","webpack://@splunk/dynamic-editors/external commonjs2 \"lodash/isNaN\"","webpack://@splunk/dynamic-editors/external commonjs2 \"lodash/uniqBy\"","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"],"sourcesContent":["import React, { Children, cloneElement, ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport Button, { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport SUIControlGroup, { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nAdvancedControlGroup.defaultProps = {\n isAdvanced: false,\n};\n\nexport default AdvancedControlGroup;\n","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@splunk/react-icons/Cross\");","module.exports = require(\"@splunk/react-icons/SlidersDoubleHorizontal\");","module.exports = require(\"@splunk/react-ui/Button\");","module.exports = require(\"@splunk/react-ui/Color\");","module.exports = require(\"@splunk/react-ui/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Number\");","module.exports = require(\"@splunk/react-ui/Switch\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/themes/variables\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/ui-utils/id\");","module.exports = require(\"@splunk/visualizations-shared/colorUtils\");","module.exports = require(\"lodash/omit\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"styled-components\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"lodash/cloneDeep\");","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';\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 }) => {\n if (error) {\n return (\n <StyledThresholdError id={id}>\n {_('Error')}: {error}\n </StyledThresholdError>\n );\n }\n\n return null;\n};\n\nThresholdError.propTypes = {\n id: T.string,\n error: T.string,\n};\n\nexport default ThresholdError;\n","import React, { useState, useCallback, useEffect } from 'react';\nimport T from 'prop-types';\nimport Number from '@splunk/react-ui/Number';\n\nconst ThresholdBoundary = ({\n 'data-test': dataTest,\n boundary,\n isDisabled,\n isEditable,\n errorId,\n onChange,\n onRequestClose,\n onValidate,\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 return isEditable ? (\n <Number\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};\n\nThresholdBoundary.defaultProps = {\n 'data-test': 'threshold-boundary-input',\n isDisabled: false,\n isEditable: true,\n errorId: undefined,\n onChange: () => {},\n onRequestClose: () => {},\n onValidate: () => {},\n};\n\nexport default ThresholdBoundary;\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"lodash/difference\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"lodash/get\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"lodash/isNaN\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"lodash/uniqBy\");","import omit from 'lodash/omit';\nimport difference from 'lodash/difference';\nimport get from 'lodash/get';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport isNaN from 'lodash/isNaN';\nimport uniqBy from 'lodash/uniqBy';\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 { _ } 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 }) => {\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\nAddThreshold.defaultProps = {\n onAddThreshold: () => {},\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,\n isRemovable,\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 />\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} />\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\nThreshold.defaultProps = {\n isRemovable: false,\n isDisabled: false,\n};\n\nexport default Threshold;\n","import React, { useCallback, useState } from 'react';\nimport T from 'prop-types';\nimport cloneDeep from 'lodash/cloneDeep';\nimport {\n validateThresholdBoundary,\n validateThresholdUpperBoundary,\n getUpdatedThresholdConfig,\n} from '../../utils/threshold';\nimport Threshold from './Threshold';\n\nconst ThresholdList = ({ ranges, openRanges, isDisabled, onChange, renderThresholdValueEditor }) => {\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\nThresholdList.defaultProps = {\n openRanges: true,\n isDisabled: false,\n ranges: [],\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/cloneDeep';\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,\n labelWidth,\n label,\n isDisabled,\n isTogglable,\n openRanges,\n renderThresholdValueEditor,\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\nThresholdEditor.defaultProps = {\n labelPosition: 'top',\n openRanges: true,\n isDisabled: false,\n renderThresholdValueEditor: ThresholdColor,\n isTogglable: true,\n};\n\nexport default ThresholdEditor;\n"],"names":["ControlGroupContainer","variables","spacingMedium","StyledToolTip","StyledAdvancedConfigButton","contentColorActive","interactiveColorOverlayDrag","AdvancedConfigButton","label","onClick","content","_","icon","appearance","AdvancedControlGroup","dataTest","children","isAdvanced","hideLabel","labelPosition","labelWidth","tooltip","help","style","error","controlsLayout","onAdvancedConfigButtonClick","Children","toArray","filter","Boolean","map","child","cloneElement","flex","propTypes","T","object","bool","func","defaultProps","module","exports","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","value","StyledThresholdError","styled","attrs","ThresholdError","id","React","ThresholdBoundary","boundary","isDisabled","isEditable","errorId","onChange","onRequestClose","onValidate","boundaryValue","setBoundaryValue","useState","useEffect","handleFromChange","useCallback","e","handleKeyDown","handleBlur","Number","inline","hideStepButtons","disabled","onBlur","onKeyDown","describedBy","defaultThresholdColors","getUpdatedThresholdConfig","thresholds","length","console","warn","updatedThresholds","threshold","updatedThreshold","_objectSpread","from","to","openLowerBounds","t","otherThresholds","uniqBy","sortedOtherThresholds","sort","b","openLowerBound","forEach","el","index","validateThresholdBoundary","thresholdValueStr","thresholdValue","parseFloat","isNaN","errorMessage","StyledAddThreshold","AddThreshold","onAddThreshold","showInput","setShowInput","setError","handleInputToggle","handleBoundaryChange","validationResult","handleValidateBoundary","isError","Button","StyledThresholdBoundaryInput","StyledThresholdBoundaryText","ToContentSpan","props","ToContentValue","ToContent","ToTooltip","Tooltip","ThresholdTo","isRemovable","isFirst","prefix","StyledThresholdLevel","StyledThresholdValueArea","StyledRemoveArea","spacingXSmall","spacingXXLarge","RemoveAreaButton","contentColorDisabled","Threshold","editFrom","editTo","editValue","onRemove","renderThresholdValueEditor","newFrom","handleToChange","newTo","onValueChange","val","handleRemove","useMemo","createDOMID","ClearIcon","isRequired","ThresholdList","ranges","openRanges","errors","setErrors","handleRemoveThreshold","result","cloneDeep","splice","errs","handleChangeThreshold","fromValueStr","fromValue","validateThresholdUpperBoundary","withoutCurrent","keys","hasErrors","canRemove","ThresholdColor","Color","isColor","hideInput","palette","Col","ThresholdEditor","name","itemSchema","isTogglable","isEnabled","Array","isArray","setDefaultThresholds","default","clearThresholds","handleEnableClick","handleAddThreshold","existingThresholds","thresholdColors","diff","difference","getNewThresholdColor","push","sortedThresholds","handleThresholdChange","ControlGroup","Switch","selected","role"],"sourceRoot":""}
1
+ {"version":3,"file":"ThresholdEditor.js","mappings":";;;;y1BAAA,mBACA,WACA,YACA,UACA,aACA,UACA,aACA,aACA,aAgBMA,GAAwB,aAAO,UAAgB;;;;qBAIhC,EAAAC,UAAUC;;;;;;;;;;;;;;;;EAmBzBC,GAAgB,aAAO,UAAQ;;;;;;EAQ/BC,GAA6B,aAAO,UAAoB;aACjD,EAAAH,UAAUI;;4BAEK,EAAAJ,UAAUK;;EAIzB,EAAAC,qBAAuB,EAChCC,QAAQ,GACRC,aAGI,wBAACN,EAAa,aACC,GAAGK,mCACdE,SAAS,IAAAC,GAAE,4BAEX,wBAACP,EAA0B,aACZ,GAAGI,2BACdI,KAAM,wBAAC,UAAkB,aAAY,GAAGJ,kCACxCK,WAAW,SACXJ,QAASA,KAMzB,MAAMK,EAAuB,EACzB,YAAaC,EACbC,WACAC,cAAa,EACbT,QACAU,YACAC,gBACAC,aACAC,UACAC,OACAC,QACAC,QACAC,iBACAhB,UACAiB,iCAEA,wBAAC1B,EAAqB,aACPe,QAAAA,EAAY,gBACvBP,MAAOA,EACPU,UAAWA,EACXC,cAAeA,EACfC,WAAYA,EACZC,QAASA,EACTC,KAAMA,EACNE,MAAOA,EACPD,MAAOA,EACPd,QAASA,EACTgB,eAAgBA,GAEfR,EACK,EAAAU,SAASC,QAAQZ,GACZa,OAAOC,SACPC,KAAIC,IACD,IAAAC,cAAaD,EAAuB,CAChCT,MAAO,CAAEW,KAAM,OAG3BlB,EACLC,EAAa,wBAAC,EAAAV,qBAAoB,CAACC,MAAOA,EAAOC,QAASiB,IAAkC,MAIrGZ,EAAqBqB,UAAY,CAI7BZ,MAAOa,EAAEC,OAITpB,WAAYmB,EAAEE,KAId7B,QAAS2B,EAAEG,KAIXb,4BAA6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AElEM,IAAAA,cAACuG,GAAa,CACVjG,SAAU4I,EACV1C,OAAQ9G,EACRS,WAAYA,EACZsG,WAAYA,EACZd,2BAA4BA,MAKjC,EAIvBoC,GAAgBvK,UAAY,CAQxB8C,SAAU7C,IAAAA,KAAO4I,WAIjB2B,KAAMvK,IAAAA,OAAS4I,WAIf4B,WAAYxK,IAAAA,OAIZiC,MAAOjC,IAAAA,QACHA,IAAAA,MAAQ,CACJ2E,KAAM3E,IAAAA,OACN4E,GAAI5E,IAAAA,OACJiC,MAAOjC,IAAAA,UAMf5B,MAAO4B,IAAAA,OAAS4I,WAIhB7J,cAAeiB,IAAAA,MAAQ,CAAC,OAAQ,QAChChB,WAAYgB,IAAAA,OAIZ0C,WAAY1C,IAAAA,KACZgJ,WAAYhJ,IAAAA,KACZkI,2BAA4BlI,IAAAA,YAC5ByK,YAAazK,IAAAA,MAGjB,W","sources":["webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/defineProperty\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/Cross\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/SlidersDoubleHorizontal\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Button\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Color\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ControlGroup\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Number\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Switch\"","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/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/id\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/colorUtils\"","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/./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"],"sourcesContent":["import React, { Children, cloneElement, ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport Button, { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport SUIControlGroup, { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced = false,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nexport default AdvancedControlGroup;\n","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@splunk/react-icons/Cross\");","module.exports = require(\"@splunk/react-icons/SlidersDoubleHorizontal\");","module.exports = require(\"@splunk/react-ui/Button\");","module.exports = require(\"@splunk/react-ui/Color\");","module.exports = require(\"@splunk/react-ui/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Number\");","module.exports = require(\"@splunk/react-ui/Switch\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/themes/variables\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/ui-utils/id\");","module.exports = require(\"@splunk/visualizations-shared/colorUtils\");","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};","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';\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 }) => {\n if (error) {\n return (\n <StyledThresholdError id={id}>\n {_('Error')}: {error}\n </StyledThresholdError>\n );\n }\n\n return null;\n};\n\nThresholdError.propTypes = {\n id: T.string,\n error: T.string,\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';\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}) => {\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 return isEditable ? (\n <Number\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};\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 />\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} />\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"],"names":["ControlGroupContainer","variables","spacingMedium","StyledToolTip","StyledAdvancedConfigButton","contentColorActive","interactiveColorOverlayDrag","AdvancedConfigButton","label","onClick","content","_","icon","appearance","AdvancedControlGroup","dataTest","children","isAdvanced","hideLabel","labelPosition","labelWidth","tooltip","help","style","error","controlsLayout","onAdvancedConfigButtonClick","Children","toArray","filter","Boolean","map","child","cloneElement","flex","propTypes","T","object","bool","func","module","exports","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","value","StyledThresholdError","styled","attrs","ThresholdError","id","React","ThresholdBoundary","boundary","isDisabled","isEditable","errorId","onChange","noop","onRequestClose","onValidate","boundaryValue","setBoundaryValue","useState","useEffect","handleFromChange","useCallback","e","handleKeyDown","handleBlur","Number","inline","hideStepButtons","disabled","onBlur","onKeyDown","describedBy","defaultThresholdColors","getUpdatedThresholdConfig","thresholds","length","console","warn","updatedThresholds","threshold","updatedThreshold","_objectSpread","from","to","openLowerBounds","t","otherThresholds","uniqBy","sortedOtherThresholds","sort","b","openLowerBound","forEach","el","index","validateThresholdBoundary","thresholdValueStr","thresholdValue","parseFloat","isNaN","errorMessage","StyledAddThreshold","AddThreshold","onAddThreshold","showInput","setShowInput","setError","handleInputToggle","handleBoundaryChange","validationResult","handleValidateBoundary","isError","Button","StyledThresholdBoundaryInput","StyledThresholdBoundaryText","ToContentSpan","props","ToContentValue","ToContent","ToTooltip","Tooltip","ThresholdTo","isRemovable","isFirst","prefix","StyledThresholdLevel","StyledThresholdValueArea","StyledRemoveArea","spacingXSmall","spacingXXLarge","RemoveAreaButton","contentColorDisabled","Threshold","editFrom","editTo","editValue","onRemove","renderThresholdValueEditor","newFrom","handleToChange","newTo","onValueChange","val","handleRemove","useMemo","createDOMID","ClearIcon","isRequired","defaultRanges","ThresholdList","ranges","openRanges","errors","setErrors","handleRemoveThreshold","result","cloneDeep","splice","errs","handleChangeThreshold","fromValueStr","fromValue","validateThresholdUpperBoundary","withoutCurrent","keys","hasErrors","canRemove","ThresholdColor","Color","isColor","hideInput","palette","Col","ThresholdEditor","name","itemSchema","isTogglable","isEnabled","Array","isArray","setDefaultThresholds","default","clearThresholds","handleEnableClick","handleAddThreshold","existingThresholds","thresholdColors","diff","difference","getNewThresholdColor","push","sortedThresholds","handleThresholdChange","ControlGroup","Switch","selected","role"],"sourceRoot":""}
@@ -53,5 +53,5 @@
53
53
  &:hover {
54
54
  background-color: ${p.variables.interactiveColorOverlayDrag} !important;
55
55
  }
56
- `;t.AdvancedConfigButton=({label:e="",onClick:t})=>i.default.createElement(g,{"data-test":`${e}-advanced-config-button-tooltip`,content:(0,c._)("Advanced configurations")},i.default.createElement(v,{"data-test":`${e}-advanced-config-button`,icon:i.default.createElement(s.default,{"data-test":`${e}-advanced-config-button-icon`}),appearance:"subtle",onClick:t}));const y=({"data-test":e,children:l,isAdvanced:a,label:n,hideLabel:r,labelPosition:o,labelWidth:u,tooltip:d,help:c,style:s,error:p,controlsLayout:f,onClick:b,onAdvancedConfigButtonClick:m})=>i.default.createElement(h,{"data-test":null!=e?e:"control-group",label:n,hideLabel:r,labelPosition:o,labelWidth:u,tooltip:d,help:c,error:p,style:s,onClick:b,controlsLayout:f},a?i.Children.toArray(l).filter(Boolean).map((e=>(0,i.cloneElement)(e,{style:{flex:1}}))):l,a?i.default.createElement(t.AdvancedConfigButton,{label:n,onClick:m}):null);y.propTypes={style:u.object,isAdvanced:u.bool,onClick:u.func,onAdvancedConfigButtonClick:u.func},y.defaultProps={isAdvanced:!1},t.default=y},2649:e=>{e.exports=require("@babel/runtime/helpers/extends")},6643:e=>{e.exports=require("@splunk/react-icons/SlidersDoubleHorizontal")},7020:e=>{e.exports=require("@splunk/react-ui/Button")},8631:e=>{e.exports=require("@splunk/react-ui/Chip")},9250:e=>{e.exports=require("@splunk/react-ui/ControlGroup")},451:e=>{e.exports=require("@splunk/react-ui/Link")},5777:e=>{e.exports=require("@splunk/react-ui/Switch")},6379:e=>{e.exports=require("@splunk/react-ui/Tooltip")},3563:e=>{e.exports=require("@splunk/themes")},6649:e=>{e.exports=require("@splunk/ui-utils/i18n")},23:e=>{e.exports=require("prop-types")},9497:e=>{e.exports=require("react")},232:e=>{e.exports=require("styled-components")}},t={};function l(a){var n=t[a];if(void 0!==n)return n.exports;var r=t[a]={exports:{}};return e[a].call(r.exports,r,r.exports,l),r.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var a in t)l.o(t,a)&&!l.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};(()=>{l.r(a),l.d(a,{default:()=>u});var e=l(2649),t=l.n(e),n=l(9497),r=l.n(n),o=l(2749),i=l.n(o);const u=e=>r().createElement(i(),t()({},e,{appearance:"toggle"}))})(),module.exports=a})();
56
+ `;t.AdvancedConfigButton=({label:e="",onClick:t})=>i.default.createElement(g,{"data-test":`${e}-advanced-config-button-tooltip`,content:(0,c._)("Advanced configurations")},i.default.createElement(v,{"data-test":`${e}-advanced-config-button`,icon:i.default.createElement(s.default,{"data-test":`${e}-advanced-config-button-icon`}),appearance:"subtle",onClick:t}));const y=({"data-test":e,children:l,isAdvanced:a=!1,label:n,hideLabel:r,labelPosition:o,labelWidth:u,tooltip:d,help:c,style:s,error:p,controlsLayout:f,onClick:b,onAdvancedConfigButtonClick:m})=>i.default.createElement(h,{"data-test":null!=e?e:"control-group",label:n,hideLabel:r,labelPosition:o,labelWidth:u,tooltip:d,help:c,error:p,style:s,onClick:b,controlsLayout:f},a?i.Children.toArray(l).filter(Boolean).map((e=>(0,i.cloneElement)(e,{style:{flex:1}}))):l,a?i.default.createElement(t.AdvancedConfigButton,{label:n,onClick:m}):null);y.propTypes={style:u.object,isAdvanced:u.bool,onClick:u.func,onAdvancedConfigButtonClick:u.func},t.default=y},2649:e=>{e.exports=require("@babel/runtime/helpers/extends")},6643:e=>{e.exports=require("@splunk/react-icons/SlidersDoubleHorizontal")},7020:e=>{e.exports=require("@splunk/react-ui/Button")},8631:e=>{e.exports=require("@splunk/react-ui/Chip")},9250:e=>{e.exports=require("@splunk/react-ui/ControlGroup")},451:e=>{e.exports=require("@splunk/react-ui/Link")},5777:e=>{e.exports=require("@splunk/react-ui/Switch")},6379:e=>{e.exports=require("@splunk/react-ui/Tooltip")},3563:e=>{e.exports=require("@splunk/themes")},6649:e=>{e.exports=require("@splunk/ui-utils/i18n")},23:e=>{e.exports=require("prop-types")},9497:e=>{e.exports=require("react")},232:e=>{e.exports=require("styled-components")}},t={};function l(a){var n=t[a];if(void 0!==n)return n.exports;var r=t[a]={exports:{}};return e[a].call(r.exports,r,r.exports,l),r.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var a in t)l.o(t,a)&&!l.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};(()=>{l.r(a),l.d(a,{default:()=>u});var e=l(2649),t=l.n(e),n=l(9497),r=l.n(n),o=l(2749),i=l.n(o);const u=e=>r().createElement(i(),t()({},e,{appearance:"toggle"}))})(),module.exports=a})();
57
57
  //# sourceMappingURL=ToggleEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleEditor.js","mappings":";;;;4EAAA,MAOMA,EAAc,IAAIC,OAFF,KAAKC,OALY,UAAUA,OAGhB,wBAAwBA,OAEuC,KAAKA,QAIxFC,EAAYC,GAA0B,iBAAVA,GAAsBJ,EAAYK,KAAKD,E,gyBCThF,mBACA,YACA,aACA,aACA,aACA,UACA,YACA,UACA,aAEME,GAAgB,aAAO,UAAQ;;;;;EAW/BC,GAAe,aAAO,UAA0B;;;MAGhD,EAAGC,aACDA,GACA;EAWFC,EAAe,UAAOC,GAAG;kBACb,EAAAC,UAAUC;aACf,EAAAD,UAAUE;iBACN,EAAAF,UAAUG;EAGrBC,GAAa,aAAO,UAAK;;EAIzBC,EAAgB,UAAOC,IAAI;;;kBAGf,EAAAN,UAAUO;;EAItBC,EAAa,CAACC,EAAQC,IACpBA,EACO,CAACD,EAAOE,MAAKC,GAAKA,IAAMF,IAA0BA,GAGtDD,EAqKX,UAvFuB,EACnBI,OACAC,aAAa,UACbC,WACAC,OACAvB,QACAgB,SACAQ,aACAP,0BACAQ,gBAAgB,QAChBC,aACAC,QACAC,aAAa,WACbC,cAAa,EACbC,eACAC,eAEA,MAAMC,GAAW,IAAAjC,WAAUC,IAAU6B,EACrC,IAAII,EAGJ,GAAIC,MAAMC,QAAQnB,IAA6B,IAAlBA,EAAOoB,OAChCH,EAAUlB,EACNC,EAAOqB,KAAIlB,GAAKA,EAAEnB,QAClBiB,QAED,GAAIiB,MAAMC,Q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AUC,QAAQ,wB,SCAzBF,EAAOC,QAAUC,QAAQ,a,WCAzBF,EAAOC,QAAUC,QAAQ,Q,UCAzBF,EAAOC,QAAUC,QAAQ,oB,GCCrBC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaL,QAGrB,IAAID,EAASG,EAAyBE,GAAY,CAGjDJ,QAAS,CAAC,GAOX,OAHAO,EAAoBH,GAAUI,KAAKT,EAAOC,QAASD,EAAQA,EAAOC,QAASG,GAGpEJ,EAAOC,OACf,CCrBAG,EAAoBM,EAAKV,IACxB,IAAIW,EAASX,GAAUA,EAAOY,WAC7B,IAAOZ,EAAiB,QACxB,IAAM,EAEP,OADAI,EAAoBS,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdP,EAAoBS,EAAI,CAACZ,EAASc,KACjC,IAAI,IAAIC,KAAOD,EACXX,EAAoBa,EAAEF,EAAYC,KAASZ,EAAoBa,EAAEhB,EAASe,IAC5EE,OAAOC,eAAelB,EAASe,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDZ,EAAoBa,EAAI,CAACK,EAAKC,IAAUL,OAAOM,UAAUC,eAAehB,KAAKa,EAAKC,GCClFnB,EAAoBsB,EAAKzB,IACH,oBAAX0B,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAelB,EAAS0B,OAAOC,YAAa,CAAE/G,MAAO,WAE7DqG,OAAOC,eAAelB,EAAS,aAAc,CAAEpF,OAAO,GAAO,E,0GCF9D,MAKA,EALqBgH,GAASC,IAAAA,cAACC,IAAcC,IAAA,GAAKH,EAAK,CAAEpF,WAAW,W","sources":["webpack://@splunk/dynamic-editors/./src/utils/token.js","webpack://@splunk/dynamic-editors/./src/editors/CheckboxEditor.tsx","webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/extends\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/SlidersDoubleHorizontal\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Button\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Chip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ControlGroup\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Link\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Switch\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Tooltip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"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/./src/editors/ToggleEditor.jsx"],"sourcesContent":["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 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, { Children, cloneElement, ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport Button, { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport SUIControlGroup, { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nAdvancedControlGroup.defaultProps = {\n isAdvanced: false,\n};\n\nexport default AdvancedControlGroup;\n","module.exports = require(\"@babel/runtime/helpers/extends\");","module.exports = require(\"@splunk/react-icons/SlidersDoubleHorizontal\");","module.exports = require(\"@splunk/react-ui/Button\");","module.exports = require(\"@splunk/react-ui/Chip\");","module.exports = require(\"@splunk/react-ui/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Link\");","module.exports = require(\"@splunk/react-ui/Switch\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/ui-utils/i18n\");","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};","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"],"names":["TokenRegExp","RegExp","source","hasTokens","value","test","StyledTooltip","StyledSwitch","hasChip","CheckboxInfo","div","variables","spacingXSmall","contentColorDefault","fontSizeSmall","StyledChip","CenteredLabel","span","inputHeight","sortValues","values","variantForSelectedState","find","v","help","helpFormat","onChange","name","itemSchema","labelPosition","labelWidth","label","appearance","isDisabled","helpTextLink","chipText","disabled","options","Array","isArray","length","map","enum","type","Error","JSON","stringify","handleClick","useCallback","event","onClick","selected","content","to","href","tooltip","ControlGroupContainer","spacingMedium","StyledToolTip","StyledAdvancedConfigButton","contentColorActive","interactiveColorOverlayDrag","AdvancedConfigButton","_","icon","AdvancedControlGroup","dataTest","children","isAdvanced","hideLabel","style","error","controlsLayout","onAdvancedConfigButtonClick","Children","toArray","filter","Boolean","child","cloneElement","flex","propTypes","T","object","bool","func","defaultProps","module","exports","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","props","React","CheckboxEditor","_extends"],"sourceRoot":""}
1
+ {"version":3,"file":"ToggleEditor.js","mappings":";;;;4EAAA,MAOMA,EAAc,IAAIC,OAFF,KAAKC,OALY,UAAUA,OAGhB,wBAAwBA,OAEuC,KAAKA,QAIxFC,EAAYC,GAA0B,iBAAVA,GAAsBJ,EAAYK,KAAKD,E,gyBCThF,mBACA,YACA,aACA,aACA,aACA,UACA,YACA,UACA,aAEME,GAAgB,aAAO,UAAQ;;;;;EAW/BC,GAAe,aAAO,UAA0B;;;MAGh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,EAASe,IAC5EE,OAAOC,eAAelB,EAASe,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDZ,EAAoBa,EAAI,CAACK,EAAKC,IAAUL,OAAOM,UAAUC,eAAehB,KAAKa,EAAKC,GCClFnB,EAAoBsB,EAAKzB,IACH,oBAAX0B,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAelB,EAAS0B,OAAOC,YAAa,CAAE9G,MAAO,WAE7DoG,OAAOC,eAAelB,EAAS,aAAc,CAAEnF,OAAO,GAAO,E,0GCF9D,MAKA,EALqB+G,GAASC,IAAAA,cAACC,IAAcC,IAAA,GAAKH,EAAK,CAAEnF,WAAW,W","sources":["webpack://@splunk/dynamic-editors/./src/utils/token.js","webpack://@splunk/dynamic-editors/./src/editors/CheckboxEditor.tsx","webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/extends\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/SlidersDoubleHorizontal\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Button\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Chip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ControlGroup\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Link\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Switch\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Tooltip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"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/./src/editors/ToggleEditor.jsx"],"sourcesContent":["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 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, { Children, cloneElement, ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport Button, { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport SUIControlGroup, { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced = false,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nexport default AdvancedControlGroup;\n","module.exports = require(\"@babel/runtime/helpers/extends\");","module.exports = require(\"@splunk/react-icons/SlidersDoubleHorizontal\");","module.exports = require(\"@splunk/react-ui/Button\");","module.exports = require(\"@splunk/react-ui/Chip\");","module.exports = require(\"@splunk/react-ui/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Link\");","module.exports = require(\"@splunk/react-ui/Switch\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/ui-utils/i18n\");","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};","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"],"names":["TokenRegExp","RegExp","source","hasTokens","value","test","StyledTooltip","StyledSwitch","hasChip","CheckboxInfo","div","variables","spacingXSmall","contentColorDefault","fontSizeSmall","StyledChip","CenteredLabel","span","inputHeight","sortValues","values","variantForSelectedState","find","v","help","helpFormat","onChange","name","itemSchema","labelPosition","labelWidth","label","appearance","isDisabled","helpTextLink","chipText","disabled","options","Array","isArray","length","map","enum","type","Error","JSON","stringify","handleClick","useCallback","event","onClick","selected","content","to","href","tooltip","ControlGroupContainer","spacingMedium","StyledToolTip","StyledAdvancedConfigButton","contentColorActive","interactiveColorOverlayDrag","AdvancedConfigButton","_","icon","AdvancedControlGroup","dataTest","children","isAdvanced","hideLabel","style","error","controlsLayout","onAdvancedConfigButtonClick","Children","toArray","filter","Boolean","child","cloneElement","flex","propTypes","T","object","bool","func","module","exports","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","props","React","CheckboxEditor","_extends"],"sourceRoot":""}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "author": "Splunk",
6
6
  "//": "actual package version is maintained by git tag",
7
- "version": "0.37.2",
7
+ "version": "0.37.4",
8
8
  "scripts": {
9
9
  "build": "NODE_ENV=production webpack --config ./webpack.config.js --bail",
10
10
  "build-storybook": "sb build -c .storybook -s fonts -o .storybook-bundle",
@@ -100,5 +100,5 @@
100
100
  "webpack": "^5.88.0",
101
101
  "webpack-cli": "^5.1.4"
102
102
  },
103
- "gitHead": "f71e1eddba7571e950d96002d343b4a5c52313bc"
103
+ "gitHead": "4cbd8feaffa5ffbe1bc7486d20f8f105469f8455"
104
104
  }
@@ -2,7 +2,7 @@
2
2
  * Copyright © 2018 Splunk Inc.
3
3
  * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
4
  * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
- */(()=>{"use strict";var e={8:function(e,t,o){var r=this&&this.__createBinding||(Object.create?function(e,t,o,r){void 0===r&&(r=o);var n=Object.getOwnPropertyDescriptor(t,o);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,r,n)}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&r(t,e,o);return n(t,e),t},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdvancedConfigButton=void 0;const i=a(o(497)),u=a(o(23)),c=l(o(232)),d=o(649),s=l(o(643)),p=o(563),f=l(o(379)),b=l(o(20)),v=l(o(250)),m=(0,c.default)(v.default)`
5
+ */(()=>{"use strict";var e={8:function(e,t,o){var r=this&&this.__createBinding||(Object.create?function(e,t,o,r){void 0===r&&(r=o);var n=Object.getOwnPropertyDescriptor(t,o);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,r,n)}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&r(t,e,o);return n(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdvancedConfigButton=void 0;const i=l(o(497)),u=l(o(23)),c=a(o(232)),d=o(649),s=a(o(643)),p=o(563),f=a(o(379)),b=a(o(20)),v=a(o(250)),m=(0,c.default)(v.default)`
6
6
  margin-top: 0;
7
7
  padding: 0;
8
8
  // adjust bottom margin according to theme
@@ -33,5 +33,5 @@
33
33
  &:hover {
34
34
  background-color: ${p.variables.interactiveColorOverlayDrag} !important;
35
35
  }
36
- `;t.AdvancedConfigButton=({label:e="",onClick:t})=>i.default.createElement(g,{"data-test":`${e}-advanced-config-button-tooltip`,content:(0,d._)("Advanced configurations")},i.default.createElement(h,{"data-test":`${e}-advanced-config-button`,icon:i.default.createElement(s.default,{"data-test":`${e}-advanced-config-button-icon`}),appearance:"subtle",onClick:t}));const y=({"data-test":e,children:o,isAdvanced:r,label:n,hideLabel:a,labelPosition:l,labelWidth:u,tooltip:c,help:d,style:s,error:p,controlsLayout:f,onClick:b,onAdvancedConfigButtonClick:v})=>i.default.createElement(m,{"data-test":null!=e?e:"control-group",label:n,hideLabel:a,labelPosition:l,labelWidth:u,tooltip:c,help:d,error:p,style:s,onClick:b,controlsLayout:f},r?i.Children.toArray(o).filter(Boolean).map((e=>(0,i.cloneElement)(e,{style:{flex:1}}))):o,r?i.default.createElement(t.AdvancedConfigButton,{label:n,onClick:v}):null);y.propTypes={style:u.object,isAdvanced:u.bool,onClick:u.func,onAdvancedConfigButtonClick:u.func},y.defaultProps={isAdvanced:!1},t.default=y},643:e=>{e.exports=require("@splunk/react-icons/SlidersDoubleHorizontal")},20:e=>{e.exports=require("@splunk/react-ui/Button")},250:e=>{e.exports=require("@splunk/react-ui/ControlGroup")},379:e=>{e.exports=require("@splunk/react-ui/Tooltip")},563:e=>{e.exports=require("@splunk/themes")},649:e=>{e.exports=require("@splunk/ui-utils/i18n")},23:e=>{e.exports=require("prop-types")},497:e=>{e.exports=require("react")},232:e=>{e.exports=require("styled-components")}},t={};var o=function o(r){var n=t[r];if(void 0!==n)return n.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,o),a.exports}(8);module.exports=o})();
36
+ `;t.AdvancedConfigButton=({label:e="",onClick:t})=>i.default.createElement(g,{"data-test":`${e}-advanced-config-button-tooltip`,content:(0,d._)("Advanced configurations")},i.default.createElement(h,{"data-test":`${e}-advanced-config-button`,icon:i.default.createElement(s.default,{"data-test":`${e}-advanced-config-button-icon`}),appearance:"subtle",onClick:t}));const y=({"data-test":e,children:o,isAdvanced:r=!1,label:n,hideLabel:l,labelPosition:a,labelWidth:u,tooltip:c,help:d,style:s,error:p,controlsLayout:f,onClick:b,onAdvancedConfigButtonClick:v})=>i.default.createElement(m,{"data-test":null!=e?e:"control-group",label:n,hideLabel:l,labelPosition:a,labelWidth:u,tooltip:c,help:d,error:p,style:s,onClick:b,controlsLayout:f},r?i.Children.toArray(o).filter(Boolean).map((e=>(0,i.cloneElement)(e,{style:{flex:1}}))):o,r?i.default.createElement(t.AdvancedConfigButton,{label:n,onClick:v}):null);y.propTypes={style:u.object,isAdvanced:u.bool,onClick:u.func,onAdvancedConfigButtonClick:u.func},t.default=y},643:e=>{e.exports=require("@splunk/react-icons/SlidersDoubleHorizontal")},20:e=>{e.exports=require("@splunk/react-ui/Button")},250:e=>{e.exports=require("@splunk/react-ui/ControlGroup")},379:e=>{e.exports=require("@splunk/react-ui/Tooltip")},563:e=>{e.exports=require("@splunk/themes")},649:e=>{e.exports=require("@splunk/ui-utils/i18n")},23:e=>{e.exports=require("prop-types")},497:e=>{e.exports=require("react")},232:e=>{e.exports=require("styled-components")}},t={};var o=function o(r){var n=t[r];if(void 0!==n)return n.exports;var l=t[r]={exports:{}};return e[r].call(l.exports,l,l.exports,o),l.exports}(8);module.exports=o})();
37
37
  //# sourceMappingURL=AdvancedControlGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdvancedControlGroup.js","mappings":";;;;s1BAAA,kBACA,WACA,YACA,SACA,YACA,SACA,YACA,WACA,YAgBMA,GAAwB,aAAO,UAAgB;;;;qBAIhC,EAAAC,UAAUC;;;;;;;;;;;;;;;;EAmBzBC,GAAgB,aAAO,UAAQ;;;;;;EAQ/BC,GAA6B,aAAO,UAAoB;aACjD,EAAAH,UAAUI;;4BAEK,EAAAJ,UAAUK;;EAIzB,EAAAC,qBAAuB,EAChCC,QAAQ,GACRC,aAGI,wBAACN,EAAa,aACC,GAAGK,mCACdE,SAAS,IAAAC,GAAE,4BAEX,wBAACP,EAA0B,aACZ,GAAGI,2BACdI,KAAM,wBAAC,UAAkB,aAAY,GAAGJ,kCACxCK,WAAW,SACXJ,QAASA,KAMzB,MAAMK,EAAuB,EACzB,YAAaC,EACbC,WACAC,aACAT,QACAU,YACAC,gBACAC,aACAC,UACAC,OACAC,QACAC,QACAC,iBACAhB,UACAiB,iCAEA,wBAAC1B,EAAqB,aACPe,QAAAA,EAAY,gBACvBP,MAAOA,EACPU,UAAWA,EACXC,cAAeA,EACfC,WAAYA,EACZC,QAASA,EACTC,KAAMA,EACNE,MAAOA,EACPD,MAAOA,EACPd,QAASA,EACTgB,eAAgBA,GAEfR,EACK,EAAAU,SAASC,QAAQZ,GACZa,OAAOC,SACPC,KAAIC,IACD,IAAAC,cAAaD,EAAuB,CAChCT,MAAO,CAAEW,KAAM,OAG3BlB,EACLC,EAAa,wBAAC,EAAAV,qBAAoB,CAACC,MAAOA,EAAOC,QAASiB,IAAkC,MAIrGZ,EAAqBqB,UAAY,CAI7BZ,MAAOa,EAAEC,OAITpB,WAAYmB,EAAEE,KAId7B,QAAS2B,EAAEG,KAIXb,4BAA6BU,EAAEG,MAGnCzB,EAAqB0B,aAAe,CAChCvB,YAAY,GAGhB,UAAeH,C,UClJf2B,EAAOC,QAAUC,QAAQ,8C,SCAzBF,EAAOC,QAAUC,QAAQ,0B,UCAzBF,EAAOC,QAAUC,QAAQ,gC,UCAzBF,EAAOC,QAAUC,QAAQ,2B,UCAzBF,EAAOC,QAAUC,QAAQ,iB,UCAzBF,EAAOC,QAAUC,QAAQ,wB,SCAzBF,EAAOC,QAAUC,QAAQ,a,UCAzBF,EAAOC,QAAUC,QAAQ,Q,UCAzBF,EAAOC,QAAUC,QAAQ,oB,GCCrBC,EAA2B,CAAC,ECEhC,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaN,QAGrB,IAAID,EAASG,EAAyBG,GAAY,CAGjDL,QAAS,CAAC,GAOX,OAHAQ,EAAoBH,GAAUI,KAAKV,EAAOC,QAASD,EAAQA,EAAOC,QAASI,GAGpEL,EAAOC,OACf,CCnB0BI,CAAoB,G","sources":["webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/SlidersDoubleHorizontal\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Button\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ControlGroup\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Tooltip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"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/startup"],"sourcesContent":["import React, { Children, cloneElement, ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport Button, { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport SUIControlGroup, { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nAdvancedControlGroup.defaultProps = {\n isAdvanced: false,\n};\n\nexport default AdvancedControlGroup;\n","module.exports = require(\"@splunk/react-icons/SlidersDoubleHorizontal\");","module.exports = require(\"@splunk/react-ui/Button\");","module.exports = require(\"@splunk/react-ui/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/ui-utils/i18n\");","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","// 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__(8);\n"],"names":["ControlGroupContainer","variables","spacingMedium","StyledToolTip","StyledAdvancedConfigButton","contentColorActive","interactiveColorOverlayDrag","AdvancedConfigButton","label","onClick","content","_","icon","appearance","AdvancedControlGroup","dataTest","children","isAdvanced","hideLabel","labelPosition","labelWidth","tooltip","help","style","error","controlsLayout","onAdvancedConfigButtonClick","Children","toArray","filter","Boolean","map","child","cloneElement","flex","propTypes","T","object","bool","func","defaultProps","module","exports","require","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call"],"sourceRoot":""}
1
+ {"version":3,"file":"AdvancedControlGroup.js","mappings":";;;;s1BAAA,kBACA,WACA,YACA,SACA,YACA,SACA,YACA,WACA,YAgBMA,GAAwB,a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AQ,a,UCAzBF,EAAOC,QAAUC,QAAQ,Q,UCAzBF,EAAOC,QAAUC,QAAQ,oB,GCCrBC,EAA2B,CAAC,ECEhC,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaN,QAGrB,IAAID,EAASG,EAAyBG,GAAY,CAGjDL,QAAS,CAAC,GAOX,OAHAQ,EAAoBH,GAAUI,KAAKV,EAAOC,QAASD,EAAQA,EAAOC,QAASI,GAGpEL,EAAOC,OACf,CCnB0BI,CAAoB,G","sources":["webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/SlidersDoubleHorizontal\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Button\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ControlGroup\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Tooltip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"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/startup"],"sourcesContent":["import React, { Children, cloneElement, ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport Button, { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport SUIControlGroup, { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced = false,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nexport default AdvancedControlGroup;\n","module.exports = require(\"@splunk/react-icons/SlidersDoubleHorizontal\");","module.exports = require(\"@splunk/react-ui/Button\");","module.exports = require(\"@splunk/react-ui/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/ui-utils/i18n\");","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","// 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__(8);\n"],"names":["ControlGroupContainer","variables","spacingMedium","StyledToolTip","StyledAdvancedConfigButton","contentColorActive","interactiveColorOverlayDrag","AdvancedConfigButton","label","onClick","content","_","icon","appearance","AdvancedControlGroup","dataTest","children","isAdvanced","hideLabel","labelPosition","labelWidth","tooltip","help","style","error","controlsLayout","onAdvancedConfigButtonClick","Children","toArray","filter","Boolean","map","child","cloneElement","flex","propTypes","T","object","bool","func","module","exports","require","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call"],"sourceRoot":""}