@sproutsocial/seeds-react-profile 0.2.0 → 0.3.0
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +8 -0
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/InlineProfile.stories.tsx +33 -0
- package/src/InlineProfile.tsx +5 -3
- package/src/ProfileToken.stories.tsx +13 -113
- package/src/ProfileToken.tsx +9 -1
- package/src/__tests__/InlineProfile.test.tsx +5 -4
- package/src/__tests__/ProfileToken.test.tsx +14 -14
- package/src/types.ts +5 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -8,14 +8,14 @@ $ tsup --dts
|
|
|
8
8
|
[34mCLI[39m Cleaning output folder
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist/index.js [22m[32m13.
|
|
12
|
-
[32mCJS[39m [1mdist/index.js.map [22m[32m18.
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
-
[32mESM[39m [1mdist/esm/index.js [22m[32m9.
|
|
15
|
-
[32mESM[39m [1mdist/esm/index.js.map [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m13.39 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m18.70 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 131ms
|
|
14
|
+
[32mESM[39m [1mdist/esm/index.js [22m[32m9.79 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/esm/index.js.map [22m[32m18.56 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 132ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m5.
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m5.
|
|
21
|
-
Done in 11.
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 9971ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m5.82 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m5.82 KB[39m
|
|
21
|
+
Done in 11.79s.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @sproutsocial/seeds-react-profile
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- deccf6b: - InlineProfile now automatically hides avatar when avatarUrl is not provided
|
|
8
|
+
- Update ProfileToken with design improvements: verticalAlign: 'middle', updated padding (2px 6px), and margin (2px 0)
|
|
9
|
+
- **BREAKING**: ProfileToken no longer accepts avatarUrl, secondaryName, or avatarSize props (enforces design standards for compact token display)
|
|
10
|
+
|
|
3
11
|
## 0.2.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/dist/esm/index.js
CHANGED
|
@@ -261,7 +261,7 @@ var InlineProfile = ({
|
|
|
261
261
|
const displayName = name || secondaryName || "Unknown Profile";
|
|
262
262
|
const avatarSize = avatarSizeOverride || avatarSizeMap[size];
|
|
263
263
|
return /* @__PURE__ */ jsxs2(InlineProfileContainer, { className, $size: size, children: [
|
|
264
|
-
/* @__PURE__ */ jsx3(InlineProfileAvatar, { children: /* @__PURE__ */ jsx3(Avatar2, { src: avatarUrl, name: displayName, size: avatarSize }) }),
|
|
264
|
+
avatarUrl && /* @__PURE__ */ jsx3(InlineProfileAvatar, { children: /* @__PURE__ */ jsx3(Avatar2, { src: avatarUrl, name: displayName, size: avatarSize }) }),
|
|
265
265
|
/* @__PURE__ */ jsxs2(InlineProfileContent, { children: [
|
|
266
266
|
partnerName && /* @__PURE__ */ jsx3(InlineProfileNetwork, { children: /* @__PURE__ */ jsx3(
|
|
267
267
|
PartnerLogo2,
|
|
@@ -294,6 +294,10 @@ var StyledProfileToken = styled3(Token)`
|
|
|
294
294
|
box-sizing: border-box;
|
|
295
295
|
display: inline-flex;
|
|
296
296
|
max-width: 100%;
|
|
297
|
+
vertical-align: middle;
|
|
298
|
+
padding: ${(props) => props.theme.space[100]}
|
|
299
|
+
${(props) => props.theme.space[200]};
|
|
300
|
+
margin: ${(props) => props.theme.space[100]} 0;
|
|
297
301
|
`;
|
|
298
302
|
var ProfileToken = ({
|
|
299
303
|
className,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ProfileCard.tsx","../../src/VerifiedProfileIcon.tsx","../../src/InlineProfile.tsx","../../src/ProfileToken.tsx"],"sourcesContent":["import styled from \"styled-components\";\nimport { PartnerLogo } from \"@sproutsocial/seeds-react-partner-logo\";\nimport { Avatar } from \"@sproutsocial/seeds-react-avatar\";\nimport {\n Card,\n CardHeader,\n CardContent,\n CardFooter,\n} from \"@sproutsocial/seeds-react-card\";\nimport { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport { Link } from \"@sproutsocial/seeds-react-link\";\nimport { Text } from \"@sproutsocial/seeds-react-text\";\nimport type { TypeProfileCardProps } from \"./types\";\nimport { VerifiedProfileIcon } from \"./VerifiedProfileIcon\";\n\n// Styled Components\nconst StyledProfileCard = styled(Card)`\n max-width: 300px;\n`;\n\nconst StyledCardHeader = styled(CardHeader)<{\n $bannerColor?: string;\n $partnerName?: string;\n}>`\n position: relative;\n height: 80px;\n padding: ${(props) => props.theme.space[400]}\n ${(props) => props.theme.space[400]} 0 ${(props) => props.theme.space[400]};\n margin-bottom: 0;\n color: ${(props) => props.theme.colors.text.inverse};\n border-radius: ${(props) => props.theme.radii[500]}\n ${(props) => props.theme.radii[500]} 0 0;\n ${(props) => {\n // Use explicit bannerColor if provided\n if (props.$bannerColor) {\n return `background: ${props.$bannerColor};`;\n }\n // Fall back to theme.colors.network[partnerName] if partnerName is available\n if (props.$partnerName && props.theme.colors.network) {\n const networkColor =\n props.theme.colors.network[\n props.$partnerName as keyof typeof props.theme.colors.network\n ];\n return networkColor ? `background: ${networkColor};` : \"\";\n }\n return \"\";\n }}\n`;\n\nconst BannerContent = styled.div`\n display: flex;\n justify-content: flex-end;\n width: 100%;\n`;\n\nconst ActionsSection = styled.div`\n display: flex;\n justify-content: flex-end;\n gap: ${(props) => props.theme.space[100]};\n padding: 0 ${(props) => props.theme.space[300]};\n\n &:empty {\n min-height: 44px;\n }\n`;\n\nconst StyledCardContent = styled(CardContent)`\n display: flex;\n flex-direction: column;\n gap: ${(props) => props.theme.space[300]};\n padding: 0 ${(props) => props.theme.space[400]}\n ${(props) => props.theme.space[400]};\n`;\n\nconst ProfileNameSection = styled.div`\n display: flex;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n`;\n\nconst InfoRow = styled.div`\n display: flex;\n align-items: center;\n gap: ${(props) => props.theme.space[300]};\n`;\n\n/**\n * A flexible profile component that can display user profiles in various formats\n * across different social networks with consistent styling and behavior.\n */\nexport const ProfileCard = ({\n partnerName,\n name,\n secondaryName,\n avatarUrl,\n subtext,\n description,\n verificationType,\n profileUrl,\n location,\n bannerColor,\n bannerContent,\n metadata,\n profileActions,\n footer,\n cardProps,\n}: TypeProfileCardProps) => {\n return (\n <StyledProfileCard role=\"presentation\" {...cardProps}>\n <StyledCardHeader $bannerColor={bannerColor} $partnerName={partnerName}>\n <Avatar src={avatarUrl} name={name} size=\"60px\" mt={450} />\n {bannerContent && <BannerContent>{bannerContent}</BannerContent>}\n </StyledCardHeader>\n\n <ActionsSection>{profileActions}</ActionsSection>\n\n <StyledCardContent>\n <ProfileNameSection>\n {partnerName && (\n <PartnerLogo\n partnerName={partnerName}\n aria-label={`${partnerName} profile`}\n size=\"small\"\n />\n )}\n <Text.SubHeadline as=\"h2\">{name}</Text.SubHeadline>\n </ProfileNameSection>\n\n {subtext && (\n <Text fontSize={200} color=\"text.subtext\">\n {subtext}\n </Text>\n )}\n\n {secondaryName && (\n <InfoRow>\n {profileUrl ? (\n <Link href={profileUrl} external>\n <Text fontSize={200}>{secondaryName}</Text>\n <Icon\n name=\"arrow-right-up-outline\"\n aria-hidden\n ml={100}\n size=\"small\"\n />\n </Link>\n ) : (\n <Text.SmallByline color=\"text.subtext\">\n {secondaryName}\n </Text.SmallByline>\n )}\n {verificationType && (\n <VerifiedProfileIcon\n partnerName={partnerName}\n verificationType={verificationType}\n />\n )}\n </InfoRow>\n )}\n\n {description && <Text fontSize={200}>{description}</Text>}\n\n {location && (\n <InfoRow>\n <Icon name=\"location-pin-outline\" aria-hidden size=\"small\" />\n <Text fontSize={200}>{location}</Text>\n </InfoRow>\n )}\n\n {metadata && metadata.length > 0 && (\n <InfoRow>\n {metadata.map((info, index) => (\n <Text fontSize={200} key={index}>\n {info}\n </Text>\n ))}\n </InfoRow>\n )}\n </StyledCardContent>\n\n {footer && <CardFooter>{footer}</CardFooter>}\n </StyledProfileCard>\n );\n};\n\nexport default ProfileCard;\n","import { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport type { TypeProfileNetwork, TypeProfileVerification } from \"./types\";\n\n// TODO: Move these to a more appropriate location\nconst VERIFICATION_COLORS = {\n twitter: \"#000000\",\n facebook: \"#1877F2\",\n x: \"#000000\",\n linkedin: \"#0A66C2\",\n instagram: \"#e4405f\",\n gray: \"#515e5f\",\n} as const;\n\n/**\n * Gets the verification color based on partnerName and verification type\n */\nexport const getVerificationColor = (\n partnerName?: TypeProfileNetwork,\n verificationType?: TypeProfileVerification\n): string => {\n if (!verificationType || verificationType === \"not_verified\") return \"\";\n\n switch (verificationType) {\n case \"blue_verified\":\n // Use partner-specific blue color\n return partnerName === \"facebook\"\n ? VERIFICATION_COLORS.facebook\n : VERIFICATION_COLORS.twitter;\n case \"gray_verified\":\n return VERIFICATION_COLORS.gray;\n case \"verified\":\n default:\n // Default to partner color or Twitter blue\n if (partnerName && partnerName in VERIFICATION_COLORS) {\n return VERIFICATION_COLORS[\n partnerName as keyof typeof VERIFICATION_COLORS\n ];\n }\n return VERIFICATION_COLORS.twitter;\n }\n};\n\nexport interface TypeVerifiedProfileIconProps {\n partnerName?: TypeProfileNetwork;\n verificationType: TypeProfileVerification;\n}\n\nexport const VerifiedProfileIcon = ({\n partnerName,\n verificationType,\n}: TypeVerifiedProfileIconProps) => {\n if (!verificationType || verificationType === \"not_verified\") return;\n\n const verificationColor = getVerificationColor(partnerName, verificationType);\n return (\n <Icon\n title=\"Verified\"\n aria-label=\"Verified account\"\n color={verificationColor}\n name=\"verified\"\n ml=\"150\"\n />\n );\n};\n","import styled from \"styled-components\";\nimport { PartnerLogo } from \"@sproutsocial/seeds-react-partner-logo\";\nimport { Avatar } from \"@sproutsocial/seeds-react-avatar\";\nimport type { TypeInlineProfileProps } from \"./types\";\nimport { VerifiedProfileIcon } from \"./VerifiedProfileIcon\";\n\nconst InlineProfileContainer = styled.span<{\n $size?: \"small\" | \"medium\" | \"large\";\n}>`\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n max-width: 100%;\n ${(props) => props.theme.typography[200]}\n color: ${(props) => props.theme.colors.text.subtext};\n text-align: inherit;\n`;\n\nconst InlineProfileAvatar = styled.span`\n display: inline-flex;\n flex-shrink: 0;\n`;\n\nconst InlineProfileContent = styled.span`\n display: inline-flex;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n min-width: 0;\n flex: 1;\n`;\n\nconst InlineProfileNetwork = styled.span`\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n`;\n\nconst InlineProfileText = styled.span`\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n min-width: 0;\n flex: 1;\n`;\n\nconst InlineProfileName = styled.span`\n display: inline-block;\n ${(props) => props.theme.typography[200]}\n font-family: ${(props) => props.theme.fontFamily};\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n text-transform: lowercase;\n color: ${(props) => props.theme.colors.text.body};\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst InlineProfileHandle = styled.span`\n display: inline-block;\n ${(props) => props.theme.typography[200]}\n font-family: ${(props) => props.theme.fontFamily};\n color: ${(props) => props.theme.colors.text.subtext};\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst avatarSizeMap = {\n small: \"16px\",\n medium: \"20px\",\n large: \"24px\",\n} as const;\n\n/**\n * A compact inline profile component that displays avatar, name/handle, and verification.\n * Perfect for use in post headers, comments, or other compact spaces.\n *\n * @param props - Profile props\n * @param props.name - Name of the profile\n * @param props.secondaryName - Secondary name of the profile\n * @param props.partnerName - Partner logo name\n * @param props.partnerLogoLabel - Aria-label for the partner logo\n * @param props.avatarSize - Size of the avatar\n * @param props.avatarUrl - Image URL for the avatar\n * @param props.children - Additional elements to render within the profile component\n * @returns JSX.Element representing a user profile\n *\n * @example\n * <InlineProfile\n * name=\"John Doe\"\n * secondaryName=\"johndoe123\"\n * partnerName=\"facebook\"\n * partnerLogoLabel=\"Facebook Logo\"\n * avatarSize=\"24px\"\n * avatarUrl=\"https://example.com/avatar.jpg\"\n * >\n * <Badge text=\"Moderator\" badgeColor=\"green\" />\n * </InlineProfile>\n */\nexport const InlineProfile = ({\n name,\n secondaryName,\n partnerName,\n partnerLogoLabel,\n size = \"medium\",\n avatarSize: avatarSizeOverride,\n avatarUrl,\n verificationType,\n className,\n}: TypeInlineProfileProps) => {\n const displayName = name || secondaryName || \"Unknown Profile\";\n const avatarSize = avatarSizeOverride || avatarSizeMap[size];\n\n return (\n <InlineProfileContainer className={className} $size={size}>\n <InlineProfileAvatar>\n <Avatar src={avatarUrl} name={displayName} size={avatarSize} />\n </InlineProfileAvatar>\n\n <InlineProfileContent>\n {partnerName && (\n <InlineProfileNetwork>\n <PartnerLogo\n partnerName={partnerName}\n aria-label={partnerLogoLabel || `${partnerName} profile`}\n size=\"small\"\n />\n </InlineProfileNetwork>\n )}\n\n <InlineProfileText>\n {name && <InlineProfileName>{name}</InlineProfileName>}\n\n {secondaryName && (\n <InlineProfileHandle>{secondaryName}</InlineProfileHandle>\n )}\n </InlineProfileText>\n\n {verificationType && (\n <VerifiedProfileIcon\n partnerName={partnerName}\n verificationType={verificationType}\n />\n )}\n </InlineProfileContent>\n </InlineProfileContainer>\n );\n};\n","import styled from \"styled-components\";\nimport { Token } from \"@sproutsocial/seeds-react-token\";\nimport { InlineProfile } from \"./InlineProfile\";\nimport type { ProfileTokenProps } from \"./types\";\n\nconst StyledProfileToken = styled(Token)`\n box-sizing: border-box;\n display: inline-flex;\n max-width: 100%;\n`;\n\n/**\n * A ProfileToken component that wraps CompactProfile in a Seeds Token component.\n * This token is not closable and provides a compact way to display profile information inline.\n */\nexport const ProfileToken = ({\n className,\n onClick,\n tokenProps,\n ...props\n}: ProfileTokenProps) => (\n <StyledProfileToken\n className={className}\n closeable={false}\n onClick={onClick}\n {...tokenProps}\n >\n <InlineProfile size=\"small\" {...props} />\n </StyledProfileToken>\n);\n\nexport default ProfileToken;\n"],"mappings":";AAAA,OAAO,YAAY;AACnB,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,QAAAA,aAAY;AACrB,SAAS,YAAY;AACrB,SAAS,YAAY;;;ACXrB,SAAS,YAAY;AAuDjB;AAnDJ,IAAM,sBAAsB;AAAA,EAC1B,SAAS;AAAA,EACT,UAAU;AAAA,EACV,GAAG;AAAA,EACH,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AACR;AAKO,IAAM,uBAAuB,CAClC,aACA,qBACW;AACX,MAAI,CAAC,oBAAoB,qBAAqB,eAAgB,QAAO;AAErE,UAAQ,kBAAkB;AA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ACF,MAA8B;AAC5B,QAAM,cAAc,QAAQ,iBAAiB;AAC7C,QAAM,aAAa,sBAAsB,cAAc,IAAI;AAE3D,SACE,gBAAAD,MAAC,0BAAuB,WAAsB,OAAO,MACnD;AAAA,oBAAAD,KAAC,uBACC,0BAAAA,KAACG,SAAA,EAAO,KAAK,WAAW,MAAM,aAAa,MAAM,YAAY,GAC/D;AAAA,IAEA,gBAAAF,MAAC,wBACE;AAAA,qBACC,gBAAAD,KAAC,wBACC,0BAAAA;AAAA,QAACI;AAAA,QAAA;AAAA,UACC;AAAA,UACA,cAAY,oBAAoB,GAAG,WAAW;AAAA,UAC9C,MAAK;AAAA;AAAA,MACP,GACF;AAAA,MAGF,gBAAAH,MAAC,qBACE;AAAA,gBAAQ,gBAAAD,KAAC,qBAAmB,gBAAK;AAAA,QAEjC,iBACC,gBAAAA,KAAC,uBAAqB,yBAAc;AAAA,SAExC;AAAA,MAEC,oBACC,gBAAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA;AAAA,MACF;AAAA,OAEJ;AAAA,KACF;AAEJ;;;ACvJA,OAAOK,aAAY;AACnB,SAAS,aAAa;AA0BlB,gBAAAC,YAAA;AAtBJ,IAAM,qBAAqBC,QAAO,KAAK;AAAA;AAAA;AAAA;AAAA;AAUhC,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE,gBAAAD;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACC,GAAG;AAAA,IAEJ,0BAAAA,KAAC,iBAAc,MAAK,SAAS,GAAG,OAAO;AAAA;AACzC;","names":["Icon","jsx","Icon","styled","PartnerLogo","Avatar","jsx","jsxs","styled","Avatar","PartnerLogo","styled","jsx","styled"]}
|
|
1
|
+
{"version":3,"sources":["../../src/ProfileCard.tsx","../../src/VerifiedProfileIcon.tsx","../../src/InlineProfile.tsx","../../src/ProfileToken.tsx"],"sourcesContent":["import styled from \"styled-components\";\nimport { PartnerLogo } from \"@sproutsocial/seeds-react-partner-logo\";\nimport { Avatar } from \"@sproutsocial/seeds-react-avatar\";\nimport {\n Card,\n CardHeader,\n CardContent,\n CardFooter,\n} from \"@sproutsocial/seeds-react-card\";\nimport { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport { Link } from \"@sproutsocial/seeds-react-link\";\nimport { Text } from \"@sproutsocial/seeds-react-text\";\nimport type { TypeProfileCardProps } from \"./types\";\nimport { VerifiedProfileIcon } from \"./VerifiedProfileIcon\";\n\n// Styled Components\nconst StyledProfileCard = styled(Card)`\n max-width: 300px;\n`;\n\nconst StyledCardHeader = styled(CardHeader)<{\n $bannerColor?: string;\n $partnerName?: string;\n}>`\n position: relative;\n height: 80px;\n padding: ${(props) => props.theme.space[400]}\n ${(props) => props.theme.space[400]} 0 ${(props) => props.theme.space[400]};\n margin-bottom: 0;\n color: ${(props) => props.theme.colors.text.inverse};\n border-radius: ${(props) => props.theme.radii[500]}\n ${(props) => props.theme.radii[500]} 0 0;\n ${(props) => {\n // Use explicit bannerColor if provided\n if (props.$bannerColor) {\n return `background: ${props.$bannerColor};`;\n }\n // Fall back to theme.colors.network[partnerName] if partnerName is available\n if (props.$partnerName && props.theme.colors.network) {\n const networkColor =\n props.theme.colors.network[\n props.$partnerName as keyof typeof props.theme.colors.network\n ];\n return networkColor ? `background: ${networkColor};` : \"\";\n }\n return \"\";\n }}\n`;\n\nconst BannerContent = styled.div`\n display: flex;\n justify-content: flex-end;\n width: 100%;\n`;\n\nconst ActionsSection = styled.div`\n display: flex;\n justify-content: flex-end;\n gap: ${(props) => props.theme.space[100]};\n padding: 0 ${(props) => props.theme.space[300]};\n\n &:empty {\n min-height: 44px;\n }\n`;\n\nconst StyledCardContent = styled(CardContent)`\n display: flex;\n flex-direction: column;\n gap: ${(props) => props.theme.space[300]};\n padding: 0 ${(props) => props.theme.space[400]}\n ${(props) => props.theme.space[400]};\n`;\n\nconst ProfileNameSection = styled.div`\n display: flex;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n`;\n\nconst InfoRow = styled.div`\n display: flex;\n align-items: center;\n gap: ${(props) => props.theme.space[300]};\n`;\n\n/**\n * A flexible profile component that can display user profiles in various formats\n * across different social networks with consistent styling and behavior.\n */\nexport const ProfileCard = ({\n partnerName,\n name,\n secondaryName,\n avatarUrl,\n subtext,\n description,\n verificationType,\n profileUrl,\n location,\n bannerColor,\n bannerContent,\n metadata,\n profileActions,\n footer,\n cardProps,\n}: TypeProfileCardProps) => {\n return (\n <StyledProfileCard role=\"presentation\" {...cardProps}>\n <StyledCardHeader $bannerColor={bannerColor} $partnerName={partnerName}>\n <Avatar src={avatarUrl} name={name} size=\"60px\" mt={450} />\n {bannerContent && <BannerContent>{bannerContent}</BannerContent>}\n </StyledCardHeader>\n\n <ActionsSection>{profileActions}</ActionsSection>\n\n <StyledCardContent>\n <ProfileNameSection>\n {partnerName && (\n <PartnerLogo\n partnerName={partnerName}\n aria-label={`${partnerName} profile`}\n size=\"small\"\n />\n )}\n <Text.SubHeadline as=\"h2\">{name}</Text.SubHeadline>\n </ProfileNameSection>\n\n {subtext && (\n <Text fontSize={200} color=\"text.subtext\">\n {subtext}\n </Text>\n )}\n\n {secondaryName && (\n <InfoRow>\n {profileUrl ? (\n <Link href={profileUrl} external>\n <Text fontSize={200}>{secondaryName}</Text>\n <Icon\n name=\"arrow-right-up-outline\"\n aria-hidden\n ml={100}\n size=\"small\"\n />\n </Link>\n ) : (\n <Text.SmallByline color=\"text.subtext\">\n {secondaryName}\n </Text.SmallByline>\n )}\n {verificationType && (\n <VerifiedProfileIcon\n partnerName={partnerName}\n verificationType={verificationType}\n />\n )}\n </InfoRow>\n )}\n\n {description && <Text fontSize={200}>{description}</Text>}\n\n {location && (\n <InfoRow>\n <Icon name=\"location-pin-outline\" aria-hidden size=\"small\" />\n <Text fontSize={200}>{location}</Text>\n </InfoRow>\n )}\n\n {metadata && metadata.length > 0 && (\n <InfoRow>\n {metadata.map((info, index) => (\n <Text fontSize={200} key={index}>\n {info}\n </Text>\n ))}\n </InfoRow>\n )}\n </StyledCardContent>\n\n {footer && <CardFooter>{footer}</CardFooter>}\n </StyledProfileCard>\n );\n};\n\nexport default ProfileCard;\n","import { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport type { TypeProfileNetwork, TypeProfileVerification } from \"./types\";\n\n// TODO: Move these to a more appropriate location\nconst VERIFICATION_COLORS = {\n twitter: \"#000000\",\n facebook: \"#1877F2\",\n x: \"#000000\",\n linkedin: \"#0A66C2\",\n instagram: \"#e4405f\",\n gray: \"#515e5f\",\n} as const;\n\n/**\n * Gets the verification color based on partnerName and verification type\n */\nexport const getVerificationColor = (\n partnerName?: TypeProfileNetwork,\n verificationType?: TypeProfileVerification\n): string => {\n if (!verificationType || verificationType === \"not_verified\") return \"\";\n\n switch (verificationType) {\n case \"blue_verified\":\n // Use partner-specific blue color\n return partnerName === \"facebook\"\n ? VERIFICATION_COLORS.facebook\n : VERIFICATION_COLORS.twitter;\n case \"gray_verified\":\n return VERIFICATION_COLORS.gray;\n case \"verified\":\n default:\n // Default to partner color or Twitter blue\n if (partnerName && partnerName in VERIFICATION_COLORS) {\n return VERIFICATION_COLORS[\n partnerName as keyof typeof VERIFICATION_COLORS\n ];\n }\n return VERIFICATION_COLORS.twitter;\n }\n};\n\nexport interface TypeVerifiedProfileIconProps {\n partnerName?: TypeProfileNetwork;\n verificationType: TypeProfileVerification;\n}\n\nexport const VerifiedProfileIcon = ({\n partnerName,\n verificationType,\n}: TypeVerifiedProfileIconProps) => {\n if (!verificationType || verificationType === \"not_verified\") return;\n\n const verificationColor = getVerificationColor(partnerName, verificationType);\n return (\n <Icon\n title=\"Verified\"\n aria-label=\"Verified account\"\n color={verificationColor}\n name=\"verified\"\n ml=\"150\"\n />\n );\n};\n","import styled from \"styled-components\";\nimport { PartnerLogo } from \"@sproutsocial/seeds-react-partner-logo\";\nimport { Avatar } from \"@sproutsocial/seeds-react-avatar\";\nimport type { TypeInlineProfileProps } from \"./types\";\nimport { VerifiedProfileIcon } from \"./VerifiedProfileIcon\";\n\nconst InlineProfileContainer = styled.span<{\n $size?: \"small\" | \"medium\" | \"large\";\n}>`\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n max-width: 100%;\n ${(props) => props.theme.typography[200]}\n color: ${(props) => props.theme.colors.text.subtext};\n text-align: inherit;\n`;\n\nconst InlineProfileAvatar = styled.span`\n display: inline-flex;\n flex-shrink: 0;\n`;\n\nconst InlineProfileContent = styled.span`\n display: inline-flex;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n min-width: 0;\n flex: 1;\n`;\n\nconst InlineProfileNetwork = styled.span`\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n`;\n\nconst InlineProfileText = styled.span`\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n min-width: 0;\n flex: 1;\n`;\n\nconst InlineProfileName = styled.span`\n display: inline-block;\n ${(props) => props.theme.typography[200]}\n font-family: ${(props) => props.theme.fontFamily};\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n text-transform: lowercase;\n color: ${(props) => props.theme.colors.text.body};\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst InlineProfileHandle = styled.span`\n display: inline-block;\n ${(props) => props.theme.typography[200]}\n font-family: ${(props) => props.theme.fontFamily};\n color: ${(props) => props.theme.colors.text.subtext};\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst avatarSizeMap = {\n small: \"16px\",\n medium: \"20px\",\n large: \"24px\",\n} as const;\n\n/**\n * A compact inline profile component that displays avatar, name/handle, and verification.\n * Perfect for use in post headers, comments, or other compact spaces.\n *\n * @param props - Profile props\n * @param props.name - Name of the profile\n * @param props.secondaryName - Secondary name of the profile\n * @param props.partnerName - Partner logo name\n * @param props.partnerLogoLabel - Aria-label for the partner logo\n * @param props.avatarSize - Size of the avatar\n * @param props.avatarUrl - Image URL for the avatar\n * @param props.children - Additional elements to render within the profile component\n * @returns JSX.Element representing a user profile\n *\n * @example\n * <InlineProfile\n * name=\"John Doe\"\n * secondaryName=\"johndoe123\"\n * partnerName=\"facebook\"\n * partnerLogoLabel=\"Facebook Logo\"\n * avatarSize=\"24px\"\n * avatarUrl=\"https://example.com/avatar.jpg\"\n * >\n * <Badge text=\"Moderator\" badgeColor=\"green\" />\n * </InlineProfile>\n */\nexport const InlineProfile = ({\n name,\n secondaryName,\n partnerName,\n partnerLogoLabel,\n size = \"medium\",\n avatarSize: avatarSizeOverride,\n avatarUrl,\n verificationType,\n className,\n}: TypeInlineProfileProps) => {\n const displayName = name || secondaryName || \"Unknown Profile\";\n const avatarSize = avatarSizeOverride || avatarSizeMap[size];\n\n return (\n <InlineProfileContainer className={className} $size={size}>\n {avatarUrl && (\n <InlineProfileAvatar>\n <Avatar src={avatarUrl} name={displayName} size={avatarSize} />\n </InlineProfileAvatar>\n )}\n\n <InlineProfileContent>\n {partnerName && (\n <InlineProfileNetwork>\n <PartnerLogo\n partnerName={partnerName}\n aria-label={partnerLogoLabel || `${partnerName} profile`}\n size=\"small\"\n />\n </InlineProfileNetwork>\n )}\n\n <InlineProfileText>\n {name && <InlineProfileName>{name}</InlineProfileName>}\n\n {secondaryName && (\n <InlineProfileHandle>{secondaryName}</InlineProfileHandle>\n )}\n </InlineProfileText>\n\n {verificationType && (\n <VerifiedProfileIcon\n partnerName={partnerName}\n verificationType={verificationType}\n />\n )}\n </InlineProfileContent>\n </InlineProfileContainer>\n );\n};\n","import styled from \"styled-components\";\nimport { Token } from \"@sproutsocial/seeds-react-token\";\nimport { InlineProfile } from \"./InlineProfile\";\nimport type { ProfileTokenProps } from \"./types\";\n\nconst StyledProfileToken = styled(Token)`\n box-sizing: border-box;\n display: inline-flex;\n max-width: 100%;\n vertical-align: middle;\n padding: ${(props) => props.theme.space[100]}\n ${(props) => props.theme.space[200]};\n margin: ${(props) => props.theme.space[100]} 0;\n`;\n\n/**\n * A ProfileToken component that wraps InlineProfile in a Seeds Token component.\n * This token is not closable and provides a compact way to display profile information inline.\n *\n * ProfileToken enforces design standards by only showing the profile name and network logo.\n * It does not support avatars, secondary names (handles), or custom avatar sizes.\n * Use InlineProfile directly if you need more flexibility.\n */\nexport const ProfileToken = ({\n className,\n onClick,\n tokenProps,\n ...props\n}: ProfileTokenProps) => (\n <StyledProfileToken\n className={className}\n closeable={false}\n onClick={onClick}\n {...tokenProps}\n >\n <InlineProfile size=\"small\" {...props} />\n </StyledProfileToken>\n);\n\nexport default ProfileToken;\n"],"mappings":";AAAA,OAAO,YAAY;AACnB,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,QAAAA,aAAY;AACrB,SAAS,YAAY;AACrB,SAAS,YAAY;;;ACXrB,SAAS,YAAY;AAuDjB;AAnDJ,IAAM,sBAAsB;AAAA,EAC1B,SAAS;AAAA,EACT,UAAU;AAAA,EACV,GAAG;AAAA,EACH,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AACR;AAKO,IAAM,uBAAuB,CAClC,aACA,qBACW;AACX,MAAI,CAAC,oBAAoB,qBAAqB,eAAgB,QAAO;AAErE,UAAQ,kBAAkB;AAAA,IACxB,KAAK;AAEH,aAAO,gBAAgB,aACnB,oBAAoB,WACpB,oBAAoB;AAAA,IAC1B,KAAK;AACH,aAAO,oBAAoB;AAAA,IAC7B,KAAK;AAAA,IACL;AAEE,UAAI,eAAe,eAAe,qBAAqB;AACrD,eAAO,oBACL,WACF;AAAA,MACF;AACA,aAAO,oBAAoB;AAAA,EAC/B;AACF;AAOO,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AACF,MAAoC;AAClC,MAAI,CAAC,oBAAoB,qBAAqB,eAAgB;AAE9D,QAAM,oBAAoB,qBAAqB,a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oB,GAAG,WAAW;AAAA,UAC9C,MAAK;AAAA;AAAA,MACP,GACF;AAAA,MAGF,gBAAAH,MAAC,qBACE;AAAA,gBAAQ,gBAAAD,KAAC,qBAAmB,gBAAK;AAAA,QAEjC,iBACC,gBAAAA,KAAC,uBAAqB,yBAAc;AAAA,SAExC;AAAA,MAEC,oBACC,gBAAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA;AAAA,MACF;AAAA,OAEJ;AAAA,KACF;AAEJ;;;ACzJA,OAAOK,aAAY;AACnB,SAAS,aAAa;AAkClB,gBAAAC,YAAA;AA9BJ,IAAM,qBAAqBC,QAAO,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,aAK1B,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA,MACxC,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA,YAC3B,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA;AAWtC,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE,gBAAAD;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACC,GAAG;AAAA,IAEJ,0BAAAA,KAAC,iBAAc,MAAK,SAAS,GAAG,OAAO;AAAA;AACzC;","names":["Icon","jsx","Icon","styled","PartnerLogo","Avatar","jsx","jsxs","styled","Avatar","PartnerLogo","styled","jsx","styled"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -49,7 +49,7 @@ interface TypeInlineProfileProps extends Omit<TypeBaseProfileProps, "name"> {
|
|
|
49
49
|
/** The px size of the avatar, which has a default based on the size prop */
|
|
50
50
|
avatarSize?: string;
|
|
51
51
|
}
|
|
52
|
-
interface ProfileTokenProps extends TypeInlineProfileProps {
|
|
52
|
+
interface ProfileTokenProps extends Omit<TypeInlineProfileProps, "avatarUrl" | "secondaryName" | "avatarSize"> {
|
|
53
53
|
/** Click handler for the entire inline profile */
|
|
54
54
|
onClick?: TypeTokenProps["onClick"];
|
|
55
55
|
/** Additional props to pass to the Token component */
|
|
@@ -119,8 +119,12 @@ declare const ProfileCard: ({ partnerName, name, secondaryName, avatarUrl, subte
|
|
|
119
119
|
declare const InlineProfile: ({ name, secondaryName, partnerName, partnerLogoLabel, size, avatarSize: avatarSizeOverride, avatarUrl, verificationType, className, }: TypeInlineProfileProps) => react_jsx_runtime.JSX.Element;
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* A ProfileToken component that wraps
|
|
122
|
+
* A ProfileToken component that wraps InlineProfile in a Seeds Token component.
|
|
123
123
|
* This token is not closable and provides a compact way to display profile information inline.
|
|
124
|
+
*
|
|
125
|
+
* ProfileToken enforces design standards by only showing the profile name and network logo.
|
|
126
|
+
* It does not support avatars, secondary names (handles), or custom avatar sizes.
|
|
127
|
+
* Use InlineProfile directly if you need more flexibility.
|
|
124
128
|
*/
|
|
125
129
|
declare const ProfileToken: ({ className, onClick, tokenProps, ...props }: ProfileTokenProps) => react_jsx_runtime.JSX.Element;
|
|
126
130
|
|
package/dist/index.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ interface TypeInlineProfileProps extends Omit<TypeBaseProfileProps, "name"> {
|
|
|
49
49
|
/** The px size of the avatar, which has a default based on the size prop */
|
|
50
50
|
avatarSize?: string;
|
|
51
51
|
}
|
|
52
|
-
interface ProfileTokenProps extends TypeInlineProfileProps {
|
|
52
|
+
interface ProfileTokenProps extends Omit<TypeInlineProfileProps, "avatarUrl" | "secondaryName" | "avatarSize"> {
|
|
53
53
|
/** Click handler for the entire inline profile */
|
|
54
54
|
onClick?: TypeTokenProps["onClick"];
|
|
55
55
|
/** Additional props to pass to the Token component */
|
|
@@ -119,8 +119,12 @@ declare const ProfileCard: ({ partnerName, name, secondaryName, avatarUrl, subte
|
|
|
119
119
|
declare const InlineProfile: ({ name, secondaryName, partnerName, partnerLogoLabel, size, avatarSize: avatarSizeOverride, avatarUrl, verificationType, className, }: TypeInlineProfileProps) => react_jsx_runtime.JSX.Element;
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* A ProfileToken component that wraps
|
|
122
|
+
* A ProfileToken component that wraps InlineProfile in a Seeds Token component.
|
|
123
123
|
* This token is not closable and provides a compact way to display profile information inline.
|
|
124
|
+
*
|
|
125
|
+
* ProfileToken enforces design standards by only showing the profile name and network logo.
|
|
126
|
+
* It does not support avatars, secondary names (handles), or custom avatar sizes.
|
|
127
|
+
* Use InlineProfile directly if you need more flexibility.
|
|
124
128
|
*/
|
|
125
129
|
declare const ProfileToken: ({ className, onClick, tokenProps, ...props }: ProfileTokenProps) => react_jsx_runtime.JSX.Element;
|
|
126
130
|
|
package/dist/index.js
CHANGED
|
@@ -294,7 +294,7 @@ var InlineProfile = ({
|
|
|
294
294
|
const displayName = name || secondaryName || "Unknown Profile";
|
|
295
295
|
const avatarSize = avatarSizeOverride || avatarSizeMap[size];
|
|
296
296
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(InlineProfileContainer, { className, $size: size, children: [
|
|
297
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InlineProfileAvatar, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_seeds_react_avatar2.Avatar, { src: avatarUrl, name: displayName, size: avatarSize }) }),
|
|
297
|
+
avatarUrl && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InlineProfileAvatar, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_seeds_react_avatar2.Avatar, { src: avatarUrl, name: displayName, size: avatarSize }) }),
|
|
298
298
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(InlineProfileContent, { children: [
|
|
299
299
|
partnerName && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InlineProfileNetwork, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
300
300
|
import_seeds_react_partner_logo2.PartnerLogo,
|
|
@@ -327,6 +327,10 @@ var StyledProfileToken = (0, import_styled_components3.default)(import_seeds_rea
|
|
|
327
327
|
box-sizing: border-box;
|
|
328
328
|
display: inline-flex;
|
|
329
329
|
max-width: 100%;
|
|
330
|
+
vertical-align: middle;
|
|
331
|
+
padding: ${(props) => props.theme.space[100]}
|
|
332
|
+
${(props) => props.theme.space[200]};
|
|
333
|
+
margin: ${(props) => props.theme.space[100]} 0;
|
|
330
334
|
`;
|
|
331
335
|
var ProfileToken = ({
|
|
332
336
|
className,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/ProfileCard.tsx","../src/VerifiedProfileIcon.tsx","../src/InlineProfile.tsx","../src/ProfileToken.tsx"],"sourcesContent":["export * from \"./ProfileCard\";\nexport * from \"./InlineProfile\";\nexport * from \"./ProfileToken\";\nexport * from \"./types\";\n","import styled from \"styled-components\";\nimport { PartnerLogo } from \"@sproutsocial/seeds-react-partner-logo\";\nimport { Avatar } from \"@sproutsocial/seeds-react-avatar\";\nimport {\n Card,\n CardHeader,\n CardContent,\n CardFooter,\n} from \"@sproutsocial/seeds-react-card\";\nimport { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport { Link } from \"@sproutsocial/seeds-react-link\";\nimport { Text } from \"@sproutsocial/seeds-react-text\";\nimport type { TypeProfileCardProps } from \"./types\";\nimport { VerifiedProfileIcon } from \"./VerifiedProfileIcon\";\n\n// Styled Components\nconst StyledProfileCard = styled(Card)`\n max-width: 300px;\n`;\n\nconst StyledCardHeader = styled(CardHeader)<{\n $bannerColor?: string;\n $partnerName?: string;\n}>`\n position: relative;\n height: 80px;\n padding: ${(props) => props.theme.space[400]}\n ${(props) => props.theme.space[400]} 0 ${(props) => props.theme.space[400]};\n margin-bottom: 0;\n color: ${(props) => props.theme.colors.text.inverse};\n border-radius: ${(props) => props.theme.radii[500]}\n ${(props) => props.theme.radii[500]} 0 0;\n ${(props) => {\n // Use explicit bannerColor if provided\n if (props.$bannerColor) {\n return `background: ${props.$bannerColor};`;\n }\n // Fall back to theme.colors.network[partnerName] if partnerName is available\n if (props.$partnerName && props.theme.colors.network) {\n const networkColor =\n props.theme.colors.network[\n props.$partnerName as keyof typeof props.theme.colors.network\n ];\n return networkColor ? `background: ${networkColor};` : \"\";\n }\n return \"\";\n }}\n`;\n\nconst BannerContent = styled.div`\n display: flex;\n justify-content: flex-end;\n width: 100%;\n`;\n\nconst ActionsSection = styled.div`\n display: flex;\n justify-content: flex-end;\n gap: ${(props) => props.theme.space[100]};\n padding: 0 ${(props) => props.theme.space[300]};\n\n &:empty {\n min-height: 44px;\n }\n`;\n\nconst StyledCardContent = styled(CardContent)`\n display: flex;\n flex-direction: column;\n gap: ${(props) => props.theme.space[300]};\n padding: 0 ${(props) => props.theme.space[400]}\n ${(props) => props.theme.space[400]};\n`;\n\nconst ProfileNameSection = styled.div`\n display: flex;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n`;\n\nconst InfoRow = styled.div`\n display: flex;\n align-items: center;\n gap: ${(props) => props.theme.space[300]};\n`;\n\n/**\n * A flexible profile component that can display user profiles in various formats\n * across different social networks with consistent styling and behavior.\n */\nexport const ProfileCard = ({\n partnerName,\n name,\n secondaryName,\n avatarUrl,\n subtext,\n description,\n verificationType,\n profileUrl,\n location,\n bannerColor,\n bannerContent,\n metadata,\n profileActions,\n footer,\n cardProps,\n}: TypeProfileCardProps) => {\n return (\n <StyledProfileCard role=\"presentation\" {...cardProps}>\n <StyledCardHeader $bannerColor={bannerColor} $partnerName={partnerName}>\n <Avatar src={avatarUrl} name={name} size=\"60px\" mt={450} />\n {bannerContent && <BannerContent>{bannerContent}</BannerContent>}\n </StyledCardHeader>\n\n <ActionsSection>{profileActions}</ActionsSection>\n\n <StyledCardContent>\n <ProfileNameSection>\n {partnerName && (\n <PartnerLogo\n partnerName={partnerName}\n aria-label={`${partnerName} profile`}\n size=\"small\"\n />\n )}\n <Text.SubHeadline as=\"h2\">{name}</Text.SubHeadline>\n </ProfileNameSection>\n\n {subtext && (\n <Text fontSize={200} color=\"text.subtext\">\n {subtext}\n </Text>\n )}\n\n {secondaryName && (\n <InfoRow>\n {profileUrl ? (\n <Link href={profileUrl} external>\n <Text fontSize={200}>{secondaryName}</Text>\n <Icon\n name=\"arrow-right-up-outline\"\n aria-hidden\n ml={100}\n size=\"small\"\n />\n </Link>\n ) : (\n <Text.SmallByline color=\"text.subtext\">\n {secondaryName}\n </Text.SmallByline>\n )}\n {verificationType && (\n <VerifiedProfileIcon\n partnerName={partnerName}\n verificationType={verificationType}\n />\n )}\n </InfoRow>\n )}\n\n {description && <Text fontSize={200}>{description}</Text>}\n\n {location && (\n <InfoRow>\n <Icon name=\"location-pin-outline\" aria-hidden size=\"small\" />\n <Text fontSize={200}>{location}</Text>\n </InfoRow>\n )}\n\n {metadata && metadata.length > 0 && (\n <InfoRow>\n {metadata.map((info, index) => (\n <Text fontSize={200} key={index}>\n {info}\n </Text>\n ))}\n </InfoRow>\n )}\n </StyledCardContent>\n\n {footer && <CardFooter>{footer}</CardFooter>}\n </StyledProfileCard>\n );\n};\n\nexport default ProfileCard;\n","import { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport type { TypeProfileNetwork, TypeProfileVerification } from \"./types\";\n\n// TODO: Move these to a more appropriate location\nconst VERIFICATION_COLORS = {\n twitter: \"#000000\",\n facebook: \"#1877F2\",\n x: \"#000000\",\n linkedin: \"#0A66C2\",\n instagram: \"#e4405f\",\n gray: \"#515e5f\",\n} as const;\n\n/**\n * Gets the verification color based on partnerName and verification type\n */\nexport const getVerificationColor = (\n partnerName?: TypeProfileNetwork,\n verificationType?: TypeProfileVerification\n): string => {\n if (!verificationType || verificationType === \"not_verified\") return \"\";\n\n switch (verificationType) {\n case \"blue_verified\":\n // Use partner-specific blue color\n return partnerName === \"facebook\"\n ? VERIFICATION_COLORS.facebook\n : VERIFICATION_COLORS.twitter;\n case \"gray_verified\":\n return VERIFICATION_COLORS.gray;\n case \"verified\":\n default:\n // Default to partner color or Twitter blue\n if (partnerName && partnerName in VERIFICATION_COLORS) {\n return VERIFICATION_COLORS[\n partnerName as keyof typeof VERIFICATION_COLORS\n ];\n }\n return VERIFICATION_COLORS.twitter;\n }\n};\n\nexport interface TypeVerifiedProfileIconProps {\n partnerName?: TypeProfileNetwork;\n verificationType: TypeProfileVerification;\n}\n\nexport const VerifiedProfileIcon = ({\n partnerName,\n verificationType,\n}: TypeVerifiedProfileIconProps) => {\n if (!verificationType || verificationType === \"not_verified\") return;\n\n const verificationColor = getVerificationColor(partnerName, verificationType);\n return (\n <Icon\n title=\"Verified\"\n aria-label=\"Verified account\"\n color={verificationColor}\n name=\"verified\"\n ml=\"150\"\n />\n );\n};\n","import styled from \"styled-components\";\nimport { PartnerLogo } from \"@sproutsocial/seeds-react-partner-logo\";\nimport { Avatar } from \"@sproutsocial/seeds-react-avatar\";\nimport type { TypeInlineProfileProps } from \"./types\";\nimport { VerifiedProfileIcon } from \"./VerifiedProfileIcon\";\n\nconst InlineProfileContainer = styled.span<{\n $size?: \"small\" | \"medium\" | \"large\";\n}>`\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n max-width: 100%;\n ${(props) => props.theme.typography[200]}\n color: ${(props) => props.theme.colors.text.subtext};\n text-align: inherit;\n`;\n\nconst InlineProfileAvatar = styled.span`\n display: inline-flex;\n flex-shrink: 0;\n`;\n\nconst InlineProfileContent = styled.span`\n display: inline-flex;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n min-width: 0;\n flex: 1;\n`;\n\nconst InlineProfileNetwork = styled.span`\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n`;\n\nconst InlineProfileText = styled.span`\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n min-width: 0;\n flex: 1;\n`;\n\nconst InlineProfileName = styled.span`\n display: inline-block;\n ${(props) => props.theme.typography[200]}\n font-family: ${(props) => props.theme.fontFamily};\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n text-transform: lowercase;\n color: ${(props) => props.theme.colors.text.body};\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst InlineProfileHandle = styled.span`\n display: inline-block;\n ${(props) => props.theme.typography[200]}\n font-family: ${(props) => props.theme.fontFamily};\n color: ${(props) => props.theme.colors.text.subtext};\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst avatarSizeMap = {\n small: \"16px\",\n medium: \"20px\",\n large: \"24px\",\n} as const;\n\n/**\n * A compact inline profile component that displays avatar, name/handle, and verification.\n * Perfect for use in post headers, comments, or other compact spaces.\n *\n * @param props - Profile props\n * @param props.name - Name of the profile\n * @param props.secondaryName - Secondary name of the profile\n * @param props.partnerName - Partner logo name\n * @param props.partnerLogoLabel - Aria-label for the partner logo\n * @param props.avatarSize - Size of the avatar\n * @param props.avatarUrl - Image URL for the avatar\n * @param props.children - Additional elements to render within the profile component\n * @returns JSX.Element representing a user profile\n *\n * @example\n * <InlineProfile\n * name=\"John Doe\"\n * secondaryName=\"johndoe123\"\n * partnerName=\"facebook\"\n * partnerLogoLabel=\"Facebook Logo\"\n * avatarSize=\"24px\"\n * avatarUrl=\"https://example.com/avatar.jpg\"\n * >\n * <Badge text=\"Moderator\" badgeColor=\"green\" />\n * </InlineProfile>\n */\nexport const InlineProfile = ({\n name,\n secondaryName,\n partnerName,\n partnerLogoLabel,\n size = \"medium\",\n avatarSize: avatarSizeOverride,\n avatarUrl,\n verificationType,\n className,\n}: TypeInlineProfileProps) => {\n const displayName = name || secondaryName || \"Unknown Profile\";\n const avatarSize = avatarSizeOverride || avatarSizeMap[size];\n\n return (\n <InlineProfileContainer className={className} $size={size}>\n <InlineProfileAvatar>\n <Avatar src={avatarUrl} name={displayName} size={avatarSize} />\n </InlineProfileAvatar>\n\n <InlineProfileContent>\n {partnerName && (\n <InlineProfileNetwork>\n <PartnerLogo\n partnerName={partnerName}\n aria-label={partnerLogoLabel || `${partnerName} profile`}\n size=\"small\"\n />\n </InlineProfileNetwork>\n )}\n\n <InlineProfileText>\n {name && <InlineProfileName>{name}</InlineProfileName>}\n\n {secondaryName && (\n <InlineProfileHandle>{secondaryName}</InlineProfileHandle>\n )}\n </InlineProfileText>\n\n {verificationType && (\n <VerifiedProfileIcon\n partnerName={partnerName}\n verificationType={verificationType}\n />\n )}\n </InlineProfileContent>\n </InlineProfileContainer>\n );\n};\n","import styled from \"styled-components\";\nimport { Token } from \"@sproutsocial/seeds-react-token\";\nimport { InlineProfile } from \"./InlineProfile\";\nimport type { ProfileTokenProps } from \"./types\";\n\nconst StyledProfileToken = styled(Token)`\n box-sizing: border-box;\n display: inline-flex;\n max-width: 100%;\n`;\n\n/**\n * A ProfileToken component that wraps CompactProfile in a Seeds Token component.\n * This token is not closable and provides a compact way to display profile information inline.\n */\nexport const ProfileToken = ({\n className,\n onClick,\n tokenProps,\n ...props\n}: ProfileTokenProps) => (\n <StyledProfileToken\n className={className}\n closeable={false}\n onClick={onClick}\n {...tokenProps}\n >\n <InlineProfile size=\"small\" {...props} />\n </StyledProfileToken>\n);\n\nexport default ProfileToken;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,+BAAmB;AACnB,sCAA4B;AAC5B,gCAAuB;AACvB,8BAKO;AACP,IAAAA,2BAAqB;AACrB,8BAAqB;AACrB,8BAAqB;;;ACXrB,8BAAqB;AAuDjB;AAnDJ,IAAM,sBAAsB;AAAA,EAC1B,SAAS;AAAA,EACT,UAAU;AAAA,EACV,GAAG;AAAA,EACH,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AACR;AAKO,IAAM,uBAAuB,CAClC,aACA,qBACW;AACX,MAAI,CAAC,oBAAoB,qBAAqB,eAAgB,QAAO;AAErE,UAAQ,kBAAkB;AAAA,IACxB,KAAK;AAEH,aAAO,gBAAgB,aACnB,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sB,cAAc,IAAI;AAE3D,SACE,8CAAC,0BAAuB,WAAsB,OAAO,MACnD;AAAA,iDAAC,uBACC,uDAAC,qCAAO,KAAK,WAAW,MAAM,aAAa,MAAM,YAAY,GAC/D;AAAA,IAEA,8CAAC,wBACE;AAAA,qBACC,6CAAC,wBACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,cAAY,oBAAoB,GAAG,WAAW;AAAA,UAC9C,MAAK;AAAA;AAAA,MACP,GACF;AAAA,MAGF,8CAAC,qBACE;AAAA,gBAAQ,6CAAC,qBAAmB,gBAAK;AAAA,QAEjC,iBACC,6CAAC,uBAAqB,yBAAc;AAAA,SAExC;AAAA,MAEC,oBACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA;AAAA,MACF;AAAA,OAEJ;AAAA,KACF;AAEJ;;;ACvJA,IAAAC,4BAAmB;AACnB,+BAAsB;AA0BlB,IAAAC,sBAAA;AAtBJ,IAAM,yBAAqB,0BAAAC,SAAO,8BAAK;AAAA;AAAA;AAAA;AAAA;AAUhC,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACC,GAAG;AAAA,IAEJ,uDAAC,iBAAc,MAAK,SAAS,GAAG,OAAO;AAAA;AACzC;","names":["import_seeds_react_icon","import_jsx_runtime","styled","import_styled_components","import_seeds_react_partner_logo","import_seeds_react_avatar","import_jsx_runtime","styled","import_styled_components","import_jsx_runtime","styled"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/ProfileCard.tsx","../src/VerifiedProfileIcon.tsx","../src/InlineProfile.tsx","../src/ProfileToken.tsx"],"sourcesContent":["export * from \"./ProfileCard\";\nexport * from \"./InlineProfile\";\nexport * from \"./ProfileToken\";\nexport * from \"./types\";\n","import styled from \"styled-components\";\nimport { PartnerLogo } from \"@sproutsocial/seeds-react-partner-logo\";\nimport { Avatar } from \"@sproutsocial/seeds-react-avatar\";\nimport {\n Card,\n CardHeader,\n CardContent,\n CardFooter,\n} from \"@sproutsocial/seeds-react-card\";\nimport { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport { Link } from \"@sproutsocial/seeds-react-link\";\nimport { Text } from \"@sproutsocial/seeds-react-text\";\nimport type { TypeProfileCardProps } from \"./types\";\nimport { VerifiedProfileIcon } from \"./VerifiedProfileIcon\";\n\n// Styled Components\nconst StyledProfileCard = styled(Card)`\n max-width: 300px;\n`;\n\nconst StyledCardHeader = styled(CardHeader)<{\n $bannerColor?: string;\n $partnerName?: string;\n}>`\n position: relative;\n height: 80px;\n padding: ${(props) => props.theme.space[400]}\n ${(props) => props.theme.space[400]} 0 ${(props) => props.theme.space[400]};\n margin-bottom: 0;\n color: ${(props) => props.theme.colors.text.inverse};\n border-radius: ${(props) => props.theme.radii[500]}\n ${(props) => props.theme.radii[500]} 0 0;\n ${(props) => {\n // Use explicit bannerColor if provided\n if (props.$bannerColor) {\n return `background: ${props.$bannerColor};`;\n }\n // Fall back to theme.colors.network[partnerName] if partnerName is available\n if (props.$partnerName && props.theme.colors.network) {\n const networkColor =\n props.theme.colors.network[\n props.$partnerName as keyof typeof props.theme.colors.network\n ];\n return networkColor ? `background: ${networkColor};` : \"\";\n }\n return \"\";\n }}\n`;\n\nconst BannerContent = styled.div`\n display: flex;\n justify-content: flex-end;\n width: 100%;\n`;\n\nconst ActionsSection = styled.div`\n display: flex;\n justify-content: flex-end;\n gap: ${(props) => props.theme.space[100]};\n padding: 0 ${(props) => props.theme.space[300]};\n\n &:empty {\n min-height: 44px;\n }\n`;\n\nconst StyledCardContent = styled(CardContent)`\n display: flex;\n flex-direction: column;\n gap: ${(props) => props.theme.space[300]};\n padding: 0 ${(props) => props.theme.space[400]}\n ${(props) => props.theme.space[400]};\n`;\n\nconst ProfileNameSection = styled.div`\n display: flex;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n`;\n\nconst InfoRow = styled.div`\n display: flex;\n align-items: center;\n gap: ${(props) => props.theme.space[300]};\n`;\n\n/**\n * A flexible profile component that can display user profiles in various formats\n * across different social networks with consistent styling and behavior.\n */\nexport const ProfileCard = ({\n partnerName,\n name,\n secondaryName,\n avatarUrl,\n subtext,\n description,\n verificationType,\n profileUrl,\n location,\n bannerColor,\n bannerContent,\n metadata,\n profileActions,\n footer,\n cardProps,\n}: TypeProfileCardProps) => {\n return (\n <StyledProfileCard role=\"presentation\" {...cardProps}>\n <StyledCardHeader $bannerColor={bannerColor} $partnerName={partnerName}>\n <Avatar src={avatarUrl} name={name} size=\"60px\" mt={450} />\n {bannerContent && <BannerContent>{bannerContent}</BannerContent>}\n </StyledCardHeader>\n\n <ActionsSection>{profileActions}</ActionsSection>\n\n <StyledCardContent>\n <ProfileNameSection>\n {partnerName && (\n <PartnerLogo\n partnerName={partnerName}\n aria-label={`${partnerName} profile`}\n size=\"small\"\n />\n )}\n <Text.SubHeadline as=\"h2\">{name}</Text.SubHeadline>\n </ProfileNameSection>\n\n {subtext && (\n <Text fontSize={200} color=\"text.subtext\">\n {subtext}\n </Text>\n )}\n\n {secondaryName && (\n <InfoRow>\n {profileUrl ? (\n <Link href={profileUrl} external>\n <Text fontSize={200}>{secondaryName}</Text>\n <Icon\n name=\"arrow-right-up-outline\"\n aria-hidden\n ml={100}\n size=\"small\"\n />\n </Link>\n ) : (\n <Text.SmallByline color=\"text.subtext\">\n {secondaryName}\n </Text.SmallByline>\n )}\n {verificationType && (\n <VerifiedProfileIcon\n partnerName={partnerName}\n verificationType={verificationType}\n />\n )}\n </InfoRow>\n )}\n\n {description && <Text fontSize={200}>{description}</Text>}\n\n {location && (\n <InfoRow>\n <Icon name=\"location-pin-outline\" aria-hidden size=\"small\" />\n <Text fontSize={200}>{location}</Text>\n </InfoRow>\n )}\n\n {metadata && metadata.length > 0 && (\n <InfoRow>\n {metadata.map((info, index) => (\n <Text fontSize={200} key={index}>\n {info}\n </Text>\n ))}\n </InfoRow>\n )}\n </StyledCardContent>\n\n {footer && <CardFooter>{footer}</CardFooter>}\n </StyledProfileCard>\n );\n};\n\nexport default ProfileCard;\n","import { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport type { TypeProfileNetwork, TypeProfileVerification } from \"./types\";\n\n// TODO: Move these to a more appropriate location\nconst VERIFICATION_COLORS = {\n twitter: \"#000000\",\n facebook: \"#1877F2\",\n x: \"#000000\",\n linkedin: \"#0A66C2\",\n instagram: \"#e4405f\",\n gray: \"#515e5f\",\n} as const;\n\n/**\n * Gets the verification color based on partnerName and verification type\n */\nexport const getVerificationColor = (\n partnerName?: TypeProfileNetwork,\n verificationType?: TypeProfileVerification\n): string => {\n if (!verificationType || verificationType === \"not_verified\") return \"\";\n\n switch (verificationType) {\n case \"blue_verified\":\n // Use partner-specific blue color\n return partnerName === \"facebook\"\n ? VERIFICATION_COLORS.facebook\n : VERIFICATION_COLORS.twitter;\n case \"gray_verified\":\n return VERIFICATION_COLORS.gray;\n case \"verified\":\n default:\n // Default to partner color or Twitter blue\n if (partnerName && partnerName in VERIFICATION_COLORS) {\n return VERIFICATION_COLORS[\n partnerName as keyof typeof VERIFICATION_COLORS\n ];\n }\n return VERIFICATION_COLORS.twitter;\n }\n};\n\nexport interface TypeVerifiedProfileIconProps {\n partnerName?: TypeProfileNetwork;\n verificationType: TypeProfileVerification;\n}\n\nexport const VerifiedProfileIcon = ({\n partnerName,\n verificationType,\n}: TypeVerifiedProfileIconProps) => {\n if (!verificationType || verificationType === \"not_verified\") return;\n\n const verificationColor = getVerificationColor(partnerName, verificationType);\n return (\n <Icon\n title=\"Verified\"\n aria-label=\"Verified account\"\n color={verificationColor}\n name=\"verified\"\n ml=\"150\"\n />\n );\n};\n","import styled from \"styled-components\";\nimport { PartnerLogo } from \"@sproutsocial/seeds-react-partner-logo\";\nimport { Avatar } from \"@sproutsocial/seeds-react-avatar\";\nimport type { TypeInlineProfileProps } from \"./types\";\nimport { VerifiedProfileIcon } from \"./VerifiedProfileIcon\";\n\nconst InlineProfileContainer = styled.span<{\n $size?: \"small\" | \"medium\" | \"large\";\n}>`\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n max-width: 100%;\n ${(props) => props.theme.typography[200]}\n color: ${(props) => props.theme.colors.text.subtext};\n text-align: inherit;\n`;\n\nconst InlineProfileAvatar = styled.span`\n display: inline-flex;\n flex-shrink: 0;\n`;\n\nconst InlineProfileContent = styled.span`\n display: inline-flex;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n min-width: 0;\n flex: 1;\n`;\n\nconst InlineProfileNetwork = styled.span`\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n`;\n\nconst InlineProfileText = styled.span`\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n gap: ${(props) => props.theme.space[200]};\n min-width: 0;\n flex: 1;\n`;\n\nconst InlineProfileName = styled.span`\n display: inline-block;\n ${(props) => props.theme.typography[200]}\n font-family: ${(props) => props.theme.fontFamily};\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n text-transform: lowercase;\n color: ${(props) => props.theme.colors.text.body};\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst InlineProfileHandle = styled.span`\n display: inline-block;\n ${(props) => props.theme.typography[200]}\n font-family: ${(props) => props.theme.fontFamily};\n color: ${(props) => props.theme.colors.text.subtext};\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst avatarSizeMap = {\n small: \"16px\",\n medium: \"20px\",\n large: \"24px\",\n} as const;\n\n/**\n * A compact inline profile component that displays avatar, name/handle, and verification.\n * Perfect for use in post headers, comments, or other compact spaces.\n *\n * @param props - Profile props\n * @param props.name - Name of the profile\n * @param props.secondaryName - Secondary name of the profile\n * @param props.partnerName - Partner logo name\n * @param props.partnerLogoLabel - Aria-label for the partner logo\n * @param props.avatarSize - Size of the avatar\n * @param props.avatarUrl - Image URL for the avatar\n * @param props.children - Additional elements to render within the profile component\n * @returns JSX.Element representing a user profile\n *\n * @example\n * <InlineProfile\n * name=\"John Doe\"\n * secondaryName=\"johndoe123\"\n * partnerName=\"facebook\"\n * partnerLogoLabel=\"Facebook Logo\"\n * avatarSize=\"24px\"\n * avatarUrl=\"https://example.com/avatar.jpg\"\n * >\n * <Badge text=\"Moderator\" badgeColor=\"green\" />\n * </InlineProfile>\n */\nexport const InlineProfile = ({\n name,\n secondaryName,\n partnerName,\n partnerLogoLabel,\n size = \"medium\",\n avatarSize: avatarSizeOverride,\n avatarUrl,\n verificationType,\n className,\n}: TypeInlineProfileProps) => {\n const displayName = name || secondaryName || \"Unknown Profile\";\n const avatarSize = avatarSizeOverride || avatarSizeMap[size];\n\n return (\n <InlineProfileContainer className={className} $size={size}>\n {avatarUrl && (\n <InlineProfileAvatar>\n <Avatar src={avatarUrl} name={displayName} size={avatarSize} />\n </InlineProfileAvatar>\n )}\n\n <InlineProfileContent>\n {partnerName && (\n <InlineProfileNetwork>\n <PartnerLogo\n partnerName={partnerName}\n aria-label={partnerLogoLabel || `${partnerName} profile`}\n size=\"small\"\n />\n </InlineProfileNetwork>\n )}\n\n <InlineProfileText>\n {name && <InlineProfileName>{name}</InlineProfileName>}\n\n {secondaryName && (\n <InlineProfileHandle>{secondaryName}</InlineProfileHandle>\n )}\n </InlineProfileText>\n\n {verificationType && (\n <VerifiedProfileIcon\n partnerName={partnerName}\n verificationType={verificationType}\n />\n )}\n </InlineProfileContent>\n </InlineProfileContainer>\n );\n};\n","import styled from \"styled-components\";\nimport { Token } from \"@sproutsocial/seeds-react-token\";\nimport { InlineProfile } from \"./InlineProfile\";\nimport type { ProfileTokenProps } from \"./types\";\n\nconst StyledProfileToken = styled(Token)`\n box-sizing: border-box;\n display: inline-flex;\n max-width: 100%;\n vertical-align: middle;\n padding: ${(props) => props.theme.space[100]}\n ${(props) => props.theme.space[200]};\n margin: ${(props) => props.theme.space[100]} 0;\n`;\n\n/**\n * A ProfileToken component that wraps InlineProfile in a Seeds Token component.\n * This token is not closable and provides a compact way to display profile information inline.\n *\n * ProfileToken enforces design standards by only showing the profile name and network logo.\n * It does not support avatars, secondary names (handles), or custom avatar sizes.\n * Use InlineProfile directly if you need more flexibility.\n */\nexport const ProfileToken = ({\n className,\n onClick,\n tokenProps,\n ...props\n}: ProfileTokenProps) => (\n <StyledProfileToken\n className={className}\n closeable={false}\n onClick={onClick}\n {...tokenProps}\n >\n <InlineProfile size=\"small\" {...props} />\n </StyledProfileToken>\n);\n\nexport default ProfileToken;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,+BAAmB;AACnB,sCAA4B;AAC5B,gCAAuB;AACvB,8BAKO;AACP,IAAAA,2BAAqB;AACrB,8BAAqB;AACrB,8BAAqB;;;ACXrB,8BAAqB;AAuDjB;AAnDJ,IAAM,sBAAsB;AAAA,EAC1B,SAAS;AAAA,EACT,UAAU;AAAA,EACV,GAAG;AAAA,EACH,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AACR;AAKO,IAAM,uBAAuB,CAClC,aACA,qBACW;AACX,MAAI,CAAC,oBAAoB,qBAAqB,eAAgB,QAAO;AAErE,UAAQ,kBAAkB;AAAA,IACxB,KAAK;AAEH,aAAO,gBAAgB,aACnB,oBAAoB,WACpB,oBAAoB;AAAA,IAC1B,KAAK;AACH,aAAO,oBAAoB;AAAA,IAC7B,KAAK;AAAA,IACL;AAEE,UAAI,eAAe,eAAe,qBAAqB;AACrD,eAAO,oBACL,WACF;AAAA,MACF;AACA,aAAO,oBAAoB;AAAA,EAC/B;AACF;AAOO,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AACF,MAAoC;AAClC,MAAI,CAAC,oBAAoB,qBAAqB,eAAgB;AAE9D,QAAM,oBAAoB,qBAAqB,aAAa,gBAAgB;AAC5E,SACE;AAAA,IAAC;AAAA;AA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jC,iBACC,6CAAC,uBAAqB,yBAAc;AAAA,SAExC;AAAA,MAEC,oBACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA;AAAA,MACF;AAAA,OAEJ;AAAA,KACF;AAEJ;;;ACzJA,IAAAC,4BAAmB;AACnB,+BAAsB;AAkClB,IAAAC,sBAAA;AA9BJ,IAAM,yBAAqB,0BAAAC,SAAO,8BAAK;AAAA;AAAA;AAAA;AAAA;AAAA,aAK1B,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA,MACxC,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA,YAC3B,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA;AAWtC,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACC,GAAG;AAAA,IAEJ,uDAAC,iBAAc,MAAK,SAAS,GAAG,OAAO;AAAA;AACzC;","names":["import_seeds_react_icon","import_jsx_runtime","styled","import_styled_components","import_seeds_react_partner_logo","import_seeds_react_avatar","import_jsx_runtime","styled","import_styled_components","import_jsx_runtime","styled"]}
|
package/package.json
CHANGED
|
@@ -152,3 +152,36 @@ export const LongNamesTruncation: Story = {
|
|
|
152
152
|
</div>
|
|
153
153
|
),
|
|
154
154
|
};
|
|
155
|
+
|
|
156
|
+
export const WithoutAvatarUrl: Story = {
|
|
157
|
+
args: {
|
|
158
|
+
name: "John Doe",
|
|
159
|
+
secondaryName: "@johndoe",
|
|
160
|
+
partnerName: "twitter",
|
|
161
|
+
// No avatarUrl provided
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export const CompareAvatarUrlPresence: Story = {
|
|
166
|
+
render: () => (
|
|
167
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "16px" }}>
|
|
168
|
+
<div style={{ padding: "8px", border: "1px solid #ccc" }}>
|
|
169
|
+
<h4 style={{ margin: "0 0 8px 0" }}>Without Avatar URL</h4>
|
|
170
|
+
<InlineProfile
|
|
171
|
+
name="John Doe"
|
|
172
|
+
secondaryName="@johndoe"
|
|
173
|
+
partnerName="twitter"
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
<div style={{ padding: "8px", border: "1px solid #ccc" }}>
|
|
177
|
+
<h4 style={{ margin: "0 0 8px 0" }}>With Avatar URL</h4>
|
|
178
|
+
<InlineProfile
|
|
179
|
+
name="John Doe"
|
|
180
|
+
secondaryName="@johndoe"
|
|
181
|
+
partnerName="twitter"
|
|
182
|
+
avatarUrl={avatarUrl}
|
|
183
|
+
/>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
),
|
|
187
|
+
};
|
package/src/InlineProfile.tsx
CHANGED
|
@@ -117,9 +117,11 @@ export const InlineProfile = ({
|
|
|
117
117
|
|
|
118
118
|
return (
|
|
119
119
|
<InlineProfileContainer className={className} $size={size}>
|
|
120
|
-
|
|
121
|
-
<
|
|
122
|
-
|
|
120
|
+
{avatarUrl && (
|
|
121
|
+
<InlineProfileAvatar>
|
|
122
|
+
<Avatar src={avatarUrl} name={displayName} size={avatarSize} />
|
|
123
|
+
</InlineProfileAvatar>
|
|
124
|
+
)}
|
|
123
125
|
|
|
124
126
|
<InlineProfileContent>
|
|
125
127
|
{partnerName && (
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import { ProfileToken } from "./ProfileToken";
|
|
3
3
|
|
|
4
|
-
const avatarUrl =
|
|
5
|
-
"https://d672eyudr6aq1.cloudfront.net/avatar/cede1373e17c05542b1cc60f427067f2?s=30&d=404";
|
|
6
|
-
|
|
7
4
|
const meta: Meta<typeof ProfileToken> = {
|
|
8
5
|
title: "Components/Profile/ProfileToken",
|
|
9
6
|
component: ProfileToken,
|
|
@@ -38,8 +35,6 @@ type Story = StoryObj<typeof meta>;
|
|
|
38
35
|
export const Default: Story = {
|
|
39
36
|
args: {
|
|
40
37
|
name: "John Doe",
|
|
41
|
-
secondaryName: "@johndoe",
|
|
42
|
-
avatarUrl: avatarUrl,
|
|
43
38
|
partnerName: "twitter",
|
|
44
39
|
},
|
|
45
40
|
};
|
|
@@ -47,8 +42,6 @@ export const Default: Story = {
|
|
|
47
42
|
export const WithVerification: Story = {
|
|
48
43
|
args: {
|
|
49
44
|
name: "Elon Musk",
|
|
50
|
-
secondaryName: "@elonmusk",
|
|
51
|
-
avatarUrl: avatarUrl,
|
|
52
45
|
partnerName: "twitter",
|
|
53
46
|
verificationType: "verified",
|
|
54
47
|
},
|
|
@@ -57,8 +50,6 @@ export const WithVerification: Story = {
|
|
|
57
50
|
export const FacebookUser: Story = {
|
|
58
51
|
args: {
|
|
59
52
|
name: "Facebook User",
|
|
60
|
-
secondaryName: "/facebookuser",
|
|
61
|
-
avatarUrl: avatarUrl,
|
|
62
53
|
partnerName: "facebook",
|
|
63
54
|
},
|
|
64
55
|
};
|
|
@@ -66,8 +57,6 @@ export const FacebookUser: Story = {
|
|
|
66
57
|
export const InstagramUser: Story = {
|
|
67
58
|
args: {
|
|
68
59
|
name: "Instagram User",
|
|
69
|
-
secondaryName: "@instagramuser",
|
|
70
|
-
avatarUrl: avatarUrl,
|
|
71
60
|
partnerName: "instagram",
|
|
72
61
|
},
|
|
73
62
|
};
|
|
@@ -75,8 +64,6 @@ export const InstagramUser: Story = {
|
|
|
75
64
|
export const LinkedInUser: Story = {
|
|
76
65
|
args: {
|
|
77
66
|
name: "LinkedIn User",
|
|
78
|
-
secondaryName: "linkedinuser",
|
|
79
|
-
avatarUrl: avatarUrl,
|
|
80
67
|
partnerName: "linkedin",
|
|
81
68
|
},
|
|
82
69
|
};
|
|
@@ -84,8 +71,6 @@ export const LinkedInUser: Story = {
|
|
|
84
71
|
export const YouTubeUser: Story = {
|
|
85
72
|
args: {
|
|
86
73
|
name: "YouTube Creator",
|
|
87
|
-
secondaryName: "@youtubecreator",
|
|
88
|
-
avatarUrl: avatarUrl,
|
|
89
74
|
partnerName: "youtube",
|
|
90
75
|
},
|
|
91
76
|
};
|
|
@@ -93,8 +78,6 @@ export const YouTubeUser: Story = {
|
|
|
93
78
|
export const TikTokUser: Story = {
|
|
94
79
|
args: {
|
|
95
80
|
name: "TikTok Creator",
|
|
96
|
-
secondaryName: "@tiktokcreator",
|
|
97
|
-
avatarUrl: avatarUrl,
|
|
98
81
|
partnerName: "tiktok",
|
|
99
82
|
},
|
|
100
83
|
};
|
|
@@ -102,8 +85,6 @@ export const TikTokUser: Story = {
|
|
|
102
85
|
export const ThreadsUser: Story = {
|
|
103
86
|
args: {
|
|
104
87
|
name: "Threads User",
|
|
105
|
-
secondaryName: "@threadsuser",
|
|
106
|
-
avatarUrl: avatarUrl,
|
|
107
88
|
partnerName: "threads",
|
|
108
89
|
},
|
|
109
90
|
};
|
|
@@ -111,26 +92,14 @@ export const ThreadsUser: Story = {
|
|
|
111
92
|
export const BlueskyUser: Story = {
|
|
112
93
|
args: {
|
|
113
94
|
name: "Bluesky User",
|
|
114
|
-
secondaryName: "@blueskyuser",
|
|
115
|
-
avatarUrl: avatarUrl,
|
|
116
95
|
partnerName: "bluesky",
|
|
117
96
|
},
|
|
118
97
|
};
|
|
119
98
|
|
|
120
|
-
export const WithoutAvatar: Story = {
|
|
121
|
-
args: {
|
|
122
|
-
name: "No Avatar User",
|
|
123
|
-
secondaryName: "@noavat,ar",
|
|
124
|
-
partnerName: "twitter",
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
|
|
128
99
|
export const BlueVerifiedUser: Story = {
|
|
129
100
|
args: {
|
|
130
101
|
name: "Blue Verified User",
|
|
131
|
-
secondaryName: "@blueverified",
|
|
132
102
|
partnerName: "twitter",
|
|
133
|
-
avatarUrl: "https://via.placeholder.com/40",
|
|
134
103
|
verificationType: "blue_verified",
|
|
135
104
|
},
|
|
136
105
|
};
|
|
@@ -138,42 +107,12 @@ export const BlueVerifiedUser: Story = {
|
|
|
138
107
|
export const DifferentNetworks: Story = {
|
|
139
108
|
render: () => (
|
|
140
109
|
<div style={{ display: "flex", flexDirection: "column", gap: "16px" }}>
|
|
141
|
-
<ProfileToken
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
/>
|
|
147
|
-
<ProfileToken
|
|
148
|
-
name="Facebook User"
|
|
149
|
-
secondaryName="/facebookuser"
|
|
150
|
-
avatarUrl={avatarUrl}
|
|
151
|
-
partnerName="facebook"
|
|
152
|
-
/>
|
|
153
|
-
<ProfileToken
|
|
154
|
-
name="Instagram User"
|
|
155
|
-
secondaryName="@instagramuser"
|
|
156
|
-
avatarUrl={avatarUrl}
|
|
157
|
-
partnerName="instagram"
|
|
158
|
-
/>
|
|
159
|
-
<ProfileToken
|
|
160
|
-
name="LinkedIn User"
|
|
161
|
-
secondaryName="linkedinuser"
|
|
162
|
-
avatarUrl={avatarUrl}
|
|
163
|
-
partnerName="linkedin"
|
|
164
|
-
/>
|
|
165
|
-
<ProfileToken
|
|
166
|
-
name="YouTube Creator"
|
|
167
|
-
secondaryName="@youtubecreator"
|
|
168
|
-
avatarUrl={avatarUrl}
|
|
169
|
-
partnerName="youtube"
|
|
170
|
-
/>
|
|
171
|
-
<ProfileToken
|
|
172
|
-
name="TikTok Creator"
|
|
173
|
-
secondaryName="@tiktokcreator"
|
|
174
|
-
avatarUrl={avatarUrl}
|
|
175
|
-
partnerName="tiktok"
|
|
176
|
-
/>
|
|
110
|
+
<ProfileToken name="Twitter User" partnerName="twitter" />
|
|
111
|
+
<ProfileToken name="Facebook User" partnerName="facebook" />
|
|
112
|
+
<ProfileToken name="Instagram User" partnerName="instagram" />
|
|
113
|
+
<ProfileToken name="LinkedIn User" partnerName="linkedin" />
|
|
114
|
+
<ProfileToken name="YouTube Creator" partnerName="youtube" />
|
|
115
|
+
<ProfileToken name="TikTok Creator" partnerName="tiktok" />
|
|
177
116
|
</div>
|
|
178
117
|
),
|
|
179
118
|
};
|
|
@@ -183,41 +122,14 @@ export const TokenVariations: Story = {
|
|
|
183
122
|
<div style={{ display: "flex", flexWrap: "wrap", gap: "8px" }}>
|
|
184
123
|
<ProfileToken
|
|
185
124
|
name="Verified User"
|
|
186
|
-
secondaryName="@verified"
|
|
187
|
-
avatarUrl={avatarUrl}
|
|
188
125
|
partnerName="twitter"
|
|
189
126
|
verificationType="verified"
|
|
190
127
|
/>
|
|
191
|
-
<ProfileToken
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
/>
|
|
197
|
-
<ProfileToken
|
|
198
|
-
name="Facebook User"
|
|
199
|
-
secondaryName="/facebookuser"
|
|
200
|
-
avatarUrl={avatarUrl}
|
|
201
|
-
partnerName="facebook"
|
|
202
|
-
/>
|
|
203
|
-
<ProfileToken
|
|
204
|
-
name="Instagram User"
|
|
205
|
-
secondaryName="@instagramuser"
|
|
206
|
-
avatarUrl={avatarUrl}
|
|
207
|
-
partnerName="instagram"
|
|
208
|
-
/>
|
|
209
|
-
<ProfileToken
|
|
210
|
-
name="LinkedIn User"
|
|
211
|
-
secondaryName="linkedinuser"
|
|
212
|
-
avatarUrl={avatarUrl}
|
|
213
|
-
partnerName="linkedin"
|
|
214
|
-
/>
|
|
215
|
-
<ProfileToken
|
|
216
|
-
name="YouTube Creator"
|
|
217
|
-
secondaryName="@youtubecreator"
|
|
218
|
-
avatarUrl={avatarUrl}
|
|
219
|
-
partnerName="youtube"
|
|
220
|
-
/>
|
|
128
|
+
<ProfileToken name="Regular User" partnerName="twitter" />
|
|
129
|
+
<ProfileToken name="Facebook User" partnerName="facebook" />
|
|
130
|
+
<ProfileToken name="Instagram User" partnerName="instagram" />
|
|
131
|
+
<ProfileToken name="LinkedIn User" partnerName="linkedin" />
|
|
132
|
+
<ProfileToken name="YouTube Creator" partnerName="youtube" />
|
|
221
133
|
</div>
|
|
222
134
|
),
|
|
223
135
|
};
|
|
@@ -230,30 +142,18 @@ export const LongNamesTruncation: Story = {
|
|
|
230
142
|
>
|
|
231
143
|
<ProfileToken
|
|
232
144
|
name="A Very Long User Name That Should Truncate"
|
|
233
|
-
secondaryName="@verylonghandlethatshouldalsotruncate"
|
|
234
|
-
avatarUrl={avatarUrl}
|
|
235
145
|
partnerName="twitter"
|
|
236
146
|
/>
|
|
237
147
|
</div>
|
|
238
148
|
<div
|
|
239
149
|
style={{ maxWidth: "180px", border: "1px solid #ccc", padding: "8px" }}
|
|
240
150
|
>
|
|
241
|
-
<ProfileToken
|
|
242
|
-
name="Another Long Name Token"
|
|
243
|
-
secondaryName="@anotherlonghandle"
|
|
244
|
-
avatarUrl={avatarUrl}
|
|
245
|
-
partnerName="facebook"
|
|
246
|
-
/>
|
|
151
|
+
<ProfileToken name="Another Long Name Token" partnerName="facebook" />
|
|
247
152
|
</div>
|
|
248
153
|
<div
|
|
249
154
|
style={{ maxWidth: "120px", border: "1px solid #ccc", padding: "8px" }}
|
|
250
155
|
>
|
|
251
|
-
<ProfileToken
|
|
252
|
-
name="Very Narrow Token"
|
|
253
|
-
secondaryName="@narrow"
|
|
254
|
-
avatarUrl={avatarUrl}
|
|
255
|
-
partnerName="instagram"
|
|
256
|
-
/>
|
|
156
|
+
<ProfileToken name="Very Narrow Token" partnerName="instagram" />
|
|
257
157
|
</div>
|
|
258
158
|
</div>
|
|
259
159
|
),
|
package/src/ProfileToken.tsx
CHANGED
|
@@ -7,11 +7,19 @@ const StyledProfileToken = styled(Token)`
|
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
display: inline-flex;
|
|
9
9
|
max-width: 100%;
|
|
10
|
+
vertical-align: middle;
|
|
11
|
+
padding: ${(props) => props.theme.space[100]}
|
|
12
|
+
${(props) => props.theme.space[200]};
|
|
13
|
+
margin: ${(props) => props.theme.space[100]} 0;
|
|
10
14
|
`;
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
|
-
* A ProfileToken component that wraps
|
|
17
|
+
* A ProfileToken component that wraps InlineProfile in a Seeds Token component.
|
|
14
18
|
* This token is not closable and provides a compact way to display profile information inline.
|
|
19
|
+
*
|
|
20
|
+
* ProfileToken enforces design standards by only showing the profile name and network logo.
|
|
21
|
+
* It does not support avatars, secondary names (handles), or custom avatar sizes.
|
|
22
|
+
* Use InlineProfile directly if you need more flexibility.
|
|
15
23
|
*/
|
|
16
24
|
export const ProfileToken = ({
|
|
17
25
|
className,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { render, screen } from "@sproutsocial/seeds-react-testing-library";
|
|
3
2
|
import { InlineProfile } from "../InlineProfile";
|
|
4
3
|
|
|
@@ -59,11 +58,13 @@ describe("InlineProfile", () => {
|
|
|
59
58
|
expect(screen.queryByText(/@/)).not.toBeInTheDocument();
|
|
60
59
|
});
|
|
61
60
|
|
|
62
|
-
it("
|
|
61
|
+
it("hides avatar when avatarUrl prop is not provided", () => {
|
|
63
62
|
render(<InlineProfile name="John Doe" />);
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
expect(
|
|
64
|
+
// Avatar should not be rendered when no URL provided
|
|
65
|
+
expect(screen.queryByText("JD")).not.toBeInTheDocument();
|
|
66
|
+
// But name should still be visible
|
|
67
|
+
expect(screen.getByText("John Doe")).toBeInTheDocument();
|
|
67
68
|
});
|
|
68
69
|
|
|
69
70
|
it("renders with verification badge when verified", () => {
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { render, screen } from "@sproutsocial/seeds-react-testing-library";
|
|
3
2
|
import { ProfileToken } from "../ProfileToken";
|
|
4
3
|
|
|
5
4
|
describe("ProfileToken", () => {
|
|
6
|
-
const mockProfileData = {
|
|
7
|
-
name: "John Doe",
|
|
8
|
-
secondaryName: "@johndoe",
|
|
9
|
-
partnerName: "twitter" as const,
|
|
10
|
-
avatarUrl: "https://example.com/avatar.jpg",
|
|
11
|
-
verificationType: "verified" as const,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
5
|
it("renders profile information in token format", () => {
|
|
15
|
-
render(<ProfileToken
|
|
6
|
+
render(<ProfileToken name="John Doe" partnerName="twitter" />);
|
|
16
7
|
|
|
17
8
|
expect(screen.getByText("John Doe")).toBeInTheDocument();
|
|
18
|
-
expect(screen.getByText("@johndoe")).toBeInTheDocument();
|
|
19
9
|
});
|
|
20
10
|
|
|
21
11
|
it("applies custom className", () => {
|
|
22
12
|
const { container } = render(
|
|
23
|
-
<ProfileToken
|
|
13
|
+
<ProfileToken
|
|
14
|
+
name="John Doe"
|
|
15
|
+
partnerName="twitter"
|
|
16
|
+
className="custom-token"
|
|
17
|
+
/>
|
|
24
18
|
);
|
|
25
19
|
|
|
26
20
|
// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access
|
|
@@ -28,7 +22,9 @@ describe("ProfileToken", () => {
|
|
|
28
22
|
});
|
|
29
23
|
|
|
30
24
|
it("renders without close button", () => {
|
|
31
|
-
const { container } = render(
|
|
25
|
+
const { container } = render(
|
|
26
|
+
<ProfileToken name="John Doe" partnerName="twitter" />
|
|
27
|
+
);
|
|
32
28
|
|
|
33
29
|
// Check that no close button elements are present
|
|
34
30
|
// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access
|
|
@@ -46,7 +42,11 @@ describe("ProfileToken", () => {
|
|
|
46
42
|
|
|
47
43
|
it("passes tokenProps to Token component", () => {
|
|
48
44
|
const { container } = render(
|
|
49
|
-
<ProfileToken
|
|
45
|
+
<ProfileToken
|
|
46
|
+
name="John Doe"
|
|
47
|
+
partnerName="twitter"
|
|
48
|
+
tokenProps={{ id: "custom-token" }}
|
|
49
|
+
/>
|
|
50
50
|
);
|
|
51
51
|
|
|
52
52
|
// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access
|
package/src/types.ts
CHANGED
|
@@ -75,7 +75,11 @@ export interface TypeInlineProfileProps
|
|
|
75
75
|
avatarSize?: string;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
export interface ProfileTokenProps
|
|
78
|
+
export interface ProfileTokenProps
|
|
79
|
+
extends Omit<
|
|
80
|
+
TypeInlineProfileProps,
|
|
81
|
+
"avatarUrl" | "secondaryName" | "avatarSize"
|
|
82
|
+
> {
|
|
79
83
|
/** Click handler for the entire inline profile */
|
|
80
84
|
onClick?: TypeTokenProps["onClick"];
|
|
81
85
|
/** Additional props to pass to the Token component */
|