@motor-hero/ui-kit 0.51.1 → 0.52.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/dist/components/rating.d.ts.map +1 -1
- package/dist/index.cjs +30 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +148 -129
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/rating.tsx +30 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rating.d.ts","sourceRoot":"","sources":["../../src/components/rating.tsx"],"names":[],"mappings":"AAYA,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;
|
|
1
|
+
{"version":3,"file":"rating.d.ts","sourceRoot":"","sources":["../../src/components/rating.tsx"],"names":[],"mappings":"AAYA,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAWD,wBAAgB,MAAM,CAAC,EACrB,KAAS,EACT,QAAQ,EACR,QAAgB,EAChB,IAAW,EACX,SAAS,EACT,YAAY,EAAE,SAAS,GACxB,EAAE,WAAW,+BA8Eb"}
|
package/dist/index.cjs
CHANGED
|
@@ -687,8 +687,9 @@ var sizeClasses2 = {
|
|
|
687
687
|
md: "h-5 w-5",
|
|
688
688
|
lg: "h-6 w-6"
|
|
689
689
|
};
|
|
690
|
+
var formatNote = (value) => value.toLocaleString("pt-BR", { maximumFractionDigits: 1 });
|
|
690
691
|
function defaultLabel(value) {
|
|
691
|
-
return value > 0 ? `
|
|
692
|
+
return value > 0 ? `Nota ${formatNote(value)} de ${MAX_STARS}` : "Avalia\xE7\xE3o: sem nota";
|
|
692
693
|
}
|
|
693
694
|
function Rating({
|
|
694
695
|
value = 0,
|
|
@@ -707,17 +708,35 @@ function Rating({
|
|
|
707
708
|
role: "img",
|
|
708
709
|
"aria-label": label,
|
|
709
710
|
className: cn("inline-flex items-center gap-0.5", className),
|
|
710
|
-
children: Array.from({ length: MAX_STARS }, (_, index) =>
|
|
711
|
-
|
|
712
|
-
{
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
711
|
+
children: Array.from({ length: MAX_STARS }, (_, index) => {
|
|
712
|
+
const fill = Math.min(1, Math.max(0, clamped - index));
|
|
713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "relative inline-flex", children: [
|
|
714
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
715
|
+
import_lucide_react5.Star,
|
|
716
|
+
{
|
|
717
|
+
"aria-hidden": true,
|
|
718
|
+
className: cn(sizeClasses2[size], "text-muted-foreground")
|
|
719
|
+
}
|
|
720
|
+
),
|
|
721
|
+
fill > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
722
|
+
"span",
|
|
723
|
+
{
|
|
724
|
+
className: "absolute inset-y-0 left-0 overflow-hidden",
|
|
725
|
+
style: { width: `${fill * 100}%` },
|
|
726
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
727
|
+
import_lucide_react5.Star,
|
|
728
|
+
{
|
|
729
|
+
"aria-hidden": true,
|
|
730
|
+
className: cn(
|
|
731
|
+
sizeClasses2[size],
|
|
732
|
+
"max-w-none fill-amber-400 text-amber-400"
|
|
733
|
+
)
|
|
734
|
+
}
|
|
735
|
+
)
|
|
736
|
+
}
|
|
717
737
|
)
|
|
718
|
-
},
|
|
719
|
-
|
|
720
|
-
))
|
|
738
|
+
] }, index);
|
|
739
|
+
})
|
|
721
740
|
}
|
|
722
741
|
);
|
|
723
742
|
}
|