analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
48 lines (42 loc) • 1.53 kB
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true});
var _chunkTN3AYOMVjs = require('./chunk-TN3AYOMV.js');
// src/components/LevelBar/LevelBar.tsx
var _jsxruntime = require('react/jsx-runtime');
var SEGMENTS = 4;
var LevelBar = ({
value,
colorClass = "bg-success-400",
trackColorClass = "bg-background-400",
className = "",
...props
}) => {
const filled = Math.min(Math.max(Math.trunc(value), 0), SEGMENTS);
return (
// Decorative: the level is always rendered as adjacent text ("Nível 2 de
// 4"), so announcing the bar too would just repeat it. Wrap it with your
// own label if you render it without that text.
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
"div",
{
"data-component": "LevelBar",
className: _chunkTN3AYOMVjs.cn.call(void 0, "flex w-full items-center gap-1", className),
"aria-hidden": "true",
...props,
children: Array.from({ length: SEGMENTS }, (_, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
"span",
{
"data-testid": index < filled ? "level-bar-filled" : "level-bar-empty",
className: _chunkTN3AYOMVjs.cn.call(void 0,
"flex-1 h-1.5 rounded-full",
index < filled ? colorClass : trackColorClass
)
},
index
))
}
)
);
};
var LevelBar_default = LevelBar;
exports.LevelBar = LevelBar; exports.LevelBar_default = LevelBar_default;
//# sourceMappingURL=chunk-IUKWYF5V.js.map