@sproutsocial/seeds-react-partner-logo 1.7.15 → 1.7.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  // src/PartnerLogo.tsx
2
- import "react";
3
- import { useTheme } from "styled-components";
2
+ import React4 from "react";
3
+
4
+ // src/PartnerLogoHybrid.tsx
5
+ import React3 from "react";
4
6
 
5
7
  // src/styles.ts
6
8
  import styled, { css } from "styled-components";
@@ -41,9 +43,12 @@ var Container = styled("span")`
41
43
  `;
42
44
  var styles_default = Container;
43
45
 
44
- // src/PartnerLogo.tsx
46
+ // src/PartnerLogoTailwind.tsx
47
+ import React2 from "react";
48
+
49
+ // src/usePartnerLogoModel.ts
50
+ import { useTheme } from "styled-components";
45
51
  import { ViewBoxes } from "@sproutsocial/seeds-partner-logos";
46
- import { jsx } from "react/jsx-runtime";
47
52
  var whichLogo = ({
48
53
  backgroundType,
49
54
  logoType,
@@ -60,58 +65,195 @@ var whichLogo = ({
60
65
  return logo;
61
66
  }
62
67
  };
63
- var PartnerLogo = ({
68
+ var usePartnerLogoModel = ({
64
69
  partnerName,
65
70
  backgroundType,
66
71
  logoType = "symbol",
67
72
  height,
68
73
  width,
69
74
  size,
70
- "aria-label": ariaLabel,
71
- svgProps,
72
- ...rest
75
+ "aria-label": ariaLabel
73
76
  }) => {
74
77
  const { mode } = useTheme();
75
78
  const logo = whichLogo({ backgroundType, logoType, partnerName }, mode);
76
79
  const logoViewBox = ViewBoxes[logo];
77
80
  const viewBoxCoordinates = logoViewBox?.split(" ") || [];
78
81
  const defaultSize = logoType === "symbol" ? "small" : void 0;
79
- const defaultWidth = viewBoxCoordinates[2];
80
- const defaultHeight = viewBoxCoordinates[3];
82
+ const logoSizeKey = size ?? defaultSize;
83
+ const logoSizePx = logoSizeKey ? PartnerLogoSizes[logoSizeKey] : void 0;
84
+ const resolvedHeight = height ? height : viewBoxCoordinates[3] + "px";
85
+ const resolvedWidth = width ? width : viewBoxCoordinates[2] + "px";
86
+ const sizeValue = logoSizePx ? logoSizePx : resolvedHeight;
87
+ const svgWidth = logoSizePx ? logoSizePx : "";
81
88
  const hasAriaLabel = !!ariaLabel;
82
- const containerAriaProps = hasAriaLabel ? {} : { "aria-hidden": "true" };
89
+ const containerAriaProps = hasAriaLabel ? {} : { "aria-hidden": true };
83
90
  const svgAriaProps = hasAriaLabel ? { role: "img", "aria-label": ariaLabel } : {};
84
- return /* @__PURE__ */ jsx(
85
- styles_default,
86
- {
87
- height: height ? height : defaultHeight + "px",
88
- width: width ? width : defaultWidth + "px",
89
- logoSize: size ?? defaultSize,
90
- className: "logo",
91
- "data-qa-logo": partnerName,
92
- ...rest,
93
- ...containerAriaProps,
94
- children: /* @__PURE__ */ jsx(
95
- "svg",
96
- {
97
- className: "logo-svg",
98
- viewBox: logoViewBox,
99
- focusable: false,
100
- "data-qa-logo-svg": `${partnerName}-svg`,
101
- ...svgProps,
102
- ...svgAriaProps,
103
- children: /* @__PURE__ */ jsx(
104
- "use",
105
- {
106
- xmlnsXlink: "http://www.w3.org/1999/xlink",
107
- xlinkHref: `#seeds-svgs_${logo}`
108
- }
109
- )
91
+ return {
92
+ logo,
93
+ logoViewBox,
94
+ logoSizeKey,
95
+ resolvedHeight,
96
+ resolvedWidth,
97
+ sizeValue,
98
+ svgWidth,
99
+ containerAriaProps,
100
+ svgAriaProps
101
+ };
102
+ };
103
+
104
+ // src/PartnerLogoTailwind.tsx
105
+ import { jsx } from "react/jsx-runtime";
106
+ function cn(...inputs) {
107
+ const classes = [];
108
+ for (const input of inputs) {
109
+ if (!input) continue;
110
+ if (typeof input === "string") {
111
+ classes.push(input);
112
+ } else if (typeof input === "object") {
113
+ for (const [key, value] of Object.entries(input)) {
114
+ if (value) {
115
+ classes.push(key);
110
116
  }
111
- )
117
+ }
112
118
  }
113
- );
114
- };
119
+ }
120
+ return classes.join(" ");
121
+ }
122
+ var PartnerLogoTailwind = React2.forwardRef(
123
+ ({
124
+ partnerName,
125
+ backgroundType,
126
+ logoType = "symbol",
127
+ height,
128
+ width,
129
+ size,
130
+ "aria-label": ariaLabel,
131
+ svgProps,
132
+ className,
133
+ style: consumerStyle,
134
+ ...rest
135
+ }, ref) => {
136
+ const {
137
+ logo,
138
+ logoViewBox,
139
+ sizeValue,
140
+ svgWidth,
141
+ containerAriaProps,
142
+ svgAriaProps
143
+ } = usePartnerLogoModel({
144
+ partnerName,
145
+ backgroundType,
146
+ logoType,
147
+ height,
148
+ width,
149
+ size,
150
+ "aria-label": ariaLabel
151
+ });
152
+ const sizingStyle = {
153
+ "--seeds-partner-logo-height": sizeValue,
154
+ ...svgWidth ? { "--seeds-partner-logo-svg-width": svgWidth } : {}
155
+ };
156
+ return /* @__PURE__ */ jsx(
157
+ "span",
158
+ {
159
+ ref,
160
+ className: cn("seeds-partner-logo", "logo", className),
161
+ "data-qa-logo": partnerName,
162
+ style: { ...sizingStyle, ...consumerStyle },
163
+ ...rest,
164
+ ...containerAriaProps,
165
+ children: /* @__PURE__ */ jsx(
166
+ "svg",
167
+ {
168
+ className: "logo-svg",
169
+ viewBox: logoViewBox,
170
+ focusable: false,
171
+ "data-qa-logo-svg": `${partnerName}-svg`,
172
+ ...svgProps,
173
+ ...svgAriaProps,
174
+ children: /* @__PURE__ */ jsx(
175
+ "use",
176
+ {
177
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
178
+ xlinkHref: `#seeds-svgs_${logo}`
179
+ }
180
+ )
181
+ }
182
+ )
183
+ }
184
+ );
185
+ }
186
+ );
187
+ PartnerLogoTailwind.displayName = "PartnerLogoTailwind";
188
+
189
+ // src/PartnerLogoHybrid.tsx
190
+ import { hasStyledProps } from "@sproutsocial/seeds-react-system-props";
191
+ import { jsx as jsx2 } from "react/jsx-runtime";
192
+ var PartnerLogoHybrid = React3.forwardRef((props, ref) => {
193
+ const {
194
+ partnerName,
195
+ backgroundType,
196
+ logoType = "symbol",
197
+ height,
198
+ width,
199
+ size,
200
+ "aria-label": ariaLabel,
201
+ svgProps,
202
+ ...rest
203
+ } = props;
204
+ const model = usePartnerLogoModel({
205
+ partnerName,
206
+ backgroundType,
207
+ logoType,
208
+ height,
209
+ width,
210
+ size,
211
+ "aria-label": ariaLabel
212
+ });
213
+ if (hasStyledProps(rest)) {
214
+ return /* @__PURE__ */ jsx2(
215
+ styles_default,
216
+ {
217
+ height: model.resolvedHeight,
218
+ width: model.resolvedWidth,
219
+ logoSize: model.logoSizeKey,
220
+ className: "logo",
221
+ "data-qa-logo": partnerName,
222
+ ref,
223
+ ...rest,
224
+ ...model.containerAriaProps,
225
+ children: /* @__PURE__ */ jsx2(
226
+ "svg",
227
+ {
228
+ className: "logo-svg",
229
+ viewBox: model.logoViewBox,
230
+ focusable: false,
231
+ "data-qa-logo-svg": `${partnerName}-svg`,
232
+ ...svgProps,
233
+ ...model.svgAriaProps,
234
+ children: /* @__PURE__ */ jsx2(
235
+ "use",
236
+ {
237
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
238
+ xlinkHref: `#seeds-svgs_${model.logo}`
239
+ }
240
+ )
241
+ }
242
+ )
243
+ }
244
+ );
245
+ }
246
+ return /* @__PURE__ */ jsx2(PartnerLogoTailwind, { ...props, ref });
247
+ });
248
+ PartnerLogoHybrid.displayName = "PartnerLogo";
249
+ var PartnerLogoHybrid_default = PartnerLogoHybrid;
250
+
251
+ // src/PartnerLogo.tsx
252
+ import { jsx as jsx3 } from "react/jsx-runtime";
253
+ var PartnerLogo = React4.forwardRef(
254
+ (props, ref) => /* @__PURE__ */ jsx3(PartnerLogoHybrid_default, { ...props, ref })
255
+ );
256
+ PartnerLogo.displayName = "PartnerLogo";
115
257
  var PartnerLogo_default = PartnerLogo;
116
258
 
117
259
  // src/index.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/PartnerLogo.tsx","../../src/styles.ts","../../src/PartnerLogoTypes.ts","../../src/index.ts"],"sourcesContent":["import React from \"react\";\nimport { useTheme } from \"styled-components\";\nimport type { TypeTheme } from \"@sproutsocial/seeds-react-theme\";\nimport Container from \"./styles\";\nimport type { TypePartnerLogoProps } from \"./PartnerLogoTypes\";\nimport { ViewBoxes } from \"@sproutsocial/seeds-partner-logos\";\n\nconst whichLogo = (\n {\n backgroundType,\n logoType,\n partnerName,\n }: Pick<TypePartnerLogoProps, \"backgroundType\" | \"logoType\" | \"partnerName\">,\n mode: TypeTheme[\"mode\"]\n) => {\n const logo =\n logoType && logoType !== \"symbol\"\n ? partnerName + \"-\" + logoType\n : partnerName;\n if (backgroundType && backgroundType === \"dark\") {\n return `${logo}-dark`;\n } else if (backgroundType && backgroundType === \"light\") {\n return logo;\n } else if (mode === \"dark\") {\n return `${logo}-dark`;\n } else {\n return logo;\n }\n};\n\nconst PartnerLogo = ({\n partnerName,\n backgroundType,\n logoType = \"symbol\",\n height,\n width,\n size,\n \"aria-label\": ariaLabel,\n svgProps,\n ...rest\n}: TypePartnerLogoProps) => {\n const { mode } = useTheme() as TypeTheme;\n\n const logo = whichLogo({ backgroundType, logoType, partnerName }, mode);\n const logoViewBox = ViewBoxes[logo as keyof typeof ViewBoxes];\n const viewBoxCoordinates = logoViewBox?.split(\" \") || [];\n const defaultSize = logoType === \"symbol\" ? \"small\" : undefined;\n const defaultWidth = viewBoxCoordinates[2];\n const defaultHeight = viewBoxCoordinates[3];\n\n const hasAriaLabel = !!ariaLabel;\n const containerAriaProps = hasAriaLabel ? {} : { \"aria-hidden\": \"true\" };\n const svgAriaProps = hasAriaLabel\n ? { role: \"img\", \"aria-label\": ariaLabel }\n : {};\n\n return (\n <Container\n // we add pixels here because view box coordinates are numbers\n height={height ? height : defaultHeight + \"px\"}\n width={width ? width : defaultWidth + \"px\"}\n logoSize={size ?? defaultSize}\n className=\"logo\"\n data-qa-logo={partnerName}\n {...rest}\n {...containerAriaProps}\n >\n <svg\n className=\"logo-svg\"\n viewBox={logoViewBox}\n focusable={false}\n data-qa-logo-svg={`${partnerName}-svg`}\n {...svgProps}\n {...svgAriaProps}\n >\n <use\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n xlinkHref={`#seeds-svgs_${logo}`}\n />\n </svg>\n </Container>\n );\n};\n\nexport default PartnerLogo;\n","import styled, { css } from \"styled-components\";\nimport { verticalAlign } from \"styled-system\";\nimport { COMMON, FLEXBOX } from \"@sproutsocial/seeds-react-system-props\";\nimport {\n type TypePartnerLogoProps,\n type TypePartnerLogoSize,\n type TypePartnerLogoSizeValues,\n PartnerLogoSizes,\n} from \"./PartnerLogoTypes\";\n\nconst stylesForSize = (\n height: TypePartnerLogoProps[\"height\"],\n logoSize: TypePartnerLogoSizeValues\n) => css`\n height: ${logoSize ? logoSize : height};\n line-height: ${logoSize ? logoSize : height};\n\n .logo-svg {\n height: ${logoSize ? logoSize : height};\n width: ${logoSize ? logoSize : \"\"};\n }\n`;\n\ninterface ContainerProps\n extends Required<Pick<TypePartnerLogoProps, \"height\" | \"width\">> {\n logoSize: TypePartnerLogoSize;\n}\n\nconst Container = styled(\"span\")<ContainerProps>`\n display: inline-block;\n color: inherit;\n vertical-align: middle;\n ${COMMON}\n ${FLEXBOX}\n ${verticalAlign}\n ${(props) => stylesForSize(props.height, PartnerLogoSizes[props.logoSize])}\n`;\nexport default Container;\n","import * as React from \"react\";\nimport type { EnumLogoNamesWithoutVariants } from \"@sproutsocial/seeds-partner-logos\";\nimport { LogoNamesWithoutVariants } from \"@sproutsocial/seeds-partner-logos\";\nimport type { TypeStyledComponentsCommonProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type {\n TypeSystemCommonProps,\n TypeSystemFlexboxProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\n/**\n * @deprecated Use PartnerLogoNames instead\n */\nexport const PartnerNames = LogoNamesWithoutVariants;\n\n/**\n * @deprecated Use EnumLogoNames instead\n */\nexport type TypePartnerNames = EnumLogoNamesWithoutVariants;\n\nexport const PartnerLogoSizes = {\n mini: \"12px\",\n small: \"16px\",\n medium: \"24px\",\n large: \"32px\",\n jumbo: \"64px\",\n} as const;\n\nexport type TypePartnerLogoSize = keyof typeof PartnerLogoSizes;\nexport type TypePartnerLogoSizeValues =\n (typeof PartnerLogoSizes)[TypePartnerLogoSize];\n\nexport const PartnerLogoTypes = [\"symbol\", \"wordmark\", \"lockup\"] as const;\n\nexport type TypePartnerLogoTypes = (typeof PartnerLogoTypes)[number];\n\nexport interface TypePartnerLogoProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n TypeSystemFlexboxProps,\n Omit<React.ComponentPropsWithoutRef<\"span\">, \"color\"> {\n /** The name of the partner whose logo you want to render. */\n partnerName: EnumLogoNamesWithoutVariants;\n\n /** Manually override the default mode behavior by rendering a logo based on the background it's displayed on. */\n backgroundType?: \"dark\" | \"light\";\n logoType?: TypePartnerLogoTypes;\n height?: string;\n width?: string;\n size?: TypePartnerLogoSize;\n svgProps?: React.ComponentPropsWithoutRef<\"svg\">;\n}\n","import PartnerLogo from \"./PartnerLogo\";\n\nexport default PartnerLogo;\nexport { PartnerLogo };\nexport * from \"./PartnerLogoTypes\";\n"],"mappings":";AAAA,OAAkB;AAClB,SAAS,gBAAgB;;;ACDzB,OAAO,UAAU,WAAW;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,QAAQ,eAAe;;;ACFhC,OAAuB;AAEvB,SAAS,gCAAgC;AAUlC,IAAM,eAAe;AAOrB,IAAM,mBAAmB;AAAA,EAC9B,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AACT;AAMO,IAAM,mBAAmB,CAAC,UAAU,YAAY,QAAQ;;;ADrB/D,IAAM,gBAAgB,CACpB,QACA,aACG;AAAA,YACO,WAAW,WAAW,MAAM;AAAA,iBACvB,WAAW,WAAW,MAAM;AAAA;AAAA;AAAA,cAG/B,WAAW,WAAW,MAAM;AAAA,aAC7B,WAAW,WAAW,EAAE;AAAA;AAAA;AASrC,IAAM,YAAY,OAAO,MAAM;AAAA;A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AAe;AAAA,MACtC,UAAU,QAAQ;AAAA,MAClB,WAAU;AAAA,MACV,gBAAc;AAAA,MACb,GAAG;AAAA,MACH,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,SAAS;AAAA,UACT,WAAW;AAAA,UACX,oBAAkB,GAAG,WAAW;AAAA,UAC/B,GAAG;AAAA,UACH,GAAG;AAAA,UAEJ;AAAA,YAAC;AAAA;AAAA,cACC,YAAW;AAAA,cACX,WAAW,eAAe,IAAI;AAAA;AAAA,UAChC;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,sBAAQ;;;AGlFf,IAAO,gBAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/PartnerLogo.tsx","../../src/PartnerLogoHybrid.tsx","../../src/styles.ts","../../src/PartnerLogoTypes.ts","../../src/PartnerLogoTailwind.tsx","../../src/usePartnerLogoModel.ts","../../src/index.ts"],"sourcesContent":["import React from \"react\";\nimport type { TypePartnerLogoProps } from \"./PartnerLogoTypes\";\nimport PartnerLogoHybrid from \"./PartnerLogoHybrid\";\n\n/**\n * PartnerLogo component. Automatically routes between the Tailwind implementation\n * (preferred) and the styled-components implementation (for consumers using\n * system props or styled() extension).\n */\nconst PartnerLogo = React.forwardRef<HTMLSpanElement, TypePartnerLogoProps>(\n (props, ref) => <PartnerLogoHybrid {...props} ref={ref} />\n);\n\nPartnerLogo.displayName = \"PartnerLogo\";\nexport default PartnerLogo;\n","/**\n * Hybrid PartnerLogo Component\n * Automatically chooses between Tailwind and styled-components based on props\n */\n\nimport React from \"react\";\nimport type { TypePartnerLogoProps } from \"./PartnerLogoTypes\";\nimport Container from \"./styles\"; // Styled-components version\nimport { PartnerLogoTailwind } from \"./PartnerLogoTailwind\"; // Tailwind version\nimport { usePartnerLogoModel } from \"./usePartnerLogoModel\";\nimport { hasStyledProps } from \"@sproutsocial/seeds-react-system-props\";\n\nconst PartnerLogoHybrid = React.forwardRef<\n HTMLSpanElement,\n TypePartnerLogoProps\n>((props, ref) => {\n const {\n partnerName,\n backgroundType,\n logoType = \"symbol\",\n height,\n width,\n size,\n \"aria-label\": ariaLabel,\n svgProps,\n ...rest\n } = props;\n\n const model = usePartnerLogoModel({\n partnerName,\n backgroundType,\n logoType,\n height,\n width,\n size,\n \"aria-label\": ariaLabel,\n });\n\n // PartnerLogo declares its own height/width/size sizing props, so they are\n // destructured out above before checking hasStyledProps(rest) — a plain\n // <PartnerLogo height=\"30px\" /> routes to Tailwind. Only genuine system props\n // (mr, display, color, ...) force the styled-components path; a styled(PartnerLogo)\n // extension routes to Tailwind and still applies its styles via the forwarded className.\n if (hasStyledProps(rest)) {\n return (\n <Container\n height={model.resolvedHeight}\n width={model.resolvedWidth}\n logoSize={model.logoSizeKey}\n className=\"logo\"\n data-qa-logo={partnerName}\n ref={ref}\n {...rest}\n {...model.containerAriaProps}\n >\n <svg\n className=\"logo-svg\"\n viewBox={model.logoViewBox}\n focusable={false}\n data-qa-logo-svg={`${partnerName}-svg`}\n {...svgProps}\n {...model.svgAriaProps}\n >\n <use\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n xlinkHref={`#seeds-svgs_${model.logo}`}\n />\n </svg>\n </Container>\n );\n }\n\n // Use Tailwind version (preferred - better performance)\n return <PartnerLogoTailwind {...props} ref={ref} />;\n});\n\nPartnerLogoHybrid.displayName = \"PartnerLogo\";\nexport default PartnerLogoHybrid;\n","import styled, { css } from \"styled-components\";\nimport { verticalAlign } from \"styled-system\";\nimport { COMMON, FLEXBOX } from \"@sproutsocial/seeds-react-system-props\";\nimport {\n type TypePartnerLogoProps,\n type TypePartnerLogoSize,\n type TypePartnerLogoSizeValues,\n PartnerLogoSizes,\n} from \"./PartnerLogoTypes\";\n\nconst stylesForSize = (\n height: TypePartnerLogoProps[\"height\"],\n logoSize: TypePartnerLogoSizeValues\n) => css`\n height: ${logoSize ? logoSize : height};\n line-height: ${logoSize ? logoSize : height};\n\n .logo-svg {\n height: ${logoSize ? logoSize : height};\n width: ${logoSize ? logoSize : \"\"};\n }\n`;\n\ninterface ContainerProps\n extends Required<Pick<TypePartnerLogoProps, \"height\" | \"width\">> {\n logoSize: TypePartnerLogoSize;\n}\n\nconst Container = styled(\"span\")<ContainerProps>`\n display: inline-block;\n color: inherit;\n vertical-align: middle;\n ${COMMON}\n ${FLEXBOX}\n ${verticalAlign}\n ${(props) => stylesForSize(props.height, PartnerLogoSizes[props.logoSize])}\n`;\nexport default Container;\n","import * as React from \"react\";\nimport type { EnumLogoNamesWithoutVariants } from \"@sproutsocial/seeds-partner-logos\";\nimport { LogoNamesWithoutVariants } from \"@sproutsocial/seeds-partner-logos\";\nimport type { TypeStyledComponentsCommonProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type {\n TypeSystemCommonProps,\n TypeSystemFlexboxProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\n/**\n * @deprecated Use PartnerLogoNames instead\n */\nexport const PartnerNames = LogoNamesWithoutVariants;\n\n/**\n * @deprecated Use EnumLogoNames instead\n */\nexport type TypePartnerNames = EnumLogoNamesWithoutVariants;\n\nexport const PartnerLogoSizes = {\n mini: \"12px\",\n small: \"16px\",\n medium: \"24px\",\n large: \"32px\",\n jumbo: \"64px\",\n} as const;\n\nexport type TypePartnerLogoSize = keyof typeof PartnerLogoSizes;\nexport type TypePartnerLogoSizeValues =\n (typeof PartnerLogoSizes)[TypePartnerLogoSize];\n\nexport const PartnerLogoTypes = [\"symbol\", \"wordmark\", \"lockup\"] as const;\n\nexport type TypePartnerLogoTypes = (typeof PartnerLogoTypes)[number];\n\nexport interface TypePartnerLogoProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n TypeSystemFlexboxProps,\n Omit<React.ComponentPropsWithoutRef<\"span\">, \"color\"> {\n /** The name of the partner whose logo you want to render. */\n partnerName: EnumLogoNamesWithoutVariants;\n\n /** Manually override the default mode behavior by rendering a logo based on the background it's displayed on. */\n backgroundType?: \"dark\" | \"light\";\n logoType?: TypePartnerLogoTypes;\n height?: string;\n width?: string;\n size?: TypePartnerLogoSize;\n svgProps?: React.ComponentPropsWithoutRef<\"svg\">;\n}\n","/**\n * Tailwind CSS implementation of PartnerLogo component\n * Uses Seeds partner logo CSS classes from partner-logo.css\n */\n\nimport React from \"react\";\nimport type { TypePartnerLogoProps } from \"./PartnerLogoTypes\";\nimport { usePartnerLogoModel } from \"./usePartnerLogoModel\";\n\n// Utility for merging class names properly\nfunction cn(\n ...inputs: (string | undefined | null | false | Record<string, boolean>)[]\n): string {\n const classes: string[] = [];\n\n for (const input of inputs) {\n if (!input) continue;\n\n if (typeof input === \"string\") {\n classes.push(input);\n } else if (typeof input === \"object\") {\n for (const [key, value] of Object.entries(input)) {\n if (value) {\n classes.push(key);\n }\n }\n }\n }\n\n return classes.join(\" \");\n}\n\nexport const PartnerLogoTailwind = React.forwardRef<\n HTMLSpanElement,\n TypePartnerLogoProps\n>(\n (\n {\n partnerName,\n backgroundType,\n logoType = \"symbol\",\n height,\n width,\n size,\n \"aria-label\": ariaLabel,\n svgProps,\n className,\n style: consumerStyle,\n ...rest\n }: TypePartnerLogoProps,\n ref: React.Ref<HTMLSpanElement>\n ) => {\n const {\n logo,\n logoViewBox,\n sizeValue,\n svgWidth,\n containerAriaProps,\n svgAriaProps,\n } = usePartnerLogoModel({\n partnerName,\n backgroundType,\n logoType,\n height,\n width,\n size,\n \"aria-label\": ariaLabel,\n });\n\n // CSS custom-property keys aren't part of CSSProperties — cast is required.\n const sizingStyle = {\n \"--seeds-partner-logo-height\": sizeValue,\n ...(svgWidth ? { \"--seeds-partner-logo-svg-width\": svgWidth } : {}),\n } as React.CSSProperties;\n\n return (\n <span\n ref={ref}\n className={cn(\"seeds-partner-logo\", \"logo\", className)}\n data-qa-logo={partnerName}\n // sizing first so a consumer's unrelated style survives without\n // clobbering the computed size CSS variables\n style={{ ...sizingStyle, ...consumerStyle }}\n {...(rest as React.ComponentPropsWithoutRef<\"span\">)}\n {...containerAriaProps}\n >\n <svg\n className=\"logo-svg\"\n viewBox={logoViewBox}\n focusable={false}\n data-qa-logo-svg={`${partnerName}-svg`}\n {...svgProps}\n {...svgAriaProps}\n >\n <use\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n xlinkHref={`#seeds-svgs_${logo}`}\n />\n </svg>\n </span>\n );\n }\n);\n\nPartnerLogoTailwind.displayName = \"PartnerLogoTailwind\";\n","import { useTheme } from \"styled-components\";\nimport type { TypeTheme } from \"@sproutsocial/seeds-react-theme\";\nimport { ViewBoxes } from \"@sproutsocial/seeds-partner-logos\";\nimport { PartnerLogoSizes } from \"./PartnerLogoTypes\";\nimport type { TypePartnerLogoProps } from \"./PartnerLogoTypes\";\n\nconst whichLogo = (\n {\n backgroundType,\n logoType,\n partnerName,\n }: Pick<TypePartnerLogoProps, \"backgroundType\" | \"logoType\" | \"partnerName\">,\n mode: TypeTheme[\"mode\"]\n) => {\n const logo =\n logoType && logoType !== \"symbol\"\n ? partnerName + \"-\" + logoType\n : partnerName;\n if (backgroundType && backgroundType === \"dark\") {\n return `${logo}-dark`;\n } else if (backgroundType && backgroundType === \"light\") {\n return logo;\n } else if (mode === \"dark\") {\n return `${logo}-dark`;\n } else {\n return logo;\n }\n};\n\n/**\n * Shared compute for both render paths (Tailwind + styled-components).\n *\n * Calls useTheme() so dark-logo selection works identically on both paths, and\n * returns the resolved logo id, viewBox, aria props, and the size values used to\n * drive sizing. Sizing precedence is preserved verbatim from the original\n * stylesForSize block: a logoSize lookup wins over the height prop, and the svg\n * width is the logoSize lookup or empty (which sizes the svg from the viewBox).\n */\nexport const usePartnerLogoModel = ({\n partnerName,\n backgroundType,\n logoType = \"symbol\",\n height,\n width,\n size,\n \"aria-label\": ariaLabel,\n}: TypePartnerLogoProps) => {\n const { mode } = useTheme() as TypeTheme;\n\n const logo = whichLogo({ backgroundType, logoType, partnerName }, mode);\n const logoViewBox = ViewBoxes[logo as keyof typeof ViewBoxes];\n const viewBoxCoordinates = logoViewBox?.split(\" \") || [];\n const defaultSize = logoType === \"symbol\" ? \"small\" : undefined;\n const logoSizeKey = size ?? defaultSize;\n const logoSizePx = logoSizeKey ? PartnerLogoSizes[logoSizeKey] : undefined;\n\n // we add pixels here because view box coordinates are numbers\n const resolvedHeight = height ? height : viewBoxCoordinates[3] + \"px\";\n const resolvedWidth = width ? width : viewBoxCoordinates[2] + \"px\";\n // container height + line-height + svg height: logoSize wins over height\n const sizeValue = logoSizePx ? logoSizePx : resolvedHeight;\n // svg width: logoSize or empty (empty => sizes from viewBox aspect ratio)\n const svgWidth = logoSizePx ? logoSizePx : \"\";\n\n const hasAriaLabel = !!ariaLabel;\n const containerAriaProps = hasAriaLabel ? {} : { \"aria-hidden\": true };\n const svgAriaProps = hasAriaLabel\n ? { role: \"img\", \"aria-label\": ariaLabel }\n : {};\n\n return {\n logo,\n logoViewBox,\n logoSizeKey,\n resolvedHeight,\n resolvedWidth,\n sizeValue,\n svgWidth,\n containerAriaProps,\n svgAriaProps,\n };\n};\n","import PartnerLogo from \"./PartnerLogo\";\n\nexport default PartnerLogo;\nexport { PartnerLogo };\nexport * from \"./PartnerLogoTypes\";\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACKlB,OAAOC,YAAW;;;ACLlB,OAAO,UAAU,WAAW;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,QAAQ,eAAe;;;ACFhC,OAAuB;AAEvB,SAAS,gCAAgC;AAUlC,IAAM,eAAe;AAOrB,IAAM,mBAAmB;AAAA,EAC9B,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AACT;AAMO,IAAM,mBAAmB,CAAC,UAAU,YAAY,QAAQ;;;ADrB/D,IAAM,gBAAgB,CACpB,QACA,aACG;AAAA,YACO,WAAW,WAAW,MAAM;AAAA,iBACvB,WAAW,WAAW,MAAM;AAAA;AAAA;AAAA,cAG/B,WAAW,WAAW,MAAM;AAAA,aAC7B,WAAW,WAAW,EAAE;AAAA;A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AAA,cAAC;AAAA;AAAA,gBACC,YAAW;AAAA,gBACX,WAAW,eAAe,MAAM,IAAI;AAAA;AAAA,YACtC;AAAA;AAAA,QACF;AAAA;AAAA,IACF;AAAA,EAEJ;AAGA,SAAO,gBAAAA,KAAC,uBAAqB,GAAG,OAAO,KAAU;AACnD,CAAC;AAED,kBAAkB,cAAc;AAChC,IAAO,4BAAQ;;;ADnEG,gBAAAE,YAAA;AADlB,IAAM,cAAcC,OAAM;AAAA,EACxB,CAAC,OAAO,QAAQ,gBAAAD,KAAC,6BAAmB,GAAG,OAAO,KAAU;AAC1D;AAEA,YAAY,cAAc;AAC1B,IAAO,sBAAQ;;;AMZf,IAAO,gBAAQ;","names":["React","React","React","React","jsx","React","jsx","React"]}
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import * as React from 'react';
2
+ import React__default from 'react';
3
3
  import { EnumLogoNamesWithoutVariants } from '@sproutsocial/seeds-partner-logos';
4
4
  import { TypeStyledComponentsCommonProps, TypeSystemCommonProps, TypeSystemFlexboxProps } from '@sproutsocial/seeds-react-system-props';
5
5
 
@@ -34,6 +34,11 @@ interface TypePartnerLogoProps extends TypeStyledComponentsCommonProps, TypeSyst
34
34
  svgProps?: React.ComponentPropsWithoutRef<"svg">;
35
35
  }
36
36
 
37
- declare const PartnerLogo: ({ partnerName, backgroundType, logoType, height, width, size, "aria-label": ariaLabel, svgProps, ...rest }: TypePartnerLogoProps) => react_jsx_runtime.JSX.Element;
37
+ /**
38
+ * PartnerLogo component. Automatically routes between the Tailwind implementation
39
+ * (preferred) and the styled-components implementation (for consumers using
40
+ * system props or styled() extension).
41
+ */
42
+ declare const PartnerLogo: React__default.ForwardRefExoticComponent<Omit<TypePartnerLogoProps, "ref"> & React__default.RefAttributes<HTMLSpanElement>>;
38
43
 
39
44
  export { PartnerLogo, PartnerLogoSizes, PartnerLogoTypes, PartnerNames, type TypePartnerLogoProps, type TypePartnerLogoSize, type TypePartnerLogoSizeValues, type TypePartnerLogoTypes, type TypePartnerNames, PartnerLogo as default };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import * as React from 'react';
2
+ import React__default from 'react';
3
3
  import { EnumLogoNamesWithoutVariants } from '@sproutsocial/seeds-partner-logos';
4
4
  import { TypeStyledComponentsCommonProps, TypeSystemCommonProps, TypeSystemFlexboxProps } from '@sproutsocial/seeds-react-system-props';
5
5
 
@@ -34,6 +34,11 @@ interface TypePartnerLogoProps extends TypeStyledComponentsCommonProps, TypeSyst
34
34
  svgProps?: React.ComponentPropsWithoutRef<"svg">;
35
35
  }
36
36
 
37
- declare const PartnerLogo: ({ partnerName, backgroundType, logoType, height, width, size, "aria-label": ariaLabel, svgProps, ...rest }: TypePartnerLogoProps) => react_jsx_runtime.JSX.Element;
37
+ /**
38
+ * PartnerLogo component. Automatically routes between the Tailwind implementation
39
+ * (preferred) and the styled-components implementation (for consumers using
40
+ * system props or styled() extension).
41
+ */
42
+ declare const PartnerLogo: React__default.ForwardRefExoticComponent<Omit<TypePartnerLogoProps, "ref"> & React__default.RefAttributes<HTMLSpanElement>>;
38
43
 
39
44
  export { PartnerLogo, PartnerLogoSizes, PartnerLogoTypes, PartnerNames, type TypePartnerLogoProps, type TypePartnerLogoSize, type TypePartnerLogoSizeValues, type TypePartnerLogoTypes, type TypePartnerNames, PartnerLogo as default };
package/dist/index.js CHANGED
@@ -39,8 +39,10 @@ __export(index_exports, {
39
39
  module.exports = __toCommonJS(index_exports);
40
40
 
41
41
  // src/PartnerLogo.tsx
42
- var import_react = require("react");
43
- var import_styled_components2 = require("styled-components");
42
+ var import_react3 = __toESM(require("react"));
43
+
44
+ // src/PartnerLogoHybrid.tsx
45
+ var import_react2 = __toESM(require("react"));
44
46
 
45
47
  // src/styles.ts
46
48
  var import_styled_components = __toESM(require("styled-components"));
@@ -81,9 +83,12 @@ var Container = (0, import_styled_components.default)("span")`
81
83
  `;
82
84
  var styles_default = Container;
83
85
 
84
- // src/PartnerLogo.tsx
86
+ // src/PartnerLogoTailwind.tsx
87
+ var import_react = __toESM(require("react"));
88
+
89
+ // src/usePartnerLogoModel.ts
90
+ var import_styled_components2 = require("styled-components");
85
91
  var import_seeds_partner_logos2 = require("@sproutsocial/seeds-partner-logos");
86
- var import_jsx_runtime = require("react/jsx-runtime");
87
92
  var whichLogo = ({
88
93
  backgroundType,
89
94
  logoType,
@@ -100,58 +105,195 @@ var whichLogo = ({
100
105
  return logo;
101
106
  }
102
107
  };
103
- var PartnerLogo = ({
108
+ var usePartnerLogoModel = ({
104
109
  partnerName,
105
110
  backgroundType,
106
111
  logoType = "symbol",
107
112
  height,
108
113
  width,
109
114
  size,
110
- "aria-label": ariaLabel,
111
- svgProps,
112
- ...rest
115
+ "aria-label": ariaLabel
113
116
  }) => {
114
117
  const { mode } = (0, import_styled_components2.useTheme)();
115
118
  const logo = whichLogo({ backgroundType, logoType, partnerName }, mode);
116
119
  const logoViewBox = import_seeds_partner_logos2.ViewBoxes[logo];
117
120
  const viewBoxCoordinates = logoViewBox?.split(" ") || [];
118
121
  const defaultSize = logoType === "symbol" ? "small" : void 0;
119
- const defaultWidth = viewBoxCoordinates[2];
120
- const defaultHeight = viewBoxCoordinates[3];
122
+ const logoSizeKey = size ?? defaultSize;
123
+ const logoSizePx = logoSizeKey ? PartnerLogoSizes[logoSizeKey] : void 0;
124
+ const resolvedHeight = height ? height : viewBoxCoordinates[3] + "px";
125
+ const resolvedWidth = width ? width : viewBoxCoordinates[2] + "px";
126
+ const sizeValue = logoSizePx ? logoSizePx : resolvedHeight;
127
+ const svgWidth = logoSizePx ? logoSizePx : "";
121
128
  const hasAriaLabel = !!ariaLabel;
122
- const containerAriaProps = hasAriaLabel ? {} : { "aria-hidden": "true" };
129
+ const containerAriaProps = hasAriaLabel ? {} : { "aria-hidden": true };
123
130
  const svgAriaProps = hasAriaLabel ? { role: "img", "aria-label": ariaLabel } : {};
124
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
125
- styles_default,
126
- {
127
- height: height ? height : defaultHeight + "px",
128
- width: width ? width : defaultWidth + "px",
129
- logoSize: size ?? defaultSize,
130
- className: "logo",
131
- "data-qa-logo": partnerName,
132
- ...rest,
133
- ...containerAriaProps,
134
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
135
- "svg",
136
- {
137
- className: "logo-svg",
138
- viewBox: logoViewBox,
139
- focusable: false,
140
- "data-qa-logo-svg": `${partnerName}-svg`,
141
- ...svgProps,
142
- ...svgAriaProps,
143
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
144
- "use",
145
- {
146
- xmlnsXlink: "http://www.w3.org/1999/xlink",
147
- xlinkHref: `#seeds-svgs_${logo}`
148
- }
149
- )
131
+ return {
132
+ logo,
133
+ logoViewBox,
134
+ logoSizeKey,
135
+ resolvedHeight,
136
+ resolvedWidth,
137
+ sizeValue,
138
+ svgWidth,
139
+ containerAriaProps,
140
+ svgAriaProps
141
+ };
142
+ };
143
+
144
+ // src/PartnerLogoTailwind.tsx
145
+ var import_jsx_runtime = require("react/jsx-runtime");
146
+ function cn(...inputs) {
147
+ const classes = [];
148
+ for (const input of inputs) {
149
+ if (!input) continue;
150
+ if (typeof input === "string") {
151
+ classes.push(input);
152
+ } else if (typeof input === "object") {
153
+ for (const [key, value] of Object.entries(input)) {
154
+ if (value) {
155
+ classes.push(key);
150
156
  }
151
- )
157
+ }
152
158
  }
153
- );
154
- };
159
+ }
160
+ return classes.join(" ");
161
+ }
162
+ var PartnerLogoTailwind = import_react.default.forwardRef(
163
+ ({
164
+ partnerName,
165
+ backgroundType,
166
+ logoType = "symbol",
167
+ height,
168
+ width,
169
+ size,
170
+ "aria-label": ariaLabel,
171
+ svgProps,
172
+ className,
173
+ style: consumerStyle,
174
+ ...rest
175
+ }, ref) => {
176
+ const {
177
+ logo,
178
+ logoViewBox,
179
+ sizeValue,
180
+ svgWidth,
181
+ containerAriaProps,
182
+ svgAriaProps
183
+ } = usePartnerLogoModel({
184
+ partnerName,
185
+ backgroundType,
186
+ logoType,
187
+ height,
188
+ width,
189
+ size,
190
+ "aria-label": ariaLabel
191
+ });
192
+ const sizingStyle = {
193
+ "--seeds-partner-logo-height": sizeValue,
194
+ ...svgWidth ? { "--seeds-partner-logo-svg-width": svgWidth } : {}
195
+ };
196
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
197
+ "span",
198
+ {
199
+ ref,
200
+ className: cn("seeds-partner-logo", "logo", className),
201
+ "data-qa-logo": partnerName,
202
+ style: { ...sizingStyle, ...consumerStyle },
203
+ ...rest,
204
+ ...containerAriaProps,
205
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
206
+ "svg",
207
+ {
208
+ className: "logo-svg",
209
+ viewBox: logoViewBox,
210
+ focusable: false,
211
+ "data-qa-logo-svg": `${partnerName}-svg`,
212
+ ...svgProps,
213
+ ...svgAriaProps,
214
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
215
+ "use",
216
+ {
217
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
218
+ xlinkHref: `#seeds-svgs_${logo}`
219
+ }
220
+ )
221
+ }
222
+ )
223
+ }
224
+ );
225
+ }
226
+ );
227
+ PartnerLogoTailwind.displayName = "PartnerLogoTailwind";
228
+
229
+ // src/PartnerLogoHybrid.tsx
230
+ var import_seeds_react_system_props2 = require("@sproutsocial/seeds-react-system-props");
231
+ var import_jsx_runtime2 = require("react/jsx-runtime");
232
+ var PartnerLogoHybrid = import_react2.default.forwardRef((props, ref) => {
233
+ const {
234
+ partnerName,
235
+ backgroundType,
236
+ logoType = "symbol",
237
+ height,
238
+ width,
239
+ size,
240
+ "aria-label": ariaLabel,
241
+ svgProps,
242
+ ...rest
243
+ } = props;
244
+ const model = usePartnerLogoModel({
245
+ partnerName,
246
+ backgroundType,
247
+ logoType,
248
+ height,
249
+ width,
250
+ size,
251
+ "aria-label": ariaLabel
252
+ });
253
+ if ((0, import_seeds_react_system_props2.hasStyledProps)(rest)) {
254
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
255
+ styles_default,
256
+ {
257
+ height: model.resolvedHeight,
258
+ width: model.resolvedWidth,
259
+ logoSize: model.logoSizeKey,
260
+ className: "logo",
261
+ "data-qa-logo": partnerName,
262
+ ref,
263
+ ...rest,
264
+ ...model.containerAriaProps,
265
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
266
+ "svg",
267
+ {
268
+ className: "logo-svg",
269
+ viewBox: model.logoViewBox,
270
+ focusable: false,
271
+ "data-qa-logo-svg": `${partnerName}-svg`,
272
+ ...svgProps,
273
+ ...model.svgAriaProps,
274
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
275
+ "use",
276
+ {
277
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
278
+ xlinkHref: `#seeds-svgs_${model.logo}`
279
+ }
280
+ )
281
+ }
282
+ )
283
+ }
284
+ );
285
+ }
286
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PartnerLogoTailwind, { ...props, ref });
287
+ });
288
+ PartnerLogoHybrid.displayName = "PartnerLogo";
289
+ var PartnerLogoHybrid_default = PartnerLogoHybrid;
290
+
291
+ // src/PartnerLogo.tsx
292
+ var import_jsx_runtime3 = require("react/jsx-runtime");
293
+ var PartnerLogo = import_react3.default.forwardRef(
294
+ (props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PartnerLogoHybrid_default, { ...props, ref })
295
+ );
296
+ PartnerLogo.displayName = "PartnerLogo";
155
297
  var PartnerLogo_default = PartnerLogo;
156
298
 
157
299
  // src/index.ts
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/PartnerLogo.tsx","../src/styles.ts","../src/PartnerLogoTypes.ts"],"sourcesContent":["import PartnerLogo from \"./PartnerLogo\";\n\nexport default PartnerLogo;\nexport { PartnerLogo };\nexport * from \"./PartnerLogoTypes\";\n","import React from \"react\";\nimport { useTheme } from \"styled-components\";\nimport type { TypeTheme } from \"@sproutsocial/seeds-react-theme\";\nimport Container from \"./styles\";\nimport type { TypePartnerLogoProps } from \"./PartnerLogoTypes\";\nimport { ViewBoxes } from \"@sproutsocial/seeds-partner-logos\";\n\nconst whichLogo = (\n {\n backgroundType,\n logoType,\n partnerName,\n }: Pick<TypePartnerLogoProps, \"backgroundType\" | \"logoType\" | \"partnerName\">,\n mode: TypeTheme[\"mode\"]\n) => {\n const logo =\n logoType && logoType !== \"symbol\"\n ? partnerName + \"-\" + logoType\n : partnerName;\n if (backgroundType && backgroundType === \"dark\") {\n return `${logo}-dark`;\n } else if (backgroundType && backgroundType === \"light\") {\n return logo;\n } else if (mode === \"dark\") {\n return `${logo}-dark`;\n } else {\n return logo;\n }\n};\n\nconst PartnerLogo = ({\n partnerName,\n backgroundType,\n logoType = \"symbol\",\n height,\n width,\n size,\n \"aria-label\": ariaLabel,\n svgProps,\n ...rest\n}: TypePartnerLogoProps) => {\n const { mode } = useTheme() as TypeTheme;\n\n const logo = whichLogo({ backgroundType, logoType, partnerName }, mode);\n const logoViewBox = ViewBoxes[logo as keyof typeof ViewBoxes];\n const viewBoxCoordinates = logoViewBox?.split(\" \") || [];\n const defaultSize = logoType === \"symbol\" ? \"small\" : undefined;\n const defaultWidth = viewBoxCoordinates[2];\n const defaultHeight = viewBoxCoordinates[3];\n\n const hasAriaLabel = !!ariaLabel;\n const containerAriaProps = hasAriaLabel ? {} : { \"aria-hidden\": \"true\" };\n const svgAriaProps = hasAriaLabel\n ? { role: \"img\", \"aria-label\": ariaLabel }\n : {};\n\n return (\n <Container\n // we add pixels here because view box coordinates are numbers\n height={height ? height : defaultHeight + \"px\"}\n width={width ? width : defaultWidth + \"px\"}\n logoSize={size ?? defaultSize}\n className=\"logo\"\n data-qa-logo={partnerName}\n {...rest}\n {...containerAriaProps}\n >\n <svg\n className=\"logo-svg\"\n viewBox={logoViewBox}\n focusable={false}\n data-qa-logo-svg={`${partnerName}-svg`}\n {...svgProps}\n {...svgAriaProps}\n >\n <use\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n xlinkHref={`#seeds-svgs_${logo}`}\n />\n </svg>\n </Container>\n );\n};\n\nexport default PartnerLogo;\n","import styled, { css } from \"styled-components\";\nimport { verticalAlign } from \"styled-system\";\nimport { COMMON, FLEXBOX } from \"@sproutsocial/seeds-react-system-props\";\nimport {\n type TypePartnerLogoProps,\n type TypePartnerLogoSize,\n type TypePartnerLogoSizeValues,\n PartnerLogoSizes,\n} from \"./PartnerLogoTypes\";\n\nconst stylesForSize = (\n height: TypePartnerLogoProps[\"height\"],\n logoSize: TypePartnerLogoSizeValues\n) => css`\n height: ${logoSize ? logoSize : height};\n line-height: ${logoSize ? logoSize : height};\n\n .logo-svg {\n height: ${logoSize ? logoSize : height};\n width: ${logoSize ? logoSize : \"\"};\n }\n`;\n\ninterface ContainerProps\n extends Required<Pick<TypePartnerLogoProps, \"height\" | \"width\">> {\n logoSize: TypePartnerLogoSize;\n}\n\nconst Container = styled(\"span\")<ContainerProps>`\n display: inline-block;\n color: inherit;\n vertical-align: middle;\n ${COMMON}\n ${FLEXBOX}\n ${verticalAlign}\n ${(props) => stylesForSize(props.height, PartnerLogoSizes[props.logoSize])}\n`;\nexport default Container;\n","import * as React from \"react\";\nimport type { EnumLogoNamesWithoutVariants } from \"@sproutsocial/seeds-partner-logos\";\nimport { LogoNamesWithoutVariants } from \"@sproutsocial/seeds-partner-logos\";\nimport type { TypeStyledComponentsCommonProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type {\n TypeSystemCommonProps,\n TypeSystemFlexboxProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\n/**\n * @deprecated Use PartnerLogoNames instead\n */\nexport const PartnerNames = LogoNamesWithoutVariants;\n\n/**\n * @deprecated Use EnumLogoNames instead\n */\nexport type TypePartnerNames = EnumLogoNamesWithoutVariants;\n\nexport const PartnerLogoSizes = {\n mini: \"12px\",\n small: \"16px\",\n medium: \"24px\",\n large: \"32px\",\n jumbo: \"64px\",\n} as const;\n\nexport type TypePartnerLogoSize = keyof typeof PartnerLogoSizes;\nexport type TypePartnerLogoSizeValues =\n (typeof PartnerLogoSizes)[TypePartnerLogoSize];\n\nexport const PartnerLogoTypes = [\"symbol\", \"wordmark\", \"lockup\"] as const;\n\nexport type TypePartnerLogoTypes = (typeof PartnerLogoTypes)[number];\n\nexport interface TypePartnerLogoProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n TypeSystemFlexboxProps,\n Omit<React.ComponentPropsWithoutRef<\"span\">, \"color\"> {\n /** The name of the partner whose logo you want to render. */\n partnerName: EnumLogoNamesWithoutVariants;\n\n /** Manually override the default mode behavior by rendering a logo based on the background it's displayed on. */\n backgroundType?: \"dark\" | \"light\";\n logoType?: TypePartnerLogoTypes;\n height?: string;\n width?: string;\n size?: TypePartnerLogoSize;\n svgProps?: React.ComponentPropsWithoutRef<\"svg\">;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAkB;AAClB,IAAAA,4BAAyB;;;ACDzB,+BAA4B;AAC5B,2BAA8B;AAC9B,sCAAgC;;;ACFhC,YAAuB;AAEvB,iCAAyC;AAUlC,IAAM,eAAe;AAOrB,IAAM,mBAAmB;AAAA,EAC9B,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AACT;AAMO,IAAM,mBAAmB,CAAC,UAAU,YAAY,QAAQ;;;ADrB/D,IAAM,gBAAgB,CACpB,QACA,aACG;AAAA,YACO,WAAW,WAAW,MAAM;AAAA,iBACvB,WAAW,WAAW,MAAM;AAAA;AAAA;AAAA,cAG/B,WAAW,WAAW,MAAM;AAAA,aAC7B,WAAW,WAAW,EAAE;AAAA;AAAA;AASrC,IAAM,gBAAY,yBAAAC,S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1C,OAAO,QAAQ,QAAQ,eAAe;AAAA,MACtC,UAAU,QAAQ;AAAA,MAClB,WAAU;AAAA,MACV,gBAAc;AAAA,MACb,GAAG;AAAA,MACH,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,SAAS;AAAA,UACT,WAAW;AAAA,UACX,oBAAkB,GAAG,WAAW;AAAA,UAC/B,GAAG;AAAA,UACH,GAAG;AAAA,UAEJ;AAAA,YAAC;AAAA;AAAA,cACC,YAAW;AAAA,cACX,WAAW,eAAe,IAAI;AAAA;AAAA,UAChC;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,sBAAQ;;;ADlFf,IAAO,gBAAQ;","names":["import_styled_components","styled","import_seeds_partner_logos"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/PartnerLogo.tsx","../src/PartnerLogoHybrid.tsx","../src/styles.ts","../src/PartnerLogoTypes.ts","../src/PartnerLogoTailwind.tsx","../src/usePartnerLogoModel.ts"],"sourcesContent":["import PartnerLogo from \"./PartnerLogo\";\n\nexport default PartnerLogo;\nexport { PartnerLogo };\nexport * from \"./PartnerLogoTypes\";\n","import React from \"react\";\nimport type { TypePartnerLogoProps } from \"./PartnerLogoTypes\";\nimport PartnerLogoHybrid from \"./PartnerLogoHybrid\";\n\n/**\n * PartnerLogo component. Automatically routes between the Tailwind implementation\n * (preferred) and the styled-components implementation (for consumers using\n * system props or styled() extension).\n */\nconst PartnerLogo = React.forwardRef<HTMLSpanElement, TypePartnerLogoProps>(\n (props, ref) => <PartnerLogoHybrid {...props} ref={ref} />\n);\n\nPartnerLogo.displayName = \"PartnerLogo\";\nexport default PartnerLogo;\n","/**\n * Hybrid PartnerLogo Component\n * Automatically chooses between Tailwind and styled-components based on props\n */\n\nimport React from \"react\";\nimport type { TypePartnerLogoProps } from \"./PartnerLogoTypes\";\nimport Container from \"./styles\"; // Styled-components version\nimport { PartnerLogoTailwind } from \"./PartnerLogoTailwind\"; // Tailwind version\nimport { usePartnerLogoModel } from \"./usePartnerLogoModel\";\nimport { hasStyledProps } from \"@sproutsocial/seeds-react-system-props\";\n\nconst PartnerLogoHybrid = React.forwardRef<\n HTMLSpanElement,\n TypePartnerLogoProps\n>((props, ref) => {\n const {\n partnerName,\n backgroundType,\n logoType = \"symbol\",\n height,\n width,\n size,\n \"aria-label\": ariaLabel,\n svgProps,\n ...rest\n } = props;\n\n const model = usePartnerLogoModel({\n partnerName,\n backgroundType,\n logoType,\n height,\n width,\n size,\n \"aria-label\": ariaLabel,\n });\n\n // PartnerLogo declares its own height/width/size sizing props, so they are\n // destructured out above before checking hasStyledProps(rest) — a plain\n // <PartnerLogo height=\"30px\" /> routes to Tailwind. Only genuine system props\n // (mr, display, color, ...) force the styled-components path; a styled(PartnerLogo)\n // extension routes to Tailwind and still applies its styles via the forwarded className.\n if (hasStyledProps(rest)) {\n return (\n <Container\n height={model.resolvedHeight}\n width={model.resolvedWidth}\n logoSize={model.logoSizeKey}\n className=\"logo\"\n data-qa-logo={partnerName}\n ref={ref}\n {...rest}\n {...model.containerAriaProps}\n >\n <svg\n className=\"logo-svg\"\n viewBox={model.logoViewBox}\n focusable={false}\n data-qa-logo-svg={`${partnerName}-svg`}\n {...svgProps}\n {...model.svgAriaProps}\n >\n <use\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n xlinkHref={`#seeds-svgs_${model.logo}`}\n />\n </svg>\n </Container>\n );\n }\n\n // Use Tailwind version (preferred - better performance)\n return <PartnerLogoTailwind {...props} ref={ref} />;\n});\n\nPartnerLogoHybrid.displayName = \"PartnerLogo\";\nexport default PartnerLogoHybrid;\n","import styled, { css } from \"styled-components\";\nimport { verticalAlign } from \"styled-system\";\nimport { COMMON, FLEXBOX } from \"@sproutsocial/seeds-react-system-props\";\nimport {\n type TypePartnerLogoProps,\n type TypePartnerLogoSize,\n type TypePartnerLogoSizeValues,\n PartnerLogoSizes,\n} from \"./PartnerLogoTypes\";\n\nconst stylesForSize = (\n height: TypePartnerLogoProps[\"height\"],\n logoSize: TypePartnerLogoSizeValues\n) => css`\n height: ${logoSize ? logoSize : height};\n line-height: ${logoSize ? logoSize : height};\n\n .logo-svg {\n height: ${logoSize ? logoSize : height};\n width: ${logoSize ? logoSize : \"\"};\n }\n`;\n\ninterface ContainerProps\n extends Required<Pick<TypePartnerLogoProps, \"height\" | \"width\">> {\n logoSize: TypePartnerLogoSize;\n}\n\nconst Container = styled(\"span\")<ContainerProps>`\n display: inline-block;\n color: inherit;\n vertical-align: middle;\n ${COMMON}\n ${FLEXBOX}\n ${verticalAlign}\n ${(props) => stylesForSize(props.height, PartnerLogoSizes[props.logoSize])}\n`;\nexport default Container;\n","import * as React from \"react\";\nimport type { EnumLogoNamesWithoutVariants } from \"@sproutsocial/seeds-partner-logos\";\nimport { LogoNamesWithoutVariants } from \"@sproutsocial/seeds-partner-logos\";\nimport type { TypeStyledComponentsCommonProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type {\n TypeSystemCommonProps,\n TypeSystemFlexboxProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\n/**\n * @deprecated Use PartnerLogoNames instead\n */\nexport const PartnerNames = LogoNamesWithoutVariants;\n\n/**\n * @deprecated Use EnumLogoNames instead\n */\nexport type TypePartnerNames = EnumLogoNamesWithoutVariants;\n\nexport const PartnerLogoSizes = {\n mini: \"12px\",\n small: \"16px\",\n medium: \"24px\",\n large: \"32px\",\n jumbo: \"64px\",\n} as const;\n\nexport type TypePartnerLogoSize = keyof typeof PartnerLogoSizes;\nexport type TypePartnerLogoSizeValues =\n (typeof PartnerLogoSizes)[TypePartnerLogoSize];\n\nexport const PartnerLogoTypes = [\"symbol\", \"wordmark\", \"lockup\"] as const;\n\nexport type TypePartnerLogoTypes = (typeof PartnerLogoTypes)[number];\n\nexport interface TypePartnerLogoProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n TypeSystemFlexboxProps,\n Omit<React.ComponentPropsWithoutRef<\"span\">, \"color\"> {\n /** The name of the partner whose logo you want to render. */\n partnerName: EnumLogoNamesWithoutVariants;\n\n /** Manually override the default mode behavior by rendering a logo based on the background it's displayed on. */\n backgroundType?: \"dark\" | \"light\";\n logoType?: TypePartnerLogoTypes;\n height?: string;\n width?: string;\n size?: TypePartnerLogoSize;\n svgProps?: React.ComponentPropsWithoutRef<\"svg\">;\n}\n","/**\n * Tailwind CSS implementation of PartnerLogo component\n * Uses Seeds partner logo CSS classes from partner-logo.css\n */\n\nimport React from \"react\";\nimport type { TypePartnerLogoProps } from \"./PartnerLogoTypes\";\nimport { usePartnerLogoModel } from \"./usePartnerLogoModel\";\n\n// Utility for merging class names properly\nfunction cn(\n ...inputs: (string | undefined | null | false | Record<string, boolean>)[]\n): string {\n const classes: string[] = [];\n\n for (const input of inputs) {\n if (!input) continue;\n\n if (typeof input === \"string\") {\n classes.push(input);\n } else if (typeof input === \"object\") {\n for (const [key, value] of Object.entries(input)) {\n if (value) {\n classes.push(key);\n }\n }\n }\n }\n\n return classes.join(\" \");\n}\n\nexport const PartnerLogoTailwind = React.forwardRef<\n HTMLSpanElement,\n TypePartnerLogoProps\n>(\n (\n {\n partnerName,\n backgroundType,\n logoType = \"symbol\",\n height,\n width,\n size,\n \"aria-label\": ariaLabel,\n svgProps,\n className,\n style: consumerStyle,\n ...rest\n }: TypePartnerLogoProps,\n ref: React.Ref<HTMLSpanElement>\n ) => {\n const {\n logo,\n logoViewBox,\n sizeValue,\n svgWidth,\n containerAriaProps,\n svgAriaProps,\n } = usePartnerLogoModel({\n partnerName,\n backgroundType,\n logoType,\n height,\n width,\n size,\n \"aria-label\": ariaLabel,\n });\n\n // CSS custom-property keys aren't part of CSSProperties — cast is required.\n const sizingStyle = {\n \"--seeds-partner-logo-height\": sizeValue,\n ...(svgWidth ? { \"--seeds-partner-logo-svg-width\": svgWidth } : {}),\n } as React.CSSProperties;\n\n return (\n <span\n ref={ref}\n className={cn(\"seeds-partner-logo\", \"logo\", className)}\n data-qa-logo={partnerName}\n // sizing first so a consumer's unrelated style survives without\n // clobbering the computed size CSS variables\n style={{ ...sizingStyle, ...consumerStyle }}\n {...(rest as React.ComponentPropsWithoutRef<\"span\">)}\n {...containerAriaProps}\n >\n <svg\n className=\"logo-svg\"\n viewBox={logoViewBox}\n focusable={false}\n data-qa-logo-svg={`${partnerName}-svg`}\n {...svgProps}\n {...svgAriaProps}\n >\n <use\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n xlinkHref={`#seeds-svgs_${logo}`}\n />\n </svg>\n </span>\n );\n }\n);\n\nPartnerLogoTailwind.displayName = \"PartnerLogoTailwind\";\n","import { useTheme } from \"styled-components\";\nimport type { TypeTheme } from \"@sproutsocial/seeds-react-theme\";\nimport { ViewBoxes } from \"@sproutsocial/seeds-partner-logos\";\nimport { PartnerLogoSizes } from \"./PartnerLogoTypes\";\nimport type { TypePartnerLogoProps } from \"./PartnerLogoTypes\";\n\nconst whichLogo = (\n {\n backgroundType,\n logoType,\n partnerName,\n }: Pick<TypePartnerLogoProps, \"backgroundType\" | \"logoType\" | \"partnerName\">,\n mode: TypeTheme[\"mode\"]\n) => {\n const logo =\n logoType && logoType !== \"symbol\"\n ? partnerName + \"-\" + logoType\n : partnerName;\n if (backgroundType && backgroundType === \"dark\") {\n return `${logo}-dark`;\n } else if (backgroundType && backgroundType === \"light\") {\n return logo;\n } else if (mode === \"dark\") {\n return `${logo}-dark`;\n } else {\n return logo;\n }\n};\n\n/**\n * Shared compute for both render paths (Tailwind + styled-components).\n *\n * Calls useTheme() so dark-logo selection works identically on both paths, and\n * returns the resolved logo id, viewBox, aria props, and the size values used to\n * drive sizing. Sizing precedence is preserved verbatim from the original\n * stylesForSize block: a logoSize lookup wins over the height prop, and the svg\n * width is the logoSize lookup or empty (which sizes the svg from the viewBox).\n */\nexport const usePartnerLogoModel = ({\n partnerName,\n backgroundType,\n logoType = \"symbol\",\n height,\n width,\n size,\n \"aria-label\": ariaLabel,\n}: TypePartnerLogoProps) => {\n const { mode } = useTheme() as TypeTheme;\n\n const logo = whichLogo({ backgroundType, logoType, partnerName }, mode);\n const logoViewBox = ViewBoxes[logo as keyof typeof ViewBoxes];\n const viewBoxCoordinates = logoViewBox?.split(\" \") || [];\n const defaultSize = logoType === \"symbol\" ? \"small\" : undefined;\n const logoSizeKey = size ?? defaultSize;\n const logoSizePx = logoSizeKey ? PartnerLogoSizes[logoSizeKey] : undefined;\n\n // we add pixels here because view box coordinates are numbers\n const resolvedHeight = height ? height : viewBoxCoordinates[3] + \"px\";\n const resolvedWidth = width ? width : viewBoxCoordinates[2] + \"px\";\n // container height + line-height + svg height: logoSize wins over height\n const sizeValue = logoSizePx ? logoSizePx : resolvedHeight;\n // svg width: logoSize or empty (empty => sizes from viewBox aspect ratio)\n const svgWidth = logoSizePx ? logoSizePx : \"\";\n\n const hasAriaLabel = !!ariaLabel;\n const containerAriaProps = hasAriaLabel ? {} : { \"aria-hidden\": true };\n const svgAriaProps = hasAriaLabel\n ? { role: \"img\", \"aria-label\": ariaLabel }\n : {};\n\n return {\n logo,\n logoViewBox,\n logoSizeKey,\n resolvedHeight,\n resolvedWidth,\n sizeValue,\n svgWidth,\n containerAriaProps,\n svgAriaProps,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAkB;;;ACKlB,IAAAC,gBAAkB;;;ACLlB,+BAA4B;AAC5B,2BAA8B;AAC9B,sCAAgC;;;ACFhC,YAAuB;AAEvB,iCAAyC;AAUlC,IAAM,eAAe;AAOrB,IAAM,mBAAmB;AAAA,EAC9B,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AACT;AAMO,IAAM,mBAAmB,CAAC,UAAU,YAAY,QAAQ;;;ADrB/D,IAAM,gBAAgB,CACpB,QACA,aACG;AAAA,YACO,WAAW,WAAW,MAAM;AAAA,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MAAM;AAAA,YACf,WAAW;AAAA,YACX,oBAAkB,GAAG,WAAW;AAAA,YAC/B,GAAG;AAAA,YACH,GAAG,MAAM;AAAA,YAEV;AAAA,cAAC;AAAA;AAAA,gBACC,YAAW;AAAA,gBACX,WAAW,eAAe,MAAM,IAAI;AAAA;AAAA,YACtC;AAAA;AAAA,QACF;AAAA;AAAA,IACF;AAAA,EAEJ;AAGA,SAAO,6CAAC,uBAAqB,GAAG,OAAO,KAAU;AACnD,CAAC;AAED,kBAAkB,cAAc;AAChC,IAAO,4BAAQ;;;ADnEG,IAAAC,sBAAA;AADlB,IAAM,cAAc,cAAAC,QAAM;AAAA,EACxB,CAAC,OAAO,QAAQ,6CAAC,6BAAmB,GAAG,OAAO,KAAU;AAC1D;AAEA,YAAY,cAAc;AAC1B,IAAO,sBAAQ;;;ADZf,IAAO,gBAAQ;","names":["import_react","import_react","styled","import_styled_components","import_seeds_partner_logos","React","import_seeds_react_system_props","import_jsx_runtime","React","import_jsx_runtime","React"]}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Seeds Partner Logo component classes
3
+ * Use these instead of writing out individual Tailwind utility classes.
4
+ *
5
+ * Ships as a separate CSS file (pulled in by consumers via the package css
6
+ * export) — not imported from TS, matching the Button component.
7
+ *
8
+ * Sizing is runtime-computed (logo size lookup or the height prop), so it is
9
+ * applied through inline CSS custom properties set on the element's style attr:
10
+ * --seeds-partner-logo-height container height + line-height + svg height
11
+ * --seeds-partner-logo-svg-width svg width (unset => auto => sizes from viewBox)
12
+ *
13
+ * Usage:
14
+ * <span class="seeds-partner-logo logo" style="--seeds-partner-logo-height: 16px">
15
+ * <svg class="logo-svg">…</svg>
16
+ * </span>
17
+ */
18
+
19
+ @layer components {
20
+ .seeds-partner-logo {
21
+ display: inline-block;
22
+ color: inherit;
23
+ vertical-align: middle;
24
+ height: var(--seeds-partner-logo-height);
25
+ line-height: var(--seeds-partner-logo-height);
26
+ }
27
+
28
+ .seeds-partner-logo .logo-svg {
29
+ height: var(--seeds-partner-logo-height);
30
+ /* unset => auto => svg sizes from its viewBox aspect ratio,
31
+ matching stylesForSize's empty width declaration */
32
+ width: var(--seeds-partner-logo-svg-width, auto);
33
+ }
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutsocial/seeds-react-partner-logo",
3
- "version": "1.7.15",
3
+ "version": "1.7.17",
4
4
  "description": "Seeds React Partner Logo component",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -10,17 +10,27 @@
10
10
  "files": [
11
11
  "dist"
12
12
  ],
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/esm/index.js",
16
+ "require": "./dist/index.js",
17
+ "types": "./dist/index.d.ts"
18
+ },
19
+ "./dist/partner-logo.css": "./dist/partner-logo.css"
20
+ },
13
21
  "scripts": {
14
- "build": "tsup --dts",
15
- "build:debug": "tsup --dts --metafile",
22
+ "build": "tsup --dts && cp src/partner-logo.css dist/partner-logo.css",
23
+ "build:debug": "tsup --dts --metafile && cp src/partner-logo.css dist/partner-logo.css",
16
24
  "dev": "tsup --watch --dts",
17
25
  "clean": "rm -rf .turbo dist",
18
26
  "clean:modules": "rm -rf node_modules",
19
- "typecheck": "tsc --noEmit"
27
+ "typecheck": "tsc --noEmit",
28
+ "test": "jest",
29
+ "test:watch": "jest --watch --coverage=false"
20
30
  },
21
31
  "dependencies": {
22
- "@sproutsocial/seeds-react-system-props": "^3.1.1",
23
- "@sproutsocial/seeds-react-theme": "^4.2.0",
32
+ "@sproutsocial/seeds-react-system-props": "^3.1.2",
33
+ "@sproutsocial/seeds-react-theme": "^4.2.1",
24
34
  "styled-system": "^5.1.5"
25
35
  },
26
36
  "devDependencies": {
@@ -29,7 +39,9 @@
29
39
  "styled-components": "^5.2.3",
30
40
  "typescript": "^5.6.2",
31
41
  "tsup": "^8.3.4",
32
- "@sproutsocial/seeds-tsconfig": "*"
42
+ "@sproutsocial/seeds-tsconfig": "*",
43
+ "@sproutsocial/seeds-testing": "*",
44
+ "@sproutsocial/seeds-react-testing-library": "*"
33
45
  },
34
46
  "peerDependencies": {
35
47
  "@sproutsocial/seeds-partner-logos": ">=1.5.0",