{"version":3,"sources":["webpack:///./src/js/components/stats-graph.js","webpack:///./node_modules/moment/locale sync ^\\.\\/.*$","webpack:///./src/js/components/data-viz.js"],"names":["colors","orange","normal","light","blue","green","purple","pink","StatsGraph","_Component","_classCallCheck","_callSuper","arguments","_inherits","key","value","_this","this","dom","$canvas","el","_$","$canvasContext","getContext","chartColor","dataset","chartType","chartValue","chartLabels","chart","observer","window","IntersectionObserver","entries","forEach","entry","isIntersecting","setTimeout","initGraph","bind","threshold","observe","_this$chartValue$spli2","_slicedToArray","split","map","Number","value1","value2","_this$chartColor$spli","color","_color$trim$split2","trim","_this$chartColor$spli2","_this$chartColor$spli3","color1","variation1","_this$chartColor$spli4","color2","variation2","data","backgroundColor","maxBarThickness","fonts","fontSize","fontFamily","scales","xAxes","stacked","gridLines","lineWidth","ticks","_objectSpread","yAxes","offsetGridLines","drawBorder","beginAtZero","maxTicksLimit","display","label","Chart","type","getType","labels","getLabels","datasets","getData","options","animation","duration","responsive","scaleLabel","hover","mode","aspectRatio","legend","tooltips","enabled","position","getScales","Component","webpackContext","req","id","webpackContextResolve","__webpack_require__","o","e","Error","code","keys","Object","resolve","module","exports","DataViz","$wrapper","$list","$points","_$$","$bulletWithoutColor","values","setPointsColor","moveDOM","point","_point$dataset$color$2","variation","style","_this$dom","insertAfter","colorCode","includes","_colorCode$split2","maintainAspectRatio"],"mappings":"m9GAGO,IAAMA,EAAS,CACpBC,OAAQ,CACNC,OAAQ,UACRC,MAAO,WAETC,KAAM,CACJF,OAAQ,UACRC,MAAO,WAETE,MAAO,CACLH,OAAQ,UACRC,MAAO,WAETG,OAAQ,CACNJ,OAAQ,UACRC,MAAO,WAETI,KAAM,CACJL,OAAQ,UACRC,MAAO,YAILK,EAAU,SAAAC,GAAA,SAAAD,IAAA,OAAAE,EAAA,KAAAF,GAAAG,EAAA,KAAAH,EAAAI,WAAA,O,qRAAAC,CAAAL,EAAAC,G,EAAAD,G,EAAA,EAAAM,IAAA,gBAAAC,MACd,WAAgB,I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,CAAAtG,IAAA,YAAAC,MAED,WACE,IAAQO,EAAmBL,KAAKC,IAAxBI,eAERL,KAAKY,MAAQ,IAAImD,IAAM1D,EAAgB,CACrC2D,KAAMhE,KAAKgE,KACXrB,KAAM,CACJyB,SAAU,CACR,CACEzB,KAAM3C,KAAKwG,OAAO7E,MAAM,KAAKC,IAAIC,QACjCe,gBAAiB5C,KAAKjB,OAAO4C,MAAM,KAAKC,KAAI,SAACK,GAC3C,IAAMgF,EAAYhF,EAAME,OAExB,GAAIF,EAAMiF,SAAS,KAAM,CACvB,IAA6CC,EAAAzF,EAApBuF,EAAUtF,MAAM,KAAI,GAAtC9B,EAAGsH,EAAA,GAAEN,EAASM,EAAA,GAErB,GAAItH,KAAOd,IACT,OAAOA,IAAOc,GAAKgH,GAIvB,OAAOI,QAKf3C,QAAS,CACPC,UAAW,CACTC,SAAU,KAEZC,YAAY,EACZ2C,qBAAqB,EACrB1C,WAAY,CACVb,SAAS,GAEXc,MAAO,CACLC,KAAM,MAERC,YAAa,EACbC,OAAQ,CACNjB,SAAS,GAEXkB,SAAU,CACRC,SAAS,GAEXxB,MAAO,CACL,CACEQ,KAAM,SACNiB,SAAU,iB,0FAjGT,CAASE,aAyGPe","file":"26.22a051.js","sourcesContent":["import { Component } from '@verndale/core';\r\nimport Chart from 'chart.js';\r\n\r\nexport const colors = {\r\n orange: {\r\n normal: '#F78842',\r\n light: '#FFDEC5'\r\n },\r\n blue: {\r\n normal: '#06A7DE',\r\n light: '#C9E5F7'\r\n },\r\n green: {\r\n normal: '#019A4B',\r\n light: '#C0DDC7'\r\n },\r\n purple: {\r\n normal: '#6F2981',\r\n light: '#CBBDD7'\r\n },\r\n pink: {\r\n normal: '#B94096',\r\n light: '#F0C7E0'\r\n }\r\n};\r\n\r\nclass StatsGraph extends Component {\r\n setupDefaults() {\r\n this.dom = {\r\n $canvas: this.el._$('.stats__canvas'),\r\n $canvasContext: this.el._$('.stats__canvas').getContext('2d')\r\n };\r\n\r\n this.chartColor = this.el.dataset.chartColor;\r\n this.chartType = this.el.dataset.chartType;\r\n this.chartValue = this.el.dataset.chartValue;\r\n this.chartLabels = this.el.dataset.chartLabels;\r\n this.chart = null;\r\n\r\n this.observer = new window.IntersectionObserver(\r\n (entries, observer) => {\r\n entries.forEach((entry) => {\r\n if (entry.isIntersecting && !this.chart) {\r\n setTimeout(::this.initGraph, 500);\r\n }\r\n });\r\n },\r\n {\r\n threshold: 1\r\n }\r\n );\r\n this.observer.observe(this.dom.$canvas);\r\n }\r\n\r\n getData() {\r\n const BAR_THICKNESS = 20;\r\n const MAX_VALUE = 100;\r\n const [value1, value2] = this.chartValue.split(',').map(Number);\r\n const value = Number(this.chartValue);\r\n\r\n if (this.chartType === 'double-bar') {\r\n const [\r\n [color1, variation1],\r\n [color2, variation2]\r\n ] = this.chartColor.split(',').map((color) => {\r\n const [c, variation] = color.trim().split('.');\r\n return [c, variation];\r\n });\r\n\r\n return [\r\n {\r\n data: [value1, value2],\r\n backgroundColor: [\r\n colors[color1][variation1],\r\n colors[color2][variation2]\r\n ],\r\n maxBarThickness: BAR_THICKNESS\r\n }\r\n ];\r\n }\r\n\r\n if (this.chartType === 'bar') {\r\n return [\r\n {\r\n data: [value],\r\n backgroundColor: colors[this.chartColor].normal,\r\n maxBarThickness: BAR_THICKNESS\r\n },\r\n {\r\n data: [MAX_VALUE - value],\r\n backgroundColor: colors[this.chartColor].light,\r\n maxBarThickness: BAR_THICKNESS\r\n }\r\n ];\r\n }\r\n\r\n return [\r\n {\r\n data: [value, MAX_VALUE - value],\r\n backgroundColor: [\r\n colors[this.chartColor].normal,\r\n colors[this.chartColor].light\r\n ]\r\n }\r\n ];\r\n }\r\n\r\n getScales() {\r\n const fonts = {\r\n fontSize: 12,\r\n fontFamily: 'Atlas Grotesk'\r\n };\r\n\r\n if (this.chartType === 'bar' || this.chartType === 'double-bar') {\r\n return {\r\n scales: {\r\n xAxes: [\r\n {\r\n stacked: true,\r\n gridLines: {\r\n lineWidth: 1\r\n },\r\n ticks: {\r\n ...fonts\r\n }\r\n }\r\n ],\r\n yAxes: [\r\n {\r\n stacked: true,\r\n gridLines: {\r\n lineWidth: 1,\r\n offsetGridLines: false,\r\n drawBorder: false\r\n },\r\n ticks: {\r\n beginAtZero: true,\r\n maxTicksLimit: 2,\r\n display: this.chartType === 'double-bar' ? false : true,\r\n ...fonts\r\n }\r\n }\r\n ]\r\n }\r\n };\r\n }\r\n\r\n return {};\r\n }\r\n\r\n getLabels() {\r\n if (this.chartType === 'double-bar') {\r\n return this.chartLabels.split(',').map((label) => label.trim());\r\n }\r\n\r\n return [];\r\n }\r\n\r\n getType() {\r\n if (this.chartType === 'double-bar') {\r\n return 'bar';\r\n }\r\n\r\n return this.chartType;\r\n }\r\n\r\n initGraph() {\r\n const { $canvasContext } = this.dom;\r\n\r\n this.chart = new Chart($canvasContext, {\r\n type: this.getType(),\r\n data: {\r\n labels: this.getLabels(),\r\n datasets: this.getData()\r\n },\r\n options: {\r\n animation: {\r\n duration: 2000\r\n },\r\n responsive: false,\r\n scaleLabel: {\r\n display: false\r\n },\r\n hover: {\r\n mode: null\r\n },\r\n aspectRatio: 1,\r\n legend: {\r\n display: false\r\n },\r\n tooltips: {\r\n enabled: false\r\n },\r\n yAxes: [\r\n {\r\n type: 'linear',\r\n position: 'left'\r\n }\r\n ],\r\n ...this.getScales()\r\n }\r\n });\r\n }\r\n}\r\n\r\nexport default StatsGraph;\r\n","var map = {\n\t\"./af\": 534,\n\t\"./af.js\": 534,\n\t\"./ar\": 535,\n\t\"./ar-dz\": 536,\n\t\"./ar-dz.js\": 536,\n\t\"./ar-kw\": 537,\n\t\"./ar-kw.js\": 537,\n\t\"./ar-ly\": 538,\n\t\"./ar-ly.js\": 538,\n\t\"./ar-ma\": 539,\n\t\"./ar-ma.js\": 539,\n\t\"./ar-ps\": 540,\n\t\"./ar-ps.js\": 540,\n\t\"./ar-sa\": 541,\n\t\"./ar-sa.js\": 541,\n\t\"./ar-tn\": 542,\n\t\"./ar-tn.js\": 542,\n\t\"./ar.js\": 535,\n\t\"./az\": 543,\n\t\"./az.js\": 543,\n\t\"./be\": 544,\n\t\"./be.js\": 544,\n\t\"./bg\": 545,\n\t\"./bg.js\": 545,\n\t\"./bm\": 546,\n\t\"./bm.js\": 546,\n\t\"./bn\": 547,\n\t\"./bn-bd\": 548,\n\t\"./bn-bd.js\": 548,\n\t\"./bn.js\": 547,\n\t\"./bo\": 549,\n\t\"./bo.js\": 549,\n\t\"./br\": 550,\n\t\"./br.js\": 550,\n\t\"./bs\": 551,\n\t\"./bs.js\": 551,\n\t\"./ca\": 552,\n\t\"./ca.js\": 552,\n\t\"./cs\": 553,\n\t\"./cs.js\": 553,\n\t\"./cv\": 554,\n\t\"./cv.js\": 554,\n\t\"./cy\": 555,\n\t\"./cy.js\": 555,\n\t\"./da\": 556,\n\t\"./da.js\": 556,\n\t\"./de\": 557,\n\t\"./de-at\": 558,\n\t\"./de-at.js\": 558,\n\t\"./de-ch\": 559,\n\t\"./de-ch.js\": 559,\n\t\"./de.js\": 557,\n\t\"./dv\": 560,\n\t\"./dv.js\": 560,\n\t\"./el\": 561,\n\t\"./el.js\": 561,\n\t\"./en-au\": 562,\n\t\"./en-au.js\": 562,\n\t\"./en-ca\": 563,\n\t\"./en-ca.js\": 563,\n\t\"./en-gb\": 564,\n\t\"./en-gb.js\": 564,\n\t\"./en-ie\": 565,\n\t\"./en-ie.js\": 565,\n\t\"./en-il\": 566,\n\t\"./en-il.js\": 566,\n\t\"./en-in\": 567,\n\t\"./en-in.js\": 567,\n\t\"./en-nz\": 568,\n\t\"./en-nz.js\": 568,\n\t\"./en-sg\": 569,\n\t\"./en-sg.js\": 569,\n\t\"./eo\": 570,\n\t\"./eo.js\": 570,\n\t\"./es\": 571,\n\t\"./es-do\": 572,\n\t\"./es-do.js\": 572,\n\t\"./es-mx\": 573,\n\t\"./es-mx.js\": 573,\n\t\"./es-us\": 574,\n\t\"./es-us.js\": 574,\n\t\"./es.js\": 571,\n\t\"./et\": 575,\n\t\"./et.js\": 575,\n\t\"./eu\": 576,\n\t\"./eu.js\": 576,\n\t\"./fa\": 577,\n\t\"./fa.js\": 577,\n\t\"./fi\": 578,\n\t\"./fi.js\": 578,\n\t\"./fil\": 579,\n\t\"./fil.js\": 579,\n\t\"./fo\": 580,\n\t\"./fo.js\": 580,\n\t\"./fr\": 581,\n\t\"./fr-ca\": 582,\n\t\"./fr-ca.js\": 582,\n\t\"./fr-ch\": 583,\n\t\"./fr-ch.js\": 583,\n\t\"./fr.js\": 581,\n\t\"./fy\": 584,\n\t\"./fy.js\": 584,\n\t\"./ga\": 585,\n\t\"./ga.js\": 585,\n\t\"./gd\": 586,\n\t\"./gd.js\": 586,\n\t\"./gl\": 587,\n\t\"./gl.js\": 587,\n\t\"./gom-deva\": 588,\n\t\"./gom-deva.js\": 588,\n\t\"./gom-latn\": 589,\n\t\"./gom-latn.js\": 589,\n\t\"./gu\": 590,\n\t\"./gu.js\": 590,\n\t\"./he\": 591,\n\t\"./he.js\": 591,\n\t\"./hi\": 592,\n\t\"./hi.js\": 592,\n\t\"./hr\": 593,\n\t\"./hr.js\": 593,\n\t\"./hu\": 594,\n\t\"./hu.js\": 594,\n\t\"./hy-am\": 595,\n\t\"./hy-am.js\": 595,\n\t\"./id\": 596,\n\t\"./id.js\": 596,\n\t\"./is\": 597,\n\t\"./is.js\": 597,\n\t\"./it\": 598,\n\t\"./it-ch\": 599,\n\t\"./it-ch.js\": 599,\n\t\"./it.js\": 598,\n\t\"./ja\": 600,\n\t\"./ja.js\": 600,\n\t\"./jv\": 601,\n\t\"./jv.js\": 601,\n\t\"./ka\": 602,\n\t\"./ka.js\": 602,\n\t\"./kk\": 603,\n\t\"./kk.js\": 603,\n\t\"./km\": 604,\n\t\"./km.js\": 604,\n\t\"./kn\": 605,\n\t\"./kn.js\": 605,\n\t\"./ko\": 606,\n\t\"./ko.js\": 606,\n\t\"./ku\": 607,\n\t\"./ku-kmr\": 608,\n\t\"./ku-kmr.js\": 608,\n\t\"./ku.js\": 607,\n\t\"./ky\": 609,\n\t\"./ky.js\": 609,\n\t\"./lb\": 610,\n\t\"./lb.js\": 610,\n\t\"./lo\": 611,\n\t\"./lo.js\": 611,\n\t\"./lt\": 612,\n\t\"./lt.js\": 612,\n\t\"./lv\": 613,\n\t\"./lv.js\": 613,\n\t\"./me\": 614,\n\t\"./me.js\": 614,\n\t\"./mi\": 615,\n\t\"./mi.js\": 615,\n\t\"./mk\": 616,\n\t\"./mk.js\": 616,\n\t\"./ml\": 617,\n\t\"./ml.js\": 617,\n\t\"./mn\": 618,\n\t\"./mn.js\": 618,\n\t\"./mr\": 619,\n\t\"./mr.js\": 619,\n\t\"./ms\": 620,\n\t\"./ms-my\": 621,\n\t\"./ms-my.js\": 621,\n\t\"./ms.js\": 620,\n\t\"./mt\": 622,\n\t\"./mt.js\": 622,\n\t\"./my\": 623,\n\t\"./my.js\": 623,\n\t\"./nb\": 624,\n\t\"./nb.js\": 624,\n\t\"./ne\": 625,\n\t\"./ne.js\": 625,\n\t\"./nl\": 626,\n\t\"./nl-be\": 627,\n\t\"./nl-be.js\": 627,\n\t\"./nl.js\": 626,\n\t\"./nn\": 628,\n\t\"./nn.js\": 628,\n\t\"./oc-lnc\": 629,\n\t\"./oc-lnc.js\": 629,\n\t\"./pa-in\": 630,\n\t\"./pa-in.js\": 630,\n\t\"./pl\": 631,\n\t\"./pl.js\": 631,\n\t\"./pt\": 632,\n\t\"./pt-br\": 633,\n\t\"./pt-br.js\": 633,\n\t\"./pt.js\": 632,\n\t\"./ro\": 634,\n\t\"./ro.js\": 634,\n\t\"./ru\": 635,\n\t\"./ru.js\": 635,\n\t\"./sd\": 636,\n\t\"./sd.js\": 636,\n\t\"./se\": 637,\n\t\"./se.js\": 637,\n\t\"./si\": 638,\n\t\"./si.js\": 638,\n\t\"./sk\": 639,\n\t\"./sk.js\": 639,\n\t\"./sl\": 640,\n\t\"./sl.js\": 640,\n\t\"./sq\": 641,\n\t\"./sq.js\": 641,\n\t\"./sr\": 642,\n\t\"./sr-cyrl\": 643,\n\t\"./sr-cyrl.js\": 643,\n\t\"./sr.js\": 642,\n\t\"./ss\": 644,\n\t\"./ss.js\": 644,\n\t\"./sv\": 645,\n\t\"./sv.js\": 645,\n\t\"./sw\": 646,\n\t\"./sw.js\": 646,\n\t\"./ta\": 647,\n\t\"./ta.js\": 647,\n\t\"./te\": 648,\n\t\"./te.js\": 648,\n\t\"./tet\": 649,\n\t\"./tet.js\": 649,\n\t\"./tg\": 650,\n\t\"./tg.js\": 650,\n\t\"./th\": 651,\n\t\"./th.js\": 651,\n\t\"./tk\": 652,\n\t\"./tk.js\": 652,\n\t\"./tl-ph\": 653,\n\t\"./tl-ph.js\": 653,\n\t\"./tlh\": 654,\n\t\"./tlh.js\": 654,\n\t\"./tr\": 655,\n\t\"./tr.js\": 655,\n\t\"./tzl\": 656,\n\t\"./tzl.js\": 656,\n\t\"./tzm\": 657,\n\t\"./tzm-latn\": 658,\n\t\"./tzm-latn.js\": 658,\n\t\"./tzm.js\": 657,\n\t\"./ug-cn\": 659,\n\t\"./ug-cn.js\": 659,\n\t\"./uk\": 660,\n\t\"./uk.js\": 660,\n\t\"./ur\": 661,\n\t\"./ur.js\": 661,\n\t\"./uz\": 662,\n\t\"./uz-latn\": 663,\n\t\"./uz-latn.js\": 663,\n\t\"./uz.js\": 662,\n\t\"./vi\": 664,\n\t\"./vi.js\": 664,\n\t\"./x-pseudo\": 665,\n\t\"./x-pseudo.js\": 665,\n\t\"./yo\": 666,\n\t\"./yo.js\": 666,\n\t\"./zh-cn\": 667,\n\t\"./zh-cn.js\": 667,\n\t\"./zh-hk\": 668,\n\t\"./zh-hk.js\": 668,\n\t\"./zh-mo\": 669,\n\t\"./zh-mo.js\": 669,\n\t\"./zh-tw\": 670,\n\t\"./zh-tw.js\": 670\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 688;","import { Component } from '@verndale/core';\r\nimport Chart from 'chart.js';\r\n\r\nimport { colors } from './stats-graph';\r\nimport { insertAfter } from '../utils/dom';\r\n\r\nclass DataViz extends Component {\r\n setupDefaults() {\r\n this.dom = {\r\n $wrapper: this.el._$('.data-viz__wrapper'),\r\n $list: this.el._$('.data-viz__points-list'),\r\n $canvas: this.el._$('.data-viz__canvas'),\r\n $canvasContext: this.el._$('.data-viz__canvas').getContext('2d'),\r\n $points: this.el._$$('.data-viz__point'),\r\n $bulletWithoutColor: this.el._$$('.data-viz__bullet[data-color]')\r\n };\r\n\r\n this.colors = this.el.dataset.colors;\r\n this.values = this.el.dataset.values;\r\n this.type = this.el.dataset.type;\r\n\r\n this.setPointsColor();\r\n this.moveDOM();\r\n\r\n this.observer = new window.IntersectionObserver(\r\n (entries, observer) => {\r\n entries.forEach((entry) => {\r\n if (entry.isIntersecting && !this.chart) {\r\n setTimeout(::this.initGraph, 500);\r\n }\r\n });\r\n },\r\n {\r\n threshold: 0.6\r\n }\r\n );\r\n this.observer.observe(this.dom.$canvas);\r\n }\r\n\r\n setPointsColor() {\r\n const { $bulletWithoutColor } = this.dom;\r\n\r\n if ($bulletWithoutColor) {\r\n $bulletWithoutColor.forEach((point) => {\r\n const [key, variation] = point.dataset.color.split('.');\r\n point.style.backgroundColor = colors[key][variation];\r\n });\r\n }\r\n }\r\n\r\n moveDOM() {\r\n const { $wrapper, $list } = this.dom;\r\n\r\n insertAfter($list, $wrapper);\r\n }\r\n\r\n initGraph() {\r\n const { $canvasContext } = this.dom;\r\n\r\n this.chart = new Chart($canvasContext, {\r\n type: this.type,\r\n data: {\r\n datasets: [\r\n {\r\n data: this.values.split(',').map(Number),\r\n backgroundColor: this.colors.split(',').map((color) => {\r\n const colorCode = color.trim();\r\n\r\n if (color.includes('.')) {\r\n const [key, variation] = colorCode.split('.');\r\n\r\n if (key in colors) {\r\n return colors[key][variation];\r\n }\r\n }\r\n\r\n return colorCode;\r\n })\r\n }\r\n ]\r\n },\r\n options: {\r\n animation: {\r\n duration: 2000\r\n },\r\n responsive: true,\r\n maintainAspectRatio: true,\r\n scaleLabel: {\r\n display: false\r\n },\r\n hover: {\r\n mode: null\r\n },\r\n aspectRatio: 1,\r\n legend: {\r\n display: false\r\n },\r\n tooltips: {\r\n enabled: false\r\n },\r\n yAxes: [\r\n {\r\n type: 'linear',\r\n position: 'left'\r\n }\r\n ]\r\n }\r\n });\r\n }\r\n}\r\n\r\nexport default DataViz;\r\n"],"sourceRoot":""}