@rehagro/ui 1.0.5 → 1.0.6
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/index.d.mts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +60 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -18
- package/dist/index.mjs.map +1 -1
- package/dist/native.d.mts +4 -0
- package/dist/native.d.ts +4 -0
- package/dist/native.js +35 -3
- package/dist/native.js.map +1 -1
- package/dist/native.mjs +36 -4
- package/dist/native.mjs.map +1 -1
- package/dist/styles.css +3 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -130,6 +130,14 @@ declare function RehagroProvider({ theme, toastPosition, children }: RehagroProv
|
|
|
130
130
|
type ButtonVariant = "solid" | "outline" | "ghost";
|
|
131
131
|
type ButtonSize = "sm" | "md" | "lg";
|
|
132
132
|
type ButtonRadius = "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "full";
|
|
133
|
+
type ButtonHoverStyle = {
|
|
134
|
+
/** Background color on hover */
|
|
135
|
+
backgroundColor?: string;
|
|
136
|
+
/** Border color on hover */
|
|
137
|
+
borderColor?: string;
|
|
138
|
+
/** Text color on hover */
|
|
139
|
+
color?: string;
|
|
140
|
+
};
|
|
133
141
|
type ButtonProps = React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
134
142
|
/** Visual style variant */
|
|
135
143
|
variant?: ButtonVariant;
|
|
@@ -141,6 +149,8 @@ type ButtonProps = React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
|
141
149
|
color?: ButtonColor;
|
|
142
150
|
/** Custom hover color — overrides the token for this button only. Only applies to preset colors. Accepts "#RRGGBB", "r g b", or "rgb(r,g,b)" */
|
|
143
151
|
hoverColor?: string;
|
|
152
|
+
/** Custom hover styles - allows full control over hover appearance */
|
|
153
|
+
hoverStyle?: ButtonHoverStyle;
|
|
144
154
|
/** Shows loading state and disables interaction */
|
|
145
155
|
loading?: boolean;
|
|
146
156
|
/** Icon rendered to the left of children (hidden when loading) */
|
|
@@ -159,6 +169,8 @@ declare const Button: React$1.ForwardRefExoticComponent<React$1.ButtonHTMLAttrib
|
|
|
159
169
|
color?: ButtonColor;
|
|
160
170
|
/** Custom hover color — overrides the token for this button only. Only applies to preset colors. Accepts "#RRGGBB", "r g b", or "rgb(r,g,b)" */
|
|
161
171
|
hoverColor?: string;
|
|
172
|
+
/** Custom hover styles - allows full control over hover appearance */
|
|
173
|
+
hoverStyle?: ButtonHoverStyle;
|
|
162
174
|
/** Shows loading state and disables interaction */
|
|
163
175
|
loading?: boolean;
|
|
164
176
|
/** Icon rendered to the left of children (hidden when loading) */
|
|
@@ -362,6 +374,8 @@ type AvatarProps = Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
|
362
374
|
size?: AvatarSize;
|
|
363
375
|
/** Shape variant */
|
|
364
376
|
variant?: AvatarVariant;
|
|
377
|
+
/** Generate background and text color automatically based on name/alt */
|
|
378
|
+
colorFromName?: boolean;
|
|
365
379
|
};
|
|
366
380
|
declare const Avatar: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
367
381
|
/** Image source URL */
|
|
@@ -374,6 +388,8 @@ declare const Avatar: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttribu
|
|
|
374
388
|
size?: AvatarSize;
|
|
375
389
|
/** Shape variant */
|
|
376
390
|
variant?: AvatarVariant;
|
|
391
|
+
/** Generate background and text color automatically based on name/alt */
|
|
392
|
+
colorFromName?: boolean;
|
|
377
393
|
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
378
394
|
|
|
379
395
|
type TagSize = "sm" | "md" | "lg";
|
|
@@ -540,6 +556,8 @@ type TableProps<T> = Omit<React$1.HTMLAttributes<HTMLTableElement>, "children">
|
|
|
540
556
|
loadingContent?: React$1.ReactNode;
|
|
541
557
|
/** Whether the table has sticky header */
|
|
542
558
|
stickyHeader?: boolean;
|
|
559
|
+
/** Custom header row style */
|
|
560
|
+
headerStyle?: React$1.CSSProperties;
|
|
543
561
|
};
|
|
544
562
|
declare const Table: <T>(props: TableProps<T> & {
|
|
545
563
|
ref?: React$1.ForwardedRef<HTMLTableElement>;
|
package/dist/index.d.ts
CHANGED
|
@@ -130,6 +130,14 @@ declare function RehagroProvider({ theme, toastPosition, children }: RehagroProv
|
|
|
130
130
|
type ButtonVariant = "solid" | "outline" | "ghost";
|
|
131
131
|
type ButtonSize = "sm" | "md" | "lg";
|
|
132
132
|
type ButtonRadius = "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "full";
|
|
133
|
+
type ButtonHoverStyle = {
|
|
134
|
+
/** Background color on hover */
|
|
135
|
+
backgroundColor?: string;
|
|
136
|
+
/** Border color on hover */
|
|
137
|
+
borderColor?: string;
|
|
138
|
+
/** Text color on hover */
|
|
139
|
+
color?: string;
|
|
140
|
+
};
|
|
133
141
|
type ButtonProps = React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
134
142
|
/** Visual style variant */
|
|
135
143
|
variant?: ButtonVariant;
|
|
@@ -141,6 +149,8 @@ type ButtonProps = React$1.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
|
141
149
|
color?: ButtonColor;
|
|
142
150
|
/** Custom hover color — overrides the token for this button only. Only applies to preset colors. Accepts "#RRGGBB", "r g b", or "rgb(r,g,b)" */
|
|
143
151
|
hoverColor?: string;
|
|
152
|
+
/** Custom hover styles - allows full control over hover appearance */
|
|
153
|
+
hoverStyle?: ButtonHoverStyle;
|
|
144
154
|
/** Shows loading state and disables interaction */
|
|
145
155
|
loading?: boolean;
|
|
146
156
|
/** Icon rendered to the left of children (hidden when loading) */
|
|
@@ -159,6 +169,8 @@ declare const Button: React$1.ForwardRefExoticComponent<React$1.ButtonHTMLAttrib
|
|
|
159
169
|
color?: ButtonColor;
|
|
160
170
|
/** Custom hover color — overrides the token for this button only. Only applies to preset colors. Accepts "#RRGGBB", "r g b", or "rgb(r,g,b)" */
|
|
161
171
|
hoverColor?: string;
|
|
172
|
+
/** Custom hover styles - allows full control over hover appearance */
|
|
173
|
+
hoverStyle?: ButtonHoverStyle;
|
|
162
174
|
/** Shows loading state and disables interaction */
|
|
163
175
|
loading?: boolean;
|
|
164
176
|
/** Icon rendered to the left of children (hidden when loading) */
|
|
@@ -362,6 +374,8 @@ type AvatarProps = Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
|
362
374
|
size?: AvatarSize;
|
|
363
375
|
/** Shape variant */
|
|
364
376
|
variant?: AvatarVariant;
|
|
377
|
+
/** Generate background and text color automatically based on name/alt */
|
|
378
|
+
colorFromName?: boolean;
|
|
365
379
|
};
|
|
366
380
|
declare const Avatar: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
367
381
|
/** Image source URL */
|
|
@@ -374,6 +388,8 @@ declare const Avatar: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttribu
|
|
|
374
388
|
size?: AvatarSize;
|
|
375
389
|
/** Shape variant */
|
|
376
390
|
variant?: AvatarVariant;
|
|
391
|
+
/** Generate background and text color automatically based on name/alt */
|
|
392
|
+
colorFromName?: boolean;
|
|
377
393
|
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
378
394
|
|
|
379
395
|
type TagSize = "sm" | "md" | "lg";
|
|
@@ -540,6 +556,8 @@ type TableProps<T> = Omit<React$1.HTMLAttributes<HTMLTableElement>, "children">
|
|
|
540
556
|
loadingContent?: React$1.ReactNode;
|
|
541
557
|
/** Whether the table has sticky header */
|
|
542
558
|
stickyHeader?: boolean;
|
|
559
|
+
/** Custom header row style */
|
|
560
|
+
headerStyle?: React$1.CSSProperties;
|
|
543
561
|
};
|
|
544
562
|
declare const Table: <T>(props: TableProps<T> & {
|
|
545
563
|
ref?: React$1.ForwardedRef<HTMLTableElement>;
|
package/dist/index.js
CHANGED
|
@@ -700,6 +700,7 @@ var Button = React8.forwardRef(function Button2({
|
|
|
700
700
|
radius = "sm",
|
|
701
701
|
color = "primary",
|
|
702
702
|
hoverColor,
|
|
703
|
+
hoverStyle,
|
|
703
704
|
loading = false,
|
|
704
705
|
disabled,
|
|
705
706
|
leftIcon,
|
|
@@ -712,13 +713,15 @@ var Button = React8.forwardRef(function Button2({
|
|
|
712
713
|
const isDisabled = React8__default.default.useMemo(() => disabled || loading, [disabled, loading]);
|
|
713
714
|
const preset = isPresetColor(color);
|
|
714
715
|
const computedStyle = React8__default.default.useMemo(() => {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
716
|
+
const baseStyle = preset ? hoverColor ? { [`--rh-${color}-hover`]: toRgbTriplet2(hoverColor) ?? hoverColor } : {} : getArbitraryColorStyle(variant, color);
|
|
717
|
+
const hoverVars = hoverStyle ? {
|
|
718
|
+
"--btn-hover-bg": hoverStyle.backgroundColor,
|
|
719
|
+
"--btn-hover-border": hoverStyle.borderColor,
|
|
720
|
+
"--btn-hover-color": hoverStyle.color
|
|
721
|
+
} : {};
|
|
722
|
+
return { ...style, ...baseStyle, ...hoverVars };
|
|
723
|
+
}, [preset, color, variant, hoverColor, hoverStyle, style]);
|
|
724
|
+
const hasCustomHover = Boolean(hoverStyle);
|
|
722
725
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
723
726
|
"button",
|
|
724
727
|
{
|
|
@@ -731,7 +734,9 @@ var Button = React8.forwardRef(function Button2({
|
|
|
731
734
|
"rh-border rh-font-sans rh-font-medium",
|
|
732
735
|
"rh-transition-colors rh-duration-150",
|
|
733
736
|
"focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring focus-visible:rh-ring-offset-2",
|
|
734
|
-
preset ? variantColorClasses[variant][color] : "
|
|
737
|
+
preset && !hasCustomHover ? variantColorClasses[variant][color] : "",
|
|
738
|
+
!preset && !hasCustomHover ? "hover:rh-brightness-90" : "",
|
|
739
|
+
hasCustomHover ? "btn-custom-hover" : "",
|
|
735
740
|
sizeClasses[size],
|
|
736
741
|
radiusClasses[radius],
|
|
737
742
|
isDisabled ? "rh-opacity-50 rh-cursor-not-allowed rh-pointer-events-none" : "",
|
|
@@ -1777,6 +1782,33 @@ var Tooltip = React8.forwardRef(
|
|
|
1777
1782
|
);
|
|
1778
1783
|
}
|
|
1779
1784
|
);
|
|
1785
|
+
var AVATAR_COLORS = [
|
|
1786
|
+
{ bg: "#FBF1E6", text: "#D6822D" },
|
|
1787
|
+
// Laranja
|
|
1788
|
+
{ bg: "#EDF3FA", text: "#538CC6" },
|
|
1789
|
+
// Azul
|
|
1790
|
+
{ bg: "#F3E5F5", text: "#9C27B0" },
|
|
1791
|
+
// Roxo
|
|
1792
|
+
{ bg: "#E8F5E9", text: "#4CAF50" },
|
|
1793
|
+
// Verde
|
|
1794
|
+
{ bg: "#FFF3E0", text: "#FF9800" },
|
|
1795
|
+
// Amarelo
|
|
1796
|
+
{ bg: "#FFEBEE", text: "#F44336" },
|
|
1797
|
+
// Vermelho
|
|
1798
|
+
{ bg: "#E3F2FD", text: "#2196F3" },
|
|
1799
|
+
// Azul claro
|
|
1800
|
+
{ bg: "#F3E5F5", text: "#673AB7" },
|
|
1801
|
+
// Violeta
|
|
1802
|
+
{ bg: "#E0F2F1", text: "#009688" },
|
|
1803
|
+
// Teal
|
|
1804
|
+
{ bg: "#FBE9E7", text: "#FF5722" }
|
|
1805
|
+
// Deep Orange
|
|
1806
|
+
];
|
|
1807
|
+
function getAvatarColors(name) {
|
|
1808
|
+
const hash = name.split("").reduce((acc, char) => acc + char.charCodeAt(0), 0);
|
|
1809
|
+
const index = hash % AVATAR_COLORS.length;
|
|
1810
|
+
return AVATAR_COLORS[index];
|
|
1811
|
+
}
|
|
1780
1812
|
var sizeClasses7 = {
|
|
1781
1813
|
sm: "rh-w-8 rh-h-8 rh-text-xs",
|
|
1782
1814
|
md: "rh-w-10 rh-h-10 rh-text-sm",
|
|
@@ -1793,9 +1825,14 @@ var variantClasses2 = {
|
|
|
1793
1825
|
circle: "rh-rounded-full",
|
|
1794
1826
|
square: "rh-rounded-sm"
|
|
1795
1827
|
};
|
|
1796
|
-
var Avatar = React8.forwardRef(function Avatar2({ src, alt = "", initials, size = "md", variant = "circle", className = "", ...rest }, ref) {
|
|
1828
|
+
var Avatar = React8.forwardRef(function Avatar2({ src, alt = "", initials, size = "md", variant = "circle", colorFromName = false, className = "", style, ...rest }, ref) {
|
|
1797
1829
|
const [imgError, setImgError] = React8.useState(false);
|
|
1798
1830
|
const showImage = src && !imgError;
|
|
1831
|
+
const avatarColors = React8.useMemo(() => {
|
|
1832
|
+
if (!colorFromName) return null;
|
|
1833
|
+
const name = initials || alt || "";
|
|
1834
|
+
return name ? getAvatarColors(name) : null;
|
|
1835
|
+
}, [colorFromName, initials, alt]);
|
|
1799
1836
|
const fallbackLabel = initials ? initials.slice(0, 2).toUpperCase() : alt ? alt.split(" ").slice(0, 2).map((w) => w[0]).join("").toUpperCase() : "?";
|
|
1800
1837
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1801
1838
|
"div",
|
|
@@ -1805,11 +1842,16 @@ var Avatar = React8.forwardRef(function Avatar2({ src, alt = "", initials, size
|
|
|
1805
1842
|
"aria-label": showImage ? void 0 : alt || initials,
|
|
1806
1843
|
className: [
|
|
1807
1844
|
"rh-inline-flex rh-items-center rh-justify-center rh-shrink-0 rh-overflow-hidden",
|
|
1808
|
-
"rh-bg-primary rh-text-surface
|
|
1845
|
+
avatarColors ? "" : "rh-bg-primary rh-text-surface",
|
|
1846
|
+
"rh-font-sans rh-font-medium rh-select-none",
|
|
1809
1847
|
sizeClasses7[size],
|
|
1810
1848
|
variantClasses2[variant],
|
|
1811
1849
|
className
|
|
1812
1850
|
].filter(Boolean).join(" "),
|
|
1851
|
+
style: {
|
|
1852
|
+
...avatarColors && { backgroundColor: avatarColors.bg, color: avatarColors.text },
|
|
1853
|
+
...style
|
|
1854
|
+
},
|
|
1813
1855
|
...rest,
|
|
1814
1856
|
children: showImage ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1815
1857
|
"img",
|
|
@@ -1973,8 +2015,8 @@ function ToggleGroupInner({
|
|
|
1973
2015
|
ref,
|
|
1974
2016
|
role: "group",
|
|
1975
2017
|
className: [
|
|
1976
|
-
"rh-inline-flex rh-items-center rh-
|
|
1977
|
-
"rh-p-0.5",
|
|
2018
|
+
"rh-inline-flex rh-items-center rh-bg-muted rh-overflow-hidden",
|
|
2019
|
+
"rh-p-1 rh-gap-0.5",
|
|
1978
2020
|
radiusClasses5[radius],
|
|
1979
2021
|
sizeClasses9[size].container,
|
|
1980
2022
|
disabled ? "rh-opacity-50 rh-cursor-not-allowed" : "",
|
|
@@ -1995,13 +2037,13 @@ function ToggleGroupInner({
|
|
|
1995
2037
|
onClick: () => !isDisabled && onChange(option.value),
|
|
1996
2038
|
className: [
|
|
1997
2039
|
"rh-flex rh-items-center rh-justify-center rh-h-full",
|
|
1998
|
-
"rh-border-0 rh-
|
|
1999
|
-
"rh-transition-
|
|
2040
|
+
"rh-border-0 rh-font-sans rh-font-medium",
|
|
2041
|
+
"rh-transition-all rh-duration-150",
|
|
2000
2042
|
"focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring",
|
|
2001
2043
|
radiusClasses5[radius],
|
|
2002
2044
|
sizeClasses9[size].button,
|
|
2003
|
-
isActive
|
|
2004
|
-
!isActive ? "
|
|
2045
|
+
isActive ? "rh-bg-surface rh-text-text rh-shadow-sm" : "rh-bg-transparent rh-text-text-muted",
|
|
2046
|
+
!isActive && !isDisabled ? "hover:rh-bg-surface/50" : "",
|
|
2005
2047
|
isDisabled ? "rh-cursor-not-allowed rh-pointer-events-none" : "rh-cursor-pointer"
|
|
2006
2048
|
].filter(Boolean).join(" "),
|
|
2007
2049
|
style: isActive && !preset ? getActiveStyles(color, preset) : void 0,
|
|
@@ -2197,6 +2239,7 @@ function TableInner({
|
|
|
2197
2239
|
emptyContent = "Nenhum dado encontrado",
|
|
2198
2240
|
loadingContent,
|
|
2199
2241
|
stickyHeader = false,
|
|
2242
|
+
headerStyle,
|
|
2200
2243
|
className = "",
|
|
2201
2244
|
...rest
|
|
2202
2245
|
}, ref) {
|
|
@@ -2248,7 +2291,7 @@ function TableInner({
|
|
|
2248
2291
|
].filter(Boolean).join(" "),
|
|
2249
2292
|
...rest,
|
|
2250
2293
|
children: [
|
|
2251
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "rh-border-b rh-border-border", children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2294
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "rh-border-b rh-border-border", style: headerStyle, children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2252
2295
|
"th",
|
|
2253
2296
|
{
|
|
2254
2297
|
scope: "col",
|