infinity-ui-elements 1.9.20 → 1.9.21

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.
@@ -59,6 +59,10 @@ export interface AvatarProps extends React.HTMLAttributes<HTMLDivElement>, Varia
59
59
  * Custom class name for the container (when label or trailingComponent is provided)
60
60
  */
61
61
  containerClassName?: string;
62
+ /**
63
+ * Custom class name for the label
64
+ */
65
+ labelClassName?: string;
62
66
  }
63
67
  declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLDivElement>>;
64
68
  export { Avatar, avatarVariants };
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACpD,KAAK,gBAAgB,GAAG,SAAS,GAAG,SAAS,CAAC;AAU9C,QAAA,MAAM,cAAc;;;mFAsBnB,CAAC;AA0BF,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAC1C,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC;;OAEG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,CAAC,EAAE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;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;IACtE;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,QAAA,MAAM,MAAM,oFAgHX,CAAC;AAIF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
@@ -327,6 +327,7 @@ declare const meta: {
327
327
  src?: string | undefined | undefined;
328
328
  alt?: string | undefined | undefined;
329
329
  containerClassName?: string | undefined;
330
+ labelClassName?: string | undefined;
330
331
  helperText?: string | undefined;
331
332
  validationState?: "none" | "positive" | "negative" | undefined;
332
333
  accept?: string | undefined | undefined;
@@ -339,7 +340,6 @@ declare const meta: {
339
340
  readOnly?: boolean | undefined | undefined;
340
341
  required?: boolean | undefined | undefined;
341
342
  errorText?: string | undefined;
342
- labelClassName?: string | undefined;
343
343
  isOptional?: boolean | undefined;
344
344
  isRequired?: boolean | undefined;
345
345
  infoHeading?: string | undefined;
package/dist/index.esm.js CHANGED
@@ -1079,33 +1079,6 @@ const Amount = React.forwardRef(({ value, currency, locale = "en-US", minimumFra
1079
1079
  });
1080
1080
  Amount.displayName = "Amount";
1081
1081
 
1082
- // Helper function to get the text utility class name
1083
- function getTextClassName(variant = "body", size = "medium", weight = "regular", color = "default") {
1084
- // Build the base class name
1085
- let baseClass = `text-${variant}`;
1086
- // Add size
1087
- if (size) {
1088
- baseClass += `-${size}`;
1089
- }
1090
- // Add weight
1091
- if (weight) {
1092
- baseClass += `-${weight}`;
1093
- }
1094
- // Add color class separately
1095
- const colorClass = `text-color-${color}`;
1096
- return `${baseClass} ${colorClass}`;
1097
- }
1098
- const Text = React.forwardRef(({ className, variant = "body", size = "medium", weight = "regular", color = "default", as = "p", children, ...props }, ref) => {
1099
- const Component = as;
1100
- const textClass = getTextClassName(variant, size, weight, color);
1101
- return React.createElement(Component, {
1102
- className: cn(textClass, className),
1103
- ref,
1104
- ...props,
1105
- }, children);
1106
- });
1107
- Text.displayName = "Text";
1108
-
1109
1082
  const inverseColorClasses = {
1110
1083
  a1: "bg-avatar-fill-a1-on-bg text-avatar-fill-a1-bg",
1111
1084
  a2: "bg-avatar-fill-a2-on-bg text-avatar-fill-a2-bg",
@@ -1153,7 +1126,7 @@ const statusVariants = cva("absolute flex items-center justify-center rounded-fu
1153
1126
  statusColor: "notice",
1154
1127
  },
1155
1128
  });
1156
- const Avatar = React.forwardRef(({ className, appearance = "default", color, size, children, src, alt, showStatus = false, statusColor = "notice", statusIcon, label, trailingComponent, containerClassName, ...props }, ref) => {
1129
+ const Avatar = React.forwardRef(({ className, appearance = "default", color, size, children, src, alt, showStatus = false, statusColor = "notice", statusIcon, label, trailingComponent, containerClassName, labelClassName, ...props }, ref) => {
1157
1130
  const [imageError, setImageError] = React.useState(false);
1158
1131
  const handleImageError = () => {
1159
1132
  setImageError(true);
@@ -1168,14 +1141,14 @@ const Avatar = React.forwardRef(({ className, appearance = "default", color, siz
1168
1141
  return "h-4 w-4";
1169
1142
  }
1170
1143
  };
1171
- const getTextSize = () => {
1144
+ const getTextClass = () => {
1172
1145
  switch (size) {
1173
1146
  case "small":
1174
- return "small";
1147
+ return "text-body-small-medium text-color-default";
1175
1148
  case "medium":
1176
- return "medium";
1149
+ return "text-body-medium-medium text-color-default";
1177
1150
  default:
1178
- return "medium";
1151
+ return "text-body-medium-medium text-color-default";
1179
1152
  }
1180
1153
  };
1181
1154
  const resolvedColor = color ?? "a1";
@@ -1187,7 +1160,7 @@ const Avatar = React.forwardRef(({ className, appearance = "default", color, siz
1187
1160
  return jsx("div", { ref: ref, children: avatarElement });
1188
1161
  }
1189
1162
  // Otherwise, return avatar with label and/or trailing component
1190
- return (jsxs("div", { ref: ref, className: cn("inline-flex items-center gap-3", containerClassName), children: [avatarElement, label && (jsx(Text, { variant: "body", size: getTextSize(), weight: "medium", color: "default", as: "span", children: label })), trailingComponent && (jsx("span", { className: "ml-auto", children: trailingComponent }))] }));
1163
+ return (jsxs("div", { ref: ref, className: cn("inline-flex items-center gap-3", containerClassName), children: [avatarElement, label && jsx("p", { className: cn(getTextClass(), labelClassName), children: label }), trailingComponent && (jsx("span", { className: "ml-auto", children: trailingComponent }))] }));
1191
1164
  });
1192
1165
  Avatar.displayName = "Avatar";
1193
1166
 
@@ -1317,6 +1290,33 @@ const Badge = React.forwardRef(({ className, variant, size, color, showDot = fal
1317
1290
  });
1318
1291
  Badge.displayName = "Badge";
1319
1292
 
1293
+ // Helper function to get the text utility class name
1294
+ function getTextClassName(variant = "body", size = "medium", weight = "regular", color = "default") {
1295
+ // Build the base class name
1296
+ let baseClass = `text-${variant}`;
1297
+ // Add size
1298
+ if (size) {
1299
+ baseClass += `-${size}`;
1300
+ }
1301
+ // Add weight
1302
+ if (weight) {
1303
+ baseClass += `-${weight}`;
1304
+ }
1305
+ // Add color class separately
1306
+ const colorClass = `text-color-${color}`;
1307
+ return `${baseClass} ${colorClass}`;
1308
+ }
1309
+ const Text = React.forwardRef(({ className, variant = "body", size = "medium", weight = "regular", color = "default", as = "p", children, ...props }, ref) => {
1310
+ const Component = as;
1311
+ const textClass = getTextClassName(variant, size, weight, color);
1312
+ return React.createElement(Component, {
1313
+ className: cn(textClass, className),
1314
+ ref,
1315
+ ...props,
1316
+ }, children);
1317
+ });
1318
+ Text.displayName = "Text";
1319
+
1320
1320
  const dividerVariants = cva("", {
1321
1321
  variants: {
1322
1322
  orientation: {