infinity-ui-elements 1.7.1 → 1.7.3
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/Avatar/Avatar.d.ts +9 -3
- package/dist/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/components/Avatar/Avatar.stories.d.ts +14 -0
- package/dist/components/Avatar/Avatar.stories.d.ts.map +1 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +18 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +18 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -96,6 +96,13 @@ const Text = React__namespace.forwardRef(({ className, variant = "body", size =
|
|
|
96
96
|
});
|
|
97
97
|
Text.displayName = "Text";
|
|
98
98
|
|
|
99
|
+
const inverseColorClasses = {
|
|
100
|
+
a1: "bg-avatar-fill-a1-on-bg text-avatar-fill-a1-bg",
|
|
101
|
+
a2: "bg-avatar-fill-a2-on-bg text-avatar-fill-a2-bg",
|
|
102
|
+
a3: "bg-avatar-fill-a3-on-bg text-avatar-fill-a3-bg",
|
|
103
|
+
a4: "bg-avatar-fill-a4-on-bg text-avatar-fill-a4-bg",
|
|
104
|
+
a5: "bg-avatar-fill-a5-on-bg text-avatar-fill-a5-bg",
|
|
105
|
+
};
|
|
99
106
|
const avatarVariants = classVarianceAuthority.cva("inline-flex items-center justify-center font-medium text-center select-none", {
|
|
100
107
|
variants: {
|
|
101
108
|
color: {
|
|
@@ -108,6 +115,7 @@ const avatarVariants = classVarianceAuthority.cva("inline-flex items-center just
|
|
|
108
115
|
size: {
|
|
109
116
|
small: "h-[24px] w-[24px] text-body-medium-regular rounded-large",
|
|
110
117
|
medium: "h-[32px] w-[32px] text-body-medium-regular rounded-xlarge",
|
|
118
|
+
xlarge: "h-[36px] w-[36px] text-body-medium-regular rounded-xlarge",
|
|
111
119
|
},
|
|
112
120
|
},
|
|
113
121
|
defaultVariants: {
|
|
@@ -120,6 +128,7 @@ const statusVariants = classVarianceAuthority.cva("absolute flex items-center ju
|
|
|
120
128
|
size: {
|
|
121
129
|
small: "h-5 w-5 -bottom-0.5 -right-0.5",
|
|
122
130
|
medium: "h-6 w-6 -bottom-1 -right-1",
|
|
131
|
+
xlarge: "h-6 w-6 -bottom-1 -right-1",
|
|
123
132
|
},
|
|
124
133
|
statusColor: {
|
|
125
134
|
positive: "bg-action-fill-positive-default",
|
|
@@ -134,7 +143,7 @@ const statusVariants = classVarianceAuthority.cva("absolute flex items-center ju
|
|
|
134
143
|
statusColor: "notice",
|
|
135
144
|
},
|
|
136
145
|
});
|
|
137
|
-
const Avatar = React__namespace.forwardRef(({ className, color, size, children, src, alt, showStatus = false, statusColor = "notice", statusIcon, label, trailingComponent, containerClassName, ...props }, ref) => {
|
|
146
|
+
const Avatar = React__namespace.forwardRef(({ className, appearance = "default", color, size, children, src, alt, showStatus = false, statusColor = "notice", statusIcon, label, trailingComponent, containerClassName, ...props }, ref) => {
|
|
138
147
|
const [imageError, setImageError] = React__namespace.useState(false);
|
|
139
148
|
const handleImageError = () => {
|
|
140
149
|
setImageError(true);
|
|
@@ -159,7 +168,10 @@ const Avatar = React__namespace.forwardRef(({ className, color, size, children,
|
|
|
159
168
|
return "medium";
|
|
160
169
|
}
|
|
161
170
|
};
|
|
162
|
-
const
|
|
171
|
+
const resolvedColor = color ?? "a1";
|
|
172
|
+
const avatarElement = (jsxRuntime.jsxs("div", { className: "relative inline-block", children: [jsxRuntime.jsx("div", { className: cn(avatarVariants({ color: resolvedColor, size }), appearance === "inverse"
|
|
173
|
+
? inverseColorClasses[resolvedColor]
|
|
174
|
+
: undefined, className), ...props, children: src && !imageError ? (jsxRuntime.jsx("img", { src: src, alt: alt || "Avatar", className: cn("h-full w-full object-cover", size === "small" ? "rounded-large" : "rounded-xlarge"), onError: handleImageError })) : (children) }), showStatus && (jsxRuntime.jsx("div", { className: cn(statusVariants({ size, statusColor })), children: statusIcon && (jsxRuntime.jsx("span", { className: cn("text-action-ink-on-primary-normal", getStatusIconSize()), children: statusIcon })) }))] }));
|
|
163
175
|
// If no label or trailing component, return just the avatar
|
|
164
176
|
if (!label && !trailingComponent) {
|
|
165
177
|
return jsxRuntime.jsx("div", { ref: ref, children: avatarElement });
|
|
@@ -299,7 +311,7 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
299
311
|
variants: {
|
|
300
312
|
variant: {
|
|
301
313
|
primary: "bg-action-fill-primary-default text-action-ink-on-primary-normal hover:bg-action-fill-primary-hover",
|
|
302
|
-
secondary: "border
|
|
314
|
+
secondary: "border",
|
|
303
315
|
tertiary: "hover:bg-accent hover:text-accent-foreground",
|
|
304
316
|
},
|
|
305
317
|
color: {
|
|
@@ -313,8 +325,8 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
313
325
|
size: {
|
|
314
326
|
xsmall: "md:h-[28px] px-3 rounded-medium text-body-small-medium",
|
|
315
327
|
small: "md:h-[32px] px-4 rounded-medium text-body-small-medium",
|
|
316
|
-
medium: "md:h-[36px] px-
|
|
317
|
-
large: "md:h-[44px] px-6 rounded-
|
|
328
|
+
medium: "md:h-[36px] px-5 py-2 rounded-large text-body-medium-medium",
|
|
329
|
+
large: "md:h-[44px] px-6 rounded-large text-body-large-medium",
|
|
318
330
|
},
|
|
319
331
|
isIconOnly: {
|
|
320
332
|
true: "aspect-square p-0",
|
|
@@ -400,7 +412,7 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
|
|
|
400
412
|
variant: "secondary",
|
|
401
413
|
color: "primary",
|
|
402
414
|
class: `
|
|
403
|
-
border-action-outline-
|
|
415
|
+
border-action-outline-primary-faded
|
|
404
416
|
text-action-ink-primary-normal
|
|
405
417
|
hover:border-action-outline-primary-faded-hover
|
|
406
418
|
hover:bg-action-fill-primary-faded-hover
|