@carbon/charts 0.29.7 → 0.29.8

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/tools.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["tools.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EACN,QAAQ,IAAI,cAAc,EAC1B,KAAK,IAAI,WAAW,EACpB,SAAS,IAAI,eAAe,EAC5B,IAAI,IAAI,YAAY,EAIpB,MAAM,WAAW,CAAC;AAEnB,YAAY;AACZ,MAAM,KAAW,KAAK,CAgNrB;AAhND,WAAiB,KAAK;IACrB,qCAAqC;IACxB,cAAQ,GAAG,cAAc,CAAC;IAC1B,WAAK,GAAG,eAAe,CAAC;IACxB,WAAK,GAAG,WAAW,CAAC;IACpB,2BAAqB,GAAG,YAAY,CAAC;IAElD;;2CAEuC;IAEvC;;;;;;OAMG;IACH,SAAgB,aAAa,CAAC,EAAE;QAC/B,OAAO;YACN,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC;YACrE,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC;SACxE,CAAC;IACH,CAAC;IALe,mBAAa,gBAK5B,CAAA;IAED;;;;OAIG;IACH,SAAgB,oBAAoB,CAAC,UAAuB;QAC3D,uFAAuF;QACvF,IAAM,cAAc,GAAG,8CAA8C,CAAC;QAEtE,IAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAChF,sBAAsB;QACtB,IAAI,YAAY,CAA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;IAC5B,CAAC,CAAC;IAEW,2BAAqB,GAAG,UAAC,mBAAuC,EAAE,WAAmC;QAC3G,IAAA,iFAA2F,EAAzF,UAAE,EAAE,UAAE,EAAE,UAAE,EAAE,UAA6E,CAAC;QAElG,OAAO,MAAI,EAAE,SAAI,EAAE,SAAI,EAAE,SAAI,EAAE,SAAI,EAAE,SAAI,EAAE,SAAI,EAAE,SAAI,EAAE,SAAI,EAAE,SAAI,EAAI,CAAC;IACvE,CAAC,CAAC;AACH,CAAC,EAhNgB,KAAK,KAAL,KAAK,QAgNrB","sourcesContent":["// Internal imports\nimport { CartesianOrientations } from \"./interfaces\";\n\nimport {\n\tdebounce as lodashDebounce,\n\tmerge as lodashMerge,\n\tcloneDeep as lodashCloneDeep,\n\tuniq as lodashUnique,\n\t// the imports below are needed because of typescript bug (error TS4029)\n\tCancelable,\n\tDebounceSettings\n} from \"lodash-es\";\n\n// Functions\nexport namespace Tools {\n\t// Export these functions from lodash\n\texport const debounce = lodashDebounce;\n\texport const clone = lodashCloneDeep;\n\texport const merge = lodashMerge;\n\texport const removeArrayDuplicates = lodashUnique;\n\n\t/**************************************\n\t * DOM-related operations *\n\t *************************************/\n\n\t/**\n\t * Get width & height of an element\n\t *\n\t * @export\n\t * @param {any} el element to get dimensions from\n\t * @returns an object containing the width and height of el\n\t */\n\texport function getDimensions(el) {\n\t\treturn {\n\t\t\twidth: parseFloat(el.style.width.replace(\"px\", \"\") || el.offsetWidth),\n\t\t\theight: parseFloat(el.style.height.replace(\"px\", \"\") || el.offsetHeight)\n\t\t};\n\t}\n\n\t/**\n\t * Returns an elements's x and y translations from attribute transform\n\t * @param {HTMLElement} element\n\t * @returns an object containing the x and y translations or null\n\t */\n\texport function getTranslationValues(elementRef: HTMLElement) {\n\t\t// regex to ONLY get values for translate (instead of all rotate, translate, skew, etc)\n\t\tconst translateRegex = /translate\\([0-9]+\\.?[0-9]*,[0-9]+\\.?[0-9]*\\)/;\n\n\t\tconst transformStr = elementRef.getAttribute(\"transform\").match(translateRegex);\n\t\t// check for the match\n\t\tif (transformStr[0]) {\n\t\t\tconst transforms = transformStr[0].replace(/translate\\(/, \"\").replace(/\\)/, \"\").split(\",\");\n\n\t\t\treturn {\n\t\t\t\t\ttx: transforms[0],\n\t\t\t\t\tty: transforms[1]\n\t\t\t\t};\n\t\t}\n\t\treturn null;\n\t}\n\n\t/**************************************\n\t * Formatting & calculations *\n\t *************************************/\n\n\t/**\n\t * Gets x and y coordinates from a HTML transform attribute\n\t *\n\t * @export\n\t * @param {any} string the transform attribute string ie. transform(x,y)\n\t * @returns Returns an object with x and y offsets of the transform\n\t */\n\texport function getTranformOffsets(string) {\n\t\tconst regExp = /\\(([^)]+)\\)/;\n\t\tconst match = regExp.exec(string)[1];\n\t\tconst xyString = match.split(\",\");\n\n\t\treturn {\n\t\t\tx: parseFloat(xyString[0]),\n\t\t\ty: parseFloat(xyString[1])\n\t\t};\n\t}\n\n\t/**\n\t * Capitalizes first letter of a string\n\t *\n\t * @export\n\t * @param {any} string the string whose first letter you'd like to capitalize\n\t * @returns The input string with its first letter capitalized\n\t */\n\texport function capitalizeFirstLetter(string) {\n\t\treturn string[0].toUpperCase() + string.slice(1);\n\t}\n\n\t/**\n\t * Get the percentage of a datapoint compared to the entire data-set.\n\t * Returns 1 significant digit if percentage is less than 1%.\n\t * @export\n\t * @param {any} item\n\t * @param {any} fullData\n\t * @returns The percentage in the form of a number\n\t */\n\texport function convertValueToPercentage(item, fullData) {\n\t\tconst percentage = item / fullData.reduce((accum, val) => accum + val.value, 0) * 100;\n\t\treturn percentage < 1 ? percentage.toPrecision(1) : Math.floor(percentage);\n\t}\n\n\t/**************************************\n\t * Object/array related checks *\n\t *************************************/\n\t/**\n\t * Get the difference between two arrays' items\n\t *\n\t * @export\n\t * @param {any[]} oldArray\n\t * @param {any[]} newArray\n\t * @returns The items missing in newArray from oldArray, and items added to newArray compared to oldArray\n\t */\n\texport function arrayDifferences(oldArray: any[], newArray: any[]) {\n\t\tconst difference = {\n\t\t\tmissing: [],\n\t\t\tadded: []\n\t\t};\n\n\t\toldArray.forEach(element => {\n\t\t\tif (newArray.indexOf(element) === -1) {\n\t\t\t\tdifference.missing.push(element);\n\t\t\t}\n\t\t});\n\n\t\tnewArray.forEach(element => {\n\t\t\tif (oldArray.indexOf(element) === -1) {\n\t\t\t\tdifference.added.push(element);\n\t\t\t}\n\t\t});\n\n\t\treturn difference;\n\t}\n\n\t/**\n\t * Lists out the duplicated keys in an array of data\n\t *\n\t * @export\n\t * @param {*} data - array of data\n\t * @returns A list of the duplicated keys in data\n\t */\n\texport function getDuplicateValues(arr: any) {\n\t\tconst values = [];\n\t\tconst duplicateValues = [];\n\n\t\tarr.forEach(value => {\n\t\t\tif (values.indexOf(value) !== -1 && duplicateValues.indexOf(value) === -1) {\n\t\t\t\tduplicateValues.push(value);\n\t\t\t}\n\n\t\t\tvalues.push(value);\n\t\t});\n\n\t\treturn duplicateValues;\n\t}\n\n\t// ================================================================================\n\t// D3 Extensions\n\t// ================================================================================\n\t/**\n\t * In D3, moves an element to the front of the canvas\n\t *\n\t * @export\n\t * @param {any} element\n\t * @returns The function to be used by D3 to push element to the top of the canvas\n\t */\n\texport function moveToFront(element) {\n\t\treturn element.each(function() {\n\t\t\tthis.parentNode.appendChild(this);\n\t\t});\n\t}\n\n\t// ================================================================================\n\t// Style Helpers\n\t// ================================================================================\n\n\texport const getProperty = (object, ...propPath) => {\n\t\tlet position = object;\n\t\tif (position) {\n\t\t\tfor (const prop of propPath) {\n\t\t\t\tif (position[prop] !== null && position[prop] !== undefined) {\n\t\t\t\t\tposition = position[prop];\n\t\t\t\t} else {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn position;\n\t\t}\n\n\t\treturn null;\n\t};\n\n\tinterface SVGPathCoordinates {\n\t\tx0: number;\n\t\tx1: number;\n\t\ty0: number;\n\t\ty1: number;\n\t}\n\n\texport const flipSVGCoordinatesBasedOnOrientation = (verticalCoordinates: SVGPathCoordinates, orientation?: CartesianOrientations) => {\n\t\tif (orientation === CartesianOrientations.HORIZONTAL) {\n\t\t\treturn {\n\t\t\t\ty0: verticalCoordinates.x0,\n\t\t\t\ty1: verticalCoordinates.x1,\n\t\t\t\tx0: verticalCoordinates.y0,\n\t\t\t\tx1: verticalCoordinates.y1\n\t\t\t};\n\t\t}\n\n\t\treturn verticalCoordinates;\n\t};\n\n\texport const generateSVGPathString = (verticalCoordinates: SVGPathCoordinates, orientation?: CartesianOrientations) => {\n\t\tconst { x0, x1, y0, y1 } = flipSVGCoordinatesBasedOnOrientation(verticalCoordinates, orientation);\n\n\t\treturn `M${x0},${y0}L${x0},${y1}L${x1},${y1}L${x1},${y0}L${x0},${y0}`;\n\t};\n}\n"]}
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["tools.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EACN,QAAQ,IAAI,cAAc,EAC1B,KAAK,IAAI,WAAW,EACpB,SAAS,IAAI,eAAe,EAC5B,IAAI,IAAI,YAAY,EACpB,KAAK,IAAI,WAAW,EAIpB,MAAM,WAAW,CAAC;AAEnB,YAAY;AACZ,MAAM,KAAW,KAAK,CAiNrB;AAjND,WAAiB,KAAK;IACrB,qCAAqC;IACxB,cAAQ,GAAG,cAAc,CAAC;IAC1B,WAAK,GAAG,eAAe,CAAC;IACxB,WAAK,GAAG,WAAW,CAAC;IACpB,2BAAqB,GAAG,YAAY,CAAC;IACrC,WAAK,GAAG,WAAW,CAAC;IAEjC;;2CAEuC;IAEvC;;;;;;OAMG;IACH,SAAgB,aAAa,CAAC,EAAE;QAC/B,OAAO;YACN,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC;YACrE,MAAM,EAAE,UAAU,CAAC,EAAE,C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D,OAAO,QAAQ,CAAC;SAChB;QAED,OAAO,IAAI,CAAC;IACb,CAAC,CAAC;IASW,0CAAoC,GAAG,UAAC,mBAAuC,EAAE,WAAmC;QAChI,IAAI,WAAW,KAAK,qBAAqB,CAAC,UAAU,EAAE;YACrD,OAAO;gBACN,EAAE,EAAE,mBAAmB,CAAC,EAAE;gBAC1B,EAAE,EAAE,mBAAmB,CAAC,EAAE;gBAC1B,EAAE,EAAE,mBAAmB,CAAC,EAAE;gBAC1B,EAAE,EAAE,mBAAmB,CAAC,EAAE;aAC1B,CAAC;SACF;QAED,OAAO,mBAAmB,CAAC;IAC5B,CAAC,CAAC;IAEW,2BAAqB,GAAG,UAAC,mBAAuC,EAAE,WAAmC;QAC3G,IAAA,iFAA2F,EAAzF,UAAE,EAAE,UAAE,EAAE,UAAE,EAAE,UAA6E,CAAC;QAElG,OAAO,MAAI,EAAE,SAAI,EAAE,SAAI,EAAE,SAAI,EAAE,SAAI,EAAE,SAAI,EAAE,SAAI,EAAE,SAAI,EAAE,SAAI,EAAE,SAAI,EAAI,CAAC;IACvE,CAAC,CAAC;AACH,CAAC,EAjNgB,KAAK,KAAL,KAAK,QAiNrB","sourcesContent":["// Internal imports\nimport { CartesianOrientations } from \"./interfaces\";\n\nimport {\n\tdebounce as lodashDebounce,\n\tmerge as lodashMerge,\n\tcloneDeep as lodashCloneDeep,\n\tuniq as lodashUnique,\n\tclamp as lodashClamp,\n\t// the imports below are needed because of typescript bug (error TS4029)\n\tCancelable,\n\tDebounceSettings\n} from \"lodash-es\";\n\n// Functions\nexport namespace Tools {\n\t// Export these functions from lodash\n\texport const debounce = lodashDebounce;\n\texport const clone = lodashCloneDeep;\n\texport const merge = lodashMerge;\n\texport const removeArrayDuplicates = lodashUnique;\n\texport const clamp = lodashClamp;\n\n\t/**************************************\n\t * DOM-related operations *\n\t *************************************/\n\n\t/**\n\t * Get width & height of an element\n\t *\n\t * @export\n\t * @param {any} el element to get dimensions from\n\t * @returns an object containing the width and height of el\n\t */\n\texport function getDimensions(el) {\n\t\treturn {\n\t\t\twidth: parseFloat(el.style.width.replace(\"px\", \"\") || el.offsetWidth),\n\t\t\theight: parseFloat(el.style.height.replace(\"px\", \"\") || el.offsetHeight)\n\t\t};\n\t}\n\n\t/**\n\t * Returns an elements's x and y translations from attribute transform\n\t * @param {HTMLElement} element\n\t * @returns an object containing the x and y translations or null\n\t */\n\texport function getTranslationValues(elementRef: HTMLElement) {\n\t\t// regex to ONLY get values for translate (instead of all rotate, translate, skew, etc)\n\t\tconst translateRegex = /translate\\([0-9]+\\.?[0-9]*,[0-9]+\\.?[0-9]*\\)/;\n\n\t\tconst transformStr = elementRef.getAttribute(\"transform\").match(translateRegex);\n\t\t// check for the match\n\t\tif (transformStr[0]) {\n\t\t\tconst transforms = transformStr[0].replace(/translate\\(/, \"\").replace(/\\)/, \"\").split(\",\");\n\n\t\t\treturn {\n\t\t\t\ttx: transforms[0],\n\t\t\t\tty: transforms[1]\n\t\t\t};\n\t\t}\n\t\treturn null;\n\t}\n\n\t/**************************************\n\t * Formatting & calculations *\n\t *************************************/\n\n\t/**\n\t * Gets x and y coordinates from a HTML transform attribute\n\t *\n\t * @export\n\t * @param {any} string the transform attribute string ie. transform(x,y)\n\t * @returns Returns an object with x and y offsets of the transform\n\t */\n\texport function getTranformOffsets(string) {\n\t\tconst regExp = /\\(([^)]+)\\)/;\n\t\tconst match = regExp.exec(string)[1];\n\t\tconst xyString = match.split(\",\");\n\n\t\treturn {\n\t\t\tx: parseFloat(xyString[0]),\n\t\t\ty: parseFloat(xyString[1])\n\t\t};\n\t}\n\n\t/**\n\t * Capitalizes first letter of a string\n\t *\n\t * @export\n\t * @param {any} string the string whose first letter you'd like to capitalize\n\t * @returns The input string with its first letter capitalized\n\t */\n\texport function capitalizeFirstLetter(string) {\n\t\treturn string[0].toUpperCase() + string.slice(1);\n\t}\n\n\t/**\n\t * Get the percentage of a datapoint compared to the entire data-set.\n\t * Returns 1 significant digit if percentage is less than 1%.\n\t * @export\n\t * @param {any} item\n\t * @param {any} fullData\n\t * @returns The percentage in the form of a number\n\t */\n\texport function convertValueToPercentage(item, fullData) {\n\t\tconst percentage = item / fullData.reduce((accum, val) => accum + val.value, 0) * 100;\n\t\treturn percentage < 1 ? percentage.toPrecision(1) : Math.floor(percentage);\n\t}\n\n\t/**************************************\n\t * Object/array related checks *\n\t *************************************/\n\t/**\n\t * Get the difference between two arrays' items\n\t *\n\t * @export\n\t * @param {any[]} oldArray\n\t * @param {any[]} newArray\n\t * @returns The items missing in newArray from oldArray, and items added to newArray compared to oldArray\n\t */\n\texport function arrayDifferences(oldArray: any[], newArray: any[]) {\n\t\tconst difference = {\n\t\t\tmissing: [],\n\t\t\tadded: []\n\t\t};\n\n\t\toldArray.forEach(element => {\n\t\t\tif (newArray.indexOf(element) === -1) {\n\t\t\t\tdifference.missing.push(element);\n\t\t\t}\n\t\t});\n\n\t\tnewArray.forEach(element => {\n\t\t\tif (oldArray.indexOf(element) === -1) {\n\t\t\t\tdifference.added.push(element);\n\t\t\t}\n\t\t});\n\n\t\treturn difference;\n\t}\n\n\t/**\n\t * Lists out the duplicated keys in an array of data\n\t *\n\t * @export\n\t * @param {*} data - array of data\n\t * @returns A list of the duplicated keys in data\n\t */\n\texport function getDuplicateValues(arr: any) {\n\t\tconst values = [];\n\t\tconst duplicateValues = [];\n\n\t\tarr.forEach(value => {\n\t\t\tif (values.indexOf(value) !== -1 && duplicateValues.indexOf(value) === -1) {\n\t\t\t\tduplicateValues.push(value);\n\t\t\t}\n\n\t\t\tvalues.push(value);\n\t\t});\n\n\t\treturn duplicateValues;\n\t}\n\n\t// ================================================================================\n\t// D3 Extensions\n\t// ================================================================================\n\t/**\n\t * In D3, moves an element to the front of the canvas\n\t *\n\t * @export\n\t * @param {any} element\n\t * @returns The function to be used by D3 to push element to the top of the canvas\n\t */\n\texport function moveToFront(element) {\n\t\treturn element.each(function() {\n\t\t\tthis.parentNode.appendChild(this);\n\t\t});\n\t}\n\n\t// ================================================================================\n\t// Style Helpers\n\t// ================================================================================\n\n\texport const getProperty = (object, ...propPath) => {\n\t\tlet position = object;\n\t\tif (position) {\n\t\t\tfor (const prop of propPath) {\n\t\t\t\tif (position[prop] !== null && position[prop] !== undefined) {\n\t\t\t\t\tposition = position[prop];\n\t\t\t\t} else {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn position;\n\t\t}\n\n\t\treturn null;\n\t};\n\n\tinterface SVGPathCoordinates {\n\t\tx0: number;\n\t\tx1: number;\n\t\ty0: number;\n\t\ty1: number;\n\t}\n\n\texport const flipSVGCoordinatesBasedOnOrientation = (verticalCoordinates: SVGPathCoordinates, orientation?: CartesianOrientations) => {\n\t\tif (orientation === CartesianOrientations.HORIZONTAL) {\n\t\t\treturn {\n\t\t\t\ty0: verticalCoordinates.x0,\n\t\t\t\ty1: verticalCoordinates.x1,\n\t\t\t\tx0: verticalCoordinates.y0,\n\t\t\t\tx1: verticalCoordinates.y1\n\t\t\t};\n\t\t}\n\n\t\treturn verticalCoordinates;\n\t};\n\n\texport const generateSVGPathString = (verticalCoordinates: SVGPathCoordinates, orientation?: CartesianOrientations) => {\n\t\tconst { x0, x1, y0, y1 } = flipSVGCoordinatesBasedOnOrientation(verticalCoordinates, orientation);\n\n\t\treturn `M${x0},${y0}L${x0},${y1}L${x1},${y1}L${x1},${y0}L${x0},${y0}`;\n\t};\n}\n"]}
@@ -258,12 +258,12 @@
258
258
  "signature": "c1d29c071815e56e4fade9f22bfe1fde035d4568ed416e802e220e33c360d11c"
259
259
  },
260
260
  "../src/tools.ts": {
261
- "version": "67aec747f987cd6e19512aa50fd20e75b519639004d254d703eb8d79e9b16824",
262
- "signature": "3edd240f2ce70c091314455e57e8dece4d35f29cc4b675d526481cab575bede6"
261
+ "version": "dbc5b82beb470a1de8e66174f161b0f8a8830e3ea792112e99a37042329a3a68",
262
+ "signature": "710f1aebe8386c60441d21ed52fa29f4f15b5a94b90771840ac663f22ae8183e"
263
263
  },
264
264
  "../src/configuration.ts": {
265
- "version": "1859250abf6da2552a4f8c212a3561d9d5821c2914b97754045736483899aaad",
266
- "signature": "d0cf7d5d839a946b0f624eb7ea9ab0a2c27fb4a38a8723f8d2568fa96ec556f1"
265
+ "version": "d09fbe8b102736e4fbd2d873aa5c73f3757e14aeb9a005fb8bbe9da17cef69e5",
266
+ "signature": "af3bce871faaf063dea15a1c3a04a46956898a4f30fd2163769a1d70268e9b99"
267
267
  },
268
268
  "../src/services/colors.ts": {
269
269
  "version": "876e70c314f9650ac7c738ed5b3cf43752b1d7f85fc4ab07344be8b495bb2076",
@@ -409,8 +409,8 @@
409
409
  "signature": "a05ec18c3100223e4e2b3dffad44b07bf81cf75c51aa541a08d43be4a0221ecd"
410
410
  },
411
411
  "../src/components/axes/axis.ts": {
412
- "version": "51b15620b6f4403bd0411b4d7d9684658e94e4177deb75695597eaea7fe98de6",
413
- "signature": "9f5b497c91bf9068a6d1db498b53f2e42943fce70ced2b443fbe5ea4dbc68ac5"
412
+ "version": "059918b2adc14d2fdda9e1c9980dbdf1b41b7d0afb88ede5c4771eb731c2f10d",
413
+ "signature": "04ee35d144b03e581383da4b2fae10d9764d171a862958f20f0a29a909ee574e"
414
414
  },
415
415
  "../src/components/axes/two-dimensional-axes.ts": {
416
416
  "version": "32b1dc1d6b0f5bc1e0af134a391b6c409b184701b90943b13554dedf80e685f5",