@splunk/dynamic-editors 0.42.1 → 0.42.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -94
- package/DynamicEditor.js +69 -69
- package/DynamicEditor.js.map +1 -1
- package/containers/EditorItem.js +72 -72
- package/containers/EditorItem.js.map +1 -1
- package/containers/EditorLayout.js +80 -80
- package/containers/EditorLayout.js.map +1 -1
- package/containers/EditorLayoutItem.js +54 -54
- package/containers/EditorLayoutItem.js.map +1 -1
- package/editors/AdvancedConfigCard.js.map +1 -1
- package/editors/ArrayOfStringsEditor.js +4 -4
- package/editors/ArrayOfStringsEditor.js.map +1 -1
- package/editors/CheckboxEditor.js.map +1 -1
- package/editors/ColorEditor.js.map +1 -1
- package/editors/ColumnMultiSelectionByFieldNameEditor.js.map +1 -1
- package/editors/ColumnMultiSelectionEditor.js +4 -4
- package/editors/ColumnMultiSelectionEditor.js.map +1 -1
- package/editors/ColumnSelectionEditor.js +4 -4
- package/editors/ColumnSelectionEditor.js.map +1 -1
- package/editors/CustomizedInSourceEditor.js +4 -4
- package/editors/CustomizedInSourceEditor.js.map +1 -1
- package/editors/DynamicColorEditor.js +40 -40
- package/editors/DynamicColorEditor.js.map +1 -1
- package/editors/DynamicColorEditorWithPrecedence.js +24 -24
- package/editors/DynamicColorEditorWithPrecedence.js.map +1 -1
- package/editors/DynamicItemEditor.js +4 -4
- package/editors/DynamicItemEditor.js.map +1 -1
- package/editors/ImageEditor.js.map +1 -1
- package/editors/MultiColorPickerEditor.js.map +1 -1
- package/editors/NetworkGraphDynamicColorEditor.js +39 -39
- package/editors/NetworkGraphDynamicColorEditor.js.map +1 -1
- package/editors/NumberEditor.js.map +1 -1
- package/editors/PercentEditor.js.map +1 -1
- package/editors/PresetSelectorEditor.js +1 -1
- package/editors/PresetSelectorEditor.js.map +1 -1
- package/editors/RadioBarEditor.js.map +1 -1
- package/editors/SelectEditor.js.map +1 -1
- package/editors/SeriesColorsByFieldEditor.js.map +1 -1
- package/editors/SeriesColorsEditor.js +12 -12
- package/editors/SeriesColorsEditor.js.map +1 -1
- package/editors/SliderEditor.js +3 -3
- package/editors/SliderEditor.js.map +1 -1
- package/editors/StaticItemEditor.js.map +1 -1
- package/editors/TableColumnFormatterEditor.js +52 -52
- package/editors/TableColumnFormatterEditor.js.map +1 -1
- package/editors/TableDynamicColorEditor.js +24 -24
- package/editors/TableDynamicColorEditor.js.map +1 -1
- package/editors/TextAreaEditor.js.map +1 -1
- package/editors/TextEditor.js.map +1 -1
- package/editors/ThresholdEditor.js.map +1 -1
- package/editors/ToggleEditor.js.map +1 -1
- package/package.json +2 -2
- package/shared/AdvancedControlGroup.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAreaEditor.js","mappings":";;;;0pCAAA,mBACA,WACA,YACA,aACA,UACA,aACA,UACA,UAKMA,GAAiB,aAAO,UAAS;;WAE7B,IAAAC,MAAK,CACHC,WAAY,CACRC,KAAM,EAAAC,GAAG;6BACI,EAAAC,UAAUC;wCACC,EAAAD,UAAUE;oCACd,EAAAF,UAAUG;;;EAoBxCC,EAAkB,I,IAAA,SACpBC,EAAQ,KACRC,EAAI,MACJC,EAAQ,GAAE,MACVC,EAAK,cACLC,EAAgB,MAAK,WACrBC,EAAU,UACVC,EAAS,WACTC,EAAU,KACVC,EAAI,QACJC,EAAO,MACPC,GAAK,EACFC,EAAU,IAZO,oHAcpB,MAAOC,EAAKC,IAAU,IAAAC,UAAiBZ,IAGvC,IAAAa,YAAU,IAAMF,EAAOX,IAAQ,CAACA,IAEhC,MAAMc,GAAe,IAAAC,cACjB,CACIC,GACEhB,MAAOiB,MAETN,EAAOM,EAAE,GAEb,IAGEC,GAAa,IAAAH,cACdI,IACG,MAAMC,EAASV,EAAIW,OACfD,IAAWpB,GAIfF,EAASqB,EAAOpB,EAAMqB,EAAO,GAEjC,CAACV,EAAKV,EAAOF,EAAUC,IAG3B,OACI,wBA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CJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaN,QAGrB,IAAID,EAASG,EAAyBG,GAAY,CAGjDL,QAAS,CAAC,GAOX,OAHAQ,EAAoBH,GAAUI,KAAKV,EAAOC,QAASD,EAAQA,EAAOC,QAASI,GAGpEL,EAAOC,OACf,CCnB0BI,CAAoB,M","sources":["webpack://@splunk/dynamic-editors/./src/editors/TextAreaEditor.tsx","webpack://@splunk/dynamic-editors/./src/interfaces/BaseEditorProps.ts","webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/./src/shared/dimensionConstants.ts","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/TextArea\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Tooltip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/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, { useState, useCallback, useEffect } from 'react';\nimport T from 'prop-types';\nimport styled, { css } from 'styled-components';\nimport TextArea from '@splunk/react-ui/TextArea';\nimport { pick, variables } from '@splunk/themes';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { editorStyle } from '../shared/dimensionConstants';\nimport { BaseEditorPropTypes } from '../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\n\n// The dark disabled textarea theme is being overriden by a global style in\n// core, so we need to specify it here so it has higher priority\nconst StyledTextArea = styled(TextArea)`\n textarea[disabled] {\n ${pick({\n enterprise: {\n dark: css`\n color: ${variables.textDisabledColor};\n background-color: ${variables.borderColor};\n border-color: ${variables.backgroundColorHover};\n `,\n },\n })}\n }\n`;\n\ninterface TextAreaEditorProps extends BaseEditorProps {\n /** current value of field */\n value: string;\n /** visually hide the label, but render it for screen readers */\n hideLabel?: boolean;\n /** help text under controls */\n help?: string;\n /** text to display in a tooltip next to the label */\n tooltip?: string;\n /** if the input should display error state */\n error?: boolean;\n}\n\nconst TextAreaEditor = ({\n onChange,\n name,\n value = '',\n label,\n labelPosition = 'top',\n labelWidth,\n hideLabel,\n isDisabled,\n help,\n tooltip,\n error,\n ...otherProps\n}: TextAreaEditorProps) => {\n const [val, setVal] = useState<string>(value);\n\n // maintain consistency of value state with prop\n useEffect(() => setVal(value), [value]);\n\n const handleChange = useCallback(\n (\n _event: React.ChangeEvent<HTMLTextAreaElement> | React.MouseEvent<HTMLSpanElement>,\n { value: v }: { value: string }\n ) => {\n setVal(v);\n },\n []\n );\n\n const handleBlur = useCallback(\n (event: React.FocusEvent<HTMLTextAreaElement> | React.KeyboardEvent<HTMLTextAreaElement>) => {\n const newVal = val.trim();\n if (newVal === value) {\n return;\n }\n // only change value if it is different from previous\n onChange(event, name, newVal);\n },\n [val, value, onChange, name]\n );\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n hideLabel={hideLabel}\n help={help}\n tooltip={tooltip}\n error={error}\n >\n <StyledTextArea\n key={value}\n data-test={name}\n style={editorStyle}\n onChange={handleChange}\n onBlur={handleBlur}\n value={val}\n disabled={isDisabled}\n {...otherProps}\n error={error}\n />\n </ControlGroup>\n );\n};\n\nconst propTypes: Record<keyof TextAreaEditorProps, T.Validator<any>> = {\n ...BaseEditorPropTypes,\n value: T.string,\n hideLabel: T.bool,\n help: T.string,\n tooltip: T.string,\n error: T.bool,\n};\n\nTextAreaEditor.propTypes = propTypes;\n\nexport default TextAreaEditor;\n","import * as T from 'prop-types';\nimport type { JSONSchema7 } from 'json-schema';\n\nexport interface BaseEditorProps {\n name: string;\n value: any;\n onChange?: (...args: any[]) => void;\n label?: string; // @TODO(pwied): this should not live in editor props\n labelPosition?: 'top' | 'left'; // ^^^\n context?: Record<string, any>;\n labelWidth?: number;\n isAdvanced?: boolean;\n isDisabled?: boolean;\n dataSourceBindings?: Record<string, any>;\n options?: { [k: string]: any };\n optionsSchema?: {\n [key: string]: JSONSchema7;\n };\n}\n\nexport const BaseEditorPropTypes: Record<keyof BaseEditorProps, T.Validator<any>> = {\n name: T.string.isRequired,\n value: T.oneOfType([T.string, T.object, T.arrayOf(T.string)]),\n context: T.object,\n label: T.string,\n labelPosition: T.oneOf(['top', 'left']),\n labelWidth: T.number,\n onChange: T.func,\n isAdvanced: T.bool,\n isDisabled: T.bool,\n dataSourceBindings: T.object,\n options: T.object,\n optionsSchema: T.object,\n};\n","import React, { Children, cloneElement } from 'react';\nimport type { ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport Button, { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport SUIControlGroup from '@splunk/react-ui/ControlGroup';\nimport type { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced = false,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nexport default AdvancedControlGroup;\n","export const FLYOUT_PADDING = 21;\nexport const COLUMN_FLYOUT_PADDING = 16;\nexport const FLYOUT_WIDTH = 344;\n\nexport const VERTICAL_EDITOR_SPACING = 16;\n\nexport const DROPDOWN_MENU_WIDTH = 327;\n\nexport const editorStyle = { width: '100%' };\n","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/TextArea\");","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__(8687);\n"],"names":["StyledTextArea","pick","enterprise","dark","css","variables","textDisabledColor","borderColor","backgroundColorHover","TextAreaEditor","onChange","name","value","label","labelPosition","labelWidth","hideLabel","isDisabled","help","tooltip","error","otherProps","val","setVal","useState","useEffect","handleChange","useCallback","_event","v","handleBlur","event","newVal","trim","key","style","editorStyle","onBlur","disabled","propTypes","BaseEditorPropTypes","string","bool","T","isRequired","oneOfType","object","arrayOf","context","oneOf","number","func","isAdvanced","dataSourceBindings","options","optionsSchema","ControlGroupContainer","spacingMedium","StyledToolTip","StyledAdvancedConfigButton","contentColorActive","interactiveColorOverlayDrag","AdvancedConfigButton","onClick","content","_","icon","appearance","AdvancedControlGroup","dataTest","children","controlsLayout","onAdvancedConfigButtonClick","Children","toArray","filter","Boolean","map","child","cloneElement","flex","FLYOUT_PADDING","COLUMN_FLYOUT_PADDING","FLYOUT_WIDTH","VERTICAL_EDITOR_SPACING","DROPDOWN_MENU_WIDTH","width","module","exports","require","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"TextAreaEditor.js","mappings":";;;;0pCAAA,mBACA,WACA,YACA,aACA,UACA,aACA,UACA,UAKMA,GAAiB,aAAO,UAAS;;WAE7B,IAAAC,MAAK,CACHC,WAAY,CACRC,KAAM,EAAAC,GAAG;6BACI,EAAAC,UAAUC;wCACC,EAAAD,UAAUE;oCACd,EAAAF,UAAUG;;;EAoBxCC,EAAkB,I,IAAA,SACpBC,EAAQ,KACRC,EAAI,MACJC,EAAQ,GAAE,MACVC,EAAK,cACLC,EAAgB,MAAK,WACrBC,EAAU,UACVC,EAAS,WACTC,EAAU,KACVC,EAAI,QACJC,EAAO,MACPC,GAAK,EACFC,EAAU,IAZO,oHAcpB,MAAOC,EAAKC,IAAU,IAAAC,UAAiBZ,IAGvC,IAAAa,YAAU,IAAMF,EAAOX,IAAQ,CAACA,IAEhC,MAAMc,GAAe,IAAAC,cACjB,CACIC,GACEhB,MAAOiB,MAETN,EAAOM,EAAE,G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AOC,QAAUC,QAAQ,wB,SCAzBF,EAAOC,QAAUC,QAAQ,a,WCAzBF,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,M","sources":["webpack://@splunk/dynamic-editors/./src/editors/TextAreaEditor.tsx","webpack://@splunk/dynamic-editors/./src/interfaces/BaseEditorProps.ts","webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/./src/shared/dimensionConstants.ts","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/TextArea\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Tooltip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/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, { useState, useCallback, useEffect } from 'react';\nimport T from 'prop-types';\nimport styled, { css } from 'styled-components';\nimport TextArea from '@splunk/react-ui/TextArea';\nimport { pick, variables } from '@splunk/themes';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { editorStyle } from '../shared/dimensionConstants';\nimport { BaseEditorPropTypes } from '../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\n\n// The dark disabled textarea theme is being overriden by a global style in\n// core, so we need to specify it here so it has higher priority\nconst StyledTextArea = styled(TextArea)`\n textarea[disabled] {\n ${pick({\n enterprise: {\n dark: css`\n color: ${variables.textDisabledColor};\n background-color: ${variables.borderColor};\n border-color: ${variables.backgroundColorHover};\n `,\n },\n })}\n }\n`;\n\ninterface TextAreaEditorProps extends BaseEditorProps {\n /** current value of field */\n value: string;\n /** visually hide the label, but render it for screen readers */\n hideLabel?: boolean;\n /** help text under controls */\n help?: string;\n /** text to display in a tooltip next to the label */\n tooltip?: string;\n /** if the input should display error state */\n error?: boolean;\n}\n\nconst TextAreaEditor = ({\n onChange,\n name,\n value = '',\n label,\n labelPosition = 'top',\n labelWidth,\n hideLabel,\n isDisabled,\n help,\n tooltip,\n error,\n ...otherProps\n}: TextAreaEditorProps) => {\n const [val, setVal] = useState<string>(value);\n\n // maintain consistency of value state with prop\n useEffect(() => setVal(value), [value]);\n\n const handleChange = useCallback(\n (\n _event: React.ChangeEvent<HTMLTextAreaElement> | React.MouseEvent<HTMLSpanElement>,\n { value: v }: { value: string }\n ) => {\n setVal(v);\n },\n []\n );\n\n const handleBlur = useCallback(\n (event: React.FocusEvent<HTMLTextAreaElement> | React.KeyboardEvent<HTMLTextAreaElement>) => {\n const newVal = val.trim();\n if (newVal === value) {\n return;\n }\n // only change value if it is different from previous\n onChange(event, name, newVal);\n },\n [val, value, onChange, name]\n );\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n hideLabel={hideLabel}\n help={help}\n tooltip={tooltip}\n error={error}\n >\n <StyledTextArea\n key={value}\n data-test={name}\n style={editorStyle}\n onChange={handleChange}\n onBlur={handleBlur}\n value={val}\n disabled={isDisabled}\n {...otherProps}\n error={error}\n />\n </ControlGroup>\n );\n};\n\nconst propTypes: Record<keyof TextAreaEditorProps, T.Validator<any>> = {\n ...BaseEditorPropTypes,\n value: T.string,\n hideLabel: T.bool,\n help: T.string,\n tooltip: T.string,\n error: T.bool,\n};\n\nTextAreaEditor.propTypes = propTypes;\n\nexport default TextAreaEditor;\n","import * as T from 'prop-types';\nimport type { JSONSchema7 } from 'json-schema';\n\nexport interface BaseEditorProps {\n name: string;\n value: any;\n onChange?: (...args: any[]) => void;\n label?: string; // @TODO(pwied): this should not live in editor props\n labelPosition?: 'top' | 'left'; // ^^^\n context?: Record<string, any>;\n labelWidth?: number;\n isAdvanced?: boolean;\n isDisabled?: boolean;\n dataSourceBindings?: Record<string, any>;\n options?: { [k: string]: any };\n optionsSchema?: {\n [key: string]: JSONSchema7;\n };\n}\n\nexport const BaseEditorPropTypes: Record<keyof BaseEditorProps, T.Validator<any>> = {\n name: T.string.isRequired,\n value: T.oneOfType([T.string, T.object, T.arrayOf(T.string)]),\n context: T.object,\n label: T.string,\n labelPosition: T.oneOf(['top', 'left']),\n labelWidth: T.number,\n onChange: T.func,\n isAdvanced: T.bool,\n isDisabled: T.bool,\n dataSourceBindings: T.object,\n options: T.object,\n optionsSchema: T.object,\n};\n","import React, { Children, cloneElement } from 'react';\nimport type { ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport type { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport Button from '@splunk/react-ui/Button';\nimport SUIControlGroup from '@splunk/react-ui/ControlGroup';\nimport type { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced = false,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nexport default AdvancedControlGroup;\n","export const FLYOUT_PADDING = 21;\nexport const COLUMN_FLYOUT_PADDING = 16;\nexport const FLYOUT_WIDTH = 344;\n\nexport const VERTICAL_EDITOR_SPACING = 16;\n\nexport const DROPDOWN_MENU_WIDTH = 327;\n\nexport const editorStyle = { width: '100%' };\n","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/TextArea\");","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__(8687);\n"],"names":["StyledTextArea","pick","enterprise","dark","css","variables","textDisabledColor","borderColor","backgroundColorHover","TextAreaEditor","onChange","name","value","label","labelPosition","labelWidth","hideLabel","isDisabled","help","tooltip","error","otherProps","val","setVal","useState","useEffect","handleChange","useCallback","_event","v","handleBlur","event","newVal","trim","key","style","editorStyle","onBlur","disabled","propTypes","BaseEditorPropTypes","string","bool","T","isRequired","oneOfType","object","arrayOf","context","oneOf","number","func","isAdvanced","dataSourceBindings","options","optionsSchema","ControlGroupContainer","spacingMedium","StyledToolTip","StyledAdvancedConfigButton","contentColorActive","interactiveColorOverlayDrag","AdvancedConfigButton","onClick","content","_","icon","appearance","AdvancedControlGroup","dataTest","children","controlsLayout","onAdvancedConfigButtonClick","Children","toArray","filter","Boolean","map","child","cloneElement","flex","FLYOUT_PADDING","COLUMN_FLYOUT_PADDING","FLYOUT_WIDTH","VERTICAL_EDITOR_SPACING","DROPDOWN_MENU_WIDTH","width","module","exports","require","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call"],"sourceRoot":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.js","mappings":";;;;y1BAAA,mBAEA,WACA,YACA,UACA,aACA,UACA,aACA,aACA,aAiBMA,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,EAA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YACPmC,SAAUsB,EACVc,UAAWP,EACXQ,OAAQZ,EACR7B,MAAOY,EACP8B,SAAUnC,EACVoC,UAAQ,GACJlC,EAAU,CACdxD,QAASiE,GAAcjE,KAEhB,EAIvBiD,EAAWtC,UAAY,CAQnBwC,SAAUvC,IAAAA,KAAO+E,WAIjBvC,KAAMxC,IAAAA,OAAS+E,WAIf3G,MAAO4B,IAAAA,OAAS+E,WAIhB5C,MAAOnC,IAAAA,OAIPjB,cAAeiB,IAAAA,MAAQ,CAAC,MAAO,SAI/BhB,WAAYgB,IAAAA,OAIZyC,WAAYzC,IAAAA,OAIZlB,UAAWkB,IAAAA,KAIXnB,WAAYmB,IAAAA,KAIZ0C,WAAY1C,IAAAA,KAIZ2C,SAAU3C,IAAAA,KAIVZ,MAAOY,IAAAA,KAIPd,KAAMc,IAAAA,OAINf,QAASe,IAAAA,QAGb,S","sources":["webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/./src/shared/dimensionConstants.ts","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/defineProperty\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/extends\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/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/Text\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Tooltip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"lodash\"","webpack://@splunk/dynamic-editors/external commonjs2 \"prop-types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react\"","webpack://@splunk/dynamic-editors/external commonjs2 \"styled-components\"","webpack://@splunk/dynamic-editors/webpack/bootstrap","webpack://@splunk/dynamic-editors/webpack/runtime/compat get default export","webpack://@splunk/dynamic-editors/webpack/runtime/define property getters","webpack://@splunk/dynamic-editors/webpack/runtime/hasOwnProperty shorthand","webpack://@splunk/dynamic-editors/webpack/runtime/make namespace object","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/objectWithoutProperties\"","webpack://@splunk/dynamic-editors/./src/editors/TextEditor.jsx"],"sourcesContent":["import React, { Children, cloneElement } from 'react';\nimport type { ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport Button, { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport SUIControlGroup from '@splunk/react-ui/ControlGroup';\nimport type { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced = false,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nexport default AdvancedControlGroup;\n","export const FLYOUT_PADDING = 21;\nexport const COLUMN_FLYOUT_PADDING = 16;\nexport const FLYOUT_WIDTH = 344;\n\nexport const VERTICAL_EDITOR_SPACING = 16;\n\nexport const DROPDOWN_MENU_WIDTH = 327;\n\nexport const editorStyle = { width: '100%' };\n","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","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/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Text\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"lodash\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"styled-components\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@babel/runtime/helpers/objectWithoutProperties\");","import React, { useState, useCallback, useEffect, useMemo } from 'react';\nimport T from 'prop-types';\nimport { debounce } from 'lodash';\nimport Text from '@splunk/react-ui/Text';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { editorStyle } from '../shared/dimensionConstants';\n\nconst defaultLabelStyle = {};\n\nconst TextEditor = ({\n onChange,\n name,\n value = '',\n label,\n labelPosition = 'top',\n labelWidth,\n labelStyle = defaultLabelStyle,\n hideLabel = false,\n isAdvanced,\n isDisabled = false,\n help,\n tooltip,\n validate,\n error,\n ...otherProps\n}) => {\n const [val, setValueState] = useState(value);\n\n const handleValidate = useCallback(\n newValue => (typeof validate === 'function' ? validate({ value: newValue }) : null),\n [validate]\n );\n const [errorState, setErrorState] = useState(handleValidate(value));\n const debouncedHandleValidate = useMemo(\n () =>\n debounce(newVal => {\n setErrorState(handleValidate(newVal));\n }, 250),\n [handleValidate]\n );\n\n useEffect(\n () => () => {\n // cancel debounce on component unmount\n debouncedHandleValidate.cancel();\n },\n [debouncedHandleValidate]\n );\n\n useEffect(() => {\n setValueState(value);\n setErrorState(handleValidate(value));\n }, [handleValidate, value]);\n\n const handleChange = useCallback(\n (_event, { value: v }) => {\n setValueState(v);\n debouncedHandleValidate(v);\n },\n [debouncedHandleValidate]\n );\n\n const handleBlur = useCallback(\n event => {\n const newVal = val.trim();\n if (newVal === value) {\n return;\n }\n const newError = handleValidate(newVal);\n // set error if there is one, or clear an existing error\n setErrorState(newError);\n if (!newError) {\n // only change value if there is no validation error\n onChange(event, name, newVal);\n }\n },\n [val, value, handleValidate, onChange, name]\n );\n\n const handleKeyPress = useCallback(\n event => {\n if (event.key === 'Enter') {\n handleBlur(event);\n }\n },\n [handleBlur]\n );\n\n const style = useMemo(\n () =>\n !label || label === ''\n ? {\n ...labelStyle,\n }\n : labelStyle,\n [label, labelStyle]\n );\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n style={style}\n hideLabel={hideLabel}\n help={help}\n tooltip={tooltip}\n error={errorState?.message || error}\n isAdvanced={isAdvanced}\n >\n <Text\n key={value}\n data-test={name}\n style={editorStyle}\n onChange={handleChange}\n onKeyDown={handleKeyPress}\n onBlur={handleBlur}\n value={val}\n disabled={isDisabled}\n canClear\n {...otherProps}\n error={!!errorState || error}\n />\n </ControlGroup>\n );\n};\n\nTextEditor.propTypes = {\n /**\n * Callback when changing the text value\n *\n * @param {SyntheticEvent} event The react `SyntheticEvent`\n * @param {string} name The option name\n * @param {string} value The option value\n */\n onChange: T.func.isRequired,\n /**\n * The option name\n */\n name: T.string.isRequired,\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n /**\n * The option value\n */\n value: T.string,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['top', 'left']),\n /**\n * Label width\n */\n labelWidth: T.number,\n /**\n * Styles to be passed to the ControlGroup\n */\n labelStyle: T.object,\n /**\n * Visually hide the label, but render it for screen readers\n */\n hideLabel: T.bool,\n /**\n * As advanced editor to show advanced config button\n */\n isAdvanced: T.bool,\n /**\n * Disabled state of component\n */\n isDisabled: T.bool,\n /**\n * Validate the value of the editor\n */\n validate: T.func,\n /**\n * If the input should display error state\n */\n error: T.bool,\n /**\n * Text to display under the the input\n */\n help: T.string,\n /**\n * Text to display in a tooltip next to the label\n */\n tooltip: T.string,\n};\n\nexport default TextEditor;\n"],"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","editorStyle","width","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","defaultLabelStyle","TextEditor","_ref","onChange","name","labelStyle","isDisabled","validate","otherProps","_objectWithoutProperties","_excluded","val","setValueState","useState","handleValidate","useCallback","newValue","errorState","setErrorState","debouncedHandleValidate","useMemo","debounce","newVal","useEffect","cancel","handleChange","_event","v","handleBlur","event","trim","newError","handleKeyPress","_objectSpread","React","ControlGroup","message","Text","_extends","onKeyDown","onBlur","disabled","canClear","isRequired"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"TextEditor.js","mappings":";;;;y1BAAA,mBAEA,WACA,YACA,UACA,aACA,UACA,aAEA,aACA,aAiBMA,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,EACT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SAI/BhB,WAAYgB,IAAAA,OAIZyC,WAAYzC,IAAAA,OAIZlB,UAAWkB,IAAAA,KAIXnB,WAAYmB,IAAAA,KAIZ0C,WAAY1C,IAAAA,KAIZ2C,SAAU3C,IAAAA,KAIVZ,MAAOY,IAAAA,KAIPd,KAAMc,IAAAA,OAINf,QAASe,IAAAA,QAGb,S","sources":["webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/./src/shared/dimensionConstants.ts","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/defineProperty\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/extends\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/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/Text\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Tooltip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"lodash\"","webpack://@splunk/dynamic-editors/external commonjs2 \"prop-types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react\"","webpack://@splunk/dynamic-editors/external commonjs2 \"styled-components\"","webpack://@splunk/dynamic-editors/webpack/bootstrap","webpack://@splunk/dynamic-editors/webpack/runtime/compat get default export","webpack://@splunk/dynamic-editors/webpack/runtime/define property getters","webpack://@splunk/dynamic-editors/webpack/runtime/hasOwnProperty shorthand","webpack://@splunk/dynamic-editors/webpack/runtime/make namespace object","webpack://@splunk/dynamic-editors/external commonjs2 \"@babel/runtime/helpers/objectWithoutProperties\"","webpack://@splunk/dynamic-editors/./src/editors/TextEditor.jsx"],"sourcesContent":["import React, { Children, cloneElement } from 'react';\nimport type { ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport type { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport Button from '@splunk/react-ui/Button';\nimport SUIControlGroup from '@splunk/react-ui/ControlGroup';\nimport type { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced = false,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nexport default AdvancedControlGroup;\n","export const FLYOUT_PADDING = 21;\nexport const COLUMN_FLYOUT_PADDING = 16;\nexport const FLYOUT_WIDTH = 344;\n\nexport const VERTICAL_EDITOR_SPACING = 16;\n\nexport const DROPDOWN_MENU_WIDTH = 327;\n\nexport const editorStyle = { width: '100%' };\n","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","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/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Text\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"lodash\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"styled-components\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@babel/runtime/helpers/objectWithoutProperties\");","import React, { useState, useCallback, useEffect, useMemo } from 'react';\nimport T from 'prop-types';\nimport { debounce } from 'lodash';\nimport Text from '@splunk/react-ui/Text';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { editorStyle } from '../shared/dimensionConstants';\n\nconst defaultLabelStyle = {};\n\nconst TextEditor = ({\n onChange,\n name,\n value = '',\n label,\n labelPosition = 'top',\n labelWidth,\n labelStyle = defaultLabelStyle,\n hideLabel = false,\n isAdvanced,\n isDisabled = false,\n help,\n tooltip,\n validate,\n error,\n ...otherProps\n}) => {\n const [val, setValueState] = useState(value);\n\n const handleValidate = useCallback(\n newValue => (typeof validate === 'function' ? validate({ value: newValue }) : null),\n [validate]\n );\n const [errorState, setErrorState] = useState(handleValidate(value));\n const debouncedHandleValidate = useMemo(\n () =>\n debounce(newVal => {\n setErrorState(handleValidate(newVal));\n }, 250),\n [handleValidate]\n );\n\n useEffect(\n () => () => {\n // cancel debounce on component unmount\n debouncedHandleValidate.cancel();\n },\n [debouncedHandleValidate]\n );\n\n useEffect(() => {\n setValueState(value);\n setErrorState(handleValidate(value));\n }, [handleValidate, value]);\n\n const handleChange = useCallback(\n (_event, { value: v }) => {\n setValueState(v);\n debouncedHandleValidate(v);\n },\n [debouncedHandleValidate]\n );\n\n const handleBlur = useCallback(\n event => {\n const newVal = val.trim();\n if (newVal === value) {\n return;\n }\n const newError = handleValidate(newVal);\n // set error if there is one, or clear an existing error\n setErrorState(newError);\n if (!newError) {\n // only change value if there is no validation error\n onChange(event, name, newVal);\n }\n },\n [val, value, handleValidate, onChange, name]\n );\n\n const handleKeyPress = useCallback(\n event => {\n if (event.key === 'Enter') {\n handleBlur(event);\n }\n },\n [handleBlur]\n );\n\n const style = useMemo(\n () =>\n !label || label === ''\n ? {\n ...labelStyle,\n }\n : labelStyle,\n [label, labelStyle]\n );\n\n return (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n style={style}\n hideLabel={hideLabel}\n help={help}\n tooltip={tooltip}\n error={errorState?.message || error}\n isAdvanced={isAdvanced}\n >\n <Text\n key={value}\n data-test={name}\n style={editorStyle}\n onChange={handleChange}\n onKeyDown={handleKeyPress}\n onBlur={handleBlur}\n value={val}\n disabled={isDisabled}\n canClear\n {...otherProps}\n error={!!errorState || error}\n />\n </ControlGroup>\n );\n};\n\nTextEditor.propTypes = {\n /**\n * Callback when changing the text value\n *\n * @param {SyntheticEvent} event The react `SyntheticEvent`\n * @param {string} name The option name\n * @param {string} value The option value\n */\n onChange: T.func.isRequired,\n /**\n * The option name\n */\n name: T.string.isRequired,\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n /**\n * The option value\n */\n value: T.string,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['top', 'left']),\n /**\n * Label width\n */\n labelWidth: T.number,\n /**\n * Styles to be passed to the ControlGroup\n */\n labelStyle: T.object,\n /**\n * Visually hide the label, but render it for screen readers\n */\n hideLabel: T.bool,\n /**\n * As advanced editor to show advanced config button\n */\n isAdvanced: T.bool,\n /**\n * Disabled state of component\n */\n isDisabled: T.bool,\n /**\n * Validate the value of the editor\n */\n validate: T.func,\n /**\n * If the input should display error state\n */\n error: T.bool,\n /**\n * Text to display under the the input\n */\n help: T.string,\n /**\n * Text to display in a tooltip next to the label\n */\n tooltip: T.string,\n};\n\nexport default TextEditor;\n"],"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","editorStyle","width","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","defaultLabelStyle","TextEditor","_ref","onChange","name","labelStyle","isDisabled","validate","otherProps","_objectWithoutProperties","_excluded","val","setValueState","useState","handleValidate","useCallback","newValue","errorState","setErrorState","debouncedHandleValidate","useMemo","debounce","newVal","useEffect","cancel","handleChange","_event","v","handleBlur","event","trim","newError","handleKeyPress","_objectSpread","React","ControlGroup","message","Text","_extends","onKeyDown","onBlur","disabled","canClear","isRequired"],"sourceRoot":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThresholdEditor.js","mappings":";;;;y1BAAA,mBAEA,WACA,YACA,UACA,aACA,UACA,aACA,aACA,aAiBMA,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,UA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ack://@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/format\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/id\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/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 } from 'react';\nimport type { ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport Button, { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport SUIControlGroup from '@splunk/react-ui/ControlGroup';\nimport type { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced = false,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nexport default AdvancedControlGroup;\n","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/format\");","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';\nimport { sprintf } from '@splunk/ui-utils/format';\n\nconst StyledThresholdError = styled.div.attrs(() => ({ 'data-test': 'threshold-error' }))`\n color: ${variables.contentColorNegative};\n padding-top: 5px;\n font-size: 12px;\n display: block;\n`;\n\nconst ThresholdError = ({ error, id, thresholdIndex }) => {\n if (error) {\n return (\n <StyledThresholdError id={id}>\n {typeof thresholdIndex === 'number'\n ? sprintf(_('Error for threshold %(thresholdIndex)d : %(error)s'), {\n thresholdIndex,\n error,\n })\n : sprintf(_('Error: %(error)s'), {\n error,\n })}\n </StyledThresholdError>\n );\n }\n\n return null;\n};\n\nThresholdError.propTypes = {\n id: T.string,\n error: T.string,\n thresholdIndex: T.number,\n};\n\nexport default ThresholdError;\n","import React, { useState, useCallback, useEffect } from 'react';\nimport T from 'prop-types';\nimport { noop } from 'lodash';\nimport Number from '@splunk/react-ui/Number';\nimport { sprintf } from '@splunk/ui-utils/format';\nimport { _ } from '@splunk/ui-utils/i18n';\n\nconst ThresholdBoundary = ({\n 'data-test': dataTest = 'threshold-boundary-input',\n boundary,\n isDisabled = false,\n isEditable = true,\n errorId,\n onChange = noop,\n onRequestClose = noop,\n onValidate = noop,\n index,\n}) => {\n const [boundaryValue, setBoundaryValue] = useState(boundary);\n\n useEffect(() => {\n setBoundaryValue(boundary);\n }, [boundary]);\n\n const handleFromChange = useCallback(\n (e, { value }) => {\n setBoundaryValue(value);\n onValidate(value);\n },\n [onValidate]\n );\n\n const handleKeyDown = useCallback(\n e => {\n if (e.key === 'Enter') {\n onChange(boundaryValue);\n }\n if (e.key === 'Escape') {\n onRequestClose();\n }\n },\n [boundaryValue, onChange, onRequestClose]\n );\n\n const handleBlur = useCallback(() => {\n onChange(boundaryValue);\n }, [onChange, boundaryValue]);\n\n const label =\n typeof index === 'number' ? sprintf(_('Threshold number %(index)d'), { index }) : _('Threshold');\n\n return isEditable ? (\n <Number\n aria-label={\n boundaryValue\n ? sprintf(_('%(label)s, value %(boundaryValue)d'), { label, boundaryValue })\n : sprintf(_('%(label)s, no value'), { label })\n }\n inline\n hideStepButtons\n disabled={isDisabled}\n value={boundaryValue || boundaryValue === 0 ? boundaryValue : null}\n onChange={handleFromChange}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n error={!!errorId}\n data-test={dataTest}\n describedBy={errorId}\n />\n ) : null;\n};\nThresholdBoundary.propTypes = {\n 'data-test': T.string,\n boundary: T.number,\n isDisabled: T.bool,\n isEditable: T.bool,\n errorId: T.string,\n onChange: T.func,\n onRequestClose: T.func,\n onValidate: T.func,\n index: T.number,\n};\n\nexport default ThresholdBoundary;\n","import { difference, get, isNaN, omit, uniqBy } from 'lodash';\n\nimport { _ } from '@splunk/ui-utils/i18n';\n\nexport const defaultThresholds = [\n {\n from: 100,\n value: '#cb3b43',\n },\n {\n from: 70,\n to: 100,\n value: '#ff7152',\n },\n {\n from: 50,\n to: 70,\n value: '#fc9850',\n },\n {\n from: 30,\n to: 50,\n value: '#f4df7a',\n },\n {\n from: 10,\n to: 30,\n value: '#4beba8',\n },\n {\n to: 10,\n value: '#5fbcff',\n },\n];\n\nexport const defaultThresholdColors = [\n '#dc4e41',\n '#f1813f',\n '#f8be34',\n '#53a051',\n '#0877a6',\n '#006d9c',\n '#ec9960',\n '#af575a',\n '#62b3b2',\n '#4fa484',\n '#f8be44',\n '#5a4575',\n '#708794',\n '#294e70',\n '#b6c75a',\n];\n\n/**\n * returns thresholds for a viz definition\n *\n * @param {object} viz definition\n * @return {array} the thresholds configuration for the thresholds editor\n */\nexport function getThresholdsForVizDefinition(vizDefinition, thresholdField) {\n return get(vizDefinition, `encoding.${thresholdField}.format.ranges`, []);\n}\n\n/**\n * Translates a thresholds configuration back into a viz definition.\n * This fn checks whether encoding exists and updates / adds an encoding configuration\n *\n * @param {object} viz definition\n * @param {array) thresholds configuration in form [{ from: <boundary>, to: <boundary>, value: <threshold value> }]\n * @param {string} the field where threshold should be applied to\n * @param {string} the default encoding field value to be used if no encoding was present\n * @return {object} an updated viz defintion with thresholds configuration applied\n */\nexport function getUpdatedVizConfigForThresholds(\n vizDefinition,\n thresholds,\n thresholdField,\n defaultEncodingFieldValue\n) {\n const formatConfig = {\n type: 'rangevalue',\n ranges: thresholds,\n };\n // @TODO(pwied):\n // future:\n // - viz data contract should expose which encoding fields are thresholdable\n // - threshold editor needs to know about the encoding field and pass it to this fn\n // - a visualization definition should always come with encoding (contract parsing needs to happen in dashboards)\n\n const getOverloadedThresholdFieldValue = tf => {\n if (typeof tf === 'object') {\n return tf;\n }\n if (typeof tf === 'string') {\n return { field: tf };\n }\n return { field: defaultEncodingFieldValue };\n };\n\n const encoding = vizDefinition?.encoding;\n const thresholdFieldValue = getOverloadedThresholdFieldValue(get(encoding, [thresholdField]));\n\n return {\n ...vizDefinition,\n encoding: {\n ...encoding,\n [thresholdField]: {\n ...thresholdFieldValue,\n format: formatConfig,\n },\n },\n };\n}\n\n/**\n * returns a viz definition with default thresholds set\n *\n * @param {object} viz definition\n * @param {string} the encoding field where threshold should be used\n * @param {string} the default encoding field value for the threshold field (ie primary[0])\n * @return {object} an updated viz defintion with default thresholds configuration applied\n */\nexport function getVizConfigWithDefaultThresholds(vizDefinition, thresholdField, defaultEncodingFieldValue) {\n return getUpdatedVizConfigForThresholds(\n vizDefinition,\n defaultThresholds,\n thresholdField,\n defaultEncodingFieldValue\n );\n}\n\n/**\n * returns a viz definition without threshold options\n *\n * @param {object} viz definition\n * @param {string} the encoding field where threshold is applied\n * @return {object} an updated viz defintion without threshold options\n */\nexport function getVizConfigWithoutThresholds(vizDefinition, thresholdField) {\n return omit(vizDefinition, `encoding.${thresholdField}`);\n}\n\n/**\n * returns a new threshold color\n *\n * @param {array} an array of threshold colors that should not be picked\n * @return {string} a color from default threshold colors that is not in the passed parameter\n * or #444000 if all colors from default colors are already used\n */\nexport function getNewThresholdColor(thresholdColors = []) {\n const diff = difference(defaultThresholdColors, thresholdColors);\n if (diff.length > 0) {\n return diff[0];\n }\n return '#444000';\n}\n\n/**\n * getUpdatedThresholdConfig calculates new threshold boundaries given an array\n * of outdated threshold configurations.\n * - the first element will always be an open upper boundary\n * - the last element will always be an open lower boundary\n * - all elements inbetween will have well defined, closed boundaries\n *\n * @param {array} array of thresholds\n * @return {array} an array of thresholds with updated boundaries\n */\nexport function getUpdatedThresholdConfig(thresholds = []) {\n if (thresholds.length < 2) {\n // a threshold config needs at least 2 levels\n // eslint-disable-next-line no-console\n console.warn('Invalid threshold configuration: at least 2 thresholds required');\n return thresholds;\n }\n // convert from and to values to numbers if they are available\n const updatedThresholds = thresholds.map(threshold => {\n const updatedThreshold = { ...threshold };\n if (threshold.from) {\n updatedThreshold.from = +threshold.from;\n }\n if (threshold.to) {\n updatedThreshold.to = +threshold.to;\n }\n return updatedThreshold;\n });\n const openLowerBounds = updatedThresholds.filter(t => t.from === undefined);\n if (openLowerBounds.length > 1) {\n // eslint-disable-next-line no-console\n console.warn('Invalid threshold configuration: multiple open lower boundaries');\n }\n // in order to determine the threshold order and ranges we can ignore the open lower bound\n const otherThresholds = updatedThresholds.filter(t => t.from !== undefined);\n if (otherThresholds.length !== uniqBy(otherThresholds, 'from').length) {\n // eslint-disable-next-line no-console\n console.warn('Invalid threshold configuration: duplicate from values');\n }\n const sortedOtherThresholds = otherThresholds.sort((a, b) => +b.from - +a.from);\n\n // This range set has open boundaries\n if (openLowerBounds.length) {\n const openLowerBound = openLowerBounds[0];\n // if the lowest from-value is not the open lower bound's to-value, update the open lower bound\n if (openLowerBound.to !== sortedOtherThresholds[sortedOtherThresholds.length - 1].from) {\n openLowerBound.to = sortedOtherThresholds[sortedOtherThresholds.length - 1].from;\n }\n // calculate the threshold ranges\n sortedOtherThresholds.forEach((el, index) => {\n const threshold = { ...el };\n if (index > 0) {\n threshold.to = sortedOtherThresholds[index - 1].from;\n } else {\n // the open uper bound is on index=0, it should not have a to value\n delete threshold.to;\n }\n sortedOtherThresholds[index] = threshold;\n });\n return [...sortedOtherThresholds, openLowerBound];\n }\n\n // This rangeset is closed ranges\n // calculate the threshold ranges\n sortedOtherThresholds.forEach((el, index) => {\n const threshold = { ...el };\n if (index > 0) {\n threshold.to = sortedOtherThresholds[index - 1].from;\n }\n sortedOtherThresholds[index] = threshold;\n });\n\n return sortedOtherThresholds;\n}\n\n/**\n * validate whether a threshold boundary update is valid\n *\n * @param {string} thresholdValueStr\n * @param {array} thresholds\n * @return {object} validation result containing error flag and an error message\n */\nexport function validateThresholdBoundary(thresholdValueStr = '', thresholds = []) {\n const thresholdValue = parseFloat(thresholdValueStr);\n if (isNaN(thresholdValue) || isNaN(+thresholdValueStr)) {\n return {\n error: true,\n errorMessage: _('Not a valid threshold. Must be a number'),\n };\n }\n if (thresholds.filter(t => t.from === thresholdValue).length > 0) {\n return {\n error: true,\n errorMessage: _('Value already exists'),\n };\n }\n return {\n error: false,\n errorMessage: null,\n };\n}\n\n/**\n * validate whether a threshold boundary update is valid\n *\n * @param {String|Number} thresholdValueStr\n * @param {String|Number} fromValueStr\n * @return {Object} validation result containing error flag and an error message\n */\nexport function validateThresholdUpperBoundary(thresholdValueStr = '', fromValueStr = '') {\n const thresholdValue = parseFloat(thresholdValueStr);\n const fromValue = parseFloat(fromValueStr);\n\n if (isNaN(thresholdValue) || isNaN(+thresholdValueStr) || isNaN(fromValue) || isNaN(+fromValueStr)) {\n return {\n error: true,\n errorMessage: _('Not a valid threshold. Must be a number'),\n };\n }\n if (thresholdValue < fromValue) {\n return {\n error: true,\n errorMessage: _('Upper boundary must exceed lower boundary'),\n };\n }\n return {\n error: false,\n errorMessage: null,\n };\n}\n","import React, { useState, useCallback } from 'react';\nimport T from 'prop-types';\nimport { noop } from 'lodash';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport Button from '@splunk/react-ui/Button';\nimport ThresholdError from './ThresholdError';\nimport ThresholdBoundary from './ThresholdBoundary';\nimport { validateThresholdBoundary } from '../../utils/threshold';\n\nconst StyledAddThreshold = styled.div.attrs(() => ({ 'data-test': 'add-threshold-level' }))`\n margin-bottom: 10px;\n`;\n\nconst AddThreshold = ({ thresholds, onAddThreshold = noop }) => {\n const [showInput, setShowInput] = useState(false);\n const [error, setError] = useState(null);\n\n const handleInputToggle = useCallback(() => {\n setShowInput(!showInput);\n }, [showInput]);\n\n const handleBoundaryChange = useCallback(\n value => {\n const validationResult = validateThresholdBoundary(value, thresholds);\n\n if (validationResult.error) {\n setError(validationResult.errorMessage);\n } else {\n onAddThreshold(value);\n }\n },\n [thresholds, onAddThreshold]\n );\n\n const handleValidateBoundary = useCallback(\n value => {\n const validationResult = validateThresholdBoundary(value, thresholds);\n\n if (validationResult.error) {\n setError(validationResult.errorMessage);\n }\n },\n [thresholds]\n );\n\n return (\n <StyledAddThreshold>\n {showInput ? (\n <React.Fragment>\n <ThresholdBoundary\n data-test=\"add-threshold-input\"\n isError={!!error}\n onChange={handleBoundaryChange}\n onRequestClose={handleInputToggle}\n onValidate={handleValidateBoundary}\n />\n <ThresholdError error={error} />\n </React.Fragment>\n ) : (\n <Button\n appearance=\"secondary\"\n onClick={handleInputToggle}\n label={`+ ${_('Add threshold level')}`}\n />\n )}\n </StyledAddThreshold>\n );\n};\n\nAddThreshold.propTypes = {\n onAddThreshold: T.func,\n thresholds: T.array,\n};\n\nexport default AddThreshold;\n","import React from 'react';\nimport T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport ThresholdBoundary from './ThresholdBoundary';\n\nconst StyledThresholdBoundaryInput = styled.div`\n margin-right: 10px;\n width: 100px;\n display: inline-block;\n`;\n\nconst StyledThresholdBoundaryText = styled.div.attrs(() => ({ 'data-test': 'threshold-boundary-label' }))`\n flex-grow: 1;\n flex-direction: row;\n`;\n\nconst ToContentSpan = styled.span`\n line-height: 36px;\n margin-right: 10px;\n color: ${props => (props.isDisabled ? variables.contentColorDisabled : variables.contentColorMuted)};\n`;\n\nconst ToContentValue = styled.span`\n display: inline-block;\n color: ${props => (props.isDisabled ? variables.contentColorDisabled : variables.contentColorMuted)};\n width: 30px;\n text-overflow: ellipsis;\n vertical-align: bottom;\n overflow: hidden;\n white-space: nowrap;\n`;\n\n// Span with extra wrapping to handle aria describedBy attribute passed by tooltip\nconst ToContent = ({ describedBy, isDisabled, to }) => (\n <ToContentValue aria-describedby={describedBy} isDisabled={isDisabled}>\n {to}\n </ToContentValue>\n);\nToContent.propTypes = {\n describedBy: T.any,\n isDisabled: T.bool,\n to: T.number,\n};\n\nconst ToTooltip = ({ isDisabled, to }) => (\n <Tooltip content={`${to}`}>\n <ToContent to={to} isDisabled={isDisabled} />\n </Tooltip>\n);\nToTooltip.propTypes = {\n isDisabled: T.bool,\n to: T.number,\n};\n\n/**\n * To\n */\nconst ThresholdTo = ({ index, to, isRemovable, isEditable, onChange, isDisabled, errorId }) => {\n const isFirst = index === 0;\n const prefix = isRemovable ? `${_('and')} ` : '';\n\n return isEditable ? (\n <StyledThresholdBoundaryText>\n <ToContentSpan isDisabled={isDisabled}>{_('to')}</ToContentSpan>\n <StyledThresholdBoundaryInput>\n <ThresholdBoundary\n data-test=\"threshold-to-level\"\n boundary={to}\n isDisabled={isDisabled}\n isEditable\n errorId={errorId}\n onChange={onChange}\n />\n </StyledThresholdBoundaryInput>\n </StyledThresholdBoundaryText>\n ) : (\n <StyledThresholdBoundaryText>\n {isFirst && <ToContentSpan isDisabled={isDisabled}>{_('and above')}</ToContentSpan>}\n {!isFirst && (\n <React.Fragment>\n <ToContentSpan isDisabled={isDisabled}>{`${prefix}${_('below')}`}</ToContentSpan>\n <ToTooltip isDisabled={isDisabled} to={to} />\n </React.Fragment>\n )}\n </StyledThresholdBoundaryText>\n );\n};\nThresholdTo.propTypes = {\n to: T.number,\n index: T.number,\n isRemovable: T.bool,\n isEditable: T.bool,\n isDisabled: T.bool,\n onChange: T.func,\n errorId: T.string,\n};\n\nexport default ThresholdTo;\n","import React, { useCallback, useMemo } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport ClearIcon from '@splunk/react-icons/Cross';\nimport Button from '@splunk/react-ui/Button';\nimport { createDOMID } from '@splunk/ui-utils/id';\nimport { variables } from '@splunk/themes';\nimport ThresholdError from './ThresholdError';\nimport ThresholdBoundary from './ThresholdBoundary';\nimport ThresholdTo from './ThresholdTo';\n\nconst StyledThresholdLevel = styled.div.attrs(() => ({ 'data-test': 'threshold-level' }))`\n width: 100%;\n position: relative;\n display: flex;\n align-items: flex-end;\n margin-bottom: 5px;\n`;\n\nconst StyledThresholdBoundaryInput = styled.div`\n margin-right: 10px;\n width: 100px;\n display: inline-block;\n`;\n\nconst StyledThresholdValueArea = styled.div`\n display: flex;\n margin-left: auto;\n`;\n\nconst StyledRemoveArea = styled.div`\n margin-left: ${variables.spacingXSmall};\n width: ${variables.spacingXXLarge};\n`;\nconst RemoveAreaButton = styled(Button)`\n color: ${props =>\n props.disabled ? variables.contentColorDisabled : variables.contentColorActive} !important;\n &:hover {\n background-color: ${props => !props.disabled && variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nconst Threshold = ({\n editFrom,\n editTo,\n editValue,\n error,\n from,\n index,\n isDisabled = false,\n isRemovable = false,\n onChange,\n onRemove,\n renderThresholdValueEditor,\n to,\n value,\n}) => {\n const handleFromChange = useCallback(\n newFrom => {\n if (error || newFrom !== from) {\n onChange(index, {\n from: newFrom,\n value,\n to,\n });\n }\n },\n [onChange, from, value, to, index, error]\n );\n\n const handleToChange = useCallback(\n newTo => {\n if (error || newTo !== to) {\n onChange(index, {\n from,\n value,\n to: newTo,\n });\n }\n },\n [onChange, from, value, to, index, error]\n );\n\n const onValueChange = useCallback(\n ({ value: val }) => {\n onChange(index, {\n from,\n value: val,\n to,\n });\n },\n [onChange, index, from, to]\n );\n\n const handleRemove = useCallback(() => onRemove(index), [onRemove, index]);\n\n const errorId = useMemo(() => (error ? createDOMID('threshold-error') : undefined), [error]);\n\n return (\n <React.Fragment>\n <StyledThresholdLevel>\n <StyledThresholdBoundaryInput>\n <ThresholdBoundary\n data-test=\"threshold-from-level\"\n boundary={from}\n isDisabled={isDisabled}\n isEditable={editFrom}\n errorId={errorId}\n onChange={handleFromChange}\n index={index}\n />\n </StyledThresholdBoundaryInput>\n <ThresholdTo\n to={to}\n index={index}\n isRemovable={isRemovable}\n isEditable={editTo}\n isDisabled={isDisabled}\n onChange={handleToChange}\n errorId={errorId}\n />\n <StyledThresholdValueArea>\n {renderThresholdValueEditor({\n value,\n onChange: onValueChange,\n isDisabled: isDisabled || !!error,\n editValue,\n })}\n </StyledThresholdValueArea>\n <StyledRemoveArea>\n {isRemovable && (\n <RemoveAreaButton\n data-test=\"threshold-remove-button\"\n icon={<ClearIcon />}\n appearance=\"subtle\"\n onClick={handleRemove}\n disabled={isDisabled}\n />\n )}\n </StyledRemoveArea>\n </StyledThresholdLevel>\n <ThresholdError error={error} id={errorId} thresholdIndex={index} />\n </React.Fragment>\n );\n};\n\nThreshold.propTypes = {\n editFrom: T.bool,\n editTo: T.bool,\n editValue: T.bool,\n error: T.string,\n from: T.number,\n index: T.number,\n isDisabled: T.bool,\n isRemovable: T.bool,\n onChange: T.func,\n onRemove: T.func,\n renderThresholdValueEditor: T.elementType.isRequired,\n to: T.number,\n value: T.string,\n};\n\nexport default Threshold;\n","import React, { useCallback, useState } from 'react';\nimport T from 'prop-types';\nimport { cloneDeep } from 'lodash';\nimport {\n validateThresholdBoundary,\n validateThresholdUpperBoundary,\n getUpdatedThresholdConfig,\n} from '../../utils/threshold';\nimport Threshold from './Threshold';\n\nconst defaultRanges = [];\n\nconst ThresholdList = ({\n ranges = defaultRanges,\n openRanges = true,\n isDisabled = false,\n onChange,\n renderThresholdValueEditor,\n}) => {\n const [errors, setErrors] = useState({});\n /**\n * Remove a threshold from the list\n */\n const handleRemoveThreshold = useCallback(\n index => {\n const result = cloneDeep(ranges);\n result.splice(index, 1);\n\n onChange(getUpdatedThresholdConfig(result));\n const errs = { ...errors };\n delete errs[index];\n setErrors(errs);\n },\n [errors, ranges, onChange]\n );\n\n /**\n * Update the threshold content at an index\n */\n const handleChangeThreshold = useCallback(\n (index, threshold) => {\n const result = cloneDeep(ranges);\n const errs = { ...errors };\n result.splice(index, 1, threshold);\n delete errs[index];\n\n if (!openRanges && index === 0) {\n const validationResult = validateThresholdUpperBoundary(threshold.to, threshold.from);\n\n if (validationResult.error) {\n errs[index] = validationResult.errorMessage;\n }\n }\n\n /*\n * When dealing with a closed range:\n * changes to range from values will overwrite all the to values of the lower ranges,\n * but the ranges are not sorted and overwritten until after validation\n * When a lower range becomes the top range, the top \"to\" value will not have anything to\n * be overwritten to, so it will remain an incorrect value lower than its associated from\n */\n if (\n !openRanges &&\n index !== 0 &&\n threshold.to < threshold.from &&\n threshold.from > ranges[0].from\n ) {\n // Since this will become the top threshold, we will add a new arbitrary top value like add threshold does\n result[index].to = threshold.from + 10;\n }\n\n // When open, the last threshold does not have an editable boundry, so skip validation\n if (!openRanges || index < ranges.length - 1) {\n const withoutCurrent = cloneDeep(ranges);\n withoutCurrent.splice(index, 1);\n\n const validationResult = validateThresholdBoundary(threshold.from, withoutCurrent);\n\n if (validationResult.error) {\n errs[index] = validationResult.errorMessage;\n }\n }\n\n setErrors(errs);\n\n if (!Object.keys(errs).length) {\n onChange(getUpdatedThresholdConfig(result));\n }\n },\n [errors, ranges, onChange, openRanges]\n );\n\n const hasErrors = !!Object.keys(errors).length;\n\n const canRemove = useCallback(\n index =>\n (!openRanges && ranges.length > 1) ||\n (openRanges && ranges.length > 2 && index !== ranges.length - 1),\n [openRanges, ranges]\n );\n\n return ranges.map((threshold, index) => (\n <Threshold\n key={`threshold-${threshold.from}-${threshold.to}-${threshold.value}`}\n onRemove={handleRemoveThreshold}\n onChange={handleChangeThreshold}\n index={index}\n from={threshold.from}\n to={threshold.to}\n value={threshold.value}\n error={errors[index]}\n editFrom={!openRanges || index !== ranges.length - 1}\n editTo={!openRanges && index === 0}\n editValue={!hasErrors}\n isRemovable={canRemove(index)}\n isDisabled={isDisabled}\n renderThresholdValueEditor={renderThresholdValueEditor}\n />\n ));\n};\n\nThresholdList.propTypes = {\n onChange: T.func.isRequired,\n ranges: T.arrayOf(\n T.shape({\n from: T.number,\n to: T.number,\n value: T.string,\n })\n ),\n isDisabled: T.bool,\n renderThresholdValueEditor: T.elementType.isRequired,\n openRanges: T.bool,\n};\n\nexport default ThresholdList;\n","import React from 'react';\nimport T from 'prop-types';\nimport Color from '@splunk/react-ui/Color';\nimport { isColor } from '@splunk/visualizations-shared/colorUtils';\nimport { defaultThresholdColors } from '../../utils/threshold';\n\nconst ThresholdColor = ({ isDisabled, value, onChange }) => (\n <Color\n disabled={isDisabled}\n value={isColor(value) ? value : 'transparent'}\n onChange={onChange}\n hideInput // prisma only\n palette={defaultThresholdColors}\n data-test=\"threshold-level-value\"\n />\n);\nThresholdColor.propTypes = {\n isDisabled: T.bool,\n value: T.string,\n onChange: T.func.isRequired,\n};\n\nexport default ThresholdColor;\n","import React, { useCallback } from 'react';\nimport T from 'prop-types';\nimport { cloneDeep } from 'lodash';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Switch from '@splunk/react-ui/Switch';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport AddThreshold from './threshold/AddThreshold';\nimport ThresholdList from './threshold/ThresholdList';\nimport { getNewThresholdColor, getUpdatedThresholdConfig } from '../utils/threshold';\nimport ThresholdColor from './threshold/ThresholdColor';\n\nconst Col = styled.div`\n flex-direction: column;\n flex-grow: 1;\n`;\n\nconst ThresholdEditor = ({\n onChange,\n name,\n itemSchema,\n value,\n labelPosition = 'top',\n labelWidth,\n label,\n isDisabled = false,\n isTogglable = true,\n openRanges = true,\n renderThresholdValueEditor = ThresholdColor,\n}) => {\n const isEnabled = Array.isArray(value) && value.length > 0;\n\n const setDefaultThresholds = useCallback(() => {\n onChange(null, name, itemSchema.default);\n }, [itemSchema, name, onChange]);\n\n const clearThresholds = useCallback(() => {\n onChange(null, name, null);\n }, [name, onChange]);\n\n const handleEnableClick = useCallback(() => {\n if (!isEnabled) {\n return setDefaultThresholds();\n }\n return clearThresholds();\n }, [isEnabled, setDefaultThresholds, clearThresholds]);\n\n const handleAddThreshold = useCallback(\n from => {\n const existingThresholds = cloneDeep(value);\n const color = getNewThresholdColor(existingThresholds.map(t => t.value));\n const result = { from, value: color };\n if (!openRanges) {\n // add an arbitrary to value in case this is a new top range\n result.to = from + 10;\n }\n existingThresholds.push(result);\n const sortedThresholds = getUpdatedThresholdConfig(existingThresholds);\n\n onChange(null, name, sortedThresholds);\n },\n [name, value, onChange, openRanges]\n );\n\n const handleThresholdChange = useCallback(\n thresholds => {\n onChange(null, name, thresholds);\n },\n [onChange, name]\n );\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth}>\n <Col data-test={name}>\n {isTogglable && (\n <Switch\n appearance=\"toggle\"\n selected={isEnabled}\n onClick={handleEnableClick}\n disabled={isDisabled}\n role=\"switch\"\n >\n {_('Threshold')}\n </Switch>\n )}\n {isEnabled && (\n <React.Fragment>\n {!isDisabled && (\n <AddThreshold onAddThreshold={handleAddThreshold} thresholds={value} />\n )}\n <ThresholdList\n onChange={handleThresholdChange}\n ranges={value}\n isDisabled={isDisabled}\n openRanges={openRanges}\n renderThresholdValueEditor={renderThresholdValueEditor}\n />\n </React.Fragment>\n )}\n </Col>\n </ControlGroup>\n );\n};\n\nThresholdEditor.propTypes = {\n /**\n * Callback when selecting an item from the menu\n *\n * @param {SyntheticEvent} event The React `SyntheticEvent`\n * @param {string} name The option name\n * @param {string|boolean} value The option value\n */\n onChange: T.func.isRequired,\n /**\n * The option name\n */\n name: T.string.isRequired,\n /**\n * The item JSON schema, it should contain `enum` property. Note this will only be used when `values` prop is undefined\n */\n itemSchema: T.object,\n /**\n * The option value\n */\n value: T.arrayOf(\n T.shape({\n from: T.number,\n to: T.number,\n value: T.string,\n })\n ),\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['left', 'top']),\n labelWidth: T.number,\n /**\n * Make thresholds editable\n */\n isDisabled: T.bool,\n openRanges: T.bool,\n renderThresholdValueEditor: T.elementType,\n isTogglable: T.bool,\n};\n\nexport default ThresholdEditor;\n"],"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","thresholdIndex","React","sprintf","ThresholdBoundary","boundary","isDisabled","isEditable","errorId","onChange","noop","onRequestClose","onValidate","index","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","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":""}
|
|
1
|
+
{"version":3,"file":"ThresholdEditor.js","mappings":";;;;y1BAAA,mBAEA,WACA,YACA,UACA,aACA,UACA,aAEA,aACA,aAiBMA,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,QAC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/C,IAAAA,KAAO8I,WAIjB2B,KAAMzK,IAAAA,OAAS8I,WAIf4B,WAAY1K,IAAAA,OAIZiC,MAAOjC,IAAAA,QACHA,IAAAA,MAAQ,CACJ8E,KAAM9E,IAAAA,OACN+E,GAAI/E,IAAAA,OACJiC,MAAOjC,IAAAA,UAMf5B,MAAO4B,IAAAA,OAAS8I,WAIhB/J,cAAeiB,IAAAA,MAAQ,CAAC,OAAQ,QAChChB,WAAYgB,IAAAA,OAIZ4C,WAAY5C,IAAAA,KACZkJ,WAAYlJ,IAAAA,KACZoI,2BAA4BpI,IAAAA,YAC5B2K,YAAa3K,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/format\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/id\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/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 } from 'react';\nimport type { ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport type { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport Button from '@splunk/react-ui/Button';\nimport SUIControlGroup from '@splunk/react-ui/ControlGroup';\nimport type { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced = false,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nexport default AdvancedControlGroup;\n","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/format\");","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';\nimport { sprintf } from '@splunk/ui-utils/format';\n\nconst StyledThresholdError = styled.div.attrs(() => ({ 'data-test': 'threshold-error' }))`\n color: ${variables.contentColorNegative};\n padding-top: 5px;\n font-size: 12px;\n display: block;\n`;\n\nconst ThresholdError = ({ error, id, thresholdIndex }) => {\n if (error) {\n return (\n <StyledThresholdError id={id}>\n {typeof thresholdIndex === 'number'\n ? sprintf(_('Error for threshold %(thresholdIndex)d : %(error)s'), {\n thresholdIndex,\n error,\n })\n : sprintf(_('Error: %(error)s'), {\n error,\n })}\n </StyledThresholdError>\n );\n }\n\n return null;\n};\n\nThresholdError.propTypes = {\n id: T.string,\n error: T.string,\n thresholdIndex: T.number,\n};\n\nexport default ThresholdError;\n","import React, { useState, useCallback, useEffect } from 'react';\nimport T from 'prop-types';\nimport { noop } from 'lodash';\nimport Number from '@splunk/react-ui/Number';\nimport { sprintf } from '@splunk/ui-utils/format';\nimport { _ } from '@splunk/ui-utils/i18n';\n\nconst ThresholdBoundary = ({\n 'data-test': dataTest = 'threshold-boundary-input',\n boundary,\n isDisabled = false,\n isEditable = true,\n errorId,\n onChange = noop,\n onRequestClose = noop,\n onValidate = noop,\n index,\n}) => {\n const [boundaryValue, setBoundaryValue] = useState(boundary);\n\n useEffect(() => {\n setBoundaryValue(boundary);\n }, [boundary]);\n\n const handleFromChange = useCallback(\n (e, { value }) => {\n setBoundaryValue(value);\n onValidate(value);\n },\n [onValidate]\n );\n\n const handleKeyDown = useCallback(\n e => {\n if (e.key === 'Enter') {\n onChange(boundaryValue);\n }\n if (e.key === 'Escape') {\n onRequestClose();\n }\n },\n [boundaryValue, onChange, onRequestClose]\n );\n\n const handleBlur = useCallback(() => {\n onChange(boundaryValue);\n }, [onChange, boundaryValue]);\n\n const label =\n typeof index === 'number' ? sprintf(_('Threshold number %(index)d'), { index }) : _('Threshold');\n\n return isEditable ? (\n <Number\n aria-label={\n boundaryValue\n ? sprintf(_('%(label)s, value %(boundaryValue)d'), { label, boundaryValue })\n : sprintf(_('%(label)s, no value'), { label })\n }\n inline\n hideStepButtons\n disabled={isDisabled}\n value={boundaryValue || boundaryValue === 0 ? boundaryValue : null}\n onChange={handleFromChange}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n error={!!errorId}\n data-test={dataTest}\n describedBy={errorId}\n />\n ) : null;\n};\nThresholdBoundary.propTypes = {\n 'data-test': T.string,\n boundary: T.number,\n isDisabled: T.bool,\n isEditable: T.bool,\n errorId: T.string,\n onChange: T.func,\n onRequestClose: T.func,\n onValidate: T.func,\n index: T.number,\n};\n\nexport default ThresholdBoundary;\n","import { difference, get, isNaN, omit, uniqBy } from 'lodash';\n\nimport { _ } from '@splunk/ui-utils/i18n';\n\nexport const defaultThresholds = [\n {\n from: 100,\n value: '#cb3b43',\n },\n {\n from: 70,\n to: 100,\n value: '#ff7152',\n },\n {\n from: 50,\n to: 70,\n value: '#fc9850',\n },\n {\n from: 30,\n to: 50,\n value: '#f4df7a',\n },\n {\n from: 10,\n to: 30,\n value: '#4beba8',\n },\n {\n to: 10,\n value: '#5fbcff',\n },\n];\n\nexport const defaultThresholdColors = [\n '#dc4e41',\n '#f1813f',\n '#f8be34',\n '#53a051',\n '#0877a6',\n '#006d9c',\n '#ec9960',\n '#af575a',\n '#62b3b2',\n '#4fa484',\n '#f8be44',\n '#5a4575',\n '#708794',\n '#294e70',\n '#b6c75a',\n];\n\n/**\n * returns thresholds for a viz definition\n *\n * @param {object} viz definition\n * @return {array} the thresholds configuration for the thresholds editor\n */\nexport function getThresholdsForVizDefinition(vizDefinition, thresholdField) {\n return get(vizDefinition, `encoding.${thresholdField}.format.ranges`, []);\n}\n\n/**\n * Translates a thresholds configuration back into a viz definition.\n * This fn checks whether encoding exists and updates / adds an encoding configuration\n *\n * @param {object} viz definition\n * @param {array) thresholds configuration in form [{ from: <boundary>, to: <boundary>, value: <threshold value> }]\n * @param {string} the field where threshold should be applied to\n * @param {string} the default encoding field value to be used if no encoding was present\n * @return {object} an updated viz defintion with thresholds configuration applied\n */\nexport function getUpdatedVizConfigForThresholds(\n vizDefinition,\n thresholds,\n thresholdField,\n defaultEncodingFieldValue\n) {\n const formatConfig = {\n type: 'rangevalue',\n ranges: thresholds,\n };\n // @TODO(pwied):\n // future:\n // - viz data contract should expose which encoding fields are thresholdable\n // - threshold editor needs to know about the encoding field and pass it to this fn\n // - a visualization definition should always come with encoding (contract parsing needs to happen in dashboards)\n\n const getOverloadedThresholdFieldValue = tf => {\n if (typeof tf === 'object') {\n return tf;\n }\n if (typeof tf === 'string') {\n return { field: tf };\n }\n return { field: defaultEncodingFieldValue };\n };\n\n const encoding = vizDefinition?.encoding;\n const thresholdFieldValue = getOverloadedThresholdFieldValue(get(encoding, [thresholdField]));\n\n return {\n ...vizDefinition,\n encoding: {\n ...encoding,\n [thresholdField]: {\n ...thresholdFieldValue,\n format: formatConfig,\n },\n },\n };\n}\n\n/**\n * returns a viz definition with default thresholds set\n *\n * @param {object} viz definition\n * @param {string} the encoding field where threshold should be used\n * @param {string} the default encoding field value for the threshold field (ie primary[0])\n * @return {object} an updated viz defintion with default thresholds configuration applied\n */\nexport function getVizConfigWithDefaultThresholds(vizDefinition, thresholdField, defaultEncodingFieldValue) {\n return getUpdatedVizConfigForThresholds(\n vizDefinition,\n defaultThresholds,\n thresholdField,\n defaultEncodingFieldValue\n );\n}\n\n/**\n * returns a viz definition without threshold options\n *\n * @param {object} viz definition\n * @param {string} the encoding field where threshold is applied\n * @return {object} an updated viz defintion without threshold options\n */\nexport function getVizConfigWithoutThresholds(vizDefinition, thresholdField) {\n return omit(vizDefinition, `encoding.${thresholdField}`);\n}\n\n/**\n * returns a new threshold color\n *\n * @param {array} an array of threshold colors that should not be picked\n * @return {string} a color from default threshold colors that is not in the passed parameter\n * or #444000 if all colors from default colors are already used\n */\nexport function getNewThresholdColor(thresholdColors = []) {\n const diff = difference(defaultThresholdColors, thresholdColors);\n if (diff.length > 0) {\n return diff[0];\n }\n return '#444000';\n}\n\n/**\n * getUpdatedThresholdConfig calculates new threshold boundaries given an array\n * of outdated threshold configurations.\n * - the first element will always be an open upper boundary\n * - the last element will always be an open lower boundary\n * - all elements inbetween will have well defined, closed boundaries\n *\n * @param {array} array of thresholds\n * @return {array} an array of thresholds with updated boundaries\n */\nexport function getUpdatedThresholdConfig(thresholds = []) {\n if (thresholds.length < 2) {\n // a threshold config needs at least 2 levels\n // eslint-disable-next-line no-console\n console.warn('Invalid threshold configuration: at least 2 thresholds required');\n return thresholds;\n }\n // convert from and to values to numbers if they are available\n const updatedThresholds = thresholds.map(threshold => {\n const updatedThreshold = { ...threshold };\n if (threshold.from) {\n updatedThreshold.from = +threshold.from;\n }\n if (threshold.to) {\n updatedThreshold.to = +threshold.to;\n }\n return updatedThreshold;\n });\n const openLowerBounds = updatedThresholds.filter(t => t.from === undefined);\n if (openLowerBounds.length > 1) {\n // eslint-disable-next-line no-console\n console.warn('Invalid threshold configuration: multiple open lower boundaries');\n }\n // in order to determine the threshold order and ranges we can ignore the open lower bound\n const otherThresholds = updatedThresholds.filter(t => t.from !== undefined);\n if (otherThresholds.length !== uniqBy(otherThresholds, 'from').length) {\n // eslint-disable-next-line no-console\n console.warn('Invalid threshold configuration: duplicate from values');\n }\n const sortedOtherThresholds = otherThresholds.sort((a, b) => +b.from - +a.from);\n\n // This range set has open boundaries\n if (openLowerBounds.length) {\n const openLowerBound = openLowerBounds[0];\n // if the lowest from-value is not the open lower bound's to-value, update the open lower bound\n if (openLowerBound.to !== sortedOtherThresholds[sortedOtherThresholds.length - 1].from) {\n openLowerBound.to = sortedOtherThresholds[sortedOtherThresholds.length - 1].from;\n }\n // calculate the threshold ranges\n sortedOtherThresholds.forEach((el, index) => {\n const threshold = { ...el };\n if (index > 0) {\n threshold.to = sortedOtherThresholds[index - 1].from;\n } else {\n // the open uper bound is on index=0, it should not have a to value\n delete threshold.to;\n }\n sortedOtherThresholds[index] = threshold;\n });\n return [...sortedOtherThresholds, openLowerBound];\n }\n\n // This rangeset is closed ranges\n // calculate the threshold ranges\n sortedOtherThresholds.forEach((el, index) => {\n const threshold = { ...el };\n if (index > 0) {\n threshold.to = sortedOtherThresholds[index - 1].from;\n }\n sortedOtherThresholds[index] = threshold;\n });\n\n return sortedOtherThresholds;\n}\n\n/**\n * validate whether a threshold boundary update is valid\n *\n * @param {string} thresholdValueStr\n * @param {array} thresholds\n * @return {object} validation result containing error flag and an error message\n */\nexport function validateThresholdBoundary(thresholdValueStr = '', thresholds = []) {\n const thresholdValue = parseFloat(thresholdValueStr);\n if (isNaN(thresholdValue) || isNaN(+thresholdValueStr)) {\n return {\n error: true,\n errorMessage: _('Not a valid threshold. Must be a number'),\n };\n }\n if (thresholds.filter(t => t.from === thresholdValue).length > 0) {\n return {\n error: true,\n errorMessage: _('Value already exists'),\n };\n }\n return {\n error: false,\n errorMessage: null,\n };\n}\n\n/**\n * validate whether a threshold boundary update is valid\n *\n * @param {String|Number} thresholdValueStr\n * @param {String|Number} fromValueStr\n * @return {Object} validation result containing error flag and an error message\n */\nexport function validateThresholdUpperBoundary(thresholdValueStr = '', fromValueStr = '') {\n const thresholdValue = parseFloat(thresholdValueStr);\n const fromValue = parseFloat(fromValueStr);\n\n if (isNaN(thresholdValue) || isNaN(+thresholdValueStr) || isNaN(fromValue) || isNaN(+fromValueStr)) {\n return {\n error: true,\n errorMessage: _('Not a valid threshold. Must be a number'),\n };\n }\n if (thresholdValue < fromValue) {\n return {\n error: true,\n errorMessage: _('Upper boundary must exceed lower boundary'),\n };\n }\n return {\n error: false,\n errorMessage: null,\n };\n}\n","import React, { useState, useCallback } from 'react';\nimport T from 'prop-types';\nimport { noop } from 'lodash';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport Button from '@splunk/react-ui/Button';\nimport ThresholdError from './ThresholdError';\nimport ThresholdBoundary from './ThresholdBoundary';\nimport { validateThresholdBoundary } from '../../utils/threshold';\n\nconst StyledAddThreshold = styled.div.attrs(() => ({ 'data-test': 'add-threshold-level' }))`\n margin-bottom: 10px;\n`;\n\nconst AddThreshold = ({ thresholds, onAddThreshold = noop }) => {\n const [showInput, setShowInput] = useState(false);\n const [error, setError] = useState(null);\n\n const handleInputToggle = useCallback(() => {\n setShowInput(!showInput);\n }, [showInput]);\n\n const handleBoundaryChange = useCallback(\n value => {\n const validationResult = validateThresholdBoundary(value, thresholds);\n\n if (validationResult.error) {\n setError(validationResult.errorMessage);\n } else {\n onAddThreshold(value);\n }\n },\n [thresholds, onAddThreshold]\n );\n\n const handleValidateBoundary = useCallback(\n value => {\n const validationResult = validateThresholdBoundary(value, thresholds);\n\n if (validationResult.error) {\n setError(validationResult.errorMessage);\n }\n },\n [thresholds]\n );\n\n return (\n <StyledAddThreshold>\n {showInput ? (\n <React.Fragment>\n <ThresholdBoundary\n data-test=\"add-threshold-input\"\n isError={!!error}\n onChange={handleBoundaryChange}\n onRequestClose={handleInputToggle}\n onValidate={handleValidateBoundary}\n />\n <ThresholdError error={error} />\n </React.Fragment>\n ) : (\n <Button\n appearance=\"secondary\"\n onClick={handleInputToggle}\n label={`+ ${_('Add threshold level')}`}\n />\n )}\n </StyledAddThreshold>\n );\n};\n\nAddThreshold.propTypes = {\n onAddThreshold: T.func,\n thresholds: T.array,\n};\n\nexport default AddThreshold;\n","import React from 'react';\nimport T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport ThresholdBoundary from './ThresholdBoundary';\n\nconst StyledThresholdBoundaryInput = styled.div`\n margin-right: 10px;\n width: 100px;\n display: inline-block;\n`;\n\nconst StyledThresholdBoundaryText = styled.div.attrs(() => ({ 'data-test': 'threshold-boundary-label' }))`\n flex-grow: 1;\n flex-direction: row;\n`;\n\nconst ToContentSpan = styled.span`\n line-height: 36px;\n margin-right: 10px;\n color: ${props => (props.isDisabled ? variables.contentColorDisabled : variables.contentColorMuted)};\n`;\n\nconst ToContentValue = styled.span`\n display: inline-block;\n color: ${props => (props.isDisabled ? variables.contentColorDisabled : variables.contentColorMuted)};\n width: 30px;\n text-overflow: ellipsis;\n vertical-align: bottom;\n overflow: hidden;\n white-space: nowrap;\n`;\n\n// Span with extra wrapping to handle aria describedBy attribute passed by tooltip\nconst ToContent = ({ describedBy, isDisabled, to }) => (\n <ToContentValue aria-describedby={describedBy} isDisabled={isDisabled}>\n {to}\n </ToContentValue>\n);\nToContent.propTypes = {\n describedBy: T.any,\n isDisabled: T.bool,\n to: T.number,\n};\n\nconst ToTooltip = ({ isDisabled, to }) => (\n <Tooltip content={`${to}`}>\n <ToContent to={to} isDisabled={isDisabled} />\n </Tooltip>\n);\nToTooltip.propTypes = {\n isDisabled: T.bool,\n to: T.number,\n};\n\n/**\n * To\n */\nconst ThresholdTo = ({ index, to, isRemovable, isEditable, onChange, isDisabled, errorId }) => {\n const isFirst = index === 0;\n const prefix = isRemovable ? `${_('and')} ` : '';\n\n return isEditable ? (\n <StyledThresholdBoundaryText>\n <ToContentSpan isDisabled={isDisabled}>{_('to')}</ToContentSpan>\n <StyledThresholdBoundaryInput>\n <ThresholdBoundary\n data-test=\"threshold-to-level\"\n boundary={to}\n isDisabled={isDisabled}\n isEditable\n errorId={errorId}\n onChange={onChange}\n />\n </StyledThresholdBoundaryInput>\n </StyledThresholdBoundaryText>\n ) : (\n <StyledThresholdBoundaryText>\n {isFirst && <ToContentSpan isDisabled={isDisabled}>{_('and above')}</ToContentSpan>}\n {!isFirst && (\n <React.Fragment>\n <ToContentSpan isDisabled={isDisabled}>{`${prefix}${_('below')}`}</ToContentSpan>\n <ToTooltip isDisabled={isDisabled} to={to} />\n </React.Fragment>\n )}\n </StyledThresholdBoundaryText>\n );\n};\nThresholdTo.propTypes = {\n to: T.number,\n index: T.number,\n isRemovable: T.bool,\n isEditable: T.bool,\n isDisabled: T.bool,\n onChange: T.func,\n errorId: T.string,\n};\n\nexport default ThresholdTo;\n","import React, { useCallback, useMemo } from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport ClearIcon from '@splunk/react-icons/Cross';\nimport Button from '@splunk/react-ui/Button';\nimport { createDOMID } from '@splunk/ui-utils/id';\nimport { variables } from '@splunk/themes';\nimport ThresholdError from './ThresholdError';\nimport ThresholdBoundary from './ThresholdBoundary';\nimport ThresholdTo from './ThresholdTo';\n\nconst StyledThresholdLevel = styled.div.attrs(() => ({ 'data-test': 'threshold-level' }))`\n width: 100%;\n position: relative;\n display: flex;\n align-items: flex-end;\n margin-bottom: 5px;\n`;\n\nconst StyledThresholdBoundaryInput = styled.div`\n margin-right: 10px;\n width: 100px;\n display: inline-block;\n`;\n\nconst StyledThresholdValueArea = styled.div`\n display: flex;\n margin-left: auto;\n`;\n\nconst StyledRemoveArea = styled.div`\n margin-left: ${variables.spacingXSmall};\n width: ${variables.spacingXXLarge};\n`;\nconst RemoveAreaButton = styled(Button)`\n color: ${props =>\n props.disabled ? variables.contentColorDisabled : variables.contentColorActive} !important;\n &:hover {\n background-color: ${props => !props.disabled && variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nconst Threshold = ({\n editFrom,\n editTo,\n editValue,\n error,\n from,\n index,\n isDisabled = false,\n isRemovable = false,\n onChange,\n onRemove,\n renderThresholdValueEditor,\n to,\n value,\n}) => {\n const handleFromChange = useCallback(\n newFrom => {\n if (error || newFrom !== from) {\n onChange(index, {\n from: newFrom,\n value,\n to,\n });\n }\n },\n [onChange, from, value, to, index, error]\n );\n\n const handleToChange = useCallback(\n newTo => {\n if (error || newTo !== to) {\n onChange(index, {\n from,\n value,\n to: newTo,\n });\n }\n },\n [onChange, from, value, to, index, error]\n );\n\n const onValueChange = useCallback(\n ({ value: val }) => {\n onChange(index, {\n from,\n value: val,\n to,\n });\n },\n [onChange, index, from, to]\n );\n\n const handleRemove = useCallback(() => onRemove(index), [onRemove, index]);\n\n const errorId = useMemo(() => (error ? createDOMID('threshold-error') : undefined), [error]);\n\n return (\n <React.Fragment>\n <StyledThresholdLevel>\n <StyledThresholdBoundaryInput>\n <ThresholdBoundary\n data-test=\"threshold-from-level\"\n boundary={from}\n isDisabled={isDisabled}\n isEditable={editFrom}\n errorId={errorId}\n onChange={handleFromChange}\n index={index}\n />\n </StyledThresholdBoundaryInput>\n <ThresholdTo\n to={to}\n index={index}\n isRemovable={isRemovable}\n isEditable={editTo}\n isDisabled={isDisabled}\n onChange={handleToChange}\n errorId={errorId}\n />\n <StyledThresholdValueArea>\n {renderThresholdValueEditor({\n value,\n onChange: onValueChange,\n isDisabled: isDisabled || !!error,\n editValue,\n })}\n </StyledThresholdValueArea>\n <StyledRemoveArea>\n {isRemovable && (\n <RemoveAreaButton\n data-test=\"threshold-remove-button\"\n icon={<ClearIcon />}\n appearance=\"subtle\"\n onClick={handleRemove}\n disabled={isDisabled}\n />\n )}\n </StyledRemoveArea>\n </StyledThresholdLevel>\n <ThresholdError error={error} id={errorId} thresholdIndex={index} />\n </React.Fragment>\n );\n};\n\nThreshold.propTypes = {\n editFrom: T.bool,\n editTo: T.bool,\n editValue: T.bool,\n error: T.string,\n from: T.number,\n index: T.number,\n isDisabled: T.bool,\n isRemovable: T.bool,\n onChange: T.func,\n onRemove: T.func,\n renderThresholdValueEditor: T.elementType.isRequired,\n to: T.number,\n value: T.string,\n};\n\nexport default Threshold;\n","import React, { useCallback, useState } from 'react';\nimport T from 'prop-types';\nimport { cloneDeep } from 'lodash';\nimport {\n validateThresholdBoundary,\n validateThresholdUpperBoundary,\n getUpdatedThresholdConfig,\n} from '../../utils/threshold';\nimport Threshold from './Threshold';\n\nconst defaultRanges = [];\n\nconst ThresholdList = ({\n ranges = defaultRanges,\n openRanges = true,\n isDisabled = false,\n onChange,\n renderThresholdValueEditor,\n}) => {\n const [errors, setErrors] = useState({});\n /**\n * Remove a threshold from the list\n */\n const handleRemoveThreshold = useCallback(\n index => {\n const result = cloneDeep(ranges);\n result.splice(index, 1);\n\n onChange(getUpdatedThresholdConfig(result));\n const errs = { ...errors };\n delete errs[index];\n setErrors(errs);\n },\n [errors, ranges, onChange]\n );\n\n /**\n * Update the threshold content at an index\n */\n const handleChangeThreshold = useCallback(\n (index, threshold) => {\n const result = cloneDeep(ranges);\n const errs = { ...errors };\n result.splice(index, 1, threshold);\n delete errs[index];\n\n if (!openRanges && index === 0) {\n const validationResult = validateThresholdUpperBoundary(threshold.to, threshold.from);\n\n if (validationResult.error) {\n errs[index] = validationResult.errorMessage;\n }\n }\n\n /*\n * When dealing with a closed range:\n * changes to range from values will overwrite all the to values of the lower ranges,\n * but the ranges are not sorted and overwritten until after validation\n * When a lower range becomes the top range, the top \"to\" value will not have anything to\n * be overwritten to, so it will remain an incorrect value lower than its associated from\n */\n if (\n !openRanges &&\n index !== 0 &&\n threshold.to < threshold.from &&\n threshold.from > ranges[0].from\n ) {\n // Since this will become the top threshold, we will add a new arbitrary top value like add threshold does\n result[index].to = threshold.from + 10;\n }\n\n // When open, the last threshold does not have an editable boundry, so skip validation\n if (!openRanges || index < ranges.length - 1) {\n const withoutCurrent = cloneDeep(ranges);\n withoutCurrent.splice(index, 1);\n\n const validationResult = validateThresholdBoundary(threshold.from, withoutCurrent);\n\n if (validationResult.error) {\n errs[index] = validationResult.errorMessage;\n }\n }\n\n setErrors(errs);\n\n if (!Object.keys(errs).length) {\n onChange(getUpdatedThresholdConfig(result));\n }\n },\n [errors, ranges, onChange, openRanges]\n );\n\n const hasErrors = !!Object.keys(errors).length;\n\n const canRemove = useCallback(\n index =>\n (!openRanges && ranges.length > 1) ||\n (openRanges && ranges.length > 2 && index !== ranges.length - 1),\n [openRanges, ranges]\n );\n\n return ranges.map((threshold, index) => (\n <Threshold\n key={`threshold-${threshold.from}-${threshold.to}-${threshold.value}`}\n onRemove={handleRemoveThreshold}\n onChange={handleChangeThreshold}\n index={index}\n from={threshold.from}\n to={threshold.to}\n value={threshold.value}\n error={errors[index]}\n editFrom={!openRanges || index !== ranges.length - 1}\n editTo={!openRanges && index === 0}\n editValue={!hasErrors}\n isRemovable={canRemove(index)}\n isDisabled={isDisabled}\n renderThresholdValueEditor={renderThresholdValueEditor}\n />\n ));\n};\n\nThresholdList.propTypes = {\n onChange: T.func.isRequired,\n ranges: T.arrayOf(\n T.shape({\n from: T.number,\n to: T.number,\n value: T.string,\n })\n ),\n isDisabled: T.bool,\n renderThresholdValueEditor: T.elementType.isRequired,\n openRanges: T.bool,\n};\n\nexport default ThresholdList;\n","import React from 'react';\nimport T from 'prop-types';\nimport Color from '@splunk/react-ui/Color';\nimport { isColor } from '@splunk/visualizations-shared/colorUtils';\nimport { defaultThresholdColors } from '../../utils/threshold';\n\nconst ThresholdColor = ({ isDisabled, value, onChange }) => (\n <Color\n disabled={isDisabled}\n value={isColor(value) ? value : 'transparent'}\n onChange={onChange}\n hideInput // prisma only\n palette={defaultThresholdColors}\n data-test=\"threshold-level-value\"\n />\n);\nThresholdColor.propTypes = {\n isDisabled: T.bool,\n value: T.string,\n onChange: T.func.isRequired,\n};\n\nexport default ThresholdColor;\n","import React, { useCallback } from 'react';\nimport T from 'prop-types';\nimport { cloneDeep } from 'lodash';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Switch from '@splunk/react-ui/Switch';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport AddThreshold from './threshold/AddThreshold';\nimport ThresholdList from './threshold/ThresholdList';\nimport { getNewThresholdColor, getUpdatedThresholdConfig } from '../utils/threshold';\nimport ThresholdColor from './threshold/ThresholdColor';\n\nconst Col = styled.div`\n flex-direction: column;\n flex-grow: 1;\n`;\n\nconst ThresholdEditor = ({\n onChange,\n name,\n itemSchema,\n value,\n labelPosition = 'top',\n labelWidth,\n label,\n isDisabled = false,\n isTogglable = true,\n openRanges = true,\n renderThresholdValueEditor = ThresholdColor,\n}) => {\n const isEnabled = Array.isArray(value) && value.length > 0;\n\n const setDefaultThresholds = useCallback(() => {\n onChange(null, name, itemSchema.default);\n }, [itemSchema, name, onChange]);\n\n const clearThresholds = useCallback(() => {\n onChange(null, name, null);\n }, [name, onChange]);\n\n const handleEnableClick = useCallback(() => {\n if (!isEnabled) {\n return setDefaultThresholds();\n }\n return clearThresholds();\n }, [isEnabled, setDefaultThresholds, clearThresholds]);\n\n const handleAddThreshold = useCallback(\n from => {\n const existingThresholds = cloneDeep(value);\n const color = getNewThresholdColor(existingThresholds.map(t => t.value));\n const result = { from, value: color };\n if (!openRanges) {\n // add an arbitrary to value in case this is a new top range\n result.to = from + 10;\n }\n existingThresholds.push(result);\n const sortedThresholds = getUpdatedThresholdConfig(existingThresholds);\n\n onChange(null, name, sortedThresholds);\n },\n [name, value, onChange, openRanges]\n );\n\n const handleThresholdChange = useCallback(\n thresholds => {\n onChange(null, name, thresholds);\n },\n [onChange, name]\n );\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth}>\n <Col data-test={name}>\n {isTogglable && (\n <Switch\n appearance=\"toggle\"\n selected={isEnabled}\n onClick={handleEnableClick}\n disabled={isDisabled}\n role=\"switch\"\n >\n {_('Threshold')}\n </Switch>\n )}\n {isEnabled && (\n <React.Fragment>\n {!isDisabled && (\n <AddThreshold onAddThreshold={handleAddThreshold} thresholds={value} />\n )}\n <ThresholdList\n onChange={handleThresholdChange}\n ranges={value}\n isDisabled={isDisabled}\n openRanges={openRanges}\n renderThresholdValueEditor={renderThresholdValueEditor}\n />\n </React.Fragment>\n )}\n </Col>\n </ControlGroup>\n );\n};\n\nThresholdEditor.propTypes = {\n /**\n * Callback when selecting an item from the menu\n *\n * @param {SyntheticEvent} event The React `SyntheticEvent`\n * @param {string} name The option name\n * @param {string|boolean} value The option value\n */\n onChange: T.func.isRequired,\n /**\n * The option name\n */\n name: T.string.isRequired,\n /**\n * The item JSON schema, it should contain `enum` property. Note this will only be used when `values` prop is undefined\n */\n itemSchema: T.object,\n /**\n * The option value\n */\n value: T.arrayOf(\n T.shape({\n from: T.number,\n to: T.number,\n value: T.string,\n })\n ),\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['left', 'top']),\n labelWidth: T.number,\n /**\n * Make thresholds editable\n */\n isDisabled: T.bool,\n openRanges: T.bool,\n renderThresholdValueEditor: T.elementType,\n isTogglable: T.bool,\n};\n\nexport default ThresholdEditor;\n"],"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","thresholdIndex","React","sprintf","ThresholdBoundary","boundary","isDisabled","isEditable","errorId","onChange","noop","onRequestClose","onValidate","index","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","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":""}
|