@splunk/visualizations-shared 28.2.2 → 28.3.0
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/LICENSE.md +0 -1
- package/RemoteIcon.js.map +2 -2
- package/VisualizationDocPage.d.ts +1 -1
- package/VisualizationDocPage.js.map +2 -2
- package/iconUtils.d.ts +1 -0
- package/iconUtils.js +7 -0
- package/iconUtils.js.map +2 -2
- package/package.json +8 -8
package/LICENSE.md
CHANGED
|
@@ -408,7 +408,6 @@ This Configuration and Implementation Services Exhibit forms a part of the Splun
|
|
|
408
408
|
8. **Insurance**
|
|
409
409
|
|
|
410
410
|
Throughout any period of C&I Services we perform for you, we will maintain insurance policies in the types and amounts described below at our own expense:
|
|
411
|
-
|
|
412
411
|
- Commercial General Liability Insurance with a limit of not less than $1,000,000 per occurrence and a general aggregate limit of not less than $2,000,000.
|
|
413
412
|
|
|
414
413
|
- Business Auto Insurance with a limit of not less than $1,000,000 combined single limit. Such Insurance will cover liability arising out of "hired and non-owned" automobiles.
|
package/RemoteIcon.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["src/RemoteIcon.tsx", "esm-externals:react", "esm-externals:styled-components", "esm-externals:xmlserializer", "esm-externals:@splunk/ui-utils/i18n", "esm-externals:@splunk/visualization-context/IconContext", "esm-externals:lodash/isNumber", "src/style.js", "src/iconUtils.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable class-methods-use-this */\nimport * as React from 'react';\nimport styled from 'styled-components';\nimport * as xmlserializer from 'xmlserializer';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport IconContext from '@splunk/visualization-context/IconContext';\nimport { toDimension } from './style';\nimport { shouldChangeFill, shouldChangeStroke, b64EncodeUnicode } from './iconUtils';\n\ninterface RemoteIconProps {\n alt?: string;\n iconURL?: string;\n color?: string;\n width?: number | string;\n height?: number | string;\n opacity?: number;\n onIconClick?: (event: React.MouseEvent<HTMLDivElement>) => void;\n}\n\ninterface RemoteIconState {\n iconDataURI: string | null;\n}\n\nconst IconContainer = styled.div<RemoteIconProps>`\n ${props => toDimension({ width: props.width, height: props.height })};\n margin: auto;\n cursor: ${props => (props.onClick ? 'pointer' : 'inherit')};\n`;\n\nconst ColoredIcon = styled.img<RemoteIconProps>`\n ${props => toDimension({ width: props.width, height: props.height })};\n opacity: ${props => props.opacity || 1.0};\n`;\n\nclass RemoteIcon extends React.PureComponent<RemoteIconProps, RemoteIconState> {\n static readonly contextType: IconContext = IconContext;\n\n static readonly BASIC_SHAPES = ['path', 'rect', 'circle', 'ellipse', 'line', 'polyline', 'polygon'];\n\n constructor(props: RemoteIconProps) {\n super(props);\n this.state = { iconDataURI: null };\n }\n\n // eslint-disable-next-line camelcase\n UNSAFE_componentWillMount() {\n this.getIcon(this.props.iconURL, this.props.color);\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.iconURL !== this.props.iconURL || prevProps.color !== this.props.color) {\n this.getIcon(this.props.iconURL, this.props.color);\n }\n }\n\n /**\n * Check if the iconURL is a registry URL/dataURI/direct URL and fetch from the registry when required\n * @param {String} iconURL\n * @param {String} color\n */\n async getIcon(iconURL, color) {\n const getIconDataURI = async () => {\n if (this.isRegistryURL(iconURL)) {\n const iconRegistry: IconContext = this.context;\n if (iconRegistry) {\n try {\n const icon = (await iconRegistry.getByURL(iconURL)) as any;\n return icon.dataURI;\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(_(error));\n }\n }\n } else {\n return iconURL;\n }\n return null;\n };\n\n const iconDataURI = await getIconDataURI();\n\n if (color) {\n this.colorIcon(iconDataURI, color);\n } else {\n this.setState({ iconDataURI });\n }\n }\n\n /**\n * check if icon is a registry url\n * @param {String} src\n */\n isRegistryURL(src = '') {\n const [type] = src.split('://');\n return type !== 'http' && type !== 'https' && !src.startsWith('data:image/svg+xml;base64');\n }\n\n /*\n * Color the icon:\n * parse svg elements from the dataURI, change color style of svg, and change fill/stroke attribute/style of each svg basic shapes\n * in the svg element to currentColor. At the end, convert the modified svg back to dataURI string.\n *\n * Limitation:\n * if the svg is created with multiple pathes with different fill attributes, this method would\n * convert all pathes' fill attribute to the color prop. It may change the view of the svg icon.\n *\n * @method colorIcon\n * @params {DataURI} dataURI\n * @params {String} color e.g. 'red' || '#ffffff'\n */\n colorIcon(dataURI, color) {\n fetch(dataURI)\n .then(response => response.text())\n .then(text => {\n const parser = new DOMParser();\n const xmlDoc = parser.parseFromString(text, 'text/xml');\n const svg = xmlDoc.getElementsByTagName('svg')[0];\n const children = svg.querySelectorAll('*');\n svg.style.color = color;\n // eslint-disable-next-line no-restricted-syntax\n for (const child of children) {\n if (RemoteIcon.BASIC_SHAPES.includes(child.tagName)) {\n const fillAttr = child.getAttribute('fill');\n const fillStyle = (child as SVGElement).style?.fill;\n const strokeAttr = child.getAttribute('stroke');\n const strokeStyle = (child as SVGElement).style?.stroke;\n if (\n shouldChangeFill({\n fillAttr,\n fillStyle,\n strokeAttr,\n strokeStyle,\n })\n ) {\n (child as SVGElement).style.fill = '';\n child.setAttribute('fill', 'currentColor');\n }\n\n if (\n shouldChangeStroke({\n fillAttr,\n fillStyle,\n strokeAttr,\n strokeStyle,\n })\n ) {\n (child as SVGElement).style.stroke = '';\n child.setAttribute('stroke', 'currentColor');\n }\n }\n }\n const s = xmlserializer.serializeToString(svg);\n const svgStr = b64EncodeUnicode(s);\n const iconDataURI = `data:image/svg+xml;base64,${svgStr}`;\n this.setState({ iconDataURI });\n })\n .catch(() => {\n // eslint-disable-next-line no-console\n console.error(_('The icon cannot be colored properly.'));\n });\n }\n\n render() {\n const { iconDataURI } = this.state;\n const { alt = _('Remote Icon'), width = 100, height = 100, opacity = 1.0, onIconClick } = this.props;\n if (!iconDataURI) {\n return null;\n }\n return (\n <IconContainer width={width} height={height} onClick={onIconClick}>\n <ColoredIcon\n src={iconDataURI}\n alt={alt}\n width={width}\n height={height}\n opacity={opacity}\n referrerPolicy=\"no-referrer\"\n />\n </IconContainer>\n );\n }\n}\n\nexport default RemoteIcon;\n", "\nimport * as defaultImport from \"react\";\nexport * from \"react\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"styled-components\";\nexport * from \"styled-components\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"xmlserializer\";\nexport * from \"xmlserializer\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/ui-utils/i18n\";\nexport * from \"@splunk/ui-utils/i18n\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualization-context/IconContext\";\nexport * from \"@splunk/visualization-context/IconContext\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"lodash/isNumber\";\nexport * from \"lodash/isNumber\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "import isNumber from 'lodash/isNumber';\n\n/**\n * convert number to px\n * @param {*} number\n */\nexport const toPx = (number, defaultNumber = 0) =>\n isNumber(number) ? `${number}px` : number || toPx(defaultNumber);\n\n/**\n * generate width/height css properties\n * @param {*} param0\n */\nexport const toDimension = ({ width, height }) => {\n let css = '';\n if (width) {\n css = `width: ${toPx(width)};`;\n }\n if (height) {\n // only add a linebreak if width was also set\n css = `${css}${width ? '\\n' : ''}height: ${toPx(height)};`;\n }\n return css;\n};\n\n/**\n * generate margin css property\n */\nexport const arrayToCSSProp = (prop, vals = [0, 0, 0, 0]) => {\n if (Array.isArray(vals)) {\n return `\n ${prop}: ${toPx(vals[0])} ${toPx(vals[1])} ${toPx(vals[2])} ${toPx(vals[3])};\n `;\n }\n\n return `${prop}: ${toPx(vals)};`;\n};\n\n/**\n * generate margin css property\n */\nexport const toMargin = (margins = [0, 0, 0, 0]) => arrayToCSSProp('margin', margins);\n\n/**\n * generate padding css property\n */\nexport const toPadding = (paddings = [0, 0, 0, 0]) => arrayToCSSProp('padding', paddings);\n", "/**\n * check if an icon is considered as remote icon\n * @param {*} icon\n */\nexport const isRemoteIcon = (icon = '') => icon.indexOf('://') > -1;\n\n/**\n * check if an icon is a dataURI\n * @param {*} icon\n */\nexport const isDataURI = (icon = '') => icon.startsWith('data:image/svg+xml;base64');\n\n/*\n * check whether need update fill for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove fill style and change the fill attribute <path fill=\"currentColor\" />\n */\nexport const shouldChangeFill = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneFillAttr = !!fillAttr && (fillAttr === 'none' || fillAttr === 'transparent');\n const noneFillStyle = !!fillStyle && (fillStyle === 'none' || fillStyle === 'transparent');\n const noFillHasStroke = !fillAttr && !fillStyle && (!!strokeAttr || !!strokeStyle);\n return !(noneFillAttr || noneFillStyle || noFillHasStroke);\n};\n\n/*\n * check whether need update stroke for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove stroke style and change the stroke attribute <path stroke=\"currentColor\" />\n */\nexport const shouldChangeStroke = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneStrokeAttr = !!strokeAttr && (strokeAttr === 'none' || strokeAttr === 'transparent');\n const noneStrokeStyle = !!strokeStyle && (strokeStyle === 'none' || strokeStyle === 'transparent');\n const hasFill = !!fillAttr || !!fillStyle;\n const noStroke = !strokeAttr && !strokeStyle;\n return !(noneStrokeAttr || noneStrokeStyle || hasFill || noStroke);\n};\n\n/*\n * base64 encoding\n * @param {String} str\n * @return {Base64} string using based-64 encoding\n */\nexport const b64EncodeUnicode = str =>\n // first we use encodeURIComponent to get percent-encoded UTF-8,\n // then we convert the percent encodings into raw bytes which\n // can be fed into btoa.\n btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode(`0x${p1}`)));\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AACA,oBAA+B;AAC/B,0BAAc;AACd,IAAO,gBAAS,aAAa,gBAA8B,wBAAU;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAA,iBAA+B;AAC/B,sCAAc;AACd,IAAO,4BAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,kCAAc;AACd,IAAO,wBAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,yBAAc;AACd,IAAO,eAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,gCAAc;AACd,IAAO,sBAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,6BAAc;AACd,IAAO,mBAAS,aAAaA,iBAA8B,yBAAUA;;;ACG9D,IAAM,OAAO,CAAC,QAAQ,gBAAgB,MACzC,iBAAS,MAAM,IAAI,GAAG,MAAM,OAAO,UAAU,KAAK,aAAa;AAM5D,IAAM,cAAc,CAAC,EAAE,OAAO,OAAO,MAAM;AAC9C,MAAI,MAAM;AACV,MAAI,OAAO;AACP,UAAM,UAAU,KAAK,KAAK,CAAC;AAAA,EAC/B;AACA,MAAI,QAAQ;AAER,UAAM,GAAG,GAAG,GAAG,QAAQ,OAAO,EAAE,WAAW,KAAK,MAAM,CAAC;AAAA,EAC3D;AACA,SAAO;AACX;;;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable class-methods-use-this */\nimport * as React from 'react';\nimport styled from 'styled-components';\nimport * as xmlserializer from 'xmlserializer';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport IconContext from '@splunk/visualization-context/IconContext';\nimport { toDimension } from './style';\nimport { shouldChangeFill, shouldChangeStroke, b64EncodeUnicode } from './iconUtils';\n\ninterface RemoteIconProps {\n alt?: string;\n iconURL?: string;\n color?: string;\n width?: number | string;\n height?: number | string;\n opacity?: number;\n onIconClick?: (event: React.MouseEvent<HTMLDivElement>) => void;\n}\n\ninterface RemoteIconState {\n iconDataURI: string | null;\n}\n\nconst IconContainer = styled.div<RemoteIconProps>`\n ${props => toDimension({ width: props.width, height: props.height })};\n margin: auto;\n cursor: ${props => (props.onClick ? 'pointer' : 'inherit')};\n`;\n\nconst ColoredIcon = styled.img<RemoteIconProps>`\n ${props => toDimension({ width: props.width, height: props.height })};\n opacity: ${props => props.opacity || 1.0};\n`;\n\nclass RemoteIcon extends React.PureComponent<RemoteIconProps, RemoteIconState> {\n static readonly contextType: IconContext = IconContext;\n\n static readonly BASIC_SHAPES = ['path', 'rect', 'circle', 'ellipse', 'line', 'polyline', 'polygon'];\n\n constructor(props: RemoteIconProps) {\n super(props);\n this.state = { iconDataURI: null };\n }\n\n // eslint-disable-next-line camelcase\n UNSAFE_componentWillMount() {\n this.getIcon(this.props.iconURL, this.props.color);\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.iconURL !== this.props.iconURL || prevProps.color !== this.props.color) {\n this.getIcon(this.props.iconURL, this.props.color);\n }\n }\n\n /**\n * Check if the iconURL is a registry URL/dataURI/direct URL and fetch from the registry when required\n * @param {String} iconURL\n * @param {String} color\n */\n async getIcon(iconURL, color) {\n const getIconDataURI = async () => {\n if (this.isRegistryURL(iconURL)) {\n const iconRegistry: IconContext = this.context;\n if (iconRegistry) {\n try {\n const icon = (await iconRegistry.getByURL(iconURL)) as any;\n return icon.dataURI;\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(_(error));\n }\n }\n } else {\n return iconURL;\n }\n return null;\n };\n\n const iconDataURI = await getIconDataURI();\n\n if (color) {\n this.colorIcon(iconDataURI, color);\n } else {\n this.setState({ iconDataURI });\n }\n }\n\n /**\n * check if icon is a registry url\n * @param {String} src\n */\n isRegistryURL(src = '') {\n const [type] = src.split('://');\n return type !== 'http' && type !== 'https' && !src.startsWith('data:image/svg+xml;base64');\n }\n\n /*\n * Color the icon:\n * parse svg elements from the dataURI, change color style of svg, and change fill/stroke attribute/style of each svg basic shapes\n * in the svg element to currentColor. At the end, convert the modified svg back to dataURI string.\n *\n * Limitation:\n * if the svg is created with multiple pathes with different fill attributes, this method would\n * convert all pathes' fill attribute to the color prop. It may change the view of the svg icon.\n *\n * @method colorIcon\n * @params {DataURI} dataURI\n * @params {String} color e.g. 'red' || '#ffffff'\n */\n colorIcon(dataURI, color) {\n fetch(dataURI)\n .then(response => response.text())\n .then(text => {\n const parser = new DOMParser();\n const xmlDoc = parser.parseFromString(text, 'text/xml');\n const svg = xmlDoc.getElementsByTagName('svg')[0];\n const children = svg.querySelectorAll('*');\n svg.style.color = color;\n // eslint-disable-next-line no-restricted-syntax\n for (const child of children) {\n if (RemoteIcon.BASIC_SHAPES.includes(child.tagName)) {\n const fillAttr = child.getAttribute('fill');\n const fillStyle = (child as SVGElement).style?.fill;\n const strokeAttr = child.getAttribute('stroke');\n const strokeStyle = (child as SVGElement).style?.stroke;\n if (\n shouldChangeFill({\n fillAttr,\n fillStyle,\n strokeAttr,\n strokeStyle,\n })\n ) {\n (child as SVGElement).style.fill = '';\n child.setAttribute('fill', 'currentColor');\n }\n\n if (\n shouldChangeStroke({\n fillAttr,\n fillStyle,\n strokeAttr,\n strokeStyle,\n })\n ) {\n (child as SVGElement).style.stroke = '';\n child.setAttribute('stroke', 'currentColor');\n }\n }\n }\n const s = xmlserializer.serializeToString(svg);\n const svgStr = b64EncodeUnicode(s);\n const iconDataURI = `data:image/svg+xml;base64,${svgStr}`;\n this.setState({ iconDataURI });\n })\n .catch(() => {\n // eslint-disable-next-line no-console\n console.error(_('The icon cannot be colored properly.'));\n });\n }\n\n render() {\n const { iconDataURI } = this.state;\n const { alt = _('Remote Icon'), width = 100, height = 100, opacity = 1.0, onIconClick } = this.props;\n if (!iconDataURI) {\n return null;\n }\n return (\n <IconContainer width={width} height={height} onClick={onIconClick}>\n <ColoredIcon\n src={iconDataURI}\n alt={alt}\n width={width}\n height={height}\n opacity={opacity}\n referrerPolicy=\"no-referrer\"\n />\n </IconContainer>\n );\n }\n}\n\nexport default RemoteIcon;\n", "\nimport * as defaultImport from \"react\";\nexport * from \"react\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"styled-components\";\nexport * from \"styled-components\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"xmlserializer\";\nexport * from \"xmlserializer\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/ui-utils/i18n\";\nexport * from \"@splunk/ui-utils/i18n\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/visualization-context/IconContext\";\nexport * from \"@splunk/visualization-context/IconContext\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"lodash/isNumber\";\nexport * from \"lodash/isNumber\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "import isNumber from 'lodash/isNumber';\n\n/**\n * convert number to px\n * @param {*} number\n */\nexport const toPx = (number, defaultNumber = 0) =>\n isNumber(number) ? `${number}px` : number || toPx(defaultNumber);\n\n/**\n * generate width/height css properties\n * @param {*} param0\n */\nexport const toDimension = ({ width, height }) => {\n let css = '';\n if (width) {\n css = `width: ${toPx(width)};`;\n }\n if (height) {\n // only add a linebreak if width was also set\n css = `${css}${width ? '\\n' : ''}height: ${toPx(height)};`;\n }\n return css;\n};\n\n/**\n * generate margin css property\n */\nexport const arrayToCSSProp = (prop, vals = [0, 0, 0, 0]) => {\n if (Array.isArray(vals)) {\n return `\n ${prop}: ${toPx(vals[0])} ${toPx(vals[1])} ${toPx(vals[2])} ${toPx(vals[3])};\n `;\n }\n\n return `${prop}: ${toPx(vals)};`;\n};\n\n/**\n * generate margin css property\n */\nexport const toMargin = (margins = [0, 0, 0, 0]) => arrayToCSSProp('margin', margins);\n\n/**\n * generate padding css property\n */\nexport const toPadding = (paddings = [0, 0, 0, 0]) => arrayToCSSProp('padding', paddings);\n", "/**\n * check if an icon is considered as remote icon\n * @param {*} icon\n */\nexport const isRemoteIcon = (icon = '') => icon.indexOf('://') > -1;\n\n/**\n * check if an icon is a dataURI\n * @param {*} icon\n */\nexport const isDataURI = (icon = '') => icon.startsWith('data:image/svg+xml;base64');\n\n/**\n * check if an icon is a relative URL path (e.g., /static/app/myapp/icon.svg)\n * @param {*} icon\n */\nexport const isRelativeUrlPath = (icon = '') => {\n if (!icon || typeof icon !== 'string') {\n return false;\n }\n // Check if it starts with / and doesn't already have a protocol\n return icon.startsWith('/') && icon.indexOf('://') === -1;\n};\n\n/*\n * check whether need update fill for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove fill style and change the fill attribute <path fill=\"currentColor\" />\n */\nexport const shouldChangeFill = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneFillAttr = !!fillAttr && (fillAttr === 'none' || fillAttr === 'transparent');\n const noneFillStyle = !!fillStyle && (fillStyle === 'none' || fillStyle === 'transparent');\n const noFillHasStroke = !fillAttr && !fillStyle && (!!strokeAttr || !!strokeStyle);\n return !(noneFillAttr || noneFillStyle || noFillHasStroke);\n};\n\n/*\n * check whether need update stroke for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove stroke style and change the stroke attribute <path stroke=\"currentColor\" />\n */\nexport const shouldChangeStroke = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneStrokeAttr = !!strokeAttr && (strokeAttr === 'none' || strokeAttr === 'transparent');\n const noneStrokeStyle = !!strokeStyle && (strokeStyle === 'none' || strokeStyle === 'transparent');\n const hasFill = !!fillAttr || !!fillStyle;\n const noStroke = !strokeAttr && !strokeStyle;\n return !(noneStrokeAttr || noneStrokeStyle || hasFill || noStroke);\n};\n\n/*\n * base64 encoding\n * @param {String} str\n * @return {Base64} string using based-64 encoding\n */\nexport const b64EncodeUnicode = str =>\n // first we use encodeURIComponent to get percent-encoded UTF-8,\n // then we convert the percent encodings into raw bytes which\n // can be fed into btoa.\n btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode(`0x${p1}`)));\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AACA,oBAA+B;AAC/B,0BAAc;AACd,IAAO,gBAAS,aAAa,gBAA8B,wBAAU;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAA,iBAA+B;AAC/B,sCAAc;AACd,IAAO,4BAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,kCAAc;AACd,IAAO,wBAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;A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AAA,YACf;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACJ,CAAC,GACH;AACE,YAAC,MAAqB,MAAM,SAAS;AACrC,kBAAM,aAAa,UAAU,cAAc;AAAA,UAC/C;AAAA,QACJ;AAAA,MACJ;AACA,YAAM,IAAkB,wCAAkB,GAAG;AAC7C,YAAM,SAAS,iBAAiB,CAAC;AACjC,YAAM,cAAc,6BAA6B,MAAM;AACvD,WAAK,SAAS,EAAE,YAAY,CAAC;AAAA,IACjC,CAAC,EACA,MAAM,MAAM;AAET,cAAQ,UAAM,gBAAE,sCAAsC,CAAC;AAAA,IAC3D,CAAC;AAAA,EACT;AAAA,EAEA,SAAS;AACL,UAAM,EAAE,YAAY,IAAI,KAAK;AAC7B,UAAM,EAAE,UAAM,gBAAE,aAAa,GAAG,QAAQ,KAAK,SAAS,KAAK,UAAU,GAAK,YAAY,IAAI,KAAK;AAC/F,QAAI,CAAC,aAAa;AACd,aAAO;AAAA,IACX;AACA,WACI,4CAAC,iBAAc,OAAc,QAAgB,SAAS,eAClD;AAAA,MAAC;AAAA;AAAA,QACG,KAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,gBAAe;AAAA;AAAA,IACnB,CACJ;AAAA,EAER;AACJ;AAnJM,YACc,cAA2B;AADzC,YAGc,eAAe,CAAC,QAAQ,QAAQ,UAAU,WAAW,QAAQ,YAAY,SAAS;AAHtG,IAAM,aAAN;AAqJA,IAAO,qBAAQ;",
|
|
6
6
|
"names": ["defaultImport", "defaultImport", "defaultImport", "defaultImport", "defaultImport"]
|
|
7
7
|
}
|
|
@@ -19,7 +19,7 @@ interface ComponentPageState {
|
|
|
19
19
|
activeSection: string;
|
|
20
20
|
}
|
|
21
21
|
declare class ComponentPage extends React.Component<ComponentPageProps, ComponentPageState> {
|
|
22
|
-
static currentSection
|
|
22
|
+
private static currentSection;
|
|
23
23
|
bodyEl: any;
|
|
24
24
|
constructor(args: any);
|
|
25
25
|
handleBodyMount: (el: any) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["src/VisualizationDocPage.tsx", "esm-externals:react", "esm-externals:lodash", "esm-externals:@splunk/react-docs/DockingTabBar", "esm-externals:@splunk/react-docs/API", "src/previewVizMessage.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { noop, pick } from 'lodash';\nimport DockingTabBar, { Tab } from '@splunk/react-docs/DockingTabBar';\nimport APIPage from '@splunk/react-docs/API';\nimport previewVizMessage from './previewVizMessage';\n\ninterface ComponentPageProps {\n createComponentURL: (componentName: string) => string;\n dependsOnSplunk: boolean;\n status: string;\n description: string;\n overviewSection: React.ReactNode;\n conceptsSection: React.ReactNode;\n examplesSection: React.ReactNode;\n optionSection: React.ReactNode;\n encodingSection: React.ReactNode;\n eventSection: React.ReactNode;\n themeSection: React.ReactNode;\n headerOffset: number;\n sourceURL: string;\n title: string;\n}\n\ninterface ComponentPageState {\n activeSection: string;\n}\n\nclass ComponentPage extends React.Component<ComponentPageProps, ComponentPageState> {\n static currentSection = 'overview';\n\n bodyEl: any;\n\n constructor(args) {\n super(args);\n this.state = { activeSection: ComponentPage.currentSection };\n }\n\n handleBodyMount = el => {\n this.bodyEl = el;\n };\n\n handleSectionChange = (e, { selectedTabId }) => {\n ComponentPage.currentSection = selectedTabId;\n this.setState({ activeSection: selectedTabId }, () => {\n // After the new section loads, scroll to the top of the section.\n const { top } = this.bodyEl.getBoundingClientRect();\n if (top < window.scrollY) {\n const target = top + window.scrollY - 90;\n window.scroll(0, target);\n }\n });\n };\n\n renderBody() {\n const {\n encodingSection,\n optionSection,\n overviewSection,\n conceptsSection,\n examplesSection,\n eventSection,\n themeSection,\n } = this.props;\n const { activeSection } = this.state;\n switch (activeSection) {\n case 'concepts':\n return conceptsSection;\n case 'overview':\n return overviewSection;\n case 'examples':\n return examplesSection;\n case 'encoding':\n return encodingSection;\n case 'option':\n return optionSection;\n case 'event':\n return eventSection;\n case 'theme':\n return themeSection;\n default:\n return null;\n }\n }\n\n render() {\n const {\n createComponentURL = noop,\n conceptsSection,\n overviewSection,\n examplesSection,\n encodingSection,\n eventSection,\n themeSection,\n headerOffset = 0,\n sourceURL,\n } = this.props;\n let basePageProps = pick(this.props, 'dependsOnSplunk', 'description', 'title');\n\n if (this.props.status === 'preview') {\n basePageProps = {\n ...basePageProps,\n description: `#### ${previewVizMessage} \\n ${basePageProps.description || ''}`,\n };\n }\n\n let { activeSection } = this.state;\n let body = this.renderBody();\n\n if (!body) {\n body = examplesSection;\n activeSection = 'examples';\n }\n return (\n <APIPage sourceURL={sourceURL || createComponentURL(window.location.pathname)} {...basePageProps}>\n <DockingTabBar\n activeTabId={activeSection}\n offset={headerOffset}\n onChange={this.handleSectionChange}\n >\n {overviewSection && <Tab label=\"Overview\" tabId=\"overview\" />}\n <Tab label=\"Examples\" tabId=\"examples\" />\n {encodingSection && <Tab label=\"Encoding\" tabId=\"encoding\" />}\n <Tab label=\"Options\" tabId=\"option\" />\n {eventSection && <Tab label=\"Events\" tabId=\"event\" />}\n {themeSection && <Tab label=\"Themes\" tabId=\"theme\" />}\n {conceptsSection && <Tab label=\"Concepts\" tabId=\"concepts\" />}\n </DockingTabBar>\n <div\n style={{\n padding: '0 30px 30px',\n marginTop: '20px',\n }}\n ref={this.handleBodyMount}\n >\n {body}\n </div>\n </APIPage>\n );\n }\n}\n\nexport default ComponentPage;\n", "\nimport * as defaultImport from \"react\";\nexport * from \"react\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"lodash\";\nexport * from \"lodash\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/react-docs/DockingTabBar\";\nexport * from \"@splunk/react-docs/DockingTabBar\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/react-docs/API\";\nexport * from \"@splunk/react-docs/API\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "const previewVizMessage =\n '\u26A0\uFE0F This is a preview of a new visualization component. Minor updates and bug fixes should be expected.';\n\nexport default previewVizMessage;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AACA,oBAA+B;AAC/B,0BAAc;AACd,IAAO,gBAAS,aAAa,gBAA8B,wBAAU;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAA,iBAA+B;AAC/B,2BAAc;AACd,IAAO,iBAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,kCAAc;AACd,IAAO,wBAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,wBAAc;AACd,IAAO,cAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE,IAAM,oBACF;AAEJ,IAAO,4BAAQ;;;ALwBf,IAAM,iBAAN,MAAM,uBAA4B,wBAAkD;AAAA,EAKhF,YAAY,MAAM;AACd,UAAM,IAAI;AAId,2BAAkB,QAAM;AACpB,WAAK,SAAS;AAAA,IAClB;AAEA,+BAAsB,CAAC,GAAG,EAAE,cAAc,MAAM;AAC5C,qBAAc,iBAAiB;AAC/B,WAAK,SAAS,EAAE,eAAe,cAAc,GAAG,MAAM;AAElD,cAAM,EAAE,IAAI,IAAI,KAAK,OAAO,sBAAsB;AAClD,YAAI,MAAM,OAAO,SAAS;AACtB,gBAAM,SAAS,MAAM,OAAO,UAAU;AACtC,iBAAO,OAAO,GAAG,MAAM;AAAA,QAC3B;AAAA,MACJ,CAAC;AAAA,IACL;AAjBI,SAAK,QAAQ,EAAE,eAAe,eAAc,eAAe;AAAA,EAC/D;AAAA,EAkBA,aAAa;AACT,UAAM;AAAA,MAC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C3D,4CAAC,6BAAI,OAAM,WAAU,OAAM,UAAS;AAAA,MACnC,gBAAgB,4CAAC,6BAAI,OAAM,UAAS,OAAM,SAAQ;AAAA,MAClD,gBAAgB,4CAAC,6BAAI,OAAM,UAAS,OAAM,SAAQ;AAAA,MAClD,mBAAmB,4CAAC,6BAAI,OAAM,YAAW,OAAM,YAAW;AAAA,IAC/D,GACA;AAAA,MAAC;AAAA;AAAA,QACG,OAAO;AAAA,UACH,SAAS;AAAA,UACT,WAAW;AAAA,QACf;AAAA,QACA,KAAK,KAAK;AAAA;AAAA,MAET;AAAA,IACL,CACJ;AAAA,EAER;AACJ;AAhHM,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { noop, pick } from 'lodash';\nimport DockingTabBar, { Tab } from '@splunk/react-docs/DockingTabBar';\nimport APIPage from '@splunk/react-docs/API';\nimport previewVizMessage from './previewVizMessage';\n\ninterface ComponentPageProps {\n createComponentURL: (componentName: string) => string;\n dependsOnSplunk: boolean;\n status: string;\n description: string;\n overviewSection: React.ReactNode;\n conceptsSection: React.ReactNode;\n examplesSection: React.ReactNode;\n optionSection: React.ReactNode;\n encodingSection: React.ReactNode;\n eventSection: React.ReactNode;\n themeSection: React.ReactNode;\n headerOffset: number;\n sourceURL: string;\n title: string;\n}\n\ninterface ComponentPageState {\n activeSection: string;\n}\n\nclass ComponentPage extends React.Component<ComponentPageProps, ComponentPageState> {\n private static currentSection = 'overview';\n\n bodyEl: any;\n\n constructor(args) {\n super(args);\n this.state = { activeSection: ComponentPage.currentSection };\n }\n\n handleBodyMount = el => {\n this.bodyEl = el;\n };\n\n handleSectionChange = (e, { selectedTabId }) => {\n ComponentPage.currentSection = selectedTabId;\n this.setState({ activeSection: selectedTabId }, () => {\n // After the new section loads, scroll to the top of the section.\n const { top } = this.bodyEl.getBoundingClientRect();\n if (top < window.scrollY) {\n const target = top + window.scrollY - 90;\n window.scroll(0, target);\n }\n });\n };\n\n renderBody() {\n const {\n encodingSection,\n optionSection,\n overviewSection,\n conceptsSection,\n examplesSection,\n eventSection,\n themeSection,\n } = this.props;\n const { activeSection } = this.state;\n switch (activeSection) {\n case 'concepts':\n return conceptsSection;\n case 'overview':\n return overviewSection;\n case 'examples':\n return examplesSection;\n case 'encoding':\n return encodingSection;\n case 'option':\n return optionSection;\n case 'event':\n return eventSection;\n case 'theme':\n return themeSection;\n default:\n return null;\n }\n }\n\n render() {\n const {\n createComponentURL = noop,\n conceptsSection,\n overviewSection,\n examplesSection,\n encodingSection,\n eventSection,\n themeSection,\n headerOffset = 0,\n sourceURL,\n } = this.props;\n let basePageProps = pick(this.props, 'dependsOnSplunk', 'description', 'title');\n\n if (this.props.status === 'preview') {\n basePageProps = {\n ...basePageProps,\n description: `#### ${previewVizMessage} \\n ${basePageProps.description || ''}`,\n };\n }\n\n let { activeSection } = this.state;\n let body = this.renderBody();\n\n if (!body) {\n body = examplesSection;\n activeSection = 'examples';\n }\n return (\n <APIPage sourceURL={sourceURL || createComponentURL(window.location.pathname)} {...basePageProps}>\n <DockingTabBar\n activeTabId={activeSection}\n offset={headerOffset}\n onChange={this.handleSectionChange}\n >\n {overviewSection && <Tab label=\"Overview\" tabId=\"overview\" />}\n <Tab label=\"Examples\" tabId=\"examples\" />\n {encodingSection && <Tab label=\"Encoding\" tabId=\"encoding\" />}\n <Tab label=\"Options\" tabId=\"option\" />\n {eventSection && <Tab label=\"Events\" tabId=\"event\" />}\n {themeSection && <Tab label=\"Themes\" tabId=\"theme\" />}\n {conceptsSection && <Tab label=\"Concepts\" tabId=\"concepts\" />}\n </DockingTabBar>\n <div\n style={{\n padding: '0 30px 30px',\n marginTop: '20px',\n }}\n ref={this.handleBodyMount}\n >\n {body}\n </div>\n </APIPage>\n );\n }\n}\n\nexport default ComponentPage;\n", "\nimport * as defaultImport from \"react\";\nexport * from \"react\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"lodash\";\nexport * from \"lodash\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/react-docs/DockingTabBar\";\nexport * from \"@splunk/react-docs/DockingTabBar\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "\nimport * as defaultImport from \"@splunk/react-docs/API\";\nexport * from \"@splunk/react-docs/API\";\nexport default ('default' in defaultImport ? defaultImport.default : defaultImport);\n", "const previewVizMessage =\n '\u26A0\uFE0F This is a preview of a new visualization component. Minor updates and bug fixes should be expected.';\n\nexport default previewVizMessage;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AACA,oBAA+B;AAC/B,0BAAc;AACd,IAAO,gBAAS,aAAa,gBAA8B,wBAAU;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAA,iBAA+B;AAC/B,2BAAc;AACd,IAAO,iBAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,kCAAc;AACd,IAAO,wBAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE;AAAA;AAAA;AAAA;AACA,IAAAC,iBAA+B;AAC/B,wBAAc;AACd,IAAO,cAAS,aAAaA,iBAA8B,yBAAUA;;;ACHrE,IAAM,oBACF;AAEJ,IAAO,4BAAQ;;;ALwBf,IAAM,iBAAN,MAAM,uBAA4B,wBAAkD;AAAA,EAKhF,YAAY,MAAM;AACd,UAAM,IAAI;AAId,2BAAkB,QAAM;AACpB,WAAK,SAAS;AAAA,IAClB;AAEA,+BAAsB,CAAC,GAAG,EAAE,cAAc,MAAM;AAC5C,qBAAc,iBAAiB;AAC/B,WAAK,SAAS,EAAE,eAAe,cAAc,GAAG,MAAM;AAElD,cAAM,EAAE,IAAI,IAAI,KAAK,OAAO,sBAAsB;AAClD,YAAI,MAAM,OAAO,SAAS;AACtB,gBAAM,S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U,KAAK;AAAA;AAAA,MAEd,mBAAmB,4CAAC,6BAAI,OAAM,YAAW,OAAM,YAAW;AAAA,MAC3D,4CAAC,6BAAI,OAAM,YAAW,OAAM,YAAW;AAAA,MACtC,mBAAmB,4CAAC,6BAAI,OAAM,YAAW,OAAM,YAAW;AAAA,MAC3D,4CAAC,6BAAI,OAAM,WAAU,OAAM,UAAS;AAAA,MACnC,gBAAgB,4CAAC,6BAAI,OAAM,UAAS,OAAM,SAAQ;AAAA,MAClD,gBAAgB,4CAAC,6BAAI,OAAM,UAAS,OAAM,SAAQ;AAAA,MAClD,mBAAmB,4CAAC,6BAAI,OAAM,YAAW,OAAM,YAAW;AAAA,IAC/D,GACA;AAAA,MAAC;AAAA;AAAA,QACG,OAAO;AAAA,UACH,SAAS;AAAA,UACT,WAAW;AAAA,QACf;AAAA,QACA,KAAK,KAAK;AAAA;AAAA,MAET;AAAA,IACL,CACJ;AAAA,EAER;AACJ;AAhHM,eACa,iBAAiB;AADpC,IAAM,gBAAN;AAkHA,IAAO,+BAAQ;",
|
|
6
6
|
"names": ["defaultImport", "defaultImport", "defaultImport"]
|
|
7
7
|
}
|
package/iconUtils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export function isRemoteIcon(icon?: any): boolean;
|
|
2
2
|
export function isDataURI(icon?: any): any;
|
|
3
|
+
export function isRelativeUrlPath(icon?: any): boolean;
|
|
3
4
|
export function shouldChangeFill({ fillAttr, fillStyle, strokeAttr, strokeStyle }: {
|
|
4
5
|
fillAttr: any;
|
|
5
6
|
fillStyle: any;
|
package/iconUtils.js
CHANGED
|
@@ -24,6 +24,7 @@ var iconUtils_exports = {};
|
|
|
24
24
|
__export(iconUtils_exports, {
|
|
25
25
|
b64EncodeUnicode: () => b64EncodeUnicode,
|
|
26
26
|
isDataURI: () => isDataURI,
|
|
27
|
+
isRelativeUrlPath: () => isRelativeUrlPath,
|
|
27
28
|
isRemoteIcon: () => isRemoteIcon,
|
|
28
29
|
shouldChangeFill: () => shouldChangeFill,
|
|
29
30
|
shouldChangeStroke: () => shouldChangeStroke
|
|
@@ -31,6 +32,12 @@ __export(iconUtils_exports, {
|
|
|
31
32
|
module.exports = __toCommonJS(iconUtils_exports);
|
|
32
33
|
var isRemoteIcon = (icon = "") => icon.indexOf("://") > -1;
|
|
33
34
|
var isDataURI = (icon = "") => icon.startsWith("data:image/svg+xml;base64");
|
|
35
|
+
var isRelativeUrlPath = (icon = "") => {
|
|
36
|
+
if (!icon || typeof icon !== "string") {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
return icon.startsWith("/") && icon.indexOf("://") === -1;
|
|
40
|
+
};
|
|
34
41
|
var shouldChangeFill = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {
|
|
35
42
|
const noneFillAttr = !!fillAttr && (fillAttr === "none" || fillAttr === "transparent");
|
|
36
43
|
const noneFillStyle = !!fillStyle && (fillStyle === "none" || fillStyle === "transparent");
|
package/iconUtils.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["src/iconUtils.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * check if an icon is considered as remote icon\n * @param {*} icon\n */\nexport const isRemoteIcon = (icon = '') => icon.indexOf('://') > -1;\n\n/**\n * check if an icon is a dataURI\n * @param {*} icon\n */\nexport const isDataURI = (icon = '') => icon.startsWith('data:image/svg+xml;base64');\n\n/*\n * check whether need update fill for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove fill style and change the fill attribute <path fill=\"currentColor\" />\n */\nexport const shouldChangeFill = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneFillAttr = !!fillAttr && (fillAttr === 'none' || fillAttr === 'transparent');\n const noneFillStyle = !!fillStyle && (fillStyle === 'none' || fillStyle === 'transparent');\n const noFillHasStroke = !fillAttr && !fillStyle && (!!strokeAttr || !!strokeStyle);\n return !(noneFillAttr || noneFillStyle || noFillHasStroke);\n};\n\n/*\n * check whether need update stroke for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove stroke style and change the stroke attribute <path stroke=\"currentColor\" />\n */\nexport const shouldChangeStroke = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneStrokeAttr = !!strokeAttr && (strokeAttr === 'none' || strokeAttr === 'transparent');\n const noneStrokeStyle = !!strokeStyle && (strokeStyle === 'none' || strokeStyle === 'transparent');\n const hasFill = !!fillAttr || !!fillStyle;\n const noStroke = !strokeAttr && !strokeStyle;\n return !(noneStrokeAttr || noneStrokeStyle || hasFill || noStroke);\n};\n\n/*\n * base64 encoding\n * @param {String} str\n * @return {Base64} string using based-64 encoding\n */\nexport const b64EncodeUnicode = str =>\n // first we use encodeURIComponent to get percent-encoded UTF-8,\n // then we convert the percent encodings into raw bytes which\n // can be fed into btoa.\n btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode(`0x${p1}`)));\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAM,eAAe,CAAC,OAAO,OAAO,KAAK,QAAQ,KAAK,IAAI;AAM1D,IAAM,YAAY,CAAC,OAAO,OAAO,KAAK,WAAW,2BAA2B;
|
|
4
|
+
"sourcesContent": ["/**\n * check if an icon is considered as remote icon\n * @param {*} icon\n */\nexport const isRemoteIcon = (icon = '') => icon.indexOf('://') > -1;\n\n/**\n * check if an icon is a dataURI\n * @param {*} icon\n */\nexport const isDataURI = (icon = '') => icon.startsWith('data:image/svg+xml;base64');\n\n/**\n * check if an icon is a relative URL path (e.g., /static/app/myapp/icon.svg)\n * @param {*} icon\n */\nexport const isRelativeUrlPath = (icon = '') => {\n if (!icon || typeof icon !== 'string') {\n return false;\n }\n // Check if it starts with / and doesn't already have a protocol\n return icon.startsWith('/') && icon.indexOf('://') === -1;\n};\n\n/*\n * check whether need update fill for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove fill style and change the fill attribute <path fill=\"currentColor\" />\n */\nexport const shouldChangeFill = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneFillAttr = !!fillAttr && (fillAttr === 'none' || fillAttr === 'transparent');\n const noneFillStyle = !!fillStyle && (fillStyle === 'none' || fillStyle === 'transparent');\n const noFillHasStroke = !fillAttr && !fillStyle && (!!strokeAttr || !!strokeStyle);\n return !(noneFillAttr || noneFillStyle || noFillHasStroke);\n};\n\n/*\n * check whether need update stroke for svg children elements\n * @params {Object} style\n * @params {String} style.fillAttr <path fill=\"red\" .../>\n * @params {String} style.fillStyle. <path style=\"fill: red;\" />\n * @params {String} style.strokeAttr. <path stroke=\"red\" .../>\n * @params {String} style.strokeStyle <path style=\"stroke: red;\" .../>\n * @returns {Boolean} true means need\n * remove stroke style and change the stroke attribute <path stroke=\"currentColor\" />\n */\nexport const shouldChangeStroke = ({ fillAttr, fillStyle, strokeAttr, strokeStyle }) => {\n const noneStrokeAttr = !!strokeAttr && (strokeAttr === 'none' || strokeAttr === 'transparent');\n const noneStrokeStyle = !!strokeStyle && (strokeStyle === 'none' || strokeStyle === 'transparent');\n const hasFill = !!fillAttr || !!fillStyle;\n const noStroke = !strokeAttr && !strokeStyle;\n return !(noneStrokeAttr || noneStrokeStyle || hasFill || noStroke);\n};\n\n/*\n * base64 encoding\n * @param {String} str\n * @return {Base64} string using based-64 encoding\n */\nexport const b64EncodeUnicode = str =>\n // first we use encodeURIComponent to get percent-encoded UTF-8,\n // then we convert the percent encodings into raw bytes which\n // can be fed into btoa.\n btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode(`0x${p1}`)));\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAM,eAAe,CAAC,OAAO,OAAO,KAAK,QAAQ,KAAK,IAAI;AAM1D,IAAM,YAAY,CAAC,OAAO,OAAO,KAAK,WAAW,2BAA2B;AAM5E,IAAM,oBAAoB,CAAC,OAAO,OAAO;AAC5C,MAAI,CAAC,QAAQ,OAAO,SAAS,UAAU;AACnC,WAAO;AAAA,EACX;AAEA,SAAO,KAAK,WAAW,GAAG,KAAK,KAAK,QAAQ,KAAK,MAAM;AAC3D;AAYO,IAAM,mBAAmB,CAAC,EAAE,UAAU,WAAW,YAAY,YAAY,MAAM;AAClF,QAAM,eAAe,CAAC,CAAC,aAAa,aAAa,UAAU,aAAa;AACxE,QAAM,gBAAgB,CAAC,CAAC,cAAc,cAAc,UAAU,cAAc;AAC5E,QAAM,kBAAkB,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,CAAC;AACtE,SAAO,EAAE,gBAAgB,iBAAiB;AAC9C;AAYO,IAAM,qBAAqB,CAAC,EAAE,UAAU,WAAW,YAAY,YAAY,MAAM;AACpF,QAAM,iBAAiB,CAAC,CAAC,eAAe,eAAe,UAAU,eAAe;AAChF,QAAM,kBAAkB,CAAC,CAAC,gBAAgB,gBAAgB,UAAU,gBAAgB;AACpF,QAAM,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC;AAChC,QAAM,WAAW,CAAC,cAAc,CAAC;AACjC,SAAO,EAAE,kBAAkB,mBAAmB,WAAW;AAC7D;AAOO,IAAM,mBAAmB;AAAA;AAAA;AAAA;AAAA,EAI5B,KAAK,mBAAmB,GAAG,EAAE,QAAQ,mBAAmB,CAAC,OAAO,OAAO,OAAO,aAAa,KAAK,EAAE,EAAE,CAAC,CAAC;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Visualizations Shared Files",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"author": "Splunk",
|
|
6
|
-
"version": "28.
|
|
6
|
+
"version": "28.3.0",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "viz-build",
|
|
9
9
|
"build-storybook": "sb build -c .storybook -o .storybook-bundle",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"@splunk/moment": "^0.7.0",
|
|
31
31
|
"@splunk/react-icons": "^5.3.0",
|
|
32
32
|
"@splunk/react-ui": "^5.3.0",
|
|
33
|
-
"@splunk/themes": "^1.
|
|
34
|
-
"@splunk/ui-utils": "^1.
|
|
35
|
-
"@splunk/visualization-encoding": "^28.
|
|
36
|
-
"@splunk/visualization-schemas": "^28.
|
|
33
|
+
"@splunk/themes": "^1.3.0",
|
|
34
|
+
"@splunk/ui-utils": "^1.11.0",
|
|
35
|
+
"@splunk/visualization-encoding": "^28.3.0",
|
|
36
|
+
"@splunk/visualization-schemas": "^28.3.0",
|
|
37
37
|
"element-resize-detector": "^1.2.4",
|
|
38
38
|
"lodash": "^4.17.21",
|
|
39
39
|
"numeral": "^2.0.6",
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"xmlserializer": "^0.6.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@splunk/visualization-context": "^28.
|
|
44
|
+
"@splunk/visualization-context": "^28.3.0",
|
|
45
45
|
"react": "^18.3.1",
|
|
46
46
|
"react-dom": "^18.3.1",
|
|
47
47
|
"styled-components": "^5.3.10"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@splunk/react-docs": "^1.3.0",
|
|
51
|
-
"@splunk/visualization-build-tools": "^28.
|
|
52
|
-
"@splunk/visualization-context": "^28.
|
|
51
|
+
"@splunk/visualization-build-tools": "^28.3.0",
|
|
52
|
+
"@splunk/visualization-context": "^28.3.0",
|
|
53
53
|
"@storybook/addon-actions": "^7.6.20",
|
|
54
54
|
"@storybook/addons": "^7.6.20",
|
|
55
55
|
"@storybook/react": "^7.6.20",
|