@aurea-uds/react 0.8.13 → 0.8.14
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/markup.d.ts +4 -1
- package/dist/markup.js +2 -2
- package/package.json +1 -1
package/dist/markup.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export declare function Prose({ className, ...props }: HTMLAttributes<HTMLDivEle
|
|
|
38
38
|
export type BadgeEmphasis = "soft" | "solid" | "outline";
|
|
39
39
|
export type BadgeSize = "xs" | "sm" | "md" | "lg";
|
|
40
40
|
export type BadgePlacement = "top-end" | "top-start" | "bottom-end" | "bottom-start";
|
|
41
|
+
export type BadgeFit = "auto" | "content";
|
|
41
42
|
export declare function formatBadgeCount(count: number, max?: number): string;
|
|
42
43
|
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement>, RefAttributes<HTMLSpanElement> {
|
|
43
44
|
variant?: BadgeVariant;
|
|
@@ -55,6 +56,8 @@ export interface BadgeProps extends HTMLAttributes<HTMLSpanElement>, RefAttribut
|
|
|
55
56
|
count?: number;
|
|
56
57
|
max?: number;
|
|
57
58
|
showZero?: boolean;
|
|
59
|
+
/** `content`: do tamanho do texto mesmo numa coluna. Padrão `auto`, que segue o recipiente. */
|
|
60
|
+
fit?: BadgeFit;
|
|
58
61
|
/** Liga o modo SOBREPOSTO e escolhe o canto. `children` passa a ser o que se decora. */
|
|
59
62
|
anchor?: BadgePlacement;
|
|
60
63
|
/** `circle` recolhe o canto em 14% — é o `overlap` da MUI, para avatar redondo. */
|
|
@@ -65,7 +68,7 @@ export interface BadgeProps extends HTMLAttributes<HTMLSpanElement>, RefAttribut
|
|
|
65
68
|
* Nome da MUI, e não `content`: este colide com o atributo HTML de mesmo nome. */
|
|
66
69
|
badgeContent?: ReactNode;
|
|
67
70
|
}
|
|
68
|
-
export declare function Badge({ variant, emphasis, size, dot, leading, trailing, image, imageAlt, count, max, showZero, anchor, anchorShape, invisible, badgeContent, children, className, ...props }: BadgeProps): React.JSX.Element;
|
|
71
|
+
export declare function Badge({ variant, emphasis, size, dot, leading, trailing, image, imageAlt, count, max, showZero, fit, anchor, anchorShape, invisible, badgeContent, children, className, ...props }: BadgeProps): React.JSX.Element;
|
|
69
72
|
export declare function Progress({ value, label }: {
|
|
70
73
|
value: number;
|
|
71
74
|
label?: string;
|
package/dist/markup.js
CHANGED
|
@@ -83,12 +83,12 @@ export function Prose({ className, ...props }) { return _jsx("div", { className:
|
|
|
83
83
|
// `max` com `+` é o idioma universal do contador (MUI, Ant, Material 3). Exportada porque quem
|
|
84
84
|
// escreve o nome acessível precisa do MESMO texto — "99+ unread" tem de bater com o que se vê.
|
|
85
85
|
export function formatBadgeCount(count, max = 99) { return count > max ? `${max}+` : String(count); }
|
|
86
|
-
export function Badge({ variant = "neutral", emphasis = "soft", size = "md", dot, leading, trailing, image, imageAlt, count, max = 99, showZero, anchor, anchorShape = "square", invisible, badgeContent, children, className, ...props }) {
|
|
86
|
+
export function Badge({ variant = "neutral", emphasis = "soft", size = "md", dot, leading, trailing, image, imageAlt, count, max = 99, showZero, fit = "auto", anchor, anchorShape = "square", invisible, badgeContent, children, className, ...props }) {
|
|
87
87
|
const numero = count != null ? formatBadgeCount(count, max) : undefined;
|
|
88
88
|
const miolo = anchor ? (numero ?? badgeContent) : (numero ?? children);
|
|
89
89
|
// Ponto puro: `dot` sem nada para mostrar. Aí o badge não tem conteúdo, e ganha medida própria.
|
|
90
90
|
const soPonto = !!dot && miolo == null;
|
|
91
|
-
const chip = _jsxs("span", { className: cx("badge", variant !== "neutral" && `badge-${variant}`, emphasis !== "soft" && `badge-${emphasis}`, size !== "md" && `badge-${size}`, anchor && `badge-overlay badge-at-${anchor}`, anchor && anchorShape === "circle" && "badge-on-circle", anchor && soPonto && "badge-is-dot", className), ...props, children: [dot && !soPonto && _jsx("span", { className: "badge-dot" }), image && _jsx("img", { className: "badge-image", src: image, alt: imageAlt ?? "" }), leading, miolo, trailing] });
|
|
91
|
+
const chip = _jsxs("span", { className: cx("badge", variant !== "neutral" && `badge-${variant}`, emphasis !== "soft" && `badge-${emphasis}`, size !== "md" && `badge-${size}`, fit === "content" && !anchor && "badge-fit", anchor && `badge-overlay badge-at-${anchor}`, anchor && anchorShape === "circle" && "badge-on-circle", anchor && soPonto && "badge-is-dot", className), ...props, children: [dot && !soPonto && _jsx("span", { className: "badge-dot" }), image && _jsx("img", { className: "badge-image", src: image, alt: imageAlt ?? "" }), leading, miolo, trailing] });
|
|
92
92
|
if (!anchor)
|
|
93
93
|
return chip;
|
|
94
94
|
// Some em zero por padrão, como a MUI: caixa de entrada zerada não merece um "0" no canto.
|