@xsolla/xui-avatar 0.138.1-pr235.1776777591 → 0.138.2
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/native/index.d.mts +5 -13
- package/native/index.d.ts +5 -13
- package/native/index.js +23 -24
- package/native/index.js.map +1 -1
- package/native/index.mjs +23 -24
- package/native/index.mjs.map +1 -1
- package/package.json +6 -6
- package/web/index.d.mts +5 -13
- package/web/index.d.ts +5 -13
- package/web/index.js +23 -24
- package/web/index.js.map +1 -1
- package/web/index.mjs +23 -24
- package/web/index.mjs.map +1 -1
package/native/index.d.mts
CHANGED
|
@@ -12,14 +12,12 @@ interface AvatarProps extends ThemeOverrideProps {
|
|
|
12
12
|
size?: "xl" | "lg" | "md" | "sm" | "xs" | "xxs";
|
|
13
13
|
/** If true, the avatar will be square with small border radius. If false, it will be a circle. */
|
|
14
14
|
square?: boolean;
|
|
15
|
-
/** Visual tone — 'mono' (default) or 'brand'. Overridden by `backgroundColor`. */
|
|
16
|
-
tone?: "mono" | "brand";
|
|
17
15
|
/** Whether to show an alert badge */
|
|
18
16
|
badge?: boolean;
|
|
19
17
|
/** Number or text to display in the badge notification */
|
|
20
18
|
badgeCount?: React.ReactNode;
|
|
21
|
-
/**
|
|
22
|
-
|
|
19
|
+
/** If true, the avatar will have a border to separate it from other avatars in a group */
|
|
20
|
+
stroke?: boolean;
|
|
23
21
|
/** Background color for the avatar. Defaults to theme background secondary. */
|
|
24
22
|
backgroundColor?: string;
|
|
25
23
|
/** Disable hover effect. Used internally by AvatarGroup. */
|
|
@@ -47,14 +45,6 @@ interface AvatarGroupItem {
|
|
|
47
45
|
onClick?: () => void;
|
|
48
46
|
/** Tooltip text to display on hover */
|
|
49
47
|
tooltip?: string;
|
|
50
|
-
/** Whether to show a badge on the avatar */
|
|
51
|
-
badge?: boolean;
|
|
52
|
-
/** Number or text to display in the badge notification */
|
|
53
|
-
badgeCount?: React.ReactNode;
|
|
54
|
-
/** Icon to display in the badge */
|
|
55
|
-
badgeIcon?: React.ReactNode;
|
|
56
|
-
/** Color tone for the badge */
|
|
57
|
-
badgeTone?: AvatarProps["badgeTone"];
|
|
58
48
|
}
|
|
59
49
|
/** Avatar background mode - preset colors, 'mixed' for cycling, or a theme function */
|
|
60
50
|
type AvatarBackgroundMode = "mixed" | "brand" | "brandExtra" | "success" | "warning" | "alert" | "neutral" | ((theme: Theme) => string);
|
|
@@ -65,12 +55,14 @@ interface AvatarGroupProps extends ThemeOverrideProps {
|
|
|
65
55
|
*/
|
|
66
56
|
list: AvatarGroupItem[];
|
|
67
57
|
/** Size of the avatars in the group */
|
|
68
|
-
size?: "
|
|
58
|
+
size?: "sm" | "md" | "lg" | "xl";
|
|
69
59
|
/**
|
|
70
60
|
* The maximum number of avatars to display before collapsing the rest into a "+N" counter.
|
|
71
61
|
* If the number of avatars exceeds this value, the extra avatars will be hidden.
|
|
72
62
|
*/
|
|
73
63
|
maxVisible?: number;
|
|
64
|
+
/** Whether to show a stroke/border around each avatar */
|
|
65
|
+
stroke?: boolean;
|
|
74
66
|
/**
|
|
75
67
|
* Controls the background color mode for avatars in the group.
|
|
76
68
|
* - 'mixed' (default): Avatars cycle through different colors
|
package/native/index.d.ts
CHANGED
|
@@ -12,14 +12,12 @@ interface AvatarProps extends ThemeOverrideProps {
|
|
|
12
12
|
size?: "xl" | "lg" | "md" | "sm" | "xs" | "xxs";
|
|
13
13
|
/** If true, the avatar will be square with small border radius. If false, it will be a circle. */
|
|
14
14
|
square?: boolean;
|
|
15
|
-
/** Visual tone — 'mono' (default) or 'brand'. Overridden by `backgroundColor`. */
|
|
16
|
-
tone?: "mono" | "brand";
|
|
17
15
|
/** Whether to show an alert badge */
|
|
18
16
|
badge?: boolean;
|
|
19
17
|
/** Number or text to display in the badge notification */
|
|
20
18
|
badgeCount?: React.ReactNode;
|
|
21
|
-
/**
|
|
22
|
-
|
|
19
|
+
/** If true, the avatar will have a border to separate it from other avatars in a group */
|
|
20
|
+
stroke?: boolean;
|
|
23
21
|
/** Background color for the avatar. Defaults to theme background secondary. */
|
|
24
22
|
backgroundColor?: string;
|
|
25
23
|
/** Disable hover effect. Used internally by AvatarGroup. */
|
|
@@ -47,14 +45,6 @@ interface AvatarGroupItem {
|
|
|
47
45
|
onClick?: () => void;
|
|
48
46
|
/** Tooltip text to display on hover */
|
|
49
47
|
tooltip?: string;
|
|
50
|
-
/** Whether to show a badge on the avatar */
|
|
51
|
-
badge?: boolean;
|
|
52
|
-
/** Number or text to display in the badge notification */
|
|
53
|
-
badgeCount?: React.ReactNode;
|
|
54
|
-
/** Icon to display in the badge */
|
|
55
|
-
badgeIcon?: React.ReactNode;
|
|
56
|
-
/** Color tone for the badge */
|
|
57
|
-
badgeTone?: AvatarProps["badgeTone"];
|
|
58
48
|
}
|
|
59
49
|
/** Avatar background mode - preset colors, 'mixed' for cycling, or a theme function */
|
|
60
50
|
type AvatarBackgroundMode = "mixed" | "brand" | "brandExtra" | "success" | "warning" | "alert" | "neutral" | ((theme: Theme) => string);
|
|
@@ -65,12 +55,14 @@ interface AvatarGroupProps extends ThemeOverrideProps {
|
|
|
65
55
|
*/
|
|
66
56
|
list: AvatarGroupItem[];
|
|
67
57
|
/** Size of the avatars in the group */
|
|
68
|
-
size?: "
|
|
58
|
+
size?: "sm" | "md" | "lg" | "xl";
|
|
69
59
|
/**
|
|
70
60
|
* The maximum number of avatars to display before collapsing the rest into a "+N" counter.
|
|
71
61
|
* If the number of avatars exceeds this value, the extra avatars will be hidden.
|
|
72
62
|
*/
|
|
73
63
|
maxVisible?: number;
|
|
64
|
+
/** Whether to show a stroke/border around each avatar */
|
|
65
|
+
stroke?: boolean;
|
|
74
66
|
/**
|
|
75
67
|
* Controls the background color mode for avatars in the group.
|
|
76
68
|
* - 'mixed' (default): Avatars cycle through different colors
|
package/native/index.js
CHANGED
|
@@ -307,11 +307,10 @@ var Avatar = ({
|
|
|
307
307
|
text,
|
|
308
308
|
size = "xl",
|
|
309
309
|
square = false,
|
|
310
|
-
tone = "mono",
|
|
311
310
|
badge = false,
|
|
312
311
|
badgeCount,
|
|
313
|
-
badgeIcon,
|
|
314
312
|
badgeTone = "alert",
|
|
313
|
+
stroke = false,
|
|
315
314
|
backgroundColor,
|
|
316
315
|
disableHover = true,
|
|
317
316
|
"aria-label": ariaLabel,
|
|
@@ -322,9 +321,6 @@ var Avatar = ({
|
|
|
322
321
|
}) => {
|
|
323
322
|
const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
|
|
324
323
|
const sizeStyles = theme.sizing.avatar(size);
|
|
325
|
-
const toneBackground = tone === "brand" ? theme.colors.background.brand.primary : theme.colors.overlay.mono;
|
|
326
|
-
const toneHoverBackground = tone === "brand" ? theme.colors.background.brand.secondary : theme.colors.overlay.monoHover;
|
|
327
|
-
const toneContent = tone === "brand" ? theme.colors.content.on.brand : theme.colors.content.primary;
|
|
328
324
|
const borderRadius = square ? sizeStyles.borderRadiusSquare : sizeStyles.borderRadiusCircle;
|
|
329
325
|
const countSizeMap = {
|
|
330
326
|
xl: "xl",
|
|
@@ -342,8 +338,7 @@ var Avatar = ({
|
|
|
342
338
|
xs: "sm",
|
|
343
339
|
xxs: "xs"
|
|
344
340
|
};
|
|
345
|
-
const
|
|
346
|
-
const badgeSize = hasBadgeContent ? countSizeMap[size] : dotSizeMap[size];
|
|
341
|
+
const badgeSize = badgeCount ? countSizeMap[size] : dotSizeMap[size];
|
|
347
342
|
const getDotOffset = () => {
|
|
348
343
|
if (square) {
|
|
349
344
|
return size === "xxs" ? { right: -1, top: -1 } : { right: -3, top: -3 };
|
|
@@ -358,7 +353,7 @@ var Avatar = ({
|
|
|
358
353
|
};
|
|
359
354
|
return circleOffsets[size];
|
|
360
355
|
};
|
|
361
|
-
const badgeOffset =
|
|
356
|
+
const badgeOffset = badgeCount ? square ? sizeStyles.badgeOffsetSquare : sizeStyles.badgeOffsetCircle : getDotOffset();
|
|
362
357
|
const displayBadgeCount = badgeCount;
|
|
363
358
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
364
359
|
Box,
|
|
@@ -386,16 +381,16 @@ var Avatar = ({
|
|
|
386
381
|
width: sizeStyles.size,
|
|
387
382
|
height: sizeStyles.size,
|
|
388
383
|
borderRadius,
|
|
389
|
-
backgroundColor: backgroundColor ||
|
|
384
|
+
backgroundColor: backgroundColor || theme.colors.overlay.mono,
|
|
390
385
|
alignItems: "center",
|
|
391
386
|
justifyContent: "center",
|
|
392
387
|
position: "relative",
|
|
393
388
|
overflow: "hidden",
|
|
394
|
-
borderWidth:
|
|
395
|
-
borderColor: theme.colors.
|
|
389
|
+
borderWidth: stroke ? 1 : 0,
|
|
390
|
+
borderColor: theme.colors.background.primary,
|
|
396
391
|
...!disableHover && !src && {
|
|
397
392
|
hoverStyle: {
|
|
398
|
-
backgroundColor:
|
|
393
|
+
backgroundColor: theme.colors.overlay.monoHover
|
|
399
394
|
}
|
|
400
395
|
},
|
|
401
396
|
children: src ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -411,11 +406,11 @@ var Avatar = ({
|
|
|
411
406
|
height: sizeStyles.size,
|
|
412
407
|
borderRadius
|
|
413
408
|
}
|
|
414
|
-
) : icon ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { size: sizeStyles.iconSize, color:
|
|
409
|
+
) : icon ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { size: sizeStyles.iconSize, color: theme.colors.content.primary, children: icon }) : text ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
415
410
|
Text,
|
|
416
411
|
{
|
|
417
412
|
fontSize: sizeStyles.fontSize,
|
|
418
|
-
color:
|
|
413
|
+
color: theme.colors.content.primary,
|
|
419
414
|
fontWeight: "400",
|
|
420
415
|
letterSpacing: 0.4,
|
|
421
416
|
children: text
|
|
@@ -423,9 +418,8 @@ var Avatar = ({
|
|
|
423
418
|
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
424
419
|
import_xui_icons_base.User,
|
|
425
420
|
{
|
|
426
|
-
variant: "solid",
|
|
427
421
|
size: sizeStyles.iconSize,
|
|
428
|
-
color:
|
|
422
|
+
color: theme.colors.content.primary
|
|
429
423
|
}
|
|
430
424
|
)
|
|
431
425
|
}
|
|
@@ -441,7 +435,6 @@ var Avatar = ({
|
|
|
441
435
|
{
|
|
442
436
|
size: badgeSize,
|
|
443
437
|
tone: badgeTone,
|
|
444
|
-
icon: badgeIcon,
|
|
445
438
|
showStroke: size !== "xxs",
|
|
446
439
|
"aria-label": displayBadgeCount ? `${displayBadgeCount} notifications` : "Notification",
|
|
447
440
|
children: displayBadgeCount
|
|
@@ -458,16 +451,24 @@ var Avatar = ({
|
|
|
458
451
|
var import_xui_core2 = require("@xsolla/xui-core");
|
|
459
452
|
var import_xui_tooltip = require("@xsolla/xui-tooltip");
|
|
460
453
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
454
|
+
var sizeMap = {
|
|
455
|
+
sm: "sm",
|
|
456
|
+
md: "md",
|
|
457
|
+
lg: "lg",
|
|
458
|
+
xl: "xl"
|
|
459
|
+
};
|
|
461
460
|
var AvatarGroup = ({
|
|
462
461
|
list,
|
|
463
|
-
size = "
|
|
462
|
+
size = "md",
|
|
464
463
|
maxVisible = 6,
|
|
464
|
+
stroke = true,
|
|
465
465
|
avatarBackgroundMode = "mixed",
|
|
466
466
|
"aria-label": ariaLabel,
|
|
467
467
|
themeMode,
|
|
468
468
|
themeProductContext
|
|
469
469
|
}) => {
|
|
470
470
|
const { theme } = (0, import_xui_core2.useResolvedTheme)({ themeMode, themeProductContext });
|
|
471
|
+
const internalSize = sizeMap[size];
|
|
471
472
|
const totalCount = list.length;
|
|
472
473
|
const visibleCount = Math.min(totalCount, Math.max(0, maxVisible));
|
|
473
474
|
const visibleListItems = list.slice(0, visibleCount);
|
|
@@ -528,14 +529,11 @@ var AvatarGroup = ({
|
|
|
528
529
|
{
|
|
529
530
|
src: item.src,
|
|
530
531
|
text: item.initials,
|
|
531
|
-
size,
|
|
532
|
+
size: internalSize,
|
|
533
|
+
stroke,
|
|
532
534
|
backgroundColor,
|
|
533
535
|
disableHover: !shouldEnableHover,
|
|
534
536
|
onClick: item.onClick,
|
|
535
|
-
badge: item.badge,
|
|
536
|
-
badgeCount: item.badgeCount,
|
|
537
|
-
badgeIcon: item.badgeIcon,
|
|
538
|
-
badgeTone: item.badgeTone,
|
|
539
537
|
...item.tooltip ? { "aria-label": item.tooltip } : {}
|
|
540
538
|
}
|
|
541
539
|
)
|
|
@@ -547,8 +545,9 @@ var AvatarGroup = ({
|
|
|
547
545
|
remainingCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box, { marginLeft: overlap, zIndex: 0, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
548
546
|
Avatar,
|
|
549
547
|
{
|
|
550
|
-
size,
|
|
548
|
+
size: internalSize,
|
|
551
549
|
text: `+${remainingCount}`,
|
|
550
|
+
stroke,
|
|
552
551
|
backgroundColor: theme.colors.background.secondary,
|
|
553
552
|
disableHover: true,
|
|
554
553
|
"aria-label": `${remainingCount} more ${remainingCount === 1 ? "user" : "users"}`
|
package/native/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.tsx","../../../primitives-native/src/Box.tsx","../../../primitives-native/src/Text.tsx","../../../primitives-native/src/Icon.tsx","../../src/Avatar.tsx","../../src/AvatarGroup.tsx"],"sourcesContent":["export * from \"./Avatar\";\nexport * from \"./AvatarGroup\";\n","import React from \"react\";\nimport {\n View,\n Pressable,\n Image,\n ViewStyle,\n ImageStyle,\n DimensionValue,\n AnimatableNumericValue,\n} from \"react-native\";\nimport { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Box: React.FC<BoxProps> = ({\n children,\n onPress,\n onLayout,\n onMoveShouldSetResponder,\n onResponderGrant,\n onResponderMove,\n onResponderRelease,\n onResponderTerminate,\n backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius,\n borderStyle,\n height,\n padding,\n paddingHorizontal,\n paddingVertical,\n margin,\n marginTop,\n marginBottom,\n marginLeft,\n marginRight,\n flexDirection,\n alignItems,\n justifyContent,\n position,\n top,\n bottom,\n left,\n right,\n width,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n overflow,\n zIndex,\n hoverStyle,\n pressStyle,\n style,\n \"data-testid\": dataTestId,\n testID,\n as,\n src,\n alt,\n ...rest\n}) => {\n const getContainerStyle = (pressed?: boolean): ViewStyle => ({\n backgroundColor:\n pressed && pressStyle?.backgroundColor\n ? pressStyle.backgroundColor\n : backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius: borderRadius as AnimatableNumericValue,\n borderStyle: borderStyle as ViewStyle[\"borderStyle\"],\n overflow,\n zIndex,\n height: height as DimensionValue,\n width: width as DimensionValue,\n minWidth: minWidth as DimensionValue,\n minHeight: minHeight as DimensionValue,\n maxWidth: maxWidth as DimensionValue,\n maxHeight: maxHeight as DimensionValue,\n padding: padding as DimensionValue,\n paddingHorizontal: paddingHorizontal as DimensionValue,\n paddingVertical: paddingVertical as DimensionValue,\n margin: margin as DimensionValue,\n marginTop: marginTop as DimensionValue,\n marginBottom: marginBottom as DimensionValue,\n marginLeft: marginLeft as DimensionValue,\n marginRight: marginRight as DimensionValue,\n flexDirection,\n alignItems,\n justifyContent,\n position: position as ViewStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n flex,\n ...(style as ViewStyle),\n });\n\n const finalTestID = dataTestId || testID;\n\n // Destructure and drop web-only props from rest before passing to RN components\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n role,\n tabIndex,\n onKeyDown,\n onKeyUp,\n \"aria-label\": _ariaLabel,\n \"aria-labelledby\": _ariaLabelledBy,\n \"aria-current\": _ariaCurrent,\n \"aria-disabled\": _ariaDisabled,\n \"aria-live\": _ariaLive,\n className,\n \"data-testid\": _dataTestId,\n ...nativeRest\n } = rest as Record<string, unknown>;\n\n // Handle as=\"img\" for React Native\n if (as === \"img\" && src) {\n const imageStyle: ImageStyle = {\n width: width as DimensionValue,\n height: height as DimensionValue,\n borderRadius: borderRadius as number,\n position: position as ImageStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n ...(style as ImageStyle),\n };\n\n return (\n <Image\n source={{ uri: src }}\n style={imageStyle}\n testID={finalTestID}\n resizeMode=\"cover\"\n {...nativeRest}\n />\n );\n }\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n style={({ pressed }) => getContainerStyle(pressed)}\n testID={finalTestID}\n {...nativeRest}\n >\n {children}\n </Pressable>\n );\n }\n\n return (\n <View\n style={getContainerStyle()}\n testID={finalTestID}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n {...nativeRest}\n >\n {children}\n </View>\n );\n};\n","import React from \"react\";\nimport {\n Text as RNText,\n TextStyle,\n AccessibilityRole,\n StyleSheet,\n} from \"react-native\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\n\nconst roleMap: Record<string, AccessibilityRole> = {\n alert: \"alert\",\n heading: \"header\",\n button: \"button\",\n link: \"link\",\n text: \"text\",\n};\n\nconst parseNumericValue = (\n value: string | number | undefined\n): number | undefined => {\n if (value === undefined) return undefined;\n if (typeof value === \"number\") return value;\n const parsed = parseFloat(value);\n return isNaN(parsed) ? undefined : parsed;\n};\n\nexport const Text: React.FC<TextProps> = ({\n children,\n color,\n fontSize,\n fontWeight,\n fontFamily,\n textAlign,\n lineHeight,\n numberOfLines,\n id,\n role,\n style: styleProp,\n ...props\n}) => {\n let resolvedFontFamily = fontFamily\n ? fontFamily.split(\",\")[0].replace(/['\"]/g, \"\").trim()\n : undefined;\n\n if (\n resolvedFontFamily === \"Pilat Wide\" ||\n resolvedFontFamily === \"Pilat Wide Bold\" ||\n resolvedFontFamily === \"Aktiv Grotesk\"\n ) {\n resolvedFontFamily = undefined;\n }\n\n const incomingStyle = StyleSheet.flatten(styleProp) as TextStyle | undefined;\n\n const baseStyle: TextStyle = {\n color: color ?? incomingStyle?.color,\n fontSize: typeof fontSize === \"number\" ? fontSize : undefined,\n fontWeight: fontWeight as TextStyle[\"fontWeight\"],\n fontFamily: resolvedFontFamily,\n textDecorationLine: props.textDecoration as TextStyle[\"textDecorationLine\"],\n textAlign: textAlign ?? incomingStyle?.textAlign,\n lineHeight: parseNumericValue(lineHeight ?? incomingStyle?.lineHeight),\n marginTop: parseNumericValue(\n incomingStyle?.marginTop as number | string | undefined\n ),\n marginBottom: parseNumericValue(\n incomingStyle?.marginBottom as number | string | undefined\n ),\n };\n\n const accessibilityRole = role ? roleMap[role] : undefined;\n\n return (\n <RNText\n style={baseStyle}\n numberOfLines={numberOfLines}\n testID={id}\n accessibilityRole={accessibilityRole}\n >\n {children}\n </RNText>\n );\n};\n","import React from \"react\";\nimport { View, ViewStyle } from \"react-native\";\nimport { IconProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Icon: React.FC<IconProps> = ({ children, color, size }) => {\n const style: ViewStyle = {\n width: typeof size === \"number\" ? size : undefined,\n height: typeof size === \"number\" ? size : undefined,\n alignItems: \"center\",\n justifyContent: \"center\",\n };\n\n // On native, we try to pass the color down to children (like Text primitives)\n // to mimic the CSS inheritance behavior of the web version.\n const childrenWithProps = React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n return React.cloneElement(child, {\n color: child.props.color || color,\n // Also pass size if child seems to be an icon that needs it\n size: child.props.size || size,\n });\n }\n return child;\n });\n\n return <View style={style}>{childrenWithProps}</View>;\n};\n","import React from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box, Text, Icon } from \"@xsolla/xui-primitives\";\nimport { useResolvedTheme, type ThemeOverrideProps } from \"@xsolla/xui-core\";\nimport { Badge } from \"@xsolla/xui-badge\";\nimport { User } from \"@xsolla/xui-icons-base\";\n\nexport interface AvatarProps extends ThemeOverrideProps {\n /** Image source URL */\n src?: string;\n /** Icon component to display when no image is provided */\n icon?: React.ReactNode;\n /** Text/Initials to display when no image or icon is provided */\n text?: string;\n /** Size of the avatar */\n size?: \"xl\" | \"lg\" | \"md\" | \"sm\" | \"xs\" | \"xxs\";\n /** If true, the avatar will be square with small border radius. If false, it will be a circle. */\n square?: boolean;\n /** Visual tone — 'mono' (default) or 'brand'. Overridden by `backgroundColor`. */\n tone?: \"mono\" | \"brand\";\n /** Whether to show an alert badge */\n badge?: boolean;\n /** Number or text to display in the badge notification */\n badgeCount?: React.ReactNode;\n /** Icon to display in the badge */\n badgeIcon?: React.ReactNode;\n /** Background color for the avatar. Defaults to theme background secondary. */\n backgroundColor?: string;\n /** Disable hover effect. Used internally by AvatarGroup. */\n disableHover?: boolean;\n /** Accessible label for the avatar. Recommended for screen readers. */\n \"aria-label\"?: string;\n /** Alternative text for the avatar image */\n alt?: string;\n /** Click handler for the avatar */\n onClick?: () => void;\n /** Color tone for the badge */\n badgeTone?:\n | \"primary\"\n | \"secondary\"\n | \"brand\"\n | \"brandExtra\"\n | \"success\"\n | \"warning\"\n | \"alert\"\n | \"neutral\";\n}\n\nexport const Avatar: React.FC<AvatarProps> = ({\n src,\n icon,\n text,\n size = \"xl\",\n square = false,\n tone = \"mono\",\n badge = false,\n badgeCount,\n badgeIcon,\n badgeTone = \"alert\",\n backgroundColor,\n disableHover = true,\n \"aria-label\": ariaLabel,\n alt,\n onClick,\n themeMode,\n themeProductContext,\n}) => {\n const { theme } = useResolvedTheme({ themeMode, themeProductContext });\n\n const sizeStyles = theme.sizing.avatar(size);\n\n const toneBackground =\n tone === \"brand\"\n ? theme.colors.background.brand.primary\n : theme.colors.overlay.mono;\n const toneHoverBackground =\n tone === \"brand\"\n ? theme.colors.background.brand.secondary\n : theme.colors.overlay.monoHover;\n const toneContent =\n tone === \"brand\"\n ? theme.colors.content.on.brand\n : theme.colors.content.primary;\n\n // Border radius based on square or circle variant\n const borderRadius = square\n ? sizeStyles.borderRadiusSquare\n : sizeStyles.borderRadiusCircle;\n\n const countSizeMap = {\n xl: \"xl\",\n lg: \"xl\",\n md: \"lg\",\n sm: \"lg\",\n xs: \"sm\",\n xxs: \"xs\",\n } as const;\n const dotSizeMap = {\n xl: \"md\",\n lg: \"md\",\n md: \"sm\",\n sm: \"sm\",\n xs: \"sm\",\n xxs: \"xs\",\n } as const;\n const hasBadgeContent = !!(badgeCount || badgeIcon);\n const badgeSize = hasBadgeContent ? countSizeMap[size] : dotSizeMap[size];\n\n // Badge offset differs for circle vs square, and for dot vs count\n // Dot badge (8px) needs different offset per avatar size\n const getDotOffset = () => {\n if (square) {\n return size === \"xxs\" ? { right: -1, top: -1 } : { right: -3, top: -3 };\n }\n // Circle - position dot on the edge based on avatar size\n const circleOffsets = {\n xl: { right: 2, top: 2 },\n lg: { right: 2, top: 2 },\n md: { right: 2, top: 2 },\n sm: { right: 2, top: 2 },\n xs: { right: 0, top: 0 },\n xxs: { right: 1, top: 1 },\n };\n return circleOffsets[size];\n };\n\n const badgeOffset = hasBadgeContent\n ? square\n ? sizeStyles.badgeOffsetSquare\n : sizeStyles.badgeOffsetCircle\n : getDotOffset();\n\n // Display badge count\n const displayBadgeCount = badgeCount;\n\n return (\n <Box\n width={sizeStyles.size}\n height={sizeStyles.size}\n position=\"relative\"\n {...(!src && { role: \"img\", \"aria-label\": ariaLabel })}\n {...(onClick && {\n onPress: onClick,\n onKeyDown: (e: React.KeyboardEvent) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n onClick();\n }\n },\n cursor: \"pointer\",\n role: \"button\",\n tabIndex: 0,\n })}\n >\n <Box\n width={sizeStyles.size}\n height={sizeStyles.size}\n borderRadius={borderRadius}\n backgroundColor={backgroundColor || toneBackground}\n alignItems=\"center\"\n justifyContent=\"center\"\n position=\"relative\"\n overflow=\"hidden\"\n borderWidth={2}\n borderColor={theme.colors.border.secondary}\n {...(!disableHover &&\n !src && {\n hoverStyle: {\n backgroundColor: toneHoverBackground,\n },\n })}\n >\n {src ? (\n <Box\n as=\"img\"\n src={src}\n alt={alt || ariaLabel || \"\"}\n position=\"absolute\"\n top={0}\n left={0}\n width={sizeStyles.size}\n height={sizeStyles.size}\n borderRadius={borderRadius}\n />\n ) : icon ? (\n <Icon size={sizeStyles.iconSize} color={toneContent}>\n {icon}\n </Icon>\n ) : text ? (\n <Text\n fontSize={sizeStyles.fontSize}\n color={toneContent}\n fontWeight=\"400\"\n letterSpacing={0.4}\n >\n {text}\n </Text>\n ) : (\n <User\n variant=\"solid\"\n size={sizeStyles.iconSize}\n color={toneContent}\n />\n )}\n </Box>\n\n {badge && (\n <Box\n position=\"absolute\"\n right={badgeOffset.right}\n top={badgeOffset.top}\n >\n <Badge\n size={badgeSize}\n tone={badgeTone}\n icon={badgeIcon}\n showStroke={size !== \"xxs\"}\n aria-label={\n displayBadgeCount\n ? `${displayBadgeCount} notifications`\n : \"Notification\"\n }\n >\n {displayBadgeCount}\n </Badge>\n </Box>\n )}\n </Box>\n );\n};\n","import React from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box } from \"@xsolla/xui-primitives\";\nimport { useResolvedTheme, type ThemeOverrideProps } from \"@xsolla/xui-core\";\nimport { Tooltip } from \"@xsolla/xui-tooltip\";\nimport { Avatar, AvatarProps } from \"./Avatar\";\n\n/** Theme type from the design system */\ntype Theme = ReturnType<typeof useResolvedTheme>[\"theme\"];\n\n/** Item in the avatar group list */\nexport interface AvatarGroupItem {\n /** Image source URL */\n src?: string;\n /** Initials to display when no image is provided */\n initials?: string;\n /** Click handler for the avatar */\n onClick?: () => void;\n /** Tooltip text to display on hover */\n tooltip?: string;\n /** Whether to show a badge on the avatar */\n badge?: boolean;\n /** Number or text to display in the badge notification */\n badgeCount?: React.ReactNode;\n /** Icon to display in the badge */\n badgeIcon?: React.ReactNode;\n /** Color tone for the badge */\n badgeTone?: AvatarProps[\"badgeTone\"];\n}\n\n/** Avatar background mode - preset colors, 'mixed' for cycling, or a theme function */\nexport type AvatarBackgroundMode =\n | \"mixed\"\n | \"brand\"\n | \"brandExtra\"\n | \"success\"\n | \"warning\"\n | \"alert\"\n | \"neutral\"\n | ((theme: Theme) => string);\n\nexport interface AvatarGroupProps extends ThemeOverrideProps {\n /**\n * List of avatars to display in the group.\n * `tooltip` property is text to be displayed in the tooltip when hovering over the avatar.\n */\n list: AvatarGroupItem[];\n /** Size of the avatars in the group */\n size?: \"xxs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n /**\n * The maximum number of avatars to display before collapsing the rest into a \"+N\" counter.\n * If the number of avatars exceeds this value, the extra avatars will be hidden.\n */\n maxVisible?: number;\n /**\n * Controls the background color mode for avatars in the group.\n * - 'mixed' (default): Avatars cycle through different colors\n * - 'brand', 'brandExtra', 'success', 'warning', 'alert', 'neutral': Single color for all avatars\n * - Theme function: A function that receives theme and returns any color from the design system.\n * Example: (theme) => theme.colors.core.link.link\n */\n avatarBackgroundMode?: AvatarBackgroundMode;\n /** Accessible label for the avatar group. Defaults to \"Group of X users\". */\n \"aria-label\"?: string;\n}\n\nexport const AvatarGroup: React.FC<AvatarGroupProps> = ({\n list,\n size = \"sm\",\n maxVisible = 6,\n avatarBackgroundMode = \"mixed\",\n \"aria-label\": ariaLabel,\n themeMode,\n themeProductContext,\n}) => {\n const { theme } = useResolvedTheme({ themeMode, themeProductContext });\n\n const totalCount = list.length;\n\n // Determine which avatars to show\n // Ensure maxVisible is non-negative and doesn't exceed totalCount\n const visibleCount = Math.min(totalCount, Math.max(0, maxVisible));\n const visibleListItems = list.slice(0, visibleCount);\n const remainingCount = totalCount - visibleCount;\n\n // Overlap amount: 4px in Figma\n const overlap = -4;\n\n // Background colors for text/icon avatars (cycling through theme colors)\n const mixedBackgrounds = [\n theme.colors.background.alert.secondary,\n theme.colors.background.warning.secondary,\n theme.colors.background.brandExtra.secondary,\n theme.colors.background.neutral.secondary,\n theme.colors.background.brand.secondary,\n theme.colors.background.success.secondary,\n theme.colors.background.success.primary,\n ];\n\n // Preset color mapping\n const presetColors: Record<string, string> = {\n brand: theme.colors.background.brand.secondary,\n brandExtra: theme.colors.background.brandExtra.secondary,\n success: theme.colors.background.success.secondary,\n warning: theme.colors.background.warning.secondary,\n alert: theme.colors.background.alert.secondary,\n neutral: theme.colors.background.neutral.secondary,\n };\n\n // Get background color based on avatarBackgroundMode\n const getBackgroundColor = (index: number): string => {\n if (typeof avatarBackgroundMode === \"function\") {\n return avatarBackgroundMode(theme);\n }\n if (avatarBackgroundMode === \"mixed\") {\n return mixedBackgrounds[index % mixedBackgrounds.length];\n }\n // Preset color mode\n return (\n presetColors[avatarBackgroundMode] || theme.colors.background.secondary\n );\n };\n\n // Default accessible label for the group\n const defaultAriaLabel =\n totalCount === 1\n ? \"1 user\"\n : totalCount === visibleCount\n ? `${totalCount} users`\n : `${visibleCount} of ${totalCount} users`;\n\n // Render an avatar with optional tooltip wrapper\n const renderAvatarWithTooltip = (\n avatar: React.ReactNode,\n tooltip: string | undefined,\n key: number\n ) => {\n if (tooltip) {\n return (\n <Tooltip key={key} content={tooltip} placement=\"top\">\n {avatar}\n </Tooltip>\n );\n }\n return avatar;\n };\n\n return (\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n role=\"group\"\n aria-label={ariaLabel || defaultAriaLabel}\n >\n {visibleListItems.map((item, index) => {\n const shouldApplyBackground = !item.src;\n const backgroundColor = shouldApplyBackground\n ? getBackgroundColor(index)\n : undefined;\n\n // Only enable hover for image avatars with onClick\n const shouldEnableHover = !!item.src && !!item.onClick;\n\n const avatar = (\n <Box\n key={index}\n marginLeft={index === 0 ? 0 : overlap}\n zIndex={totalCount - index}\n >\n <Avatar\n src={item.src}\n text={item.initials}\n size={size}\n backgroundColor={backgroundColor}\n disableHover={!shouldEnableHover}\n onClick={item.onClick}\n badge={item.badge}\n badgeCount={item.badgeCount}\n badgeIcon={item.badgeIcon}\n badgeTone={item.badgeTone}\n {...(item.tooltip ? { \"aria-label\": item.tooltip } : {})}\n />\n </Box>\n );\n\n return renderAvatarWithTooltip(avatar, item.tooltip, index);\n })}\n\n {remainingCount > 0 && (\n <Box marginLeft={overlap} zIndex={0}>\n <Avatar\n size={size}\n text={`+${remainingCount}`}\n backgroundColor={theme.colors.background.secondary}\n disableHover={true}\n aria-label={`${remainingCount} more ${remainingCount === 1 ? \"user\" : \"users\"}`}\n />\n </Box>\n )}\n </Box>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,0BAQO;AA2ID;AAxIC,IAAM,MAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;A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AM,kBAAkB,wBACpB,mBAAmB,KAAK,IACxB;AAGJ,gBAAM,oBAAoB,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,KAAK;AAE/C,gBAAM,SACJ;AAAA,YAAC;AAAA;AAAA,cAEC,YAAY,UAAU,IAAI,IAAI;AAAA,cAC9B,QAAQ,aAAa;AAAA,cAErB;AAAA,gBAAC;AAAA;AAAA,kBACC,KAAK,KAAK;AAAA,kBACV,MAAM,KAAK;AAAA,kBACX;AAAA,kBACA;AAAA,kBACA,cAAc,CAAC;AAAA,kBACf,SAAS,KAAK;AAAA,kBACd,OAAO,KAAK;AAAA,kBACZ,YAAY,KAAK;AAAA,kBACjB,WAAW,KAAK;AAAA,kBAChB,WAAW,KAAK;AAAA,kBACf,GAAI,KAAK,UAAU,EAAE,cAAc,KAAK,QAAQ,IAAI,CAAC;AAAA;AAAA,cACxD;AAAA;AAAA,YAhBK;AAAA,UAiBP;AAGF,iBAAO,wBAAwB,QAAQ,KAAK,SAAS,KAAK;AAAA,QAC5D,CAAC;AAAA,QAEA,iBAAiB,KAChB,6CAAC,OAAI,YAAY,SAAS,QAAQ,GAChC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,MAAM,IAAI,cAAc;AAAA,YACxB,iBAAiB,MAAM,OAAO,WAAW;AAAA,YACzC,cAAc;AAAA,YACd,cAAY,GAAG,cAAc,SAAS,mBAAmB,IAAI,SAAS,OAAO;AAAA;AAAA,QAC/E,GACF;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["import_react_native","import_jsx_runtime","RNText","import_react_native","import_jsx_runtime","React","import_jsx_runtime","import_xui_core","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.tsx","../../../primitives-native/src/Box.tsx","../../../primitives-native/src/Text.tsx","../../../primitives-native/src/Icon.tsx","../../src/Avatar.tsx","../../src/AvatarGroup.tsx"],"sourcesContent":["export * from \"./Avatar\";\nexport * from \"./AvatarGroup\";\n","import React from \"react\";\nimport {\n View,\n Pressable,\n Image,\n ViewStyle,\n ImageStyle,\n DimensionValue,\n AnimatableNumericValue,\n} from \"react-native\";\nimport { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Box: React.FC<BoxProps> = ({\n children,\n onPress,\n onLayout,\n onMoveShouldSetResponder,\n onResponderGrant,\n onResponderMove,\n onResponderRelease,\n onResponderTerminate,\n backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius,\n borderStyle,\n height,\n padding,\n paddingHorizontal,\n paddingVertical,\n margin,\n marginTop,\n marginBottom,\n marginLeft,\n marginRight,\n flexDirection,\n alignItems,\n justifyContent,\n position,\n top,\n bottom,\n left,\n right,\n width,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n overflow,\n zIndex,\n hoverStyle,\n pressStyle,\n style,\n \"data-testid\": dataTestId,\n testID,\n as,\n src,\n alt,\n ...rest\n}) => {\n const getContainerStyle = (pressed?: boolean): ViewStyle => ({\n backgroundColor:\n pressed && pressStyle?.backgroundColor\n ? pressStyle.backgroundColor\n : backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius: borderRadius as AnimatableNumericValue,\n borderStyle: borderStyle as ViewStyle[\"borderStyle\"],\n overflow,\n zIndex,\n height: height as DimensionValue,\n width: width as DimensionValue,\n minWidth: minWidth as DimensionValue,\n minHeight: minHeight as DimensionValue,\n maxWidth: maxWidth as DimensionValue,\n maxHeight: maxHeight as DimensionValue,\n padding: padding as DimensionValue,\n paddingHorizontal: paddingHorizontal as DimensionValue,\n paddingVertical: paddingVertical as DimensionValue,\n margin: margin as DimensionValue,\n marginTop: marginTop as DimensionValue,\n marginBottom: marginBottom as DimensionValue,\n marginLeft: marginLeft as DimensionValue,\n marginRight: marginRight as DimensionValue,\n flexDirection,\n alignItems,\n justifyContent,\n position: position as ViewStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n flex,\n ...(style as ViewStyle),\n });\n\n const finalTestID = dataTestId || testID;\n\n // Destructure and drop web-only props from rest before passing to RN components\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n role,\n tabIndex,\n onKeyDown,\n onKeyUp,\n \"aria-label\": _ariaLabel,\n \"aria-labelledby\": _ariaLabelledBy,\n \"aria-current\": _ariaCurrent,\n \"aria-disabled\": _ariaDisabled,\n \"aria-live\": _ariaLive,\n className,\n \"data-testid\": _dataTestId,\n ...nativeRest\n } = rest as Record<string, unknown>;\n\n // Handle as=\"img\" for React Native\n if (as === \"img\" && src) {\n const imageStyle: ImageStyle = {\n width: width as DimensionValue,\n height: height as DimensionValue,\n borderRadius: borderRadius as number,\n position: position as ImageStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n ...(style as ImageStyle),\n };\n\n return (\n <Image\n source={{ uri: src }}\n style={imageStyle}\n testID={finalTestID}\n resizeMode=\"cover\"\n {...nativeRest}\n />\n );\n }\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n style={({ pressed }) => getContainerStyle(pressed)}\n testID={finalTestID}\n {...nativeRest}\n >\n {children}\n </Pressable>\n );\n }\n\n return (\n <View\n style={getContainerStyle()}\n testID={finalTestID}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n {...nativeRest}\n >\n {children}\n </View>\n );\n};\n","import React from \"react\";\nimport {\n Text as RNText,\n TextStyle,\n AccessibilityRole,\n StyleSheet,\n} from \"react-native\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\n\nconst roleMap: Record<string, AccessibilityRole> = {\n alert: \"alert\",\n heading: \"header\",\n button: \"button\",\n link: \"link\",\n text: \"text\",\n};\n\nconst parseNumericValue = (\n value: string | number | undefined\n): number | undefined => {\n if (value === undefined) return undefined;\n if (typeof value === \"number\") return value;\n const parsed = parseFloat(value);\n return isNaN(parsed) ? undefined : parsed;\n};\n\nexport const Text: React.FC<TextProps> = ({\n children,\n color,\n fontSize,\n fontWeight,\n fontFamily,\n textAlign,\n lineHeight,\n numberOfLines,\n id,\n role,\n style: styleProp,\n ...props\n}) => {\n let resolvedFontFamily = fontFamily\n ? fontFamily.split(\",\")[0].replace(/['\"]/g, \"\").trim()\n : undefined;\n\n if (\n resolvedFontFamily === \"Pilat Wide\" ||\n resolvedFontFamily === \"Pilat Wide Bold\" ||\n resolvedFontFamily === \"Aktiv Grotesk\"\n ) {\n resolvedFontFamily = undefined;\n }\n\n const incomingStyle = StyleSheet.flatten(styleProp) as TextStyle | undefined;\n\n const baseStyle: TextStyle = {\n color: color ?? incomingStyle?.color,\n fontSize: typeof fontSize === \"number\" ? fontSize : undefined,\n fontWeight: fontWeight as TextStyle[\"fontWeight\"],\n fontFamily: resolvedFontFamily,\n textDecorationLine: props.textDecoration as TextStyle[\"textDecorationLine\"],\n textAlign: textAlign ?? incomingStyle?.textAlign,\n lineHeight: parseNumericValue(lineHeight ?? incomingStyle?.lineHeight),\n marginTop: parseNumericValue(\n incomingStyle?.marginTop as number | string | undefined\n ),\n marginBottom: parseNumericValue(\n incomingStyle?.marginBottom as number | string | undefined\n ),\n };\n\n const accessibilityRole = role ? roleMap[role] : undefined;\n\n return (\n <RNText\n style={baseStyle}\n numberOfLines={numberOfLines}\n testID={id}\n accessibilityRole={accessibilityRole}\n >\n {children}\n </RNText>\n );\n};\n","import React from \"react\";\nimport { View, ViewStyle } from \"react-native\";\nimport { IconProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Icon: React.FC<IconProps> = ({ children, color, size }) => {\n const style: ViewStyle = {\n width: typeof size === \"number\" ? size : undefined,\n height: typeof size === \"number\" ? size : undefined,\n alignItems: \"center\",\n justifyContent: \"center\",\n };\n\n // On native, we try to pass the color down to children (like Text primitives)\n // to mimic the CSS inheritance behavior of the web version.\n const childrenWithProps = React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n return React.cloneElement(child, {\n color: child.props.color || color,\n // Also pass size if child seems to be an icon that needs it\n size: child.props.size || size,\n });\n }\n return child;\n });\n\n return <View style={style}>{childrenWithProps}</View>;\n};\n","import React from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box, Text, Icon } from \"@xsolla/xui-primitives\";\nimport { useResolvedTheme, type ThemeOverrideProps } from \"@xsolla/xui-core\";\nimport { Badge } from \"@xsolla/xui-badge\";\nimport { User } from \"@xsolla/xui-icons-base\";\n\nexport interface AvatarProps extends ThemeOverrideProps {\n /** Image source URL */\n src?: string;\n /** Icon component to display when no image is provided */\n icon?: React.ReactNode;\n /** Text/Initials to display when no image or icon is provided */\n text?: string;\n /** Size of the avatar */\n size?: \"xl\" | \"lg\" | \"md\" | \"sm\" | \"xs\" | \"xxs\";\n /** If true, the avatar will be square with small border radius. If false, it will be a circle. */\n square?: boolean;\n /** Whether to show an alert badge */\n badge?: boolean;\n /** Number or text to display in the badge notification */\n badgeCount?: React.ReactNode;\n /** If true, the avatar will have a border to separate it from other avatars in a group */\n stroke?: boolean;\n /** Background color for the avatar. Defaults to theme background secondary. */\n backgroundColor?: string;\n /** Disable hover effect. Used internally by AvatarGroup. */\n disableHover?: boolean;\n /** Accessible label for the avatar. Recommended for screen readers. */\n \"aria-label\"?: string;\n /** Alternative text for the avatar image */\n alt?: string;\n /** Click handler for the avatar */\n onClick?: () => void;\n /** Color tone for the badge */\n badgeTone?:\n | \"primary\"\n | \"secondary\"\n | \"brand\"\n | \"brandExtra\"\n | \"success\"\n | \"warning\"\n | \"alert\"\n | \"neutral\";\n}\n\nexport const Avatar: React.FC<AvatarProps> = ({\n src,\n icon,\n text,\n size = \"xl\",\n square = false,\n badge = false,\n badgeCount,\n badgeTone = \"alert\",\n stroke = false,\n backgroundColor,\n disableHover = true,\n \"aria-label\": ariaLabel,\n alt,\n onClick,\n themeMode,\n themeProductContext,\n}) => {\n const { theme } = useResolvedTheme({ themeMode, themeProductContext });\n\n const sizeStyles = theme.sizing.avatar(size);\n\n // Border radius based on square or circle variant\n const borderRadius = square\n ? sizeStyles.borderRadiusSquare\n : sizeStyles.borderRadiusCircle;\n\n const countSizeMap = {\n xl: \"xl\",\n lg: \"xl\",\n md: \"lg\",\n sm: \"lg\",\n xs: \"sm\",\n xxs: \"xs\",\n } as const;\n const dotSizeMap = {\n xl: \"md\",\n lg: \"md\",\n md: \"sm\",\n sm: \"sm\",\n xs: \"sm\",\n xxs: \"xs\",\n } as const;\n const badgeSize = badgeCount ? countSizeMap[size] : dotSizeMap[size];\n\n // Badge offset differs for circle vs square, and for dot vs count\n // Dot badge (8px) needs different offset per avatar size\n const getDotOffset = () => {\n if (square) {\n return size === \"xxs\" ? { right: -1, top: -1 } : { right: -3, top: -3 };\n }\n // Circle - position dot on the edge based on avatar size\n const circleOffsets = {\n xl: { right: 2, top: 2 },\n lg: { right: 2, top: 2 },\n md: { right: 2, top: 2 },\n sm: { right: 2, top: 2 },\n xs: { right: 0, top: 0 },\n xxs: { right: 1, top: 1 },\n };\n return circleOffsets[size];\n };\n\n const badgeOffset = badgeCount\n ? square\n ? sizeStyles.badgeOffsetSquare\n : sizeStyles.badgeOffsetCircle\n : getDotOffset();\n\n // Display badge count\n const displayBadgeCount = badgeCount;\n\n return (\n <Box\n width={sizeStyles.size}\n height={sizeStyles.size}\n position=\"relative\"\n {...(!src && { role: \"img\", \"aria-label\": ariaLabel })}\n {...(onClick && {\n onPress: onClick,\n onKeyDown: (e: React.KeyboardEvent) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n onClick();\n }\n },\n cursor: \"pointer\",\n role: \"button\",\n tabIndex: 0,\n })}\n >\n <Box\n width={sizeStyles.size}\n height={sizeStyles.size}\n borderRadius={borderRadius}\n backgroundColor={backgroundColor || theme.colors.overlay.mono}\n alignItems=\"center\"\n justifyContent=\"center\"\n position=\"relative\"\n overflow=\"hidden\"\n borderWidth={stroke ? 1 : 0}\n borderColor={theme.colors.background.primary}\n {...(!disableHover &&\n !src && {\n hoverStyle: {\n backgroundColor: theme.colors.overlay.monoHover,\n },\n })}\n >\n {src ? (\n <Box\n as=\"img\"\n src={src}\n alt={alt || ariaLabel || \"\"}\n position=\"absolute\"\n top={0}\n left={0}\n width={sizeStyles.size}\n height={sizeStyles.size}\n borderRadius={borderRadius}\n />\n ) : icon ? (\n <Icon size={sizeStyles.iconSize} color={theme.colors.content.primary}>\n {icon}\n </Icon>\n ) : text ? (\n <Text\n fontSize={sizeStyles.fontSize}\n color={theme.colors.content.primary}\n fontWeight=\"400\"\n letterSpacing={0.4}\n >\n {text}\n </Text>\n ) : (\n <User\n size={sizeStyles.iconSize}\n color={theme.colors.content.primary}\n />\n )}\n </Box>\n\n {badge && (\n <Box\n position=\"absolute\"\n right={badgeOffset.right}\n top={badgeOffset.top}\n >\n <Badge\n size={badgeSize}\n tone={badgeTone}\n showStroke={size !== \"xxs\"}\n aria-label={\n displayBadgeCount\n ? `${displayBadgeCount} notifications`\n : \"Notification\"\n }\n >\n {displayBadgeCount}\n </Badge>\n </Box>\n )}\n </Box>\n );\n};\n","import React from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box } from \"@xsolla/xui-primitives\";\nimport { useResolvedTheme, type ThemeOverrideProps } from \"@xsolla/xui-core\";\nimport { Tooltip } from \"@xsolla/xui-tooltip\";\nimport { Avatar } from \"./Avatar\";\n\n/** Theme type from the design system */\ntype Theme = ReturnType<typeof useResolvedTheme>[\"theme\"];\n\n/** Item in the avatar group list */\nexport interface AvatarGroupItem {\n /** Image source URL */\n src?: string;\n /** Initials to display when no image is provided */\n initials?: string;\n /** Click handler for the avatar */\n onClick?: () => void;\n /** Tooltip text to display on hover */\n tooltip?: string;\n}\n\n/** Avatar background mode - preset colors, 'mixed' for cycling, or a theme function */\nexport type AvatarBackgroundMode =\n | \"mixed\"\n | \"brand\"\n | \"brandExtra\"\n | \"success\"\n | \"warning\"\n | \"alert\"\n | \"neutral\"\n | ((theme: Theme) => string);\n\nexport interface AvatarGroupProps extends ThemeOverrideProps {\n /**\n * List of avatars to display in the group.\n * `tooltip` property is text to be displayed in the tooltip when hovering over the avatar.\n */\n list: AvatarGroupItem[];\n /** Size of the avatars in the group */\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n /**\n * The maximum number of avatars to display before collapsing the rest into a \"+N\" counter.\n * If the number of avatars exceeds this value, the extra avatars will be hidden.\n */\n maxVisible?: number;\n /** Whether to show a stroke/border around each avatar */\n stroke?: boolean;\n /**\n * Controls the background color mode for avatars in the group.\n * - 'mixed' (default): Avatars cycle through different colors\n * - 'brand', 'brandExtra', 'success', 'warning', 'alert', 'neutral': Single color for all avatars\n * - Theme function: A function that receives theme and returns any color from the design system.\n * Example: (theme) => theme.colors.core.link.link\n */\n avatarBackgroundMode?: AvatarBackgroundMode;\n /** Accessible label for the avatar group. Defaults to \"Group of X users\". */\n \"aria-label\"?: string;\n}\n\n// Map external size values to internal Avatar size values\nconst sizeMap: Record<\n \"sm\" | \"md\" | \"lg\" | \"xl\",\n \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\"\n> = {\n sm: \"sm\",\n md: \"md\",\n lg: \"lg\",\n xl: \"xl\",\n};\n\nexport const AvatarGroup: React.FC<AvatarGroupProps> = ({\n list,\n size = \"md\",\n maxVisible = 6,\n stroke = true,\n avatarBackgroundMode = \"mixed\",\n \"aria-label\": ariaLabel,\n themeMode,\n themeProductContext,\n}) => {\n const { theme } = useResolvedTheme({ themeMode, themeProductContext });\n\n // Map external size to internal Avatar size\n const internalSize = sizeMap[size];\n\n const totalCount = list.length;\n\n // Determine which avatars to show\n // Ensure maxVisible is non-negative and doesn't exceed totalCount\n const visibleCount = Math.min(totalCount, Math.max(0, maxVisible));\n const visibleListItems = list.slice(0, visibleCount);\n const remainingCount = totalCount - visibleCount;\n\n // Overlap amount: 4px in Figma\n const overlap = -4;\n\n // Background colors for text/icon avatars (cycling through theme colors)\n const mixedBackgrounds = [\n theme.colors.background.alert.secondary,\n theme.colors.background.warning.secondary,\n theme.colors.background.brandExtra.secondary,\n theme.colors.background.neutral.secondary,\n theme.colors.background.brand.secondary,\n theme.colors.background.success.secondary,\n theme.colors.background.success.primary,\n ];\n\n // Preset color mapping\n const presetColors: Record<string, string> = {\n brand: theme.colors.background.brand.secondary,\n brandExtra: theme.colors.background.brandExtra.secondary,\n success: theme.colors.background.success.secondary,\n warning: theme.colors.background.warning.secondary,\n alert: theme.colors.background.alert.secondary,\n neutral: theme.colors.background.neutral.secondary,\n };\n\n // Get background color based on avatarBackgroundMode\n const getBackgroundColor = (index: number): string => {\n if (typeof avatarBackgroundMode === \"function\") {\n return avatarBackgroundMode(theme);\n }\n if (avatarBackgroundMode === \"mixed\") {\n return mixedBackgrounds[index % mixedBackgrounds.length];\n }\n // Preset color mode\n return (\n presetColors[avatarBackgroundMode] || theme.colors.background.secondary\n );\n };\n\n // Default accessible label for the group\n const defaultAriaLabel =\n totalCount === 1\n ? \"1 user\"\n : totalCount === visibleCount\n ? `${totalCount} users`\n : `${visibleCount} of ${totalCount} users`;\n\n // Render an avatar with optional tooltip wrapper\n const renderAvatarWithTooltip = (\n avatar: React.ReactNode,\n tooltip: string | undefined,\n key: number\n ) => {\n if (tooltip) {\n return (\n <Tooltip key={key} content={tooltip} placement=\"top\">\n {avatar}\n </Tooltip>\n );\n }\n return avatar;\n };\n\n return (\n <Box\n flexDirection=\"row\"\n alignItems=\"center\"\n role=\"group\"\n aria-label={ariaLabel || defaultAriaLabel}\n >\n {visibleListItems.map((item, index) => {\n const shouldApplyBackground = !item.src;\n const backgroundColor = shouldApplyBackground\n ? getBackgroundColor(index)\n : undefined;\n\n // Only enable hover for image avatars with onClick\n const shouldEnableHover = !!item.src && !!item.onClick;\n\n const avatar = (\n <Box\n key={index}\n marginLeft={index === 0 ? 0 : overlap}\n zIndex={totalCount - index}\n >\n <Avatar\n src={item.src}\n text={item.initials}\n size={internalSize}\n stroke={stroke}\n backgroundColor={backgroundColor}\n disableHover={!shouldEnableHover}\n onClick={item.onClick}\n {...(item.tooltip ? { \"aria-label\": item.tooltip } : {})}\n />\n </Box>\n );\n\n return renderAvatarWithTooltip(avatar, item.tooltip, index);\n })}\n\n {remainingCount > 0 && (\n <Box marginLeft={overlap} zIndex={0}>\n <Avatar\n size={internalSize}\n text={`+${remainingCount}`}\n stroke={stroke}\n backgroundColor={theme.colors.background.secondary}\n disableHover={true}\n aria-label={`${remainingCount} more ${remainingCount === 1 ? \"user\" : \"users\"}`}\n />\n </Box>\n )}\n </Box>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,0BAQO;AA2ID;AAxIC,IAAM,MAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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AC,CAAC,KAAK;AAE/C,gBAAM,SACJ;AAAA,YAAC;AAAA;AAAA,cAEC,YAAY,UAAU,IAAI,IAAI;AAAA,cAC9B,QAAQ,aAAa;AAAA,cAErB;AAAA,gBAAC;AAAA;AAAA,kBACC,KAAK,KAAK;AAAA,kBACV,MAAM,KAAK;AAAA,kBACX,MAAM;AAAA,kBACN;AAAA,kBACA;AAAA,kBACA,cAAc,CAAC;AAAA,kBACf,SAAS,KAAK;AAAA,kBACb,GAAI,KAAK,UAAU,EAAE,cAAc,KAAK,QAAQ,IAAI,CAAC;AAAA;AAAA,cACxD;AAAA;AAAA,YAbK;AAAA,UAcP;AAGF,iBAAO,wBAAwB,QAAQ,KAAK,SAAS,KAAK;AAAA,QAC5D,CAAC;AAAA,QAEA,iBAAiB,KAChB,6CAAC,OAAI,YAAY,SAAS,QAAQ,GAChC;AAAA,UAAC;AAAA;AAAA,YACC,MAAM;AAAA,YACN,MAAM,IAAI,cAAc;AAAA,YACxB;AAAA,YACA,iBAAiB,MAAM,OAAO,WAAW;AAAA,YACzC,cAAc;AAAA,YACd,cAAY,GAAG,cAAc,SAAS,mBAAmB,IAAI,SAAS,OAAO;AAAA;AAAA,QAC/E,GACF;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["import_react_native","import_jsx_runtime","RNText","import_react_native","import_jsx_runtime","React","import_jsx_runtime","import_xui_core","import_jsx_runtime"]}
|
package/native/index.mjs
CHANGED
|
@@ -277,11 +277,10 @@ var Avatar = ({
|
|
|
277
277
|
text,
|
|
278
278
|
size = "xl",
|
|
279
279
|
square = false,
|
|
280
|
-
tone = "mono",
|
|
281
280
|
badge = false,
|
|
282
281
|
badgeCount,
|
|
283
|
-
badgeIcon,
|
|
284
282
|
badgeTone = "alert",
|
|
283
|
+
stroke = false,
|
|
285
284
|
backgroundColor,
|
|
286
285
|
disableHover = true,
|
|
287
286
|
"aria-label": ariaLabel,
|
|
@@ -292,9 +291,6 @@ var Avatar = ({
|
|
|
292
291
|
}) => {
|
|
293
292
|
const { theme } = useResolvedTheme({ themeMode, themeProductContext });
|
|
294
293
|
const sizeStyles = theme.sizing.avatar(size);
|
|
295
|
-
const toneBackground = tone === "brand" ? theme.colors.background.brand.primary : theme.colors.overlay.mono;
|
|
296
|
-
const toneHoverBackground = tone === "brand" ? theme.colors.background.brand.secondary : theme.colors.overlay.monoHover;
|
|
297
|
-
const toneContent = tone === "brand" ? theme.colors.content.on.brand : theme.colors.content.primary;
|
|
298
294
|
const borderRadius = square ? sizeStyles.borderRadiusSquare : sizeStyles.borderRadiusCircle;
|
|
299
295
|
const countSizeMap = {
|
|
300
296
|
xl: "xl",
|
|
@@ -312,8 +308,7 @@ var Avatar = ({
|
|
|
312
308
|
xs: "sm",
|
|
313
309
|
xxs: "xs"
|
|
314
310
|
};
|
|
315
|
-
const
|
|
316
|
-
const badgeSize = hasBadgeContent ? countSizeMap[size] : dotSizeMap[size];
|
|
311
|
+
const badgeSize = badgeCount ? countSizeMap[size] : dotSizeMap[size];
|
|
317
312
|
const getDotOffset = () => {
|
|
318
313
|
if (square) {
|
|
319
314
|
return size === "xxs" ? { right: -1, top: -1 } : { right: -3, top: -3 };
|
|
@@ -328,7 +323,7 @@ var Avatar = ({
|
|
|
328
323
|
};
|
|
329
324
|
return circleOffsets[size];
|
|
330
325
|
};
|
|
331
|
-
const badgeOffset =
|
|
326
|
+
const badgeOffset = badgeCount ? square ? sizeStyles.badgeOffsetSquare : sizeStyles.badgeOffsetCircle : getDotOffset();
|
|
332
327
|
const displayBadgeCount = badgeCount;
|
|
333
328
|
return /* @__PURE__ */ jsxs(
|
|
334
329
|
Box,
|
|
@@ -356,16 +351,16 @@ var Avatar = ({
|
|
|
356
351
|
width: sizeStyles.size,
|
|
357
352
|
height: sizeStyles.size,
|
|
358
353
|
borderRadius,
|
|
359
|
-
backgroundColor: backgroundColor ||
|
|
354
|
+
backgroundColor: backgroundColor || theme.colors.overlay.mono,
|
|
360
355
|
alignItems: "center",
|
|
361
356
|
justifyContent: "center",
|
|
362
357
|
position: "relative",
|
|
363
358
|
overflow: "hidden",
|
|
364
|
-
borderWidth:
|
|
365
|
-
borderColor: theme.colors.
|
|
359
|
+
borderWidth: stroke ? 1 : 0,
|
|
360
|
+
borderColor: theme.colors.background.primary,
|
|
366
361
|
...!disableHover && !src && {
|
|
367
362
|
hoverStyle: {
|
|
368
|
-
backgroundColor:
|
|
363
|
+
backgroundColor: theme.colors.overlay.monoHover
|
|
369
364
|
}
|
|
370
365
|
},
|
|
371
366
|
children: src ? /* @__PURE__ */ jsx4(
|
|
@@ -381,11 +376,11 @@ var Avatar = ({
|
|
|
381
376
|
height: sizeStyles.size,
|
|
382
377
|
borderRadius
|
|
383
378
|
}
|
|
384
|
-
) : icon ? /* @__PURE__ */ jsx4(Icon, { size: sizeStyles.iconSize, color:
|
|
379
|
+
) : icon ? /* @__PURE__ */ jsx4(Icon, { size: sizeStyles.iconSize, color: theme.colors.content.primary, children: icon }) : text ? /* @__PURE__ */ jsx4(
|
|
385
380
|
Text,
|
|
386
381
|
{
|
|
387
382
|
fontSize: sizeStyles.fontSize,
|
|
388
|
-
color:
|
|
383
|
+
color: theme.colors.content.primary,
|
|
389
384
|
fontWeight: "400",
|
|
390
385
|
letterSpacing: 0.4,
|
|
391
386
|
children: text
|
|
@@ -393,9 +388,8 @@ var Avatar = ({
|
|
|
393
388
|
) : /* @__PURE__ */ jsx4(
|
|
394
389
|
User,
|
|
395
390
|
{
|
|
396
|
-
variant: "solid",
|
|
397
391
|
size: sizeStyles.iconSize,
|
|
398
|
-
color:
|
|
392
|
+
color: theme.colors.content.primary
|
|
399
393
|
}
|
|
400
394
|
)
|
|
401
395
|
}
|
|
@@ -411,7 +405,6 @@ var Avatar = ({
|
|
|
411
405
|
{
|
|
412
406
|
size: badgeSize,
|
|
413
407
|
tone: badgeTone,
|
|
414
|
-
icon: badgeIcon,
|
|
415
408
|
showStroke: size !== "xxs",
|
|
416
409
|
"aria-label": displayBadgeCount ? `${displayBadgeCount} notifications` : "Notification",
|
|
417
410
|
children: displayBadgeCount
|
|
@@ -428,16 +421,24 @@ var Avatar = ({
|
|
|
428
421
|
import { useResolvedTheme as useResolvedTheme2 } from "@xsolla/xui-core";
|
|
429
422
|
import { Tooltip } from "@xsolla/xui-tooltip";
|
|
430
423
|
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
424
|
+
var sizeMap = {
|
|
425
|
+
sm: "sm",
|
|
426
|
+
md: "md",
|
|
427
|
+
lg: "lg",
|
|
428
|
+
xl: "xl"
|
|
429
|
+
};
|
|
431
430
|
var AvatarGroup = ({
|
|
432
431
|
list,
|
|
433
|
-
size = "
|
|
432
|
+
size = "md",
|
|
434
433
|
maxVisible = 6,
|
|
434
|
+
stroke = true,
|
|
435
435
|
avatarBackgroundMode = "mixed",
|
|
436
436
|
"aria-label": ariaLabel,
|
|
437
437
|
themeMode,
|
|
438
438
|
themeProductContext
|
|
439
439
|
}) => {
|
|
440
440
|
const { theme } = useResolvedTheme2({ themeMode, themeProductContext });
|
|
441
|
+
const internalSize = sizeMap[size];
|
|
441
442
|
const totalCount = list.length;
|
|
442
443
|
const visibleCount = Math.min(totalCount, Math.max(0, maxVisible));
|
|
443
444
|
const visibleListItems = list.slice(0, visibleCount);
|
|
@@ -498,14 +499,11 @@ var AvatarGroup = ({
|
|
|
498
499
|
{
|
|
499
500
|
src: item.src,
|
|
500
501
|
text: item.initials,
|
|
501
|
-
size,
|
|
502
|
+
size: internalSize,
|
|
503
|
+
stroke,
|
|
502
504
|
backgroundColor,
|
|
503
505
|
disableHover: !shouldEnableHover,
|
|
504
506
|
onClick: item.onClick,
|
|
505
|
-
badge: item.badge,
|
|
506
|
-
badgeCount: item.badgeCount,
|
|
507
|
-
badgeIcon: item.badgeIcon,
|
|
508
|
-
badgeTone: item.badgeTone,
|
|
509
507
|
...item.tooltip ? { "aria-label": item.tooltip } : {}
|
|
510
508
|
}
|
|
511
509
|
)
|
|
@@ -517,8 +515,9 @@ var AvatarGroup = ({
|
|
|
517
515
|
remainingCount > 0 && /* @__PURE__ */ jsx5(Box, { marginLeft: overlap, zIndex: 0, children: /* @__PURE__ */ jsx5(
|
|
518
516
|
Avatar,
|
|
519
517
|
{
|
|
520
|
-
size,
|
|
518
|
+
size: internalSize,
|
|
521
519
|
text: `+${remainingCount}`,
|
|
520
|
+
stroke,
|
|
522
521
|
backgroundColor: theme.colors.background.secondary,
|
|
523
522
|
disableHover: true,
|
|
524
523
|
"aria-label": `${remainingCount} more ${remainingCount === 1 ? "user" : "users"}`
|