revdev-components 0.194.0 → 0.195.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/badges/level/index.d.ts +1 -0
- package/build/index.js +11 -5
- package/build/styles.css +33 -4
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -5809,10 +5809,11 @@ var HelpTip = function (_a) {
|
|
|
5809
5809
|
return (React.createElement(AppTooltip, { title: title || children, placement: "top" }, href ? (React.createElement(AppLink, { href: href, target: target }, iconNode)) : (iconNode)));
|
|
5810
5810
|
};
|
|
5811
5811
|
|
|
5812
|
-
var s = {"root":"index-module_root__W7fFh","
|
|
5812
|
+
var s = {"root":"index-module_root__W7fFh","root__compact":"index-module_root__compact__4t0Qf","bar":"index-module_bar__V-ymE","level":"index-module_level__J8dSJ","bar__rate":"index-module_bar__rate__w6r3z","code":"index-module_code__aAnic","label":"index-module_label__gftYy"};
|
|
5813
5813
|
|
|
5814
5814
|
var LevelBadge = function (_a) {
|
|
5815
|
-
var
|
|
5815
|
+
var _b;
|
|
5816
|
+
var levels = _a.levels, className = _a.className, texts = _a.texts, children = _a.children, _c = _a.mode, mode = _c === void 0 ? "default" : _c;
|
|
5816
5817
|
var bars = React.useMemo(function () {
|
|
5817
5818
|
var maxRate = Math.max.apply(Math, levels.map(function (x) { return x.rate; }));
|
|
5818
5819
|
return levels.map(function (x) { return [x.code.toUpperCase(), x.rate, x.rate / maxRate]; });
|
|
@@ -5823,17 +5824,22 @@ var LevelBadge = function (_a) {
|
|
|
5823
5824
|
refersTo: (_a = texts === null || texts === void 0 ? void 0 : texts.refersTo) !== null && _a !== void 0 ? _a : (function (level) { return "Level ".concat(level.code, " at ").concat(numeral(level.rate).format("0%")); }),
|
|
5824
5825
|
};
|
|
5825
5826
|
}, [texts]);
|
|
5827
|
+
var renderCode = React.useCallback(function (code) {
|
|
5828
|
+
return mode === "compact" ? (React.createElement("div", { className: s.code },
|
|
5829
|
+
React.createElement("span", null, code))) : null;
|
|
5830
|
+
}, [levels, mode]);
|
|
5826
5831
|
if (bars.length === 0) {
|
|
5827
5832
|
return null;
|
|
5828
5833
|
}
|
|
5829
|
-
return (React.createElement("div", { className: classNames(s.root, className) },
|
|
5834
|
+
return (React.createElement("div", { className: classNames(s.root, (_b = {}, _b[s.root__compact] = mode === "compact", _b), className) },
|
|
5830
5835
|
bars.map(function (_a) {
|
|
5831
5836
|
var code = _a[0], rate = _a[1], normalizedRate = _a[2];
|
|
5832
5837
|
return (React.createElement(AppTooltip, { key: code, title: interText.refersTo({ code: code, rate: rate }), placement: "top" },
|
|
5833
5838
|
React.createElement("div", { key: code, className: s.level },
|
|
5834
5839
|
React.createElement("div", { className: s.bar },
|
|
5835
|
-
React.createElement("div", { className: s.bar__rate, style: { height: "".concat(normalizedRate * 100, "%") } })),
|
|
5836
|
-
|
|
5840
|
+
React.createElement("div", { className: s.bar__rate, style: { height: "".concat(normalizedRate * 100, "%") } }, renderCode(code)),
|
|
5841
|
+
renderCode(code)),
|
|
5842
|
+
mode === "default" && React.createElement("div", { className: s.label }, code))));
|
|
5837
5843
|
}),
|
|
5838
5844
|
children));
|
|
5839
5845
|
};
|
package/build/styles.css
CHANGED
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
--iconDropBackgroundColor: white;
|
|
37
37
|
--helpTipMargin: none;
|
|
38
38
|
--helpTipFontSize: 0.8em;
|
|
39
|
+
--levelBadgeBarBackgroundColor: #e4e4e4;
|
|
40
|
+
--levelBadgeColor: #555;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
html,
|
|
@@ -672,6 +674,10 @@ body {
|
|
|
672
674
|
flex-direction: row;
|
|
673
675
|
font-size: 12px;
|
|
674
676
|
gap: 0.3em;
|
|
677
|
+
color: var(--levelBadgeColor);
|
|
678
|
+
}
|
|
679
|
+
.index-module_root__compact__4t0Qf .index-module_bar__V-ymE {
|
|
680
|
+
width: 1.4em;
|
|
675
681
|
}
|
|
676
682
|
|
|
677
683
|
.index-module_level__J8dSJ {
|
|
@@ -680,18 +686,41 @@ body {
|
|
|
680
686
|
}
|
|
681
687
|
|
|
682
688
|
.index-module_bar__V-ymE {
|
|
683
|
-
height: 1.
|
|
684
|
-
background-color: rgba(15, 23, 42, 0.055);
|
|
689
|
+
height: 1.2em;
|
|
685
690
|
display: flex;
|
|
686
691
|
align-items: flex-end;
|
|
687
692
|
justify-content: center;
|
|
693
|
+
position: relative;
|
|
694
|
+
background-color: var(--levelBadgeBarBackgroundColor);
|
|
695
|
+
color: var(--levelBadgeColor);
|
|
696
|
+
z-index: 0;
|
|
688
697
|
}
|
|
689
698
|
|
|
690
699
|
.index-module_bar__rate__w6r3z {
|
|
691
700
|
width: 100%;
|
|
692
|
-
background-color: var(--
|
|
701
|
+
background-color: var(--levelBadgeColor);
|
|
702
|
+
position: relative;
|
|
703
|
+
overflow: hidden;
|
|
704
|
+
left: 0;
|
|
705
|
+
bottom: 0;
|
|
706
|
+
z-index: 1;
|
|
707
|
+
}
|
|
708
|
+
.index-module_bar__rate__w6r3z .index-module_code__aAnic {
|
|
709
|
+
color: var(--levelBadgeBarBackgroundColor);
|
|
710
|
+
z-index: 2;
|
|
693
711
|
}
|
|
694
712
|
|
|
695
|
-
.index-
|
|
713
|
+
.index-module_label__gftYy {
|
|
696
714
|
padding: 1px 0;
|
|
715
|
+
text-align: center;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
.index-module_code__aAnic {
|
|
719
|
+
position: absolute;
|
|
720
|
+
bottom: 0;
|
|
721
|
+
left: 50%;
|
|
722
|
+
display: flex;
|
|
723
|
+
place-items: center;
|
|
724
|
+
transform: translateX(-50%);
|
|
725
|
+
font-weight: bold;
|
|
697
726
|
}
|