diff --git a/dist/css/coreui-chartjs.css b/dist/css/coreui-chartjs.css index 7487064..4fa4b0c 100644 --- a/dist/css/coreui-chartjs.css +++ b/dist/css/coreui-chartjs.css @@ -1,7 +1,7 @@ @charset "UTF-8"; /*! * CoreUI Plugins - Chart.js for CoreUI 3 - * @version v4.0.0-beta.1 + * @version v4.0.0-rc.0 * @link https://coreui.io * Copyright (c) 2023 creativeLabs Łukasz Holeczek * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE) diff --git a/dist/css/coreui-chartjs.css.map b/dist/css/coreui-chartjs.css.map index 3c2fe95..2889948 100644 --- a/dist/css/coreui-chartjs.css.map +++ b/dist/css/coreui-chartjs.css.map @@ -1 +1 @@ -{"version":3,"sources":["coreui-chartjs.css","../../scss/coreui-chartjs.scss","../../scss/_tooltips.scss","../../node_modules/@coreui/coreui/scss/mixins/_border-radius.scss","../../node_modules/@coreui/coreui/scss/mixins/_transition.scss"],"names":[],"mappings":"AAAA,gBAAgB;ACAhB;;;;;;EAAA;ACEA;EAEE,kCAAA;EACA,uCAAA;EACA,wCAAA;EACA,+CAAA;EACA,kEAAA;EACA,6DAAA;EACA,gDAAA;EACA,2CAAA;EACA,gDAAA;EACA,6CAAA;EACA,8CAAA;EACA,2CAAA;EAGA,kBAAA;EACA,0CAAA;EACA,kFAAA;EACA,uCAAA;EACA,oBAAA;EACA,yCAAA;EACA,UAAA;EACA,6BAAA;ECNE,uDAAA;ECHE,iDFWJ;AFIF;AIXM;EFlBN;IEmBQ,gBAAA;EJcN;AACF;;AENA;EACE,uDAAA;AFSF;;AENA;EACE,sDAAA;EACA,0DAAA;AFSF;;AENA;EACE,mBAAA;EACA,oDAAA;EACA,wDAAA;EACA,mBAAA;AFSF","file":"coreui-chartjs.css","sourcesContent":["@charset \"UTF-8\";\n/*!\n * CoreUI Plugins - Chart.js for CoreUI 3\n * @version v4.0.0-beta.1\n * @link https://coreui.io\n * Copyright (c) 2023 creativeLabs Łukasz Holeczek\n * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)\n */\n.chartjs-tooltip {\n --cui-chartjs-tooltip-zindex: 1080;\n --cui-chartjs-tooltip-padding-x: 0.5rem;\n --cui-chartjs-tooltip-padding-y: 0.25rem;\n --cui-chartjs-tooltip-color: var(--cui-body-bg);\n --cui-chartjs-tooltip-bg: rgba(var(--cui-emphasis-color-rgb), 0.8);\n --cui-chartjs-tooltip-border-radius: var(--cui-border-radius);\n --cui-chartjs-tooltip-transition: all 0.15s ease;\n --cui-chartjs-tooltip-header-margin: 0.5rem;\n --cui-chartjs-tooltip-header-font-size: 0.875rem;\n --cui-chartjs-tooltip-header-font-weight: 700;\n --cui-chartjs-tooltip-body-font-size: 0.875rem;\n --cui-chartjs-tooltip-body-font-weight: 400;\n position: absolute;\n z-index: var(--cui-chartjs-tooltip-zindex);\n padding: var(--cui-chartjs-tooltip-padding-y) var(--cui-chartjs-tooltip-padding-x);\n color: var(--cui-chartjs-tooltip-color);\n pointer-events: none;\n background: var(--cui-chartjs-tooltip-bg);\n opacity: 0;\n transform: translate(-50%, 0);\n border-radius: var(--cui-chartjs-tooltip-border-radius);\n transition: var(--cui-chartjs-tooltip-transition);\n}\n@media (prefers-reduced-motion: reduce) {\n .chartjs-tooltip {\n transition: none;\n }\n}\n\n.chartjs-tooltip-header {\n margin-bottom: var(--cui-chartjs-tooltip-header-margin);\n}\n\n.chartjs-tooltip-header-item {\n font-size: var(--cui-chartjs-tooltip-header-font-size);\n font-weight: var(--cui-chartjs-tooltip-header-font-weight);\n}\n\n.chartjs-tooltip-body-item {\n align-items: center;\n font-size: var(--cui-chartjs-tooltip-body-font-size);\n font-weight: var(--cui-chartjs-tooltip-body-font-weight);\n white-space: nowrap;\n}\n\n/*# sourceMappingURL=coreui-chartjs.css.map */\n","/*!\n * CoreUI Plugins - Chart.js for CoreUI 3\n * @version v4.0.0-beta.1\n * @link https://coreui.io\n * Copyright (c) 2023 creativeLabs Łukasz Holeczek\n * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)\n */\n\n@import \"@coreui/coreui/scss/functions\";\n@import \"@coreui/coreui/scss/variables\";\n@import \"@coreui/coreui/scss/mixins/border-radius\";\n@import \"@coreui/coreui/scss/mixins/transition\";\n@import \"variables\";\n@import \"tooltips\";\n","// Custom tooltips\n\n.chartjs-tooltip {\n // scss-docs-start chartjs-tooltip-css-vars\n --#{$prefix}chartjs-tooltip-zindex: #{$chartjs-tooltip-zindex};\n --#{$prefix}chartjs-tooltip-padding-x: #{$chartjs-tooltip-padding-x};\n --#{$prefix}chartjs-tooltip-padding-y: #{$chartjs-tooltip-padding-y};\n --#{$prefix}chartjs-tooltip-color: #{$chartjs-tooltip-color};\n --#{$prefix}chartjs-tooltip-bg: #{$chartjs-tooltip-bg};\n --#{$prefix}chartjs-tooltip-border-radius: #{$chartjs-tooltip-border-radius};\n --#{$prefix}chartjs-tooltip-transition: #{$chartjs-tooltip-transition};\n --#{$prefix}chartjs-tooltip-header-margin: #{$chartjs-tooltip-header-margin};\n --#{$prefix}chartjs-tooltip-header-font-size: #{$chartjs-tooltip-header-font-size};\n --#{$prefix}chartjs-tooltip-header-font-weight: #{$chartjs-tooltip-header-font-weight};\n --#{$prefix}chartjs-tooltip-body-font-size: #{$chartjs-tooltip-body-font-size};\n --#{$prefix}chartjs-tooltip-body-font-weight: #{$chartjs-tooltip-body-font-weight};\n // scss-docs-end chartjs-tooltip-css-vars\n\n position: absolute;\n z-index: var(--#{$prefix}chartjs-tooltip-zindex);\n padding: var(--#{$prefix}chartjs-tooltip-padding-y) var(--#{$prefix}chartjs-tooltip-padding-x);\n color: var(--#{$prefix}chartjs-tooltip-color);\n pointer-events: none;\n background: var(--#{$prefix}chartjs-tooltip-bg);\n opacity: 0;\n transform: translate(-50%, 0);\n @include border-radius(var(--#{$prefix}chartjs-tooltip-border-radius));\n @include transition(var(--#{$prefix}chartjs-tooltip-transition));\n}\n\n.chartjs-tooltip-header {\n margin-bottom: var(--#{$prefix}chartjs-tooltip-header-margin);\n}\n\n.chartjs-tooltip-header-item {\n font-size: var(--#{$prefix}chartjs-tooltip-header-font-size);\n font-weight: var(--#{$prefix}chartjs-tooltip-header-font-weight);\n}\n\n.chartjs-tooltip-body-item {\n align-items: center;\n font-size: var(--#{$prefix}chartjs-tooltip-body-font-size);\n font-weight: var(--#{$prefix}chartjs-tooltip-body-font-weight);\n white-space: nowrap;\n}\n","// stylelint-disable property-disallowed-list\n// Single side border-radius\n\n// Helper function to replace negative values with 0\n@function valid-radius($radius) {\n $return: ();\n @each $value in $radius {\n @if type-of($value) == number {\n $return: append($return, max($value, 0));\n } @else {\n $return: append($return, $value);\n }\n }\n @return $return;\n}\n\n// scss-docs-start border-radius-mixins\n@mixin border-radius($radius: $border-radius, $fallback-border-radius: false) {\n @if $enable-rounded {\n border-radius: valid-radius($radius);\n }\n @else if $fallback-border-radius != false {\n border-radius: $fallback-border-radius;\n }\n}\n\n@mixin border-top-radius($radius: $border-radius) {\n @if $enable-rounded {\n border-top-left-radius: valid-radius($radius);\n border-top-right-radius: valid-radius($radius);\n }\n}\n\n@mixin border-end-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-top-right-radius\", valid-radius($radius));\n @include ltr-rtl(\"border-bottom-right-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-bottom-radius($radius: $border-radius) {\n @if $enable-rounded {\n border-bottom-right-radius: valid-radius($radius);\n border-bottom-left-radius: valid-radius($radius);\n }\n}\n\n@mixin border-start-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-top-left-radius\", valid-radius($radius));\n @include ltr-rtl(\"border-bottom-left-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-top-start-radius($radius: $border-radius) {\n @if $enable-rounded {\n border-top-left-radius: valid-radius($radius);\n }\n}\n\n@mixin border-top-end-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-top-right-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-bottom-end-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-bottom-right-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-bottom-start-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-bottom-left-radius\", valid-radius($radius));\n }\n}\n// scss-docs-end border-radius-mixins\n","// stylelint-disable property-disallowed-list\n@mixin transition($transition...) {\n @if length($transition) == 0 {\n $transition: $transition-base;\n }\n\n @if length($transition) > 1 {\n @each $value in $transition {\n @if $value == null or $value == none {\n @warn \"The keyword 'none' or 'null' must be used as a single argument.\";\n }\n }\n }\n\n @if $enable-transitions {\n @if nth($transition, 1) != null {\n transition: $transition;\n }\n\n @if $enable-reduced-motion and nth($transition, 1) != null and nth($transition, 1) != none {\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n }\n }\n}\n"]} \ No newline at end of file +{"version":3,"sources":["coreui-chartjs.css","../../scss/coreui-chartjs.scss","../../scss/_tooltips.scss","../../node_modules/@coreui/coreui/scss/mixins/_border-radius.scss","../../node_modules/@coreui/coreui/scss/mixins/_transition.scss"],"names":[],"mappings":"AAAA,gBAAgB;ACAhB;;;;;;EAAA;ACEA;EAEE,kCAAA;EACA,uCAAA;EACA,wCAAA;EACA,+CAAA;EACA,kEAAA;EACA,6DAAA;EACA,gDAAA;EACA,2CAAA;EACA,gDAAA;EACA,6CAAA;EACA,8CAAA;EACA,2CAAA;EAGA,kBAAA;EACA,0CAAA;EACA,kFAAA;EACA,uCAAA;EACA,oBAAA;EACA,yCAAA;EACA,UAAA;EACA,6BAAA;ECNE,uDAAA;ECHE,iDFWJ;AFIF;AIXM;EFlBN;IEmBQ,gBAAA;EJcN;AACF;;AENA;EACE,uDAAA;AFSF;;AENA;EACE,sDAAA;EACA,0DAAA;AFSF;;AENA;EACE,mBAAA;EACA,oDAAA;EACA,wDAAA;EACA,mBAAA;AFSF","file":"coreui-chartjs.css","sourcesContent":["@charset \"UTF-8\";\n/*!\n * CoreUI Plugins - Chart.js for CoreUI 3\n * @version v4.0.0-rc.0\n * @link https://coreui.io\n * Copyright (c) 2023 creativeLabs Łukasz Holeczek\n * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)\n */\n.chartjs-tooltip {\n --cui-chartjs-tooltip-zindex: 1080;\n --cui-chartjs-tooltip-padding-x: 0.5rem;\n --cui-chartjs-tooltip-padding-y: 0.25rem;\n --cui-chartjs-tooltip-color: var(--cui-body-bg);\n --cui-chartjs-tooltip-bg: rgba(var(--cui-emphasis-color-rgb), 0.8);\n --cui-chartjs-tooltip-border-radius: var(--cui-border-radius);\n --cui-chartjs-tooltip-transition: all 0.15s ease;\n --cui-chartjs-tooltip-header-margin: 0.5rem;\n --cui-chartjs-tooltip-header-font-size: 0.875rem;\n --cui-chartjs-tooltip-header-font-weight: 700;\n --cui-chartjs-tooltip-body-font-size: 0.875rem;\n --cui-chartjs-tooltip-body-font-weight: 400;\n position: absolute;\n z-index: var(--cui-chartjs-tooltip-zindex);\n padding: var(--cui-chartjs-tooltip-padding-y) var(--cui-chartjs-tooltip-padding-x);\n color: var(--cui-chartjs-tooltip-color);\n pointer-events: none;\n background: var(--cui-chartjs-tooltip-bg);\n opacity: 0;\n transform: translate(-50%, 0);\n border-radius: var(--cui-chartjs-tooltip-border-radius);\n transition: var(--cui-chartjs-tooltip-transition);\n}\n@media (prefers-reduced-motion: reduce) {\n .chartjs-tooltip {\n transition: none;\n }\n}\n\n.chartjs-tooltip-header {\n margin-bottom: var(--cui-chartjs-tooltip-header-margin);\n}\n\n.chartjs-tooltip-header-item {\n font-size: var(--cui-chartjs-tooltip-header-font-size);\n font-weight: var(--cui-chartjs-tooltip-header-font-weight);\n}\n\n.chartjs-tooltip-body-item {\n align-items: center;\n font-size: var(--cui-chartjs-tooltip-body-font-size);\n font-weight: var(--cui-chartjs-tooltip-body-font-weight);\n white-space: nowrap;\n}\n\n/*# sourceMappingURL=coreui-chartjs.css.map */\n","/*!\n * CoreUI Plugins - Chart.js for CoreUI 3\n * @version v4.0.0-rc.0\n * @link https://coreui.io\n * Copyright (c) 2023 creativeLabs Łukasz Holeczek\n * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)\n */\n\n@import \"@coreui/coreui/scss/functions\";\n@import \"@coreui/coreui/scss/variables\";\n@import \"@coreui/coreui/scss/mixins/border-radius\";\n@import \"@coreui/coreui/scss/mixins/transition\";\n@import \"variables\";\n@import \"tooltips\";\n","// Custom tooltips\n\n.chartjs-tooltip {\n // scss-docs-start chartjs-tooltip-css-vars\n --#{$prefix}chartjs-tooltip-zindex: #{$chartjs-tooltip-zindex};\n --#{$prefix}chartjs-tooltip-padding-x: #{$chartjs-tooltip-padding-x};\n --#{$prefix}chartjs-tooltip-padding-y: #{$chartjs-tooltip-padding-y};\n --#{$prefix}chartjs-tooltip-color: #{$chartjs-tooltip-color};\n --#{$prefix}chartjs-tooltip-bg: #{$chartjs-tooltip-bg};\n --#{$prefix}chartjs-tooltip-border-radius: #{$chartjs-tooltip-border-radius};\n --#{$prefix}chartjs-tooltip-transition: #{$chartjs-tooltip-transition};\n --#{$prefix}chartjs-tooltip-header-margin: #{$chartjs-tooltip-header-margin};\n --#{$prefix}chartjs-tooltip-header-font-size: #{$chartjs-tooltip-header-font-size};\n --#{$prefix}chartjs-tooltip-header-font-weight: #{$chartjs-tooltip-header-font-weight};\n --#{$prefix}chartjs-tooltip-body-font-size: #{$chartjs-tooltip-body-font-size};\n --#{$prefix}chartjs-tooltip-body-font-weight: #{$chartjs-tooltip-body-font-weight};\n // scss-docs-end chartjs-tooltip-css-vars\n\n position: absolute;\n z-index: var(--#{$prefix}chartjs-tooltip-zindex);\n padding: var(--#{$prefix}chartjs-tooltip-padding-y) var(--#{$prefix}chartjs-tooltip-padding-x);\n color: var(--#{$prefix}chartjs-tooltip-color);\n pointer-events: none;\n background: var(--#{$prefix}chartjs-tooltip-bg);\n opacity: 0;\n transform: translate(-50%, 0);\n @include border-radius(var(--#{$prefix}chartjs-tooltip-border-radius));\n @include transition(var(--#{$prefix}chartjs-tooltip-transition));\n}\n\n.chartjs-tooltip-header {\n margin-bottom: var(--#{$prefix}chartjs-tooltip-header-margin);\n}\n\n.chartjs-tooltip-header-item {\n font-size: var(--#{$prefix}chartjs-tooltip-header-font-size);\n font-weight: var(--#{$prefix}chartjs-tooltip-header-font-weight);\n}\n\n.chartjs-tooltip-body-item {\n align-items: center;\n font-size: var(--#{$prefix}chartjs-tooltip-body-font-size);\n font-weight: var(--#{$prefix}chartjs-tooltip-body-font-weight);\n white-space: nowrap;\n}\n","// stylelint-disable property-disallowed-list\n// Single side border-radius\n\n// Helper function to replace negative values with 0\n@function valid-radius($radius) {\n $return: ();\n @each $value in $radius {\n @if type-of($value) == number {\n $return: append($return, max($value, 0));\n } @else {\n $return: append($return, $value);\n }\n }\n @return $return;\n}\n\n// scss-docs-start border-radius-mixins\n@mixin border-radius($radius: $border-radius, $fallback-border-radius: false) {\n @if $enable-rounded {\n border-radius: valid-radius($radius);\n }\n @else if $fallback-border-radius != false {\n border-radius: $fallback-border-radius;\n }\n}\n\n@mixin border-top-radius($radius: $border-radius) {\n @if $enable-rounded {\n border-top-left-radius: valid-radius($radius);\n border-top-right-radius: valid-radius($radius);\n }\n}\n\n@mixin border-end-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-top-right-radius\", valid-radius($radius));\n @include ltr-rtl(\"border-bottom-right-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-bottom-radius($radius: $border-radius) {\n @if $enable-rounded {\n border-bottom-right-radius: valid-radius($radius);\n border-bottom-left-radius: valid-radius($radius);\n }\n}\n\n@mixin border-start-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-top-left-radius\", valid-radius($radius));\n @include ltr-rtl(\"border-bottom-left-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-top-start-radius($radius: $border-radius) {\n @if $enable-rounded {\n border-top-left-radius: valid-radius($radius);\n }\n}\n\n@mixin border-top-end-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-top-right-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-bottom-end-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-bottom-right-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-bottom-start-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-bottom-left-radius\", valid-radius($radius));\n }\n}\n// scss-docs-end border-radius-mixins\n","// stylelint-disable property-disallowed-list\n@mixin transition($transition...) {\n @if length($transition) == 0 {\n $transition: $transition-base;\n }\n\n @if length($transition) > 1 {\n @each $value in $transition {\n @if $value == null or $value == none {\n @warn \"The keyword 'none' or 'null' must be used as a single argument.\";\n }\n }\n }\n\n @if $enable-transitions {\n @if nth($transition, 1) != null {\n transition: $transition;\n }\n\n @if $enable-reduced-motion and nth($transition, 1) != null and nth($transition, 1) != none {\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n }\n }\n}\n"]} \ No newline at end of file diff --git a/dist/css/coreui-chartjs.min.css b/dist/css/coreui-chartjs.min.css index fb72654..a45e5e9 100644 --- a/dist/css/coreui-chartjs.min.css +++ b/dist/css/coreui-chartjs.min.css @@ -1,6 +1,6 @@ @charset "UTF-8";/*! * CoreUI Plugins - Chart.js for CoreUI 3 - * @version v4.0.0-beta.1 + * @version v4.0.0-rc.0 * @link https://coreui.io * Copyright (c) 2023 creativeLabs Łukasz Holeczek * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE) diff --git a/dist/css/coreui-chartjs.min.css.map b/dist/css/coreui-chartjs.min.css.map index 2f915a6..5e01244 100644 --- a/dist/css/coreui-chartjs.min.css.map +++ b/dist/css/coreui-chartjs.min.css.map @@ -1 +1 @@ -{"version":3,"sources":["../../scss/coreui-chartjs.scss","../../scss/_tooltips.scss","../../node_modules/@coreui/coreui/scss/mixins/_border-radius.scss","../../node_modules/@coreui/coreui/scss/mixins/_transition.scss"],"names":[],"mappings":"iBAAA;;;;;;ACEA,iBAEE,6BAAA,KACA,gCAAA,OACA,gCAAA,QACA,4BAAA,mBACA,yBAAA,yCACA,oCAAA,yBACA,iCAAA,IAAA,MAAA,KACA,oCAAA,OACA,uCAAA,SACA,yCAAA,IACA,qCAAA,SACA,uCAAA,IAGA,SAAA,SACA,QAAA,kCACA,QAAA,qCAAA,qCACA,MAAA,iCACA,eAAA,KACA,WAAA,8BACA,QAAA,EACA,UAAA,kBCNE,cAAA,yCCHE,WAAA,sCAIA,uCFlBN,iBEmBQ,WAAA,MFSR,wBACE,cAAA,yCAGF,6BACE,UAAA,4CACA,YAAA,8CAGF,2BACE,YAAA,OACA,UAAA,0CACA,YAAA,4CACA,YAAA","sourcesContent":["/*!\n * CoreUI Plugins - Chart.js for CoreUI 3\n * @version v4.0.0-beta.1\n * @link https://coreui.io\n * Copyright (c) 2023 creativeLabs Łukasz Holeczek\n * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)\n */\n\n@import \"@coreui/coreui/scss/functions\";\n@import \"@coreui/coreui/scss/variables\";\n@import \"@coreui/coreui/scss/mixins/border-radius\";\n@import \"@coreui/coreui/scss/mixins/transition\";\n@import \"variables\";\n@import \"tooltips\";\n","// Custom tooltips\n\n.chartjs-tooltip {\n // scss-docs-start chartjs-tooltip-css-vars\n --#{$prefix}chartjs-tooltip-zindex: #{$chartjs-tooltip-zindex};\n --#{$prefix}chartjs-tooltip-padding-x: #{$chartjs-tooltip-padding-x};\n --#{$prefix}chartjs-tooltip-padding-y: #{$chartjs-tooltip-padding-y};\n --#{$prefix}chartjs-tooltip-color: #{$chartjs-tooltip-color};\n --#{$prefix}chartjs-tooltip-bg: #{$chartjs-tooltip-bg};\n --#{$prefix}chartjs-tooltip-border-radius: #{$chartjs-tooltip-border-radius};\n --#{$prefix}chartjs-tooltip-transition: #{$chartjs-tooltip-transition};\n --#{$prefix}chartjs-tooltip-header-margin: #{$chartjs-tooltip-header-margin};\n --#{$prefix}chartjs-tooltip-header-font-size: #{$chartjs-tooltip-header-font-size};\n --#{$prefix}chartjs-tooltip-header-font-weight: #{$chartjs-tooltip-header-font-weight};\n --#{$prefix}chartjs-tooltip-body-font-size: #{$chartjs-tooltip-body-font-size};\n --#{$prefix}chartjs-tooltip-body-font-weight: #{$chartjs-tooltip-body-font-weight};\n // scss-docs-end chartjs-tooltip-css-vars\n\n position: absolute;\n z-index: var(--#{$prefix}chartjs-tooltip-zindex);\n padding: var(--#{$prefix}chartjs-tooltip-padding-y) var(--#{$prefix}chartjs-tooltip-padding-x);\n color: var(--#{$prefix}chartjs-tooltip-color);\n pointer-events: none;\n background: var(--#{$prefix}chartjs-tooltip-bg);\n opacity: 0;\n transform: translate(-50%, 0);\n @include border-radius(var(--#{$prefix}chartjs-tooltip-border-radius));\n @include transition(var(--#{$prefix}chartjs-tooltip-transition));\n}\n\n.chartjs-tooltip-header {\n margin-bottom: var(--#{$prefix}chartjs-tooltip-header-margin);\n}\n\n.chartjs-tooltip-header-item {\n font-size: var(--#{$prefix}chartjs-tooltip-header-font-size);\n font-weight: var(--#{$prefix}chartjs-tooltip-header-font-weight);\n}\n\n.chartjs-tooltip-body-item {\n align-items: center;\n font-size: var(--#{$prefix}chartjs-tooltip-body-font-size);\n font-weight: var(--#{$prefix}chartjs-tooltip-body-font-weight);\n white-space: nowrap;\n}\n","// stylelint-disable property-disallowed-list\n// Single side border-radius\n\n// Helper function to replace negative values with 0\n@function valid-radius($radius) {\n $return: ();\n @each $value in $radius {\n @if type-of($value) == number {\n $return: append($return, max($value, 0));\n } @else {\n $return: append($return, $value);\n }\n }\n @return $return;\n}\n\n// scss-docs-start border-radius-mixins\n@mixin border-radius($radius: $border-radius, $fallback-border-radius: false) {\n @if $enable-rounded {\n border-radius: valid-radius($radius);\n }\n @else if $fallback-border-radius != false {\n border-radius: $fallback-border-radius;\n }\n}\n\n@mixin border-top-radius($radius: $border-radius) {\n @if $enable-rounded {\n border-top-left-radius: valid-radius($radius);\n border-top-right-radius: valid-radius($radius);\n }\n}\n\n@mixin border-end-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-top-right-radius\", valid-radius($radius));\n @include ltr-rtl(\"border-bottom-right-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-bottom-radius($radius: $border-radius) {\n @if $enable-rounded {\n border-bottom-right-radius: valid-radius($radius);\n border-bottom-left-radius: valid-radius($radius);\n }\n}\n\n@mixin border-start-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-top-left-radius\", valid-radius($radius));\n @include ltr-rtl(\"border-bottom-left-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-top-start-radius($radius: $border-radius) {\n @if $enable-rounded {\n border-top-left-radius: valid-radius($radius);\n }\n}\n\n@mixin border-top-end-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-top-right-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-bottom-end-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-bottom-right-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-bottom-start-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-bottom-left-radius\", valid-radius($radius));\n }\n}\n// scss-docs-end border-radius-mixins\n","// stylelint-disable property-disallowed-list\n@mixin transition($transition...) {\n @if length($transition) == 0 {\n $transition: $transition-base;\n }\n\n @if length($transition) > 1 {\n @each $value in $transition {\n @if $value == null or $value == none {\n @warn \"The keyword 'none' or 'null' must be used as a single argument.\";\n }\n }\n }\n\n @if $enable-transitions {\n @if nth($transition, 1) != null {\n transition: $transition;\n }\n\n @if $enable-reduced-motion and nth($transition, 1) != null and nth($transition, 1) != none {\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n }\n }\n}\n"]} \ No newline at end of file +{"version":3,"sources":["../../scss/coreui-chartjs.scss","../../scss/_tooltips.scss","../../node_modules/@coreui/coreui/scss/mixins/_border-radius.scss","../../node_modules/@coreui/coreui/scss/mixins/_transition.scss"],"names":[],"mappings":"iBAAA;;;;;;ACEA,iBAEE,6BAAA,KACA,gCAAA,OACA,gCAAA,QACA,4BAAA,mBACA,yBAAA,yCACA,oCAAA,yBACA,iCAAA,IAAA,MAAA,KACA,oCAAA,OACA,uCAAA,SACA,yCAAA,IACA,qCAAA,SACA,uCAAA,IAGA,SAAA,SACA,QAAA,kCACA,QAAA,qCAAA,qCACA,MAAA,iCACA,eAAA,KACA,WAAA,8BACA,QAAA,EACA,UAAA,kBCNE,cAAA,yCCHE,WAAA,sCAIA,uCFlBN,iBEmBQ,WAAA,MFSR,wBACE,cAAA,yCAGF,6BACE,UAAA,4CACA,YAAA,8CAGF,2BACE,YAAA,OACA,UAAA,0CACA,YAAA,4CACA,YAAA","sourcesContent":["/*!\n * CoreUI Plugins - Chart.js for CoreUI 3\n * @version v4.0.0-rc.0\n * @link https://coreui.io\n * Copyright (c) 2023 creativeLabs Łukasz Holeczek\n * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)\n */\n\n@import \"@coreui/coreui/scss/functions\";\n@import \"@coreui/coreui/scss/variables\";\n@import \"@coreui/coreui/scss/mixins/border-radius\";\n@import \"@coreui/coreui/scss/mixins/transition\";\n@import \"variables\";\n@import \"tooltips\";\n","// Custom tooltips\n\n.chartjs-tooltip {\n // scss-docs-start chartjs-tooltip-css-vars\n --#{$prefix}chartjs-tooltip-zindex: #{$chartjs-tooltip-zindex};\n --#{$prefix}chartjs-tooltip-padding-x: #{$chartjs-tooltip-padding-x};\n --#{$prefix}chartjs-tooltip-padding-y: #{$chartjs-tooltip-padding-y};\n --#{$prefix}chartjs-tooltip-color: #{$chartjs-tooltip-color};\n --#{$prefix}chartjs-tooltip-bg: #{$chartjs-tooltip-bg};\n --#{$prefix}chartjs-tooltip-border-radius: #{$chartjs-tooltip-border-radius};\n --#{$prefix}chartjs-tooltip-transition: #{$chartjs-tooltip-transition};\n --#{$prefix}chartjs-tooltip-header-margin: #{$chartjs-tooltip-header-margin};\n --#{$prefix}chartjs-tooltip-header-font-size: #{$chartjs-tooltip-header-font-size};\n --#{$prefix}chartjs-tooltip-header-font-weight: #{$chartjs-tooltip-header-font-weight};\n --#{$prefix}chartjs-tooltip-body-font-size: #{$chartjs-tooltip-body-font-size};\n --#{$prefix}chartjs-tooltip-body-font-weight: #{$chartjs-tooltip-body-font-weight};\n // scss-docs-end chartjs-tooltip-css-vars\n\n position: absolute;\n z-index: var(--#{$prefix}chartjs-tooltip-zindex);\n padding: var(--#{$prefix}chartjs-tooltip-padding-y) var(--#{$prefix}chartjs-tooltip-padding-x);\n color: var(--#{$prefix}chartjs-tooltip-color);\n pointer-events: none;\n background: var(--#{$prefix}chartjs-tooltip-bg);\n opacity: 0;\n transform: translate(-50%, 0);\n @include border-radius(var(--#{$prefix}chartjs-tooltip-border-radius));\n @include transition(var(--#{$prefix}chartjs-tooltip-transition));\n}\n\n.chartjs-tooltip-header {\n margin-bottom: var(--#{$prefix}chartjs-tooltip-header-margin);\n}\n\n.chartjs-tooltip-header-item {\n font-size: var(--#{$prefix}chartjs-tooltip-header-font-size);\n font-weight: var(--#{$prefix}chartjs-tooltip-header-font-weight);\n}\n\n.chartjs-tooltip-body-item {\n align-items: center;\n font-size: var(--#{$prefix}chartjs-tooltip-body-font-size);\n font-weight: var(--#{$prefix}chartjs-tooltip-body-font-weight);\n white-space: nowrap;\n}\n","// stylelint-disable property-disallowed-list\n// Single side border-radius\n\n// Helper function to replace negative values with 0\n@function valid-radius($radius) {\n $return: ();\n @each $value in $radius {\n @if type-of($value) == number {\n $return: append($return, max($value, 0));\n } @else {\n $return: append($return, $value);\n }\n }\n @return $return;\n}\n\n// scss-docs-start border-radius-mixins\n@mixin border-radius($radius: $border-radius, $fallback-border-radius: false) {\n @if $enable-rounded {\n border-radius: valid-radius($radius);\n }\n @else if $fallback-border-radius != false {\n border-radius: $fallback-border-radius;\n }\n}\n\n@mixin border-top-radius($radius: $border-radius) {\n @if $enable-rounded {\n border-top-left-radius: valid-radius($radius);\n border-top-right-radius: valid-radius($radius);\n }\n}\n\n@mixin border-end-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-top-right-radius\", valid-radius($radius));\n @include ltr-rtl(\"border-bottom-right-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-bottom-radius($radius: $border-radius) {\n @if $enable-rounded {\n border-bottom-right-radius: valid-radius($radius);\n border-bottom-left-radius: valid-radius($radius);\n }\n}\n\n@mixin border-start-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-top-left-radius\", valid-radius($radius));\n @include ltr-rtl(\"border-bottom-left-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-top-start-radius($radius: $border-radius) {\n @if $enable-rounded {\n border-top-left-radius: valid-radius($radius);\n }\n}\n\n@mixin border-top-end-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-top-right-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-bottom-end-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-bottom-right-radius\", valid-radius($radius));\n }\n}\n\n@mixin border-bottom-start-radius($radius: $border-radius) {\n @if $enable-rounded {\n @include ltr-rtl(\"border-bottom-left-radius\", valid-radius($radius));\n }\n}\n// scss-docs-end border-radius-mixins\n","// stylelint-disable property-disallowed-list\n@mixin transition($transition...) {\n @if length($transition) == 0 {\n $transition: $transition-base;\n }\n\n @if length($transition) > 1 {\n @each $value in $transition {\n @if $value == null or $value == none {\n @warn \"The keyword 'none' or 'null' must be used as a single argument.\";\n }\n }\n }\n\n @if $enable-transitions {\n @if nth($transition, 1) != null {\n transition: $transition;\n }\n\n @if $enable-reduced-motion and nth($transition, 1) != null and nth($transition, 1) != none {\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n }\n }\n}\n"]} \ No newline at end of file diff --git a/dist/js/coreui-chartjs.esm.js b/dist/js/coreui-chartjs.esm.js index 59d189a..5526f52 100644 --- a/dist/js/coreui-chartjs.esm.js +++ b/dist/js/coreui-chartjs.esm.js @@ -1,12 +1,12 @@ /*! - * CoreUI v4.0.0-beta.1 (https://coreui.io) + * CoreUI v4.0.0-rc.0 (https://coreui.io) * Copyright 2023 [object Object] * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE) */ /** * -------------------------------------------------------------------------- - * Custom Tooltips for Chart.js (v4.0.0-beta.1): custom-tooltips.js - * Licensed under MIT (https://coreui.io/plugins/chart.js) + * Custom Tooltips for Chart.js (v4.0.0-rc.0): custom-tooltips.js + * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE) * -------------------------------------------------------------------------- */ diff --git a/dist/js/coreui-chartjs.esm.js.map b/dist/js/coreui-chartjs.esm.js.map index 170b73c..c46414d 100644 --- a/dist/js/coreui-chartjs.esm.js.map +++ b/dist/js/coreui-chartjs.esm.js.map @@ -1 +1 @@ -{"version":3,"file":"coreui-chartjs.esm.js","sources":["../../js/src/custom-tooltips.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Custom Tooltips for Chart.js (v4.0.0-beta.1): custom-tooltips.js\n * Licensed under MIT (https://coreui.io/plugins/chart.js)\n * --------------------------------------------------------------------------\n */\n\nconst ClassName = {\n TOOLTIP: 'chartjs-tooltip',\n TOOLTIP_BODY: 'chartjs-tooltip-body',\n TOOLTIP_BODY_ITEM: 'chartjs-tooltip-body-item',\n TOOLTIP_HEADER: 'chartjs-tooltip-header',\n TOOLTIP_HEADER_ITEM: 'chartjs-tooltip-header-item'\n}\n\nconst getOrCreateTooltip = chart => {\n let tooltipEl = chart.canvas.parentNode.querySelector('div')\n\n if (!tooltipEl) {\n tooltipEl = document.createElement('div')\n tooltipEl.classList.add(ClassName.TOOLTIP)\n\n const table = document.createElement('table')\n table.style.margin = '0px'\n\n tooltipEl.append(table)\n chart.canvas.parentNode.append(tooltipEl)\n }\n\n return tooltipEl\n}\n\nconst customTooltips = context => {\n // Tooltip Element\n const { chart, tooltip } = context\n const tooltipEl = getOrCreateTooltip(chart)\n\n // Hide if no tooltip\n if (tooltip.opacity === 0) {\n tooltipEl.style.opacity = 0\n return\n }\n\n // Set Text\n if (tooltip.body) {\n const titleLines = tooltip.title || []\n const bodyLines = tooltip.body.map(b => b.lines)\n\n const tableHead = document.createElement('thead')\n tableHead.classList.add(ClassName.TOOLTIP_HEADER)\n\n for (const title of titleLines) {\n const tr = document.createElement('tr')\n tr.style.borderWidth = 0\n tr.classList.add(ClassName.TOOLTIP_HEADER_ITEM)\n\n const th = document.createElement('th')\n th.style.borderWidth = 0\n const text = document.createTextNode(title)\n\n th.append(text)\n tr.append(th)\n tableHead.append(tr)\n }\n\n const tableBody = document.createElement('tbody')\n tableBody.classList.add(ClassName.TOOLTIP_BODY)\n\n for (const [i, body] of bodyLines.entries()) {\n const colors = tooltip.labelColors[i]\n\n const span = document.createElement('span')\n span.style.background = colors.backgroundColor\n span.style.borderColor = colors.borderColor\n span.style.borderWidth = '2px'\n span.style.marginRight = '10px'\n span.style.height = '10px'\n span.style.width = '10px'\n span.style.display = 'inline-block'\n\n const tr = document.createElement('tr')\n tr.classList.add(ClassName.TOOLTIP_BODY_ITEM)\n\n const td = document.createElement('td')\n td.style.borderWidth = 0\n\n const text = document.createTextNode(body)\n\n td.append(span)\n td.append(text)\n tr.append(td)\n tableBody.append(tr)\n }\n\n const tableRoot = tooltipEl.querySelector('table')\n\n // Remove old children\n while (tableRoot.firstChild) {\n tableRoot.firstChild.remove()\n }\n\n // Add new children\n tableRoot.append(tableHead)\n tableRoot.append(tableBody)\n }\n\n const { offsetLeft: positionX, offsetTop: positionY } = chart.canvas\n\n // Display, position, and set styles for font\n tooltipEl.style.opacity = 1\n tooltipEl.style.left = `${positionX + tooltip.caretX}px`\n tooltipEl.style.top = `${positionY + tooltip.caretY}px`\n tooltipEl.style.font = tooltip.options.bodyFont.string\n tooltipEl.style.padding = `${tooltip.padding}px ${tooltip.padding}px`\n}\n\nexport default customTooltips\n"],"names":["ClassName","TOOLTIP","TOOLTIP_BODY","TOOLTIP_BODY_ITEM","TOOLTIP_HEADER","TOOLTIP_HEADER_ITEM","getOrCreateTooltip","chart","tooltipEl","canvas","parentNode","querySelector","document","createElement","classList","add","table","style","margin","append","customTooltips","context","tooltip","opacity","body","titleLines","title","bodyLines","map","b","lines","tableHead","tr","borderWidth","th","text","createTextNode","tableBody","i","entries","colors","labelColors","span","background","backgroundColor","borderColor","marginRight","height","width","display","td","tableRoot","firstChild","remove","offsetLeft","positionX","offsetTop","positionY","left","caretX","top","caretY","font","options","bodyFont","string","padding"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,SAAS,GAAG;AAChBC,EAAAA,OAAO,EAAE,iBAAiB;AAC1BC,EAAAA,YAAY,EAAE,sBAAsB;AACpCC,EAAAA,iBAAiB,EAAE,2BAA2B;AAC9CC,EAAAA,cAAc,EAAE,wBAAwB;AACxCC,EAAAA,mBAAmB,EAAE,6BAAA;AACvB,CAAC,CAAA;AAED,MAAMC,kBAAkB,GAAGC,KAAK,IAAI;EAClC,IAAIC,SAAS,GAAGD,KAAK,CAACE,MAAM,CAACC,UAAU,CAACC,aAAa,CAAC,KAAK,CAAC,CAAA;EAE5D,IAAI,CAACH,SAAS,EAAE;AACdA,IAAAA,SAAS,GAAGI,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,CAAA;IACzCL,SAAS,CAACM,SAAS,CAACC,GAAG,CAACf,SAAS,CAACC,OAAO,CAAC,CAAA;AAE1C,IAAA,MAAMe,KAAK,GAAGJ,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC,CAAA;AAC7CG,IAAAA,KAAK,CAACC,KAAK,CAACC,MAAM,GAAG,KAAK,CAAA;AAE1BV,IAAAA,SAAS,CAACW,MAAM,CAACH,KAAK,CAAC,CAAA;IACvBT,KAAK,CAACE,MAAM,CAACC,UAAU,CAACS,MAAM,CAACX,SAAS,CAAC,CAAA;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AS,GAAGnC,OAAO,CAACuC,MAAO,CAAG,EAAA,CAAA,CAAA;EACvDrD,SAAS,CAACS,KAAK,CAAC6C,IAAI,GAAGxC,OAAO,CAACyC,OAAO,CAACC,QAAQ,CAACC,MAAM,CAAA;AACtDzD,EAAAA,SAAS,CAACS,KAAK,CAACiD,OAAO,GAAI,CAAA,EAAE5C,OAAO,CAAC4C,OAAQ,CAAA,GAAA,EAAK5C,OAAO,CAAC4C,OAAQ,CAAG,EAAA,CAAA,CAAA;AACvE;;;;"} \ No newline at end of file +{"version":3,"file":"coreui-chartjs.esm.js","sources":["../../js/src/custom-tooltips.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Custom Tooltips for Chart.js (v4.0.0-rc.0): custom-tooltips.js\n * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst ClassName = {\n TOOLTIP: 'chartjs-tooltip',\n TOOLTIP_BODY: 'chartjs-tooltip-body',\n TOOLTIP_BODY_ITEM: 'chartjs-tooltip-body-item',\n TOOLTIP_HEADER: 'chartjs-tooltip-header',\n TOOLTIP_HEADER_ITEM: 'chartjs-tooltip-header-item'\n}\n\nconst getOrCreateTooltip = chart => {\n let tooltipEl = chart.canvas.parentNode.querySelector('div')\n\n if (!tooltipEl) {\n tooltipEl = document.createElement('div')\n tooltipEl.classList.add(ClassName.TOOLTIP)\n\n const table = document.createElement('table')\n table.style.margin = '0px'\n\n tooltipEl.append(table)\n chart.canvas.parentNode.append(tooltipEl)\n }\n\n return tooltipEl\n}\n\nconst customTooltips = context => {\n // Tooltip Element\n const { chart, tooltip } = context\n const tooltipEl = getOrCreateTooltip(chart)\n\n // Hide if no tooltip\n if (tooltip.opacity === 0) {\n tooltipEl.style.opacity = 0\n return\n }\n\n // Set Text\n if (tooltip.body) {\n const titleLines = tooltip.title || []\n const bodyLines = tooltip.body.map(b => b.lines)\n\n const tableHead = document.createElement('thead')\n tableHead.classList.add(ClassName.TOOLTIP_HEADER)\n\n for (const title of titleLines) {\n const tr = document.createElement('tr')\n tr.style.borderWidth = 0\n tr.classList.add(ClassName.TOOLTIP_HEADER_ITEM)\n\n const th = document.createElement('th')\n th.style.borderWidth = 0\n const text = document.createTextNode(title)\n\n th.append(text)\n tr.append(th)\n tableHead.append(tr)\n }\n\n const tableBody = document.createElement('tbody')\n tableBody.classList.add(ClassName.TOOLTIP_BODY)\n\n for (const [i, body] of bodyLines.entries()) {\n const colors = tooltip.labelColors[i]\n\n const span = document.createElement('span')\n span.style.background = colors.backgroundColor\n span.style.borderColor = colors.borderColor\n span.style.borderWidth = '2px'\n span.style.marginRight = '10px'\n span.style.height = '10px'\n span.style.width = '10px'\n span.style.display = 'inline-block'\n\n const tr = document.createElement('tr')\n tr.classList.add(ClassName.TOOLTIP_BODY_ITEM)\n\n const td = document.createElement('td')\n td.style.borderWidth = 0\n\n const text = document.createTextNode(body)\n\n td.append(span)\n td.append(text)\n tr.append(td)\n tableBody.append(tr)\n }\n\n const tableRoot = tooltipEl.querySelector('table')\n\n // Remove old children\n while (tableRoot.firstChild) {\n tableRoot.firstChild.remove()\n }\n\n // Add new children\n tableRoot.append(tableHead)\n tableRoot.append(tableBody)\n }\n\n const { offsetLeft: positionX, offsetTop: positionY } = chart.canvas\n\n // Display, position, and set styles for font\n tooltipEl.style.opacity = 1\n tooltipEl.style.left = `${positionX + tooltip.caretX}px`\n tooltipEl.style.top = `${positionY + tooltip.caretY}px`\n tooltipEl.style.font = tooltip.options.bodyFont.string\n tooltipEl.style.padding = `${tooltip.padding}px ${tooltip.padding}px`\n}\n\nexport default customTooltips\n"],"names":["ClassName","TOOLTIP","TOOLTIP_BODY","TOOLTIP_BODY_ITEM","TOOLTIP_HEADER","TOOLTIP_HEADER_ITEM","getOrCreateTooltip","chart","tooltipEl","canvas","parentNode","querySelector","document","createElement","classList","add","table","style","margin","append","customTooltips","context","tooltip","opacity","body","titleLines","title","bodyLines","map","b","lines","tableHead","tr","borderWidth","th","text","createTextNode","tableBody","i","entries","colors","labelColors","span","background","backgroundColor","borderColor","marginRight","height","width","display","td","tableRoot","firstChild","remove","offsetLeft","positionX","offsetTop","positionY","left","caretX","top","caretY","font","options","bodyFont","string","padding"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,SAAS,GAAG;AAChBC,EAAAA,OAAO,EAAE,iBAAiB;AAC1BC,EAAAA,YAAY,EAAE,sBAAsB;AACpCC,EAAAA,iBAAiB,EAAE,2BAA2B;AAC9CC,EAAAA,cAAc,EAAE,wBAAwB;AACxCC,EAAAA,mBAAmB,EAAE,6BAAA;AACvB,CAAC,CAAA;AAED,MAAMC,kBAAkB,GAAGC,KAAK,IAAI;EAClC,IAAIC,SAAS,GAAGD,KAAK,CAACE,MAAM,CAACC,UAAU,CAACC,aAAa,CAAC,KAAK,CAAC,CAAA;EAE5D,IAAI,CAACH,SAAS,EAAE;AACdA,IAAAA,SAAS,GAAGI,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,CAAA;IACzCL,SAAS,CAACM,SAAS,CAACC,GAAG,CAACf,SAAS,CAACC,OAAO,CAAC,CAAA;AAE1C,IAAA,MAAMe,KAAK,GAAGJ,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC,CAAA;AAC7CG,IAAAA,KAAK,CAACC,KAAK,CAACC,MAAM,GAAG,KAAK,CAAA;AAE1BV,IAAAA,SAAS,CAACW,MAAM,CAACH,KAAK,CAAC,CAAA;IACvBT,KAAK,CAACE,MAAM,CAACC,UAAU,CAACS,MAAM,CAACX,SAAS,CAAC,CAAA;AAC3C,GAAA;AAEA,EAAA,OAAOA,SAAS,CAAA;AAClB,CAAC,CAAA;AAEKY,MAAAA,cAAc,GAAGC,OAAO,IAAI;AAChC;EACA,MAAM;IAAEd,KAAK;AAAEe,IAAAA,OAAAA;AAAQ,GAAC,GAAGD,OAAO,CAAA;AAClC,EAAA,MAAMb,SAAS,GAAGF,kBAAkB,CAACC,KAAK,CAA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,CAAA,GAAA,EAAK5C,OAAO,CAAC4C,OAAQ,CAAG,EAAA,CAAA,CAAA;AACvE;;;;"} \ No newline at end of file diff --git a/dist/js/coreui-chartjs.esm.min.js b/dist/js/coreui-chartjs.esm.min.js index 4fe4a82..2fcb210 100644 --- a/dist/js/coreui-chartjs.esm.min.js +++ b/dist/js/coreui-chartjs.esm.min.js @@ -1,5 +1,5 @@ /*! - * CoreUI v4.0.0-beta.1 (https://coreui.io) + * CoreUI v4.0.0-rc.0 (https://coreui.io) * Copyright 2023 [object Object] * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE) */ diff --git a/dist/js/coreui-chartjs.esm.min.js.map b/dist/js/coreui-chartjs.esm.min.js.map index 488cd42..314dae7 100644 --- a/dist/js/coreui-chartjs.esm.min.js.map +++ b/dist/js/coreui-chartjs.esm.min.js.map @@ -1 +1 @@ -{"version":3,"names":["ClassName","TOOLTIP","TOOLTIP_BODY","TOOLTIP_BODY_ITEM","TOOLTIP_HEADER","TOOLTIP_HEADER_ITEM","getOrCreateTooltip","chart","tooltipEl","canvas","parentNode","querySelector","document","createElement","classList","add","table","style","margin","append","customTooltips","context","tooltip","opacity","body","titleLines","title","bodyLines","map","b","lines","tableHead","tr","borderWidth","th","text","createTextNode","tableBody","i","entries","colors","labelColors","span","background","backgroundColor","borderColor","marginRight","height","width","display","td","tableRoot","firstChild","remove","offsetLeft","positionX","offsetTop","positionY","left","caretX","top","caretY","font","options","bodyFont","string","padding"],"sources":["../../js/src/custom-tooltips.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Custom Tooltips for Chart.js (v4.0.0-beta.1): custom-tooltips.js\n * Licensed under MIT (https://coreui.io/plugins/chart.js)\n * --------------------------------------------------------------------------\n */\n\nconst ClassName = {\n TOOLTIP: 'chartjs-tooltip',\n TOOLTIP_BODY: 'chartjs-tooltip-body',\n TOOLTIP_BODY_ITEM: 'chartjs-tooltip-body-item',\n TOOLTIP_HEADER: 'chartjs-tooltip-header',\n TOOLTIP_HEADER_ITEM: 'chartjs-tooltip-header-item'\n}\n\nconst getOrCreateTooltip = chart => {\n let tooltipEl = chart.canvas.parentNode.querySelector('div')\n\n if (!tooltipEl) {\n tooltipEl = document.createElement('div')\n tooltipEl.classList.add(ClassName.TOOLTIP)\n\n const table = document.createElement('table')\n table.style.margin = '0px'\n\n tooltipEl.append(table)\n chart.canvas.parentNode.append(tooltipEl)\n }\n\n return tooltipEl\n}\n\nconst customTooltips = context => {\n // Tooltip Element\n const { chart, tooltip } = context\n const tooltipEl = getOrCreateTooltip(chart)\n\n // Hide if no tooltip\n if (tooltip.opacity === 0) {\n tooltipEl.style.opacity = 0\n return\n }\n\n // Set Text\n if (tooltip.body) {\n const titleLines = tooltip.title || []\n const bodyLines = tooltip.body.map(b => b.lines)\n\n const tableHead = document.createElement('thead')\n tableHead.classList.add(ClassName.TOOLTIP_HEADER)\n\n for (const title of titleLines) {\n const tr = document.createElement('tr')\n tr.style.borderWidth = 0\n tr.classList.add(ClassName.TOOLTIP_HEADER_ITEM)\n\n const th = document.createElement('th')\n th.style.borderWidth = 0\n const text = document.createTextNode(title)\n\n th.append(text)\n tr.append(th)\n tableHead.append(tr)\n }\n\n const tableBody = document.createElement('tbody')\n tableBody.classList.add(ClassName.TOOLTIP_BODY)\n\n for (const [i, body] of bodyLines.entries()) {\n const colors = tooltip.labelColors[i]\n\n const span = document.createElement('span')\n span.style.background = colors.backgroundColor\n span.style.borderColor = colors.borderColor\n span.style.borderWidth = '2px'\n span.style.marginRight = '10px'\n span.style.height = '10px'\n span.style.width = '10px'\n span.style.display = 'inline-block'\n\n const tr = document.createElement('tr')\n tr.classList.add(ClassName.TOOLTIP_BODY_ITEM)\n\n const td = document.createElement('td')\n td.style.borderWidth = 0\n\n const text = document.createTextNode(body)\n\n td.append(span)\n td.append(text)\n tr.append(td)\n tableBody.append(tr)\n }\n\n const tableRoot = tooltipEl.querySelector('table')\n\n // Remove old children\n while (tableRoot.firstChild) {\n tableRoot.firstChild.remove()\n }\n\n // Add new children\n tableRoot.append(tableHead)\n tableRoot.append(tableBody)\n }\n\n const { offsetLeft: positionX, offsetTop: positionY } = chart.canvas\n\n // Display, position, and set styles for font\n tooltipEl.style.opacity = 1\n tooltipEl.style.left = `${positionX + tooltip.caretX}px`\n tooltipEl.style.top = `${positionY + tooltip.caretY}px`\n tooltipEl.style.font = tooltip.options.bodyFont.string\n tooltipEl.style.padding = `${tooltip.padding}px ${tooltip.padding}px`\n}\n\nexport default customTooltips\n"],"mappings":";;;;;AAOA,MAAMA,UAAY,CAChBC,QAAS,kBACTC,aAAc,uBACdC,kBAAmB,4BACnBC,eAAgB,yBAChBC,oBAAqB,+BAGjBC,mBAAqBC,IACzB,IAAIC,EAAYD,EAAME,OAAOC,WAAWC,cAAc,OAEtD,IAAKH,EAAW,CACdA,EAAYI,SAASC,cAAc,OACnCL,EAAUM,UAAUC,IAAIf,UAAUC,SAElC,MAAMe,EAAQJ,SAASC,cAAc,SACrCG,EAAMC,MAAMC,OAAS,MAErBV,EAAUW,OAAOH,GACjBT,EAAME,OAAOC,WAAWS,OAAOX,EACjC,CAEA,OAAOA,CAAS,EAGZY,eAAiBC,IAErB,MAAMd,MAAEA,EAAKe,QAAEA,GAAYD,EACrBb,EAAYF,mBAAmBC,GAGrC,GAAwB,IAApBe,EAAQC,QAEV,YADAf,EAAUS,MAAMM,QAAU,GAK5B,GAAID,EAAQE,KAAM,CAChB,MAAMC,EAAaH,EAAQI,OAAS,GAC9BC,EAAYL,EAAQE,KAAKI,KAAIC,GAAKA,EAAEC,QAEpCC,EAAYnB,SAASC,cAAc,SACzCkB,EAAUjB,UAAUC,IAAIf,UAAUI,gBAElC,IAAK,MAAMsB,KAASD,EAAY,CAC9B,MAAMO,EAAKpB,SAASC,cAAc,MAClCmB,EAAGf,MAAMgB,YAAc,EACvBD,EAAGlB,UAAUC,IAAIf,UAAUK,qBAE3B,MAAM6B,EAAKtB,SAASC,cAAc,MAClCqB,EAAGjB,MAAM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EAAQ4C,aAAa5C,EAAQ4C,WAAW,S"} \ No newline at end of file +{"version":3,"names":["ClassName","TOOLTIP","TOOLTIP_BODY","TOOLTIP_BODY_ITEM","TOOLTIP_HEADER","TOOLTIP_HEADER_ITEM","getOrCreateTooltip","chart","tooltipEl","canvas","parentNode","querySelector","document","createElement","classList","add","table","style","margin","append","customTooltips","context","tooltip","opacity","body","titleLines","title","bodyLines","map","b","lines","tableHead","tr","borderWidth","th","text","createTextNode","tableBody","i","entries","colors","labelColors","span","background","backgroundColor","borderColor","marginRight","height","width","display","td","tableRoot","firstChild","remove","offsetLeft","positionX","offsetTop","positionY","left","caretX","top","caretY","font","options","bodyFont","string","padding"],"sources":["../../js/src/custom-tooltips.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Custom Tooltips for Chart.js (v4.0.0-rc.0): custom-tooltips.js\n * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst ClassName = {\n TOOLTIP: 'chartjs-tooltip',\n TOOLTIP_BODY: 'chartjs-tooltip-body',\n TOOLTIP_BODY_ITEM: 'chartjs-tooltip-body-item',\n TOOLTIP_HEADER: 'chartjs-tooltip-header',\n TOOLTIP_HEADER_ITEM: 'chartjs-tooltip-header-item'\n}\n\nconst getOrCreateTooltip = chart => {\n let tooltipEl = chart.canvas.parentNode.querySelector('div')\n\n if (!tooltipEl) {\n tooltipEl = document.createElement('div')\n tooltipEl.classList.add(ClassName.TOOLTIP)\n\n const table = document.createElement('table')\n table.style.margin = '0px'\n\n tooltipEl.append(table)\n chart.canvas.parentNode.append(tooltipEl)\n }\n\n return tooltipEl\n}\n\nconst customTooltips = context => {\n // Tooltip Element\n const { chart, tooltip } = context\n const tooltipEl = getOrCreateTooltip(chart)\n\n // Hide if no tooltip\n if (tooltip.opacity === 0) {\n tooltipEl.style.opacity = 0\n return\n }\n\n // Set Text\n if (tooltip.body) {\n const titleLines = tooltip.title || []\n const bodyLines = tooltip.body.map(b => b.lines)\n\n const tableHead = document.createElement('thead')\n tableHead.classList.add(ClassName.TOOLTIP_HEADER)\n\n for (const title of titleLines) {\n const tr = document.createElement('tr')\n tr.style.borderWidth = 0\n tr.classList.add(ClassName.TOOLTIP_HEADER_ITEM)\n\n const th = document.createElement('th')\n th.style.borderWidth = 0\n const text = document.createTextNode(title)\n\n th.append(text)\n tr.append(th)\n tableHead.append(tr)\n }\n\n const tableBody = document.createElement('tbody')\n tableBody.classList.add(ClassName.TOOLTIP_BODY)\n\n for (const [i, body] of bodyLines.entries()) {\n const colors = tooltip.labelColors[i]\n\n const span = document.createElement('span')\n span.style.background = colors.backgroundColor\n span.style.borderColor = colors.borderColor\n span.style.borderWidth = '2px'\n span.style.marginRight = '10px'\n span.style.height = '10px'\n span.style.width = '10px'\n span.style.display = 'inline-block'\n\n const tr = document.createElement('tr')\n tr.classList.add(ClassName.TOOLTIP_BODY_ITEM)\n\n const td = document.createElement('td')\n td.style.borderWidth = 0\n\n const text = document.createTextNode(body)\n\n td.append(span)\n td.append(text)\n tr.append(td)\n tableBody.append(tr)\n }\n\n const tableRoot = tooltipEl.querySelector('table')\n\n // Remove old children\n while (tableRoot.firstChild) {\n tableRoot.firstChild.remove()\n }\n\n // Add new children\n tableRoot.append(tableHead)\n tableRoot.append(tableBody)\n }\n\n const { offsetLeft: positionX, offsetTop: positionY } = chart.canvas\n\n // Display, position, and set styles for font\n tooltipEl.style.opacity = 1\n tooltipEl.style.left = `${positionX + tooltip.caretX}px`\n tooltipEl.style.top = `${positionY + tooltip.caretY}px`\n tooltipEl.style.font = tooltip.options.bodyFont.string\n tooltipEl.style.padding = `${tooltip.padding}px ${tooltip.padding}px`\n}\n\nexport default customTooltips\n"],"mappings":";;;;;AAOA,MAAMA,UAAY,CAChBC,QAAS,kBACTC,aAAc,uBACdC,kBAAmB,4BACnBC,eAAgB,yBAChBC,oBAAqB,+BAGjBC,mBAAqBC,IACzB,IAAIC,EAAYD,EAAME,OAAOC,WAAW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EAAKzB,MAAM+B,MAAQ,OACnBN,EAAKzB,MAAMgC,QAAU,eAErB,MAAMjB,EAAKpB,SAASC,cAAc,MAClCmB,EAAGlB,UAAUC,IAAIf,UAAUG,mBAE3B,MAAM+C,EAAKtC,SAASC,cAAc,MAClCqC,EAAGjC,MAAMgB,YAAc,EAEvB,MAAME,EAAOvB,SAASwB,eAAeZ,GAErC0B,EAAG/B,OAAOuB,GACVQ,EAAG/B,OAAOgB,GACVH,EAAGb,OAAO+B,GACVb,EAAUlB,OAAOa,EACnB,CAEA,MAAMmB,EAAY3C,EAAUG,cAAc,SAG1C,KAAOwC,EAAUC,YACfD,EAAUC,WAAWC,SAIvBF,EAAUhC,OAAOY,GACjBoB,EAAUhC,OAAOkB,EACnB,CAEA,MAAQiB,WAAYC,EAAWC,UAAWC,GAAclD,EAAME,OAG9DD,EAAUS,MAAMM,QAAU,EAC1Bf,EAAUS,MAAMyC,KAAQ,GAAEH,EAAYjC,EAAQqC,WAC9CnD,EAAUS,MAAM2C,IAAO,GAAEH,EAAYnC,EAAQuC,WAC7CrD,EAAUS,MAAM6C,KAAOxC,EAAQyC,QAAQC,SAASC,OAChDzD,EAAUS,MAAMiD,QAAW,GAAE5C,EAAQ4C,aAAa5C,EAAQ4C,WAAW,S"} \ No newline at end of file diff --git a/dist/js/coreui-chartjs.js b/dist/js/coreui-chartjs.js index 9c4fc11..3815315 100644 --- a/dist/js/coreui-chartjs.js +++ b/dist/js/coreui-chartjs.js @@ -1,5 +1,5 @@ /*! - * CoreUI v4.0.0-beta.1 (https://coreui.io) + * CoreUI v4.0.0-rc.0 (https://coreui.io) * Copyright 2023 [object Object] * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE) */ @@ -11,8 +11,8 @@ /** * -------------------------------------------------------------------------- - * Custom Tooltips for Chart.js (v4.0.0-beta.1): custom-tooltips.js - * Licensed under MIT (https://coreui.io/plugins/chart.js) + * Custom Tooltips for Chart.js (v4.0.0-rc.0): custom-tooltips.js + * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE) * -------------------------------------------------------------------------- */ diff --git a/dist/js/coreui-chartjs.js.map b/dist/js/coreui-chartjs.js.map index a4b982a..9d443e6 100644 --- a/dist/js/coreui-chartjs.js.map +++ b/dist/js/coreui-chartjs.js.map @@ -1 +1 @@ -{"version":3,"file":"coreui-chartjs.js","sources":["../../js/src/custom-tooltips.js","../../js/index.umd.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Custom Tooltips for Chart.js (v4.0.0-beta.1): custom-tooltips.js\n * Licensed under MIT (https://coreui.io/plugins/chart.js)\n * --------------------------------------------------------------------------\n */\n\nconst ClassName = {\n TOOLTIP: 'chartjs-tooltip',\n TOOLTIP_BODY: 'chartjs-tooltip-body',\n TOOLTIP_BODY_ITEM: 'chartjs-tooltip-body-item',\n TOOLTIP_HEADER: 'chartjs-tooltip-header',\n TOOLTIP_HEADER_ITEM: 'chartjs-tooltip-header-item'\n}\n\nconst getOrCreateTooltip = chart => {\n let tooltipEl = chart.canvas.parentNode.querySelector('div')\n\n if (!tooltipEl) {\n tooltipEl = document.createElement('div')\n tooltipEl.classList.add(ClassName.TOOLTIP)\n\n const table = document.createElement('table')\n table.style.margin = '0px'\n\n tooltipEl.append(table)\n chart.canvas.parentNode.append(tooltipEl)\n }\n\n return tooltipEl\n}\n\nconst customTooltips = context => {\n // Tooltip Element\n const { chart, tooltip } = context\n const tooltipEl = getOrCreateTooltip(chart)\n\n // Hide if no tooltip\n if (tooltip.opacity === 0) {\n tooltipEl.style.opacity = 0\n return\n }\n\n // Set Text\n if (tooltip.body) {\n const titleLines = tooltip.title || []\n const bodyLines = tooltip.body.map(b => b.lines)\n\n const tableHead = document.createElement('thead')\n tableHead.classList.add(ClassName.TOOLTIP_HEADER)\n\n for (const title of titleLines) {\n const tr = document.createElement('tr')\n tr.style.borderWidth = 0\n tr.classList.add(ClassName.TOOLTIP_HEADER_ITEM)\n\n const th = document.createElement('th')\n th.style.borderWidth = 0\n const text = document.createTextNode(title)\n\n th.append(text)\n tr.append(th)\n tableHead.append(tr)\n }\n\n const tableBody = document.createElement('tbody')\n tableBody.classList.add(ClassName.TOOLTIP_BODY)\n\n for (const [i, body] of bodyLines.entries()) {\n const colors = tooltip.labelColors[i]\n\n const span = document.createElement('span')\n span.style.background = colors.backgroundColor\n span.style.borderColor = colors.borderColor\n span.style.borderWidth = '2px'\n span.style.marginRight = '10px'\n span.style.height = '10px'\n span.style.width = '10px'\n span.style.display = 'inline-block'\n\n const tr = document.createElement('tr')\n tr.classList.add(ClassName.TOOLTIP_BODY_ITEM)\n\n const td = document.createElement('td')\n td.style.borderWidth = 0\n\n const text = document.createTextNode(body)\n\n td.append(span)\n td.append(text)\n tr.append(td)\n tableBody.append(tr)\n }\n\n const tableRoot = tooltipEl.querySelector('table')\n\n // Remove old children\n while (tableRoot.firstChild) {\n tableRoot.firstChild.remove()\n }\n\n // Add new children\n tableRoot.append(tableHead)\n tableRoot.append(tableBody)\n }\n\n const { offsetLeft: positionX, offsetTop: positionY } = chart.canvas\n\n // Display, position, and set styles for font\n tooltipEl.style.opacity = 1\n tooltipEl.style.left = `${positionX + tooltip.caretX}px`\n tooltipEl.style.top = `${positionY + tooltip.caretY}px`\n tooltipEl.style.font = tooltip.options.bodyFont.string\n tooltipEl.style.padding = `${tooltip.padding}px ${tooltip.padding}px`\n}\n\nexport default customTooltips\n","/**\n * --------------------------------------------------------------------------\n * Custom Tooltips for Chart.js (v4.0.0-alpha.0): index.umd.js\n * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n// eslint-disable-next-line no-unused-vars\nimport customTooltips from './src/custom-tooltips.js'\n\nexport default {\n customTooltips\n}\n"],"names":["ClassName","TOOLTIP","TOOLTIP_BODY","TOOLTIP_BODY_ITEM","TOOLTIP_HEADER","TOOLTIP_HEADER_ITEM","getOrCreateTooltip","chart","tooltipEl","canvas","parentNode","querySelector","document","createElement","classList","add","table","style","margin","append","customTooltips","context","tooltip","opacity","body","titleLines","title","bodyLines","map","b","lines","tableHead","tr","borderWidth","th","text","createTextNode","tableBody","i","entries","colors","labelColors","span","background","backgroundColor","borderColor","marginRight","height","width","display","td","tableRoot","firstChild","remove","offsetLeft","positionX","offsetTop","positionY","left","caretX","top","caretY","font","options","bodyFont","string","padding"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA,MAAMA,SAAS,GAAG;EAChBC,EAAAA,OAAO,EAAE,iBAAiB;EAC1BC,EAAAA,YAAY,EAAE,sBAAsB;EACpCC,EAAAA,iBAAiB,EAAE,2BAA2B;EAC9CC,EAAAA,cAAc,EAAE,wBAAwB;EACxCC,EAAAA,mBAAmB,EAAE,6BAAA;EACvB,CAAC,CAAA;EAED,MAAMC,kBAAkB,GAAGC,KAAK,IAAI;IAClC,IAAIC,SAAS,GAAGD,KAAK,CAACE,MAAM,CAACC,UAAU,CAACC,aAAa,CAAC,KAAK,CAAC,CAAA;IAE5D,IAAI,CAACH,SAAS,EAAE;EACdA,IAAAA,SAAS,GAAGI,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,CAAA;MACzCL,SAAS,CAACM,SAAS,CAACC,GAAG,CAACf,SAAS,CAACC,OAAO,CAAC,CAAA;EAE1C,IAAA,MAAMe,KAAK,GAAGJ,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC,CAAA;EAC7CG,IAAAA,KAAK,CAACC,KAAK,CAACC,MAAM,GAAG,KAAK,CAAA;EAE1BV,IAAAA,SAAS,CAACW,MAAM,CAACH,KAAK,CAAC,CAAA;MACvBT,KAAK,CAACE,MAAM,CAACC,UAAU,CAACS,MAAM,CAACX,SAAS,CAAC,CAAA;EAC3C,GAAA;EAEA,EAAA,OAAOA,SAAS,CAAA;EAClB,CAAC,CAAA;EAED,MAAMY,cAAc,GAAGC,OAAO,IAAI;EAChC;IACA,MAAM;MAAEd,KAAK;EAAEe,IAAAA,OAAA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AA;EACtDzD,EAAAA,SAAS,CAACS,KAAK,CAACiD,OAAO,GAAI,CAAA,EAAE5C,OAAO,CAAC4C,OAAQ,CAAA,GAAA,EAAK5C,OAAO,CAAC4C,OAAQ,CAAG,EAAA,CAAA,CAAA;EACvE,CAAC;;EClHD;EACA;EACA;EACA;EACA;EACA;;AAKA,oBAAe;EACb9C,EAAAA,cAAAA;EACF,CAAC;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"coreui-chartjs.js","sources":["../../js/src/custom-tooltips.js","../../js/index.umd.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Custom Tooltips for Chart.js (v4.0.0-rc.0): custom-tooltips.js\n * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst ClassName = {\n TOOLTIP: 'chartjs-tooltip',\n TOOLTIP_BODY: 'chartjs-tooltip-body',\n TOOLTIP_BODY_ITEM: 'chartjs-tooltip-body-item',\n TOOLTIP_HEADER: 'chartjs-tooltip-header',\n TOOLTIP_HEADER_ITEM: 'chartjs-tooltip-header-item'\n}\n\nconst getOrCreateTooltip = chart => {\n let tooltipEl = chart.canvas.parentNode.querySelector('div')\n\n if (!tooltipEl) {\n tooltipEl = document.createElement('div')\n tooltipEl.classList.add(ClassName.TOOLTIP)\n\n const table = document.createElement('table')\n table.style.margin = '0px'\n\n tooltipEl.append(table)\n chart.canvas.parentNode.append(tooltipEl)\n }\n\n return tooltipEl\n}\n\nconst customTooltips = context => {\n // Tooltip Element\n const { chart, tooltip } = context\n const tooltipEl = getOrCreateTooltip(chart)\n\n // Hide if no tooltip\n if (tooltip.opacity === 0) {\n tooltipEl.style.opacity = 0\n return\n }\n\n // Set Text\n if (tooltip.body) {\n const titleLines = tooltip.title || []\n const bodyLines = tooltip.body.map(b => b.lines)\n\n const tableHead = document.createElement('thead')\n tableHead.classList.add(ClassName.TOOLTIP_HEADER)\n\n for (const title of titleLines) {\n const tr = document.createElement('tr')\n tr.style.borderWidth = 0\n tr.classList.add(ClassName.TOOLTIP_HEADER_ITEM)\n\n const th = document.createElement('th')\n th.style.borderWidth = 0\n const text = document.createTextNode(title)\n\n th.append(text)\n tr.append(th)\n tableHead.append(tr)\n }\n\n const tableBody = document.createElement('tbody')\n tableBody.classList.add(ClassName.TOOLTIP_BODY)\n\n for (const [i, body] of bodyLines.entries()) {\n const colors = tooltip.labelColors[i]\n\n const span = document.createElement('span')\n span.style.background = colors.backgroundColor\n span.style.borderColor = colors.borderColor\n span.style.borderWidth = '2px'\n span.style.marginRight = '10px'\n span.style.height = '10px'\n span.style.width = '10px'\n span.style.display = 'inline-block'\n\n const tr = document.createElement('tr')\n tr.classList.add(ClassName.TOOLTIP_BODY_ITEM)\n\n const td = document.createElement('td')\n td.style.borderWidth = 0\n\n const text = document.createTextNode(body)\n\n td.append(span)\n td.append(text)\n tr.append(td)\n tableBody.append(tr)\n }\n\n const tableRoot = tooltipEl.querySelector('table')\n\n // Remove old children\n while (tableRoot.firstChild) {\n tableRoot.firstChild.remove()\n }\n\n // Add new children\n tableRoot.append(tableHead)\n tableRoot.append(tableBody)\n }\n\n const { offsetLeft: positionX, offsetTop: positionY } = chart.canvas\n\n // Display, position, and set styles for font\n tooltipEl.style.opacity = 1\n tooltipEl.style.left = `${positionX + tooltip.caretX}px`\n tooltipEl.style.top = `${positionY + tooltip.caretY}px`\n tooltipEl.style.font = tooltip.options.bodyFont.string\n tooltipEl.style.padding = `${tooltip.padding}px ${tooltip.padding}px`\n}\n\nexport default customTooltips\n","/**\n * --------------------------------------------------------------------------\n * Custom Tooltips for Chart.js (v4.0.0-alpha.0): index.umd.js\n * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n// eslint-disable-next-line no-unused-vars\nimport customTooltips from './src/custom-tooltips.js'\n\nexport default {\n customTooltips\n}\n"],"names":["ClassName","TOOLTIP","TOOLTIP_BODY","TOOLTIP_BODY_ITEM","TOOLTIP_HEADER","TOOLTIP_HEADER_ITEM","getOrCreateTooltip","chart","tooltipEl","canvas","parentNode","querySelector","document","createElement","classList","add","table","style","margin","append","customTooltips","context","tooltip","opacity","body","titleLines","title","bodyLines","map","b","lines","tableHead","tr","borderWidth","th","text","createTextNode","tableBody","i","entries","colors","labelColors","span","background","backgroundColor","borderColor","marginRight","height","width","display","td","tableRoot","firstChild","remove","offsetLeft","positionX","offsetTop","positionY","left","caretX","top","caretY","font","options","bodyFont","string","padding"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA,MAAMA,SAAS,GAAG;EAChBC,EAAAA,OAAO,EAAE,iBAAiB;EAC1BC,EAAAA,YAAY,EAAE,sBAAsB;EACpCC,EAAAA,iBAAiB,EAAE,2BAA2B;EAC9CC,EAAAA,cAAc,EAAE,wBAAwB;EACxCC,EAAAA,mBAAmB,EAAE,6BAAA;EACvB,CAAC,CAAA;EAED,MAAMC,kBAAkB,GAAGC,KAAK,IAAI;IAClC,IAAIC,SAAS,GAAGD,KAAK,CAACE,MAAM,CAACC,UAAU,CAACC,aAAa,CAAC,KAAK,CAAC,CAAA;IAE5D,IAAI,CAACH,SAAS,EAAE;EACdA,IAAAA,SAAS,GAAGI,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,CAAA;MACzCL,SAAS,CAACM,SAAS,CAACC,GAAG,CAACf,SAAS,CAACC,OAAO,CAAC,CAAA;EAE1C,IAAA,MAAMe,KAAK,GAAGJ,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC,CAAA;EAC7CG,IAAAA,KAAK,CAACC,KAAK,CAACC,MAAM,GAAG,KAAK,CAAA;EAE1BV,IAAAA,SAAS,CAACW,MAAM,CAACH,KAAK,CAAC,CAAA;MACvBT,KAAK,CAACE,MAAM,CAACC,UAAU,CAACS,MAAM,CAACX,SAAS,CAAC,CAAA;EAC3C,GAAA;EAEA,EAAA,OAAOA,SAAS,CAAA;EAClB,CAAC,CAAA;EAED,MA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ACS,KAAK,CAAC6C,IAAI,GAAGxC,OAAO,CAACyC,OAAO,CAACC,QAAQ,CAACC,MAAM,CAAA;EACtDzD,EAAAA,SAAS,CAACS,KAAK,CAACiD,OAAO,GAAI,CAAA,EAAE5C,OAAO,CAAC4C,OAAQ,CAAA,GAAA,EAAK5C,OAAO,CAAC4C,OAAQ,CAAG,EAAA,CAAA,CAAA;EACvE,CAAC;;EClHD;EACA;EACA;EACA;EACA;EACA;;AAKA,oBAAe;EACb9C,EAAAA,cAAAA;EACF,CAAC;;;;;;;;"} \ No newline at end of file diff --git a/dist/js/coreui-chartjs.min.js b/dist/js/coreui-chartjs.min.js index 1b4de45..57d290c 100644 --- a/dist/js/coreui-chartjs.min.js +++ b/dist/js/coreui-chartjs.min.js @@ -1,5 +1,5 @@ /*! - * CoreUI v4.0.0-beta.1 (https://coreui.io) + * CoreUI v4.0.0-rc.0 (https://coreui.io) * Copyright 2023 [object Object] * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE) */ diff --git a/dist/js/coreui-chartjs.min.js.map b/dist/js/coreui-chartjs.min.js.map index 26da19e..2c591d9 100644 --- a/dist/js/coreui-chartjs.min.js.map +++ b/dist/js/coreui-chartjs.min.js.map @@ -1 +1 @@ -{"version":3,"names":["ClassName","customTooltips","context","chart","tooltip","tooltipEl","canvas","parentNode","querySelector","document","createElement","classList","add","table","style","margin","append","getOrCreateTooltip","opacity","body","titleLines","title","bodyLines","map","b","lines","tableHead","tr","borderWidth","th","text","createTextNode","tableBody","i","entries","colors","labelColors","span","background","backgroundColor","borderColor","marginRight","height","width","display","td","tableRoot","firstChild","remove","offsetLeft","positionX","offsetTop","positionY","left","caretX","top","caretY","font","options","bodyFont","string","padding"],"sources":["../../js/src/custom-tooltips.js","../../js/index.umd.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Custom Tooltips for Chart.js (v4.0.0-beta.1): custom-tooltips.js\n * Licensed under MIT (https://coreui.io/plugins/chart.js)\n * --------------------------------------------------------------------------\n */\n\nconst ClassName = {\n TOOLTIP: 'chartjs-tooltip',\n TOOLTIP_BODY: 'chartjs-tooltip-body',\n TOOLTIP_BODY_ITEM: 'chartjs-tooltip-body-item',\n TOOLTIP_HEADER: 'chartjs-tooltip-header',\n TOOLTIP_HEADER_ITEM: 'chartjs-tooltip-header-item'\n}\n\nconst getOrCreateTooltip = chart => {\n let tooltipEl = chart.canvas.parentNode.querySelector('div')\n\n if (!tooltipEl) {\n tooltipEl = document.createElement('div')\n tooltipEl.classList.add(ClassName.TOOLTIP)\n\n const table = document.createElement('table')\n table.style.margin = '0px'\n\n tooltipEl.append(table)\n chart.canvas.parentNode.append(tooltipEl)\n }\n\n return tooltipEl\n}\n\nconst customTooltips = context => {\n // Tooltip Element\n const { chart, tooltip } = context\n const tooltipEl = getOrCreateTooltip(chart)\n\n // Hide if no tooltip\n if (tooltip.opacity === 0) {\n tooltipEl.style.opacity = 0\n return\n }\n\n // Set Text\n if (tooltip.body) {\n const titleLines = tooltip.title || []\n const bodyLines = tooltip.body.map(b => b.lines)\n\n const tableHead = document.createElement('thead')\n tableHead.classList.add(ClassName.TOOLTIP_HEADER)\n\n for (const title of titleLines) {\n const tr = document.createElement('tr')\n tr.style.borderWidth = 0\n tr.classList.add(ClassName.TOOLTIP_HEADER_ITEM)\n\n const th = document.createElement('th')\n th.style.borderWidth = 0\n const text = document.createTextNode(title)\n\n th.append(text)\n tr.append(th)\n tableHead.append(tr)\n }\n\n const tableBody = document.createElement('tbody')\n tableBody.classList.add(ClassName.TOOLTIP_BODY)\n\n for (const [i, body] of bodyLines.entries()) {\n const colors = tooltip.labelColors[i]\n\n const span = document.createElement('span')\n span.style.background = colors.backgroundColor\n span.style.borderColor = colors.borderColor\n span.style.borderWidth = '2px'\n span.style.marginRight = '10px'\n span.style.height = '10px'\n span.style.width = '10px'\n span.style.display = 'inline-block'\n\n const tr = document.createElement('tr')\n tr.classList.add(ClassName.TOOLTIP_BODY_ITEM)\n\n const td = document.createElement('td')\n td.style.borderWidth = 0\n\n const text = document.createTextNode(body)\n\n td.append(span)\n td.append(text)\n tr.append(td)\n tableBody.append(tr)\n }\n\n const tableRoot = tooltipEl.querySelector('table')\n\n // Remove old children\n while (tableRoot.firstChild) {\n tableRoot.firstChild.remove()\n }\n\n // Add new children\n tableRoot.append(tableHead)\n tableRoot.append(tableBody)\n }\n\n const { offsetLeft: positionX, offsetTop: positionY } = chart.canvas\n\n // Display, position, and set styles for font\n tooltipEl.style.opacity = 1\n tooltipEl.style.left = `${positionX + tooltip.caretX}px`\n tooltipEl.style.top = `${positionY + tooltip.caretY}px`\n tooltipEl.style.font = tooltip.options.bodyFont.string\n tooltipEl.style.padding = `${tooltip.padding}px ${tooltip.padding}px`\n}\n\nexport default customTooltips\n","/**\n * --------------------------------------------------------------------------\n * Custom Tooltips for Chart.js (v4.0.0-alpha.0): index.umd.js\n * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n// eslint-disable-next-line no-unused-vars\nimport customTooltips from './src/custom-tooltips.js'\n\nexport default {\n customTooltips\n}\n"],"mappings":";;;;;uQAOA,MAAMA,EACK,kBADLA,EAEU,uBAFVA,EAGe,4BAHfA,EAIY,yBAJZA,EAKiB,8B,MCFR,CACbC,eDqBqBC,IAErB,MAAMC,MAAEA,EAAKC,QAAEA,GAAYF,EACrBG,EApBmBF,KACzB,IAAIE,EAAYF,EAAMG,OAAOC,WAAWC,cAAc,OAEtD,IAAKH,EAAW,CACdA,EAAYI,SAASC,cAAc,OACnCL,EAAUM,UAAUC,IAAIZ,GAExB,MAAMa,EAAQJ,SAASC,cAAc,SACrCG,EAAMC,MAAMC,OAAS,MAErBV,EAAUW,OAAOH,GACjBV,EAAMG,OAAOC,WAAWS,OAAOX,EACjC,CAEA,OAAOA,CAAS,EAMEY,CAAmBd,GAGrC,GAAwB,IAApBC,EAAQc,QAEV,YADAb,EAAUS,MAAMI,QAAU,GAK5B,GAAId,EAA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OAAOU,GACjBoB,EAAU9B,OAAOgB,EACnB,CAEA,MAAQiB,WAAYC,EAAWC,UAAWC,GAAcjD,EAAMG,OAG9DD,EAAUS,MAAMI,QAAU,EAC1Bb,EAAUS,MAAMuC,KAAQ,GAAEH,EAAY9C,EAAQkD,WAC9CjD,EAAUS,MAAMyC,IAAO,GAAEH,EAAYhD,EAAQoD,WAC7CnD,EAAUS,MAAM2C,KAAOrD,EAAQsD,QAAQC,SAASC,OAChDvD,EAAUS,MAAM+C,QAAW,GAAEzD,EAAQyD,aAAazD,EAAQyD,WAAW,E"} \ No newline at end of file +{"version":3,"names":["ClassName","customTooltips","context","chart","tooltip","tooltipEl","canvas","parentNode","querySelector","document","createElement","classList","add","table","style","margin","append","getOrCreateTooltip","opacity","body","titleLines","title","bodyLines","map","b","lines","tableHead","tr","borderWidth","th","text","createTextNode","tableBody","i","entries","colors","labelColors","span","background","backgroundColor","borderColor","marginRight","height","width","display","td","tableRoot","firstChild","remove","offsetLeft","positionX","offsetTop","positionY","left","caretX","top","caretY","font","options","bodyFont","string","padding"],"sources":["../../js/src/custom-tooltips.js","../../js/index.umd.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Custom Tooltips for Chart.js (v4.0.0-rc.0): custom-tooltips.js\n * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst ClassName = {\n TOOLTIP: 'chartjs-tooltip',\n TOOLTIP_BODY: 'chartjs-tooltip-body',\n TOOLTIP_BODY_ITEM: 'chartjs-tooltip-body-item',\n TOOLTIP_HEADER: 'chartjs-tooltip-header',\n TOOLTIP_HEADER_ITEM: 'chartjs-tooltip-header-item'\n}\n\nconst getOrCreateTooltip = chart => {\n let tooltipEl = chart.canvas.parentNode.querySelector('div')\n\n if (!tooltipEl) {\n tooltipEl = document.createElement('div')\n tooltipEl.classList.add(ClassName.TOOLTIP)\n\n const table = document.createElement('table')\n table.style.margin = '0px'\n\n tooltipEl.append(table)\n chart.canvas.parentNode.append(tooltipEl)\n }\n\n return tooltipEl\n}\n\nconst customTooltips = context => {\n // Tooltip Element\n const { chart, tooltip } = context\n const tooltipEl = getOrCreateTooltip(chart)\n\n // Hide if no tooltip\n if (tooltip.opacity === 0) {\n tooltipEl.style.opacity = 0\n return\n }\n\n // Set Text\n if (tooltip.body) {\n const titleLines = tooltip.title || []\n const bodyLines = tooltip.body.map(b => b.lines)\n\n const tableHead = document.createElement('thead')\n tableHead.classList.add(ClassName.TOOLTIP_HEADER)\n\n for (const title of titleLines) {\n const tr = document.createElement('tr')\n tr.style.borderWidth = 0\n tr.classList.add(ClassName.TOOLTIP_HEADER_ITEM)\n\n const th = document.createElement('th')\n th.style.borderWidth = 0\n const text = document.createTextNode(title)\n\n th.append(text)\n tr.append(th)\n tableHead.append(tr)\n }\n\n const tableBody = document.createElement('tbody')\n tableBody.classList.add(ClassName.TOOLTIP_BODY)\n\n for (const [i, body] of bodyLines.entries()) {\n const colors = tooltip.labelColors[i]\n\n const span = document.createElement('span')\n span.style.background = colors.backgroundColor\n span.style.borderColor = colors.borderColor\n span.style.borderWidth = '2px'\n span.style.marginRight = '10px'\n span.style.height = '10px'\n span.style.width = '10px'\n span.style.display = 'inline-block'\n\n const tr = document.createElement('tr')\n tr.classList.add(ClassName.TOOLTIP_BODY_ITEM)\n\n const td = document.createElement('td')\n td.style.borderWidth = 0\n\n const text = document.createTextNode(body)\n\n td.append(span)\n td.append(text)\n tr.append(td)\n tableBody.append(tr)\n }\n\n const tableRoot = tooltipEl.querySelector('table')\n\n // Remove old children\n while (tableRoot.firstChild) {\n tableRoot.firstChild.remove()\n }\n\n // Add new children\n tableRoot.append(tableHead)\n tableRoot.append(tableBody)\n }\n\n const { offsetLeft: positionX, offsetTop: positionY } = chart.canvas\n\n // Display, position, and set styles for font\n tooltipEl.style.opacity = 1\n tooltipEl.style.left = `${positionX + tooltip.caretX}px`\n tooltipEl.style.top = `${positionY + tooltip.caretY}px`\n tooltipEl.style.font = tooltip.options.bodyFont.string\n tooltipEl.style.padding = `${tooltip.padding}px ${tooltip.padding}px`\n}\n\nexport default customTooltips\n","/**\n * --------------------------------------------------------------------------\n * Custom Tooltips for Chart.js (v4.0.0-alpha.0): index.umd.js\n * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n// eslint-disable-next-line no-unused-vars\nimport customTooltips from './src/custom-tooltips.js'\n\nexport default {\n customTooltips\n}\n"],"mappings":";;;;;uQAOA,MAAMA,EACK,kBADLA,EAEU,uBAFVA,EAGe,4BAHfA,EAIY,yBAJZA,EAKiB,8B,MCFR,CACbC,eDqBqBC,IAErB,MAAMC,MAAEA,EAAKC,QAAEA,GAAYF,EACrBG,EApBmBF,KACzB,IAAIE,EAAYF,EAAMG,OAAOC,WAAWC,cAAc,OAEtD,IAAKH,EAAW,CACdA,EAAYI,SAASC,cAAc,OACnCL,EAAUM,UAAUC,IAAIZ,GAExB,MAAMa,EAAQJ,SAASC,cAAc,SACrCG,EAAMC,MAAMC,OAAS,MAErBV,EAAUW,OAAOH,GACjBV,EAAMG,OAAOC,WAAWS,OAAOX,EACjC,CAEA,OAAOA,CAAS,EAMEY,CAAmBd,GAGrC,GAAwB,IAApBC,EAAQc,QAEV,YADAb,EAAUS,MAAMI,QAAU,GAK5B,GAAId,EAAQe,KAAM,CAChB,MAAMC,EAAahB,EAAQiB,OAAS,GAC9BC,EAAYlB,EAAQe,KAAKI,KAAIC,GAAKA,EAAEC,QAEpCC,EAAYjB,SAASC,cAAc,SACzCgB,EAAUf,UAAUC,IAAIZ,GAExB,IAAK,MAAMqB,KAASD,EAAY,CAC9B,MAAMO,EAAKlB,SAASC,cAAc,MAClCiB,EAAGb,MAAMc,YAAc,EACvBD,EAAGhB,UAAUC,IAAIZ,GAEjB,MAAM6B,EAAKpB,SAASC,cAAc,MAClCmB,EAAGf,MAAMc,YAAc,EACvB,MAAME,EAAOrB,SAASsB,eAAeV,GAErC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.js b/js/src/custom-tooltips.js index 3faa36f..8a8fe63 100644 --- a/js/src/custom-tooltips.js +++ b/js/src/custom-tooltips.js @@ -1,7 +1,7 @@ /** * -------------------------------------------------------------------------- - * Custom Tooltips for Chart.js (v4.0.0-beta.1): custom-tooltips.js - * Licensed under MIT (https://coreui.io/plugins/chart.js) + * Custom Tooltips for Chart.js (v4.0.0-rc.0): custom-tooltips.js + * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE) * -------------------------------------------------------------------------- */ diff --git a/package-lock.json b/package-lock.json index 68cf997..1d487c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@coreui/chartjs", - "version": "4.0.0-beta.1", + "version": "4.0.0-rc.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@coreui/chartjs", - "version": "4.0.0-beta.1", + "version": "4.0.0-rc.0", "license": "MIT", "dependencies": { "@coreui/coreui": "^5.0.0-rc.0", diff --git a/package.json b/package.json index ec8a46b..7d13e51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@coreui/chartjs", - "version": "4.0.0-beta.1", + "version": "4.0.0-rc.0", "description": "Chart.js for CoreUI", "keywords": [ "chart", diff --git a/scss/coreui-chartjs.scss b/scss/coreui-chartjs.scss index 5f29cf7..1ec1e2d 100644 --- a/scss/coreui-chartjs.scss +++ b/scss/coreui-chartjs.scss @@ -1,6 +1,6 @@ /*! * CoreUI Plugins - Chart.js for CoreUI 3 - * @version v4.0.0-beta.1 + * @version v4.0.0-rc.0 * @link https://coreui.io * Copyright (c) 2023 creativeLabs Łukasz Holeczek * Licensed under MIT (https://github.com/coreui/coreui-chartjs/blob/main/LICENSE)