@splunk/dynamic-editors 0.43.0 → 0.43.1
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 +11 -0
- package/DynamicEditor.js +4 -4
- package/DynamicEditor.js.map +1 -1
- package/containers/EditorItem.js +4 -4
- package/containers/EditorItem.js.map +1 -1
- package/containers/EditorLayout.js +4 -4
- package/containers/EditorLayout.js.map +1 -1
- package/containers/EditorLayoutItem.js +4 -4
- package/containers/EditorLayoutItem.js.map +1 -1
- package/editors/DynamicColorEditor.js +3 -3
- package/editors/DynamicColorEditor.js.map +1 -1
- package/editors/DynamicColorEditorWithPrecedence.js +3 -3
- package/editors/DynamicColorEditorWithPrecedence.js.map +1 -1
- package/editors/NetworkGraphDynamicColorEditor.js +3 -3
- package/editors/NetworkGraphDynamicColorEditor.js.map +1 -1
- package/editors/TableColumnFormatterEditor.js +4 -4
- package/editors/TableColumnFormatterEditor.js.map +1 -1
- package/editors/TableDynamicColorEditor.js +3 -3
- package/editors/TableDynamicColorEditor.js.map +1 -1
- package/editors/ThresholdEditor.js +1 -1
- package/editors/ThresholdEditor.js.map +1 -1
- package/package.json +2 -2
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
&:hover {
|
|
81
81
|
background-color: ${e=>!e.disabled&&N.variables.interactiveColorOverlayDrag} !important;
|
|
82
82
|
}
|
|
83
|
-
`,te=({editFrom:r,editTo:o,editValue:n,error:l,from:a,index:s,isDisabled:i=!1,isRemovable:d=!1,onChange:u,onRemove:c,renderThresholdValueEditor:b,to:p,value:h})=>{const f=(0,e.useCallback)((e=>{(l||e!==a)&&u(s,{from:e,value:h,to:p})}),[u,a,h,p,s,l]),m=(0,e.useCallback)((e=>{(l||e!==p)&&u(s,{from:a,value:h,to:e})}),[u,a,h,p,s,l]),g=(0,e.useCallback)((({value:e})=>{u(s,{from:a,value:e,to:p})}),[u,s,a,p]),v=(0,e.useCallback)((()=>c(s)),[c,s]),y=(0,e.useMemo)((()=>l?(0,I.createDOMID)("threshold-error"):void 0),[l]);return t().createElement(t().Fragment,null,t().createElement(J,null,t().createElement(Q,null,t().createElement(D,{"data-test":"threshold-from-level",boundary:a,isDisabled:i,isEditable:r,errorId:y,onChange:f,index:s})),t().createElement(K,{to:p,index:s,isRemovable:d,isEditable:o,isDisabled:i,onChange:m,errorId:y}),t().createElement(Y,null,b({value:h,onChange:g,isDisabled:i||!!l,editValue:n})),t().createElement(Z,null,d&&t().createElement(ee,{"data-test":"threshold-remove-button",icon:t().createElement(A(),null),appearance:"subtle",onClick:v,disabled:i}))),t().createElement(E,{error:l,id:y,thresholdIndex:s}))};te.propTypes={editFrom:l().bool,editTo:l().bool,editValue:l().bool,error:l().string,from:l().number,index:l().number,isDisabled:l().bool,isRemovable:l().bool,onChange:l().func,onRemove:l().func,renderThresholdValueEditor:l().elementType.isRequired,to:l().number,value:l().string};const re=te;function oe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function ne(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(r),!0).forEach((function(t){j()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const le=[],ae=({ranges:r=le,openRanges:o=!0,isDisabled:n=!1,onChange:l,renderThresholdValueEditor:s})=>{const[i,u]=(0,e.useState)({}),c=(0,e.useCallback)((e=>{const t=(0,a.cloneDeep)(r);t.splice(e,1),l(P(t));const o=ne({},i);delete o[e],u(o)}),[i,r,l]),b=(0,e.useCallback)(((e,t)=>{const n=(0,a.cloneDeep)(r),s=ne({},i);if(n.splice(e,1,t),delete s[e],!o&&0===e){const r=function(e="",t=""){const r=parseFloat(e),o=parseFloat(t);return(0,a.isNaN)(r)||(0,a.isNaN)(+e)||(0,a.isNaN)(o)||(0,a.isNaN)(+t)?{error:!0,errorMessage:(0,d._)("Not a valid threshold. Must be a number")}:r<o?{error:!0,errorMessage:(0,d._)("Upper boundary must exceed lower boundary")}:{error:!1,errorMessage:null}}(t.to,t.from);r.error&&(s[e]=r.errorMessage)}if(!o&&0!==e&&t.to<t.from&&t.from>r[0].from&&(n[e].to=t.from+10),!o||e<r.length-1){const o=(0,a.cloneDeep)(r);o.splice(e,1);const n=M(t.from,o);n.error&&(s[e]=n.errorMessage)}u(s),Object.keys(s).length||l(P(n))}),[i,r,l,o]),p=!!Object.keys(i).length,h=(0,e.useCallback)((e=>!o&&r.length>1||o&&r.length>2&&e!==r.length-1),[o,r]);return r.map(((e,l)=>t().createElement(re,{key:`threshold-${e.from}-${e.to}-${e.value}`,onRemove:c,onChange:b,index:l,from:e.from,to:e.to,value:e.value,error:i[l],editFrom:!o||l!==r.length-1,editTo:!o&&0===l,editValue:!p,isRemovable:h(l),isDisabled:n,renderThresholdValueEditor:s})))};ae.propTypes={onChange:l().func.isRequired,ranges:l().arrayOf(l().shape({from:l().number,to:l().number,value:l().string})),isDisabled:l().bool,renderThresholdValueEditor:l().elementType.isRequired,openRanges:l().bool};const se=ae;var ie=r(7408),de=r.n(ie),ue=r(3283);const ce=({isDisabled:e,value:r,onChange:o})=>t().createElement(de(),{disabled:e,value:(0,ue.isColor)(r)?r:"transparent",onChange:
|
|
83
|
+
`,te=({editFrom:r,editTo:o,editValue:n,error:l,from:a,index:s,isDisabled:i=!1,isRemovable:d=!1,onChange:u,onRemove:c,renderThresholdValueEditor:b,to:p,value:h})=>{const f=(0,e.useCallback)((e=>{(l||e!==a)&&u(s,{from:e,value:h,to:p})}),[u,a,h,p,s,l]),m=(0,e.useCallback)((e=>{(l||e!==p)&&u(s,{from:a,value:h,to:e})}),[u,a,h,p,s,l]),g=(0,e.useCallback)((({value:e})=>{u(s,{from:a,value:e,to:p})}),[u,s,a,p]),v=(0,e.useCallback)((()=>c(s)),[c,s]),y=(0,e.useMemo)((()=>l?(0,I.createDOMID)("threshold-error"):void 0),[l]);return t().createElement(t().Fragment,null,t().createElement(J,null,t().createElement(Q,null,t().createElement(D,{"data-test":"threshold-from-level",boundary:a,isDisabled:i,isEditable:r,errorId:y,onChange:f,index:s})),t().createElement(K,{to:p,index:s,isRemovable:d,isEditable:o,isDisabled:i,onChange:m,errorId:y}),t().createElement(Y,null,b({value:h,onChange:g,isDisabled:i||!!l,editValue:n})),t().createElement(Z,null,d&&t().createElement(ee,{"data-test":"threshold-remove-button",icon:t().createElement(A(),null),appearance:"subtle",onClick:v,disabled:i}))),t().createElement(E,{error:l,id:y,thresholdIndex:s}))};te.propTypes={editFrom:l().bool,editTo:l().bool,editValue:l().bool,error:l().string,from:l().number,index:l().number,isDisabled:l().bool,isRemovable:l().bool,onChange:l().func,onRemove:l().func,renderThresholdValueEditor:l().elementType.isRequired,to:l().number,value:l().string};const re=te;function oe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function ne(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(r),!0).forEach((function(t){j()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const le=[],ae=({ranges:r=le,openRanges:o=!0,isDisabled:n=!1,onChange:l,renderThresholdValueEditor:s})=>{const[i,u]=(0,e.useState)({}),c=(0,e.useCallback)((e=>{const t=(0,a.cloneDeep)(r);t.splice(e,1),l(P(t));const o=ne({},i);delete o[e],u(o)}),[i,r,l]),b=(0,e.useCallback)(((e,t)=>{const n=(0,a.cloneDeep)(r),s=ne({},i);if(n.splice(e,1,t),delete s[e],!o&&0===e){const r=function(e="",t=""){const r=parseFloat(e),o=parseFloat(t);return(0,a.isNaN)(r)||(0,a.isNaN)(+e)||(0,a.isNaN)(o)||(0,a.isNaN)(+t)?{error:!0,errorMessage:(0,d._)("Not a valid threshold. Must be a number")}:r<o?{error:!0,errorMessage:(0,d._)("Upper boundary must exceed lower boundary")}:{error:!1,errorMessage:null}}(t.to,t.from);r.error&&(s[e]=r.errorMessage)}if(!o&&0!==e&&t.to<t.from&&t.from>r[0].from&&(n[e].to=t.from+10),!o||e<r.length-1){const o=(0,a.cloneDeep)(r);o.splice(e,1);const n=M(t.from,o);n.error&&(s[e]=n.errorMessage)}u(s),Object.keys(s).length||l(P(n))}),[i,r,l,o]),p=!!Object.keys(i).length,h=(0,e.useCallback)((e=>!o&&r.length>1||o&&r.length>2&&e!==r.length-1),[o,r]);return r.map(((e,l)=>t().createElement(re,{key:`threshold-${e.from}-${e.to}-${e.value}`,onRemove:c,onChange:b,index:l,from:e.from,to:e.to,value:e.value,error:i[l],editFrom:!o||l!==r.length-1,editTo:!o&&0===l,editValue:!p,isRemovable:h(l),isDisabled:n,renderThresholdValueEditor:s})))};ae.propTypes={onChange:l().func.isRequired,ranges:l().arrayOf(l().shape({from:l().number,to:l().number,value:l().string})),isDisabled:l().bool,renderThresholdValueEditor:l().elementType.isRequired,openRanges:l().bool};const se=ae;var ie=r(7408),de=r.n(ie),ue=r(3283);const ce=({isDisabled:e,value:r,onChange:o})=>{const n=t().useCallback((({value:e})=>{o({value:null==e||""===e?"transparent":e})}),[o]);return t().createElement(de(),{disabled:e,value:(0,ue.isColor)(r)?r:"transparent",onChange:n,hideInput:!0,palette:q,"data-test":"threshold-level-value"})};ce.propTypes={isDisabled:l().bool,value:l().string,onChange:l().func.isRequired};const be=ce,pe=i().div`
|
|
84
84
|
flex-direction: column;
|
|
85
85
|
flex-grow: 1;
|
|
86
86
|
`,he=({onChange:r,name:o,itemSchema:n,value:l,labelPosition:s="top",labelWidth:i,label:u,isDisabled:b=!1,isTogglable:h=!0,openRanges:f=!0,renderThresholdValueEditor:m=be})=>{const g=Array.isArray(l)&&l.length>0,v=(0,e.useCallback)((()=>{r(null,o,n.default)}),[n,o,r]),y=(0,e.useCallback)((()=>{r(null,o,null)}),[o,r]),C=(0,e.useCallback)((()=>g?y():v()),[g,v,y]),E=(0,e.useCallback)((e=>{const t=(0,a.cloneDeep)(l),n={from:e,value:function(e=[]){const t=(0,a.difference)(q,e);return t.length>0?t[0]:"#444000"}(t.map((e=>e.value)))};f||(n.to=e+10),t.push(n);const s=P(t);r(null,o,s)}),[o,l,r,f]),x=(0,e.useCallback)((e=>{r(null,o,e)}),[r,o]);return t().createElement(p(),{label:u,labelPosition:s,labelWidth:i},t().createElement(pe,{"data-test":o},h&&t().createElement(c(),{appearance:"toggle",selected:g,onClick:C,disabled:b,role:"switch"},(0,d._)("Threshold")),g&&t().createElement(t().Fragment,null,!b&&t().createElement(S,{onAddThreshold:E,thresholds:l}),t().createElement(se,{onChange:x,ranges:l,isDisabled:b,openRanges:f,renderThresholdValueEditor:m}))))};he.propTypes={onChange:l().func.isRequired,name:l().string.isRequired,itemSchema:l().object,value:l().arrayOf(l().shape({from:l().number,to:l().number,value:l().string})),label:l().string.isRequired,labelPosition:l().oneOf(["left","top"]),labelWidth:l().number,isDisabled:l().bool,openRanges:l().bool,renderThresholdValueEditor:l().elementType,isTogglable:l().bool};const fe=he})(),module.exports=o})();
|
|
@@ -1 +1 @@
|
|
|
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,qBAAu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pI,IAAAA,cAACA,IAAAA,SAAc,MACTI,GACEJ,IAAAA,cAACyD,EAAY,CAACC,eAAgBiF,EAAoB7G,WAAYrC,IAElEO,IAAAA,cAACwG,GAAa,CACVjG,SAAU4I,EACV1C,OAAQhH,EACRW,WAAYA,EACZsG,WAAYA,EACZd,2BAA4BA,MAKjC,EAIvBoC,GAAgBzK,UAAY,CAQxBgD,SAAU/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":""}
|
|
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,QACAU,YACAC,gBACAC,aACAC,UACAC,OACAC,QACAC,QACAC,iBACAhB,UACAiB,iCAEA,wBAAC1B,EAAqB,aACPe,QAAAA,EAAY,gBACvBP,MAAOA,EACPU,UAAWA,EACXC,cAAeA,EACfC,WAAYA,EACZC,QAASA,EACTC,KAAMA,EACNE,MAAOA,EACPD,MAAOA,EACPd,QAASA,EACTgB,eAAgBA,GAEfR,EACK,EAAAU,SAASC,QAAQZ,GACZa,OAAOC,SACPC,KAAIC,IACD,IAAAC,cAAaD,EAAuB,CAChCT,MAAO,CAAEW,KAAM,OAG3BlB,EACLC,EAAa,wBAAC,EAAAV,qBAAoB,CAACC,MAAOA,EAAOC,QAASiB,IAAkC,MAIrGZ,EAAqBqB,UAAY,CAI7BZ,MAAOa,EAAEC,OAITpB,WAAYmB,EAAEE,K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4BpI,IAAAA,YAC5B6K,YAAa7K,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 const handleColorChange = React.useCallback(\n ({ value: selectedColor }) => {\n const nextValue = selectedColor == null || selectedColor === '' ? 'transparent' : selectedColor;\n onChange({ value: nextValue });\n },\n [onChange]\n );\n\n return (\n <Color\n disabled={isDisabled}\n value={isColor(value) ? value : 'transparent'}\n onChange={handleColorChange}\n hideInput // prisma only\n palette={defaultThresholdColors}\n data-test=\"threshold-level-value\"\n />\n );\n};\nThresholdColor.propTypes = {\n isDisabled: T.bool,\n value: T.string,\n onChange: T.func.isRequired,\n};\n\nexport default ThresholdColor;\n","import React, { useCallback } from 'react';\nimport T from 'prop-types';\nimport { cloneDeep } from 'lodash';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Switch from '@splunk/react-ui/Switch';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport AddThreshold from './threshold/AddThreshold';\nimport ThresholdList from './threshold/ThresholdList';\nimport { getNewThresholdColor, getUpdatedThresholdConfig } from '../utils/threshold';\nimport ThresholdColor from './threshold/ThresholdColor';\n\nconst Col = styled.div`\n flex-direction: column;\n flex-grow: 1;\n`;\n\nconst ThresholdEditor = ({\n onChange,\n name,\n itemSchema,\n value,\n labelPosition = 'top',\n labelWidth,\n label,\n isDisabled = false,\n isTogglable = true,\n openRanges = true,\n renderThresholdValueEditor = ThresholdColor,\n}) => {\n const isEnabled = Array.isArray(value) && value.length > 0;\n\n const setDefaultThresholds = useCallback(() => {\n onChange(null, name, itemSchema.default);\n }, [itemSchema, name, onChange]);\n\n const clearThresholds = useCallback(() => {\n onChange(null, name, null);\n }, [name, onChange]);\n\n const handleEnableClick = useCallback(() => {\n if (!isEnabled) {\n return setDefaultThresholds();\n }\n return clearThresholds();\n }, [isEnabled, setDefaultThresholds, clearThresholds]);\n\n const handleAddThreshold = useCallback(\n from => {\n const existingThresholds = cloneDeep(value);\n const color = getNewThresholdColor(existingThresholds.map(t => t.value));\n const result = { from, value: color };\n if (!openRanges) {\n // add an arbitrary to value in case this is a new top range\n result.to = from + 10;\n }\n existingThresholds.push(result);\n const sortedThresholds = getUpdatedThresholdConfig(existingThresholds);\n\n onChange(null, name, sortedThresholds);\n },\n [name, value, onChange, openRanges]\n );\n\n const handleThresholdChange = useCallback(\n thresholds => {\n onChange(null, name, thresholds);\n },\n [onChange, name]\n );\n\n return (\n <ControlGroup label={label} labelPosition={labelPosition} labelWidth={labelWidth}>\n <Col data-test={name}>\n {isTogglable && (\n <Switch\n appearance=\"toggle\"\n selected={isEnabled}\n onClick={handleEnableClick}\n disabled={isDisabled}\n role=\"switch\"\n >\n {_('Threshold')}\n </Switch>\n )}\n {isEnabled && (\n <React.Fragment>\n {!isDisabled && (\n <AddThreshold onAddThreshold={handleAddThreshold} thresholds={value} />\n )}\n <ThresholdList\n onChange={handleThresholdChange}\n ranges={value}\n isDisabled={isDisabled}\n openRanges={openRanges}\n renderThresholdValueEditor={renderThresholdValueEditor}\n />\n </React.Fragment>\n )}\n </Col>\n </ControlGroup>\n );\n};\n\nThresholdEditor.propTypes = {\n /**\n * Callback when selecting an item from the menu\n *\n * @param {SyntheticEvent} event The React `SyntheticEvent`\n * @param {string} name The option name\n * @param {string|boolean} value The option value\n */\n onChange: T.func.isRequired,\n /**\n * The option name\n */\n name: T.string.isRequired,\n /**\n * The item JSON schema, it should contain `enum` property. Note this will only be used when `values` prop is undefined\n */\n itemSchema: T.object,\n /**\n * The option value\n */\n value: T.arrayOf(\n T.shape({\n from: T.number,\n to: T.number,\n value: T.string,\n })\n ),\n /**\n * A human readable label for the option\n */\n label: T.string.isRequired,\n /**\n * Label position\n */\n labelPosition: T.oneOf(['left', 'top']),\n labelWidth: T.number,\n /**\n * Make thresholds editable\n */\n isDisabled: T.bool,\n openRanges: T.bool,\n renderThresholdValueEditor: T.elementType,\n isTogglable: T.bool,\n};\n\nexport default ThresholdEditor;\n"],"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","handleColorChange","selectedColor","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":""}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"author": "Splunk",
|
|
6
6
|
"//": "actual package version is maintained by git tag",
|
|
7
|
-
"version": "0.43.
|
|
7
|
+
"version": "0.43.1",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "NODE_ENV=production webpack --config ./webpack.config.js --bail",
|
|
10
10
|
"build-storybook": "sb build -c .storybook -s fonts -o .storybook-bundle",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"webpack": "^5.88.0",
|
|
101
101
|
"webpack-cli": "^5.1.4"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "6411f20fd49ccc797aabbda6f7a76fd110561fe0"
|
|
104
104
|
}
|