Skip to content

Commit c589415

Browse files
committed
fixed data-on-color, data-off-color for rating
1 parent eda37c1 commit c589415

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

examples/rating.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ <h1>Rating test page</h1>
2222
<input data-role="rating" data-stars="10">
2323
<input data-role="rating" data-value="3">
2424
<input data-role="rating" data-value="3" data-message="(3856)">
25-
<input data-role="rating" data-value="3" data-star-color="pink" data-stared-color="cyan">
25+
<input data-role="rating" data-value="3" data-off-color="var(--color-light-red)" data-on-color="red">
2626
</div>
2727

2828
</div>

lib/metro.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝
99

1010
* Metro UI v5.1.19 Components Library (https://metroui.org.ua)
11-
* Build: 10.09.2025, 11:49:58
11+
* Build: 20.09.2025, 12:03:47
1212
* Copyright 2012-2025 by Serhii Pimenov
1313
* Licensed under MIT
1414
*/
@@ -11497,7 +11497,7 @@
1149711497
(($7) => {
1149811498
"use strict";
1149911499
globalThis["__version__"] = "5.1.19";
11500-
globalThis["__build_time__"] = "10.09.2025, 11:49:58";
11500+
globalThis["__build_time__"] = "20.09.2025, 12:03:47";
1150111501
const meta_init = $7.meta("metro:init").attr("content");
1150211502
const meta_cloak = $7.meta("metro:cloak").attr("content");
1150311503
const meta_cloak_duration = $7.meta("metro:cloak_duration").attr("content");
@@ -11844,7 +11844,7 @@
1184411844
const normalizeComponentName2 = (name2) => typeof name2 !== "string" ? void 0 : name2.replace(/-/g, "").toLowerCase();
1184511845
const Metro2 = {
1184611846
version: "5.1.19",
11847-
build_time: "10.09.2025, 11:49:58",
11847+
build_time: "20.09.2025, 12:03:47",
1184811848
buildNumber: 0,
1184911849
isTouchable: isTouch3,
1185011850
fullScreenEnabled: document.fullscreenEnabled,
@@ -36635,12 +36635,11 @@ ${err.message}`);
3663536635
}
3663636636
const result = $7("<span>").addClass("result").addClass(o2.clsResult).appendTo(rating);
3663736637
result.html(o2.message);
36638-
if (o2.offColor !== null && (o2.offColor.includes("var(") || Farbe.Routines.isColor(o2.offColor))) {
36638+
if (o2.offColor) {
36639+
rating.cssVar("rating-off-color", o2.offColor);
3663936640
}
36640-
if (o2.onColor !== null && (o2.onColor.includes("var(") || Farbe.Routines.isColor(o2.onColor))) {
36641-
Metro2.utils.addCssRule(sheet, `#${id} .stars:hover li`, `color: ${o2.onColor};`);
36642-
Metro2.utils.addCssRule(sheet, `#${id} .stars li.on`, `color: ${o2.onColor};`);
36643-
Metro2.utils.addCssRule(sheet, `#${id} .stars li.half::after`, `color: ${o2.onColor};`);
36641+
if (o2.onColor) {
36642+
rating.cssVar("rating-on-color", o2.onColor);
3664436643
}
3664536644
if (o2.title !== null) {
3664636645
const title = $7("<span>").addClass("title").addClass(o2.clsTitle).html(o2.title);

lib/metro.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/components/rating/rating.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,12 @@
112112
const result = $("<span>").addClass("result").addClass(o.clsResult).appendTo(rating);
113113
result.html(o.message);
114114

115-
if (o.offColor !== null && (o.offColor.includes("var(") || Farbe.Routines.isColor(o.offColor))) {
116-
// nothing current
115+
if (o.offColor) {
116+
rating.cssVar("rating-off-color", o.offColor);
117117
}
118118

119-
if (o.onColor !== null && (o.onColor.includes("var(") || Farbe.Routines.isColor(o.onColor))) {
120-
Metro.utils.addCssRule(sheet, `#${id} .stars:hover li`, `color: ${o.onColor};`);
121-
Metro.utils.addCssRule(sheet, `#${id} .stars li.on`, `color: ${o.onColor};`);
122-
Metro.utils.addCssRule(sheet, `#${id} .stars li.half::after`, `color: ${o.onColor};`);
119+
if (o.onColor) {
120+
rating.cssVar("rating-on-color", o.onColor);
123121
}
124122

125123
if (o.title !== null) {

0 commit comments

Comments
 (0)