@progress/kendo-vue-inputs
Version:
64 lines (63 loc) • 2.48 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import { defineComponent as F, createVNode as o, createTextVNode as d } from "vue";
import { provideLocalizationService as M } from "@progress/kendo-vue-intl";
import { checkIcon as e, xIcon as g } from "@progress/kendo-svg-icons";
import { colorGradientContrastRatio as p, messages as a, colorGradientAALevel as u, colorGradientAAALevel as m, colorGradientPass as k, colorGradientFail as x } from "../messages/main.mjs";
import { getContrastFromTwoRGBAs as T } from "./utils/color-parser.mjs";
import { Icon as n } from "@progress/kendo-vue-common";
const z = /* @__PURE__ */ F({
name: "KendoColorContrastLabels",
props: {
bgColor: Object,
rgba: Object
},
inject: {
kendoLocalizationService: {
default: null
}
},
render() {
const t = M(this), v = t.toLanguageString(p, a[p]), A = t.toLanguageString(u, a[u]), L = t.toLanguageString(m, a[m]), C = t.toLanguageString(k, a[k]), b = t.toLanguageString(x, a[x]), s = T(this.$props.rgba, this.$props.bgColor), f = 4.5.toFixed(1), $ = 7 .toFixed(1), h = `${v}: ${s.toFixed(2)}`, S = `${A}: ${f}`, G = `${L}: ${$}`, r = s >= 4.5, c = s >= 7, i = o("span", {
key: 1,
class: "k-contrast-validation k-text-success"
}, [C, d(" "), o(n, {
name: "check",
icon: e
}, null)]), l = o("span", {
key: 2,
class: "k-contrast-validation k-text-error"
}, [b, d(" "), o(n, {
name: "x",
icon: g
}, null)]);
return o("div", {
class: "k-vbox k-colorgradient-color-contrast"
}, [o("div", {
class: "k-contrast-ratio"
}, [o("span", {
class: "k-contrast-ratio-text"
}, [h]), r ? o("span", {
class: "k-contrast-validation k-text-success"
}, [o(n, {
name: "check",
icon: e
}, null), c && o(n, {
name: "check",
icon: e
}, null)]) : o("span", {
class: "k-contrast-validation k-text-error"
}, [o(n, {
name: "x",
icon: g
}, null)])]), o("div", null, [o("span", null, [S]), r ? i : l]), o("div", null, [o("span", null, [G]), c ? i : l])]);
}
});
export {
z as ColorContrastLabels
};